@dominusnode/sdk 1.1.0 → 1.1.1

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.
@@ -37,7 +37,7 @@ class DominusNodeClient {
37
37
  constructor(config = {}) {
38
38
  const baseUrl = config.baseUrl ?? constants_js_1.DEFAULT_BASE_URL;
39
39
  this.tokenManager = new token_manager_js_1.TokenManager();
40
- this.http = new http_js_1.HttpClient(baseUrl, this.tokenManager);
40
+ this.http = new http_js_1.HttpClient(baseUrl, this.tokenManager, config.agentSecret);
41
41
  // Initialize all resource modules BEFORE setting refresh function
42
42
  // this.auth must exist before refresh function can be invoked
43
43
  this.auth = new auth_js_1.AuthResource(this.http);
@@ -9,7 +9,8 @@ export interface HttpOptions {
9
9
  export declare class HttpClient {
10
10
  private baseUrl;
11
11
  private tokenManager;
12
- constructor(baseUrl: string, tokenManager: TokenManager);
12
+ private agentSecret?;
13
+ constructor(baseUrl: string, tokenManager: TokenManager, agentSecret?: string);
13
14
  request<T>(opts: HttpOptions): Promise<T>;
14
15
  get<T>(path: string, requiresAuth?: boolean): Promise<T>;
15
16
  post<T>(path: string, body?: unknown, requiresAuth?: boolean): Promise<T>;
package/dist/cjs/http.js CHANGED
@@ -70,9 +70,11 @@ const MAX_RESPONSE_BYTES = 10 * 1024 * 1024; // 10 MB
70
70
  class HttpClient {
71
71
  baseUrl;
72
72
  tokenManager;
73
- constructor(baseUrl, tokenManager) {
73
+ agentSecret;
74
+ constructor(baseUrl, tokenManager, agentSecret) {
74
75
  this.baseUrl = baseUrl;
75
76
  this.tokenManager = tokenManager;
77
+ this.agentSecret = agentSecret;
76
78
  }
77
79
  async request(opts) {
78
80
  const headers = {
@@ -80,6 +82,10 @@ class HttpClient {
80
82
  "Content-Type": "application/json",
81
83
  ...opts.headers,
82
84
  };
85
+ if (this.agentSecret) {
86
+ headers["X-DominusNode-Agent"] = "mcp";
87
+ headers["X-DominusNode-Agent-Secret"] = this.agentSecret;
88
+ }
83
89
  if (opts.requiresAuth !== false) {
84
90
  const token = await this.tokenManager.getValidToken();
85
91
  // Guard against null/empty token to prevent "Bearer " header
@@ -6,6 +6,7 @@ export interface DominusNodeConfig {
6
6
  proxyHost?: string;
7
7
  httpProxyPort?: number;
8
8
  socks5ProxyPort?: number;
9
+ agentSecret?: string;
9
10
  }
10
11
  export interface User {
11
12
  id: string;
@@ -34,7 +34,7 @@ export class DominusNodeClient {
34
34
  constructor(config = {}) {
35
35
  const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
36
36
  this.tokenManager = new TokenManager();
37
- this.http = new HttpClient(baseUrl, this.tokenManager);
37
+ this.http = new HttpClient(baseUrl, this.tokenManager, config.agentSecret);
38
38
  // Initialize all resource modules BEFORE setting refresh function
39
39
  // this.auth must exist before refresh function can be invoked
40
40
  this.auth = new AuthResource(this.http);
@@ -9,7 +9,8 @@ export interface HttpOptions {
9
9
  export declare class HttpClient {
10
10
  private baseUrl;
11
11
  private tokenManager;
12
- constructor(baseUrl: string, tokenManager: TokenManager);
12
+ private agentSecret?;
13
+ constructor(baseUrl: string, tokenManager: TokenManager, agentSecret?: string);
13
14
  request<T>(opts: HttpOptions): Promise<T>;
14
15
  get<T>(path: string, requiresAuth?: boolean): Promise<T>;
15
16
  post<T>(path: string, body?: unknown, requiresAuth?: boolean): Promise<T>;
package/dist/esm/http.js CHANGED
@@ -67,9 +67,11 @@ const MAX_RESPONSE_BYTES = 10 * 1024 * 1024; // 10 MB
67
67
  export class HttpClient {
68
68
  baseUrl;
69
69
  tokenManager;
70
- constructor(baseUrl, tokenManager) {
70
+ agentSecret;
71
+ constructor(baseUrl, tokenManager, agentSecret) {
71
72
  this.baseUrl = baseUrl;
72
73
  this.tokenManager = tokenManager;
74
+ this.agentSecret = agentSecret;
73
75
  }
74
76
  async request(opts) {
75
77
  const headers = {
@@ -77,6 +79,10 @@ export class HttpClient {
77
79
  "Content-Type": "application/json",
78
80
  ...opts.headers,
79
81
  };
82
+ if (this.agentSecret) {
83
+ headers["X-DominusNode-Agent"] = "mcp";
84
+ headers["X-DominusNode-Agent-Secret"] = this.agentSecret;
85
+ }
80
86
  if (opts.requiresAuth !== false) {
81
87
  const token = await this.tokenManager.getValidToken();
82
88
  // Guard against null/empty token to prevent "Bearer " header
@@ -6,6 +6,7 @@ export interface DominusNodeConfig {
6
6
  proxyHost?: string;
7
7
  httpProxyPort?: number;
8
8
  socks5ProxyPort?: number;
9
+ agentSecret?: string;
9
10
  }
10
11
  export interface User {
11
12
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dominusnode/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Official Dominus Node SDK for Node.js/TypeScript",
5
5
  "author": "Dominus Node",
6
6
  "license": "MIT",