@doist/twist-sdk 2.9.1 → 2.9.3
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.
|
@@ -121,7 +121,7 @@ function isNodeEnvironment() {
|
|
|
121
121
|
}
|
|
122
122
|
function createDefaultDispatcher() {
|
|
123
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
-
var _a, EnvHttpProxyAgent, interceptors, decompress;
|
|
124
|
+
var _a, EnvHttpProxyAgent, interceptors, agent, decompress;
|
|
125
125
|
return __generator(this, function (_b) {
|
|
126
126
|
switch (_b.label) {
|
|
127
127
|
case 0:
|
|
@@ -131,8 +131,19 @@ function createDefaultDispatcher() {
|
|
|
131
131
|
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('undici')); })];
|
|
132
132
|
case 1:
|
|
133
133
|
_a = _b.sent(), EnvHttpProxyAgent = _a.EnvHttpProxyAgent, interceptors = _a.interceptors;
|
|
134
|
+
agent = new EnvHttpProxyAgent(keepAliveOptions);
|
|
135
|
+
// Some runtimes report `process.versions.node` (so `isNodeEnvironment()`
|
|
136
|
+
// passes) but ship only a partial undici: `interceptors.decompress` is
|
|
137
|
+
// absent and dispatchers have no `.compose`. Bun is the common case. There
|
|
138
|
+
// the proxy agent alone is enough — Bun's `fetch` decompresses
|
|
139
|
+
// gzip/deflate/br/zstd natively — so skip the interceptor instead of
|
|
140
|
+
// crashing on the missing API. Optional chaining also guards a runtime that
|
|
141
|
+
// omits the `interceptors` export entirely.
|
|
142
|
+
if (typeof (interceptors === null || interceptors === void 0 ? void 0 : interceptors.decompress) !== 'function') {
|
|
143
|
+
return [2 /*return*/, agent];
|
|
144
|
+
}
|
|
134
145
|
decompress = suppressExperimentalWarningsSync(function () { return interceptors.decompress(); });
|
|
135
|
-
return [2 /*return*/,
|
|
146
|
+
return [2 /*return*/, agent.compose(decompress)];
|
|
136
147
|
}
|
|
137
148
|
});
|
|
138
149
|
});
|
|
@@ -83,25 +83,29 @@ function isNodeEnvironment() {
|
|
|
83
83
|
}
|
|
84
84
|
function createDefaultDispatcher() {
|
|
85
85
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var _a, EnvHttpProxyAgent, interceptors, decompress;
|
|
86
|
+
var _a, EnvHttpProxyAgent, interceptors, agent, decompress;
|
|
87
87
|
return __generator(this, function (_b) {
|
|
88
88
|
switch (_b.label) {
|
|
89
89
|
case 0:
|
|
90
90
|
if (!isNodeEnvironment()) {
|
|
91
91
|
return [2 /*return*/, undefined];
|
|
92
92
|
}
|
|
93
|
-
return [4 /*yield*/, import('undici')
|
|
94
|
-
// Compose the response-decompression interceptor so gzip/deflate/br/zstd
|
|
95
|
-
// bodies are decoded before consumers parse them. Required on Node 24+:
|
|
96
|
-
// attaching any custom dispatcher to the global `fetch` strips the
|
|
97
|
-
// `content-encoding` header but does not actually decompress the body,
|
|
98
|
-
// so callers receive raw gzipped bytes and `JSON.parse` fails.
|
|
99
|
-
// See https://github.com/Doist/todoist-cli/issues/318.
|
|
100
|
-
];
|
|
93
|
+
return [4 /*yield*/, import('undici')];
|
|
101
94
|
case 1:
|
|
102
95
|
_a = _b.sent(), EnvHttpProxyAgent = _a.EnvHttpProxyAgent, interceptors = _a.interceptors;
|
|
96
|
+
agent = new EnvHttpProxyAgent(keepAliveOptions);
|
|
97
|
+
// Some runtimes report `process.versions.node` (so `isNodeEnvironment()`
|
|
98
|
+
// passes) but ship only a partial undici: `interceptors.decompress` is
|
|
99
|
+
// absent and dispatchers have no `.compose`. Bun is the common case. There
|
|
100
|
+
// the proxy agent alone is enough — Bun's `fetch` decompresses
|
|
101
|
+
// gzip/deflate/br/zstd natively — so skip the interceptor instead of
|
|
102
|
+
// crashing on the missing API. Optional chaining also guards a runtime that
|
|
103
|
+
// omits the `interceptors` export entirely.
|
|
104
|
+
if (typeof (interceptors === null || interceptors === void 0 ? void 0 : interceptors.decompress) !== 'function') {
|
|
105
|
+
return [2 /*return*/, agent];
|
|
106
|
+
}
|
|
103
107
|
decompress = suppressExperimentalWarningsSync(function () { return interceptors.decompress(); });
|
|
104
|
-
return [2 /*return*/,
|
|
108
|
+
return [2 /*return*/, agent.compose(decompress)];
|
|
105
109
|
}
|
|
106
110
|
});
|
|
107
111
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/twist-sdk",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.3",
|
|
4
4
|
"description": "A TypeScript wrapper for the Twist REST API.",
|
|
5
5
|
"author": "Doist developers",
|
|
6
6
|
"homepage": "https://doist.github.io/twist-sdk-typescript/",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"camelcase": "8.0.0",
|
|
47
47
|
"ts-custom-error": "^3.2.0",
|
|
48
|
-
"undici": "
|
|
48
|
+
"undici": "7.24.8",
|
|
49
49
|
"uuid": "^11.1.0",
|
|
50
50
|
"zod": "4.1.12"
|
|
51
51
|
},
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"ts-node": "10.9.2",
|
|
67
67
|
"type-fest": "^5.0.0",
|
|
68
68
|
"typescript": "5.9.3",
|
|
69
|
-
"vitest": "4.0
|
|
69
|
+
"vitest": "4.1.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"type-fest": "^4.12.0 || ^5.1.0"
|