@dominusnode/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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +679 -0
  3. package/dist/cjs/admin.d.ts +71 -0
  4. package/dist/cjs/admin.js +60 -0
  5. package/dist/cjs/auth.d.ts +47 -0
  6. package/dist/cjs/auth.js +46 -0
  7. package/dist/cjs/client.d.ts +56 -0
  8. package/dist/cjs/client.js +109 -0
  9. package/dist/cjs/constants.d.ts +8 -0
  10. package/dist/cjs/constants.js +11 -0
  11. package/dist/cjs/errors.d.ts +36 -0
  12. package/dist/cjs/errors.js +86 -0
  13. package/dist/cjs/http.d.ts +19 -0
  14. package/dist/cjs/http.js +195 -0
  15. package/dist/cjs/index.d.ts +30 -0
  16. package/dist/cjs/index.js +58 -0
  17. package/dist/cjs/keys.d.ts +27 -0
  18. package/dist/cjs/keys.js +22 -0
  19. package/dist/cjs/plans.d.ts +37 -0
  20. package/dist/cjs/plans.js +22 -0
  21. package/dist/cjs/proxy.d.ts +62 -0
  22. package/dist/cjs/proxy.js +71 -0
  23. package/dist/cjs/resources/agent-wallet.d.ts +52 -0
  24. package/dist/cjs/resources/agent-wallet.js +64 -0
  25. package/dist/cjs/resources/teams.d.ts +93 -0
  26. package/dist/cjs/resources/teams.js +82 -0
  27. package/dist/cjs/resources/wallet-auth.d.ts +66 -0
  28. package/dist/cjs/resources/wallet-auth.js +105 -0
  29. package/dist/cjs/resources/x402.d.ts +39 -0
  30. package/dist/cjs/resources/x402.js +25 -0
  31. package/dist/cjs/sessions.d.ts +15 -0
  32. package/dist/cjs/sessions.js +14 -0
  33. package/dist/cjs/slots.d.ts +9 -0
  34. package/dist/cjs/slots.js +19 -0
  35. package/dist/cjs/token-manager.d.ts +21 -0
  36. package/dist/cjs/token-manager.js +105 -0
  37. package/dist/cjs/types.d.ts +154 -0
  38. package/dist/cjs/types.js +2 -0
  39. package/dist/cjs/usage.d.ts +80 -0
  40. package/dist/cjs/usage.js +56 -0
  41. package/dist/cjs/wallet.d.ts +59 -0
  42. package/dist/cjs/wallet.js +56 -0
  43. package/dist/esm/admin.d.ts +71 -0
  44. package/dist/esm/admin.js +56 -0
  45. package/dist/esm/auth.d.ts +47 -0
  46. package/dist/esm/auth.js +42 -0
  47. package/dist/esm/client.d.ts +56 -0
  48. package/dist/esm/client.js +105 -0
  49. package/dist/esm/constants.d.ts +8 -0
  50. package/dist/esm/constants.js +8 -0
  51. package/dist/esm/errors.d.ts +36 -0
  52. package/dist/esm/errors.js +72 -0
  53. package/dist/esm/http.d.ts +19 -0
  54. package/dist/esm/http.js +191 -0
  55. package/dist/esm/index.d.ts +30 -0
  56. package/dist/esm/index.js +23 -0
  57. package/dist/esm/keys.d.ts +27 -0
  58. package/dist/esm/keys.js +18 -0
  59. package/dist/esm/plans.d.ts +37 -0
  60. package/dist/esm/plans.js +18 -0
  61. package/dist/esm/proxy.d.ts +62 -0
  62. package/dist/esm/proxy.js +67 -0
  63. package/dist/esm/resources/agent-wallet.d.ts +52 -0
  64. package/dist/esm/resources/agent-wallet.js +60 -0
  65. package/dist/esm/resources/teams.d.ts +93 -0
  66. package/dist/esm/resources/teams.js +78 -0
  67. package/dist/esm/resources/wallet-auth.d.ts +66 -0
  68. package/dist/esm/resources/wallet-auth.js +101 -0
  69. package/dist/esm/resources/x402.d.ts +39 -0
  70. package/dist/esm/resources/x402.js +21 -0
  71. package/dist/esm/sessions.d.ts +15 -0
  72. package/dist/esm/sessions.js +10 -0
  73. package/dist/esm/slots.d.ts +9 -0
  74. package/dist/esm/slots.js +15 -0
  75. package/dist/esm/token-manager.d.ts +21 -0
  76. package/dist/esm/token-manager.js +101 -0
  77. package/dist/esm/types.d.ts +154 -0
  78. package/dist/esm/types.js +1 -0
  79. package/dist/esm/usage.d.ts +80 -0
  80. package/dist/esm/usage.js +52 -0
  81. package/dist/esm/wallet.d.ts +59 -0
  82. package/dist/esm/wallet.js +52 -0
  83. package/dist/tsconfig.tsbuildinfo +1 -0
  84. package/package.json +31 -0
