From c1a285145b9d317df6ced56c09f525b5c2b6f755 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 20 Dec 2024 18:12:15 +0000 Subject: [PATCH] build(release): 1.11.1 [skip ci] ## [1.11.1](https://github.com/actions/create-github-app-token/compare/v1.11.0...v1.11.1) (2024-12-20) ### Bug Fixes * **deps:** bump the production-dependencies group across 1 directory with 3 updates ([#193](https://github.com/actions/create-github-app-token/issues/193)) ([fa6118c](https://github.com/actions/create-github-app-token/commit/fa6118ca8519e5d19f94c18bbaaa727bd543ae0d)), closes [#1842](https://github.com/actions/create-github-app-token/issues/1842) [#1551](https://github.com/actions/create-github-app-token/issues/1551) [#1824](https://github.com/actions/create-github-app-token/issues/1824) [#654](https://github.com/actions/create-github-app-token/issues/654) [#651](https://github.com/actions/create-github-app-token/issues/651) [#654](https://github.com/actions/create-github-app-token/issues/654) [#652](https://github.com/actions/create-github-app-token/issues/652) [#644](https://github.com/actions/create-github-app-token/issues/644) [#651](https://github.com/actions/create-github-app-token/issues/651) [#650](https://github.com/actions/create-github-app-token/issues/650) [#648](https://github.com/actions/create-github-app-token/issues/648) [#646](https://github.com/actions/create-github-app-token/issues/646) [#645](https://github.com/actions/create-github-app-token/issues/645) [#626](https://github.com/actions/create-github-app-token/issues/626) [#643](https://github.com/actions/create-github-app-token/issues/643) [#82](https://github.com/actions/create-github-app-token/issues/82) [#82](https://github.com/actions/create-github-app-token/issues/82) --- dist/main.cjs | 3291 ++++++++++++++++++++++--------------------------- dist/post.cjs | 1738 +++++++++++++++++++------- package.json | 2 +- 3 files changed, 2710 insertions(+), 2321 deletions(-) diff --git a/dist/main.cjs b/dist/main.cjs index 3baed63..2128bf0 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -4,9 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; @@ -31,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/@actions/core/lib/utils.js var require_utils = __commonJS({ @@ -71,9 +67,13 @@ var require_command = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; @@ -87,7 +87,7 @@ var require_command = __commonJS({ if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); } __setModuleDefault(result, mod); return result; @@ -139,344 +139,11 @@ var require_command = __commonJS({ } }; function escapeData(s) { - return utils_1.toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); + return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); } function escapeProperty(s) { - return utils_1.toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); - } - } -}); - -// node_modules/uuid/dist/esm-node/rng.js -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - import_crypto.default.randomFillSync(rnds8Pool); - poolPtr = 0; - } - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} -var import_crypto, rnds8Pool, poolPtr; -var init_rng = __esm({ - "node_modules/uuid/dist/esm-node/rng.js"() { - import_crypto = __toESM(require("crypto")); - rnds8Pool = new Uint8Array(256); - poolPtr = rnds8Pool.length; - } -}); - -// node_modules/uuid/dist/esm-node/regex.js -var regex_default; -var init_regex = __esm({ - "node_modules/uuid/dist/esm-node/regex.js"() { - regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; - } -}); - -// node_modules/uuid/dist/esm-node/validate.js -function validate(uuid) { - return typeof uuid === "string" && regex_default.test(uuid); -} -var validate_default; -var init_validate = __esm({ - "node_modules/uuid/dist/esm-node/validate.js"() { - init_regex(); - validate_default = validate; - } -}); - -// node_modules/uuid/dist/esm-node/stringify.js -function stringify(arr, offset = 0) { - const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); - if (!validate_default(uuid)) { - throw TypeError("Stringified UUID is invalid"); - } - return uuid; -} -var byteToHex, stringify_default; -var init_stringify = __esm({ - "node_modules/uuid/dist/esm-node/stringify.js"() { - init_validate(); - byteToHex = []; - for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 256).toString(16).substr(1)); - } - stringify_default = stringify; - } -}); - -// node_modules/uuid/dist/esm-node/v1.js -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || rng)(); - if (node == null) { - node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - if (clockseq == null) { - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; - } - } - let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); - let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; - if (dt < 0 && options.clockseq === void 0) { - clockseq = clockseq + 1 & 16383; - } - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { - nsecs = 0; - } - if (nsecs >= 1e4) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - msecs += 122192928e5; - const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; - b[i++] = tl >>> 24 & 255; - b[i++] = tl >>> 16 & 255; - b[i++] = tl >>> 8 & 255; - b[i++] = tl & 255; - const tmh = msecs / 4294967296 * 1e4 & 268435455; - b[i++] = tmh >>> 8 & 255; - b[i++] = tmh & 255; - b[i++] = tmh >>> 24 & 15 | 16; - b[i++] = tmh >>> 16 & 255; - b[i++] = clockseq >>> 8 | 128; - b[i++] = clockseq & 255; - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - return buf || stringify_default(b); -} -var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; -var init_v1 = __esm({ - "node_modules/uuid/dist/esm-node/v1.js"() { - init_rng(); - init_stringify(); - _lastMSecs = 0; - _lastNSecs = 0; - v1_default = v1; - } -}); - -// node_modules/uuid/dist/esm-node/parse.js -function parse(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - let v; - const arr = new Uint8Array(16); - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 255; - arr[2] = v >>> 8 & 255; - arr[3] = v & 255; - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 255; - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 255; - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 255; - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; - arr[11] = v / 4294967296 & 255; - arr[12] = v >>> 24 & 255; - arr[13] = v >>> 16 & 255; - arr[14] = v >>> 8 & 255; - arr[15] = v & 255; - return arr; -} -var parse_default; -var init_parse = __esm({ - "node_modules/uuid/dist/esm-node/parse.js"() { - init_validate(); - parse_default = parse; - } -}); - -// node_modules/uuid/dist/esm-node/v35.js -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); - const bytes = []; - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - return bytes; -} -function v35_default(name, version2, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === "string") { - value = stringToBytes(value); - } - if (typeof namespace === "string") { - namespace = parse_default(namespace); - } - if (namespace.length !== 16) { - throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); - } - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 15 | version2; - bytes[8] = bytes[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - return buf; + return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); } - return stringify_default(bytes); - } - try { - generateUUID.name = name; - } catch (err) { - } - generateUUID.DNS = DNS; - generateUUID.URL = URL2; - return generateUUID; -} -var DNS, URL2; -var init_v35 = __esm({ - "node_modules/uuid/dist/esm-node/v35.js"() { - init_stringify(); - init_parse(); - DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; - URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; - } -}); - -// node_modules/uuid/dist/esm-node/md5.js -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto2.default.createHash("md5").update(bytes).digest(); -} -var import_crypto2, md5_default; -var init_md5 = __esm({ - "node_modules/uuid/dist/esm-node/md5.js"() { - import_crypto2 = __toESM(require("crypto")); - md5_default = md5; - } -}); - -// node_modules/uuid/dist/esm-node/v3.js -var v3, v3_default; -var init_v3 = __esm({ - "node_modules/uuid/dist/esm-node/v3.js"() { - init_v35(); - init_md5(); - v3 = v35_default("v3", 48, md5_default); - v3_default = v3; - } -}); - -// node_modules/uuid/dist/esm-node/v4.js -function v4(options, buf, offset) { - options = options || {}; - const rnds = options.random || (options.rng || rng)(); - rnds[6] = rnds[6] & 15 | 64; - rnds[8] = rnds[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - return buf; - } - return stringify_default(rnds); -} -var v4_default; -var init_v4 = __esm({ - "node_modules/uuid/dist/esm-node/v4.js"() { - init_rng(); - init_stringify(); - v4_default = v4; - } -}); - -// node_modules/uuid/dist/esm-node/sha1.js -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto3.default.createHash("sha1").update(bytes).digest(); -} -var import_crypto3, sha1_default; -var init_sha1 = __esm({ - "node_modules/uuid/dist/esm-node/sha1.js"() { - import_crypto3 = __toESM(require("crypto")); - sha1_default = sha1; - } -}); - -// node_modules/uuid/dist/esm-node/v5.js -var v5, v5_default; -var init_v5 = __esm({ - "node_modules/uuid/dist/esm-node/v5.js"() { - init_v35(); - init_sha1(); - v5 = v35_default("v5", 80, sha1_default); - v5_default = v5; - } -}); - -// node_modules/uuid/dist/esm-node/nil.js -var nil_default; -var init_nil = __esm({ - "node_modules/uuid/dist/esm-node/nil.js"() { - nil_default = "00000000-0000-0000-0000-000000000000"; - } -}); - -// node_modules/uuid/dist/esm-node/version.js -function version(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - return parseInt(uuid.substr(14, 1), 16); -} -var version_default; -var init_version = __esm({ - "node_modules/uuid/dist/esm-node/version.js"() { - init_validate(); - version_default = version; - } -}); - -// node_modules/uuid/dist/esm-node/index.js -var esm_node_exports = {}; -__export(esm_node_exports, { - NIL: () => nil_default, - parse: () => parse_default, - stringify: () => stringify_default, - v1: () => v1_default, - v3: () => v3_default, - v4: () => v4_default, - v5: () => v5_default, - validate: () => validate_default, - version: () => version_default -}); -var init_esm_node = __esm({ - "node_modules/uuid/dist/esm-node/index.js"() { - init_v1(); - init_v3(); - init_v4(); - init_v5(); - init_nil(); - init_version(); - init_validate(); - init_stringify(); - init_parse(); } }); @@ -486,9 +153,13 @@ var require_file_command = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; @@ -502,16 +173,16 @@ var require_file_command = __commonJS({ if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); } __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; + var crypto = __importStar(require("crypto")); var fs = __importStar(require("fs")); var os = __importStar(require("os")); - var uuid_1 = (init_esm_node(), __toCommonJS(esm_node_exports)); var utils_1 = require_utils(); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; @@ -521,14 +192,14 @@ var require_file_command = __commonJS({ if (!fs.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + fs.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os.EOL}`, { encoding: "utf8" }); } exports2.issueFileCommand = issueFileCommand; function prepareKeyValueMessage(key, value) { - const delimiter = `ghadelimiter_${uuid_1.v4()}`; - const convertedValue = utils_1.toCommandValue(value); + const delimiter = `ghadelimiter_${crypto.randomUUID()}`; + const convertedValue = (0, utils_1.toCommandValue)(value); if (key.includes(delimiter)) { throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); } @@ -561,10 +232,10 @@ var require_proxy = __commonJS({ })(); if (proxyVar) { try { - return new DecodedURL(proxyVar); + return new URL(proxyVar); } catch (_a) { if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://")) - return new DecodedURL(`http://${proxyVar}`); + return new URL(`http://${proxyVar}`); } } else { return void 0; @@ -607,19 +278,6 @@ var require_proxy = __commonJS({ const hostLower = host.toLowerCase(); return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]"); } - var DecodedURL = class extends URL { - constructor(url, base) { - super(url, base); - this._decodedUsername = decodeURIComponent(super.username); - this._decodedPassword = decodeURIComponent(super.password); - } - get username() { - return this._decodedUsername; - } - get password() { - return this._decodedPassword; - } - }; } }); @@ -1271,7 +929,7 @@ var require_util = __commonJS({ var { InvalidArgumentError } = require_errors(); var { Blob: Blob2 } = require("buffer"); var nodeUtil = require("util"); - var { stringify: stringify2 } = require("querystring"); + var { stringify } = require("querystring"); var { headerNameLowerCasedRecord } = require_constants(); var [nodeMajor, nodeMinor] = process.versions.node.split(".").map((v) => Number(v)); function nop() { @@ -1286,7 +944,7 @@ var require_util = __commonJS({ if (url.includes("?") || url.includes("#")) { throw new Error('Query params cannot be passed when url already contains "?" or "#".'); } - const stringified = stringify2(queryParams); + const stringified = stringify(queryParams); if (stringified) { url += "?" + stringified; } @@ -3962,11 +3620,11 @@ var require_util2 = __commonJS({ var assert = require("assert"); var { isUint8Array } = require("util/types"); var supportedHashes = []; - var crypto4; + var crypto; try { - crypto4 = require("crypto"); + crypto = require("crypto"); const possibleRelevantHashes = ["sha256", "sha384", "sha512"]; - supportedHashes = crypto4.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); } catch { } function responseURL(response) { @@ -4243,7 +3901,7 @@ var require_util2 = __commonJS({ } } function bytesMatch(bytes, metadataList) { - if (crypto4 === void 0) { + if (crypto === void 0) { return true; } const parsedMetadata = parseMetadata(metadataList); @@ -4258,7 +3916,7 @@ var require_util2 = __commonJS({ for (const item of metadata) { const algorithm = item.algo; const expectedValue = item.hash; - let actualValue = crypto4.createHash(algorithm).update(bytes).digest("base64"); + let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64"); if (actualValue[actualValue.length - 1] === "=") { if (actualValue[actualValue.length - 2] === "=") { actualValue = actualValue.slice(0, -2); @@ -6712,12 +6370,12 @@ var require_constants3 = __commonJS({ ERROR2[ERROR2["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; ERROR2[ERROR2["USER"] = 24] = "USER"; })(ERROR = exports2.ERROR || (exports2.ERROR = {})); - var TYPE2; - (function(TYPE3) { - TYPE3[TYPE3["BOTH"] = 0] = "BOTH"; - TYPE3[TYPE3["REQUEST"] = 1] = "REQUEST"; - TYPE3[TYPE3["RESPONSE"] = 2] = "RESPONSE"; - })(TYPE2 = exports2.TYPE || (exports2.TYPE = {})); + var TYPE; + (function(TYPE2) { + TYPE2[TYPE2["BOTH"] = 0] = "BOTH"; + TYPE2[TYPE2["REQUEST"] = 1] = "REQUEST"; + TYPE2[TYPE2["RESPONSE"] = 2] = "RESPONSE"; + })(TYPE = exports2.TYPE || (exports2.TYPE = {})); var FLAGS; (function(FLAGS2) { FLAGS2[FLAGS2["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE"; @@ -11380,7 +11038,7 @@ var require_proxy_agent = __commonJS({ "node_modules/@actions/http-client/node_modules/undici/lib/proxy-agent.js"(exports2, module2) { "use strict"; var { kProxy, kClose, kDestroy, kInterceptors } = require_symbols(); - var { URL: URL3 } = require("url"); + var { URL: URL2 } = require("url"); var Agent = require_agent(); var Pool = require_pool(); var DispatcherBase = require_dispatcher_base(); @@ -11429,7 +11087,7 @@ var require_proxy_agent = __commonJS({ this[kRequestTls] = opts.requestTls; this[kProxyTls] = opts.proxyTls; this[kProxyHeaders] = opts.headers || {}; - const resolvedUrl = new URL3(opts.uri); + const resolvedUrl = new URL2(opts.uri); const { origin, port, host, username, password } = resolvedUrl; if (opts.auth && opts.token) { throw new InvalidArgumentError("opts.auth cannot be used in combination with opts.token"); @@ -11484,7 +11142,7 @@ var require_proxy_agent = __commonJS({ }); } dispatch(opts, handler) { - const { host } = new URL3(opts.origin); + const { host } = new URL2(opts.origin); const headers = buildHeaders(opts.headers); throwIfProxyAuthIsSent(headers); return this[kAgent].dispatch( @@ -15894,7 +15552,7 @@ var require_util6 = __commonJS({ throw new Error("Invalid cookie max-age"); } } - function stringify2(cookie) { + function stringify(cookie) { if (cookie.name.length === 0) { return null; } @@ -15959,7 +15617,7 @@ var require_util6 = __commonJS({ } module2.exports = { isCTLExcludingHtab, - stringify: stringify2, + stringify, getHeadersList }; } @@ -16110,7 +15768,7 @@ var require_cookies = __commonJS({ "node_modules/@actions/http-client/node_modules/undici/lib/cookies/index.js"(exports2, module2) { "use strict"; var { parseSetCookie } = require_parse(); - var { stringify: stringify2, getHeadersList } = require_util6(); + var { stringify, getHeadersList } = require_util6(); var { webidl } = require_webidl(); var { Headers } = require_headers(); function getCookies(headers) { @@ -16152,9 +15810,9 @@ var require_cookies = __commonJS({ webidl.argumentLengthCheck(arguments, 2, { header: "setCookie" }); webidl.brandCheck(headers, Headers, { strict: false }); cookie = webidl.converters.Cookie(cookie); - const str = stringify2(cookie); + const str = stringify(cookie); if (str) { - headers.append("Set-Cookie", stringify2(cookie)); + headers.append("Set-Cookie", stringify(cookie)); } } webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([ @@ -16650,9 +16308,9 @@ var require_connection = __commonJS({ channels.open = diagnosticsChannel.channel("undici:websocket:open"); channels.close = diagnosticsChannel.channel("undici:websocket:close"); channels.socketError = diagnosticsChannel.channel("undici:websocket:socket_error"); - var crypto4; + var crypto; try { - crypto4 = require("crypto"); + crypto = require("crypto"); } catch { } function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { @@ -16671,7 +16329,7 @@ var require_connection = __commonJS({ const headersList = new Headers(options.headers)[kHeadersList]; request2.headersList = headersList; } - const keyValue = crypto4.randomBytes(16).toString("base64"); + const keyValue = crypto.randomBytes(16).toString("base64"); request2.headersList.append("sec-websocket-key", keyValue); request2.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { @@ -16700,7 +16358,7 @@ var require_connection = __commonJS({ return; } const secWSAccept = response.headersList.get("Sec-WebSocket-Accept"); - const digest = crypto4.createHash("sha1").update(keyValue + uid).digest("base64"); + const digest = crypto.createHash("sha1").update(keyValue + uid).digest("base64"); if (secWSAccept !== digest) { failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header."); return; @@ -16780,9 +16438,9 @@ var require_frame = __commonJS({ "node_modules/@actions/http-client/node_modules/undici/lib/websocket/frame.js"(exports2, module2) { "use strict"; var { maxUnsigned16Bit } = require_constants5(); - var crypto4; + var crypto; try { - crypto4 = require("crypto"); + crypto = require("crypto"); } catch { } var WebsocketFrameSend = class { @@ -16791,7 +16449,7 @@ var require_frame = __commonJS({ */ constructor(data) { this.frameData = data; - this.maskKey = crypto4.randomBytes(4); + this.maskKey = crypto.randomBytes(4); } createFrame(opcode) { const bodyLength = this.frameData?.byteLength ?? 0; @@ -18154,7 +17812,7 @@ var require_lib = __commonJS({ } const usingSsl = parsedUrl.protocol === "https:"; proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && { - token: `Basic ${Buffer.from(`${proxyUrl2.username}:${proxyUrl2.password}`).toString("base64")}` + token: `${proxyUrl2.username}:${proxyUrl2.password}` })); this._proxyAgentDispatcher = proxyAgent; if (usingSsl && this._ignoreSslError) { @@ -18419,9 +18077,9 @@ var require_oidc_utils = __commonJS({ const encodedAudience = encodeURIComponent(audience); id_token_url = `${id_token_url}&audience=${encodedAudience}`; } - core_1.debug(`ID token url is ${id_token_url}`); + (0, core_1.debug)(`ID token url is ${id_token_url}`); const id_token = yield _OidcClient.getCall(id_token_url); - core_1.setSecret(id_token); + (0, core_1.setSecret)(id_token); return id_token; } catch (error) { throw new Error(`Error message: ${error.message}`); @@ -18730,6 +18388,476 @@ var require_summary = __commonJS({ // node_modules/@actions/core/lib/path-utils.js var require_path_utils = __commonJS({ "node_modules/@actions/core/lib/path-utils.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = void 0; + var path = __importStar(require("path")); + function toPosixPath(pth) { + return pth.replace(/[\\]/g, "/"); + } + exports2.toPosixPath = toPosixPath; + function toWin32Path(pth) { + return pth.replace(/[/]/g, "\\"); + } + exports2.toWin32Path = toWin32Path; + function toPlatformPath(pth) { + return pth.replace(/[/\\]/g, path.sep); + } + exports2.toPlatformPath = toPlatformPath; + } +}); + +// node_modules/@actions/io/lib/io-util.js +var require_io_util = __commonJS({ + "node_modules/@actions/io/lib/io-util.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var _a; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; + var fs = __importStar(require("fs")); + var path = __importStar(require("path")); + _a = fs.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; + exports2.IS_WINDOWS = process.platform === "win32"; + exports2.UV_FS_O_EXLOCK = 268435456; + exports2.READONLY = fs.constants.O_RDONLY; + function exists(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + try { + yield exports2.stat(fsPath); + } catch (err) { + if (err.code === "ENOENT") { + return false; + } + throw err; + } + return true; + }); + } + exports2.exists = exists; + function isDirectory(fsPath, useStat = false) { + return __awaiter(this, void 0, void 0, function* () { + const stats = useStat ? yield exports2.stat(fsPath) : yield exports2.lstat(fsPath); + return stats.isDirectory(); + }); + } + exports2.isDirectory = isDirectory; + function isRooted(p) { + p = normalizeSeparators(p); + if (!p) { + throw new Error('isRooted() parameter "p" cannot be empty'); + } + if (exports2.IS_WINDOWS) { + return p.startsWith("\\") || /^[A-Z]:/i.test(p); + } + return p.startsWith("/"); + } + exports2.isRooted = isRooted; + function tryGetExecutablePath(filePath, extensions) { + return __awaiter(this, void 0, void 0, function* () { + let stats = void 0; + try { + stats = yield exports2.stat(filePath); + } catch (err) { + if (err.code !== "ENOENT") { + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } + } + if (stats && stats.isFile()) { + if (exports2.IS_WINDOWS) { + const upperExt = path.extname(filePath).toUpperCase(); + if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { + return filePath; + } + } else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + const originalFilePath = filePath; + for (const extension of extensions) { + filePath = originalFilePath + extension; + stats = void 0; + try { + stats = yield exports2.stat(filePath); + } catch (err) { + if (err.code !== "ENOENT") { + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } + } + if (stats && stats.isFile()) { + if (exports2.IS_WINDOWS) { + try { + const directory = path.dirname(filePath); + const upperName = path.basename(filePath).toUpperCase(); + for (const actualName of yield exports2.readdir(directory)) { + if (upperName === actualName.toUpperCase()) { + filePath = path.join(directory, actualName); + break; + } + } + } catch (err) { + console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); + } + return filePath; + } else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + } + return ""; + }); + } + exports2.tryGetExecutablePath = tryGetExecutablePath; + function normalizeSeparators(p) { + p = p || ""; + if (exports2.IS_WINDOWS) { + p = p.replace(/\//g, "\\"); + return p.replace(/\\\\+/g, "\\"); + } + return p.replace(/\/\/+/g, "/"); + } + function isUnixExecutable(stats) { + return (stats.mode & 1) > 0 || (stats.mode & 8) > 0 && stats.gid === process.getgid() || (stats.mode & 64) > 0 && stats.uid === process.getuid(); + } + function getCmdPath() { + var _a2; + return (_a2 = process.env["COMSPEC"]) !== null && _a2 !== void 0 ? _a2 : `cmd.exe`; + } + exports2.getCmdPath = getCmdPath; + } +}); + +// node_modules/@actions/io/lib/io.js +var require_io = __commonJS({ + "node_modules/@actions/io/lib/io.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.findInPath = exports2.which = exports2.mkdirP = exports2.rmRF = exports2.mv = exports2.cp = void 0; + var assert_1 = require("assert"); + var path = __importStar(require("path")); + var ioUtil = __importStar(require_io_util()); + function cp(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const { force, recursive, copySourceDirectory } = readCopyOptions(options); + const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; + if (destStat && destStat.isFile() && !force) { + return; + } + const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path.join(dest, path.basename(source)) : dest; + if (!(yield ioUtil.exists(source))) { + throw new Error(`no such file or directory: ${source}`); + } + const sourceStat = yield ioUtil.stat(source); + if (sourceStat.isDirectory()) { + if (!recursive) { + throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); + } else { + yield cpDirRecursive(source, newDest, 0, force); + } + } else { + if (path.relative(source, newDest) === "") { + throw new Error(`'${newDest}' and '${source}' are the same file`); + } + yield copyFile(source, newDest, force); + } + }); + } + exports2.cp = cp; + function mv(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + if (yield ioUtil.exists(dest)) { + let destExists = true; + if (yield ioUtil.isDirectory(dest)) { + dest = path.join(dest, path.basename(source)); + destExists = yield ioUtil.exists(dest); + } + if (destExists) { + if (options.force == null || options.force) { + yield rmRF(dest); + } else { + throw new Error("Destination already exists"); + } + } + } + yield mkdirP(path.dirname(dest)); + yield ioUtil.rename(source, dest); + }); + } + exports2.mv = mv; + function rmRF(inputPath) { + return __awaiter(this, void 0, void 0, function* () { + if (ioUtil.IS_WINDOWS) { + if (/[*"<>|]/.test(inputPath)) { + throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); + } + } + try { + yield ioUtil.rm(inputPath, { + force: true, + maxRetries: 3, + recursive: true, + retryDelay: 300 + }); + } catch (err) { + throw new Error(`File was unable to be removed ${err}`); + } + }); + } + exports2.rmRF = rmRF; + function mkdirP(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + assert_1.ok(fsPath, "a path argument must be provided"); + yield ioUtil.mkdir(fsPath, { recursive: true }); + }); + } + exports2.mkdirP = mkdirP; + function which(tool, check) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + if (check) { + const result = yield which(tool, false); + if (!result) { + if (ioUtil.IS_WINDOWS) { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); + } else { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); + } + } + return result; + } + const matches = yield findInPath(tool); + if (matches && matches.length > 0) { + return matches[0]; + } + return ""; + }); + } + exports2.which = which; + function findInPath(tool) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + const extensions = []; + if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { + for (const extension of process.env["PATHEXT"].split(path.delimiter)) { + if (extension) { + extensions.push(extension); + } + } + } + if (ioUtil.isRooted(tool)) { + const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); + if (filePath) { + return [filePath]; + } + return []; + } + if (tool.includes(path.sep)) { + return []; + } + const directories = []; + if (process.env.PATH) { + for (const p of process.env.PATH.split(path.delimiter)) { + if (p) { + directories.push(p); + } + } + } + const matches = []; + for (const directory of directories) { + const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); + if (filePath) { + matches.push(filePath); + } + } + return matches; + }); + } + exports2.findInPath = findInPath; + function readCopyOptions(options) { + const force = options.force == null ? true : options.force; + const recursive = Boolean(options.recursive); + const copySourceDirectory = options.copySourceDirectory == null ? true : Boolean(options.copySourceDirectory); + return { force, recursive, copySourceDirectory }; + } + function cpDirRecursive(sourceDir, destDir, currentDepth, force) { + return __awaiter(this, void 0, void 0, function* () { + if (currentDepth >= 255) + return; + currentDepth++; + yield mkdirP(destDir); + const files = yield ioUtil.readdir(sourceDir); + for (const fileName of files) { + const srcFile = `${sourceDir}/${fileName}`; + const destFile = `${destDir}/${fileName}`; + const srcFileStat = yield ioUtil.lstat(srcFile); + if (srcFileStat.isDirectory()) { + yield cpDirRecursive(srcFile, destFile, currentDepth, force); + } else { + yield copyFile(srcFile, destFile, force); + } + } + yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); + }); + } + function copyFile(srcFile, destFile, force) { + return __awaiter(this, void 0, void 0, function* () { + if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { + try { + yield ioUtil.lstat(destFile); + yield ioUtil.unlink(destFile); + } catch (e) { + if (e.code === "EPERM") { + yield ioUtil.chmod(destFile, "0666"); + yield ioUtil.unlink(destFile); + } + } + const symlinkFull = yield ioUtil.readlink(srcFile); + yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? "junction" : null); + } else if (!(yield ioUtil.exists(destFile)) || force) { + yield ioUtil.copyFile(srcFile, destFile); + } + }); + } + } +}); + +// node_modules/@actions/exec/lib/toolrunner.js +var require_toolrunner = __commonJS({ + "node_modules/@actions/exec/lib/toolrunner.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; @@ -18754,21 +18882,686 @@ var require_path_utils = __commonJS({ __setModuleDefault(result, mod); return result; }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = void 0; + exports2.argStringToArray = exports2.ToolRunner = void 0; + var os = __importStar(require("os")); + var events = __importStar(require("events")); + var child = __importStar(require("child_process")); var path = __importStar(require("path")); - function toPosixPath(pth) { - return pth.replace(/[\\]/g, "/"); + var io = __importStar(require_io()); + var ioUtil = __importStar(require_io_util()); + var timers_1 = require("timers"); + var IS_WINDOWS = process.platform === "win32"; + var ToolRunner = class extends events.EventEmitter { + constructor(toolPath, args, options) { + super(); + if (!toolPath) { + throw new Error("Parameter 'toolPath' cannot be null or empty."); + } + this.toolPath = toolPath; + this.args = args || []; + this.options = options || {}; + } + _debug(message) { + if (this.options.listeners && this.options.listeners.debug) { + this.options.listeners.debug(message); + } + } + _getCommandString(options, noPrefix) { + const toolPath = this._getSpawnFileName(); + const args = this._getSpawnArgs(options); + let cmd = noPrefix ? "" : "[command]"; + if (IS_WINDOWS) { + if (this._isCmdFile()) { + cmd += toolPath; + for (const a of args) { + cmd += ` ${a}`; + } + } else if (options.windowsVerbatimArguments) { + cmd += `"${toolPath}"`; + for (const a of args) { + cmd += ` ${a}`; + } + } else { + cmd += this._windowsQuoteCmdArg(toolPath); + for (const a of args) { + cmd += ` ${this._windowsQuoteCmdArg(a)}`; + } + } + } else { + cmd += toolPath; + for (const a of args) { + cmd += ` ${a}`; + } + } + return cmd; + } + _processLineBuffer(data, strBuffer, onLine) { + try { + let s = strBuffer + data.toString(); + let n = s.indexOf(os.EOL); + while (n > -1) { + const line = s.substring(0, n); + onLine(line); + s = s.substring(n + os.EOL.length); + n = s.indexOf(os.EOL); + } + return s; + } catch (err) { + this._debug(`error processing line. Failed with error ${err}`); + return ""; + } + } + _getSpawnFileName() { + if (IS_WINDOWS) { + if (this._isCmdFile()) { + return process.env["COMSPEC"] || "cmd.exe"; + } + } + return this.toolPath; + } + _getSpawnArgs(options) { + if (IS_WINDOWS) { + if (this._isCmdFile()) { + let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; + for (const a of this.args) { + argline += " "; + argline += options.windowsVerbatimArguments ? a : this._windowsQuoteCmdArg(a); + } + argline += '"'; + return [argline]; + } + } + return this.args; + } + _endsWith(str, end) { + return str.endsWith(end); + } + _isCmdFile() { + const upperToolPath = this.toolPath.toUpperCase(); + return this._endsWith(upperToolPath, ".CMD") || this._endsWith(upperToolPath, ".BAT"); + } + _windowsQuoteCmdArg(arg) { + if (!this._isCmdFile()) { + return this._uvQuoteCmdArg(arg); + } + if (!arg) { + return '""'; + } + const cmdSpecialChars = [ + " ", + " ", + "&", + "(", + ")", + "[", + "]", + "{", + "}", + "^", + "=", + ";", + "!", + "'", + "+", + ",", + "`", + "~", + "|", + "<", + ">", + '"' + ]; + let needsQuotes = false; + for (const char of arg) { + if (cmdSpecialChars.some((x) => x === char)) { + needsQuotes = true; + break; + } + } + if (!needsQuotes) { + return arg; + } + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { + reverse += arg[i - 1]; + if (quoteHit && arg[i - 1] === "\\") { + reverse += "\\"; + } else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += '"'; + } else { + quoteHit = false; + } + } + reverse += '"'; + return reverse.split("").reverse().join(""); + } + _uvQuoteCmdArg(arg) { + if (!arg) { + return '""'; + } + if (!arg.includes(" ") && !arg.includes(" ") && !arg.includes('"')) { + return arg; + } + if (!arg.includes('"') && !arg.includes("\\")) { + return `"${arg}"`; + } + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { + reverse += arg[i - 1]; + if (quoteHit && arg[i - 1] === "\\") { + reverse += "\\"; + } else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += "\\"; + } else { + quoteHit = false; + } + } + reverse += '"'; + return reverse.split("").reverse().join(""); + } + _cloneExecOptions(options) { + options = options || {}; + const result = { + cwd: options.cwd || process.cwd(), + env: options.env || process.env, + silent: options.silent || false, + windowsVerbatimArguments: options.windowsVerbatimArguments || false, + failOnStdErr: options.failOnStdErr || false, + ignoreReturnCode: options.ignoreReturnCode || false, + delay: options.delay || 1e4 + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; + } + _getSpawnOptions(options, toolPath) { + options = options || {}; + const result = {}; + result.cwd = options.cwd; + result.env = options.env; + result["windowsVerbatimArguments"] = options.windowsVerbatimArguments || this._isCmdFile(); + if (options.windowsVerbatimArguments) { + result.argv0 = `"${toolPath}"`; + } + return result; + } + /** + * Exec a tool. + * Output will be streamed to the live console. + * Returns promise with return code + * + * @param tool path to tool to exec + * @param options optional exec options. See ExecOptions + * @returns number + */ + exec() { + return __awaiter(this, void 0, void 0, function* () { + if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { + this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); + } + this.toolPath = yield io.which(this.toolPath, true); + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + this._debug(`exec tool: ${this.toolPath}`); + this._debug("arguments:"); + for (const arg of this.args) { + this._debug(` ${arg}`); + } + const optionsNonNull = this._cloneExecOptions(this.options); + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + } + const state = new ExecState(optionsNonNull, this.toolPath); + state.on("debug", (message) => { + this._debug(message); + }); + if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { + return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); + } + const fileName = this._getSpawnFileName(); + const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); + let stdbuffer = ""; + if (cp.stdout) { + cp.stdout.on("data", (data) => { + if (this.options.listeners && this.options.listeners.stdout) { + this.options.listeners.stdout(data); + } + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(data); + } + stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { + if (this.options.listeners && this.options.listeners.stdline) { + this.options.listeners.stdline(line); + } + }); + }); + } + let errbuffer = ""; + if (cp.stderr) { + cp.stderr.on("data", (data) => { + state.processStderr = true; + if (this.options.listeners && this.options.listeners.stderr) { + this.options.listeners.stderr(data); + } + if (!optionsNonNull.silent && optionsNonNull.errStream && optionsNonNull.outStream) { + const s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; + s.write(data); + } + errbuffer = this._processLineBuffer(data, errbuffer, (line) => { + if (this.options.listeners && this.options.listeners.errline) { + this.options.listeners.errline(line); + } + }); + }); + } + cp.on("error", (err) => { + state.processError = err.message; + state.processExited = true; + state.processClosed = true; + state.CheckComplete(); + }); + cp.on("exit", (code) => { + state.processExitCode = code; + state.processExited = true; + this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); + state.CheckComplete(); + }); + cp.on("close", (code) => { + state.processExitCode = code; + state.processExited = true; + state.processClosed = true; + this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); + state.CheckComplete(); + }); + state.on("done", (error, exitCode) => { + if (stdbuffer.length > 0) { + this.emit("stdline", stdbuffer); + } + if (errbuffer.length > 0) { + this.emit("errline", errbuffer); + } + cp.removeAllListeners(); + if (error) { + reject(error); + } else { + resolve(exitCode); + } + }); + if (this.options.input) { + if (!cp.stdin) { + throw new Error("child process missing stdin"); + } + cp.stdin.end(this.options.input); + } + })); + }); + } + }; + exports2.ToolRunner = ToolRunner; + function argStringToArray(argString) { + const args = []; + let inQuotes = false; + let escaped = false; + let arg = ""; + function append(c) { + if (escaped && c !== '"') { + arg += "\\"; + } + arg += c; + escaped = false; + } + for (let i = 0; i < argString.length; i++) { + const c = argString.charAt(i); + if (c === '"') { + if (!escaped) { + inQuotes = !inQuotes; + } else { + append(c); + } + continue; + } + if (c === "\\" && escaped) { + append(c); + continue; + } + if (c === "\\" && inQuotes) { + escaped = true; + continue; + } + if (c === " " && !inQuotes) { + if (arg.length > 0) { + args.push(arg); + arg = ""; + } + continue; + } + append(c); + } + if (arg.length > 0) { + args.push(arg.trim()); + } + return args; } - exports2.toPosixPath = toPosixPath; - function toWin32Path(pth) { - return pth.replace(/[/]/g, "\\"); + exports2.argStringToArray = argStringToArray; + var ExecState = class _ExecState extends events.EventEmitter { + constructor(options, toolPath) { + super(); + this.processClosed = false; + this.processError = ""; + this.processExitCode = 0; + this.processExited = false; + this.processStderr = false; + this.delay = 1e4; + this.done = false; + this.timeout = null; + if (!toolPath) { + throw new Error("toolPath must not be empty"); + } + this.options = options; + this.toolPath = toolPath; + if (options.delay) { + this.delay = options.delay; + } + } + CheckComplete() { + if (this.done) { + return; + } + if (this.processClosed) { + this._setResult(); + } else if (this.processExited) { + this.timeout = timers_1.setTimeout(_ExecState.HandleTimeout, this.delay, this); + } + } + _debug(message) { + this.emit("debug", message); + } + _setResult() { + let error; + if (this.processExited) { + if (this.processError) { + error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); + } else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { + error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); + } else if (this.processStderr && this.options.failOnStdErr) { + error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); + } + } + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = null; + } + this.done = true; + this.emit("done", error, this.processExitCode); + } + static HandleTimeout(state) { + if (state.done) { + return; + } + if (!state.processClosed && state.processExited) { + const message = `The STDIO streams did not close within ${state.delay / 1e3} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; + state._debug(message); + } + state._setResult(); + } + }; + } +}); + +// node_modules/@actions/exec/lib/exec.js +var require_exec = __commonJS({ + "node_modules/@actions/exec/lib/exec.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getExecOutput = exports2.exec = void 0; + var string_decoder_1 = require("string_decoder"); + var tr = __importStar(require_toolrunner()); + function exec(commandLine, args, options) { + return __awaiter(this, void 0, void 0, function* () { + const commandArgs = tr.argStringToArray(commandLine); + if (commandArgs.length === 0) { + throw new Error(`Parameter 'commandLine' cannot be null or empty.`); + } + const toolPath = commandArgs[0]; + args = commandArgs.slice(1).concat(args || []); + const runner = new tr.ToolRunner(toolPath, args, options); + return runner.exec(); + }); } - exports2.toWin32Path = toWin32Path; - function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path.sep); + exports2.exec = exec; + function getExecOutput(commandLine, args, options) { + var _a, _b; + return __awaiter(this, void 0, void 0, function* () { + let stdout = ""; + let stderr = ""; + const stdoutDecoder = new string_decoder_1.StringDecoder("utf8"); + const stderrDecoder = new string_decoder_1.StringDecoder("utf8"); + const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; + const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; + const stdErrListener = (data) => { + stderr += stderrDecoder.write(data); + if (originalStdErrListener) { + originalStdErrListener(data); + } + }; + const stdOutListener = (data) => { + stdout += stdoutDecoder.write(data); + if (originalStdoutListener) { + originalStdoutListener(data); + } + }; + const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); + const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); + stdout += stdoutDecoder.end(); + stderr += stderrDecoder.end(); + return { + exitCode, + stdout, + stderr + }; + }); } - exports2.toPlatformPath = toPlatformPath; + exports2.getExecOutput = getExecOutput; + } +}); + +// node_modules/@actions/core/lib/platform.js +var require_platform = __commonJS({ + "node_modules/@actions/core/lib/platform.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getDetails = exports2.isLinux = exports2.isMacOS = exports2.isWindows = exports2.arch = exports2.platform = void 0; + var os_1 = __importDefault(require("os")); + var exec = __importStar(require_exec()); + var getWindowsInfo = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', void 0, { + silent: true + }); + const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', void 0, { + silent: true + }); + return { + name: name.trim(), + version: version.trim() + }; + }); + var getMacOsInfo = () => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b, _c, _d; + const { stdout } = yield exec.getExecOutput("sw_vers", void 0, { + silent: true + }); + const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : ""; + const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : ""; + return { + name, + version + }; + }); + var getLinuxInfo = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout } = yield exec.getExecOutput("lsb_release", ["-i", "-r", "-s"], { + silent: true + }); + const [name, version] = stdout.trim().split("\n"); + return { + name, + version + }; + }); + exports2.platform = os_1.default.platform(); + exports2.arch = os_1.default.arch(); + exports2.isWindows = exports2.platform === "win32"; + exports2.isMacOS = exports2.platform === "darwin"; + exports2.isLinux = exports2.platform === "linux"; + function getDetails() { + return __awaiter(this, void 0, void 0, function* () { + return Object.assign(Object.assign({}, yield exports2.isWindows ? getWindowsInfo() : exports2.isMacOS ? getMacOsInfo() : getLinuxInfo()), { + platform: exports2.platform, + arch: exports2.arch, + isWindows: exports2.isWindows, + isMacOS: exports2.isMacOS, + isLinux: exports2.isLinux + }); + }); + } + exports2.getDetails = getDetails; } }); @@ -18778,9 +19571,13 @@ var require_core = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; @@ -18794,7 +19591,7 @@ var require_core = __commonJS({ if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); } __setModuleDefault(result, mod); return result; @@ -18827,7 +19624,7 @@ var require_core = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getIDToken = exports2.getState = exports2.saveState = exports2.group = exports2.endGroup = exports2.startGroup = exports2.info = exports2.notice = exports2.warning = exports2.error = exports2.debug = exports2.isDebug = exports2.setFailed = exports2.setCommandEcho = exports2.setOutput = exports2.getBooleanInput = exports2.getMultilineInput = exports2.getInput = exports2.addPath = exports2.setSecret = exports2.exportVariable = exports2.ExitCode = void 0; + exports2.platform = exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = exports2.markdownSummary = exports2.summary = exports2.getIDToken = exports2.getState = exports2.saveState = exports2.group = exports2.endGroup = exports2.startGroup = exports2.info = exports2.notice = exports2.warning = exports2.error = exports2.debug = exports2.isDebug = exports2.setFailed = exports2.setCommandEcho = exports2.setOutput = exports2.getBooleanInput = exports2.getMultilineInput = exports2.getInput = exports2.addPath = exports2.setSecret = exports2.exportVariable = exports2.ExitCode = void 0; var command_1 = require_command(); var file_command_1 = require_file_command(); var utils_1 = require_utils(); @@ -18838,27 +19635,27 @@ var require_core = __commonJS({ (function(ExitCode2) { ExitCode2[ExitCode2["Success"] = 0] = "Success"; ExitCode2[ExitCode2["Failure"] = 1] = "Failure"; - })(ExitCode = exports2.ExitCode || (exports2.ExitCode = {})); + })(ExitCode || (exports2.ExitCode = ExitCode = {})); function exportVariable(name, val) { - const convertedVal = utils_1.toCommandValue(val); + const convertedVal = (0, utils_1.toCommandValue)(val); process.env[name] = convertedVal; const filePath = process.env["GITHUB_ENV"] || ""; if (filePath) { - return file_command_1.issueFileCommand("ENV", file_command_1.prepareKeyValueMessage(name, val)); + return (0, file_command_1.issueFileCommand)("ENV", (0, file_command_1.prepareKeyValueMessage)(name, val)); } - command_1.issueCommand("set-env", { name }, convertedVal); + (0, command_1.issueCommand)("set-env", { name }, convertedVal); } exports2.exportVariable = exportVariable; function setSecret(secret) { - command_1.issueCommand("add-mask", {}, secret); + (0, command_1.issueCommand)("add-mask", {}, secret); } exports2.setSecret = setSecret; function addPath(inputPath) { const filePath = process.env["GITHUB_PATH"] || ""; if (filePath) { - file_command_1.issueFileCommand("PATH", inputPath); + (0, file_command_1.issueFileCommand)("PATH", inputPath); } else { - command_1.issueCommand("add-path", {}, inputPath); + (0, command_1.issueCommand)("add-path", {}, inputPath); } process.env["PATH"] = `${inputPath}${path.delimiter}${process.env["PATH"]}`; } @@ -18897,14 +19694,14 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function setOutput(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { - return file_command_1.issueFileCommand("OUTPUT", file_command_1.prepareKeyValueMessage(name, value)); + return (0, file_command_1.issueFileCommand)("OUTPUT", (0, file_command_1.prepareKeyValueMessage)(name, value)); } process.stdout.write(os.EOL); - command_1.issueCommand("set-output", { name }, utils_1.toCommandValue(value)); + (0, command_1.issueCommand)("set-output", { name }, (0, utils_1.toCommandValue)(value)); } exports2.setOutput = setOutput; function setCommandEcho(enabled) { - command_1.issue("echo", enabled ? "on" : "off"); + (0, command_1.issue)("echo", enabled ? "on" : "off"); } exports2.setCommandEcho = setCommandEcho; function setFailed(message) { @@ -18917,19 +19714,19 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.isDebug = isDebug; function debug(message) { - command_1.issueCommand("debug", {}, message); + (0, command_1.issueCommand)("debug", {}, message); } exports2.debug = debug; function error(message, properties = {}) { - command_1.issueCommand("error", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + (0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.error = error; function warning(message, properties = {}) { - command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + (0, command_1.issueCommand)("warning", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.warning = warning; function notice(message, properties = {}) { - command_1.issueCommand("notice", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.notice = notice; function info(message) { @@ -18937,11 +19734,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.info = info; function startGroup(name) { - command_1.issue("group", name); + (0, command_1.issue)("group", name); } exports2.startGroup = startGroup; function endGroup() { - command_1.issue("endgroup"); + (0, command_1.issue)("endgroup"); } exports2.endGroup = endGroup; function group(name, fn) { @@ -18960,9 +19757,9 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function saveState(name, value) { const filePath = process.env["GITHUB_STATE"] || ""; if (filePath) { - return file_command_1.issueFileCommand("STATE", file_command_1.prepareKeyValueMessage(name, value)); + return (0, file_command_1.issueFileCommand)("STATE", (0, file_command_1.prepareKeyValueMessage)(name, value)); } - command_1.issueCommand("save-state", { name }, utils_1.toCommandValue(value)); + (0, command_1.issueCommand)("save-state", { name }, (0, utils_1.toCommandValue)(value)); } exports2.saveState = saveState; function getState(name) { @@ -18993,6 +19790,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); Object.defineProperty(exports2, "toPlatformPath", { enumerable: true, get: function() { return path_utils_1.toPlatformPath; } }); + exports2.platform = __importStar(require_platform()); } }); @@ -19777,7 +20575,7 @@ var require_util8 = __commonJS({ var net = require("node:net"); var { Blob: Blob2 } = require("node:buffer"); var nodeUtil = require("node:util"); - var { stringify: stringify2 } = require("node:querystring"); + var { stringify } = require("node:querystring"); var { EventEmitter: EE } = require("node:events"); var { InvalidArgumentError } = require_errors2(); var { headerNameLowerCasedRecord } = require_constants6(); @@ -19837,7 +20635,7 @@ var require_util8 = __commonJS({ if (url.includes("?") || url.includes("#")) { throw new Error('Query params cannot be passed when url already contains "?" or "#".'); } - const stringified = stringify2(queryParams); + const stringified = stringify(queryParams); if (stringified) { url += "?" + stringified; } @@ -20305,36 +21103,36 @@ var require_diagnostics = __commonJS({ const debuglog = fetchDebuglog.enabled ? fetchDebuglog : undiciDebugLog; diagnosticsChannel.channel("undici:client:beforeConnect").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connecting to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connected").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connected to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host }, + connectParams: { version, protocol, port, host }, error } = evt; debuglog( "connection to %s using %s%s errored - %s", `${host}${port ? `:${port}` : ""}`, protocol, - version2, + version, error.message ); }); @@ -20383,31 +21181,31 @@ var require_diagnostics = __commonJS({ const debuglog = undiciDebugLog.enabled ? undiciDebugLog : websocketDebuglog; diagnosticsChannel.channel("undici:client:beforeConnect").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connecting to %s%s using %s%s", host, port ? `:${port}` : "", protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connected").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connected to %s%s using %s%s", host, port ? `:${port}` : "", protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host }, + connectParams: { version, protocol, port, host }, error } = evt; debuglog( @@ -20415,7 +21213,7 @@ var require_diagnostics = __commonJS({ host, port ? `:${port}` : "", protocol, - version2, + version, error.message ); }); @@ -21295,12 +22093,12 @@ var require_constants7 = __commonJS({ ERROR2[ERROR2["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; ERROR2[ERROR2["USER"] = 24] = "USER"; })(ERROR = exports2.ERROR || (exports2.ERROR = {})); - var TYPE2; - (function(TYPE3) { - TYPE3[TYPE3["BOTH"] = 0] = "BOTH"; - TYPE3[TYPE3["REQUEST"] = 1] = "REQUEST"; - TYPE3[TYPE3["RESPONSE"] = 2] = "RESPONSE"; - })(TYPE2 = exports2.TYPE || (exports2.TYPE = {})); + var TYPE; + (function(TYPE2) { + TYPE2[TYPE2["BOTH"] = 0] = "BOTH"; + TYPE2[TYPE2["REQUEST"] = 1] = "REQUEST"; + TYPE2[TYPE2["RESPONSE"] = 2] = "RESPONSE"; + })(TYPE = exports2.TYPE || (exports2.TYPE = {})); var FLAGS; (function(FLAGS2) { FLAGS2[FLAGS2["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE"; @@ -22594,11 +23392,11 @@ var require_util9 = __commonJS({ var { isUint8Array } = require("node:util/types"); var { webidl } = require_webidl2(); var supportedHashes = []; - var crypto4; + var crypto; try { - crypto4 = require("node:crypto"); + crypto = require("node:crypto"); const possibleRelevantHashes = ["sha256", "sha384", "sha512"]; - supportedHashes = crypto4.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); } catch { } function responseURL(response) { @@ -22871,7 +23669,7 @@ var require_util9 = __commonJS({ } } function bytesMatch(bytes, metadataList) { - if (crypto4 === void 0) { + if (crypto === void 0) { return true; } const parsedMetadata = parseMetadata(metadataList); @@ -22886,7 +23684,7 @@ var require_util9 = __commonJS({ for (const item of metadata) { const algorithm = item.algo; const expectedValue = item.hash; - let actualValue = crypto4.createHash(algorithm).update(bytes).digest("base64"); + let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64"); if (actualValue[actualValue.length - 1] === "=") { if (actualValue[actualValue.length - 2] === "=") { actualValue = actualValue.slice(0, -2); @@ -26986,7 +27784,7 @@ var require_proxy_agent2 = __commonJS({ "node_modules/undici/lib/dispatcher/proxy-agent.js"(exports2, module2) { "use strict"; var { kProxy, kClose, kDestroy, kInterceptors } = require_symbols6(); - var { URL: URL3 } = require("node:url"); + var { URL: URL2 } = require("node:url"); var Agent = require_agent2(); var Pool = require_pool2(); var DispatcherBase = require_dispatcher_base2(); @@ -27007,7 +27805,7 @@ var require_proxy_agent2 = __commonJS({ var ProxyAgent2 = class extends DispatcherBase { constructor(opts) { super(); - if (!opts || typeof opts === "object" && !(opts instanceof URL3) && !opts.uri) { + if (!opts || typeof opts === "object" && !(opts instanceof URL2) && !opts.uri) { throw new InvalidArgumentError("Proxy uri is mandatory"); } const { clientFactory = defaultFactory } = opts; @@ -27082,7 +27880,7 @@ var require_proxy_agent2 = __commonJS({ const headers = buildHeaders(opts.headers); throwIfProxyAuthIsSent(headers); if (headers && !("host" in headers) && !("Host" in headers)) { - const { host } = new URL3(opts.origin); + const { host } = new URL2(opts.origin); headers.host = host; } return this[kAgent].dispatch( @@ -27099,11 +27897,11 @@ var require_proxy_agent2 = __commonJS({ */ #getUrl(opts) { if (typeof opts === "string") { - return new URL3(opts); - } else if (opts instanceof URL3) { + return new URL2(opts); + } else if (opts instanceof URL2) { return opts; } else { - return new URL3(opts.uri); + return new URL2(opts.uri); } } async [kClose]() { @@ -34029,7 +34827,7 @@ var require_util13 = __commonJS({ throw new Error("Invalid cookie max-age"); } } - function stringify2(cookie) { + function stringify(cookie) { if (cookie.name.length === 0) { return null; } @@ -34083,7 +34881,7 @@ var require_util13 = __commonJS({ validateCookiePath, validateCookieValue, toIMFDate, - stringify: stringify2 + stringify }; } }); @@ -34233,7 +35031,7 @@ var require_cookies2 = __commonJS({ "node_modules/undici/lib/web/cookies/index.js"(exports2, module2) { "use strict"; var { parseSetCookie } = require_parse2(); - var { stringify: stringify2 } = require_util13(); + var { stringify } = require_util13(); var { webidl } = require_webidl2(); var { Headers } = require_headers2(); function getCookies(headers) { @@ -34276,7 +35074,7 @@ var require_cookies2 = __commonJS({ webidl.argumentLengthCheck(arguments, 2, "setCookie"); webidl.brandCheck(headers, Headers, { strict: false }); cookie = webidl.converters.Cookie(cookie); - const str = stringify2(cookie); + const str = stringify(cookie); if (str) { headers.append("Set-Cookie", str); } @@ -34868,13 +35666,13 @@ var require_frame2 = __commonJS({ "use strict"; var { maxUnsigned16Bit } = require_constants10(); var BUFFER_SIZE = 16386; - var crypto4; + var crypto; var buffer = null; var bufIdx = BUFFER_SIZE; try { - crypto4 = require("node:crypto"); + crypto = require("node:crypto"); } catch { - crypto4 = { + crypto = { // not full compatibility, but minimum. randomFillSync: function randomFillSync(buffer2, _offset, _size) { for (let i = 0; i < buffer2.length; ++i) { @@ -34887,7 +35685,7 @@ var require_frame2 = __commonJS({ function generateMask() { if (bufIdx === BUFFER_SIZE) { bufIdx = 0; - crypto4.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE); + crypto.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE); } return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]]; } @@ -34959,9 +35757,9 @@ var require_connection2 = __commonJS({ var { Headers, getHeadersList } = require_headers2(); var { getDecodeSplit } = require_util9(); var { WebsocketFrameSend } = require_frame2(); - var crypto4; + var crypto; try { - crypto4 = require("node:crypto"); + crypto = require("node:crypto"); } catch { } function establishWebSocketConnection(url, protocols, client, ws, onEstablish, options) { @@ -34981,7 +35779,7 @@ var require_connection2 = __commonJS({ const headersList = getHeadersList(new Headers(options.headers)); request2.headersList = headersList; } - const keyValue = crypto4.randomBytes(16).toString("base64"); + const keyValue = crypto.randomBytes(16).toString("base64"); request2.headersList.append("sec-websocket-key", keyValue); request2.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { @@ -35011,7 +35809,7 @@ var require_connection2 = __commonJS({ return; } const secWSAccept = response.headersList.get("Sec-WebSocket-Accept"); - const digest = crypto4.createHash("sha1").update(keyValue + uid).digest("base64"); + const digest = crypto.createHash("sha1").update(keyValue + uid).digest("base64"); if (secWSAccept !== digest) { failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header."); return; @@ -36897,7 +37695,7 @@ function expand(template, context) { return template.replace(/\/$/, ""); } } -function parse2(options) { +function parse(options) { let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); @@ -36961,7 +37759,7 @@ function parse2(options) { ); } function endpointWithDefaults(defaults, route, options) { - return parse2(merge(defaults, route, options)); + return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { const DEFAULTS2 = merge(oldDefaults, newDefaults); @@ -36970,7 +37768,7 @@ function withDefaults(oldDefaults, newDefaults) { DEFAULTS: DEFAULTS2, defaults: withDefaults.bind(null, DEFAULTS2), merge: merge.bind(null, DEFAULTS2), - parse: parse2 + parse }); } var endpoint = withDefaults(null, DEFAULTS); @@ -36992,11 +37790,11 @@ var RequestError = class extends Error { response; constructor(message, statusCode, options) { super(message); - this.name = "HttpError"; - this.status = Number.parseInt(statusCode); - if (Number.isNaN(this.status)) { - this.status = 0; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); } + this.name = "HttpError"; + this.status = statusCode; if ("response" in options) { this.response = options.response; } @@ -37915,1372 +38713,139 @@ async function githubAppJwt({ }; } -// node_modules/lru-cache/dist/esm/index.js -var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date; -var warned = /* @__PURE__ */ new Set(); -var PROCESS = typeof process === "object" && !!process ? process : {}; -var emitWarning = (msg, type, code, fn) => { - typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`); -}; -var AC = globalThis.AbortController; -var AS = globalThis.AbortSignal; -if (typeof AC === "undefined") { - AS = class AbortSignal { - onabort; - _onabort = []; - reason; - aborted = false; - addEventListener(_, fn) { - this._onabort.push(fn); - } - }; - AC = class AbortController { - constructor() { - warnACPolyfill(); - } - signal = new AS(); - abort(reason) { - if (this.signal.aborted) - return; - this.signal.reason = reason; - this.signal.aborted = true; - for (const fn of this.signal._onabort) { - fn(reason); - } - this.signal.onabort?.(reason); - } - }; - let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1"; - const warnACPolyfill = () => { - if (!printACPolyfillWarning) +// node_modules/toad-cache/dist/toad-cache.mjs +var LruObject = class { + constructor(max = 1e3, ttlInMsecs = 0) { + if (isNaN(max) || max < 0) { + throw new Error("Invalid max value"); + } + if (isNaN(ttlInMsecs) || ttlInMsecs < 0) { + throw new Error("Invalid ttl value"); + } + this.first = null; + this.items = /* @__PURE__ */ Object.create(null); + this.last = null; + this.size = 0; + this.max = max; + this.ttl = ttlInMsecs; + } + bumpLru(item) { + if (this.last === item) { return; - printACPolyfillWarning = false; - emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill); - }; -} -var shouldWarn = (code) => !warned.has(code); -var TYPE = Symbol("type"); -var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n); -var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null; -var ZeroArray = class extends Array { - constructor(size) { - super(size); - this.fill(0); - } -}; -var Stack = class _Stack { - heap; - length; - // private constructor - static #constructing = false; - static create(max) { - const HeapCls = getUintArray(max); - if (!HeapCls) - return []; - _Stack.#constructing = true; - const s = new _Stack(max, HeapCls); - _Stack.#constructing = false; - return s; - } - constructor(max, HeapCls) { - if (!_Stack.#constructing) { - throw new TypeError("instantiate Stack using Stack.create(n)"); - } - this.heap = new HeapCls(max); - this.length = 0; - } - push(n) { - this.heap[this.length++] = n; - } - pop() { - return this.heap[--this.length]; - } -}; -var LRUCache = class _LRUCache { - // options that cannot be changed without disaster - #max; - #maxSize; - #dispose; - #disposeAfter; - #fetchMethod; - #memoMethod; - /** - * {@link LRUCache.OptionsBase.ttl} - */ - ttl; - /** - * {@link LRUCache.OptionsBase.ttlResolution} - */ - ttlResolution; - /** - * {@link LRUCache.OptionsBase.ttlAutopurge} - */ - ttlAutopurge; - /** - * {@link LRUCache.OptionsBase.updateAgeOnGet} - */ - updateAgeOnGet; - /** - * {@link LRUCache.OptionsBase.updateAgeOnHas} - */ - updateAgeOnHas; - /** - * {@link LRUCache.OptionsBase.allowStale} - */ - allowStale; - /** - * {@link LRUCache.OptionsBase.noDisposeOnSet} - */ - noDisposeOnSet; - /** - * {@link LRUCache.OptionsBase.noUpdateTTL} - */ - noUpdateTTL; - /** - * {@link LRUCache.OptionsBase.maxEntrySize} - */ - maxEntrySize; - /** - * {@link LRUCache.OptionsBase.sizeCalculation} - */ - sizeCalculation; - /** - * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection} - */ - noDeleteOnFetchRejection; - /** - * {@link LRUCache.OptionsBase.noDeleteOnStaleGet} - */ - noDeleteOnStaleGet; - /** - * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort} - */ - allowStaleOnFetchAbort; - /** - * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} - */ - allowStaleOnFetchRejection; - /** - * {@link LRUCache.OptionsBase.ignoreFetchAbort} - */ - ignoreFetchAbort; - // computed properties - #size; - #calculatedSize; - #keyMap; - #keyList; - #valList; - #next; - #prev; - #head; - #tail; - #free; - #disposed; - #sizes; - #starts; - #ttls; - #hasDispose; - #hasFetchMethod; - #hasDisposeAfter; - /** - * Do not call this method unless you need to inspect the - * inner workings of the cache. If anything returned by this - * object is modified in any way, strange breakage may occur. - * - * These fields are private for a reason! - * - * @internal - */ - static unsafeExposeInternals(c) { - return { - // properties - starts: c.#starts, - ttls: c.#ttls, - sizes: c.#sizes, - keyMap: c.#keyMap, - keyList: c.#keyList, - valList: c.#valList, - next: c.#next, - prev: c.#prev, - get head() { - return c.#head; - }, - get tail() { - return c.#tail; - }, - free: c.#free, - // methods - isBackgroundFetch: (p) => c.#isBackgroundFetch(p), - backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context), - moveToTail: (index) => c.#moveToTail(index), - indexes: (options) => c.#indexes(options), - rindexes: (options) => c.#rindexes(options), - isStale: (index) => c.#isStale(index) - }; - } - // Protected read-only members - /** - * {@link LRUCache.OptionsBase.max} (read-only) - */ - get max() { - return this.#max; - } - /** - * {@link LRUCache.OptionsBase.maxSize} (read-only) - */ - get maxSize() { - return this.#maxSize; - } - /** - * The total computed size of items in the cache (read-only) - */ - get calculatedSize() { - return this.#calculatedSize; - } - /** - * The number of items stored in the cache (read-only) - */ - get size() { - return this.#size; - } - /** - * {@link LRUCache.OptionsBase.fetchMethod} (read-only) - */ - get fetchMethod() { - return this.#fetchMethod; - } - get memoMethod() { - return this.#memoMethod; - } - /** - * {@link LRUCache.OptionsBase.dispose} (read-only) - */ - get dispose() { - return this.#dispose; - } - /** - * {@link LRUCache.OptionsBase.disposeAfter} (read-only) - */ - get disposeAfter() { - return this.#disposeAfter; - } - constructor(options) { - const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options; - if (max !== 0 && !isPosInt(max)) { - throw new TypeError("max option must be a nonnegative integer"); - } - const UintArray = max ? getUintArray(max) : Array; - if (!UintArray) { - throw new Error("invalid max value: " + max); - } - this.#max = max; - this.#maxSize = maxSize; - this.maxEntrySize = maxEntrySize || this.#maxSize; - this.sizeCalculation = sizeCalculation; - if (this.sizeCalculation) { - if (!this.#maxSize && !this.maxEntrySize) { - throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize"); - } - if (typeof this.sizeCalculation !== "function") { - throw new TypeError("sizeCalculation set to non-function"); - } - } - if (memoMethod !== void 0 && typeof memoMethod !== "function") { - throw new TypeError("memoMethod must be a function if defined"); - } - this.#memoMethod = memoMethod; - if (fetchMethod !== void 0 && typeof fetchMethod !== "function") { - throw new TypeError("fetchMethod must be a function if specified"); - } - this.#fetchMethod = fetchMethod; - this.#hasFetchMethod = !!fetchMethod; - this.#keyMap = /* @__PURE__ */ new Map(); - this.#keyList = new Array(max).fill(void 0); - this.#valList = new Array(max).fill(void 0); - this.#next = new UintArray(max); - this.#prev = new UintArray(max); - this.#head = 0; - this.#tail = 0; - this.#free = Stack.create(max); - this.#size = 0; - this.#calculatedSize = 0; - if (typeof dispose === "function") { - this.#dispose = dispose; - } - if (typeof disposeAfter === "function") { - this.#disposeAfter = disposeAfter; - this.#disposed = []; - } else { - this.#disposeAfter = void 0; - this.#disposed = void 0; - } - this.#hasDispose = !!this.#dispose; - this.#hasDisposeAfter = !!this.#disposeAfter; - this.noDisposeOnSet = !!noDisposeOnSet; - this.noUpdateTTL = !!noUpdateTTL; - this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection; - this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection; - this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort; - this.ignoreFetchAbort = !!ignoreFetchAbort; - if (this.maxEntrySize !== 0) { - if (this.#maxSize !== 0) { - if (!isPosInt(this.#maxSize)) { - throw new TypeError("maxSize must be a positive integer if specified"); - } - } - if (!isPosInt(this.maxEntrySize)) { - throw new TypeError("maxEntrySize must be a positive integer if specified"); - } - this.#initializeSizeTracking(); } - this.allowStale = !!allowStale; - this.noDeleteOnStaleGet = !!noDeleteOnStaleGet; - this.updateAgeOnGet = !!updateAgeOnGet; - this.updateAgeOnHas = !!updateAgeOnHas; - this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1; - this.ttlAutopurge = !!ttlAutopurge; - this.ttl = ttl || 0; - if (this.ttl) { - if (!isPosInt(this.ttl)) { - throw new TypeError("ttl must be a positive integer if specified"); - } - this.#initializeTTLTracking(); + const last = this.last; + const next = item.next; + const prev = item.prev; + if (this.first === item) { + this.first = next; } - if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) { - throw new TypeError("At least one of max, maxSize, or ttl is required"); + item.next = null; + item.prev = last; + last.next = item; + if (prev !== null) { + prev.next = next; } - if (!this.ttlAutopurge && !this.#max && !this.#maxSize) { - const code = "LRU_CACHE_UNBOUNDED"; - if (shouldWarn(code)) { - warned.add(code); - const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption."; - emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache); - } + if (next !== null) { + next.prev = prev; } + this.last = item; } - /** - * Return the number of ms left in the item's TTL. If item is not in cache, - * returns `0`. Returns `Infinity` if item is in cache without a defined TTL. - */ - getRemainingTTL(key) { - return this.#keyMap.has(key) ? Infinity : 0; - } - #initializeTTLTracking() { - const ttls = new ZeroArray(this.#max); - const starts = new ZeroArray(this.#max); - this.#ttls = ttls; - this.#starts = starts; - this.#setItemTTL = (index, ttl, start = perf.now()) => { - starts[index] = ttl !== 0 ? start : 0; - ttls[index] = ttl; - if (ttl !== 0 && this.ttlAutopurge) { - const t = setTimeout(() => { - if (this.#isStale(index)) { - this.#delete(this.#keyList[index], "expire"); - } - }, ttl + 1); - if (t.unref) { - t.unref(); - } - } - }; - this.#updateItemAge = (index) => { - starts[index] = ttls[index] !== 0 ? perf.now() : 0; - }; - this.#statusTTL = (status, index) => { - if (ttls[index]) { - const ttl = ttls[index]; - const start = starts[index]; - if (!ttl || !start) - return; - status.ttl = ttl; - status.start = start; - status.now = cachedNow || getNow(); - const age = status.now - start; - status.remainingTTL = ttl - age; - } - }; - let cachedNow = 0; - const getNow = () => { - const n = perf.now(); - if (this.ttlResolution > 0) { - cachedNow = n; - const t = setTimeout(() => cachedNow = 0, this.ttlResolution); - if (t.unref) { - t.unref(); - } - } - return n; - }; - this.getRemainingTTL = (key) => { - const index = this.#keyMap.get(key); - if (index === void 0) { - return 0; - } - const ttl = ttls[index]; - const start = starts[index]; - if (!ttl || !start) { - return Infinity; - } - const age = (cachedNow || getNow()) - start; - return ttl - age; - }; - this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; - }; - } - // conditionally set private methods related to TTL - #updateItemAge = () => { - }; - #statusTTL = () => { - }; - #setItemTTL = () => { - }; - /* c8 ignore stop */ - #isStale = () => false; - #initializeSizeTracking() { - const sizes = new ZeroArray(this.#max); - this.#calculatedSize = 0; - this.#sizes = sizes; - this.#removeItemSize = (index) => { - this.#calculatedSize -= sizes[index]; - sizes[index] = 0; - }; - this.#requireSize = (k, v, size, sizeCalculation) => { - if (this.#isBackgroundFetch(v)) { - return 0; - } - if (!isPosInt(size)) { - if (sizeCalculation) { - if (typeof sizeCalculation !== "function") { - throw new TypeError("sizeCalculation must be a function"); - } - size = sizeCalculation(v, k); - if (!isPosInt(size)) { - throw new TypeError("sizeCalculation return invalid (expect positive integer)"); - } - } else { - throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set."); - } - } - return size; - }; - this.#addItemSize = (index, size, status) => { - sizes[index] = size; - if (this.#maxSize) { - const maxSize = this.#maxSize - sizes[index]; - while (this.#calculatedSize > maxSize) { - this.#evict(true); - } - } - this.#calculatedSize += sizes[index]; - if (status) { - status.entrySize = size; - status.totalCalculatedSize = this.#calculatedSize; - } - }; - } - #removeItemSize = (_i) => { - }; - #addItemSize = (_i, _s, _st) => { - }; - #requireSize = (_k, _v, size, sizeCalculation) => { - if (size || sizeCalculation) { - throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache"); - } - return 0; - }; - *#indexes({ allowStale = this.allowStale } = {}) { - if (this.#size) { - for (let i = this.#tail; true; ) { - if (!this.#isValidIndex(i)) { - break; - } - if (allowStale || !this.#isStale(i)) { - yield i; - } - if (i === this.#head) { - break; - } else { - i = this.#prev[i]; - } - } - } - } - *#rindexes({ allowStale = this.allowStale } = {}) { - if (this.#size) { - for (let i = this.#head; true; ) { - if (!this.#isValidIndex(i)) { - break; - } - if (allowStale || !this.#isStale(i)) { - yield i; - } - if (i === this.#tail) { - break; - } else { - i = this.#next[i]; - } - } - } - } - #isValidIndex(index) { - return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index; - } - /** - * Return a generator yielding `[key, value]` pairs, - * in order from most recently used to least recently used. - */ - *entries() { - for (const i of this.#indexes()) { - if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield [this.#keyList[i], this.#valList[i]]; - } - } + clear() { + this.items = /* @__PURE__ */ Object.create(null); + this.first = null; + this.last = null; + this.size = 0; } - /** - * Inverse order version of {@link LRUCache.entries} - * - * Return a generator yielding `[key, value]` pairs, - * in order from least recently used to most recently used. - */ - *rentries() { - for (const i of this.#rindexes()) { - if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield [this.#keyList[i], this.#valList[i]]; + delete(key) { + if (Object.prototype.hasOwnProperty.call(this.items, key)) { + const item = this.items[key]; + delete this.items[key]; + this.size--; + if (item.prev !== null) { + item.prev.next = item.next; } - } - } - /** - * Return a generator yielding the keys in the cache, - * in order from most recently used to least recently used. - */ - *keys() { - for (const i of this.#indexes()) { - const k = this.#keyList[i]; - if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield k; + if (item.next !== null) { + item.next.prev = item.prev; } - } - } - /** - * Inverse order version of {@link LRUCache.keys} - * - * Return a generator yielding the keys in the cache, - * in order from least recently used to most recently used. - */ - *rkeys() { - for (const i of this.#rindexes()) { - const k = this.#keyList[i]; - if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield k; + if (this.first === item) { + this.first = item.next; } - } - } - /** - * Return a generator yielding the values in the cache, - * in order from most recently used to least recently used. - */ - *values() { - for (const i of this.#indexes()) { - const v = this.#valList[i]; - if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield this.#valList[i]; + if (this.last === item) { + this.last = item.prev; } } } - /** - * Inverse order version of {@link LRUCache.values} - * - * Return a generator yielding the values in the cache, - * in order from least recently used to most recently used. - */ - *rvalues() { - for (const i of this.#rindexes()) { - const v = this.#valList[i]; - if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield this.#valList[i]; - } + deleteMany(keys) { + for (var i = 0; i < keys.length; i++) { + this.delete(keys[i]); } } - /** - * Iterating over the cache itself yields the same results as - * {@link LRUCache.entries} - */ - [Symbol.iterator]() { - return this.entries(); - } - /** - * A String value that is used in the creation of the default string - * description of an object. Called by the built-in method - * `Object.prototype.toString`. - */ - [Symbol.toStringTag] = "LRUCache"; - /** - * Find a value for which the supplied fn method returns a truthy value, - * similar to `Array.find()`. fn is called as `fn(value, key, cache)`. - */ - find(fn, getOptions = {}) { - for (const i of this.#indexes()) { - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - continue; - if (fn(value, this.#keyList[i], this)) { - return this.get(this.#keyList[i], getOptions); + evict() { + if (this.size > 0) { + const item = this.first; + delete this.items[item.key]; + if (--this.size === 0) { + this.first = null; + this.last = null; + } else { + this.first = item.next; + this.first.prev = null; } } } - /** - * Call the supplied function on each item in the cache, in order from most - * recently used to least recently used. - * - * `fn` is called as `fn(value, key, cache)`. - * - * If `thisp` is provided, function will be called in the `this`-context of - * the provided object, or the cache if no `thisp` object is provided. - * - * Does not update age or recenty of use, or iterate over stale values. - */ - forEach(fn, thisp = this) { - for (const i of this.#indexes()) { - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - continue; - fn.call(thisp, value, this.#keyList[i], this); + expiresAt(key) { + if (Object.prototype.hasOwnProperty.call(this.items, key)) { + return this.items[key].expiry; } } - /** - * The same as {@link LRUCache.forEach} but items are iterated over in - * reverse order. (ie, less recently used items are iterated over first.) - */ - rforEach(fn, thisp = this) { - for (const i of this.#rindexes()) { - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - continue; - fn.call(thisp, value, this.#keyList[i], this); - } - } - /** - * Delete any stale entries. Returns true if anything was removed, - * false otherwise. - */ - purgeStale() { - let deleted = false; - for (const i of this.#rindexes({ allowStale: true })) { - if (this.#isStale(i)) { - this.#delete(this.#keyList[i], "expire"); - deleted = true; - } - } - return deleted; - } - /** - * Get the extended info about a given entry, to get its value, size, and - * TTL info simultaneously. Returns `undefined` if the key is not present. - * - * Unlike {@link LRUCache#dump}, which is designed to be portable and survive - * serialization, the `start` value is always the current timestamp, and the - * `ttl` is a calculated remaining time to live (negative if expired). - * - * Always returns stale values, if their info is found in the cache, so be - * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl}) - * if relevant. - */ - info(key) { - const i = this.#keyMap.get(key); - if (i === void 0) - return void 0; - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - return void 0; - const entry = { value }; - if (this.#ttls && this.#starts) { - const ttl = this.#ttls[i]; - const start = this.#starts[i]; - if (ttl && start) { - const remain = ttl - (perf.now() - start); - entry.ttl = remain; - entry.start = Date.now(); - } - } - if (this.#sizes) { - entry.size = this.#sizes[i]; - } - return entry; - } - /** - * Return an array of [key, {@link LRUCache.Entry}] tuples which can be - * passed to {@link LRLUCache#load}. - * - * The `start` fields are calculated relative to a portable `Date.now()` - * timestamp, even if `performance.now()` is available. - * - * Stale entries are always included in the `dump`, even if - * {@link LRUCache.OptionsBase.allowStale} is false. - * - * Note: this returns an actual array, not a generator, so it can be more - * easily passed around. - */ - dump() { - const arr = []; - for (const i of this.#indexes({ allowStale: true })) { - const key = this.#keyList[i]; - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0 || key === void 0) - continue; - const entry = { value }; - if (this.#ttls && this.#starts) { - entry.ttl = this.#ttls[i]; - const age = perf.now() - this.#starts[i]; - entry.start = Math.floor(Date.now() - age); - } - if (this.#sizes) { - entry.size = this.#sizes[i]; - } - arr.unshift([key, entry]); - } - return arr; - } - /** - * Reset the cache and load in the items in entries in the order listed. - * - * The shape of the resulting cache may be different if the same options are - * not used in both caches. - * - * The `start` fields are assumed to be calculated relative to a portable - * `Date.now()` timestamp, even if `performance.now()` is available. - */ - load(arr) { - this.clear(); - for (const [key, entry] of arr) { - if (entry.start) { - const age = Date.now() - entry.start; - entry.start = perf.now() - age; - } - this.set(key, entry.value, entry); - } - } - /** - * Add a value to the cache. - * - * Note: if `undefined` is specified as a value, this is an alias for - * {@link LRUCache#delete} - * - * Fields on the {@link LRUCache.SetOptions} options param will override - * their corresponding values in the constructor options for the scope - * of this single `set()` operation. - * - * If `start` is provided, then that will set the effective start - * time for the TTL calculation. Note that this must be a previous - * value of `performance.now()` if supported, or a previous value of - * `Date.now()` if not. - * - * Options object may also include `size`, which will prevent - * calling the `sizeCalculation` function and just use the specified - * number if it is a positive integer, and `noDisposeOnSet` which - * will prevent calling a `dispose` function in the case of - * overwrites. - * - * If the `size` (or return value of `sizeCalculation`) for a given - * entry is greater than `maxEntrySize`, then the item will not be - * added to the cache. - * - * Will update the recency of the entry. - * - * If the value is `undefined`, then this is an alias for - * `cache.delete(key)`. `undefined` is never stored in the cache. - */ - set(k, v, setOptions = {}) { - if (v === void 0) { - this.delete(k); - return this; - } - const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions; - let { noUpdateTTL = this.noUpdateTTL } = setOptions; - const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation); - if (this.maxEntrySize && size > this.maxEntrySize) { - if (status) { - status.set = "miss"; - status.maxEntrySizeExceeded = true; - } - this.#delete(k, "set"); - return this; - } - let index = this.#size === 0 ? void 0 : this.#keyMap.get(k); - if (index === void 0) { - index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size; - this.#keyList[index] = k; - this.#valList[index] = v; - this.#keyMap.set(k, index); - this.#next[this.#tail] = index; - this.#prev[index] = this.#tail; - this.#tail = index; - this.#size++; - this.#addItemSize(index, size, status); - if (status) - status.set = "add"; - noUpdateTTL = false; - } else { - this.#moveToTail(index); - const oldVal = this.#valList[index]; - if (v !== oldVal) { - if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) { - oldVal.__abortController.abort(new Error("replaced")); - const { __staleWhileFetching: s } = oldVal; - if (s !== void 0 && !noDisposeOnSet) { - if (this.#hasDispose) { - this.#dispose?.(s, k, "set"); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([s, k, "set"]); - } - } - } else if (!noDisposeOnSet) { - if (this.#hasDispose) { - this.#dispose?.(oldVal, k, "set"); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([oldVal, k, "set"]); - } - } - this.#removeItemSize(index); - this.#addItemSize(index, size, status); - this.#valList[index] = v; - if (status) { - status.set = "replace"; - const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal; - if (oldValue !== void 0) - status.oldValue = oldValue; - } - } else if (status) { - status.set = "update"; - } - } - if (ttl !== 0 && !this.#ttls) { - this.#initializeTTLTracking(); - } - if (this.#ttls) { - if (!noUpdateTTL) { - this.#setItemTTL(index, ttl, start); - } - if (status) - this.#statusTTL(status, index); - } - if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); + get(key) { + if (Object.prototype.hasOwnProperty.call(this.items, key)) { + const item = this.items[key]; + if (this.ttl > 0 && item.expiry <= Date.now()) { + this.delete(key); + return; } + this.bumpLru(item); + return item.value; } - return this; } - /** - * Evict the least recently used item, returning its value or - * `undefined` if cache is empty. - */ - pop() { - try { - while (this.#size) { - const val = this.#valList[this.#head]; - this.#evict(true); - if (this.#isBackgroundFetch(val)) { - if (val.__staleWhileFetching) { - return val.__staleWhileFetching; - } - } else if (val !== void 0) { - return val; - } - } - } finally { - if (this.#hasDisposeAfter && this.#disposed) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } - } + getMany(keys) { + const result = []; + for (var i = 0; i < keys.length; i++) { + result.push(this.get(keys[i])); } + return result; } - #evict(free) { - const head = this.#head; - const k = this.#keyList[head]; - const v = this.#valList[head]; - if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) { - v.__abortController.abort(new Error("evicted")); - } else if (this.#hasDispose || this.#hasDisposeAfter) { - if (this.#hasDispose) { - this.#dispose?.(v, k, "evict"); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([v, k, "evict"]); - } - } - this.#removeItemSize(head); - if (free) { - this.#keyList[head] = void 0; - this.#valList[head] = void 0; - this.#free.push(head); - } - if (this.#size === 1) { - this.#head = this.#tail = 0; - this.#free.length = 0; - } else { - this.#head = this.#next[head]; - } - this.#keyMap.delete(k); - this.#size--; - return head; + keys() { + return Object.keys(this.items); } - /** - * Check if a key is in the cache, without updating the recency of use. - * Will return false if the item is stale, even though it is technically - * in the cache. - * - * Check if a key is in the cache, without updating the recency of - * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set - * to `true` in either the options or the constructor. - * - * Will return `false` if the item is stale, even though it is technically in - * the cache. The difference can be determined (if it matters) by using a - * `status` argument, and inspecting the `has` field. - * - * Will not update item age unless - * {@link LRUCache.OptionsBase.updateAgeOnHas} is set. - */ - has(k, hasOptions = {}) { - const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions; - const index = this.#keyMap.get(k); - if (index !== void 0) { - const v = this.#valList[index]; - if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) { - return false; + set(key, value) { + if (Object.prototype.hasOwnProperty.call(this.items, key)) { + const item2 = this.items[key]; + item2.value = value; + item2.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl; + if (this.last !== item2) { + this.bumpLru(item2); } - if (!this.#isStale(index)) { - if (updateAgeOnHas) { - this.#updateItemAge(index); - } - if (status) { - status.has = "hit"; - this.#statusTTL(status, index); - } - return true; - } else if (status) { - status.has = "stale"; - this.#statusTTL(status, index); - } - } else if (status) { - status.has = "miss"; - } - return false; - } - /** - * Like {@link LRUCache#get} but doesn't update recency or delete stale - * items. - * - * Returns `undefined` if the item is stale, unless - * {@link LRUCache.OptionsBase.allowStale} is set. - */ - peek(k, peekOptions = {}) { - const { allowStale = this.allowStale } = peekOptions; - const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { return; } - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - } - #backgroundFetch(k, index, options, context) { - const v = index === void 0 ? void 0 : this.#valList[index]; - if (this.#isBackgroundFetch(v)) { - return v; + if (this.max > 0 && this.size === this.max) { + this.evict(); } - const ac = new AC(); - const { signal } = options; - signal?.addEventListener("abort", () => ac.abort(signal.reason), { - signal: ac.signal - }); - const fetchOpts = { - signal: ac.signal, - options, - context - }; - const cb = (v2, updateCache = false) => { - const { aborted } = ac.signal; - const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0; - if (options.status) { - if (aborted && !updateCache) { - options.status.fetchAborted = true; - options.status.fetchError = ac.signal.reason; - if (ignoreAbort) - options.status.fetchAbortIgnored = true; - } else { - options.status.fetchResolved = true; - } - } - if (aborted && !ignoreAbort && !updateCache) { - return fetchFail(ac.signal.reason); - } - const bf2 = p; - if (this.#valList[index] === p) { - if (v2 === void 0) { - if (bf2.__staleWhileFetching) { - this.#valList[index] = bf2.__staleWhileFetching; - } else { - this.#delete(k, "fetch"); - } - } else { - if (options.status) - options.status.fetchUpdated = true; - this.set(k, v2, fetchOpts.options); - } - } - return v2; + const item = { + expiry: this.ttl > 0 ? Date.now() + this.ttl : this.ttl, + key, + prev: this.last, + next: null, + value }; - const eb = (er) => { - if (options.status) { - options.status.fetchRejected = true; - options.status.fetchError = er; - } - return fetchFail(er); - }; - const fetchFail = (er) => { - const { aborted } = ac.signal; - const allowStaleAborted = aborted && options.allowStaleOnFetchAbort; - const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection; - const noDelete = allowStale || options.noDeleteOnFetchRejection; - const bf2 = p; - if (this.#valList[index] === p) { - const del = !noDelete || bf2.__staleWhileFetching === void 0; - if (del) { - this.#delete(k, "fetch"); - } else if (!allowStaleAborted) { - this.#valList[index] = bf2.__staleWhileFetching; - } - } - if (allowStale) { - if (options.status && bf2.__staleWhileFetching !== void 0) { - options.status.returnedStale = true; - } - return bf2.__staleWhileFetching; - } else if (bf2.__returned === bf2) { - throw er; - } - }; - const pcall = (res, rej) => { - const fmp = this.#fetchMethod?.(k, v, fetchOpts); - if (fmp && fmp instanceof Promise) { - fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej); - } - ac.signal.addEventListener("abort", () => { - if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) { - res(void 0); - if (options.allowStaleOnFetchAbort) { - res = (v2) => cb(v2, true); - } - } - }); - }; - if (options.status) - options.status.fetchDispatched = true; - const p = new Promise(pcall).then(cb, eb); - const bf = Object.assign(p, { - __abortController: ac, - __staleWhileFetching: v, - __returned: void 0 - }); - if (index === void 0) { - this.set(k, bf, { ...fetchOpts.options, status: void 0 }); - index = this.#keyMap.get(k); - } else { - this.#valList[index] = bf; - } - return bf; - } - #isBackgroundFetch(p) { - if (!this.#hasFetchMethod) - return false; - const b = p; - return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC; - } - async fetch(k, fetchOptions = {}) { - const { - // get options - allowStale = this.allowStale, - updateAgeOnGet = this.updateAgeOnGet, - noDeleteOnStaleGet = this.noDeleteOnStaleGet, - // set options - ttl = this.ttl, - noDisposeOnSet = this.noDisposeOnSet, - size = 0, - sizeCalculation = this.sizeCalculation, - noUpdateTTL = this.noUpdateTTL, - // fetch exclusive options - noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, - allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, - ignoreFetchAbort = this.ignoreFetchAbort, - allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, - context, - forceRefresh = false, - status, - signal - } = fetchOptions; - if (!this.#hasFetchMethod) { - if (status) - status.fetch = "get"; - return this.get(k, { - allowStale, - updateAgeOnGet, - noDeleteOnStaleGet, - status - }); - } - const options = { - allowStale, - updateAgeOnGet, - noDeleteOnStaleGet, - ttl, - noDisposeOnSet, - size, - sizeCalculation, - noUpdateTTL, - noDeleteOnFetchRejection, - allowStaleOnFetchRejection, - allowStaleOnFetchAbort, - ignoreFetchAbort, - status, - signal - }; - let index = this.#keyMap.get(k); - if (index === void 0) { - if (status) - status.fetch = "miss"; - const p = this.#backgroundFetch(k, index, options, context); - return p.__returned = p; + this.items[key] = item; + if (++this.size === 1) { + this.first = item; } else { - const v = this.#valList[index]; - if (this.#isBackgroundFetch(v)) { - const stale = allowStale && v.__staleWhileFetching !== void 0; - if (status) { - status.fetch = "inflight"; - if (stale) - status.returnedStale = true; - } - return stale ? v.__staleWhileFetching : v.__returned = v; - } - const isStale = this.#isStale(index); - if (!forceRefresh && !isStale) { - if (status) - status.fetch = "hit"; - this.#moveToTail(index); - if (updateAgeOnGet) { - this.#updateItemAge(index); - } - if (status) - this.#statusTTL(status, index); - return v; - } - const p = this.#backgroundFetch(k, index, options, context); - const hasStale = p.__staleWhileFetching !== void 0; - const staleVal = hasStale && allowStale; - if (status) { - status.fetch = isStale ? "stale" : "refresh"; - if (staleVal && isStale) - status.returnedStale = true; - } - return staleVal ? p.__staleWhileFetching : p.__returned = p; - } - } - async forceFetch(k, fetchOptions = {}) { - const v = await this.fetch(k, fetchOptions); - if (v === void 0) - throw new Error("fetch() returned undefined"); - return v; - } - memo(k, memoOptions = {}) { - const memoMethod = this.#memoMethod; - if (!memoMethod) { - throw new Error("no memoMethod provided to constructor"); - } - const { context, forceRefresh, ...options } = memoOptions; - const v = this.get(k, options); - if (!forceRefresh && v !== void 0) - return v; - const vv = memoMethod(k, v, { - options, - context - }); - this.set(k, vv, options); - return vv; - } - /** - * Return a value from the cache. Will update the recency of the cache - * entry found. - * - * If the key is not found, get() will return `undefined`. - */ - get(k, getOptions = {}) { - const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions; - const index = this.#keyMap.get(k); - if (index !== void 0) { - const value = this.#valList[index]; - const fetching = this.#isBackgroundFetch(value); - if (status) - this.#statusTTL(status, index); - if (this.#isStale(index)) { - if (status) - status.get = "stale"; - if (!fetching) { - if (!noDeleteOnStaleGet) { - this.#delete(k, "expire"); - } - if (status && allowStale) - status.returnedStale = true; - return allowStale ? value : void 0; - } else { - if (status && allowStale && value.__staleWhileFetching !== void 0) { - status.returnedStale = true; - } - return allowStale ? value.__staleWhileFetching : void 0; - } - } else { - if (status) - status.get = "hit"; - if (fetching) { - return value.__staleWhileFetching; - } - this.#moveToTail(index); - if (updateAgeOnGet) { - this.#updateItemAge(index); - } - return value; - } - } else if (status) { - status.get = "miss"; - } - } - #connect(p, n) { - this.#prev[n] = p; - this.#next[p] = n; - } - #moveToTail(index) { - if (index !== this.#tail) { - if (index === this.#head) { - this.#head = this.#next[index]; - } else { - this.#connect(this.#prev[index], this.#next[index]); - } - this.#connect(this.#tail, index); - this.#tail = index; - } - } - /** - * Deletes a key out of the cache. - * - * Returns true if the key was deleted, false otherwise. - */ - delete(k) { - return this.#delete(k, "delete"); - } - #delete(k, reason) { - let deleted = false; - if (this.#size !== 0) { - const index = this.#keyMap.get(k); - if (index !== void 0) { - deleted = true; - if (this.#size === 1) { - this.#clear(reason); - } else { - this.#removeItemSize(index); - const v = this.#valList[index]; - if (this.#isBackgroundFetch(v)) { - v.__abortController.abort(new Error("deleted")); - } else if (this.#hasDispose || this.#hasDisposeAfter) { - if (this.#hasDispose) { - this.#dispose?.(v, k, reason); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([v, k, reason]); - } - } - this.#keyMap.delete(k); - this.#keyList[index] = void 0; - this.#valList[index] = void 0; - if (index === this.#tail) { - this.#tail = this.#prev[index]; - } else if (index === this.#head) { - this.#head = this.#next[index]; - } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; - } - this.#size--; - this.#free.push(index); - } - } - } - if (this.#hasDisposeAfter && this.#disposed?.length) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } - } - return deleted; - } - /** - * Clear the cache entirely, throwing away all values. - */ - clear() { - return this.#clear("delete"); - } - #clear(reason) { - for (const index of this.#rindexes({ allowStale: true })) { - const v = this.#valList[index]; - if (this.#isBackgroundFetch(v)) { - v.__abortController.abort(new Error("deleted")); - } else { - const k = this.#keyList[index]; - if (this.#hasDispose) { - this.#dispose?.(v, k, reason); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([v, k, reason]); - } - } - } - this.#keyMap.clear(); - this.#valList.fill(void 0); - this.#keyList.fill(void 0); - if (this.#ttls && this.#starts) { - this.#ttls.fill(0); - this.#starts.fill(0); - } - if (this.#sizes) { - this.#sizes.fill(0); - } - this.#head = 0; - this.#tail = 0; - this.#free.length = 0; - this.#calculatedSize = 0; - this.#size = 0; - if (this.#hasDisposeAfter && this.#disposed) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } + this.last.next = item; } + this.last = item; } }; @@ -39291,11 +38856,16 @@ async function getAppAuthentication({ timeDifference }) { try { - const appAuthentication = await githubAppJwt({ + const authOptions = { id: appId2, - privateKey: privateKey2, - now: timeDifference && Math.floor(Date.now() / 1e3) + timeDifference - }); + privateKey: privateKey2 + }; + if (timeDifference) { + Object.assign(authOptions, { + now: Math.floor(Date.now() / 1e3) + timeDifference + }); + } + const appAuthentication = await githubAppJwt(authOptions); return { type: "app", token: appAuthentication.token, @@ -39313,12 +38883,12 @@ async function getAppAuthentication({ } } function getCache() { - return new LRUCache({ + return new LruObject( // cache max. 15000 tokens, that will use less than 10mb memory - max: 15e3, + 15e3, // Cache for 1 minute less than GitHub expiry - ttl: 1e3 * 60 * 59 - }); + 1e3 * 60 * 59 + ); } async function get(cache, options) { const cacheKey = optionsToCacheKey(options); @@ -39460,6 +39030,26 @@ async function getInstallationAuthentication(state, options, customRequest) { } const appAuthentication = await getAppAuthentication(state); const request2 = customRequest || state.request; + const payload = { + installation_id: installationId, + mediaType: { + previews: ["machine-man"] + }, + headers: { + authorization: `bearer ${appAuthentication.token}` + } + }; + if (options.repositoryIds) { + Object.assign(payload, { repository_ids: options.repositoryIds }); + } + if (options.repositoryNames) { + Object.assign(payload, { + repositories: options.repositoryNames + }); + } + if (options.permissions) { + Object.assign(payload, { permissions: options.permissions }); + } const { data: { token, @@ -39469,34 +39059,29 @@ async function getInstallationAuthentication(state, options, customRequest) { repository_selection: repositorySelectionOptional, single_file: singleFileName } - } = await request2("POST /app/installations/{installation_id}/access_tokens", { - installation_id: installationId, - repository_ids: options.repositoryIds, - repositories: options.repositoryNames, - permissions: options.permissions, - mediaType: { - previews: ["machine-man"] - }, - headers: { - authorization: `bearer ${appAuthentication.token}` - } - }); + } = await request2( + "POST /app/installations/{installation_id}/access_tokens", + payload + ); const permissions = permissionsOptional || {}; const repositorySelection = repositorySelectionOptional || "all"; const repositoryIds = repositories2 ? repositories2.map((r) => r.id) : void 0; const repositoryNames = repositories2 ? repositories2.map((repo) => repo.name) : void 0; const createdAt = (/* @__PURE__ */ new Date()).toISOString(); - await set(state.cache, optionsWithInstallationTokenFromState, { + const cacheOptions = { token, createdAt, expiresAt, repositorySelection, permissions, repositoryIds, - repositoryNames, - singleFileName - }); - return toTokenAuthentication({ + repositoryNames + }; + if (singleFileName) { + Object.assign(payload, { singleFileName }); + } + await set(state.cache, optionsWithInstallationTokenFromState, cacheOptions); + const cacheData = { installationId, token, createdAt, @@ -39504,9 +39089,12 @@ async function getInstallationAuthentication(state, options, customRequest) { repositorySelection, permissions, repositoryIds, - repositoryNames, - singleFileName - }); + repositoryNames + }; + if (singleFileName) { + Object.assign(cacheData, { singleFileName }); + } + return toTokenAuthentication(cacheData); } async function auth4(state, authOptions) { switch (authOptions.type) { @@ -39645,7 +39233,7 @@ async function sendRequestWithRetries(state, request2, options, createdAt, retri return sendRequestWithRetries(state, request2, options, createdAt, retries); } } -var VERSION6 = "7.1.1"; +var VERSION6 = "7.1.3"; function createAppAuth(options) { if (!options.appId) { throw new Error("[@octokit/auth-app] appId option is required"); @@ -39749,13 +39337,11 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => { }; async function pRetry(input, options) { return new Promise((resolve, reject) => { - options = { - onFailedAttempt() { - }, - retries: 10, - shouldRetry: () => true, - ...options + options = { ...options }; + options.onFailedAttempt ??= () => { }; + options.shouldRetry ??= () => true; + options.retries ??= 10; const operation = import_retry.default.operation(options); const abortHandler = () => { operation.stop(); @@ -39992,4 +39578,13 @@ undici/lib/web/fetch/body.js: undici/lib/web/websocket/frame.js: (*! ws. MIT License. Einar Otto Stangvik *) + +toad-cache/dist/toad-cache.mjs: + (** + * toad-cache + * + * @copyright 2024 Igor Savin + * @license MIT + * @version 3.7.0 + *) */ diff --git a/dist/post.cjs b/dist/post.cjs index 37b6461..3766d87 100644 --- a/dist/post.cjs +++ b/dist/post.cjs @@ -4,16 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) @@ -30,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/@actions/core/lib/utils.js var require_utils = __commonJS({ @@ -70,9 +62,13 @@ var require_command = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; @@ -86,7 +82,7 @@ var require_command = __commonJS({ if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); } __setModuleDefault(result, mod); return result; @@ -138,345 +134,12 @@ var require_command = __commonJS({ } }; function escapeData(s) { - return utils_1.toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); + return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); } function escapeProperty(s) { - return utils_1.toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); - } - } -}); - -// node_modules/uuid/dist/esm-node/rng.js -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - import_crypto.default.randomFillSync(rnds8Pool); - poolPtr = 0; - } - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} -var import_crypto, rnds8Pool, poolPtr; -var init_rng = __esm({ - "node_modules/uuid/dist/esm-node/rng.js"() { - import_crypto = __toESM(require("crypto")); - rnds8Pool = new Uint8Array(256); - poolPtr = rnds8Pool.length; - } -}); - -// node_modules/uuid/dist/esm-node/regex.js -var regex_default; -var init_regex = __esm({ - "node_modules/uuid/dist/esm-node/regex.js"() { - regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; - } -}); - -// node_modules/uuid/dist/esm-node/validate.js -function validate(uuid) { - return typeof uuid === "string" && regex_default.test(uuid); -} -var validate_default; -var init_validate = __esm({ - "node_modules/uuid/dist/esm-node/validate.js"() { - init_regex(); - validate_default = validate; - } -}); - -// node_modules/uuid/dist/esm-node/stringify.js -function stringify(arr, offset = 0) { - const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); - if (!validate_default(uuid)) { - throw TypeError("Stringified UUID is invalid"); - } - return uuid; -} -var byteToHex, stringify_default; -var init_stringify = __esm({ - "node_modules/uuid/dist/esm-node/stringify.js"() { - init_validate(); - byteToHex = []; - for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 256).toString(16).substr(1)); - } - stringify_default = stringify; - } -}); - -// node_modules/uuid/dist/esm-node/v1.js -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || rng)(); - if (node == null) { - node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - if (clockseq == null) { - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; + return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); } } - let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); - let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; - if (dt < 0 && options.clockseq === void 0) { - clockseq = clockseq + 1 & 16383; - } - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { - nsecs = 0; - } - if (nsecs >= 1e4) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - msecs += 122192928e5; - const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; - b[i++] = tl >>> 24 & 255; - b[i++] = tl >>> 16 & 255; - b[i++] = tl >>> 8 & 255; - b[i++] = tl & 255; - const tmh = msecs / 4294967296 * 1e4 & 268435455; - b[i++] = tmh >>> 8 & 255; - b[i++] = tmh & 255; - b[i++] = tmh >>> 24 & 15 | 16; - b[i++] = tmh >>> 16 & 255; - b[i++] = clockseq >>> 8 | 128; - b[i++] = clockseq & 255; - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - return buf || stringify_default(b); -} -var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; -var init_v1 = __esm({ - "node_modules/uuid/dist/esm-node/v1.js"() { - init_rng(); - init_stringify(); - _lastMSecs = 0; - _lastNSecs = 0; - v1_default = v1; - } -}); - -// node_modules/uuid/dist/esm-node/parse.js -function parse(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - let v; - const arr = new Uint8Array(16); - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 255; - arr[2] = v >>> 8 & 255; - arr[3] = v & 255; - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 255; - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 255; - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 255; - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; - arr[11] = v / 4294967296 & 255; - arr[12] = v >>> 24 & 255; - arr[13] = v >>> 16 & 255; - arr[14] = v >>> 8 & 255; - arr[15] = v & 255; - return arr; -} -var parse_default; -var init_parse = __esm({ - "node_modules/uuid/dist/esm-node/parse.js"() { - init_validate(); - parse_default = parse; - } -}); - -// node_modules/uuid/dist/esm-node/v35.js -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); - const bytes = []; - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - return bytes; -} -function v35_default(name, version2, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === "string") { - value = stringToBytes(value); - } - if (typeof namespace === "string") { - namespace = parse_default(namespace); - } - if (namespace.length !== 16) { - throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); - } - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 15 | version2; - bytes[8] = bytes[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - return buf; - } - return stringify_default(bytes); - } - try { - generateUUID.name = name; - } catch (err) { - } - generateUUID.DNS = DNS; - generateUUID.URL = URL2; - return generateUUID; -} -var DNS, URL2; -var init_v35 = __esm({ - "node_modules/uuid/dist/esm-node/v35.js"() { - init_stringify(); - init_parse(); - DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; - URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; - } -}); - -// node_modules/uuid/dist/esm-node/md5.js -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto2.default.createHash("md5").update(bytes).digest(); -} -var import_crypto2, md5_default; -var init_md5 = __esm({ - "node_modules/uuid/dist/esm-node/md5.js"() { - import_crypto2 = __toESM(require("crypto")); - md5_default = md5; - } -}); - -// node_modules/uuid/dist/esm-node/v3.js -var v3, v3_default; -var init_v3 = __esm({ - "node_modules/uuid/dist/esm-node/v3.js"() { - init_v35(); - init_md5(); - v3 = v35_default("v3", 48, md5_default); - v3_default = v3; - } -}); - -// node_modules/uuid/dist/esm-node/v4.js -function v4(options, buf, offset) { - options = options || {}; - const rnds = options.random || (options.rng || rng)(); - rnds[6] = rnds[6] & 15 | 64; - rnds[8] = rnds[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - return buf; - } - return stringify_default(rnds); -} -var v4_default; -var init_v4 = __esm({ - "node_modules/uuid/dist/esm-node/v4.js"() { - init_rng(); - init_stringify(); - v4_default = v4; - } -}); - -// node_modules/uuid/dist/esm-node/sha1.js -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto3.default.createHash("sha1").update(bytes).digest(); -} -var import_crypto3, sha1_default; -var init_sha1 = __esm({ - "node_modules/uuid/dist/esm-node/sha1.js"() { - import_crypto3 = __toESM(require("crypto")); - sha1_default = sha1; - } -}); - -// node_modules/uuid/dist/esm-node/v5.js -var v5, v5_default; -var init_v5 = __esm({ - "node_modules/uuid/dist/esm-node/v5.js"() { - init_v35(); - init_sha1(); - v5 = v35_default("v5", 80, sha1_default); - v5_default = v5; - } -}); - -// node_modules/uuid/dist/esm-node/nil.js -var nil_default; -var init_nil = __esm({ - "node_modules/uuid/dist/esm-node/nil.js"() { - nil_default = "00000000-0000-0000-0000-000000000000"; - } -}); - -// node_modules/uuid/dist/esm-node/version.js -function version(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - return parseInt(uuid.substr(14, 1), 16); -} -var version_default; -var init_version = __esm({ - "node_modules/uuid/dist/esm-node/version.js"() { - init_validate(); - version_default = version; - } -}); - -// node_modules/uuid/dist/esm-node/index.js -var esm_node_exports = {}; -__export(esm_node_exports, { - NIL: () => nil_default, - parse: () => parse_default, - stringify: () => stringify_default, - v1: () => v1_default, - v3: () => v3_default, - v4: () => v4_default, - v5: () => v5_default, - validate: () => validate_default, - version: () => version_default -}); -var init_esm_node = __esm({ - "node_modules/uuid/dist/esm-node/index.js"() { - init_v1(); - init_v3(); - init_v4(); - init_v5(); - init_nil(); - init_version(); - init_validate(); - init_stringify(); - init_parse(); - } }); // node_modules/@actions/core/lib/file-command.js @@ -485,9 +148,13 @@ var require_file_command = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; @@ -501,16 +168,16 @@ var require_file_command = __commonJS({ if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); } __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; + var crypto = __importStar(require("crypto")); var fs = __importStar(require("fs")); var os = __importStar(require("os")); - var uuid_1 = (init_esm_node(), __toCommonJS(esm_node_exports)); var utils_1 = require_utils(); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; @@ -520,14 +187,14 @@ var require_file_command = __commonJS({ if (!fs.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + fs.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os.EOL}`, { encoding: "utf8" }); } exports2.issueFileCommand = issueFileCommand; function prepareKeyValueMessage(key, value) { - const delimiter = `ghadelimiter_${uuid_1.v4()}`; - const convertedValue = utils_1.toCommandValue(value); + const delimiter = `ghadelimiter_${crypto.randomUUID()}`; + const convertedValue = (0, utils_1.toCommandValue)(value); if (key.includes(delimiter)) { throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); } @@ -560,10 +227,10 @@ var require_proxy = __commonJS({ })(); if (proxyVar) { try { - return new DecodedURL(proxyVar); + return new URL(proxyVar); } catch (_a) { if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://")) - return new DecodedURL(`http://${proxyVar}`); + return new URL(`http://${proxyVar}`); } } else { return void 0; @@ -606,19 +273,6 @@ var require_proxy = __commonJS({ const hostLower = host.toLowerCase(); return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]"); } - var DecodedURL = class extends URL { - constructor(url, base) { - super(url, base); - this._decodedUsername = decodeURIComponent(super.username); - this._decodedPassword = decodeURIComponent(super.password); - } - get username() { - return this._decodedUsername; - } - get password() { - return this._decodedPassword; - } - }; } }); @@ -1270,7 +924,7 @@ var require_util = __commonJS({ var { InvalidArgumentError } = require_errors(); var { Blob: Blob2 } = require("buffer"); var nodeUtil = require("util"); - var { stringify: stringify2 } = require("querystring"); + var { stringify } = require("querystring"); var { headerNameLowerCasedRecord } = require_constants(); var [nodeMajor, nodeMinor] = process.versions.node.split(".").map((v) => Number(v)); function nop() { @@ -1285,7 +939,7 @@ var require_util = __commonJS({ if (url.includes("?") || url.includes("#")) { throw new Error('Query params cannot be passed when url already contains "?" or "#".'); } - const stringified = stringify2(queryParams); + const stringified = stringify(queryParams); if (stringified) { url += "?" + stringified; } @@ -3961,11 +3615,11 @@ var require_util2 = __commonJS({ var assert = require("assert"); var { isUint8Array } = require("util/types"); var supportedHashes = []; - var crypto4; + var crypto; try { - crypto4 = require("crypto"); + crypto = require("crypto"); const possibleRelevantHashes = ["sha256", "sha384", "sha512"]; - supportedHashes = crypto4.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); } catch { } function responseURL(response) { @@ -4242,7 +3896,7 @@ var require_util2 = __commonJS({ } } function bytesMatch(bytes, metadataList) { - if (crypto4 === void 0) { + if (crypto === void 0) { return true; } const parsedMetadata = parseMetadata(metadataList); @@ -4257,7 +3911,7 @@ var require_util2 = __commonJS({ for (const item of metadata) { const algorithm = item.algo; const expectedValue = item.hash; - let actualValue = crypto4.createHash(algorithm).update(bytes).digest("base64"); + let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64"); if (actualValue[actualValue.length - 1] === "=") { if (actualValue[actualValue.length - 2] === "=") { actualValue = actualValue.slice(0, -2); @@ -11379,7 +11033,7 @@ var require_proxy_agent = __commonJS({ "node_modules/@actions/http-client/node_modules/undici/lib/proxy-agent.js"(exports2, module2) { "use strict"; var { kProxy, kClose, kDestroy, kInterceptors } = require_symbols(); - var { URL: URL3 } = require("url"); + var { URL: URL2 } = require("url"); var Agent = require_agent(); var Pool = require_pool(); var DispatcherBase = require_dispatcher_base(); @@ -11428,7 +11082,7 @@ var require_proxy_agent = __commonJS({ this[kRequestTls] = opts.requestTls; this[kProxyTls] = opts.proxyTls; this[kProxyHeaders] = opts.headers || {}; - const resolvedUrl = new URL3(opts.uri); + const resolvedUrl = new URL2(opts.uri); const { origin, port, host, username, password } = resolvedUrl; if (opts.auth && opts.token) { throw new InvalidArgumentError("opts.auth cannot be used in combination with opts.token"); @@ -11483,7 +11137,7 @@ var require_proxy_agent = __commonJS({ }); } dispatch(opts, handler) { - const { host } = new URL3(opts.origin); + const { host } = new URL2(opts.origin); const headers = buildHeaders(opts.headers); throwIfProxyAuthIsSent(headers); return this[kAgent].dispatch( @@ -15893,7 +15547,7 @@ var require_util6 = __commonJS({ throw new Error("Invalid cookie max-age"); } } - function stringify2(cookie) { + function stringify(cookie) { if (cookie.name.length === 0) { return null; } @@ -15958,7 +15612,7 @@ var require_util6 = __commonJS({ } module2.exports = { isCTLExcludingHtab, - stringify: stringify2, + stringify, getHeadersList }; } @@ -16109,7 +15763,7 @@ var require_cookies = __commonJS({ "node_modules/@actions/http-client/node_modules/undici/lib/cookies/index.js"(exports2, module2) { "use strict"; var { parseSetCookie } = require_parse(); - var { stringify: stringify2, getHeadersList } = require_util6(); + var { stringify, getHeadersList } = require_util6(); var { webidl } = require_webidl(); var { Headers } = require_headers(); function getCookies(headers) { @@ -16151,9 +15805,9 @@ var require_cookies = __commonJS({ webidl.argumentLengthCheck(arguments, 2, { header: "setCookie" }); webidl.brandCheck(headers, Headers, { strict: false }); cookie = webidl.converters.Cookie(cookie); - const str = stringify2(cookie); + const str = stringify(cookie); if (str) { - headers.append("Set-Cookie", stringify2(cookie)); + headers.append("Set-Cookie", stringify(cookie)); } } webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([ @@ -16649,9 +16303,9 @@ var require_connection = __commonJS({ channels.open = diagnosticsChannel.channel("undici:websocket:open"); channels.close = diagnosticsChannel.channel("undici:websocket:close"); channels.socketError = diagnosticsChannel.channel("undici:websocket:socket_error"); - var crypto4; + var crypto; try { - crypto4 = require("crypto"); + crypto = require("crypto"); } catch { } function establishWebSocketConnection(url, protocols, ws, onEstablish, options) { @@ -16670,7 +16324,7 @@ var require_connection = __commonJS({ const headersList = new Headers(options.headers)[kHeadersList]; request2.headersList = headersList; } - const keyValue = crypto4.randomBytes(16).toString("base64"); + const keyValue = crypto.randomBytes(16).toString("base64"); request2.headersList.append("sec-websocket-key", keyValue); request2.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { @@ -16699,7 +16353,7 @@ var require_connection = __commonJS({ return; } const secWSAccept = response.headersList.get("Sec-WebSocket-Accept"); - const digest = crypto4.createHash("sha1").update(keyValue + uid).digest("base64"); + const digest = crypto.createHash("sha1").update(keyValue + uid).digest("base64"); if (secWSAccept !== digest) { failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header."); return; @@ -16779,9 +16433,9 @@ var require_frame = __commonJS({ "node_modules/@actions/http-client/node_modules/undici/lib/websocket/frame.js"(exports2, module2) { "use strict"; var { maxUnsigned16Bit } = require_constants5(); - var crypto4; + var crypto; try { - crypto4 = require("crypto"); + crypto = require("crypto"); } catch { } var WebsocketFrameSend = class { @@ -16790,7 +16444,7 @@ var require_frame = __commonJS({ */ constructor(data) { this.frameData = data; - this.maskKey = crypto4.randomBytes(4); + this.maskKey = crypto.randomBytes(4); } createFrame(opcode) { const bodyLength = this.frameData?.byteLength ?? 0; @@ -18153,7 +17807,7 @@ var require_lib = __commonJS({ } const usingSsl = parsedUrl.protocol === "https:"; proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl2.href, pipelining: !this._keepAlive ? 0 : 1 }, (proxyUrl2.username || proxyUrl2.password) && { - token: `Basic ${Buffer.from(`${proxyUrl2.username}:${proxyUrl2.password}`).toString("base64")}` + token: `${proxyUrl2.username}:${proxyUrl2.password}` })); this._proxyAgentDispatcher = proxyAgent; if (usingSsl && this._ignoreSslError) { @@ -18418,9 +18072,9 @@ var require_oidc_utils = __commonJS({ const encodedAudience = encodeURIComponent(audience); id_token_url = `${id_token_url}&audience=${encodedAudience}`; } - core_1.debug(`ID token url is ${id_token_url}`); + (0, core_1.debug)(`ID token url is ${id_token_url}`); const id_token = yield _OidcClient.getCall(id_token_url); - core_1.setSecret(id_token); + (0, core_1.setSecret)(id_token); return id_token; } catch (error) { throw new Error(`Error message: ${error.message}`); @@ -18729,6 +18383,476 @@ var require_summary = __commonJS({ // node_modules/@actions/core/lib/path-utils.js var require_path_utils = __commonJS({ "node_modules/@actions/core/lib/path-utils.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = void 0; + var path = __importStar(require("path")); + function toPosixPath(pth) { + return pth.replace(/[\\]/g, "/"); + } + exports2.toPosixPath = toPosixPath; + function toWin32Path(pth) { + return pth.replace(/[/]/g, "\\"); + } + exports2.toWin32Path = toWin32Path; + function toPlatformPath(pth) { + return pth.replace(/[/\\]/g, path.sep); + } + exports2.toPlatformPath = toPlatformPath; + } +}); + +// node_modules/@actions/io/lib/io-util.js +var require_io_util = __commonJS({ + "node_modules/@actions/io/lib/io-util.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var _a; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; + var fs = __importStar(require("fs")); + var path = __importStar(require("path")); + _a = fs.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; + exports2.IS_WINDOWS = process.platform === "win32"; + exports2.UV_FS_O_EXLOCK = 268435456; + exports2.READONLY = fs.constants.O_RDONLY; + function exists(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + try { + yield exports2.stat(fsPath); + } catch (err) { + if (err.code === "ENOENT") { + return false; + } + throw err; + } + return true; + }); + } + exports2.exists = exists; + function isDirectory(fsPath, useStat = false) { + return __awaiter(this, void 0, void 0, function* () { + const stats = useStat ? yield exports2.stat(fsPath) : yield exports2.lstat(fsPath); + return stats.isDirectory(); + }); + } + exports2.isDirectory = isDirectory; + function isRooted(p) { + p = normalizeSeparators(p); + if (!p) { + throw new Error('isRooted() parameter "p" cannot be empty'); + } + if (exports2.IS_WINDOWS) { + return p.startsWith("\\") || /^[A-Z]:/i.test(p); + } + return p.startsWith("/"); + } + exports2.isRooted = isRooted; + function tryGetExecutablePath(filePath, extensions) { + return __awaiter(this, void 0, void 0, function* () { + let stats = void 0; + try { + stats = yield exports2.stat(filePath); + } catch (err) { + if (err.code !== "ENOENT") { + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } + } + if (stats && stats.isFile()) { + if (exports2.IS_WINDOWS) { + const upperExt = path.extname(filePath).toUpperCase(); + if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { + return filePath; + } + } else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + const originalFilePath = filePath; + for (const extension of extensions) { + filePath = originalFilePath + extension; + stats = void 0; + try { + stats = yield exports2.stat(filePath); + } catch (err) { + if (err.code !== "ENOENT") { + console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); + } + } + if (stats && stats.isFile()) { + if (exports2.IS_WINDOWS) { + try { + const directory = path.dirname(filePath); + const upperName = path.basename(filePath).toUpperCase(); + for (const actualName of yield exports2.readdir(directory)) { + if (upperName === actualName.toUpperCase()) { + filePath = path.join(directory, actualName); + break; + } + } + } catch (err) { + console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); + } + return filePath; + } else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + } + return ""; + }); + } + exports2.tryGetExecutablePath = tryGetExecutablePath; + function normalizeSeparators(p) { + p = p || ""; + if (exports2.IS_WINDOWS) { + p = p.replace(/\//g, "\\"); + return p.replace(/\\\\+/g, "\\"); + } + return p.replace(/\/\/+/g, "/"); + } + function isUnixExecutable(stats) { + return (stats.mode & 1) > 0 || (stats.mode & 8) > 0 && stats.gid === process.getgid() || (stats.mode & 64) > 0 && stats.uid === process.getuid(); + } + function getCmdPath() { + var _a2; + return (_a2 = process.env["COMSPEC"]) !== null && _a2 !== void 0 ? _a2 : `cmd.exe`; + } + exports2.getCmdPath = getCmdPath; + } +}); + +// node_modules/@actions/io/lib/io.js +var require_io = __commonJS({ + "node_modules/@actions/io/lib/io.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.findInPath = exports2.which = exports2.mkdirP = exports2.rmRF = exports2.mv = exports2.cp = void 0; + var assert_1 = require("assert"); + var path = __importStar(require("path")); + var ioUtil = __importStar(require_io_util()); + function cp(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const { force, recursive, copySourceDirectory } = readCopyOptions(options); + const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; + if (destStat && destStat.isFile() && !force) { + return; + } + const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path.join(dest, path.basename(source)) : dest; + if (!(yield ioUtil.exists(source))) { + throw new Error(`no such file or directory: ${source}`); + } + const sourceStat = yield ioUtil.stat(source); + if (sourceStat.isDirectory()) { + if (!recursive) { + throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); + } else { + yield cpDirRecursive(source, newDest, 0, force); + } + } else { + if (path.relative(source, newDest) === "") { + throw new Error(`'${newDest}' and '${source}' are the same file`); + } + yield copyFile(source, newDest, force); + } + }); + } + exports2.cp = cp; + function mv(source, dest, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + if (yield ioUtil.exists(dest)) { + let destExists = true; + if (yield ioUtil.isDirectory(dest)) { + dest = path.join(dest, path.basename(source)); + destExists = yield ioUtil.exists(dest); + } + if (destExists) { + if (options.force == null || options.force) { + yield rmRF(dest); + } else { + throw new Error("Destination already exists"); + } + } + } + yield mkdirP(path.dirname(dest)); + yield ioUtil.rename(source, dest); + }); + } + exports2.mv = mv; + function rmRF(inputPath) { + return __awaiter(this, void 0, void 0, function* () { + if (ioUtil.IS_WINDOWS) { + if (/[*"<>|]/.test(inputPath)) { + throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); + } + } + try { + yield ioUtil.rm(inputPath, { + force: true, + maxRetries: 3, + recursive: true, + retryDelay: 300 + }); + } catch (err) { + throw new Error(`File was unable to be removed ${err}`); + } + }); + } + exports2.rmRF = rmRF; + function mkdirP(fsPath) { + return __awaiter(this, void 0, void 0, function* () { + assert_1.ok(fsPath, "a path argument must be provided"); + yield ioUtil.mkdir(fsPath, { recursive: true }); + }); + } + exports2.mkdirP = mkdirP; + function which(tool, check) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + if (check) { + const result = yield which(tool, false); + if (!result) { + if (ioUtil.IS_WINDOWS) { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`); + } else { + throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); + } + } + return result; + } + const matches = yield findInPath(tool); + if (matches && matches.length > 0) { + return matches[0]; + } + return ""; + }); + } + exports2.which = which; + function findInPath(tool) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + const extensions = []; + if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { + for (const extension of process.env["PATHEXT"].split(path.delimiter)) { + if (extension) { + extensions.push(extension); + } + } + } + if (ioUtil.isRooted(tool)) { + const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); + if (filePath) { + return [filePath]; + } + return []; + } + if (tool.includes(path.sep)) { + return []; + } + const directories = []; + if (process.env.PATH) { + for (const p of process.env.PATH.split(path.delimiter)) { + if (p) { + directories.push(p); + } + } + } + const matches = []; + for (const directory of directories) { + const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); + if (filePath) { + matches.push(filePath); + } + } + return matches; + }); + } + exports2.findInPath = findInPath; + function readCopyOptions(options) { + const force = options.force == null ? true : options.force; + const recursive = Boolean(options.recursive); + const copySourceDirectory = options.copySourceDirectory == null ? true : Boolean(options.copySourceDirectory); + return { force, recursive, copySourceDirectory }; + } + function cpDirRecursive(sourceDir, destDir, currentDepth, force) { + return __awaiter(this, void 0, void 0, function* () { + if (currentDepth >= 255) + return; + currentDepth++; + yield mkdirP(destDir); + const files = yield ioUtil.readdir(sourceDir); + for (const fileName of files) { + const srcFile = `${sourceDir}/${fileName}`; + const destFile = `${destDir}/${fileName}`; + const srcFileStat = yield ioUtil.lstat(srcFile); + if (srcFileStat.isDirectory()) { + yield cpDirRecursive(srcFile, destFile, currentDepth, force); + } else { + yield copyFile(srcFile, destFile, force); + } + } + yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); + }); + } + function copyFile(srcFile, destFile, force) { + return __awaiter(this, void 0, void 0, function* () { + if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { + try { + yield ioUtil.lstat(destFile); + yield ioUtil.unlink(destFile); + } catch (e) { + if (e.code === "EPERM") { + yield ioUtil.chmod(destFile, "0666"); + yield ioUtil.unlink(destFile); + } + } + const symlinkFull = yield ioUtil.readlink(srcFile); + yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? "junction" : null); + } else if (!(yield ioUtil.exists(destFile)) || force) { + yield ioUtil.copyFile(srcFile, destFile); + } + }); + } + } +}); + +// node_modules/@actions/exec/lib/toolrunner.js +var require_toolrunner = __commonJS({ + "node_modules/@actions/exec/lib/toolrunner.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; @@ -18753,21 +18877,686 @@ var require_path_utils = __commonJS({ __setModuleDefault(result, mod); return result; }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = void 0; + exports2.argStringToArray = exports2.ToolRunner = void 0; + var os = __importStar(require("os")); + var events = __importStar(require("events")); + var child = __importStar(require("child_process")); var path = __importStar(require("path")); - function toPosixPath(pth) { - return pth.replace(/[\\]/g, "/"); + var io = __importStar(require_io()); + var ioUtil = __importStar(require_io_util()); + var timers_1 = require("timers"); + var IS_WINDOWS = process.platform === "win32"; + var ToolRunner = class extends events.EventEmitter { + constructor(toolPath, args, options) { + super(); + if (!toolPath) { + throw new Error("Parameter 'toolPath' cannot be null or empty."); + } + this.toolPath = toolPath; + this.args = args || []; + this.options = options || {}; + } + _debug(message) { + if (this.options.listeners && this.options.listeners.debug) { + this.options.listeners.debug(message); + } + } + _getCommandString(options, noPrefix) { + const toolPath = this._getSpawnFileName(); + const args = this._getSpawnArgs(options); + let cmd = noPrefix ? "" : "[command]"; + if (IS_WINDOWS) { + if (this._isCmdFile()) { + cmd += toolPath; + for (const a of args) { + cmd += ` ${a}`; + } + } else if (options.windowsVerbatimArguments) { + cmd += `"${toolPath}"`; + for (const a of args) { + cmd += ` ${a}`; + } + } else { + cmd += this._windowsQuoteCmdArg(toolPath); + for (const a of args) { + cmd += ` ${this._windowsQuoteCmdArg(a)}`; + } + } + } else { + cmd += toolPath; + for (const a of args) { + cmd += ` ${a}`; + } + } + return cmd; + } + _processLineBuffer(data, strBuffer, onLine) { + try { + let s = strBuffer + data.toString(); + let n = s.indexOf(os.EOL); + while (n > -1) { + const line = s.substring(0, n); + onLine(line); + s = s.substring(n + os.EOL.length); + n = s.indexOf(os.EOL); + } + return s; + } catch (err) { + this._debug(`error processing line. Failed with error ${err}`); + return ""; + } + } + _getSpawnFileName() { + if (IS_WINDOWS) { + if (this._isCmdFile()) { + return process.env["COMSPEC"] || "cmd.exe"; + } + } + return this.toolPath; + } + _getSpawnArgs(options) { + if (IS_WINDOWS) { + if (this._isCmdFile()) { + let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; + for (const a of this.args) { + argline += " "; + argline += options.windowsVerbatimArguments ? a : this._windowsQuoteCmdArg(a); + } + argline += '"'; + return [argline]; + } + } + return this.args; + } + _endsWith(str, end) { + return str.endsWith(end); + } + _isCmdFile() { + const upperToolPath = this.toolPath.toUpperCase(); + return this._endsWith(upperToolPath, ".CMD") || this._endsWith(upperToolPath, ".BAT"); + } + _windowsQuoteCmdArg(arg) { + if (!this._isCmdFile()) { + return this._uvQuoteCmdArg(arg); + } + if (!arg) { + return '""'; + } + const cmdSpecialChars = [ + " ", + " ", + "&", + "(", + ")", + "[", + "]", + "{", + "}", + "^", + "=", + ";", + "!", + "'", + "+", + ",", + "`", + "~", + "|", + "<", + ">", + '"' + ]; + let needsQuotes = false; + for (const char of arg) { + if (cmdSpecialChars.some((x) => x === char)) { + needsQuotes = true; + break; + } + } + if (!needsQuotes) { + return arg; + } + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { + reverse += arg[i - 1]; + if (quoteHit && arg[i - 1] === "\\") { + reverse += "\\"; + } else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += '"'; + } else { + quoteHit = false; + } + } + reverse += '"'; + return reverse.split("").reverse().join(""); + } + _uvQuoteCmdArg(arg) { + if (!arg) { + return '""'; + } + if (!arg.includes(" ") && !arg.includes(" ") && !arg.includes('"')) { + return arg; + } + if (!arg.includes('"') && !arg.includes("\\")) { + return `"${arg}"`; + } + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { + reverse += arg[i - 1]; + if (quoteHit && arg[i - 1] === "\\") { + reverse += "\\"; + } else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += "\\"; + } else { + quoteHit = false; + } + } + reverse += '"'; + return reverse.split("").reverse().join(""); + } + _cloneExecOptions(options) { + options = options || {}; + const result = { + cwd: options.cwd || process.cwd(), + env: options.env || process.env, + silent: options.silent || false, + windowsVerbatimArguments: options.windowsVerbatimArguments || false, + failOnStdErr: options.failOnStdErr || false, + ignoreReturnCode: options.ignoreReturnCode || false, + delay: options.delay || 1e4 + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; + } + _getSpawnOptions(options, toolPath) { + options = options || {}; + const result = {}; + result.cwd = options.cwd; + result.env = options.env; + result["windowsVerbatimArguments"] = options.windowsVerbatimArguments || this._isCmdFile(); + if (options.windowsVerbatimArguments) { + result.argv0 = `"${toolPath}"`; + } + return result; + } + /** + * Exec a tool. + * Output will be streamed to the live console. + * Returns promise with return code + * + * @param tool path to tool to exec + * @param options optional exec options. See ExecOptions + * @returns number + */ + exec() { + return __awaiter(this, void 0, void 0, function* () { + if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { + this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); + } + this.toolPath = yield io.which(this.toolPath, true); + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + this._debug(`exec tool: ${this.toolPath}`); + this._debug("arguments:"); + for (const arg of this.args) { + this._debug(` ${arg}`); + } + const optionsNonNull = this._cloneExecOptions(this.options); + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + } + const state = new ExecState(optionsNonNull, this.toolPath); + state.on("debug", (message) => { + this._debug(message); + }); + if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { + return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); + } + const fileName = this._getSpawnFileName(); + const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); + let stdbuffer = ""; + if (cp.stdout) { + cp.stdout.on("data", (data) => { + if (this.options.listeners && this.options.listeners.stdout) { + this.options.listeners.stdout(data); + } + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(data); + } + stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { + if (this.options.listeners && this.options.listeners.stdline) { + this.options.listeners.stdline(line); + } + }); + }); + } + let errbuffer = ""; + if (cp.stderr) { + cp.stderr.on("data", (data) => { + state.processStderr = true; + if (this.options.listeners && this.options.listeners.stderr) { + this.options.listeners.stderr(data); + } + if (!optionsNonNull.silent && optionsNonNull.errStream && optionsNonNull.outStream) { + const s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; + s.write(data); + } + errbuffer = this._processLineBuffer(data, errbuffer, (line) => { + if (this.options.listeners && this.options.listeners.errline) { + this.options.listeners.errline(line); + } + }); + }); + } + cp.on("error", (err) => { + state.processError = err.message; + state.processExited = true; + state.processClosed = true; + state.CheckComplete(); + }); + cp.on("exit", (code) => { + state.processExitCode = code; + state.processExited = true; + this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); + state.CheckComplete(); + }); + cp.on("close", (code) => { + state.processExitCode = code; + state.processExited = true; + state.processClosed = true; + this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); + state.CheckComplete(); + }); + state.on("done", (error, exitCode) => { + if (stdbuffer.length > 0) { + this.emit("stdline", stdbuffer); + } + if (errbuffer.length > 0) { + this.emit("errline", errbuffer); + } + cp.removeAllListeners(); + if (error) { + reject(error); + } else { + resolve(exitCode); + } + }); + if (this.options.input) { + if (!cp.stdin) { + throw new Error("child process missing stdin"); + } + cp.stdin.end(this.options.input); + } + })); + }); + } + }; + exports2.ToolRunner = ToolRunner; + function argStringToArray(argString) { + const args = []; + let inQuotes = false; + let escaped = false; + let arg = ""; + function append(c) { + if (escaped && c !== '"') { + arg += "\\"; + } + arg += c; + escaped = false; + } + for (let i = 0; i < argString.length; i++) { + const c = argString.charAt(i); + if (c === '"') { + if (!escaped) { + inQuotes = !inQuotes; + } else { + append(c); + } + continue; + } + if (c === "\\" && escaped) { + append(c); + continue; + } + if (c === "\\" && inQuotes) { + escaped = true; + continue; + } + if (c === " " && !inQuotes) { + if (arg.length > 0) { + args.push(arg); + arg = ""; + } + continue; + } + append(c); + } + if (arg.length > 0) { + args.push(arg.trim()); + } + return args; } - exports2.toPosixPath = toPosixPath; - function toWin32Path(pth) { - return pth.replace(/[/]/g, "\\"); + exports2.argStringToArray = argStringToArray; + var ExecState = class _ExecState extends events.EventEmitter { + constructor(options, toolPath) { + super(); + this.processClosed = false; + this.processError = ""; + this.processExitCode = 0; + this.processExited = false; + this.processStderr = false; + this.delay = 1e4; + this.done = false; + this.timeout = null; + if (!toolPath) { + throw new Error("toolPath must not be empty"); + } + this.options = options; + this.toolPath = toolPath; + if (options.delay) { + this.delay = options.delay; + } + } + CheckComplete() { + if (this.done) { + return; + } + if (this.processClosed) { + this._setResult(); + } else if (this.processExited) { + this.timeout = timers_1.setTimeout(_ExecState.HandleTimeout, this.delay, this); + } + } + _debug(message) { + this.emit("debug", message); + } + _setResult() { + let error; + if (this.processExited) { + if (this.processError) { + error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); + } else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { + error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); + } else if (this.processStderr && this.options.failOnStdErr) { + error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); + } + } + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = null; + } + this.done = true; + this.emit("done", error, this.processExitCode); + } + static HandleTimeout(state) { + if (state.done) { + return; + } + if (!state.processClosed && state.processExited) { + const message = `The STDIO streams did not close within ${state.delay / 1e3} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; + state._debug(message); + } + state._setResult(); + } + }; + } +}); + +// node_modules/@actions/exec/lib/exec.js +var require_exec = __commonJS({ + "node_modules/@actions/exec/lib/exec.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getExecOutput = exports2.exec = void 0; + var string_decoder_1 = require("string_decoder"); + var tr = __importStar(require_toolrunner()); + function exec(commandLine, args, options) { + return __awaiter(this, void 0, void 0, function* () { + const commandArgs = tr.argStringToArray(commandLine); + if (commandArgs.length === 0) { + throw new Error(`Parameter 'commandLine' cannot be null or empty.`); + } + const toolPath = commandArgs[0]; + args = commandArgs.slice(1).concat(args || []); + const runner = new tr.ToolRunner(toolPath, args, options); + return runner.exec(); + }); } - exports2.toWin32Path = toWin32Path; - function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path.sep); + exports2.exec = exec; + function getExecOutput(commandLine, args, options) { + var _a, _b; + return __awaiter(this, void 0, void 0, function* () { + let stdout = ""; + let stderr = ""; + const stdoutDecoder = new string_decoder_1.StringDecoder("utf8"); + const stderrDecoder = new string_decoder_1.StringDecoder("utf8"); + const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; + const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; + const stdErrListener = (data) => { + stderr += stderrDecoder.write(data); + if (originalStdErrListener) { + originalStdErrListener(data); + } + }; + const stdOutListener = (data) => { + stdout += stdoutDecoder.write(data); + if (originalStdoutListener) { + originalStdoutListener(data); + } + }; + const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); + const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); + stdout += stdoutDecoder.end(); + stderr += stderrDecoder.end(); + return { + exitCode, + stdout, + stderr + }; + }); } - exports2.toPlatformPath = toPlatformPath; + exports2.getExecOutput = getExecOutput; + } +}); + +// node_modules/@actions/core/lib/platform.js +var require_platform = __commonJS({ + "node_modules/@actions/core/lib/platform.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getDetails = exports2.isLinux = exports2.isMacOS = exports2.isWindows = exports2.arch = exports2.platform = void 0; + var os_1 = __importDefault(require("os")); + var exec = __importStar(require_exec()); + var getWindowsInfo = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', void 0, { + silent: true + }); + const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', void 0, { + silent: true + }); + return { + name: name.trim(), + version: version.trim() + }; + }); + var getMacOsInfo = () => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b, _c, _d; + const { stdout } = yield exec.getExecOutput("sw_vers", void 0, { + silent: true + }); + const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : ""; + const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : ""; + return { + name, + version + }; + }); + var getLinuxInfo = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout } = yield exec.getExecOutput("lsb_release", ["-i", "-r", "-s"], { + silent: true + }); + const [name, version] = stdout.trim().split("\n"); + return { + name, + version + }; + }); + exports2.platform = os_1.default.platform(); + exports2.arch = os_1.default.arch(); + exports2.isWindows = exports2.platform === "win32"; + exports2.isMacOS = exports2.platform === "darwin"; + exports2.isLinux = exports2.platform === "linux"; + function getDetails() { + return __awaiter(this, void 0, void 0, function* () { + return Object.assign(Object.assign({}, yield exports2.isWindows ? getWindowsInfo() : exports2.isMacOS ? getMacOsInfo() : getLinuxInfo()), { + platform: exports2.platform, + arch: exports2.arch, + isWindows: exports2.isWindows, + isMacOS: exports2.isMacOS, + isLinux: exports2.isLinux + }); + }); + } + exports2.getDetails = getDetails; } }); @@ -18777,9 +19566,13 @@ var require_core = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; @@ -18793,7 +19586,7 @@ var require_core = __commonJS({ if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); } __setModuleDefault(result, mod); return result; @@ -18826,7 +19619,7 @@ var require_core = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getIDToken = exports2.getState = exports2.saveState = exports2.group = exports2.endGroup = exports2.startGroup = exports2.info = exports2.notice = exports2.warning = exports2.error = exports2.debug = exports2.isDebug = exports2.setFailed = exports2.setCommandEcho = exports2.setOutput = exports2.getBooleanInput = exports2.getMultilineInput = exports2.getInput = exports2.addPath = exports2.setSecret = exports2.exportVariable = exports2.ExitCode = void 0; + exports2.platform = exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = exports2.markdownSummary = exports2.summary = exports2.getIDToken = exports2.getState = exports2.saveState = exports2.group = exports2.endGroup = exports2.startGroup = exports2.info = exports2.notice = exports2.warning = exports2.error = exports2.debug = exports2.isDebug = exports2.setFailed = exports2.setCommandEcho = exports2.setOutput = exports2.getBooleanInput = exports2.getMultilineInput = exports2.getInput = exports2.addPath = exports2.setSecret = exports2.exportVariable = exports2.ExitCode = void 0; var command_1 = require_command(); var file_command_1 = require_file_command(); var utils_1 = require_utils(); @@ -18837,27 +19630,27 @@ var require_core = __commonJS({ (function(ExitCode2) { ExitCode2[ExitCode2["Success"] = 0] = "Success"; ExitCode2[ExitCode2["Failure"] = 1] = "Failure"; - })(ExitCode = exports2.ExitCode || (exports2.ExitCode = {})); + })(ExitCode || (exports2.ExitCode = ExitCode = {})); function exportVariable(name, val) { - const convertedVal = utils_1.toCommandValue(val); + const convertedVal = (0, utils_1.toCommandValue)(val); process.env[name] = convertedVal; const filePath = process.env["GITHUB_ENV"] || ""; if (filePath) { - return file_command_1.issueFileCommand("ENV", file_command_1.prepareKeyValueMessage(name, val)); + return (0, file_command_1.issueFileCommand)("ENV", (0, file_command_1.prepareKeyValueMessage)(name, val)); } - command_1.issueCommand("set-env", { name }, convertedVal); + (0, command_1.issueCommand)("set-env", { name }, convertedVal); } exports2.exportVariable = exportVariable; function setSecret(secret) { - command_1.issueCommand("add-mask", {}, secret); + (0, command_1.issueCommand)("add-mask", {}, secret); } exports2.setSecret = setSecret; function addPath(inputPath) { const filePath = process.env["GITHUB_PATH"] || ""; if (filePath) { - file_command_1.issueFileCommand("PATH", inputPath); + (0, file_command_1.issueFileCommand)("PATH", inputPath); } else { - command_1.issueCommand("add-path", {}, inputPath); + (0, command_1.issueCommand)("add-path", {}, inputPath); } process.env["PATH"] = `${inputPath}${path.delimiter}${process.env["PATH"]}`; } @@ -18896,14 +19689,14 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function setOutput(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { - return file_command_1.issueFileCommand("OUTPUT", file_command_1.prepareKeyValueMessage(name, value)); + return (0, file_command_1.issueFileCommand)("OUTPUT", (0, file_command_1.prepareKeyValueMessage)(name, value)); } process.stdout.write(os.EOL); - command_1.issueCommand("set-output", { name }, utils_1.toCommandValue(value)); + (0, command_1.issueCommand)("set-output", { name }, (0, utils_1.toCommandValue)(value)); } exports2.setOutput = setOutput; function setCommandEcho(enabled) { - command_1.issue("echo", enabled ? "on" : "off"); + (0, command_1.issue)("echo", enabled ? "on" : "off"); } exports2.setCommandEcho = setCommandEcho; function setFailed(message) { @@ -18916,19 +19709,19 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.isDebug = isDebug; function debug(message) { - command_1.issueCommand("debug", {}, message); + (0, command_1.issueCommand)("debug", {}, message); } exports2.debug = debug; function error(message, properties = {}) { - command_1.issueCommand("error", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + (0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.error = error; function warning(message, properties = {}) { - command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + (0, command_1.issueCommand)("warning", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.warning = warning; function notice(message, properties = {}) { - command_1.issueCommand("notice", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); + (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.notice = notice; function info(message) { @@ -18936,11 +19729,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.info = info; function startGroup(name) { - command_1.issue("group", name); + (0, command_1.issue)("group", name); } exports2.startGroup = startGroup; function endGroup() { - command_1.issue("endgroup"); + (0, command_1.issue)("endgroup"); } exports2.endGroup = endGroup; function group(name, fn) { @@ -18959,9 +19752,9 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function saveState(name, value) { const filePath = process.env["GITHUB_STATE"] || ""; if (filePath) { - return file_command_1.issueFileCommand("STATE", file_command_1.prepareKeyValueMessage(name, value)); + return (0, file_command_1.issueFileCommand)("STATE", (0, file_command_1.prepareKeyValueMessage)(name, value)); } - command_1.issueCommand("save-state", { name }, utils_1.toCommandValue(value)); + (0, command_1.issueCommand)("save-state", { name }, (0, utils_1.toCommandValue)(value)); } exports2.saveState = saveState; function getState(name) { @@ -18992,6 +19785,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); Object.defineProperty(exports2, "toPlatformPath", { enumerable: true, get: function() { return path_utils_1.toPlatformPath; } }); + exports2.platform = __importStar(require_platform()); } }); @@ -19548,7 +20342,7 @@ var require_util8 = __commonJS({ var net = require("node:net"); var { Blob: Blob2 } = require("node:buffer"); var nodeUtil = require("node:util"); - var { stringify: stringify2 } = require("node:querystring"); + var { stringify } = require("node:querystring"); var { EventEmitter: EE } = require("node:events"); var { InvalidArgumentError } = require_errors2(); var { headerNameLowerCasedRecord } = require_constants6(); @@ -19608,7 +20402,7 @@ var require_util8 = __commonJS({ if (url.includes("?") || url.includes("#")) { throw new Error('Query params cannot be passed when url already contains "?" or "#".'); } - const stringified = stringify2(queryParams); + const stringified = stringify(queryParams); if (stringified) { url += "?" + stringified; } @@ -20076,36 +20870,36 @@ var require_diagnostics = __commonJS({ const debuglog = fetchDebuglog.enabled ? fetchDebuglog : undiciDebugLog; diagnosticsChannel.channel("undici:client:beforeConnect").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connecting to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connected").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connected to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host }, + connectParams: { version, protocol, port, host }, error } = evt; debuglog( "connection to %s using %s%s errored - %s", `${host}${port ? `:${port}` : ""}`, protocol, - version2, + version, error.message ); }); @@ -20154,31 +20948,31 @@ var require_diagnostics = __commonJS({ const debuglog = undiciDebugLog.enabled ? undiciDebugLog : websocketDebuglog; diagnosticsChannel.channel("undici:client:beforeConnect").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connecting to %s%s using %s%s", host, port ? `:${port}` : "", protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connected").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host } + connectParams: { version, protocol, port, host } } = evt; debuglog( "connected to %s%s using %s%s", host, port ? `:${port}` : "", protocol, - version2 + version ); }); diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => { const { - connectParams: { version: version2, protocol, port, host }, + connectParams: { version, protocol, port, host }, error } = evt; debuglog( @@ -20186,7 +20980,7 @@ var require_diagnostics = __commonJS({ host, port ? `:${port}` : "", protocol, - version2, + version, error.message ); }); @@ -22365,11 +23159,11 @@ var require_util9 = __commonJS({ var { isUint8Array } = require("node:util/types"); var { webidl } = require_webidl2(); var supportedHashes = []; - var crypto4; + var crypto; try { - crypto4 = require("node:crypto"); + crypto = require("node:crypto"); const possibleRelevantHashes = ["sha256", "sha384", "sha512"]; - supportedHashes = crypto4.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); } catch { } function responseURL(response) { @@ -22642,7 +23436,7 @@ var require_util9 = __commonJS({ } } function bytesMatch(bytes, metadataList) { - if (crypto4 === void 0) { + if (crypto === void 0) { return true; } const parsedMetadata = parseMetadata(metadataList); @@ -22657,7 +23451,7 @@ var require_util9 = __commonJS({ for (const item of metadata) { const algorithm = item.algo; const expectedValue = item.hash; - let actualValue = crypto4.createHash(algorithm).update(bytes).digest("base64"); + let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64"); if (actualValue[actualValue.length - 1] === "=") { if (actualValue[actualValue.length - 2] === "=") { actualValue = actualValue.slice(0, -2); @@ -26757,7 +27551,7 @@ var require_proxy_agent2 = __commonJS({ "node_modules/undici/lib/dispatcher/proxy-agent.js"(exports2, module2) { "use strict"; var { kProxy, kClose, kDestroy, kInterceptors } = require_symbols6(); - var { URL: URL3 } = require("node:url"); + var { URL: URL2 } = require("node:url"); var Agent = require_agent2(); var Pool = require_pool2(); var DispatcherBase = require_dispatcher_base2(); @@ -26778,7 +27572,7 @@ var require_proxy_agent2 = __commonJS({ var ProxyAgent2 = class extends DispatcherBase { constructor(opts) { super(); - if (!opts || typeof opts === "object" && !(opts instanceof URL3) && !opts.uri) { + if (!opts || typeof opts === "object" && !(opts instanceof URL2) && !opts.uri) { throw new InvalidArgumentError("Proxy uri is mandatory"); } const { clientFactory = defaultFactory } = opts; @@ -26853,7 +27647,7 @@ var require_proxy_agent2 = __commonJS({ const headers = buildHeaders(opts.headers); throwIfProxyAuthIsSent(headers); if (headers && !("host" in headers) && !("Host" in headers)) { - const { host } = new URL3(opts.origin); + const { host } = new URL2(opts.origin); headers.host = host; } return this[kAgent].dispatch( @@ -26870,11 +27664,11 @@ var require_proxy_agent2 = __commonJS({ */ #getUrl(opts) { if (typeof opts === "string") { - return new URL3(opts); - } else if (opts instanceof URL3) { + return new URL2(opts); + } else if (opts instanceof URL2) { return opts; } else { - return new URL3(opts.uri); + return new URL2(opts.uri); } } async [kClose]() { @@ -33800,7 +34594,7 @@ var require_util13 = __commonJS({ throw new Error("Invalid cookie max-age"); } } - function stringify2(cookie) { + function stringify(cookie) { if (cookie.name.length === 0) { return null; } @@ -33854,7 +34648,7 @@ var require_util13 = __commonJS({ validateCookiePath, validateCookieValue, toIMFDate, - stringify: stringify2 + stringify }; } }); @@ -34004,7 +34798,7 @@ var require_cookies2 = __commonJS({ "node_modules/undici/lib/web/cookies/index.js"(exports2, module2) { "use strict"; var { parseSetCookie } = require_parse2(); - var { stringify: stringify2 } = require_util13(); + var { stringify } = require_util13(); var { webidl } = require_webidl2(); var { Headers } = require_headers2(); function getCookies(headers) { @@ -34047,7 +34841,7 @@ var require_cookies2 = __commonJS({ webidl.argumentLengthCheck(arguments, 2, "setCookie"); webidl.brandCheck(headers, Headers, { strict: false }); cookie = webidl.converters.Cookie(cookie); - const str = stringify2(cookie); + const str = stringify(cookie); if (str) { headers.append("Set-Cookie", str); } @@ -34639,13 +35433,13 @@ var require_frame2 = __commonJS({ "use strict"; var { maxUnsigned16Bit } = require_constants10(); var BUFFER_SIZE = 16386; - var crypto4; + var crypto; var buffer = null; var bufIdx = BUFFER_SIZE; try { - crypto4 = require("node:crypto"); + crypto = require("node:crypto"); } catch { - crypto4 = { + crypto = { // not full compatibility, but minimum. randomFillSync: function randomFillSync(buffer2, _offset, _size) { for (let i = 0; i < buffer2.length; ++i) { @@ -34658,7 +35452,7 @@ var require_frame2 = __commonJS({ function generateMask() { if (bufIdx === BUFFER_SIZE) { bufIdx = 0; - crypto4.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE); + crypto.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE); } return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]]; } @@ -34730,9 +35524,9 @@ var require_connection2 = __commonJS({ var { Headers, getHeadersList } = require_headers2(); var { getDecodeSplit } = require_util9(); var { WebsocketFrameSend } = require_frame2(); - var crypto4; + var crypto; try { - crypto4 = require("node:crypto"); + crypto = require("node:crypto"); } catch { } function establishWebSocketConnection(url, protocols, client, ws, onEstablish, options) { @@ -34752,7 +35546,7 @@ var require_connection2 = __commonJS({ const headersList = getHeadersList(new Headers(options.headers)); request2.headersList = headersList; } - const keyValue = crypto4.randomBytes(16).toString("base64"); + const keyValue = crypto.randomBytes(16).toString("base64"); request2.headersList.append("sec-websocket-key", keyValue); request2.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { @@ -34782,7 +35576,7 @@ var require_connection2 = __commonJS({ return; } const secWSAccept = response.headersList.get("Sec-WebSocket-Accept"); - const digest = crypto4.createHash("sha1").update(keyValue + uid).digest("base64"); + const digest = crypto.createHash("sha1").update(keyValue + uid).digest("base64"); if (secWSAccept !== digest) { failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header."); return; @@ -36709,7 +37503,7 @@ function expand(template, context) { return template.replace(/\/$/, ""); } } -function parse2(options) { +function parse(options) { let method = options.method.toUpperCase(); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); let headers = Object.assign({}, options.headers); @@ -36773,7 +37567,7 @@ function parse2(options) { ); } function endpointWithDefaults(defaults, route, options) { - return parse2(merge(defaults, route, options)); + return parse(merge(defaults, route, options)); } function withDefaults(oldDefaults, newDefaults) { const DEFAULTS2 = merge(oldDefaults, newDefaults); @@ -36782,7 +37576,7 @@ function withDefaults(oldDefaults, newDefaults) { DEFAULTS: DEFAULTS2, defaults: withDefaults.bind(null, DEFAULTS2), merge: merge.bind(null, DEFAULTS2), - parse: parse2 + parse }); } var endpoint = withDefaults(null, DEFAULTS); @@ -36804,11 +37598,11 @@ var RequestError = class extends Error { response; constructor(message, statusCode, options) { super(message); - this.name = "HttpError"; - this.status = Number.parseInt(statusCode); - if (Number.isNaN(this.status)) { - this.status = 0; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); } + this.name = "HttpError"; + this.status = statusCode; if ("response" in options) { this.response = options.response; } diff --git a/package.json b/package.json index ae5f7e6..cdf37f1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "create-github-app-token", "private": true, "type": "module", - "version": "1.11.0", + "version": "1.11.1", "description": "GitHub Action for creating a GitHub App Installation Access Token", "scripts": { "build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node20.0.0 --packages=bundle",