From b26fd06e9da88a61ada55f23d7863325b1f115d3 Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Fri, 21 Feb 2025 13:05:59 -0500 Subject: [PATCH 1/2] Update to use artifact 2.2.2 package --- dist/merge/index.js | 2175 +----------------------------------------- dist/upload/index.js | 2175 +----------------------------------------- package-lock.json | 378 ++------ package.json | 4 +- 4 files changed, 95 insertions(+), 4637 deletions(-) diff --git a/dist/merge/index.js b/dist/merge/index.js index f38ff57..31792d4 100644 --- a/dist/merge/index.js +++ b/dist/merge/index.js @@ -813,7 +813,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); __exportStar(__nccwpck_require__(54622), exports); __exportStar(__nccwpck_require__(8626), exports); __exportStar(__nccwpck_require__(58178), exports); -__exportStar(__nccwpck_require__(63077), exports); +__exportStar(__nccwpck_require__(49773), exports); //# sourceMappingURL=index.js.map /***/ }), @@ -1529,23 +1529,13 @@ exports.ArtifactService = new runtime_rpc_1.ServiceType("github.actions.results. /***/ }), -/***/ 63077: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 49773: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.createArtifactServiceServer = exports.ArtifactServiceMethodList = exports.ArtifactServiceMethod = exports.ArtifactServiceClientProtobuf = exports.ArtifactServiceClientJSON = void 0; -const twirp_ts_1 = __nccwpck_require__(66465); +exports.ArtifactServiceClientProtobuf = exports.ArtifactServiceClientJSON = void 0; const artifact_1 = __nccwpck_require__(58178); class ArtifactServiceClientJSON { constructor(rpc) { @@ -1642,405 +1632,7 @@ class ArtifactServiceClientProtobuf { } } exports.ArtifactServiceClientProtobuf = ArtifactServiceClientProtobuf; -var ArtifactServiceMethod; -(function (ArtifactServiceMethod) { - ArtifactServiceMethod["CreateArtifact"] = "CreateArtifact"; - ArtifactServiceMethod["FinalizeArtifact"] = "FinalizeArtifact"; - ArtifactServiceMethod["ListArtifacts"] = "ListArtifacts"; - ArtifactServiceMethod["GetSignedArtifactURL"] = "GetSignedArtifactURL"; - ArtifactServiceMethod["DeleteArtifact"] = "DeleteArtifact"; -})(ArtifactServiceMethod || (exports.ArtifactServiceMethod = ArtifactServiceMethod = {})); -exports.ArtifactServiceMethodList = [ - ArtifactServiceMethod.CreateArtifact, - ArtifactServiceMethod.FinalizeArtifact, - ArtifactServiceMethod.ListArtifacts, - ArtifactServiceMethod.GetSignedArtifactURL, - ArtifactServiceMethod.DeleteArtifact, -]; -function createArtifactServiceServer(service) { - return new twirp_ts_1.TwirpServer({ - service, - packageName: "github.actions.results.api.v1", - serviceName: "ArtifactService", - methodList: exports.ArtifactServiceMethodList, - matchRoute: matchArtifactServiceRoute, - }); -} -exports.createArtifactServiceServer = createArtifactServiceServer; -function matchArtifactServiceRoute(method, events) { - switch (method) { - case "CreateArtifact": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "CreateArtifact" }); - yield events.onMatch(ctx); - return handleArtifactServiceCreateArtifactRequest(ctx, service, data, interceptors); - }); - case "FinalizeArtifact": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "FinalizeArtifact" }); - yield events.onMatch(ctx); - return handleArtifactServiceFinalizeArtifactRequest(ctx, service, data, interceptors); - }); - case "ListArtifacts": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "ListArtifacts" }); - yield events.onMatch(ctx); - return handleArtifactServiceListArtifactsRequest(ctx, service, data, interceptors); - }); - case "GetSignedArtifactURL": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "GetSignedArtifactURL" }); - yield events.onMatch(ctx); - return handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, interceptors); - }); - case "DeleteArtifact": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "DeleteArtifact" }); - yield events.onMatch(ctx); - return handleArtifactServiceDeleteArtifactRequest(ctx, service, data, interceptors); - }); - default: - events.onNotFound(); - const msg = `no handler found`; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceCreateArtifactRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceCreateArtifactJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceCreateArtifactProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceFinalizeArtifactRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceFinalizeArtifactJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceFinalizeArtifactProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceListArtifactsRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceListArtifactsJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceListArtifactsProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceGetSignedArtifactURLJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceGetSignedArtifactURLProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceDeleteArtifactRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceCreateArtifactJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.CreateArtifactRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.CreateArtifact(ctx, inputReq); - }); - } - else { - response = yield service.CreateArtifact(ctx, request); - } - return JSON.stringify(artifact_1.CreateArtifactResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceFinalizeArtifactJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.FinalizeArtifactRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.FinalizeArtifact(ctx, inputReq); - }); - } - else { - response = yield service.FinalizeArtifact(ctx, request); - } - return JSON.stringify(artifact_1.FinalizeArtifactResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceListArtifactsJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.ListArtifactsRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.ListArtifacts(ctx, inputReq); - }); - } - else { - response = yield service.ListArtifacts(ctx, request); - } - return JSON.stringify(artifact_1.ListArtifactsResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceGetSignedArtifactURLJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.GetSignedArtifactURLRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.GetSignedArtifactURL(ctx, inputReq); - }); - } - else { - response = yield service.GetSignedArtifactURL(ctx, request); - } - return JSON.stringify(artifact_1.GetSignedArtifactURLResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.DeleteArtifactRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.DeleteArtifact(ctx, inputReq); - }); - } - else { - response = yield service.DeleteArtifact(ctx, request); - } - return JSON.stringify(artifact_1.DeleteArtifactResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceCreateArtifactProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.CreateArtifactRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.CreateArtifact(ctx, inputReq); - }); - } - else { - response = yield service.CreateArtifact(ctx, request); - } - return Buffer.from(artifact_1.CreateArtifactResponse.toBinary(response)); - }); -} -function handleArtifactServiceFinalizeArtifactProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.FinalizeArtifactRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.FinalizeArtifact(ctx, inputReq); - }); - } - else { - response = yield service.FinalizeArtifact(ctx, request); - } - return Buffer.from(artifact_1.FinalizeArtifactResponse.toBinary(response)); - }); -} -function handleArtifactServiceListArtifactsProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.ListArtifactsRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.ListArtifacts(ctx, inputReq); - }); - } - else { - response = yield service.ListArtifacts(ctx, request); - } - return Buffer.from(artifact_1.ListArtifactsResponse.toBinary(response)); - }); -} -function handleArtifactServiceGetSignedArtifactURLProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.GetSignedArtifactURLRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.GetSignedArtifactURL(ctx, inputReq); - }); - } - else { - response = yield service.GetSignedArtifactURL(ctx, request); - } - return Buffer.from(artifact_1.GetSignedArtifactURLResponse.toBinary(response)); - }); -} -function handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.DeleteArtifactRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.DeleteArtifact(ctx, inputReq); - }); - } - else { - response = yield service.DeleteArtifact(ctx, request); - } - return Buffer.from(artifact_1.DeleteArtifactResponse.toBinary(response)); - }); -} -//# sourceMappingURL=artifact.twirp.js.map +//# sourceMappingURL=artifact.twirp-client.js.map /***/ }), @@ -3039,10 +2631,8 @@ function getGitHubWorkspaceDir() { return ghWorkspaceDir; } exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir; -// Mimics behavior of azcopy: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-optimize -// If your machine has fewer than 5 CPUs, then the value of this variable is set to 32. -// Otherwise, the default value is equal to 16 multiplied by the number of CPUs. The maximum value of this variable is 300. -// This value can be lowered with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable. +// The maximum value of concurrency is 300. +// This value can be changed with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable. function getConcurrency() { const numCPUs = os_1.default.cpus().length; let concurrencyCap = 32; @@ -3057,11 +2647,14 @@ function getConcurrency() { throw new Error('Invalid value set for ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY env variable'); } if (concurrency < concurrencyCap) { + (0, core_1.info)(`Set concurrency based on the value set in ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY.`); return concurrency; } - (0, core_1.info)(`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Lowering it to the cap.`); + (0, core_1.info)(`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Set it to the maximum value allowed.`); + return concurrencyCap; } - return concurrencyCap; + // default concurrency to 5 + return 5; } exports.getConcurrency = getConcurrency; function getUploadChunkTimeout() { @@ -54519,6 +54112,7 @@ const json_format_contract_1 = __nccwpck_require__(48139); const reflection_equals_1 = __nccwpck_require__(39473); const binary_writer_1 = __nccwpck_require__(44354); const binary_reader_1 = __nccwpck_require__(65210); +const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})); /** * This standard message type provides reflection-based * operations to work with a message. @@ -54529,7 +54123,7 @@ class MessageType { this.typeName = name; this.fields = fields.map(reflection_info_1.normalizeFieldInfo); this.options = options !== null && options !== void 0 ? options : {}; - this.messagePrototype = Object.defineProperty({}, message_type_contract_1.MESSAGE_TYPE, { value: this }); + this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [message_type_contract_1.MESSAGE_TYPE]: { value: this } })); this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this); this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this); this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this); @@ -70568,599 +70162,6 @@ class Deprecation extends Error { exports.Deprecation = Deprecation; -/***/ }), - -/***/ 13598: -/***/ ((module) => { - -"use strict"; - - -function _process (v, mod) { - var i - var r - - if (typeof mod === 'function') { - r = mod(v) - if (r !== undefined) { - v = r - } - } else if (Array.isArray(mod)) { - for (i = 0; i < mod.length; i++) { - r = mod[i](v) - if (r !== undefined) { - v = r - } - } - } - - return v -} - -function parseKey (key, val) { - // detect negative index notation - if (key[0] === '-' && Array.isArray(val) && /^-\d+$/.test(key)) { - return val.length + parseInt(key, 10) - } - return key -} - -function isIndex (k) { - return /^\d+$/.test(k) -} - -function isObject (val) { - return Object.prototype.toString.call(val) === '[object Object]' -} - -function isArrayOrObject (val) { - return Object(val) === val -} - -function isEmptyObject (val) { - return Object.keys(val).length === 0 -} - -var blacklist = ['__proto__', 'prototype', 'constructor'] -var blacklistFilter = function (part) { return blacklist.indexOf(part) === -1 } - -function parsePath (path, sep) { - if (path.indexOf('[') >= 0) { - path = path.replace(/\[/g, sep).replace(/]/g, '') - } - - var parts = path.split(sep) - - var check = parts.filter(blacklistFilter) - - if (check.length !== parts.length) { - throw Error('Refusing to update blacklisted property ' + path) - } - - return parts -} - -var hasOwnProperty = Object.prototype.hasOwnProperty - -function DotObject (separator, override, useArray, useBrackets) { - if (!(this instanceof DotObject)) { - return new DotObject(separator, override, useArray, useBrackets) - } - - if (typeof override === 'undefined') override = false - if (typeof useArray === 'undefined') useArray = true - if (typeof useBrackets === 'undefined') useBrackets = true - this.separator = separator || '.' - this.override = override - this.useArray = useArray - this.useBrackets = useBrackets - this.keepArray = false - - // contains touched arrays - this.cleanup = [] -} - -var dotDefault = new DotObject('.', false, true, true) -function wrap (method) { - return function () { - return dotDefault[method].apply(dotDefault, arguments) - } -} - -DotObject.prototype._fill = function (a, obj, v, mod) { - var k = a.shift() - - if (a.length > 0) { - obj[k] = obj[k] || (this.useArray && isIndex(a[0]) ? [] : {}) - - if (!isArrayOrObject(obj[k])) { - if (this.override) { - obj[k] = {} - } else { - if (!(isArrayOrObject(v) && isEmptyObject(v))) { - throw new Error( - 'Trying to redefine `' + k + '` which is a ' + typeof obj[k] - ) - } - - return - } - } - - this._fill(a, obj[k], v, mod) - } else { - if (!this.override && isArrayOrObject(obj[k]) && !isEmptyObject(obj[k])) { - if (!(isArrayOrObject(v) && isEmptyObject(v))) { - throw new Error("Trying to redefine non-empty obj['" + k + "']") - } - - return - } - - obj[k] = _process(v, mod) - } -} - -/** - * - * Converts an object with dotted-key/value pairs to it's expanded version - * - * Optionally transformed by a set of modifiers. - * - * Usage: - * - * var row = { - * 'nr': 200, - * 'doc.name': ' My Document ' - * } - * - * var mods = { - * 'doc.name': [_s.trim, _s.underscored] - * } - * - * dot.object(row, mods) - * - * @param {Object} obj - * @param {Object} mods - */ -DotObject.prototype.object = function (obj, mods) { - var self = this - - Object.keys(obj).forEach(function (k) { - var mod = mods === undefined ? null : mods[k] - // normalize array notation. - var ok = parsePath(k, self.separator).join(self.separator) - - if (ok.indexOf(self.separator) !== -1) { - self._fill(ok.split(self.separator), obj, obj[k], mod) - delete obj[k] - } else { - obj[k] = _process(obj[k], mod) - } - }) - - return obj -} - -/** - * @param {String} path dotted path - * @param {String} v value to be set - * @param {Object} obj object to be modified - * @param {Function|Array} mod optional modifier - */ -DotObject.prototype.str = function (path, v, obj, mod) { - var ok = parsePath(path, this.separator).join(this.separator) - - if (path.indexOf(this.separator) !== -1) { - this._fill(ok.split(this.separator), obj, v, mod) - } else { - obj[path] = _process(v, mod) - } - - return obj -} - -/** - * - * Pick a value from an object using dot notation. - * - * Optionally remove the value - * - * @param {String} path - * @param {Object} obj - * @param {Boolean} remove - */ -DotObject.prototype.pick = function (path, obj, remove, reindexArray) { - var i - var keys - var val - var key - var cp - - keys = parsePath(path, this.separator) - for (i = 0; i < keys.length; i++) { - key = parseKey(keys[i], obj) - if (obj && typeof obj === 'object' && key in obj) { - if (i === keys.length - 1) { - if (remove) { - val = obj[key] - if (reindexArray && Array.isArray(obj)) { - obj.splice(key, 1) - } else { - delete obj[key] - } - if (Array.isArray(obj)) { - cp = keys.slice(0, -1).join('.') - if (this.cleanup.indexOf(cp) === -1) { - this.cleanup.push(cp) - } - } - return val - } else { - return obj[key] - } - } else { - obj = obj[key] - } - } else { - return undefined - } - } - if (remove && Array.isArray(obj)) { - obj = obj.filter(function (n) { - return n !== undefined - }) - } - return obj -} -/** - * - * Delete value from an object using dot notation. - * - * @param {String} path - * @param {Object} obj - * @return {any} The removed value - */ -DotObject.prototype.delete = function (path, obj) { - return this.remove(path, obj, true) -} - -/** - * - * Remove value from an object using dot notation. - * - * Will remove multiple items if path is an array. - * In this case array indexes will be retained until all - * removals have been processed. - * - * Use dot.delete() to automatically re-index arrays. - * - * @param {String|Array} path - * @param {Object} obj - * @param {Boolean} reindexArray - * @return {any} The removed value - */ -DotObject.prototype.remove = function (path, obj, reindexArray) { - var i - - this.cleanup = [] - if (Array.isArray(path)) { - for (i = 0; i < path.length; i++) { - this.pick(path[i], obj, true, reindexArray) - } - if (!reindexArray) { - this._cleanup(obj) - } - return obj - } else { - return this.pick(path, obj, true, reindexArray) - } -} - -DotObject.prototype._cleanup = function (obj) { - var ret - var i - var keys - var root - if (this.cleanup.length) { - for (i = 0; i < this.cleanup.length; i++) { - keys = this.cleanup[i].split('.') - root = keys.splice(0, -1).join('.') - ret = root ? this.pick(root, obj) : obj - ret = ret[keys[0]].filter(function (v) { - return v !== undefined - }) - this.set(this.cleanup[i], ret, obj) - } - this.cleanup = [] - } -} - -/** - * Alias method for `dot.remove` - * - * Note: this is not an alias for dot.delete() - * - * @param {String|Array} path - * @param {Object} obj - * @param {Boolean} reindexArray - * @return {any} The removed value - */ -DotObject.prototype.del = DotObject.prototype.remove - -/** - * - * Move a property from one place to the other. - * - * If the source path does not exist (undefined) - * the target property will not be set. - * - * @param {String} source - * @param {String} target - * @param {Object} obj - * @param {Function|Array} mods - * @param {Boolean} merge - */ -DotObject.prototype.move = function (source, target, obj, mods, merge) { - if (typeof mods === 'function' || Array.isArray(mods)) { - this.set(target, _process(this.pick(source, obj, true), mods), obj, merge) - } else { - merge = mods - this.set(target, this.pick(source, obj, true), obj, merge) - } - - return obj -} - -/** - * - * Transfer a property from one object to another object. - * - * If the source path does not exist (undefined) - * the property on the other object will not be set. - * - * @param {String} source - * @param {String} target - * @param {Object} obj1 - * @param {Object} obj2 - * @param {Function|Array} mods - * @param {Boolean} merge - */ -DotObject.prototype.transfer = function ( - source, - target, - obj1, - obj2, - mods, - merge -) { - if (typeof mods === 'function' || Array.isArray(mods)) { - this.set( - target, - _process(this.pick(source, obj1, true), mods), - obj2, - merge - ) - } else { - merge = mods - this.set(target, this.pick(source, obj1, true), obj2, merge) - } - - return obj2 -} - -/** - * - * Copy a property from one object to another object. - * - * If the source path does not exist (undefined) - * the property on the other object will not be set. - * - * @param {String} source - * @param {String} target - * @param {Object} obj1 - * @param {Object} obj2 - * @param {Function|Array} mods - * @param {Boolean} merge - */ -DotObject.prototype.copy = function (source, target, obj1, obj2, mods, merge) { - if (typeof mods === 'function' || Array.isArray(mods)) { - this.set( - target, - _process( - // clone what is picked - JSON.parse(JSON.stringify(this.pick(source, obj1, false))), - mods - ), - obj2, - merge - ) - } else { - merge = mods - this.set(target, this.pick(source, obj1, false), obj2, merge) - } - - return obj2 -} - -/** - * - * Set a property on an object using dot notation. - * - * @param {String} path - * @param {any} val - * @param {Object} obj - * @param {Boolean} merge - */ -DotObject.prototype.set = function (path, val, obj, merge) { - var i - var k - var keys - var key - - // Do not operate if the value is undefined. - if (typeof val === 'undefined') { - return obj - } - keys = parsePath(path, this.separator) - - for (i = 0; i < keys.length; i++) { - key = keys[i] - if (i === keys.length - 1) { - if (merge && isObject(val) && isObject(obj[key])) { - for (k in val) { - if (hasOwnProperty.call(val, k)) { - obj[key][k] = val[k] - } - } - } else if (merge && Array.isArray(obj[key]) && Array.isArray(val)) { - for (var j = 0; j < val.length; j++) { - obj[keys[i]].push(val[j]) - } - } else { - obj[key] = val - } - } else if ( - // force the value to be an object - !hasOwnProperty.call(obj, key) || - (!isObject(obj[key]) && !Array.isArray(obj[key])) - ) { - // initialize as array if next key is numeric - if (/^\d+$/.test(keys[i + 1])) { - obj[key] = [] - } else { - obj[key] = {} - } - } - obj = obj[key] - } - return obj -} - -/** - * - * Transform an object - * - * Usage: - * - * var obj = { - * "id": 1, - * "some": { - * "thing": "else" - * } - * } - * - * var transform = { - * "id": "nr", - * "some.thing": "name" - * } - * - * var tgt = dot.transform(transform, obj) - * - * @param {Object} recipe Transform recipe - * @param {Object} obj Object to be transformed - * @param {Array} mods modifiers for the target - */ -DotObject.prototype.transform = function (recipe, obj, tgt) { - obj = obj || {} - tgt = tgt || {} - Object.keys(recipe).forEach( - function (key) { - this.set(recipe[key], this.pick(key, obj), tgt) - }.bind(this) - ) - return tgt -} - -/** - * - * Convert object to dotted-key/value pair - * - * Usage: - * - * var tgt = dot.dot(obj) - * - * or - * - * var tgt = {} - * dot.dot(obj, tgt) - * - * @param {Object} obj source object - * @param {Object} tgt target object - * @param {Array} path path array (internal) - */ -DotObject.prototype.dot = function (obj, tgt, path) { - tgt = tgt || {} - path = path || [] - var isArray = Array.isArray(obj) - - Object.keys(obj).forEach( - function (key) { - var index = isArray && this.useBrackets ? '[' + key + ']' : key - if ( - isArrayOrObject(obj[key]) && - ((isObject(obj[key]) && !isEmptyObject(obj[key])) || - (Array.isArray(obj[key]) && !this.keepArray && obj[key].length !== 0)) - ) { - if (isArray && this.useBrackets) { - var previousKey = path[path.length - 1] || '' - return this.dot( - obj[key], - tgt, - path.slice(0, -1).concat(previousKey + index) - ) - } else { - return this.dot(obj[key], tgt, path.concat(index)) - } - } else { - if (isArray && this.useBrackets) { - tgt[path.join(this.separator).concat('[' + key + ']')] = obj[key] - } else { - tgt[path.concat(index).join(this.separator)] = obj[key] - } - } - }.bind(this) - ) - return tgt -} - -DotObject.pick = wrap('pick') -DotObject.move = wrap('move') -DotObject.transfer = wrap('transfer') -DotObject.transform = wrap('transform') -DotObject.copy = wrap('copy') -DotObject.object = wrap('object') -DotObject.str = wrap('str') -DotObject.set = wrap('set') -DotObject.delete = wrap('delete') -DotObject.del = DotObject.remove = wrap('remove') -DotObject.dot = wrap('dot'); -['override', 'overwrite'].forEach(function (prop) { - Object.defineProperty(DotObject, prop, { - get: function () { - return dotDefault.override - }, - set: function (val) { - dotDefault.override = !!val - } - }) -}); -['useArray', 'keepArray', 'useBrackets'].forEach(function (prop) { - Object.defineProperty(DotObject, prop, { - get: function () { - return dotDefault[prop] - }, - set: function (val) { - dotDefault[prop] = val - } - }) -}) - -DotObject._process = _process - -module.exports = DotObject - - /***/ }), /***/ 84697: @@ -94928,1152 +93929,6 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { exports.debug = debug; // for test -/***/ }), - -/***/ 31524: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); - - -/***/ }), - -/***/ 66647: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isValidErrorCode = exports.httpStatusFromErrorCode = exports.TwirpErrorCode = exports.BadRouteError = exports.InternalServerErrorWith = exports.InternalServerError = exports.RequiredArgumentError = exports.InvalidArgumentError = exports.NotFoundError = exports.TwirpError = void 0; -/** - * Represents a twirp error - */ -class TwirpError extends Error { - constructor(code, msg) { - super(msg); - this.code = TwirpErrorCode.Internal; - this.meta = {}; - this.code = code; - this.msg = msg; - Object.setPrototypeOf(this, TwirpError.prototype); - } - /** - * Adds a metadata kv to the error - * @param key - * @param value - */ - withMeta(key, value) { - this.meta[key] = value; - return this; - } - /** - * Returns a single metadata value - * return "" if not found - * @param key - */ - getMeta(key) { - return this.meta[key] || ""; - } - /** - * Add the original error cause - * @param err - * @param addMeta - */ - withCause(err, addMeta = false) { - this._originalCause = err; - if (addMeta) { - this.withMeta("cause", err.message); - } - return this; - } - cause() { - return this._originalCause; - } - /** - * Returns the error representation to JSON - */ - toJSON() { - try { - return JSON.stringify({ - code: this.code, - msg: this.msg, - meta: this.meta, - }); - } - catch (e) { - return `{"code": "internal", "msg": "There was an error but it could not be serialized into JSON"}`; - } - } - /** - * Create a twirp error from an object - * @param obj - */ - static fromObject(obj) { - const code = obj["code"] || TwirpErrorCode.Unknown; - const msg = obj["msg"] || "unknown"; - const error = new TwirpError(code, msg); - if (obj["meta"]) { - Object.keys(obj["meta"]).forEach((key) => { - error.withMeta(key, obj["meta"][key]); - }); - } - return error; - } -} -exports.TwirpError = TwirpError; -/** - * NotFoundError constructor for the common NotFound error. - */ -class NotFoundError extends TwirpError { - constructor(msg) { - super(TwirpErrorCode.NotFound, msg); - } -} -exports.NotFoundError = NotFoundError; -/** - * InvalidArgumentError constructor for the common InvalidArgument error. Can be - * used when an argument has invalid format, is a number out of range, is a bad - * option, etc). - */ -class InvalidArgumentError extends TwirpError { - constructor(argument, validationMsg) { - super(TwirpErrorCode.InvalidArgument, argument + " " + validationMsg); - this.withMeta("argument", argument); - } -} -exports.InvalidArgumentError = InvalidArgumentError; -/** - * RequiredArgumentError is a more specific constructor for InvalidArgument - * error. Should be used when the argument is required (expected to have a - * non-zero value). - */ -class RequiredArgumentError extends InvalidArgumentError { - constructor(argument) { - super(argument, "is required"); - } -} -exports.RequiredArgumentError = RequiredArgumentError; -/** - * InternalError constructor for the common Internal error. Should be used to - * specify that something bad or unexpected happened. - */ -class InternalServerError extends TwirpError { - constructor(msg) { - super(TwirpErrorCode.Internal, msg); - } -} -exports.InternalServerError = InternalServerError; -/** - * InternalErrorWith makes an internal error, wrapping the original error and using it - * for the error message, and with metadata "cause" with the original error type. - * This function is used by Twirp services to wrap non-Twirp errors as internal errors. - * The wrapped error can be extracted later with err.cause() - */ -class InternalServerErrorWith extends InternalServerError { - constructor(err) { - super(err.message); - this.withMeta("cause", err.name); - this.withCause(err); - } -} -exports.InternalServerErrorWith = InternalServerErrorWith; -/** - * A standard BadRoute Error - */ -class BadRouteError extends TwirpError { - constructor(msg, method, url) { - super(TwirpErrorCode.BadRoute, msg); - this.withMeta("twirp_invalid_route", method + " " + url); - } -} -exports.BadRouteError = BadRouteError; -var TwirpErrorCode; -(function (TwirpErrorCode) { - // Canceled indicates the operation was cancelled (typically by the caller). - TwirpErrorCode["Canceled"] = "canceled"; - // Unknown error. For example when handling errors raised by APIs that do not - // return enough error information. - TwirpErrorCode["Unknown"] = "unknown"; - // InvalidArgument indicates client specified an invalid argument. It - // indicates arguments that are problematic regardless of the state of the - // system (i.e. a malformed file name, required argument, number out of range, - // etc.). - TwirpErrorCode["InvalidArgument"] = "invalid_argument"; - // Malformed indicates an error occurred while decoding the client's request. - // This may mean that the message was encoded improperly, or that there is a - // disagreement in message format between the client and server. - TwirpErrorCode["Malformed"] = "malformed"; - // DeadlineExceeded means operation expired before completion. For operations - // that change the state of the system, this error may be returned even if the - // operation has completed successfully (timeout). - TwirpErrorCode["DeadlineExceeded"] = "deadline_exceeded"; - // NotFound means some requested entity was not found. - TwirpErrorCode["NotFound"] = "not_found"; - // BadRoute means that the requested URL path wasn't routable to a Twirp - // service and method. This is returned by the generated server, and usually - // shouldn't be returned by applications. Instead, applications should use - // NotFound or Unimplemented. - TwirpErrorCode["BadRoute"] = "bad_route"; - // AlreadyExists means an attempt to create an entity failed because one - // already exists. - TwirpErrorCode["AlreadyExists"] = "already_exists"; - // PermissionDenied indicates the caller does not have permission to execute - // the specified operation. It must not be used if the caller cannot be - // identified (Unauthenticated). - TwirpErrorCode["PermissionDenied"] = "permission_denied"; - // Unauthenticated indicates the request does not have valid authentication - // credentials for the operation. - TwirpErrorCode["Unauthenticated"] = "unauthenticated"; - // ResourceExhausted indicates some resource has been exhausted, perhaps a - // per-user quota, or perhaps the entire file system is out of space. - TwirpErrorCode["ResourceExhausted"] = "resource_exhausted"; - // FailedPrecondition indicates operation was rejected because the system is - // not in a state required for the operation's execution. For example, doing - // an rmdir operation on a directory that is non-empty, or on a non-directory - // object, or when having conflicting read-modify-write on the same resource. - TwirpErrorCode["FailedPrecondition"] = "failed_precondition"; - // Aborted indicates the operation was aborted, typically due to a concurrency - // issue like sequencer check failures, transaction aborts, etc. - TwirpErrorCode["Aborted"] = "aborted"; - // OutOfRange means operation was attempted past the valid range. For example, - // seeking or reading past end of a paginated collection. - // - // Unlike InvalidArgument, this error indicates a problem that may be fixed if - // the system state changes (i.e. adding more items to the collection). - // - // There is a fair bit of overlap between FailedPrecondition and OutOfRange. - // We recommend using OutOfRange (the more specific error) when it applies so - // that callers who are iterating through a space can easily look for an - // OutOfRange error to detect when they are done. - TwirpErrorCode["OutOfRange"] = "out_of_range"; - // Unimplemented indicates operation is not implemented or not - // supported/enabled in this service. - TwirpErrorCode["Unimplemented"] = "unimplemented"; - // Internal errors. When some invariants expected by the underlying system - // have been broken. In other words, something bad happened in the library or - // backend service. Do not confuse with HTTP Internal Server Error; an - // Internal error could also happen on the client code, i.e. when parsing a - // server response. - TwirpErrorCode["Internal"] = "internal"; - // Unavailable indicates the service is currently unavailable. This is a most - // likely a transient condition and may be corrected by retrying with a - // backoff. - TwirpErrorCode["Unavailable"] = "unavailable"; - // DataLoss indicates unrecoverable data loss or corruption. - TwirpErrorCode["DataLoss"] = "data_loss"; -})(TwirpErrorCode = exports.TwirpErrorCode || (exports.TwirpErrorCode = {})); -// ServerHTTPStatusFromErrorCode maps a Twirp error type into a similar HTTP -// response status. It is used by the Twirp server handler to set the HTTP -// response status code. Returns 0 if the ErrorCode is invalid. -function httpStatusFromErrorCode(code) { - switch (code) { - case TwirpErrorCode.Canceled: - return 408; // RequestTimeout - case TwirpErrorCode.Unknown: - return 500; // Internal Server Error - case TwirpErrorCode.InvalidArgument: - return 400; // BadRequest - case TwirpErrorCode.Malformed: - return 400; // BadRequest - case TwirpErrorCode.DeadlineExceeded: - return 408; // RequestTimeout - case TwirpErrorCode.NotFound: - return 404; // Not Found - case TwirpErrorCode.BadRoute: - return 404; // Not Found - case TwirpErrorCode.AlreadyExists: - return 409; // Conflict - case TwirpErrorCode.PermissionDenied: - return 403; // Forbidden - case TwirpErrorCode.Unauthenticated: - return 401; // Unauthorized - case TwirpErrorCode.ResourceExhausted: - return 429; // Too Many Requests - case TwirpErrorCode.FailedPrecondition: - return 412; // Precondition Failed - case TwirpErrorCode.Aborted: - return 409; // Conflict - case TwirpErrorCode.OutOfRange: - return 400; // Bad Request - case TwirpErrorCode.Unimplemented: - return 501; // Not Implemented - case TwirpErrorCode.Internal: - return 500; // Internal Server Error - case TwirpErrorCode.Unavailable: - return 503; // Service Unavailable - case TwirpErrorCode.DataLoss: - return 500; // Internal Server Error - default: - return 0; // Invalid! - } -} -exports.httpStatusFromErrorCode = httpStatusFromErrorCode; -// IsValidErrorCode returns true if is one of the valid predefined constants. -function isValidErrorCode(code) { - return httpStatusFromErrorCode(code) != 0; -} -exports.isValidErrorCode = isValidErrorCode; - - -/***/ }), - -/***/ 56748: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__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 = (this && this.__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 __rest = (this && this.__rest) || function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Gateway = exports.Pattern = void 0; -const querystring_1 = __nccwpck_require__(63477); -const dotObject = __importStar(__nccwpck_require__(13598)); -const request_1 = __nccwpck_require__(8347); -const errors_1 = __nccwpck_require__(66647); -const http_client_1 = __nccwpck_require__(94091); -const server_1 = __nccwpck_require__(26604); -var Pattern; -(function (Pattern) { - Pattern["POST"] = "post"; - Pattern["GET"] = "get"; - Pattern["PATCH"] = "patch"; - Pattern["PUT"] = "put"; - Pattern["DELETE"] = "delete"; -})(Pattern = exports.Pattern || (exports.Pattern = {})); -/** - * The Gateway proxies http requests to Twirp Compliant - * handlers - */ -class Gateway { - constructor(routes) { - this.routes = routes; - } - /** - * Middleware that rewrite the current request - * to a Twirp compliant request - */ - twirpRewrite(prefix = "/twirp") { - return (req, resp, next) => { - this.rewrite(req, resp, prefix) - .then(() => next()) - .catch((e) => { - if (e instanceof errors_1.TwirpError) { - if (e.code !== errors_1.TwirpErrorCode.NotFound) { - server_1.writeError(resp, e); - } - else { - next(); - } - } - }); - }; - } - /** - * Rewrite an incoming request to a Twirp compliant request - * @param req - * @param resp - * @param prefix - */ - rewrite(req, resp, prefix = "/twirp") { - return __awaiter(this, void 0, void 0, function* () { - const [match, route] = this.matchRoute(req); - const body = yield this.prepareTwirpBody(req, match, route); - const twirpUrl = `${prefix}/${route.packageName}.${route.serviceName}/${route.methodName}`; - req.url = twirpUrl; - req.originalUrl = twirpUrl; - req.method = "POST"; - req.headers["content-type"] = "application/json"; - req.rawBody = Buffer.from(JSON.stringify(body)); - if (route.responseBodyKey) { - const endFn = resp.end.bind(resp); - resp.end = function (chunk) { - if (resp.statusCode === 200) { - endFn(`{ "${route.responseBodyKey}": ${chunk} }`); - } - else { - endFn(chunk); - } - }; - } - }); - } - /** - * Create a reverse proxy handler to - * proxy http requests to Twirp Compliant handlers - * @param httpClientOption - */ - reverseProxy(httpClientOption) { - const client = http_client_1.NodeHttpRPC(httpClientOption); - return (req, res) => __awaiter(this, void 0, void 0, function* () { - try { - const [match, route] = this.matchRoute(req); - const body = yield this.prepareTwirpBody(req, match, route); - const response = yield client.request(`${route.packageName}.${route.serviceName}`, route.methodName, "application/json", body); - res.statusCode = 200; - res.setHeader("content-type", "application/json"); - let jsonResponse; - if (route.responseBodyKey) { - jsonResponse = JSON.stringify({ [route.responseBodyKey]: response }); - } - else { - jsonResponse = JSON.stringify(response); - } - res.end(jsonResponse); - } - catch (e) { - server_1.writeError(res, e); - } - }); - } - /** - * Prepares twirp body requests using http.google.annotions - * compliant spec - * - * @param req - * @param match - * @param route - * @protected - */ - prepareTwirpBody(req, match, route) { - return __awaiter(this, void 0, void 0, function* () { - const _a = match.params, { query_string } = _a, params = __rest(_a, ["query_string"]); - let requestBody = Object.assign({}, params); - if (query_string && route.bodyKey !== "*") { - const queryParams = this.parseQueryString(query_string); - requestBody = Object.assign(Object.assign({}, queryParams), requestBody); - } - let body = {}; - if (route.bodyKey) { - const data = yield request_1.getRequestData(req); - try { - const jsonBody = JSON.parse(data.toString() || "{}"); - if (route.bodyKey === "*") { - body = jsonBody; - } - else { - body[route.bodyKey] = jsonBody; - } - } - catch (e) { - const msg = "the json request could not be decoded"; - throw new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - return Object.assign(Object.assign({}, body), requestBody); - }); - } - /** - * Matches a route - * @param req - */ - matchRoute(req) { - var _a; - const httpMethod = (_a = req.method) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - if (!httpMethod) { - throw new errors_1.BadRouteError(`method not allowed`, req.method || "", req.url || ""); - } - const routes = this.routes[httpMethod]; - for (const route of routes) { - const match = route.matcher(req.url || "/"); - if (match) { - return [match, route]; - } - } - throw new errors_1.NotFoundError(`url ${req.url} not found`); - } - /** - * Parse query string - * @param queryString - */ - parseQueryString(queryString) { - const queryParams = querystring_1.parse(queryString.replace("?", "")); - return dotObject.object(queryParams); - } -} -exports.Gateway = Gateway; - - -/***/ }), - -/***/ 4263: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.isHook = exports.chainHooks = void 0; -// ChainHooks creates a new ServerHook which chains the callbacks in -// each of the constituent hooks passed in. Each hook function will be -// called in the order of the ServerHooks values passed in. -// -// For the erroring hooks, RequestReceived and RequestRouted, any returned -// errors prevent processing by later hooks. -function chainHooks(...hooks) { - if (hooks.length === 0) { - return null; - } - if (hooks.length === 1) { - return hooks[0]; - } - const serverHook = { - requestReceived(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestReceived) { - continue; - } - yield hook.requestReceived(ctx); - } - }); - }, - requestPrepared(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestPrepared) { - continue; - } - console.warn("hook requestPrepared is deprecated and will be removed in the next release. " + - "Please use responsePrepared instead."); - yield hook.requestPrepared(ctx); - } - }); - }, - responsePrepared(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.responsePrepared) { - continue; - } - yield hook.responsePrepared(ctx); - } - }); - }, - requestSent(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestSent) { - continue; - } - console.warn("hook requestSent is deprecated and will be removed in the next release. " + - "Please use responseSent instead."); - yield hook.requestSent(ctx); - } - }); - }, - responseSent(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.responseSent) { - continue; - } - yield hook.responseSent(ctx); - } - }); - }, - requestRouted(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestRouted) { - continue; - } - yield hook.requestRouted(ctx); - } - }); - }, - error(ctx, err) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.error) { - continue; - } - yield hook.error(ctx, err); - } - }); - }, - }; - return serverHook; -} -exports.chainHooks = chainHooks; -function isHook(object) { - return ("requestReceived" in object || - "requestPrepared" in object || - "requestSent" in object || - "requestRouted" in object || - "responsePrepared" in object || - "responseSent" in object || - "error" in object); -} -exports.isHook = isHook; - - -/***/ }), - -/***/ 94091: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__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 = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.FetchRPC = exports.wrapErrorResponseToTwirpError = exports.NodeHttpRPC = void 0; -const http = __importStar(__nccwpck_require__(13685)); -const https = __importStar(__nccwpck_require__(95687)); -const url_1 = __nccwpck_require__(57310); -const errors_1 = __nccwpck_require__(66647); -/** - * a node HTTP RPC implementation - * @param options - * @constructor - */ -const NodeHttpRPC = (options) => ({ - request(service, method, contentType, data) { - let client; - return new Promise((resolve, rejected) => { - const responseChunks = []; - const requestData = contentType === "application/protobuf" - ? Buffer.from(data) - : JSON.stringify(data); - const url = new url_1.URL(options.baseUrl); - const isHttps = url.protocol === "https:"; - if (isHttps) { - client = https; - } - else { - client = http; - } - const prefix = url.pathname !== "/" ? url.pathname : ""; - const req = client - .request(Object.assign(Object.assign({}, (options ? options : {})), { method: "POST", protocol: url.protocol, host: url.hostname, port: url.port ? url.port : isHttps ? 443 : 80, path: `${prefix}/${service}/${method}`, headers: Object.assign(Object.assign({}, (options.headers ? options.headers : {})), { "Content-Type": contentType, "Content-Length": contentType === "application/protobuf" - ? Buffer.byteLength(requestData) - : Buffer.from(requestData).byteLength }) }), (res) => { - res.on("data", (chunk) => responseChunks.push(chunk)); - res.on("end", () => { - const data = Buffer.concat(responseChunks); - if (res.statusCode != 200) { - rejected(wrapErrorResponseToTwirpError(data.toString())); - } - else { - if (contentType === "application/json") { - resolve(JSON.parse(data.toString())); - } - else { - resolve(data); - } - } - }); - res.on("error", (err) => { - rejected(err); - }); - }) - .on("error", (err) => { - rejected(err); - }); - req.end(requestData); - }); - }, -}); -exports.NodeHttpRPC = NodeHttpRPC; -function wrapErrorResponseToTwirpError(errorResponse) { - return errors_1.TwirpError.fromObject(JSON.parse(errorResponse)); -} -exports.wrapErrorResponseToTwirpError = wrapErrorResponseToTwirpError; -/** - * a browser fetch RPC implementation - */ -const FetchRPC = (options) => ({ - request(service, method, contentType, data) { - return __awaiter(this, void 0, void 0, function* () { - const headers = new Headers(options.headers); - headers.set("content-type", contentType); - const response = yield fetch(`${options.baseUrl}/${service}/${method}`, Object.assign(Object.assign({}, options), { method: "POST", headers, body: data instanceof Uint8Array ? data : JSON.stringify(data) })); - if (response.status === 200) { - if (contentType === "application/json") { - return yield response.json(); - } - return new Uint8Array(yield response.arrayBuffer()); - } - throw errors_1.TwirpError.fromObject(yield response.json()); - }); - }, -}); -exports.FetchRPC = FetchRPC; - - -/***/ }), - -/***/ 66465: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TwirpContentType = void 0; -__exportStar(__nccwpck_require__(31524), exports); -__exportStar(__nccwpck_require__(26604), exports); -__exportStar(__nccwpck_require__(48913), exports); -__exportStar(__nccwpck_require__(4263), exports); -__exportStar(__nccwpck_require__(66647), exports); -__exportStar(__nccwpck_require__(56748), exports); -__exportStar(__nccwpck_require__(94091), exports); -var request_1 = __nccwpck_require__(8347); -Object.defineProperty(exports, "TwirpContentType", ({ enumerable: true, get: function () { return request_1.TwirpContentType; } })); - - -/***/ }), - -/***/ 48913: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.chainInterceptors = void 0; -// chains multiple Interceptors into a single Interceptor. -// The first interceptor wraps the second one, and so on. -// Returns null if interceptors is empty. -function chainInterceptors(...interceptors) { - if (interceptors.length === 0) { - return; - } - if (interceptors.length === 1) { - return interceptors[0]; - } - const first = interceptors[0]; - return (ctx, request, handler) => __awaiter(this, void 0, void 0, function* () { - let next = handler; - for (let i = interceptors.length - 1; i > 0; i--) { - next = ((next) => (ctx, typedRequest) => { - return interceptors[i](ctx, typedRequest, next); - })(next); - } - return first(ctx, request, next); - }); -} -exports.chainInterceptors = chainInterceptors; - - -/***/ }), - -/***/ 8347: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.parseTwirpPath = exports.getRequestData = exports.validateRequest = exports.getContentType = exports.TwirpContentType = void 0; -const errors_1 = __nccwpck_require__(66647); -/** - * Supported Twirp Content-Type - */ -var TwirpContentType; -(function (TwirpContentType) { - TwirpContentType[TwirpContentType["Protobuf"] = 0] = "Protobuf"; - TwirpContentType[TwirpContentType["JSON"] = 1] = "JSON"; - TwirpContentType[TwirpContentType["Unknown"] = 2] = "Unknown"; -})(TwirpContentType = exports.TwirpContentType || (exports.TwirpContentType = {})); -/** - * Get supported content-type - * @param mimeType - */ -function getContentType(mimeType) { - switch (mimeType) { - case "application/protobuf": - return TwirpContentType.Protobuf; - case "application/json": - return TwirpContentType.JSON; - default: - return TwirpContentType.Unknown; - } -} -exports.getContentType = getContentType; -/** - * Validate a twirp request - * @param ctx - * @param request - * @param pathPrefix - */ -function validateRequest(ctx, request, pathPrefix) { - if (request.method !== "POST") { - const msg = `unsupported method ${request.method} (only POST is allowed)`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - const path = parseTwirpPath(request.url || ""); - if (path.pkgService !== - (ctx.packageName ? ctx.packageName + "." : "") + ctx.serviceName) { - const msg = `no handler for path ${request.url}`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - if (path.prefix !== pathPrefix) { - const msg = `invalid path prefix ${path.prefix}, expected ${pathPrefix}, on path ${request.url}`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - const mimeContentType = request.headers["content-type"] || ""; - if (ctx.contentType === TwirpContentType.Unknown) { - const msg = `unexpected Content-Type: ${request.headers["content-type"]}`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - return Object.assign(Object.assign({}, path), { mimeContentType, contentType: ctx.contentType }); -} -exports.validateRequest = validateRequest; -/** - * Get request data from the body - * @param req - */ -function getRequestData(req) { - return new Promise((resolve, reject) => { - const reqWithRawBody = req; - if (reqWithRawBody.rawBody instanceof Buffer) { - resolve(reqWithRawBody.rawBody); - return; - } - const chunks = []; - req.on("data", (chunk) => chunks.push(chunk)); - req.on("end", () => __awaiter(this, void 0, void 0, function* () { - const data = Buffer.concat(chunks); - resolve(data); - })); - req.on("error", (err) => { - if (req.aborted) { - reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.DeadlineExceeded, "failed to read request: deadline exceeded")); - } - else { - reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, err.message).withCause(err)); - } - }); - req.on("close", () => { - reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Canceled, "failed to read request: context canceled")); - }); - }); -} -exports.getRequestData = getRequestData; -/** - * Parses twirp url path - * @param path - */ -function parseTwirpPath(path) { - const parts = path.split("/"); - if (parts.length < 2) { - return { - pkgService: "", - method: "", - prefix: "", - }; - } - return { - method: parts[parts.length - 1], - pkgService: parts[parts.length - 2], - prefix: parts.slice(0, parts.length - 2).join("/"), - }; -} -exports.parseTwirpPath = parseTwirpPath; - - -/***/ }), - -/***/ 26604: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.writeError = exports.TwirpServer = void 0; -const hooks_1 = __nccwpck_require__(4263); -const request_1 = __nccwpck_require__(8347); -const errors_1 = __nccwpck_require__(66647); -/** - * Runtime server implementation of a TwirpServer - */ -class TwirpServer { - constructor(options) { - this.pathPrefix = "/twirp"; - this.hooks = []; - this.interceptors = []; - this.packageName = options.packageName; - this.serviceName = options.serviceName; - this.methodList = options.methodList; - this.matchRoute = options.matchRoute; - this.service = options.service; - } - /** - * Returns the prefix for this server - */ - get prefix() { - return this.pathPrefix; - } - /** - * The http handler for twirp complaint endpoints - * @param options - */ - httpHandler(options) { - return (req, resp) => { - // setup prefix - if ((options === null || options === void 0 ? void 0 : options.prefix) !== undefined) { - this.withPrefix(options.prefix); - } - return this._httpHandler(req, resp); - }; - } - /** - * Adds interceptors or hooks to the request stack - * @param middlewares - */ - use(...middlewares) { - middlewares.forEach((middleware) => { - if (hooks_1.isHook(middleware)) { - this.hooks.push(middleware); - return this; - } - this.interceptors.push(middleware); - }); - return this; - } - /** - * Adds a prefix to the service url path - * @param prefix - */ - withPrefix(prefix) { - if (prefix === false) { - this.pathPrefix = ""; - } - else { - this.pathPrefix = prefix; - } - return this; - } - /** - * Returns the regex matching path for this twirp server - */ - matchingPath() { - const baseRegex = this.baseURI().replace(/\./g, "\\."); - return new RegExp(`${baseRegex}\/(${this.methodList.join("|")})`); - } - /** - * Returns the base URI for this twirp server - */ - baseURI() { - return `${this.pathPrefix}/${this.packageName ? this.packageName + "." : ""}${this.serviceName}`; - } - /** - * Create a twirp context - * @param req - * @param res - * @private - */ - createContext(req, res) { - return { - packageName: this.packageName, - serviceName: this.serviceName, - methodName: "", - contentType: request_1.getContentType(req.headers["content-type"]), - req: req, - res: res, - }; - } - /** - * Twrip server http handler implementation - * @param req - * @param resp - * @private - */ - _httpHandler(req, resp) { - return __awaiter(this, void 0, void 0, function* () { - const ctx = this.createContext(req, resp); - try { - yield this.invokeHook("requestReceived", ctx); - const { method, mimeContentType } = request_1.validateRequest(ctx, req, this.pathPrefix || ""); - const handler = this.matchRoute(method, { - onMatch: (ctx) => { - return this.invokeHook("requestRouted", ctx); - }, - onNotFound: () => { - const msg = `no handler for path ${req.url}`; - throw new errors_1.BadRouteError(msg, req.method || "", req.url || ""); - }, - }); - const body = yield request_1.getRequestData(req); - const response = yield handler(ctx, this.service, body, this.interceptors); - yield Promise.all([ - this.invokeHook("responsePrepared", ctx), - // keep backwards compatibility till next release - this.invokeHook("requestPrepared", ctx), - ]); - resp.statusCode = 200; - resp.setHeader("Content-Type", mimeContentType); - resp.end(response); - } - catch (e) { - yield this.invokeHook("error", ctx, mustBeTwirpError(e)); - if (!resp.headersSent) { - writeError(resp, e); - } - } - finally { - yield Promise.all([ - this.invokeHook("responseSent", ctx), - // keep backwards compatibility till next release - this.invokeHook("requestSent", ctx), - ]); - } - }); - } - /** - * Invoke a hook - * @param hookName - * @param ctx - * @param err - * @protected - */ - invokeHook(hookName, ctx, err) { - return __awaiter(this, void 0, void 0, function* () { - if (this.hooks.length === 0) { - return; - } - const chainedHooks = hooks_1.chainHooks(...this.hooks); - const hook = chainedHooks === null || chainedHooks === void 0 ? void 0 : chainedHooks[hookName]; - if (hook) { - yield hook(ctx, err || new errors_1.InternalServerError("internal server error")); - } - }); - } -} -exports.TwirpServer = TwirpServer; -/** - * Write http error response - * @param res - * @param error - */ -function writeError(res, error) { - const twirpError = mustBeTwirpError(error); - res.setHeader("Content-Type", "application/json"); - res.statusCode = errors_1.httpStatusFromErrorCode(twirpError.code); - res.end(twirpError.toJSON()); -} -exports.writeError = writeError; -/** - * Make sure that the error passed is a TwirpError - * otherwise it will wrap it into an InternalError - * @param err - */ -function mustBeTwirpError(err) { - if (err instanceof errors_1.TwirpError) { - return err; - } - return new errors_1.InternalServerErrorWith(err); -} - - /***/ }), /***/ 41773: @@ -137628,7 +135483,7 @@ module.exports = index; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.2.1","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); +module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.2.2","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); /***/ }), diff --git a/dist/upload/index.js b/dist/upload/index.js index a3c9a4e..3966dc5 100644 --- a/dist/upload/index.js +++ b/dist/upload/index.js @@ -813,7 +813,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); __exportStar(__nccwpck_require__(54622), exports); __exportStar(__nccwpck_require__(8626), exports); __exportStar(__nccwpck_require__(58178), exports); -__exportStar(__nccwpck_require__(63077), exports); +__exportStar(__nccwpck_require__(49773), exports); //# sourceMappingURL=index.js.map /***/ }), @@ -1529,23 +1529,13 @@ exports.ArtifactService = new runtime_rpc_1.ServiceType("github.actions.results. /***/ }), -/***/ 63077: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 49773: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.createArtifactServiceServer = exports.ArtifactServiceMethodList = exports.ArtifactServiceMethod = exports.ArtifactServiceClientProtobuf = exports.ArtifactServiceClientJSON = void 0; -const twirp_ts_1 = __nccwpck_require__(66465); +exports.ArtifactServiceClientProtobuf = exports.ArtifactServiceClientJSON = void 0; const artifact_1 = __nccwpck_require__(58178); class ArtifactServiceClientJSON { constructor(rpc) { @@ -1642,405 +1632,7 @@ class ArtifactServiceClientProtobuf { } } exports.ArtifactServiceClientProtobuf = ArtifactServiceClientProtobuf; -var ArtifactServiceMethod; -(function (ArtifactServiceMethod) { - ArtifactServiceMethod["CreateArtifact"] = "CreateArtifact"; - ArtifactServiceMethod["FinalizeArtifact"] = "FinalizeArtifact"; - ArtifactServiceMethod["ListArtifacts"] = "ListArtifacts"; - ArtifactServiceMethod["GetSignedArtifactURL"] = "GetSignedArtifactURL"; - ArtifactServiceMethod["DeleteArtifact"] = "DeleteArtifact"; -})(ArtifactServiceMethod || (exports.ArtifactServiceMethod = ArtifactServiceMethod = {})); -exports.ArtifactServiceMethodList = [ - ArtifactServiceMethod.CreateArtifact, - ArtifactServiceMethod.FinalizeArtifact, - ArtifactServiceMethod.ListArtifacts, - ArtifactServiceMethod.GetSignedArtifactURL, - ArtifactServiceMethod.DeleteArtifact, -]; -function createArtifactServiceServer(service) { - return new twirp_ts_1.TwirpServer({ - service, - packageName: "github.actions.results.api.v1", - serviceName: "ArtifactService", - methodList: exports.ArtifactServiceMethodList, - matchRoute: matchArtifactServiceRoute, - }); -} -exports.createArtifactServiceServer = createArtifactServiceServer; -function matchArtifactServiceRoute(method, events) { - switch (method) { - case "CreateArtifact": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "CreateArtifact" }); - yield events.onMatch(ctx); - return handleArtifactServiceCreateArtifactRequest(ctx, service, data, interceptors); - }); - case "FinalizeArtifact": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "FinalizeArtifact" }); - yield events.onMatch(ctx); - return handleArtifactServiceFinalizeArtifactRequest(ctx, service, data, interceptors); - }); - case "ListArtifacts": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "ListArtifacts" }); - yield events.onMatch(ctx); - return handleArtifactServiceListArtifactsRequest(ctx, service, data, interceptors); - }); - case "GetSignedArtifactURL": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "GetSignedArtifactURL" }); - yield events.onMatch(ctx); - return handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, interceptors); - }); - case "DeleteArtifact": - return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () { - ctx = Object.assign(Object.assign({}, ctx), { methodName: "DeleteArtifact" }); - yield events.onMatch(ctx); - return handleArtifactServiceDeleteArtifactRequest(ctx, service, data, interceptors); - }); - default: - events.onNotFound(); - const msg = `no handler found`; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceCreateArtifactRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceCreateArtifactJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceCreateArtifactProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceFinalizeArtifactRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceFinalizeArtifactJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceFinalizeArtifactProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceListArtifactsRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceListArtifactsJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceListArtifactsProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceGetSignedArtifactURLRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceGetSignedArtifactURLJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceGetSignedArtifactURLProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceDeleteArtifactRequest(ctx, service, data, interceptors) { - switch (ctx.contentType) { - case twirp_ts_1.TwirpContentType.JSON: - return handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors); - case twirp_ts_1.TwirpContentType.Protobuf: - return handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors); - default: - const msg = "unexpected Content-Type"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg); - } -} -function handleArtifactServiceCreateArtifactJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.CreateArtifactRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.CreateArtifact(ctx, inputReq); - }); - } - else { - response = yield service.CreateArtifact(ctx, request); - } - return JSON.stringify(artifact_1.CreateArtifactResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceFinalizeArtifactJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.FinalizeArtifactRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.FinalizeArtifact(ctx, inputReq); - }); - } - else { - response = yield service.FinalizeArtifact(ctx, request); - } - return JSON.stringify(artifact_1.FinalizeArtifactResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceListArtifactsJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.ListArtifactsRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.ListArtifacts(ctx, inputReq); - }); - } - else { - response = yield service.ListArtifacts(ctx, request); - } - return JSON.stringify(artifact_1.ListArtifactsResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceGetSignedArtifactURLJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.GetSignedArtifactURLRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.GetSignedArtifactURL(ctx, inputReq); - }); - } - else { - response = yield service.GetSignedArtifactURL(ctx, request); - } - return JSON.stringify(artifact_1.GetSignedArtifactURLResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceDeleteArtifactJSON(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - const body = JSON.parse(data.toString() || "{}"); - request = artifact_1.DeleteArtifactRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } - catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.DeleteArtifact(ctx, inputReq); - }); - } - else { - response = yield service.DeleteArtifact(ctx, request); - } - return JSON.stringify(artifact_1.DeleteArtifactResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - })); - }); -} -function handleArtifactServiceCreateArtifactProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.CreateArtifactRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.CreateArtifact(ctx, inputReq); - }); - } - else { - response = yield service.CreateArtifact(ctx, request); - } - return Buffer.from(artifact_1.CreateArtifactResponse.toBinary(response)); - }); -} -function handleArtifactServiceFinalizeArtifactProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.FinalizeArtifactRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.FinalizeArtifact(ctx, inputReq); - }); - } - else { - response = yield service.FinalizeArtifact(ctx, request); - } - return Buffer.from(artifact_1.FinalizeArtifactResponse.toBinary(response)); - }); -} -function handleArtifactServiceListArtifactsProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.ListArtifactsRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.ListArtifacts(ctx, inputReq); - }); - } - else { - response = yield service.ListArtifacts(ctx, request); - } - return Buffer.from(artifact_1.ListArtifactsResponse.toBinary(response)); - }); -} -function handleArtifactServiceGetSignedArtifactURLProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.GetSignedArtifactURLRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.GetSignedArtifactURL(ctx, inputReq); - }); - } - else { - response = yield service.GetSignedArtifactURL(ctx, request); - } - return Buffer.from(artifact_1.GetSignedArtifactURLResponse.toBinary(response)); - }); -} -function handleArtifactServiceDeleteArtifactProtobuf(ctx, service, data, interceptors) { - return __awaiter(this, void 0, void 0, function* () { - let request; - let response; - try { - request = artifact_1.DeleteArtifactRequest.fromBinary(data); - } - catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - if (interceptors && interceptors.length > 0) { - const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors); - response = yield interceptor(ctx, request, (ctx, inputReq) => { - return service.DeleteArtifact(ctx, inputReq); - }); - } - else { - response = yield service.DeleteArtifact(ctx, request); - } - return Buffer.from(artifact_1.DeleteArtifactResponse.toBinary(response)); - }); -} -//# sourceMappingURL=artifact.twirp.js.map +//# sourceMappingURL=artifact.twirp-client.js.map /***/ }), @@ -3039,10 +2631,8 @@ function getGitHubWorkspaceDir() { return ghWorkspaceDir; } exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir; -// Mimics behavior of azcopy: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-optimize -// If your machine has fewer than 5 CPUs, then the value of this variable is set to 32. -// Otherwise, the default value is equal to 16 multiplied by the number of CPUs. The maximum value of this variable is 300. -// This value can be lowered with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable. +// The maximum value of concurrency is 300. +// This value can be changed with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable. function getConcurrency() { const numCPUs = os_1.default.cpus().length; let concurrencyCap = 32; @@ -3057,11 +2647,14 @@ function getConcurrency() { throw new Error('Invalid value set for ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY env variable'); } if (concurrency < concurrencyCap) { + (0, core_1.info)(`Set concurrency based on the value set in ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY.`); return concurrency; } - (0, core_1.info)(`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Lowering it to the cap.`); + (0, core_1.info)(`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Set it to the maximum value allowed.`); + return concurrencyCap; } - return concurrencyCap; + // default concurrency to 5 + return 5; } exports.getConcurrency = getConcurrency; function getUploadChunkTimeout() { @@ -54519,6 +54112,7 @@ const json_format_contract_1 = __nccwpck_require__(48139); const reflection_equals_1 = __nccwpck_require__(39473); const binary_writer_1 = __nccwpck_require__(44354); const binary_reader_1 = __nccwpck_require__(65210); +const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})); /** * This standard message type provides reflection-based * operations to work with a message. @@ -54529,7 +54123,7 @@ class MessageType { this.typeName = name; this.fields = fields.map(reflection_info_1.normalizeFieldInfo); this.options = options !== null && options !== void 0 ? options : {}; - this.messagePrototype = Object.defineProperty({}, message_type_contract_1.MESSAGE_TYPE, { value: this }); + this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [message_type_contract_1.MESSAGE_TYPE]: { value: this } })); this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this); this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this); this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this); @@ -70568,599 +70162,6 @@ class Deprecation extends Error { exports.Deprecation = Deprecation; -/***/ }), - -/***/ 13598: -/***/ ((module) => { - -"use strict"; - - -function _process (v, mod) { - var i - var r - - if (typeof mod === 'function') { - r = mod(v) - if (r !== undefined) { - v = r - } - } else if (Array.isArray(mod)) { - for (i = 0; i < mod.length; i++) { - r = mod[i](v) - if (r !== undefined) { - v = r - } - } - } - - return v -} - -function parseKey (key, val) { - // detect negative index notation - if (key[0] === '-' && Array.isArray(val) && /^-\d+$/.test(key)) { - return val.length + parseInt(key, 10) - } - return key -} - -function isIndex (k) { - return /^\d+$/.test(k) -} - -function isObject (val) { - return Object.prototype.toString.call(val) === '[object Object]' -} - -function isArrayOrObject (val) { - return Object(val) === val -} - -function isEmptyObject (val) { - return Object.keys(val).length === 0 -} - -var blacklist = ['__proto__', 'prototype', 'constructor'] -var blacklistFilter = function (part) { return blacklist.indexOf(part) === -1 } - -function parsePath (path, sep) { - if (path.indexOf('[') >= 0) { - path = path.replace(/\[/g, sep).replace(/]/g, '') - } - - var parts = path.split(sep) - - var check = parts.filter(blacklistFilter) - - if (check.length !== parts.length) { - throw Error('Refusing to update blacklisted property ' + path) - } - - return parts -} - -var hasOwnProperty = Object.prototype.hasOwnProperty - -function DotObject (separator, override, useArray, useBrackets) { - if (!(this instanceof DotObject)) { - return new DotObject(separator, override, useArray, useBrackets) - } - - if (typeof override === 'undefined') override = false - if (typeof useArray === 'undefined') useArray = true - if (typeof useBrackets === 'undefined') useBrackets = true - this.separator = separator || '.' - this.override = override - this.useArray = useArray - this.useBrackets = useBrackets - this.keepArray = false - - // contains touched arrays - this.cleanup = [] -} - -var dotDefault = new DotObject('.', false, true, true) -function wrap (method) { - return function () { - return dotDefault[method].apply(dotDefault, arguments) - } -} - -DotObject.prototype._fill = function (a, obj, v, mod) { - var k = a.shift() - - if (a.length > 0) { - obj[k] = obj[k] || (this.useArray && isIndex(a[0]) ? [] : {}) - - if (!isArrayOrObject(obj[k])) { - if (this.override) { - obj[k] = {} - } else { - if (!(isArrayOrObject(v) && isEmptyObject(v))) { - throw new Error( - 'Trying to redefine `' + k + '` which is a ' + typeof obj[k] - ) - } - - return - } - } - - this._fill(a, obj[k], v, mod) - } else { - if (!this.override && isArrayOrObject(obj[k]) && !isEmptyObject(obj[k])) { - if (!(isArrayOrObject(v) && isEmptyObject(v))) { - throw new Error("Trying to redefine non-empty obj['" + k + "']") - } - - return - } - - obj[k] = _process(v, mod) - } -} - -/** - * - * Converts an object with dotted-key/value pairs to it's expanded version - * - * Optionally transformed by a set of modifiers. - * - * Usage: - * - * var row = { - * 'nr': 200, - * 'doc.name': ' My Document ' - * } - * - * var mods = { - * 'doc.name': [_s.trim, _s.underscored] - * } - * - * dot.object(row, mods) - * - * @param {Object} obj - * @param {Object} mods - */ -DotObject.prototype.object = function (obj, mods) { - var self = this - - Object.keys(obj).forEach(function (k) { - var mod = mods === undefined ? null : mods[k] - // normalize array notation. - var ok = parsePath(k, self.separator).join(self.separator) - - if (ok.indexOf(self.separator) !== -1) { - self._fill(ok.split(self.separator), obj, obj[k], mod) - delete obj[k] - } else { - obj[k] = _process(obj[k], mod) - } - }) - - return obj -} - -/** - * @param {String} path dotted path - * @param {String} v value to be set - * @param {Object} obj object to be modified - * @param {Function|Array} mod optional modifier - */ -DotObject.prototype.str = function (path, v, obj, mod) { - var ok = parsePath(path, this.separator).join(this.separator) - - if (path.indexOf(this.separator) !== -1) { - this._fill(ok.split(this.separator), obj, v, mod) - } else { - obj[path] = _process(v, mod) - } - - return obj -} - -/** - * - * Pick a value from an object using dot notation. - * - * Optionally remove the value - * - * @param {String} path - * @param {Object} obj - * @param {Boolean} remove - */ -DotObject.prototype.pick = function (path, obj, remove, reindexArray) { - var i - var keys - var val - var key - var cp - - keys = parsePath(path, this.separator) - for (i = 0; i < keys.length; i++) { - key = parseKey(keys[i], obj) - if (obj && typeof obj === 'object' && key in obj) { - if (i === keys.length - 1) { - if (remove) { - val = obj[key] - if (reindexArray && Array.isArray(obj)) { - obj.splice(key, 1) - } else { - delete obj[key] - } - if (Array.isArray(obj)) { - cp = keys.slice(0, -1).join('.') - if (this.cleanup.indexOf(cp) === -1) { - this.cleanup.push(cp) - } - } - return val - } else { - return obj[key] - } - } else { - obj = obj[key] - } - } else { - return undefined - } - } - if (remove && Array.isArray(obj)) { - obj = obj.filter(function (n) { - return n !== undefined - }) - } - return obj -} -/** - * - * Delete value from an object using dot notation. - * - * @param {String} path - * @param {Object} obj - * @return {any} The removed value - */ -DotObject.prototype.delete = function (path, obj) { - return this.remove(path, obj, true) -} - -/** - * - * Remove value from an object using dot notation. - * - * Will remove multiple items if path is an array. - * In this case array indexes will be retained until all - * removals have been processed. - * - * Use dot.delete() to automatically re-index arrays. - * - * @param {String|Array} path - * @param {Object} obj - * @param {Boolean} reindexArray - * @return {any} The removed value - */ -DotObject.prototype.remove = function (path, obj, reindexArray) { - var i - - this.cleanup = [] - if (Array.isArray(path)) { - for (i = 0; i < path.length; i++) { - this.pick(path[i], obj, true, reindexArray) - } - if (!reindexArray) { - this._cleanup(obj) - } - return obj - } else { - return this.pick(path, obj, true, reindexArray) - } -} - -DotObject.prototype._cleanup = function (obj) { - var ret - var i - var keys - var root - if (this.cleanup.length) { - for (i = 0; i < this.cleanup.length; i++) { - keys = this.cleanup[i].split('.') - root = keys.splice(0, -1).join('.') - ret = root ? this.pick(root, obj) : obj - ret = ret[keys[0]].filter(function (v) { - return v !== undefined - }) - this.set(this.cleanup[i], ret, obj) - } - this.cleanup = [] - } -} - -/** - * Alias method for `dot.remove` - * - * Note: this is not an alias for dot.delete() - * - * @param {String|Array} path - * @param {Object} obj - * @param {Boolean} reindexArray - * @return {any} The removed value - */ -DotObject.prototype.del = DotObject.prototype.remove - -/** - * - * Move a property from one place to the other. - * - * If the source path does not exist (undefined) - * the target property will not be set. - * - * @param {String} source - * @param {String} target - * @param {Object} obj - * @param {Function|Array} mods - * @param {Boolean} merge - */ -DotObject.prototype.move = function (source, target, obj, mods, merge) { - if (typeof mods === 'function' || Array.isArray(mods)) { - this.set(target, _process(this.pick(source, obj, true), mods), obj, merge) - } else { - merge = mods - this.set(target, this.pick(source, obj, true), obj, merge) - } - - return obj -} - -/** - * - * Transfer a property from one object to another object. - * - * If the source path does not exist (undefined) - * the property on the other object will not be set. - * - * @param {String} source - * @param {String} target - * @param {Object} obj1 - * @param {Object} obj2 - * @param {Function|Array} mods - * @param {Boolean} merge - */ -DotObject.prototype.transfer = function ( - source, - target, - obj1, - obj2, - mods, - merge -) { - if (typeof mods === 'function' || Array.isArray(mods)) { - this.set( - target, - _process(this.pick(source, obj1, true), mods), - obj2, - merge - ) - } else { - merge = mods - this.set(target, this.pick(source, obj1, true), obj2, merge) - } - - return obj2 -} - -/** - * - * Copy a property from one object to another object. - * - * If the source path does not exist (undefined) - * the property on the other object will not be set. - * - * @param {String} source - * @param {String} target - * @param {Object} obj1 - * @param {Object} obj2 - * @param {Function|Array} mods - * @param {Boolean} merge - */ -DotObject.prototype.copy = function (source, target, obj1, obj2, mods, merge) { - if (typeof mods === 'function' || Array.isArray(mods)) { - this.set( - target, - _process( - // clone what is picked - JSON.parse(JSON.stringify(this.pick(source, obj1, false))), - mods - ), - obj2, - merge - ) - } else { - merge = mods - this.set(target, this.pick(source, obj1, false), obj2, merge) - } - - return obj2 -} - -/** - * - * Set a property on an object using dot notation. - * - * @param {String} path - * @param {any} val - * @param {Object} obj - * @param {Boolean} merge - */ -DotObject.prototype.set = function (path, val, obj, merge) { - var i - var k - var keys - var key - - // Do not operate if the value is undefined. - if (typeof val === 'undefined') { - return obj - } - keys = parsePath(path, this.separator) - - for (i = 0; i < keys.length; i++) { - key = keys[i] - if (i === keys.length - 1) { - if (merge && isObject(val) && isObject(obj[key])) { - for (k in val) { - if (hasOwnProperty.call(val, k)) { - obj[key][k] = val[k] - } - } - } else if (merge && Array.isArray(obj[key]) && Array.isArray(val)) { - for (var j = 0; j < val.length; j++) { - obj[keys[i]].push(val[j]) - } - } else { - obj[key] = val - } - } else if ( - // force the value to be an object - !hasOwnProperty.call(obj, key) || - (!isObject(obj[key]) && !Array.isArray(obj[key])) - ) { - // initialize as array if next key is numeric - if (/^\d+$/.test(keys[i + 1])) { - obj[key] = [] - } else { - obj[key] = {} - } - } - obj = obj[key] - } - return obj -} - -/** - * - * Transform an object - * - * Usage: - * - * var obj = { - * "id": 1, - * "some": { - * "thing": "else" - * } - * } - * - * var transform = { - * "id": "nr", - * "some.thing": "name" - * } - * - * var tgt = dot.transform(transform, obj) - * - * @param {Object} recipe Transform recipe - * @param {Object} obj Object to be transformed - * @param {Array} mods modifiers for the target - */ -DotObject.prototype.transform = function (recipe, obj, tgt) { - obj = obj || {} - tgt = tgt || {} - Object.keys(recipe).forEach( - function (key) { - this.set(recipe[key], this.pick(key, obj), tgt) - }.bind(this) - ) - return tgt -} - -/** - * - * Convert object to dotted-key/value pair - * - * Usage: - * - * var tgt = dot.dot(obj) - * - * or - * - * var tgt = {} - * dot.dot(obj, tgt) - * - * @param {Object} obj source object - * @param {Object} tgt target object - * @param {Array} path path array (internal) - */ -DotObject.prototype.dot = function (obj, tgt, path) { - tgt = tgt || {} - path = path || [] - var isArray = Array.isArray(obj) - - Object.keys(obj).forEach( - function (key) { - var index = isArray && this.useBrackets ? '[' + key + ']' : key - if ( - isArrayOrObject(obj[key]) && - ((isObject(obj[key]) && !isEmptyObject(obj[key])) || - (Array.isArray(obj[key]) && !this.keepArray && obj[key].length !== 0)) - ) { - if (isArray && this.useBrackets) { - var previousKey = path[path.length - 1] || '' - return this.dot( - obj[key], - tgt, - path.slice(0, -1).concat(previousKey + index) - ) - } else { - return this.dot(obj[key], tgt, path.concat(index)) - } - } else { - if (isArray && this.useBrackets) { - tgt[path.join(this.separator).concat('[' + key + ']')] = obj[key] - } else { - tgt[path.concat(index).join(this.separator)] = obj[key] - } - } - }.bind(this) - ) - return tgt -} - -DotObject.pick = wrap('pick') -DotObject.move = wrap('move') -DotObject.transfer = wrap('transfer') -DotObject.transform = wrap('transform') -DotObject.copy = wrap('copy') -DotObject.object = wrap('object') -DotObject.str = wrap('str') -DotObject.set = wrap('set') -DotObject.delete = wrap('delete') -DotObject.del = DotObject.remove = wrap('remove') -DotObject.dot = wrap('dot'); -['override', 'overwrite'].forEach(function (prop) { - Object.defineProperty(DotObject, prop, { - get: function () { - return dotDefault.override - }, - set: function (val) { - dotDefault.override = !!val - } - }) -}); -['useArray', 'keepArray', 'useBrackets'].forEach(function (prop) { - Object.defineProperty(DotObject, prop, { - get: function () { - return dotDefault[prop] - }, - set: function (val) { - dotDefault[prop] = val - } - }) -}) - -DotObject._process = _process - -module.exports = DotObject - - /***/ }), /***/ 84697: @@ -94928,1152 +93929,6 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { exports.debug = debug; // for test -/***/ }), - -/***/ 31524: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); - - -/***/ }), - -/***/ 66647: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isValidErrorCode = exports.httpStatusFromErrorCode = exports.TwirpErrorCode = exports.BadRouteError = exports.InternalServerErrorWith = exports.InternalServerError = exports.RequiredArgumentError = exports.InvalidArgumentError = exports.NotFoundError = exports.TwirpError = void 0; -/** - * Represents a twirp error - */ -class TwirpError extends Error { - constructor(code, msg) { - super(msg); - this.code = TwirpErrorCode.Internal; - this.meta = {}; - this.code = code; - this.msg = msg; - Object.setPrototypeOf(this, TwirpError.prototype); - } - /** - * Adds a metadata kv to the error - * @param key - * @param value - */ - withMeta(key, value) { - this.meta[key] = value; - return this; - } - /** - * Returns a single metadata value - * return "" if not found - * @param key - */ - getMeta(key) { - return this.meta[key] || ""; - } - /** - * Add the original error cause - * @param err - * @param addMeta - */ - withCause(err, addMeta = false) { - this._originalCause = err; - if (addMeta) { - this.withMeta("cause", err.message); - } - return this; - } - cause() { - return this._originalCause; - } - /** - * Returns the error representation to JSON - */ - toJSON() { - try { - return JSON.stringify({ - code: this.code, - msg: this.msg, - meta: this.meta, - }); - } - catch (e) { - return `{"code": "internal", "msg": "There was an error but it could not be serialized into JSON"}`; - } - } - /** - * Create a twirp error from an object - * @param obj - */ - static fromObject(obj) { - const code = obj["code"] || TwirpErrorCode.Unknown; - const msg = obj["msg"] || "unknown"; - const error = new TwirpError(code, msg); - if (obj["meta"]) { - Object.keys(obj["meta"]).forEach((key) => { - error.withMeta(key, obj["meta"][key]); - }); - } - return error; - } -} -exports.TwirpError = TwirpError; -/** - * NotFoundError constructor for the common NotFound error. - */ -class NotFoundError extends TwirpError { - constructor(msg) { - super(TwirpErrorCode.NotFound, msg); - } -} -exports.NotFoundError = NotFoundError; -/** - * InvalidArgumentError constructor for the common InvalidArgument error. Can be - * used when an argument has invalid format, is a number out of range, is a bad - * option, etc). - */ -class InvalidArgumentError extends TwirpError { - constructor(argument, validationMsg) { - super(TwirpErrorCode.InvalidArgument, argument + " " + validationMsg); - this.withMeta("argument", argument); - } -} -exports.InvalidArgumentError = InvalidArgumentError; -/** - * RequiredArgumentError is a more specific constructor for InvalidArgument - * error. Should be used when the argument is required (expected to have a - * non-zero value). - */ -class RequiredArgumentError extends InvalidArgumentError { - constructor(argument) { - super(argument, "is required"); - } -} -exports.RequiredArgumentError = RequiredArgumentError; -/** - * InternalError constructor for the common Internal error. Should be used to - * specify that something bad or unexpected happened. - */ -class InternalServerError extends TwirpError { - constructor(msg) { - super(TwirpErrorCode.Internal, msg); - } -} -exports.InternalServerError = InternalServerError; -/** - * InternalErrorWith makes an internal error, wrapping the original error and using it - * for the error message, and with metadata "cause" with the original error type. - * This function is used by Twirp services to wrap non-Twirp errors as internal errors. - * The wrapped error can be extracted later with err.cause() - */ -class InternalServerErrorWith extends InternalServerError { - constructor(err) { - super(err.message); - this.withMeta("cause", err.name); - this.withCause(err); - } -} -exports.InternalServerErrorWith = InternalServerErrorWith; -/** - * A standard BadRoute Error - */ -class BadRouteError extends TwirpError { - constructor(msg, method, url) { - super(TwirpErrorCode.BadRoute, msg); - this.withMeta("twirp_invalid_route", method + " " + url); - } -} -exports.BadRouteError = BadRouteError; -var TwirpErrorCode; -(function (TwirpErrorCode) { - // Canceled indicates the operation was cancelled (typically by the caller). - TwirpErrorCode["Canceled"] = "canceled"; - // Unknown error. For example when handling errors raised by APIs that do not - // return enough error information. - TwirpErrorCode["Unknown"] = "unknown"; - // InvalidArgument indicates client specified an invalid argument. It - // indicates arguments that are problematic regardless of the state of the - // system (i.e. a malformed file name, required argument, number out of range, - // etc.). - TwirpErrorCode["InvalidArgument"] = "invalid_argument"; - // Malformed indicates an error occurred while decoding the client's request. - // This may mean that the message was encoded improperly, or that there is a - // disagreement in message format between the client and server. - TwirpErrorCode["Malformed"] = "malformed"; - // DeadlineExceeded means operation expired before completion. For operations - // that change the state of the system, this error may be returned even if the - // operation has completed successfully (timeout). - TwirpErrorCode["DeadlineExceeded"] = "deadline_exceeded"; - // NotFound means some requested entity was not found. - TwirpErrorCode["NotFound"] = "not_found"; - // BadRoute means that the requested URL path wasn't routable to a Twirp - // service and method. This is returned by the generated server, and usually - // shouldn't be returned by applications. Instead, applications should use - // NotFound or Unimplemented. - TwirpErrorCode["BadRoute"] = "bad_route"; - // AlreadyExists means an attempt to create an entity failed because one - // already exists. - TwirpErrorCode["AlreadyExists"] = "already_exists"; - // PermissionDenied indicates the caller does not have permission to execute - // the specified operation. It must not be used if the caller cannot be - // identified (Unauthenticated). - TwirpErrorCode["PermissionDenied"] = "permission_denied"; - // Unauthenticated indicates the request does not have valid authentication - // credentials for the operation. - TwirpErrorCode["Unauthenticated"] = "unauthenticated"; - // ResourceExhausted indicates some resource has been exhausted, perhaps a - // per-user quota, or perhaps the entire file system is out of space. - TwirpErrorCode["ResourceExhausted"] = "resource_exhausted"; - // FailedPrecondition indicates operation was rejected because the system is - // not in a state required for the operation's execution. For example, doing - // an rmdir operation on a directory that is non-empty, or on a non-directory - // object, or when having conflicting read-modify-write on the same resource. - TwirpErrorCode["FailedPrecondition"] = "failed_precondition"; - // Aborted indicates the operation was aborted, typically due to a concurrency - // issue like sequencer check failures, transaction aborts, etc. - TwirpErrorCode["Aborted"] = "aborted"; - // OutOfRange means operation was attempted past the valid range. For example, - // seeking or reading past end of a paginated collection. - // - // Unlike InvalidArgument, this error indicates a problem that may be fixed if - // the system state changes (i.e. adding more items to the collection). - // - // There is a fair bit of overlap between FailedPrecondition and OutOfRange. - // We recommend using OutOfRange (the more specific error) when it applies so - // that callers who are iterating through a space can easily look for an - // OutOfRange error to detect when they are done. - TwirpErrorCode["OutOfRange"] = "out_of_range"; - // Unimplemented indicates operation is not implemented or not - // supported/enabled in this service. - TwirpErrorCode["Unimplemented"] = "unimplemented"; - // Internal errors. When some invariants expected by the underlying system - // have been broken. In other words, something bad happened in the library or - // backend service. Do not confuse with HTTP Internal Server Error; an - // Internal error could also happen on the client code, i.e. when parsing a - // server response. - TwirpErrorCode["Internal"] = "internal"; - // Unavailable indicates the service is currently unavailable. This is a most - // likely a transient condition and may be corrected by retrying with a - // backoff. - TwirpErrorCode["Unavailable"] = "unavailable"; - // DataLoss indicates unrecoverable data loss or corruption. - TwirpErrorCode["DataLoss"] = "data_loss"; -})(TwirpErrorCode = exports.TwirpErrorCode || (exports.TwirpErrorCode = {})); -// ServerHTTPStatusFromErrorCode maps a Twirp error type into a similar HTTP -// response status. It is used by the Twirp server handler to set the HTTP -// response status code. Returns 0 if the ErrorCode is invalid. -function httpStatusFromErrorCode(code) { - switch (code) { - case TwirpErrorCode.Canceled: - return 408; // RequestTimeout - case TwirpErrorCode.Unknown: - return 500; // Internal Server Error - case TwirpErrorCode.InvalidArgument: - return 400; // BadRequest - case TwirpErrorCode.Malformed: - return 400; // BadRequest - case TwirpErrorCode.DeadlineExceeded: - return 408; // RequestTimeout - case TwirpErrorCode.NotFound: - return 404; // Not Found - case TwirpErrorCode.BadRoute: - return 404; // Not Found - case TwirpErrorCode.AlreadyExists: - return 409; // Conflict - case TwirpErrorCode.PermissionDenied: - return 403; // Forbidden - case TwirpErrorCode.Unauthenticated: - return 401; // Unauthorized - case TwirpErrorCode.ResourceExhausted: - return 429; // Too Many Requests - case TwirpErrorCode.FailedPrecondition: - return 412; // Precondition Failed - case TwirpErrorCode.Aborted: - return 409; // Conflict - case TwirpErrorCode.OutOfRange: - return 400; // Bad Request - case TwirpErrorCode.Unimplemented: - return 501; // Not Implemented - case TwirpErrorCode.Internal: - return 500; // Internal Server Error - case TwirpErrorCode.Unavailable: - return 503; // Service Unavailable - case TwirpErrorCode.DataLoss: - return 500; // Internal Server Error - default: - return 0; // Invalid! - } -} -exports.httpStatusFromErrorCode = httpStatusFromErrorCode; -// IsValidErrorCode returns true if is one of the valid predefined constants. -function isValidErrorCode(code) { - return httpStatusFromErrorCode(code) != 0; -} -exports.isValidErrorCode = isValidErrorCode; - - -/***/ }), - -/***/ 56748: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__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 = (this && this.__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 __rest = (this && this.__rest) || function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Gateway = exports.Pattern = void 0; -const querystring_1 = __nccwpck_require__(63477); -const dotObject = __importStar(__nccwpck_require__(13598)); -const request_1 = __nccwpck_require__(8347); -const errors_1 = __nccwpck_require__(66647); -const http_client_1 = __nccwpck_require__(94091); -const server_1 = __nccwpck_require__(26604); -var Pattern; -(function (Pattern) { - Pattern["POST"] = "post"; - Pattern["GET"] = "get"; - Pattern["PATCH"] = "patch"; - Pattern["PUT"] = "put"; - Pattern["DELETE"] = "delete"; -})(Pattern = exports.Pattern || (exports.Pattern = {})); -/** - * The Gateway proxies http requests to Twirp Compliant - * handlers - */ -class Gateway { - constructor(routes) { - this.routes = routes; - } - /** - * Middleware that rewrite the current request - * to a Twirp compliant request - */ - twirpRewrite(prefix = "/twirp") { - return (req, resp, next) => { - this.rewrite(req, resp, prefix) - .then(() => next()) - .catch((e) => { - if (e instanceof errors_1.TwirpError) { - if (e.code !== errors_1.TwirpErrorCode.NotFound) { - server_1.writeError(resp, e); - } - else { - next(); - } - } - }); - }; - } - /** - * Rewrite an incoming request to a Twirp compliant request - * @param req - * @param resp - * @param prefix - */ - rewrite(req, resp, prefix = "/twirp") { - return __awaiter(this, void 0, void 0, function* () { - const [match, route] = this.matchRoute(req); - const body = yield this.prepareTwirpBody(req, match, route); - const twirpUrl = `${prefix}/${route.packageName}.${route.serviceName}/${route.methodName}`; - req.url = twirpUrl; - req.originalUrl = twirpUrl; - req.method = "POST"; - req.headers["content-type"] = "application/json"; - req.rawBody = Buffer.from(JSON.stringify(body)); - if (route.responseBodyKey) { - const endFn = resp.end.bind(resp); - resp.end = function (chunk) { - if (resp.statusCode === 200) { - endFn(`{ "${route.responseBodyKey}": ${chunk} }`); - } - else { - endFn(chunk); - } - }; - } - }); - } - /** - * Create a reverse proxy handler to - * proxy http requests to Twirp Compliant handlers - * @param httpClientOption - */ - reverseProxy(httpClientOption) { - const client = http_client_1.NodeHttpRPC(httpClientOption); - return (req, res) => __awaiter(this, void 0, void 0, function* () { - try { - const [match, route] = this.matchRoute(req); - const body = yield this.prepareTwirpBody(req, match, route); - const response = yield client.request(`${route.packageName}.${route.serviceName}`, route.methodName, "application/json", body); - res.statusCode = 200; - res.setHeader("content-type", "application/json"); - let jsonResponse; - if (route.responseBodyKey) { - jsonResponse = JSON.stringify({ [route.responseBodyKey]: response }); - } - else { - jsonResponse = JSON.stringify(response); - } - res.end(jsonResponse); - } - catch (e) { - server_1.writeError(res, e); - } - }); - } - /** - * Prepares twirp body requests using http.google.annotions - * compliant spec - * - * @param req - * @param match - * @param route - * @protected - */ - prepareTwirpBody(req, match, route) { - return __awaiter(this, void 0, void 0, function* () { - const _a = match.params, { query_string } = _a, params = __rest(_a, ["query_string"]); - let requestBody = Object.assign({}, params); - if (query_string && route.bodyKey !== "*") { - const queryParams = this.parseQueryString(query_string); - requestBody = Object.assign(Object.assign({}, queryParams), requestBody); - } - let body = {}; - if (route.bodyKey) { - const data = yield request_1.getRequestData(req); - try { - const jsonBody = JSON.parse(data.toString() || "{}"); - if (route.bodyKey === "*") { - body = jsonBody; - } - else { - body[route.bodyKey] = jsonBody; - } - } - catch (e) { - const msg = "the json request could not be decoded"; - throw new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - return Object.assign(Object.assign({}, body), requestBody); - }); - } - /** - * Matches a route - * @param req - */ - matchRoute(req) { - var _a; - const httpMethod = (_a = req.method) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - if (!httpMethod) { - throw new errors_1.BadRouteError(`method not allowed`, req.method || "", req.url || ""); - } - const routes = this.routes[httpMethod]; - for (const route of routes) { - const match = route.matcher(req.url || "/"); - if (match) { - return [match, route]; - } - } - throw new errors_1.NotFoundError(`url ${req.url} not found`); - } - /** - * Parse query string - * @param queryString - */ - parseQueryString(queryString) { - const queryParams = querystring_1.parse(queryString.replace("?", "")); - return dotObject.object(queryParams); - } -} -exports.Gateway = Gateway; - - -/***/ }), - -/***/ 4263: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.isHook = exports.chainHooks = void 0; -// ChainHooks creates a new ServerHook which chains the callbacks in -// each of the constituent hooks passed in. Each hook function will be -// called in the order of the ServerHooks values passed in. -// -// For the erroring hooks, RequestReceived and RequestRouted, any returned -// errors prevent processing by later hooks. -function chainHooks(...hooks) { - if (hooks.length === 0) { - return null; - } - if (hooks.length === 1) { - return hooks[0]; - } - const serverHook = { - requestReceived(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestReceived) { - continue; - } - yield hook.requestReceived(ctx); - } - }); - }, - requestPrepared(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestPrepared) { - continue; - } - console.warn("hook requestPrepared is deprecated and will be removed in the next release. " + - "Please use responsePrepared instead."); - yield hook.requestPrepared(ctx); - } - }); - }, - responsePrepared(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.responsePrepared) { - continue; - } - yield hook.responsePrepared(ctx); - } - }); - }, - requestSent(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestSent) { - continue; - } - console.warn("hook requestSent is deprecated and will be removed in the next release. " + - "Please use responseSent instead."); - yield hook.requestSent(ctx); - } - }); - }, - responseSent(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.responseSent) { - continue; - } - yield hook.responseSent(ctx); - } - }); - }, - requestRouted(ctx) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.requestRouted) { - continue; - } - yield hook.requestRouted(ctx); - } - }); - }, - error(ctx, err) { - return __awaiter(this, void 0, void 0, function* () { - for (const hook of hooks) { - if (!hook.error) { - continue; - } - yield hook.error(ctx, err); - } - }); - }, - }; - return serverHook; -} -exports.chainHooks = chainHooks; -function isHook(object) { - return ("requestReceived" in object || - "requestPrepared" in object || - "requestSent" in object || - "requestRouted" in object || - "responsePrepared" in object || - "responseSent" in object || - "error" in object); -} -exports.isHook = isHook; - - -/***/ }), - -/***/ 94091: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__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 = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.FetchRPC = exports.wrapErrorResponseToTwirpError = exports.NodeHttpRPC = void 0; -const http = __importStar(__nccwpck_require__(13685)); -const https = __importStar(__nccwpck_require__(95687)); -const url_1 = __nccwpck_require__(57310); -const errors_1 = __nccwpck_require__(66647); -/** - * a node HTTP RPC implementation - * @param options - * @constructor - */ -const NodeHttpRPC = (options) => ({ - request(service, method, contentType, data) { - let client; - return new Promise((resolve, rejected) => { - const responseChunks = []; - const requestData = contentType === "application/protobuf" - ? Buffer.from(data) - : JSON.stringify(data); - const url = new url_1.URL(options.baseUrl); - const isHttps = url.protocol === "https:"; - if (isHttps) { - client = https; - } - else { - client = http; - } - const prefix = url.pathname !== "/" ? url.pathname : ""; - const req = client - .request(Object.assign(Object.assign({}, (options ? options : {})), { method: "POST", protocol: url.protocol, host: url.hostname, port: url.port ? url.port : isHttps ? 443 : 80, path: `${prefix}/${service}/${method}`, headers: Object.assign(Object.assign({}, (options.headers ? options.headers : {})), { "Content-Type": contentType, "Content-Length": contentType === "application/protobuf" - ? Buffer.byteLength(requestData) - : Buffer.from(requestData).byteLength }) }), (res) => { - res.on("data", (chunk) => responseChunks.push(chunk)); - res.on("end", () => { - const data = Buffer.concat(responseChunks); - if (res.statusCode != 200) { - rejected(wrapErrorResponseToTwirpError(data.toString())); - } - else { - if (contentType === "application/json") { - resolve(JSON.parse(data.toString())); - } - else { - resolve(data); - } - } - }); - res.on("error", (err) => { - rejected(err); - }); - }) - .on("error", (err) => { - rejected(err); - }); - req.end(requestData); - }); - }, -}); -exports.NodeHttpRPC = NodeHttpRPC; -function wrapErrorResponseToTwirpError(errorResponse) { - return errors_1.TwirpError.fromObject(JSON.parse(errorResponse)); -} -exports.wrapErrorResponseToTwirpError = wrapErrorResponseToTwirpError; -/** - * a browser fetch RPC implementation - */ -const FetchRPC = (options) => ({ - request(service, method, contentType, data) { - return __awaiter(this, void 0, void 0, function* () { - const headers = new Headers(options.headers); - headers.set("content-type", contentType); - const response = yield fetch(`${options.baseUrl}/${service}/${method}`, Object.assign(Object.assign({}, options), { method: "POST", headers, body: data instanceof Uint8Array ? data : JSON.stringify(data) })); - if (response.status === 200) { - if (contentType === "application/json") { - return yield response.json(); - } - return new Uint8Array(yield response.arrayBuffer()); - } - throw errors_1.TwirpError.fromObject(yield response.json()); - }); - }, -}); -exports.FetchRPC = FetchRPC; - - -/***/ }), - -/***/ 66465: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TwirpContentType = void 0; -__exportStar(__nccwpck_require__(31524), exports); -__exportStar(__nccwpck_require__(26604), exports); -__exportStar(__nccwpck_require__(48913), exports); -__exportStar(__nccwpck_require__(4263), exports); -__exportStar(__nccwpck_require__(66647), exports); -__exportStar(__nccwpck_require__(56748), exports); -__exportStar(__nccwpck_require__(94091), exports); -var request_1 = __nccwpck_require__(8347); -Object.defineProperty(exports, "TwirpContentType", ({ enumerable: true, get: function () { return request_1.TwirpContentType; } })); - - -/***/ }), - -/***/ 48913: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.chainInterceptors = void 0; -// chains multiple Interceptors into a single Interceptor. -// The first interceptor wraps the second one, and so on. -// Returns null if interceptors is empty. -function chainInterceptors(...interceptors) { - if (interceptors.length === 0) { - return; - } - if (interceptors.length === 1) { - return interceptors[0]; - } - const first = interceptors[0]; - return (ctx, request, handler) => __awaiter(this, void 0, void 0, function* () { - let next = handler; - for (let i = interceptors.length - 1; i > 0; i--) { - next = ((next) => (ctx, typedRequest) => { - return interceptors[i](ctx, typedRequest, next); - })(next); - } - return first(ctx, request, next); - }); -} -exports.chainInterceptors = chainInterceptors; - - -/***/ }), - -/***/ 8347: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.parseTwirpPath = exports.getRequestData = exports.validateRequest = exports.getContentType = exports.TwirpContentType = void 0; -const errors_1 = __nccwpck_require__(66647); -/** - * Supported Twirp Content-Type - */ -var TwirpContentType; -(function (TwirpContentType) { - TwirpContentType[TwirpContentType["Protobuf"] = 0] = "Protobuf"; - TwirpContentType[TwirpContentType["JSON"] = 1] = "JSON"; - TwirpContentType[TwirpContentType["Unknown"] = 2] = "Unknown"; -})(TwirpContentType = exports.TwirpContentType || (exports.TwirpContentType = {})); -/** - * Get supported content-type - * @param mimeType - */ -function getContentType(mimeType) { - switch (mimeType) { - case "application/protobuf": - return TwirpContentType.Protobuf; - case "application/json": - return TwirpContentType.JSON; - default: - return TwirpContentType.Unknown; - } -} -exports.getContentType = getContentType; -/** - * Validate a twirp request - * @param ctx - * @param request - * @param pathPrefix - */ -function validateRequest(ctx, request, pathPrefix) { - if (request.method !== "POST") { - const msg = `unsupported method ${request.method} (only POST is allowed)`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - const path = parseTwirpPath(request.url || ""); - if (path.pkgService !== - (ctx.packageName ? ctx.packageName + "." : "") + ctx.serviceName) { - const msg = `no handler for path ${request.url}`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - if (path.prefix !== pathPrefix) { - const msg = `invalid path prefix ${path.prefix}, expected ${pathPrefix}, on path ${request.url}`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - const mimeContentType = request.headers["content-type"] || ""; - if (ctx.contentType === TwirpContentType.Unknown) { - const msg = `unexpected Content-Type: ${request.headers["content-type"]}`; - throw new errors_1.BadRouteError(msg, request.method || "", request.url || ""); - } - return Object.assign(Object.assign({}, path), { mimeContentType, contentType: ctx.contentType }); -} -exports.validateRequest = validateRequest; -/** - * Get request data from the body - * @param req - */ -function getRequestData(req) { - return new Promise((resolve, reject) => { - const reqWithRawBody = req; - if (reqWithRawBody.rawBody instanceof Buffer) { - resolve(reqWithRawBody.rawBody); - return; - } - const chunks = []; - req.on("data", (chunk) => chunks.push(chunk)); - req.on("end", () => __awaiter(this, void 0, void 0, function* () { - const data = Buffer.concat(chunks); - resolve(data); - })); - req.on("error", (err) => { - if (req.aborted) { - reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.DeadlineExceeded, "failed to read request: deadline exceeded")); - } - else { - reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, err.message).withCause(err)); - } - }); - req.on("close", () => { - reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Canceled, "failed to read request: context canceled")); - }); - }); -} -exports.getRequestData = getRequestData; -/** - * Parses twirp url path - * @param path - */ -function parseTwirpPath(path) { - const parts = path.split("/"); - if (parts.length < 2) { - return { - pkgService: "", - method: "", - prefix: "", - }; - } - return { - method: parts[parts.length - 1], - pkgService: parts[parts.length - 2], - prefix: parts.slice(0, parts.length - 2).join("/"), - }; -} -exports.parseTwirpPath = parseTwirpPath; - - -/***/ }), - -/***/ 26604: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __awaiter = (this && this.__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(exports, "__esModule", ({ value: true })); -exports.writeError = exports.TwirpServer = void 0; -const hooks_1 = __nccwpck_require__(4263); -const request_1 = __nccwpck_require__(8347); -const errors_1 = __nccwpck_require__(66647); -/** - * Runtime server implementation of a TwirpServer - */ -class TwirpServer { - constructor(options) { - this.pathPrefix = "/twirp"; - this.hooks = []; - this.interceptors = []; - this.packageName = options.packageName; - this.serviceName = options.serviceName; - this.methodList = options.methodList; - this.matchRoute = options.matchRoute; - this.service = options.service; - } - /** - * Returns the prefix for this server - */ - get prefix() { - return this.pathPrefix; - } - /** - * The http handler for twirp complaint endpoints - * @param options - */ - httpHandler(options) { - return (req, resp) => { - // setup prefix - if ((options === null || options === void 0 ? void 0 : options.prefix) !== undefined) { - this.withPrefix(options.prefix); - } - return this._httpHandler(req, resp); - }; - } - /** - * Adds interceptors or hooks to the request stack - * @param middlewares - */ - use(...middlewares) { - middlewares.forEach((middleware) => { - if (hooks_1.isHook(middleware)) { - this.hooks.push(middleware); - return this; - } - this.interceptors.push(middleware); - }); - return this; - } - /** - * Adds a prefix to the service url path - * @param prefix - */ - withPrefix(prefix) { - if (prefix === false) { - this.pathPrefix = ""; - } - else { - this.pathPrefix = prefix; - } - return this; - } - /** - * Returns the regex matching path for this twirp server - */ - matchingPath() { - const baseRegex = this.baseURI().replace(/\./g, "\\."); - return new RegExp(`${baseRegex}\/(${this.methodList.join("|")})`); - } - /** - * Returns the base URI for this twirp server - */ - baseURI() { - return `${this.pathPrefix}/${this.packageName ? this.packageName + "." : ""}${this.serviceName}`; - } - /** - * Create a twirp context - * @param req - * @param res - * @private - */ - createContext(req, res) { - return { - packageName: this.packageName, - serviceName: this.serviceName, - methodName: "", - contentType: request_1.getContentType(req.headers["content-type"]), - req: req, - res: res, - }; - } - /** - * Twrip server http handler implementation - * @param req - * @param resp - * @private - */ - _httpHandler(req, resp) { - return __awaiter(this, void 0, void 0, function* () { - const ctx = this.createContext(req, resp); - try { - yield this.invokeHook("requestReceived", ctx); - const { method, mimeContentType } = request_1.validateRequest(ctx, req, this.pathPrefix || ""); - const handler = this.matchRoute(method, { - onMatch: (ctx) => { - return this.invokeHook("requestRouted", ctx); - }, - onNotFound: () => { - const msg = `no handler for path ${req.url}`; - throw new errors_1.BadRouteError(msg, req.method || "", req.url || ""); - }, - }); - const body = yield request_1.getRequestData(req); - const response = yield handler(ctx, this.service, body, this.interceptors); - yield Promise.all([ - this.invokeHook("responsePrepared", ctx), - // keep backwards compatibility till next release - this.invokeHook("requestPrepared", ctx), - ]); - resp.statusCode = 200; - resp.setHeader("Content-Type", mimeContentType); - resp.end(response); - } - catch (e) { - yield this.invokeHook("error", ctx, mustBeTwirpError(e)); - if (!resp.headersSent) { - writeError(resp, e); - } - } - finally { - yield Promise.all([ - this.invokeHook("responseSent", ctx), - // keep backwards compatibility till next release - this.invokeHook("requestSent", ctx), - ]); - } - }); - } - /** - * Invoke a hook - * @param hookName - * @param ctx - * @param err - * @protected - */ - invokeHook(hookName, ctx, err) { - return __awaiter(this, void 0, void 0, function* () { - if (this.hooks.length === 0) { - return; - } - const chainedHooks = hooks_1.chainHooks(...this.hooks); - const hook = chainedHooks === null || chainedHooks === void 0 ? void 0 : chainedHooks[hookName]; - if (hook) { - yield hook(ctx, err || new errors_1.InternalServerError("internal server error")); - } - }); - } -} -exports.TwirpServer = TwirpServer; -/** - * Write http error response - * @param res - * @param error - */ -function writeError(res, error) { - const twirpError = mustBeTwirpError(error); - res.setHeader("Content-Type", "application/json"); - res.statusCode = errors_1.httpStatusFromErrorCode(twirpError.code); - res.end(twirpError.toJSON()); -} -exports.writeError = writeError; -/** - * Make sure that the error passed is a TwirpError - * otherwise it will wrap it into an InternalError - * @param err - */ -function mustBeTwirpError(err) { - if (err instanceof errors_1.TwirpError) { - return err; - } - return new errors_1.InternalServerErrorWith(err); -} - - /***/ }), /***/ 41773: @@ -137638,7 +135493,7 @@ module.exports = index; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.2.1","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); +module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.2.2","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); /***/ }), diff --git a/package-lock.json b/package-lock.json index c2f35ae..e6d252e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "upload-artifact", - "version": "4.5.0", + "version": "4.6.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "upload-artifact", - "version": "4.5.0", + "version": "4.6.1", "license": "MIT", "dependencies": { - "@actions/artifact": "^2.2.1", + "@actions/artifact": "^2.2.2", "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", "@actions/glob": "^0.5.0", @@ -34,9 +34,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.2.1.tgz", - "integrity": "sha512-V2cvKJ+Evg2n9Mcqz7kjbY2s0nd9MsBI2rw2E38pSEMv+Coo4i1sX0lyGcgSn1zyfVtmLwAI9LfuSptWF8PdaA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.2.2.tgz", + "integrity": "sha512-UtS1kcINiPRkI3/hDKkO/XdrtKo89kn8s81J67QNBU6RRMWSSXrrfCCbQVThuxcdW2boOLv51NVCEKyo954A2A==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -49,7 +49,6 @@ "@protobuf-ts/plugin": "^2.2.3-alpha.1", "archiver": "^7.0.1", "jwt-decode": "^3.1.2", - "twirp-ts": "^2.5.0", "unzip-stream": "^0.3.1" } }, @@ -1955,14 +1954,14 @@ } }, "node_modules/@protobuf-ts/plugin": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.3.tgz", - "integrity": "sha512-tHYACv+nnIV2eoiMxeZhrgMqGiUktzUzrhfgnROg/rr8TecPLp9v5/yqNibN+bad5k7d57aqlTuQKhFl+J4W/g==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz", + "integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==", "dependencies": { - "@protobuf-ts/plugin-framework": "^2.9.3", - "@protobuf-ts/protoc": "^2.9.3", - "@protobuf-ts/runtime": "^2.9.3", - "@protobuf-ts/runtime-rpc": "^2.9.3", + "@protobuf-ts/plugin-framework": "^2.9.4", + "@protobuf-ts/protoc": "^2.9.4", + "@protobuf-ts/runtime": "^2.9.4", + "@protobuf-ts/runtime-rpc": "^2.9.4", "typescript": "^3.9" }, "bin": { @@ -1971,11 +1970,11 @@ } }, "node_modules/@protobuf-ts/plugin-framework": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.3.tgz", - "integrity": "sha512-iqdkhAu7fGPvBCVOoAEEFJ1/oaGIBoNIMgSv2WonTNJVHxv5FvvAfWFn6nG/eta34fHRZT38ZXTaYcMUkv8AiQ==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz", + "integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==", "dependencies": { - "@protobuf-ts/runtime": "^2.9.3", + "@protobuf-ts/runtime": "^2.9.4", "typescript": "^3.9" } }, @@ -2004,24 +2003,24 @@ } }, "node_modules/@protobuf-ts/protoc": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.3.tgz", - "integrity": "sha512-TJ0Ycx/CIBqpB4wpKt6K05kjXj6zv36s/qpdCT/wdJBhpayOVBqLF5NpLp3WIiw1PmIxvqalB6QHKjvnLzGKLA==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz", + "integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ==", "bin": { "protoc": "protoc.js" } }, "node_modules/@protobuf-ts/runtime": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.3.tgz", - "integrity": "sha512-nivzCpg/qYD0RX2OmHOahJALb8ndjGmUhNBcTJ0BbXoqKwCSM6vYA+vegzS3rhuaPgbyC7Ec8idlnizzUfIRuw==" + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz", + "integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==" }, "node_modules/@protobuf-ts/runtime-rpc": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.3.tgz", - "integrity": "sha512-WelHpctvZeG8yhbb7tnsrLzotq9xjMCXuGuhJ8qMyEdNoBBEodbXseofAYFTebo2/PN2LzyEq3X6vwr5f8jqTA==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz", + "integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==", "dependencies": { - "@protobuf-ts/runtime": "^2.9.3" + "@protobuf-ts/runtime": "^2.9.4" } }, "node_modules/@sinclair/typebox": { @@ -2968,15 +2967,6 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, - "node_modules/camel-case": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", - "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dependencies": { - "pascal-case": "^3.1.2", - "tslib": "^2.0.3" - } - }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -3113,14 +3103,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "engines": { - "node": ">= 6" - } - }, "node_modules/compress-commons": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", @@ -3363,57 +3345,6 @@ "esutils": "^2.0.2" } }, - "node_modules/dot-object": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.4.tgz", - "integrity": "sha512-7FXnyyCLFawNYJ+NhkqyP9Wd2yzuo+7n9pGiYpkmXCTYa8Ci2U0eUNDVg5OuO5Pm6aFXI2SWN8/N/w7SJWu1WA==", - "dependencies": { - "commander": "^4.0.0", - "glob": "^7.1.5" - }, - "bin": { - "dot-object": "bin/dot-object" - } - }, - "node_modules/dot-object/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/dot-object/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/dot-object/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -4375,7 +4306,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "node_modules/fsevents": { "version": "2.3.2", @@ -4769,6 +4701,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -6032,14 +5965,6 @@ "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", "dev": true }, - "node_modules/lower-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", - "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dependencies": { - "tslib": "^2.0.3" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -6204,15 +6129,6 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, - "node_modules/no-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", - "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -6406,15 +6322,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pascal-case": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", - "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -6428,6 +6335,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -6466,12 +6374,6 @@ "node": "14 || >=16.14" } }, - "node_modules/path-to-regexp": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", - "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", - "license": "MIT" - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -6576,6 +6478,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz", "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==", + "dev": true, "bin": { "prettier": "bin-prettier.js" }, @@ -7421,15 +7324,6 @@ } } }, - "node_modules/ts-poet": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-4.15.0.tgz", - "integrity": "sha512-sLLR8yQBvHzi9d4R1F4pd+AzQxBfzOSSjfxiJxQhkUoH5bL7RsAC6wgvtVUQdGqiCsyS9rT6/8X2FI7ipdir5g==", - "dependencies": { - "lodash": "^4.17.15", - "prettier": "^2.5.1" - } - }, "node_modules/tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -7497,34 +7391,6 @@ "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "node_modules/twirp-ts": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/twirp-ts/-/twirp-ts-2.5.0.tgz", - "integrity": "sha512-JTKIK5Pf/+3qCrmYDFlqcPPUx+ohEWKBaZy8GL8TmvV2VvC0SXVyNYILO39+GCRbqnuP6hBIF+BVr8ZxRz+6fw==", - "dependencies": { - "@protobuf-ts/plugin-framework": "^2.0.7", - "camel-case": "^4.1.2", - "dot-object": "^2.1.4", - "path-to-regexp": "^6.2.0", - "ts-poet": "^4.5.0", - "yaml": "^1.10.2" - }, - "bin": { - "protoc-gen-twirp_ts": "protoc-gen-twirp_ts" - }, - "peerDependencies": { - "@protobuf-ts/plugin": "^2.5.0", - "ts-proto": "^1.81.3" - }, - "peerDependenciesMeta": { - "@protobuf-ts/plugin": { - "optional": true - }, - "ts-proto": { - "optional": true - } - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -7845,14 +7711,6 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "engines": { - "node": ">= 6" - } - }, "node_modules/yargs": { "version": "17.6.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", @@ -7908,9 +7766,9 @@ }, "dependencies": { "@actions/artifact": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.2.1.tgz", - "integrity": "sha512-V2cvKJ+Evg2n9Mcqz7kjbY2s0nd9MsBI2rw2E38pSEMv+Coo4i1sX0lyGcgSn1zyfVtmLwAI9LfuSptWF8PdaA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.2.2.tgz", + "integrity": "sha512-UtS1kcINiPRkI3/hDKkO/XdrtKo89kn8s81J67QNBU6RRMWSSXrrfCCbQVThuxcdW2boOLv51NVCEKyo954A2A==", "requires": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", @@ -7923,7 +7781,6 @@ "@protobuf-ts/plugin": "^2.2.3-alpha.1", "archiver": "^7.0.1", "jwt-decode": "^3.1.2", - "twirp-ts": "^2.5.0", "unzip-stream": "^0.3.1" }, "dependencies": { @@ -9445,14 +9302,14 @@ "optional": true }, "@protobuf-ts/plugin": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.3.tgz", - "integrity": "sha512-tHYACv+nnIV2eoiMxeZhrgMqGiUktzUzrhfgnROg/rr8TecPLp9v5/yqNibN+bad5k7d57aqlTuQKhFl+J4W/g==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz", + "integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==", "requires": { - "@protobuf-ts/plugin-framework": "^2.9.3", - "@protobuf-ts/protoc": "^2.9.3", - "@protobuf-ts/runtime": "^2.9.3", - "@protobuf-ts/runtime-rpc": "^2.9.3", + "@protobuf-ts/plugin-framework": "^2.9.4", + "@protobuf-ts/protoc": "^2.9.4", + "@protobuf-ts/runtime": "^2.9.4", + "@protobuf-ts/runtime-rpc": "^2.9.4", "typescript": "^3.9" }, "dependencies": { @@ -9464,11 +9321,11 @@ } }, "@protobuf-ts/plugin-framework": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.3.tgz", - "integrity": "sha512-iqdkhAu7fGPvBCVOoAEEFJ1/oaGIBoNIMgSv2WonTNJVHxv5FvvAfWFn6nG/eta34fHRZT38ZXTaYcMUkv8AiQ==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz", + "integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==", "requires": { - "@protobuf-ts/runtime": "^2.9.3", + "@protobuf-ts/runtime": "^2.9.4", "typescript": "^3.9" }, "dependencies": { @@ -9480,21 +9337,21 @@ } }, "@protobuf-ts/protoc": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.3.tgz", - "integrity": "sha512-TJ0Ycx/CIBqpB4wpKt6K05kjXj6zv36s/qpdCT/wdJBhpayOVBqLF5NpLp3WIiw1PmIxvqalB6QHKjvnLzGKLA==" + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz", + "integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ==" }, "@protobuf-ts/runtime": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.3.tgz", - "integrity": "sha512-nivzCpg/qYD0RX2OmHOahJALb8ndjGmUhNBcTJ0BbXoqKwCSM6vYA+vegzS3rhuaPgbyC7Ec8idlnizzUfIRuw==" + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz", + "integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==" }, "@protobuf-ts/runtime-rpc": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.3.tgz", - "integrity": "sha512-WelHpctvZeG8yhbb7tnsrLzotq9xjMCXuGuhJ8qMyEdNoBBEodbXseofAYFTebo2/PN2LzyEq3X6vwr5f8jqTA==", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz", + "integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==", "requires": { - "@protobuf-ts/runtime": "^2.9.3" + "@protobuf-ts/runtime": "^2.9.4" } }, "@sinclair/typebox": { @@ -10194,15 +10051,6 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, - "camel-case": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", - "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "requires": { - "pascal-case": "^3.1.2", - "tslib": "^2.0.3" - } - }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -10295,11 +10143,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" - }, "compress-commons": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", @@ -10475,47 +10318,6 @@ "esutils": "^2.0.2" } }, - "dot-object": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.4.tgz", - "integrity": "sha512-7FXnyyCLFawNYJ+NhkqyP9Wd2yzuo+7n9pGiYpkmXCTYa8Ci2U0eUNDVg5OuO5Pm6aFXI2SWN8/N/w7SJWu1WA==", - "requires": { - "commander": "^4.0.0", - "glob": "^7.1.5" - }, - "dependencies": { - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "requires": { - "brace-expansion": "^1.1.7" - } - } - } - }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -11276,7 +11078,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "2.3.2", @@ -11543,6 +11346,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -12508,14 +12312,6 @@ "integrity": "sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==", "dev": true }, - "lower-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", - "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "requires": { - "tslib": "^2.0.3" - } - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -12642,15 +12438,6 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, - "no-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", - "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "requires": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, "node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -12782,15 +12569,6 @@ "lines-and-columns": "^1.1.6" } }, - "pascal-case": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", - "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "requires": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -12800,7 +12578,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true }, "path-key": { "version": "3.1.1", @@ -12829,11 +12608,6 @@ } } }, - "path-to-regexp": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", - "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==" - }, "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -12909,7 +12683,8 @@ "prettier": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz", - "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==" + "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==", + "dev": true }, "prettier-linter-helpers": { "version": "1.0.0", @@ -13526,15 +13301,6 @@ "yargs-parser": "^21.0.1" } }, - "ts-poet": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-4.15.0.tgz", - "integrity": "sha512-sLLR8yQBvHzi9d4R1F4pd+AzQxBfzOSSjfxiJxQhkUoH5bL7RsAC6wgvtVUQdGqiCsyS9rT6/8X2FI7ipdir5g==", - "requires": { - "lodash": "^4.17.15", - "prettier": "^2.5.1" - } - }, "tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -13591,19 +13357,6 @@ "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, - "twirp-ts": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/twirp-ts/-/twirp-ts-2.5.0.tgz", - "integrity": "sha512-JTKIK5Pf/+3qCrmYDFlqcPPUx+ohEWKBaZy8GL8TmvV2VvC0SXVyNYILO39+GCRbqnuP6hBIF+BVr8ZxRz+6fw==", - "requires": { - "@protobuf-ts/plugin-framework": "^2.0.7", - "camel-case": "^4.1.2", - "dot-object": "^2.1.4", - "path-to-regexp": "^6.2.0", - "ts-poet": "^4.5.0", - "yaml": "^1.10.2" - } - }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -13841,11 +13594,6 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" - }, "yargs": { "version": "17.6.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", diff --git a/package.json b/package.json index 511cc95..68072a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "upload-artifact", - "version": "4.5.0", + "version": "4.6.1", "description": "Upload an Actions Artifact in a workflow run", "main": "dist/upload/index.js", "scripts": { @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/actions/upload-artifact#readme", "dependencies": { - "@actions/artifact": "^2.2.1", + "@actions/artifact": "^2.2.2", "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", "@actions/glob": "^0.5.0", From e9fad966ccdffceea5de0445882c9455934bcf8e Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Fri, 21 Feb 2025 13:16:50 -0500 Subject: [PATCH 2/2] license cache update for artifact --- .licenses/npm/@actions/artifact.dep.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.licenses/npm/@actions/artifact.dep.yml b/.licenses/npm/@actions/artifact.dep.yml index 6fbfbca..33a2153 100644 --- a/.licenses/npm/@actions/artifact.dep.yml +++ b/.licenses/npm/@actions/artifact.dep.yml @@ -1,6 +1,6 @@ --- name: "@actions/artifact" -version: 2.2.1 +version: 2.2.2 type: npm summary: Actions artifact lib homepage: https://github.com/actions/toolkit/tree/main/packages/artifact