pmxtjs 2.17.8 → 2.17.9

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,6 +37,8 @@ export declare class ServerManager {
37
37
  isServerRunning(): Promise<boolean>;
38
38
  /**
39
39
  * Wait for the server to be ready.
40
+ * Requires a lock file to be present to avoid falsely matching an unrelated
41
+ * server that may already be running on the default port.
40
42
  */
41
43
  private waitForServer;
42
44
  /**
@@ -76,11 +76,24 @@ export class ServerManager {
76
76
  }
77
77
  /**
78
78
  * Wait for the server to be ready.
79
+ * Requires a lock file to be present to avoid falsely matching an unrelated
80
+ * server that may already be running on the default port.
79
81
  */
80
82
  async waitForServer() {
81
83
  for (let i = 0; i < this.maxRetries; i++) {
82
- if (await this.isServerRunning()) {
83
- return;
84
+ const info = this.getServerInfo();
85
+ if (info) {
86
+ try {
87
+ const response = await fetch(`http://localhost:${info.port}/health`);
88
+ if (response.ok) {
89
+ const data = await response.json();
90
+ if (data.status === "ok")
91
+ return;
92
+ }
93
+ }
94
+ catch {
95
+ // Not ready yet
96
+ }
84
97
  }
85
98
  await new Promise((resolve) => setTimeout(resolve, this.retryDelayMs));
86
99
  }
@@ -37,6 +37,8 @@ export declare class ServerManager {
37
37
  isServerRunning(): Promise<boolean>;
38
38
  /**
39
39
  * Wait for the server to be ready.
40
+ * Requires a lock file to be present to avoid falsely matching an unrelated
41
+ * server that may already be running on the default port.
40
42
  */
41
43
  private waitForServer;
42
44
  /**
@@ -112,11 +112,24 @@ class ServerManager {
112
112
  }
113
113
  /**
114
114
  * Wait for the server to be ready.
115
+ * Requires a lock file to be present to avoid falsely matching an unrelated
116
+ * server that may already be running on the default port.
115
117
  */
116
118
  async waitForServer() {
117
119
  for (let i = 0; i < this.maxRetries; i++) {
118
- if (await this.isServerRunning()) {
119
- return;
120
+ const info = this.getServerInfo();
121
+ if (info) {
122
+ try {
123
+ const response = await fetch(`http://localhost:${info.port}/health`);
124
+ if (response.ok) {
125
+ const data = await response.json();
126
+ if (data.status === "ok")
127
+ return;
128
+ }
129
+ }
130
+ catch {
131
+ // Not ready yet
132
+ }
120
133
  }
121
134
  await new Promise((resolve) => setTimeout(resolve, this.retryDelayMs));
122
135
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.17.8",
3
+ "version": "2.17.9",
4
4
  "description": "OpenAPI client for pmxtjs",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.17.8",
3
+ "version": "2.17.9",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "unified"
44
44
  ],
45
45
  "dependencies": {
46
- "pmxt-core": "2.17.8"
46
+ "pmxt-core": "2.17.9"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/jest": "^30.0.0",
@@ -98,11 +98,22 @@ export class ServerManager {
98
98
 
99
99
  /**
100
100
  * Wait for the server to be ready.
101
+ * Requires a lock file to be present to avoid falsely matching an unrelated
102
+ * server that may already be running on the default port.
101
103
  */
102
104
  private async waitForServer(): Promise<void> {
103
105
  for (let i = 0; i < this.maxRetries; i++) {
104
- if (await this.isServerRunning()) {
105
- return;
106
+ const info = this.getServerInfo();
107
+ if (info) {
108
+ try {
109
+ const response = await fetch(`http://localhost:${info.port}/health`);
110
+ if (response.ok) {
111
+ const data = await response.json() as any;
112
+ if (data.status === "ok") return;
113
+ }
114
+ } catch {
115
+ // Not ready yet
116
+ }
106
117
  }
107
118
  await new Promise((resolve) => setTimeout(resolve, this.retryDelayMs));
108
119
  }