@loyaltte/node 0.1.0 → 0.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.
- package/README.md +1 -1
- package/dist/cjs/transport.js +8 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/transport.js +8 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cjs/transport.js
CHANGED
|
@@ -92,13 +92,17 @@ class Transport {
|
|
|
92
92
|
const retriesLeft = attempt <= maxRetries && slept < exports.RETRY.maxTotalSleepMs;
|
|
93
93
|
let response;
|
|
94
94
|
let text;
|
|
95
|
+
// A plain timer (not AbortSignal.timeout, whose timer is unref'd on Node 18) so the timeout always fires,
|
|
96
|
+
// covering the body read too; cleared as soon as the attempt ends.
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
const timer = setTimeout(() => controller.abort(new DOMException("The request timed out.", "TimeoutError")), timeoutMs);
|
|
95
99
|
try {
|
|
96
100
|
response = await fetch(url, {
|
|
97
101
|
method: operation.method,
|
|
98
102
|
headers,
|
|
99
103
|
body,
|
|
100
104
|
redirect: "error", // never follow a redirect with the key attached
|
|
101
|
-
signal:
|
|
105
|
+
signal: controller.signal,
|
|
102
106
|
});
|
|
103
107
|
text = await response.text();
|
|
104
108
|
}
|
|
@@ -116,6 +120,9 @@ class Transport {
|
|
|
116
120
|
}
|
|
117
121
|
throw this.#connectionError(error);
|
|
118
122
|
}
|
|
123
|
+
finally {
|
|
124
|
+
clearTimeout(timer);
|
|
125
|
+
}
|
|
119
126
|
if (response.ok)
|
|
120
127
|
return this.#parse(response, text);
|
|
121
128
|
const failure = this.#failure(response, text);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The SDK's own version: sent as `X-Loyaltte-SDK: node/<version>` on every call. Kept equal to package.json. */
|
|
2
|
-
export declare const VERSION = "0.1.
|
|
2
|
+
export declare const VERSION = "0.1.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/transport.js
CHANGED
|
@@ -88,13 +88,17 @@ export class Transport {
|
|
|
88
88
|
const retriesLeft = attempt <= maxRetries && slept < RETRY.maxTotalSleepMs;
|
|
89
89
|
let response;
|
|
90
90
|
let text;
|
|
91
|
+
// A plain timer (not AbortSignal.timeout, whose timer is unref'd on Node 18) so the timeout always fires,
|
|
92
|
+
// covering the body read too; cleared as soon as the attempt ends.
|
|
93
|
+
const controller = new AbortController();
|
|
94
|
+
const timer = setTimeout(() => controller.abort(new DOMException("The request timed out.", "TimeoutError")), timeoutMs);
|
|
91
95
|
try {
|
|
92
96
|
response = await fetch(url, {
|
|
93
97
|
method: operation.method,
|
|
94
98
|
headers,
|
|
95
99
|
body,
|
|
96
100
|
redirect: "error", // never follow a redirect with the key attached
|
|
97
|
-
signal:
|
|
101
|
+
signal: controller.signal,
|
|
98
102
|
});
|
|
99
103
|
text = await response.text();
|
|
100
104
|
}
|
|
@@ -112,6 +116,9 @@ export class Transport {
|
|
|
112
116
|
}
|
|
113
117
|
throw this.#connectionError(error);
|
|
114
118
|
}
|
|
119
|
+
finally {
|
|
120
|
+
clearTimeout(timer);
|
|
121
|
+
}
|
|
115
122
|
if (response.ok)
|
|
116
123
|
return this.#parse(response, text);
|
|
117
124
|
const failure = this.#failure(response, text);
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The SDK's own version: sent as `X-Loyaltte-SDK: node/<version>` on every call. Kept equal to package.json. */
|
|
2
|
-
export declare const VERSION = "0.1.
|
|
2
|
+
export declare const VERSION = "0.1.1";
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The SDK's own version: sent as `X-Loyaltte-SDK: node/<version>` on every call. Kept equal to package.json. */
|
|
2
|
-
export const VERSION = "0.1.
|
|
2
|
+
export const VERSION = "0.1.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loyaltte/node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Loyaltte for Node.js servers: record bills and returns exactly once, look up customers and points, send events, sign customers in for the app SDKs, and verify webhooks. Zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://developers.loyaltte.com/",
|