@ayurak/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.
@@ -0,0 +1,547 @@
1
+ interface HttpClientOptions {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ timeout?: number;
5
+ }
6
+ declare class HttpClient {
7
+ private apiKey;
8
+ private baseUrl;
9
+ private timeout;
10
+ constructor(options: HttpClientOptions);
11
+ private handleResponse;
12
+ private request;
13
+ get(path: string, params?: Record<string, string | number | boolean>): Promise<unknown>;
14
+ post(path: string, body?: Record<string, unknown>, formData?: FormData): Promise<unknown>;
15
+ put(path: string, body?: Record<string, unknown>): Promise<unknown>;
16
+ patch(path: string, body?: Record<string, unknown>): Promise<unknown>;
17
+ delete(path: string): Promise<unknown>;
18
+ }
19
+
20
+ interface AnalyzeDiagramOptions {
21
+ filename?: string;
22
+ analysisDepth?: 'basic' | 'comprehensive' | 'detailed';
23
+ wait?: boolean;
24
+ timeout?: number;
25
+ }
26
+ interface ListDiagramsOptions {
27
+ page?: number;
28
+ limit?: number;
29
+ status?: string;
30
+ search?: string;
31
+ }
32
+ interface Diagram {
33
+ diagram_id: string;
34
+ name: string;
35
+ status: string;
36
+ threat_count?: number;
37
+ component_count?: number;
38
+ created_at: string;
39
+ updated_at: string;
40
+ [key: string]: unknown;
41
+ }
42
+ interface Threat {
43
+ threat_id: string;
44
+ title: string;
45
+ description: string;
46
+ severity: string;
47
+ cvss_score?: number;
48
+ mitigations?: string[];
49
+ [key: string]: unknown;
50
+ }
51
+ interface Component {
52
+ component_id: string;
53
+ name: string;
54
+ type: string;
55
+ connections?: string[];
56
+ [key: string]: unknown;
57
+ }
58
+ /**
59
+ * Threat modeling operations
60
+ */
61
+ declare class ThreatModelingAPI {
62
+ private http;
63
+ constructor(http: HttpClient);
64
+ /**
65
+ * Upload and analyze a diagram for threats
66
+ */
67
+ analyzeDiagram(file: File | Blob, options?: AnalyzeDiagramOptions): Promise<Diagram>;
68
+ private waitForAnalysis;
69
+ /**
70
+ * List diagrams
71
+ */
72
+ list(options?: ListDiagramsOptions): Promise<{
73
+ results: Diagram[];
74
+ count: number;
75
+ next?: string;
76
+ previous?: string;
77
+ }>;
78
+ /**
79
+ * Get diagram details
80
+ */
81
+ get(diagramId: string): Promise<Diagram>;
82
+ /**
83
+ * Get threats for a diagram
84
+ */
85
+ getThreats(diagramId: string): Promise<Threat[]>;
86
+ /**
87
+ * Get components detected in diagram
88
+ */
89
+ getComponents(diagramId: string): Promise<Component[]>;
90
+ /**
91
+ * Run AI-powered analysis on diagram
92
+ */
93
+ analyzeWithAI(diagramId: string, analysisTypes?: string[]): Promise<Record<string, unknown>>;
94
+ /**
95
+ * Delete a diagram
96
+ */
97
+ delete(diagramId: string): Promise<void>;
98
+ /**
99
+ * Get threat modeling dashboard
100
+ */
101
+ dashboard(period?: 'day' | 'week' | 'month' | 'quarter', includeTrends?: boolean): Promise<Record<string, unknown>>;
102
+ }
103
+
104
+ interface ScanOptions$1 {
105
+ standards?: string[];
106
+ includeRecommendations?: boolean;
107
+ }
108
+ interface ComplianceResult {
109
+ scan_id: string;
110
+ overall_score: number;
111
+ standards: {
112
+ standard: string;
113
+ score: number;
114
+ gaps_count: number;
115
+ }[];
116
+ gaps: ComplianceGap[];
117
+ [key: string]: unknown;
118
+ }
119
+ interface ComplianceGap {
120
+ gap_id: string;
121
+ standard: string;
122
+ control_id: string;
123
+ severity: string;
124
+ description: string;
125
+ recommendation?: string;
126
+ [key: string]: unknown;
127
+ }
128
+ interface ComplianceStandard {
129
+ id: string;
130
+ name: string;
131
+ description: string;
132
+ controls_count: number;
133
+ [key: string]: unknown;
134
+ }
135
+ interface Control {
136
+ id: string;
137
+ name: string;
138
+ description: string;
139
+ category?: string;
140
+ severity?: string;
141
+ [key: string]: unknown;
142
+ }
143
+ /**
144
+ * Compliance scanning and reporting
145
+ */
146
+ declare class ComplianceAPI {
147
+ private http;
148
+ constructor(http: HttpClient);
149
+ /**
150
+ * Run compliance scan on a diagram
151
+ */
152
+ scan(diagramId: string, options?: ScanOptions$1): Promise<ComplianceResult>;
153
+ /**
154
+ * Get compliance report for a diagram
155
+ */
156
+ getReport(diagramId: string, format?: 'json' | 'pdf' | 'html'): Promise<Record<string, unknown>>;
157
+ /**
158
+ * List available compliance standards
159
+ */
160
+ listStandards(): Promise<ComplianceStandard[]>;
161
+ /**
162
+ * Get details of a compliance standard
163
+ */
164
+ getStandard(standardId: string): Promise<ComplianceStandard>;
165
+ /**
166
+ * List controls for a compliance standard
167
+ */
168
+ listControls(standardId: string, category?: string): Promise<Control[]>;
169
+ /**
170
+ * Get compliance gaps for a diagram
171
+ */
172
+ getGaps(diagramId: string, standardId?: string): Promise<ComplianceGap[]>;
173
+ /**
174
+ * Create a custom compliance standard
175
+ */
176
+ addCustomStandard(name: string, description: string, controls: {
177
+ id: string;
178
+ name: string;
179
+ description: string;
180
+ severity?: string;
181
+ }[]): Promise<ComplianceStandard>;
182
+ /**
183
+ * Get compliance dashboard metrics
184
+ */
185
+ dashboard(period?: 'day' | 'week' | 'month' | 'quarter'): Promise<Record<string, unknown>>;
186
+ }
187
+
188
+ interface CloudScanOptions {
189
+ provider?: 'aws' | 'azure' | 'gcp';
190
+ regions?: string[];
191
+ services?: string[];
192
+ complianceStandards?: string[];
193
+ }
194
+ interface CloudScan {
195
+ scan_id: string;
196
+ project_id: string;
197
+ provider: string;
198
+ status: string;
199
+ findings_count?: number;
200
+ critical_count?: number;
201
+ high_count?: number;
202
+ created_at: string;
203
+ [key: string]: unknown;
204
+ }
205
+ interface CloudFinding {
206
+ finding_id: string;
207
+ title: string;
208
+ description: string;
209
+ severity: string;
210
+ service: string;
211
+ resource_id?: string;
212
+ status: string;
213
+ remediation?: string;
214
+ [key: string]: unknown;
215
+ }
216
+ interface CloudAccount {
217
+ account_id: string;
218
+ name: string;
219
+ provider: string;
220
+ status: string;
221
+ regions?: string[];
222
+ created_at: string;
223
+ [key: string]: unknown;
224
+ }
225
+ interface ListScansOptions {
226
+ projectId?: string;
227
+ provider?: string;
228
+ status?: string;
229
+ page?: number;
230
+ limit?: number;
231
+ }
232
+ interface GetFindingsOptions {
233
+ severity?: string;
234
+ service?: string;
235
+ status?: string;
236
+ }
237
+ /**
238
+ * Cloud security scanning for AWS, Azure, and GCP
239
+ */
240
+ declare class CloudSecurityAPI {
241
+ private http;
242
+ constructor(http: HttpClient);
243
+ /**
244
+ * Run cloud security scan
245
+ */
246
+ scan(projectId: string, options?: CloudScanOptions): Promise<CloudScan>;
247
+ /**
248
+ * Get scan details and results
249
+ */
250
+ getScan(scanId: string): Promise<CloudScan>;
251
+ /**
252
+ * List cloud security scans
253
+ */
254
+ listScans(options?: ListScansOptions): Promise<{
255
+ results: CloudScan[];
256
+ count: number;
257
+ }>;
258
+ /**
259
+ * Get findings from a scan
260
+ */
261
+ getFindings(scanId: string, options?: GetFindingsOptions): Promise<CloudFinding[]>;
262
+ /**
263
+ * Connect a cloud account for scanning
264
+ */
265
+ connectAccount(provider: 'aws' | 'azure' | 'gcp', credentials: Record<string, string>, options?: {
266
+ name?: string;
267
+ regions?: string[];
268
+ }): Promise<CloudAccount>;
269
+ /**
270
+ * List connected cloud accounts
271
+ */
272
+ listAccounts(provider?: string): Promise<CloudAccount[]>;
273
+ /**
274
+ * Disconnect a cloud account
275
+ */
276
+ deleteAccount(accountId: string): Promise<void>;
277
+ /**
278
+ * Mark a finding as resolved
279
+ */
280
+ resolveFinding(findingId: string, resolution: 'fixed' | 'accepted' | 'false_positive', notes?: string): Promise<CloudFinding>;
281
+ /**
282
+ * Suppress a finding
283
+ */
284
+ suppressFinding(findingId: string, reason: string, durationDays?: number): Promise<CloudFinding>;
285
+ /**
286
+ * Get remediation steps for a finding
287
+ */
288
+ getRemediation(findingId: string): Promise<{
289
+ steps: string[];
290
+ code_examples?: Record<string, string>;
291
+ }>;
292
+ /**
293
+ * Get cloud security dashboard
294
+ */
295
+ dashboard(projectId?: string, period?: 'day' | 'week' | 'month' | 'quarter'): Promise<Record<string, unknown>>;
296
+ }
297
+
298
+ interface CreateProjectOptions {
299
+ repositoryUrl?: string;
300
+ defaultBranch?: string;
301
+ scanTypes?: ('sast' | 'sca' | 'secrets' | 'iac')[];
302
+ }
303
+ interface ScanOptions {
304
+ commitSha?: string;
305
+ branch?: string;
306
+ scanTypes?: ('sast' | 'sca' | 'secrets' | 'iac')[];
307
+ failOnSeverity?: 'critical' | 'high' | 'medium' | 'low';
308
+ wait?: boolean;
309
+ timeout?: number;
310
+ }
311
+ interface Project {
312
+ project_id: string;
313
+ name: string;
314
+ repository_url?: string;
315
+ default_branch: string;
316
+ scan_types: string[];
317
+ created_at: string;
318
+ [key: string]: unknown;
319
+ }
320
+ interface PipelineScan {
321
+ scan_id: string;
322
+ project_id: string;
323
+ commit_sha?: string;
324
+ branch?: string;
325
+ status: string;
326
+ findings_count?: number;
327
+ blocking_findings?: Finding[];
328
+ summary?: string;
329
+ created_at: string;
330
+ [key: string]: unknown;
331
+ }
332
+ interface Finding {
333
+ finding_id: string;
334
+ type: string;
335
+ title: string;
336
+ description: string;
337
+ severity: string;
338
+ file_path?: string;
339
+ line_number?: number;
340
+ [key: string]: unknown;
341
+ }
342
+ interface GatesConfig {
343
+ fail_on_critical?: boolean;
344
+ fail_on_high?: boolean;
345
+ max_high_findings?: number;
346
+ block_secrets?: boolean;
347
+ required_scan_types?: string[];
348
+ [key: string]: unknown;
349
+ }
350
+ /**
351
+ * CI/CD pipeline security scanning
352
+ */
353
+ declare class PipelineAPI {
354
+ private http;
355
+ constructor(http: HttpClient);
356
+ /**
357
+ * Create a pipeline project
358
+ */
359
+ createProject(name: string, options?: CreateProjectOptions): Promise<Project>;
360
+ /**
361
+ * List pipeline projects
362
+ */
363
+ listProjects(page?: number, limit?: number): Promise<{
364
+ results: Project[];
365
+ count: number;
366
+ }>;
367
+ /**
368
+ * Get project details
369
+ */
370
+ getProject(projectId: string): Promise<Project>;
371
+ /**
372
+ * Delete a pipeline project
373
+ */
374
+ deleteProject(projectId: string): Promise<void>;
375
+ /**
376
+ * Run pipeline security scan
377
+ */
378
+ scan(projectId: string, options?: ScanOptions): Promise<PipelineScan>;
379
+ private waitForScan;
380
+ /**
381
+ * Get scan details and results
382
+ */
383
+ getScan(scanId: string): Promise<PipelineScan>;
384
+ /**
385
+ * List pipeline scans
386
+ */
387
+ listScans(options?: {
388
+ projectId?: string;
389
+ status?: string;
390
+ branch?: string;
391
+ page?: number;
392
+ limit?: number;
393
+ }): Promise<{
394
+ results: PipelineScan[];
395
+ count: number;
396
+ }>;
397
+ /**
398
+ * Get findings from a scan
399
+ */
400
+ getFindings(scanId: string, options?: {
401
+ scanType?: string;
402
+ severity?: string;
403
+ }): Promise<Finding[]>;
404
+ /**
405
+ * Get SAST (static analysis) findings
406
+ */
407
+ getSastFindings(scanId: string): Promise<Finding[]>;
408
+ /**
409
+ * Get SCA (dependency) findings
410
+ */
411
+ getScaFindings(scanId: string): Promise<Finding[]>;
412
+ /**
413
+ * Get secrets detection findings
414
+ */
415
+ getSecretsFindings(scanId: string): Promise<Finding[]>;
416
+ /**
417
+ * Configure security gates for a project
418
+ */
419
+ configureGates(projectId: string, gates: GatesConfig): Promise<Project>;
420
+ /**
421
+ * Set scan as baseline (suppress existing findings)
422
+ */
423
+ addBaseline(projectId: string, scanId: string): Promise<Project>;
424
+ /**
425
+ * Suppress a finding
426
+ */
427
+ suppressFinding(findingId: string, reason: string, expiresAt?: string): Promise<Finding>;
428
+ /**
429
+ * Get pipeline security dashboard
430
+ */
431
+ dashboard(projectId?: string, period?: 'day' | 'week' | 'month' | 'quarter'): Promise<Record<string, unknown>>;
432
+ }
433
+
434
+ interface AribotOptions {
435
+ baseUrl?: string;
436
+ timeout?: number;
437
+ }
438
+ /**
439
+ * Aribot Security Platform client by Aristiun & Ayurak
440
+ *
441
+ * Provides access to threat modeling, compliance scanning,
442
+ * cloud security, and pipeline security APIs.
443
+ *
444
+ * @example
445
+ * ```typescript
446
+ * import { Aribot } from 'aribot-sdk';
447
+ *
448
+ * const client = new Aribot('your_api_key');
449
+ *
450
+ * // Threat modeling
451
+ * const result = await client.threatModeling.analyzeDiagram(file);
452
+ * const threats = await client.threatModeling.getThreats(result.diagram_id);
453
+ *
454
+ * // Compliance scanning
455
+ * const compliance = await client.compliance.scan(diagramId, {
456
+ * standards: ['ISO27001']
457
+ * });
458
+ *
459
+ * // Cloud security
460
+ * const scan = await client.cloud.scan('aws-123456');
461
+ *
462
+ * // Pipeline security
463
+ * const result = await client.pipeline.scan(projectId, {
464
+ * commitSha: 'abc123'
465
+ * });
466
+ * ```
467
+ */
468
+ declare class Aribot {
469
+ private http;
470
+ /** Threat modeling operations */
471
+ threatModeling: ThreatModelingAPI;
472
+ /** Compliance scanning and reporting */
473
+ compliance: ComplianceAPI;
474
+ /** Cloud security scanning */
475
+ cloud: CloudSecurityAPI;
476
+ /** Pipeline security scanning */
477
+ pipeline: PipelineAPI;
478
+ /**
479
+ * Create Aribot client
480
+ *
481
+ * @param apiKey - Your Aribot API key
482
+ * @param options - Client configuration options
483
+ */
484
+ constructor(apiKey: string, options?: AribotOptions);
485
+ /**
486
+ * Check API health status
487
+ */
488
+ health(): Promise<{
489
+ status: string;
490
+ version: string;
491
+ }>;
492
+ /**
493
+ * Get current user/organization info
494
+ */
495
+ me(): Promise<Record<string, unknown>>;
496
+ /**
497
+ * Get API usage statistics
498
+ */
499
+ usage(period?: 'day' | 'week' | 'month'): Promise<{
500
+ calls_used: number;
501
+ calls_limit: number;
502
+ period: string;
503
+ }>;
504
+ }
505
+
506
+ /**
507
+ * Base error for Aribot SDK
508
+ */
509
+ declare class AribotError extends Error {
510
+ statusCode?: number;
511
+ response?: Record<string, unknown>;
512
+ constructor(message: string, statusCode?: number, response?: Record<string, unknown>);
513
+ }
514
+ /**
515
+ * Invalid or missing API key
516
+ */
517
+ declare class AuthenticationError extends AribotError {
518
+ constructor(message: string, statusCode?: number, response?: Record<string, unknown>);
519
+ }
520
+ /**
521
+ * API rate limit exceeded
522
+ */
523
+ declare class RateLimitError extends AribotError {
524
+ retryAfter?: number;
525
+ constructor(message: string, retryAfter?: number, statusCode?: number, response?: Record<string, unknown>);
526
+ }
527
+ /**
528
+ * Invalid request parameters
529
+ */
530
+ declare class ValidationError extends AribotError {
531
+ errors: unknown[];
532
+ constructor(message: string, errors?: unknown[], statusCode?: number, response?: Record<string, unknown>);
533
+ }
534
+ /**
535
+ * Resource not found
536
+ */
537
+ declare class NotFoundError extends AribotError {
538
+ constructor(message: string, statusCode?: number, response?: Record<string, unknown>);
539
+ }
540
+ /**
541
+ * Server-side error
542
+ */
543
+ declare class ServerError extends AribotError {
544
+ constructor(message: string, statusCode?: number, response?: Record<string, unknown>);
545
+ }
546
+
547
+ export { type AnalyzeDiagramOptions, Aribot, AribotError, type AribotOptions, AuthenticationError, type CloudAccount, type CloudFinding, type CloudScan, type CloudScanOptions, CloudSecurityAPI, ComplianceAPI, type ComplianceGap, type ComplianceResult, type ScanOptions$1 as ComplianceScanOptions, type ComplianceStandard, type Component, type Control, type CreateProjectOptions, type Diagram, type Finding, type GatesConfig, type GetFindingsOptions, type ListDiagramsOptions, type ListScansOptions, NotFoundError, PipelineAPI, type PipelineScan, type ScanOptions as PipelineScanOptions, type Project, RateLimitError, ServerError, type Threat, ThreatModelingAPI, ValidationError };