mirror of
https://github.com/ryanccn/attic-action.git
synced 2024-11-20 06:24:16 +00:00
29 lines
248 KiB
JavaScript
29 lines
248 KiB
JavaScript
|
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_utils=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/utils.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.toCommandProperties=exports.toCommandValue=void 0;function toCommandValue(input){return input==null?"":typeof input=="string"||input instanceof String?input:JSON.stringify(input)}exports.toCommandValue=toCommandValue;function toCommandProperties(annotationProperties){return Object.keys(annotationProperties).length?{title:annotationProperties.title,file:annotationProperties.file,line:annotationProperties.startLine,endLine:annotationProperties.endLine,col:annotationProperties.startColumn,endColumn:annotationProperties.endColumn}:{}}exports.toCommandProperties=toCommandProperties}});var require_command=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/command.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result};Object.defineProperty(exports,"__esModule",{value:!0});exports.issue=exports.issueCommand=void 0;var os=__importStar(require("os")),utils_1=require_utils();function issueCommand(command,properties,message){let cmd=new Command(command,properties,message);process.stdout.write(cmd.toString()+os.EOL)}exports.issueCommand=issueCommand;function issue(name,message=""){issueCommand(name,{},message)}exports.issue=issue;var CMD_STRING="::",Command=class{constructor(command,properties,message){command||(command="missing.command"),this.command=command,this.properties=properties,this.message=message}toString(){let cmdStr=CMD_STRING+this.command;if(this.properties&&Object.keys(this.properties).length>0){cmdStr+=" ";let first=!0;for(let key in this.properties)if(this.properties.hasOwnProperty(key)){let val=this.properties[key];val&&(first?first=!1:cmdStr+=",",cmdStr+=`${key}=${escapeProperty(val)}`)}}return cmdStr+=`${CMD_STRING}${escapeData(this.message)}`,cmdStr}};function escapeData(s2){return utils_1.toCommandValue(s2).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(s2){return utils_1.toCommandValue(s2).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}}});function rng(){return poolPtr>rnds8Pool.length-16&&(import_crypto.default.randomFillSync(rnds8Pool),poolPtr=
|
||
|
`,cause.message,cause.stack);var error=new Error("tunneling socket could not be established, cause="+cause.message);error.code="ECONNRESET",options.request.emit("error",error),self2.removeSocket(placeholder)}};TunnelingAgent.prototype.removeSocket=function(socket){var pos=this.sockets.indexOf(socket);if(pos!==-1){this.sockets.splice(pos,1);var pending=this.requests.shift();pending&&this.createSocket(pending,function(socket2){pending.request.onSocket(socket2)})}};function createSecureSocket(options,cb){var self2=this;TunnelingAgent.prototype.createSocket.call(self2,options,function(socket){var hostHeader=options.request.getHeader("host"),tlsOptions=mergeOptions({},self2.options,{socket,servername:hostHeader?hostHeader.replace(/:.*$/,""):options.host}),secureSocket=tls.connect(0,tlsOptions);self2.sockets[self2.sockets.indexOf(socket)]=secureSocket,cb(secureSocket)})}function toOptions(host,port,localAddress){return typeof host=="string"?{host,port,localAddress}:host}function mergeOptions(target){for(var i2=1,len=arguments.length;i2<len;++i2){var overrides=arguments[i2];if(typeof overrides=="object")for(var keys=Object.keys(overrides),j=0,keyLen=keys.length;j<keyLen;++j){var k=keys[j];overrides[k]!==void 0&&(target[k]=overrides[k])}}return target}var debug;process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?debug=function(){var args=Array.prototype.slice.call(arguments);typeof args[0]=="string"?args[0]="TUNNEL: "+args[0]:args.unshift("TUNNEL:"),console.error.apply(console,args)}:debug=function(){};exports.debug=debug}});var require_tunnel2=__commonJS({"node_modules/.pnpm/tunnel@0.0.6/node_modules/tunnel/index.js"(exports,module2){module2.exports=require_tunnel()}});var require_lib=__commonJS({"node_modules/.pnpm/@actions+http-client@2.1.0/node_modules/@actions/http-client/lib/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__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(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}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:!0});exports.HttpClient=exports.isHttps=exports.HttpClientResponse=exports.HttpClientError=exports.getProxyUrl=exports.MediaTypes=exports.Headers=exports.HttpCodes=void 0;var http3=__importStar(require("http")),https3=__importStar(require("https")),pm=__importStar(require_proxy()),tunnel=__importStar(require_tunnel2()),HttpCodes;(function(HttpCodes2){HttpCodes2[HttpCodes2.OK=200]="OK",HttpCodes2[HttpCodes2.MultipleChoices=300]="MultipleChoices",HttpCodes2[HttpCodes2.MovedPermanently=301]="MovedPermanently",HttpCodes2[HttpCodes2.ResourceMoved=302]="ResourceMoved",HttpCodes2[HttpCodes2.SeeOther=303]="SeeOther",HttpCodes2[HttpCodes2.NotModified=304]="NotModified",HttpCodes2[HttpCodes2.UseProxy=305]="UseProxy",HttpCodes2[HttpCodes2.SwitchProxy=306]="SwitchProxy",HttpCodes2[HttpCodes2.TemporaryRedirect=307]="TemporaryRedirect",HttpCodes2[HttpCodes2.PermanentRedirect=308]="PermanentRedirect",HttpCodes2[HttpCodes2.BadRequest=400]="BadRequest",HttpCodes2[HttpCod
|
||
|
|
||
|
Error Code : ${error.statusCode}
|
||
|
|
||
|
Error Message: ${error.result.message}`)})).result)===null||_a===void 0?void 0:_a.value;if(!id_token)throw new Error("Response json body do not have ID Token field");return id_token})}static getIDToken(audience){return __awaiter(this,void 0,void 0,function*(){try{let id_token_url=_OidcClient.getIDTokenUrl();if(audience){let encodedAudience=encodeURIComponent(audience);id_token_url=`${id_token_url}&audience=${encodedAudience}`}core_1.debug(`ID token url is ${id_token_url}`);let id_token=yield _OidcClient.getCall(id_token_url);return core_1.setSecret(id_token),id_token}catch(error){throw new Error(`Error message: ${error.message}`)}})}};exports.OidcClient=OidcClient}});var require_summary=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/summary.js"(exports){"use strict";var __awaiter=exports&&exports.__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(e2){reject(e2)}}function rejected(value){try{step(generator.throw(value))}catch(e2){reject(e2)}}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:!0});exports.summary=exports.markdownSummary=exports.SUMMARY_DOCS_URL=exports.SUMMARY_ENV_VAR=void 0;var os_1=require("os"),fs_1=require("fs"),{access,appendFile,writeFile:writeFile2}=fs_1.promises;exports.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";exports.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Summary=class{constructor(){this._buffer=""}filePath(){return __awaiter(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let pathFromEnv=process.env[exports.SUMMARY_ENV_VAR];if(!pathFromEnv)throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield access(pathFromEnv,fs_1.constants.R_OK|fs_1.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`)}return this._filePath=pathFromEnv,this._filePath})}wrap(tag,content,attrs={}){let htmlAttrs=Object.entries(attrs).map(([key,value])=>` ${key}="${value}"`).join("");return content?`<${tag}${htmlAttrs}>${content}</${tag}>`:`<${tag}${htmlAttrs}>`}write(options){return __awaiter(this,void 0,void 0,function*(){let overwrite=!!options?.overwrite,filePath=yield this.filePath();return yield(overwrite?writeFile2:appendFile)(filePath,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return __awaiter(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(text,addEOL=!1){return this._buffer+=text,addEOL?this.addEOL():this}addEOL(){return this.addRaw(os_1.EOL)}addCodeBlock(code,lang){let attrs=Object.assign({},lang&&{lang}),element=this.wrap("pre",this.wrap("code",code),attrs);return this.addRaw(element).addEOL()}addList(items,ordered=!1){let tag=ordered?"ol":"ul",listItems=items.map(item=>this.wrap("li",item)).join(""),element=this.wrap(tag,listItems);return this.addRaw(element).addEOL()}addTable(rows){let tableBody=rows.map(row=>{let cells=row.map(cell=>{if(typeof cell=="string")return this.wrap("td",cell);let{header,data,colspan,rowspan}=cell,tag=header?"th":"td",attrs=Object.assign(Object.assign({},colspan&&{colspan}),rowspan&&{rowspan});return this.wrap(tag,data,attrs)}).join("");return this.wrap("tr",cells)}).join(""),element=this.wrap("table",tableBody);return this.addRaw(element).addEOL()}addDetails(label,content){let element=this.wrap("details",this.wrap("summary",label)+content);return this.addRaw(element).addEOL()}addImage(src,alt,options
|
||
|
`).filter(x2=>x2!=="");return options&&options.trimWhitespace===!1?inputs:inputs.map(input=>input.trim())}exports.getMultilineInput=getMultilineInput;function getBooleanInput(name,options){let trueValue=["true","True","TRUE"],falseValue=["false","False","FALSE"],val=getInput2(name,options);if(trueValue.includes(val))return!0;if(falseValue.includes(val))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}
|
||
|
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}exports.getBooleanInput=getBooleanInput;function setOutput(name,value){if(process.env.GITHUB_OUTPUT||"")return file_command_1.issueFileCommand("OUTPUT",file_command_1.prepareKeyValueMessage(name,value));process.stdout.write(os.EOL),command_1.issueCommand("set-output",{name},utils_1.toCommandValue(value))}exports.setOutput=setOutput;function setCommandEcho(enabled){command_1.issue("echo",enabled?"on":"off")}exports.setCommandEcho=setCommandEcho;function setFailed(message){process.exitCode=ExitCode.Failure,error(message)}exports.setFailed=setFailed;function isDebug(){return process.env.RUNNER_DEBUG==="1"}exports.isDebug=isDebug;function debug(message){command_1.issueCommand("debug",{},message)}exports.debug=debug;function error(message,properties={}){command_1.issueCommand("error",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.error=error;function warning(message,properties={}){command_1.issueCommand("warning",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.warning=warning;function notice(message,properties={}){command_1.issueCommand("notice",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.notice=notice;function info(message){process.stdout.write(message+os.EOL)}exports.info=info;function startGroup3(name){command_1.issue("group",name)}exports.startGroup=startGroup3;function endGroup3(){command_1.issue("endgroup")}exports.endGroup=endGroup3;function group(name,fn){return __awaiter(this,void 0,void 0,function*(){startGroup3(name);let result;try{result=yield fn()}finally{endGroup3()}return result})}exports.group=group;function saveState(name,value){if(process.env.GITHUB_STATE||"")return file_command_1.issueFileCommand("STATE",file_command_1.prepareKeyValueMessage(name,value));command_1.issueCommand("save-state",{name},utils_1.toCommandValue(value))}exports.saveState=saveState;function getState(name){return process.env[`STATE_${name}`]||""}exports.getState=getState;function getIDToken(aud){return __awaiter(this,void 0,void 0,function*(){return yield oidc_utils_1.OidcClient.getIDToken(aud)})}exports.getIDToken=getIDToken;var summary_1=require_summary();Object.defineProperty(exports,"summary",{enumerable:!0,get:function(){return summary_1.summary}});var summary_2=require_summary();Object.defineProperty(exports,"markdownSummary",{enumerable:!0,get:function(){return summary_2.markdownSummary}});var path_utils_1=require_path_utils();Object.defineProperty(exports,"toPosixPath",{enumerable:!0,get:function(){return path_utils_1.toPosixPath}});Object.defineProperty(exports,"toWin32Path",{enumerable:!0,get:function(){return path_utils_1.toWin32Path}});Object.defineProperty(exports,"toPlatformPath",{enumerable:!0,get:function(){return path_utils_1.toPlatformPath}})}});var require_io_util=__commonJS({"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m2,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m2[k]}})}:function(o,m2,k,k2){k2===void 0&&(k2=k),o[k2]=m2[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__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(e2){reject(e2)}}function rejected(value){try{step(generator.th
|
||
|
--`+boundary;let ui8a=new Uint8Array(boundary.length);for(let i2=0;i2<boundary.length;i2++)ui8a[i2]=boundary.charCodeAt(i2),this.boundaryChars[ui8a[i2]]=!0;this.boundary=ui8a,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=S.START_BOUNDARY}write(data){let i2=0,length_=data.length,previousIndex=this.index,{lookbehind,boundary,boundaryChars,index,state,flags}=this,boundaryLength=this.boundary.length,boundaryEnd=boundaryLength-1,bufferLength=data.length,c,cl,mark=name=>{this[name+"Mark"]=i2},clear=name=>{delete this[name+"Mark"]},callback=(callbackSymbol,start,end,ui8a)=>{(start===void 0||start!==end)&&this[callbackSymbol](ui8a&&ui8a.subarray(start,end))},dataCallback=(name,clear2)=>{let markSymbol=name+"Mark";markSymbol in this&&(clear2?(callback(name,this[markSymbol],i2,data),delete this[markSymbol]):(callback(name,this[markSymbol],data.length,data),this[markSymbol]=0))};for(i2=0;i2<length_;i2++)switch(c=data[i2],state){case S.START_BOUNDARY:if(index===boundary.length-2){if(c===HYPHEN)flags|=F.LAST_BOUNDARY;else if(c!==CR)return;index++;break}else if(index-1===boundary.length-2){if(flags&F.LAST_BOUNDARY&&c===HYPHEN)state=S.END,flags=0;else if(!(flags&F.LAST_BOUNDARY)&&c===LF)index=0,callback("onPartBegin"),state=S.HEADER_FIELD_START;else return;break}c!==boundary[index+2]&&(index=-2),c===boundary[index+2]&&index++;break;case S.HEADER_FIELD_START:state=S.HEADER_FIELD,mark("onHeaderField"),index=0;case S.HEADER_FIELD:if(c===CR){clear("onHeaderField"),state=S.HEADERS_ALMOST_DONE;break}if(index++,c===HYPHEN)break;if(c===COLON){if(index===1)return;dataCallback("onHeaderField",!0),state=S.HEADER_VALUE_START;break}if(cl=lower(c),cl<A||cl>Z)return;break;case S.HEADER_VALUE_START:if(c===SPACE)break;mark("onHeaderValue"),state=S.HEADER_VALUE;case S.HEADER_VALUE:c===CR&&(dataCallback("onHeaderValue",!0),callback("onHeaderEnd"),state=S.HEADER_VALUE_ALMOST_DONE);break;case S.HEADER_VALUE_ALMOST_DONE:if(c!==LF)return;state=S.HEADER_FIELD_START;break;case S.HEADERS_ALMOST_DONE:if(c!==LF)return;callback("onHeadersEnd"),state=S.PART_DATA_START;break;case S.PART_DATA_START:state=S.PART_DATA,mark("onPartData");case S.PART_DATA:if(previousIndex=index,index===0){for(i2+=boundaryEnd;i2<bufferLength&&!(data[i2]in boundaryChars);)i2+=boundaryLength;i2-=boundaryEnd,c=data[i2]}if(index<boundary.length)boundary[index]===c?(index===0&&dataCallback("onPartData",!0),index++):index=0;else if(index===boundary.length)index++,c===CR?flags|=F.PART_BOUNDARY:c===HYPHEN?flags|=F.LAST_BOUNDARY:index=0;else if(index-1===boundary.length)if(flags&F.PART_BOUNDARY){if(index=0,c===LF){flags&=~F.PART_BOUNDARY,callback("onPartEnd"),callback("onPartBegin"),state=S.HEADER_FIELD_START;break}}else flags&F.LAST_BOUNDARY&&c===HYPHEN?(callback("onPartEnd"),state=S.END,flags=0):index=0;if(index>0)lookbehind[index-1]=c;else if(previousIndex>0){let _lookbehind=new Uint8Array(lookbehind.buffer,lookbehind.byteOffset,lookbehind.byteLength);callback("onPartData",0,previousIndex,_lookbehind),previousIndex=0,mark("onPartData"),i2--}break;case S.END:break;default:throw new Error(`Unexpected state entered: ${state}`)}dataCallback("onHeaderField"),dataCallback("onHeaderValue"),dataCallback("onPartData"),this.index=index,this.state=state,this.flags=flags}end(){if(this.state===S.HEADER_FIELD_START&&this.index===0||this.state===S.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==S.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}}});function dataUriToBuffer(uri){if(!/^data:/i.test(uri))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');uri=uri.replace(/\r?\n/g,"");let firstComma=uri.indexOf(",");if(firstComma===-1||firstComma<=4)throw new TypeError("malformed data: URI");let meta=uri.substring(5,firstComma).split(";"),charset="",base64=!1,type=meta[0]||"text/plain",typeFull=type;for(let i2=1;i2<meta.length;i2++)meta[i2]==="base64"?base64=!0:meta[i2]&&(typeFull+=`;${meta[i2]}`,meta[i2].indexOf("charset=")===0&&(charset=meta[i2].substring(8)));!meta[0]&&!charset.length&&(typeFull+
|
||
|
Content-Disposition: form-data; name="`;return F2.forEach((v,n)=>typeof v=="string"?c.push(p+e(n)+`"\r
|
||
|
\r
|
||
|
${v.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
|
||
|
`)}\r
|
||
|
`):c.push(p+e(n)+`"; filename="${e(v.name,1)}"\r
|
||
|
Content-Type: ${v.type||"application/octet-stream"}\r
|
||
|
\r
|
||
|
`,v,`\r
|
||
|
`)),c.push(`--${b}--`),new B(c,{type:"multipart/form-data; boundary="+b})}async function consumeBody(data){if(data[INTERNALS$2].disturbed)throw new TypeError(`body used already for: ${data.url}`);if(data[INTERNALS$2].disturbed=!0,data[INTERNALS$2].error)throw data[INTERNALS$2].error;let{body}=data;if(body===null)return import_node_buffer.Buffer.alloc(0);if(!(body instanceof import_node_stream.default))return import_node_buffer.Buffer.alloc(0);let accum=[],accumBytes=0;try{for await(let chunk of body){if(data.size>0&&accumBytes+chunk.length>data.size){let error=new FetchError(`content size at ${data.url} over limit: ${data.size}`,"max-size");throw body.destroy(error),error}accumBytes+=chunk.length,accum.push(chunk)}}catch(error){throw error instanceof FetchBaseError?error:new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`,"system",error)}if(body.readableEnded===!0||body._readableState.ended===!0)try{return accum.every(c=>typeof c=="string")?import_node_buffer.Buffer.from(accum.join("")):import_node_buffer.Buffer.concat(accum,accumBytes)}catch(error){throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`,"system",error)}else throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`)}function fromRawHeaders(headers=[]){return new Headers(headers.reduce((result,value,index,array)=>(index%2===0&&result.push(array.slice(index,index+2)),result),[]).filter(([name,value])=>{try{return validateHeaderName(name),validateHeaderValue(name,String(value)),!0}catch{return!1}}))}function stripURLForUseAsAReferrer(url,originOnly=!1){return url==null||(url=new URL(url),/^(about|blob|data):$/.test(url.protocol))?"no-referrer":(url.username="",url.password="",url.hash="",originOnly&&(url.pathname="",url.search=""),url)}function validateReferrerPolicy(referrerPolicy){if(!ReferrerPolicy.has(referrerPolicy))throw new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);return referrerPolicy}function isOriginPotentiallyTrustworthy(url){if(/^(http|ws)s:$/.test(url.protocol))return!0;let hostIp=url.host.replace(/(^\[)|(]$)/g,""),hostIPVersion=(0,import_node_net.isIP)(hostIp);return hostIPVersion===4&&/^127\./.test(hostIp)||hostIPVersion===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)?!0:url.host==="localhost"||url.host.endsWith(".localhost")?!1:url.protocol==="file:"}function isUrlPotentiallyTrustworthy(url){return/^about:(blank|srcdoc)$/.test(url)||url.protocol==="data:"||/^(blob|filesystem):$/.test(url.protocol)?!0:isOriginPotentiallyTrustworthy(url)}function determineRequestsReferrer(request,{referrerURLCallback,referrerOriginCallback}={}){if(request.referrer==="no-referrer"||request.referrerPolicy==="")return null;let policy=request.referrerPolicy;if(request.referrer==="about:client")return"no-referrer";let referrerSource=request.referrer,referrerURL=stripURLForUseAsAReferrer(referrerSource),referrerOrigin=stripURLForUseAsAReferrer(referrerSource,!0);referrerURL.toString().length>4096&&(referrerURL=referrerOrigin),referrerURLCallback&&(referrerURL=referrerURLCallback(referrerURL)),referrerOriginCallback&&(referrerOrigin=referrerOriginCallback(referrerOrigin));let currentURL=new URL(request.url);switch(policy){case"no-referrer":return"no-referrer";case"origin":return referrerOrigin;case"unsafe-url":return referrerURL;case"strict-origin":return isUrlPotentiallyTrustworthy(referrerURL)&&!isUrlPotentiallyTrustworthy(currentURL)?"no-referrer":referrerOrigin.toString();case"strict-origin-when-cross-origin":return referrerURL.origin===currentURL.origin?referrerURL:isUrlPotentiallyTrustworthy(referrerURL)&&!isUrlPotentiallyTrustworthy(currentURL)?"no-referrer":referrerOrigin;case"same-origin":return referrerURL.origin===currentURL.origin?referrerURL:"no-referrer";case"origin-when-cross-origin":return referrerURL.origin===currentURL.origin?referrerURL:referrerOrigin;case"no-referrer-when-downgrade":return isUrlPotentiallyTrustworthy(referrerURL)&&!isUrlPotentiallyTrustworthy(currentURL)?"no-referrer":referrerURL;default:throw ne
|
||
|
\r
|
||
|
`),isChunkedTransfer=!1,properLastChunkReceived=!1,previousChunk;request.on("response",response=>{let{headers}=response;isChunkedTransfer=headers["transfer-encoding"]==="chunked"&&!headers["content-length"]}),request.on("socket",socket=>{let onSocketClose=()=>{if(isChunkedTransfer&&!properLastChunkReceived){let error=new Error("Premature close");error.code="ERR_STREAM_PREMATURE_CLOSE",errorCallback(error)}},onData=buf=>{properLastChunkReceived=import_node_buffer.Buffer.compare(buf.slice(-5),LAST_CHUNK)===0,!properLastChunkReceived&&previousChunk&&(properLastChunkReceived=import_node_buffer.Buffer.compare(previousChunk.slice(-3),LAST_CHUNK.slice(0,3))===0&&import_node_buffer.Buffer.compare(buf.slice(-2),LAST_CHUNK.slice(3))===0),previousChunk=buf};socket.prependListener("close",onSocketClose),socket.on("data",onData),request.on("close",()=>{socket.removeListener("close",onSocketClose),socket.removeListener("data",onData)})})}function pd(event){let retv=privateData.get(event);return console.assert(retv!=null,"'this' is expected an Event object, but got",event),retv}function setCancelFlag(data){if(data.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",data.passiveListener);return}data.event.cancelable&&(data.canceled=!0,typeof data.event.preventDefault=="function"&&data.event.preventDefault())}function Event(eventTarget,event){privateData.set(this,{eventTarget,event,eventPhase:2,currentTarget:eventTarget,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:event.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let keys=Object.keys(event);for(let i2=0;i2<keys.length;++i2){let key=keys[i2];key in this||Object.defineProperty(this,key,defineRedirectDescriptor(key))}}function defineRedirectDescriptor(key){return{get(){return pd(this).event[key]},set(value){pd(this).event[key]=value},configurable:!0,enumerable:!0}}function defineCallDescriptor(key){return{value(){let event=pd(this).event;return event[key].apply(event,arguments)},configurable:!0,enumerable:!0}}function defineWrapper(BaseEvent,proto){let keys=Object.keys(proto);if(keys.length===0)return BaseEvent;function CustomEvent(eventTarget,event){BaseEvent.call(this,eventTarget,event)}CustomEvent.prototype=Object.create(BaseEvent.prototype,{constructor:{value:CustomEvent,configurable:!0,writable:!0}});for(let i2=0;i2<keys.length;++i2){let key=keys[i2];if(!(key in BaseEvent.prototype)){let isFunc=typeof Object.getOwnPropertyDescriptor(proto,key).value=="function";Object.defineProperty(CustomEvent.prototype,key,isFunc?defineCallDescriptor(key):defineRedirectDescriptor(key))}}return CustomEvent}function getWrapper(proto){if(proto==null||proto===Object.prototype)return Event;let wrapper=wrappers.get(proto);return wrapper==null&&(wrapper=defineWrapper(getWrapper(Object.getPrototypeOf(proto)),proto),wrappers.set(proto,wrapper)),wrapper}function wrapEvent(eventTarget,event){let Wrapper=getWrapper(Object.getPrototypeOf(event));return new Wrapper(eventTarget,event)}function isStopped(event){return pd(event).immediateStopped}function setEventPhase(event,eventPhase){pd(event).eventPhase=eventPhase}function setCurrentTarget(event,currentTarget){pd(event).currentTarget=currentTarget}function setPassiveListener(event,passiveListener){pd(event).passiveListener=passiveListener}function isObject(x2){return x2!==null&&typeof x2=="object"}function getListeners(eventTarget){let listeners=listenersMap.get(eventTarget);if(listeners==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return listeners}function defineEventAttributeDescriptor(eventName){return{get(){let node=getListeners(this).get(eventName);for(;node!=null;){if(node.listenerType===ATTRIBUTE)return node.listener;node=node.next}return null},set(listener){typeof listener!="function"&&!isObject(listener)&&(listener=null);let listeners=getListeners(this),prev=null,node=listeners.get(eventName);for(;node!=null;)node.listenerType=
|
||
|
`)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(n,a,e2)=>{if(a.length<e2)throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e2} arguments required, but only ${a.length} present.`)},FormData=class{#d=[];constructor(...a){if(a.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[t](){return"FormData"}[i](){return this.entries()}static[h](o){return o&&typeof o=="object"&&o[t]==="FormData"&&!m.some(m2=>typeof o[m2]!="function")}append(...a){x("append",arguments,2),this.#d.push(f2(...a))}delete(a){x("delete",arguments,1),a+="",this.#d=this.#d.filter(([b])=>b!==a)}get(a){x("get",arguments,1),a+="";for(var b=this.#d,l=b.length,c=0;c<l;c++)if(b[c][0]===a)return b[c][1];return null}getAll(a,b){return x("getAll",arguments,1),b=[],a+="",this.#d.forEach(c=>c[0]===a&&b.push(c[1])),b}has(a){return x("has",arguments,1),a+="",this.#d.some(b=>b[0]===a)}forEach(a,b){x("forEach",arguments,1);for(var[c,d]of this)a.call(b,d,c,this)}set(...a){x("set",arguments,2);var b=[],c=!0;a=f2(...a),this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)}),c&&b.push(a),this.#d=b}*entries(){yield*this.#d}*keys(){for(var[a]of this)yield a}*values(){for(var[,a]of this)yield a}};FetchBaseError=class extends Error{constructor(message,type){super(message),Error.captureStackTrace(this,this.constructor),this.type=type}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},FetchError=class extends FetchBaseError{constructor(message,type,systemError){super(message,type),systemError&&(this.code=this.errno=systemError.code,this.erroredSysCall=systemError.syscall)}},NAME=Symbol.toStringTag,isURLSearchParameters=object=>typeof object=="object"&&typeof object.append=="function"&&typeof object.delete=="function"&&typeof object.get=="function"&&typeof object.getAll=="function"&&typeof object.has=="function"&&typeof object.set=="function"&&typeof object.sort=="function"&&object[NAME]==="URLSearchParams",isBlob=object=>object&&typeof object=="object"&&typeof object.arrayBuffer=="function"&&typeof object.type=="string"&&typeof object.stream=="function"&&typeof object.constructor=="function"&&/^(Blob|File)$/.test(object[NAME]),isAbortSignal=object=>typeof object=="object"&&(object[NAME]==="AbortSignal"||object[NAME]==="EventTarget"),isDomainOrSubdomain=(destination,original)=>{let orig=new URL(original).hostname,dest=new URL(destination).hostname;return orig===dest||orig.endsWith(`.${dest}`)},isSameProtocol=(destination,original)=>{let orig=new URL(original).protocol,dest=new URL(destination).protocol;return orig===dest},pipeline=(0,import_node_util.promisify)(import_node_stream.default.pipeline),INTERNALS$2=Symbol("Body internals"),Body=class{constructor(body,{size=0}={}){let boundary=null;body===null?body=null:isURLSearchParameters(body)?body=import_node_buffer.Buffer.from(body.toString()):isBlob(body)||import_node_buffer.Buffer.isBuffer(body)||(import_node_util.types.isAnyArrayBuffer(body)?body=import_node_buffer.Buffer.from(body):ArrayBuffer.isView(body)?body=import_node_buffer.Buffer.from(body.buffer,body.byteOffset,body.byteLength):body instanceof import_node_stream.default||(body instanceof FormData?(body=formDataToBlob(body),boundary=body.type.split("=")[1]):body=import_node_buffer.Buffer.from(String(body))));let stream=body;import_node_buffer.Buffer.isBuffer(body)?stream=import_node_stream.default.Readable.from(body):isBlob(body)&&(stream=import_node_stream.default.Readable.from(body.stream())),this[INTERNALS$2]={body,stream,boundary,disturbed:!1,error:null},this.size=size,body instanceof import_node_stream.default&&body.on("error",error_=>{let error=error_ instanceof FetchBaseError?error_:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`,"system",error_);this[INTERNALS$2].error=error})}get body(){return this[INTERNALS$2].stream}get bodyUsed(){return this[INTERNALS$2].disturbed}async arrayBuffer(){let{buffer,byteOffset,byteLength}=await consumeBody(this);return buffer.slice(byteOffset,byt
|
||
|
/*! Bundled license information:
|
||
|
|
||
|
node-fetch-native/dist/shared/node-fetch-native.d7878b77.mjs:
|
||
|
(*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
|
||
|
(*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
|
||
|
(*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
|
||
|
*/
|