@northflank/js-client 0.9.3-beta.0 → 0.9.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -161,18 +161,18 @@ return[4,Promise.all(this.connections.map(function(t){return T(e,void 0,void 0,f
161
161
  ;return null===(t=this.duplex)||void 0===t||t.write(this.constructPayloadPacket(e)),[2]})})},p.resizeTerminal=function(e){return T(p,void 0,void 0,function(){var t;return D(this,function(n){if(void 0===this.currentCommand||void 0===this.duplex)throw new Error("No command is running, can't resize terminal");return null===(t=this.duplex)||void 0===t||t.write(JSON.stringify({type:"resize",data:{ttyRows:null==e?void 0:e.rows,ttyColumns:null==e?void 0:e.columns}})),[2]})})},p.constructPayloadPacket=function(e){return JSON.stringify({type:"payload",data:e.toString()})},p.stdInEndPacket=JSON.stringify({type:"stdInEnd"}),p}return P(t,e),Object.defineProperty(t.prototype,"execEndpoint",{get:function(){var e=this.execConfig,t=e.entityId,n=e.entityType,r=e.projectId,o=e.teamId,a=void 0!==o?"teams/".concat(o,"/"):"",i="".concat(this.baseUrl,"/v1/command-exec/").concat(a,"projects/").concat(r,"/");return"".concat(i).concat(function(){switch(n){case"service":return"services/".concat(t);case"job":
162
162
  return"jobs/".concat(t);case"addon":return"addons/".concat(t);case"build":return"builds/".concat(t);default:throw new Error("Unexpected Northflank entity type received in command exec endpoint generation: ".concat(n))}}())},enumerable:!1,configurable:!0}),t.prototype.start=function(){return T(this,void 0,void 0,function(){var e=this;return D(this,function(t){if(void 0!==this.currentCommand)throw new Error("Command is already running");return this.currentCommand=new Promise(function(t,n){var r,o,a;if(void 0===e.remote){var i,d=!1,p=function(t){d?e.listenerCount("error")>0&&e.emit("error",new Error(t)):(d=!0,e.listenerCount("error")>0&&e.emit("error",new Error(t)),e.reset(),n(new Error(t)))};try{var l=e.execEndpoint.replace("https:","wss:").replace("http:","ws:");e.remote=new Ha(l,{agent:e.agent}),e.remote.on("error",function(e){p("WebSocket error: ".concat(e.message))}),e.remote.on("close",function(e,t){
163
163
  [1e3,1005].includes(e)||d||p("WebSocket closed unexpectedly: ".concat(e," ").concat(t||"(no reason)"))}),e.duplex=Ma(e.remote)}catch(e){return void p("Failed to establish connection to command execution proxy: ".concat(e.message))}e.stdIn.on("data",function(t){var n;(null===(n=e.duplex)||void 0===n?void 0:n.writable)&&e.duplex.write(e.constructPayloadPacket(t))}),e.stdIn.on("end",function(){var t;(null===(t=e.duplex)||void 0===t?void 0:t.writable)&&e.duplex.write(e.stdInEndPacket)});null===(r=e.duplex)||void 0===r||r.on("data",function(t){var n,r,o,a,d;try{var l=JSON.parse(t.toString());switch(null==l?void 0:l.type){case"init":var s=l.data;"successful"!==s.auth?p("Command initialization failed: ".concat(null!==(n=null==s?void 0:s.message)&&void 0!==n?n:"Reason unknown")):e.emit("auth-success",s);break;case"completion":i=l.data,e.emit("command-result",i),null===(r=e.duplex)||void 0===r||r.end(),e.stdOut.end(),e.stdErr.end(),e.stdIn.end();break;case"stdOut":e.emit("std-out-data",l.data),
164
- e.stdOut.write(l.data,null===(o=e.execConfig)||void 0===o?void 0:o.encoding);break;case"stdErr":e.emit("std-err-data",l.data),e.stdErr.write(l.data,null===(a=e.execConfig)||void 0===a?void 0:a.encoding);break;case"error":p((null===(d=l.data)||void 0===d?void 0:d.message)||"Unknown error");break;default:var u="unable to parse message: ".concat(JSON.stringify(l));p(u)}}catch(e){p("Failed to parse message: ".concat(e.message))}}),null===(o=e.duplex)||void 0===o||o.on("end",function(){i?d||(d=!0,e.emit("command-completed"),e.reset(),t(i)):p("Connection closed before receiving command result")}),null===(a=e.duplex)||void 0===a||a.on("error",function(e){p("Duplex stream error: ".concat(e.message))}),e.initialAuth(),e.emit("command-started")}else n(Error("Command is already running"))}),[2,this.currentCommand]})})},t.prototype.initialAuth=function(){
164
+ e.stdOut.write(l.data,null===(o=e.execConfig)||void 0===o?void 0:o.encoding);break;case"stdErr":e.emit("std-err-data",l.data),e.stdErr.write(l.data,null===(a=e.execConfig)||void 0===a?void 0:a.encoding);break;case"error":p((null===(d=l.data)||void 0===d?void 0:d.message)||"Unknown error");break;default:var u="unable to parse message: ".concat(JSON.stringify(l));p(u)}}catch(e){p("Failed to parse message: ".concat(e.message))}}),null===(o=e.duplex)||void 0===o||o.on("end",function(){i?d||(d=!0,e.emit("command-completed"),e.reset(),t(i)):d||p("Connection closed before receiving command result")}),null===(a=e.duplex)||void 0===a||a.on("error",function(e){p("Duplex stream error: ".concat(e.message))}),e.initialAuth(),e.emit("command-started")}else n(Error("Command is already running"))}),[2,this.currentCommand]})})},t.prototype.initialAuth=function(){
165
165
  var e,t=this.execConfig,n=t.command,r=t.containerName,o=t.instanceName,a=t.shell,i=t.user,d=this.execConfig,p=d.group,l=d.encoding,s=d.tty,u=d.ttyColumns,m=d.ttyRows,c={type:"init",data:{auth:{type:"apiToken",apiToken:this.token},context:{instanceName:o,containerName:r,command:n,shell:a,user:i,group:p,encoding:l,tty:s,ttyColumns:u,ttyRows:m}}};null===(e=this.duplex)||void 0===e||e.write(JSON.stringify(c))},t.prototype.reset=function(){var e;this.remote=void 0,this.currentCommand=void 0,null===(e=this.duplex)||void 0===e||e.destroy(),this.duplex=void 0},t}(e.EventEmitter),ei=function(e){function t(t,n,r,o,a,i){void 0===o&&(o=new S.PassThrough),void 0===a&&(a=new S.PassThrough),void 0===i&&(i=new S.PassThrough);var d=e.call(this)||this;return d.execConfig=t,d.token=n,d.session=r,d.stdOut=o,d.stdErr=a,d.stdIn=i,d.waitForCommandResult=function(){return T(d,void 0,void 0,function(){return D(this,function(e){switch(e.label){case 0:
166
166
  if(void 0===this.currentCommand)throw new Error("No command is running");return[4,this.currentCommand];case 1:return[2,e.sent()]}})})},d.sendInputToCurrentCommand=function(e){return T(d,void 0,void 0,function(){var t;return D(this,function(n){if(void 0===this.currentCommand||void 0===this.clientStream)throw new Error("No command is running");return null===(t=this.clientStream)||void 0===t||t.write(this.constructPayloadPacket(e)),[2]})})},d.resizeTerminal=function(e){return T(d,void 0,void 0,function(){var t,n;return D(this,function(r){if(void 0===this.currentCommand||void 0===this.clientStream)throw new Error("No command is running, can't resize terminal");return t={type:"resize",data:{ttyRows:null==e?void 0:e.rows,ttyColumns:null==e?void 0:e.columns}},null===(n=this.clientStream)||void 0===n||n.write("".concat(JSON.stringify(t),"\n")),[2]})})},d.getHashingKey=function(){var e;return d.execConfig.entityId+(null!==(e=d.execConfig.instanceName)&&void 0!==e?e:"na")},
167
- d.constructPayloadPacket=function(e){return"".concat(JSON.stringify({type:"stdin",data:{data:e.toString()}}),"\n")},d.stdInEndPacket="".concat(JSON.stringify({type:"stdInEnd"}),"\n"),d}return P(t,e),t.prototype.start=function(){return T(this,void 0,void 0,function(){var e=this;return D(this,function(t){if(void 0!==this.currentCommand)throw new Error("Command is already running");return this.currentCommand=new Promise(function(t,n){var r,o,a;if(void 0===e.clientStream){var i,d=!1,p=function(t){d?e.listenerCount("error")>0&&e.emit("error",new Error(t)):(d=!0,e.emit("error",new Error(t)),e.reset(),n(new Error(t)))};try{var l=e.session.request({":method":"POST",":path":"/exec","content-type":"application/x-ndjson","x-target-key":e.getHashingKey()});e.clientStream=l,l.on("error",function(e){p("session error: ".concat(e.message))}),l.on("end",function(e,t){})}catch(e){return void p("Failed to establish connection to command execution proxy: ".concat(e.message))}e.stdIn.on("data",function(t){
168
- var n;(null===(n=e.clientStream)||void 0===n?void 0:n.writable)&&e.clientStream.write(e.constructPayloadPacket(t))}),e.stdIn.on("end",function(){var t;(null===(t=e.clientStream)||void 0===t?void 0:t.writable)&&e.clientStream.write(e.stdInEndPacket)}),e.clientStream.on("response",function(t){e.emit("auth-success",t)});null===(r=e.clientStream)||void 0===r||r.on("data",function(t){var n,r,o,a,d,l,s,u,m;try{var c=JSON.parse(t.toString());switch(null==c?void 0:c.type){case"init":var v=c.data;"successful"!==v.auth?p("Command initialization failed: ".concat(null!==(n=null==v?void 0:v.message)&&void 0!==n?n:"Reason unknown")):e.emit("auth-success",v);break;case"execExit":i=c.data,e.emit("command-result",i),null===(r=e.clientStream)||void 0===r||r.end(),e.stdOut.end(),e.stdErr.end(),e.stdIn.end();break;case"stdout":e.emit("std-out-data",null===(o=c.data)||void 0===o?void 0:o.data),e.stdOut.write(null===(a=c.data)||void 0===a?void 0:a.data,null===(d=e.execConfig)||void 0===d?void 0:d.encoding)
169
- ;break;case"stderr":e.emit("std-err-data",null===(l=c.data)||void 0===l?void 0:l.data),e.stdErr.write(null===(s=c.data)||void 0===s?void 0:s.data,null===(u=e.execConfig)||void 0===u?void 0:u.encoding);break;case"error":p((null===(m=c.data)||void 0===m?void 0:m.message)||"Unknown error");break;default:var h="unable to parse message: ".concat(JSON.stringify(c));p(h)}}catch(e){p("Failed to parse message: ".concat(e.message))}}),null===(o=e.clientStream)||void 0===o||o.on("end",function(){i?d||(d=!0,e.emit("command-completed"),e.reset(),t(i)):p("Connection closed before receiving command result")}),null===(a=e.clientStream)||void 0===a||a.on("error",function(e){p("Duplex stream error: ".concat(e.message))}),e.initialAuth(),e.emit("command-started")}else n(Error("Command is already running"))}),[2,this.currentCommand]})})},t.prototype.initialAuth=function(){
170
- var e,t=this.execConfig,n=t.command,r=t.containerName,o=t.instanceName,a=t.shell,i=t.user,d=this.execConfig,p=d.group,l=d.encoding,s=d.tty,u=d.ttyColumns,m=d.ttyRows,c={type:"execStart",data:{auth:{type:"apiToken",apiToken:this.token},context:{projectId:this.execConfig.projectId,serviceId:this.execConfig.entityId,instanceName:o,containerName:r,command:n,shell:a,user:i,group:p,encoding:l,tty:s,ttyColumns:u,ttyRows:m}}};null===(e=this.clientStream)||void 0===e||e.write("".concat(JSON.stringify(c),"\n"))},t.prototype.reset=function(){var e;this.currentCommand=void 0,null===(e=this.clientStream)||void 0===e||e.destroy(),this.clientStream=void 0},t}(e.EventEmitter),ti=["us","eu","asia"],ni=function(){function e(e,t,n){var r=this;this.contextProvider=e,this.agent=t,this.sessionRegistry={},this.assertStartedWithNodejs=function(){if(!so)throw new Error("Command exec only possible when started with nodejs")},null==n||n.forEach(function(e){r.http2Session({execLocationHint:e})})}
171
- return e.prototype.http2Session=function(e){var t,n=this,r=function(){if(e.execLocationHint){var t=e.execLocationHint;if(!ti.includes(t))throw new Error("execLocationHint (".concat(t,") not valid. Must be one of [").concat(ti.join(","),"]."));var r=n.contextProvider.getCurrentBaseUrl(!0);return o=t,r.replace(/\/\/api\./,"//api-exec-".concat(o,"."))}if(e.execLocationOverride)return e.execLocationOverride;var o;throw new Error("Invalid exec location"+JSON.stringify(e))}();if(null===(t=this.sessionRegistry)||void 0===t?void 0:t[r])return this.sessionRegistry[r];var o="".concat(r,"/exec"),a=I.connect(o);return this.sessionRegistry[r]=a,a},e.prototype.execServiceCommand=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){return n=e.serviceId,r=e.projectId,o=e.teamId,a=k({teamId:o,projectId:r,entityId:n,entityType:"service"},t),[2,this.execCommand(a)]})})},e.prototype.execServiceSession=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i
172
- ;return D(this,function(d){switch(d.label){case 0:return r=e.serviceId,o=e.projectId,a=e.teamId,i=k({teamId:a,projectId:o,entityId:r,entityType:"service"},t),[4,this.shellSession(i,n)];case 1:return[2,d.sent()]}})})},e.prototype.execJobCommand=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){return n=e.jobId,r=e.projectId,o=e.teamId,a=k({teamId:o,projectId:r,entityId:n,entityType:"job"},t),[2,this.execCommand(a)]})})},e.prototype.execJobSession=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i;return D(this,function(d){switch(d.label){case 0:return r=e.jobId,o=e.projectId,a=e.teamId,i=k({teamId:a,projectId:o,entityId:r,entityType:"job"},t),[4,this.shellSession(i,n)];case 1:return[2,d.sent()]}})})},e.prototype.execAddonCommand=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){return n=e.addonId,r=e.projectId,o=e.teamId,a=k({teamId:o,projectId:r,entityId:n,entityType:"addon"},t),
173
- [2,this.execCommand(a)]})})},e.prototype.execAddonSession=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i;return D(this,function(d){switch(d.label){case 0:return r=e.addonId,o=e.projectId,a=e.teamId,i=k({teamId:a,projectId:o,entityId:r,entityType:"addon"},t),[4,this.shellSession(i,n)];case 1:return[2,d.sent()]}})})},e.prototype.execCommand=function(e){return T(this,void 0,void 0,function(){var t,n,r,o,a;return D(this,function(i){switch(i.label){case 0:this.assertStartedWithNodejs(),t=this.getCommandRunner(k({shell:"none"},e)),n=new Ro,r=new Ro,i.label=1;case 1:return i.trys.push([1,3,,4]),t.stdOut.pipe(n),t.stdErr.pipe(r),o=new Promise(function(e,n){t.once("error",function(e){n(new Error("".concat(e.message||e)))})}),[4,Promise.race([t.start(),o])];case 2:return[2,{commandResult:i.sent(),stdOut:n.getContentsAsString(),stdErr:r.getContentsAsString()}];case 3:throw a=i.sent(),t.stdOut.unpipe(n),t.stdErr.unpipe(r),
174
- new Error("Command execution failed: ".concat(a instanceof Error?a.message:String(a)));case 4:return[2]}})})},e.prototype.shellSession=function(e,t){return T(this,void 0,void 0,function(){var n,r;return D(this,function(o){switch(o.label){case 0:return this.assertStartedWithNodejs(),n=this.getCommandRunner(e),r=new Promise(function(e,r){n.once("auth-success",function(n){var r;null==t||t(null!==(r=null==n?void 0:n.context)&&void 0!==r?r:{}),e()}),n.once("error",function(e){r(new Error("Shell session failed: ".concat(e.message||e)))});var o=setTimeout(function(){r(new Error("Shell session timed out waiting for auth-success"))},3e4);n.once("auth-success",function(){return clearTimeout(o)})}),n.start(),[4,r];case 1:return o.sent(),[2,n]}})})},e.prototype.getCommandRunner=function(e){var t=this.contextProvider.getCurrentBaseUrl(!0),n=this.contextProvider.getCurrentToken();if(!n)throw Error("API token not found");var r=e.execLocationHint,o=e.execLocationOverride;return o?new ei(k({
175
- shell:"none"},e),n,this.http2Session({execLocationOverride:o})):r?new ei(k({shell:"none"},e),n,this.http2Session({execLocationHint:r})):new Qa(t,e,n,this.agent)},e}(),ri=Object.defineProperty,oi="object"==typeof process&&process?process:{stdout:null,stderr:null
167
+ d.constructPayloadPacket=function(e){return"".concat(JSON.stringify({type:"payload",data:e.toString()}),"\n")},d.stdInEndPacket="".concat(JSON.stringify({type:"stdInEnd"}),"\n"),d}return P(t,e),t.prototype.start=function(){return T(this,void 0,void 0,function(){var e=this;return D(this,function(t){if(void 0!==this.currentCommand)throw new Error("Command is already running");return this.currentCommand=new Promise(function(t,n){var r,o,a;if(void 0===e.clientStream){var i,d=!1,p=function(t){d?e.listenerCount("error")>0&&e.emit("error",new Error(t)):(d=!0,e.listenerCount("error")>0&&e.emit("error",new Error(t)),e.reset(),n(new Error(t)))};try{var l=e.session.request({":method":"POST",":path":"/exec","content-type":"application/x-ndjson","x-target-key":e.getHashingKey()});e.clientStream=l,l.on("error",function(e){p("session error: ".concat(e.message))})}catch(e){return void p("Failed to establish connection to command execution proxy: ".concat(e.message))}e.stdIn.on("data",function(t){var n
168
+ ;(null===(n=e.clientStream)||void 0===n?void 0:n.writable)&&e.clientStream.write(e.constructPayloadPacket(t))}),e.stdIn.on("end",function(){var t;(null===(t=e.clientStream)||void 0===t?void 0:t.writable)&&e.clientStream.write(e.stdInEndPacket)});var s=function(t){var n,r,o,a,d;switch(null==t?void 0:t.type){case"init":var l=t.data;"successful"!==l.auth?p("Command initialization failed: ".concat(null!==(n=null==l?void 0:l.message)&&void 0!==n?n:"Reason unknown")):e.emit("auth-success",l);break;case"completion":i=t.data,e.emit("command-result",i),null===(r=e.clientStream)||void 0===r||r.end(),e.stdOut.end(),e.stdErr.end(),e.stdIn.end();break;case"stdOut":e.emit("std-out-data",t.data),e.stdOut.write(t.data,null===(o=e.execConfig)||void 0===o?void 0:o.encoding);break;case"stdErr":e.emit("std-err-data",t.data),e.stdErr.write(t.data,null===(a=e.execConfig)||void 0===a?void 0:a.encoding);break;case"error":p((null===(d=t.data)||void 0===d?void 0:d.message)||"Unknown error");break;default:
169
+ var s="Unknown frame type: ".concat(String(null==t?void 0:t.type),"; message: ").concat(JSON.stringify(t));p(s)}},u="";null===(r=e.clientStream)||void 0===r||r.on("data",function(e){var t,n=(u+=e.toString()).split("\n");u=null!==(t=n.pop())&&void 0!==t?t:"";for(var r=0,o=n;r<o.length;r++){var a=o[r];if(a)try{var i=JSON.parse(a);s(i)}catch(e){return void p("Failed to parse message: ".concat(e.message))}}}),null===(o=e.clientStream)||void 0===o||o.on("end",function(){i?d||(d=!0,e.emit("command-completed"),e.reset(),t(i)):d||p("Connection closed before receiving command result")}),null===(a=e.clientStream)||void 0===a||a.on("error",function(e){p("Duplex stream error: ".concat(e.message))}),e.initialAuth(),e.emit("command-started")}else n(Error("Command is already running"))}),[2,this.currentCommand]})})},t.prototype.entityIdField=function(){var e=this.execConfig,t=e.entityType,n=e.entityId;switch(t){case"service":return{serviceId:n};case"job":return{jobId:n};case"addon":return{addonId:n}
170
+ ;case"build":return{buildId:n}}},t.prototype.initialAuth=function(){var e,t=this.execConfig,n=t.command,r=t.containerName,o=t.instanceName,a=t.shell,i=t.user,d=this.execConfig,p=d.group,l=d.encoding,s=d.tty,u=d.ttyColumns,m=d.ttyRows,c={type:"init",data:{auth:{type:"apiToken",apiToken:this.token},context:k(k({projectId:this.execConfig.projectId},this.entityIdField()),{instanceName:o,containerName:r,command:n,shell:a,user:i,group:p,encoding:l,tty:s,ttyColumns:u,ttyRows:m})}};null===(e=this.clientStream)||void 0===e||e.write("".concat(JSON.stringify(c),"\n"))},t.prototype.reset=function(){var e;this.currentCommand=void 0,null===(e=this.clientStream)||void 0===e||e.destroy(),this.clientStream=void 0},t}(e.EventEmitter),ti=["us","eu","asia"],ni=function(){function e(e,t,n){var r=this;this.contextProvider=e,this.agent=t,this.sessionRegistry={},this.assertStartedWithNodejs=function(){if(!so)throw new Error("Command exec only possible when started with nodejs")},
171
+ null==n||n.forEach(function(e){r.http2Session({execLocationHint:e})})}return e.prototype.http2Session=function(e){var t,n=this,r=function(){if(e.execLocationHint){var t=e.execLocationHint;if(!ti.includes(t))throw new Error("execLocationHint (".concat(t,") not valid. Must be one of [").concat(ti.join(","),"]."));var r=n.contextProvider.getCurrentBaseUrl(!0);return o=t,r.replace(/\/\/api\./,"//api-exec-".concat(o,"."))}if(e.execLocationOverride)return e.execLocationOverride;var o;throw new Error("Invalid exec location"+JSON.stringify(e))}();if(null===(t=this.sessionRegistry)||void 0===t?void 0:t[r])return this.sessionRegistry[r];var o="".concat(r,"/exec"),a=I.connect(o);return this.sessionRegistry[r]=a,a},e.prototype.execServiceCommand=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){return n=e.serviceId,r=e.projectId,o=e.teamId,a=k({teamId:o,projectId:r,entityId:n,entityType:"service"},t),[2,this.execCommand(a)]})})},
172
+ e.prototype.execServiceSession=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i;return D(this,function(d){switch(d.label){case 0:return r=e.serviceId,o=e.projectId,a=e.teamId,i=k({teamId:a,projectId:o,entityId:r,entityType:"service"},t),[4,this.shellSession(i,n)];case 1:return[2,d.sent()]}})})},e.prototype.execJobCommand=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){return n=e.jobId,r=e.projectId,o=e.teamId,a=k({teamId:o,projectId:r,entityId:n,entityType:"job"},t),[2,this.execCommand(a)]})})},e.prototype.execJobSession=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i;return D(this,function(d){switch(d.label){case 0:return r=e.jobId,o=e.projectId,a=e.teamId,i=k({teamId:a,projectId:o,entityId:r,entityType:"job"},t),[4,this.shellSession(i,n)];case 1:return[2,d.sent()]}})})},e.prototype.execAddonCommand=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){
173
+ return n=e.addonId,r=e.projectId,o=e.teamId,a=k({teamId:o,projectId:r,entityId:n,entityType:"addon"},t),[2,this.execCommand(a)]})})},e.prototype.execAddonSession=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i;return D(this,function(d){switch(d.label){case 0:return r=e.addonId,o=e.projectId,a=e.teamId,i=k({teamId:a,projectId:o,entityId:r,entityType:"addon"},t),[4,this.shellSession(i,n)];case 1:return[2,d.sent()]}})})},e.prototype.execCommand=function(e){return T(this,void 0,void 0,function(){var t,n,r,o,a;return D(this,function(i){switch(i.label){case 0:this.assertStartedWithNodejs(),t=this.getCommandRunner(k({shell:"none"},e)),n=new Ro,r=new Ro,i.label=1;case 1:return i.trys.push([1,3,,4]),t.stdOut.pipe(n),t.stdErr.pipe(r),o=new Promise(function(e,n){t.once("error",function(e){n(new Error("".concat(e.message||e)))})}),[4,Promise.race([t.start(),o])];case 2:return[2,{commandResult:i.sent(),stdOut:n.getContentsAsString(),stdErr:r.getContentsAsString()}];case 3:
174
+ throw a=i.sent(),t.stdOut.unpipe(n),t.stdErr.unpipe(r),new Error("Command execution failed: ".concat(a instanceof Error?a.message:String(a)));case 4:return[2]}})})},e.prototype.shellSession=function(e,t){return T(this,void 0,void 0,function(){var n,r;return D(this,function(o){switch(o.label){case 0:return this.assertStartedWithNodejs(),n=this.getCommandRunner(e),r=new Promise(function(e,r){n.once("auth-success",function(n){var r;null==t||t(null!==(r=null==n?void 0:n.context)&&void 0!==r?r:{}),e()}),n.once("error",function(e){r(new Error("Shell session failed: ".concat(e.message||e)))});var o=setTimeout(function(){r(new Error("Shell session timed out waiting for auth-success"))},3e4);n.once("auth-success",function(){return clearTimeout(o)})}),n.start().catch(function(){}),[4,r];case 1:return o.sent(),[2,n]}})})},e.prototype.getCommandRunner=function(e){var t=this.contextProvider.getCurrentBaseUrl(!0),n=this.contextProvider.getCurrentToken();if(!n)throw Error("API token not found")
175
+ ;var r=e.execLocationHint,o=e.execLocationOverride;return o?new ei(k({shell:"none"},e),n,this.http2Session({execLocationOverride:o})):r?new ei(k({shell:"none"},e),n,this.http2Session({execLocationHint:r})):new Qa(t,e,n,this.agent)},e}(),ri=Object.defineProperty,oi="object"==typeof process&&process?process:{stdout:null,stderr:null
176
176
  },ai=e=>!!e&&"object"==typeof e&&(e instanceof Mi||e instanceof n||ii(e)||di(e)),ii=e=>!!e&&"object"==typeof e&&e instanceof w.EventEmitter&&"function"==typeof e.pipe&&e.pipe!==n.Writable.prototype.pipe,di=e=>!!e&&"object"==typeof e&&e instanceof w.EventEmitter&&"function"==typeof e.write&&"function"==typeof e.end,pi=Symbol("EOF"),li=Symbol("maybeEmitEnd"),si=Symbol("emittedEnd"),ui=Symbol("emittingEnd"),mi=Symbol("emittedError"),ci=Symbol("closed"),vi=Symbol("read"),hi=Symbol("flush"),fi=Symbol("flushChunk"),Ii=Symbol("encoding"),wi=Symbol("decoder"),gi=Symbol("flowing"),bi=Symbol("paused"),yi=Symbol("resume"),Ri=Symbol("buffer"),ji=Symbol("pipes"),Ei=Symbol("bufferLength"),Ui=Symbol("bufferPush"),Ci=Symbol("bufferShift"),_i=Symbol("objectMode"),Si=Symbol("destroyed"),Ni=Symbol("error"),xi=Symbol("emitData"),Ai=Symbol("emitEnd"),Pi=Symbol("emitEnd2"),ki=Symbol("async"),Ti=Symbol("abort"),Di=Symbol("aborted"),Oi=Symbol("signal"),Li=Symbol("dataListeners"),qi=Symbol("discarded"),Bi=e=>Promise.resolve().then(e),Vi=e=>e(),Fi=class{
177
177
  src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[yi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Gi=class extends Fi{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>this.dest.emit("error",e),e.on("error",this.proxyErrors)}},Mi=class extends w.EventEmitter{[gi]=!1;[bi]=!1;[ji]=[];[Ri]=[];[_i];[Ii];[ki];[wi];[pi]=!1;[si]=!1;[ui]=!1;[ci]=!1;[mi]=null;[Ei]=0;[Si]=!1;[Oi];[Di]=!1;[Li]=0;[qi]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&"string"==typeof t.encoding)throw new TypeError("Encoding and objectMode may not be used together");t.objectMode?(this[_i]=!0,this[Ii]=null):(e=>!e.objectMode&&!!e.encoding&&"buffer"!==e.encoding)(t)?(this[Ii]=t.encoding,this[_i]=!1):(this[_i]=!1,this[Ii]=null),this[ki]=!!t.async,
178
178
  this[wi]=this[Ii]?new g.StringDecoder(this[Ii]):null,t&&!0===t.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[Ri]}),t&&!0===t.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[ji]});let{signal:n}=t;n&&(this[Oi]=n,n.aborted?this[Ti]():n.addEventListener("abort",()=>this[Ti]()))}get bufferLength(){return this[Ei]}get encoding(){return this[Ii]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[_i]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ki]}set async(e){this[ki]=this[ki]||!!e}[Ti](){this[Di]=!0,this.emit("abort",this[Oi]?.reason),this.destroy(this[Oi]?.reason)}get aborted(){return this[Di]}set aborted(e){}write(e,t,n){if(this[Di])return!1;if(this[pi])throw new Error("write after end")
@@ -264,7 +264,7 @@ const t=h(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(t){return
264
264
  "undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const e=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,"/");I.convert=e;const t=/^[a-z]:\//i;I.isNotRelative=e=>t.test(e)||w(e)}return Uu}(),xu=Qn(Nu);exports.CopyType=void 0,(Su=exports.CopyType||(exports.CopyType={})).DIRECTORY_UPLOAD="directory-upload",Su.FILE_UPLOAD="file-upload",Su.DIRECTORY_DOWNLOAD="directory-download",Su.FILE_DOWNLOAD="file-download";var Au,Pu=function(){function e(e,t){var n=this;if(this.exec=e,this.parameters=t,this.defaultEncoding="base64",this.getFileIgnoreFilter=function(e){if(void 0!==e){var t=xu({allowRelativePaths:!0}).add(e);return function(e){return!t.ignores(e)}}},this.getTarTransformFn=function(e,t){return function(n){n.path=n.path.replace(e,t)}},this.ensureDirRemote=function(e){return T(n,void 0,void 0,function(){var t,n,r;return D(this,function(o){switch(o.label){case 0:return t=["mkdir","-p",e],[4,this.runCommand(t)]
265
265
  ;case 1:if(n=o.sent(),"Success"!==(null===(r=null==n?void 0:n.commandResult)||void 0===r?void 0:r.status))throw new Error("Failed creating remote directory.");return[2]}})})},this.ensureTarCmd=function(){return T(n,void 0,void 0,function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:return e=["tar","--version"],[4,this.runCommand(e)];case 1:if(t=r.sent(),"Success"!==(null===(n=null==t?void 0:t.commandResult)||void 0===n?void 0:n.status))throw new Error("Tar command not found on remote container. Required for file copy.");return[2]}})})},this.pathExistsRemote=function(e){return T(n,void 0,void 0,function(){var t;return D(this,function(n){switch(n.label){case 0:return t=["test","-e",e],[4,this.runCommand(t)];case 1:return[2,0===n.sent().commandResult.exitCode]}})})},this.checkIsDirRemote=function(e){return T(n,void 0,void 0,function(){var t;return D(this,function(n){switch(n.label){case 0:return t=["test","-d",e],[4,this.runCommand(t)];case 1:
266
266
  return[2,0===n.sent().commandResult.exitCode]}})})},this.checkIsFileRemote=function(e){return T(n,void 0,void 0,function(){var t;return D(this,function(n){switch(n.label){case 0:return t=["test","-e",e],[4,this.runCommand(t)];case 1:return[2,0===n.sent().commandResult.exitCode]}})})},this.runCommand=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return T(n,O([e],t,!0),void 0,function(e,t){var n,r,o,a,i,d,p,l,s,u,m,c;return void 0===t&&(t="none"),D(this,function(v){switch(v.label){case 0:return r=(n=this).exec,o=n.parameters,a=o.teamId,i=o.projectId,d=o.resourceId,p=o.resourceType,l=o.containerName,s=o.instanceName,u=o.execLocationHint,m={command:e,shell:t,containerName:l,instanceName:s,execLocationHint:u},"service"!==p?[3,2]:[4,r.execServiceCommand({teamId:a,projectId:i,serviceId:d},m)];case 1:return c=v.sent(),[3,4];case 2:return[4,r.execJobCommand({teamId:a,projectId:i,jobId:d},m)];case 3:c=v.sent(),v.label=4;case 4:return[2,c]}})})},
