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 +6 -4
- package/package.json +1 -1
- package/protocols.js +1 -1
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.
|
|
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(),
|
|
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
|
-
|
|
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
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.
|
|
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
|