@northflank/js-client 0.9.3-beta.0 → 0.9.3-beta.1
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.
- package/dist/cjs/api-client.d.ts +4276 -51
- package/dist/cjs/api-client.js +67 -67
- package/dist/esm/api-client.d.ts +4276 -51
- package/dist/esm/api-client.js +54 -52
- package/package.json +1 -1
package/dist/esm/api-client.js
CHANGED
|
@@ -158,20 +158,21 @@ return[2,(s.address=u.sent(),s.port=o.internalPort,s)]}})})},t.prototype.consist
|
|
|
158
158
|
return[4,ta.load({header:"Northflank Proxy"})];case 1:return t=r.sent(),e(t),[4,t.backup({suffix:".backup-pre-northflank"})];case 2:r.sent(),r.label=3;case 3:return r.trys.push([3,5,,7]),[4,Uo(5)(function(){return W(n,void 0,void 0,function(){return $(this,function(e){switch(e.label){case 0:return[4,t.write({writeMode:"atomic"})];case 1:return e.sent(),[2]}})})})];case 4:return r.sent(),[3,7];case 5:return r.sent(),[4,Uo(5)(function(){return W(n,void 0,void 0,function(){return $(this,function(e){switch(e.label){case 0:return[4,t.write({writeMode:"standard"})];case 1:return e.sent(),[2]}})})})];case 6:return r.sent(),[3,7];case 7:return[2]}})})})];case 1:return n.sent(),[2]}})})},t.prototype.stopProjectForwarding=function(e){return W(this,void 0,void 0,function(){var t=this;return $(this,function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter(function(t){return t.forwardingContext.projectId===e.projectId}).map(function(e){return t.stopForwarding(e)}))];case 1:
|
|
159
159
|
return n.sent(),[2]}})})},t.prototype.stopServiceForwarding=function(e){return W(this,void 0,void 0,function(){var t=this;return $(this,function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter(function(t){return"service"===t.forwardingContext.type&&t.forwardingContext.projectId===e.projectId&&t.forwardingContext.id===e.serviceId}).map(function(e){return t.stopForwarding(e)}))];case 1:return n.sent(),[2]}})})},t.prototype.stopAddonForwarding=function(e){return W(this,void 0,void 0,function(){var t=this;return $(this,function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter(function(t){return"addon"===t.forwardingContext.type&&t.forwardingContext.projectId===e.projectId&&t.forwardingContext.id===e.addonId}).map(function(e){return t.stopForwarding(e)}))];case 1:return n.sent(),[2]}})})},t.prototype.stop=function(){return W(this,void 0,void 0,function(){var e=this;return $(this,function(t){switch(t.label){case 0:
|
|
160
160
|
return[4,Promise.all(this.connections.map(function(t){return W(e,void 0,void 0,function(){return $(this,function(e){return[2,this.stopForwarding(t)]})})}))];case 1:return t.sent(),[2]}})})},t}(t),ui=function(e){function t(t,n,r,a,i,d,p){void 0===i&&(i=new o.PassThrough),void 0===d&&(d=new o.PassThrough),void 0===p&&(p=new o.PassThrough);var l=e.call(this)||this;return l.baseUrl=t,l.execConfig=n,l.token=r,l.agent=a,l.stdOut=i,l.stdErr=d,l.stdIn=p,l.waitForCommandResult=function(){return W(l,void 0,void 0,function(){return $(this,function(e){switch(e.label){case 0:if(void 0===this.currentCommand)throw new Error("No command is running");return[4,this.currentCommand];case 1:return[2,e.sent()]}})})},l.sendInputToCurrentCommand=function(e){return W(l,void 0,void 0,function(){var t;return $(this,function(n){if(void 0===this.currentCommand||void 0===this.duplex)throw new Error("No command is running");return null===(t=this.duplex)||void 0===t||t.write(this.constructPayloadPacket(e)),[2]})})},
|
|
161
|
-
l.resizeTerminal=function(e){return W(l,void 0,void 0,function(){var t;return $(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]})})},l.constructPayloadPacket=function(e){return JSON.stringify({type:"payload",data:
|
|
162
|
-
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 W(this,void 0,void 0,function(){var e=this;return $(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 ii(l,{agent:e.agent}),e.remote.on("error",function(e){p("WebSocket error: ".concat(e.message))}),e.remote.on("close",function(e,t){
|
|
163
|
-
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
|
|
164
|
-
e.
|
|
165
|
-
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}(t),mi=function(e){function t(t,n,r,a,i,d){void 0===a&&(a=new o.PassThrough),void 0===i&&(i=new o.PassThrough),void 0===d&&(d=new o.PassThrough);var p=e.call(this)||this;return p.execConfig=t,p.token=n,p.session=r,p.stdOut=a,p.stdErr=i,p.stdIn=d,p.waitForCommandResult=function(){return W(p,void 0,void 0,function(){
|
|
166
|
-
;return null===(t=this.clientStream)||void 0===t||t.write(this.constructPayloadPacket(e)),[2]})})},p.resizeTerminal=function(e){return W(p,void 0,void 0,function(){var t,n;return $(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]})})},p.getHashingKey=function(){var e
|
|
167
|
-
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){
|
|
168
|
-
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":
|
|
169
|
-
;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"))}),
|
|
170
|
-
;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}(t),ci=["us","eu","asia"],vi=function(){function e(e,t,n){var r=this;this.contextProvider=e,this.agent=t,this.sessionRegistry={},this.assertStartedWithNodejs=function(){if(!Ro)throw new Error("Command exec only possible when started with nodejs")},null==n||n.forEach(function(e){
|
|
171
|
-
;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=A(o);return this.sessionRegistry[r]=a,a},e.prototype.execServiceCommand=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){return n=e.serviceId,r=e.projectId,o=e.teamId,a=J({teamId:o,projectId:r,entityId:n,entityType:"service"},t),[2,this.execCommand(a)]})})},e.prototype.execServiceSession=function(e,t,n){
|
|
172
|
-
|
|
173
|
-
var t,n,r,o,a;return $(this,function(i){switch(i.label){case 0:this.assertStartedWithNodejs(),t=this.getCommandRunner(J({shell:"none"},e)),n=new Do,r=new Do,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
|
-
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 mi(J({
|
|
161
|
+
l.resizeTerminal=function(e){return W(l,void 0,void 0,function(){var t;return $(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]})})},l.constructPayloadPacket=function(e){var t,n=(null===(t=l.execConfig)||void 0===t?void 0:t.encoding)?Buffer.from(e).toString(l.execConfig.encoding):e.toString();return JSON.stringify({type:"payload",data:n})},l.stdInEndPacket=JSON.stringify({type:"stdInEnd"}),l}return z(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":
|
|
162
|
+
return"services/".concat(t);case"job":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 W(this,void 0,void 0,function(){var e=this;return $(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 ii(l,{agent:e.agent}),e.remote.on("error",function(e){p("WebSocket error: ".concat(e.message))}),e.remote.on("close",function(e,t){
|
|
163
|
+
[1e3,1005].includes(e)||d||p("WebSocket closed unexpectedly: ".concat(e," ").concat(t||"(no reason)"))}),e.duplex=ti(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,l,s;try{var u=JSON.parse(t.toString());switch(null==u?void 0:u.type){case"init":var m=u.data;"successful"!==m.auth?p("Command initialization failed: ".concat(null!==(n=null==m?void 0:m.message)&&void 0!==n?n:"Reason unknown")):e.emit("auth-success",m);break;case"completion":i=u.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":
|
|
164
|
+
var c=(null===(o=e.execConfig)||void 0===o?void 0:o.encoding)?Buffer.from(u.data,e.execConfig.encoding):u.data;e.emit("std-out-data",c),e.stdOut.write(u.data,null===(a=e.execConfig)||void 0===a?void 0:a.encoding);break;case"stdErr":var v=(null===(d=e.execConfig)||void 0===d?void 0:d.encoding)?Buffer.from(u.data,e.execConfig.encoding):u.data;e.emit("std-err-data",v),e.stdErr.write(u.data,null===(l=e.execConfig)||void 0===l?void 0:l.encoding);break;case"error":p((null===(s=u.data)||void 0===s?void 0:s.message)||"Unknown error");break;default:var h="unable to parse message: ".concat(JSON.stringify(u));p(h)}}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")
|
|
165
|
+
}else n(Error("Command is already running"))}),[2,this.currentCommand]})})},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:{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}(t),mi=function(e){function t(t,n,r,a,i,d){void 0===a&&(a=new o.PassThrough),void 0===i&&(i=new o.PassThrough),void 0===d&&(d=new o.PassThrough);var p=e.call(this)||this;return p.execConfig=t,p.token=n,p.session=r,p.stdOut=a,p.stdErr=i,p.stdIn=d,p.waitForCommandResult=function(){return W(p,void 0,void 0,function(){
|
|
166
|
+
return $(this,function(e){switch(e.label){case 0:if(void 0===this.currentCommand)throw new Error("No command is running");return[4,this.currentCommand];case 1:return[2,e.sent()]}})})},p.sendInputToCurrentCommand=function(e){return W(p,void 0,void 0,function(){var t;return $(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]})})},p.resizeTerminal=function(e){return W(p,void 0,void 0,function(){var t,n;return $(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]})})},p.getHashingKey=function(){var e
|
|
167
|
+
;return p.execConfig.entityId+(null!==(e=p.execConfig.instanceName)&&void 0!==e?e:"na")},p.constructPayloadPacket=function(e){return"".concat(JSON.stringify({type:"stdin",data:{data:e.toString()}}),"\n")},p.stdInEndPacket="".concat(JSON.stringify({type:"stdInEnd"}),"\n"),p}return z(t,e),t.prototype.start=function(){return W(this,void 0,void 0,function(){var e=this;return $(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){
|
|
168
|
+
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.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":
|
|
169
|
+
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);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"))}),
|
|
170
|
+
[2,this.currentCommand]})})},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:"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}(t),ci=["us","eu","asia"],vi=function(){function e(e,t,n){var r=this;this.contextProvider=e,this.agent=t,this.sessionRegistry={},this.assertStartedWithNodejs=function(){if(!Ro)throw new Error("Command exec only possible when started with nodejs")},null==n||n.forEach(function(e){
|
|
171
|
+
r.http2Session({execLocationHint:e})})}return e.prototype.http2Session=function(e){var t,n=this,r=function(){if(e.execLocationHint){var t=e.execLocationHint;if(!ci.includes(t))throw new Error("execLocationHint (".concat(t,") not valid. Must be one of [").concat(ci.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=A(o);return this.sessionRegistry[r]=a,a},e.prototype.execServiceCommand=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){return n=e.serviceId,r=e.projectId,o=e.teamId,a=J({teamId:o,projectId:r,entityId:n,entityType:"service"},t),[2,this.execCommand(a)]})})},e.prototype.execServiceSession=function(e,t,n){
|
|
172
|
+
return W(this,void 0,void 0,function(){var r,o,a,i;return $(this,function(d){switch(d.label){case 0:return r=e.serviceId,o=e.projectId,a=e.teamId,i=J({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 W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){return n=e.jobId,r=e.projectId,o=e.teamId,a=J({teamId:o,projectId:r,entityId:n,entityType:"job"},t),[2,this.execCommand(a)]})})},e.prototype.execJobSession=function(e,t,n){return W(this,void 0,void 0,function(){var r,o,a,i;return $(this,function(d){switch(d.label){case 0:return r=e.jobId,o=e.projectId,a=e.teamId,i=J({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 W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){return n=e.addonId,r=e.projectId,o=e.teamId,a=J({teamId:o,
|
|
173
|
+
projectId:r,entityId:n,entityType:"addon"},t),[2,this.execCommand(a)]})})},e.prototype.execAddonSession=function(e,t,n){return W(this,void 0,void 0,function(){var r,o,a,i;return $(this,function(d){switch(d.label){case 0:return r=e.addonId,o=e.projectId,a=e.teamId,i=J({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 W(this,void 0,void 0,function(){var t,n,r,o,a;return $(this,function(i){switch(i.label){case 0:this.assertStartedWithNodejs(),t=this.getCommandRunner(J({shell:"none"},e)),n=new Do,r=new Do,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 W(this,void 0,void 0,function(){var n,r;return $(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 mi(J({
|
|
175
|
+
shell:"none"},e),n,this.http2Session({execLocationOverride:o})):r?new mi(J({shell:"none"},e),n,this.http2Session({execLocationHint:r})):new ui(t,e,n,this.agent)},e}(),hi=Object.defineProperty,fi="object"==typeof process&&process?process:{stdout:null,stderr:null
|
|
175
176
|
},Ii=e=>!!e&&"object"==typeof e&&(e instanceof td||e instanceof a||wi(e)||gi(e)),wi=e=>!!e&&"object"==typeof e&&e instanceof k&&"function"==typeof e.pipe&&e.pipe!==a.Writable.prototype.pipe,gi=e=>!!e&&"object"==typeof e&&e instanceof k&&"function"==typeof e.write&&"function"==typeof e.end,bi=Symbol("EOF"),yi=Symbol("maybeEmitEnd"),Ri=Symbol("emittedEnd"),ji=Symbol("emittingEnd"),Ui=Symbol("emittedError"),Ci=Symbol("closed"),Ei=Symbol("read"),_i=Symbol("flush"),Si=Symbol("flushChunk"),Ni=Symbol("encoding"),Ai=Symbol("decoder"),ki=Symbol("flowing"),Pi=Symbol("paused"),Ti=Symbol("resume"),Di=Symbol("buffer"),Oi=Symbol("pipes"),xi=Symbol("bufferLength"),Li=Symbol("bufferPush"),qi=Symbol("bufferShift"),Bi=Symbol("objectMode"),Vi=Symbol("destroyed"),Fi=Symbol("error"),Mi=Symbol("emitData"),Gi=Symbol("emitEnd"),zi=Symbol("emitEnd2"),Ji=Symbol("async"),Wi=Symbol("abort"),$i=Symbol("aborted"),Hi=Symbol("signal"),Zi=Symbol("dataListeners"),Yi=Symbol("discarded"),Ki=e=>Promise.resolve().then(e),Xi=e=>e(),Qi=class{
|
|
176
177
|
src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[Ti](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ed=class extends Qi{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)}},td=class extends k{[ki]=!1;[Pi]=!1;[Oi]=[];[Di]=[];[Bi];[Ni];[Ji];[Ai];[bi]=!1;[Ri]=!1;[ji]=!1;[Ci]=!1;[Ui]=null;[xi]=0;[Vi]=!1;[Hi];[$i]=!1;[Zi]=0;[Yi]=!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[Bi]=!0,this[Ni]=null):(e=>!e.objectMode&&!!e.encoding&&"buffer"!==e.encoding)(t)?(this[Ni]=t.encoding,this[Bi]=!1):(this[Bi]=!1,this[Ni]=null),this[Ji]=!!t.async,
|
|
177
178
|
this[Ai]=this[Ni]?new P(this[Ni]):null,t&&!0===t.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[Di]}),t&&!0===t.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[Oi]});let{signal:n}=t;n&&(this[Hi]=n,n.aborted?this[Wi]():n.addEventListener("abort",()=>this[Wi]()))}get bufferLength(){return this[xi]}get encoding(){return this[Ni]}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[Bi]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ji]}set async(e){this[Ji]=this[Ji]||!!e}[Wi](){this[$i]=!0,this.emit("abort",this[Hi]?.reason),this.destroy(this[Hi]?.reason)}get aborted(){return this[$i]}set aborted(e){}write(e,t,n){if(this[$i])return!1;if(this[bi])throw new Error("write after end")
|
|
@@ -264,39 +265,39 @@ q.open(e.file,a,i)):d||!p?o(d):void q.fstat(p,(a,i)=>{if(a)return q.close(p,()=>
|
|
|
264
265
|
"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 W(n,void 0,void 0,function(){var e,t,n;return $(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 W(n,void 0,void 0,function(){var t;return $(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 W(n,void 0,void 0,function(){var t;return $(this,function(n){switch(n.label){case 0:return t=["test","-d",e],[4,this.runCommand(t)];case 1:return[2,0===n.sent().commandResult.exitCode]}})})},
|
|
265
266
|
this.checkIsFileRemote=function(e){return W(n,void 0,void 0,function(){var t;return $(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 W(n,H([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"),$(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]}})})},this.runSession=function(e){return W(n,void 0,void 0,function(){
|
|
266
267
|
var t,n,r,o,a,i,d,p,l,s,u;return $(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 W(this,void 0,void 0,function(){var r,o,a,i,d,p,l,s,u,m,c,v;return $(this,function(h){switch(h.label){case 0:if(void 0===e||!b.existsSync(e))throw new Error("Local path '".concat(e,"' does not exists but is required for uploads."))
|
|
267
|
-
;return r=b.lstatSync(e).isFile(),o=r?y.dirname(e):e,a=r?y.basename(e):".",i=r&&void 0!==t&&""!==y.extname(t),d=i?y.dirname(t):null!=t?t:o,p=void 0!==t?y.basename(t):a,l=Ns({gzip
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
void 0!==
|
|
277
|
-
|
|
278
|
-
|
|
268
|
+
;return r=b.lstatSync(e).isFile(),o=r?y.dirname(e):e,a=r?y.basename(e):".",i=r&&void 0!==t&&""!==y.extname(t),d=i?y.dirname(t):null!=t?t:o,p=void 0!==t?y.basename(t):a,l=Ns({gzip:!0,cwd:o,filter:this.getFileIgnoreFilter(n),preservePaths:!0,onWriteEntry:i?this.getTarTransformFn(a,p):void 0},Po(a)),[4,this.ensureTarCmd()];case 1:return h.sent(),[4,this.ensureDirRemote(d)];case 2:return h.sent(),s=H(H(["tar","-xzvf","-"],["--no-same-owner"],!0),["-C",d],!1),[4,this.runSession(s)];case 3:return u=h.sent(),m=new Do,c=new Do,u.stdErr.pipe(m),u.stdOut.pipe(c),l.pipe(u.stdIn),[4,u.waitForCommandResult()];case 4:if("Success"!==(null==(v=h.sent())?void 0:v.status))throw new Error("Failed to upload file to container: ".concat(null==v?void 0:v.message,", error details: ").concat(m.getContentsAsString(),"; ").concat(c.getContentsAsString()));return r?[2,{type:Vu.FILE_UPLOAD,sourceDirectory:o,sourceFile:a,targetDirectory:d,targetFile:p}]:[2,{type:Vu.DIRECTORY_UPLOAD,sourceDirectory:o,
|
|
269
|
+
targetDirectory:d}]}})})},e.prototype.uploadStream=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a,i,p,l;return $(this,function(s){switch(s.label){case 0:return n=function(e){var t="string"==typeof e,n=Buffer.isBuffer(e);return t||n?d.from(e):e},r=y.dirname(t),[4,this.ensureTarCmd()];case 1:return s.sent(),[4,this.ensureDirRemote(r)];case 2:return s.sent(),o=["tee",t],[4,this.runSession(o)];case 3:return a=s.sent(),i=new Do,p=new Do,a.stdErr.pipe(i),a.stdOut.pipe(p),n(e).pipe(a.stdIn),[4,a.waitForCommandResult()];case 4:return l=s.sent(),[4,this.runCommand(["cat",t])];case 5:if(s.sent(),"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(i.getContentsAsString(),"; ").concat(p.getContentsAsString()));return[2]}})})},e.prototype.downloadFiles=function(e,t,n){return W(this,void 0,void 0,function(){var r,o,a,i,d,p,l,s,u,m,c,v,h,f;return $(this,function(I){switch(I.label){
|
|
270
|
+
case 0:return(r=void 0===e)?[3,2]:[4,this.pathExistsRemote(e)];case 1:r=!I.sent(),I.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=I.sent(),a=o?e:y.dirname(e),i=o?".":y.basename(e),d=void 0!==t&&""!==y.extname(t),p=!o&&d?y.basename(t):i,(l=void 0!==t?d?y.dirname(t):t:".")&&b.mkdirSync(l,{recursive:!0}),s=Po(null!=n?n:[]).map(function(e){return"--exclude=".concat(e)}),u=H(H(["tar","-zcf","-"],["--no-same-owner"],!0),s,!0),m=H(H([],u,!0),["-C",a,i],!1),[4,this.runSession(m)];case 4:return c=I.sent(),v=Pu({cwd:l,gzip:{encoding:this.defaultEncoding},onReadEntry:p?this.getTarTransformFn(i,p):void 0}),h=new Do,c.stdErr.pipe(h),c.stdOut.pipe(v),[4,c.waitForCommandResult()];case 5:if("Success"!==(null==(f=I.sent())?void 0:f.status))throw new Error("Failed to download file from container: ".concat(null==f?void 0:f.message,", error details: ").concat(h.getContentsAsString()))
|
|
271
|
+
;return o?[2,{type:Vu.DIRECTORY_DOWNLOAD,sourceDirectory:a,targetDirectory:l}]:[2,{type:Vu.FILE_DOWNLOAD,sourceDirectory:a,sourceFile:i,targetDirectory:l,targetFile:p}]}})})},e.prototype.downloadStream=function(e){return W(this,void 0,void 0,function(){var t,n,r,o;return $(this,function(a){switch(a.label){case 0:return[4,this.checkIsFileRemote(e)];case 1:if(!a.sent())throw new Error("Remote path '".concat(e,"' must be a file."));return t=y.dirname(e),[4,this.ensureTarCmd()];case 2:return a.sent(),[4,this.ensureDirRemote(t)];case 3:return a.sent(),n=["cat",e],[4,this.runSession(n)];case 4:return r=a.sent(),o=new Do,r.stdErr.pipe(o),[2,{fileStream:r.stdOut,completionPromise:r.waitForCommandResult().then(function(e){return 0===e.exitCode})}]}})})},e}(),Ju=function(){function e(e,t){this.exec=e,this.stdIgnoreList=["*.*~"],t&&(this.stdIgnoreList=t)}return e.prototype.downloadServiceFiles=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){
|
|
272
|
+
switch(i.label){case 0:return n=e.serviceId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"service"},[4,this.copy(a,t,"download")];case 1:return[2,i.sent()]}})})},e.prototype.downloadServiceFileStream=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.serviceId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"service"},[4,new zu(this.exec,J(J({},a),{instanceName:t.instanceName,containerName:t.containerName})).downloadStream(t.remotePath)];case 1:return[2,i.sent()]}})})},e.prototype.uploadServiceFiles=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.serviceId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"service"},[4,this.copy(a,t,"upload")];case 1:return[2,i.sent()]}})})},e.prototype.uploadServiceFileStream=function(e,t){
|
|
273
|
+
return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.serviceId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"service"},[4,new zu(this.exec,J(J({},a),{instanceName:t.instanceName,containerName:t.containerName})).uploadStream(t.source,t.remotePath)];case 1:return[2,i.sent()]}})})},e.prototype.downloadJobFiles=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.jobId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"job"},[4,this.copy(a,t,"download")];case 1:return[2,i.sent()]}})})},e.prototype.downloadJobFileStream=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.jobId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"job"},[4,new zu(this.exec,J(J({},a),{instanceName:t.instanceName,
|
|
274
|
+
containerName:t.containerName})).downloadStream(t.remotePath)];case 1:return[2,i.sent()]}})})},e.prototype.uploadJobFiles=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.jobId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"job"},[4,this.copy(a,t,"upload")];case 1:return[2,i.sent()]}})})},e.prototype.uploadJobFileStream=function(e,t){return W(this,void 0,void 0,function(){var n,r,o,a;return $(this,function(i){switch(i.label){case 0:return n=e.jobId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"job"},[4,new zu(this.exec,J(J({},a),{instanceName:t.instanceName,containerName:t.containerName})).uploadStream(t.source,t.remotePath)];case 1:return[2,i.sent()]}})})},e.prototype.copy=function(e,t,n){return W(this,void 0,void 0,function(){var r,o,a;return $(this,function(i){switch(i.label){case 0:switch(r=new zu(this.exec,J(J({},e),{instanceName:t.instanceName,
|
|
275
|
+
containerName:t.containerName,execLocationHint:t.execLocationHint})),o=H(H([],null!==(a=t.ignoreList)&&void 0!==a?a:[],!0),this.stdIgnoreList,!0),n){case"download":return[3,1];case"upload":return[3,3]}return[3,5];case 1:return[4,r.downloadFiles(t.remotePath,t.localPath,o)];case 2:case 4:return[2,i.sent()];case 3:return[4,r.uploadFiles(t.localPath,t.remotePath,o)];case 5:return[2]}})})},e}(),Wu=function(e){function t(t){var n=this.constructor,r=e.call(this,t.message)||this;r.name="NorthflankApiCallError",r.message=t.message,r.status=t.status,r.id=t.id,r.details=t.details;var o=n.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(r,o):r.__proto__=o,r}return z(t,e),t}(Error);!function(e){e.CDN="cdn",e.Mesh="mesh",e.Ingress="ingress",e.Runtime="runtime"}(Gu||(Gu={}));var $u,Hu,Zu=function(e){return{containerId:e.containerId,log:e.log,ts:new Date(e.ts)}},Yu=function(e){function t(t,n,r,o){var a=e.call(this)||this;return a.baseUrl=t,a.logsConfig=n,a.token=r,a.agent=o,
|
|
276
|
+
a.stop=function(){return W(a,void 0,void 0,function(){var e;return $(this,function(t){if(void 0===this.logSession)throw new Error("No command is running");return null===(e=this.remote)||void 0===e||e.close(),[2]})})},a}return z(t,e),t.getLogsEndpoint=function(e){var t=e.containerName,n=e.types,r=e.entityId,o=e.entityType,a=e.buildId,i=e.runId,d=e.backupId,p=e.restoreId,l=e.deploymentId,s=e.isBuild,u=e.lineLimit,m=e.teamId,c=e.projectId,v=e.queryType,h=e.startTime,f=e.endTime,I=e.duration,w=e.direction,g=e.textIncludes,b=e.textNotIncludes,y=e.regexIncludes,R=e.regexNotIncludes,j=void 0!==m?"teams/".concat(m,"/"):"",U="/v1/".concat(j,"projects/").concat(c,"/"),C=new URLSearchParams;return C.append("queryType",v),void 0!==h&&C.append("startTime",h.toISOString()),void 0!==f&&C.append("endTime",f.toISOString()),void 0!==u&&C.append("lineLimit",u.toString()),void 0!==t&&C.append("containerName",t),void 0!==l&&C.append("deploymentId",l),void 0!==i&&C.append("runId",i),
|
|
277
|
+
void 0!==a&&C.append("buildId",a),void 0!==g&&C.append("textIncludes",g),void 0!==b&&C.append("textNotIncludes",b),void 0!==y&&C.append("regexIncludes",y),void 0!==R&&C.append("regexNotIncludes",R),void 0!==w&&C.append("direction",w),void 0!==I&&C.append("duration",I.toString()),void 0!==n&&n.forEach(function(e){return C.append("type",e)}),"".concat(U).concat(function(){var e=s?"/build-logs":"/logs";switch(o){case"service":return"services/".concat(r).concat(e);case"job":return"jobs/".concat(r).concat(e);case"addon":return"addons/".concat(r).concat(e);case"addonBackup":return"addons/".concat(r,"/backups/").concat(d).concat(e);case"addonRestore":return"addons/".concat(r,"/backups/").concat(d,"/restores/").concat(p).concat(e);default:throw new Error("Unexpected Northflank entity type received in logs endpoint generation: ".concat(o))}}(),"?").concat(C.toString())},Object.defineProperty(t.prototype,"logsEndpoint",{get:function(){
|
|
278
|
+
return"".concat(this.baseUrl).concat(t.getLogsEndpoint(this.logsConfig))},enumerable:!1,configurable:!0}),t.prototype.start=function(){return W(this,void 0,void 0,function(){var e=this;return $(this,function(t){switch(t.label){case 0:if(void 0!==this.logSession)throw new Error("Command is already running");return this.logSession=new Promise(function(t,n){var r,o,a,i;void 0!==e.remote&&n(Error("Command is already running"));var d=e.logsEndpoint.replace("https:","wss:").replace("http:","ws:");e.remote=new ii(d,{agent:e.agent}),null===(r=e.remote)||void 0===r||r.on("message",function(t){var n,r,o=JSON.parse(t.toString());switch(null==o?void 0:o.type){case"init":var a=o.data;"successful"!==a.auth&&p("Log tail initialization failed: ".concat(null!==(n=null==a?void 0:a.message)&&void 0!==n?n:"Reason unknown"));break;case"log-lines":var i=o.data;e.emit("logs-received",i.map(Zu));break;case"error":p(null===(r=o.data)||void 0===r?void 0:r.message);break;default:
|
|
279
|
+
var d="unable to parse message: ".concat(JSON.stringify(o));p(d)}}),null===(o=e.remote)||void 0===o||o.on("close",function(){e.emit("close"),e.reset(),t()}),null===(a=e.remote)||void 0===a||a.on("open",function(){e.emit("open")}),null===(i=e.remote)||void 0===i||i.on("error",function(n){e.emit("error",n),e.reset(),t()});var p=function(t){e.emit("error",{message:t}),e.reset(),n(new Error(t))}}),[4,new Promise(function(t){var n;e.remote.on("open",function(){return t()}),null===(n=e.remote)||void 0===n||n.on("error",function(){t()})})];case 1:return t.sent(),this.initialAuth(),[2,this.logSession]}})})},t.prototype.initialAuth=function(){var e,t={type:"init",data:{auth:{type:"apiToken",apiToken:this.token}}};null===(e=this.remote)||void 0===e||e.send(JSON.stringify(t))},t.prototype.reset=function(){this.remote=void 0,this.logSession=void 0},t}(t),Ku=function(){if(void 0!==$u)return $u;if(Ro)try{
|
|
279
280
|
var e=JSON.parse(b.readFileSync(y.join(y.dirname(u(import.meta.url)),"../../package.json")).toString());$u=null==e?void 0:e.version}catch(e){$u=void 0}return $u},Xu=function(){function e(e,t){var n=this;this.opts=t,this.call=function(e){return W(n,void 0,void 0,function(){return $(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(Ku()).concat(n)}},e.prototype.executeCall=function(e){return W(this,void 0,void 0,function(){var t,n,r,o,a,i,d,p,l,s,u,m,c,v=this;return $(this,function(h){switch(h.label){case 0:if(t=this.method,n=this.opts.agent,r={method:t,headers:this.getDefaultHeaders(),agent:n},
|
|
280
281
|
!(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=J(J({url:a},r),{body:i}),[4,dm(a,J(J({},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 Wu(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}(),Qu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
281
282
|
;return t.method="get",t.body=function(){},t}return z(t,e),t}(Xu),em=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.all=function(e){return W(t,void 0,void 0,function(){return $(this,function(t){return[2,new am(this,e).getAll()]})})},t.call=function(n){return W(t,void 0,void 0,function(){var t,r=this;return $(this,function(o){switch(o.label){case 0:return[4,e.prototype.executeCall.call(this,n)];case 1:return t=o.sent(),[2,J(J({},t),{pagination:J(J({},t.pagination),{getNextPage:function(){return W(r,void 0,void 0,function(){var e,r,o,a,i,d,p,l=this;return $(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=J(J({},t),{pagination:J(J({},t.pagination),{count:0}),data:r}),[2,(a=function(e){return J(J({},e),{pagination:J(J({},e.pagination),{getNextPage:function(){return W(l,void 0,void 0,function(){return $(this,function(t){return[2,a(e)]})})}})})
|
|
282
|
-
})(o)]):[2,new am(this,n,null===(p=t.pagination)||void 0===p?void 0:p.cursor).getNext()]})})}})})]}})})},t}return z(t,e),t}(Qu),tm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="post",t}return z(t,e),t}(Xu),nm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="delete",t
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
283
|
+
})(o)]):[2,new am(this,n,null===(p=t.pagination)||void 0===p?void 0:p.cursor).getNext()]})})}})})]}})})},t}return z(t,e),t}(Qu),tm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="post",t}return z(t,e),t}(Xu),nm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="delete",t}return z(t,e),t}(Xu),rm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="put",t}return z(t,e),t}(Xu),om=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.method="patch",t}return z(t,e),t}(Xu),am=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 W(this,void 0,void 0,function(){
|
|
284
|
+
var e,t,n,r,o,a,i,d,p;return $(this,function(l){switch(l.label){case 0:return[4,this.endpoint.call(J(J({},this.opts),{options:J(J({},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,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 W(this,void 0,void 0,function(){var e,t,n,r,o,a,i;return $(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,
|
|
285
|
+
rawResponse:null===(i=e[0])||void 0===i?void 0:i.rawResponse}]}})})},e}(),im=function(e){return new Promise(function(t){setTimeout(function(){t()},e)})},dm=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){return jo(e,t).then(function(e){o(e)}).catch(function(e){return W(void 0,void 0,void 0,function(){return $(this,function(t){switch(t.label){case 0:return n>0?[4,im(r)]:[3,2];case 1:return t.sent(),[2,i(n-1)];case 2:return[2,a(e)]}})})})};return i(n)})},pm=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 Yu.getLogsEndpoint(e)},t.body=function(){},t}return z(t,e),t}(Qu),lm=function(e,t){void 0===t&&(t={});var n=this;this.contextProvider=e,this.clientOpts=t,this.getServiceLogs=function(e){
|
|
286
|
+
return W(n,void 0,void 0,function(){var t,n,r;return $(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 W(n,void 0,void 0,function(){var t,n,r,o,a,i;return $(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,J(J({},n),{isBuild:!0}),"service")]})})},this.getJobLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r;return $(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 W(n,void 0,void 0,function(){var t,n,r,o,a,i;return $(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,J(J({},n),{isBuild:!0
|
|
287
|
+
}),"job")]})})},this.getAddonLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r;return $(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){return W(n,void 0,void 0,function(){var t,n,r;return $(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.addonId,projectId:t.projectId,teamId:t.teamId},[2,this.logRange(r,J(J({},n),{backupId:t.backupId}),"addonBackup")]})})},this.getAddonRestoresLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r,o,a,i,d;return $(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,J(J({},n),d),"addonRestore")]})})},this.logRange=function(e,t,r){return W(n,void 0,void 0,function(){var n,o,a,i,d,p;return $(this,function(l){switch(l.label){case 0:return n=e.entityId,
|
|
288
|
+
o=e.projectId,a=e.teamId,i=J(J({teamId:a,projectId:o,entityId:n,entityType:r},t),{queryType:"range"}),[4,new pm(this.contextProvider,this.clientOpts).call(i)];case 1:return(d=l.sent()).error?[2,d]:[2,J(J({},d),{data:null===(p=null==d?void 0:d.data)||void 0===p?void 0:p.map(Zu)})]}})})},this.tailServiceLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r;return $(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.serviceId,projectId:t.projectId,teamId:t.teamId},[2,this.logTail(r,null!=n?n:{},"service")]})})},this.tailServiceBuildLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.serviceId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.logTail(i,J(J({},n),{isBuild:!0}),"service")]})})},this.tailJobLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r;return $(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.jobId,projectId:t.projectId,
|
|
289
|
+
teamId:t.teamId},[2,this.logTail(r,null!=n?n:{},"job")]})})},this.tailJobBuildLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r,o,a;return $(this,function(i){return t=e.parameters,n=e.options,r=t.projectId,o=t.jobId,a={entityId:o,projectId:r,teamId:t.teamId},[2,this.logTail(a,J(J({},n),{isBuild:!0}),"job")]})})},this.tailAddonLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r;return $(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.addonId,projectId:t.projectId,teamId:t.teamId},[2,this.logTail(r,null!=n?n:{},"addon")]})})},this.tailAddonBackupLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r;return $(this,function(o){return t=e.parameters,n=e.options,r={entityId:t.addonId,projectId:t.projectId,teamId:t.teamId},[2,this.logTail(r,J(J({},n),{backupId:t.backupId}),"addonBackup")]})})},this.tailAddonRestoresLogs=function(e){return W(n,void 0,void 0,function(){var t,n,r,o;return $(this,function(a){return t=e.parameters,n=e.options,r={
|
|
290
|
+
entityId:t.addonId,projectId:t.projectId},o={backupId:t.backupId,restoreId:t.restoreId},[2,this.logTail(r,J(J({},n),o),"addonRestore")]})})},this.logTail=function(e,t,r){return W(n,void 0,void 0,function(){var n,o,a,i,d,p;return $(this,function(l){if(n=e.entityId,o=e.projectId,a=e.teamId,i=J({queryType:"tail",teamId:a,projectId:o,entityId:n,entityType:r},t),this.assertStartedWithNodejs(),d=this.contextProvider.getCurrentBaseUrl(!0),!(p=this.contextProvider.getCurrentToken()))throw new Error("API token not found");return[2,new Yu(d,i,p,this.clientOpts.agent)]})})},this.assertStartedWithNodejs=function(){if(!Ro)throw new Error("Command exec only possible when started with nodejs")}},sm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Fetch metrics entries over a specific time span",t.withAuth=!0,t.requiredPermissions="Account > Service | Job | Addon > General > Read",t.endpointUrl=function(e){
|
|
291
|
+
var t=e.teamId,n=e.projectId,r=e.entityId,o=e.entityType,a=e.deploymentId,i=e.runId,d=e.buildId,p=e.isBuild,l=e.queryType,s=e.metricTypes,u=e.startTime,m=e.endTime,c=e.duration,v=e.containerName,h=e.timestamp,f=void 0!==t?"teams/".concat(t,"/"):"",I="/v1/".concat(f,"projects/").concat(n,"/");var w=new URLSearchParams;return w.append("queryType",l),void 0!==u&&w.append("startTime",u.toISOString()),void 0!==m&&w.append("endTime",m.toISOString()),void 0!==v&&w.append("containerName",v),void 0!==a&&w.append("deploymentId",a),void 0!==i&&w.append("runId",i),void 0!==d&&w.append("buildId",d),void 0!==h&&w.append("timestamp",h.toISOString()),void 0!==c&&w.append("duration",c.toString()),void 0!==s&&s.forEach(function(e){return w.append("metricTypes",e)}),"".concat(I).concat(function(){var e=p?"/build-metrics":"/metrics";switch(o){case"service":return"services/".concat(r).concat(e);case"job":return"jobs/".concat(r).concat(e);case"addon":return"addons/".concat(r).concat(e);default:
|
|
292
|
+
throw new Error("Unexpected Northflank entity type received in metrics endpoint generation: ".concat(o))}}(),"?").concat(w.toString())},t.body=function(){},t}return z(t,e),t}(Qu),um=function(e){return{metadata:e.metadata,data:e.data.map(function(e){return{value:e.value,ts:new Date(e.ts)}})}};!function(e){e.Cpu="cpu",e.Memory="memory",e.NetworkIngress="networkIngress",e.NetworkEgress="networkEgress",e.TcpConnectionOpen="tcpConnectionsOpen",e.PvcUsage="diskUsage",e.Requests="requests",e.Http4xxResponses="http4xxResponses",e.Http5xxResponses="http5xxResponses",e.Bandwidth="bandwidth",e.BandwidthVolume="bandwidthVolume"}(Hu||(Hu={}));var mm=function(e){var t=this;this.contextProvider=e,this.getServiceMetrics=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.serviceId,o=t.projectId,a=t.teamId,i={teamId:a,entityId:r,projectId:o},[2,this.metricsSingle(i,null!=n?n:{},"service")]})})},
|
|
293
|
+
this.getServiceBuildMetrics=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.serviceId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsSingle(i,J(J({},n),{isBuild:!0}),"service")]})})},this.getJobMetrics=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.jobId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsSingle(i,null!=n?n:{},"job")]})})},this.getJobBuildMetrics=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.jobId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsSingle(i,J(J({},n),{isBuild:!0}),"job")]})})},this.getAddonMetrics=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.addonId,
|
|
294
|
+
o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsSingle(i,null!=n?n:{},"addon")]})})},this.metricsSingle=function(e,n,r){return W(t,void 0,void 0,function(){var t,o,a,i;return $(this,function(d){return t=e.entityId,o=e.projectId,a=e.teamId,i=J(J({teamId:a,projectId:o,entityId:t,entityType:r},n),{queryType:"single"}),[2,this.getMetrics(i)]})})},this.getServiceMetricsRange=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.serviceId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsRange(i,null!=n?n:{},"service")]})})},this.getServiceBuildMetricsRange=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(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.metricsRange(i,J(J({},n),{isBuild:!0}),"service")]})})},this.getJobMetricsRange=function(e){
|
|
295
|
+
return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(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.metricsRange(i,null!=n?n:{},"job")]})})},this.getJobBuildMetricsRange=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(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.metricsRange(i,J(J({},n),{isBuild:!0}),"job")]})})},this.getAddonMetricsRange=function(e){return W(t,void 0,void 0,function(){var t,n,r,o,a,i;return $(this,function(d){return t=e.parameters,n=e.options,r=t.projectId,o=t.addonId,a=t.teamId,i={entityId:o,projectId:r,teamId:a},[2,this.metricsRange(i,null!=n?n:{},"addon")]})})},this.metricsRange=function(e,n,r){return W(t,void 0,void 0,function(){var t,o,a,i;return $(this,function(d){return t=e.entityId,o=e.projectId,a=e.teamId,i=J(J({teamId:a,projectId:o,entityId:t,entityType:r},n),{
|
|
296
|
+
queryType:"range"}),[2,this.getMetrics(i)]})})},this.getMetrics=function(e){return W(t,void 0,void 0,function(){var t;return $(this,function(n){switch(n.label){case 0:return[4,new sm(this.contextProvider,{}).call(e)];case 1:return(t=n.sent()).error?[2,t]:[2,J(J({},t),{data:Object.fromEntries(Object.entries(t.data).map(function(e){var t=e[0],n=e[1];return[t,J(J({},n),{values:n.values.map(um)})]}))})]}})})}},cm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Gets information about the available addon types",t.withAuth=!0,t.requiredPermissions="undefined",t.endpointUrl=function(e){return"/v1/addon-types"},t.body=function(){},t}return z(t,e),t}(Qu),vm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Lists the backup destinations saved to this account. Does not display secrets.",t.withAuth=!0,t.requiredPermissions="Account > BackupDestinations > General > Read",t.endpointUrl=function(e){var t,n,r
|
|
297
|
+
;[].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,"'"))}),r=(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)?"/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/backup-destinations"):"/v1/backup-destinations";var o=Object.entries(null!==(n=null==e?void 0:e.options)&&void 0!==n?n:{}).filter(function(e){return void 0!==e[1]}),a=o.length>0?"?".concat(o.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(r).concat(a)},t.body=function(){},t}return z(t,e),t}(em),hm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Adds a new backup destination to this account.",t.withAuth=!0,t.requiredPermissions="Account > BackupDestinations > General > Create",t.endpointUrl=function(e){var t
|
|
298
|
+
;return[].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)?"/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/backup-destinations"):"/v1/backup-destinations"},t.body=function(e){return JSON.stringify(e.data)},t}return z(t,e),t}(tm),fm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="View a backup destination, including secrets.",t.withAuth=!0,t.requiredPermissions="Account > BackupDestinations > General > Read",t.endpointUrl=function(e){var t,n,r,o;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,"'"))}),
|
|
299
|
+
(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)&&"backupDestinationId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.backupDestinationId))o="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/backup-destinations/").concat(encodeURIComponent(e.parameters.backupDestinationId));else{if(!(null==e?void 0:e.parameters)||!("backupDestinationId"in(null==e?void 0:e.parameters))||void 0===(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.backupDestinationId))throw new Error("No matching endpoint URL found for provided parameters");o="/v1/backup-destinations/".concat(encodeURIComponent(e.parameters.backupDestinationId))}return o},t.body=function(){},t}return z(t,e),t}(Qu),Im=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
300
|
+
;return t.description="Updates a backup destination.",t.withAuth=!0,t.requiredPermissions="Account > BackupDestinations > General > Update",t.endpointUrl=function(e){var t,n,r,o;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)&&"backupDestinationId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.backupDestinationId))o="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/backup-destinations/").concat(encodeURIComponent(e.parameters.backupDestinationId));else{
|
|
300
301
|
if(!(null==e?void 0:e.parameters)||!("backupDestinationId"in(null==e?void 0:e.parameters))||void 0===(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.backupDestinationId))throw new Error("No matching endpoint URL found for provided parameters");o="/v1/backup-destinations/".concat(encodeURIComponent(e.parameters.backupDestinationId))}return o},t.body=function(e){return JSON.stringify(e.data)},t}return z(t,e),t}(om),wm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Delete a backup destination.",t.withAuth=!0,t.requiredPermissions="Account > BackupDestinations > General > Delete",t.endpointUrl=function(e){var t,n,r,o;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,"'"))}),
|
|
301
302
|
(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)&&"backupDestinationId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.backupDestinationId))o="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/backup-destinations/").concat(encodeURIComponent(e.parameters.backupDestinationId));else{if(!(null==e?void 0:e.parameters)||!("backupDestinationId"in(null==e?void 0:e.parameters))||void 0===(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.backupDestinationId))throw new Error("No matching endpoint URL found for provided parameters");o="/v1/backup-destinations/".concat(encodeURIComponent(e.parameters.backupDestinationId))}return o},t.body=function(){},t}return z(t,e),t}(nm),gm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
302
303
|
;return t.description="Lists the backups associated with a backup destinations.",t.withAuth=!0,t.requiredPermissions="Account > BackupDestinations > General > Read",t.endpointUrl=function(e){var t,n,r,o,a;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)&&"backupDestinationId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.backupDestinationId))a="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/backup-destinations/").concat(encodeURIComponent(e.parameters.backupDestinationId),"/backups");else{
|
|
@@ -620,10 +621,11 @@ t.requiredPermissions="Account > Templates > General > Create",t.endpointUrl=fun
|
|
|
620
621
|
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 z(t,e),t}(tm),Hh=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
|
|
621
622
|
;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{
|
|
622
623
|
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 z(t,e),t}(em),Zh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
623
|
-
;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,"'"))}),
|
|
624
|
-
(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))
|
|
625
|
-
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");
|
|
626
|
-
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,"'"))}),
|
|
624
|
+
;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,"'"))}),
|
|
625
|
+
(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{
|
|
626
|
+
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("&")):""
|
|
627
|
+
;return"".concat(l).concat(u)},t.body=function(e){return JSON.stringify(e.data)},t}return z(t,e),t}(nm),Yh=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,"'"))}),
|
|
628
|
+
(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{
|
|
627
629
|
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 z(t,e),t}(tm),Kh=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
|
|
628
630
|
;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{
|
|
629
631
|
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 z(t,e),t}(em),Xh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get information about the given preview template run.",
|
|
@@ -660,10 +662,10 @@ if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&
|
|
|
660
662
|
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 z(t,e),t}(nm),uf=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
|
|
661
663
|
;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{
|
|
662
664
|
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 z(t,e),t}(em),mf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
663
|
-
;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,"'"))}),
|
|
664
|
-
(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))
|
|
665
|
-
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");
|
|
666
|
-
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,"'"))}),
|
|
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,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,"'"))}),
|
|
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))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{
|
|
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");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("&")):""
|
|
668
|
+
;return"".concat(l).concat(u)},t.body=function(e){return JSON.stringify(e.data)},t}return z(t,e),t}(nm),cf=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,"'"))}),
|
|
667
669
|
(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{
|
|
668
670
|
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 z(t,e),t}(tm),vf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
669
671
|
;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,"'"))}),
|