267
- this.runSession=function(e){return T(n,void 0,void 0,function(){var t,n,r,o,a,i,d,p,l,s,u;return D(this,function(m){switch(m.label){case 0:return n=(t=this).exec,r=t.parameters,o=r.teamId,a=r.projectId,i=r.resourceId,d=r.resourceType,p=r.containerName,l=r.instanceName,s={command:e,shell:"none",tty:!1,encoding:this.defaultEncoding,containerName:p,instanceName:l},"service"!==d?[3,2]:[4,n.execServiceSession({teamId:o,projectId:a,serviceId:i},s)];case 1:return u=m.sent(),[3,4];case 2:return[4,n.execJobSession({teamId:o,projectId:a,jobId:i},s)];case 3:u=m.sent(),m.label=4;case 4:return[2,u]}})})},!["service","job"].includes(t.resourceType))throw new Error("Invalid resource type: ".concat(t.resourceType,", only 'service' and 'job' supported"))}return e.prototype.uploadFiles=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i,d,p,l,s,c,v,h,f;return D(this,function(I){switch(I.label){case 0:
267
+ this.runSession=function(e){return T(n,void 0,void 0,function(){var t,n,r,o,a,i,d,p,l,s,u,m;return D(this,function(c){switch(c.label){case 0:return n=(t=this).exec,r=t.parameters,o=r.teamId,a=r.projectId,i=r.resourceId,d=r.resourceType,p=r.containerName,l=r.instanceName,s=r.execLocationHint,u={command:e,shell:"none",tty:!1,encoding:this.defaultEncoding,containerName:p,instanceName:l,execLocationHint:s},"service"!==d?[3,2]:[4,n.execServiceSession({teamId:o,projectId:a,serviceId:i},u)];case 1:return m=c.sent(),[3,4];case 2:return[4,n.execJobSession({teamId:o,projectId:a,jobId:i},u)];case 3:m=c.sent(),c.label=4;case 4:return[2,m]}})})},!["service","job"].includes(t.resourceType))throw new Error("Invalid resource type: ".concat(t.resourceType,", only 'service' and 'job' supported"))}return e.prototype.uploadFiles=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i,d,p,l,s,c,v,h,f;return D(this,function(I){switch(I.label){case 0:
268
268
  if(void 0===e||!u.existsSync(e))throw new Error("Local path '".concat(e,"' does not exists but is required for uploads."));return r=u.lstatSync(e).isFile(),o=r?m.dirname(e):e,a=r?m.basename(e):".",i=r&&void 0!==t&&""!==m.extname(t),d=i?m.dirname(t):null!=t?t:o,p=void 0!==t?m.basename(t):a,l=Is({gzip:{encoding:this.defaultEncoding},cwd:o,filter:this.getFileIgnoreFilter(n),preservePaths:!0,onWriteEntry:i?this.getTarTransformFn(a,p):void 0},bo(a)),[4,this.ensureTarCmd()];case 1:return I.sent(),[4,this.ensureDirRemote(d)];case 2:return I.sent(),s=O(O(["tar","-xzvf","-"],["--no-same-owner"],!0),["-C",d],!1),[4,this.runSession(s)];case 3:return c=I.sent(),v=new Ro,h=new Ro,c.stdErr.pipe(v),c.stdOut.pipe(h),l.pipe(c.stdIn),[4,c.waitForCommandResult()];case 4:if("Success"!==(null==(f=I.sent())?void 0:f.status))throw new Error("Failed to upload file to container: ".concat(null==f?void 0:f.message,", error details: ").concat(v.getContentsAsString(),"; ").concat(h.getContentsAsString()))
269
269
  ;return r?[2,{type:exports.CopyType.FILE_UPLOAD,sourceDirectory:o,sourceFile:a,targetDirectory:d,targetFile:p}]:[2,{type:exports.CopyType.DIRECTORY_UPLOAD,sourceDirectory:o,targetDirectory:d}]}})})},e.prototype.uploadStream=function(e,t){return T(this,void 0,void 0,function(){var r,o,a,i,d,p,l;return D(this,function(s){switch(s.label){case 0:return r=function(e){var t=new n.Transform({transform:function(e,t,n){this.push(e.toString("base64")),n()}}),r="string"==typeof e,o=Buffer.isBuffer(e);return r||o?n.Readable.from(e).pipe(t):e.pipe(t)},o=m.dirname(t),[4,this.ensureTarCmd()];case 1:return s.sent(),[4,this.ensureDirRemote(o)];case 2:return s.sent(),a=["tee",t],[4,this.runSession(a)];case 3:return i=s.sent(),d=new Ro,p=new Ro,i.stdErr.pipe(d),i.stdOut.pipe(p),r(e).pipe(i.stdIn),[4,i.waitForCommandResult()];case 4:return l=s.sent(),[4,this.runCommand(["cat",t])];case 5:if(s.sent(),
270
270
  "Success"!==(null==l?void 0:l.status))throw new Error("Failed to upload file to container: ".concat(null==l?void 0:l.message,", error details: ").concat(d.getContentsAsString(),"; ").concat(p.getContentsAsString()));return[2]}})})},e.prototype.downloadFiles=function(e,t,n){return T(this,void 0,void 0,function(){var r,o,a,i,d,p,l,s,c,v,h,f,I,w;return D(this,function(g){switch(g.label){case 0:return(r=void 0===e)?[3,2]:[4,this.pathExistsRemote(e)];case 1:r=!g.sent(),g.label=2;case 2:if(r)throw new Error("Remote path '".concat(e,"' does not exists but is required for downloads."));return[4,this.checkIsDirRemote(e)];case 3:return o=g.sent(),a=o?e:m.dirname(e),i=o?".":m.basename(e),d=void 0!==t&&""!==m.extname(t),p=!o&&d?m.basename(t):i,(l=void 0!==t?d?m.dirname(t):t:".")&&u.mkdirSync(l,{recursive:!0}),s=bo(null!=n?n:[]).map(function(e){return"--exclude=".concat(e)}),c=O(O(["tar","-zcf","-"],["--no-same-owner"],!0),s,!0),v=O(O([],c,!0),["-C",a,i],!1),[4,this.runSession(v)];case 4:
@@ -281,8 +281,8 @@ e.emit("error",{message:t}),e.reset(),n(new Error(t))}}),[4,new Promise(function
281
281
  return T(n,void 0,void 0,function(){return D(this,function(t){return[2,this.executeCall(e)]})})},this.contextProvider=e}return e.prototype.getDefaultHeaders=function(){var e,t=this.contextProvider.getCurrentToken(),n=(null===(e=this.opts)||void 0===e?void 0:e.customUserAgent)?" (".concat(this.opts.customUserAgent,")"):"";return{Authorization:this.withAuth?"Bearer ".concat(t):void 0,"Content-Type":"application/json","User-Agent":"northflank-js-client/".concat(Bu()).concat(n)}},e.prototype.executeCall=function(e){return T(this,void 0,void 0,function(){var t,n,r,o,a,i,d,p,l,s,u,m,c,v=this;return D(this,function(h){switch(h.label){case 0:if(t=this.method,n=this.opts.agent,r={method:t,headers:this.getDefaultHeaders(),agent:n},!(o=null===(c=this.contextProvider)||void 0===c?void 0:c.getCurrentBaseUrl()))throw new Error("Api client context not correctly initialized, please provide a url to the context.");return a="".concat(o).concat(this.endpointUrl(e)),i=this.body(e),d=k(k({url:a},r),{body:i
282
282
  }),[4,Zu(a,k(k({},r),{body:i}))];case 1:return[4,(p=h.sent()).text()];case 2:return l=h.sent(),s=function(){if(200!==p.status){var e=null==u?void 0:u.error,t=(null==e?void 0:e.message)||"",n={status:p.status,message:t,id:null==e?void 0:e.id,details:null==e?void 0:e.details};if(v.opts.throwErrorOnHttpErrorCode)throw new Tu(n);return n}},u=function(){try{return JSON.parse(l)}catch(e){throw Error("Failed reading api request result: \n\tStatus: ".concat(p.statusText," (").concat(p.status,")\n\tMessage: ").concat(l))}}(),m=s(),[2,{data:null==u?void 0:u.data,rawResponse:p,request:d,error:m,pagination:null==u?void 0:u.pagination}]}})})},e}(),Fu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="get",t.body=function(){},t}return P(t,e),t}(Vu),Gu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.all=function(e){return T(t,void 0,void 0,function(){return D(this,function(t){return[2,new $u(this,e).getAll()]})})},