@@ -0,0 +1,154 @@
1
+ export interface DominusNodeConfig {
2
+ baseUrl?: string;
3
+ apiKey?: string;
4
+ accessToken?: string;
5
+ refreshToken?: string;
6
+ proxyHost?: string;
7
+ httpProxyPort?: number;
8
+ socks5ProxyPort?: number;
9
+ }
10
+ export interface User {
11
+ id: string;
12
+ email: string;
13
+ is_admin: boolean;
14
+ created_at?: string;
15
+ }
16
+ export interface ApiKey {
17
+ id: string;
18
+ key_prefix: string;
19
+ label: string;
20
+ created_at: string;
21
+ raw?: string;
22
+ }
23
+ export interface Wallet {
24
+ balance_cents: number;
25
+ currency: string;
26
+ }
27
+ export interface WalletTransaction {
28
+ id: string;
29
+ type: "topup" | "debit" | "refund";
30
+ amount_cents: number;
31
+ description: string;
32
+ created_at: string;
33
+ }
34
+ export interface UsageRecord {
35
+ date: string;
36
+ bytes_in: number;
37
+ bytes_out: number;
38
+ total_bytes: number;
39
+ cost_cents: number;
40
+ request_count: number;
41
+ }
42
+ export interface TopHost {
43
+ target_host: string;
44
+ total_bytes: number;
45
+ request_count: number;
46
+ }
47
+ export interface Plan {
48
+ id: string;
49
+ name: string;
50
+ price_per_gb_cents: number;
51
+ monthly_bandwidth_bytes: number;
52
+ is_default: boolean;
53
+ }
54
+ export interface ActiveSession {
55
+ id: string;
56
+ started_at: string;
57
+ status: string;
58
+ }
59
+ export interface ProxyUrlOptions {
60
+ protocol?: "http" | "socks5";
61
+ country?: string;
62
+ state?: string;
63
+ city?: string;
64
+ asn?: number;
65
+ sessionId?: string;
66
+ }
67
+ export interface ProxyHealth {
68
+ status: string;
69
+ providers?: unknown;
70
+ }
71
+ export interface ProxyConfig {
72
+ httpProxy: {
73
+ host: string;
74
+ port: number;
75
+ };
76
+ socks5Proxy: {
77
+ host: string;
78
+ port: number;
79
+ };
80
+ supportedCountries: string[];
81
+ blockedCountries: string[];
82
+ geoTargeting?: {
83
+ stateSupport: boolean;
84
+ citySupport: boolean;
85
+ asnSupport: boolean;
86
+ };
87
+ }
88
+ export interface StripeCheckout {
89
+ url: string;
90
+ sessionId: string;
91
+ }
92
+ export interface CryptoInvoice {
93
+ invoiceId: string;
94
+ paymentUrl: string;
95
+ amount: number;
96
+ currency: string;
97
+ }
98
+ export interface PaypalOrder {
99
+ orderId: string;
100
+ approvalUrl: string;
101
+ amountCents: number;
102
+ }
103
+ export interface AdminUser {
104
+ id: string;
105
+ email: string;
106
+ status: string;
107
+ is_admin: boolean;
108
+ created_at: string;
109
+ balance_cents: number;
110
+ }
111
+ export interface RevenueStats {
112
+ total_revenue_cents: number;
113
+ total_topups_cents: number;
114
+ total_usage_cents: number;
115
+ user_count: number;
116
+ }
117
+ export interface DailyRevenue {
118
+ date: string;
119
+ revenue_cents: number;
120
+ }
121
+ export interface SystemStats {
122
+ active_sessions: number;
123
+ total_users: number;
124
+ total_bandwidth_bytes: number;
125
+ }
126
+ export interface MfaStatus {
127
+ enabled: boolean;
128
+ backupCodesRemaining: number;
129
+ }
130
+ export interface MfaSetup {
131
+ secret: string;
132
+ otpauthUri: string;
133
+ backupCodes: string[];
134
+ }
135
+ export interface LoginResult {
136
+ user?: User;
137
+ mfaRequired?: boolean;
138
+ }
139
+ export interface TokenPair {
140
+ accessToken: string;
141
+ refreshToken: string;
142
+ }
143
+ export interface SlotsInfo {
144
+ total: number;
145
+ used: number;
146
+ remaining: number;
147
+ unlimited: boolean;
148
+ }
149
+ export interface WaitlistJoinResult {
150
+ message: string;
151
+ }
152
+ export interface WaitlistCount {
153
+ pending: number;
154
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,80 @@
1
+ import type { HttpClient } from "./http.js";
2
+ export interface DateRangeOptions {
3
+ from?: string;
4
+ to?: string;
5
+ }
6
+ export interface UsageSummary {
7
+ totalBytes: number;
8
+ totalCostCents: number;
9
+ requestCount: number;
10
+ totalGB: number;
11
+ totalCostUsd: number;
12
+ }
13
+ export interface UsageResponse {
14
+ summary: UsageSummary;
15
+ records: Array<{
16
+ id: string;
17
+ sessionId: string;
18
+ bytesIn: number;
19
+ bytesOut: number;
20
+ totalBytes: number;
21
+ costCents: number;
22
+ proxyType: string;
23
+ targetHost: string;
24
+ createdAt: string;
25
+ }>;
26
+ pagination: {
27
+ limit: number;
28
+ offset: number;
29
+ total: number;
30
+ };
31
+ period: {
32
+ since: string;
33
+ until: string;
34
+ };
35
+ }
36
+ export interface DailyUsageDay {
37
+ date: string;
38
+ totalBytes: number;
39
+ totalGB: number;
40
+ totalCostCents: number;
41
+ totalCostUsd: number;
42
+ requestCount: number;
43
+ }
44
+ export interface DailyUsageResponse {
45
+ days: DailyUsageDay[];
46
+ period: {
47
+ since: string;
48
+ until: string;
49
+ };
50
+ }
51
+ export interface TopHostEntry {
52
+ targetHost: string;
53
+ totalBytes: number;
54
+ totalGB: number;
55
+ requestCount: number;
56
+ }
57
+ export interface TopHostsResponse {
58
+ hosts: TopHostEntry[];
59
+ period: {
60
+ since: string;
61
+ until: string;
62
+ };
63
+ }
64
+ export declare class UsageResource {
65
+ private http;
66
+ constructor(http: HttpClient);
67
+ /** Get detailed usage records with summary. */
68
+ get(opts?: DateRangeOptions & {
69
+ limit?: number;
70
+ offset?: number;
71
+ }): Promise<UsageResponse>;
72
+ /** Get daily usage aggregation for charts. */
73
+ getDaily(opts?: DateRangeOptions): Promise<DailyUsageResponse>;
74
+ /** Get top target hosts by bandwidth. */
75
+ getTopHosts(opts?: DateRangeOptions & {
76
+ limit?: number;
77
+ }): Promise<TopHostsResponse>;
78
+ /** Export usage records as CSV string. */
79
+ exportCsv(opts?: DateRangeOptions): Promise<string>;
80
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsageResource = void 0;
4
+ class UsageResource {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** Get detailed usage records with summary. */
10
+ async get(opts) {
11
+ const params = new URLSearchParams();
12
+ if (opts?.from)
13
+ params.set("since", opts.from);
14
+ if (opts?.to)
15
+ params.set("until", opts.to);
16
+ if (opts?.limit !== undefined)
17
+ params.set("limit", String(opts.limit));
18
+ if (opts?.offset !== undefined)
19
+ params.set("offset", String(opts.offset));
20
+ const qs = params.toString();
21
+ return this.http.get(`/api/usage${qs ? `?${qs}` : ""}`);
22
+ }
23
+ /** Get daily usage aggregation for charts. */
24
+ async getDaily(opts) {
25
+ const params = new URLSearchParams();
26
+ if (opts?.from)
27
+ params.set("since", opts.from);
28
+ if (opts?.to)
29
+ params.set("until", opts.to);
30
+ const qs = params.toString();
31
+ return this.http.get(`/api/usage/daily${qs ? `?${qs}` : ""}`);
32
+ }
33
+ /** Get top target hosts by bandwidth. */
34
+ async getTopHosts(opts) {
35
+ const params = new URLSearchParams();
36
+ if (opts?.from)
37
+ params.set("since", opts.from);
38
+ if (opts?.to)
39
+ params.set("until", opts.to);
40
+ if (opts?.limit !== undefined)
41
+ params.set("limit", String(opts.limit));
42
+ const qs = params.toString();
43
+ return this.http.get(`/api/usage/top-hosts${qs ? `?${qs}` : ""}`);
44
+ }
45
+ /** Export usage records as CSV string. */
46
+ async exportCsv(opts) {
47
+ const params = new URLSearchParams();
48
+ if (opts?.from)
49
+ params.set("since", opts.from);
50
+ if (opts?.to)
51
+ params.set("until", opts.to);
52
+ const qs = params.toString();
53
+ return this.http.get(`/api/usage/export${qs ? `?${qs}` : ""}`);
54
+ }
55
+ }
56
+ exports.UsageResource = UsageResource;
@@ -0,0 +1,59 @@
1
+ import type { HttpClient } from "./http.js";
2
+ import type { WalletTransaction } from "./types.js";
3
+ export interface WalletBalanceResponse {
4
+ balanceCents: number;
5
+ balanceUsd: number;
6
+ currency: string;
7
+ lastToppedUp: string | null;
8
+ }
9
+ export interface TransactionsResponse {
10
+ transactions: Array<{
11
+ id: string;
12
+ type: WalletTransaction["type"];
13
+ amountCents: number;
14
+ amountUsd: number;
15
+ description: string;
16
+ paymentProvider: string | null;
17
+ createdAt: string;
18
+ }>;
19
+ }
20
+ export interface StripeCheckoutResponse {
21
+ sessionId: string;
22
+ url: string;
23
+ }
24
+ export interface CryptoInvoiceResponse {
25
+ invoiceId: string;
26
+ invoiceUrl: string;
27
+ payCurrency: string;
28
+ priceAmount: number;
29
+ }
30
+ export interface PaypalOrderResponse {
31
+ orderId: string;
32
+ approvalUrl: string;
33
+ amountCents: number;
34
+ }
35
+ export interface ForecastResponse {
36
+ dailyAvgCents: number;
37
+ daysRemaining: number | null;
38
+ trend: "up" | "down" | "stable";
39
+ trendPct: number;
40
+ }
41
+ export declare class WalletResource {
42
+ private http;
43
+ constructor(http: HttpClient);
44
+ /** Get current wallet balance. */
45
+ getBalance(): Promise<WalletBalanceResponse>;
46
+ /** Get wallet transaction history. */
47
+ getTransactions(opts?: {
48
+ limit?: number;
49
+ offset?: number;
50
+ }): Promise<TransactionsResponse>;
51
+ /** Create a Stripe checkout session for wallet top-up. */
52
+ topUpStripe(amountCents: number): Promise<StripeCheckoutResponse>;
53
+ /** Create a crypto invoice for wallet top-up. Minimum $10 (1000 cents). */
54
+ topUpCrypto(amountCents: number, currency: string): Promise<CryptoInvoiceResponse>;
55
+ /** Create a PayPal order for wallet top-up. Minimum $5 (500 cents). */
56
+ topUpPaypal(amountCents: number): Promise<PaypalOrderResponse>;
57
+ /** Get spending forecast based on recent usage. */
58
+ getForecast(): Promise<ForecastResponse>;
59
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletResource = void 0;
4
+ class WalletResource {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** Get current wallet balance. */
10
+ async getBalance() {
11
+ return this.http.get("/api/wallet");
12
+ }
13
+ /** Get wallet transaction history. */
14
+ async getTransactions(opts) {
15
+ const params = new URLSearchParams();
16
+ if (opts?.limit !== undefined)
17
+ params.set("limit", String(opts.limit));
18
+ if (opts?.offset !== undefined)
19
+ params.set("offset", String(opts.offset));
20
+ const qs = params.toString();
21
+ return this.http.get(`/api/wallet/transactions${qs ? `?${qs}` : ""}`);
22
+ }
23
+ /** Create a Stripe checkout session for wallet top-up. */
24
+ async topUpStripe(amountCents) {
25
+ if (!Number.isInteger(amountCents) || amountCents <= 0 || amountCents > 2_147_483_647) {
26
+ throw new Error("amountCents must be a positive integer <= 2,147,483,647");
27
+ }
28
+ return this.http.post("/api/wallet/topup/stripe", { amountCents });
29
+ }
30
+ /** Create a crypto invoice for wallet top-up. Minimum $10 (1000 cents). */
31
+ async topUpCrypto(amountCents, currency) {
32
+ if (!Number.isInteger(amountCents) || amountCents <= 0 || amountCents > 2_147_483_647) {
33
+ throw new Error("amountCents must be a positive integer <= 2,147,483,647");
34
+ }
35
+ if (amountCents < 1000) {
36
+ throw new Error("Minimum crypto top-up is $10.00 (1000 cents)");
37
+ }
38
+ const amountUsd = amountCents / 100;
39
+ return this.http.post("/api/wallet/topup/crypto", { amountUsd, currency });
40
+ }
41
+ /** Create a PayPal order for wallet top-up. Minimum $5 (500 cents). */
42
+ async topUpPaypal(amountCents) {
43
+ if (!Number.isInteger(amountCents) || amountCents <= 0 || amountCents > 2_147_483_647) {
44
+ throw new Error("amountCents must be a positive integer <= 2,147,483,647");
45
+ }
46
+ if (amountCents < 500) {
47
+ throw new Error("Minimum PayPal top-up is $5.00 (500 cents)");
48
+ }
49
+ return this.http.post("/api/wallet/topup/paypal", { amountCents });
50
+ }
51
+ /** Get spending forecast based on recent usage. */
52
+ async getForecast() {
53
+ return this.http.get("/api/wallet/forecast");
54
+ }
55
+ }
56
+ exports.WalletResource = WalletResource;
@@ -0,0 +1,71 @@
1
+ import type { HttpClient } from "./http.js";
2
+ import type { AdminUser, SystemStats } from "./types.js";
3
+ export interface DateRangeOptions {
4
+ since?: string;
5
+ until?: string;
6
+ }
7
+ export interface ListUsersResponse {
8
+ users: AdminUser[];
9
+ pagination: {
10
+ page: number;
11
+ limit: number;
12
+ total: number;
13
+ totalPages: number;
14
+ };
15
+ }
16
+ export interface GetUserResponse {
17
+ user: AdminUser;
18
+ }
19
+ export interface RevenueResponse {
20
+ totalRevenueCents: number;
21
+ totalRevenueUsd: number;
22
+ avgTransactionCents: number;
23
+ avgTransactionUsd: number;
24
+ transactionCount: number;
25
+ topupCount: number;
26
+ period: {
27
+ since: string;
28
+ until: string;
29
+ };
30
+ }
31
+ export interface DailyRevenueEntry {
32
+ date: string;
33
+ revenueCents: number;
34
+ revenueUsd: number;
35
+ }
36
+ export interface DailyRevenueResponse {
37
+ days: DailyRevenueEntry[];
38
+ period: {
39
+ since: string;
40
+ until: string;
41
+ };
42
+ }
43
+ export declare class AdminResource {
44
+ private http;
45
+ constructor(http: HttpClient);
46
+ /** List all users (paginated). Requires admin privileges. */
47
+ listUsers(opts?: {
48
+ page?: number;
49
+ limit?: number;
50
+ }): Promise<ListUsersResponse>;
51
+ /** Get detailed info for a specific user. Requires admin privileges. */
52
+ getUser(id: string): Promise<GetUserResponse>;
53
+ /** Suspend a user account. Requires admin privileges. */
54
+ suspendUser(id: string): Promise<{
55
+ message: string;
56
+ }>;
57
+ /** Reactivate a suspended user account. Requires admin privileges. */
58
+ activateUser(id: string): Promise<{
59
+ message: string;
60
+ }>;
61
+ /** Soft-delete a user account. Requires admin privileges. */
62
+ deleteUser(id: string): Promise<{
63
+ message: string;
64
+ }>;
65
+ /** Get revenue statistics for a date range. Requires admin privileges. */
66
+ getRevenue(opts?: DateRangeOptions): Promise<RevenueResponse>;
67
+ /** Get daily revenue breakdown. Requires admin privileges. */
68
+ getDailyRevenue(opts?: DateRangeOptions): Promise<DailyRevenueResponse>;
69
+ /** Get system-wide statistics. Requires admin privileges. */
70
+ getStats(): Promise<SystemStats>;
71
+ }
@@ -0,0 +1,56 @@
1
+ export class AdminResource {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ /** List all users (paginated). Requires admin privileges. */
7
+ async listUsers(opts) {
8
+ const params = new URLSearchParams();
9
+ if (opts?.page !== undefined)
10
+ params.set("page", String(opts.page));
11
+ if (opts?.limit !== undefined)
12
+ params.set("limit", String(opts.limit));
13
+ const qs = params.toString();
14
+ return this.http.get(`/api/admin/users${qs ? `?${qs}` : ""}`);
15
+ }
16
+ /** Get detailed info for a specific user. Requires admin privileges. */
17
+ async getUser(id) {
18
+ return this.http.get(`/api/admin/users/${encodeURIComponent(id)}`);
19
+ }
20
+ /** Suspend a user account. Requires admin privileges. */
21
+ async suspendUser(id) {
22
+ return this.http.put(`/api/admin/users/${encodeURIComponent(id)}/suspend`);
23
+ }
24
+ /** Reactivate a suspended user account. Requires admin privileges. */
25
+ async activateUser(id) {
26
+ return this.http.put(`/api/admin/users/${encodeURIComponent(id)}/activate`);
27
+ }
28
+ /** Soft-delete a user account. Requires admin privileges. */
29
+ async deleteUser(id) {
30
+ return this.http.delete(`/api/admin/users/${encodeURIComponent(id)}`);
31
+ }
32
+ /** Get revenue statistics for a date range. Requires admin privileges. */
33
+ async getRevenue(opts) {
34
+ const params = new URLSearchParams();
35
+ if (opts?.since)
36
+ params.set("since", opts.since);
37
+ if (opts?.until)
38
+ params.set("until", opts.until);
39
+ const qs = params.toString();
40
+ return this.http.get(`/api/admin/revenue${qs ? `?${qs}` : ""}`);
41
+ }
42
+ /** Get daily revenue breakdown. Requires admin privileges. */
43
+ async getDailyRevenue(opts) {
44
+ const params = new URLSearchParams();
45
+ if (opts?.since)
46
+ params.set("since", opts.since);
47
+ if (opts?.until)
48
+ params.set("until", opts.until);
49
+ const qs = params.toString();
50
+ return this.http.get(`/api/admin/revenue/daily${qs ? `?${qs}` : ""}`);
51
+ }
52
+ /** Get system-wide statistics. Requires admin privileges. */
53
+ async getStats() {
54
+ return this.http.get("/api/admin/stats");
55
+ }
56
+ }
@@ -0,0 +1,47 @@
1
+ import type { HttpClient } from "./http.js";
2
+ import type { User, LoginResult, MfaStatus, MfaSetup } from "./types.js";
3
+ export declare class AuthResource {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ register(email: string, password: string): Promise<{
7
+ user: User;
8
+ token?: string;
9
+ refreshToken?: string;
10
+ }>;
11
+ login(email: string, password: string): Promise<LoginResult & {
12
+ token?: string;
13
+ refreshToken?: string;
14
+ }>;
15
+ verifyMfa(code: string, opts?: {
16
+ mfaChallengeToken?: string;
17
+ isBackupCode?: boolean;
18
+ }): Promise<{
19
+ user: User;
20
+ token: string;
21
+ refreshToken: string;
22
+ }>;
23
+ refresh(refreshToken: string): Promise<{
24
+ token: string;
25
+ refreshToken?: string;
26
+ }>;
27
+ logout(): Promise<void>;
28
+ me(): Promise<{
29
+ user: User;
30
+ }>;
31
+ changePassword(currentPassword: string, newPassword: string): Promise<void>;
32
+ verifyKey(apiKey: string): Promise<{
33
+ valid: boolean;
34
+ token: string;
35
+ refreshToken: string;
36
+ userId: string;
37
+ email: string;
38
+ }>;
39
+ mfaSetup(): Promise<MfaSetup>;
40
+ mfaEnable(code: string): Promise<{
41
+ enabled: boolean;
42
+ }>;
43
+ mfaDisable(password: string, code: string): Promise<{
44
+ enabled: boolean;
45
+ }>;
46
+ mfaStatus(): Promise<MfaStatus>;
47
+ }
@@ -0,0 +1,42 @@
1
+ export class AuthResource {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async register(email, password) {
7
+ return this.http.post("/api/auth/register", { email, password }, false);
8
+ }
9
+ async login(email, password) {
10
+ return this.http.post("/api/auth/login", { email, password }, false);
11
+ }
12
+ async verifyMfa(code, opts) {
13
+ return this.http.post("/api/auth/mfa/verify", { code, ...opts }, false);
14
+ }
15
+ async refresh(refreshToken) {
16
+ return this.http.post("/api/auth/refresh", { refreshToken }, false);
17
+ }
18
+ async logout() {
19
+ await this.http.post("/api/auth/logout", {});
20
+ }
21
+ async me() {
22
+ return this.http.get("/api/auth/me");
23
+ }
24
+ async changePassword(currentPassword, newPassword) {
25
+ await this.http.post("/api/auth/change-password", { currentPassword, newPassword });
26
+ }
27
+ async verifyKey(apiKey) {
28
+ return this.http.post("/api/auth/verify-key", { apiKey }, false);
29
+ }
30
+ async mfaSetup() {
31
+ return this.http.post("/api/auth/mfa/setup", {});
32
+ }
33
+ async mfaEnable(code) {
34
+ return this.http.post("/api/auth/mfa/enable", { code });
35
+ }
36
+ async mfaDisable(password, code) {
37
+ return this.http.post("/api/auth/mfa/disable", { password, code });
38
+ }
39
+ async mfaStatus() {
40
+ return this.http.get("/api/auth/mfa/status");
41
+ }
42
+ }
@@ -0,0 +1,56 @@
1
+ import { AuthResource } from "./auth.js";
2
+ import { KeysResource } from "./keys.js";
3
+ import { WalletResource } from "./wallet.js";
4
+ import { UsageResource } from "./usage.js";
5
+ import { PlansResource } from "./plans.js";
6
+ import { SessionsResource } from "./sessions.js";
7
+ import { ProxyResource } from "./proxy.js";
8
+ import { AdminResource } from "./admin.js";
9
+ import { SlotsResource } from "./slots.js";
10
+ import { AgenticWalletResource } from "./resources/agent-wallet.js";
11
+ import { TeamsResource } from "./resources/teams.js";
12
+ import { X402Resource } from "./resources/x402.js";
13
+ import { WalletAuthResource } from "./resources/wallet-auth.js";
14
+ import type { DominusNodeConfig, LoginResult } from "./types.js";
15
+ export declare class DominusNodeClient {
16
+ readonly auth: AuthResource;
17
+ readonly keys: KeysResource;
18
+ readonly wallet: WalletResource;
19
+ readonly usage: UsageResource;
20
+ readonly plans: PlansResource;
21
+ readonly sessions: SessionsResource;
22
+ readonly proxy: ProxyResource;
23
+ readonly admin: AdminResource;
24
+ readonly slots: SlotsResource;
25
+ readonly agenticWallets: AgenticWalletResource;
26
+ readonly teams: TeamsResource;
27
+ readonly x402: X402Resource;
28
+ readonly walletAuth: WalletAuthResource;
29
+ private tokenManager;
30
+ private http;
31
+ private apiKey;
32
+ constructor(config?: DominusNodeConfig);
33
+ /**
34
+ * Authenticate with an API key.
35
+ * Verifies the key against the server and stores the resulting JWT tokens
36
+ * for subsequent authenticated requests.
37
+ */
38
+ connectWithKey(apiKey: string): Promise<void>;
39
+ /**
40
+ * Authenticate with email and password.
41
+ * If MFA is required, the returned result will have `mfaRequired: true`.
42
+ * Call `completeMfa()` to finish authentication in that case.
43
+ */
44
+ connectWithCredentials(email: string, password: string): Promise<LoginResult>;
45
+ /**
46
+ * Complete MFA verification after a login that returned `mfaRequired: true`.
47
+ */
48
+ completeMfa(code: string, opts?: {
49
+ mfaChallengeToken?: string;
50
+ isBackupCode?: boolean;
51
+ }): Promise<void>;
52
+ /**
53
+ * Disconnect: revoke refresh tokens server-side (best-effort) and clear all stored tokens.
54
+ */
55
+ disconnect(): Promise<void>;
56
+ }