@orion-belt/sdk 0.0.0-stage → 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,580 @@
1
+ export type LoginUser = {
2
+ id?: string;
3
+ username?: string;
4
+ email?: string;
5
+ is_admin?: boolean;
6
+ role?: string;
7
+ mfa_enabled?: boolean;
8
+ password_set?: boolean;
9
+ must_set_password?: boolean;
10
+ };
11
+ export type PasswordLoginResult = {
12
+ session_token?: string;
13
+ access_token?: string;
14
+ expires_at?: string;
15
+ user?: LoginUser;
16
+ };
17
+ export type APIKeyLoginResult = {
18
+ api_key?: string;
19
+ expires_at?: string;
20
+ user?: LoginUser;
21
+ };
22
+ export type JWTLoginResult = {
23
+ access_token?: string;
24
+ token_type?: string;
25
+ expires_at?: string;
26
+ user?: LoginUser;
27
+ };
28
+ export type AuthUser = {
29
+ id?: string;
30
+ username?: string;
31
+ email?: string;
32
+ public_key?: string;
33
+ is_admin?: boolean;
34
+ role?: string;
35
+ mfa_enabled?: boolean;
36
+ webauthn_enabled?: boolean;
37
+ password_set?: boolean;
38
+ must_set_password?: boolean;
39
+ created_at?: string;
40
+ updated_at?: string;
41
+ };
42
+ export type User = {
43
+ id?: string;
44
+ username?: string;
45
+ email?: string;
46
+ public_key?: string;
47
+ is_admin?: boolean;
48
+ role?: string;
49
+ mfa_enabled?: boolean;
50
+ webauthn_enabled?: boolean;
51
+ created_at?: string;
52
+ updated_at?: string;
53
+ };
54
+ export type Machine = {
55
+ id?: string;
56
+ name?: string;
57
+ hostname?: string;
58
+ port?: number;
59
+ tags?: Record<string, string>;
60
+ agent_id?: string;
61
+ is_active?: boolean;
62
+ last_seen_at?: string;
63
+ created_at?: string;
64
+ updated_at?: string;
65
+ };
66
+ export type RiskSignals = {
67
+ source_ip?: string;
68
+ device?: string;
69
+ auth_method?: string;
70
+ mfa_enrolled?: boolean;
71
+ hour_utc?: number;
72
+ weekday?: string;
73
+ target_sensitivity?: string;
74
+ collected_at?: string;
75
+ };
76
+ export type RiskDecision = {
77
+ outcome?: string;
78
+ reasons?: string[];
79
+ };
80
+ export type AccessRequest = {
81
+ id?: string;
82
+ user_id?: string;
83
+ machine_id?: string;
84
+ remote_users?: string[];
85
+ access_type?: string;
86
+ reason?: string;
87
+ duration?: number;
88
+ status?: string;
89
+ requested_at?: string;
90
+ reviewed_at?: string;
91
+ reviewed_by?: string;
92
+ expires_at?: string;
93
+ risk_signals?: RiskSignals;
94
+ risk_decision?: RiskDecision;
95
+ };
96
+ export type Session = {
97
+ id?: string;
98
+ user_id?: string;
99
+ machine_id?: string;
100
+ remote_user?: string;
101
+ source?: string;
102
+ start_time?: string;
103
+ end_time?: string;
104
+ recording_path?: string;
105
+ status?: string;
106
+ created_at?: string;
107
+ };
108
+ export type AuditLog = {
109
+ id?: string;
110
+ user_id?: string;
111
+ action?: string;
112
+ resource?: string;
113
+ metadata?: Record<string, unknown>;
114
+ ip_address?: string;
115
+ timestamp?: string;
116
+ };
117
+ export type Notification = {
118
+ id?: string;
119
+ user_id?: string;
120
+ type?: string;
121
+ title?: string;
122
+ body?: string;
123
+ metadata?: Record<string, unknown>;
124
+ read_at?: string;
125
+ created_at?: string;
126
+ };
127
+ export type NotificationPrefs = {
128
+ user_id?: string;
129
+ in_app_enabled?: boolean;
130
+ email_enabled?: boolean;
131
+ event_types?: string[];
132
+ };
133
+ export type NotificationPrefsResult = NotificationPrefs & {
134
+ allowed_channels?: string[];
135
+ mandatory_events?: Record<string, string[]>;
136
+ adjusted?: boolean;
137
+ };
138
+ export type NotificationPolicy = {
139
+ allowed_channels?: string[];
140
+ mandatory_events?: Record<string, string[]>;
141
+ updated_at?: string;
142
+ };
143
+ export type NotificationPolicyResult = {
144
+ policy?: NotificationPolicy;
145
+ known_channels?: string[];
146
+ known_events?: string[];
147
+ };
148
+ export type NotificationTemplate = {
149
+ event_type?: string;
150
+ title?: string;
151
+ body?: string;
152
+ updated_at?: string;
153
+ };
154
+ export type NotificationTemplateEntry = NotificationTemplate & {
155
+ customized?: boolean;
156
+ default_title?: string;
157
+ default_body?: string;
158
+ placeholders?: string[];
159
+ };
160
+ export type HourRange = {
161
+ start: number;
162
+ end: number;
163
+ };
164
+ export type AutoApproveRule = {
165
+ enabled?: boolean;
166
+ max_sensitivity?: string;
167
+ max_duration_seconds?: number;
168
+ hours_utc?: HourRange;
169
+ source_cidrs?: string[];
170
+ require_mfa?: boolean;
171
+ remote_users?: string[];
172
+ };
173
+ export type EscalateRule = {
174
+ enabled?: boolean;
175
+ sensitivities?: string[];
176
+ outside_hours_utc?: HourRange;
177
+ without_mfa?: boolean;
178
+ source_outside_cidrs?: string[];
179
+ };
180
+ export type RiskPolicy = {
181
+ auto_approve?: AutoApproveRule;
182
+ escalate?: EscalateRule;
183
+ updated_at?: string;
184
+ updated_by?: string;
185
+ };
186
+ export type AccessAnomaly = {
187
+ id?: string;
188
+ kind?: string;
189
+ signal?: string;
190
+ user_id?: string;
191
+ machine_id?: string;
192
+ machine?: string;
193
+ remote_user?: string;
194
+ session_id?: string;
195
+ ip_address?: string;
196
+ flagged_at?: string;
197
+ };
198
+ export type AccessLink = {
199
+ relation?: string;
200
+ ref?: string;
201
+ holds?: boolean;
202
+ detail?: string;
203
+ via?: string;
204
+ reason?: string;
205
+ granted_by?: string;
206
+ at?: string;
207
+ expires_at?: string;
208
+ };
209
+ export type AccessExplanation = {
210
+ allowed?: boolean;
211
+ summary?: string;
212
+ user_id?: string;
213
+ username?: string;
214
+ machine_id?: string;
215
+ machine?: string;
216
+ access_type?: string;
217
+ remote_user?: string;
218
+ chain?: AccessLink[];
219
+ };
220
+ export type APIKey = {
221
+ id?: string;
222
+ user_id?: string;
223
+ name?: string;
224
+ key_prefix?: string;
225
+ last_used_at?: string;
226
+ expires_at?: string;
227
+ created_at?: string;
228
+ revoked_at?: string;
229
+ };
230
+ export type CreateAPIKeyResponse = {
231
+ id?: string;
232
+ name?: string;
233
+ api_key?: string;
234
+ key_prefix?: string;
235
+ expires_at?: string;
236
+ created_at?: string;
237
+ };
238
+ export type Permission = {
239
+ id?: string;
240
+ user_id?: string;
241
+ machine_id?: string;
242
+ access_type?: string;
243
+ remote_users?: string[];
244
+ granted_by?: string;
245
+ granted_at?: string;
246
+ expires_at?: string;
247
+ };
248
+ export type EffectiveAccess = {
249
+ user_id?: string;
250
+ username?: string;
251
+ machine_id?: string;
252
+ machine_name?: string;
253
+ access_type?: string;
254
+ remote_users?: string[];
255
+ source?: string;
256
+ expires_at?: string;
257
+ };
258
+ export type BulkFailure = {
259
+ user_id?: string;
260
+ machine_id?: string;
261
+ permission_id?: string;
262
+ error?: string;
263
+ };
264
+ export type BulkResult = {
265
+ granted?: number;
266
+ revoked?: number;
267
+ failed?: BulkFailure[];
268
+ };
269
+ export type Capability = {
270
+ id?: string;
271
+ machine_id?: string;
272
+ machine_name?: string;
273
+ hostname?: string;
274
+ port?: number;
275
+ machine_active?: boolean;
276
+ tags?: Record<string, string>;
277
+ remote_user?: string;
278
+ access_type?: string;
279
+ status?: string;
280
+ source?: string;
281
+ reason?: string;
282
+ permission_id?: string;
283
+ request_id?: string;
284
+ expires_at?: string;
285
+ last_used_at?: string;
286
+ };
287
+ export type CapabilityCatalog = {
288
+ user_id?: string;
289
+ scope?: string;
290
+ generated_at?: string;
291
+ truncated?: boolean;
292
+ capabilities?: Capability[];
293
+ };
294
+ export type SetupSteps = {
295
+ admin_exists?: boolean;
296
+ has_machines?: boolean;
297
+ has_connected_agents?: boolean;
298
+ has_users?: boolean;
299
+ has_permissions?: boolean;
300
+ };
301
+ export type SetupCounts = {
302
+ admins?: number;
303
+ users?: number;
304
+ machines?: number;
305
+ connected_agents?: number;
306
+ permissions?: number;
307
+ };
308
+ export type SetupStatus = {
309
+ complete?: boolean;
310
+ steps?: SetupSteps;
311
+ counts?: SetupCounts;
312
+ next?: string;
313
+ };
314
+ export type AccessVolume = {
315
+ sessions_total?: number;
316
+ sessions_active?: number;
317
+ requests_total?: number;
318
+ requests_pending?: number;
319
+ requests_approved?: number;
320
+ requests_rejected?: number;
321
+ };
322
+ export type ApprovalLatency = {
323
+ sample_size?: number;
324
+ average_seconds?: number;
325
+ p50_seconds?: number;
326
+ p95_seconds?: number;
327
+ };
328
+ export type TopTarget = {
329
+ machine_id?: string;
330
+ machine_name?: string;
331
+ session_count?: number;
332
+ };
333
+ export type UsageDashboard = {
334
+ window_hours?: number;
335
+ from?: string;
336
+ to?: string;
337
+ generated_at?: string;
338
+ access_volume?: AccessVolume;
339
+ approval_latency?: ApprovalLatency;
340
+ top_targets?: TopTarget[];
341
+ };
342
+ export type GatewayInfo = {
343
+ public_url?: string;
344
+ ui_url?: string;
345
+ ssh_host?: string;
346
+ ssh_port?: number;
347
+ api_port?: number;
348
+ public_ssh_host?: string;
349
+ public_ssh_port?: number;
350
+ };
351
+ export type VersionInfo = {
352
+ version?: string;
353
+ commit?: string;
354
+ date?: string;
355
+ display?: string;
356
+ };
357
+ export type TrustedCA = {
358
+ enabled?: boolean;
359
+ user_ca?: string;
360
+ host_ca?: string;
361
+ };
362
+ export type IssuedCert = {
363
+ certificate?: string;
364
+ serial?: string;
365
+ expires_at?: string;
366
+ };
367
+ export type SSHCertificate = {
368
+ id?: string;
369
+ serial?: string;
370
+ cert_type?: string;
371
+ subject_id?: string;
372
+ key_id?: string;
373
+ principals?: string[];
374
+ public_key_fingerprint?: string;
375
+ issued_at?: string;
376
+ expires_at?: string;
377
+ revoked_at?: string;
378
+ revoked_by?: string;
379
+ revoke_reason?: string;
380
+ };
381
+ export type SSHKey = {
382
+ id?: string;
383
+ user_id?: string;
384
+ name?: string;
385
+ public_key?: string;
386
+ key_type?: string;
387
+ created_at?: string;
388
+ };
389
+ export type BootstrapCode = {
390
+ code?: string;
391
+ expires_at?: string;
392
+ };
393
+ export type PluginConfigField = {
394
+ key?: string;
395
+ label?: string;
396
+ type?: string;
397
+ secret?: boolean;
398
+ required?: boolean;
399
+ placeholder?: string;
400
+ help?: string;
401
+ fields?: PluginConfigField[];
402
+ };
403
+ export type PluginInfo = {
404
+ name?: string;
405
+ version?: string;
406
+ enabled?: boolean;
407
+ configured?: boolean;
408
+ last_error?: string;
409
+ config?: Record<string, unknown>;
410
+ has_webhook?: boolean;
411
+ schema?: PluginConfigField[];
412
+ };
413
+ export type PluginConfigResult = {
414
+ plugin?: PluginInfo;
415
+ configure_error?: string;
416
+ };
417
+ export type AgentInstallScriptResponse = {
418
+ script?: string;
419
+ machine_id?: string;
420
+ user_id?: string;
421
+ agent_name?: string;
422
+ public_key?: string;
423
+ filename?: string;
424
+ message?: string;
425
+ unsigned_build?: boolean;
426
+ };
427
+ export type RegisterAgentResponse = {
428
+ user_id?: string;
429
+ machine_id?: string;
430
+ message?: string;
431
+ host_certificate?: string;
432
+ host_ca_public_key?: string;
433
+ };
434
+ export type RegisterClientResponse = {
435
+ user_id?: string;
436
+ message?: string;
437
+ };
438
+ export type MFAEnrollResponse = {
439
+ secret?: string;
440
+ otpauth_url?: string;
441
+ backup_codes?: string[];
442
+ message?: string;
443
+ };
444
+ export type MFAStatus = {
445
+ mfa_enabled?: boolean;
446
+ mfa_required?: boolean;
447
+ };
448
+ export type WebAuthnCredential = {
449
+ id?: string;
450
+ name?: string;
451
+ created_at?: string;
452
+ cred_id?: string;
453
+ };
454
+ export type FileEntry = {
455
+ name?: string;
456
+ path?: string;
457
+ is_dir?: boolean;
458
+ size?: number;
459
+ mtime?: number;
460
+ };
461
+ export type FileListResponse = {
462
+ path?: string;
463
+ entries?: FileEntry[];
464
+ raw?: string;
465
+ };
466
+ export type FileUploadResponse = {
467
+ message?: string;
468
+ path?: string;
469
+ size?: number;
470
+ };
471
+ export type KubeBinding = {
472
+ name?: string;
473
+ namespace?: string;
474
+ cluster_role?: string;
475
+ subject?: string;
476
+ user?: string;
477
+ permission_id?: string;
478
+ expires_at?: string;
479
+ };
480
+ export type KubePlan = {
481
+ create?: KubeBinding[];
482
+ update?: KubeBinding[];
483
+ delete?: KubeBinding[];
484
+ };
485
+ export type KubeReconcileResult = {
486
+ machine_id?: string;
487
+ dry_run?: boolean;
488
+ in_sync?: boolean;
489
+ plan?: KubePlan;
490
+ };
491
+ export type CreateAPIKeyRequest = {
492
+ name?: string;
493
+ /** Lifetime in DAYS, not seconds. Leave it out for a key that never expires. */
494
+ expires_in?: number;
495
+ };
496
+ export type CreateAccessRequestRequest = {
497
+ machine_id?: string;
498
+ reason?: string;
499
+ /** Seconds. */
500
+ duration?: number;
501
+ access_type?: string;
502
+ remote_users?: string[];
503
+ };
504
+ export type CreateUserRequest = {
505
+ username?: string;
506
+ email?: string;
507
+ public_key?: string;
508
+ role?: string;
509
+ is_admin?: boolean;
510
+ };
511
+ export type UpdateUserRequest = {
512
+ email?: string;
513
+ public_key?: string;
514
+ is_admin?: boolean;
515
+ role?: string;
516
+ };
517
+ export type CreateMachineRequest = {
518
+ name?: string;
519
+ hostname?: string;
520
+ port?: number;
521
+ tags?: Record<string, string>;
522
+ agent_id?: string;
523
+ is_active?: boolean;
524
+ };
525
+ export type UpdateMachineRequest = {
526
+ name?: string;
527
+ hostname?: string;
528
+ port?: number;
529
+ tags?: Record<string, string>;
530
+ agent_id?: string;
531
+ is_active?: boolean;
532
+ };
533
+ export type GrantPermissionRequest = {
534
+ user_id?: string;
535
+ machine_id?: string;
536
+ access_type?: string;
537
+ remote_users?: string[];
538
+ expires_at?: string;
539
+ duration_seconds?: number;
540
+ };
541
+ export type UpdatePermissionRequest = {
542
+ access_type?: string;
543
+ remote_users?: string[];
544
+ expires_at?: string;
545
+ duration_seconds?: number;
546
+ };
547
+ export type BulkGrantRequest = {
548
+ user_ids?: string[];
549
+ machine_ids?: string[];
550
+ access_type?: string;
551
+ remote_users?: string[];
552
+ expires_at?: string;
553
+ duration_seconds?: number;
554
+ };
555
+ export type AgentInstallScriptRequest = {
556
+ name?: string;
557
+ hostname?: string;
558
+ port?: number;
559
+ tags?: Record<string, string>;
560
+ os?: string;
561
+ gateway_host?: string;
562
+ gateway_port?: number;
563
+ package_base_url?: string;
564
+ version?: string;
565
+ /** The server audits it. */
566
+ allow_unsigned_build?: boolean;
567
+ };
568
+ export type RegisterAgentRequest = {
569
+ name?: string;
570
+ hostname?: string;
571
+ port?: number;
572
+ public_key?: string;
573
+ tags?: Record<string, string>;
574
+ };
575
+ export type RegisterClientRequest = {
576
+ username?: string;
577
+ email?: string;
578
+ public_key?: string;
579
+ is_admin?: boolean;
580
+ };
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ // Response and request shapes for the Orion Belt API, kept in step with
2
+ // sdk/python/src/orion_belt_sdk/types.py. Timestamps are the RFC 3339 strings
3
+ // the server sends. Fields are optional because the server omits empty
4
+ // optional fields; request fields left out are not sent, which is how the
5
+ // update endpoints tell "unchanged" from "cleared".
6
+ export {};
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@orion-belt/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "TypeScript client for the Orion Belt API",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "author": "Orion Belt Maintainers",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/orion-belt-dev/orion-belt.git",
10
+ "directory": "sdk/js"
11
+ },
12
+ "homepage": "https://github.com/orion-belt-dev/orion-belt/tree/master/sdk/js",
13
+ "bugs": "https://github.com/orion-belt-dev/orion-belt/issues",
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "sideEffects": false,
27
+ "engines": {
28
+ "node": ">=20"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": true
33
+ },
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.json",
36
+ "check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
37
+ "lint": "oxlint --deny-warnings src test",
38
+ "clean": "rm -rf dist build-test",
39
+ "pretest": "rm -rf build-test && tsc -p tsconfig.test.json",
40
+ "test": "node --test --experimental-test-coverage --test-coverage-include='build-test/src/**' --test-coverage-lines=90 --test-coverage-branches=90 'build-test/test/**/*.test.js'",
41
+ "prepack": "npm run clean && npm run build"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "26.6.6",
45
+ "oxlint": "1.91.0",
46
+ "typescript": "7.0.2"
47
+ }
48
+ }