283
283
  t.call=function(n){return T(t,void 0,void 0,function(){var t,r=this;return D(this,function(o){switch(o.label){case 0:return[4,e.prototype.executeCall.call(this,n)];case 1:return t=o.sent(),[2,k(k({},t),{pagination:k(k({},t.pagination),{getNextPage:function(){return T(r,void 0,void 0,function(){var e,r,o,a,i,d,p,l=this;return D(this,function(s){return void 0===(null===(d=t.pagination)||void 0===d?void 0:d.cursor)?(e=Object.keys(t.data),r=1===e.length?((i={})[e[0]]=[],i):{},o=k(k({},t),{pagination:k(k({},t.pagination),{count:0}),data:r}),[2,(a=function(e){return k(k({},e),{pagination:k(k({},e.pagination),{getNextPage:function(){return T(l,void 0,void 0,function(){return D(this,function(t){return[2,a(e)]})})}})})})(o)]):[2,new $u(this,n,null===(p=t.pagination)||void 0===p?void 0:p.cursor).getNext()]})})}})})]}})})},t}return P(t,e),t}(Fu),Mu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="post",t}return P(t,e),t}(Vu),Ju=function(e){function t(){
284
- var t=null!==e&&e.apply(this,arguments)||this;return t.method="delete",t.body=function(){},t}return P(t,e),t}(Vu),zu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="put",t}return P(t,e),t}(Vu),Wu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="patch",t}return P(t,e),t}(Vu),$u=function(){function e(e,t,n){void 0===n&&(n=null);var r=this;this.endpoint=e,this.opts=t,this._currentOffset=0,this.hasNext=function(){return void 0!==r.cursor},this.cursor=n}return Object.defineProperty(e.prototype,"currentOffset",{get:function(){return this._currentOffset},enumerable:!1,configurable:!0}),e.prototype.getNext=function(){return T(this,void 0,void 0,function(){var e,t,n,r,o,a,i,d,p;return D(this,function(l){switch(l.label){case 0:return[4,this.endpoint.call(k(k({},this.opts),{options:k(k({},null===(i=this.opts)||void 0===i?void 0:i.options),{cursor:null!==(d=this.cursor)&&void 0!==d?d:void 0})}))];case 1:
285
- return e=l.sent(),t=e.data,n=e.request,r=e.error,o=e.pagination,a=e.rawResponse,this.cursor=null==o?void 0:o.cursor,this._currentOffset+=null!==(p=null==o?void 0:o.count)&&void 0!==p?p:0,[2,{data:t,request:n,error:r,pagination:o,rawResponse:a}]}})})},e.prototype.getAll=function(){return T(this,void 0,void 0,function(){var e,t,n,r,o,a,i;return D(this,function(d){switch(d.label){case 0:e=[],d.label=1;case 1:return this.hasNext()?[4,this.getNext()]:[3,3];case 2:return(t=d.sent()).error?[2,t]:(e.push(t),[3,1]);case 3:return r=e.flatMap(function(e){var t=Object.keys(e.data);return 1===t.length?(n=t[0],e.data[t[0]]):e.data}),[2,{data:void 0===n?r:(o={},o[n]=r,o),request:null===(a=e[0])||void 0===a?void 0:a.request,rawResponse:null===(i=e[0])||void 0===i?void 0:i.rawResponse}]}})})},e}(),Hu=function(e){return new Promise(function(t){setTimeout(function(){t()},e)})},Zu=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=3),void 0===r&&(r=500),new Promise(function(o,a){var i=function(n){
284
+ var t=null!==e&&e.apply(this,arguments)||this;return t.method="delete",t}return P(t,e),t}(Vu),zu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="put",t}return P(t,e),t}(Vu),Wu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="patch",t}return P(t,e),t}(Vu),$u=function(){function e(e,t,n){void 0===n&&(n=null);var r=this;this.endpoint=e,this.opts=t,this._currentOffset=0,this.hasNext=function(){return void 0!==r.cursor},this.cursor=n}return Object.defineProperty(e.prototype,"currentOffset",{get:function(){return this._currentOffset},enumerable:!1,configurable:!0}),e.prototype.getNext=function(){return T(this,void 0,void 0,function(){var e,t,n,r,o,a,i,d,p;return D(this,function(l){switch(l.label){case 0:return[4,this.endpoint.call(k(k({},this.opts),{options:k(k({},null===(i=this.opts)||void 0===i?void 0:i.options),{cursor:null!==(d=this.cursor)&&void 0!==d?d:void 0})}))];case 1:return e=l.sent(),t=e.data,
285
+ n=e.request,r=e.error,o=e.pagination,a=e.rawResponse,this.cursor=null==o?void 0:o.cursor,this._currentOffset+=null!==(p=null==o?void 0:o.count)&&void 0!==p?p:0,[2,{data:t,request:n,error:r,pagination:o,rawResponse:a}]}})})},e.prototype.getAll=function(){return T(this,void 0,void 0,function(){var e,t,n,r,o,a,i;return D(this,function(d){switch(d.label){case 0:e=[],d.label=1;case 1:return this.hasNext()?[4,this.getNext()]:[3,3];case 2:return(t=d.sent()).error?[2,t]:(e.push(t),[3,1]);case 3:return r=e.flatMap(function(e){var t=Object.keys(e.data);return 1===t.length?(n=t[0],e.data[t[0]]):e.data}),[2,{data:void 0===n?r:(o={},o[n]=r,o),request:null===(a=e[0])||void 0===a?void 0:a.request,rawResponse:null===(i=e[0])||void 0===i?void 0:i.rawResponse}]}})})},e}(),Hu=function(e){return new Promise(function(t){setTimeout(function(){t()},e)})},Zu=function(e,t,n,r){return void 0===t&&(t={}),void 0===n&&(n=3),void 0===r&&(r=500),new Promise(function(o,a){var i=function(n){
286
286
  return uo(e,t).then(function(e){o(e)}).catch(function(e){return T(void 0,void 0,void 0,function(){return D(this,function(t){switch(t.label){case 0:return n>0?[4,Hu(r)]:[3,2];case 1:return t.sent(),[2,i(n-1)];case 2:return[2,a(e)]}})})})};return i(n)})},Yu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Fetch log lines over a specific time span",t.withAuth=!0,t.requiredPermissions="Account > Service | Job | Addon > General > Read",t.endpointUrl=function(e){return qu.getLogsEndpoint(e)},t.body=function(){},t}return P(t,e),t}(Fu),Ku=function(e,t){void 0===t&&(t={});var n=this;this.contextProvider=e,this.clientOpts=t,this.getServiceLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r;return D(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.serviceId,projectId:t.projectId,teamId:t.teamId},[2,this.logRange(r,null!=n?n:{},"service")]})})},this.getServiceBuildLogs=function(e){return T(n,void 0,void 0,function(){
