@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/cjs/api-client.js
CHANGED
|
@@ -158,21 +158,21 @@ return[2,(u.address=m.sent(),u.port=o.internalPort,u)]}})})},n.prototype.consist
|
|
|
158
158
|
return[4,Mo.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,mo(5)(function(){return T(n,void 0,void 0,function(){return D(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,mo(5)(function(){return T(n,void 0,void 0,function(){return D(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]}})})},n.prototype.stopProjectForwarding=function(e){return T(this,void 0,void 0,function(){var t=this;return D(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]}})})},n.prototype.stopServiceForwarding=function(e){return T(this,void 0,void 0,function(){var t=this;return D(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]}})})},n.prototype.stopAddonForwarding=function(e){return T(this,void 0,void 0,function(){var t=this;return D(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]}})})},n.prototype.stop=function(){return T(this,void 0,void 0,function(){var e=this;return D(this,function(t){switch(t.label){case 0:
|
|
160
160
|
return[4,Promise.all(this.connections.map(function(t){return T(e,void 0,void 0,function(){return D(this,function(e){return[2,this.stopForwarding(t)]})})}))];case 1:return t.sent(),[2]}})})},n}(e.EventEmitter),Qa=function(e){function t(t,n,r,o,a,i,d){void 0===a&&(a=new S.PassThrough),void 0===i&&(i=new S.PassThrough),void 0===d&&(d=new S.PassThrough);var p=e.call(this)||this;return p.baseUrl=t,p.execConfig=n,p.token=r,p.agent=o,p.stdOut=a,p.stdErr=i,p.stdIn=d,p.waitForCommandResult=function(){return T(p,void 0,void 0,function(){return D(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 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")
|
|
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:
|
|
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{
|
|
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
|
|
164
|
-
e.stdOut.
|
|
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
|
|
166
|
-
|
|
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,
|
|
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
|
|
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(){
|
|
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(),
|
|
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
|
|
172
|
-
|
|
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),
|
|
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(){
|
|
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
|
|
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){var t,n=(null===(t=p.execConfig)||void 0===t?void 0:t.encoding)?Buffer.from(e).toString(p.execConfig.encoding):e.toString();return JSON.stringify({type:"payload",data:n})},p.stdInEndPacket=JSON.stringify({type:"stdInEnd"}),p}return P(t,e),Object.defineProperty(t.prototype,"execEndpoint",{get:function(){
|
|
162
|
+
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":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{
|
|
163
|
+
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){[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,l,s;try{var u=JSON.parse(t.toString());switch(null==u?void 0:u.type){case"init":var m=u.data
|
|
164
|
+
;"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":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))}}),
|
|
165
|
+
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(){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
|
|
166
|
+
}(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: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){
|
|
167
|
+
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")},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,
|
|
168
|
+
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){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
|
|
169
|
+
;"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);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(){
|
|
170
|
+
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(){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(),
|
|
171
|
+
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})})}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
|
|
172
|
+
},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;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,
|
|
173
|
+
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),[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),
|
|
174
|
+
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),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(){
|
|
175
|
+
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({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")
|
|
@@ -265,50 +265,49 @@ const t=h(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(t){return
|
|
|
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
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:
|
|
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
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
;case 1:return[2,i.sent()]}})})},e.prototype.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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.
|
|
288
|
-
|
|
289
|
-
})},this.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
(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),"/cloud-providers/clusters"):"/v1/cloud-providers/clusters"},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(
|
|
311
|
-
(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),"/cloud-providers/clusters"):"/v1/cloud-providers/clusters"},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(zu),vm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get information about the given cluster",t.withAuth=!0,t.requiredPermissions="Account > Cloud > Clusters > 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,"'"))}),
|
|
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:!0,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()));return r?[2,{
|
|
269
|
+
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="string"==typeof e,r=Buffer.isBuffer(e);return t||r?n.Readable.from(e):e},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(),"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()))
|
|
270
|
+
;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:return h=g.sent(),f=bu({cwd:l,gzip:{encoding:this.defaultEncoding},onReadEntry:p?this.getTarTransformFn(i,p):void 0}),I=new Ro,h.stdErr.pipe(I),h.stdOut.pipe(f),[4,h.waitForCommandResult()];case 5:
|
|
271
|
+
if("Success"!==(null==(w=g.sent())?void 0:w.status))throw new Error("Failed to download file from container: ".concat(null==w?void 0:w.message,", error details: ").concat(I.getContentsAsString()));return o?[2,{type:exports.CopyType.DIRECTORY_DOWNLOAD,sourceDirectory:a,targetDirectory:l}]:[2,{type:exports.CopyType.FILE_DOWNLOAD,sourceDirectory:a,sourceFile:i,targetDirectory:l,targetFile:p}]}})})},e.prototype.downloadStream=function(e){return T(this,void 0,void 0,function(){var t,n,r,o;return D(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=m.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 Ro,r.stdErr.pipe(o),[2,{fileStream:r.stdOut,completionPromise:r.waitForCommandResult().then(function(e){return 0===e.exitCode})}]}})})},e}(),ku=function(){
|
|
272
|
+
function e(e,t){this.exec=e,this.stdIgnoreList=["*.*~"],t&&(this.stdIgnoreList=t)}return e.prototype.downloadServiceFiles=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(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,"download")];case 1:return[2,i.sent()]}})})},e.prototype.downloadServiceFileStream=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(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 Pu(this.exec,k(k({},a),{instanceName:t.instanceName,containerName:t.containerName})).downloadStream(t.remotePath)];case 1:return[2,i.sent()]}})})},e.prototype.uploadServiceFiles=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){switch(i.label){case 0:return n=e.serviceId,r=e.projectId,
|
|
273
|
+
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){return T(this,void 0,void 0,function(){var n,r,o,a;return D(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 Pu(this.exec,k(k({},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 T(this,void 0,void 0,function(){var n,r,o,a;return D(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 T(this,void 0,void 0,function(){var n,r,o,a;return D(this,function(i){switch(i.label){
|
|
274
|
+
case 0:return n=e.jobId,r=e.projectId,o=e.teamId,a={teamId:o,projectId:r,resourceId:n,resourceType:"job"},[4,new Pu(this.exec,k(k({},a),{instanceName:t.instanceName,containerName:t.containerName})).downloadStream(t.remotePath)];case 1:return[2,i.sent()]}})})},e.prototype.uploadJobFiles=function(e,t){return T(this,void 0,void 0,function(){var n,r,o,a;return D(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 T(this,void 0,void 0,function(){var n,r,o,a;return D(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 Pu(this.exec,k(k({},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){
|
|
275
|
+
return T(this,void 0,void 0,function(){var r,o,a;return D(this,function(i){switch(i.label){case 0:switch(r=new Pu(this.exec,k(k({},e),{instanceName:t.instanceName,containerName:t.containerName,execLocationHint:t.execLocationHint})),o=O(O([],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}(),Tu=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 P(t,e),t}(Error);exports.LogType=void 0,(Au=exports.LogType||(exports.LogType={})).CDN="cdn",Au.Mesh="mesh",Au.Ingress="ingress",Au.Runtime="runtime"
|
|
276
|
+
;var Du,Ou,Lu=function(e){return{containerId:e.containerId,log:e.log,ts:new Date(e.ts)}},qu=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,a.stop=function(){return T(a,void 0,void 0,function(){var e;return D(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 P(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,"/"):"",E="/v1/".concat(j,"projects/").concat(c,"/"),U=new URLSearchParams;return U.append("queryType",v),void 0!==h&&U.append("startTime",h.toISOString()),
|
|
277
|
+
void 0!==f&&U.append("endTime",f.toISOString()),void 0!==u&&U.append("lineLimit",u.toString()),void 0!==t&&U.append("containerName",t),void 0!==l&&U.append("deploymentId",l),void 0!==i&&U.append("runId",i),void 0!==a&&U.append("buildId",a),void 0!==g&&U.append("textIncludes",g),void 0!==b&&U.append("textNotIncludes",b),void 0!==y&&U.append("regexIncludes",y),void 0!==R&&U.append("regexNotIncludes",R),void 0!==w&&U.append("direction",w),void 0!==I&&U.append("duration",I.toString()),void 0!==n&&n.forEach(function(e){return U.append("type",e)}),"".concat(E).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:
|
|
278
|
+
throw new Error("Unexpected Northflank entity type received in logs endpoint generation: ".concat(o))}}(),"?").concat(U.toString())},Object.defineProperty(t.prototype,"logsEndpoint",{get:function(){return"".concat(this.baseUrl).concat(t.getLogsEndpoint(this.logsConfig))},enumerable:!1,configurable:!0}),t.prototype.start=function(){return T(this,void 0,void 0,function(){var e=this;return D(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 Ha(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
|
|
279
|
+
;"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(Lu));break;case"error":p(null===(r=o.data)||void 0===r?void 0:r.message);break;default: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}}
|
|
280
|
+
};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}(e.EventEmitter),Bu=function(){if(void 0!==Du)return Du;if(so)try{var e=JSON.parse(u.readFileSync(m.join(m.dirname(a.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:C&&"SCRIPT"===C.tagName.toUpperCase()&&C.src||new URL("api-client.js",document.baseURI).href)),"../../package.json")).toString());Du=null==e?void 0:e.version}catch(e){Du=void 0}return Du},Vu=function(){function e(e,t){var n=this;this.opts=t,this.call=function(e){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,
|
|
281
|
+
"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}),[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){
|
|
282
|
+
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()]})})},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){
|
|
283
|
+
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(){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(){
|
|
284
|
+
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,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){
|
|
285
|
+
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){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
|
|
286
|
+
;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(){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,
|
|
287
|
+
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){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
|
|
288
|
+
;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)})]}})})},this.tailServiceLogs=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.logTail(r,null!=n?n:{},"service")]})})},this.tailServiceBuildLogs=function(e){return T(n,void 0,void 0,function(){
|
|
289
|
+
var t,n,r,o,a,i;return D(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,k(k({},n),{isBuild:!0}),"service")]})})},this.tailJobLogs=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.logTail(r,null!=n?n:{},"job")]})})},this.tailJobBuildLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r,o,a;return D(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,k(k({},n),{isBuild:!0}),"job")]})})},this.tailAddonLogs=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,teamId:t.teamId},[2,this.logTail(r,null!=n?n:{},"addon")]})})},this.tailAddonBackupLogs=function(e){
|
|
290
|
+
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.logTail(r,k(k({},n),{backupId:t.backupId}),"addonBackup")]})})},this.tailAddonRestoresLogs=function(e){return T(n,void 0,void 0,function(){var t,n,r,o;return D(this,function(a){return t=e.parameters,n=e.options,r={entityId:t.addonId,projectId:t.projectId},o={backupId:t.backupId,restoreId:t.restoreId},[2,this.logTail(r,k(k({},n),o),"addonRestore")]})})},this.logTail=function(e,t,r){return T(n,void 0,void 0,function(){var n,o,a,i,d,p;return D(this,function(l){if(n=e.entityId,o=e.projectId,a=e.teamId,i=k({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 qu(d,i,p,this.clientOpts.agent)]})})},this.assertStartedWithNodejs=function(){
|
|
291
|
+
if(!so)throw new Error("Command exec only possible when started with nodejs")}},Xu=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){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()),
|
|
292
|
+
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:throw new Error("Unexpected Northflank entity type received in metrics endpoint generation: ".concat(o))}}(),"?").concat(w.toString())},t.body=function(){},t}return P(t,e),t}(Fu),Qu=function(e){return{metadata:e.metadata,data:e.data.map(function(e){return{value:e.value,ts:new Date(e.ts)}})}};exports.MetricType=void 0,(Ou=exports.MetricType||(exports.MetricType={})).Cpu="cpu",Ou.Memory="memory",Ou.NetworkIngress="networkIngress",Ou.NetworkEgress="networkEgress",Ou.TcpConnectionOpen="tcpConnectionsOpen",Ou.PvcUsage="diskUsage",Ou.Requests="requests",Ou.Http4xxResponses="http4xxResponses",Ou.Http5xxResponses="http5xxResponses",
|
|
293
|
+
Ou.Bandwidth="bandwidth",Ou.BandwidthVolume="bandwidthVolume";var em=function(e){var t=this;this.contextProvider=e,this.getServiceMetrics=function(e){return T(t,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.serviceId,o=t.projectId,a=t.teamId,i={teamId:a,entityId:r,projectId:o},[2,this.metricsSingle(i,null!=n?n:{},"service")]})})},this.getServiceBuildMetrics=function(e){return T(t,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.serviceId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsSingle(i,k(k({},n),{isBuild:!0}),"service")]})})},this.getJobMetrics=function(e){return T(t,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.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){
|
|
294
|
+
return T(t,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.jobId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a},[2,this.metricsSingle(i,k(k({},n),{isBuild:!0}),"job")]})})},this.getAddonMetrics=function(e){return T(t,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.addonId,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 T(t,void 0,void 0,function(){var t,o,a,i;return D(this,function(d){return t=e.entityId,o=e.projectId,a=e.teamId,i=k(k({teamId:a,projectId:o,entityId:t,entityType:r},n),{queryType:"single"}),[2,this.getMetrics(i)]})})},this.getServiceMetricsRange=function(e){return T(t,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.serviceId,o=t.projectId,a=t.teamId,i={entityId:r,projectId:o,teamId:a
|
|
295
|
+
},[2,this.metricsRange(i,null!=n?n:{},"service")]})})},this.getServiceBuildMetricsRange=function(e){return T(t,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.serviceId,a=t.teamId,i={entityId:o,projectId:r,teamId:a},[2,this.metricsRange(i,k(k({},n),{isBuild:!0}),"service")]})})},this.getJobMetricsRange=function(e){return T(t,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.metricsRange(i,null!=n?n:{},"job")]})})},this.getJobBuildMetricsRange=function(e){return T(t,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.metricsRange(i,k(k({},n),{isBuild:!0}),"job")]})})},this.getAddonMetricsRange=function(e){return T(t,void 0,void 0,function(){var t,n,r,o,a,i
|
|
296
|
+
;return D(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 T(t,void 0,void 0,function(){var t,o,a,i;return D(this,function(d){return t=e.entityId,o=e.projectId,a=e.teamId,i=k(k({teamId:a,projectId:o,entityId:t,entityType:r},n),{queryType:"range"}),[2,this.getMetrics(i)]})})},this.getMetrics=function(e){return T(t,void 0,void 0,function(){var t;return D(this,function(n){switch(n.label){case 0:return[4,new Xu(this.contextProvider,{}).call(e)];case 1:return(t=n.sent()).error?[2,t]:[2,k(k({},t),{data:Object.fromEntries(Object.entries(t.data).map(function(e){var t=e[0],n=e[1];return[t,k(k({},n),{values:n.values.map(Qu)})]}))})]}})})}},tm=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",
|
|
297
|
+
t.endpointUrl=function(e){return"/v1/addon-types"},t.body=function(){},t}return P(t,e),t}(Fu),nm=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;[].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){
|
|
298
|
+
return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(r).concat(a)},t.body=function(){},t}return P(t,e),t}(Gu),rm=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;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 P(t,e),t}(Mu),om=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
299
|
+
;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,"'"))}),(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
|
+
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 P(t,e),t}(Fu),am=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;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,"'"))}),
|
|
301
|
+
(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(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Wu),im=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
302
|
+
;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,"'"))}),(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{
|
|
303
|
+
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 P(t,e),t}(Ju),dm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;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,"'"))}),
|
|
304
|
+
(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{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");a="/v1/backup-destinations/".concat(encodeURIComponent(e.parameters.backupDestinationId),"/backups")}var i=Object.entries(null!==(o=null==e?void 0:e.options)&&void 0!==o?o:{}).filter(function(e){return void 0!==e[1]
|
|
305
|
+
}),d=i.length>0?"?".concat(i.map(function(e){return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(a).concat(d)},t.body=function(){},t}return P(t,e),t}(Gu),pm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get a list of past invoices",t.withAuth=!0,t.requiredPermissions="Account > Billing > General > Read",t.endpointUrl=function(e){var t,n,r;[].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),"/billing/invoices"):"/v1/billing/invoices";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){
|
|
306
|
+
return"".concat(e[0],"=").concat(e[1])}).join("&")):"";return"".concat(r).concat(a)},t.body=function(){},t}return P(t,e),t}(Gu),lm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get details about an invoice. If `timestamp` is passed in as a query parameter, this endpoint returns details about the invoice containing that timestamp. Otherwise, returns a preview invoice displaying billing data from after the most recent invoice.",t.withAuth=!0,t.requiredPermissions="Account > Billing > General > Read",t.endpointUrl=function(e){var t,n,r;[].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,"'"))}),
|
|
307
|
+
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),"/billing/invoices/details"):"/v1/billing/invoices/details";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 P(t,e),t}(Fu),sm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Lists supported cloud providers",t.withAuth=!0,t.requiredPermissions="undefined",t.endpointUrl=function(e){return"/v1/cloud-providers"},t.body=function(){},t}return P(t,e),t}(Fu),um=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Lists clusters for the authenticated user or team.",t.withAuth=!0,
|
|
308
|
+
t.requiredPermissions="Account > Cloud > Clusters > Read",t.endpointUrl=function(e){var t,n,r;[].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),"/cloud-providers/clusters"):"/v1/cloud-providers/clusters";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 P(t,e),t}(Gu),mm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Creates a new cluster.",t.withAuth=!0,
|
|
309
|
+
t.requiredPermissions="Account > Cloud > Clusters > Create",t.endpointUrl=function(e){var t;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),"/cloud-providers/clusters"):"/v1/cloud-providers/clusters"},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Mu),cm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Creates or update a cluster.",t.withAuth=!0,t.requiredPermissions="Account > Cloud > Clusters > Create",t.endpointUrl=function(e){var t;return[].forEach(function(t){var n
|
|
310
|
+
;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),"/cloud-providers/clusters"):"/v1/cloud-providers/clusters"},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(zu),vm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Get information about the given cluster",t.withAuth=!0,t.requiredPermissions="Account > Cloud > Clusters > 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,"'"))}),
|
|
312
311
|
(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)&&"clusterId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.clusterId))o="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/cloud-providers/clusters/").concat(encodeURIComponent(e.parameters.clusterId));else{if(!(null==e?void 0:e.parameters)||!("clusterId"in(null==e?void 0:e.parameters))||void 0===(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.clusterId))throw new Error("No matching endpoint URL found for provided parameters");o="/v1/cloud-providers/clusters/".concat(encodeURIComponent(e.parameters.clusterId))}return o},t.body=function(){},t}return P(t,e),t}(Fu),hm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Updates a cluster.",t.withAuth=!0,
|
|
313
312
|
t.requiredPermissions="Account > Cloud > Clusters > 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)&&"clusterId"in(null==e?void 0:e.parameters)&&void 0!==(null===(n=null==e?void 0:e.parameters)||void 0===n?void 0:n.clusterId))o="/v1/teams/".concat(encodeURIComponent(e.parameters.teamId),"/cloud-providers/clusters/").concat(encodeURIComponent(e.parameters.clusterId));else{if(!(null==e?void 0:e.parameters)||!("clusterId"in(null==e?void 0:e.parameters))||void 0===(null===(r=null==e?void 0:e.parameters)||void 0===r?void 0:r.clusterId))throw new Error("No matching endpoint URL found for provided parameters")
|
|
314
313
|
;o="/v1/cloud-providers/clusters/".concat(encodeURIComponent(e.parameters.clusterId))}return o},t.body=function(e){return JSON.stringify(e.data)},t}return P(t,e),t}(Wu),fm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.description="Delete the given cluster. Fails if the cluster has associated projects.",t.withAuth=!0,t.requiredPermissions="Account > Cloud > Clusters > 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,"'"))}),
|
|
@@ -622,10 +621,11 @@ t.requiredPermissions="Account > Templates > General > Create",t.endpointUrl=fun
|
|
|
622
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 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
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{
|
|
624
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 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))
|
|
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");
|
|
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,"'"))}),
|
|
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 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,"'"))}),
|
|
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{
|
|
629
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 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
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{
|
|
631
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 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 +662,10 @@ if(!((null==e?void 0:e.parameters)&&"projectId"in(null==e?void 0:e.parameters)&&
|
|
|
662
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 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
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{
|
|
664
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 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))
|
|
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");
|
|
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,"'"))}),
|
|
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 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
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{
|
|
670
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 P(t,e),t}(Mu),tf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this
|
|
671
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,"'"))}),
|