m2m-market 2.8.0 → 2.8.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.
package/index.js CHANGED
@@ -54,7 +54,7 @@ function finishExternal(result, candidateId, key, options, attempts) {
54
54
  return out;
55
55
  }
56
56
 
57
- export const SDK_VERSION = "2.8.0";
57
+ export const SDK_VERSION = "2.8.1";
58
58
 
59
59
  const ms = (value) => Math.max(0, Math.round(value));
60
60
 
@@ -149,7 +149,7 @@ export class M2MConnectionClient {
149
149
  _sendTiming(target, agent) {
150
150
  if (!this.reportTiming || !agent || agent.call_total_ms === undefined) return;
151
151
  const controller = new AbortController();
152
- const timer = setTimeout(() => controller.abort(), 2000);
152
+ const timer = setTimeout(() => controller.abort(), 5000);
153
153
  if (typeof timer.unref === "function") timer.unref();
154
154
  Promise.resolve()
155
155
  .then(() => this.fetchImpl(`${this.baseUrl}/connect/timing`, {
@@ -302,9 +302,11 @@ export class M2MConnectionClient {
302
302
  }
303
303
 
304
304
  /** @deprecated Use buyExternal(null, { body, query }, { candidateId, idempotencyKey }). */
305
- purchaseExternal(candidateId, options) {
305
+ async purchaseExternal(candidateId, options) {
306
306
  deprecated("purchaseExternal", "buyExternal(null, { body, query }, { candidateId, idempotencyKey })");
307
- return this._purchaseExternal(candidateId, options);
307
+ const result = await this._purchaseExternal(candidateId, options);
308
+ if (!(options && options.dryRun)) this._sendTiming({ idempotency_key: result.idempotency_key }, { ...this._lastTiming });
309
+ return result;
308
310
  }
309
311
 
310
312
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m2m-market",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Customer SDK for connecting AI Agents to M2M Market",
5
5
  "author": "M2M Market, Inc.",
6
6
  "type": "module",
package/protocols.js CHANGED
@@ -32,7 +32,7 @@ export async function connectMcp({ accessToken, timeoutMs = 30000, fetchImpl = g
32
32
  const transport = new sdk.StreamableHTTPClientTransport(new URL(MCP_RESOURCE), {
33
33
  fetch: guardedFetch, reconnectionOptions: { maxRetries: 0, initialReconnectionDelay: 1000, maxReconnectionDelay: 1000, reconnectionDelayGrowFactor: 1 }
34
34
  });
35
- const client = new sdk.Client({ name: 'm2m-market', version: '2.8.0' });
35
+ const client = new sdk.Client({ name: 'm2m-market', version: '2.8.1' });
36
36
  try { await client.connect(transport); }
37
37
  catch { await client.close().catch(() => {}); throw new M2MAPIError('mcp_connection_failed'); }
38
38
  return client; // caller closes it in finally; no automatic paid call or replay