287
287
  var t,n,r,o,a,i;return D(this,function(d){return t=e.parameters,n=e.options,r=t.projectId,o=t.serviceId,a=t.teamId,i={entityId:o,projectId:r,teamId:a},[2,this.logRange(i,k(k({},n),{isBuild:!0}),"service")]})})},this.getJobLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r;return D(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.jobId,projectId:t.projectId,teamId:t.teamId},[2,this.logRange(r,null!=n?n:{},"job")]})})},this.getJobBuildLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r,o,a,i;return D(this,function(d){return t=e.parameters,n=e.options,r=t.projectId,o=t.jobId,a=t.teamId,i={entityId:o,projectId:r,teamId:a},[2,this.logRange(i,k(k({},n),{isBuild:!0}),"job")]})})},this.getAddonLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r;return D(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.addonId,projectId:t.projectId},[2,this.logRange(r,null!=n?n:{},"addon")]})})},this.getAddonBackupLogs=function(e){
288
288
  return T(n,void 0,void 0,function(){var t,n,r;return D(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.addonId,projectId:t.projectId,teamId:t.teamId},[2,this.logRange(r,k(k({},n),{backupId:t.backupId}),"addonBackup")]})})},this.getAddonRestoresLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r,o,a,i,d;return D(this,function(p){return t=e.parameters,n=e.options,r=t.teamId,o=t.projectId,a=t.addonId,i={entityId:a,projectId:o,teamId:r},d={backupId:t.backupId,restoreId:t.restoreId},[2,this.logRange(i,k(k({},n),d),"addonRestore")]})})},this.logRange=function(e,t,r){return T(n,void 0,void 0,function(){var n,o,a,i,d,p;return D(this,function(l){switch(l.label){case 0:return n=e.entityId,o=e.projectId,a=e.teamId,i=k(k({teamId:a,projectId:o,entityId:n,entityType:r},t),{queryType:"range"}),[4,new Yu(this.contextProvider,this.clientOpts).call(i)];case 1:return(d=l.sent()).error?[2,d]:[2,k(k({},d),{data:null===(p=null==d?void 0:d.data)||void 0===p?void 0:p.map(Lu)})]}})
@@ -622,10 +622,11 @@ t.requiredPermissions="Account > Templates > General > Create",t.endpointUrl=fun
622
622
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.pipelineId)))throw new Error("No matching endpoint URL found for provided parameters");i="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs")}return i},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Mu),Oh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get a list of active preview environments for a template",t.withAuth=!0,t.requiredPermissions="Account > Templates > General > Read",t.endpointUrl=function(e){var t,n,r,o,a,i,d;if([].forEach(function(t){var n
623
623
  ;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),(null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.pipelineId))d="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/previews");else{
624
624
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.pipelineId)))throw new Error("No matching endpoint URL found for provided parameters");d="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/previews")}var p=Object.entries(null!==(i=null==e?void 0:e.options)&&void 0!==i?i:{}).filter(function(e){return void 0!==e[1]}),l=p.length>0?"?".concat(p.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(d).concat(l)},t.body=function(){},t}return P(t,e),t}(Gu),Lh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
625
- ;return t.description="Delete a preview environment generated by a preview template.",t.withAuth=!0,t.requiredPermissions="Account > Templates > General > Delete",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
626
- (null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.pipelineId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.previewId))p="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/previews/").concat(encodeURIComponent(e.parameters.previewId));else{
627
- if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(i=null==e?void 0:e.parameters)||void 0===i?void 0:i.pipelineId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(d=null==e?void 0:e.parameters)||void 0===d?void 0:d.previewId)))throw new Error("No matching endpoint URL found for provided parameters");p="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/previews/").concat(encodeURIComponent(e.parameters.previewId))}return p},t.body=function(){},t}return P(t,e),t}(Ju),qh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Run the given preview template.",t.withAuth=!0,
628
- t.requiredPermissions="Account > Templates > General > Create",t.endpointUrl=function(e){var t,n,r,o,a,i;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),(null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.pipelineId))i="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/runs");else{
625
+ ;return t.description="Delete a preview environment generated by a preview template.",t.withAuth=!0,t.requiredPermissions="Account > Templates > General > Delete",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p,l;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
626
+ (null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.pipelineId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.previewId))l="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/previews/").concat(encodeURIComponent(e.parameters.previewId));else{
627
+ if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(i=null==e?void 0:e.parameters)||void 0===i?void 0:i.pipelineId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(d=null==e?void 0:e.parameters)||void 0===d?void 0:d.previewId)))throw new Error("No matching endpoint URL found for provided parameters");l="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/previews/").concat(encodeURIComponent(e.parameters.previewId))}var s=Object.entries(null!==(p=null==e?void 0:e.options)&&void 0!==p?p:{}).filter(function(e){return void 0!==e[1]}),u=s.length>0?"?".concat(s.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):""
628
+ ;return"".concat(l).concat(u)},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Ju),qh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Run the given preview template.",t.withAuth=!0,t.requiredPermissions="Account > Templates > General > Create",t.endpointUrl=function(e){var t,n,r,o,a,i;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
629
+ (null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.pipelineId))i="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/runs");else{
629
630
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.pipelineId)))throw new Error("No matching endpoint URL found for provided parameters");i="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/runs")}return i},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Mu),Bh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get a list of preview template runs",t.withAuth=!0,t.requiredPermissions="Account > Templates > General > Read",t.endpointUrl=function(e){var t,n,r,o,a,i,d;if([].forEach(function(t){var n
630
631
  ;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),(null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.pipelineId))d="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/runs");else{
631
632
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.projectId)&&(null==e?void 0:e.parameters)&&"pipelineId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.pipelineId)))throw new Error("No matching endpoint URL found for provided parameters");d="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/pipelines/").concat(encodeURIComponent(e.parameters.pipelineId),"/preview-envs/runs")}var p=Object.entries(null!==(i=null==e?void 0:e.options)&&void 0!==i?i:{}).filter(function(e){return void 0!==e[1]}),l=p.length>0?"?".concat(p.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(d).concat(l)},t.body=function(){},t}return P(t,e),t}(Gu),Vh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get information about the given preview template run.",
@@ -662,10 +663,10 @@ if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&
662
663
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.previewBlueprintId)))throw new Error("No matching endpoint URL found for provided parameters");i="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId))}return i},t.body=function(){},t}return P(t,e),t}(Ju),Xh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get a list of active previews for a preview blueprint.",t.withAuth=!0,t.requiredPermissions="Project > PreviewBlueprints > General > Read",t.endpointUrl=function(e){var t,n,r,o,a,i,d;if([].forEach(function(t){var n
663
664
  ;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),(null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.previewBlueprintId))d="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews");else{
664
665
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.previewBlueprintId)))throw new Error("No matching endpoint URL found for provided parameters");d="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews")}var p=Object.entries(null!==(i=null==e?void 0:e.options)&&void 0!==i?i:{}).filter(function(e){return void 0!==e[1]}),l=p.length>0?"?".concat(p.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(d).concat(l)},t.body=function(){},t}return P(t,e),t}(Gu),Qh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
665
- ;return t.description="Delete a preview environment generated by a preview blueprint.",t.withAuth=!0,t.requiredPermissions="Project > PreviewBlueprints > Previews > Delete",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
666
- (null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.previewBlueprintId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.previewId))p="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews/").concat(encodeURIComponent(e.parameters.previewId));else{
667
- if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(i=null==e?void 0:e.parameters)||void 0===i?void 0:i.previewBlueprintId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(d=null==e?void 0:e.parameters)||void 0===d?void 0:d.previewId)))throw new Error("No matching endpoint URL found for provided parameters");p="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews/").concat(encodeURIComponent(e.parameters.previewId))}return p},t.body=function(){},t}return P(t,e),t}(Ju),ef=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Pause a preview environment generated by a preview blueprint.",
668
- t.withAuth=!0,t.requiredPermissions="Project > PreviewBlueprints > Previews > Pause",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
666
+ ;return t.description="Delete a preview environment generated by a preview blueprint.",t.withAuth=!0,t.requiredPermissions="Project > PreviewBlueprints > Previews > Delete",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p,l;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
667
+ (null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.previewBlueprintId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.previewId))l="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews/").concat(encodeURIComponent(e.parameters.previewId));else{
668
+ if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(i=null==e?void 0:e.parameters)||void 0===i?void 0:i.previewBlueprintId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(d=null==e?void 0:e.parameters)||void 0===d?void 0:d.previewId)))throw new Error("No matching endpoint URL found for provided parameters");l="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews/").concat(encodeURIComponent(e.parameters.previewId))}var s=Object.entries(null!==(p=null==e?void 0:e.options)&&void 0!==p?p:{}).filter(function(e){return void 0!==e[1]}),u=s.length>0?"?".concat(s.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):""
669
+ ;return"".concat(l).concat(u)},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Ju),ef=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Pause a preview environment generated by a preview blueprint.",t.withAuth=!0,t.requiredPermissions="Project > PreviewBlueprints > Previews > Pause",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),
669
670
  (null==e?void 0:e.parameters)&&"teamId"in(null==e?void 0:e.parameters)&&void 0!==(null===(t=null==e?void 0:e.parameters)||void 0===t?void 0:t.teamId)&&(null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.previewBlueprintId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(o=null==e?void 0:e.parameters)||void 0===o?void 0:o.previewId))p="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/projects/").concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews/").concat(encodeURIComponent(e.parameters.previewId),"/pause");else{
