pmxt-core 2.35.32 → 2.36.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.
@@ -12,6 +12,11 @@ export interface ApiEndpoint {
12
12
  isPrivate?: boolean;
13
13
  /** Identifier used to generate the implicit API method name. */
14
14
  operationId?: string;
15
+ /**
16
+ * When set, requests use this base URL instead of the descriptor default
17
+ * (OpenAPI path- or operation-level `servers` override).
18
+ */
19
+ baseUrl?: string;
15
20
  }
16
21
  export interface ApiDescriptor {
17
22
  /** Base URL that all endpoint paths are resolved against. */
@@ -982,7 +982,7 @@ class PredictionMarketExchange {
982
982
  if (name in this) {
983
983
  continue;
984
984
  }
985
- this[name] = this.createImplicitMethod(name, endpoint, descriptor.baseUrl);
985
+ this[name] = this.createImplicitMethod(name, endpoint, endpoint.baseUrl ?? descriptor.baseUrl);
986
986
  }
987
987
  }
988
988
  /**
@@ -1002,7 +1002,7 @@ class PredictionMarketExchange {
1002
1002
  /**
1003
1003
  * Creates an async function for an implicit API endpoint.
1004
1004
  */
1005
- createImplicitMethod(name, endpoint, baseUrl) {
1005
+ createImplicitMethod(name, endpoint, resolvedBaseUrl) {
1006
1006
  return async (params) => {
1007
1007
  const allParams = { ...(params || {}) };
1008
1008
  // Substitute path parameters like {ticker} from params
@@ -1020,7 +1020,7 @@ class PredictionMarketExchange {
1020
1020
  if (endpoint.isPrivate) {
1021
1021
  headers = this.sign(endpoint.method, resolvedPath, allParams);
1022
1022
  }
1023
- const url = `${baseUrl}${resolvedPath}`;
1023
+ const url = `${resolvedBaseUrl}${resolvedPath}`;
1024
1024
  const method = endpoint.method.toUpperCase();
1025
1025
  try {
1026
1026
  let response;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
3
- * Generated at: 2026-05-01T12:04:30.287Z
3
+ * Generated at: 2026-05-03T08:52:44.008Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const kalshiApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.kalshiApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
6
- * Generated at: 2026-05-01T12:04:30.287Z
6
+ * Generated at: 2026-05-03T08:52:44.008Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.kalshiApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
3
- * Generated at: 2026-05-01T12:04:30.324Z
3
+ * Generated at: 2026-05-03T08:52:44.066Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const limitlessApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.limitlessApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
6
- * Generated at: 2026-05-01T12:04:30.324Z
6
+ * Generated at: 2026-05-03T08:52:44.066Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.limitlessApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
3
- * Generated at: 2026-05-01T12:04:30.336Z
3
+ * Generated at: 2026-05-03T08:52:44.082Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const myriadApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.myriadApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
6
- * Generated at: 2026-05-01T12:04:30.336Z
6
+ * Generated at: 2026-05-03T08:52:44.082Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.myriadApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
3
- * Generated at: 2026-05-01T12:04:30.340Z
3
+ * Generated at: 2026-05-03T08:52:44.089Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const opinionApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.opinionApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
6
- * Generated at: 2026-05-01T12:04:30.340Z
6
+ * Generated at: 2026-05-03T08:52:44.089Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.opinionApiSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
3
- * Generated at: 2026-05-01T12:04:30.294Z
3
+ * Generated at: 2026-05-03T08:52:44.016Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketClobSpec: {
@@ -349,6 +349,7 @@ export declare const polymarketClobSpec: {
349
349
  };
350
350
  "/geoblock": {
351
351
  get: {
352
+ operationId: string;
352
353
  summary: string;
353
354
  tags: string[];
354
355
  servers: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketClobSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
6
- * Generated at: 2026-05-01T12:04:30.294Z
6
+ * Generated at: 2026-05-03T08:52:44.016Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketClobSpec = {
@@ -520,6 +520,7 @@ exports.polymarketClobSpec = {
520
520
  },
521
521
  "/geoblock": {
522
522
  "get": {
523
+ "operationId": "getGeoblock",
523
524
  "summary": "Check Geoblock Status",
524
525
  "tags": [
525
526
  "System"
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
3
- * Generated at: 2026-05-01T12:04:30.307Z
3
+ * Generated at: 2026-05-03T08:52:44.040Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketDataSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketDataSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
6
- * Generated at: 2026-05-01T12:04:30.307Z
6
+ * Generated at: 2026-05-03T08:52:44.040Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketDataSpec = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
3
- * Generated at: 2026-05-01T12:04:30.304Z
3
+ * Generated at: 2026-05-03T08:52:44.035Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const polymarketGammaSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.polymarketGammaSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
6
- * Generated at: 2026-05-01T12:04:30.304Z
6
+ * Generated at: 2026-05-03T08:52:44.035Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -34,8 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.PolymarketFetcher = void 0;
37
+ const errors_1 = require("../../errors");
37
38
  const utils_1 = require("./utils");
38
- const errors_1 = require("./errors");
39
+ const errors_2 = require("./errors");
39
40
  /**
40
41
  * Coerce a value that should be a Date into an actual Date instance.
41
42
  * Handles strings (ISO 8601), epoch numbers (seconds or milliseconds),
@@ -84,7 +85,7 @@ class PolymarketFetcher {
84
85
  return this.fetchRawMarketsDefault(params);
85
86
  }
86
87
  catch (error) {
87
- throw errors_1.polymarketErrorMapper.mapError(error);
88
+ throw errors_2.polymarketErrorMapper.mapError(error);
88
89
  }
89
90
  }
90
91
  // ------------------------------------------------------------------------
@@ -106,7 +107,7 @@ class PolymarketFetcher {
106
107
  return this.fetchRawEventsDefault(params);
107
108
  }
108
109
  catch (error) {
109
- throw errors_1.polymarketErrorMapper.mapError(error);
110
+ throw errors_2.polymarketErrorMapper.mapError(error);
110
111
  }
111
112
  }
112
113
  // ------------------------------------------------------------------------
@@ -136,7 +137,7 @@ class PolymarketFetcher {
136
137
  return { history: data.history || [] };
137
138
  }
138
139
  catch (error) {
139
- throw errors_1.polymarketErrorMapper.mapError(error);
140
+ throw errors_2.polymarketErrorMapper.mapError(error);
140
141
  }
141
142
  }
142
143
  // ------------------------------------------------------------------------
@@ -148,7 +149,14 @@ class PolymarketFetcher {
148
149
  return data;
149
150
  }
150
151
  catch (error) {
151
- throw errors_1.polymarketErrorMapper.mapError(error);
152
+ const mapped = errors_2.polymarketErrorMapper.mapError(error);
153
+ // The CLOB returns a generic "order not found" for missing books,
154
+ // which the heuristic mapper mis-categorises as OrderNotFound.
155
+ // Normalise to NotFound so all venues behave the same for order-book lookups.
156
+ if (mapped instanceof errors_1.OrderNotFound) {
157
+ throw new errors_1.NotFound(`Order book not found: ${id}`, 'Polymarket');
158
+ }
159
+ throw mapped;
152
160
  }
153
161
  }
154
162
  // ------------------------------------------------------------------------
@@ -169,7 +177,7 @@ class PolymarketFetcher {
169
177
  return trades;
170
178
  }
171
179
  catch (error) {
172
- throw errors_1.polymarketErrorMapper.mapError(error);
180
+ throw errors_2.polymarketErrorMapper.mapError(error);
173
181
  }
174
182
  }
175
183
  async fetchRawMyTrades(params, walletAddress) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
3
- * Generated at: 2026-05-01T12:04:30.329Z
3
+ * Generated at: 2026-05-03T08:52:44.075Z
4
4
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
5
5
  */
6
6
  export declare const probableApiSpec: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.probableApiSpec = void 0;
4
4
  /**
5
5
  * Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
6
- * Generated at: 2026-05-01T12:04:30.329Z
6
+ * Generated at: 2026-05-03T08:52:44.075Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
@@ -129,8 +129,8 @@ class ErrorMapper {
129
129
  */
130
130
  mapNotFoundError(message, data) {
131
131
  const lowerMessage = message.toLowerCase();
132
- // Detect order not found
133
- if (lowerMessage.includes('order')) {
132
+ // Detect order not found (but not "order book" — that's a different resource)
133
+ if (lowerMessage.includes('order') && !lowerMessage.includes('order book')) {
134
134
  // Try to extract order ID from message
135
135
  const orderIdMatch = message.match(/order[:\s]+([a-zA-Z0-9-]+)/i);
136
136
  const orderId = orderIdMatch ? orderIdMatch[1] : 'unknown';
@@ -37,12 +37,25 @@ function parseOpenApiSpec(spec, baseUrl) {
37
37
  // Inherit top-level security when operations don't define their own
38
38
  const topLevelSecurity = !!(spec.security && spec.security.length > 0);
39
39
  const paths = spec.paths || {};
40
- for (const [path, methods] of Object.entries(paths)) {
41
- for (const [httpMethod, operation] of Object.entries(methods)) {
42
- // Skip non-HTTP-method keys like "parameters"
40
+ for (const [path, pathItem] of Object.entries(paths)) {
41
+ if (!pathItem || typeof pathItem !== 'object') {
42
+ continue;
43
+ }
44
+ const pathServerUrl = Array.isArray(pathItem.servers) && pathItem.servers[0]?.url
45
+ ? String(pathItem.servers[0].url).replace(/\/$/, '')
46
+ : undefined;
47
+ for (const [httpMethod, operation] of Object.entries(pathItem)) {
48
+ // Skip non-HTTP-method keys like "parameters", "servers"
43
49
  if (!['get', 'post', 'put', 'patch', 'delete'].includes(httpMethod.toLowerCase())) {
44
50
  continue;
45
51
  }
52
+ if (!operation || typeof operation !== 'object') {
53
+ continue;
54
+ }
55
+ const opServerUrl = Array.isArray(operation.servers) && operation.servers[0]?.url
56
+ ? String(operation.servers[0].url).replace(/\/$/, '')
57
+ : undefined;
58
+ const endpointBaseUrl = opServerUrl || pathServerUrl;
46
59
  const name = operation.operationId || generateMethodName(httpMethod, path);
47
60
  const isPrivate = operation.security !== undefined
48
61
  ? !!(operation.security && operation.security.length > 0)
@@ -52,6 +65,7 @@ function parseOpenApiSpec(spec, baseUrl) {
52
65
  path,
53
66
  isPrivate,
54
67
  operationId: operation.operationId,
68
+ ...(endpointBaseUrl ? { baseUrl: endpointBaseUrl } : {}),
55
69
  };
56
70
  }
57
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.35.32",
3
+ "version": "2.36.1",
4
4
  "description": "pmxt is a unified prediction market data API. The ccxt for prediction markets.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "test": "jest -c jest.config.js",
30
30
  "server": "tsx watch src/server/index.ts",
31
31
  "server:prod": "node dist/server/index.js",
32
- "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.35.32,library=urllib3",
33
- "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.35.32,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
32
+ "generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.36.1,library=urllib3",
33
+ "generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.36.1,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
34
34
  "fetch:openapi": "node scripts/fetch-openapi-specs.js",
35
35
  "extract:jsdoc": "node ../scripts/extract-jsdoc.js",
36
36
  "generate:docs": "npm run extract:jsdoc && node ../scripts/generate-api-docs.js",