@orion-belt/sdk 1.1.0 → 1.2.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/client.d.ts +26 -1
- package/dist/client.js +48 -0
- package/dist/types.d.ts +57 -0
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccessAnomaly, AccessExplanation, AccessRequest, AgentInstallScriptRequest, AgentInstallScriptResponse, APIKey, APIKeyLoginResult, AuditLog, AuthUser, BootstrapCode, BulkGrantRequest, BulkResult, CapabilityCatalog, CreateAccessRequestRequest, CreateAPIKeyRequest, CreateAPIKeyResponse, CreateMachineRequest, CreateUserRequest, EffectiveAccess, FileListResponse, FileUploadResponse, GatewayInfo, GrantPermissionRequest, IssuedCert, JWTLoginResult, KubeReconcileResult, Machine, MFAEnrollResponse, MFAStatus, Notification, NotificationPolicy, NotificationPolicyResult, NotificationPrefs, NotificationPrefsResult, NotificationTemplate, NotificationTemplateEntry, PasswordLoginResult, Permission, PluginConfigResult, PluginInfo, RegisterAgentRequest, RegisterAgentResponse, RegisterClientRequest, RegisterClientResponse, RiskPolicy, Session, SetupStatus, SSHCertificate, SSHKey, TrustedCA, UpdateMachineRequest, UpdatePermissionRequest, UpdateUserRequest, UsageDashboard, User, VersionInfo, WebAuthnCredential } from './types.js';
|
|
1
|
+
import type { AccessAnomaly, AccessExplanation, AccessRequest, AgentInstallScriptRequest, AgentInstallScriptResponse, APIKey, APIKeyLoginResult, AuditLog, AuthUser, BootstrapCode, BulkGrantRequest, BulkResult, CapabilityCatalog, CapabilityDefinition, CapabilityDefinitionInput, CapabilityVersion, CreateAccessRequestRequest, CreateAPIKeyRequest, CreateAPIKeyResponse, CreateMachineRequest, CreateUserRequest, EffectiveAccess, FileListResponse, FileUploadResponse, GatewayInfo, GrantPermissionRequest, IssuedCert, JWTLoginResult, KubeReconcileResult, Machine, MFAEnrollResponse, MFAStatus, Notification, NotificationPolicy, NotificationPolicyResult, NotificationPrefs, NotificationPrefsResult, NotificationTemplate, NotificationTemplateEntry, OIDCInfo, PasswordLoginResult, Permission, PluginConfigResult, PluginInfo, RegisterAgentRequest, RegisterAgentResponse, RegisterClientRequest, RegisterClientResponse, RiskPolicy, Session, SetupStatus, SSHCertificate, SSHKey, TicketPolicy, TrustedCA, UpdateMachineRequest, UpdatePermissionRequest, UpdateUserRequest, UsageDashboard, User, VersionInfo, WebAuthnCredential } from './types.js';
|
|
2
2
|
export type ClientOptions = {
|
|
3
3
|
/** Server base URL, e.g. https://pam.example.com. */
|
|
4
4
|
baseUrl: string;
|
|
@@ -81,6 +81,13 @@ export declare class OrionBeltClient {
|
|
|
81
81
|
private storeSession;
|
|
82
82
|
/** Addresses the gateway advertises to clients and agents. Needs no credentials. */
|
|
83
83
|
getGatewayInfo(): Promise<GatewayInfo>;
|
|
84
|
+
/** Whether the web console offers single sign-on, and how to start it. Needs no credentials. */
|
|
85
|
+
getOidcInfo(): Promise<OIDCInfo>;
|
|
86
|
+
/**
|
|
87
|
+
* Where a browser starts single sign-on. The login and its callback are browser
|
|
88
|
+
* redirects that set and check a cookie, so the SDK gives the URL to open.
|
|
89
|
+
*/
|
|
90
|
+
oidcLoginUrl(): string;
|
|
84
91
|
/** The server's build version. Needs no credentials. */
|
|
85
92
|
getVersion(): Promise<VersionInfo>;
|
|
86
93
|
/** The server's OpenAPI 3 document, as YAML text. */
|
|
@@ -184,6 +191,24 @@ export declare class OrionBeltClient {
|
|
|
184
191
|
getRiskPolicy(): Promise<RiskPolicy>;
|
|
185
192
|
/** Replaces the risk policy outright; send the whole document. */
|
|
186
193
|
putRiskPolicy(policy: RiskPolicy): Promise<RiskPolicy>;
|
|
194
|
+
/** Whether access requests must name a change ticket, and in what format. */
|
|
195
|
+
getTicketPolicy(): Promise<TicketPolicy>;
|
|
196
|
+
/** Replaces the ticket policy outright (admin only). */
|
|
197
|
+
putTicketPolicy(policy: TicketPolicy): Promise<TicketPolicy>;
|
|
198
|
+
/** Capability definitions by name; archived ones only with `includeArchived`. */
|
|
199
|
+
listCapabilityDefinitions(includeArchived?: boolean): Promise<CapabilityDefinition[]>;
|
|
200
|
+
/** A capability definition in its current version. */
|
|
201
|
+
getCapabilityDefinition(id: string): Promise<CapabilityDefinition>;
|
|
202
|
+
/** Every version of a definition, newest first. */
|
|
203
|
+
listCapabilityVersions(id: string): Promise<CapabilityVersion[]>;
|
|
204
|
+
/** One version of a definition, archived or not. */
|
|
205
|
+
getCapabilityVersion(id: string, version: number): Promise<CapabilityVersion>;
|
|
206
|
+
/** Stores a new definition as version 1 (admins and operators). */
|
|
207
|
+
createCapabilityDefinition(definition: CapabilityDefinitionInput): Promise<CapabilityDefinition>;
|
|
208
|
+
/** Replaces a definition, adding a version; `definition.version` must be the current one. */
|
|
209
|
+
updateCapabilityDefinition(id: string, definition: CapabilityDefinitionInput): Promise<CapabilityDefinition>;
|
|
210
|
+
/** Hides a definition from new use; its versions stay readable. */
|
|
211
|
+
archiveCapabilityDefinition(id: string): Promise<CapabilityDefinition>;
|
|
187
212
|
listSessions(status?: string): Promise<Session[]>;
|
|
188
213
|
listActiveSessions(): Promise<Session[]>;
|
|
189
214
|
getSession(sessionId: string): Promise<Session>;
|
package/dist/client.js
CHANGED
|
@@ -202,6 +202,17 @@ export class OrionBeltClient {
|
|
|
202
202
|
getGatewayInfo() {
|
|
203
203
|
return this.request('GET', '/gateway-info', undefined, { auth: false });
|
|
204
204
|
}
|
|
205
|
+
/** Whether the web console offers single sign-on, and how to start it. Needs no credentials. */
|
|
206
|
+
getOidcInfo() {
|
|
207
|
+
return this.request('GET', '/public/auth/oidc', undefined, { auth: false });
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Where a browser starts single sign-on. The login and its callback are browser
|
|
211
|
+
* redirects that set and check a cookie, so the SDK gives the URL to open.
|
|
212
|
+
*/
|
|
213
|
+
oidcLoginUrl() {
|
|
214
|
+
return this.url('/public/auth/oidc/login');
|
|
215
|
+
}
|
|
205
216
|
/** The server's build version. Needs no credentials. */
|
|
206
217
|
getVersion() {
|
|
207
218
|
return this.request('GET', '/version', undefined, { auth: false });
|
|
@@ -500,6 +511,43 @@ export class OrionBeltClient {
|
|
|
500
511
|
putRiskPolicy(policy) {
|
|
501
512
|
return this.request('PUT', '/admin/risk-policy', policy);
|
|
502
513
|
}
|
|
514
|
+
/** Whether access requests must name a change ticket, and in what format. */
|
|
515
|
+
getTicketPolicy() {
|
|
516
|
+
return this.request('GET', '/ticket-policy');
|
|
517
|
+
}
|
|
518
|
+
/** Replaces the ticket policy outright (admin only). */
|
|
519
|
+
putTicketPolicy(policy) {
|
|
520
|
+
return this.request('PUT', '/admin/ticket-policy', policy);
|
|
521
|
+
}
|
|
522
|
+
/** Capability definitions by name; archived ones only with `includeArchived`. */
|
|
523
|
+
async listCapabilityDefinitions(includeArchived = false) {
|
|
524
|
+
const path = `/capability-definitions${query({ archived: includeArchived })}`;
|
|
525
|
+
return (await this.request('GET', path)) ?? [];
|
|
526
|
+
}
|
|
527
|
+
/** A capability definition in its current version. */
|
|
528
|
+
getCapabilityDefinition(id) {
|
|
529
|
+
return this.request('GET', `/capability-definitions/${seg(id)}`);
|
|
530
|
+
}
|
|
531
|
+
/** Every version of a definition, newest first. */
|
|
532
|
+
async listCapabilityVersions(id) {
|
|
533
|
+
return (await this.request('GET', `/capability-definitions/${seg(id)}/versions`)) ?? [];
|
|
534
|
+
}
|
|
535
|
+
/** One version of a definition, archived or not. */
|
|
536
|
+
getCapabilityVersion(id, version) {
|
|
537
|
+
return this.request('GET', `/capability-definitions/${seg(id)}/versions/${Math.trunc(version)}`);
|
|
538
|
+
}
|
|
539
|
+
/** Stores a new definition as version 1 (admins and operators). */
|
|
540
|
+
createCapabilityDefinition(definition) {
|
|
541
|
+
return this.request('POST', '/admin/capability-definitions', definition);
|
|
542
|
+
}
|
|
543
|
+
/** Replaces a definition, adding a version; `definition.version` must be the current one. */
|
|
544
|
+
updateCapabilityDefinition(id, definition) {
|
|
545
|
+
return this.request('PUT', `/admin/capability-definitions/${seg(id)}`, definition);
|
|
546
|
+
}
|
|
547
|
+
/** Hides a definition from new use; its versions stay readable. */
|
|
548
|
+
archiveCapabilityDefinition(id) {
|
|
549
|
+
return this.request('DELETE', `/admin/capability-definitions/${seg(id)}`);
|
|
550
|
+
}
|
|
503
551
|
// Sessions, audit, reporting
|
|
504
552
|
listSessions(status = '') {
|
|
505
553
|
return this.list(`/sessions${query({ status })}`);
|
package/dist/types.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export type AccessRequest = {
|
|
|
92
92
|
expires_at?: string;
|
|
93
93
|
risk_signals?: RiskSignals;
|
|
94
94
|
risk_decision?: RiskDecision;
|
|
95
|
+
ticket_ref?: string;
|
|
95
96
|
};
|
|
96
97
|
export type Session = {
|
|
97
98
|
id?: string;
|
|
@@ -185,6 +186,55 @@ export type RiskPolicy = {
|
|
|
185
186
|
updated_at?: string;
|
|
186
187
|
updated_by?: string;
|
|
187
188
|
};
|
|
189
|
+
export type TicketPolicy = {
|
|
190
|
+
required?: boolean;
|
|
191
|
+
/** Regular expression the whole reference must match. */
|
|
192
|
+
pattern?: string;
|
|
193
|
+
/** Link for a reference; {ticket} stands for the reference. */
|
|
194
|
+
url_template?: string;
|
|
195
|
+
updated_at?: string;
|
|
196
|
+
updated_by?: string;
|
|
197
|
+
};
|
|
198
|
+
export type CapabilityTarget = {
|
|
199
|
+
/** Exactly one of machine_id and machine_tags is set. */
|
|
200
|
+
machine_id?: string;
|
|
201
|
+
machine_tags?: Record<string, string>;
|
|
202
|
+
access_type: string;
|
|
203
|
+
remote_users?: string[];
|
|
204
|
+
/** Recorded with each version, not enforced. */
|
|
205
|
+
commands?: string[];
|
|
206
|
+
};
|
|
207
|
+
export type CapabilityDefinitionInput = {
|
|
208
|
+
name: string;
|
|
209
|
+
description?: string;
|
|
210
|
+
targets: CapabilityTarget[];
|
|
211
|
+
relationships?: string[];
|
|
212
|
+
/** The version an update is based on; omit on create. */
|
|
213
|
+
version?: number;
|
|
214
|
+
};
|
|
215
|
+
export type CapabilityDefinition = {
|
|
216
|
+
id: string;
|
|
217
|
+
name: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
targets: CapabilityTarget[];
|
|
220
|
+
relationships?: string[];
|
|
221
|
+
version: number;
|
|
222
|
+
archived_at?: string;
|
|
223
|
+
created_at: string;
|
|
224
|
+
created_by?: string;
|
|
225
|
+
updated_at: string;
|
|
226
|
+
updated_by?: string;
|
|
227
|
+
};
|
|
228
|
+
export type CapabilityVersion = {
|
|
229
|
+
definition_id: string;
|
|
230
|
+
version: number;
|
|
231
|
+
name: string;
|
|
232
|
+
description?: string;
|
|
233
|
+
targets: CapabilityTarget[];
|
|
234
|
+
relationships?: string[];
|
|
235
|
+
created_at: string;
|
|
236
|
+
created_by?: string;
|
|
237
|
+
};
|
|
188
238
|
export type AccessAnomaly = {
|
|
189
239
|
id?: string;
|
|
190
240
|
kind?: string;
|
|
@@ -341,6 +391,11 @@ export type UsageDashboard = {
|
|
|
341
391
|
approval_latency?: ApprovalLatency;
|
|
342
392
|
top_targets?: TopTarget[];
|
|
343
393
|
};
|
|
394
|
+
export type OIDCInfo = {
|
|
395
|
+
enabled: boolean;
|
|
396
|
+
display_name?: string;
|
|
397
|
+
login_url?: string;
|
|
398
|
+
};
|
|
344
399
|
export type GatewayInfo = {
|
|
345
400
|
public_url?: string;
|
|
346
401
|
ui_url?: string;
|
|
@@ -397,6 +452,7 @@ export type PluginConfigField = {
|
|
|
397
452
|
label?: string;
|
|
398
453
|
type?: string;
|
|
399
454
|
secret?: boolean;
|
|
455
|
+
destination?: boolean;
|
|
400
456
|
required?: boolean;
|
|
401
457
|
placeholder?: string;
|
|
402
458
|
help?: string;
|
|
@@ -506,6 +562,7 @@ export type CreateAccessRequestRequest = {
|
|
|
506
562
|
duration?: number;
|
|
507
563
|
access_type?: string;
|
|
508
564
|
remote_users?: string[];
|
|
565
|
+
ticket_ref?: string;
|
|
509
566
|
};
|
|
510
567
|
export type CreateUserRequest = {
|
|
511
568
|
username?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-belt/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "TypeScript client for the Orion Belt API",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"author": "Orion Belt Maintainers",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"prepack": "npm run clean && npm run build"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/node": "26.6.
|
|
44
|
+
"@types/node": "26.6.11",
|
|
45
45
|
"oxlint": "1.95.0",
|
|
46
46
|
"typescript": "7.0.2"
|
|
47
47
|
}
|