670
671
  if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&void 0!==(null===(a=null==e?void 0:e.parameters)||void 0===a?void 0:a.projectId)&&(null==e?void 0:e.parameters)&&"previewBlueprintId"in(null==e?void 0:e.parameters)&&void 0!==(null===(i=null==e?void 0:e.parameters)||void 0===i?void 0:i.previewBlueprintId)&&(null==e?void 0:e.parameters)&&"previewId"in(null==e?void 0:e.parameters)&&void 0!==(null===(d=null==e?void 0:e.parameters)||void 0===d?void 0:d.previewId)))throw new Error("No matching endpoint URL found for provided parameters");p="/v1/projects/".concat(encodeURIComponent(e.parameters.projectId),"/preview-blueprints/").concat(encodeURIComponent(e.parameters.previewBlueprintId),"/previews/").concat(encodeURIComponent(e.parameters.previewId),"/pause")}return p},t.body=function(){},t}return P(t,e),t}(Mu),tf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
671
672
  ;return t.description="Reset the expiry of a preview environment generated by a preview blueprint.",t.withAuth=!0,t.requiredPermissions="Project > PreviewBlueprints > General > Update",t.endpointUrl=function(e){var t,n,r,o,a,i,d,p;if([].forEach(function(t){var n;if(void 0===(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n[t]))throw new Error("Required argument not set: '".concat(t,"'"))}),