Skip to content

Commit bc20f4b

Browse files
Rebuild dist for 2.4.0
Picks up review-comment changes from d856796 (ECONNABORTED on abort, setCookie returns header string in Workers) which only updated src. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent fe653f8 commit bc20f4b

11 files changed

Lines changed: 103 additions & 24 deletions

dist/client/base_client.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ var BaseClient = /** @class */ (function () {
146146
err_1 = _e.sent();
147147
clearTimeout(timeoutId);
148148
wrapped = new Error((err_1 === null || err_1 === void 0 ? void 0 : err_1.message) || "Network request failed");
149+
if (controller.signal.aborted || (err_1 === null || err_1 === void 0 ? void 0 : err_1.name) === "AbortError") {
150+
wrapped.code = "ECONNABORTED";
151+
}
149152
wrapped.request = { url: finalUrl, method: method };
150153
wrapped.config = { url: finalUrl, method: method };
151154
throw wrapped;

dist/crowdhandler.cjs.js

Lines changed: 21 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.esm.js

Lines changed: 21 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.umd.js

Lines changed: 21 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.umd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/crowdhandler.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gatekeeper/gatekeeper.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,12 +790,23 @@ var Gatekeeper = /** @class */ (function () {
790790
*
791791
* @param {string} value - The cookie value to set (from result.cookieValue)
792792
* @param {string} domain - Optional domain pattern to determine cookie domain scope
793-
* @returns {boolean} True if the cookie was successfully set, false otherwise
793+
* @returns {boolean | string} In Node.js/Lambda/browser environments returns true on success
794+
* or false on failure. In Cloudflare Workers returns the Set-Cookie header string that
795+
* must be applied to the outgoing Response by the caller.
794796
*
795797
* @example
798+
* // Node.js / Lambda
796799
* if (result.setCookie) {
797800
* gatekeeper.setCookie(result.cookieValue, result.domain);
798801
* }
802+
*
803+
* @example
804+
* // Cloudflare Workers
805+
* if (result.setCookie) {
806+
* const setCookieHeader = gatekeeper.setCookie(result.cookieValue, result.domain);
807+
* // setCookieHeader is the Set-Cookie header value — apply it to the Response:
808+
* // response.headers.append('Set-Cookie', setCookieHeader as string);
809+
* }
799810
*/
800811
Gatekeeper.prototype.setCookie = function (value, domain) {
801812
try {
@@ -808,9 +819,12 @@ var Gatekeeper = /** @class */ (function () {
808819
(0, logger_1.logger)(this.options.debug, "info", "Setting cookie with domain: ".concat(cookieDomain));
809820
}
810821
}
811-
// Set the cookie with the provided value and options
812-
this.REQUEST.setCookie(value, this.STORAGE_NAME, cookieDomain);
813-
return true;
822+
// Set the cookie with the provided value and options.
823+
// CloudflareWorkersHandler returns the Set-Cookie header string because
824+
// Workers are response-out and the caller must apply the header manually.
825+
// All other handlers set the cookie as a side-effect and return void.
826+
var result = this.REQUEST.setCookie(value, this.STORAGE_NAME, cookieDomain);
827+
return typeof result === 'string' ? result : true;
814828
}
815829
catch (error) {
816830
(0, logger_1.logger)(this.options.debug, "error", error);

0 commit comments

Comments
 (0)