@coalescesoftware/coa 7.2.8 → 7.2.9

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/coa.js CHANGED
@@ -122,7 +122,7 @@ ${v}`),h.pop(),`{${P}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";
122
122
  `),stack:t.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(t)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:rvn.loadavg(),uptime:rvn.uptime()}}getTrace(t){return(t?nvn.parse(t):nvn.get()).map(i=>({column:i.getColumnNumber(),file:i.getFileName(),function:i.getFunctionName(),line:i.getLineNumber(),method:i.getMethodName(),native:i.isNative()}))}_addHandler(t){if(!this.handlers.has(t)){t.handleExceptions=!0;let n=new hTs(t);this.handlers.set(t,n),this.logger.pipe(n)}}_uncaughtException(t){let n=this.getAllInfo(t),i=this._getExceptionHandlers(),o=typeof this.logger.exitOnError=="function"?this.logger.exitOnError(t):this.logger.exitOnError,s;!i.length&&o&&(console.warn("winston: exitOnError cannot be true with no exception handlers."),console.warn("winston: not exiting process."),o=!1);function a(){HXt("doExit",o),HXt("process._exiting",process._exiting),o&&!process._exiting&&(s&&clearTimeout(s),process.exit(1))}if(!i||i.length===0)return process.nextTick(a);ATs(i,(u,c)=>{let l=fTs(c),d=u.transport||u;function p(A){return()=>{HXt(A),l()}}d._ending=!0,d.once("finish",p("finished")),d.once("error",p("error"))},()=>o&&a()),this.logger.log(n),o&&(s=setTimeout(a,3e3))}_getExceptionHandlers(){return this.logger.transports.filter(t=>(t.transport||t).handleExceptions)}}});var KXt=C((ai0,avn)=>{"use strict";var ovn=require("os"),gTs=xnt(),YXt=iMe()("winston:rejection"),mTs=jXt(),svn=GXt(),yTs=WXt();avn.exports=class{constructor(t){if(!t)throw new Error("Logger is required to handle rejections");this.logger=t,this.handlers=new Map}handle(...t){t.forEach(n=>{if(Array.isArray(n))return n.forEach(i=>this._addHandler(i));this._addHandler(n)}),this.catcher||(this.catcher=this._unhandledRejection.bind(this),process.on("unhandledRejection",this.catcher))}unhandle(){this.catcher&&(process.removeListener("unhandledRejection",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(t=>this.logger.unpipe(t)))}getAllInfo(t){let n=null;return t&&(n=typeof t=="string"?t:t.message),{error:t,level:"error",message:[`unhandledRejection: ${n||"(no error message)"}`,t&&t.stack||" No stack trace"].join(`
123
123
  `),stack:t&&t.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(t)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:ovn.loadavg(),uptime:ovn.uptime()}}getTrace(t){return(t?svn.parse(t):svn.get()).map(i=>({column:i.getColumnNumber(),file:i.getFileName(),function:i.getFunctionName(),line:i.getLineNumber(),method:i.getMethodName(),native:i.isNative()}))}_addHandler(t){if(!this.handlers.has(t)){t.handleRejections=!0;let n=new yTs(t);this.handlers.set(t,n),this.logger.pipe(n)}}_unhandledRejection(t){let n=this.getAllInfo(t),i=this._getRejectionHandlers(),o=typeof this.logger.exitOnError=="function"?this.logger.exitOnError(t):this.logger.exitOnError,s;!i.length&&o&&(console.warn("winston: exitOnError cannot be true with no rejection handlers."),console.warn("winston: not exiting process."),o=!1);function a(){YXt("doExit",o),YXt("process._exiting",process._exiting),o&&!process._exiting&&(s&&clearTimeout(s),process.exit(1))}if(!i||i.length===0)return process.nextTick(a);gTs(i,(u,c)=>{let l=mTs(c),d=u.transport||u;function p(A){return()=>{YXt(A),l()}}d._ending=!0,d.once("finish",p("finished")),d.once("error",p("error"))},()=>o&&a()),this.logger.log(n),o&&(s=setTimeout(a,3e3))}_getRejectionHandlers(){return this.logger.transports.filter(t=>(t.transport||t).handleRejections)}}});var lvn=C((li0,uvn)=>{"use strict";uvn.exports=class{constructor(t){if(!t)throw new Error("Logger is required for profiling.");this.logger=t,this.start=Date.now()}done(...t){typeof t[t.length-1]=="function"&&(console.warn("Callback function no longer supported as of winston@3.0.0"),t.pop());let n=typeof t[t.length-1]=="object"?t.pop():{};return n.level=n.level||"info",n.durationMs=Date.now()-this.start,this.logger.write(n)}}});var fvn=C((ci0,Avn)=>{"use strict";var{Stream:ETs,Transform:bTs}=l7(),cvn=xnt(),{LEVEL:TB,SPLAT:dvn}=DA(),pvn=oMe(),CTs=VXt(),ITs=KXt(),vTs=OXt(),xTs=lvn(),{warn:STs}=XJt(),OTs=Ent(),_Ts=/%[scdjifoO%]/g,Snt=class extends bTs{constructor(t){super({objectMode:!0}),this.configure(t)}child(t){let n=this;return Object.create(n,{write:{value:function(i){let o=Object.assign({},t,i);i instanceof Error&&(o.stack=i.stack,o.message=i.message),n.write(o)}}})}configure({silent:t,format:n,defaultMeta:i,levels:o,level:s="info",exitOnError:a=!0,transports:u,colors:c,emitErrs:l,formatters:d,padLevels:p,rewriters:A,stripColors:f,exceptionHandlers:h,rejectionHandlers:y}={}){if(this.transports.length&&this.clear(),this.silent=t,this.format=n||this.format||WJt()(),this.defaultMeta=i||null,this.levels=o||this.levels||OTs.npm.levels,this.level=s,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new CTs(this),this.rejections=new ITs(this),this.profilers={},this.exitOnError=a,u&&(u=Array.isArray(u)?u:[u],u.forEach(I=>this.add(I))),c||l||d||p||A||f)throw new Error(["{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.","Use a custom winston.format(function) instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join(`
124
124
  `));h&&this.exceptions.handle(h),y&&this.rejections.handle(y)}isLevelEnabled(t){let n=JXt(this.levels,t);if(n===null)return!1;let i=JXt(this.levels,this.level);return i===null?!1:!this.transports||this.transports.length===0?i>=n:this.transports.findIndex(s=>{let a=JXt(this.levels,s.level);return a===null&&(a=i),a>=n})!==-1}log(t,n,...i){if(arguments.length===1)return t[TB]=t.level,this._addDefaultMeta(t),this.write(t),this;if(arguments.length===2)return n&&typeof n=="object"?(n[TB]=n.level=t,this._addDefaultMeta(n),this.write(n),this):(n={[TB]:t,level:t,message:n},this._addDefaultMeta(n),this.write(n),this);let[o]=i;if(typeof o=="object"&&o!==null&&!(n&&n.match&&n.match(_Ts))){let a=Object.assign({},this.defaultMeta,o,{[TB]:t,[dvn]:i,level:t,message:n});return o.message&&(a.message=`${a.message} ${o.message}`),o.stack&&(a.stack=o.stack),this.write(a),this}return this.write(Object.assign({},this.defaultMeta,{[TB]:t,[dvn]:i,level:t,message:n})),this}_transform(t,n,i){if(this.silent)return i();t[TB]||(t[TB]=t.level),!this.levels[t[TB]]&&this.levels[t[TB]]!==0&&console.error("[winston] Unknown logger level: %s",t[TB]),this._readableState.pipes||console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",t);try{this.push(this.format.transform(t,this.format.options))}finally{this._writableState.sync=!1,i()}}_final(t){let n=this.transports.slice();cvn(n,(i,o)=>{if(!i||i.finished)return setImmediate(o);i.once("finish",o),i.end()},t)}add(t){let n=!pvn(t)||t.log.length>2?new vTs({transport:t}):t;if(!n._writableState||!n._writableState.objectMode)throw new Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.");return this._onEvent("error",n),this._onEvent("warn",n),this.pipe(n),t.handleExceptions&&this.exceptions.handle(),t.handleRejections&&this.rejections.handle(),this}remove(t){if(!t)return this;let n=t;return(!pvn(t)||t.log.length>2)&&(n=this.transports.filter(i=>i.transport===t)[0]),n&&this.unpipe(n),this}clear(){return this.unpipe(),this}close(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit("close"),this}setLevels(){STs.deprecated("setLevels")}query(t,n){typeof t=="function"&&(n=t,t={}),t=t||{};let i={},o=Object.assign({},t.query||{});function s(u,c){t.query&&typeof u.formatQuery=="function"&&(t.query=u.formatQuery(o)),u.query(t,(l,d)=>{if(l)return c(l);typeof u.formatResults=="function"&&(d=u.formatResults(d,t.format)),c(null,d)})}function a(u,c){s(u,(l,d)=>{c&&(d=l||d,d&&(i[u.name]=d),c()),c=null})}cvn(this.transports.filter(u=>!!u.query),a,()=>n(null,i))}stream(t={}){let n=new ETs,i=[];return n._streams=i,n.destroy=()=>{let o=i.length;for(;o--;)i[o].destroy()},this.transports.filter(o=>!!o.stream).forEach(o=>{let s=o.stream(t);s&&(i.push(s),s.on("log",a=>{a.transport=a.transport||[],a.transport.push(o.name),n.emit("log",a)}),s.on("error",a=>{a.transport=a.transport||[],a.transport.push(o.name),n.emit("error",a)}))}),n}startTimer(){return new xTs(this)}profile(t,...n){let i=Date.now();if(this.profilers[t]){let o=this.profilers[t];delete this.profilers[t],typeof n[n.length-2]=="function"&&(console.warn("Callback function no longer supported as of winston@3.0.0"),n.pop());let s=typeof n[n.length-1]=="object"?n.pop():{};return s.level=s.level||"info",s.durationMs=i-o,s.message=s.message||t,this.write(s)}return this.profilers[t]=i,this}handleExceptions(...t){console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()"),this.exceptions.handle(...t)}unhandleExceptions(...t){console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()"),this.exceptions.unhandle(...t)}cli(){throw new Error(["Logger.cli() was removed in winston@3.0.0","Use a custom winston.formats.cli() instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join(`
125
- `))}_onEvent(t,n){function i(o){t==="error"&&!this.transports.includes(n)&&this.add(n),this.emit(t,o,n)}n["__winston"+t]||(n["__winston"+t]=i.bind(this),n.on(t,n["__winston"+t]))}_addDefaultMeta(t){this.defaultMeta&&Object.assign(t,this.defaultMeta)}};function JXt(r,t){let n=r[t];return!n&&n!==0?null:n}Object.defineProperty(Snt.prototype,"transports",{configurable:!1,enumerable:!0,get(){let{pipes:r}=this._readableState;return Array.isArray(r)?r:[r].filter(Boolean)}});Avn.exports=Snt});var XXt=C((di0,hvn)=>{"use strict";var{LEVEL:wTs}=DA(),BTs=Ent(),RTs=fvn(),TTs=iMe()("winston:create-logger");function MTs(r){return"is"+r.charAt(0).toUpperCase()+r.slice(1)+"Enabled"}hvn.exports=function(r={}){r.levels=r.levels||BTs.npm.levels;class t extends RTs{constructor(o){super(o)}}let n=new t(r);return Object.keys(r.levels).forEach(function(i){if(TTs('Define prototype method for "%s"',i),i==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}t.prototype[i]=function(...o){let s=this||n;if(o.length===1){let[a]=o,u=a&&a.message&&a||{message:a};return u.level=u[wTs]=i,s._addDefaultMeta(u),s.write(u),this||n}return o.length===0?(s.log(i,""),s):s.log(i,...o)},t.prototype[MTs(i)]=function(){return(this||n).isLevelEnabled(i)}}),n}});var mvn=C((Ai0,gvn)=>{"use strict";var DTs=XXt();gvn.exports=class{constructor(t={}){this.loggers=new Map,this.options=t}add(t,n){if(!this.loggers.has(t)){n=Object.assign({},n||this.options);let i=n.transports||this.options.transports;n.transports=i?i.slice():[];let o=DTs(n);o.on("close",()=>this._delete(t)),this.loggers.set(t,o)}return this.loggers.get(t)}get(t,n){return this.add(t,n)}has(t){return!!this.loggers.has(t)}close(t){if(t)return this._removeLogger(t);this.loggers.forEach((n,i)=>this._removeLogger(i))}_removeLogger(t){if(!this.loggers.has(t))return;this.loggers.get(t).close(),this._delete(t)}_delete(t){this.loggers.delete(t)}}});var cMe=C(B0=>{"use strict";var yvn=JJt(),{warn:J0e}=XJt();B0.version=kbn().version;B0.transports=HIn();B0.config=Ent();B0.addColors=yvn.levels;B0.format=yvn.format;B0.createLogger=XXt();B0.ExceptionHandler=VXt();B0.RejectionHandler=KXt();B0.Container=mvn();B0.Transport=BL();B0.loggers=new B0.Container;var d7=B0.createLogger();Object.keys(B0.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(r=>B0[r]=(...t)=>d7[r](...t));Object.defineProperty(B0,"level",{get(){return d7.level},set(r){d7.level=r}});Object.defineProperty(B0,"exceptions",{get(){return d7.exceptions}});["exitOnError"].forEach(r=>{Object.defineProperty(B0,r,{get(){return d7[r]},set(t){d7[r]=t}})});Object.defineProperty(B0,"default",{get(){return{exceptionHandlers:d7.exceptionHandlers,rejectionHandlers:d7.rejectionHandlers,transports:d7.transports}}});J0e.deprecated(B0,"setLevels");J0e.forFunctions(B0,"useFormat",["cli"]);J0e.forProperties(B0,"useFormat",["padLevels","stripColors"]);J0e.forFunctions(B0,"deprecated",["addRewriter","addFilter","clone","extend"]);J0e.forProperties(B0,"deprecated",["emitErrs","levelLength"]);J0e.moved(B0,"createLogger","Logger")});var $Xt,ix,dMe=lt(()=>{"use strict";$Xt=["ACTUAL_STATE","ADVANCED_DEPLOY","APP","AUTH","BULK_WRITE","CLI","CLI_INTERNAL","COLUMN_LINEAGE","COLUMN_METADATA","COMMON","CONNECTION","DEBUG","DEPLOY","DNS","DOCS","DRAG","ENV","ENVIRONMENTS","ERROR_OPERATIONS","FIREBASE","FOLDERS","GIT","GIT_SETTINGS","GOOGLE_DEBUG","GRAPH","HEARTBEAT","JEST","JOBS","JSON_PARSER","LIGHTNING_FS","LISTENERS","MACROS","MAPPING_GRID","METADATA_HYDRATION","METADATA_OPERATIONS","NARROW_METADATA","ORGS","ORG_BOOTSTRAP","ORG_SCANNER","ORG_SETTINGS","ORG_UPGRADE","PACKAGES","PACKAGES_BACKEND","PACKAGE_NAMESPACES","PACKAGE_REGISTRY","PALETTE","PARTNER_CONNECT","PENDO","PERFORMANCE","PLAN_NODES","PLAN_UTILS","PLATFORM","PRESYNC","PROBLEM_SCANNER","PROJECTS","RBAC","RENDERER","RUNNER","RUNNER_BACKEND","RUN_RESULTS","RUN_TRANSACTION","SEARCH","SECRETS","SQL_PARSING","SQL_TESTING","STATE","STEPS","STEP_TYPES","STORAGE_LOCATIONS","STRUMENTA","SYSTEM_EMAILS","TEMPLATE_EDITOR","TESTING","TIMING_UTILS","TREE_OPERATIONS","TYPESENSE","UI","USERS","USER_ACTIVATION","USER_MANAGEMENT","USER_SETTINGS","VERSIONING","VERSION_CONTROL_ACTIONS","WORKSPACES","XML_PARSER","YAML","ZIP"],ix={...Object.fromEntries($Xt.map(r=>[r,{level:"info"}]))}});var Oc,p7,Ad,pMe=lt(()=>{"use strict";Oc=(r,t,n,i,o)=>({orgID:r,workspaceID:t,userID:n,runID:i,nodeID:o}),p7=(r,t)=>{r.runID=t},Ad={}});var bvn=C(Evn=>{"use strict";Object.defineProperty(Evn,"__esModule",{value:!0})});var ZXt=C(Ont=>{"use strict";Object.defineProperty(Ont,"__esModule",{value:!0});Ont.Failcode=void 0;Ont.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}});var $0e=C(X0e=>{"use strict";var NTs=X0e&&X0e.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(X0e,"__esModule",{value:!0});X0e.ValidationError=void 0;var QTs=function(r){NTs(t,r);function t(n){var i=r.call(this,n.message)||this;return i.name="ValidationError",i.code=n.code,n.details!==void 0&&(i.details=n.details),Object.setPrototypeOf(i,t.prototype),i}return t}(Error);X0e.ValidationError=QTs});var AMe=C(e$t=>{"use strict";Object.defineProperty(e$t,"__esModule",{value:!0});var _nt=function(r){return function(t){switch(t.tag){case"literal":return'"'.concat(String(t.value),'"');case"string":return"string";case"brand":return t.brand;case"constraint":return t.name||_nt(r)(t.underlying);case"union":return t.alternatives.map(_nt(r)).join(" | ");case"intersect":return t.intersectees.map(_nt(r)).join(" & ");default:break}return"`${".concat(CI(!1,r)(t),"}`")}},wnt=function(r){return function(t){switch(t.tag){case"literal":return String(t.value);case"brand":return"${".concat(t.brand,"}");case"constraint":return t.name?"${".concat(t.name,"}"):wnt(r)(t.underlying);case"union":if(t.alternatives.length===1){var n=t.alternatives[0];return wnt(r)(n.reflect)}break;case"intersect":if(t.intersectees.length===1){var n=t.intersectees[0];return wnt(r)(n.reflect)}break;default:break}return"${".concat(CI(!1,r)(t),"}")}},CI=function(r,t){return function(n){var i=function(l){return r?"(".concat(l,")"):l};if(t.has(n))return i("CIRCULAR ".concat(n.tag));t.add(n);try{switch(n.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return n.tag;case"literal":{var o=n.value;return typeof o=="string"?'"'.concat(o,'"'):String(o)}case"template":{if(n.strings.length===0)return'""';if(n.strings.length===1)return'"'.concat(n.strings[0],'"');if(n.strings.length===2&&n.strings.every(function(l){return l===""})){var s=n.runtypes[0];return _nt(t)(s.reflect)}var a=!1,u=n.strings.reduce(function(l,d,p){var A=l+d,f=n.runtypes[p];if(f){var h=wnt(t)(f.reflect);return!a&&h.startsWith("$")&&(a=!0),A+h}else return A},"");return a?"`".concat(u,"`"):'"'.concat(u,'"')}case"array":return"".concat(Cvn(n)).concat(CI(!0,t)(n.element),"[]");case"dictionary":return"{ [_: ".concat(n.key,"]: ").concat(CI(!1,t)(n.value)," }");case"record":{var c=Object.keys(n.fields);return c.length?"{ ".concat(c.map(function(l){return"".concat(Cvn(n)).concat(l).concat(PTs(n,l),": ").concat(n.fields[l].tag==="optional"?CI(!1,t)(n.fields[l].underlying):CI(!1,t)(n.fields[l]),";")}).join(" ")," }"):"{}"}case"tuple":return"[".concat(n.components.map(CI(!1,t)).join(", "),"]");case"union":return i("".concat(n.alternatives.map(CI(!0,t)).join(" | ")));case"intersect":return i("".concat(n.intersectees.map(CI(!0,t)).join(" & ")));case"optional":return CI(r,t)(n.underlying)+" | undefined";case"constraint":return n.name||CI(r,t)(n.underlying);case"instanceof":return n.ctor.name;case"brand":return CI(r,t)(n.entity)}}finally{t.delete(n)}throw Error("impossible")}};e$t.default=CI(!1,new Set);function PTs(r,t){var n=r.isPartial,i=r.fields;return n||t!==void 0&&i[t].tag==="optional"?"?":""}function Cvn(r){var t=r.isReadonly;return t?"readonly ":""}});var Wd=C(jc=>{"use strict";var t$t=jc&&jc.__assign||function(){return t$t=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},t$t.apply(this,arguments)};Object.defineProperty(jc,"__esModule",{value:!0});jc.FAILURE=jc.SUCCESS=jc.enumerableKeysOf=jc.typeOf=jc.hasKey=void 0;var MB=ZXt(),Hee=AMe();function kTs(r,t){return typeof t=="object"&&t!==null&&r in t}jc.hasKey=kTs;var zTs=function(r){var t,n,i;return typeof r=="object"?r===null?"null":Array.isArray(r)?"array":((t=r.constructor)===null||t===void 0?void 0:t.name)==="Object"?"object":(i=(n=r.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:typeof r:typeof r};jc.typeOf=zTs;var FTs=function(r){return typeof r=="object"&&r!==null?Reflect.ownKeys(r).filter(function(t){var n,i;return(i=(n=r.propertyIsEnumerable)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:!0}):[]};jc.enumerableKeysOf=FTs;function LTs(r){return{success:!0,value:r}}jc.SUCCESS=LTs;jc.FAILURE=Object.assign(function(r,t,n){return t$t({success:!1,code:r,message:t},n?{details:n}:{})},{TYPE_INCORRECT:function(r,t){var n="Expected ".concat(r.tag==="template"?"string ".concat((0,Hee.default)(r)):(0,Hee.default)(r),", but was ").concat((0,jc.typeOf)(t));return(0,jc.FAILURE)(MB.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(r,t,n){return(0,jc.FAILURE)(MB.Failcode.VALUE_INCORRECT,"Expected ".concat(r," ").concat(String(t),", but was ").concat(String(n)))},KEY_INCORRECT:function(r,t,n){return(0,jc.FAILURE)(MB.Failcode.KEY_INCORRECT,"Expected ".concat((0,Hee.default)(r)," key to be ").concat((0,Hee.default)(t),", but was ").concat((0,jc.typeOf)(n)))},CONTENT_INCORRECT:function(r,t){var n="Expected ".concat((0,Hee.default)(r),", but was incompatible");return(0,jc.FAILURE)(MB.Failcode.CONTENT_INCORRECT,n,t)},ARGUMENT_INCORRECT:function(r){return(0,jc.FAILURE)(MB.Failcode.ARGUMENT_INCORRECT,r)},RETURN_INCORRECT:function(r){return(0,jc.FAILURE)(MB.Failcode.RETURN_INCORRECT,r)},CONSTRAINT_FAILED:function(r,t){var n=t?": ".concat(t):"";return(0,jc.FAILURE)(MB.Failcode.CONSTRAINT_FAILED,"Failed constraint check for ".concat((0,Hee.default)(r)).concat(n))},PROPERTY_MISSING:function(r){var t="Expected ".concat((0,Hee.default)(r),", but was missing");return(0,jc.FAILURE)(MB.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(r){var t="Expected nothing, but was ".concat((0,jc.typeOf)(r));return(0,jc.FAILURE)(MB.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(r){var t="Expected nothing, but was ".concat((0,jc.typeOf)(r));return(0,jc.FAILURE)(MB.Failcode.NOTHING_EXPECTED,t)}})});var Ivn=C(TL=>{"use strict";var qTs=TL&&TL.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},UTs=TL&&TL.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(TL,"__esModule",{value:!0});TL.Contract=void 0;var jTs=$0e(),GTs=Wd();function WTs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),l=GTs.FAILURE.ARGUMENT_INCORRECT(c);throw new jTs.ValidationError(l)}for(var d=0;d<i.length;d++)i[d].check(a[d]);return o.check(s.apply(void 0,UTs([],qTs(a),!1)))}}}}TL.Contract=WTs});var Svn=C(ML=>{"use strict";var HTs=ML&&ML.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},VTs=ML&&ML.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(ML,"__esModule",{value:!0});ML.AsyncContract=void 0;var vvn=$0e(),xvn=Wd();function YTs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),l=xvn.FAILURE.ARGUMENT_INCORRECT(c);throw new vvn.ValidationError(l)}for(var d=0;d<i.length;d++)i[d].check(a[d]);var p=s.apply(void 0,VTs([],HTs(a),!1));if(!(p instanceof Promise)){var c="Expected function to return a promise, but instead got ".concat(p),l=xvn.FAILURE.RETURN_INCORRECT(c);throw new vvn.ValidationError(l)}return p.then(o.check)}}}}ML.AsyncContract=YTs});var Ovn=C(DB=>{"use strict";var KTs=DB&&DB.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},JTs=DB&&DB.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s};Object.defineProperty(DB,"__esModule",{value:!0});DB.when=DB.match=void 0;function XTs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(n){var i,o;try{for(var s=KTs(r),a=s.next();!a.done;a=s.next()){var u=JTs(a.value,2),c=u[0],l=u[1];if(c.guard(n))return l(n)}}catch(d){i={error:d}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}throw new Error("No alternatives were matched")}}DB.match=XTs;function $Ts(r,t){return[r,t]}DB.when=$Ts});var a1=C(NL=>{"use strict";Object.defineProperty(NL,"__esModule",{value:!0});NL.innerValidate=NL.create=NL.isRuntype=void 0;var DL=NA(),ZTs=AMe(),eMs=$0e(),_vn=Wd(),wvn=Symbol(),tMs=function(r){return(0,_vn.hasKey)(wvn,r)};NL.isRuntype=tMs;function rMs(r,t){return t[wvn]=!0,t.check=n,t.assert=n,t._innerValidate=function(p,A){return A.has(p,t)?(0,_vn.SUCCESS)(p):r(p,A)},t.validate=function(p){return t._innerValidate(p,iMs())},t.guard=i,t.Or=o,t.And=s,t.optional=a,t.nullable=u,t.withConstraint=c,t.withGuard=l,t.withBrand=d,t.reflect=t,t.toString=function(){return"Runtype<".concat((0,ZTs.default)(t),">")},t;function n(p){var A=t.validate(p);if(A.success)return A.value;throw new eMs.ValidationError(A)}function i(p){return t.validate(p).success}function o(p){return(0,DL.Union)(t,p)}function s(p){return(0,DL.Intersect)(t,p)}function a(){return(0,DL.Optional)(t)}function u(){return(0,DL.Union)(t,DL.Null)}function c(p,A){return(0,DL.Constraint)(t,p,A)}function l(p,A){return(0,DL.Constraint)(t,p,A)}function d(p){return(0,DL.Brand)(p,t)}}NL.create=rMs;function nMs(r,t,n){return r._innerValidate(t,n)}NL.innerValidate=nMs;function iMs(){var r=new WeakMap,t=function(i,o){if(!(i===null||typeof i!="object")){var s=r.get(i);r.set(i,s?s.set(o,!0):new WeakMap().set(o,!0))}},n=function(i,o){var s=r.get(i),a=s&&s.get(o)||!1;return t(i,o),a};return{has:n}}});var Rnt=C(Bnt=>{"use strict";Object.defineProperty(Bnt,"__esModule",{value:!0});Bnt.Unknown=void 0;var oMs=a1(),sMs=Wd(),aMs={tag:"unknown"};Bnt.Unknown=(0,oMs.create)(function(r){return(0,sMs.SUCCESS)(r)},aMs)});var Bvn=C(Tnt=>{"use strict";Object.defineProperty(Tnt,"__esModule",{value:!0});Tnt.Never=void 0;var uMs=a1(),lMs=Wd(),cMs={tag:"never"};Tnt.Never=(0,uMs.create)(lMs.FAILURE.NOTHING_EXPECTED,cMs)});var Rvn=C(Mnt=>{"use strict";Object.defineProperty(Mnt,"__esModule",{value:!0});Mnt.Void=void 0;var dMs=Rnt();Mnt.Void=dMs.Unknown});var r$t=C(Z0e=>{"use strict";var Dnt=Z0e&&Z0e.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Z0e,"__esModule",{value:!0});Z0e.Union=void 0;var Nnt=a1(),fMe=Wd();function pMs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return function(a){for(var u=0;u<r.length;u++)if(r[u].guard(a))return o[u](a)}},i={tag:"union",alternatives:r,match:n};return(0,Nnt.create)(function(o,s){var a,u,c,l,d,p,A,f;if(typeof o!="object"||o===null){try{for(var h=Dnt(r),y=h.next();!y.done;y=h.next()){var I=y.value;if((0,Nnt.innerValidate)(I,o,s).success)return(0,fMe.SUCCESS)(o)}}catch(Y){a={error:Y}}finally{try{y&&!y.done&&(u=h.return)&&u.call(h)}finally{if(a)throw a.error}}return fMe.FAILURE.TYPE_INCORRECT(i,o)}var v={};try{for(var O=Dnt(r),_=O.next();!_.done;_=O.next()){var I=_.value;if(I.reflect.tag==="record"){var w=function(K){var k=I.reflect.fields[K];k.tag==="literal"&&(v[K]?v[K].every(function($){return $!==k.value})&&v[K].push(k.value):v[K]=[k.value])};for(var P in I.reflect.fields)w(P)}}}catch(Y){c={error:Y}}finally{try{_&&!_.done&&(l=O.return)&&l.call(O)}finally{if(c)throw c.error}}for(var P in v)if(v[P].length===r.length)try{for(var F=(d=void 0,Dnt(r)),W=F.next();!W.done;W=F.next()){var I=W.value;if(I.reflect.tag==="record"){var H=I.reflect.fields[P];if(H.tag==="literal"&&(0,fMe.hasKey)(P,o)&&o[P]===H.value)return(0,Nnt.innerValidate)(I,o,s)}}}catch(K){d={error:K}}finally{try{W&&!W.done&&(p=F.return)&&p.call(F)}finally{if(d)throw d.error}}try{for(var ee=Dnt(r),X=ee.next();!X.done;X=ee.next()){var U=X.value;if((0,Nnt.innerValidate)(U,o,s).success)return(0,fMe.SUCCESS)(o)}}catch(Y){A={error:Y}}finally{try{X&&!X.done&&(f=ee.return)&&f.call(ee)}finally{if(A)throw A.error}}return fMe.FAILURE.TYPE_INCORRECT(i,o)},i)}Z0e.Union=pMs});var o$t=C(XE=>{"use strict";Object.defineProperty(XE,"__esModule",{value:!0});XE.Nullish=XE.Null=XE.Undefined=XE.Literal=XE.literal=void 0;var AMs=a1(),Tvn=Wd(),fMs=r$t();function n$t(r){return Array.isArray(r)?String(r.map(String)):typeof r=="bigint"?String(r)+"n":String(r)}XE.literal=n$t;function i$t(r){var t={tag:"literal",value:r};return(0,AMs.create)(function(n){return n===r?(0,Tvn.SUCCESS)(n):Tvn.FAILURE.VALUE_INCORRECT("literal","`".concat(n$t(r),"`"),"`".concat(n$t(n),"`"))},t)}XE.Literal=i$t;XE.Undefined=i$t(void 0);XE.Null=i$t(null);XE.Nullish=(0,fMs.Union)(XE.Null,XE.Undefined)});var Pvn=C(NB=>{"use strict";var QL=NB&&NB.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},s$t=NB&&NB.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},Mvn=NB&&NB.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(NB,"__esModule",{value:!0});NB.Template=void 0;var Qnt=a1(),Dvn=AMe(),A7=Wd(),Qvn=o$t(),a$t=function(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},hMs=function(r){if(0<r.length&&Array.isArray(r[0])){var t=QL(r),n=t[0],i=t.slice(1);return[Array.from(n),i]}else{var o=r,n=o.reduce(function(u,c){return(0,Qnt.isRuntype)(c)?u.push(""):u.push(u.pop()+String(c)),u},[""]),i=o.filter(Qnt.isRuntype);return[n,i]}},gMs=function(r,t){for(var n=0;n<t.length;)switch(t[n].reflect.tag){case"literal":{var i=t[n];t.splice(n,1);var o=String(i.value);r.splice(n,2,r[n]+o+r[n+1]);break}case"template":{var s=t[n];t.splice.apply(t,s$t([n,1],QL(s.runtypes),!1));var a=s.strings;if(a.length===1)r.splice(n,2,r[n]+a[0]+r[n+1]);else{var u=a[0],c=a.slice(1,-1),l=a[a.length-1];r.splice.apply(r,s$t(s$t([n,2,r[n]+u],QL(c),!1),[l+r[n+1]],!1))}break}case"union":{var d=t[n];if(d.alternatives.length===1)try{var p=mMe(d);t.splice(n,1);var o=String(p.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}case"intersect":{var A=t[n];if(A.intersectees.length===1)try{var f=mMe(A);t.splice(n,1);var o=String(f.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}default:n++;break}},mMs=function(r){var t=QL(hMs(r),2),n=t[0],i=t[1];return gMs(n,i),[n,i]},mMe=function(r){switch(r.reflect.tag){case"literal":return r;case"brand":return mMe(r.reflect.entity);case"union":if(r.reflect.alternatives.length===1)return mMe(r.reflect.alternatives[0]);break;case"intersect":if(r.reflect.intersectees.length===1)return mMe(r.reflect.intersectees[0]);break;default:break}throw void 0},Nvn=function(r){return r},u$t={string:[function(r){return globalThis.String(r)},".*"],number:[function(r){return globalThis.Number(r)},"[+-]?(?:\\d*\\.\\d+|\\d+\\.\\d*|\\d+)(?:[Ee][+-]?\\d+)?","0[Bb][01]+","0[Oo][0-7]+","0[Xx][0-9A-Fa-f]+"],bigint:[function(r){return globalThis.BigInt(r)},"-?[1-9]d*"],boolean:[function(r){return r!=="false"},"true","false"],null:[function(){return null},"null"],undefined:[function(){},"undefined"]},hMe=function(r){switch(r.tag){case"literal":{var t=QL(u$t[(0,A7.typeOf)(r.value)]||[Nvn],1),n=t[0];return n}case"brand":return hMe(r.entity);case"constraint":return hMe(r.underlying);case"union":return r.alternatives.map(hMe);case"intersect":return r.intersectees.map(hMe);default:var i=QL(u$t[r.tag]||[Nvn],1),o=i[0];return o}},l$t=function(r,t){return function(n){var i,o,s,a,u=hMe(r);if(Array.isArray(u))switch(r.tag){case"union":try{for(var c=Mvn(r.alternatives),l=c.next();!l.done;l=c.next()){var d=l.value,p=l$t(d.reflect,t)(n);if(p.success)return p}}catch(I){i={error:I}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return A7.FAILURE.TYPE_INCORRECT(r,n);case"intersect":try{for(var A=Mvn(r.intersectees),f=A.next();!f.done;f=A.next()){var h=f.value,p=l$t(h.reflect,t)(n);if(!p.success)return p}}catch(I){s={error:I}}finally{try{f&&!f.done&&(a=A.return)&&a.call(A)}finally{if(s)throw s.error}}return(0,A7.SUCCESS)(n);default:throw Error("impossible")}else{var y=u,p=(0,Qnt.innerValidate)(r,y(n),t);return!p.success&&p.code==="VALUE_INCORRECT"&&r.tag==="literal"?A7.FAILURE.VALUE_INCORRECT("literal",'"'.concat((0,Qvn.literal)(r.value),'"'),'"'.concat(n,'"')):p}}},gMe=function(r){switch(r.tag){case"literal":return a$t(String(r.value));case"brand":return gMe(r.entity);case"constraint":return gMe(r.underlying);case"union":return r.alternatives.map(gMe).join("|");case"template":return r.strings.map(a$t).reduce(function(i,o,s){var a=i+o,u=r.runtypes[s];return u?a+"(?:".concat(gMe(u.reflect),")"):a},"");default:var t=QL(u$t[r.tag]||[void 0,".*"]),n=t.slice(1);return n.join("|")}},yMs=function(r){var t=r.strings.map(a$t).reduce(function(n,i,o){var s=n+i,a=r.runtypes[o];return a?s+"(".concat(gMe(a.reflect),")"):s},"");return new RegExp("^".concat(t,"$"),"su")};function EMs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=QL(mMs(r),2),i=n[0],o=n[1],s={tag:"template",strings:i,runtypes:o},a=yMs(s),u=function(c,l){var d=c.match(a);if(d){for(var p=d.slice(1),A=0;A<o.length;A++){var f=o[A],h=p[A],y=l$t(f.reflect,l)(h);if(!y.success)return y}return(0,A7.SUCCESS)(c)}else return A7.FAILURE.VALUE_INCORRECT("string","".concat((0,Dvn.default)(s)),'"'.concat((0,Qvn.literal)(c),'"'))};return(0,Qnt.create)(function(c,l){if(typeof c!="string")return A7.FAILURE.TYPE_INCORRECT(s,c);var d=u(c,l);if(d.success)return(0,A7.SUCCESS)(c);var p=A7.FAILURE.VALUE_INCORRECT("string","".concat((0,Dvn.default)(s)),'"'.concat(c,'"'));return p.message!==d.message&&(p.message+=" (inner: ".concat(d.message,")")),p},s)}NB.Template=EMs});var Fvn=C(Pnt=>{"use strict";Object.defineProperty(Pnt,"__esModule",{value:!0});Pnt.Boolean=void 0;var bMs=a1(),kvn=Wd(),zvn={tag:"boolean"};Pnt.Boolean=(0,bMs.create)(function(r){return typeof r=="boolean"?(0,kvn.SUCCESS)(r):kvn.FAILURE.TYPE_INCORRECT(zvn,r)},zvn)});var Uvn=C(knt=>{"use strict";Object.defineProperty(knt,"__esModule",{value:!0});knt.Number=void 0;var CMs=a1(),Lvn=Wd(),qvn={tag:"number"};knt.Number=(0,CMs.create)(function(r){return typeof r=="number"?(0,Lvn.SUCCESS)(r):Lvn.FAILURE.TYPE_INCORRECT(qvn,r)},qvn)});var Wvn=C(znt=>{"use strict";Object.defineProperty(znt,"__esModule",{value:!0});znt.BigInt=void 0;var IMs=a1(),jvn=Wd(),Gvn={tag:"bigint"};znt.BigInt=(0,IMs.create)(function(r){return typeof r=="bigint"?(0,jvn.SUCCESS)(r):jvn.FAILURE.TYPE_INCORRECT(Gvn,r)},Gvn)});var c$t=C(Fnt=>{"use strict";Object.defineProperty(Fnt,"__esModule",{value:!0});Fnt.String=void 0;var vMs=a1(),Hvn=Wd(),Vvn={tag:"string"};Fnt.String=(0,vMs.create)(function(r){return typeof r=="string"?(0,Hvn.SUCCESS)(r):Hvn.FAILURE.TYPE_INCORRECT(Vvn,r)},Vvn)});var Xvn=C(Lnt=>{"use strict";Object.defineProperty(Lnt,"__esModule",{value:!0});Lnt.Symbol=void 0;var Jvn=a1(),yMe=Wd(),xMs=function(r){var t={tag:"symbol",key:r};return(0,Jvn.create)(function(n){if(typeof n!="symbol")return yMe.FAILURE.TYPE_INCORRECT(t,n);var i=globalThis.Symbol.keyFor(n);return i!==r?yMe.FAILURE.VALUE_INCORRECT("symbol key",Kvn(r),Kvn(i)):(0,yMe.SUCCESS)(n)},t)},Yvn={tag:"symbol"};Lnt.Symbol=(0,Jvn.create)(function(r){return typeof r=="symbol"?(0,yMe.SUCCESS)(r):yMe.FAILURE.TYPE_INCORRECT(Yvn,r)},Object.assign(xMs,Yvn));var Kvn=function(r){return r===void 0?"undefined":'"'.concat(r,'"')}});var e4n=C(qnt=>{"use strict";Object.defineProperty(qnt,"__esModule",{value:!0});qnt.Array=void 0;var $vn=a1(),EMe=Wd();function Zvn(r,t){var n={tag:"array",isReadonly:t,element:r};return OMs((0,$vn.create)(function(i,o){if(!Array.isArray(i))return EMe.FAILURE.TYPE_INCORRECT(n,i);var s=(0,EMe.enumerableKeysOf)(i),a=s.map(function(c){return(0,$vn.innerValidate)(r,i[c],o)}),u=s.reduce(function(c,l){var d=a[l];return d.success||(c[l]=d.details||d.message),c},[]);return(0,EMe.enumerableKeysOf)(u).length!==0?EMe.FAILURE.CONTENT_INCORRECT(n,u):(0,EMe.SUCCESS)(i)},n))}function SMs(r){return Zvn(r,!1)}qnt.Array=SMs;function OMs(r){return r.asReadonly=t,r;function t(){return Zvn(r.element,!0)}}});var r4n=C(Unt=>{"use strict";Object.defineProperty(Unt,"__esModule",{value:!0});Unt.Tuple=void 0;var t4n=a1(),ede=Wd();function _Ms(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"tuple",components:r};return(0,t4n.create)(function(i,o){if(!Array.isArray(i))return ede.FAILURE.TYPE_INCORRECT(n,i);if(i.length!==r.length)return ede.FAILURE.CONSTRAINT_FAILED(n,"Expected length ".concat(r.length,", but was ").concat(i.length));var s=(0,ede.enumerableKeysOf)(i),a=s.map(function(c){return(0,t4n.innerValidate)(r[c],i[c],o)}),u=s.reduce(function(c,l){var d=a[l];return d.success||(c[l]=d.details||d.message),c},[]);return(0,ede.enumerableKeysOf)(u).length!==0?ede.FAILURE.CONTENT_INCORRECT(n,u):(0,ede.SUCCESS)(i)},n)}Unt.Tuple=_Ms});var i4n=C(ox=>{"use strict";var d$t=ox&&ox.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},p$t=ox&&ox.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(ox,"__esModule",{value:!0});ox.Partial=ox.Record=ox.InternalRecord=void 0;var n4n=a1(),$E=Wd();function PL(r,t,n){var i={tag:"record",isPartial:t,isReadonly:n,fields:r};return RMs((0,n4n.create)(function(o,s){if(o==null)return $E.FAILURE.TYPE_INCORRECT(i,o);var a=(0,$E.enumerableKeysOf)(r);if(a.length!==0&&typeof o!="object")return $E.FAILURE.TYPE_INCORRECT(i,o);var u=p$t([],d$t(new Set(p$t(p$t([],d$t(a),!1),d$t((0,$E.enumerableKeysOf)(o)),!1))),!1),c=u.reduce(function(d,p){var A=(0,$E.hasKey)(p,r),f=(0,$E.hasKey)(p,o);if(A){var h=r[p],y=t||h.reflect.tag==="optional";if(f){var I=o[p];y&&I===void 0?d[p]=(0,$E.SUCCESS)(I):d[p]=(0,n4n.innerValidate)(h,I,s)}else y?d[p]=(0,$E.SUCCESS)(void 0):d[p]=$E.FAILURE.PROPERTY_MISSING(h.reflect)}else if(f){var I=o[p];d[p]=(0,$E.SUCCESS)(I)}else throw new Error("impossible");return d},{}),l=u.reduce(function(d,p){var A=c[p];return A.success||(d[p]=A.details||A.message),d},{});return(0,$E.enumerableKeysOf)(l).length!==0?$E.FAILURE.CONTENT_INCORRECT(i,l):(0,$E.SUCCESS)(o)},i))}ox.InternalRecord=PL;function wMs(r){return PL(r,!1,!1)}ox.Record=wMs;function BMs(r){return PL(r,!0,!1)}ox.Partial=BMs;function RMs(r){return r.asPartial=t,r.asReadonly=n,r.pick=i,r.omit=o,r.extend=s,r;function t(){return PL(r.fields,!0,r.isReadonly)}function n(){return PL(r.fields,r.isPartial,!0)}function i(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];var c={};return a.forEach(function(l){c[l]=r.fields[l]}),PL(c,r.isPartial,r.isReadonly)}function o(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];var c={},l=(0,$E.enumerableKeysOf)(r.fields);return l.forEach(function(d){a.includes(d)||(c[d]=r.fields[d])}),PL(c,r.isPartial,r.isReadonly)}function s(a){return PL(Object.assign({},r.fields,a),r.isPartial,r.isReadonly)}}});var f$t=C(tde=>{"use strict";Object.defineProperty(tde,"__esModule",{value:!0});tde.Guard=tde.Constraint=void 0;var TMs=a1(),A$t=Wd(),MMs=Rnt();function DMs(r,t,n){var i=n&&n.name,o=n&&n.args,s={tag:"constraint",underlying:r,constraint:t,name:i,args:o};return(0,TMs.create)(function(a){var u=r.validate(a);if(!u.success)return u;var c=t(u.value);return typeof c=="string"?A$t.FAILURE.CONSTRAINT_FAILED(s,c):c?(0,A$t.SUCCESS)(u.value):A$t.FAILURE.CONSTRAINT_FAILED(s)},s)}tde.Constraint=DMs;var NMs=function(r,t){return MMs.Unknown.withGuard(r,t)};tde.Guard=NMs});var s4n=C(jnt=>{"use strict";Object.defineProperty(jnt,"__esModule",{value:!0});jnt.Dictionary=void 0;var o4n=a1(),h$t=c$t(),QMs=f$t(),PMs=AMe(),Vee=Wd(),kMs=(0,QMs.Constraint)(h$t.String,function(r){return!isNaN(+r)},{name:"number"});function zMs(r,t){var n=t===void 0||t==="string"?h$t.String:t==="number"?kMs:t,i=(0,PMs.default)(n),o={tag:"dictionary",key:i,value:r};return(0,o4n.create)(function(s,a){if(s==null||typeof s!="object"||Object.getPrototypeOf(s)!==Object.prototype&&(!Array.isArray(s)||i==="string"))return Vee.FAILURE.TYPE_INCORRECT(o,s);var u=/^(?:NaN|-?\d+(?:\.\d+)?)$/,c=(0,Vee.enumerableKeysOf)(s),l=c.reduce(function(p,A){var f=typeof A=="string"&&u.test(A),h=f?globalThis.Number(A):A;return(f?!n.guard(h)&&!n.guard(A):!n.guard(h))?p[A]=Vee.FAILURE.KEY_INCORRECT(o,n.reflect,h):p[A]=(0,o4n.innerValidate)(r,s[A],a),p},{}),d=c.reduce(function(p,A){var f=l[A];return f.success||(p[A]=f.details||f.message),p},{});return(0,Vee.enumerableKeysOf)(d).length!==0?Vee.FAILURE.CONTENT_INCORRECT(o,d):(0,Vee.SUCCESS)(s)},o)}jnt.Dictionary=zMs});var u4n=C(rde=>{"use strict";var FMs=rde&&rde.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(rde,"__esModule",{value:!0});rde.Intersect=void 0;var a4n=a1(),LMs=Wd();function qMs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"intersect",intersectees:r};return(0,a4n.create)(function(i,o){var s,a;try{for(var u=FMs(r),c=u.next();!c.done;c=u.next()){var l=c.value,d=(0,a4n.innerValidate)(l,i,o);if(!d.success)return d}}catch(p){s={error:p}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(s)throw s.error}}return(0,LMs.SUCCESS)(i)},n)}rde.Intersect=qMs});var l4n=C(Gnt=>{"use strict";Object.defineProperty(Gnt,"__esModule",{value:!0});Gnt.Optional=void 0;var UMs=a1(),jMs=Wd();function GMs(r){var t={tag:"optional",underlying:r};return(0,UMs.create)(function(n){return n===void 0?(0,jMs.SUCCESS)(n):r.validate(n)},t)}Gnt.Optional=GMs});var p4n=C(Wnt=>{"use strict";Object.defineProperty(Wnt,"__esModule",{value:!0});Wnt.Function=void 0;var WMs=a1(),c4n=Wd(),d4n={tag:"function"};Wnt.Function=(0,WMs.create)(function(r){return typeof r=="function"?(0,c4n.SUCCESS)(r):c4n.FAILURE.TYPE_INCORRECT(d4n,r)},d4n)});var f4n=C(Hnt=>{"use strict";Object.defineProperty(Hnt,"__esModule",{value:!0});Hnt.InstanceOf=void 0;var HMs=a1(),A4n=Wd();function VMs(r){var t={tag:"instanceof",ctor:r};return(0,HMs.create)(function(n){return n instanceof r?(0,A4n.SUCCESS)(n):A4n.FAILURE.TYPE_INCORRECT(t,n)},t)}Hnt.InstanceOf=VMs});var h4n=C(Vnt=>{"use strict";Object.defineProperty(Vnt,"__esModule",{value:!0});Vnt.Lazy=void 0;var YMs=a1();function KMs(r){var t={get tag(){return i().tag}},n;function i(){if(!n){n=r();for(var o in n)o!=="tag"&&(t[o]=n[o])}return n}return(0,YMs.create)(function(o){return i().validate(o)},t)}Vnt.Lazy=KMs});var g4n=C(Ynt=>{"use strict";Object.defineProperty(Ynt,"__esModule",{value:!0});Ynt.Brand=void 0;var JMs=a1();function XMs(r,t){var n={tag:"brand",brand:r,entity:t};return(0,JMs.create)(function(i){return t.validate(i)},n)}Ynt.Brand=XMs});var m4n=C(nde=>{"use strict";Object.defineProperty(nde,"__esModule",{value:!0});nde.checked=nde.check=void 0;var $Ms=$0e(),ZMs=Wd(),g$t=new WeakMap;function e8s(r,t,n){var i=g$t.get(r)||new Map;g$t.set(r,i);var o=i.get(t)||[];i.set(t,o),o.push(n)}nde.check=e8s;function t8s(r,t,n){var i=g$t.get(r),o=i&&i.get(t);if(o)return o;for(var s=[],a=0;a<n;a++)s.push(a);return s}function r8s(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(r.length===0)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(n,i,o){var s=o.value,a=(n.name||n.constructor.name+".prototype")+(typeof i=="string"?'["'.concat(i,'"]'):"[".concat(String(i),"]")),u=t8s(n,i,r.length);if(u.length!==r.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(u.length>s.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");o.value=function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];return r.forEach(function(d,p){var A=u[p],f=d.validate(c[A]);if(!f.success){var h="".concat(a,", argument #").concat(A,": ").concat(f.message),y=ZMs.FAILURE.ARGUMENT_INCORRECT(h);throw new $Ms.ValidationError(y)}}),s.apply(this,c)}}}nde.checked=r8s});var NA=C(na=>{"use strict";var n8s=na&&na.__createBinding||(Object.create?function(r,t,n,i){i===void 0&&(i=n),Object.defineProperty(r,i,{enumerable:!0,get:function(){return t[n]}})}:function(r,t,n,i){i===void 0&&(i=n),r[i]=t[n]}),i0=na&&na.__exportStar||function(r,t){for(var n in r)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&n8s(t,r,n)};Object.defineProperty(na,"__esModule",{value:!0});na.InstanceOf=na.Nullish=na.Null=na.Undefined=na.Literal=void 0;i0(bvn(),na);i0(ZXt(),na);i0(Ivn(),na);i0(Svn(),na);i0(Ovn(),na);i0($0e(),na);i0(Rnt(),na);i0(Bvn(),na);i0(Rvn(),na);var Knt=o$t();Object.defineProperty(na,"Literal",{enumerable:!0,get:function(){return Knt.Literal}});Object.defineProperty(na,"Undefined",{enumerable:!0,get:function(){return Knt.Undefined}});Object.defineProperty(na,"Null",{enumerable:!0,get:function(){return Knt.Null}});Object.defineProperty(na,"Nullish",{enumerable:!0,get:function(){return Knt.Nullish}});i0(Pvn(),na);i0(Fvn(),na);i0(Uvn(),na);i0(Wvn(),na);i0(c$t(),na);i0(Xvn(),na);i0(e4n(),na);i0(r4n(),na);i0(i4n(),na);i0(s4n(),na);i0(r$t(),na);i0(u4n(),na);i0(l4n(),na);i0(p4n(),na);var i8s=f4n();Object.defineProperty(na,"InstanceOf",{enumerable:!0,get:function(){return i8s.InstanceOf}});i0(h4n(),na);i0(f$t(),na);i0(g4n(),na);i0(m4n(),na)});var bMe=C((Ji0,y4n)=>{var o8s="2.0.0",s8s=Number.MAX_SAFE_INTEGER||9007199254740991,a8s=16,u8s=256-6,l8s=["major","premajor","minor","preminor","patch","prepatch","prerelease"];y4n.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:a8s,MAX_SAFE_BUILD_LENGTH:u8s,MAX_SAFE_INTEGER:s8s,RELEASE_TYPES:l8s,SEMVER_SPEC_VERSION:o8s,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var CMe=C((Xi0,E4n)=>{var c8s=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};E4n.exports=c8s});var ide=C((f7,b4n)=>{var{MAX_SAFE_COMPONENT_LENGTH:m$t,MAX_SAFE_BUILD_LENGTH:d8s,MAX_LENGTH:p8s}=bMe(),A8s=CMe();f7=b4n.exports={};var f8s=f7.re=[],h8s=f7.safeRe=[],lo=f7.src=[],co=f7.t={},g8s=0,y$t="[a-zA-Z0-9-]",m8s=[["\\s",1],["\\d",p8s],[y$t,d8s]],y8s=r=>{for(let[t,n]of m8s)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},Na=(r,t,n)=>{let i=y8s(t),o=g8s++;A8s(r,o,t),co[r]=o,lo[o]=t,f8s[o]=new RegExp(t,n?"g":void 0),h8s[o]=new RegExp(i,n?"g":void 0)};Na("NUMERICIDENTIFIER","0|[1-9]\\d*");Na("NUMERICIDENTIFIERLOOSE","\\d+");Na("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y$t}*`);Na("MAINVERSION",`(${lo[co.NUMERICIDENTIFIER]})\\.(${lo[co.NUMERICIDENTIFIER]})\\.(${lo[co.NUMERICIDENTIFIER]})`);Na("MAINVERSIONLOOSE",`(${lo[co.NUMERICIDENTIFIERLOOSE]})\\.(${lo[co.NUMERICIDENTIFIERLOOSE]})\\.(${lo[co.NUMERICIDENTIFIERLOOSE]})`);Na("PRERELEASEIDENTIFIER",`(?:${lo[co.NUMERICIDENTIFIER]}|${lo[co.NONNUMERICIDENTIFIER]})`);Na("PRERELEASEIDENTIFIERLOOSE",`(?:${lo[co.NUMERICIDENTIFIERLOOSE]}|${lo[co.NONNUMERICIDENTIFIER]})`);Na("PRERELEASE",`(?:-(${lo[co.PRERELEASEIDENTIFIER]}(?:\\.${lo[co.PRERELEASEIDENTIFIER]})*))`);Na("PRERELEASELOOSE",`(?:-?(${lo[co.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${lo[co.PRERELEASEIDENTIFIERLOOSE]})*))`);Na("BUILDIDENTIFIER",`${y$t}+`);Na("BUILD",`(?:\\+(${lo[co.BUILDIDENTIFIER]}(?:\\.${lo[co.BUILDIDENTIFIER]})*))`);Na("FULLPLAIN",`v?${lo[co.MAINVERSION]}${lo[co.PRERELEASE]}?${lo[co.BUILD]}?`);Na("FULL",`^${lo[co.FULLPLAIN]}$`);Na("LOOSEPLAIN",`[v=\\s]*${lo[co.MAINVERSIONLOOSE]}${lo[co.PRERELEASELOOSE]}?${lo[co.BUILD]}?`);Na("LOOSE",`^${lo[co.LOOSEPLAIN]}$`);Na("GTLT","((?:<|>)?=?)");Na("XRANGEIDENTIFIERLOOSE",`${lo[co.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Na("XRANGEIDENTIFIER",`${lo[co.NUMERICIDENTIFIER]}|x|X|\\*`);Na("XRANGEPLAIN",`[v=\\s]*(${lo[co.XRANGEIDENTIFIER]})(?:\\.(${lo[co.XRANGEIDENTIFIER]})(?:\\.(${lo[co.XRANGEIDENTIFIER]})(?:${lo[co.PRERELEASE]})?${lo[co.BUILD]}?)?)?`);Na("XRANGEPLAINLOOSE",`[v=\\s]*(${lo[co.XRANGEIDENTIFIERLOOSE]})(?:\\.(${lo[co.XRANGEIDENTIFIERLOOSE]})(?:\\.(${lo[co.XRANGEIDENTIFIERLOOSE]})(?:${lo[co.PRERELEASELOOSE]})?${lo[co.BUILD]}?)?)?`);Na("XRANGE",`^${lo[co.GTLT]}\\s*${lo[co.XRANGEPLAIN]}$`);Na("XRANGELOOSE",`^${lo[co.GTLT]}\\s*${lo[co.XRANGEPLAINLOOSE]}$`);Na("COERCE",`(^|[^\\d])(\\d{1,${m$t}})(?:\\.(\\d{1,${m$t}}))?(?:\\.(\\d{1,${m$t}}))?(?:$|[^\\d])`);Na("COERCERTL",lo[co.COERCE],!0);Na("LONETILDE","(?:~>?)");Na("TILDETRIM",`(\\s*)${lo[co.LONETILDE]}\\s+`,!0);f7.tildeTrimReplace="$1~";Na("TILDE",`^${lo[co.LONETILDE]}${lo[co.XRANGEPLAIN]}$`);Na("TILDELOOSE",`^${lo[co.LONETILDE]}${lo[co.XRANGEPLAINLOOSE]}$`);Na("LONECARET","(?:\\^)");Na("CARETTRIM",`(\\s*)${lo[co.LONECARET]}\\s+`,!0);f7.caretTrimReplace="$1^";Na("CARET",`^${lo[co.LONECARET]}${lo[co.XRANGEPLAIN]}$`);Na("CARETLOOSE",`^${lo[co.LONECARET]}${lo[co.XRANGEPLAINLOOSE]}$`);Na("COMPARATORLOOSE",`^${lo[co.GTLT]}\\s*(${lo[co.LOOSEPLAIN]})$|^$`);Na("COMPARATOR",`^${lo[co.GTLT]}\\s*(${lo[co.FULLPLAIN]})$|^$`);Na("COMPARATORTRIM",`(\\s*)${lo[co.GTLT]}\\s*(${lo[co.LOOSEPLAIN]}|${lo[co.XRANGEPLAIN]})`,!0);f7.comparatorTrimReplace="$1$2$3";Na("HYPHENRANGE",`^\\s*(${lo[co.XRANGEPLAIN]})\\s+-\\s+(${lo[co.XRANGEPLAIN]})\\s*$`);Na("HYPHENRANGELOOSE",`^\\s*(${lo[co.XRANGEPLAINLOOSE]})\\s+-\\s+(${lo[co.XRANGEPLAINLOOSE]})\\s*$`);Na("STAR","(<|>)?=?\\s*\\*");Na("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Na("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Jnt=C(($i0,C4n)=>{var E8s=Object.freeze({loose:!0}),b8s=Object.freeze({}),C8s=r=>r?typeof r!="object"?E8s:r:b8s;C4n.exports=C8s});var E$t=C((Zi0,x4n)=>{var I4n=/^[0-9]+$/,v4n=(r,t)=>{let n=I4n.test(r),i=I4n.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},I8s=(r,t)=>v4n(t,r);x4n.exports={compareIdentifiers:v4n,rcompareIdentifiers:I8s}});var y2=C((eo0,w4n)=>{var Xnt=CMe(),{MAX_LENGTH:S4n,MAX_SAFE_INTEGER:$nt}=bMe(),{safeRe:O4n,t:_4n}=ide(),v8s=Jnt(),{compareIdentifiers:ode}=E$t(),II=class{constructor(t,n){if(n=v8s(n),t instanceof II){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>S4n)throw new TypeError(`version is longer than ${S4n} characters`);Xnt("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?O4n[_4n.LOOSE]:O4n[_4n.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>$nt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>$nt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>$nt||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<$nt)return s}return o}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Xnt("SemVer.compare",this.version,this.options,t),!(t instanceof II)){if(typeof t=="string"&&t===this.version)return 0;t=new II(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof II||(t=new II(t,this.options)),ode(this.major,t.major)||ode(this.minor,t.minor)||ode(this.patch,t.patch)}comparePre(t){if(t instanceof II||(t=new II(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{let i=this.prerelease[n],o=t.prerelease[n];if(Xnt("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return ode(i,o)}while(++n)}compareBuild(t){t instanceof II||(t=new II(t,this.options));let n=0;do{let i=this.build[n],o=t.build[n];if(Xnt("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return ode(i,o)}while(++n)}inc(t,n,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,i),this.inc("pre",n,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,i),this.inc("pre",n,i);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(i)?1:0;if(!n&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];i===!1&&(s=[n]),ode(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};w4n.exports=II});var Yee=C((to0,R4n)=>{var B4n=y2(),x8s=(r,t,n=!1)=>{if(r instanceof B4n)return r;try{return new B4n(r,t)}catch(i){if(!n)return null;throw i}};R4n.exports=x8s});var M4n=C((ro0,T4n)=>{var S8s=Yee(),O8s=(r,t)=>{let n=S8s(r,t);return n?n.version:null};T4n.exports=O8s});var N4n=C((no0,D4n)=>{var _8s=Yee(),w8s=(r,t)=>{let n=_8s(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};D4n.exports=w8s});var k4n=C((io0,P4n)=>{var Q4n=y2(),B8s=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Q4n(r instanceof Q4n?r.version:r,n).inc(t,i,o).version}catch{return null}};P4n.exports=B8s});var L4n=C((oo0,F4n)=>{var z4n=Yee(),R8s=(r,t)=>{let n=z4n(r,null,!0),i=z4n(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,u=s?i:n,c=!!a.prerelease.length;if(!!u.prerelease.length&&!c)return!u.patch&&!u.minor?"major":a.patch?"patch":a.minor?"minor":"major";let d=c?"pre":"";return n.major!==i.major?d+"major":n.minor!==i.minor?d+"minor":n.patch!==i.patch?d+"patch":"prerelease"};F4n.exports=R8s});var U4n=C((so0,q4n)=>{var T8s=y2(),M8s=(r,t)=>new T8s(r,t).major;q4n.exports=M8s});var G4n=C((ao0,j4n)=>{var D8s=y2(),N8s=(r,t)=>new D8s(r,t).minor;j4n.exports=N8s});var H4n=C((uo0,W4n)=>{var Q8s=y2(),P8s=(r,t)=>new Q8s(r,t).patch;W4n.exports=P8s});var Y4n=C((lo0,V4n)=>{var k8s=Yee(),z8s=(r,t)=>{let n=k8s(r,t);return n&&n.prerelease.length?n.prerelease:null};V4n.exports=z8s});var sx=C((co0,J4n)=>{var K4n=y2(),F8s=(r,t,n)=>new K4n(r,n).compare(new K4n(t,n));J4n.exports=F8s});var $4n=C((do0,X4n)=>{var L8s=sx(),q8s=(r,t,n)=>L8s(t,r,n);X4n.exports=q8s});var exn=C((po0,Z4n)=>{var U8s=sx(),j8s=(r,t)=>U8s(r,t,!0);Z4n.exports=j8s});var Znt=C((Ao0,rxn)=>{var txn=y2(),G8s=(r,t,n)=>{let i=new txn(r,n),o=new txn(t,n);return i.compare(o)||i.compareBuild(o)};rxn.exports=G8s});var ixn=C((fo0,nxn)=>{var W8s=Znt(),H8s=(r,t)=>r.sort((n,i)=>W8s(n,i,t));nxn.exports=H8s});var sxn=C((ho0,oxn)=>{var V8s=Znt(),Y8s=(r,t)=>r.sort((n,i)=>V8s(i,n,t));oxn.exports=Y8s});var IMe=C((go0,axn)=>{var K8s=sx(),J8s=(r,t,n)=>K8s(r,t,n)>0;axn.exports=J8s});var eit=C((mo0,uxn)=>{var X8s=sx(),$8s=(r,t,n)=>X8s(r,t,n)<0;uxn.exports=$8s});var b$t=C((yo0,lxn)=>{var Z8s=sx(),eDs=(r,t,n)=>Z8s(r,t,n)===0;lxn.exports=eDs});var C$t=C((Eo0,cxn)=>{var tDs=sx(),rDs=(r,t,n)=>tDs(r,t,n)!==0;cxn.exports=rDs});var tit=C((bo0,dxn)=>{var nDs=sx(),iDs=(r,t,n)=>nDs(r,t,n)>=0;dxn.exports=iDs});var rit=C((Co0,pxn)=>{var oDs=sx(),sDs=(r,t,n)=>oDs(r,t,n)<=0;pxn.exports=sDs});var I$t=C((Io0,Axn)=>{var aDs=b$t(),uDs=C$t(),lDs=IMe(),cDs=tit(),dDs=eit(),pDs=rit(),ADs=(r,t,n,i)=>{switch(t){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return aDs(r,n,i);case"!=":return uDs(r,n,i);case">":return lDs(r,n,i);case">=":return cDs(r,n,i);case"<":return dDs(r,n,i);case"<=":return pDs(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};Axn.exports=ADs});var hxn=C((vo0,fxn)=>{var fDs=y2(),hDs=Yee(),{safeRe:nit,t:iit}=ide(),gDs=(r,t)=>{if(r instanceof fDs)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;t=t||{};let n=null;if(!t.rtl)n=r.match(nit[iit.COERCE]);else{let i;for(;(i=nit[iit.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),nit[iit.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;nit[iit.COERCERTL].lastIndex=-1}return n===null?null:hDs(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};fxn.exports=gDs});var mxn=C((xo0,gxn)=>{"use strict";gxn.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var v$t=C((So0,yxn)=>{"use strict";yxn.exports=Il;Il.Node=Kee;Il.create=Il;function Il(r){var t=this;if(t instanceof Il||(t=new Il),t.tail=null,t.head=null,t.length=0,r&&typeof r.forEach=="function")r.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}Il.prototype.removeNode=function(r){if(r.list!==this)throw new Error("removing node which does not belong to this list");var t=r.next,n=r.prev;return t&&(t.prev=n),n&&(n.next=t),r===this.head&&(this.head=t),r===this.tail&&(this.tail=n),r.list.length--,r.next=null,r.prev=null,r.list=null,t};Il.prototype.unshiftNode=function(r){if(r!==this.head){r.list&&r.list.removeNode(r);var t=this.head;r.list=this,r.next=t,t&&(t.prev=r),this.head=r,this.tail||(this.tail=r),this.length++}};Il.prototype.pushNode=function(r){if(r!==this.tail){r.list&&r.list.removeNode(r);var t=this.tail;r.list=this,r.prev=t,t&&(t.next=r),this.tail=r,this.head||(this.head=r),this.length++}};Il.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)yDs(this,arguments[r]);return this.length};Il.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)EDs(this,arguments[r]);return this.length};Il.prototype.pop=function(){if(this.tail){var r=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,r}};Il.prototype.shift=function(){if(this.head){var r=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,r}};Il.prototype.forEach=function(r,t){t=t||this;for(var n=this.head,i=0;n!==null;i++)r.call(t,n.value,i,this),n=n.next};Il.prototype.forEachReverse=function(r,t){t=t||this;for(var n=this.tail,i=this.length-1;n!==null;i--)r.call(t,n.value,i,this),n=n.prev};Il.prototype.get=function(r){for(var t=0,n=this.head;n!==null&&t<r;t++)n=n.next;if(t===r&&n!==null)return n.value};Il.prototype.getReverse=function(r){for(var t=0,n=this.tail;n!==null&&t<r;t++)n=n.prev;if(t===r&&n!==null)return n.value};Il.prototype.map=function(r,t){t=t||this;for(var n=new Il,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};Il.prototype.mapReverse=function(r,t){t=t||this;for(var n=new Il,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};Il.prototype.reduce=function(r,t){var n,i=this.head;if(arguments.length>1)n=t;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i!==null;o++)n=r(n,i.value,o),i=i.next;return n};Il.prototype.reduceReverse=function(r,t){var n,i=this.tail;if(arguments.length>1)n=t;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;i!==null;o--)n=r(n,i.value,o),i=i.prev;return n};Il.prototype.toArray=function(){for(var r=new Array(this.length),t=0,n=this.head;n!==null;t++)r[t]=n.value,n=n.next;return r};Il.prototype.toArrayReverse=function(){for(var r=new Array(this.length),t=0,n=this.tail;n!==null;t++)r[t]=n.value,n=n.prev;return r};Il.prototype.slice=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new Il;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(;o!==null&&i<t;i++,o=o.next)n.push(o.value);return n};Il.prototype.sliceReverse=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new Il;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;o!==null&&i>t;i--)o=o.prev;for(;o!==null&&i>r;i--,o=o.prev)n.push(o.value);return n};Il.prototype.splice=function(r,t,...n){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(var s=[],i=0;o&&i<t;i++)s.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var i=0;i<n.length;i++)o=mDs(this,o,n[i]);return s};Il.prototype.reverse=function(){for(var r=this.head,t=this.tail,n=r;n!==null;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=r,this};function mDs(r,t,n){var i=t===r.head?new Kee(n,null,t,r):new Kee(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function yDs(r,t){r.tail=new Kee(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function EDs(r,t){r.head=new Kee(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function Kee(r,t,n,i){if(!(this instanceof Kee))return new Kee(r,t,n,i);this.list=i,this.value=r,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{mxn()(Il)}catch{}});var w$t=C((Oo0,Ixn)=>{"use strict";var bDs=v$t(),Jee=Symbol("max"),g7=Symbol("length"),sde=Symbol("lengthCalculator"),xMe=Symbol("allowStale"),Xee=Symbol("maxAge"),h7=Symbol("dispose"),Exn=Symbol("noDisposeOnSet"),bh=Symbol("lruList"),NO=Symbol("cache"),Cxn=Symbol("updateAgeOnGet"),x$t=()=>1,O$t=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");let n=this[Jee]=t.max||1/0,i=t.length||x$t;if(this[sde]=typeof i!="function"?x$t:i,this[xMe]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[Xee]=t.maxAge||0,this[h7]=t.dispose,this[Exn]=t.noDisposeOnSet||!1,this[Cxn]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[Jee]=t||1/0,vMe(this)}get max(){return this[Jee]}set allowStale(t){this[xMe]=!!t}get allowStale(){return this[xMe]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[Xee]=t,vMe(this)}get maxAge(){return this[Xee]}set lengthCalculator(t){typeof t!="function"&&(t=x$t),t!==this[sde]&&(this[sde]=t,this[g7]=0,this[bh].forEach(n=>{n.length=this[sde](n.value,n.key),this[g7]+=n.length})),vMe(this)}get lengthCalculator(){return this[sde]}get length(){return this[g7]}get itemCount(){return this[bh].length}rforEach(t,n){n=n||this;for(let i=this[bh].tail;i!==null;){let o=i.prev;bxn(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[bh].head;i!==null;){let o=i.next;bxn(this,t,i,n),i=o}}keys(){return this[bh].toArray().map(t=>t.key)}values(){return this[bh].toArray().map(t=>t.value)}reset(){this[h7]&&this[bh]&&this[bh].length&&this[bh].forEach(t=>this[h7](t.key,t.value)),this[NO]=new Map,this[bh]=new bDs,this[g7]=0}dump(){return this[bh].map(t=>oit(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[bh]}set(t,n,i){if(i=i||this[Xee],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[sde](n,t);if(this[NO].has(t)){if(s>this[Jee])return ade(this,this[NO].get(t)),!1;let c=this[NO].get(t).value;return this[h7]&&(this[Exn]||this[h7](t,c.value)),c.now=o,c.maxAge=i,c.value=n,this[g7]+=s-c.length,c.length=s,this.get(t),vMe(this),!0}let a=new _$t(t,n,s,o,i);return a.length>this[Jee]?(this[h7]&&this[h7](t,n),!1):(this[g7]+=a.length,this[bh].unshift(a),this[NO].set(t,this[bh].head),vMe(this),!0)}has(t){if(!this[NO].has(t))return!1;let n=this[NO].get(t).value;return!oit(this,n)}get(t){return S$t(this,t,!0)}peek(t){return S$t(this,t,!1)}pop(){let t=this[bh].tail;return t?(ade(this,t),t.value):null}del(t){ade(this,this[NO].get(t))}load(t){this.reset();let n=Date.now();for(let i=t.length-1;i>=0;i--){let o=t[i],s=o.e||0;if(s===0)this.set(o.k,o.v);else{let a=s-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[NO].forEach((t,n)=>S$t(this,n,!1))}},S$t=(r,t,n)=>{let i=r[NO].get(t);if(i){let o=i.value;if(oit(r,o)){if(ade(r,i),!r[xMe])return}else n&&(r[Cxn]&&(i.value.now=Date.now()),r[bh].unshiftNode(i));return o.value}},oit=(r,t)=>{if(!t||!t.maxAge&&!r[Xee])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[Xee]&&n>r[Xee]},vMe=r=>{if(r[g7]>r[Jee])for(let t=r[bh].tail;r[g7]>r[Jee]&&t!==null;){let n=t.prev;ade(r,t),t=n}},ade=(r,t)=>{if(t){let n=t.value;r[h7]&&r[h7](n.key,n.value),r[g7]-=n.length,r[NO].delete(n.key),r[bh].removeNode(t)}},_$t=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},bxn=(r,t,n,i)=>{let o=n.value;oit(r,o)&&(ade(r,n),r[xMe]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};Ixn.exports=O$t});var ax=C((_o0,Oxn)=>{var $ee=class{constructor(t,n){if(n=IDs(n),t instanceof $ee)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new $ee(t.raw,n);if(t instanceof B$t)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(o=>!xxn(o[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&BDs(o[0])){this.set=[o];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&_Ds)|(this.options.loose&&wDs))+":"+t,o=vxn.get(i);if(o)return o;let s=this.options.loose,a=s?ZE[a3.HYPHENRANGELOOSE]:ZE[a3.HYPHENRANGE];t=t.replace(a,FDs(this.options.includePrerelease)),fd("hyphen replace",t),t=t.replace(ZE[a3.COMPARATORTRIM],xDs),fd("comparator trim",t),t=t.replace(ZE[a3.TILDETRIM],SDs),fd("tilde trim",t),t=t.replace(ZE[a3.CARETTRIM],ODs),fd("caret trim",t);let u=t.split(" ").map(p=>RDs(p,this.options)).join(" ").split(/\s+/).map(p=>zDs(p,this.options));s&&(u=u.filter(p=>(fd("loose invalid filter",p,this.options),!!p.match(ZE[a3.COMPARATORLOOSE])))),fd("range list",u);let c=new Map,l=u.map(p=>new B$t(p,this.options));for(let p of l){if(xxn(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return vxn.set(i,d),d}intersects(t,n){if(!(t instanceof $ee))throw new TypeError("a Range is required");return this.set.some(i=>Sxn(i,n)&&t.set.some(o=>Sxn(o,n)&&i.every(s=>o.every(a=>s.intersects(a,n)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new vDs(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(LDs(this.set[n],t,this.options))return!0;return!1}};Oxn.exports=$ee;var CDs=w$t(),vxn=new CDs({max:1e3}),IDs=Jnt(),B$t=SMe(),fd=CMe(),vDs=y2(),{safeRe:ZE,t:a3,comparatorTrimReplace:xDs,tildeTrimReplace:SDs,caretTrimReplace:ODs}=ide(),{FLAG_INCLUDE_PRERELEASE:_Ds,FLAG_LOOSE:wDs}=bMe(),xxn=r=>r.value==="<0.0.0-0",BDs=r=>r.value==="",Sxn=(r,t)=>{let n=!0,i=r.slice(),o=i.pop();for(;n&&i.length;)n=i.every(s=>o.intersects(s,t)),o=i.pop();return n},RDs=(r,t)=>(fd("comp",r,t),r=DDs(r,t),fd("caret",r),r=TDs(r,t),fd("tildes",r),r=QDs(r,t),fd("xrange",r),r=kDs(r,t),fd("stars",r),r),u3=r=>!r||r.toLowerCase()==="x"||r==="*",TDs=(r,t)=>r.trim().split(/\s+/).map(n=>MDs(n,t)).join(" "),MDs=(r,t)=>{let n=t.loose?ZE[a3.TILDELOOSE]:ZE[a3.TILDE];return r.replace(n,(i,o,s,a,u)=>{fd("tilde",r,i,o,s,a,u);let c;return u3(o)?c="":u3(s)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:u3(a)?c=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(fd("replaceTilde pr",u),c=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,fd("tilde return",c),c})},DDs=(r,t)=>r.trim().split(/\s+/).map(n=>NDs(n,t)).join(" "),NDs=(r,t)=>{fd("caret",r,t);let n=t.loose?ZE[a3.CARETLOOSE]:ZE[a3.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,c)=>{fd("caret",r,o,s,a,u,c);let l;return u3(s)?l="":u3(a)?l=`>=${s}.0.0${i} <${+s+1}.0.0-0`:u3(u)?s==="0"?l=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:c?(fd("replaceCaret pr",c),s==="0"?a==="0"?l=`>=${s}.${a}.${u}-${c} <${s}.${a}.${+u+1}-0`:l=`>=${s}.${a}.${u}-${c} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.${u}-${c} <${+s+1}.0.0-0`):(fd("no pr"),s==="0"?a==="0"?l=`>=${s}.${a}.${u}${i} <${s}.${a}.${+u+1}-0`:l=`>=${s}.${a}.${u}${i} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.${u} <${+s+1}.0.0-0`),fd("caret return",l),l})},QDs=(r,t)=>(fd("replaceXRanges",r,t),r.split(/\s+/).map(n=>PDs(n,t)).join(" ")),PDs=(r,t)=>{r=r.trim();let n=t.loose?ZE[a3.XRANGELOOSE]:ZE[a3.XRANGE];return r.replace(n,(i,o,s,a,u,c)=>{fd("xRange",r,i,o,s,a,u,c);let l=u3(s),d=l||u3(a),p=d||u3(u),A=p;return o==="="&&A&&(o=""),c=t.includePrerelease?"-0":"",l?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&A?(d&&(a=0),u=0,o===">"?(o=">=",d?(s=+s+1,a=0,u=0):(a=+a+1,u=0)):o==="<="&&(o="<",d?s=+s+1:a=+a+1),o==="<"&&(c="-0"),i=`${o+s}.${a}.${u}${c}`):d?i=`>=${s}.0.0${c} <${+s+1}.0.0-0`:p&&(i=`>=${s}.${a}.0${c} <${s}.${+a+1}.0-0`),fd("xRange return",i),i})},kDs=(r,t)=>(fd("replaceStars",r,t),r.trim().replace(ZE[a3.STAR],"")),zDs=(r,t)=>(fd("replaceGTE0",r,t),r.trim().replace(ZE[t.includePrerelease?a3.GTE0PRE:a3.GTE0],"")),FDs=r=>(t,n,i,o,s,a,u,c,l,d,p,A,f)=>(u3(i)?n="":u3(o)?n=`>=${i}.0.0${r?"-0":""}`:u3(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,u3(l)?c="":u3(d)?c=`<${+l+1}.0.0-0`:u3(p)?c=`<${l}.${+d+1}.0-0`:A?c=`<=${l}.${d}.${p}-${A}`:r?c=`<${l}.${d}.${+p+1}-0`:c=`<=${c}`,`${n} ${c}`.trim()),LDs=(r,t,n)=>{for(let i=0;i<r.length;i++)if(!r[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let i=0;i<r.length;i++)if(fd(r[i].semver),r[i].semver!==B$t.ANY&&r[i].semver.prerelease.length>0){let o=r[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var SMe=C((wo0,Mxn)=>{var OMe=Symbol("SemVer ANY"),ude=class{static get ANY(){return OMe}constructor(t,n){if(n=_xn(n),t instanceof ude){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),T$t("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===OMe?this.value="":this.value=this.operator+this.semver.version,T$t("comp",this)}parse(t){let n=this.options.loose?wxn[Bxn.COMPARATORLOOSE]:wxn[Bxn.COMPARATOR],i=t.match(n);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Rxn(i[2],this.options.loose):this.semver=OMe}toString(){return this.value}test(t){if(T$t("Comparator.test",t,this.options.loose),this.semver===OMe||t===OMe)return!0;if(typeof t=="string")try{t=new Rxn(t,this.options)}catch{return!1}return R$t(t,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof ude))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Txn(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new Txn(this.value,n).test(t.semver):(n=_xn(n),n.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||R$t(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||R$t(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Mxn.exports=ude;var _xn=Jnt(),{safeRe:wxn,t:Bxn}=ide(),R$t=I$t(),T$t=CMe(),Rxn=y2(),Txn=ax()});var _Me=C((Bo0,Dxn)=>{var qDs=ax(),UDs=(r,t,n)=>{try{t=new qDs(t,n)}catch{return!1}return t.test(r)};Dxn.exports=UDs});var Qxn=C((Ro0,Nxn)=>{var jDs=ax(),GDs=(r,t)=>new jDs(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));Nxn.exports=GDs});var kxn=C((To0,Pxn)=>{var WDs=y2(),HDs=ax(),VDs=(r,t,n)=>{let i=null,o=null,s=null;try{s=new HDs(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new WDs(i,n))}),i};Pxn.exports=VDs});var Fxn=C((Mo0,zxn)=>{var YDs=y2(),KDs=ax(),JDs=(r,t,n)=>{let i=null,o=null,s=null;try{s=new KDs(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new YDs(i,n))}),i};zxn.exports=JDs});var Uxn=C((Do0,qxn)=>{var M$t=y2(),XDs=ax(),Lxn=IMe(),$Ds=(r,t)=>{r=new XDs(r,t);let n=new M$t("0.0.0");if(r.test(n)||(n=new M$t("0.0.0-0"),r.test(n)))return n;n=null;for(let i=0;i<r.set.length;++i){let o=r.set[i],s=null;o.forEach(a=>{let u=new M$t(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||Lxn(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||Lxn(n,s))&&(n=s)}return n&&r.test(n)?n:null};qxn.exports=$Ds});var Gxn=C((No0,jxn)=>{var ZDs=ax(),e9s=(r,t)=>{try{return new ZDs(r,t).range||"*"}catch{return null}};jxn.exports=e9s});var sit=C((Qo0,Yxn)=>{var t9s=y2(),Vxn=SMe(),{ANY:r9s}=Vxn,n9s=ax(),i9s=_Me(),Wxn=IMe(),Hxn=eit(),o9s=rit(),s9s=tit(),a9s=(r,t,n,i)=>{r=new t9s(r,i),t=new n9s(t,i);let o,s,a,u,c;switch(n){case">":o=Wxn,s=o9s,a=Hxn,u=">",c=">=";break;case"<":o=Hxn,s=s9s,a=Wxn,u="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i9s(r,t,i))return!1;for(let l=0;l<t.set.length;++l){let d=t.set[l],p=null,A=null;if(d.forEach(f=>{f.semver===r9s&&(f=new Vxn(">=0.0.0")),p=p||f,A=A||f,o(f.semver,p.semver,i)?p=f:a(f.semver,A.semver,i)&&(A=f)}),p.operator===u||p.operator===c||(!A.operator||A.operator===u)&&s(r,A.semver))return!1;if(A.operator===c&&a(r,A.semver))return!1}return!0};Yxn.exports=a9s});var Jxn=C((Po0,Kxn)=>{var u9s=sit(),l9s=(r,t,n)=>u9s(r,t,">",n);Kxn.exports=l9s});var $xn=C((ko0,Xxn)=>{var c9s=sit(),d9s=(r,t,n)=>c9s(r,t,"<",n);Xxn.exports=d9s});var t5n=C((zo0,e5n)=>{var Zxn=ax(),p9s=(r,t,n)=>(r=new Zxn(r,n),t=new Zxn(t,n),r.intersects(t,n));e5n.exports=p9s});var n5n=C((Fo0,r5n)=>{var A9s=_Me(),f9s=sx();r5n.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((d,p)=>f9s(d,p,n));for(let d of a)A9s(d,t,n)?(s=d,o||(o=d)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let u=[];for(let[d,p]of i)d===p?u.push(d):!p&&d===a[0]?u.push("*"):p?d===a[0]?u.push(`<=${p}`):u.push(`${d} - ${p}`):u.push(`>=${d}`);let c=u.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length<l.length?c:t}});var l5n=C((Lo0,u5n)=>{var i5n=ax(),N$t=SMe(),{ANY:D$t}=N$t,wMe=_Me(),Q$t=sx(),h9s=(r,t,n={})=>{if(r===t)return!0;r=new i5n(r,n),t=new i5n(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=m9s(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},g9s=[new N$t(">=0.0.0-0")],o5n=[new N$t(">=0.0.0")],m9s=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===D$t){if(t.length===1&&t[0].semver===D$t)return!0;n.includePrerelease?r=g9s:r=o5n}if(t.length===1&&t[0].semver===D$t){if(n.includePrerelease)return!0;t=o5n}let i=new Set,o,s;for(let f of r)f.operator===">"||f.operator===">="?o=s5n(o,f,n):f.operator==="<"||f.operator==="<="?s=a5n(s,f,n):i.add(f.semver);if(i.size>1)return null;let a;if(o&&s){if(a=Q$t(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let f of i){if(o&&!wMe(f,String(o),n)||s&&!wMe(f,String(s),n))return null;for(let h of t)if(!wMe(f,String(h),n))return!1;return!0}let u,c,l,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,A=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let f of t){if(d=d||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",o){if(A&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===A.major&&f.semver.minor===A.minor&&f.semver.patch===A.patch&&(A=!1),f.operator===">"||f.operator===">="){if(u=s5n(o,f,n),u===f&&u!==o)return!1}else if(o.operator===">="&&!wMe(o.semver,String(f),n))return!1}if(s){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator==="<"||f.operator==="<="){if(c=a5n(s,f,n),c===f&&c!==s)return!1}else if(s.operator==="<="&&!wMe(s.semver,String(f),n))return!1}if(!f.operator&&(s||o)&&a!==0)return!1}return!(o&&l&&!s&&a!==0||s&&d&&!o&&a!==0||A||p)},s5n=(r,t,n)=>{if(!r)return t;let i=Q$t(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},a5n=(r,t,n)=>{if(!r)return t;let i=Q$t(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};u5n.exports=h9s});var BMe=C((qo0,p5n)=>{var P$t=ide(),c5n=bMe(),y9s=y2(),d5n=E$t(),E9s=Yee(),b9s=M4n(),C9s=N4n(),I9s=k4n(),v9s=L4n(),x9s=U4n(),S9s=G4n(),O9s=H4n(),_9s=Y4n(),w9s=sx(),B9s=$4n(),R9s=exn(),T9s=Znt(),M9s=ixn(),D9s=sxn(),N9s=IMe(),Q9s=eit(),P9s=b$t(),k9s=C$t(),z9s=tit(),F9s=rit(),L9s=I$t(),q9s=hxn(),U9s=SMe(),j9s=ax(),G9s=_Me(),W9s=Qxn(),H9s=kxn(),V9s=Fxn(),Y9s=Uxn(),K9s=Gxn(),J9s=sit(),X9s=Jxn(),$9s=$xn(),Z9s=t5n(),eNs=n5n(),tNs=l5n();p5n.exports={parse:E9s,valid:b9s,clean:C9s,inc:I9s,diff:v9s,major:x9s,minor:S9s,patch:O9s,prerelease:_9s,compare:w9s,rcompare:B9s,compareLoose:R9s,compareBuild:T9s,sort:M9s,rsort:D9s,gt:N9s,lt:Q9s,eq:P9s,neq:k9s,gte:z9s,lte:F9s,cmp:L9s,coerce:q9s,Comparator:U9s,Range:j9s,satisfies:G9s,toComparators:W9s,maxSatisfying:H9s,minSatisfying:V9s,minVersion:Y9s,validRange:K9s,outside:J9s,gtr:X9s,ltr:$9s,intersects:Z9s,simplifyRange:eNs,subset:tNs,SemVer:y9s,re:P$t.re,src:P$t.src,tokens:P$t.t,SEMVER_SPEC_VERSION:c5n.SEMVER_SPEC_VERSION,RELEASE_TYPES:c5n.RELEASE_TYPES,compareIdentifiers:d5n.compareIdentifiers,rcompareIdentifiers:d5n.rcompareIdentifiers}});var RMe,rNs,jo0,nNs,lde,ait=lt(()=>{"use strict";RMe=St(NA()),rNs=St(BMe()),jo0=(0,RMe.Record)({version:RMe.String,hash:RMe.String}),nNs=()=>({version:"7.2.8",hash:"d857c6e7cd1d0bc2b021f7aa6d16e7e209146c3f"}),lde=nNs()});var A5n,ux,f5n,oNs,uit,sNs,TMe,lit=lt(()=>{"use strict";A5n=St(cMe());dMe();z0e();MMe();ul();ait();f5n=r=>{ux=r},oNs=()=>ld()?{}:{windowInfo:{frontendURLHost:self.location.host}},uit=r=>({coalesceSoftwareVersion:lde?.version||"",service:r,env:process.env.REACT_APP_OWNER??"",reactAppCoalesceDev:process.env.REACT_APP_COALESCE_DEV??""}),sNs=r=>{let t=uit(ux);return{appEnv:oNs(),loggingArea:r,...t}},TMe=r=>{let t=ix[r];if(!t)throw new Error(`Logging area "${r}" is not a valid LoggingAreas key`);return t.logger||(t.logger=A5n.createLogger({levels:Srt.LEVELS,defaultMeta:sNs(r),level:t.level,transports:h5n(t)})),t.logger}});var g5n,eb,k$t,m5n,z$t,F$t,cit,aNs,L$t,cde,dit,q$t,pit,h5n,MMe=lt(()=>{"use strict";g5n=St(BL()),eb=St(cMe());z0e();pMe();lit();ul();k$t=null,m5n=r=>{k$t=r},z$t=class extends g5n.default{baseContext;levelMappings;constructor(t){super(t),this.baseContext=uit(ux),this.levelMappings={emerg:"error",assert:"warn",alert:"warn",error:"warn",app:"info",info:"info",debug:"debug"}}log(t,n){k$t&&k$t.log(t,{...this.baseContext,...Ad},this.levelMappings[t.level]),n()}},F$t=null,cit=r=>{let t=uit(r);F$t={host:"http-intake.logs.datadoghq.com",path:`/v1/input/pub04bd017317b60c96b62874179d82ff97?ddtags=env:${t.env},coalesceSoftwareVersion:${t.coalesceSoftwareVersion}&ddsource=nodejs&service=${r}`,ssl:!0}},aNs=!1,L$t=()=>eb.format.combine(eb.format.timestamp(),eb.format.colorize({colors:Srt.COLORS}),eb.format.printf(r=>`|${r.timestamp}|${process.env.JEST_WORKER_ID?`[SHARD:${process.env.JEST_WORKER_ID}]`:""}[${r.loggingArea}]${r.orgID?`|(org:${r.orgID})`:""}${r.workspaceID?`|(env:${r.workspaceID})`:""}${r.userID?`|(user:${r.userID})`:""}${r.runID?`|run:${r.runID})`:""}(${r.nodeID?`|(node:${r.nodeID})`:""})|)|${r.level}:${r.message}`)),cde=r=>new eb.transports.Console({format:process.env.CONSOLE_JSON_LOGS?eb.format.combine(eb.format.timestamp(),eb.format.json()):L$t(),level:r.level,silent:aNs}),dit=()=>new eb.transports.Http({...F$t,format:eb.format.combine(L$t(),eb.format.uncolorize()),level:"info",env:process.env.REACT_APP_OWNER}),q$t=()=>new eb.transports.File({filename:process.env.JEST_WORKER_ID?`test-shard-${process.env.JEST_WORKER_ID}.log`:"test.log",dirname:"./test-logs",format:L$t(),level:xrt.debug}),pit=r=>{let t=r??{};return new z$t(t)},h5n=r=>{let t=[];return t.push(cde(r)),F$t&&t.push(dit()),al().isTest&&t.push(q$t()),[pit(),...t]}});var y5n,Ait,fit,U$t,hit,m7,E5n=lt(()=>{"use strict";y5n=St(Za()),Ait=St(cMe());dMe();MMe();ul();lit();z0e();fit=(r,t)=>{let n=r.toUpperCase(),i=[];if(n in ix||i.push(`invalid logging area '${n}'`),xrt[t]||i.push("`invalid log level '${logLevel}'`"),i.length)throw i.forEach(u=>{console.error(u)}),new Error("Invalid logging area or log level: "+i.join(", "));let o=TMe(n),s=o.transports.filter(u=>u instanceof Ait.transports.Console),a=o.transports;s.length||(a=[...a,cde(ix[n])]),a.filter(u=>u instanceof Ait.transports.Console)[0].level=t,o.configure({...o,transports:o.transports})},U$t=()=>{Object.keys(ix).forEach(r=>{fit(r,"debug")})},hit=(r,t)=>{for(let n in r){let i=n,o=TMe(i);r[i].defaultMeta={...o.defaultMeta,...r[i].defaultMeta,...t};let s=r[i].transports||o.transports;if(al().isTest&&s.length>0){let a=s[s.length-1];a instanceof Ait.transports.File&&a.close&&(a.close(),s=o.transports.slice(0,-1),s.push(q$t()))}o.configure({...o,...r[i],transports:s,level:r[i].level||o.level})}},m7=r=>{let t=y5n.default.mapValues(ix,(n,i)=>({}));hit(t,r)}});var b5n=lt(()=>{"use strict"});function Ef(r){return typeof r=="object"&&r instanceof Gt}function yit(r){return typeof r=="object"&&r instanceof Error&&typeof r.code=="string"}var Gt,Zee,W1,_c,lx,QO,git,DMe,ete,mit,NMe,li=lt(()=>{"use strict";b5n();Gt=class extends Error{detailMessage;constructor(t,n){super(t),this.detailMessage=n}statusCode(){return 500}get detail(){return this.detailMessage}toTRunError(){return{error:{errorString:this.message,errorDetail:this.detailMessage||""}}}toString(){return JSON.stringify(this.toTRunError())}toFormattedString(){return this.detailMessage?`${this.message}: ${this.detailMessage}`:this.message}toFormattedStringWithCode(){return`${this.statusCode()}${": "+this.toFormattedString()}`}handleExpressResponse(t){t.status(this.statusCode()).json(this.toTRunError())}};Zee=class extends Gt{},W1=class extends Gt{statusCode(){return 404}},_c=class extends Gt{statusCode(){return 400}},lx=class extends Gt{statusCode(){return 403}},QO=class extends Gt{statusCode(){return 409}},git=class extends Gt{constructor(t="Not implemented",n){super(t,n)}statusCode(){return 501}},DMe=class extends Gt{statusCode(){return 404}},ete=class extends Gt{releaseID;packageID;pkgAlias;constructor(t,n,i){super(t,i),this.releaseID=n?.contents?.release?.releaseID||"n/a",this.packageID=n?.contents?.packageID||"n/a",this.pkgAlias=n?.alias||"n/a"}},mit=class extends Gt{entityCollection;entityData;entityId;constructor(t,n,i,o,s){let a=`Entity with id "${n}" in "${t}" failed validation for these reasons: ${i}`;super(a,o),this.entityCollection=t,this.entityData=s,this.entityId=n}toTRunError(){return{error:{errorString:this.message,errorDetail:this.detail?this.detail:this.message},validationDetails:{id:this.entityId,type:this.entityCollection,value:this.entityData}}}},NMe=class extends Gt{constructor(t,n){super(t,n)}}});var C5n,Eit,QMe,uNs,lNs,I5n,kL,j$t=lt(()=>{"use strict";li();C5n=()=>{let r=new WeakSet;return(t,n)=>{if(typeof n=="object"&&n!==null){if(r.has(n))return;r.add(n)}return n}},Eit=r=>{switch(typeof r){case"object":if(r===null)return"null";try{if(r instanceof Error){if(r instanceof Gt)return r.toString();if(yit(r))return`Error: [${r.code}] ${r.message}`}switch(r?.constructor?.name){case"Object":case"Array":return JSON.stringify(r,C5n());case"Set":return JSON.stringify(Array.from(r),C5n());case"Error":{let t=r.toString();try{let n=JSON.stringify(r);n!=="{}"&&(t=n)}catch{}return t}case"Null":return"null";case"Function":case"RegExp":return r.toString();case"Date":return r.toDateString();case"ReferenceError":case"TypeError":case"SyntaxError":case"JestAssertionError":return r.toString();case void 0:default:return`attempting to stringify object w/ constructor: ${r?.constructor?.name}; ${JSON.stringify(r)}`}}catch(t){return`Error converting object to string:${t}`}case"undefined":return typeof r;case"bigint":case"number":case"symbol":return r.toString();case"boolean":return String(r);case"string":return r;default:return"Can't convert arg to string"}},QMe=r=>r.map(Eit),uNs=1e6,lNs=.8,I5n=r=>{let i=uNs*lNs/r.length/2;return r.map(s=>typeof s!="string"||s.length<i?s:s.slice(0,i))},kL=r=>{let t;return r&&r.length>5?t="*"+r.substring(r.length-4,r.length):r.length?t="****":t="",t}});var cNs,v5n,x5n,G$t,bit=lt(()=>{"use strict";pMe();cNs=()=>({logContext:Oc()}),v5n=cNs,x5n=r=>{v5n=r},G$t=()=>v5n()});var W$t,dNs,ot,O5n=lt(()=>{"use strict";dMe();MMe();z0e();j$t();lit();bit();W$t=(r,t)=>{f5n(r),ux==="Frontend"?m5n(t.datadogFrontEndLogger):ux==="CLI"?cit(ux):ux==="Scheduler"?cit(ux):ux==="JestTest"&&cit(ux)},dNs=r=>{let t=u=>{let c=QMe(u);return I5n(c).join(" ")},n=u=>u?{...u,envID:u.envID?.toString(),workspaceID:u.workspaceID?.toString()}:{},i=(u,c)=>{o(u,void 0,c)},o=(u,c,l)=>{let d=TMe(r);if(!d.isLevelEnabled(u))return;let p=t(l);d.log({level:u,message:p,...n({...G$t().logContext,...c})})};return{...{info:(...u)=>{i("info",u)},infoContext:(u,...c)=>{o("info",u,c)},emerg:(...u)=>{i("emerg",u)},emergContext:(u,...c)=>{o("emerg",u,c)},assert:(...u)=>{i("assert",u)},assertContext:(u,...c)=>{o("assert",u,c)},alert:(...u)=>{i("alert",u)},alertContext:(u,...c)=>{o("alert",u,c)},debug:(...u)=>{i("debug",u)},debugContext:(u,...c)=>{o("debug",u,c)},error:(...u)=>{i("error",u)},errorContext:(u,...c)=>{o("error",u,c)},app:(...u)=>{i("app",u)},appContext:(u,...c)=>{o("app",u,c)}},fromFunction:(u,c,l,...d)=>{u.function=c,o(l,u,d),delete u.function}}},ot=Object.fromEntries($Xt.map(r=>[r,dNs(r)]))});var _5n=lt(()=>{"use strict"});var w5n=lt(()=>{"use strict";ul();_5n()});var Ar=lt(()=>{"use strict";z0e();E5n();pMe();O5n();dMe();w5n();j$t();MMe()});function Ys(r,t,n){return(0,Cit.has)(r,t)?(0,Cit.get)(r,t):n}function Y$t(r,t,n){if(r==null){let i=`Non-nullish assertion failed; More info: ${n}`;throw tte.assertContext(t,i),new Error(i)}else return}var B5n,Cit,fNs,hNs,tte,rte,V$t,gNs,Ki,gu,Iit,R5n,H$t,T5n,QB,M5n,zL,kMe,D5n,dde,tb,N5n,Q5n,PMe,P5n,K$t,k5n,J$t,z5n,F5n,FL,vit,L5n,q5n,U5n,j5n,G5n,W5n,xit,PB,vi=lt(()=>{"use strict";drt();B5n=require("child_process"),Cit=St(Za()),fNs=St(m3n());gEn();ul();Ar();tte=ot.COMMON;rte=(r,t,n)=>({statusCode:r,error:{errorString:t,errorDetail:n},toString:()=>`${t} DETAIL:${n} STATUS CODE:${r}`}),V$t=(l=>(l.AG_Tree_Node="ag-tree-node",l.AG_Tree_Subgraph="ag-tree-subgraph",l.AG_Tree_Job="ag-tree-job",l.AG_Tree_Parent="ag-tree-parent",l.AG_SQL_Step_Menu_Column="ag-SQL-step-menu-column",l.AG_Column_Viewer_Column="ag-column-viewer-column",l.Step_Menu_Tab="step-menu-tab",l.Node_Test="node-test",l.Tabular_Config="tabular-config",l))(V$t||{}),gNs=()=>{let r=new Error().stack;if(r)return r.split(`
125
+ `))}_onEvent(t,n){function i(o){t==="error"&&!this.transports.includes(n)&&this.add(n),this.emit(t,o,n)}n["__winston"+t]||(n["__winston"+t]=i.bind(this),n.on(t,n["__winston"+t]))}_addDefaultMeta(t){this.defaultMeta&&Object.assign(t,this.defaultMeta)}};function JXt(r,t){let n=r[t];return!n&&n!==0?null:n}Object.defineProperty(Snt.prototype,"transports",{configurable:!1,enumerable:!0,get(){let{pipes:r}=this._readableState;return Array.isArray(r)?r:[r].filter(Boolean)}});Avn.exports=Snt});var XXt=C((di0,hvn)=>{"use strict";var{LEVEL:wTs}=DA(),BTs=Ent(),RTs=fvn(),TTs=iMe()("winston:create-logger");function MTs(r){return"is"+r.charAt(0).toUpperCase()+r.slice(1)+"Enabled"}hvn.exports=function(r={}){r.levels=r.levels||BTs.npm.levels;class t extends RTs{constructor(o){super(o)}}let n=new t(r);return Object.keys(r.levels).forEach(function(i){if(TTs('Define prototype method for "%s"',i),i==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}t.prototype[i]=function(...o){let s=this||n;if(o.length===1){let[a]=o,u=a&&a.message&&a||{message:a};return u.level=u[wTs]=i,s._addDefaultMeta(u),s.write(u),this||n}return o.length===0?(s.log(i,""),s):s.log(i,...o)},t.prototype[MTs(i)]=function(){return(this||n).isLevelEnabled(i)}}),n}});var mvn=C((Ai0,gvn)=>{"use strict";var DTs=XXt();gvn.exports=class{constructor(t={}){this.loggers=new Map,this.options=t}add(t,n){if(!this.loggers.has(t)){n=Object.assign({},n||this.options);let i=n.transports||this.options.transports;n.transports=i?i.slice():[];let o=DTs(n);o.on("close",()=>this._delete(t)),this.loggers.set(t,o)}return this.loggers.get(t)}get(t,n){return this.add(t,n)}has(t){return!!this.loggers.has(t)}close(t){if(t)return this._removeLogger(t);this.loggers.forEach((n,i)=>this._removeLogger(i))}_removeLogger(t){if(!this.loggers.has(t))return;this.loggers.get(t).close(),this._delete(t)}_delete(t){this.loggers.delete(t)}}});var cMe=C(B0=>{"use strict";var yvn=JJt(),{warn:J0e}=XJt();B0.version=kbn().version;B0.transports=HIn();B0.config=Ent();B0.addColors=yvn.levels;B0.format=yvn.format;B0.createLogger=XXt();B0.ExceptionHandler=VXt();B0.RejectionHandler=KXt();B0.Container=mvn();B0.Transport=BL();B0.loggers=new B0.Container;var d7=B0.createLogger();Object.keys(B0.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(r=>B0[r]=(...t)=>d7[r](...t));Object.defineProperty(B0,"level",{get(){return d7.level},set(r){d7.level=r}});Object.defineProperty(B0,"exceptions",{get(){return d7.exceptions}});["exitOnError"].forEach(r=>{Object.defineProperty(B0,r,{get(){return d7[r]},set(t){d7[r]=t}})});Object.defineProperty(B0,"default",{get(){return{exceptionHandlers:d7.exceptionHandlers,rejectionHandlers:d7.rejectionHandlers,transports:d7.transports}}});J0e.deprecated(B0,"setLevels");J0e.forFunctions(B0,"useFormat",["cli"]);J0e.forProperties(B0,"useFormat",["padLevels","stripColors"]);J0e.forFunctions(B0,"deprecated",["addRewriter","addFilter","clone","extend"]);J0e.forProperties(B0,"deprecated",["emitErrs","levelLength"]);J0e.moved(B0,"createLogger","Logger")});var $Xt,ix,dMe=lt(()=>{"use strict";$Xt=["ACTUAL_STATE","ADVANCED_DEPLOY","APP","AUTH","BULK_WRITE","CLI","CLI_INTERNAL","COLUMN_LINEAGE","COLUMN_METADATA","COMMON","CONNECTION","DEBUG","DEPLOY","DNS","DOCS","DRAG","ENV","ENVIRONMENTS","ERROR_OPERATIONS","FIREBASE","FOLDERS","GIT","GIT_SETTINGS","GOOGLE_DEBUG","GRAPH","HEARTBEAT","JEST","JOBS","JSON_PARSER","LIGHTNING_FS","LISTENERS","MACROS","MAPPING_GRID","METADATA_HYDRATION","METADATA_OPERATIONS","NARROW_METADATA","ORGS","ORG_BOOTSTRAP","ORG_SCANNER","ORG_SETTINGS","ORG_UPGRADE","PACKAGES","PACKAGES_BACKEND","PACKAGE_NAMESPACES","PACKAGE_REGISTRY","PALETTE","PARTNER_CONNECT","PENDO","PERFORMANCE","PLAN_NODES","PLAN_UTILS","PLATFORM","PRESYNC","PROBLEM_SCANNER","PROJECTS","RBAC","RENDERER","RUNNER","RUNNER_BACKEND","RUN_RESULTS","RUN_TRANSACTION","SEARCH","SECRETS","SQL_PARSING","SQL_TESTING","STATE","STEPS","STEP_TYPES","STORAGE_LOCATIONS","STRUMENTA","SYSTEM_EMAILS","TEMPLATE_EDITOR","TESTING","TIMING_UTILS","TREE_OPERATIONS","TYPESENSE","UI","USERS","USER_ACTIVATION","USER_MANAGEMENT","USER_SETTINGS","VERSIONING","VERSION_CONTROL_ACTIONS","WORKSPACES","XML_PARSER","YAML","ZIP"],ix={...Object.fromEntries($Xt.map(r=>[r,{level:"info"}]))}});var Oc,p7,Ad,pMe=lt(()=>{"use strict";Oc=(r,t,n,i,o)=>({orgID:r,workspaceID:t,userID:n,runID:i,nodeID:o}),p7=(r,t)=>{r.runID=t},Ad={}});var bvn=C(Evn=>{"use strict";Object.defineProperty(Evn,"__esModule",{value:!0})});var ZXt=C(Ont=>{"use strict";Object.defineProperty(Ont,"__esModule",{value:!0});Ont.Failcode=void 0;Ont.Failcode={TYPE_INCORRECT:"TYPE_INCORRECT",VALUE_INCORRECT:"VALUE_INCORRECT",KEY_INCORRECT:"KEY_INCORRECT",CONTENT_INCORRECT:"CONTENT_INCORRECT",ARGUMENT_INCORRECT:"ARGUMENT_INCORRECT",RETURN_INCORRECT:"RETURN_INCORRECT",CONSTRAINT_FAILED:"CONSTRAINT_FAILED",PROPERTY_MISSING:"PROPERTY_MISSING",PROPERTY_PRESENT:"PROPERTY_PRESENT",NOTHING_EXPECTED:"NOTHING_EXPECTED"}});var $0e=C(X0e=>{"use strict";var NTs=X0e&&X0e.__extends||function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])},r(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(X0e,"__esModule",{value:!0});X0e.ValidationError=void 0;var QTs=function(r){NTs(t,r);function t(n){var i=r.call(this,n.message)||this;return i.name="ValidationError",i.code=n.code,n.details!==void 0&&(i.details=n.details),Object.setPrototypeOf(i,t.prototype),i}return t}(Error);X0e.ValidationError=QTs});var AMe=C(e$t=>{"use strict";Object.defineProperty(e$t,"__esModule",{value:!0});var _nt=function(r){return function(t){switch(t.tag){case"literal":return'"'.concat(String(t.value),'"');case"string":return"string";case"brand":return t.brand;case"constraint":return t.name||_nt(r)(t.underlying);case"union":return t.alternatives.map(_nt(r)).join(" | ");case"intersect":return t.intersectees.map(_nt(r)).join(" & ");default:break}return"`${".concat(CI(!1,r)(t),"}`")}},wnt=function(r){return function(t){switch(t.tag){case"literal":return String(t.value);case"brand":return"${".concat(t.brand,"}");case"constraint":return t.name?"${".concat(t.name,"}"):wnt(r)(t.underlying);case"union":if(t.alternatives.length===1){var n=t.alternatives[0];return wnt(r)(n.reflect)}break;case"intersect":if(t.intersectees.length===1){var n=t.intersectees[0];return wnt(r)(n.reflect)}break;default:break}return"${".concat(CI(!1,r)(t),"}")}},CI=function(r,t){return function(n){var i=function(l){return r?"(".concat(l,")"):l};if(t.has(n))return i("CIRCULAR ".concat(n.tag));t.add(n);try{switch(n.tag){case"unknown":case"never":case"void":case"boolean":case"number":case"bigint":case"string":case"symbol":case"function":return n.tag;case"literal":{var o=n.value;return typeof o=="string"?'"'.concat(o,'"'):String(o)}case"template":{if(n.strings.length===0)return'""';if(n.strings.length===1)return'"'.concat(n.strings[0],'"');if(n.strings.length===2&&n.strings.every(function(l){return l===""})){var s=n.runtypes[0];return _nt(t)(s.reflect)}var a=!1,u=n.strings.reduce(function(l,d,p){var A=l+d,f=n.runtypes[p];if(f){var h=wnt(t)(f.reflect);return!a&&h.startsWith("$")&&(a=!0),A+h}else return A},"");return a?"`".concat(u,"`"):'"'.concat(u,'"')}case"array":return"".concat(Cvn(n)).concat(CI(!0,t)(n.element),"[]");case"dictionary":return"{ [_: ".concat(n.key,"]: ").concat(CI(!1,t)(n.value)," }");case"record":{var c=Object.keys(n.fields);return c.length?"{ ".concat(c.map(function(l){return"".concat(Cvn(n)).concat(l).concat(PTs(n,l),": ").concat(n.fields[l].tag==="optional"?CI(!1,t)(n.fields[l].underlying):CI(!1,t)(n.fields[l]),";")}).join(" ")," }"):"{}"}case"tuple":return"[".concat(n.components.map(CI(!1,t)).join(", "),"]");case"union":return i("".concat(n.alternatives.map(CI(!0,t)).join(" | ")));case"intersect":return i("".concat(n.intersectees.map(CI(!0,t)).join(" & ")));case"optional":return CI(r,t)(n.underlying)+" | undefined";case"constraint":return n.name||CI(r,t)(n.underlying);case"instanceof":return n.ctor.name;case"brand":return CI(r,t)(n.entity)}}finally{t.delete(n)}throw Error("impossible")}};e$t.default=CI(!1,new Set);function PTs(r,t){var n=r.isPartial,i=r.fields;return n||t!==void 0&&i[t].tag==="optional"?"?":""}function Cvn(r){var t=r.isReadonly;return t?"readonly ":""}});var Wd=C(jc=>{"use strict";var t$t=jc&&jc.__assign||function(){return t$t=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},t$t.apply(this,arguments)};Object.defineProperty(jc,"__esModule",{value:!0});jc.FAILURE=jc.SUCCESS=jc.enumerableKeysOf=jc.typeOf=jc.hasKey=void 0;var MB=ZXt(),Hee=AMe();function kTs(r,t){return typeof t=="object"&&t!==null&&r in t}jc.hasKey=kTs;var zTs=function(r){var t,n,i;return typeof r=="object"?r===null?"null":Array.isArray(r)?"array":((t=r.constructor)===null||t===void 0?void 0:t.name)==="Object"?"object":(i=(n=r.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:typeof r:typeof r};jc.typeOf=zTs;var FTs=function(r){return typeof r=="object"&&r!==null?Reflect.ownKeys(r).filter(function(t){var n,i;return(i=(n=r.propertyIsEnumerable)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:!0}):[]};jc.enumerableKeysOf=FTs;function LTs(r){return{success:!0,value:r}}jc.SUCCESS=LTs;jc.FAILURE=Object.assign(function(r,t,n){return t$t({success:!1,code:r,message:t},n?{details:n}:{})},{TYPE_INCORRECT:function(r,t){var n="Expected ".concat(r.tag==="template"?"string ".concat((0,Hee.default)(r)):(0,Hee.default)(r),", but was ").concat((0,jc.typeOf)(t));return(0,jc.FAILURE)(MB.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(r,t,n){return(0,jc.FAILURE)(MB.Failcode.VALUE_INCORRECT,"Expected ".concat(r," ").concat(String(t),", but was ").concat(String(n)))},KEY_INCORRECT:function(r,t,n){return(0,jc.FAILURE)(MB.Failcode.KEY_INCORRECT,"Expected ".concat((0,Hee.default)(r)," key to be ").concat((0,Hee.default)(t),", but was ").concat((0,jc.typeOf)(n)))},CONTENT_INCORRECT:function(r,t){var n="Expected ".concat((0,Hee.default)(r),", but was incompatible");return(0,jc.FAILURE)(MB.Failcode.CONTENT_INCORRECT,n,t)},ARGUMENT_INCORRECT:function(r){return(0,jc.FAILURE)(MB.Failcode.ARGUMENT_INCORRECT,r)},RETURN_INCORRECT:function(r){return(0,jc.FAILURE)(MB.Failcode.RETURN_INCORRECT,r)},CONSTRAINT_FAILED:function(r,t){var n=t?": ".concat(t):"";return(0,jc.FAILURE)(MB.Failcode.CONSTRAINT_FAILED,"Failed constraint check for ".concat((0,Hee.default)(r)).concat(n))},PROPERTY_MISSING:function(r){var t="Expected ".concat((0,Hee.default)(r),", but was missing");return(0,jc.FAILURE)(MB.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(r){var t="Expected nothing, but was ".concat((0,jc.typeOf)(r));return(0,jc.FAILURE)(MB.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(r){var t="Expected nothing, but was ".concat((0,jc.typeOf)(r));return(0,jc.FAILURE)(MB.Failcode.NOTHING_EXPECTED,t)}})});var Ivn=C(TL=>{"use strict";var qTs=TL&&TL.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},UTs=TL&&TL.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(TL,"__esModule",{value:!0});TL.Contract=void 0;var jTs=$0e(),GTs=Wd();function WTs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),l=GTs.FAILURE.ARGUMENT_INCORRECT(c);throw new jTs.ValidationError(l)}for(var d=0;d<i.length;d++)i[d].check(a[d]);return o.check(s.apply(void 0,UTs([],qTs(a),!1)))}}}}TL.Contract=WTs});var Svn=C(ML=>{"use strict";var HTs=ML&&ML.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},VTs=ML&&ML.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(ML,"__esModule",{value:!0});ML.AsyncContract=void 0;var vvn=$0e(),xvn=Wd();function YTs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=r.length-1,i=r.slice(0,n),o=r[n];return{enforce:function(s){return function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];if(a.length<i.length){var c="Expected ".concat(i.length," arguments but only received ").concat(a.length),l=xvn.FAILURE.ARGUMENT_INCORRECT(c);throw new vvn.ValidationError(l)}for(var d=0;d<i.length;d++)i[d].check(a[d]);var p=s.apply(void 0,VTs([],HTs(a),!1));if(!(p instanceof Promise)){var c="Expected function to return a promise, but instead got ".concat(p),l=xvn.FAILURE.RETURN_INCORRECT(c);throw new vvn.ValidationError(l)}return p.then(o.check)}}}}ML.AsyncContract=YTs});var Ovn=C(DB=>{"use strict";var KTs=DB&&DB.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},JTs=DB&&DB.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s};Object.defineProperty(DB,"__esModule",{value:!0});DB.when=DB.match=void 0;function XTs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(n){var i,o;try{for(var s=KTs(r),a=s.next();!a.done;a=s.next()){var u=JTs(a.value,2),c=u[0],l=u[1];if(c.guard(n))return l(n)}}catch(d){i={error:d}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}throw new Error("No alternatives were matched")}}DB.match=XTs;function $Ts(r,t){return[r,t]}DB.when=$Ts});var a1=C(NL=>{"use strict";Object.defineProperty(NL,"__esModule",{value:!0});NL.innerValidate=NL.create=NL.isRuntype=void 0;var DL=NA(),ZTs=AMe(),eMs=$0e(),_vn=Wd(),wvn=Symbol(),tMs=function(r){return(0,_vn.hasKey)(wvn,r)};NL.isRuntype=tMs;function rMs(r,t){return t[wvn]=!0,t.check=n,t.assert=n,t._innerValidate=function(p,A){return A.has(p,t)?(0,_vn.SUCCESS)(p):r(p,A)},t.validate=function(p){return t._innerValidate(p,iMs())},t.guard=i,t.Or=o,t.And=s,t.optional=a,t.nullable=u,t.withConstraint=c,t.withGuard=l,t.withBrand=d,t.reflect=t,t.toString=function(){return"Runtype<".concat((0,ZTs.default)(t),">")},t;function n(p){var A=t.validate(p);if(A.success)return A.value;throw new eMs.ValidationError(A)}function i(p){return t.validate(p).success}function o(p){return(0,DL.Union)(t,p)}function s(p){return(0,DL.Intersect)(t,p)}function a(){return(0,DL.Optional)(t)}function u(){return(0,DL.Union)(t,DL.Null)}function c(p,A){return(0,DL.Constraint)(t,p,A)}function l(p,A){return(0,DL.Constraint)(t,p,A)}function d(p){return(0,DL.Brand)(p,t)}}NL.create=rMs;function nMs(r,t,n){return r._innerValidate(t,n)}NL.innerValidate=nMs;function iMs(){var r=new WeakMap,t=function(i,o){if(!(i===null||typeof i!="object")){var s=r.get(i);r.set(i,s?s.set(o,!0):new WeakMap().set(o,!0))}},n=function(i,o){var s=r.get(i),a=s&&s.get(o)||!1;return t(i,o),a};return{has:n}}});var Rnt=C(Bnt=>{"use strict";Object.defineProperty(Bnt,"__esModule",{value:!0});Bnt.Unknown=void 0;var oMs=a1(),sMs=Wd(),aMs={tag:"unknown"};Bnt.Unknown=(0,oMs.create)(function(r){return(0,sMs.SUCCESS)(r)},aMs)});var Bvn=C(Tnt=>{"use strict";Object.defineProperty(Tnt,"__esModule",{value:!0});Tnt.Never=void 0;var uMs=a1(),lMs=Wd(),cMs={tag:"never"};Tnt.Never=(0,uMs.create)(lMs.FAILURE.NOTHING_EXPECTED,cMs)});var Rvn=C(Mnt=>{"use strict";Object.defineProperty(Mnt,"__esModule",{value:!0});Mnt.Void=void 0;var dMs=Rnt();Mnt.Void=dMs.Unknown});var r$t=C(Z0e=>{"use strict";var Dnt=Z0e&&Z0e.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Z0e,"__esModule",{value:!0});Z0e.Union=void 0;var Nnt=a1(),fMe=Wd();function pMs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return function(a){for(var u=0;u<r.length;u++)if(r[u].guard(a))return o[u](a)}},i={tag:"union",alternatives:r,match:n};return(0,Nnt.create)(function(o,s){var a,u,c,l,d,p,A,f;if(typeof o!="object"||o===null){try{for(var h=Dnt(r),y=h.next();!y.done;y=h.next()){var I=y.value;if((0,Nnt.innerValidate)(I,o,s).success)return(0,fMe.SUCCESS)(o)}}catch(Y){a={error:Y}}finally{try{y&&!y.done&&(u=h.return)&&u.call(h)}finally{if(a)throw a.error}}return fMe.FAILURE.TYPE_INCORRECT(i,o)}var v={};try{for(var O=Dnt(r),_=O.next();!_.done;_=O.next()){var I=_.value;if(I.reflect.tag==="record"){var w=function(K){var k=I.reflect.fields[K];k.tag==="literal"&&(v[K]?v[K].every(function($){return $!==k.value})&&v[K].push(k.value):v[K]=[k.value])};for(var P in I.reflect.fields)w(P)}}}catch(Y){c={error:Y}}finally{try{_&&!_.done&&(l=O.return)&&l.call(O)}finally{if(c)throw c.error}}for(var P in v)if(v[P].length===r.length)try{for(var F=(d=void 0,Dnt(r)),W=F.next();!W.done;W=F.next()){var I=W.value;if(I.reflect.tag==="record"){var H=I.reflect.fields[P];if(H.tag==="literal"&&(0,fMe.hasKey)(P,o)&&o[P]===H.value)return(0,Nnt.innerValidate)(I,o,s)}}}catch(K){d={error:K}}finally{try{W&&!W.done&&(p=F.return)&&p.call(F)}finally{if(d)throw d.error}}try{for(var ee=Dnt(r),X=ee.next();!X.done;X=ee.next()){var U=X.value;if((0,Nnt.innerValidate)(U,o,s).success)return(0,fMe.SUCCESS)(o)}}catch(Y){A={error:Y}}finally{try{X&&!X.done&&(f=ee.return)&&f.call(ee)}finally{if(A)throw A.error}}return fMe.FAILURE.TYPE_INCORRECT(i,o)},i)}Z0e.Union=pMs});var o$t=C(XE=>{"use strict";Object.defineProperty(XE,"__esModule",{value:!0});XE.Nullish=XE.Null=XE.Undefined=XE.Literal=XE.literal=void 0;var AMs=a1(),Tvn=Wd(),fMs=r$t();function n$t(r){return Array.isArray(r)?String(r.map(String)):typeof r=="bigint"?String(r)+"n":String(r)}XE.literal=n$t;function i$t(r){var t={tag:"literal",value:r};return(0,AMs.create)(function(n){return n===r?(0,Tvn.SUCCESS)(n):Tvn.FAILURE.VALUE_INCORRECT("literal","`".concat(n$t(r),"`"),"`".concat(n$t(n),"`"))},t)}XE.Literal=i$t;XE.Undefined=i$t(void 0);XE.Null=i$t(null);XE.Nullish=(0,fMs.Union)(XE.Null,XE.Undefined)});var Pvn=C(NB=>{"use strict";var QL=NB&&NB.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},s$t=NB&&NB.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))},Mvn=NB&&NB.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(NB,"__esModule",{value:!0});NB.Template=void 0;var Qnt=a1(),Dvn=AMe(),A7=Wd(),Qvn=o$t(),a$t=function(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},hMs=function(r){if(0<r.length&&Array.isArray(r[0])){var t=QL(r),n=t[0],i=t.slice(1);return[Array.from(n),i]}else{var o=r,n=o.reduce(function(u,c){return(0,Qnt.isRuntype)(c)?u.push(""):u.push(u.pop()+String(c)),u},[""]),i=o.filter(Qnt.isRuntype);return[n,i]}},gMs=function(r,t){for(var n=0;n<t.length;)switch(t[n].reflect.tag){case"literal":{var i=t[n];t.splice(n,1);var o=String(i.value);r.splice(n,2,r[n]+o+r[n+1]);break}case"template":{var s=t[n];t.splice.apply(t,s$t([n,1],QL(s.runtypes),!1));var a=s.strings;if(a.length===1)r.splice(n,2,r[n]+a[0]+r[n+1]);else{var u=a[0],c=a.slice(1,-1),l=a[a.length-1];r.splice.apply(r,s$t(s$t([n,2,r[n]+u],QL(c),!1),[l+r[n+1]],!1))}break}case"union":{var d=t[n];if(d.alternatives.length===1)try{var p=mMe(d);t.splice(n,1);var o=String(p.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}case"intersect":{var A=t[n];if(A.intersectees.length===1)try{var f=mMe(A);t.splice(n,1);var o=String(f.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}default:n++;break}},mMs=function(r){var t=QL(hMs(r),2),n=t[0],i=t[1];return gMs(n,i),[n,i]},mMe=function(r){switch(r.reflect.tag){case"literal":return r;case"brand":return mMe(r.reflect.entity);case"union":if(r.reflect.alternatives.length===1)return mMe(r.reflect.alternatives[0]);break;case"intersect":if(r.reflect.intersectees.length===1)return mMe(r.reflect.intersectees[0]);break;default:break}throw void 0},Nvn=function(r){return r},u$t={string:[function(r){return globalThis.String(r)},".*"],number:[function(r){return globalThis.Number(r)},"[+-]?(?:\\d*\\.\\d+|\\d+\\.\\d*|\\d+)(?:[Ee][+-]?\\d+)?","0[Bb][01]+","0[Oo][0-7]+","0[Xx][0-9A-Fa-f]+"],bigint:[function(r){return globalThis.BigInt(r)},"-?[1-9]d*"],boolean:[function(r){return r!=="false"},"true","false"],null:[function(){return null},"null"],undefined:[function(){},"undefined"]},hMe=function(r){switch(r.tag){case"literal":{var t=QL(u$t[(0,A7.typeOf)(r.value)]||[Nvn],1),n=t[0];return n}case"brand":return hMe(r.entity);case"constraint":return hMe(r.underlying);case"union":return r.alternatives.map(hMe);case"intersect":return r.intersectees.map(hMe);default:var i=QL(u$t[r.tag]||[Nvn],1),o=i[0];return o}},l$t=function(r,t){return function(n){var i,o,s,a,u=hMe(r);if(Array.isArray(u))switch(r.tag){case"union":try{for(var c=Mvn(r.alternatives),l=c.next();!l.done;l=c.next()){var d=l.value,p=l$t(d.reflect,t)(n);if(p.success)return p}}catch(I){i={error:I}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return A7.FAILURE.TYPE_INCORRECT(r,n);case"intersect":try{for(var A=Mvn(r.intersectees),f=A.next();!f.done;f=A.next()){var h=f.value,p=l$t(h.reflect,t)(n);if(!p.success)return p}}catch(I){s={error:I}}finally{try{f&&!f.done&&(a=A.return)&&a.call(A)}finally{if(s)throw s.error}}return(0,A7.SUCCESS)(n);default:throw Error("impossible")}else{var y=u,p=(0,Qnt.innerValidate)(r,y(n),t);return!p.success&&p.code==="VALUE_INCORRECT"&&r.tag==="literal"?A7.FAILURE.VALUE_INCORRECT("literal",'"'.concat((0,Qvn.literal)(r.value),'"'),'"'.concat(n,'"')):p}}},gMe=function(r){switch(r.tag){case"literal":return a$t(String(r.value));case"brand":return gMe(r.entity);case"constraint":return gMe(r.underlying);case"union":return r.alternatives.map(gMe).join("|");case"template":return r.strings.map(a$t).reduce(function(i,o,s){var a=i+o,u=r.runtypes[s];return u?a+"(?:".concat(gMe(u.reflect),")"):a},"");default:var t=QL(u$t[r.tag]||[void 0,".*"]),n=t.slice(1);return n.join("|")}},yMs=function(r){var t=r.strings.map(a$t).reduce(function(n,i,o){var s=n+i,a=r.runtypes[o];return a?s+"(".concat(gMe(a.reflect),")"):s},"");return new RegExp("^".concat(t,"$"),"su")};function EMs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=QL(mMs(r),2),i=n[0],o=n[1],s={tag:"template",strings:i,runtypes:o},a=yMs(s),u=function(c,l){var d=c.match(a);if(d){for(var p=d.slice(1),A=0;A<o.length;A++){var f=o[A],h=p[A],y=l$t(f.reflect,l)(h);if(!y.success)return y}return(0,A7.SUCCESS)(c)}else return A7.FAILURE.VALUE_INCORRECT("string","".concat((0,Dvn.default)(s)),'"'.concat((0,Qvn.literal)(c),'"'))};return(0,Qnt.create)(function(c,l){if(typeof c!="string")return A7.FAILURE.TYPE_INCORRECT(s,c);var d=u(c,l);if(d.success)return(0,A7.SUCCESS)(c);var p=A7.FAILURE.VALUE_INCORRECT("string","".concat((0,Dvn.default)(s)),'"'.concat(c,'"'));return p.message!==d.message&&(p.message+=" (inner: ".concat(d.message,")")),p},s)}NB.Template=EMs});var Fvn=C(Pnt=>{"use strict";Object.defineProperty(Pnt,"__esModule",{value:!0});Pnt.Boolean=void 0;var bMs=a1(),kvn=Wd(),zvn={tag:"boolean"};Pnt.Boolean=(0,bMs.create)(function(r){return typeof r=="boolean"?(0,kvn.SUCCESS)(r):kvn.FAILURE.TYPE_INCORRECT(zvn,r)},zvn)});var Uvn=C(knt=>{"use strict";Object.defineProperty(knt,"__esModule",{value:!0});knt.Number=void 0;var CMs=a1(),Lvn=Wd(),qvn={tag:"number"};knt.Number=(0,CMs.create)(function(r){return typeof r=="number"?(0,Lvn.SUCCESS)(r):Lvn.FAILURE.TYPE_INCORRECT(qvn,r)},qvn)});var Wvn=C(znt=>{"use strict";Object.defineProperty(znt,"__esModule",{value:!0});znt.BigInt=void 0;var IMs=a1(),jvn=Wd(),Gvn={tag:"bigint"};znt.BigInt=(0,IMs.create)(function(r){return typeof r=="bigint"?(0,jvn.SUCCESS)(r):jvn.FAILURE.TYPE_INCORRECT(Gvn,r)},Gvn)});var c$t=C(Fnt=>{"use strict";Object.defineProperty(Fnt,"__esModule",{value:!0});Fnt.String=void 0;var vMs=a1(),Hvn=Wd(),Vvn={tag:"string"};Fnt.String=(0,vMs.create)(function(r){return typeof r=="string"?(0,Hvn.SUCCESS)(r):Hvn.FAILURE.TYPE_INCORRECT(Vvn,r)},Vvn)});var Xvn=C(Lnt=>{"use strict";Object.defineProperty(Lnt,"__esModule",{value:!0});Lnt.Symbol=void 0;var Jvn=a1(),yMe=Wd(),xMs=function(r){var t={tag:"symbol",key:r};return(0,Jvn.create)(function(n){if(typeof n!="symbol")return yMe.FAILURE.TYPE_INCORRECT(t,n);var i=globalThis.Symbol.keyFor(n);return i!==r?yMe.FAILURE.VALUE_INCORRECT("symbol key",Kvn(r),Kvn(i)):(0,yMe.SUCCESS)(n)},t)},Yvn={tag:"symbol"};Lnt.Symbol=(0,Jvn.create)(function(r){return typeof r=="symbol"?(0,yMe.SUCCESS)(r):yMe.FAILURE.TYPE_INCORRECT(Yvn,r)},Object.assign(xMs,Yvn));var Kvn=function(r){return r===void 0?"undefined":'"'.concat(r,'"')}});var e4n=C(qnt=>{"use strict";Object.defineProperty(qnt,"__esModule",{value:!0});qnt.Array=void 0;var $vn=a1(),EMe=Wd();function Zvn(r,t){var n={tag:"array",isReadonly:t,element:r};return OMs((0,$vn.create)(function(i,o){if(!Array.isArray(i))return EMe.FAILURE.TYPE_INCORRECT(n,i);var s=(0,EMe.enumerableKeysOf)(i),a=s.map(function(c){return(0,$vn.innerValidate)(r,i[c],o)}),u=s.reduce(function(c,l){var d=a[l];return d.success||(c[l]=d.details||d.message),c},[]);return(0,EMe.enumerableKeysOf)(u).length!==0?EMe.FAILURE.CONTENT_INCORRECT(n,u):(0,EMe.SUCCESS)(i)},n))}function SMs(r){return Zvn(r,!1)}qnt.Array=SMs;function OMs(r){return r.asReadonly=t,r;function t(){return Zvn(r.element,!0)}}});var r4n=C(Unt=>{"use strict";Object.defineProperty(Unt,"__esModule",{value:!0});Unt.Tuple=void 0;var t4n=a1(),ede=Wd();function _Ms(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"tuple",components:r};return(0,t4n.create)(function(i,o){if(!Array.isArray(i))return ede.FAILURE.TYPE_INCORRECT(n,i);if(i.length!==r.length)return ede.FAILURE.CONSTRAINT_FAILED(n,"Expected length ".concat(r.length,", but was ").concat(i.length));var s=(0,ede.enumerableKeysOf)(i),a=s.map(function(c){return(0,t4n.innerValidate)(r[c],i[c],o)}),u=s.reduce(function(c,l){var d=a[l];return d.success||(c[l]=d.details||d.message),c},[]);return(0,ede.enumerableKeysOf)(u).length!==0?ede.FAILURE.CONTENT_INCORRECT(n,u):(0,ede.SUCCESS)(i)},n)}Unt.Tuple=_Ms});var i4n=C(ox=>{"use strict";var d$t=ox&&ox.__read||function(r,t){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var i=n.call(r),o,s=[],a;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return s},p$t=ox&&ox.__spreadArray||function(r,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,s;i<o;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return r.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(ox,"__esModule",{value:!0});ox.Partial=ox.Record=ox.InternalRecord=void 0;var n4n=a1(),$E=Wd();function PL(r,t,n){var i={tag:"record",isPartial:t,isReadonly:n,fields:r};return RMs((0,n4n.create)(function(o,s){if(o==null)return $E.FAILURE.TYPE_INCORRECT(i,o);var a=(0,$E.enumerableKeysOf)(r);if(a.length!==0&&typeof o!="object")return $E.FAILURE.TYPE_INCORRECT(i,o);var u=p$t([],d$t(new Set(p$t(p$t([],d$t(a),!1),d$t((0,$E.enumerableKeysOf)(o)),!1))),!1),c=u.reduce(function(d,p){var A=(0,$E.hasKey)(p,r),f=(0,$E.hasKey)(p,o);if(A){var h=r[p],y=t||h.reflect.tag==="optional";if(f){var I=o[p];y&&I===void 0?d[p]=(0,$E.SUCCESS)(I):d[p]=(0,n4n.innerValidate)(h,I,s)}else y?d[p]=(0,$E.SUCCESS)(void 0):d[p]=$E.FAILURE.PROPERTY_MISSING(h.reflect)}else if(f){var I=o[p];d[p]=(0,$E.SUCCESS)(I)}else throw new Error("impossible");return d},{}),l=u.reduce(function(d,p){var A=c[p];return A.success||(d[p]=A.details||A.message),d},{});return(0,$E.enumerableKeysOf)(l).length!==0?$E.FAILURE.CONTENT_INCORRECT(i,l):(0,$E.SUCCESS)(o)},i))}ox.InternalRecord=PL;function wMs(r){return PL(r,!1,!1)}ox.Record=wMs;function BMs(r){return PL(r,!0,!1)}ox.Partial=BMs;function RMs(r){return r.asPartial=t,r.asReadonly=n,r.pick=i,r.omit=o,r.extend=s,r;function t(){return PL(r.fields,!0,r.isReadonly)}function n(){return PL(r.fields,r.isPartial,!0)}function i(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];var c={};return a.forEach(function(l){c[l]=r.fields[l]}),PL(c,r.isPartial,r.isReadonly)}function o(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];var c={},l=(0,$E.enumerableKeysOf)(r.fields);return l.forEach(function(d){a.includes(d)||(c[d]=r.fields[d])}),PL(c,r.isPartial,r.isReadonly)}function s(a){return PL(Object.assign({},r.fields,a),r.isPartial,r.isReadonly)}}});var f$t=C(tde=>{"use strict";Object.defineProperty(tde,"__esModule",{value:!0});tde.Guard=tde.Constraint=void 0;var TMs=a1(),A$t=Wd(),MMs=Rnt();function DMs(r,t,n){var i=n&&n.name,o=n&&n.args,s={tag:"constraint",underlying:r,constraint:t,name:i,args:o};return(0,TMs.create)(function(a){var u=r.validate(a);if(!u.success)return u;var c=t(u.value);return typeof c=="string"?A$t.FAILURE.CONSTRAINT_FAILED(s,c):c?(0,A$t.SUCCESS)(u.value):A$t.FAILURE.CONSTRAINT_FAILED(s)},s)}tde.Constraint=DMs;var NMs=function(r,t){return MMs.Unknown.withGuard(r,t)};tde.Guard=NMs});var s4n=C(jnt=>{"use strict";Object.defineProperty(jnt,"__esModule",{value:!0});jnt.Dictionary=void 0;var o4n=a1(),h$t=c$t(),QMs=f$t(),PMs=AMe(),Vee=Wd(),kMs=(0,QMs.Constraint)(h$t.String,function(r){return!isNaN(+r)},{name:"number"});function zMs(r,t){var n=t===void 0||t==="string"?h$t.String:t==="number"?kMs:t,i=(0,PMs.default)(n),o={tag:"dictionary",key:i,value:r};return(0,o4n.create)(function(s,a){if(s==null||typeof s!="object"||Object.getPrototypeOf(s)!==Object.prototype&&(!Array.isArray(s)||i==="string"))return Vee.FAILURE.TYPE_INCORRECT(o,s);var u=/^(?:NaN|-?\d+(?:\.\d+)?)$/,c=(0,Vee.enumerableKeysOf)(s),l=c.reduce(function(p,A){var f=typeof A=="string"&&u.test(A),h=f?globalThis.Number(A):A;return(f?!n.guard(h)&&!n.guard(A):!n.guard(h))?p[A]=Vee.FAILURE.KEY_INCORRECT(o,n.reflect,h):p[A]=(0,o4n.innerValidate)(r,s[A],a),p},{}),d=c.reduce(function(p,A){var f=l[A];return f.success||(p[A]=f.details||f.message),p},{});return(0,Vee.enumerableKeysOf)(d).length!==0?Vee.FAILURE.CONTENT_INCORRECT(o,d):(0,Vee.SUCCESS)(s)},o)}jnt.Dictionary=zMs});var u4n=C(rde=>{"use strict";var FMs=rde&&rde.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&r[t],i=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(rde,"__esModule",{value:!0});rde.Intersect=void 0;var a4n=a1(),LMs=Wd();function qMs(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"intersect",intersectees:r};return(0,a4n.create)(function(i,o){var s,a;try{for(var u=FMs(r),c=u.next();!c.done;c=u.next()){var l=c.value,d=(0,a4n.innerValidate)(l,i,o);if(!d.success)return d}}catch(p){s={error:p}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(s)throw s.error}}return(0,LMs.SUCCESS)(i)},n)}rde.Intersect=qMs});var l4n=C(Gnt=>{"use strict";Object.defineProperty(Gnt,"__esModule",{value:!0});Gnt.Optional=void 0;var UMs=a1(),jMs=Wd();function GMs(r){var t={tag:"optional",underlying:r};return(0,UMs.create)(function(n){return n===void 0?(0,jMs.SUCCESS)(n):r.validate(n)},t)}Gnt.Optional=GMs});var p4n=C(Wnt=>{"use strict";Object.defineProperty(Wnt,"__esModule",{value:!0});Wnt.Function=void 0;var WMs=a1(),c4n=Wd(),d4n={tag:"function"};Wnt.Function=(0,WMs.create)(function(r){return typeof r=="function"?(0,c4n.SUCCESS)(r):c4n.FAILURE.TYPE_INCORRECT(d4n,r)},d4n)});var f4n=C(Hnt=>{"use strict";Object.defineProperty(Hnt,"__esModule",{value:!0});Hnt.InstanceOf=void 0;var HMs=a1(),A4n=Wd();function VMs(r){var t={tag:"instanceof",ctor:r};return(0,HMs.create)(function(n){return n instanceof r?(0,A4n.SUCCESS)(n):A4n.FAILURE.TYPE_INCORRECT(t,n)},t)}Hnt.InstanceOf=VMs});var h4n=C(Vnt=>{"use strict";Object.defineProperty(Vnt,"__esModule",{value:!0});Vnt.Lazy=void 0;var YMs=a1();function KMs(r){var t={get tag(){return i().tag}},n;function i(){if(!n){n=r();for(var o in n)o!=="tag"&&(t[o]=n[o])}return n}return(0,YMs.create)(function(o){return i().validate(o)},t)}Vnt.Lazy=KMs});var g4n=C(Ynt=>{"use strict";Object.defineProperty(Ynt,"__esModule",{value:!0});Ynt.Brand=void 0;var JMs=a1();function XMs(r,t){var n={tag:"brand",brand:r,entity:t};return(0,JMs.create)(function(i){return t.validate(i)},n)}Ynt.Brand=XMs});var m4n=C(nde=>{"use strict";Object.defineProperty(nde,"__esModule",{value:!0});nde.checked=nde.check=void 0;var $Ms=$0e(),ZMs=Wd(),g$t=new WeakMap;function e8s(r,t,n){var i=g$t.get(r)||new Map;g$t.set(r,i);var o=i.get(t)||[];i.set(t,o),o.push(n)}nde.check=e8s;function t8s(r,t,n){var i=g$t.get(r),o=i&&i.get(t);if(o)return o;for(var s=[],a=0;a<n;a++)s.push(a);return s}function r8s(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(r.length===0)throw new Error("No runtype provided to `@checked`. Please remove the decorator.");return function(n,i,o){var s=o.value,a=(n.name||n.constructor.name+".prototype")+(typeof i=="string"?'["'.concat(i,'"]'):"[".concat(String(i),"]")),u=t8s(n,i,r.length);if(u.length!==r.length)throw new Error("Number of `@checked` runtypes and @check parameters not matched.");if(u.length>s.length)throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");o.value=function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];return r.forEach(function(d,p){var A=u[p],f=d.validate(c[A]);if(!f.success){var h="".concat(a,", argument #").concat(A,": ").concat(f.message),y=ZMs.FAILURE.ARGUMENT_INCORRECT(h);throw new $Ms.ValidationError(y)}}),s.apply(this,c)}}}nde.checked=r8s});var NA=C(na=>{"use strict";var n8s=na&&na.__createBinding||(Object.create?function(r,t,n,i){i===void 0&&(i=n),Object.defineProperty(r,i,{enumerable:!0,get:function(){return t[n]}})}:function(r,t,n,i){i===void 0&&(i=n),r[i]=t[n]}),i0=na&&na.__exportStar||function(r,t){for(var n in r)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&n8s(t,r,n)};Object.defineProperty(na,"__esModule",{value:!0});na.InstanceOf=na.Nullish=na.Null=na.Undefined=na.Literal=void 0;i0(bvn(),na);i0(ZXt(),na);i0(Ivn(),na);i0(Svn(),na);i0(Ovn(),na);i0($0e(),na);i0(Rnt(),na);i0(Bvn(),na);i0(Rvn(),na);var Knt=o$t();Object.defineProperty(na,"Literal",{enumerable:!0,get:function(){return Knt.Literal}});Object.defineProperty(na,"Undefined",{enumerable:!0,get:function(){return Knt.Undefined}});Object.defineProperty(na,"Null",{enumerable:!0,get:function(){return Knt.Null}});Object.defineProperty(na,"Nullish",{enumerable:!0,get:function(){return Knt.Nullish}});i0(Pvn(),na);i0(Fvn(),na);i0(Uvn(),na);i0(Wvn(),na);i0(c$t(),na);i0(Xvn(),na);i0(e4n(),na);i0(r4n(),na);i0(i4n(),na);i0(s4n(),na);i0(r$t(),na);i0(u4n(),na);i0(l4n(),na);i0(p4n(),na);var i8s=f4n();Object.defineProperty(na,"InstanceOf",{enumerable:!0,get:function(){return i8s.InstanceOf}});i0(h4n(),na);i0(f$t(),na);i0(g4n(),na);i0(m4n(),na)});var bMe=C((Ji0,y4n)=>{var o8s="2.0.0",s8s=Number.MAX_SAFE_INTEGER||9007199254740991,a8s=16,u8s=256-6,l8s=["major","premajor","minor","preminor","patch","prepatch","prerelease"];y4n.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:a8s,MAX_SAFE_BUILD_LENGTH:u8s,MAX_SAFE_INTEGER:s8s,RELEASE_TYPES:l8s,SEMVER_SPEC_VERSION:o8s,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var CMe=C((Xi0,E4n)=>{var c8s=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};E4n.exports=c8s});var ide=C((f7,b4n)=>{var{MAX_SAFE_COMPONENT_LENGTH:m$t,MAX_SAFE_BUILD_LENGTH:d8s,MAX_LENGTH:p8s}=bMe(),A8s=CMe();f7=b4n.exports={};var f8s=f7.re=[],h8s=f7.safeRe=[],lo=f7.src=[],co=f7.t={},g8s=0,y$t="[a-zA-Z0-9-]",m8s=[["\\s",1],["\\d",p8s],[y$t,d8s]],y8s=r=>{for(let[t,n]of m8s)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},Na=(r,t,n)=>{let i=y8s(t),o=g8s++;A8s(r,o,t),co[r]=o,lo[o]=t,f8s[o]=new RegExp(t,n?"g":void 0),h8s[o]=new RegExp(i,n?"g":void 0)};Na("NUMERICIDENTIFIER","0|[1-9]\\d*");Na("NUMERICIDENTIFIERLOOSE","\\d+");Na("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y$t}*`);Na("MAINVERSION",`(${lo[co.NUMERICIDENTIFIER]})\\.(${lo[co.NUMERICIDENTIFIER]})\\.(${lo[co.NUMERICIDENTIFIER]})`);Na("MAINVERSIONLOOSE",`(${lo[co.NUMERICIDENTIFIERLOOSE]})\\.(${lo[co.NUMERICIDENTIFIERLOOSE]})\\.(${lo[co.NUMERICIDENTIFIERLOOSE]})`);Na("PRERELEASEIDENTIFIER",`(?:${lo[co.NUMERICIDENTIFIER]}|${lo[co.NONNUMERICIDENTIFIER]})`);Na("PRERELEASEIDENTIFIERLOOSE",`(?:${lo[co.NUMERICIDENTIFIERLOOSE]}|${lo[co.NONNUMERICIDENTIFIER]})`);Na("PRERELEASE",`(?:-(${lo[co.PRERELEASEIDENTIFIER]}(?:\\.${lo[co.PRERELEASEIDENTIFIER]})*))`);Na("PRERELEASELOOSE",`(?:-?(${lo[co.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${lo[co.PRERELEASEIDENTIFIERLOOSE]})*))`);Na("BUILDIDENTIFIER",`${y$t}+`);Na("BUILD",`(?:\\+(${lo[co.BUILDIDENTIFIER]}(?:\\.${lo[co.BUILDIDENTIFIER]})*))`);Na("FULLPLAIN",`v?${lo[co.MAINVERSION]}${lo[co.PRERELEASE]}?${lo[co.BUILD]}?`);Na("FULL",`^${lo[co.FULLPLAIN]}$`);Na("LOOSEPLAIN",`[v=\\s]*${lo[co.MAINVERSIONLOOSE]}${lo[co.PRERELEASELOOSE]}?${lo[co.BUILD]}?`);Na("LOOSE",`^${lo[co.LOOSEPLAIN]}$`);Na("GTLT","((?:<|>)?=?)");Na("XRANGEIDENTIFIERLOOSE",`${lo[co.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Na("XRANGEIDENTIFIER",`${lo[co.NUMERICIDENTIFIER]}|x|X|\\*`);Na("XRANGEPLAIN",`[v=\\s]*(${lo[co.XRANGEIDENTIFIER]})(?:\\.(${lo[co.XRANGEIDENTIFIER]})(?:\\.(${lo[co.XRANGEIDENTIFIER]})(?:${lo[co.PRERELEASE]})?${lo[co.BUILD]}?)?)?`);Na("XRANGEPLAINLOOSE",`[v=\\s]*(${lo[co.XRANGEIDENTIFIERLOOSE]})(?:\\.(${lo[co.XRANGEIDENTIFIERLOOSE]})(?:\\.(${lo[co.XRANGEIDENTIFIERLOOSE]})(?:${lo[co.PRERELEASELOOSE]})?${lo[co.BUILD]}?)?)?`);Na("XRANGE",`^${lo[co.GTLT]}\\s*${lo[co.XRANGEPLAIN]}$`);Na("XRANGELOOSE",`^${lo[co.GTLT]}\\s*${lo[co.XRANGEPLAINLOOSE]}$`);Na("COERCE",`(^|[^\\d])(\\d{1,${m$t}})(?:\\.(\\d{1,${m$t}}))?(?:\\.(\\d{1,${m$t}}))?(?:$|[^\\d])`);Na("COERCERTL",lo[co.COERCE],!0);Na("LONETILDE","(?:~>?)");Na("TILDETRIM",`(\\s*)${lo[co.LONETILDE]}\\s+`,!0);f7.tildeTrimReplace="$1~";Na("TILDE",`^${lo[co.LONETILDE]}${lo[co.XRANGEPLAIN]}$`);Na("TILDELOOSE",`^${lo[co.LONETILDE]}${lo[co.XRANGEPLAINLOOSE]}$`);Na("LONECARET","(?:\\^)");Na("CARETTRIM",`(\\s*)${lo[co.LONECARET]}\\s+`,!0);f7.caretTrimReplace="$1^";Na("CARET",`^${lo[co.LONECARET]}${lo[co.XRANGEPLAIN]}$`);Na("CARETLOOSE",`^${lo[co.LONECARET]}${lo[co.XRANGEPLAINLOOSE]}$`);Na("COMPARATORLOOSE",`^${lo[co.GTLT]}\\s*(${lo[co.LOOSEPLAIN]})$|^$`);Na("COMPARATOR",`^${lo[co.GTLT]}\\s*(${lo[co.FULLPLAIN]})$|^$`);Na("COMPARATORTRIM",`(\\s*)${lo[co.GTLT]}\\s*(${lo[co.LOOSEPLAIN]}|${lo[co.XRANGEPLAIN]})`,!0);f7.comparatorTrimReplace="$1$2$3";Na("HYPHENRANGE",`^\\s*(${lo[co.XRANGEPLAIN]})\\s+-\\s+(${lo[co.XRANGEPLAIN]})\\s*$`);Na("HYPHENRANGELOOSE",`^\\s*(${lo[co.XRANGEPLAINLOOSE]})\\s+-\\s+(${lo[co.XRANGEPLAINLOOSE]})\\s*$`);Na("STAR","(<|>)?=?\\s*\\*");Na("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Na("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Jnt=C(($i0,C4n)=>{var E8s=Object.freeze({loose:!0}),b8s=Object.freeze({}),C8s=r=>r?typeof r!="object"?E8s:r:b8s;C4n.exports=C8s});var E$t=C((Zi0,x4n)=>{var I4n=/^[0-9]+$/,v4n=(r,t)=>{let n=I4n.test(r),i=I4n.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},I8s=(r,t)=>v4n(t,r);x4n.exports={compareIdentifiers:v4n,rcompareIdentifiers:I8s}});var y2=C((eo0,w4n)=>{var Xnt=CMe(),{MAX_LENGTH:S4n,MAX_SAFE_INTEGER:$nt}=bMe(),{safeRe:O4n,t:_4n}=ide(),v8s=Jnt(),{compareIdentifiers:ode}=E$t(),II=class{constructor(t,n){if(n=v8s(n),t instanceof II){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>S4n)throw new TypeError(`version is longer than ${S4n} characters`);Xnt("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?O4n[_4n.LOOSE]:O4n[_4n.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>$nt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>$nt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>$nt||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<$nt)return s}return o}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Xnt("SemVer.compare",this.version,this.options,t),!(t instanceof II)){if(typeof t=="string"&&t===this.version)return 0;t=new II(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof II||(t=new II(t,this.options)),ode(this.major,t.major)||ode(this.minor,t.minor)||ode(this.patch,t.patch)}comparePre(t){if(t instanceof II||(t=new II(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{let i=this.prerelease[n],o=t.prerelease[n];if(Xnt("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return ode(i,o)}while(++n)}compareBuild(t){t instanceof II||(t=new II(t,this.options));let n=0;do{let i=this.build[n],o=t.build[n];if(Xnt("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return ode(i,o)}while(++n)}inc(t,n,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,i),this.inc("pre",n,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,i),this.inc("pre",n,i);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(i)?1:0;if(!n&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];i===!1&&(s=[n]),ode(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};w4n.exports=II});var Yee=C((to0,R4n)=>{var B4n=y2(),x8s=(r,t,n=!1)=>{if(r instanceof B4n)return r;try{return new B4n(r,t)}catch(i){if(!n)return null;throw i}};R4n.exports=x8s});var M4n=C((ro0,T4n)=>{var S8s=Yee(),O8s=(r,t)=>{let n=S8s(r,t);return n?n.version:null};T4n.exports=O8s});var N4n=C((no0,D4n)=>{var _8s=Yee(),w8s=(r,t)=>{let n=_8s(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};D4n.exports=w8s});var k4n=C((io0,P4n)=>{var Q4n=y2(),B8s=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Q4n(r instanceof Q4n?r.version:r,n).inc(t,i,o).version}catch{return null}};P4n.exports=B8s});var L4n=C((oo0,F4n)=>{var z4n=Yee(),R8s=(r,t)=>{let n=z4n(r,null,!0),i=z4n(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,u=s?i:n,c=!!a.prerelease.length;if(!!u.prerelease.length&&!c)return!u.patch&&!u.minor?"major":a.patch?"patch":a.minor?"minor":"major";let d=c?"pre":"";return n.major!==i.major?d+"major":n.minor!==i.minor?d+"minor":n.patch!==i.patch?d+"patch":"prerelease"};F4n.exports=R8s});var U4n=C((so0,q4n)=>{var T8s=y2(),M8s=(r,t)=>new T8s(r,t).major;q4n.exports=M8s});var G4n=C((ao0,j4n)=>{var D8s=y2(),N8s=(r,t)=>new D8s(r,t).minor;j4n.exports=N8s});var H4n=C((uo0,W4n)=>{var Q8s=y2(),P8s=(r,t)=>new Q8s(r,t).patch;W4n.exports=P8s});var Y4n=C((lo0,V4n)=>{var k8s=Yee(),z8s=(r,t)=>{let n=k8s(r,t);return n&&n.prerelease.length?n.prerelease:null};V4n.exports=z8s});var sx=C((co0,J4n)=>{var K4n=y2(),F8s=(r,t,n)=>new K4n(r,n).compare(new K4n(t,n));J4n.exports=F8s});var $4n=C((do0,X4n)=>{var L8s=sx(),q8s=(r,t,n)=>L8s(t,r,n);X4n.exports=q8s});var exn=C((po0,Z4n)=>{var U8s=sx(),j8s=(r,t)=>U8s(r,t,!0);Z4n.exports=j8s});var Znt=C((Ao0,rxn)=>{var txn=y2(),G8s=(r,t,n)=>{let i=new txn(r,n),o=new txn(t,n);return i.compare(o)||i.compareBuild(o)};rxn.exports=G8s});var ixn=C((fo0,nxn)=>{var W8s=Znt(),H8s=(r,t)=>r.sort((n,i)=>W8s(n,i,t));nxn.exports=H8s});var sxn=C((ho0,oxn)=>{var V8s=Znt(),Y8s=(r,t)=>r.sort((n,i)=>V8s(i,n,t));oxn.exports=Y8s});var IMe=C((go0,axn)=>{var K8s=sx(),J8s=(r,t,n)=>K8s(r,t,n)>0;axn.exports=J8s});var eit=C((mo0,uxn)=>{var X8s=sx(),$8s=(r,t,n)=>X8s(r,t,n)<0;uxn.exports=$8s});var b$t=C((yo0,lxn)=>{var Z8s=sx(),eDs=(r,t,n)=>Z8s(r,t,n)===0;lxn.exports=eDs});var C$t=C((Eo0,cxn)=>{var tDs=sx(),rDs=(r,t,n)=>tDs(r,t,n)!==0;cxn.exports=rDs});var tit=C((bo0,dxn)=>{var nDs=sx(),iDs=(r,t,n)=>nDs(r,t,n)>=0;dxn.exports=iDs});var rit=C((Co0,pxn)=>{var oDs=sx(),sDs=(r,t,n)=>oDs(r,t,n)<=0;pxn.exports=sDs});var I$t=C((Io0,Axn)=>{var aDs=b$t(),uDs=C$t(),lDs=IMe(),cDs=tit(),dDs=eit(),pDs=rit(),ADs=(r,t,n,i)=>{switch(t){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return aDs(r,n,i);case"!=":return uDs(r,n,i);case">":return lDs(r,n,i);case">=":return cDs(r,n,i);case"<":return dDs(r,n,i);case"<=":return pDs(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};Axn.exports=ADs});var hxn=C((vo0,fxn)=>{var fDs=y2(),hDs=Yee(),{safeRe:nit,t:iit}=ide(),gDs=(r,t)=>{if(r instanceof fDs)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;t=t||{};let n=null;if(!t.rtl)n=r.match(nit[iit.COERCE]);else{let i;for(;(i=nit[iit.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),nit[iit.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;nit[iit.COERCERTL].lastIndex=-1}return n===null?null:hDs(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};fxn.exports=gDs});var mxn=C((xo0,gxn)=>{"use strict";gxn.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var v$t=C((So0,yxn)=>{"use strict";yxn.exports=Il;Il.Node=Kee;Il.create=Il;function Il(r){var t=this;if(t instanceof Il||(t=new Il),t.tail=null,t.head=null,t.length=0,r&&typeof r.forEach=="function")r.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}Il.prototype.removeNode=function(r){if(r.list!==this)throw new Error("removing node which does not belong to this list");var t=r.next,n=r.prev;return t&&(t.prev=n),n&&(n.next=t),r===this.head&&(this.head=t),r===this.tail&&(this.tail=n),r.list.length--,r.next=null,r.prev=null,r.list=null,t};Il.prototype.unshiftNode=function(r){if(r!==this.head){r.list&&r.list.removeNode(r);var t=this.head;r.list=this,r.next=t,t&&(t.prev=r),this.head=r,this.tail||(this.tail=r),this.length++}};Il.prototype.pushNode=function(r){if(r!==this.tail){r.list&&r.list.removeNode(r);var t=this.tail;r.list=this,r.prev=t,t&&(t.next=r),this.tail=r,this.head||(this.head=r),this.length++}};Il.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)yDs(this,arguments[r]);return this.length};Il.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)EDs(this,arguments[r]);return this.length};Il.prototype.pop=function(){if(this.tail){var r=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,r}};Il.prototype.shift=function(){if(this.head){var r=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,r}};Il.prototype.forEach=function(r,t){t=t||this;for(var n=this.head,i=0;n!==null;i++)r.call(t,n.value,i,this),n=n.next};Il.prototype.forEachReverse=function(r,t){t=t||this;for(var n=this.tail,i=this.length-1;n!==null;i--)r.call(t,n.value,i,this),n=n.prev};Il.prototype.get=function(r){for(var t=0,n=this.head;n!==null&&t<r;t++)n=n.next;if(t===r&&n!==null)return n.value};Il.prototype.getReverse=function(r){for(var t=0,n=this.tail;n!==null&&t<r;t++)n=n.prev;if(t===r&&n!==null)return n.value};Il.prototype.map=function(r,t){t=t||this;for(var n=new Il,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};Il.prototype.mapReverse=function(r,t){t=t||this;for(var n=new Il,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};Il.prototype.reduce=function(r,t){var n,i=this.head;if(arguments.length>1)n=t;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i!==null;o++)n=r(n,i.value,o),i=i.next;return n};Il.prototype.reduceReverse=function(r,t){var n,i=this.tail;if(arguments.length>1)n=t;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;i!==null;o--)n=r(n,i.value,o),i=i.prev;return n};Il.prototype.toArray=function(){for(var r=new Array(this.length),t=0,n=this.head;n!==null;t++)r[t]=n.value,n=n.next;return r};Il.prototype.toArrayReverse=function(){for(var r=new Array(this.length),t=0,n=this.tail;n!==null;t++)r[t]=n.value,n=n.prev;return r};Il.prototype.slice=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new Il;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(;o!==null&&i<t;i++,o=o.next)n.push(o.value);return n};Il.prototype.sliceReverse=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new Il;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;o!==null&&i>t;i--)o=o.prev;for(;o!==null&&i>r;i--,o=o.prev)n.push(o.value);return n};Il.prototype.splice=function(r,t,...n){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(var s=[],i=0;o&&i<t;i++)s.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var i=0;i<n.length;i++)o=mDs(this,o,n[i]);return s};Il.prototype.reverse=function(){for(var r=this.head,t=this.tail,n=r;n!==null;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=r,this};function mDs(r,t,n){var i=t===r.head?new Kee(n,null,t,r):new Kee(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function yDs(r,t){r.tail=new Kee(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function EDs(r,t){r.head=new Kee(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function Kee(r,t,n,i){if(!(this instanceof Kee))return new Kee(r,t,n,i);this.list=i,this.value=r,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{mxn()(Il)}catch{}});var w$t=C((Oo0,Ixn)=>{"use strict";var bDs=v$t(),Jee=Symbol("max"),g7=Symbol("length"),sde=Symbol("lengthCalculator"),xMe=Symbol("allowStale"),Xee=Symbol("maxAge"),h7=Symbol("dispose"),Exn=Symbol("noDisposeOnSet"),bh=Symbol("lruList"),NO=Symbol("cache"),Cxn=Symbol("updateAgeOnGet"),x$t=()=>1,O$t=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");let n=this[Jee]=t.max||1/0,i=t.length||x$t;if(this[sde]=typeof i!="function"?x$t:i,this[xMe]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[Xee]=t.maxAge||0,this[h7]=t.dispose,this[Exn]=t.noDisposeOnSet||!1,this[Cxn]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[Jee]=t||1/0,vMe(this)}get max(){return this[Jee]}set allowStale(t){this[xMe]=!!t}get allowStale(){return this[xMe]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[Xee]=t,vMe(this)}get maxAge(){return this[Xee]}set lengthCalculator(t){typeof t!="function"&&(t=x$t),t!==this[sde]&&(this[sde]=t,this[g7]=0,this[bh].forEach(n=>{n.length=this[sde](n.value,n.key),this[g7]+=n.length})),vMe(this)}get lengthCalculator(){return this[sde]}get length(){return this[g7]}get itemCount(){return this[bh].length}rforEach(t,n){n=n||this;for(let i=this[bh].tail;i!==null;){let o=i.prev;bxn(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[bh].head;i!==null;){let o=i.next;bxn(this,t,i,n),i=o}}keys(){return this[bh].toArray().map(t=>t.key)}values(){return this[bh].toArray().map(t=>t.value)}reset(){this[h7]&&this[bh]&&this[bh].length&&this[bh].forEach(t=>this[h7](t.key,t.value)),this[NO]=new Map,this[bh]=new bDs,this[g7]=0}dump(){return this[bh].map(t=>oit(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[bh]}set(t,n,i){if(i=i||this[Xee],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[sde](n,t);if(this[NO].has(t)){if(s>this[Jee])return ade(this,this[NO].get(t)),!1;let c=this[NO].get(t).value;return this[h7]&&(this[Exn]||this[h7](t,c.value)),c.now=o,c.maxAge=i,c.value=n,this[g7]+=s-c.length,c.length=s,this.get(t),vMe(this),!0}let a=new _$t(t,n,s,o,i);return a.length>this[Jee]?(this[h7]&&this[h7](t,n),!1):(this[g7]+=a.length,this[bh].unshift(a),this[NO].set(t,this[bh].head),vMe(this),!0)}has(t){if(!this[NO].has(t))return!1;let n=this[NO].get(t).value;return!oit(this,n)}get(t){return S$t(this,t,!0)}peek(t){return S$t(this,t,!1)}pop(){let t=this[bh].tail;return t?(ade(this,t),t.value):null}del(t){ade(this,this[NO].get(t))}load(t){this.reset();let n=Date.now();for(let i=t.length-1;i>=0;i--){let o=t[i],s=o.e||0;if(s===0)this.set(o.k,o.v);else{let a=s-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[NO].forEach((t,n)=>S$t(this,n,!1))}},S$t=(r,t,n)=>{let i=r[NO].get(t);if(i){let o=i.value;if(oit(r,o)){if(ade(r,i),!r[xMe])return}else n&&(r[Cxn]&&(i.value.now=Date.now()),r[bh].unshiftNode(i));return o.value}},oit=(r,t)=>{if(!t||!t.maxAge&&!r[Xee])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[Xee]&&n>r[Xee]},vMe=r=>{if(r[g7]>r[Jee])for(let t=r[bh].tail;r[g7]>r[Jee]&&t!==null;){let n=t.prev;ade(r,t),t=n}},ade=(r,t)=>{if(t){let n=t.value;r[h7]&&r[h7](n.key,n.value),r[g7]-=n.length,r[NO].delete(n.key),r[bh].removeNode(t)}},_$t=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},bxn=(r,t,n,i)=>{let o=n.value;oit(r,o)&&(ade(r,n),r[xMe]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};Ixn.exports=O$t});var ax=C((_o0,Oxn)=>{var $ee=class{constructor(t,n){if(n=IDs(n),t instanceof $ee)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new $ee(t.raw,n);if(t instanceof B$t)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(o=>!xxn(o[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&BDs(o[0])){this.set=[o];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&_Ds)|(this.options.loose&&wDs))+":"+t,o=vxn.get(i);if(o)return o;let s=this.options.loose,a=s?ZE[a3.HYPHENRANGELOOSE]:ZE[a3.HYPHENRANGE];t=t.replace(a,FDs(this.options.includePrerelease)),fd("hyphen replace",t),t=t.replace(ZE[a3.COMPARATORTRIM],xDs),fd("comparator trim",t),t=t.replace(ZE[a3.TILDETRIM],SDs),fd("tilde trim",t),t=t.replace(ZE[a3.CARETTRIM],ODs),fd("caret trim",t);let u=t.split(" ").map(p=>RDs(p,this.options)).join(" ").split(/\s+/).map(p=>zDs(p,this.options));s&&(u=u.filter(p=>(fd("loose invalid filter",p,this.options),!!p.match(ZE[a3.COMPARATORLOOSE])))),fd("range list",u);let c=new Map,l=u.map(p=>new B$t(p,this.options));for(let p of l){if(xxn(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return vxn.set(i,d),d}intersects(t,n){if(!(t instanceof $ee))throw new TypeError("a Range is required");return this.set.some(i=>Sxn(i,n)&&t.set.some(o=>Sxn(o,n)&&i.every(s=>o.every(a=>s.intersects(a,n)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new vDs(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(LDs(this.set[n],t,this.options))return!0;return!1}};Oxn.exports=$ee;var CDs=w$t(),vxn=new CDs({max:1e3}),IDs=Jnt(),B$t=SMe(),fd=CMe(),vDs=y2(),{safeRe:ZE,t:a3,comparatorTrimReplace:xDs,tildeTrimReplace:SDs,caretTrimReplace:ODs}=ide(),{FLAG_INCLUDE_PRERELEASE:_Ds,FLAG_LOOSE:wDs}=bMe(),xxn=r=>r.value==="<0.0.0-0",BDs=r=>r.value==="",Sxn=(r,t)=>{let n=!0,i=r.slice(),o=i.pop();for(;n&&i.length;)n=i.every(s=>o.intersects(s,t)),o=i.pop();return n},RDs=(r,t)=>(fd("comp",r,t),r=DDs(r,t),fd("caret",r),r=TDs(r,t),fd("tildes",r),r=QDs(r,t),fd("xrange",r),r=kDs(r,t),fd("stars",r),r),u3=r=>!r||r.toLowerCase()==="x"||r==="*",TDs=(r,t)=>r.trim().split(/\s+/).map(n=>MDs(n,t)).join(" "),MDs=(r,t)=>{let n=t.loose?ZE[a3.TILDELOOSE]:ZE[a3.TILDE];return r.replace(n,(i,o,s,a,u)=>{fd("tilde",r,i,o,s,a,u);let c;return u3(o)?c="":u3(s)?c=`>=${o}.0.0 <${+o+1}.0.0-0`:u3(a)?c=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(fd("replaceTilde pr",u),c=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):c=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,fd("tilde return",c),c})},DDs=(r,t)=>r.trim().split(/\s+/).map(n=>NDs(n,t)).join(" "),NDs=(r,t)=>{fd("caret",r,t);let n=t.loose?ZE[a3.CARETLOOSE]:ZE[a3.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,c)=>{fd("caret",r,o,s,a,u,c);let l;return u3(s)?l="":u3(a)?l=`>=${s}.0.0${i} <${+s+1}.0.0-0`:u3(u)?s==="0"?l=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:c?(fd("replaceCaret pr",c),s==="0"?a==="0"?l=`>=${s}.${a}.${u}-${c} <${s}.${a}.${+u+1}-0`:l=`>=${s}.${a}.${u}-${c} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.${u}-${c} <${+s+1}.0.0-0`):(fd("no pr"),s==="0"?a==="0"?l=`>=${s}.${a}.${u}${i} <${s}.${a}.${+u+1}-0`:l=`>=${s}.${a}.${u}${i} <${s}.${+a+1}.0-0`:l=`>=${s}.${a}.${u} <${+s+1}.0.0-0`),fd("caret return",l),l})},QDs=(r,t)=>(fd("replaceXRanges",r,t),r.split(/\s+/).map(n=>PDs(n,t)).join(" ")),PDs=(r,t)=>{r=r.trim();let n=t.loose?ZE[a3.XRANGELOOSE]:ZE[a3.XRANGE];return r.replace(n,(i,o,s,a,u,c)=>{fd("xRange",r,i,o,s,a,u,c);let l=u3(s),d=l||u3(a),p=d||u3(u),A=p;return o==="="&&A&&(o=""),c=t.includePrerelease?"-0":"",l?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&A?(d&&(a=0),u=0,o===">"?(o=">=",d?(s=+s+1,a=0,u=0):(a=+a+1,u=0)):o==="<="&&(o="<",d?s=+s+1:a=+a+1),o==="<"&&(c="-0"),i=`${o+s}.${a}.${u}${c}`):d?i=`>=${s}.0.0${c} <${+s+1}.0.0-0`:p&&(i=`>=${s}.${a}.0${c} <${s}.${+a+1}.0-0`),fd("xRange return",i),i})},kDs=(r,t)=>(fd("replaceStars",r,t),r.trim().replace(ZE[a3.STAR],"")),zDs=(r,t)=>(fd("replaceGTE0",r,t),r.trim().replace(ZE[t.includePrerelease?a3.GTE0PRE:a3.GTE0],"")),FDs=r=>(t,n,i,o,s,a,u,c,l,d,p,A,f)=>(u3(i)?n="":u3(o)?n=`>=${i}.0.0${r?"-0":""}`:u3(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,u3(l)?c="":u3(d)?c=`<${+l+1}.0.0-0`:u3(p)?c=`<${l}.${+d+1}.0-0`:A?c=`<=${l}.${d}.${p}-${A}`:r?c=`<${l}.${d}.${+p+1}-0`:c=`<=${c}`,`${n} ${c}`.trim()),LDs=(r,t,n)=>{for(let i=0;i<r.length;i++)if(!r[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let i=0;i<r.length;i++)if(fd(r[i].semver),r[i].semver!==B$t.ANY&&r[i].semver.prerelease.length>0){let o=r[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var SMe=C((wo0,Mxn)=>{var OMe=Symbol("SemVer ANY"),ude=class{static get ANY(){return OMe}constructor(t,n){if(n=_xn(n),t instanceof ude){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),T$t("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===OMe?this.value="":this.value=this.operator+this.semver.version,T$t("comp",this)}parse(t){let n=this.options.loose?wxn[Bxn.COMPARATORLOOSE]:wxn[Bxn.COMPARATOR],i=t.match(n);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Rxn(i[2],this.options.loose):this.semver=OMe}toString(){return this.value}test(t){if(T$t("Comparator.test",t,this.options.loose),this.semver===OMe||t===OMe)return!0;if(typeof t=="string")try{t=new Rxn(t,this.options)}catch{return!1}return R$t(t,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof ude))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Txn(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new Txn(this.value,n).test(t.semver):(n=_xn(n),n.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||R$t(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||R$t(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Mxn.exports=ude;var _xn=Jnt(),{safeRe:wxn,t:Bxn}=ide(),R$t=I$t(),T$t=CMe(),Rxn=y2(),Txn=ax()});var _Me=C((Bo0,Dxn)=>{var qDs=ax(),UDs=(r,t,n)=>{try{t=new qDs(t,n)}catch{return!1}return t.test(r)};Dxn.exports=UDs});var Qxn=C((Ro0,Nxn)=>{var jDs=ax(),GDs=(r,t)=>new jDs(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));Nxn.exports=GDs});var kxn=C((To0,Pxn)=>{var WDs=y2(),HDs=ax(),VDs=(r,t,n)=>{let i=null,o=null,s=null;try{s=new HDs(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new WDs(i,n))}),i};Pxn.exports=VDs});var Fxn=C((Mo0,zxn)=>{var YDs=y2(),KDs=ax(),JDs=(r,t,n)=>{let i=null,o=null,s=null;try{s=new KDs(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new YDs(i,n))}),i};zxn.exports=JDs});var Uxn=C((Do0,qxn)=>{var M$t=y2(),XDs=ax(),Lxn=IMe(),$Ds=(r,t)=>{r=new XDs(r,t);let n=new M$t("0.0.0");if(r.test(n)||(n=new M$t("0.0.0-0"),r.test(n)))return n;n=null;for(let i=0;i<r.set.length;++i){let o=r.set[i],s=null;o.forEach(a=>{let u=new M$t(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||Lxn(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||Lxn(n,s))&&(n=s)}return n&&r.test(n)?n:null};qxn.exports=$Ds});var Gxn=C((No0,jxn)=>{var ZDs=ax(),e9s=(r,t)=>{try{return new ZDs(r,t).range||"*"}catch{return null}};jxn.exports=e9s});var sit=C((Qo0,Yxn)=>{var t9s=y2(),Vxn=SMe(),{ANY:r9s}=Vxn,n9s=ax(),i9s=_Me(),Wxn=IMe(),Hxn=eit(),o9s=rit(),s9s=tit(),a9s=(r,t,n,i)=>{r=new t9s(r,i),t=new n9s(t,i);let o,s,a,u,c;switch(n){case">":o=Wxn,s=o9s,a=Hxn,u=">",c=">=";break;case"<":o=Hxn,s=s9s,a=Wxn,u="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i9s(r,t,i))return!1;for(let l=0;l<t.set.length;++l){let d=t.set[l],p=null,A=null;if(d.forEach(f=>{f.semver===r9s&&(f=new Vxn(">=0.0.0")),p=p||f,A=A||f,o(f.semver,p.semver,i)?p=f:a(f.semver,A.semver,i)&&(A=f)}),p.operator===u||p.operator===c||(!A.operator||A.operator===u)&&s(r,A.semver))return!1;if(A.operator===c&&a(r,A.semver))return!1}return!0};Yxn.exports=a9s});var Jxn=C((Po0,Kxn)=>{var u9s=sit(),l9s=(r,t,n)=>u9s(r,t,">",n);Kxn.exports=l9s});var $xn=C((ko0,Xxn)=>{var c9s=sit(),d9s=(r,t,n)=>c9s(r,t,"<",n);Xxn.exports=d9s});var t5n=C((zo0,e5n)=>{var Zxn=ax(),p9s=(r,t,n)=>(r=new Zxn(r,n),t=new Zxn(t,n),r.intersects(t,n));e5n.exports=p9s});var n5n=C((Fo0,r5n)=>{var A9s=_Me(),f9s=sx();r5n.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((d,p)=>f9s(d,p,n));for(let d of a)A9s(d,t,n)?(s=d,o||(o=d)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let u=[];for(let[d,p]of i)d===p?u.push(d):!p&&d===a[0]?u.push("*"):p?d===a[0]?u.push(`<=${p}`):u.push(`${d} - ${p}`):u.push(`>=${d}`);let c=u.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return c.length<l.length?c:t}});var l5n=C((Lo0,u5n)=>{var i5n=ax(),N$t=SMe(),{ANY:D$t}=N$t,wMe=_Me(),Q$t=sx(),h9s=(r,t,n={})=>{if(r===t)return!0;r=new i5n(r,n),t=new i5n(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=m9s(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},g9s=[new N$t(">=0.0.0-0")],o5n=[new N$t(">=0.0.0")],m9s=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===D$t){if(t.length===1&&t[0].semver===D$t)return!0;n.includePrerelease?r=g9s:r=o5n}if(t.length===1&&t[0].semver===D$t){if(n.includePrerelease)return!0;t=o5n}let i=new Set,o,s;for(let f of r)f.operator===">"||f.operator===">="?o=s5n(o,f,n):f.operator==="<"||f.operator==="<="?s=a5n(s,f,n):i.add(f.semver);if(i.size>1)return null;let a;if(o&&s){if(a=Q$t(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let f of i){if(o&&!wMe(f,String(o),n)||s&&!wMe(f,String(s),n))return null;for(let h of t)if(!wMe(f,String(h),n))return!1;return!0}let u,c,l,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,A=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let f of t){if(d=d||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",o){if(A&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===A.major&&f.semver.minor===A.minor&&f.semver.patch===A.patch&&(A=!1),f.operator===">"||f.operator===">="){if(u=s5n(o,f,n),u===f&&u!==o)return!1}else if(o.operator===">="&&!wMe(o.semver,String(f),n))return!1}if(s){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator==="<"||f.operator==="<="){if(c=a5n(s,f,n),c===f&&c!==s)return!1}else if(s.operator==="<="&&!wMe(s.semver,String(f),n))return!1}if(!f.operator&&(s||o)&&a!==0)return!1}return!(o&&l&&!s&&a!==0||s&&d&&!o&&a!==0||A||p)},s5n=(r,t,n)=>{if(!r)return t;let i=Q$t(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},a5n=(r,t,n)=>{if(!r)return t;let i=Q$t(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};u5n.exports=h9s});var BMe=C((qo0,p5n)=>{var P$t=ide(),c5n=bMe(),y9s=y2(),d5n=E$t(),E9s=Yee(),b9s=M4n(),C9s=N4n(),I9s=k4n(),v9s=L4n(),x9s=U4n(),S9s=G4n(),O9s=H4n(),_9s=Y4n(),w9s=sx(),B9s=$4n(),R9s=exn(),T9s=Znt(),M9s=ixn(),D9s=sxn(),N9s=IMe(),Q9s=eit(),P9s=b$t(),k9s=C$t(),z9s=tit(),F9s=rit(),L9s=I$t(),q9s=hxn(),U9s=SMe(),j9s=ax(),G9s=_Me(),W9s=Qxn(),H9s=kxn(),V9s=Fxn(),Y9s=Uxn(),K9s=Gxn(),J9s=sit(),X9s=Jxn(),$9s=$xn(),Z9s=t5n(),eNs=n5n(),tNs=l5n();p5n.exports={parse:E9s,valid:b9s,clean:C9s,inc:I9s,diff:v9s,major:x9s,minor:S9s,patch:O9s,prerelease:_9s,compare:w9s,rcompare:B9s,compareLoose:R9s,compareBuild:T9s,sort:M9s,rsort:D9s,gt:N9s,lt:Q9s,eq:P9s,neq:k9s,gte:z9s,lte:F9s,cmp:L9s,coerce:q9s,Comparator:U9s,Range:j9s,satisfies:G9s,toComparators:W9s,maxSatisfying:H9s,minSatisfying:V9s,minVersion:Y9s,validRange:K9s,outside:J9s,gtr:X9s,ltr:$9s,intersects:Z9s,simplifyRange:eNs,subset:tNs,SemVer:y9s,re:P$t.re,src:P$t.src,tokens:P$t.t,SEMVER_SPEC_VERSION:c5n.SEMVER_SPEC_VERSION,RELEASE_TYPES:c5n.RELEASE_TYPES,compareIdentifiers:d5n.compareIdentifiers,rcompareIdentifiers:d5n.rcompareIdentifiers}});var RMe,rNs,jo0,nNs,lde,ait=lt(()=>{"use strict";RMe=St(NA()),rNs=St(BMe()),jo0=(0,RMe.Record)({version:RMe.String,hash:RMe.String}),nNs=()=>({version:"7.2.9",hash:"805e2c02bac2c40d22940f91dc4815e813acbeb5"}),lde=nNs()});var A5n,ux,f5n,oNs,uit,sNs,TMe,lit=lt(()=>{"use strict";A5n=St(cMe());dMe();z0e();MMe();ul();ait();f5n=r=>{ux=r},oNs=()=>ld()?{}:{windowInfo:{frontendURLHost:self.location.host}},uit=r=>({coalesceSoftwareVersion:lde?.version||"",service:r,env:process.env.REACT_APP_OWNER??"",reactAppCoalesceDev:process.env.REACT_APP_COALESCE_DEV??""}),sNs=r=>{let t=uit(ux);return{appEnv:oNs(),loggingArea:r,...t}},TMe=r=>{let t=ix[r];if(!t)throw new Error(`Logging area "${r}" is not a valid LoggingAreas key`);return t.logger||(t.logger=A5n.createLogger({levels:Srt.LEVELS,defaultMeta:sNs(r),level:t.level,transports:h5n(t)})),t.logger}});var g5n,eb,k$t,m5n,z$t,F$t,cit,aNs,L$t,cde,dit,q$t,pit,h5n,MMe=lt(()=>{"use strict";g5n=St(BL()),eb=St(cMe());z0e();pMe();lit();ul();k$t=null,m5n=r=>{k$t=r},z$t=class extends g5n.default{baseContext;levelMappings;constructor(t){super(t),this.baseContext=uit(ux),this.levelMappings={emerg:"error",assert:"warn",alert:"warn",error:"warn",app:"info",info:"info",debug:"debug"}}log(t,n){k$t&&k$t.log(t,{...this.baseContext,...Ad},this.levelMappings[t.level]),n()}},F$t=null,cit=r=>{let t=uit(r);F$t={host:"http-intake.logs.datadoghq.com",path:`/v1/input/pub04bd017317b60c96b62874179d82ff97?ddtags=env:${t.env},coalesceSoftwareVersion:${t.coalesceSoftwareVersion}&ddsource=nodejs&service=${r}`,ssl:!0}},aNs=!1,L$t=()=>eb.format.combine(eb.format.timestamp(),eb.format.colorize({colors:Srt.COLORS}),eb.format.printf(r=>`|${r.timestamp}|${process.env.JEST_WORKER_ID?`[SHARD:${process.env.JEST_WORKER_ID}]`:""}[${r.loggingArea}]${r.orgID?`|(org:${r.orgID})`:""}${r.workspaceID?`|(env:${r.workspaceID})`:""}${r.userID?`|(user:${r.userID})`:""}${r.runID?`|run:${r.runID})`:""}(${r.nodeID?`|(node:${r.nodeID})`:""})|)|${r.level}:${r.message}`)),cde=r=>new eb.transports.Console({format:process.env.CONSOLE_JSON_LOGS?eb.format.combine(eb.format.timestamp(),eb.format.json()):L$t(),level:r.level,silent:aNs}),dit=()=>new eb.transports.Http({...F$t,format:eb.format.combine(L$t(),eb.format.uncolorize()),level:"info",env:process.env.REACT_APP_OWNER}),q$t=()=>new eb.transports.File({filename:process.env.JEST_WORKER_ID?`test-shard-${process.env.JEST_WORKER_ID}.log`:"test.log",dirname:"./test-logs",format:L$t(),level:xrt.debug}),pit=r=>{let t=r??{};return new z$t(t)},h5n=r=>{let t=[];return t.push(cde(r)),F$t&&t.push(dit()),al().isTest&&t.push(q$t()),[pit(),...t]}});var y5n,Ait,fit,U$t,hit,m7,E5n=lt(()=>{"use strict";y5n=St(Za()),Ait=St(cMe());dMe();MMe();ul();lit();z0e();fit=(r,t)=>{let n=r.toUpperCase(),i=[];if(n in ix||i.push(`invalid logging area '${n}'`),xrt[t]||i.push("`invalid log level '${logLevel}'`"),i.length)throw i.forEach(u=>{console.error(u)}),new Error("Invalid logging area or log level: "+i.join(", "));let o=TMe(n),s=o.transports.filter(u=>u instanceof Ait.transports.Console),a=o.transports;s.length||(a=[...a,cde(ix[n])]),a.filter(u=>u instanceof Ait.transports.Console)[0].level=t,o.configure({...o,transports:o.transports})},U$t=()=>{Object.keys(ix).forEach(r=>{fit(r,"debug")})},hit=(r,t)=>{for(let n in r){let i=n,o=TMe(i);r[i].defaultMeta={...o.defaultMeta,...r[i].defaultMeta,...t};let s=r[i].transports||o.transports;if(al().isTest&&s.length>0){let a=s[s.length-1];a instanceof Ait.transports.File&&a.close&&(a.close(),s=o.transports.slice(0,-1),s.push(q$t()))}o.configure({...o,...r[i],transports:s,level:r[i].level||o.level})}},m7=r=>{let t=y5n.default.mapValues(ix,(n,i)=>({}));hit(t,r)}});var b5n=lt(()=>{"use strict"});function Ef(r){return typeof r=="object"&&r instanceof Gt}function yit(r){return typeof r=="object"&&r instanceof Error&&typeof r.code=="string"}var Gt,Zee,W1,_c,lx,QO,git,DMe,ete,mit,NMe,li=lt(()=>{"use strict";b5n();Gt=class extends Error{detailMessage;constructor(t,n){super(t),this.detailMessage=n}statusCode(){return 500}get detail(){return this.detailMessage}toTRunError(){return{error:{errorString:this.message,errorDetail:this.detailMessage||""}}}toString(){return JSON.stringify(this.toTRunError())}toFormattedString(){return this.detailMessage?`${this.message}: ${this.detailMessage}`:this.message}toFormattedStringWithCode(){return`${this.statusCode()}${": "+this.toFormattedString()}`}handleExpressResponse(t){t.status(this.statusCode()).json(this.toTRunError())}};Zee=class extends Gt{},W1=class extends Gt{statusCode(){return 404}},_c=class extends Gt{statusCode(){return 400}},lx=class extends Gt{statusCode(){return 403}},QO=class extends Gt{statusCode(){return 409}},git=class extends Gt{constructor(t="Not implemented",n){super(t,n)}statusCode(){return 501}},DMe=class extends Gt{statusCode(){return 404}},ete=class extends Gt{releaseID;packageID;pkgAlias;constructor(t,n,i){super(t,i),this.releaseID=n?.contents?.release?.releaseID||"n/a",this.packageID=n?.contents?.packageID||"n/a",this.pkgAlias=n?.alias||"n/a"}},mit=class extends Gt{entityCollection;entityData;entityId;constructor(t,n,i,o,s){let a=`Entity with id "${n}" in "${t}" failed validation for these reasons: ${i}`;super(a,o),this.entityCollection=t,this.entityData=s,this.entityId=n}toTRunError(){return{error:{errorString:this.message,errorDetail:this.detail?this.detail:this.message},validationDetails:{id:this.entityId,type:this.entityCollection,value:this.entityData}}}},NMe=class extends Gt{constructor(t,n){super(t,n)}}});var C5n,Eit,QMe,uNs,lNs,I5n,kL,j$t=lt(()=>{"use strict";li();C5n=()=>{let r=new WeakSet;return(t,n)=>{if(typeof n=="object"&&n!==null){if(r.has(n))return;r.add(n)}return n}},Eit=r=>{switch(typeof r){case"object":if(r===null)return"null";try{if(r instanceof Error){if(r instanceof Gt)return r.toString();if(yit(r))return`Error: [${r.code}] ${r.message}`}switch(r?.constructor?.name){case"Object":case"Array":return JSON.stringify(r,C5n());case"Set":return JSON.stringify(Array.from(r),C5n());case"Error":{let t=r.toString();try{let n=JSON.stringify(r);n!=="{}"&&(t=n)}catch{}return t}case"Null":return"null";case"Function":case"RegExp":return r.toString();case"Date":return r.toDateString();case"ReferenceError":case"TypeError":case"SyntaxError":case"JestAssertionError":return r.toString();case void 0:default:return`attempting to stringify object w/ constructor: ${r?.constructor?.name}; ${JSON.stringify(r)}`}}catch(t){return`Error converting object to string:${t}`}case"undefined":return typeof r;case"bigint":case"number":case"symbol":return r.toString();case"boolean":return String(r);case"string":return r;default:return"Can't convert arg to string"}},QMe=r=>r.map(Eit),uNs=1e6,lNs=.8,I5n=r=>{let i=uNs*lNs/r.length/2;return r.map(s=>typeof s!="string"||s.length<i?s:s.slice(0,i))},kL=r=>{let t;return r&&r.length>5?t="*"+r.substring(r.length-4,r.length):r.length?t="****":t="",t}});var cNs,v5n,x5n,G$t,bit=lt(()=>{"use strict";pMe();cNs=()=>({logContext:Oc()}),v5n=cNs,x5n=r=>{v5n=r},G$t=()=>v5n()});var W$t,dNs,ot,O5n=lt(()=>{"use strict";dMe();MMe();z0e();j$t();lit();bit();W$t=(r,t)=>{f5n(r),ux==="Frontend"?m5n(t.datadogFrontEndLogger):ux==="CLI"?cit(ux):ux==="Scheduler"?cit(ux):ux==="JestTest"&&cit(ux)},dNs=r=>{let t=u=>{let c=QMe(u);return I5n(c).join(" ")},n=u=>u?{...u,envID:u.envID?.toString(),workspaceID:u.workspaceID?.toString()}:{},i=(u,c)=>{o(u,void 0,c)},o=(u,c,l)=>{let d=TMe(r);if(!d.isLevelEnabled(u))return;let p=t(l);d.log({level:u,message:p,...n({...G$t().logContext,...c})})};return{...{info:(...u)=>{i("info",u)},infoContext:(u,...c)=>{o("info",u,c)},emerg:(...u)=>{i("emerg",u)},emergContext:(u,...c)=>{o("emerg",u,c)},assert:(...u)=>{i("assert",u)},assertContext:(u,...c)=>{o("assert",u,c)},alert:(...u)=>{i("alert",u)},alertContext:(u,...c)=>{o("alert",u,c)},debug:(...u)=>{i("debug",u)},debugContext:(u,...c)=>{o("debug",u,c)},error:(...u)=>{i("error",u)},errorContext:(u,...c)=>{o("error",u,c)},app:(...u)=>{i("app",u)},appContext:(u,...c)=>{o("app",u,c)}},fromFunction:(u,c,l,...d)=>{u.function=c,o(l,u,d),delete u.function}}},ot=Object.fromEntries($Xt.map(r=>[r,dNs(r)]))});var _5n=lt(()=>{"use strict"});var w5n=lt(()=>{"use strict";ul();_5n()});var Ar=lt(()=>{"use strict";z0e();E5n();pMe();O5n();dMe();w5n();j$t();MMe()});function Ys(r,t,n){return(0,Cit.has)(r,t)?(0,Cit.get)(r,t):n}function Y$t(r,t,n){if(r==null){let i=`Non-nullish assertion failed; More info: ${n}`;throw tte.assertContext(t,i),new Error(i)}else return}var B5n,Cit,fNs,hNs,tte,rte,V$t,gNs,Ki,gu,Iit,R5n,H$t,T5n,QB,M5n,zL,kMe,D5n,dde,tb,N5n,Q5n,PMe,P5n,K$t,k5n,J$t,z5n,F5n,FL,vit,L5n,q5n,U5n,j5n,G5n,W5n,xit,PB,vi=lt(()=>{"use strict";drt();B5n=require("child_process"),Cit=St(Za()),fNs=St(m3n());gEn();ul();Ar();tte=ot.COMMON;rte=(r,t,n)=>({statusCode:r,error:{errorString:t,errorDetail:n},toString:()=>`${t} DETAIL:${n} STATUS CODE:${r}`}),V$t=(l=>(l.AG_Tree_Node="ag-tree-node",l.AG_Tree_Subgraph="ag-tree-subgraph",l.AG_Tree_Job="ag-tree-job",l.AG_Tree_Parent="ag-tree-parent",l.AG_SQL_Step_Menu_Column="ag-SQL-step-menu-column",l.AG_Column_Viewer_Column="ag-column-viewer-column",l.Step_Menu_Tab="step-menu-tab",l.Node_Test="node-test",l.Tabular_Config="tabular-config",l))(V$t||{}),gNs=()=>{let r=new Error().stack;if(r)return r.split(`
126
126
  `).slice(3)},Ki=(r,t,n,...i)=>gu(r,t,{},n,...i),gu=(r,t,n,i,...o)=>{let s=ot[r];if(!t){let a=`orgID: ${hNs}, ${i||"assertion failed"}`;s.assertContext(n,a,...o,`
127
127
  Stack: ${gNs()?.join(`
128
128
  `)}`)}},Iit=(r,t,n,i,o,...s)=>{if(!r)throw ot[n].fromFunction(i,o,"assertContext",t,s),new Error(t)},R5n=r=>r.length!==new Set(r).size,H$t=class extends Error{command;stdout;stderr;underlyingError;constructor(t,n,i,o){let s=`Error: stdout:
@@ -3212,7 +3212,7 @@ ${t}`),t};var Iu=ot.PRESYNC,oRt=class{constructor(t){this.baseLogContext=t}nodes
3212
3212
  `,t),t.forEach(s=>{Ki("PRESYNC",typeof o!="string",`Column diff record for ${n} is a string when it should be a record of in column differences`),o[s.kind]||(o[s.kind]=[]);let a=o[s.kind];if(!a)throw new Gt(`Column ${n} not found in columnChanges`);a.push(Nbo(s,i))}),o):null}},Pbo=r=>({syncDetails:null,node:r}),iRt=(r,t,n,i,o)=>{r.operation.materializationType=t;let s=Mbo(r.operation.name,n,t),a=aRt(s,null);return{node:uRt(r,i,o).node,syncDetails:a}},kbo=(r,t)=>({syncDetails:aRt(`Node with ID ${r} did not exist at old location: ${t}`,null),node:null}),TUr=(r,t,n)=>{let i=m6(r,t,n),{node:o,location:s}=uRt(r,i,n),{operation:a}=r,u=RUr(a.name,s,a.materializationType)+"with all expected columns.";return{node:o,syncDetails:aRt(u,null)}},zbo=(r,t,n,i)=>{let o=uRt(r,null,i).node;return qbo(o,t,n,null)},Fbo=(r,t,n,i,o)=>{let s=m6(r,i,o),{node:a,location:u}=uRt(r,s,o),{name:c,materializationType:l}=a.operation,d=RUr(c,u,l)+"with unexpected column differences.";return qbo(a,t,n,d)},qbo=(r,t,n,i)=>(r.operation.metadata.columns=t,{node:r,syncDetails:aRt(i,n)}),aRt=(r,t)=>({object:r,columns:t}),uRt=(r,t,n)=>{let i="";if(t){let o=r.operation.locationName;if(!t.database||!t.schema)throw new Gt(`Database or schema not found in location ${o}`);let{name:s,database:a,schema:u}=r.operation;Iu.infoContext(n,`Augmenting location data for ${s}. Was:`,{database:a,schema:u,locationName:o},"Now:",t),r.operation.database=t.database,r.operation.schema=t.schema,i=tue(t)}return{node:{...r,presync:!0},location:i}},MUr=(r,t)=>{if(!Wf(r,t))return!1;let n=r.operation.materializationType;return n==="table"||n==="view"};var Ubo=r=>r.presync;Ar();Ar();Ts();qi();var uX=new Date("2023-01-01T00:00:00.000Z"),Gs=(r,t,n)=>{let i=`${r}Entity`;return n||(n=as(t)),{standard:nn(i,n),strict:nn(`${i} (strict)`,t)}};var DUr=ot.FIREBASE,jbo=r=>{if(Array.isArray(r))for(let t=r.length-1;t>=0;t--)r[t]===void 0&&r.splice(t,1);if(r&&typeof r=="object")for(let t in r)r.hasOwnProperty(t)&&r[t]===void 0&&delete r[t];return r},e6l=r=>r&&typeof r=="object"&&r.toDate&&(!isNaN(r.seconds)&&!isNaN(r.nanoseconds)||!isNaN(r._seconds)&&!isNaN(r._nanoseconds))?r.toDate():r,t6l=(r,t)=>r instanceof AEe?t.getDeleteSentinel():r,nue=(r,t)=>{if(t=r(t),typeof t=="object"){if(Array.isArray(t))return t.map(n=>nue(r,n));for(let n in t)t.hasOwnProperty(n)&&(t[n]=nue(r,t[n]))}return t},iHe=class{fromStorage(t,n,i,o,s){try{return this.transformFromStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw DUr.debug(`Error transforming repository entity ${n} from storage`,a),a}return i}toStorage(t,n,i,o,s){try{return this.transformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw DUr.debug(`Error transforming repository entity ${n} to storage`,a),a}return i}mergeToStorage(t,n,i,o,s){try{return this.mergeTransformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw DUr.debug(`Error merge transforming repository entity ${n} to storage`,a),a}return i}},NUr=class extends iHe{constructor(n=!1){super();this.preserveID=n}transformFromStorage(n,i,o){return o.id||(o.id=n),o.createdAt||(o.createdAt=uX),o.updatedAt||(o.updatedAt=uX),nue(e6l,o)}transformToStorage(n,i,o){return this.preserveID||delete o.id,nue(jbo,o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,nue(a=>jbo(t6l(a,s)),o)}},QUr=class extends iHe{constructor(n){super();this.validators=n}transformFromStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}transformToStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}mergeTransformToStorage(n,i,o,s,a){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},Ws=(r,t,n)=>{let i=[new NUr(n),new QUr(r)];return t&&i.unshift(t),new PUr(...i)},PUr=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o,s){return this.transforms.reduce((a,u)=>u.fromStorage(t,n,a,o,s),i)}toStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.toStorage(t,n,a,o,s),i)}mergeToStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.mergeToStorage(t,n,a,o,s),i)}},Ig=class extends iHe{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}};var r6l=ot.FIREBASE,kUr=(r,t,n)=>{let i=n.type,o=[];if(n.locationName||(o.push("Adding property locationName with default value"),n.locationName=""),n.description===null&&(o.push('Setting null description to ""'),n.description=""),n.type==="sql"&&n.isMultisource===void 0&&(o.push("Setting missing isMultisource to false"),n.isMultisource=!1),n.metadata&&typeof n.metadata=="object"){let s=n.metadata;s?.appliedNodeTests===null&&(o.push("Setting null metadata.appliedNodesTests to []"),s.appliedNodeTests=[]),Array.isArray(s?.columns)&&s.columns.filter(a=>!!a&&typeof a=="object").forEach((a,u)=>{if(["ghostRecordValue","descendedFrom","hashColumns","columnsForHash"].forEach(c=>{a.hasOwnProperty(c)&&(o.push(`Removing property '${c}' from metadata.columns[${u}]`),delete a[c])}),a.appliedColumnTests===null&&(o.push(`Deleting null metadata.columns[${u}].appliedColumnTests`),delete a.appliedColumnTests),a.config===null&&(o.push(`Deleting null metadata.columns[${u}].config`),delete a.config),typeof a.dataType!="string"&&(o.push(`Setting non-string metadata.columns[${u}].dataType to ""`),a.dataType=""),typeof a.hashDetails=="string"&&(o.push(`Deleting metadata.columns[${u}].hashDetails with invalid string value "${a.hashDetails}`),delete a.hashDetails),a.keyColumnType==="None"&&delete a.keyColumnType,a.systemColumnType==="None"&&delete a.systemColumnType,a.columnReference&&typeof a.columnReference=="object"){let c=a.columnReference;(c.stepCounter===void 0||c.stepCounter===null)&&(o.push(`Setting missing/null metadata.columns[${u}].columnReference.stepCounter to ${r}`),c.stepCounter=r)}Array.isArray(a.sourceColumnReferences)&&a.sourceColumnReferences.filter(c=>!!c&&typeof c=="object").forEach((c,l)=>{Array.isArray(c.columnReferences)&&c.columnReferences.filter(d=>!!d&&typeof d=="object").forEach((d,p)=>{(d.stepCounter===void 0||d.stepCounter===null)&&(o.push(`Setting missing/null metadata.columns[${u}].sourceColumnReferences[${l}].columnReferences[${p}].stepCounter to ""`),d.stepCounter="")})}),a.transform===null&&(o.push(`Setting null metadata.columns[${u}].transform to ""`),a.transform="")}),i==="sql"&&!s.sourceMapping?.length&&(o.push("Setting missing/empty metadata.sourceMapping to [ basicMapping ]"),s.sourceMapping=[{name:n.name??"",join:{joinString:""},dependencies:[],noLinkRefs:[],aliases:{}}]),Array.isArray(s.sourceMapping)&&s.sourceMapping.filter(a=>!!a&&typeof a=="object").forEach((a,u)=>{if(typeof a.join=="string"&&(o.push(`Converting string metadata.sourceMapping[${u}].join to object`),a.join={joinCondition:a.join}),a.name===void 0){let c=a.join?.name??"";o.push(`Setting missing metadata.sourceMapping[${u}].name to "${c}"`),a.name=c}Array.isArray(a.dependencies)&&a.dependencies.filter(c=>!!c&&typeof c=="object").forEach((c,l)=>{(c.locationName===void 0||c.locationName===null)&&(o.push(`Setting missing/null metadata.sourceMapping[${u}].dependencies[${l}].locationName to ""`),c.locationName=""),(c.nodeName===void 0||c.nodeName===null)&&(o.push(`Setting missing/null metadata.sourceMapping[${u}].dependencies[${l}].nodeName to ""`),c.nodeName="")})})}return o.length>0&&r6l.debug(`Patched node ${t}`,o),n},lRt=class extends Ig{transformFromStorage(t,n,i){return kUr(t,n,i)}};var rh=ot.PLAN_UTILS,Gbo=(r,t,n,i,o,s)=>{let a=new Set(i);rh.debugContext(s,"Getting implemented schemas for subset of nodes:",i);let u=Object.fromEntries(Object.entries(t).filter(([c])=>a.has(c)));return rh.debugContext(s,"Getting used step locations lookup for subset"),r.showSchemas(sRt(u,n,o,s))},n6l=(r,t,n,i)=>{let o=(u,c)=>{let{name:l,database:d,schema:p}=u.operation;return{id:c,name:l,database:d,schema:p}},s=(u,c,l)=>{let d=l[u.operation.locationName];d?d.push(o(u,c)):l[u.operation.locationName]=[o(u,c)]},a={};for(let[u,c]of Object.entries(r)){let{database:l,schema:d,locationName:p,name:A}=c.operation;if(p in a){let f=n[p];if(!f)throw new Gt(`Location "${p}" used by "${A}" was not found in workspace locations.`);let{database:h,schema:y}=f;Ki("PLAN_UTILS",l===h&&d===y,`Data for location ${p} was derived from node data, but encountered node ${A} using same location ${p} with differing db/schema values! Node db: ${l}, schema: ${d}. Location ${p} db: ${h}, schema: ${y}. Workspace is in an inconsistent state.`),s(c,u,a)}else t[p]||(rh.infoContext(i,`Workspace locations did not contain location "${p}" - this can be expected. Using node data supplemented values for database "${l}" and schema "${d}".`),s(c,u,a))}return a},sRt=(r,t,n,i)=>{let o={};return(0,cRt.forOwn)(r,s=>{let a=s.operation.locationName;if(gu("PRESYNC",!!a,i,`nodeLocation for ${s.operation.name} is undefined`),!(a in o))try{o[a]=n(s,t,i)}catch(u){rh.assertContext(i,`getImplementedLocations: could not find location data for node ${s.operation.name} location: ${a}.`,u)}}),xit("(Logging Only) generating derived locations record",i,()=>{let s=n6l(r,t,o,i);(0,cRt.size)(s)&&rh.appContext(i,`Some locations did not exist in the original workspace locations data. For those locations the data was instead derived from the initial listed node. Workspace locations:
3213
3213
  `,t,`
3214
3214
  Locations derived from node data:
3215
- `,s)}),o},FUr=(r,t,n)=>{let i=Hbo(r,n.nodeID,n),o=Hbo(t,n.nodeID,n),s=(0,zUr.diff)(i,o)||[],a=t.operation.name;s.length||rh.infoContext(n,`DoNodesHaveDifferenceForDatabaseUpdate: ${a} diff:`,s);for(let u of s){if(!u.path)continue;let c=u.path[4]==="sourceColumnReferences"&&u.path[6]==="transform",l=u.path[1]==="config",d=u.path[2]==="columns";if(c||l||d)return!0}if(Ubo(r)){let{name:u}=t.operation;return rh.debugContext(n,`${u} has presync data and is eligible for database update.`),!0}return!1},tue=r=>{let{database:t,schema:n}=r;if(!t||!n)throw new Error(`Database or schema are empty or undefined. Cannot create location name. database: ${t}, schema: ${n}`);return`"${t}"."${n}".`},LUr=(r,t,n)=>{let i=Wbo(r,n.nodeID,n),o=Wbo(t,n.nodeID,n),s=(0,zUr.diff)(i,o),a=t.operation.name;return rh.infoContext(n,`DoNodesHaveMetadataDiffForDDL: ${a} diff:`,s),s?s.some(u=>{if(u.kind!=="N")return!0;let c=u.path?.[2]==="columns",l=u.path?.[4];return!(c&&(l==="config"||l==="appliedColumnTests"))}):!1},i6l=r=>!!r.presync,Vbo=(r,t,n,i)=>gi(r,o=>{dWn(o)&&delete o.stepCounter,o.operation.database="",o.operation.schema="",o.operation.deployEnabled=!0,delete o.operation.locationID,delete o.operation.dependencies,delete o.operation.isDataVault,i6l(o)&&delete o.presync,TTi(o,i)&&(delete o.operation.table,delete o.operation.dataset),delete o.operation.version,o.operation.metadata.sourceMapping&&o.operation.metadata.sourceMapping.map(s=>{s.noLinkRefs||(s.noLinkRefs=[])}),Wf(o,i)&&(o.operation.metadata.appliedNodeTests||(o.operation.metadata.appliedNodeTests=[]),o.operation.metadata.enabledColumnTestIDs||(o.operation.metadata.enabledColumnTestIDs=[])),n(o),kUr(t,"",o.operation)}),Wbo=(r,t,n)=>Vbo(r,t,o=>{if(Wf(o,n)&&o.operation.materializationType!=="view"){o.operation.config={};for(let a of o.operation.metadata.columns)for(let u of a.sourceColumnReferences||[])u.transform=""}},n),Hbo=(r,t,n)=>Vbo(r,t,o=>{},n),rue=(r,t,n)=>{let{name:i,locationName:o,database:s,schema:a}=r.operation,u;rh.debugContext(n,`getLocDataForDeployedNode: database: ${s}, schema: ${a}`);try{return r.operation.database&&r.operation.schema?u={...r.operation,source:"node operation data"}:u=Ybo(o,t),rh.debugContext(n,`getLocDataForDeployedNode: Got loc data for node ${i}. db: ${u.database}, schema: ${u.schema} from ${u.source}`),{...u,locationName:o}}catch(c){throw rh.errorContext(n,`getLocDataForDeployedNode: cannot get location data for ${i}. node: `,r.operation,"locations:",t,c),c}},m6=(r,t,n)=>{let{name:i,locationName:o,database:s,schema:a}=r.operation;rh.debugContext(n,`getLocDataForDeployedNode: database: ${s}, schema: ${a}`);try{let u=Ybo(o,t);return rh.debugContext(n,`getLocDataForGitCommitNode: Got loc data for node ${i}. db: ${u.database}, schema: ${u.schema}`),u}catch(u){throw rh.errorContext(n,`getLocDataForGitCommitNode: cannot get location data for ${i}. node: `,r.operation,"locations:",t,u),u}},Ybo=(r,t)=>({...PB(t[r],()=>new Gt(`Could not find location data for location: ${r}`)),source:"workspace locations data",locationName:r}),Kbo=async(r,t,n,i,o,s,a)=>{let u=`user/${i}/environment/${n}/planContext/${t}.${s}`;try{rh.appContext(a,`Storing plan data "${s}" to ${u}...`);let c=JSON.stringify(o);await r.storage().uploadFile(u,c),rh.appContext(a,`Successfully stored plan data "${s}" to ${u}`)}catch(c){throw rh.errorContext(a,`Failed to store plan data "${s}" to ${u}`,c),c}},qUr=async(r,t,n,i,o)=>{rh.appContext(o,"Getting schemas for current and updated workspace states");let{entitiesWithPossibleEdits:s}=xse(i.steps,n.steps),a=await Gbo(t,n.steps,hg(n.locations||{},r),s,rue,o),u=await Gbo(t,i.steps,hg(i.locations||{},r),s,m6,o);return rh.appContext(o,"Got schemas. current:",a,"updated:",u),{current:a,updated:u}};vi();li();Ar();var Jbo=ot.PLAN_UTILS,oHe=class{constructor(t,n,{locations:i,stepTypes:o,steps:s,installedPackages:a,macros:u},c){this.workspaceState=t;this.logContext=c;if(!i)throw new Gt("Locations are required to initialize plan state");this.locations=i,this.physicalLocs=hg(i,n);let l=Object.values(o)[0];l?jBt(l)?this.stepTypes=Qxe(o):(Jbo.alertContext(this.logContext,"Step types have already been parsed, skipping parsing step types"),this.stepTypes=o):(Jbo.alertContext(this.logContext,"No step types found, initializing empty step types object"),this.stepTypes={}),this.nodes=s,this.installedPackages=a||{},this.macros=u}nodes;physicalLocs;stepTypes;locations;installedPackages;macros;getSqlNode(t){let n=this.getNode(t);if(!Wf(n,{...this.logContext,nodeID:t}))throw new Gt(`Node ${n.operation.name} is not a SQL node, cannot get workspace edits for non-SQL nodes`);return n}getNode(t){return PB(this.nodes[t],()=>new X0(t,"this.nodes",Object.keys(this.nodes)))}getUdn(t){return PB(this.stepTypes[t],()=>new W1(`No step type found for id ${t}`))}getNodePartialLocationString(t){let n=this.workspaceState==="current"?rue(this.getNode(t),this.physicalLocs,this.logContext):m6(this.getNode(t),this.physicalLocs,this.logContext);return tue(n)}};var da=ot.PLAN_NODES,jUr=(r,t,n,i)=>sf(r,t,"deletedTable",n,i),eCo=(r,t,n)=>sf(r,"Cleaning any stale data","dropClone",{oldLocation:t.oldLocation,oldName:t.oldName+_y},n),s6l=(r,t,n,i,o,s)=>{let a=t.getNode(r),u=a.operation.name,c={...s,nodeName:u},l={...n.stepTypes,...t.stepTypes},d=jxe(a.operation,l,c),p={};try{p={oldName:u,oldLocation:t.getNodePartialLocationString(r)}}catch{da.errorContext(c,`Mappings for node: ${u} don't exist`)}return Wf(a,c)&&d?(da.infoContext(c,`getting advanced edit for remove node for ${u}...`),a6l(r,t,o,l,c)):Wf(a,c)&&"oldLocation"in p?(da.debugContext(c,`getting standard edit for remove node for ${u}...`),u6l(r,t,i,p,c)):(da.debugContext(c,`getting metadata edit for remove node for ${u}...`),l6l(r,t,c))},a6l=(r,t,n,i,o)=>{let s=t.getSqlNode(r);da.infoContext(o,`Getting advanced deploy drop edit for ${s.operation.name}`);let a=ZWe(i,s.operation.sqlType,!0).create.templateString,u=a.length?`Advanced Deployment: Deleted node ${s.operation.name}`:`Advanced Deployment: No SQL available for ${s.operation.name}`,c=cbo(r,t,null,i,n,o);gu("DEPLOY",!!Object.keys(c).length,o,"hydratedMetadata for advanced deploy was missing data when creating workspace edits");let l={...sf(r,u,"deletedTable",{}),sql:a};return i9(s.operation,[l],t.physicalLocs,c)},u6l=(r,t,n,i,o)=>{let s=t.getSqlNode(r),a=`Deleted node ${s.operation.name}`,u,c=s.operation.materializationType==="view",l=s.operation.sqlType==="View";if(c||l){da.infoContext(o,`Node ${s.operation.name} is a view, getting delete template...`);let d=n.getDeleteTemplate("view");u=[jUr(r,a,i,d)]}else{da.infoContext(o,`Node ${s.operation.name} is a table, getting delete template...`);let d=n.getDeleteTemplate("table");u=[eCo(r,i,d),jUr(r,a,i,d)]}return i9(s.operation,u,t.physicalLocs,{})},l6l=(r,t,n)=>{da.infoContext(n,"Getting metadata drop edit for node");let i=t.getNode(r);return i9(i.operation,[sf(r,`Deleting metadata for ${i.operation.name}`,"deletedTable",{})],t.physicalLocs,{})},c6l=(r,t,n,i,o)=>{let s={...n,...t.stepTypes},a,u,c=t.getNode(r);if(Wf(c,o)){if(jxe(c.operation,s,o)){let d=ZWe(s,c.operation.sqlType,!0).create.templateString,p=`Advanced Deployment: Created node ${c.operation.name}`,A=$Bt(c.operation,r,null,t.physicalLocs,t.nodes,s,i,o);return{sql:d,message:p,hydratedMetadata:A,node:c}}a=`Created node ${c.operation.name}`,u=hUr(s,c.operation.sqlType)}else a=`Adding metadata for ${c.operation.name}`,u=XBt(s,"Source","run");let l=n4(c.operation,r,t.nodes,s,t.physicalLocs,null,i,o);return{message:a,sql:u,hydratedMetadata:l,node:c}},d6l=(r,t,n,i,o)=>{da.debugContext(o,`getting node create requirements for node "${r}"`);let{message:s,sql:a,hydratedMetadata:u,node:c}=c6l(r,t,n,i,o);da.infoContext({...o,nodeName:c.operation.name},`getting create edit for node "${c.operation.name}"`);let l=sf(r,s,"addedTable",{},a);return i9(c.operation,[l],t.physicalLocs,u)},p6l=async(r,t,n,i,o,s)=>{let a=n.getNode(t),u=i.getNode(t),{name:c}=u.operation;if(da.debugContext(s,`getting alter advanced deploy workspace edits for node ${c}`),!Wf(a,s)||!Wf(u,s))throw new Gt(`Node ${c} is not a SQL node, cannot get advanced deploy workspace edits for non-SQL nodes`);let l=i.getUdn(u.operation.sqlType).metadata.templates.create.templateString,d=AD({...i.macros,...xk}),p=dbo(t,n,i,o,s),A=await Jqr(r,l,p,d,i.installedPackages||{},i.getUdn(u.operation.sqlType),s),f=[],h=[],y=[],I=qxe(A.compiledSQL);if(!I.parsedSQLStages.length&&FUr(a,u,s)){da.debugContext(s,`Advanced deploy node ${c} will have metadata update`);let O=n4(u.operation,t,i.nodes,i.stepTypes,i.physicalLocs,null,o,s),_=sf(t,`Updating metadata for ${u.operation.name}`,"alteredTable",O);y.push(_)}da.debugContext(s,`Got ${I.parsedSQLStages.length} parsed sql stages for advanced deploy node ${c}`);for(let O of I.parsedSQLStages){let{deployPhase:_}=O;_==="create"?h.push(UUr(t,"addedTable",O)):_==="drop"?f.push(UUr(t,"deletedTable",O)):y.push(UUr(t,"alteredTable",O))}let v=O=>{let _=W5n(O);return _&&i9(u.operation,_,i.physicalLocs,p)};return{stepDataWithCreateEdits:v(h),stepDataWithAlterEdits:v(y),stepDataWithDeleteEdits:v(f)}},A6l=(r,t,n,i,o)=>{let s=t.getNode(r),a=n.getNode(r);da.debugContext(o,`getting alter src workspace edits for node with updated name "${a.operation.name}"...`);let u=t.getNodePartialLocationString(r),c=n.getNodePartialLocationString(r),l=u!==c;if(!LUr(s,a,o)&&!l)return da.infoContext(o,`No metadata diff detected for source node ${a.operation.name}`),{stepDataWithAlterEdits:null,stepDataWithCreateEdits:null,stepDataWithDeleteEdits:null};da.infoContext(o,`Metadata diff detected for source node ${a.operation.name}, getting workspace edits...`);let p=`Updating metadata for ${a.operation.name}`,A=XBt(n.stepTypes,"Source","run"),f=n4(a.operation,r,n.nodes,n.stepTypes,n.physicalLocs,null,i,o),h=sf(r,p,"alteredTable",f,A);return{stepDataWithAlterEdits:i9(a.operation,[h],n.physicalLocs,f),stepDataWithCreateEdits:null,stepDataWithDeleteEdits:null}},f6l=(r,t,n,i,o,s)=>{let a=n.operation.metadata.columns.map(O=>O.columnReference.columnCounter),u=i.operation.metadata.columns.map(O=>O.columnReference.columnCounter),{firstOnly:c,inCommon:l,secondOnly:d}=dde(a,u),p=[],A=N6l(n,o,c,t,r),f=Q6l(n,i,o,l,t,r),h=P6l(n,i,o,l,t,r),y=k6l(i,o,d,t,r),I=c.length&&c.length===a.length,v;if(I)if(d.length){da.infoContext(s,`Node ${i.operation.name} has dropped all original columns and added new columns. Inserting stages for addition and removal of internal column.`);let O=v6l(o,r);p.push(O),v=x6l(o,r)}else throw new Gt(`Node ${i.operation.name} has dropped all columns and has no added columns. This is not allowed.`);return p.push(...A,...f,...h,...y),v&&p.push(v),p},h6l=(r,t,n,i,o,s,a,u,c,l,d)=>{let p=n.operation,A=i.operation;da.infoContext(d,`Node ${A.name} is a table. getting workspace edits for alter table...`);let f=l.current[p.locationName],h=l.updated[A.locationName];if(!f||!h){let O=!f&&!h?"Current and updated":f?"Updated":"Current";throw da.errorContext(d,`${O} schema missing for node. currentLoc:`,p.locationName,"updatedLoc:",A.locationName,"schemas:",l),new Gt(`${O} schema is missing for node ${A.name} (updated name)`)}let I=[B6l(t,s,r,f,h)];if(I.push(...f6l(r,t,n,i,s,d)),p.description!==A.description){let v=T6l(t,s,r);I.push(v)}if(u||c){da.infoContext(d,`Node ${A.name} is a table and has a name or location mapping difference. getting workspace edits for rename or swap...`,`
3215
+ `,s)}),o},FUr=(r,t,n)=>{let i=Hbo(r,n.nodeID,n),o=Hbo(t,n.nodeID,n),s=(0,zUr.diff)(i,o)||[],a=t.operation.name;rh.debugContext(n,`DoNodesHaveDifferenceForDatabaseUpdate: ${a} diff:`,s);for(let u of s){if(!u.path)continue;let c=u.path[4]==="sourceColumnReferences"&&u.path[6]==="transform",l=u.path[1]==="config",d=u.path[2]==="columns";if(c||l||d)return!0}if(Ubo(r)){let{name:u}=t.operation;return rh.debugContext(n,`${u} has presync data and is eligible for database update.`),!0}return!1},tue=r=>{let{database:t,schema:n}=r;if(!t||!n)throw new Error(`Database or schema are empty or undefined. Cannot create location name. database: ${t}, schema: ${n}`);return`"${t}"."${n}".`},LUr=(r,t,n)=>{let i=Wbo(r,n.nodeID,n),o=Wbo(t,n.nodeID,n),s=(0,zUr.diff)(i,o),a=t.operation.name;return rh.debugContext(n,`DoNodesHaveMetadataDiffForDDL: ${a} diff:`,s),s?s.some(u=>{if(u.kind!=="N")return!0;let c=u.path?.[2]==="columns",l=u.path?.[4];return!(c&&(l==="config"||l==="appliedColumnTests"))}):!1},i6l=r=>!!r.presync,Vbo=(r,t,n,i)=>gi(r,o=>{dWn(o)&&delete o.stepCounter,o.operation.database="",o.operation.schema="",o.operation.deployEnabled=!0,delete o.operation.locationID,delete o.operation.dependencies,delete o.operation.isDataVault,i6l(o)&&delete o.presync,TTi(o,i)&&(delete o.operation.table,delete o.operation.dataset),delete o.operation.version,o.operation.metadata.sourceMapping&&o.operation.metadata.sourceMapping.map(s=>{s.noLinkRefs||(s.noLinkRefs=[])}),Wf(o,i)&&(o.operation.metadata.appliedNodeTests||(o.operation.metadata.appliedNodeTests=[]),o.operation.metadata.enabledColumnTestIDs||(o.operation.metadata.enabledColumnTestIDs=[])),n(o),kUr(t,"",o.operation)}),Wbo=(r,t,n)=>Vbo(r,t,o=>{if(Wf(o,n)&&o.operation.materializationType!=="view"){o.operation.config={};for(let a of o.operation.metadata.columns)for(let u of a.sourceColumnReferences||[])u.transform=""}},n),Hbo=(r,t,n)=>Vbo(r,t,o=>{},n),rue=(r,t,n)=>{let{name:i,locationName:o,database:s,schema:a}=r.operation,u;rh.debugContext(n,`getLocDataForDeployedNode: database: ${s}, schema: ${a}`);try{return r.operation.database&&r.operation.schema?u={...r.operation,source:"node operation data"}:u=Ybo(o,t),rh.debugContext(n,`getLocDataForDeployedNode: Got loc data for node ${i}. db: ${u.database}, schema: ${u.schema} from ${u.source}`),{...u,locationName:o}}catch(c){throw rh.errorContext(n,`getLocDataForDeployedNode: cannot get location data for ${i}. node: `,r.operation,"locations:",t,c),c}},m6=(r,t,n)=>{let{name:i,locationName:o,database:s,schema:a}=r.operation;rh.debugContext(n,`getLocDataForDeployedNode: database: ${s}, schema: ${a}`);try{let u=Ybo(o,t);return rh.debugContext(n,`getLocDataForGitCommitNode: Got loc data for node ${i}. db: ${u.database}, schema: ${u.schema}`),u}catch(u){throw rh.errorContext(n,`getLocDataForGitCommitNode: cannot get location data for ${i}. node: `,r.operation,"locations:",t,u),u}},Ybo=(r,t)=>({...PB(t[r],()=>new Gt(`Could not find location data for location: ${r}`)),source:"workspace locations data",locationName:r}),Kbo=async(r,t,n,i,o,s,a)=>{let u=`user/${i}/environment/${n}/planContext/${t}.${s}`;try{rh.appContext(a,`Storing plan data "${s}" to ${u}...`);let c=JSON.stringify(o);await r.storage().uploadFile(u,c),rh.appContext(a,`Successfully stored plan data "${s}" to ${u}`)}catch(c){throw rh.errorContext(a,`Failed to store plan data "${s}" to ${u}`,c),c}},qUr=async(r,t,n,i,o)=>{rh.appContext(o,"Getting schemas for current and updated workspace states");let{entitiesWithPossibleEdits:s}=xse(i.steps,n.steps),a=await Gbo(t,n.steps,hg(n.locations||{},r),s,rue,o),u=await Gbo(t,i.steps,hg(i.locations||{},r),s,m6,o);return rh.appContext(o,"Got schemas. current:",a,"updated:",u),{current:a,updated:u}};vi();li();Ar();var Jbo=ot.PLAN_UTILS,oHe=class{constructor(t,n,{locations:i,stepTypes:o,steps:s,installedPackages:a,macros:u},c){this.workspaceState=t;this.logContext=c;if(!i)throw new Gt("Locations are required to initialize plan state");this.locations=i,this.physicalLocs=hg(i,n);let l=Object.values(o)[0];l?jBt(l)?this.stepTypes=Qxe(o):(Jbo.alertContext(this.logContext,"Step types have already been parsed, skipping parsing step types"),this.stepTypes=o):(Jbo.alertContext(this.logContext,"No step types found, initializing empty step types object"),this.stepTypes={}),this.nodes=s,this.installedPackages=a||{},this.macros=u}nodes;physicalLocs;stepTypes;locations;installedPackages;macros;getSqlNode(t){let n=this.getNode(t);if(!Wf(n,{...this.logContext,nodeID:t}))throw new Gt(`Node ${n.operation.name} is not a SQL node, cannot get workspace edits for non-SQL nodes`);return n}getNode(t){return PB(this.nodes[t],()=>new X0(t,"this.nodes",Object.keys(this.nodes)))}getUdn(t){return PB(this.stepTypes[t],()=>new W1(`No step type found for id ${t}`))}getNodePartialLocationString(t){let n=this.workspaceState==="current"?rue(this.getNode(t),this.physicalLocs,this.logContext):m6(this.getNode(t),this.physicalLocs,this.logContext);return tue(n)}};var da=ot.PLAN_NODES,jUr=(r,t,n,i)=>sf(r,t,"deletedTable",n,i),eCo=(r,t,n)=>sf(r,"Cleaning any stale data","dropClone",{oldLocation:t.oldLocation,oldName:t.oldName+_y},n),s6l=(r,t,n,i,o,s)=>{let a=t.getNode(r),u=a.operation.name,c={...s,nodeName:u},l={...n.stepTypes,...t.stepTypes},d=jxe(a.operation,l,c),p={};try{p={oldName:u,oldLocation:t.getNodePartialLocationString(r)}}catch{da.errorContext(c,`Mappings for node: ${u} don't exist`)}return Wf(a,c)&&d?(da.infoContext(c,`getting advanced edit for remove node for ${u}...`),a6l(r,t,o,l,c)):Wf(a,c)&&"oldLocation"in p?(da.debugContext(c,`getting standard edit for remove node for ${u}...`),u6l(r,t,i,p,c)):(da.debugContext(c,`getting metadata edit for remove node for ${u}...`),l6l(r,t,c))},a6l=(r,t,n,i,o)=>{let s=t.getSqlNode(r);da.infoContext(o,`Getting advanced deploy drop edit for ${s.operation.name}`);let a=ZWe(i,s.operation.sqlType,!0).create.templateString,u=a.length?`Advanced Deployment: Deleted node ${s.operation.name}`:`Advanced Deployment: No SQL available for ${s.operation.name}`,c=cbo(r,t,null,i,n,o);gu("DEPLOY",!!Object.keys(c).length,o,"hydratedMetadata for advanced deploy was missing data when creating workspace edits");let l={...sf(r,u,"deletedTable",{}),sql:a};return i9(s.operation,[l],t.physicalLocs,c)},u6l=(r,t,n,i,o)=>{let s=t.getSqlNode(r),a=`Deleted node ${s.operation.name}`,u,c=s.operation.materializationType==="view",l=s.operation.sqlType==="View";if(c||l){da.infoContext(o,`Node ${s.operation.name} is a view, getting delete template...`);let d=n.getDeleteTemplate("view");u=[jUr(r,a,i,d)]}else{da.infoContext(o,`Node ${s.operation.name} is a table, getting delete template...`);let d=n.getDeleteTemplate("table");u=[eCo(r,i,d),jUr(r,a,i,d)]}return i9(s.operation,u,t.physicalLocs,{})},l6l=(r,t,n)=>{da.infoContext(n,"Getting metadata drop edit for node");let i=t.getNode(r);return i9(i.operation,[sf(r,`Deleting metadata for ${i.operation.name}`,"deletedTable",{})],t.physicalLocs,{})},c6l=(r,t,n,i,o)=>{let s={...n,...t.stepTypes},a,u,c=t.getNode(r);if(Wf(c,o)){if(jxe(c.operation,s,o)){let d=ZWe(s,c.operation.sqlType,!0).create.templateString,p=`Advanced Deployment: Created node ${c.operation.name}`,A=$Bt(c.operation,r,null,t.physicalLocs,t.nodes,s,i,o);return{sql:d,message:p,hydratedMetadata:A,node:c}}a=`Created node ${c.operation.name}`,u=hUr(s,c.operation.sqlType)}else a=`Adding metadata for ${c.operation.name}`,u=XBt(s,"Source","run");let l=n4(c.operation,r,t.nodes,s,t.physicalLocs,null,i,o);return{message:a,sql:u,hydratedMetadata:l,node:c}},d6l=(r,t,n,i,o)=>{da.debugContext(o,`getting node create requirements for node "${r}"`);let{message:s,sql:a,hydratedMetadata:u,node:c}=c6l(r,t,n,i,o);da.infoContext({...o,nodeName:c.operation.name},`getting create edit for node "${c.operation.name}"`);let l=sf(r,s,"addedTable",{},a);return i9(c.operation,[l],t.physicalLocs,u)},p6l=async(r,t,n,i,o,s)=>{let a=n.getNode(t),u=i.getNode(t),{name:c}=u.operation;if(da.debugContext(s,`getting alter advanced deploy workspace edits for node ${c}`),!Wf(a,s)||!Wf(u,s))throw new Gt(`Node ${c} is not a SQL node, cannot get advanced deploy workspace edits for non-SQL nodes`);let l=i.getUdn(u.operation.sqlType).metadata.templates.create.templateString,d=AD({...i.macros,...xk}),p=dbo(t,n,i,o,s),A=await Jqr(r,l,p,d,i.installedPackages||{},i.getUdn(u.operation.sqlType),s),f=[],h=[],y=[],I=qxe(A.compiledSQL);if(!I.parsedSQLStages.length&&FUr(a,u,s)){da.debugContext(s,`Advanced deploy node ${c} will have metadata update`);let O=n4(u.operation,t,i.nodes,i.stepTypes,i.physicalLocs,null,o,s),_=sf(t,`Updating metadata for ${u.operation.name}`,"alteredTable",O);y.push(_)}da.debugContext(s,`Got ${I.parsedSQLStages.length} parsed sql stages for advanced deploy node ${c}`);for(let O of I.parsedSQLStages){let{deployPhase:_}=O;_==="create"?h.push(UUr(t,"addedTable",O)):_==="drop"?f.push(UUr(t,"deletedTable",O)):y.push(UUr(t,"alteredTable",O))}let v=O=>{let _=W5n(O);return _&&i9(u.operation,_,i.physicalLocs,p)};return{stepDataWithCreateEdits:v(h),stepDataWithAlterEdits:v(y),stepDataWithDeleteEdits:v(f)}},A6l=(r,t,n,i,o)=>{let s=t.getNode(r),a=n.getNode(r);da.debugContext(o,`getting alter src workspace edits for node with updated name "${a.operation.name}"...`);let u=t.getNodePartialLocationString(r),c=n.getNodePartialLocationString(r),l=u!==c;if(!LUr(s,a,o)&&!l)return da.debugContext(o,`No metadata diff detected for source node ${a.operation.name}`),{stepDataWithAlterEdits:null,stepDataWithCreateEdits:null,stepDataWithDeleteEdits:null};da.infoContext(o,`Metadata diff detected for source node ${a.operation.name}, getting workspace edits...`);let p=`Updating metadata for ${a.operation.name}`,A=XBt(n.stepTypes,"Source","run"),f=n4(a.operation,r,n.nodes,n.stepTypes,n.physicalLocs,null,i,o),h=sf(r,p,"alteredTable",f,A);return{stepDataWithAlterEdits:i9(a.operation,[h],n.physicalLocs,f),stepDataWithCreateEdits:null,stepDataWithDeleteEdits:null}},f6l=(r,t,n,i,o,s)=>{let a=n.operation.metadata.columns.map(O=>O.columnReference.columnCounter),u=i.operation.metadata.columns.map(O=>O.columnReference.columnCounter),{firstOnly:c,inCommon:l,secondOnly:d}=dde(a,u),p=[],A=N6l(n,o,c,t,r),f=Q6l(n,i,o,l,t,r),h=P6l(n,i,o,l,t,r),y=k6l(i,o,d,t,r),I=c.length&&c.length===a.length,v;if(I)if(d.length){da.infoContext(s,`Node ${i.operation.name} has dropped all original columns and added new columns. Inserting stages for addition and removal of internal column.`);let O=v6l(o,r);p.push(O),v=x6l(o,r)}else throw new Gt(`Node ${i.operation.name} has dropped all columns and has no added columns. This is not allowed.`);return p.push(...A,...f,...h,...y),v&&p.push(v),p},h6l=(r,t,n,i,o,s,a,u,c,l,d)=>{let p=n.operation,A=i.operation;da.infoContext(d,`Node ${A.name} is a table. getting workspace edits for alter table...`);let f=l.current[p.locationName],h=l.updated[A.locationName];if(!f||!h){let O=!f&&!h?"Current and updated":f?"Updated":"Current";throw da.errorContext(d,`${O} schema missing for node. currentLoc:`,p.locationName,"updatedLoc:",A.locationName,"schemas:",l),new Gt(`${O} schema is missing for node ${A.name} (updated name)`)}let I=[B6l(t,s,r,f,h)];if(I.push(...f6l(r,t,n,i,s,d)),p.description!==A.description){let v=T6l(t,s,r);I.push(v)}if(u||c){da.infoContext(d,`Node ${A.name} is a table and has a name or location mapping difference. getting workspace edits for rename or swap...`,`
3216
3216
  hasNodeNameDifference: ${u}, hasLocationMappingDifference: ${c}`);let v=R6l(t,s,r),O=_6l(t,s,r);I.push(v,O)}else{da.infoContext(d,`Node ${A.name} is a table and has no name or location mapping difference. getting workspace edits for swap and drop...`,`
3217
3217
  hasNodeNameDifference: ${u}, hasLocationMappingDifference: ${c}`);let v=w6l(t,s,r),O=eCo(t,s,r.getDeleteTemplate("table"));I.push(v,O)}return Ki("DEPLOY",!!I.length,`alteredTable 'editsCollection' does not contain an edit for stepCounter: ${t}`),{stepDataWithDeleteEdits:null,stepDataWithCreateEdits:null,stepDataWithAlterEdits:i9(A,I,o,a)}},g6l=(r,t,n,i,o,s,a,u,c,l,d)=>{let p=n.getSqlNode(t),A=i.getSqlNode(t),f=p.operation.materializationType==="table",h=A.operation.materializationType==="table",y=lbo(A.operation,i.stepTypes,d);da.debugContext(d,`getWorkspaceEditsForAlteredNode: originalNodeIsTable: ${f}, updatedNodeIsTable: ${h}, transientDeploy: ${y}`);let I=n4(A.operation,t,i.nodes,i.stepTypes,i.physicalLocs,null,l,d),v=U6l(p.operation.name,n.getNodePartialLocationString(t));if(f&&h&&!y)return h6l(r,t,p,A,i.physicalLocs,v,I,s,a,c,d);if(u||o||y)return D6l(t,v,i.stepTypes,p.operation,A.operation,n.physicalLocs,i.physicalLocs,I,r,"",d);{let O=`Reached dropthrough case for step ${t} when attempting to create workspace edits - one or both materialization types are invalid. Original materialization type: ${p.operation.materializationType}; updated materialization type: ${A.operation.materializationType}.`;throw da.emergContext(d,O),new Error(O)}},tCo=(r,t,n,i,o)=>{let s=PB(n.nodes[t],()=>new X0(t,"state.nodes",Object.keys(n.nodes))),a=`Updating metadata for ${s.operation.name}`,u=r.getSelectOneTemplate("Validating Object Exists"),c=n4(s.operation,t,n.nodes,n.stepTypes,n.physicalLocs,null,i,o),l=sf(t,a,"alteredTable",c,u);return i9(s.operation,[l],n.physicalLocs,c)},m6l=(r,t,n,i,o)=>({stepDataWithAlterEdits:tCo(r,t,n,i,o),stepDataWithDeleteEdits:null,stepDataWithCreateEdits:null}),Xbo=r=>r==="table"||r==="view",y6l=(r,t,n,i,o,s,a)=>{let u=t.getSqlNode(r),c=n.getSqlNode(r),{name:l,materializationType:d}=c.operation;da.debugContext(a,`getting alter non-src workspace edits for node ${l}...`);let p=t.getNodePartialLocationString(r),A=n.getNodePartialLocationString(r);da.debugContext(a,`Got original and updated locations for node ${l}. original: ${p}, updated ${A}`);let f=Wf(c,a)&&Xbo(u.operation.materializationType)&&Xbo(c.operation.materializationType),h=LUr(u,c,a),y=u.operation.name!==c.operation.name,I=p!==A,v=!h&&!I&&!y&&d!=="table"&&f&&q6l(r,t,n,a);return h||I||v?(da.debugContext(a,`Node ${l} is a ${d} that will be recreated.`,`viewHasDependencyWithMappingDifference: ${v}`,`hasMetadataDiffForDDL: ${h}`),g6l(o,r,t,n,v,y,I,f,s,i,a)):FUr(u,c,a)?m6l(o,r,n,i,a):{stepDataWithDeleteEdits:null,stepDataWithCreateEdits:null,stepDataWithAlterEdits:null}},$bo=r=>{Object.values(r).forEach(t=>t.operation.metadata.columns.forEach(QIe))},GUr=(r,t,n,i,o,s,a,u)=>{if(!n.locations||!t.locations)throw new Gt("Locations are required to calculate node edits");return E6l(r,new oHe("current",i,t,u),new oHe("updated",i,n,u),o,s,a,u)},E6l=async(r,t,n,i,o,s,a)=>{let u={["addedTable"]:{},["alteredTable"]:{},["deletedTable"]:{}};$bo(t.nodes),$bo(n.nodes);let c=vEo(n.nodes),{deletedEntityIDs:l,addedEntityIDs:d,entitiesWithPossibleEdits:p}=xse(c,t.nodes);da.infoContext(a,"getNodeEditsInternal -",`deletedEntityIDs:
3218
3218
  `,l,`addedEntityIDs:
@@ -3301,7 +3301,7 @@ Total columns from all schemas: `,s)}catch(o){l$e.errorContext(t,"Failed to log
3301
3301
  {% endfor %}
3302
3302
  `}getSelectOneTemplate(n){return`{{ stage('${n}') }}
3303
3303
  SELECT 1 FROM {{ ref(node.location.name, node.name) }} LIMIT 0
3304
- `}async showSchemas(n){let i={},o=new Map;for(let s of Object.values(n)){let{database:a,schema:u,locationName:c}=s;if(o.has(a)){this.log("infoContext",`Schemas for ${a} already fetched. Updating record for ${c}.`);let A=o.get(a);if(!A)throw new Gt(`Cached schemas for database ${a} are empty.`);let f=A[u];if(!f)throw new Gt(`Cached schema info for schema ${u} in database ${a} is empty.`);i[c]=f;continue}this.log("infoContext",`Fetching schemas for database ${a} from location ${c}.`);let l=await Pb(()=>this.getRows(`SHOW SCHEMAS IN DATABASE "${a}"`),3,ot.PLATFORM,cEe(this.userContext),{logOnRetry:`Failed to SHOW SCHEMAS for database ${a} from location ${c}. Retrying...`,retryLogLevel:"error",logOnFailure:`Failed to SHOW SCHEMAS for database ${a} from location ${c}:`,failureLogLevel:"error",checkError:A=>_in(A)?void 0:A}),d=Object.fromEntries(l.map(A=>[A.name,urs.parse(A)]));o.set(a,d);let p=d[u];if(!p)throw new Gt(`Schema ${u} not found in database ${a} from location ${c}`);i[c]=p}return i}getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n?.data?.status||"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data){let a=n.data.rows.map(c=>({values:Object.values(c)})),u=n.data.columns.map(c=>({name:c.Name,type:c.DataType||""}));s.fields=u,s.rows=a}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(u=>({locationName:u.location_name,nodeName:u.node_name}));s.exportedRefs=IP(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(u=>({locationName:u.location_name,nodeName:u.node_name}));s.invalidExportedRefs=IP(a)}return s}showColumns(n){return Oin("columns",i=>this.getRows(`SHOW COLUMNS IN SCHEMA "${i.database}"."${i.schema}"`),Object.values(n),!1,cEe(this.userContext),i=>_in(i)?void 0:i)}showObjects(n,i){return Oin("objects",o=>this.getRows(`SHOW OBJECTS IN "${o.database}"."${o.schema}"`),Object.values(n),i,cEe(this.userContext),o=>_in(o)?void 0:o)}async testConnection(){try{return await this.runSQL(Cat,void 0),null}catch(n){return Ef(n)?new Gt(`Could not validate connection to ${this.name}: ${n.message}`,n.detail):new Gt(`Could not validate connection to ${this.name}`,l1(n).error.errorDetail)}}async getDatabases(){return(await this.getRows("SHOW DATABASES")).map(i=>i.name)}async getSchemas(n){return(await this.getRows(`SHOW SCHEMAS IN "${n}"`)).map(o=>o.name)}getName(n,i){let o=n[i.locationName];if(!o)throw new XOt(n,i.locationName);let{database:s,schema:a}=o;return`"${s}"."${a}"."${i.name}"`}async getVariantRows(n,i,o,s){let a=this.getName(s,o),u=`SELECT "${n}" FROM ${a} SAMPLE (${i} ROWS)`;return this.getSQLQueryResult(u)}async getObjectRows(n,i,o){let s=`SELECT * FROM ${this.getName(n,i)} LIMIT 100`;return o&&(s=uzt(s)),this.getSQLQueryResult(s)}createColumnMetadata(n,i){return{name:n.name,dataType:n.type,transform:"",nullable:n["null?"]==="Y",defaultValue:"",columnReference:{columnCounter:P0(),stepCounter:i},primaryKey:n["primary key"]==="Y",uniqueKey:n["unique key"]==="Y",description:n.comment||"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let a=`DESC ${o.toUpperCase()} ${this.getName(n,i)}`;return(await this.runSQL(a,P0())).data.rows.map(c=>this.createColumnMetadata(c,s))}convertObjectRowsToMaterializationKinds(n){let i=[],o=[];for(let s of n)s.kind==="TABLE"?i.push(s.name):s.kind==="VIEW"&&o.push(s.name);return{tables:i,views:o}}createState(n,i,o,s,a){return new OFt(s,o,i,n,a)}},_in=r=>Ef(r)?!!(r.detail?.includes("name=NetworkError")||r.detail?.includes("Network Error")):!0;var DE=class extends wFt{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({sqlText:n,requestId:i||P0()});return DE.GetTemplateResultFromExecutionResult(n,o)}static GetTemplateResultFromExecutionResult(n,i){let o=i.stmt.getColumns().map(a=>({Name:a.getName(),DataType:a.getType()}));return{runDetails:{compiledSQL:n,exported_refs:[],invalid_exported_refs:[],ref_usage:{invalid_ref:[],invalid_ref_link:[],invalid_ref_no_link:[],ref:[],ref_link:[],ref_no_link:[]},queryID:i.queryID,warehouse:i.warehouse},data:{columns:o,rows:i.rows,status:i.status}}}usingConnection=n=>new DE(n,this.userContext)};qi();var prs=r=>{let t={};for(let n of cGn.options)t[n]=r.featureFlags?.[n]??(n in r?r[n]:void 0);return t};li();Hi();var hBc=Q.enum(["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-create","org-users-delete","org-userRoles-read","org-userRoles-write","org-projects-create"]),gBc=Q.enum(["project-settings-read","project-summary-read","project-settings-write","project-delete","project-members-read","project-members-add","project-members-write","project-members-remove","project-workspaces-create","project-documentation-read","project-environments-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-create","project-workspace-jobs-read","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-read","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-read","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-create","project-workspace-packages-read","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-sql-run","project-workspace-subgraphs-create","project-workspace-subgraphs-read","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"]),mBc=Q.enum(["env-run-results-read","env-delete","env-deploy","env-refresh","env-settings-read","env-summary-read","env-settings-write","env-documentation-read","env-members-read","env-members-add","env-members-write","env-members-remove"]),yBc={reader:{permissions:["env-run-results-read","env-summary-read","env-documentation-read"],inheritedEnvironmentRoles:[]},admin:{permissions:[...mBc.options],inheritedEnvironmentRoles:["reader"]}},EBc={member:{permissions:["project-summary-read"],inheritedProjectRoles:[],inheritedEnvironmentRoles:[]},contributor:{permissions:["project-settings-read","project-members-read","project-workspaces-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-read","project-workspace-macros-read","project-workspace-node-types-read","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-read","project-workspace-subgraphs-read","project-documentation-read","env-documentation-read"],inheritedProjectRoles:["member"],inheritedEnvironmentRoles:[]},architect:{permissions:["project-workspace-jobs-create","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-packages-create","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-sql-run","project-workspace-subgraphs-create","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"],inheritedProjectRoles:["contributor"],inheritedEnvironmentRoles:[]},admin:{permissions:[...gBc.options],inheritedProjectRoles:["architect"],inheritedEnvironmentRoles:["admin"]}},bBc={member:{permissions:["org-users-read"],inheritedOrganizationRoles:[],inheritedProjectRoles:[]},contributor:{permissions:["org-projects-create"],inheritedOrganizationRoles:["member"],inheritedProjectRoles:[]},admin:{permissions:[...hBc.options],inheritedOrganizationRoles:["contributor"],inheritedProjectRoles:["admin"]}},RFt=r=>{let t=yBc[r],n=new Set(t.permissions);for(let i of t.inheritedEnvironmentRoles)RFt(i).forEach(o=>n.add(o));return Array.from(n)},v6e=r=>{let t=EBc[r],n=new Set(t.permissions);for(let i of t.inheritedProjectRoles)v6e(i).forEach(o=>n.add(o));for(let i of t.inheritedEnvironmentRoles)RFt(i).forEach(o=>n.add(o));return Array.from(n)},BFt=r=>{let t=bBc[r],n=new Set(t.permissions);for(let i of t.inheritedOrganizationRoles)BFt(i).forEach(o=>n.add(o));for(let i of t.inheritedProjectRoles)v6e(i).forEach(o=>n.add(o));return Array.from(n)},Ars={admin:BFt("admin"),contributor:BFt("contributor"),member:BFt("member")},frs={admin:v6e("admin"),architect:v6e("architect"),contributor:v6e("contributor"),member:v6e("member")},hrs={admin:RFt("admin"),reader:RFt("reader")};var c$e=class{throwIfOrgPermissionDenied(t,n=!1){if(!this.hasOrgPermission(t))throw n?new W1("The requested resource is unavailable"):new lx("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfProjectPermissionDenied(t,n,i=!1){if(!this.hasProjectPermission(t,n))throw i?new W1("The requested resource is unavailable"):new lx("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfEnvironmentPermissionDenied(t,n,i,o=!1){if(!this.hasEnvironmentPermission(t,n,i))throw o?new W1("The requested resource is unavailable"):new lx("Permission denied",`'Permission ${t}' is required to perform this operation.`)}},yF=class extends c$e{constructor(n,i){super();this.userRoles=n;this.hasSuperUserAccess=i;this.userPermissions=this.ConstructPermissionsFromRoles(n)}userPermissions;hasOrgPermissionInternal(n){return this.userPermissions.organizationPermissions?.has(n)}hasOrgPermission(n){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)}hasProjectPermissionInternal(n,i){return this.userPermissions.projects[i]?.projectPermissions?.has(n)}hasProjectPermission(n,i){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)}hasEnvironmentPermissionInternal(n,i,o){return this.userPermissions.projects[i]?.environments[o]?.environmentPermissions?.has(n)}hasEnvironmentPermission(n,i,o){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)||this.hasEnvironmentPermissionInternal(n,i,o)}ConstructPermissionsFromRoles(n){return n?{organizationPermissions:yF.ConstructOrgPermissionsFromRoles(n.organizationRoles),projects:yF.ConstructProjectsPermissionsFromRoles(n.projects)}:{organizationPermissions:new Set,projects:{}}}static ConstructEnvironmentPermissionsFromRoles(n){let i=new Set;return n.environmentRoles.forEach(o=>{hrs[o].forEach(s=>{i.add(s)})}),i}static ConstructEnvironmentPermissionObjectsFromRoles(n){let i={};return Object.entries(n).forEach(([o,s])=>{i[o]={environmentPermissions:yF.ConstructEnvironmentPermissionsFromRoles(s)}}),i}static ConstructProjectPermissionsFromRoles(n){let i=new Set;return n.projectRoles.forEach(s=>{frs[s].forEach(a=>{i.add(a)})}),{projectPermissions:i,environments:yF.ConstructEnvironmentPermissionObjectsFromRoles(n.environments)}}static ConstructProjectsPermissionsFromRoles(n){let i={};return Object.keys(n).forEach(o=>{i[o]=this.ConstructProjectPermissionsFromRoles(n[o])}),i}static ConstructOrgPermissionsFromRoles(n){let i=new Set;return n.forEach(o=>{Ars[o].forEach(s=>{i.add(s)})}),i}};var TFt=class extends c$e{constructor(n,i){super();this.userRole=n;this.hasSuperUserAccess=i}hasOrgPermission(n){if(this.hasSuperUserAccess||this.userRole==="Admin")return!0;{let i=["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-delete"];return this.userRole==="User"&&!i.includes(n)}}hasProjectPermission(n,i){return!!this.userRole||this.hasSuperUserAccess}hasEnvironmentPermission(n,i,o){return!!this.userRole||this.hasSuperUserAccess}};var IBc=null;ld()&&(IBc=OUe());var Dle=ot.AUTH,_ap=ot.USER_MANAGEMENT,vBc=0,BA=ot.RUNNER_BACKEND;var xBc=async(r,t)=>{try{await m1r(t);let n=r+vBc++,i=c7e().initializeApp(t,n);y1r(i,!1);let o=await VH("/scheduler/generateLoginToken",null,r),{customToken:s,uid:a}=o.data;return await i.auth().signInWithCustomToken(s),{Firebase:i,rootRepository:Yts(i),uid:a}}catch(n){throw BA.error("GetOrSetupFirebase",n),n}},SBc=async r=>{let t=(await l7e()).apiKey;return JCr(`https://securetoken.googleapis.com/v1/token?key=${t}`,{refresh_token:r,grant_type:"refresh_token"}).then(n=>n.data.id_token)},OBc=async(r,t,n)=>{let i,o,s,a,u,c,l,d,p;return Dle.debug("got auth request refresh:",!!r,"id token",!!t),t===void 0&&YU&&(t=r),Dle.debug("inAuthenticate, between 1st and 2nd",!!t),(t?Promise.resolve(t):SBc(r)).then(A=>(Dle.debug("inAuthenticate, before setting id token"),i=A,Dle.debug("inAuthenticate, setting up firebase 2"),n(i))).then(A=>(o=A.Firebase,s=A.rootRepository,l=A.uid,Dle.debug("inAuthenticate, getting team data admin ",l),YFi(o.firestore(),A.uid))).then(A=>(a=A,d=eLi(A.fbRole),Dle.debug("inAuthenticate, finishing...",l),s.org(A.fbTeamID).fetch())).then(A=>(u=A,s.user(a.fbUserID).fetch())).then(A=>{if(c=A,p=prs(u.featureFlags),p.RBAC)return s.org(a.fbTeamID).userRole(a.fbUserID).fetch()}).then(A=>{let f;return A?f=new yF(A,!!c.hasSuperUserAccess):f=new TFt(c.role,!!c.hasSuperUserAccess),{teamInfo:a,firebase:o,rootRepository:s,idToken:i,featureFlags:p,userPermissions:f,UserRolePrivilegeChecker:d}}).catch(A=>{let f=a?a.fbUserID:"",h=a?a.fbTeamID:"";Dle.errorContext({userID:f,orgID:h},"AuthenticateFirebaseTokenAndRetrieveTeamInfo",A);let y=A?.message||A?.error?.errorString;throw new Gt("Unable to authenticate, please check your network connection and ensure your token is valid",y)})};var aZ=async(r,t,n)=>{let o=await kR(n.origin).GetDatabase();return await zYn(o),process.env.SCHEDULER_ADDRESS=n.origin,OBc(r,t,s=>xBc(s,o))};var grs=r=>JSON.stringify(Kqr(r)),win=(r,t,n,i)=>{let o=qBt(r.userCredentials,t);return{runTimeParameters:r.runTimeParameters,runDetails:r.runDetails,userCredentials:o,runStatus:i?"waitingToRun":"initializing",userID:n,runType:"deploy",kubernetesJobUuid:i}},Bin=async(r,t,n,i,o,s,a,u,c)=>{if(!c.render)throw new Error("CreateRunDeployPromise: bad renderer");let{firebase:l,teamInfo:d,teamInfo:{fbTeamID:p},rootRepository:A}=r;try{await bts(l,A,t,d,i,s,a,c),BA.appContext(a,"runDeploy finished successfully"),await trs(l,p,o,n)}catch(f){let h=l1(f),{error:{errorString:y}}=h;BA.errorContext(a,"Error during deploy inner promise (runDeployCompletion):",y);try{await rrs(l,p,o,n,y)}catch(I){BA.errorContext(a,"Error during status release: ",I)}throw h}finally{await u()}},_Bc=async(r,t,n,i,o,s,a,u=!1)=>{let{teamInfo:{fbTeamID:c},rootRepository:l}=r,{runCounter:d,CleanupHeartbeat:p}=await Zts(l,c,n,t,s),A={...s,runID:d},f=u?Promise.resolve():Bin(r,new DE(i.getConnection(),o),d,t,n,i,A,p,a);return u&&(await p(),await i.teardown()),{runCounter:d,runCompletion:f}},mrs=async(r,t,n,i,o,s)=>{let{teamInfo:a,teamInfo:{fbUserID:u},rootRepository:c}=t,l=parseInt(r.runDetails.environmentID),d=Math.max(...Object.values(r.runDetails.dividedStepDataWithWorkspaceEdits).map(A=>Object.keys(A).length)),p=r.runDetails.planID;BA.infoContext(n,"Initializing deploy! planId:",p);try{let A=await bF(c,a,l,i),f=EF(A,u),h=s?1:r.runDetails.parallelism,y=await lO.New(A,t,n,sZ(d,h));r.runDetails=WFi(f,r.runDetails,u),BA.appContext(n,grs(A),"BECLI_HandleDeploy"),await Min(y,u,n);let I=win(r,A,u,s),v=await _Bc(t,I,l,y,A,n,o,!!s);return await wBc(c,t,v.runCounter,l,u,n),v}catch(A){throw BA.errorContext(n,`Error during deploy${p?` for plan ${p}`:""}: `,A),A}},wBc=async(r,t,n,i,o,s)=>{try{let a=rP(t.firebase.firestore(),t.teamInfo.fbTeamID,i),u=await A1(a);if(!u.exists)throw new Gt(`Workspace ${i} does not exist!`);let c=`run-${n}.predeploy`,l=`user/${o}/environment/${i}/workspacePreDeploy/${c}`,d=u.data();BA.appContext(s,"saving workspace data",d);let p=JSON.stringify(d);await r.storage().uploadFile(l,p),BA.appContext(s,`Run ${n}: Saved pre-deploy workspace state to ${l}`)}catch(a){BA.errorContext(s,"Error while saving preDeploy workspace state: ",a)}},Rin=r=>{let{runDetails:t}=r;if(t.jobID&&(t.includeNodesSelector||t.excludeNodesSelector))throw new Error("Unable to process, don't provide a JobID and Node Include/Exclude Selector(s) for 1 Refresh Run")},BBc=(r,t)=>{for(let n in t)t[n]&&(r[n]=t[n])},Tin=(r,t,n,i)=>{let o=qBt(r.userCredentials,t),s={runTimeParameters:r.runTimeParameters,runDetails:{...r.runDetails,jobID:TCr(r.runDetails.jobID)},userCredentials:o,runStatus:i?"waitingToRun":"initializing",userID:n,runType:"refresh",kubernetesJobUuid:i};return tb(s),s},EF=(r,t)=>{let n={connectionDetails:{userID:t,user:r.user,role:r.role,warehouse:r.warehouse},connectionType:r.authenticator};return r.authenticator==="KeyPair"&&(n.connectionDetails.keyPair=r.keyPairKey),n},Min=async(r,t,n)=>{let i=EF(r.userContext,t),o={connectionType:i.connectionType,connectionDetails:UFi(i.connectionDetails)};BA.infoContext(n,"testing snowflake connection:",o),await r.withConnection(async s=>{await s.execute({sqlText:Cat})})},bF=async(r,t,n,i)=>{let o=await pEe(r,t,n),{accountName:s,accessUrl:a}=await jFi(r,t.fbTeamID,n),u={accountName:s,accessUrl:a,user:o.connectionDetails.user,role:o.connectionDetails.role,warehouse:o.connectionDetails.warehouse,environmentID:n,orgID:t.fbTeamID,authenticator:o.connectionType};return BBc(u,i),u},MFt=r=>HH(r,o=>({user:o.snowflakeUsername,password:o.snowflakePassword,role:o.snowflakeRole,warehouse:o.snowflakeWarehouse,authenticator:"Basic"}),o=>{if(o.snowflakeKeyPairKey===void 0)throw new Gt("No private key was provided, cannot perform key pair authentication with Snowflake");let s=o.snowflakeKeyPairPass?new hl(o.snowflakeKeyPairPass):void 0,a=uke(new hl(o.snowflakeKeyPairKey),s);return{user:o.snowflakeUsername,keyPairKey:a.sensitiveValue,keyPairPass:o.snowflakeKeyPairPass,role:o.snowflakeRole,warehouse:o.snowflakeWarehouse,authenticator:"KeyPair"}},o=>({warehouse:o.snowflakeWarehouse,authenticator:"OAuth"}),DSr),DFt=async(r,t,n,i,o,s,a,u,c,l,d,p)=>{let{firebase:A,teamInfo:f,teamInfo:{fbTeamID:h},rootRepository:y}=r;try{BA.appContext(u,"Starting runRefresh"),await Cts(y,t,f,o,n,i,s,a,c,l,p),BA.appContext(u,"runRefresh finished with no errors, releasing workspace status"),await nrs(A,h,i,o)}catch(I){let v=l1(I),{error:{errorString:O}}=v;BA.errorContext(u,"Error during refresh:",O);try{await irs(A,h,i,o,O)}catch(_){BA.errorContext(u,"Error during status release:",_)}throw v}finally{await d()}},yrs=async(r,t,n,i,o,s,a,u,c,l=!1,d)=>{BA.infoContext(a,"Securing workspace status and starting refresh:",i);let{teamInfo:{fbTeamID:p},rootRepository:A}=r,{runCounter:f,CleanupHeartbeat:h}=await ers(A,p,i,n,a),y={...a,runID:f},I=A.org(p).run(f);await a$e(n,c,u,I);let v=l?Promise.resolve():DFt(r,t,n,i,f,o,s,y,u,c,h,d);return l&&(await h(),await o.teardown()),{runCounter:f,runCompletion:v}},RBc=async(r,t,n,i,o)=>o?(BA.infoContext(i,"Refreshing job:",o),xOi(r,t,n,"jobs",o)):(BA.infoContext(i,"No job ID, refreshing all steps"),!0),Ers=async(r,t,n,i,o,s,a)=>{let{teamInfo:u,teamInfo:{fbTeamID:c,fbUserID:l},firebase:d,rootRepository:p}=t,A=d.firestore(),f=parseInt(r.runDetails.environmentID);r.runTimeParameters=await CF(p,c,f,r.runTimeParameters),Rin(r);let h=TCr(r.runDetails.jobID),y=RBc(A,c,f,n,h);try{let I=await bF(p,u,f,i),v=EF(I,l);if(BA.appContext(n,grs(I),"BECLI_HandleRefresh"),!await y)throw rte(400,`Unable to start job ${h}`,`Job ${h} did not exist`);let O=Tin(r,I,l,a),_={steps:{},folders:{},jobs:{},macros:{},stepTypes:{}},w=new Set;a||(_=await DIe(t,+O.runDetails.environmentID,s),w=await b6e(d,c,O,_));let P=await lO.New(I,t,n,a?1:sZ(w.size,r.runDetails.parallelism));return await Min(P,l,n),yrs(t,new DE(P.getConnection(),I),O,f,P,v,n,_,w,!!a,o)}catch(I){throw BA.errorContext(n,"Error during refresh:",I),I}};var TBc=async(r,t,n)=>{let o=(await r.org(t).workspace(n).fetch()).runTimeParameters??"";return YOt(o)},CF=async(r,t,n,i)=>i?eRt(i):TBc(r,t,n),Din=async(r,t,n,i,o,s)=>{let a=qBt(t.userCredentials,i),u=await CF(r,o.fbTeamID,parseInt(n.runDetails.environmentID),t.runTimeParameters);return n.runType==="refresh"&&(t.runDetails.forceIgnoreWorkspaceStatus!==void 0?n.runDetails.forceIgnoreWorkspaceStatus=t.runDetails.forceIgnoreWorkspaceStatus:n.runDetails.forceIgnoreWorkspaceStatus!==void 0&&delete n.runDetails.forceIgnoreWorkspaceStatus),{runStatus:s?"waitingToRun":"initializing",runType:"refresh",runDetails:n.runDetails,userCredentials:a,reRunID:t.runDetails.runID,runTimeParameters:u,userID:o.fbUserID,kubernetesJobUuid:s}},MBc=async(r,t,n,i,o,s,a,u)=>{let{firebase:c,rootRepository:l,teamInfo:d,teamInfo:{fbUserID:p,fbTeamID:A}}=n,f=parseInt(t.runDetails.environmentID),h=await bF(l,d,f,o),y=await Din(l,r,t,h,d,u),I=await DIe(n,+y.runDetails.environmentID,a),v=await b6e(c,A,y,I),O=u?1:y.runDetails.parallelism,_=await lO.New(h,n,i,sZ(v.size,O));r.runTimeParameters=await CF(l,A,f,r.runTimeParameters);let w=EF(h,p);return await Min(_,p,i),yrs(n,new DE(_.getConnection(),h),y,f,_,w,i,I,v,!!u,s)},brs=async(r,t,n,i,o,s,a,u)=>{if(BA.appContext(i,"BECLI_HandleRerun"),t.runStatus!=="failed")throw new Error("Only failed jobs can be re-run!");if(Tdt(t))return MBc(r,t,n,i,o,s,a,u);throw new Error(`Run type ${t.runType} is not eligible for re-run`)};var wap=wc({newOrg:Qbt,newUser:w2([Nbt,kte()]),baseURL:Wi()}),Crs=r=>Irs(r,"runCounter"),d$e=r=>Irs(r,"environment ID"),Irs=(r,t)=>{let n=typeof r=="number"?r:parseInt(r||"");if(!r||isNaN(n))throw new _c(`Specify a valid ${t}`,`400: ${n} is not valid`);return n};var QFt=St(Zae());var xrs=St(require("node:fs")),Srs=St(require("node:child_process"));li();Ar();ul();Rf();vi();var x6e=ot.CLI;var IF=class extends Gt{constructor(n){super(`CLI exited with status ${n}`);this.exitCode=n}},Ep=async r=>{if(al().isTest)throw new IF(r);if(process.env.COALESCE_COA_CLOUD_JOB_ID){try{let t=process.env.COALESCE_COA_EXIT_STATUS_PATH||"/tmp/coa-exit-status";x6e.info(`Writing exit status ${r} to ${t}`),xrs.default.writeFileSync(t,r.toString())}catch(t){x6e.error("Unable to write exit status to file:",t)}x6e.info(`Running "kill -9 ${process.pid}" to kill cloud coa process`),Srs.default.spawnSync("kill",["-9",process.pid.toString()]),x6e.info("Finished running kill command"),setImmediate(async()=>{for(;;)await LU(1e3),x6e.info("Cloud coa still alive...waiting to die...")});return}setTimeout(()=>{setTimeout(()=>{process.exit(r)},1e3)},5e3);try{let t=c7e(),n=[];t.apps.length&&t.apps.forEach(i=>{n.push(t.app(i.name).delete())}),process.exitCode=r,await FL(n)}catch{x6e.error("Error while attempting to close Firebase apps in CLI")}},DBc=(r,t)=>{let n=[pit(),dit()],i={transports:n};if(r){let o={...ix[t],level:r};n.push(cde(o)),i.level=r}return i},vrs=(r,...t)=>{let n=Object.fromEntries(t.map(i=>[i,DBc(r,i)]));hit(n)},NFt=(r,t)=>{r&&!t||(t?vrs("debug",...Object.keys(ix)):vrs(null,...Object.keys(ix).filter(n=>n!="CLI")))};DR();var NBc=async(r,t,n,i,o)=>{Oa.infoContext(o,`Starting deploy job coa-${r}`);let s=qSi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),a=new Yye(s),u=d$e(a.runDetails.environmentID),c={...o,workspaceID:u},l=await pEe(t.rootRepository,t.teamInfo,u);await Tyt(t.teamInfo.fbTeamID,t.teamInfo.fbUserID,u,a.userCredentials,l);let d=await bF(t.rootRepository,t.teamInfo,u,MFt(a.userCredentials)),p=win(a,d,t.teamInfo.fbUserID,r);p.id=i;let A=t.rootRepository.org(t.teamInfo.fbTeamID).run(i);await A.updateHeartbeat({runStatus:"initializing"});let f=Mle(c,A,p.runType);try{let h=Math.max(...Object.values(a.runDetails.dividedStepDataWithWorkspaceEdits).map(I=>Object.keys(I).length)),y=await lO.New(d,t,c,sZ(h,a.runDetails.parallelism));return Bin(t,new DE(y.getConnection(),d),i,p,u,y,c,f,(0,QFt.GetPool)())}catch(h){try{await f()}catch(y){Oa.error("Unable to clean up hearbeat after handling error",h,"innerError",y)}throw h}},QBc=async(r,t,n,i,o)=>{Oa.infoContext(o,`Starting refresh job coa-${r}`);let a=kSi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),u=d$e(a.runDetails.environmentID),c={...o,workspaceID:u},l=await pEe(t.rootRepository,t.teamInfo,u);await Tyt(t.teamInfo.fbTeamID,t.teamInfo.fbUserID,u,a.userCredentials,l);let d=await bF(t.rootRepository,t.teamInfo,u,MFt(a.userCredentials));a.runTimeParameters=await CF(t.rootRepository,t.teamInfo.fbTeamID,u,a.runTimeParameters),Rin(a);let p=Tin(a,d,t.teamInfo.fbUserID,r);p.id=i;let A=t.rootRepository.org(t.teamInfo.fbTeamID),f=A.run(i);await f.updateHeartbeat({runStatus:"initializing"});let h=Mle(c,f,p.runType);try{let y=await DIe(t,u,A),I=await b6e(t.firebase,t.teamInfo.fbTeamID,p,y);await a$e(p,I,y,f);let v=EF(d,t.teamInfo.fbUserID),O=await lO.New(d,t,c,sZ(I.size,a.runDetails.parallelism));return DFt(t,new DE(O.getConnection(),d),p,u,i,O,v,c,y,I,h,(0,QFt.GetPool)())}catch(y){try{await h()}catch(I){Oa.error("Unable to clean up hearbeat after handling error",y,"innerError",I)}throw y}},PBc=async(r,t,n,i,o)=>{Oa.infoContext(o,`Starting re-run job coa-${r}`);let s=FSi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),a=new Kye(s);tb(a);let u=Crs(a.runDetails.runID),c=await s$e(t.firebase.firestore(),t.teamInfo.fbTeamID,u);if(!c)throw new Error(`Could not find runInfo for teamID=${t.teamInfo.fbTeamID}, oldRunID=${u}`);if(!Tdt(c))throw new Error("Run is not eligible for rerun or a dev run");let l=d$e(c.runDetails.environmentID),d={...o,workspaceID:l},p=await pEe(t.rootRepository,t.teamInfo,l);await Tyt(t.teamInfo.fbTeamID,t.teamInfo.fbUserID,l,a.userCredentials,p);let A=await bF(t.rootRepository,t.teamInfo,l,MFt(a.userCredentials)),f=await Din(t.rootRepository,a,c,A,t.teamInfo,r);f.id=i;let h=d$e(f.runDetails.environmentID);gu("RUNNER_BACKEND",h===l,d,"Unexpected mismatch between workspace IDs for re-run and original run; workspace for re-run:",h,"workspace for original run:",l);let y=t.rootRepository.org(t.teamInfo.fbTeamID),I=y.run(i);await I.updateHeartbeat({runStatus:"initializing"});let v=Mle(d,I,f.runType);try{let O=await DIe(t,h,y),_=await b6e(t.firebase,t.teamInfo.fbTeamID,f,O);await a$e(f,_,O,I);let w=EF(A,t.teamInfo.fbUserID),P=await lO.New(A,t,d,sZ(_.size,f.runDetails.parallelism));return DFt(t,new DE(P.getConnection(),A),f,l,i,P,w,d,O,_,v,(0,QFt.GetPool)())}catch(O){try{await v()}catch(_){Oa.error("Unable to clean up hearbeat after handling error",O,"innerError",_)}}},Ors=async r=>{if(Oa.debug("Cloud entrypoint."),!process.env.SCHEDULER_ADDRESS){let o="No SCHEDULER_ADDRESS defined for cloud entrypoint";throw Oa.emerg(o),new Error(o)}let t=await aZ(process.env.COALESCE_COA_CLOUD_TOKEN,void 0,new URL(process.env.SCHEDULER_ADDRESS)),n={orgID:t.teamInfo.fbTeamID,userID:t.teamInfo.fbUserID};Oa.infoContext(n,"Authenticated user.");let i;try{await KFi(t.firebase.firestore(),t.teamInfo.fbTeamID)&&(U$t(),Oa.debugContext(n,"CloudEntry: super Debug enabled"));let s=parseInt(process.env.COALESCE_COA_CLOUD_RUN_COUNTER);if(Number.isNaN(s))throw new Error(`Unable to parse runCounter: ${process.env.COALESCE_COA_CLOUD_RUN_COUNTER}!`);let a={...n,runID:s},u=process.env.COALESCE_COA_CLOUD_REQUEST_PATH;if(!u)throw new Gt("COALESCE_COA_CLOUD_REQUEST_PATH not set!");let c=iJt(WN(t.firebase.name)),l=D0e(c,u);Oa.infoContext(a,"Downloading request data...");let d=await $yn(l);Oa.infoContext(a,"Downloading request data completed!"),Oa.infoContext(a,"Deleting request data..."),await lrt(l),Oa.infoContext(a,"Deleting request data completed!"),Oa.infoContext(a,"Parsing request data as JSON...");let p=JSON.parse(Buffer.from(d).toString());Oa.infoContext(a,"Parsing request data as JSON completed!"),Oa.infoContext(a,"Renderer started!");let A=[r,t,p,s,a];switch(process.env.COALESCE_COA_CLOUD_ACTION){case"deploy":i=NBc(...A);break;case"refresh":i=QBc(...A);break;case"rerun":i=PBc(...A);break;default:throw new Gt(`Error: COALESCE_COA_CLOUD_ACTION is invalid! value=${process.env.COALESCE_COA_CLOUD_ACTION}`)}}catch(o){Oa.errorContext(n,"Error starting coa run",o);let s={error:{errorString:Iat(o),errorDetail:""},statusCode:500};o instanceof Gt?(s.error=o.toTRunError().error,s.statusCode=o.statusCode()):(s.error.errorString=o.error?.errorString??s.error.errorString,s.error.errorDetail=o.error?.errorDetail??s.error.errorDetail,s.statusCode=o.statusCode??s.statusCode),await Ep(1);return}try{Oa.infoContext(n,"Job started. Waiting for completion..."),await i,Oa.infoContext(n,"Job completed without exception!"),await Ep(0)}catch(o){Oa.errorContext(n,"Job completed with exception!",o),await Ep(1)}};var qrs=St(Lrs(),1),{program:mup,createCommand:yup,createArgument:Eup,createOption:bup,CommanderError:Cup,InvalidArgumentError:Urs,InvalidOptionArgumentError:Iup,Command:jrs,Argument:vup,Option:j6,Help:xup}=qrs.default;ait();var scs=St(Za());var PBe=St(require("fs")),acs=St(Vrs());li();var Yrs={openapi:"3.0.3",info:{version:"1.0.0",title:"Coalesce API",description:"REST API for performing operations with the Coalesce backend."},servers:[{url:"https://app.coalescesoftware.io",description:"US primary"},{url:"https://app.centralus.azure.coalescesoftware.io",description:"US primary Azure"},{url:"https://app.eu.coalescesoftware.io",description:"Europe primary"},{url:"https://app.australia-southeast1.gcp.coalescesoftware.io",description:"Australia primary"},{url:"https://app.us-east-1.aws.coalescesoftware.io",description:"US AWS US East"},{url:"https://app.us-east-1.aws.privatelink.coalescesoftware.io",description:"US AWS US East with PrivateLink"},{url:"https://app.us-west-2.aws.coalescesoftware.io",description:"US AWS US West"},{url:"https://app.us-west-2.aws.privatelink.coalescesoftware.io",description:"US AWS US West with PrivateLink"}],security:[{BearerAuth:[]}],"x-coa-private-pointers":["/paths/~1api~1v2~1render","/paths/~1api~1v2~1render~1health","/components/schemas/PackageDefinition","/components/schemas/RenderRequestV2"],components:{schemas:{EnvironmentsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of environment information.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/Environment"}},{type:"array",items:{$ref:"#/components/schemas/EnvironmentSummary"}}]}}},ProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/Project"}}}},ProjectResponse:{type:"object",required:["project"],properties:{project:{description:"Information about a project.",$ref:"#/components/schemas/Project"}}},TypesenseConfigResponse:{description:"Summary of configuration data for Typesense in a given org.","x-coa-private":!0,type:"object",required:["typesenseKey","typesenseHosts"],properties:{typesenseKey:{description:"The Typesense access key scoped to a users org.",type:"string"},typesenseHosts:{description:"The Typesense host address(es) for our cluster(s).",type:"array",items:{type:"string"}}}},EnvironmentSummary:{type:"object",description:"Summary information about an environment.",additionalProperties:!1,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string"},name:{type:"string"},project:{type:"string"},status:{$ref:"#/components/schemas/EnvironmentHealth"}},required:["createdAt","id","name","project","status"]},ErrorResponse:{description:"Error detail in addition to the HTTP status code and text.",type:"object",required:["error"],properties:{error:{$ref:"#/components/schemas/Error"}}},NodesResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of nodes for an environment.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/NodeSummary"}},{type:"array",items:{$ref:"#/components/schemas/Node"}}]}}},NodeSummary:{type:"object",properties:{database:{type:"string"},id:{type:"string"},locationName:{type:"string"},name:{type:"string"},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string"}},required:["database","id","locationName","name","nodeType","schema"]},OrderByDirection:{description:"The sort order for query results.",type:"string",enum:["asc","desc"]},PackageCreateEntity:{description:"A single package entity to be created.","x-coa-private":!0,type:"object",properties:{macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}}},required:["macros","dependencies","nodeTypes"]},PackageDependency:{description:"A package dependency.","x-coa-private":!0,type:"object",required:["version","macros","dependencies","releaseID","alias","packageID"],properties:{packageID:{type:"string"},alias:{type:"string"},version:{type:"string"},releaseID:{type:"string"},macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}}},example:{name:"foo",version:"1.2.3",macros:"{% macro bar() %}hello,{% endmacro %}",nodeTypes:{},dependencies:{dep:{name:"baz",version:"1.1.1",macros:"{% macro bar() %}world!{% endmacro %}",dependencies:{}}}}},PackageEntityTagV1:{description:"Identifies the package from which the entity came. (Deprecated, see PackageEntityTagV2).","x-coa-private":!0,type:"object",required:["id","version"],properties:{id:{type:"string"},version:{type:"string"}}},PackageEntityTagV2:{description:"Identifies the package from which the entity came.","x-coa-private":!0,type:"object",required:["id","releaseID"],properties:{id:{type:"string"},releaseID:{type:"string"}}},PackageMacro:{description:"A macro in a package.","x-coa-private":!0,type:"string"},PackageNodeType:{description:"A node type in a collection of nodeTypes to be packaged.","x-coa-private":!0,type:"object",required:["name","version","isDisabled","metadata"],properties:{name:{type:"string"},version:{type:"number"},id:{type:"string"},isDisabled:{type:"boolean"},metadata:{type:"object"},packageInfo:{type:"object"}}},PackageCreateReleaseInfo:{description:"Package release information for a create operation.","x-coa-private":!0,type:"object",properties:{changeLog:{type:"string"},version:{type:"string"},certified:{type:"boolean"}},required:["changeLog","version"]},PackageCreateEntities:{description:"Entities that are part of a package release.","x-coa-private":!0,required:["dependencies","nodeTypes","macros"],properties:{dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}},macros:{type:"string"}}},RunsOrderBy:{description:"The field used to sort query results.",type:"string",enum:["id","runStartTime","runEndTime"],default:"id"},RunsResponse:{description:"A collection of runs.",type:"object",required:["limit","orderBy","orderByDirection","data"],properties:{limit:{description:"The maximum number of runs returned by this query.",type:"integer"},orderByDirection:{$ref:"#/components/schemas/OrderByDirection"},orderBy:{$ref:"#/components/schemas/RunsOrderBy"},data:{description:"A collection of runs.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/RunSummary"}},{type:"array",items:{$ref:"#/components/schemas/RunInfo"}}]}}},RunResultsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of run results.",type:"array",items:{$ref:"#/components/schemas/RunResult"}}}},RunSummary:{type:"object",properties:{id:{description:"The run ID.",type:"integer"},reRunID:{description:"If this is a re-run, the ID of the original operation.",type:"string"},runStartTime:{description:"The datetime at which the run started.",type:"string",format:"date-time"},runEndTime:{description:"The datetime at which the run ended.",type:"string",format:"date-time"},runType:{$ref:"#/components/schemas/RunType"},runStatus:{$ref:"#/components/schemas/RunStatus"},environmentID:{description:"The environment in which the run operation was applied.",type:"string"},runFailureReason:{description:"Information about the cause of a run failure.",type:"string"}},required:["id","runType","runStatus"]},DatabaseInfoResponse:{type:"object",required:["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId","measurementId"],properties:{apiKey:{type:"string"},authDomain:{type:"string"},projectId:{type:"string"},storageBucket:{type:"string"},messagingSenderId:{type:"string"},appId:{type:"string"},measurementId:{type:"string"},emulatorInfo:{type:"object",required:["auth","firestore","storage"],properties:{auth:{type:"string"},firestore:{type:"string"},storage:{type:"string"}}}}},UserEnvironmentRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserEnvironmentRoles"},additionalProperties:!1},UserProjectRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserProjectRoles"},additionalProperties:!1},UserRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserOrgRoles"},additionalProperties:!1},FivetranProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/FivetranProject"}}}},FivetranProjectResponse:{type:"object",required:["project"],properties:{project:{description:"Fivetran project data.",$ref:"#/components/schemas/FivetranProject"}}},FivetranJobsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of job information.",type:"array",items:{$ref:"#/components/schemas/FivetranJob"}}}},FivetranJobHistoryResponse:{type:"object",required:["jobHistory"],properties:{jobHistory:{description:"Fivetran job history data.",$ref:"#/components/schemas/FivetranJobHistory"}}},FivetranRefreshJobResponse:{type:"object",required:["jobHistory"],properties:{jobHistory:{description:"A fivetran job",$ref:"#/components/schemas/FivetranJobHistory"}}},BaseEnvironment:{type:"object",description:"An environment is used for deploying your data pipeline to non-development Snowflake environments.",additionalProperties:!0,properties:{connectionAccount:{type:"string"},defaultStorageMapping:{type:"string",nullable:!0},description:{type:"string"},name:{type:"string"},oauthEnabled:{type:"boolean"},runTimeParameters:{type:"object",additionalProperties:!0},tagColors:{$ref:"#/components/schemas/TagColor"},project:{type:"string"}},required:["name","oauthEnabled","project"]},Environment:{description:"An environment is used for deploying your data pipeline to non-development Snowflake environments.",allOf:[{$ref:"#/components/schemas/BaseWorkspaceEnv"},{type:"object",additionalProperties:!0,properties:{runTimeParameters:{type:"object",additionalProperties:!0},currentMappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},required:["createdAt","id","status"]}]},EnvironmentCreateRequest:{"x-coa-private":!0,type:"object",description:"Initial values to set on a newly created environment.",allOf:[{$ref:"#/components/schemas/BaseEnvironment"},{type:"object",properties:{mappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},additionalProperties:!0}]},EnvironmentHealth:{type:"string",enum:["Deleting","Deploying","Failed Deploy","Failed Dev Run","Failed Refresh","Initializing","Refreshing","Running Dev Run","Waiting"]},EnvironmentStorageLocationMappings:{type:"object",additionalProperties:{type:"object",properties:{database:{type:"string"},schema:{type:"string"}}}},BaseProject:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",additionalProperties:!0,properties:{description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},required:["name"]},Project:{description:"A project groups environments and workspaces for easier management and access control.",allOf:[{$ref:"#/components/schemas/BaseProject"},{type:"object",additionalProperties:!0,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},updatedAt:{type:"string",format:"date-time"},updatedBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string"},status:{$ref:"#/components/schemas/ProjectStatus"},workspaces:{type:"array",items:{$ref:"#/components/schemas/WorkspaceSummary"}}},required:["createdAt","updatedAt","id","status","name"]}]},ProjectCreateRequest:{$ref:"#/components/schemas/BaseProject"},ProjectStatus:{type:"string",enum:["active","deleted"]},UserSummary:{type:"object",description:"Summary information about a user.",additionalProperties:!1,properties:{id:{type:"string"},firstName:{type:"string"},lastName:{type:"string"}},required:["id"]},FirestoreWebTimestamp:{type:"object",description:"Timestamp from the web Firestore SDK.",additionalProperties:!1,properties:{seconds:{type:"number"},nanoseconds:{type:"number"}},required:["seconds","nanoseconds"]},FirestoreAdminTimestamp:{type:"object",description:"Timestamp from the admin Firestore SDK.",additionalProperties:!1,properties:{_seconds:{type:"number"},_nanoseconds:{type:"number"}},required:["_seconds","_nanoseconds"]},FirestoreTimestamp:{type:"object",description:"Timestamp from either the web admin Firestore SDKs.",oneOf:[{$ref:"#/components/schemas/FirestoreWebTimestamp"},{$ref:"#/components/schemas/FirestoreAdminTimestamp"}]},Error:{type:"object",additionalProperties:!1,properties:{errorString:{description:"The error message.",type:"string"},errorDetail:{description:"Additional detail about the error.",type:"string"}},required:["errorString"]},Node:{type:"object",oneOf:[{$ref:"#/components/schemas/SourceNode"},{$ref:"#/components/schemas/SQLNode"}]},AliasToStepIDMapping:{type:"object",additionalProperties:{type:"string"}},AppliedColumnTests:{type:"object",additionalProperties:{type:"boolean"}},BaseNode:{type:"object",additionalProperties:!0,properties:{database:{type:"string"},description:{type:"string"},id:{type:"string"},locationName:{type:"string"},name:{type:"string"},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string"}},required:["database","description","id","locationName","name","nodeType","schema"]},ColumnMetadata:{type:"object",additionalProperties:!1,properties:{appliedColumnTests:{$ref:"#/components/schemas/AppliedColumnTests"},columnID:{type:"string"},columnReferences:{items:{$ref:"#/components/schemas/IntermediateColumnRefResult"},type:"array"},config:{type:"object",additionalProperties:!0},dataType:{type:"string"},defaultValue:{type:"string"},description:{type:"string"},hashDetails:{$ref:"#/components/schemas/HashMetadata"},hashedColumns:{type:"array",items:{$ref:"#/components/schemas/ColumnReference"}},isBusinessKey:{type:"boolean",description:"Tags the column as a business key."},isChangeTracking:{type:"boolean",description:"Tags the column as a change tracking column in type 2 dimensions."},isSurrogateKey:{type:"boolean",description:"Tags the column as a surrogate key, e.g. DIM_CUSTOMER_KEY."},keyColumnType:{type:"string",enum:["None","primaryBusinessKey","surrogateKey"]},name:{type:"string"},nullable:{type:"boolean"},primaryKey:{description:"Tags the column as a primary key.",type:"boolean"},sources:{items:{$ref:"#/components/schemas/SourceColumnReference"},type:"array"},systemColumnType:{type:"string",enum:["None","sysCreateDate","sysCurrentFlag","sysEndDate","sysStartDate","sysUpdateDate","sysVersion"]},transform:{type:"string"},uniqueKey:{type:"boolean"}},required:["columnID","dataType","description","name","nullable"]},ColumnReference:{type:"object",additionalProperties:!1,properties:{columnID:{type:"string"},nodeID:{type:"string"}},required:["columnID","nodeID"]},CustomSQL:{type:"object",additionalProperties:!1,properties:{customSQL:{type:"string"}},required:["customSQL"]},HashAlgorithm:{type:"string",enum:["MD5","SHA1","SHA256"]},HashMetadata:{type:"object",additionalProperties:!1,properties:{hashAlgorithm:{$ref:"#/components/schemas/HashAlgorithm"},hashType:{enum:["ChangeHash","Hash","HubHash","LinkHash","None"],type:"string"},hubHashes:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"}},required:["hashAlgorithm"]},IntermediateColumnRefResult:{additionalProperties:!1,properties:{columnName:{type:"string"},tableName:{type:"string",nullable:!0}},required:["columnName","tableName"],type:"object"},JoinCondition:{type:"object",additionalProperties:!1,properties:{joinCondition:{type:"string"}},required:["joinCondition"]},NodeType:{anyOf:[{type:"string",enum:["Dimension","Fact","Hub","Link","Satellite","Source","Stage","View","persistentStage"]},{type:"string"}]},RefLink:{type:"object",additionalProperties:!1,properties:{locationName:{type:"string"},nodeName:{type:"string"}},required:["locationName","nodeName"]},SourceColumnReference:{anyOf:[{$ref:"#/components/schemas/SourceColumnReferenceV1"},{$ref:"#/components/schemas/SourceColumnReferenceV2"}]},SourceColumnReferenceV1:{type:"object",additionalProperties:!1,properties:{columnReferences:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"},transform:{type:"string"}},required:["columnReferences","transform"]},SourceColumnReferenceV2:{type:"object",additionalProperties:!1,properties:{transform:{type:"string"}},required:["transform"]},SourceMap:{additionalProperties:!1,properties:{aliases:{$ref:"#/components/schemas/AliasToStepIDMapping"},customSQL:{$ref:"#/components/schemas/CustomSQL"},dependencies:{items:{$ref:"#/components/schemas/RefLink"},type:"array"},join:{$ref:"#/components/schemas/JoinCondition"},name:{type:"string"},noLinkRefs:{items:{$ref:"#/components/schemas/RefLink"},type:"array"}},required:["dependencies","join","name","noLinkRefs"],type:"object"},RunStatus:{enum:["canceled","completed","failed","initializing","rendering","running","waitingToRun"],type:"string"},RunType:{enum:["deploy","refresh"],type:"string"},UserConnectionType:{type:"string",enum:["Basic","Cloud","KeyPair","OAuth"]},DeployRunDetails:{type:"object",additionalProperties:!1,properties:{canceled:{type:"boolean"},deployCommit:{type:"string"},deployCommitMessage:{type:"string"},environmentID:{type:"string"},parallelism:{type:"integer"},nodesInRun:{type:"integer"}},required:["deployCommit","environmentID"]},RefreshRunDetails:{type:"object",additionalProperties:!1,properties:{canceled:{type:"boolean"},environmentID:{type:"string"},excludeNodesSelector:{type:"string"},forceIgnoreEnvironmentStatus:{type:"boolean"},includeNodesSelector:{type:"string"},jobID:{type:"integer"},parallelism:{type:"integer"},refreshDescription:{type:"string"},nodesForRefresh:{type:"integer"},nodesInRun:{type:"integer"}},required:["environmentID"]},RunDetails:{description:"Detailed information about a run.",anyOf:[{$ref:"#/components/schemas/DeployRunDetails"},{$ref:"#/components/schemas/RefreshRunDetails"}]},RunInfo:{description:"The full details of a run, without the run results.",type:"object",additionalProperties:!1,properties:{id:{type:"integer"},reRunID:{type:"string"},runDetails:{$ref:"#/components/schemas/RunDetails"},runEndTime:{format:"date-time",type:"string"},runHistory:{items:{type:"integer"},type:"array"},runStartTime:{format:"date-time",type:"string"},runStatus:{$ref:"#/components/schemas/RunStatus"},runTimeParameters:{type:"object",additionalProperties:!0},runType:{$ref:"#/components/schemas/RunType"},userCredentials:{$ref:"#/components/schemas/SnowflakeUserCredentials"},userID:{type:"string"},version:{type:"integer"}},required:["id","runDetails","runStatus","runTimeParameters","runType"]},SnowflakeUserCredentials:{description:"Information about the Snowflake account used to perform a run.",type:"object",additionalProperties:!1,properties:{snowflakeAccount:{type:"string"},snowflakeAuthType:{$ref:"#/components/schemas/UserConnectionType"},snowflakeRole:{type:"string"},snowflakeUsername:{type:"string"},snowflakeWarehouse:{type:"string"}},required:["snowflakeAccount","snowflakeAuthType","snowflakeUsername"]},QueryResult:{type:"object",additionalProperties:!1,properties:{endTime:{type:"string",format:"date-time"},error:{$ref:"#/components/schemas/Error"},isRunning:{type:"boolean"},name:{type:"string"},queryID:{type:"string"},rowsDeleted:{type:"integer"},rowsInserted:{type:"integer"},rowsUpdated:{type:"integer"},sql:{type:"string"},startTime:{type:"string",format:"date-time"},status:{type:"string"},success:{type:"boolean"},warehouse:{type:"string"}},required:["isRunning","name","sql","status","success"]},RunResult:{type:"object",additionalProperties:!1,description:"The result output describing each query processed during a run.",properties:{isRunning:{type:"boolean"},name:{type:"string"},nodeID:{type:"string"},queryResults:{items:{$ref:"#/components/schemas/QueryResult"},type:"array"},renderQueryResult:{$ref:"#/components/schemas/QueryResult"}},required:["isRunning","name","nodeID","queryResults"]},OrgRoles:{type:"object",description:"Specifies role assignments.",required:["organizationRoles","projects"],properties:{organizationRoles:{description:"The organization roles assigned to the user.",type:"array",items:{type:"string"}},projects:{description:"A dictionary of project role assignments keyed by project ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/ProjectRoles"}}},additionalProperties:!0},ProjectRoles:{type:"object",description:"Specifies project role assignments.",required:["projectRoles","environments"],properties:{projectRoles:{type:"array",items:{type:"string"}},environments:{description:"A dictionary of environment role assignments keyed by environment ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/EnvironmentRoles"}}},additionalProperties:!0},EnvironmentRoles:{type:"object",description:"Specifies environment role assignments.",required:["environmentRoles"],properties:{environmentRoles:{description:"The environment roles assigned to the user.",type:"array",items:{type:"string"}}},additionalProperties:!0},UserOrgRoles:{description:"The roles assigned to a user.",allOf:[{$ref:"#/components/schemas/OrgRoles"},{type:"object",required:["user","organizationRoles","projects"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserProjectRoles:{description:"The project roles assigned to the user.",allOf:[{$ref:"#/components/schemas/ProjectRoles"},{type:"object",required:["user","projectRoles","environments"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserEnvironmentRoles:{description:"The environment roles assigned to the user.",allOf:[{$ref:"#/components/schemas/EnvironmentRoles"},{type:"object",required:["user"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},FivetranProject:{type:"object",properties:{id:{type:"string"},name:{type:"string"},createdAtUtc:{type:"string",format:"date-time"},updatedAtUtc:{type:"string",format:"date-time"},extras:{type:"object",description:"Additional data, if applicable"}},required:["id","name","createdAtUtc","updatedAtUtc"]},FivetranJob:{type:"object",properties:{id:{type:"string"},projectId:{type:"string"},name:{type:"string"},createdAtUtc:{type:"string",format:"date-time"},updatedAtUtc:{type:"string",format:"date-time"},extras:{type:"object",description:"Additional data, if applicable"}}},FivetranJobHistory:{type:"object",properties:{id:{type:"string"},jobId:{type:"string"},status:{$ref:"#/components/schemas/FivetranJobStatus"},startedAtUtc:{type:"string",format:"date-time",nullable:!0},endedAtUtc:{type:"string",format:"date-time",nullable:!0},logs:{type:"array",items:{type:"string"}},extras:{type:"object",description:"Additional data, if applicable"}}},FivetranJobStatus:{type:"string",description:"Possible statuses of jobs",enum:["NEW","SCHEDULING","RUNNING","COMPLETED","TERMINATING","PAUSED","STOPPED","FAILED"]},RegistryPackageReleaseResult:{description:"A single release of a package in the registry.",type:"object",properties:{createdBy:{type:"string"},createdAt:{type:"string",format:"date-time"},updatedBy:{type:"string"},updatedAt:{type:"string",format:"date-time"},version:{type:"string"},changeLog:{type:"string"},releaseID:{type:"string"},storagePath:{type:"string"},privacy:{type:"string",enum:["public","private","unlisted"]}},required:["createdBy","createdAt","version","changeLog","releaseID","storagePath","privacy"]},RegistryPackageResult:{description:"A single package in the registry.",type:"object",properties:{updatedBy:{type:"string"},updatedAt:{type:"string",format:"date-time"},name:{type:"string"},publisherID:{type:"string"},description:{type:"string"},org:{type:"string"},latestRelease:{type:"string"},overview:{type:"string"},featured:{type:"boolean"},tags:{type:"array",minItems:0,items:{type:"string"}},certified:{type:"boolean"},packageID:{type:"string"}},required:["name","description","org","latestRelease","overview","tags","featured","certified","publisherID","packageID"]},BaseWorkspaceEnv:{type:"object",description:"A workspace is a collection of resources that are used to develop, test, and deploy code.",additionalProperties:!0,properties:{connectionAccount:{type:"string"},defaultStorageMapping:{type:"string",nullable:!0},description:{type:"string"},name:{type:"string"},oauthEnabled:{type:"boolean"},tagColors:{$ref:"#/components/schemas/TagColor"},project:{type:"string"},createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},updatedAt:{type:"string",format:"date-time"},currentGitBranch:{type:"string"},currentGitCommit:{type:"string"},currentGitURL:{type:"string"},currentlyRunningJobs:{type:"array",items:{type:"integer"}},id:{type:"string"},deployedCommit:{type:"string"},status:{$ref:"#/components/schemas/WorkspaceEnvHealth"}},required:["createdAt","updatedAt","id","name","oauthEnabled","project","status"]},Workspace:{allOf:[{$ref:"#/components/schemas/BaseWorkspaceEnv"},{type:"object",additionalProperties:!0,properties:{mappingsV1:{type:"string"},runTimeParameters:{type:"string"},jobs:{type:"array",items:{$ref:"#/components/schemas/Job"}}}}]},WorkspaceSummary:{type:"object",description:"A set of minimal workspace data.",additionalProperties:!0,properties:{id:{type:"string"},name:{type:"string"},project:{type:"string"},status:{$ref:"#/components/schemas/WorkspaceEnvHealth"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},jobs:{type:"array",items:{$ref:"#/components/schemas/Job"}}},required:["createdAt","createdBy","updatedAt","id","name","status","project"]},WorkspaceEnvHealth:{type:"string",enum:["Deleting","Deploying","Failed Deploy","Failed Refresh","Initializing","Refreshing","Waiting"]},TagColor:{type:"object",additionalProperties:!1,properties:{backgroundColor:{type:"string"},textColor:{type:"string"}}},SourceColumnMetadata:{type:"object",additionalProperties:!1,properties:{columns:{items:{$ref:"#/components/schemas/ColumnMetadata"},type:"array"},join:{type:"object",additionalProperties:!1,properties:{joinCondition:{type:"string"}},required:["joinCondition"]},sourceMapping:{type:"array",items:{$ref:"#/components/schemas/SourceMap"}}},required:["columns"]},SourceNode:{type:"object",allOf:[{$ref:"#/components/schemas/BaseNode"}],additionalProperties:!0,properties:{metadata:{$ref:"#/components/schemas/SourceColumnMetadata"},table:{type:"string"}},required:["database","description","locationName","metadata","name","nodeType","schema","table"]},MaterializationType:{type:"string",enum:["table","view"]},NodeTest:{type:"object",additionalProperties:!1,properties:{continueOnFailure:{type:"boolean"},description:{type:"string"},name:{type:"string"},runOrder:{$ref:"#/components/schemas/TestRunOrder"},templateString:{type:"string"}},required:["continueOnFailure","description","name","runOrder","templateString"]},SQLNode:{type:"object",allOf:[{$ref:"#/components/schemas/BaseNode"}],additionalProperties:!0,properties:{config:{$ref:"#/components/schemas/UserConfig"},isMultisource:{type:"boolean"},materializationType:{$ref:"#/components/schemas/MaterializationType"},metadata:{$ref:"#/components/schemas/SQLNodeMetadata"},overrideSQL:{type:"boolean"}},required:["config","database","description","isMultisource","locationName","materializationType","metadata","name","nodeType","overrideSQL","schema"]},SQLNodeMetadata:{type:"object",additionalProperties:!1,properties:{appliedNodeTests:{default:[],items:{$ref:"#/components/schemas/NodeTest"},type:"array"},columns:{default:[],items:{$ref:"#/components/schemas/ColumnMetadata"},type:"array"},cteString:{type:"string"},description:{type:"string"},destinationName:{type:"string"},enabledColumnTestIDs:{type:"array",items:{type:"string"}},mapping:{type:"object",additionalProperties:{anyOf:[{type:"object"},{type:"string"},{type:"number"},{type:"boolean"}]}},materializationOption:{type:"string"},sourceMapping:{type:"array",items:{$ref:"#/components/schemas/SourceMap"}}},required:["appliedNodeTests","columns","enabledColumnTestIDs","sourceMapping"]},TestRunOrder:{type:"string",enum:["After","Before"]},UserConfig:{type:"object",additionalProperties:{anyOf:[{type:"object"},{type:"string"},{type:"number"},{type:"boolean"}]}},Job:{type:"object",description:"A coalesce job.",additionalProperties:!0,properties:{id:{type:"string"},name:{type:"string"},includeSelector:{type:"string"},excludeSelector:{type:"string"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","name","includeSelector","excludeSelector","createdAt","updatedAt"]}},responses:{CoaTagResponse:{description:"The coa image tag being used.","x-coa-private":!0,content:{"application/json":{schema:{type:"string"}}}},CoaTagReportResponse:{description:"A report of what coa image tags are being used for what orgs.","x-coa-private":!0,content:{"application/json":{schema:{type:"object",required:["defaultTag","deviatingOrgs"],properties:{defaultTag:{type:"string"},deviatingOrgs:{type:"array",items:{type:"object",required:["orgID","orgName","tag","image"],properties:{orgID:{type:"string"},orgName:{type:"string"},tag:{type:"string"},image:{type:"string"}}}}}}}}},CustomTokenResponse:{description:"The Coalesce custom token response","x-coa-private":!0,content:{"application/json":{schema:{type:"object",required:["customToken"],properties:{customToken:{description:"A Coalesce token",type:"string"}}}}}},EnvironmentResponse:{description:"Information about an environment.",content:{"application/json":{schema:{$ref:"#/components/schemas/Environment"}}}},EnvironmentsResponse:{description:"A collection of environment information.",content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentsResponse"}}}},ProjectsResponse:{description:"A collection of project information.",content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectsResponse"}}}},FivetranProjectsResponse:{description:"A collection of project information.",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranProjectsResponse"}}}},FivetranJobsResponse:{description:"A collection of Fivetran job information.",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranJobsResponse"}}}},FivetranJobHistoryResponse:{description:"Fivetran job history data.",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranJobHistoryResponse"}}}},FivetranRefreshJobResponse:{description:"The Fivetran start job refresh response.",content:{"application/json":{schema:{type:"object",required:["jobHistory"],properties:{jobHistory:{description:"Fivetran job history for the new run.",$ref:"#/components/schemas/FivetranJobHistory"}}}}}},NodeResponse:{description:"A node for an environment.",content:{"application/json":{schema:{$ref:"#/components/schemas/Node"}}}},NodesResponse:{description:"A collection of nodes for an environment.",content:{"application/json":{schema:{$ref:"#/components/schemas/NodesResponse"}}}},PackageResponse:{description:"A package registration","x-coa-private":!0,content:{"application/json":{schema:{type:"object",required:["releaseID","packageID","storePath","publisherID"],properties:{releaseID:{type:"string"},publisherID:{type:"string"},packageID:{type:"string"},storePath:{type:"string"}}}}}},PackageUpdateResponse:{description:"Successful package update","x-coa-private":!0,content:{"application/json":{schema:{type:"string"}}}},AllRegistryPackagesResult:{description:"A list of all packages in the registry.",content:{"application/json":{schema:{type:"array",minItems:0,items:{$ref:"#/components/schemas/RegistryPackageResult"}}}}},AllRegistryPackageReleasesResult:{description:"A list of all releases for a single package in the registry.",content:{"application/json":{schema:{type:"array",minItems:1,items:{$ref:"#/components/schemas/RegistryPackageReleaseResult"}}}}},RegistryPackageResult:{description:"A single package in the registry.",content:{"application/json":{schema:{$ref:"#/components/schemas/RegistryPackageResult"}}}},RegistryPackageReleaseResult:{description:"A single release for a single package in the registry.",content:{"application/json":{schema:{$ref:"#/components/schemas/RegistryPackageReleaseResult"}}}},ProjectResponse:{description:"Information about a project.",content:{"application/json":{schema:{$ref:"#/components/schemas/Project"}}}},RunResultsResponse:{description:"A collection of results for a deploy or refresh run.",content:{"application/json":{schema:{$ref:"#/components/schemas/RunResultsResponse"}}}},RunResponse:{description:"A single run.",content:{"application/json":{schema:{$ref:"#/components/schemas/RunInfo"}}}},RunsResponse:{description:"A collection of runs.",content:{"application/json":{schema:{$ref:"#/components/schemas/RunsResponse"}}}},DatabaseInfoResponse:{description:"Information required to connect to the Coalesce database.",content:{"application/json":{schema:{$ref:"#/components/schemas/DatabaseInfoResponse"}}}},secretExists:{"x-coa-private":!0,description:"Specifies whether or not a value for the secret exists.",content:{"application/json":{schema:{type:"boolean"}}}},ValidHostname:{"x-coa-private":!0,description:"A whitelisted version of the passed hostname.",content:{"application/json":{schema:{type:"string"}}}},TypesenseConfigurationResponse:{"x-coa-private":!0,description:"The typesense configuration data for a given org.",content:{"application/json":{schema:{$ref:"#/components/schemas/TypesenseConfigResponse"}}}},UserEnvironmentRoleResponse:{description:"A user's environment role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentRoles"}}}},UserEnvironmentRolesResponse:{description:"A collection of user environment role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/UserEnvironmentRolesResponse"}}}},UserProjectRoleResponse:{description:"A user's project role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectRoles"}}}},UserProjectRolesResponse:{description:"A collection of user project role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/UserProjectRolesResponse"}}}},UserRoleResponse:{description:"A user's role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/OrgRoles"}}}},UserRolesResponse:{description:"A collection of user role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/UserRolesResponse"}}}},AlreadyExistsError:{description:"The requested resource already exists.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},BadGatewayError:{description:"The server received an error from an upstream system.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},ForbiddenError:{description:"The client is not permitted to perform the requested operation.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},GatewayTimeoutError:{description:"The server did not receive a response in time from an upstream system.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},InternalServerError:{description:"The server encountered an unexpected condition that prevented it from fulfilling the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},InvalidRequestError:{description:"The request was invalid.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},NotFoundError:{description:"The requested resource could not be found.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},ServiceUnavailableError:{description:"The service is currently unavailable.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},Unauthorized:{description:"User lacks authorization to perform this action."}},parameters:{orderByDirection:{name:"orderByDirection",description:"The sort order for query results.",in:"query",schema:{description:"The sort order for query results.",type:"string",enum:["asc","desc"],default:"desc"},required:!1},secretType:{"x-coa-private":!0,description:"The name of the secret type.",name:"secretType",in:"path",schema:{type:"string"},required:!0},context:{description:"Contextual information required to identify a particular secret.",name:"context",in:"path",schema:{type:"string"},required:!0},orgId:{"x-coa-private":!0,description:"The Organization ID of the organization that will be affected by the API call.",name:"orgId",in:"path",schema:{type:"string"},required:!0},runId:{"x-coa-private":!0,description:"The Run ID of the run that will be affected by the API call.",name:"runId",in:"path",schema:{type:"integer"},required:!0},coaTag:{"x-coa-private":!0,description:"A coa container image tag in Google Container Registry.",name:"coaTag",in:"path",schema:{type:"string"},required:!0}},securitySchemes:{BearerAuth:{type:"http",scheme:"bearer"}}},paths:{"/api/v1/customToken":{summary:"Custom Token","x-coa-private":!0,post:{summary:"Generate Custom Token",description:"Generate a Coalesce token from the provided OpenID Connect ID token",operationId:"GenerateCustomToken","x-eov-operation-handler":"SSOHandlers",requestBody:{description:"The information from the OpenID Connect authorization server required to sign into Coalesce.",required:!0,content:{"application/json":{schema:{type:"object",required:["idToken","accessToken","orgID"],properties:{idToken:{type:"string"},accessToken:{type:"string"},orgID:{type:"string"}},additionalProperties:!1}}}},security:[],tags:["Authorization"],responses:{"200":{$ref:"#/components/responses/CustomTokenResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments":{summary:"Environments","x-coa-command-group":"environments",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Environments",description:"Get a collection of environment information.",operationId:"GetEnvironments","x-eov-operation-handler":"EnvironmentHandlers","x-coa-command":"list",parameters:[{name:"detail",description:"Include the full detail of the environments.",in:"query",schema:{type:"boolean",default:!1},required:!1}],security:[{BearerAuth:[]}],tags:["Environments"],responses:{"200":{$ref:"#/components/responses/EnvironmentsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},post:{summary:"Create Environment",description:"Create a new environment.",operationId:"CreateEnvironment","x-eov-operation-handler":"EnvironmentHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Environments"],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentCreateRequest"}}}},responses:{"201":{$ref:"#/components/responses/EnvironmentResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments/{environmentID}":{summary:"Environment","x-coa-command-group":"environments",parameters:[{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],delete:{summary:"Delete Environment",description:"Delete an environment.",operationId:"DeleteEnvironment","x-eov-operation-handler":"EnvironmentHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Environments"],responses:{"204":{description:"The environment was successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},get:{summary:"Get Environment",description:"Get information about an environment.",operationId:"GetEnvironment","x-eov-operation-handler":"EnvironmentHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Environments"],responses:{"200":{$ref:"#/components/responses/EnvironmentResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments/{environmentID}/nodes":{summary:"Nodes","x-coa-command-group":"nodes",parameters:[{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Nodes",description:"Get a collection of nodes for an environment",operationId:"GetNodes","x-eov-operation-handler":"NodeHandlers","x-coa-command":"list",parameters:[{name:"detail",description:"Include the full detail of the nodes.",in:"query",schema:{type:"boolean",default:!1},required:!1}],security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodesResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments/{environmentID}/nodes/{nodeID}":{summary:"Node","x-coa-command-group":"nodes",parameters:[{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"nodeID",description:"The node ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"Get Node",description:"Get information about a node in an environment.",operationId:"GetNode","x-eov-operation-handler":"NodeHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodeResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/workspaces/{workspaceID}/nodes":{summary:"Nodes","x-coa-command-group":"workspace-nodes",parameters:[{name:"workspaceID",description:"The workspace ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Workspace Nodes",description:"Get a collection of nodes for a workspace (Preview).",operationId:"GetWorkspaceNodes","x-eov-operation-handler":"NodeHandlers","x-coa-command":"list",parameters:[{name:"detail",description:"Include the full detail of the nodes.",in:"query",schema:{type:"boolean",default:!1},required:!1}],security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodesResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/workspaces/{workspaceID}/nodes/{nodeID}":{summary:"Node","x-coa-command-group":"workspace-nodes",parameters:[{name:"workspaceID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"nodeID",description:"The node ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"Get Node",description:"Get information about a node in a workspace (Preview).",operationId:"GetWorkspaceNode","x-eov-operation-handler":"NodeHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodeResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{summary:"Set Node",description:"Replace all fields of a node in a workspace (Preview).",operationId:"SetWorkspaceNode","x-eov-operation-handler":"NodeHandlers","x-coa-command":"put",security:[{BearerAuth:[]}],tags:["Nodes"],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Node"}}}},responses:{"200":{$ref:"#/components/responses/NodeResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/projects":{summary:"Projects","x-coa-private":!0,get:{summary:"Get Projects",description:"Get projects in org.",operationId:"GetProjectsInOrg","x-eov-operation-handler":"ProjectHandlers",parameters:[{name:"includeWorkspaces",description:"Whether or not to include nested workspace data for all projects.",in:"query",schema:{type:"boolean"},required:!1},{name:"includeJobs",description:"Whether or not to include nested job data for all workspaces in the projects.",in:"query",schema:{type:"boolean"},required:!1}],security:[{BearerAuth:[]}],tags:["Projects"],responses:{"200":{$ref:"#/components/responses/ProjectsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},post:{summary:"Create Project",description:"Create a new project.",operationId:"CreateProject","x-eov-operation-handler":"ProjectHandlers",security:[{BearerAuth:[]}],tags:["Projects"],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectCreateRequest"}}}},responses:{"201":{$ref:"#/components/responses/ProjectResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/projects/{projectID}":{summary:"Projects","x-coa-command-group":"projects",parameters:[{name:"projectID",description:"The project ID.",in:"path",schema:{type:"string"},required:!0},{name:"includeWorkspaces",description:"Whether or not to include nested workspace data for all projects.",in:"query",schema:{type:"boolean"},required:!1},{name:"includeJobs",description:"Whether or not to include nested job data for all workspaces in the projects.",in:"query",schema:{type:"boolean"},required:!1}],get:{summary:"Get Project",description:"Get a project.",operationId:"GetProjectInOrg","x-eov-operation-handler":"ProjectHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Projects"],responses:{"200":{description:"Successful response",content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectResponse"}}}},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{summary:"Delete Project",description:"Delete a project.",operationId:"DeleteProject","x-eov-operation-handler":"ProjectHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Projects"],responses:{"204":{description:"The project was successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/projects":{summary:"Fivetran Projects","x-coa-private":!0,get:{summary:"Get Fivetran Projects",description:"Get fivetran projects in org.",operationId:"GetFivetranProjects","x-eov-operation-handler":"FivetranHandlers",security:[{BearerAuth:[]}],tags:["Projects"],responses:{"200":{$ref:"#/components/responses/FivetranProjectsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/projects/{projectId}":{get:{summary:"Gets a single Fivetran project.",operationId:"GetFivetranProject","x-eov-operation-handler":"FivetranHandlers",parameters:[{name:"projectId",in:"path",description:"The unique identifier for the project",required:!0,schema:{type:"string"}}],responses:{"200":{description:"Successful response",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranProjectResponse"}}}},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/projects/{projectId}/jobs":{summary:"Fivetran Jobs","x-coa-private":!0,get:{summary:"Get Fivetran jobs",description:"Get Fivetran jobs.",operationId:"GetFivetranJobs","x-eov-operation-handler":"FivetranHandlers",parameters:[{name:"projectId",in:"path",description:"The unique identifier for the project",required:!0,schema:{type:"string"}}],security:[{BearerAuth:[]}],tags:["Jobs"],responses:{"200":{$ref:"#/components/responses/FivetranJobsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/jobs/{jobId}/history/{historyId}":{summary:"Fivetran Job History","x-coa-private":!0,get:{parameters:[{name:"jobId",description:"The Fivetran job ID.",in:"path",schema:{type:"string"},required:!0},{name:"historyId",description:"The Fivetran history ID.",in:"path",schema:{type:"string"},required:!0}],summary:"Get Fivetran Job History",description:"Get Fivetran job history in org.",operationId:"GetFivetranJobHistory","x-eov-operation-handler":"FivetranHandlers",security:[{BearerAuth:[]}],tags:["Jobs"],responses:{"200":{$ref:"#/components/responses/FivetranJobHistoryResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/jobs/{jobId}/run":{summary:"Start a refresh job via Fivetran","x-coa-private":!0,post:{parameters:[{name:"jobId",description:"The Fivetran job ID.",in:"path",schema:{type:"string"},required:!0}],summary:"Start a refresh job via Fivetran",operationId:"PostFivetranJobRefresh","x-eov-operation-handler":"FivetranHandlers",security:[{BearerAuth:[]}],tags:["Jobs"],responses:{"201":{$ref:"#/components/responses/FivetranRefreshJobResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles":{summary:"User Roles","x-coa-private":!0,get:{summary:"List User Roles",description:"Get all user roles in the organization, filtered by information available based on the current user's roles and sorted alphabetically by last name, then by first name.",operationId:"GetUserRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],parameters:[{name:"excludeOrgRoles",description:"Exclude organization level roles from the results.",in:"query",schema:{type:"boolean"}},{name:"projectID",description:"Return only user roles pertaining to the specified project.",in:"query",schema:{type:"string"},required:!1},{name:"environmentID",description:"Return only user roles pertaining to the specified environment.",in:"query",schema:{type:"string"},required:!1}],responses:{"200":{$ref:"#/components/responses/UserRolesResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles/{userID}/organizationRoles":{summary:"Organization User Roles","x-coa-private":!0,parameters:[{name:"userID",description:"The user ID.",in:"path",schema:{type:"string"},required:!0}],put:{summary:"Create/Update User Organization Roles",description:"Creates or updates all of a user's organization roles. Only org admins may use this API.",operationId:"UpsertUserOrganizationRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],requestBody:{description:"The user's organization roles.",required:!0,content:{"application/json":{schema:{type:"array",items:{type:"string"}}}}},responses:{"200":{$ref:"#/components/responses/UserRoleResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles/{userID}/projects/{projectID}/environments/{environmentID}":{summary:"Environment User Roles","x-coa-private":!0,parameters:[{name:"userID",description:"The user ID.",in:"path",schema:{type:"string"},required:!0},{name:"projectID",description:"The project ID.",in:"path",schema:{type:"string"},required:!0},{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0}],delete:{summary:"Delete Environment User Roles",description:"Deletes all of a user's environment roles.",operationId:"DeleteUserEnvironmentRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],responses:{"204":{description:"The user's environment roles were successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{summary:"Create/Update Environment User Roles",description:"Creates or updates all of a user's environment roles.",operationId:"UpsertUserEnvironmentRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],requestBody:{description:"The user environment roles.",required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentRoles"}}}},responses:{"200":{$ref:"#/components/responses/UserEnvironmentRoleResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles/{userID}/projects/{projectID}":{summary:"Project User Roles","x-coa-private":!0,parameters:[{name:"userID",description:"The user ID.",in:"path",schema:{type:"string"},required:!0},{name:"projectID",description:"The project ID.",in:"path",schema:{type:"string"},required:!0}],delete:{summary:"Delete Project User Roles",description:"Deletes all of a user's project roles. Only org and project admins may user this API.",operationId:"DeleteUserProjectRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],responses:{"204":{description:"The user's project roles were successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{summary:"Create/Update Project User Roles",description:"Creates or updates all of a user's project roles. Only org and project admins may user this API.",operationId:"UpsertUserProjectRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],requestBody:{description:"The user project roles.",required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectRoles"}}}},responses:{"200":{$ref:"#/components/responses/UserProjectRoleResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/all":{summary:"All Packages","x-coa-private":!0,get:{description:"Get all available packages on the registry.",operationId:"GetAllRegistryPackages","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],responses:{"200":{$ref:"#/components/responses/AllRegistryPackagesResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/{packageID}/releases":{summary:"All Package Releases","x-coa-private":!0,get:{description:"Get all available releases for a package on the registry.",operationId:"GetAllRegistryPackageReleases","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],parameters:[{name:"packageID",description:"The package id.",in:"path",schema:{type:"string"},required:!0}],responses:{"200":{$ref:"#/components/responses/AllRegistryPackageReleasesResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/{packageID}":{summary:"Package","x-coa-private":!0,get:{description:"Get a package on the registry.",operationId:"GetRegistryPackage","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],parameters:[{name:"packageID",description:"The package id.",in:"path",schema:{type:"string"},required:!0}],responses:{"200":{$ref:"#/components/responses/RegistryPackageResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/{packageID}/releases/{releaseID}":{summary:"Package Release","x-coa-private":!0,get:{description:"Get a release from a package in the registry.",operationId:"GetRegistryPackageRelease","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],parameters:[{name:"packageID",description:"The package id.",in:"path",schema:{type:"string"},required:!0},{name:"releaseID",description:"The package release ID.",in:"path",schema:{type:"string"},required:!0}],responses:{"200":{$ref:"#/components/responses/RegistryPackageReleaseResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/org":{summary:"Organization Packages","x-coa-private":!0,get:{description:"Get a release from a package in the registry.",operationId:"GetRegistryPackagesForOrg","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],responses:{"200":{$ref:"#/components/responses/AllRegistryPackagesResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/createPackage":{summary:"Packages","x-coa-private":!0,post:{description:"Create a package.",operationId:"CreatePackage","x-eov-operation-handler":"PackagesHandlers",tags:["Packages"],requestBody:{description:"The package info to create with.",required:!0,content:{"application/json":{schema:{type:"object",required:["release","name","description","entities","privacy","packageVariables"],properties:{release:{$ref:"#/components/schemas/PackageCreateReleaseInfo"},name:{type:"string"},description:{type:"string"},overview:{type:"string",maxLength:200},privacy:{type:"string",enum:["public","private","unlisted"]},entities:{$ref:"#/components/schemas/PackageCreateEntities"},packageVariables:{type:"string"}}}}}},responses:{"201":{$ref:"#/components/responses/PackageResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/createRelease":{"x-coa-private":!0,post:{description:"Add a new package release to an existing package.",operationId:"AddPackageRelease","x-eov-operation-handler":"PackagesHandlers",tags:["Packages"],requestBody:{description:"The package release info.",required:!0,content:{"application/json":{schema:{type:"object",required:["release","entities","privacy","packageVariables","packageID"],properties:{release:{$ref:"#/components/schemas/PackageCreateReleaseInfo"},privacy:{type:"string",enum:["public","private","unlisted"]},entities:{$ref:"#/components/schemas/PackageCreateEntities"},packageVariables:{type:"string"},packageID:{type:"string"}}}}}},responses:{"200":{$ref:"#/components/responses/PackageResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/update":{"x-coa-private":!0,put:{description:"Update a package.",operationId:"UpdatePackage","x-eov-operation-handler":"PackagesHandlers",tags:["Packages"],requestBody:{description:"The package info to create with.",required:!0,content:{"application/json":{schema:{type:"object",required:["packageID","releaseID"],properties:{packageID:{type:"string"},releaseID:{type:"string"},changeLog:{type:"string"},description:{type:"string"},privacy:{type:"string",enum:["public","private","unlisted"]}}}}}},responses:{"200":{$ref:"#/components/responses/PackageUpdateResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/typesense/orgs/{orgID}/typesense-config":{summary:"Typesense Config","x-coa-private":!0,parameters:[{name:"orgID",description:"The organization ID.",in:"path",schema:{type:"string"},required:!0}],post:{description:"Returns Typesense configuration data for a given org.",operationId:"getTypesenseConfigForOrg","x-eov-operation-handler":"TypesenseHandlers",security:[{BearerAuth:[]}],tags:["CoalesceAPI"],responses:{"200":{$ref:"#/components/responses/TypesenseConfigurationResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/runs":{summary:"Runs","x-coa-command-group":"runs",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Runs",description:"Get a collection of information about runs.",operationId:"GetRuns","x-eov-operation-handler":"RunHandlers","x-coa-command":"list",security:[{BearerAuth:[]}],tags:["Runs"],parameters:[{name:"limit",description:"The maximum number of runs to return.",in:"query",schema:{type:"integer",minimum:0,maximum:1e3,default:25},required:!1},{name:"startingFrom",description:"The starting run ID, runStartTime, or runEndTime (exclusive) for paging the query results.",in:"query",allowReserved:!0,schema:{oneOf:[{type:"integer",minimum:0},{type:"string",format:"date-time"}]},required:!1},{name:"orderBy",description:"The field used to order results.",in:"query",schema:{$ref:"#/components/schemas/RunsOrderBy"},required:!1},{$ref:"#/components/parameters/orderByDirection"},{name:"runType",description:"A run type to filter the query results.",in:"query",schema:{$ref:"#/components/schemas/RunType"},required:!1},{name:"runStatus",description:"A status value to filter the query results.",in:"query",schema:{$ref:"#/components/schemas/RunStatus"},required:!1},{name:"environmentID",description:"An environment ID to filter the query results.",in:"query",schema:{type:"string"},required:!1},{name:"detail",description:"Include the full detail of the run.",in:"query",schema:{type:"boolean",default:!1},required:!1}],responses:{"200":{$ref:"#/components/responses/RunsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/runs/{runID}":{summary:"Run","x-coa-command-group":"runs",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"Get Run",description:"Gets a single run.",operationId:"GetRun","x-eov-operation-handler":"RunHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Runs"],parameters:[{name:"runID",description:"The run ID.",in:"path",schema:{type:"integer"},required:!0}],responses:{"200":{$ref:"#/components/responses/RunResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/runs/{runID}/results":{summary:"Run Results","x-coa-command-group":"runs",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Run Results",description:"Get a collection of the results of a deploy or refresh run",operationId:"GetRunResults","x-eov-operation-handler":"RunHandlers","x-coa-command":"list-results",security:[{BearerAuth:[]}],tags:["Runs"],parameters:[{name:"runID",description:"The run ID.",in:"path",schema:{type:"integer"},required:!0}],responses:{"200":{$ref:"#/components/responses/RunResultsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/database":{get:{summary:"Get database connectivity information.",description:"Gets the information required to connect to the Coalesce database.",operationId:"GetDatabase","x-eov-operation-handler":"DatabaseHandlers",security:[],responses:{"200":{$ref:"#/components/responses/DatabaseInfoResponse"}}}},"/api/v1/secrets/{secretType}/{context}":{"x-coa-private":!0,get:{description:"Determines whether or not a git token value exists for a given project ID.",operationId:"SecretExists","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["Secrets"],parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"200":{$ref:"#/components/responses/secretExists"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{description:"Sets the value of a secret.",operationId:"SetSecret","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["Secrets"],parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],requestBody:{description:"The new value of the secret.",required:!0,content:{"application/json":{schema:{type:"object",required:["secretValue"],properties:{secretValue:{}}}}}},responses:{"204":{description:"Successfully set the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{description:"Deletes a secret.",operationId:"DeleteSecret","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["Secrets"],parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"204":{description:"Successfully deleted the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/kill-job/{orgId}/{runId}":{"x-coa-private":!0,post:{description:"Deletes the Kubernetes job.",operationId:"KillJob","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"},{$ref:"#/components/parameters/runId"}],responses:{"204":{description:"Successfully killed the job."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/coa-tag":{"x-coa-private":!0,get:{description:"Gets a report of all organizations that are using a non-standard coa image tag.",operationId:"GetCoaTagReport","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],responses:{"200":{$ref:"#/components/responses/CoaTagReportResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/coa-tag/{orgId}":{"x-coa-private":!0,get:{description:"Gets the container image tag that should be used when running cloud coa jobs for a particular org.",operationId:"GetCoaTag","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"}],responses:{"200":{$ref:"#/components/responses/CoaTagResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{description:"Resets the container image tag that should be used when running cloud coa jobs for a particular org to the default.",operationId:"ResetCoaTag","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"}],responses:{"204":{description:"Successfully reset coa tag."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/coa-tag/{orgId}/{coaTag}":{"x-coa-private":!0,post:{description:"Sets the container image tag that should be used when running cloud coa jobs for a particular org.",operationId:"SetCoaTag","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"},{$ref:"#/components/parameters/coaTag"}],responses:{"204":{description:"Successfully set coa tag."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/scheduler/secret/{secretType}/{context}":{"x-coa-private":!0,get:{description:"Determines whether or not a git token value exists for a given project ID.",operationId:"SecretExistsV0","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["default"],deprecated:!0,parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"200":{$ref:"#/components/responses/secretExists"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},post:{description:"Sets the value of a secret.",operationId:"SetSecretV0","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["default"],deprecated:!0,parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],requestBody:{description:"The new value of the secret.",required:!0,content:{"application/json":{schema:{type:"object",required:["secretValue"],properties:{secretValue:{}}}}}},responses:{"204":{description:"Successfully set the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{description:"Deletes a secret.",operationId:"DeleteSecretV0","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["default"],deprecated:!0,parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"204":{description:"Successfully deleted the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/bulkWrite":{"x-coa-private":!0,post:{description:"Updates multiple documents for a workspace.",operationId:"BulkWrite","x-eov-operation-handler":"BulkWriteHandlers",security:[{BearerAuth:[]}],tags:["BulkOperations"],deprecated:!1,requestBody:{description:"The workspace to update and the path to the storage bucket containing the document write information.",required:!0,content:{"application/json":{schema:{type:"object",required:["workspaceID","bulkWriteRequestPath"],properties:{workspaceID:{type:"number"},bulkWriteRequestPath:{type:"string"}}}}}},responses:{"204":{description:"Successfully wrote the documents to the workspace."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/validHostname":{"x-coa-private":!0,post:{description:"Validates the passed hostname and returns an authorized version.",operationId:"ValidateHostname","x-eov-operation-handler":"ValidateHostnameHandlers",tags:["default"],deprecated:!1,security:[],requestBody:{description:"The hostname that needs to be validated.",required:!0,content:{"application/json":{schema:{type:"object",required:["hostname"],properties:{hostname:{type:"string"}}}}}},responses:{"200":{$ref:"#/components/responses/ValidHostname"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}}}};var ens=St(require("os")),tns=St(require("path")),rns=St(Zrs()),nns=require("fs/promises");vi();Ar();var ins=r=>gi(r,t=>{t.snowflakePassword?.value&&(t.snowflakePassword.value="<REDACTED>"),t.token?.value&&(t.token.value="<REDACTED>")}),sRc=r=>gi(r,t=>{Object.keys(t).forEach(n=>{t[n]=ins(r[n])})}),h$e=ot.CLI_INTERNAL,SF=ot.CLI,aRc=()=>{let r=ens.default.homedir(),t=tns.default.join(r,".coa/config");return h$e.info("using default location",t),t},YC={profile:{value:"",description:"Profile To Use"},environmentID:{value:"",description:"Environment ID"},parameters:{value:"",description:"Parameters"},snowflakeAuthType:{value:"",description:"Snowflake Auth Type (Basic, KeyPair)"},snowflakeKeyPairPath:{value:"",description:"Snowflake Key Pair Path (deprecated, please use --snowflakeKeyPairKey)",deprecationMessage:"This option has been replaced by snowflakeKeyPairKey."},snowflakeKeyPairKey:{value:"",description:"Snowflake Key Pair Path"},snowflakeKeyPairPass:{value:"",description:"Snowflake Key Pair Pass"},snowflakePassword:{value:"",description:"Snowflake Password"},snowflakeRole:{value:"",description:"Snowflake Role"},snowflakeUsername:{value:"",description:"Snowflake Username"},snowflakeWarehouse:{value:"",description:"Snowflake Warehouse"},token:{value:"",description:"Coalesce Refresh Token"},jobID:{value:"",description:"Coalesce JobID"},include:{value:"",description:"Coalesce Node Selector"},exclude:{value:"",description:"Coalesce Node Selector"},parallelism:{value:"",description:"Parallelism level to use"},domain:{value:"",description:"Coalesce domain name to use for API requests",default:"https://app.coalescesoftware.io"}},uRc=async r=>{try{let t=await(0,nns.readFile)(r??aRc(),"utf-8"),n=rns.default.parse(t);return Object.fromEntries(Object.entries(n).flatMap(([i,o])=>{if(!o||typeof o!="object")return SF.error(`Unexpected top-level option ${i} in config file.`),[];let s=Object.entries(o).flatMap(([a,u])=>YC[a]?!u||typeof u!="string"?(SF.error(`Expected profile ${i} field ${a} to be a string, but it is of type ${typeof o}.`),[]):(YC[a].deprecationMessage&&SF.error(`CLI profile ${i} is using deprecated option ${a}.`,YC[a].deprecationMessage),[[a,{...YC[a],value:u}]]):(SF.error("Ignoring unknown field",a,`in CLI profile ${i}.`),[]));return[[i,Object.fromEntries(s)]]}))}catch(t){if(r)throw new Error(`Unable to read cli profile: ${r}`);return SF.error("Using default options. Unable to read default cli profile:",r,". Error:",t),{}}},lRc=async(r,t)=>{let n=await uRc(t),i=n.default,o={};i&&(o=i);let s=r.profile?.value||i?.profile?.value||"";if(h$e.info("using profile",s,"cliProfiles",JSON.stringify(sRc(n))),s){if(!(s in n))throw new Error(`Unable to find profile ${s}`);let a=n[s];o={...o,...a}}return o={...o,...r},o},cRc=r=>{if(r.snowflakeAuthType?.value==="Basic")return TSi.assert({snowflakeUsername:r.snowflakeUsername?.value,snowflakePassword:r.snowflakePassword?.value,snowflakeWarehouse:r.snowflakeWarehouse?.value,snowflakeRole:r.snowflakeRole?.value});if(r.snowflakeAuthType?.value==="KeyPair")return NSi.assert({snowflakeUsername:r.snowflakeUsername?.value,snowflakeKeyPairKey:r.snowflakeKeyPairKey?.value||r.snowflakeKeyPairPath?.value,snowflakeKeyPairPass:r.snowflakeKeyPairPass?.value||"",snowflakeWarehouse:r.snowflakeWarehouse?.value,snowflakeRole:r.snowflakeRole?.value});throw new Error(`SnowflakeAuthFromCLI: CLI config must have a valid credential type. Expected "Basic" or "KeyPair", got ${JSON.stringify(r.snowflakeAuthType?.value)}`)},ons=async(r,t)=>{let n=await lRc(r,t);h$e.info("got final cli profile configFileLocation:",t,JSON.stringify(ins(n)));let i;try{i=P5n(n,["token","environmentID"])}catch(u){throw typeof u=="object"&&u instanceof PMe&&h$e.error(`cliProfile was missing ${u.missingProperties}`),u}let o=i.domain?.value||process.env.SCHEDULER_ADDRESS||YC.domain.default,s={token:i.token.value,runDetails:{environmentID:i.environmentID.value},userCredentials:cRc(i),runtimeParameters:i.parameters?.value||"",domain:new URL(o)};if(!s.domain)throw new Error("Unable to determine Coalesce domain.");let a=i.jobID?.value;if(a&&(s.runDetails.jobID=a),i.include?.value&&(s.runDetails.includeNodesSelector=i.include.value),i.exclude?.value&&(s.runDetails.excludeNodesSelector=i.exclude.value),i.parallelism?.value){let u=parseInt(i.parallelism.value);if(isNaN(u)){let c=`Parameter 'parallelism' was set to '${i.parallelism}', which could not be interpreted as a number`;throw h$e.error(c),new Error(c)}else s.runDetails.parallelism=u}return tb(s),s};var MBe=St(Uf()),nln=St(require("util"));li();bat();var sns=require("fs/promises");vi();Ar();var dRc=ot.CLI,ans=(r,t,n,i)=>{let o,s;return aZ(n,void 0,i).then(a=>{let{teamInfo:u,firebase:c}=a;o=u.fbTeamID;let l=c.firestore();return s=parseInt(t),Its(l,o,s)}).then(a=>{let u=rRt.validate(a);u.valid||dRc.emergContext({orgID:o,runID:s},`Got an unexpected error deserializing run output ${u.failureMessage}`);let c=Q5n(a);return(0,sns.writeFile)(r,c+`
3304
+ `}async showSchemas(n){let i={},o=new Map;for(let s of Object.values(n)){let{database:a,schema:u,locationName:c}=s;if(o.has(a)){this.log("debugContext",`Schemas for ${a} already fetched. Updating record for ${c}.`);let A=o.get(a);if(!A)throw new Gt(`Cached schemas for database ${a} are empty.`);let f=A[u];if(!f)throw new Gt(`Cached schema info for schema ${u} in database ${a} is empty.`);i[c]=f;continue}this.log("debugContext",`Fetching schemas for database ${a} from location ${c}.`);let l=await Pb(()=>this.getRows(`SHOW SCHEMAS IN DATABASE "${a}"`),3,ot.PLATFORM,cEe(this.userContext),{logOnRetry:`Failed to SHOW SCHEMAS for database ${a} from location ${c}. Retrying...`,retryLogLevel:"error",logOnFailure:`Failed to SHOW SCHEMAS for database ${a} from location ${c}:`,failureLogLevel:"error",checkError:A=>_in(A)?void 0:A}),d=Object.fromEntries(l.map(A=>[A.name,urs.parse(A)]));o.set(a,d);let p=d[u];if(!p)throw new Gt(`Schema ${u} not found in database ${a} from location ${c}`);i[c]=p}return i}getQueryResultFromTemplateRunResult(n,i){let o=n.runDetails.compiledSQL,s={error:null,fields:[],rows:[],success:!0,sql:o,exportedRefs:[],invalidExportedRefs:[],startTime:i,endTime:new Date,isRunning:!1,name:"",status:n?.data?.status||"Success",type:"sql",queryID:n.runDetails.queryID,warehouse:n.runDetails.warehouse};if(n.data){let a=n.data.rows.map(c=>({values:Object.values(c)})),u=n.data.columns.map(c=>({name:c.Name,type:c.DataType||""}));s.fields=u,s.rows=a}if(n?.runDetails?.exported_refs.length){let a=n.runDetails.exported_refs.map(u=>({locationName:u.location_name,nodeName:u.node_name}));s.exportedRefs=IP(a)}if(n?.runDetails?.invalid_exported_refs.length){let a=n.runDetails.invalid_exported_refs.map(u=>({locationName:u.location_name,nodeName:u.node_name}));s.invalidExportedRefs=IP(a)}return s}showColumns(n){return Oin("columns",i=>this.getRows(`SHOW COLUMNS IN SCHEMA "${i.database}"."${i.schema}"`),Object.values(n),!1,cEe(this.userContext),i=>_in(i)?void 0:i)}showObjects(n,i){return Oin("objects",o=>this.getRows(`SHOW OBJECTS IN "${o.database}"."${o.schema}"`),Object.values(n),i,cEe(this.userContext),o=>_in(o)?void 0:o)}async testConnection(){try{return await this.runSQL(Cat,void 0),null}catch(n){return Ef(n)?new Gt(`Could not validate connection to ${this.name}: ${n.message}`,n.detail):new Gt(`Could not validate connection to ${this.name}`,l1(n).error.errorDetail)}}async getDatabases(){return(await this.getRows("SHOW DATABASES")).map(i=>i.name)}async getSchemas(n){return(await this.getRows(`SHOW SCHEMAS IN "${n}"`)).map(o=>o.name)}getName(n,i){let o=n[i.locationName];if(!o)throw new XOt(n,i.locationName);let{database:s,schema:a}=o;return`"${s}"."${a}"."${i.name}"`}async getVariantRows(n,i,o,s){let a=this.getName(s,o),u=`SELECT "${n}" FROM ${a} SAMPLE (${i} ROWS)`;return this.getSQLQueryResult(u)}async getObjectRows(n,i,o){let s=`SELECT * FROM ${this.getName(n,i)} LIMIT 100`;return o&&(s=uzt(s)),this.getSQLQueryResult(s)}createColumnMetadata(n,i){return{name:n.name,dataType:n.type,transform:"",nullable:n["null?"]==="Y",defaultValue:"",columnReference:{columnCounter:P0(),stepCounter:i},primaryKey:n["primary key"]==="Y",uniqueKey:n["unique key"]==="Y",description:n.comment||"",appliedColumnTests:{},acceptedValues:{strictMatch:!0,values:[]},config:{},sourceColumnReferences:[{transform:"",columnReferences:[]}]}}async describeObject(n,i,o,s){let a=`DESC ${o.toUpperCase()} ${this.getName(n,i)}`;return(await this.runSQL(a,P0())).data.rows.map(c=>this.createColumnMetadata(c,s))}convertObjectRowsToMaterializationKinds(n){let i=[],o=[];for(let s of n)s.kind==="TABLE"?i.push(s.name):s.kind==="VIEW"&&o.push(s.name);return{tables:i,views:o}}createState(n,i,o,s,a){return new OFt(s,o,i,n,a)}},_in=r=>Ef(r)?!!(r.detail?.includes("name=NetworkError")||r.detail?.includes("Network Error")):!0;var DE=class extends wFt{constructor(n,i){super(i);this.connection=n}async runSQL(n,i){let o=await this.connection.execute({sqlText:n,requestId:i||P0()});return DE.GetTemplateResultFromExecutionResult(n,o)}static GetTemplateResultFromExecutionResult(n,i){let o=i.stmt.getColumns().map(a=>({Name:a.getName(),DataType:a.getType()}));return{runDetails:{compiledSQL:n,exported_refs:[],invalid_exported_refs:[],ref_usage:{invalid_ref:[],invalid_ref_link:[],invalid_ref_no_link:[],ref:[],ref_link:[],ref_no_link:[]},queryID:i.queryID,warehouse:i.warehouse},data:{columns:o,rows:i.rows,status:i.status}}}usingConnection=n=>new DE(n,this.userContext)};qi();var prs=r=>{let t={};for(let n of cGn.options)t[n]=r.featureFlags?.[n]??(n in r?r[n]:void 0);return t};li();Hi();var hBc=Q.enum(["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-create","org-users-delete","org-userRoles-read","org-userRoles-write","org-projects-create"]),gBc=Q.enum(["project-settings-read","project-summary-read","project-settings-write","project-delete","project-members-read","project-members-add","project-members-write","project-members-remove","project-workspaces-create","project-documentation-read","project-environments-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-create","project-workspace-jobs-read","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-read","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-read","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-create","project-workspace-packages-read","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-sql-run","project-workspace-subgraphs-create","project-workspace-subgraphs-read","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"]),mBc=Q.enum(["env-run-results-read","env-delete","env-deploy","env-refresh","env-settings-read","env-summary-read","env-settings-write","env-documentation-read","env-members-read","env-members-add","env-members-write","env-members-remove"]),yBc={reader:{permissions:["env-run-results-read","env-summary-read","env-documentation-read"],inheritedEnvironmentRoles:[]},admin:{permissions:[...mBc.options],inheritedEnvironmentRoles:["reader"]}},EBc={member:{permissions:["project-summary-read"],inheritedProjectRoles:[],inheritedEnvironmentRoles:[]},contributor:{permissions:["project-settings-read","project-members-read","project-workspaces-create","project-workspace-settings-read","project-workspace-settings-write","project-workspaces-delete","project-workspace-jobs-read","project-workspace-macros-read","project-workspace-node-types-read","project-workspace-nodes-create","project-workspace-nodes-read","project-workspace-nodes-write","project-workspace-nodes-delete","project-workspace-packages-read","project-workspace-subgraphs-read","project-documentation-read","env-documentation-read"],inheritedProjectRoles:["member"],inheritedEnvironmentRoles:[]},architect:{permissions:["project-workspace-jobs-create","project-workspace-jobs-write","project-workspace-jobs-delete","project-workspace-macros-create","project-workspace-macros-write","project-workspace-macros-delete","project-workspace-node-types-create","project-workspace-node-types-write","project-workspace-node-types-delete","project-workspace-packages-create","project-workspace-packages-write","project-workspace-packages-delete","project-workspace-sql-run","project-workspace-subgraphs-create","project-workspace-subgraphs-write","project-workspace-subgraphs-delete"],inheritedProjectRoles:["contributor"],inheritedEnvironmentRoles:[]},admin:{permissions:[...gBc.options],inheritedProjectRoles:["architect"],inheritedEnvironmentRoles:["admin"]}},bBc={member:{permissions:["org-users-read"],inheritedOrganizationRoles:[],inheritedProjectRoles:[]},contributor:{permissions:["org-projects-create"],inheritedOrganizationRoles:["member"],inheritedProjectRoles:[]},admin:{permissions:[...hBc.options],inheritedOrganizationRoles:["contributor"],inheritedProjectRoles:["admin"]}},RFt=r=>{let t=yBc[r],n=new Set(t.permissions);for(let i of t.inheritedEnvironmentRoles)RFt(i).forEach(o=>n.add(o));return Array.from(n)},v6e=r=>{let t=EBc[r],n=new Set(t.permissions);for(let i of t.inheritedProjectRoles)v6e(i).forEach(o=>n.add(o));for(let i of t.inheritedEnvironmentRoles)RFt(i).forEach(o=>n.add(o));return Array.from(n)},BFt=r=>{let t=bBc[r],n=new Set(t.permissions);for(let i of t.inheritedOrganizationRoles)BFt(i).forEach(o=>n.add(o));for(let i of t.inheritedProjectRoles)v6e(i).forEach(o=>n.add(o));return Array.from(n)},Ars={admin:BFt("admin"),contributor:BFt("contributor"),member:BFt("member")},frs={admin:v6e("admin"),architect:v6e("architect"),contributor:v6e("contributor"),member:v6e("member")},hrs={admin:RFt("admin"),reader:RFt("reader")};var c$e=class{throwIfOrgPermissionDenied(t,n=!1){if(!this.hasOrgPermission(t))throw n?new W1("The requested resource is unavailable"):new lx("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfProjectPermissionDenied(t,n,i=!1){if(!this.hasProjectPermission(t,n))throw i?new W1("The requested resource is unavailable"):new lx("Permission denied",`Permission '${t}' is required to perform this operation.`)}throwIfEnvironmentPermissionDenied(t,n,i,o=!1){if(!this.hasEnvironmentPermission(t,n,i))throw o?new W1("The requested resource is unavailable"):new lx("Permission denied",`'Permission ${t}' is required to perform this operation.`)}},yF=class extends c$e{constructor(n,i){super();this.userRoles=n;this.hasSuperUserAccess=i;this.userPermissions=this.ConstructPermissionsFromRoles(n)}userPermissions;hasOrgPermissionInternal(n){return this.userPermissions.organizationPermissions?.has(n)}hasOrgPermission(n){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)}hasProjectPermissionInternal(n,i){return this.userPermissions.projects[i]?.projectPermissions?.has(n)}hasProjectPermission(n,i){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)}hasEnvironmentPermissionInternal(n,i,o){return this.userPermissions.projects[i]?.environments[o]?.environmentPermissions?.has(n)}hasEnvironmentPermission(n,i,o){return this.hasSuperUserAccess||this.hasOrgPermissionInternal(n)||this.hasProjectPermissionInternal(n,i)||this.hasEnvironmentPermissionInternal(n,i,o)}ConstructPermissionsFromRoles(n){return n?{organizationPermissions:yF.ConstructOrgPermissionsFromRoles(n.organizationRoles),projects:yF.ConstructProjectsPermissionsFromRoles(n.projects)}:{organizationPermissions:new Set,projects:{}}}static ConstructEnvironmentPermissionsFromRoles(n){let i=new Set;return n.environmentRoles.forEach(o=>{hrs[o].forEach(s=>{i.add(s)})}),i}static ConstructEnvironmentPermissionObjectsFromRoles(n){let i={};return Object.entries(n).forEach(([o,s])=>{i[o]={environmentPermissions:yF.ConstructEnvironmentPermissionsFromRoles(s)}}),i}static ConstructProjectPermissionsFromRoles(n){let i=new Set;return n.projectRoles.forEach(s=>{frs[s].forEach(a=>{i.add(a)})}),{projectPermissions:i,environments:yF.ConstructEnvironmentPermissionObjectsFromRoles(n.environments)}}static ConstructProjectsPermissionsFromRoles(n){let i={};return Object.keys(n).forEach(o=>{i[o]=this.ConstructProjectPermissionsFromRoles(n[o])}),i}static ConstructOrgPermissionsFromRoles(n){let i=new Set;return n.forEach(o=>{Ars[o].forEach(s=>{i.add(s)})}),i}};var TFt=class extends c$e{constructor(n,i){super();this.userRole=n;this.hasSuperUserAccess=i}hasOrgPermission(n){if(this.hasSuperUserAccess||this.userRole==="Admin")return!0;{let i=["org-settings-read","org-settings-write","org-users-read","org-users-write","org-users-delete"];return this.userRole==="User"&&!i.includes(n)}}hasProjectPermission(n,i){return!!this.userRole||this.hasSuperUserAccess}hasEnvironmentPermission(n,i,o){return!!this.userRole||this.hasSuperUserAccess}};var IBc=null;ld()&&(IBc=OUe());var Dle=ot.AUTH,_ap=ot.USER_MANAGEMENT,vBc=0,BA=ot.RUNNER_BACKEND;var xBc=async(r,t)=>{try{await m1r(t);let n=r+vBc++,i=c7e().initializeApp(t,n);y1r(i,!1);let o=await VH("/scheduler/generateLoginToken",null,r),{customToken:s,uid:a}=o.data;return await i.auth().signInWithCustomToken(s),{Firebase:i,rootRepository:Yts(i),uid:a}}catch(n){throw BA.error("GetOrSetupFirebase",n),n}},SBc=async r=>{let t=(await l7e()).apiKey;return JCr(`https://securetoken.googleapis.com/v1/token?key=${t}`,{refresh_token:r,grant_type:"refresh_token"}).then(n=>n.data.id_token)},OBc=async(r,t,n)=>{let i,o,s,a,u,c,l,d,p;return Dle.debug("got auth request refresh:",!!r,"id token",!!t),t===void 0&&YU&&(t=r),Dle.debug("inAuthenticate, between 1st and 2nd",!!t),(t?Promise.resolve(t):SBc(r)).then(A=>(Dle.debug("inAuthenticate, before setting id token"),i=A,Dle.debug("inAuthenticate, setting up firebase 2"),n(i))).then(A=>(o=A.Firebase,s=A.rootRepository,l=A.uid,Dle.debug("inAuthenticate, getting team data admin ",l),YFi(o.firestore(),A.uid))).then(A=>(a=A,d=eLi(A.fbRole),Dle.debug("inAuthenticate, finishing...",l),s.org(A.fbTeamID).fetch())).then(A=>(u=A,s.user(a.fbUserID).fetch())).then(A=>{if(c=A,p=prs(u.featureFlags),p.RBAC)return s.org(a.fbTeamID).userRole(a.fbUserID).fetch()}).then(A=>{let f;return A?f=new yF(A,!!c.hasSuperUserAccess):f=new TFt(c.role,!!c.hasSuperUserAccess),{teamInfo:a,firebase:o,rootRepository:s,idToken:i,featureFlags:p,userPermissions:f,UserRolePrivilegeChecker:d}}).catch(A=>{let f=a?a.fbUserID:"",h=a?a.fbTeamID:"";Dle.errorContext({userID:f,orgID:h},"AuthenticateFirebaseTokenAndRetrieveTeamInfo",A);let y=A?.message||A?.error?.errorString;throw new Gt("Unable to authenticate, please check your network connection and ensure your token is valid",y)})};var aZ=async(r,t,n)=>{let o=await kR(n.origin).GetDatabase();return await zYn(o),process.env.SCHEDULER_ADDRESS=n.origin,OBc(r,t,s=>xBc(s,o))};var grs=r=>JSON.stringify(Kqr(r)),win=(r,t,n,i)=>{let o=qBt(r.userCredentials,t);return{runTimeParameters:r.runTimeParameters,runDetails:r.runDetails,userCredentials:o,runStatus:i?"waitingToRun":"initializing",userID:n,runType:"deploy",kubernetesJobUuid:i}},Bin=async(r,t,n,i,o,s,a,u,c)=>{if(!c.render)throw new Error("CreateRunDeployPromise: bad renderer");let{firebase:l,teamInfo:d,teamInfo:{fbTeamID:p},rootRepository:A}=r;try{await bts(l,A,t,d,i,s,a,c),BA.appContext(a,"runDeploy finished successfully"),await trs(l,p,o,n)}catch(f){let h=l1(f),{error:{errorString:y}}=h;BA.errorContext(a,"Error during deploy inner promise (runDeployCompletion):",y);try{await rrs(l,p,o,n,y)}catch(I){BA.errorContext(a,"Error during status release: ",I)}throw h}finally{await u()}},_Bc=async(r,t,n,i,o,s,a,u=!1)=>{let{teamInfo:{fbTeamID:c},rootRepository:l}=r,{runCounter:d,CleanupHeartbeat:p}=await Zts(l,c,n,t,s),A={...s,runID:d},f=u?Promise.resolve():Bin(r,new DE(i.getConnection(),o),d,t,n,i,A,p,a);return u&&(await p(),await i.teardown()),{runCounter:d,runCompletion:f}},mrs=async(r,t,n,i,o,s)=>{let{teamInfo:a,teamInfo:{fbUserID:u},rootRepository:c}=t,l=parseInt(r.runDetails.environmentID),d=Math.max(...Object.values(r.runDetails.dividedStepDataWithWorkspaceEdits).map(A=>Object.keys(A).length)),p=r.runDetails.planID;BA.infoContext(n,"Initializing deploy! planId:",p);try{let A=await bF(c,a,l,i),f=EF(A,u),h=s?1:r.runDetails.parallelism,y=await lO.New(A,t,n,sZ(d,h));r.runDetails=WFi(f,r.runDetails,u),BA.appContext(n,grs(A),"BECLI_HandleDeploy"),await Min(y,u,n);let I=win(r,A,u,s),v=await _Bc(t,I,l,y,A,n,o,!!s);return await wBc(c,t,v.runCounter,l,u,n),v}catch(A){throw BA.errorContext(n,`Error during deploy${p?` for plan ${p}`:""}: `,A),A}},wBc=async(r,t,n,i,o,s)=>{try{let a=rP(t.firebase.firestore(),t.teamInfo.fbTeamID,i),u=await A1(a);if(!u.exists)throw new Gt(`Workspace ${i} does not exist!`);let c=`run-${n}.predeploy`,l=`user/${o}/environment/${i}/workspacePreDeploy/${c}`,d=u.data();BA.appContext(s,"saving workspace data",d);let p=JSON.stringify(d);await r.storage().uploadFile(l,p),BA.appContext(s,`Run ${n}: Saved pre-deploy workspace state to ${l}`)}catch(a){BA.errorContext(s,"Error while saving preDeploy workspace state: ",a)}},Rin=r=>{let{runDetails:t}=r;if(t.jobID&&(t.includeNodesSelector||t.excludeNodesSelector))throw new Error("Unable to process, don't provide a JobID and Node Include/Exclude Selector(s) for 1 Refresh Run")},BBc=(r,t)=>{for(let n in t)t[n]&&(r[n]=t[n])},Tin=(r,t,n,i)=>{let o=qBt(r.userCredentials,t),s={runTimeParameters:r.runTimeParameters,runDetails:{...r.runDetails,jobID:TCr(r.runDetails.jobID)},userCredentials:o,runStatus:i?"waitingToRun":"initializing",userID:n,runType:"refresh",kubernetesJobUuid:i};return tb(s),s},EF=(r,t)=>{let n={connectionDetails:{userID:t,user:r.user,role:r.role,warehouse:r.warehouse},connectionType:r.authenticator};return r.authenticator==="KeyPair"&&(n.connectionDetails.keyPair=r.keyPairKey),n},Min=async(r,t,n)=>{let i=EF(r.userContext,t),o={connectionType:i.connectionType,connectionDetails:UFi(i.connectionDetails)};BA.infoContext(n,"testing snowflake connection:",o),await r.withConnection(async s=>{await s.execute({sqlText:Cat})})},bF=async(r,t,n,i)=>{let o=await pEe(r,t,n),{accountName:s,accessUrl:a}=await jFi(r,t.fbTeamID,n),u={accountName:s,accessUrl:a,user:o.connectionDetails.user,role:o.connectionDetails.role,warehouse:o.connectionDetails.warehouse,environmentID:n,orgID:t.fbTeamID,authenticator:o.connectionType};return BBc(u,i),u},MFt=r=>HH(r,o=>({user:o.snowflakeUsername,password:o.snowflakePassword,role:o.snowflakeRole,warehouse:o.snowflakeWarehouse,authenticator:"Basic"}),o=>{if(o.snowflakeKeyPairKey===void 0)throw new Gt("No private key was provided, cannot perform key pair authentication with Snowflake");let s=o.snowflakeKeyPairPass?new hl(o.snowflakeKeyPairPass):void 0,a=uke(new hl(o.snowflakeKeyPairKey),s);return{user:o.snowflakeUsername,keyPairKey:a.sensitiveValue,keyPairPass:o.snowflakeKeyPairPass,role:o.snowflakeRole,warehouse:o.snowflakeWarehouse,authenticator:"KeyPair"}},o=>({warehouse:o.snowflakeWarehouse,authenticator:"OAuth"}),DSr),DFt=async(r,t,n,i,o,s,a,u,c,l,d,p)=>{let{firebase:A,teamInfo:f,teamInfo:{fbTeamID:h},rootRepository:y}=r;try{BA.appContext(u,"Starting runRefresh"),await Cts(y,t,f,o,n,i,s,a,c,l,p),BA.appContext(u,"runRefresh finished with no errors, releasing workspace status"),await nrs(A,h,i,o)}catch(I){let v=l1(I),{error:{errorString:O}}=v;BA.errorContext(u,"Error during refresh:",O);try{await irs(A,h,i,o,O)}catch(_){BA.errorContext(u,"Error during status release:",_)}throw v}finally{await d()}},yrs=async(r,t,n,i,o,s,a,u,c,l=!1,d)=>{BA.infoContext(a,"Securing workspace status and starting refresh:",i);let{teamInfo:{fbTeamID:p},rootRepository:A}=r,{runCounter:f,CleanupHeartbeat:h}=await ers(A,p,i,n,a),y={...a,runID:f},I=A.org(p).run(f);await a$e(n,c,u,I);let v=l?Promise.resolve():DFt(r,t,n,i,f,o,s,y,u,c,h,d);return l&&(await h(),await o.teardown()),{runCounter:f,runCompletion:v}},RBc=async(r,t,n,i,o)=>o?(BA.infoContext(i,"Refreshing job:",o),xOi(r,t,n,"jobs",o)):(BA.infoContext(i,"No job ID, refreshing all steps"),!0),Ers=async(r,t,n,i,o,s,a)=>{let{teamInfo:u,teamInfo:{fbTeamID:c,fbUserID:l},firebase:d,rootRepository:p}=t,A=d.firestore(),f=parseInt(r.runDetails.environmentID);r.runTimeParameters=await CF(p,c,f,r.runTimeParameters),Rin(r);let h=TCr(r.runDetails.jobID),y=RBc(A,c,f,n,h);try{let I=await bF(p,u,f,i),v=EF(I,l);if(BA.appContext(n,grs(I),"BECLI_HandleRefresh"),!await y)throw rte(400,`Unable to start job ${h}`,`Job ${h} did not exist`);let O=Tin(r,I,l,a),_={steps:{},folders:{},jobs:{},macros:{},stepTypes:{}},w=new Set;a||(_=await DIe(t,+O.runDetails.environmentID,s),w=await b6e(d,c,O,_));let P=await lO.New(I,t,n,a?1:sZ(w.size,r.runDetails.parallelism));return await Min(P,l,n),yrs(t,new DE(P.getConnection(),I),O,f,P,v,n,_,w,!!a,o)}catch(I){throw BA.errorContext(n,"Error during refresh:",I),I}};var TBc=async(r,t,n)=>{let o=(await r.org(t).workspace(n).fetch()).runTimeParameters??"";return YOt(o)},CF=async(r,t,n,i)=>i?eRt(i):TBc(r,t,n),Din=async(r,t,n,i,o,s)=>{let a=qBt(t.userCredentials,i),u=await CF(r,o.fbTeamID,parseInt(n.runDetails.environmentID),t.runTimeParameters);return n.runType==="refresh"&&(t.runDetails.forceIgnoreWorkspaceStatus!==void 0?n.runDetails.forceIgnoreWorkspaceStatus=t.runDetails.forceIgnoreWorkspaceStatus:n.runDetails.forceIgnoreWorkspaceStatus!==void 0&&delete n.runDetails.forceIgnoreWorkspaceStatus),{runStatus:s?"waitingToRun":"initializing",runType:"refresh",runDetails:n.runDetails,userCredentials:a,reRunID:t.runDetails.runID,runTimeParameters:u,userID:o.fbUserID,kubernetesJobUuid:s}},MBc=async(r,t,n,i,o,s,a,u)=>{let{firebase:c,rootRepository:l,teamInfo:d,teamInfo:{fbUserID:p,fbTeamID:A}}=n,f=parseInt(t.runDetails.environmentID),h=await bF(l,d,f,o),y=await Din(l,r,t,h,d,u),I=await DIe(n,+y.runDetails.environmentID,a),v=await b6e(c,A,y,I),O=u?1:y.runDetails.parallelism,_=await lO.New(h,n,i,sZ(v.size,O));r.runTimeParameters=await CF(l,A,f,r.runTimeParameters);let w=EF(h,p);return await Min(_,p,i),yrs(n,new DE(_.getConnection(),h),y,f,_,w,i,I,v,!!u,s)},brs=async(r,t,n,i,o,s,a,u)=>{if(BA.appContext(i,"BECLI_HandleRerun"),t.runStatus!=="failed")throw new Error("Only failed jobs can be re-run!");if(Tdt(t))return MBc(r,t,n,i,o,s,a,u);throw new Error(`Run type ${t.runType} is not eligible for re-run`)};var wap=wc({newOrg:Qbt,newUser:w2([Nbt,kte()]),baseURL:Wi()}),Crs=r=>Irs(r,"runCounter"),d$e=r=>Irs(r,"environment ID"),Irs=(r,t)=>{let n=typeof r=="number"?r:parseInt(r||"");if(!r||isNaN(n))throw new _c(`Specify a valid ${t}`,`400: ${n} is not valid`);return n};var QFt=St(Zae());var xrs=St(require("node:fs")),Srs=St(require("node:child_process"));li();Ar();ul();Rf();vi();var x6e=ot.CLI;var IF=class extends Gt{constructor(n){super(`CLI exited with status ${n}`);this.exitCode=n}},Ep=async r=>{if(al().isTest)throw new IF(r);if(process.env.COALESCE_COA_CLOUD_JOB_ID){try{let t=process.env.COALESCE_COA_EXIT_STATUS_PATH||"/tmp/coa-exit-status";x6e.info(`Writing exit status ${r} to ${t}`),xrs.default.writeFileSync(t,r.toString())}catch(t){x6e.error("Unable to write exit status to file:",t)}x6e.info(`Running "kill -9 ${process.pid}" to kill cloud coa process`),Srs.default.spawnSync("kill",["-9",process.pid.toString()]),x6e.info("Finished running kill command"),setImmediate(async()=>{for(;;)await LU(1e3),x6e.info("Cloud coa still alive...waiting to die...")});return}setTimeout(()=>{setTimeout(()=>{process.exit(r)},1e3)},5e3);try{let t=c7e(),n=[];t.apps.length&&t.apps.forEach(i=>{n.push(t.app(i.name).delete())}),process.exitCode=r,await FL(n)}catch{x6e.error("Error while attempting to close Firebase apps in CLI")}},DBc=(r,t)=>{let n=[pit(),dit()],i={transports:n};if(r){let o={...ix[t],level:r};n.push(cde(o)),i.level=r}return i},vrs=(r,...t)=>{let n=Object.fromEntries(t.map(i=>[i,DBc(r,i)]));hit(n)},NFt=(r,t)=>{r&&!t||(t?vrs("debug",...Object.keys(ix)):vrs(null,...Object.keys(ix).filter(n=>n!="CLI")))};DR();var NBc=async(r,t,n,i,o)=>{Oa.infoContext(o,`Starting deploy job coa-${r}`);let s=qSi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),a=new Yye(s),u=d$e(a.runDetails.environmentID),c={...o,workspaceID:u},l=await pEe(t.rootRepository,t.teamInfo,u);await Tyt(t.teamInfo.fbTeamID,t.teamInfo.fbUserID,u,a.userCredentials,l);let d=await bF(t.rootRepository,t.teamInfo,u,MFt(a.userCredentials)),p=win(a,d,t.teamInfo.fbUserID,r);p.id=i;let A=t.rootRepository.org(t.teamInfo.fbTeamID).run(i);await A.updateHeartbeat({runStatus:"initializing"});let f=Mle(c,A,p.runType);try{let h=Math.max(...Object.values(a.runDetails.dividedStepDataWithWorkspaceEdits).map(I=>Object.keys(I).length)),y=await lO.New(d,t,c,sZ(h,a.runDetails.parallelism));return Bin(t,new DE(y.getConnection(),d),i,p,u,y,c,f,(0,QFt.GetPool)())}catch(h){try{await f()}catch(y){Oa.error("Unable to clean up hearbeat after handling error",h,"innerError",y)}throw h}},QBc=async(r,t,n,i,o)=>{Oa.infoContext(o,`Starting refresh job coa-${r}`);let a=kSi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),u=d$e(a.runDetails.environmentID),c={...o,workspaceID:u},l=await pEe(t.rootRepository,t.teamInfo,u);await Tyt(t.teamInfo.fbTeamID,t.teamInfo.fbUserID,u,a.userCredentials,l);let d=await bF(t.rootRepository,t.teamInfo,u,MFt(a.userCredentials));a.runTimeParameters=await CF(t.rootRepository,t.teamInfo.fbTeamID,u,a.runTimeParameters),Rin(a);let p=Tin(a,d,t.teamInfo.fbUserID,r);p.id=i;let A=t.rootRepository.org(t.teamInfo.fbTeamID),f=A.run(i);await f.updateHeartbeat({runStatus:"initializing"});let h=Mle(c,f,p.runType);try{let y=await DIe(t,u,A),I=await b6e(t.firebase,t.teamInfo.fbTeamID,p,y);await a$e(p,I,y,f);let v=EF(d,t.teamInfo.fbUserID),O=await lO.New(d,t,c,sZ(I.size,a.runDetails.parallelism));return DFt(t,new DE(O.getConnection(),d),p,u,i,O,v,c,y,I,h,(0,QFt.GetPool)())}catch(y){try{await h()}catch(I){Oa.error("Unable to clean up hearbeat after handling error",y,"innerError",I)}throw y}},PBc=async(r,t,n,i,o)=>{Oa.infoContext(o,`Starting re-run job coa-${r}`);let s=FSi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),a=new Kye(s);tb(a);let u=Crs(a.runDetails.runID),c=await s$e(t.firebase.firestore(),t.teamInfo.fbTeamID,u);if(!c)throw new Error(`Could not find runInfo for teamID=${t.teamInfo.fbTeamID}, oldRunID=${u}`);if(!Tdt(c))throw new Error("Run is not eligible for rerun or a dev run");let l=d$e(c.runDetails.environmentID),d={...o,workspaceID:l},p=await pEe(t.rootRepository,t.teamInfo,l);await Tyt(t.teamInfo.fbTeamID,t.teamInfo.fbUserID,l,a.userCredentials,p);let A=await bF(t.rootRepository,t.teamInfo,l,MFt(a.userCredentials)),f=await Din(t.rootRepository,a,c,A,t.teamInfo,r);f.id=i;let h=d$e(f.runDetails.environmentID);gu("RUNNER_BACKEND",h===l,d,"Unexpected mismatch between workspace IDs for re-run and original run; workspace for re-run:",h,"workspace for original run:",l);let y=t.rootRepository.org(t.teamInfo.fbTeamID),I=y.run(i);await I.updateHeartbeat({runStatus:"initializing"});let v=Mle(d,I,f.runType);try{let O=await DIe(t,h,y),_=await b6e(t.firebase,t.teamInfo.fbTeamID,f,O);await a$e(f,_,O,I);let w=EF(A,t.teamInfo.fbUserID),P=await lO.New(A,t,d,sZ(_.size,f.runDetails.parallelism));return DFt(t,new DE(P.getConnection(),A),f,l,i,P,w,d,O,_,v,(0,QFt.GetPool)())}catch(O){try{await v()}catch(_){Oa.error("Unable to clean up hearbeat after handling error",O,"innerError",_)}}},Ors=async r=>{if(Oa.debug("Cloud entrypoint."),!process.env.SCHEDULER_ADDRESS){let o="No SCHEDULER_ADDRESS defined for cloud entrypoint";throw Oa.emerg(o),new Error(o)}let t=await aZ(process.env.COALESCE_COA_CLOUD_TOKEN,void 0,new URL(process.env.SCHEDULER_ADDRESS)),n={orgID:t.teamInfo.fbTeamID,userID:t.teamInfo.fbUserID};Oa.infoContext(n,"Authenticated user.");let i;try{await KFi(t.firebase.firestore(),t.teamInfo.fbTeamID)&&(U$t(),Oa.debugContext(n,"CloudEntry: super Debug enabled"));let s=parseInt(process.env.COALESCE_COA_CLOUD_RUN_COUNTER);if(Number.isNaN(s))throw new Error(`Unable to parse runCounter: ${process.env.COALESCE_COA_CLOUD_RUN_COUNTER}!`);let a={...n,runID:s},u=process.env.COALESCE_COA_CLOUD_REQUEST_PATH;if(!u)throw new Gt("COALESCE_COA_CLOUD_REQUEST_PATH not set!");let c=iJt(WN(t.firebase.name)),l=D0e(c,u);Oa.infoContext(a,"Downloading request data...");let d=await $yn(l);Oa.infoContext(a,"Downloading request data completed!"),Oa.infoContext(a,"Deleting request data..."),await lrt(l),Oa.infoContext(a,"Deleting request data completed!"),Oa.infoContext(a,"Parsing request data as JSON...");let p=JSON.parse(Buffer.from(d).toString());Oa.infoContext(a,"Parsing request data as JSON completed!"),Oa.infoContext(a,"Renderer started!");let A=[r,t,p,s,a];switch(process.env.COALESCE_COA_CLOUD_ACTION){case"deploy":i=NBc(...A);break;case"refresh":i=QBc(...A);break;case"rerun":i=PBc(...A);break;default:throw new Gt(`Error: COALESCE_COA_CLOUD_ACTION is invalid! value=${process.env.COALESCE_COA_CLOUD_ACTION}`)}}catch(o){Oa.errorContext(n,"Error starting coa run",o);let s={error:{errorString:Iat(o),errorDetail:""},statusCode:500};o instanceof Gt?(s.error=o.toTRunError().error,s.statusCode=o.statusCode()):(s.error.errorString=o.error?.errorString??s.error.errorString,s.error.errorDetail=o.error?.errorDetail??s.error.errorDetail,s.statusCode=o.statusCode??s.statusCode),await Ep(1);return}try{Oa.infoContext(n,"Job started. Waiting for completion..."),await i,Oa.infoContext(n,"Job completed without exception!"),await Ep(0)}catch(o){Oa.errorContext(n,"Job completed with exception!",o),await Ep(1)}};var qrs=St(Lrs(),1),{program:mup,createCommand:yup,createArgument:Eup,createOption:bup,CommanderError:Cup,InvalidArgumentError:Urs,InvalidOptionArgumentError:Iup,Command:jrs,Argument:vup,Option:j6,Help:xup}=qrs.default;ait();var scs=St(Za());var PBe=St(require("fs")),acs=St(Vrs());li();var Yrs={openapi:"3.0.3",info:{version:"1.0.0",title:"Coalesce API",description:"REST API for performing operations with the Coalesce backend."},servers:[{url:"https://app.coalescesoftware.io",description:"US primary"},{url:"https://app.centralus.azure.coalescesoftware.io",description:"US primary Azure"},{url:"https://app.eu.coalescesoftware.io",description:"Europe primary"},{url:"https://app.australia-southeast1.gcp.coalescesoftware.io",description:"Australia primary"},{url:"https://app.us-east-1.aws.coalescesoftware.io",description:"US AWS US East"},{url:"https://app.us-east-1.aws.privatelink.coalescesoftware.io",description:"US AWS US East with PrivateLink"},{url:"https://app.us-west-2.aws.coalescesoftware.io",description:"US AWS US West"},{url:"https://app.us-west-2.aws.privatelink.coalescesoftware.io",description:"US AWS US West with PrivateLink"}],security:[{BearerAuth:[]}],"x-coa-private-pointers":["/paths/~1api~1v2~1render","/paths/~1api~1v2~1render~1health","/components/schemas/PackageDefinition","/components/schemas/RenderRequestV2"],components:{schemas:{EnvironmentsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of environment information.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/Environment"}},{type:"array",items:{$ref:"#/components/schemas/EnvironmentSummary"}}]}}},ProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/Project"}}}},ProjectResponse:{type:"object",required:["project"],properties:{project:{description:"Information about a project.",$ref:"#/components/schemas/Project"}}},TypesenseConfigResponse:{description:"Summary of configuration data for Typesense in a given org.","x-coa-private":!0,type:"object",required:["typesenseKey","typesenseHosts"],properties:{typesenseKey:{description:"The Typesense access key scoped to a users org.",type:"string"},typesenseHosts:{description:"The Typesense host address(es) for our cluster(s).",type:"array",items:{type:"string"}}}},EnvironmentSummary:{type:"object",description:"Summary information about an environment.",additionalProperties:!1,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string"},name:{type:"string"},project:{type:"string"},status:{$ref:"#/components/schemas/EnvironmentHealth"}},required:["createdAt","id","name","project","status"]},ErrorResponse:{description:"Error detail in addition to the HTTP status code and text.",type:"object",required:["error"],properties:{error:{$ref:"#/components/schemas/Error"}}},NodesResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of nodes for an environment.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/NodeSummary"}},{type:"array",items:{$ref:"#/components/schemas/Node"}}]}}},NodeSummary:{type:"object",properties:{database:{type:"string"},id:{type:"string"},locationName:{type:"string"},name:{type:"string"},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string"}},required:["database","id","locationName","name","nodeType","schema"]},OrderByDirection:{description:"The sort order for query results.",type:"string",enum:["asc","desc"]},PackageCreateEntity:{description:"A single package entity to be created.","x-coa-private":!0,type:"object",properties:{macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}}},required:["macros","dependencies","nodeTypes"]},PackageDependency:{description:"A package dependency.","x-coa-private":!0,type:"object",required:["version","macros","dependencies","releaseID","alias","packageID"],properties:{packageID:{type:"string"},alias:{type:"string"},version:{type:"string"},releaseID:{type:"string"},macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}}},example:{name:"foo",version:"1.2.3",macros:"{% macro bar() %}hello,{% endmacro %}",nodeTypes:{},dependencies:{dep:{name:"baz",version:"1.1.1",macros:"{% macro bar() %}world!{% endmacro %}",dependencies:{}}}}},PackageEntityTagV1:{description:"Identifies the package from which the entity came. (Deprecated, see PackageEntityTagV2).","x-coa-private":!0,type:"object",required:["id","version"],properties:{id:{type:"string"},version:{type:"string"}}},PackageEntityTagV2:{description:"Identifies the package from which the entity came.","x-coa-private":!0,type:"object",required:["id","releaseID"],properties:{id:{type:"string"},releaseID:{type:"string"}}},PackageMacro:{description:"A macro in a package.","x-coa-private":!0,type:"string"},PackageNodeType:{description:"A node type in a collection of nodeTypes to be packaged.","x-coa-private":!0,type:"object",required:["name","version","isDisabled","metadata"],properties:{name:{type:"string"},version:{type:"number"},id:{type:"string"},isDisabled:{type:"boolean"},metadata:{type:"object"},packageInfo:{type:"object"}}},PackageCreateReleaseInfo:{description:"Package release information for a create operation.","x-coa-private":!0,type:"object",properties:{changeLog:{type:"string"},version:{type:"string"},certified:{type:"boolean"}},required:["changeLog","version"]},PackageCreateEntities:{description:"Entities that are part of a package release.","x-coa-private":!0,required:["dependencies","nodeTypes","macros"],properties:{dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}},macros:{type:"string"}}},RunsOrderBy:{description:"The field used to sort query results.",type:"string",enum:["id","runStartTime","runEndTime"],default:"id"},RunsResponse:{description:"A collection of runs.",type:"object",required:["limit","orderBy","orderByDirection","data"],properties:{limit:{description:"The maximum number of runs returned by this query.",type:"integer"},orderByDirection:{$ref:"#/components/schemas/OrderByDirection"},orderBy:{$ref:"#/components/schemas/RunsOrderBy"},data:{description:"A collection of runs.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/RunSummary"}},{type:"array",items:{$ref:"#/components/schemas/RunInfo"}}]}}},RunResultsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of run results.",type:"array",items:{$ref:"#/components/schemas/RunResult"}}}},RunSummary:{type:"object",properties:{id:{description:"The run ID.",type:"integer"},reRunID:{description:"If this is a re-run, the ID of the original operation.",type:"string"},runStartTime:{description:"The datetime at which the run started.",type:"string",format:"date-time"},runEndTime:{description:"The datetime at which the run ended.",type:"string",format:"date-time"},runType:{$ref:"#/components/schemas/RunType"},runStatus:{$ref:"#/components/schemas/RunStatus"},environmentID:{description:"The environment in which the run operation was applied.",type:"string"},runFailureReason:{description:"Information about the cause of a run failure.",type:"string"}},required:["id","runType","runStatus"]},DatabaseInfoResponse:{type:"object",required:["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId","measurementId"],properties:{apiKey:{type:"string"},authDomain:{type:"string"},projectId:{type:"string"},storageBucket:{type:"string"},messagingSenderId:{type:"string"},appId:{type:"string"},measurementId:{type:"string"},emulatorInfo:{type:"object",required:["auth","firestore","storage"],properties:{auth:{type:"string"},firestore:{type:"string"},storage:{type:"string"}}}}},UserEnvironmentRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserEnvironmentRoles"},additionalProperties:!1},UserProjectRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserProjectRoles"},additionalProperties:!1},UserRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserOrgRoles"},additionalProperties:!1},FivetranProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/FivetranProject"}}}},FivetranProjectResponse:{type:"object",required:["project"],properties:{project:{description:"Fivetran project data.",$ref:"#/components/schemas/FivetranProject"}}},FivetranJobsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of job information.",type:"array",items:{$ref:"#/components/schemas/FivetranJob"}}}},FivetranJobHistoryResponse:{type:"object",required:["jobHistory"],properties:{jobHistory:{description:"Fivetran job history data.",$ref:"#/components/schemas/FivetranJobHistory"}}},FivetranRefreshJobResponse:{type:"object",required:["jobHistory"],properties:{jobHistory:{description:"A fivetran job",$ref:"#/components/schemas/FivetranJobHistory"}}},BaseEnvironment:{type:"object",description:"An environment is used for deploying your data pipeline to non-development Snowflake environments.",additionalProperties:!0,properties:{connectionAccount:{type:"string"},defaultStorageMapping:{type:"string",nullable:!0},description:{type:"string"},name:{type:"string"},oauthEnabled:{type:"boolean"},runTimeParameters:{type:"object",additionalProperties:!0},tagColors:{$ref:"#/components/schemas/TagColor"},project:{type:"string"}},required:["name","oauthEnabled","project"]},Environment:{description:"An environment is used for deploying your data pipeline to non-development Snowflake environments.",allOf:[{$ref:"#/components/schemas/BaseWorkspaceEnv"},{type:"object",additionalProperties:!0,properties:{runTimeParameters:{type:"object",additionalProperties:!0},currentMappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},required:["createdAt","id","status"]}]},EnvironmentCreateRequest:{"x-coa-private":!0,type:"object",description:"Initial values to set on a newly created environment.",allOf:[{$ref:"#/components/schemas/BaseEnvironment"},{type:"object",properties:{mappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},additionalProperties:!0}]},EnvironmentHealth:{type:"string",enum:["Deleting","Deploying","Failed Deploy","Failed Dev Run","Failed Refresh","Initializing","Refreshing","Running Dev Run","Waiting"]},EnvironmentStorageLocationMappings:{type:"object",additionalProperties:{type:"object",properties:{database:{type:"string"},schema:{type:"string"}}}},BaseProject:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",additionalProperties:!0,properties:{description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},required:["name"]},Project:{description:"A project groups environments and workspaces for easier management and access control.",allOf:[{$ref:"#/components/schemas/BaseProject"},{type:"object",additionalProperties:!0,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},updatedAt:{type:"string",format:"date-time"},updatedBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string"},status:{$ref:"#/components/schemas/ProjectStatus"},workspaces:{type:"array",items:{$ref:"#/components/schemas/WorkspaceSummary"}}},required:["createdAt","updatedAt","id","status","name"]}]},ProjectCreateRequest:{$ref:"#/components/schemas/BaseProject"},ProjectStatus:{type:"string",enum:["active","deleted"]},UserSummary:{type:"object",description:"Summary information about a user.",additionalProperties:!1,properties:{id:{type:"string"},firstName:{type:"string"},lastName:{type:"string"}},required:["id"]},FirestoreWebTimestamp:{type:"object",description:"Timestamp from the web Firestore SDK.",additionalProperties:!1,properties:{seconds:{type:"number"},nanoseconds:{type:"number"}},required:["seconds","nanoseconds"]},FirestoreAdminTimestamp:{type:"object",description:"Timestamp from the admin Firestore SDK.",additionalProperties:!1,properties:{_seconds:{type:"number"},_nanoseconds:{type:"number"}},required:["_seconds","_nanoseconds"]},FirestoreTimestamp:{type:"object",description:"Timestamp from either the web admin Firestore SDKs.",oneOf:[{$ref:"#/components/schemas/FirestoreWebTimestamp"},{$ref:"#/components/schemas/FirestoreAdminTimestamp"}]},Error:{type:"object",additionalProperties:!1,properties:{errorString:{description:"The error message.",type:"string"},errorDetail:{description:"Additional detail about the error.",type:"string"}},required:["errorString"]},Node:{type:"object",oneOf:[{$ref:"#/components/schemas/SourceNode"},{$ref:"#/components/schemas/SQLNode"}]},AliasToStepIDMapping:{type:"object",additionalProperties:{type:"string"}},AppliedColumnTests:{type:"object",additionalProperties:{type:"boolean"}},BaseNode:{type:"object",additionalProperties:!0,properties:{database:{type:"string"},description:{type:"string"},id:{type:"string"},locationName:{type:"string"},name:{type:"string"},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string"}},required:["database","description","id","locationName","name","nodeType","schema"]},ColumnMetadata:{type:"object",additionalProperties:!1,properties:{appliedColumnTests:{$ref:"#/components/schemas/AppliedColumnTests"},columnID:{type:"string"},columnReferences:{items:{$ref:"#/components/schemas/IntermediateColumnRefResult"},type:"array"},config:{type:"object",additionalProperties:!0},dataType:{type:"string"},defaultValue:{type:"string"},description:{type:"string"},hashDetails:{$ref:"#/components/schemas/HashMetadata"},hashedColumns:{type:"array",items:{$ref:"#/components/schemas/ColumnReference"}},isBusinessKey:{type:"boolean",description:"Tags the column as a business key."},isChangeTracking:{type:"boolean",description:"Tags the column as a change tracking column in type 2 dimensions."},isSurrogateKey:{type:"boolean",description:"Tags the column as a surrogate key, e.g. DIM_CUSTOMER_KEY."},keyColumnType:{type:"string",enum:["None","primaryBusinessKey","surrogateKey"]},name:{type:"string"},nullable:{type:"boolean"},primaryKey:{description:"Tags the column as a primary key.",type:"boolean"},sources:{items:{$ref:"#/components/schemas/SourceColumnReference"},type:"array"},systemColumnType:{type:"string",enum:["None","sysCreateDate","sysCurrentFlag","sysEndDate","sysStartDate","sysUpdateDate","sysVersion"]},transform:{type:"string"},uniqueKey:{type:"boolean"}},required:["columnID","dataType","description","name","nullable"]},ColumnReference:{type:"object",additionalProperties:!1,properties:{columnID:{type:"string"},nodeID:{type:"string"}},required:["columnID","nodeID"]},CustomSQL:{type:"object",additionalProperties:!1,properties:{customSQL:{type:"string"}},required:["customSQL"]},HashAlgorithm:{type:"string",enum:["MD5","SHA1","SHA256"]},HashMetadata:{type:"object",additionalProperties:!1,properties:{hashAlgorithm:{$ref:"#/components/schemas/HashAlgorithm"},hashType:{enum:["ChangeHash","Hash","HubHash","LinkHash","None"],type:"string"},hubHashes:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"}},required:["hashAlgorithm"]},IntermediateColumnRefResult:{additionalProperties:!1,properties:{columnName:{type:"string"},tableName:{type:"string",nullable:!0}},required:["columnName","tableName"],type:"object"},JoinCondition:{type:"object",additionalProperties:!1,properties:{joinCondition:{type:"string"}},required:["joinCondition"]},NodeType:{anyOf:[{type:"string",enum:["Dimension","Fact","Hub","Link","Satellite","Source","Stage","View","persistentStage"]},{type:"string"}]},RefLink:{type:"object",additionalProperties:!1,properties:{locationName:{type:"string"},nodeName:{type:"string"}},required:["locationName","nodeName"]},SourceColumnReference:{anyOf:[{$ref:"#/components/schemas/SourceColumnReferenceV1"},{$ref:"#/components/schemas/SourceColumnReferenceV2"}]},SourceColumnReferenceV1:{type:"object",additionalProperties:!1,properties:{columnReferences:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"},transform:{type:"string"}},required:["columnReferences","transform"]},SourceColumnReferenceV2:{type:"object",additionalProperties:!1,properties:{transform:{type:"string"}},required:["transform"]},SourceMap:{additionalProperties:!1,properties:{aliases:{$ref:"#/components/schemas/AliasToStepIDMapping"},customSQL:{$ref:"#/components/schemas/CustomSQL"},dependencies:{items:{$ref:"#/components/schemas/RefLink"},type:"array"},join:{$ref:"#/components/schemas/JoinCondition"},name:{type:"string"},noLinkRefs:{items:{$ref:"#/components/schemas/RefLink"},type:"array"}},required:["dependencies","join","name","noLinkRefs"],type:"object"},RunStatus:{enum:["canceled","completed","failed","initializing","rendering","running","waitingToRun"],type:"string"},RunType:{enum:["deploy","refresh"],type:"string"},UserConnectionType:{type:"string",enum:["Basic","Cloud","KeyPair","OAuth"]},DeployRunDetails:{type:"object",additionalProperties:!1,properties:{canceled:{type:"boolean"},deployCommit:{type:"string"},deployCommitMessage:{type:"string"},environmentID:{type:"string"},parallelism:{type:"integer"},nodesInRun:{type:"integer"}},required:["deployCommit","environmentID"]},RefreshRunDetails:{type:"object",additionalProperties:!1,properties:{canceled:{type:"boolean"},environmentID:{type:"string"},excludeNodesSelector:{type:"string"},forceIgnoreEnvironmentStatus:{type:"boolean"},includeNodesSelector:{type:"string"},jobID:{type:"integer"},parallelism:{type:"integer"},refreshDescription:{type:"string"},nodesForRefresh:{type:"integer"},nodesInRun:{type:"integer"}},required:["environmentID"]},RunDetails:{description:"Detailed information about a run.",anyOf:[{$ref:"#/components/schemas/DeployRunDetails"},{$ref:"#/components/schemas/RefreshRunDetails"}]},RunInfo:{description:"The full details of a run, without the run results.",type:"object",additionalProperties:!1,properties:{id:{type:"integer"},reRunID:{type:"string"},runDetails:{$ref:"#/components/schemas/RunDetails"},runEndTime:{format:"date-time",type:"string"},runHistory:{items:{type:"integer"},type:"array"},runStartTime:{format:"date-time",type:"string"},runStatus:{$ref:"#/components/schemas/RunStatus"},runTimeParameters:{type:"object",additionalProperties:!0},runType:{$ref:"#/components/schemas/RunType"},userCredentials:{$ref:"#/components/schemas/SnowflakeUserCredentials"},userID:{type:"string"},version:{type:"integer"}},required:["id","runDetails","runStatus","runTimeParameters","runType"]},SnowflakeUserCredentials:{description:"Information about the Snowflake account used to perform a run.",type:"object",additionalProperties:!1,properties:{snowflakeAccount:{type:"string"},snowflakeAuthType:{$ref:"#/components/schemas/UserConnectionType"},snowflakeRole:{type:"string"},snowflakeUsername:{type:"string"},snowflakeWarehouse:{type:"string"}},required:["snowflakeAccount","snowflakeAuthType","snowflakeUsername"]},QueryResult:{type:"object",additionalProperties:!1,properties:{endTime:{type:"string",format:"date-time"},error:{$ref:"#/components/schemas/Error"},isRunning:{type:"boolean"},name:{type:"string"},queryID:{type:"string"},rowsDeleted:{type:"integer"},rowsInserted:{type:"integer"},rowsUpdated:{type:"integer"},sql:{type:"string"},startTime:{type:"string",format:"date-time"},status:{type:"string"},success:{type:"boolean"},warehouse:{type:"string"}},required:["isRunning","name","sql","status","success"]},RunResult:{type:"object",additionalProperties:!1,description:"The result output describing each query processed during a run.",properties:{isRunning:{type:"boolean"},name:{type:"string"},nodeID:{type:"string"},queryResults:{items:{$ref:"#/components/schemas/QueryResult"},type:"array"},renderQueryResult:{$ref:"#/components/schemas/QueryResult"}},required:["isRunning","name","nodeID","queryResults"]},OrgRoles:{type:"object",description:"Specifies role assignments.",required:["organizationRoles","projects"],properties:{organizationRoles:{description:"The organization roles assigned to the user.",type:"array",items:{type:"string"}},projects:{description:"A dictionary of project role assignments keyed by project ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/ProjectRoles"}}},additionalProperties:!0},ProjectRoles:{type:"object",description:"Specifies project role assignments.",required:["projectRoles","environments"],properties:{projectRoles:{type:"array",items:{type:"string"}},environments:{description:"A dictionary of environment role assignments keyed by environment ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/EnvironmentRoles"}}},additionalProperties:!0},EnvironmentRoles:{type:"object",description:"Specifies environment role assignments.",required:["environmentRoles"],properties:{environmentRoles:{description:"The environment roles assigned to the user.",type:"array",items:{type:"string"}}},additionalProperties:!0},UserOrgRoles:{description:"The roles assigned to a user.",allOf:[{$ref:"#/components/schemas/OrgRoles"},{type:"object",required:["user","organizationRoles","projects"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserProjectRoles:{description:"The project roles assigned to the user.",allOf:[{$ref:"#/components/schemas/ProjectRoles"},{type:"object",required:["user","projectRoles","environments"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserEnvironmentRoles:{description:"The environment roles assigned to the user.",allOf:[{$ref:"#/components/schemas/EnvironmentRoles"},{type:"object",required:["user"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},FivetranProject:{type:"object",properties:{id:{type:"string"},name:{type:"string"},createdAtUtc:{type:"string",format:"date-time"},updatedAtUtc:{type:"string",format:"date-time"},extras:{type:"object",description:"Additional data, if applicable"}},required:["id","name","createdAtUtc","updatedAtUtc"]},FivetranJob:{type:"object",properties:{id:{type:"string"},projectId:{type:"string"},name:{type:"string"},createdAtUtc:{type:"string",format:"date-time"},updatedAtUtc:{type:"string",format:"date-time"},extras:{type:"object",description:"Additional data, if applicable"}}},FivetranJobHistory:{type:"object",properties:{id:{type:"string"},jobId:{type:"string"},status:{$ref:"#/components/schemas/FivetranJobStatus"},startedAtUtc:{type:"string",format:"date-time",nullable:!0},endedAtUtc:{type:"string",format:"date-time",nullable:!0},logs:{type:"array",items:{type:"string"}},extras:{type:"object",description:"Additional data, if applicable"}}},FivetranJobStatus:{type:"string",description:"Possible statuses of jobs",enum:["NEW","SCHEDULING","RUNNING","COMPLETED","TERMINATING","PAUSED","STOPPED","FAILED"]},RegistryPackageReleaseResult:{description:"A single release of a package in the registry.",type:"object",properties:{createdBy:{type:"string"},createdAt:{type:"string",format:"date-time"},updatedBy:{type:"string"},updatedAt:{type:"string",format:"date-time"},version:{type:"string"},changeLog:{type:"string"},releaseID:{type:"string"},storagePath:{type:"string"},privacy:{type:"string",enum:["public","private","unlisted"]}},required:["createdBy","createdAt","version","changeLog","releaseID","storagePath","privacy"]},RegistryPackageResult:{description:"A single package in the registry.",type:"object",properties:{updatedBy:{type:"string"},updatedAt:{type:"string",format:"date-time"},name:{type:"string"},publisherID:{type:"string"},description:{type:"string"},org:{type:"string"},latestRelease:{type:"string"},overview:{type:"string"},featured:{type:"boolean"},tags:{type:"array",minItems:0,items:{type:"string"}},certified:{type:"boolean"},packageID:{type:"string"}},required:["name","description","org","latestRelease","overview","tags","featured","certified","publisherID","packageID"]},BaseWorkspaceEnv:{type:"object",description:"A workspace is a collection of resources that are used to develop, test, and deploy code.",additionalProperties:!0,properties:{connectionAccount:{type:"string"},defaultStorageMapping:{type:"string",nullable:!0},description:{type:"string"},name:{type:"string"},oauthEnabled:{type:"boolean"},tagColors:{$ref:"#/components/schemas/TagColor"},project:{type:"string"},createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},updatedAt:{type:"string",format:"date-time"},currentGitBranch:{type:"string"},currentGitCommit:{type:"string"},currentGitURL:{type:"string"},currentlyRunningJobs:{type:"array",items:{type:"integer"}},id:{type:"string"},deployedCommit:{type:"string"},status:{$ref:"#/components/schemas/WorkspaceEnvHealth"}},required:["createdAt","updatedAt","id","name","oauthEnabled","project","status"]},Workspace:{allOf:[{$ref:"#/components/schemas/BaseWorkspaceEnv"},{type:"object",additionalProperties:!0,properties:{mappingsV1:{type:"string"},runTimeParameters:{type:"string"},jobs:{type:"array",items:{$ref:"#/components/schemas/Job"}}}}]},WorkspaceSummary:{type:"object",description:"A set of minimal workspace data.",additionalProperties:!0,properties:{id:{type:"string"},name:{type:"string"},project:{type:"string"},status:{$ref:"#/components/schemas/WorkspaceEnvHealth"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},jobs:{type:"array",items:{$ref:"#/components/schemas/Job"}}},required:["createdAt","createdBy","updatedAt","id","name","status","project"]},WorkspaceEnvHealth:{type:"string",enum:["Deleting","Deploying","Failed Deploy","Failed Refresh","Initializing","Refreshing","Waiting"]},TagColor:{type:"object",additionalProperties:!1,properties:{backgroundColor:{type:"string"},textColor:{type:"string"}}},SourceColumnMetadata:{type:"object",additionalProperties:!1,properties:{columns:{items:{$ref:"#/components/schemas/ColumnMetadata"},type:"array"},join:{type:"object",additionalProperties:!1,properties:{joinCondition:{type:"string"}},required:["joinCondition"]},sourceMapping:{type:"array",items:{$ref:"#/components/schemas/SourceMap"}}},required:["columns"]},SourceNode:{type:"object",allOf:[{$ref:"#/components/schemas/BaseNode"}],additionalProperties:!0,properties:{metadata:{$ref:"#/components/schemas/SourceColumnMetadata"},table:{type:"string"}},required:["database","description","locationName","metadata","name","nodeType","schema","table"]},MaterializationType:{type:"string",enum:["table","view"]},NodeTest:{type:"object",additionalProperties:!1,properties:{continueOnFailure:{type:"boolean"},description:{type:"string"},name:{type:"string"},runOrder:{$ref:"#/components/schemas/TestRunOrder"},templateString:{type:"string"}},required:["continueOnFailure","description","name","runOrder","templateString"]},SQLNode:{type:"object",allOf:[{$ref:"#/components/schemas/BaseNode"}],additionalProperties:!0,properties:{config:{$ref:"#/components/schemas/UserConfig"},isMultisource:{type:"boolean"},materializationType:{$ref:"#/components/schemas/MaterializationType"},metadata:{$ref:"#/components/schemas/SQLNodeMetadata"},overrideSQL:{type:"boolean"}},required:["config","database","description","isMultisource","locationName","materializationType","metadata","name","nodeType","overrideSQL","schema"]},SQLNodeMetadata:{type:"object",additionalProperties:!1,properties:{appliedNodeTests:{default:[],items:{$ref:"#/components/schemas/NodeTest"},type:"array"},columns:{default:[],items:{$ref:"#/components/schemas/ColumnMetadata"},type:"array"},cteString:{type:"string"},description:{type:"string"},destinationName:{type:"string"},enabledColumnTestIDs:{type:"array",items:{type:"string"}},mapping:{type:"object",additionalProperties:{anyOf:[{type:"object"},{type:"string"},{type:"number"},{type:"boolean"}]}},materializationOption:{type:"string"},sourceMapping:{type:"array",items:{$ref:"#/components/schemas/SourceMap"}}},required:["appliedNodeTests","columns","enabledColumnTestIDs","sourceMapping"]},TestRunOrder:{type:"string",enum:["After","Before"]},UserConfig:{type:"object",additionalProperties:{anyOf:[{type:"object"},{type:"string"},{type:"number"},{type:"boolean"}]}},Job:{type:"object",description:"A coalesce job.",additionalProperties:!0,properties:{id:{type:"string"},name:{type:"string"},includeSelector:{type:"string"},excludeSelector:{type:"string"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","name","includeSelector","excludeSelector","createdAt","updatedAt"]}},responses:{CoaTagResponse:{description:"The coa image tag being used.","x-coa-private":!0,content:{"application/json":{schema:{type:"string"}}}},CoaTagReportResponse:{description:"A report of what coa image tags are being used for what orgs.","x-coa-private":!0,content:{"application/json":{schema:{type:"object",required:["defaultTag","deviatingOrgs"],properties:{defaultTag:{type:"string"},deviatingOrgs:{type:"array",items:{type:"object",required:["orgID","orgName","tag","image"],properties:{orgID:{type:"string"},orgName:{type:"string"},tag:{type:"string"},image:{type:"string"}}}}}}}}},CustomTokenResponse:{description:"The Coalesce custom token response","x-coa-private":!0,content:{"application/json":{schema:{type:"object",required:["customToken"],properties:{customToken:{description:"A Coalesce token",type:"string"}}}}}},EnvironmentResponse:{description:"Information about an environment.",content:{"application/json":{schema:{$ref:"#/components/schemas/Environment"}}}},EnvironmentsResponse:{description:"A collection of environment information.",content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentsResponse"}}}},ProjectsResponse:{description:"A collection of project information.",content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectsResponse"}}}},FivetranProjectsResponse:{description:"A collection of project information.",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranProjectsResponse"}}}},FivetranJobsResponse:{description:"A collection of Fivetran job information.",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranJobsResponse"}}}},FivetranJobHistoryResponse:{description:"Fivetran job history data.",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranJobHistoryResponse"}}}},FivetranRefreshJobResponse:{description:"The Fivetran start job refresh response.",content:{"application/json":{schema:{type:"object",required:["jobHistory"],properties:{jobHistory:{description:"Fivetran job history for the new run.",$ref:"#/components/schemas/FivetranJobHistory"}}}}}},NodeResponse:{description:"A node for an environment.",content:{"application/json":{schema:{$ref:"#/components/schemas/Node"}}}},NodesResponse:{description:"A collection of nodes for an environment.",content:{"application/json":{schema:{$ref:"#/components/schemas/NodesResponse"}}}},PackageResponse:{description:"A package registration","x-coa-private":!0,content:{"application/json":{schema:{type:"object",required:["releaseID","packageID","storePath","publisherID"],properties:{releaseID:{type:"string"},publisherID:{type:"string"},packageID:{type:"string"},storePath:{type:"string"}}}}}},PackageUpdateResponse:{description:"Successful package update","x-coa-private":!0,content:{"application/json":{schema:{type:"string"}}}},AllRegistryPackagesResult:{description:"A list of all packages in the registry.",content:{"application/json":{schema:{type:"array",minItems:0,items:{$ref:"#/components/schemas/RegistryPackageResult"}}}}},AllRegistryPackageReleasesResult:{description:"A list of all releases for a single package in the registry.",content:{"application/json":{schema:{type:"array",minItems:1,items:{$ref:"#/components/schemas/RegistryPackageReleaseResult"}}}}},RegistryPackageResult:{description:"A single package in the registry.",content:{"application/json":{schema:{$ref:"#/components/schemas/RegistryPackageResult"}}}},RegistryPackageReleaseResult:{description:"A single release for a single package in the registry.",content:{"application/json":{schema:{$ref:"#/components/schemas/RegistryPackageReleaseResult"}}}},ProjectResponse:{description:"Information about a project.",content:{"application/json":{schema:{$ref:"#/components/schemas/Project"}}}},RunResultsResponse:{description:"A collection of results for a deploy or refresh run.",content:{"application/json":{schema:{$ref:"#/components/schemas/RunResultsResponse"}}}},RunResponse:{description:"A single run.",content:{"application/json":{schema:{$ref:"#/components/schemas/RunInfo"}}}},RunsResponse:{description:"A collection of runs.",content:{"application/json":{schema:{$ref:"#/components/schemas/RunsResponse"}}}},DatabaseInfoResponse:{description:"Information required to connect to the Coalesce database.",content:{"application/json":{schema:{$ref:"#/components/schemas/DatabaseInfoResponse"}}}},secretExists:{"x-coa-private":!0,description:"Specifies whether or not a value for the secret exists.",content:{"application/json":{schema:{type:"boolean"}}}},ValidHostname:{"x-coa-private":!0,description:"A whitelisted version of the passed hostname.",content:{"application/json":{schema:{type:"string"}}}},TypesenseConfigurationResponse:{"x-coa-private":!0,description:"The typesense configuration data for a given org.",content:{"application/json":{schema:{$ref:"#/components/schemas/TypesenseConfigResponse"}}}},UserEnvironmentRoleResponse:{description:"A user's environment role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentRoles"}}}},UserEnvironmentRolesResponse:{description:"A collection of user environment role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/UserEnvironmentRolesResponse"}}}},UserProjectRoleResponse:{description:"A user's project role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectRoles"}}}},UserProjectRolesResponse:{description:"A collection of user project role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/UserProjectRolesResponse"}}}},UserRoleResponse:{description:"A user's role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/OrgRoles"}}}},UserRolesResponse:{description:"A collection of user role information.",content:{"application/json":{schema:{$ref:"#/components/schemas/UserRolesResponse"}}}},AlreadyExistsError:{description:"The requested resource already exists.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},BadGatewayError:{description:"The server received an error from an upstream system.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},ForbiddenError:{description:"The client is not permitted to perform the requested operation.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},GatewayTimeoutError:{description:"The server did not receive a response in time from an upstream system.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},InternalServerError:{description:"The server encountered an unexpected condition that prevented it from fulfilling the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},InvalidRequestError:{description:"The request was invalid.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},NotFoundError:{description:"The requested resource could not be found.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},ServiceUnavailableError:{description:"The service is currently unavailable.",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}},Unauthorized:{description:"User lacks authorization to perform this action."}},parameters:{orderByDirection:{name:"orderByDirection",description:"The sort order for query results.",in:"query",schema:{description:"The sort order for query results.",type:"string",enum:["asc","desc"],default:"desc"},required:!1},secretType:{"x-coa-private":!0,description:"The name of the secret type.",name:"secretType",in:"path",schema:{type:"string"},required:!0},context:{description:"Contextual information required to identify a particular secret.",name:"context",in:"path",schema:{type:"string"},required:!0},orgId:{"x-coa-private":!0,description:"The Organization ID of the organization that will be affected by the API call.",name:"orgId",in:"path",schema:{type:"string"},required:!0},runId:{"x-coa-private":!0,description:"The Run ID of the run that will be affected by the API call.",name:"runId",in:"path",schema:{type:"integer"},required:!0},coaTag:{"x-coa-private":!0,description:"A coa container image tag in Google Container Registry.",name:"coaTag",in:"path",schema:{type:"string"},required:!0}},securitySchemes:{BearerAuth:{type:"http",scheme:"bearer"}}},paths:{"/api/v1/customToken":{summary:"Custom Token","x-coa-private":!0,post:{summary:"Generate Custom Token",description:"Generate a Coalesce token from the provided OpenID Connect ID token",operationId:"GenerateCustomToken","x-eov-operation-handler":"SSOHandlers",requestBody:{description:"The information from the OpenID Connect authorization server required to sign into Coalesce.",required:!0,content:{"application/json":{schema:{type:"object",required:["idToken","accessToken","orgID"],properties:{idToken:{type:"string"},accessToken:{type:"string"},orgID:{type:"string"}},additionalProperties:!1}}}},security:[],tags:["Authorization"],responses:{"200":{$ref:"#/components/responses/CustomTokenResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments":{summary:"Environments","x-coa-command-group":"environments",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Environments",description:"Get a collection of environment information.",operationId:"GetEnvironments","x-eov-operation-handler":"EnvironmentHandlers","x-coa-command":"list",parameters:[{name:"detail",description:"Include the full detail of the environments.",in:"query",schema:{type:"boolean",default:!1},required:!1}],security:[{BearerAuth:[]}],tags:["Environments"],responses:{"200":{$ref:"#/components/responses/EnvironmentsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},post:{summary:"Create Environment",description:"Create a new environment.",operationId:"CreateEnvironment","x-eov-operation-handler":"EnvironmentHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Environments"],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentCreateRequest"}}}},responses:{"201":{$ref:"#/components/responses/EnvironmentResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments/{environmentID}":{summary:"Environment","x-coa-command-group":"environments",parameters:[{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],delete:{summary:"Delete Environment",description:"Delete an environment.",operationId:"DeleteEnvironment","x-eov-operation-handler":"EnvironmentHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Environments"],responses:{"204":{description:"The environment was successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},get:{summary:"Get Environment",description:"Get information about an environment.",operationId:"GetEnvironment","x-eov-operation-handler":"EnvironmentHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Environments"],responses:{"200":{$ref:"#/components/responses/EnvironmentResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments/{environmentID}/nodes":{summary:"Nodes","x-coa-command-group":"nodes",parameters:[{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Nodes",description:"Get a collection of nodes for an environment",operationId:"GetNodes","x-eov-operation-handler":"NodeHandlers","x-coa-command":"list",parameters:[{name:"detail",description:"Include the full detail of the nodes.",in:"query",schema:{type:"boolean",default:!1},required:!1}],security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodesResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/environments/{environmentID}/nodes/{nodeID}":{summary:"Node","x-coa-command-group":"nodes",parameters:[{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"nodeID",description:"The node ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"Get Node",description:"Get information about a node in an environment.",operationId:"GetNode","x-eov-operation-handler":"NodeHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodeResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/workspaces/{workspaceID}/nodes":{summary:"Nodes","x-coa-command-group":"workspace-nodes",parameters:[{name:"workspaceID",description:"The workspace ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Workspace Nodes",description:"Get a collection of nodes for a workspace (Preview).",operationId:"GetWorkspaceNodes","x-eov-operation-handler":"NodeHandlers","x-coa-command":"list",parameters:[{name:"detail",description:"Include the full detail of the nodes.",in:"query",schema:{type:"boolean",default:!1},required:!1}],security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodesResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/workspaces/{workspaceID}/nodes/{nodeID}":{summary:"Node","x-coa-command-group":"workspace-nodes",parameters:[{name:"workspaceID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0},{name:"nodeID",description:"The node ID.",in:"path",schema:{type:"string"},required:!0},{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"Get Node",description:"Get information about a node in a workspace (Preview).",operationId:"GetWorkspaceNode","x-eov-operation-handler":"NodeHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Nodes"],responses:{"200":{$ref:"#/components/responses/NodeResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{summary:"Set Node",description:"Replace all fields of a node in a workspace (Preview).",operationId:"SetWorkspaceNode","x-eov-operation-handler":"NodeHandlers","x-coa-command":"put",security:[{BearerAuth:[]}],tags:["Nodes"],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Node"}}}},responses:{"200":{$ref:"#/components/responses/NodeResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/projects":{summary:"Projects","x-coa-private":!0,get:{summary:"Get Projects",description:"Get projects in org.",operationId:"GetProjectsInOrg","x-eov-operation-handler":"ProjectHandlers",parameters:[{name:"includeWorkspaces",description:"Whether or not to include nested workspace data for all projects.",in:"query",schema:{type:"boolean"},required:!1},{name:"includeJobs",description:"Whether or not to include nested job data for all workspaces in the projects.",in:"query",schema:{type:"boolean"},required:!1}],security:[{BearerAuth:[]}],tags:["Projects"],responses:{"200":{$ref:"#/components/responses/ProjectsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},post:{summary:"Create Project",description:"Create a new project.",operationId:"CreateProject","x-eov-operation-handler":"ProjectHandlers",security:[{BearerAuth:[]}],tags:["Projects"],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectCreateRequest"}}}},responses:{"201":{$ref:"#/components/responses/ProjectResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/projects/{projectID}":{summary:"Projects","x-coa-command-group":"projects",parameters:[{name:"projectID",description:"The project ID.",in:"path",schema:{type:"string"},required:!0},{name:"includeWorkspaces",description:"Whether or not to include nested workspace data for all projects.",in:"query",schema:{type:"boolean"},required:!1},{name:"includeJobs",description:"Whether or not to include nested job data for all workspaces in the projects.",in:"query",schema:{type:"boolean"},required:!1}],get:{summary:"Get Project",description:"Get a project.",operationId:"GetProjectInOrg","x-eov-operation-handler":"ProjectHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Projects"],responses:{"200":{description:"Successful response",content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectResponse"}}}},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{summary:"Delete Project",description:"Delete a project.",operationId:"DeleteProject","x-eov-operation-handler":"ProjectHandlers","x-coa-private":!0,security:[{BearerAuth:[]}],tags:["Projects"],responses:{"204":{description:"The project was successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/projects":{summary:"Fivetran Projects","x-coa-private":!0,get:{summary:"Get Fivetran Projects",description:"Get fivetran projects in org.",operationId:"GetFivetranProjects","x-eov-operation-handler":"FivetranHandlers",security:[{BearerAuth:[]}],tags:["Projects"],responses:{"200":{$ref:"#/components/responses/FivetranProjectsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/projects/{projectId}":{get:{summary:"Gets a single Fivetran project.",operationId:"GetFivetranProject","x-eov-operation-handler":"FivetranHandlers",parameters:[{name:"projectId",in:"path",description:"The unique identifier for the project",required:!0,schema:{type:"string"}}],responses:{"200":{description:"Successful response",content:{"application/json":{schema:{$ref:"#/components/schemas/FivetranProjectResponse"}}}},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/projects/{projectId}/jobs":{summary:"Fivetran Jobs","x-coa-private":!0,get:{summary:"Get Fivetran jobs",description:"Get Fivetran jobs.",operationId:"GetFivetranJobs","x-eov-operation-handler":"FivetranHandlers",parameters:[{name:"projectId",in:"path",description:"The unique identifier for the project",required:!0,schema:{type:"string"}}],security:[{BearerAuth:[]}],tags:["Jobs"],responses:{"200":{$ref:"#/components/responses/FivetranJobsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/jobs/{jobId}/history/{historyId}":{summary:"Fivetran Job History","x-coa-private":!0,get:{parameters:[{name:"jobId",description:"The Fivetran job ID.",in:"path",schema:{type:"string"},required:!0},{name:"historyId",description:"The Fivetran history ID.",in:"path",schema:{type:"string"},required:!0}],summary:"Get Fivetran Job History",description:"Get Fivetran job history in org.",operationId:"GetFivetranJobHistory","x-eov-operation-handler":"FivetranHandlers",security:[{BearerAuth:[]}],tags:["Jobs"],responses:{"200":{$ref:"#/components/responses/FivetranJobHistoryResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/integrations/fivetran/jobs/{jobId}/run":{summary:"Start a refresh job via Fivetran","x-coa-private":!0,post:{parameters:[{name:"jobId",description:"The Fivetran job ID.",in:"path",schema:{type:"string"},required:!0}],summary:"Start a refresh job via Fivetran",operationId:"PostFivetranJobRefresh","x-eov-operation-handler":"FivetranHandlers",security:[{BearerAuth:[]}],tags:["Jobs"],responses:{"201":{$ref:"#/components/responses/FivetranRefreshJobResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles":{summary:"User Roles","x-coa-private":!0,get:{summary:"List User Roles",description:"Get all user roles in the organization, filtered by information available based on the current user's roles and sorted alphabetically by last name, then by first name.",operationId:"GetUserRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],parameters:[{name:"excludeOrgRoles",description:"Exclude organization level roles from the results.",in:"query",schema:{type:"boolean"}},{name:"projectID",description:"Return only user roles pertaining to the specified project.",in:"query",schema:{type:"string"},required:!1},{name:"environmentID",description:"Return only user roles pertaining to the specified environment.",in:"query",schema:{type:"string"},required:!1}],responses:{"200":{$ref:"#/components/responses/UserRolesResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles/{userID}/organizationRoles":{summary:"Organization User Roles","x-coa-private":!0,parameters:[{name:"userID",description:"The user ID.",in:"path",schema:{type:"string"},required:!0}],put:{summary:"Create/Update User Organization Roles",description:"Creates or updates all of a user's organization roles. Only org admins may use this API.",operationId:"UpsertUserOrganizationRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],requestBody:{description:"The user's organization roles.",required:!0,content:{"application/json":{schema:{type:"array",items:{type:"string"}}}}},responses:{"200":{$ref:"#/components/responses/UserRoleResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles/{userID}/projects/{projectID}/environments/{environmentID}":{summary:"Environment User Roles","x-coa-private":!0,parameters:[{name:"userID",description:"The user ID.",in:"path",schema:{type:"string"},required:!0},{name:"projectID",description:"The project ID.",in:"path",schema:{type:"string"},required:!0},{name:"environmentID",description:"The environment ID.",in:"path",schema:{type:"string"},required:!0}],delete:{summary:"Delete Environment User Roles",description:"Deletes all of a user's environment roles.",operationId:"DeleteUserEnvironmentRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],responses:{"204":{description:"The user's environment roles were successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{summary:"Create/Update Environment User Roles",description:"Creates or updates all of a user's environment roles.",operationId:"UpsertUserEnvironmentRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],requestBody:{description:"The user environment roles.",required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/EnvironmentRoles"}}}},responses:{"200":{$ref:"#/components/responses/UserEnvironmentRoleResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/userRoles/{userID}/projects/{projectID}":{summary:"Project User Roles","x-coa-private":!0,parameters:[{name:"userID",description:"The user ID.",in:"path",schema:{type:"string"},required:!0},{name:"projectID",description:"The project ID.",in:"path",schema:{type:"string"},required:!0}],delete:{summary:"Delete Project User Roles",description:"Deletes all of a user's project roles. Only org and project admins may user this API.",operationId:"DeleteUserProjectRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],responses:{"204":{description:"The user's project roles were successfully deleted."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{summary:"Create/Update Project User Roles",description:"Creates or updates all of a user's project roles. Only org and project admins may user this API.",operationId:"UpsertUserProjectRoles","x-eov-operation-handler":"UserRolesHandlers",tags:["UserRoles"],requestBody:{description:"The user project roles.",required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ProjectRoles"}}}},responses:{"200":{$ref:"#/components/responses/UserProjectRoleResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/all":{summary:"All Packages","x-coa-private":!0,get:{description:"Get all available packages on the registry.",operationId:"GetAllRegistryPackages","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],responses:{"200":{$ref:"#/components/responses/AllRegistryPackagesResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/{packageID}/releases":{summary:"All Package Releases","x-coa-private":!0,get:{description:"Get all available releases for a package on the registry.",operationId:"GetAllRegistryPackageReleases","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],parameters:[{name:"packageID",description:"The package id.",in:"path",schema:{type:"string"},required:!0}],responses:{"200":{$ref:"#/components/responses/AllRegistryPackageReleasesResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/{packageID}":{summary:"Package","x-coa-private":!0,get:{description:"Get a package on the registry.",operationId:"GetRegistryPackage","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],parameters:[{name:"packageID",description:"The package id.",in:"path",schema:{type:"string"},required:!0}],responses:{"200":{$ref:"#/components/responses/RegistryPackageResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/{packageID}/releases/{releaseID}":{summary:"Package Release","x-coa-private":!0,get:{description:"Get a release from a package in the registry.",operationId:"GetRegistryPackageRelease","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],parameters:[{name:"packageID",description:"The package id.",in:"path",schema:{type:"string"},required:!0},{name:"releaseID",description:"The package release ID.",in:"path",schema:{type:"string"},required:!0}],responses:{"200":{$ref:"#/components/responses/RegistryPackageReleaseResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/org":{summary:"Organization Packages","x-coa-private":!0,get:{description:"Get a release from a package in the registry.",operationId:"GetRegistryPackagesForOrg","x-eov-operation-handler":"PackageRegistryHandlers",tags:["PackageRegistry"],responses:{"200":{$ref:"#/components/responses/AllRegistryPackagesResult"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/createPackage":{summary:"Packages","x-coa-private":!0,post:{description:"Create a package.",operationId:"CreatePackage","x-eov-operation-handler":"PackagesHandlers",tags:["Packages"],requestBody:{description:"The package info to create with.",required:!0,content:{"application/json":{schema:{type:"object",required:["release","name","description","entities","privacy","packageVariables"],properties:{release:{$ref:"#/components/schemas/PackageCreateReleaseInfo"},name:{type:"string"},description:{type:"string"},overview:{type:"string",maxLength:200},privacy:{type:"string",enum:["public","private","unlisted"]},entities:{$ref:"#/components/schemas/PackageCreateEntities"},packageVariables:{type:"string"}}}}}},responses:{"201":{$ref:"#/components/responses/PackageResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/createRelease":{"x-coa-private":!0,post:{description:"Add a new package release to an existing package.",operationId:"AddPackageRelease","x-eov-operation-handler":"PackagesHandlers",tags:["Packages"],requestBody:{description:"The package release info.",required:!0,content:{"application/json":{schema:{type:"object",required:["release","entities","privacy","packageVariables","packageID"],properties:{release:{$ref:"#/components/schemas/PackageCreateReleaseInfo"},privacy:{type:"string",enum:["public","private","unlisted"]},entities:{$ref:"#/components/schemas/PackageCreateEntities"},packageVariables:{type:"string"},packageID:{type:"string"}}}}}},responses:{"200":{$ref:"#/components/responses/PackageResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"409":{$ref:"#/components/responses/AlreadyExistsError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/packageRegistry/update":{"x-coa-private":!0,put:{description:"Update a package.",operationId:"UpdatePackage","x-eov-operation-handler":"PackagesHandlers",tags:["Packages"],requestBody:{description:"The package info to create with.",required:!0,content:{"application/json":{schema:{type:"object",required:["packageID","releaseID"],properties:{packageID:{type:"string"},releaseID:{type:"string"},changeLog:{type:"string"},description:{type:"string"},privacy:{type:"string",enum:["public","private","unlisted"]}}}}}},responses:{"200":{$ref:"#/components/responses/PackageUpdateResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/typesense/orgs/{orgID}/typesense-config":{summary:"Typesense Config","x-coa-private":!0,parameters:[{name:"orgID",description:"The organization ID.",in:"path",schema:{type:"string"},required:!0}],post:{description:"Returns Typesense configuration data for a given org.",operationId:"getTypesenseConfigForOrg","x-eov-operation-handler":"TypesenseHandlers",security:[{BearerAuth:[]}],tags:["CoalesceAPI"],responses:{"200":{$ref:"#/components/responses/TypesenseConfigurationResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/runs":{summary:"Runs","x-coa-command-group":"runs",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Runs",description:"Get a collection of information about runs.",operationId:"GetRuns","x-eov-operation-handler":"RunHandlers","x-coa-command":"list",security:[{BearerAuth:[]}],tags:["Runs"],parameters:[{name:"limit",description:"The maximum number of runs to return.",in:"query",schema:{type:"integer",minimum:0,maximum:1e3,default:25},required:!1},{name:"startingFrom",description:"The starting run ID, runStartTime, or runEndTime (exclusive) for paging the query results.",in:"query",allowReserved:!0,schema:{oneOf:[{type:"integer",minimum:0},{type:"string",format:"date-time"}]},required:!1},{name:"orderBy",description:"The field used to order results.",in:"query",schema:{$ref:"#/components/schemas/RunsOrderBy"},required:!1},{$ref:"#/components/parameters/orderByDirection"},{name:"runType",description:"A run type to filter the query results.",in:"query",schema:{$ref:"#/components/schemas/RunType"},required:!1},{name:"runStatus",description:"A status value to filter the query results.",in:"query",schema:{$ref:"#/components/schemas/RunStatus"},required:!1},{name:"environmentID",description:"An environment ID to filter the query results.",in:"query",schema:{type:"string"},required:!1},{name:"detail",description:"Include the full detail of the run.",in:"query",schema:{type:"boolean",default:!1},required:!1}],responses:{"200":{$ref:"#/components/responses/RunsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/runs/{runID}":{summary:"Run","x-coa-command-group":"runs",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"Get Run",description:"Gets a single run.",operationId:"GetRun","x-eov-operation-handler":"RunHandlers","x-coa-command":"get",security:[{BearerAuth:[]}],tags:["Runs"],parameters:[{name:"runID",description:"The run ID.",in:"path",schema:{type:"integer"},required:!0}],responses:{"200":{$ref:"#/components/responses/RunResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/runs/{runID}/results":{summary:"Run Results","x-coa-command-group":"runs",parameters:[{name:"overrideOrgID",description:"Runs an operation against the specified org. (Super-users only.)","x-coa-private":!0,in:"query",schema:{type:"string"},required:!1}],get:{summary:"List Run Results",description:"Get a collection of the results of a deploy or refresh run",operationId:"GetRunResults","x-eov-operation-handler":"RunHandlers","x-coa-command":"list-results",security:[{BearerAuth:[]}],tags:["Runs"],parameters:[{name:"runID",description:"The run ID.",in:"path",schema:{type:"integer"},required:!0}],responses:{"200":{$ref:"#/components/responses/RunResultsResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/database":{get:{summary:"Get database connectivity information.",description:"Gets the information required to connect to the Coalesce database.",operationId:"GetDatabase","x-eov-operation-handler":"DatabaseHandlers",security:[],responses:{"200":{$ref:"#/components/responses/DatabaseInfoResponse"}}}},"/api/v1/secrets/{secretType}/{context}":{"x-coa-private":!0,get:{description:"Determines whether or not a git token value exists for a given project ID.",operationId:"SecretExists","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["Secrets"],parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"200":{$ref:"#/components/responses/secretExists"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},put:{description:"Sets the value of a secret.",operationId:"SetSecret","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["Secrets"],parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],requestBody:{description:"The new value of the secret.",required:!0,content:{"application/json":{schema:{type:"object",required:["secretValue"],properties:{secretValue:{}}}}}},responses:{"204":{description:"Successfully set the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{description:"Deletes a secret.",operationId:"DeleteSecret","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["Secrets"],parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"204":{description:"Successfully deleted the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/kill-job/{orgId}/{runId}":{"x-coa-private":!0,post:{description:"Deletes the Kubernetes job.",operationId:"KillJob","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"},{$ref:"#/components/parameters/runId"}],responses:{"204":{description:"Successfully killed the job."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/coa-tag":{"x-coa-private":!0,get:{description:"Gets a report of all organizations that are using a non-standard coa image tag.",operationId:"GetCoaTagReport","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],responses:{"200":{$ref:"#/components/responses/CoaTagReportResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/coa-tag/{orgId}":{"x-coa-private":!0,get:{description:"Gets the container image tag that should be used when running cloud coa jobs for a particular org.",operationId:"GetCoaTag","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"}],responses:{"200":{$ref:"#/components/responses/CoaTagResponse"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{description:"Resets the container image tag that should be used when running cloud coa jobs for a particular org to the default.",operationId:"ResetCoaTag","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"}],responses:{"204":{description:"Successfully reset coa tag."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/admin/coa-tag/{orgId}/{coaTag}":{"x-coa-private":!0,post:{description:"Sets the container image tag that should be used when running cloud coa jobs for a particular org.",operationId:"SetCoaTag","x-eov-operation-handler":"AdminHandlers",security:[{BearerAuth:[]}],tags:["Admin"],parameters:[{$ref:"#/components/parameters/orgId"},{$ref:"#/components/parameters/coaTag"}],responses:{"204":{description:"Successfully set coa tag."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/scheduler/secret/{secretType}/{context}":{"x-coa-private":!0,get:{description:"Determines whether or not a git token value exists for a given project ID.",operationId:"SecretExistsV0","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["default"],deprecated:!0,parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"200":{$ref:"#/components/responses/secretExists"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},post:{description:"Sets the value of a secret.",operationId:"SetSecretV0","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["default"],deprecated:!0,parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],requestBody:{description:"The new value of the secret.",required:!0,content:{"application/json":{schema:{type:"object",required:["secretValue"],properties:{secretValue:{}}}}}},responses:{"204":{description:"Successfully set the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}},delete:{description:"Deletes a secret.",operationId:"DeleteSecretV0","x-eov-operation-handler":"SecretHandlers",security:[{BearerAuth:[]}],tags:["default"],deprecated:!0,parameters:[{$ref:"#/components/parameters/secretType"},{$ref:"#/components/parameters/context"}],responses:{"204":{description:"Successfully deleted the value of a secret."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/bulkWrite":{"x-coa-private":!0,post:{description:"Updates multiple documents for a workspace.",operationId:"BulkWrite","x-eov-operation-handler":"BulkWriteHandlers",security:[{BearerAuth:[]}],tags:["BulkOperations"],deprecated:!1,requestBody:{description:"The workspace to update and the path to the storage bucket containing the document write information.",required:!0,content:{"application/json":{schema:{type:"object",required:["workspaceID","bulkWriteRequestPath"],properties:{workspaceID:{type:"number"},bulkWriteRequestPath:{type:"string"}}}}}},responses:{"204":{description:"Successfully wrote the documents to the workspace."},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}},"/api/v1/validHostname":{"x-coa-private":!0,post:{description:"Validates the passed hostname and returns an authorized version.",operationId:"ValidateHostname","x-eov-operation-handler":"ValidateHostnameHandlers",tags:["default"],deprecated:!1,security:[],requestBody:{description:"The hostname that needs to be validated.",required:!0,content:{"application/json":{schema:{type:"object",required:["hostname"],properties:{hostname:{type:"string"}}}}}},responses:{"200":{$ref:"#/components/responses/ValidHostname"},"400":{$ref:"#/components/responses/InvalidRequestError"},"401":{$ref:"#/components/responses/Unauthorized"},"403":{$ref:"#/components/responses/ForbiddenError"},"404":{$ref:"#/components/responses/NotFoundError"},"500":{$ref:"#/components/responses/InternalServerError"},"502":{$ref:"#/components/responses/BadGatewayError"},"503":{$ref:"#/components/responses/ServiceUnavailableError"},"504":{$ref:"#/components/responses/GatewayTimeoutError"}}}}}};var ens=St(require("os")),tns=St(require("path")),rns=St(Zrs()),nns=require("fs/promises");vi();Ar();var ins=r=>gi(r,t=>{t.snowflakePassword?.value&&(t.snowflakePassword.value="<REDACTED>"),t.token?.value&&(t.token.value="<REDACTED>")}),sRc=r=>gi(r,t=>{Object.keys(t).forEach(n=>{t[n]=ins(r[n])})}),h$e=ot.CLI_INTERNAL,SF=ot.CLI,aRc=()=>{let r=ens.default.homedir(),t=tns.default.join(r,".coa/config");return h$e.info("using default location",t),t},YC={profile:{value:"",description:"Profile To Use"},environmentID:{value:"",description:"Environment ID"},parameters:{value:"",description:"Parameters"},snowflakeAuthType:{value:"",description:"Snowflake Auth Type (Basic, KeyPair)"},snowflakeKeyPairPath:{value:"",description:"Snowflake Key Pair Path (deprecated, please use --snowflakeKeyPairKey)",deprecationMessage:"This option has been replaced by snowflakeKeyPairKey."},snowflakeKeyPairKey:{value:"",description:"Snowflake Key Pair Path"},snowflakeKeyPairPass:{value:"",description:"Snowflake Key Pair Pass"},snowflakePassword:{value:"",description:"Snowflake Password"},snowflakeRole:{value:"",description:"Snowflake Role"},snowflakeUsername:{value:"",description:"Snowflake Username"},snowflakeWarehouse:{value:"",description:"Snowflake Warehouse"},token:{value:"",description:"Coalesce Refresh Token"},jobID:{value:"",description:"Coalesce JobID"},include:{value:"",description:"Coalesce Node Selector"},exclude:{value:"",description:"Coalesce Node Selector"},parallelism:{value:"",description:"Parallelism level to use"},domain:{value:"",description:"Coalesce domain name to use for API requests",default:"https://app.coalescesoftware.io"}},uRc=async r=>{try{let t=await(0,nns.readFile)(r??aRc(),"utf-8"),n=rns.default.parse(t);return Object.fromEntries(Object.entries(n).flatMap(([i,o])=>{if(!o||typeof o!="object")return SF.error(`Unexpected top-level option ${i} in config file.`),[];let s=Object.entries(o).flatMap(([a,u])=>YC[a]?!u||typeof u!="string"?(SF.error(`Expected profile ${i} field ${a} to be a string, but it is of type ${typeof o}.`),[]):(YC[a].deprecationMessage&&SF.error(`CLI profile ${i} is using deprecated option ${a}.`,YC[a].deprecationMessage),[[a,{...YC[a],value:u}]]):(SF.error("Ignoring unknown field",a,`in CLI profile ${i}.`),[]));return[[i,Object.fromEntries(s)]]}))}catch(t){if(r)throw new Error(`Unable to read cli profile: ${r}`);return SF.error("Using default options. Unable to read default cli profile:",r,". Error:",t),{}}},lRc=async(r,t)=>{let n=await uRc(t),i=n.default,o={};i&&(o=i);let s=r.profile?.value||i?.profile?.value||"";if(h$e.info("using profile",s,"cliProfiles",JSON.stringify(sRc(n))),s){if(!(s in n))throw new Error(`Unable to find profile ${s}`);let a=n[s];o={...o,...a}}return o={...o,...r},o},cRc=r=>{if(r.snowflakeAuthType?.value==="Basic")return TSi.assert({snowflakeUsername:r.snowflakeUsername?.value,snowflakePassword:r.snowflakePassword?.value,snowflakeWarehouse:r.snowflakeWarehouse?.value,snowflakeRole:r.snowflakeRole?.value});if(r.snowflakeAuthType?.value==="KeyPair")return NSi.assert({snowflakeUsername:r.snowflakeUsername?.value,snowflakeKeyPairKey:r.snowflakeKeyPairKey?.value||r.snowflakeKeyPairPath?.value,snowflakeKeyPairPass:r.snowflakeKeyPairPass?.value||"",snowflakeWarehouse:r.snowflakeWarehouse?.value,snowflakeRole:r.snowflakeRole?.value});throw new Error(`SnowflakeAuthFromCLI: CLI config must have a valid credential type. Expected "Basic" or "KeyPair", got ${JSON.stringify(r.snowflakeAuthType?.value)}`)},ons=async(r,t)=>{let n=await lRc(r,t);h$e.info("got final cli profile configFileLocation:",t,JSON.stringify(ins(n)));let i;try{i=P5n(n,["token","environmentID"])}catch(u){throw typeof u=="object"&&u instanceof PMe&&h$e.error(`cliProfile was missing ${u.missingProperties}`),u}let o=i.domain?.value||process.env.SCHEDULER_ADDRESS||YC.domain.default,s={token:i.token.value,runDetails:{environmentID:i.environmentID.value},userCredentials:cRc(i),runtimeParameters:i.parameters?.value||"",domain:new URL(o)};if(!s.domain)throw new Error("Unable to determine Coalesce domain.");let a=i.jobID?.value;if(a&&(s.runDetails.jobID=a),i.include?.value&&(s.runDetails.includeNodesSelector=i.include.value),i.exclude?.value&&(s.runDetails.excludeNodesSelector=i.exclude.value),i.parallelism?.value){let u=parseInt(i.parallelism.value);if(isNaN(u)){let c=`Parameter 'parallelism' was set to '${i.parallelism}', which could not be interpreted as a number`;throw h$e.error(c),new Error(c)}else s.runDetails.parallelism=u}return tb(s),s};var MBe=St(Uf()),nln=St(require("util"));li();bat();var sns=require("fs/promises");vi();Ar();var dRc=ot.CLI,ans=(r,t,n,i)=>{let o,s;return aZ(n,void 0,i).then(a=>{let{teamInfo:u,firebase:c}=a;o=u.fbTeamID;let l=c.firestore();return s=parseInt(t),Its(l,o,s)}).then(a=>{let u=rRt.validate(a);u.valid||dRc.emergContext({orgID:o,runID:s},`Got an unexpected error deserializing run output ${u.failureMessage}`);let c=Q5n(a);return(0,sns.writeFile)(r,c+`
3305
3305
  `)})};Ar();var ARc=ot.RUNNER_BACKEND,fRc=ot.CLI_INTERNAL,O6e=async(r,t,n,i)=>{try{await r}finally{try{t&&(FYn(t),Kts())}catch(o){ARc.errorContext(n,`Error during ${i}WithCLI Finally firebase cleanup: `,o)}}},uZ=async r=>{let t=o=>{let s={user:o.snowflakeUsername,password:o.snowflakePassword,authenticator:"Basic"};return o.snowflakeRole&&(s.role=o.snowflakeRole),o.snowflakeWarehouse&&(s.warehouse=o.snowflakeWarehouse),Promise.resolve(s)},n=async o=>{if(!o.snowflakeKeyPairKey)throw new Error("No private key was provided, cannot perform key pair authentication with Snowflake");let s=o.snowflakeKeyPairPass?new hl(o.snowflakeKeyPairPass):void 0,a=SSi(o.snowflakeKeyPairKey,s),u={user:o.snowflakeUsername,keyPairKey:a.sensitiveValue,keyPairPass:o.snowflakeKeyPairPass,authenticator:"KeyPair"};return o.snowflakeRole&&(u.role=o.snowflakeRole),o.snowflakeWarehouse&&(u.warehouse=o.snowflakeWarehouse),u},i=async o=>({warehouse:o.snowflakeWarehouse,authenticator:"OAuth"});return HH(r,t,n,process.env.COALESCE_COA_CLOUD_JOB_ID!==void 0?i:void 0,HFi)},uns=(r,t,n,i,o)=>t?(fRc.infoContext(r,"saving run results to file",t),ans(t,n.toString(),i,o)):Promise.resolve();var lns=require("async_hooks");Ar();bit();var UFt,hRc=()=>(UFt||(UFt=new lns.AsyncLocalStorage),UFt),cns=(r,t)=>(x5n(gRc),new Promise((n,i)=>{hRc().run(r,()=>{t().then(n).catch(i)})})),gRc=()=>UFt?.getStore()??{logContext:Oc()};vi();ul();Ar();aq();var rln=St(Kls()),ece=async(r,t=!1)=>{let n=[{name:"userResponse",type:"confirm",message:r,default:t}],{userResponse:i}=await rln.default.prompt(n);return i},Jls=async(r,t)=>{let n=[{name:"userResponse",type:"input",message:r,default:t}],{userResponse:i}=await rln.default.prompt(n);return i};var Gy=(r,t)=>(Object.keys(YC).forEach(n=>{if(!t||t.includes(n)){let i=YC[n];r.option(`--${n} <value>`,i.description,i.default)}}),r),FKc=r=>{let t={};return Object.keys(YC).forEach(n=>{if(r.getOptionValueSource(n)=="cli"){let o=YC[n].deprecationMessage;o&&Oa.error(`Deprecated CLI option --${n} was used.`,o),t[n]={value:`${r.getOptionValue(n)}`,default:YC[n].default,description:YC[n].default}}}),t},LKc=async r=>{let t=FKc(r),n=r.optsWithGlobals();al().isTest||NFt(n.debug,n.verbose);let i=n.changeLogLevel;if(i){let[l,d]=i.split(":");Ki("CLI_INTERNAL",!!l,"loggingArea is required"),Ki("CLI_INTERNAL",!!d,"logLevel is required"),tP.info("changing log level ",l,d),fit(l,d),ot.COMMON.debug("logging changed in coa")}let o=await ons(t,n.config),s=await aZ(o.token,void 0,o.domain),{teamInfo:{fbUserID:a,fbTeamID:u}}=s,c={orgID:u,workspaceID:+o.runDetails.environmentID,userID:a};return m7(c),{teamDetails:s,config:o,optsWithGlobals:n,logContext:c}},kg=async(r,t,n,i)=>{tP.debug("Runtime environment",JSON.stringify(al(),void 0,2));let o=Oc();try{let s=await LKc(r),{teamDetails:a,config:u,optsWithGlobals:c,logContext:l}=s;o=l,i||Oa.infoContext(l,MBe.default.whiteBright(`${t} initialized.`)+` ${MBe.default.green("running")}...`),await cns({userID:a.teamInfo?.fbUserID,orgID:a.teamInfo?.fbTeamID,logContext:l},()=>n(a,u,c,l)),i||Oa.infoContext(l,MBe.default.whiteBright(`${t} successful!`)),await Ep(0)}catch(s){if(s instanceof IF)throw s;tP.errorContext(o,`An error occurred during ${t}: ${nln.default.inspect(s)}`),Oa.error(MBe.default.redBright(`An error occurred during ${t}:`,UKc(s))),await Ep(1)}},NBe=(r,t)=>async(n,i,o,s)=>{let a=await r(n,i,o,s),{runCounter:u,runCompletion:c,logContext:l}=a;s=l||s,Oa.infoContext(s,MBe.default.whiteBright(`${t} run initialized. RunCounter: ${u}`));try{await c}finally{let d=o.out;await uns(s,d,u,i.token,i.domain)}},Xls=async r=>{let t=`You have uncommitted changes in this branch.
3306
3306
  ${r.map(n=>`
3307
3307
  File: ${n.name}, Status: ${n.status}`)}
@@ -3312,7 +3312,7 @@ Would you like to proceed without committing these changes? Press Y to proceed o
3312
3312
  Would you like to continue installation and overwrite any previously installed package data from "${r}"?`;return await ece(t)},Zls=async()=>await ece("Continue?"),ecs=async r=>await ece(`Overwrite existing file "${r}"?`),tcs=async()=>(await Jls('Type "DELETE" to confirm')).toLowerCase()==="delete",DBe=class extends Error{constructor(){super("403 - Forbidden: You do not have permission to access this experimental feature")}},qKc=!1;var tce=r=>(qKc&&r.exitOverride(),r),UKc=r=>r instanceof Gt?r.toFormattedString():WO(r)?r.message:NDn(r)?r.toString():nln.default.inspect(r);Jnr();var jKc=7,GKc=3,rcs=r=>r==="name"?100:r==="id"?90:r.match(/Name$/)?80:r.match(/(ID$)|(Id$)/)?70:0,ncs=r=>r.sort((t,n)=>{let i=rcs(t),o=rcs(n);return(i||o)&&i!==o?o-i:t>n?1:t<n?-1:0}),Zjt=(r,t=!1)=>{if(Array.isArray(r)){if(Object.values(r).length===0)return"[]";let n=r[0],i=n&&typeof n=="object";return i&&Object.keys(n).length<=(t?jKc:GKc)?VKc(r):YKc(r,i?"<hr/>":void 0)}return r&&typeof r=="object"?KKc(r):WKc(r)?HKc(r):""},WKc=r=>{let t=typeof r;return t==="string"||t==="number"||t==="boolean"||t==="undefined"||r===null},HKc=r=>r==null?"":`${r}`,VKc=r=>{let t=new Set;for(let o of r)for(let s of Object.keys(o))t.add(s);let n=ncs(Array.from(t)),i="";i+="<tr>";for(let o of n)i+=`<th>${o}</th>`;i+="</tr>";for(let o of r){i+="<tr>";for(let s of n)s in o?i+=`<td>${Zjt(o[s])}</td>`:i+="<td></td>";i+="</tr>"}return`<table>${i}</table>`},YKc=(r,t="<br/>")=>r.map(n=>Zjt(n)).join(t),KKc=r=>`<table>${ncs(Object.keys(r)).map(t=>`<tr><td>${t}:</td><td>${Zjt(r[t])}</td></tr>`)}</table>`,QBe=r=>{let t=Zjt(r,!0);return cat(t,{wordwrap:100,selectors:[{selector:"table",format:"dataTable"}]})};vi();Ar();var ics="paging",eGt="inputFile",iln="outputFile",ocs="format",oln="skipConfirm";function JKc(r,t){Ki("CLI",r,t)}var rce=class{constructor(t,n,i,o,s){this.commandGroup=t;this.spec=n;this.path=i;this.operation=o;this.apiServiceName=`${s}Service`}apiServiceName;addCommand(){let t=this.operation?.["x-coa-command"],n=this.operation?.operationId;if(!t||!n)return;let i=this.operation.summary||this.operation.description||"",o=tce(this.commandGroup.command(t).description(i)),s=this.determineRequestTypes();return o=this.addCommandOptionsForApiParameters(o,s.parameterArguments),o=this.addCommandOptionsForRequestBody(o,s.requestBodyArgument),o=this.addCommandOptionsForResponseBody(o,s.responseBodySchema),o=this.addCommandOptionsForPaging(o,s),o=this.addCommandOptionsForConfirmOperation(o),this.addCommandAction(o,s)}determineRequestTypes(){let t=[],n=this.path.parameters||[];this.operation.parameters&&(n=n.concat(this.operation.parameters));for(let s of n){let a=this.resolveReference(s);if(!a)throw new Gt(`Unable to resolve parameter from $ref '${a}'`);let u=this.resolveReference(a?.schema),c=a?.description||u?.description;if(!u||!c)throw new Gt(`Missing schema or description for parameter '${a.name}'`);if(a.in!=="query"&&a.in!=="path")throw new Gt(`${a.in} arguments are not supported`);t.push({name:a.name,description:c,schema:u,required:!!a.required,hidden:!!a["x-coa-private"],in:a.in})}let i=this.resolveContentSchema(this.resolveReference(this.operation.requestBody)?.content),o=this.resolveResponseSchema();return{parameterArguments:t,requestBodyArgument:i?{name:eGt,description:"The request content",schema:i}:void 0,responseBodySchema:o}}addCommandOptionsForApiParameters(t,n){let i=["profile"];t=this.setAuthOptions(t,i);for(let{name:o,schema:s,description:a,required:u}of n.filter(c=>!c.hidden))if(YC[o])i.push(o);else{let c=`--${o}`;s.type!=="boolean"&&(c+=` <${this.resolveSchemaType(s)}>`);let l;s.type==="integer"&&(l=d=>{let p=parseInt(d);if(isNaN(p))throw new Urs(`Expected a number for ${c}, received '${d}'`);return p}),u?l?t=t.requiredOption(c,a,l,s.default):t=t.requiredOption(c,a,s.default):l?t=t.option(c,a,l,s.default):t=t.option(c,a,s.default)}return Gy(t,i.length>0?i:void 0)}addCommandOptionsForConfirmOperation(t){return t.option(`--${oln}`,"Skip any confirmation prompts")}addCommandOptionsForRequestBody(t,n){return n&&(t=t.option(`--${eGt} <request-file>`,"The request content")),t}addCommandOptionsForResponseBody(t,n){return n&&(t=t.option(`--${iln} <fileName>`,"Write output to file").addOption(new j6(`--${ocs} <json|text>`,"Output results as JSON or text").choices(["json","text"]).default("text"))),t}addCommandOptionsForPaging(t,n){return this.supportsPaging(n)&&(t=t.addOption(new j6(`--${ics}`,"Enable interactive paging").conflicts(iln))),t}addCommandAction(t,n){let i=this.operation.operationId,o=async(s,a,u,c)=>{if(!await this.promptForConfirmOperation(u))throw new Error("Operation canceled");let l,d=u[ics],p=this.requiresAuth()?s.idToken||a.token:void 0,f=kR(a.domain.origin,p)[i];if(!f||typeof f!="function")throw new Gt(`Unable to find service method '${i}'`);let h=[];n.requestBodyArgument&&(h=h.concat(this.mapOptionValuesToRequestBody(u))),h=h.concat(this.mapOptionValuesToRequestParameters(n,u,a));let y=!0;for(;y;)ot.CLI_INTERNAL.debug(`Calling API method ${i}`),l=await this.callApi(f,...h),await this.processResponse(u,this.formatResponse(u,l)),y=d&&this.setPagingArguments(n.parameterArguments,h,l)&&await Zls()};return t.action((s,a)=>kg(a,this.operation.operationId,o.bind(this),!0))}mapOptionValuesToRequestParameters(t,n,i){return t.parameterArguments.reduce((o,s)=>{let a=n[s.name]===""?void 0:n[s.name];return a===void 0&&(s.name in i&&i[s.name]?a=i[s.name]:s.name in i.runDetails&&i.runDetails[s.name]&&(a=i.runDetails[s.name])),s.in==="query"?o.queries[s.name]=a:o.params[s.name]=a,o},{queries:{},params:{}})}mapOptionValuesToRequestBody(t){return t[eGt]?JSON.parse(PBe.readFileSync(t[eGt],"utf8")):{}}async callApi(t,...n){try{return await t(...n)}catch(i){throw i instanceof sfe?new Error(`${i.message} ${i.data?.error.errorString} ${i.data?.error.errorDetail}`):i}}async promptForConfirmOperation(t){return!t[oln]&&this.isDeleteOperation?tcs():!0}formatResponse(t,n){return t[ocs]==="json"?JSON.stringify(n,void 0,2):this.formatTextResponse(n)}formatTextResponse(t){return t.data?QBe(t.data)+`
3313
3313
  `+QBe(scs.omit(t,"data")):QBe(t)}async processResponse(t,n){let i=t[iln];if(n)if(i){let o=!0;PBe.existsSync(i)&&!t[oln]&&(o=await ecs(i)),o&&PBe.writeFileSync(i,n,"utf8")}else gOi(`
3314
3314
  ${n}
3315
- `)}resolveReference(t){if(t){let n=t.$ref;if(n){let i=acs.get(this.spec,n.substring(1));if(!i)throw new Gt(`Unable to resolve OpenAPI schema $ref '${n}'`);return this.resolveReference(i)}}return t}resolveSchemaType(t){let n=t.type;if(n)return n;let i=t.oneOf||t.anyOf;return i?i.map(o=>this.resolveSchemaType(this.resolveReference(o))).join("|"):"value"}resolveResponseSchema(){if(this.operation.responses){let t=Object.keys(this.operation.responses).reduce((n,i)=>{let o=parseInt(i);return o>=200&&o<300&&(!n||o<n)?o:n},void 0);if(t)return this.resolveContentSchema(this.resolveReference(this.operation.responses[t])?.content)}}resolveContentSchema(t){if(t)return this.resolveReference(t["application/json"]?.schema)}requiresAuth(){let t=this.operation.security||this.spec.security;return!!t&&!!t.find(n=>n.BearerAuth)}setAuthOptions(t,n){return n.push("token"),t}supportsPaging(t){let n=!!t.parameterArguments.find(s=>s.name==="startingFrom"),i=!!t.responseBodySchema?.properties?.limit,o=!!t.responseBodySchema?.properties?.limit;return n&&i&&o}setPagingArguments(t,n,i){let o=t.findIndex(c=>c.name==="startingFrom"),s=i.orderBy,a=i.data,u=i.limit;return o>=0&&s&&a?.length>=u?(n[o]=a[a.length-1][s],!0):!1}get isDeleteOperation(){return!!this.operation.operationId?.toLowerCase().includes("delete")}},XKc=(r,t)=>{let n=new Map;for(let[i,o]of Object.entries(r.paths)){let s=o?.["x-coa-command-group"],a=o?.summary||o?.description;if(JKc(!s||!!a,`Path ${i} is missing a summary or description.`),s&&a){let u=n.get(s);u||(u=tce(t.command(s).description(a)),n.set(s,u));for(let c of["get","post","put","delete","patch"]){let l=o[c];l?.operationId&&l["x-coa-command"]&&l?.tags?.length===1&&(ot.CLI_INTERNAL.debug(`Setting up command for REST API operation ${l.operationId}`),(ucs[l.operationId]?.getApiCommandFactory||$Kc)(u,r,o,l,l.tags[0]).addCommand())}}}},$Kc=(r,t,n,i,o)=>new rce(r,t,n,i,o),ucs={},tGt=(r,t)=>{ucs[r]=t},lcs=r=>{XKc(Yrs,r)};wp();var ccs=r=>{Gy(r.command("cancel"),["environmentID"]).description("Cancels a running pipeline.").argument("<runID>","The ID of the run to cancel.").action(async(t,n,i)=>{let o=parseInt(t);if(!o)throw new Error("Unable to parse runID as a number");await kg(i,"cancel",ZKc(o))})};function ZKc(r){return async(t,n,i,o)=>{Oa.appContext(o,`Canceling run ID ${r}`);try{let s={environmentID:n.runDetails.environmentID,runID:r};await qEo(s,t.firebase.auth())}catch(s){throw tP.errorContext(o,"Error canceling run",s),XO(s)?s.error.errorString:"unknown error"}}}var ycs=St(require("fs"));var dcs=St(Zae());Ar();var eJc=ot.CLI,pcs=async(r,t,n,i)=>{let o=r.firebase,s=await uZ(t.userCredentials);eJc.infoContext(n,"Deploy starting (CLI)");let{runCounter:a,runCompletion:u}=await mrs(t,r,n,s,(0,dcs.GetPool)(),i);m7({orgID:r.teamInfo.fbTeamID,runID:a,workspaceID:t.runDetails.environmentID===void 0?void 0:parseInt(t.runDetails.environmentID),userID:r.teamInfo.fbUserID});let c=O6e(u,o,n,"Deploy");return{runCounter:a,runCompletion:c,logContext:{...n,runID:a}}};T3();Ar();Hi();var Acs=Q.object({subtitle:Q.string(),title:Q.string(),messages:Q.array(Q.string())}),QAp=Q.object({stopDeploy:Q.set(Acs),warning:Q.set(Acs)}),sln=()=>({stopDeploy:new Set,warning:new Set});li();wp();var tJc=ot.DEPLOY,aln=class{constructor(t){this.buildIssue=t}missingStorageMappings=(t,n)=>{if(!t.locations||!Object.keys(t.locations).length)return this.buildIssue("Add a storage location and mappings for that location and commit your changes","Missing Storage Locations",["No storage locations found"]);let i=hg(t.locations,n),o=[],s=Object.fromEntries(Object.keys(t.locations).map(a=>{let u=i[a],c={schema:!!(u&&u.schema),database:!!(u&&u.database)};if(!c.schema||!c.database){let l=`Storage location "${a}" is missing its ${!c.schema&&!c.database?"schema and database":c.schema?"database":"schema"}`;o.push(l)}return[a,c]}));for(let[a,u]of Object.entries(t.steps)){let{name:c,locationName:l}=u.operation;if(!s[l]){let h=`${c} (${a}) is using an invalid storage location: "${l}"`;o.push(h);continue}if(!Object.values(s[l]).some(h=>!h))continue;let{schema:p,database:A}=s[l],f=`${c} (${a}) is using storage location "${l}" which is not using a valid ${!p&&!A?"schema or database":p?"database":"schema"}.`;o.push(f)}return o.length?this.buildIssue('To Fix: From the build tab, update storage mappings in "Build Settings" >> "Environments" for this environment and commit your changes',"Missing or Invalid Storage Mappings",o):null};userConnection=(t,n)=>{let i="Missing connection information";if(MSr(t))if(n.accountName?.trim()){let o=`Using ${t.connectionType} Auth`,s=Xqr(n);return HH(s,a=>a.snowflakeUsername.trim()&&a.snowflakePassword?null:this.buildIssue(o,i,["Verify your account username and password"]),()=>null,()=>null,a=>a.snowflakeUsername?.trim()?null:this.buildIssue(o,i,["Verify your account username and password"]))}else return this.buildIssue("Verify your account.",i,["Add an account in your environment's 'Settings' tab"]);else return tJc.error("User connection is not valid! userConnection: ",t),this.buildIssue("Verify that you have selected and authenticated a connection type.",i,["Check your environment's 'Settings' and 'User Credentials' tab and ensure required information is correctly filled out and saved"])};nodeTypes=t=>{let n=t.stepTypes,i=[];if(Object.entries(n).forEach(([o,s])=>{let a=oUr(s.name,s.metadata.nodeMetadataSpec).errorString;if(!UBt(s)||a){let u=`Node type with ID: ${o}`;i.push(`${s.name||u} is not a valid node type. ${a}`)}}),i.length){let o='To Fix: From the build tab, correct errors for node types in "Build Settings" >> "Node Types"',s="Invalid Node Type",a=i;return this.buildIssue(o,s,a)}else return null};missingStepTypes=t=>{let n=t.stepTypes,i=t.steps,o=[],s="Missing Node Type",a="Please update the node type for node(s) and commit your changes before attempting to deploy";return Object.keys(i).forEach(u=>{let c=i[u]?.operation?.sqlType;if(!c||!n[c]){let l=i[u]?.operation?.name;o.push(`Node ${l} (ID: ${u}) is using a non-existent node type, node type ID: ${c}`)}}),o.length?this.buildIssue(a,s,o):null};columnSources=t=>{let n=t.steps,i=kTi(n),o=zTi(i);if(Object.keys(o).length){let s="Check join conditions on nodes listed below. Was name or location changed on any dependencies?",a="Non-Existent or Invalid Ref(s) on Nodes",u=Object.values(o);return this.buildIssue(s,a,u)}else return null}},uln=class{_allIssues=sln();getError(t){return new NMe(this.issuesHeader,t)}addStopDeployIssue(t){t&&this._allIssues.stopDeploy.add(t)}addDeployWarningIssue(t){t&&this._allIssues.warning.add(t)}addErrorAsIssue(t,n){if(t instanceof NMe)return t;{let{error:{errorString:i,errorDetail:o}}=l1(t),s=`${n==="stop"?"Must address":"Consider addressing"} the error(s) below before proceeding`,a=this.buildIssue(s,"Unknown Error(s) detected",[i]);return n==="stop"?this.addStopDeployIssue(a):this.addDeployWarningIssue(a),this.getError(o)}}clearIssues(){this._allIssues=sln()}get allIssues(){return this._allIssues}hasIssues=t=>t==="stop"?!!this._allIssues.stopDeploy.size:t==="warn"?!!this._allIssues.warning.size:!!this._allIssues.stopDeploy.size||!!this._allIssues.warning.size;buildIssue=(t,n,i)=>({subtitle:t,title:n,messages:i});detectIssues(t,n,i,o){let s=new aln(this.buildIssue);this.addStopDeployIssue(s.missingStorageMappings(t,n)),this.addStopDeployIssue(s.userConnection(i,o)),this.addStopDeployIssue(s.nodeTypes(t)),this.addStopDeployIssue(s.missingStepTypes(t)),this.addDeployWarningIssue(s.columnSources(t))}},rGt=class extends uln{issuesHeader='Problems detected (see above "Issues preventing Plan calculation") - terminating plan calculation...';logger=ot.CLI;formatIssuesForLog=t=>[...t].map(n=>{let{title:i,subtitle:o,messages:s}=n;return`${i}: ${o}
3315
+ `)}resolveReference(t){if(t){let n=t.$ref;if(n){let i=acs.get(this.spec,n.substring(1));if(!i)throw new Gt(`Unable to resolve OpenAPI schema $ref '${n}'`);return this.resolveReference(i)}}return t}resolveSchemaType(t){let n=t.type;if(n)return n;let i=t.oneOf||t.anyOf;return i?i.map(o=>this.resolveSchemaType(this.resolveReference(o))).join("|"):"value"}resolveResponseSchema(){if(this.operation.responses){let t=Object.keys(this.operation.responses).reduce((n,i)=>{let o=parseInt(i);return o>=200&&o<300&&(!n||o<n)?o:n},void 0);if(t)return this.resolveContentSchema(this.resolveReference(this.operation.responses[t])?.content)}}resolveContentSchema(t){if(t)return this.resolveReference(t["application/json"]?.schema)}requiresAuth(){let t=this.operation.security||this.spec.security;return!!t&&!!t.find(n=>n.BearerAuth)}setAuthOptions(t,n){return n.push("token"),t}supportsPaging(t){let n=!!t.parameterArguments.find(s=>s.name==="startingFrom"),i=!!t.responseBodySchema?.properties?.limit,o=!!t.responseBodySchema?.properties?.limit;return n&&i&&o}setPagingArguments(t,n,i){let o=t.findIndex(c=>c.name==="startingFrom"),s=i.orderBy,a=i.data,u=i.limit;return o>=0&&s&&a?.length>=u?(n[o]=a[a.length-1][s],!0):!1}get isDeleteOperation(){return!!this.operation.operationId?.toLowerCase().includes("delete")}},XKc=(r,t)=>{let n=new Map;for(let[i,o]of Object.entries(r.paths)){let s=o?.["x-coa-command-group"],a=o?.summary||o?.description;if(JKc(!s||!!a,`Path ${i} is missing a summary or description.`),s&&a){let u=n.get(s);u||(u=tce(t.command(s).description(a)),n.set(s,u));for(let c of["get","post","put","delete","patch"]){let l=o[c];l?.operationId&&l["x-coa-command"]&&l?.tags?.length===1&&(ot.CLI_INTERNAL.debug(`Setting up command for REST API operation ${l.operationId}`),(ucs[l.operationId]?.getApiCommandFactory||$Kc)(u,r,o,l,l.tags[0]).addCommand())}}}},$Kc=(r,t,n,i,o)=>new rce(r,t,n,i,o),ucs={},tGt=(r,t)=>{ucs[r]=t},lcs=r=>{XKc(Yrs,r)};wp();var ccs=r=>{Gy(r.command("cancel"),["environmentID"]).description("Cancels a running pipeline.").argument("<runID>","The ID of the run to cancel.").action(async(t,n,i)=>{let o=parseInt(t);if(!o)throw new Error("Unable to parse runID as a number");await kg(i,"cancel",ZKc(o))})};function ZKc(r){return async(t,n,i,o)=>{Oa.appContext(o,`Canceling run ID ${r}`);try{let s={environmentID:n.runDetails.environmentID,runID:r};await qEo(s,t.firebase.auth())}catch(s){throw tP.errorContext(o,"Error canceling run",s),XO(s)?s.error.errorString:"unknown error"}}}var ycs=St(require("fs"));var dcs=St(Zae());Ar();var eJc=ot.CLI,pcs=async(r,t,n,i)=>{let o=r.firebase,s=await uZ(t.userCredentials);eJc.infoContext(n,"Deploy starting (CLI)");let{runCounter:a,runCompletion:u}=await mrs(t,r,n,s,(0,dcs.GetPool)(),i);m7({orgID:r.teamInfo.fbTeamID,runID:a,workspaceID:t.runDetails.environmentID===void 0?void 0:parseInt(t.runDetails.environmentID),userID:r.teamInfo.fbUserID});let c=O6e(u,o,n,"Deploy");return{runCounter:a,runCompletion:c,logContext:{...n,runID:a}}};T3();Ar();Hi();var Acs=Q.object({subtitle:Q.string(),title:Q.string(),messages:Q.array(Q.string())}),QAp=Q.object({stopDeploy:Q.set(Acs),warning:Q.set(Acs)}),sln=()=>({stopDeploy:new Set,warning:new Set});li();wp();var tJc=ot.DEPLOY,aln=class{constructor(t){this.buildIssue=t}missingStorageMappings=(t,n)=>{if(!t.locations||!Object.keys(t.locations).length)return this.buildIssue("Add a storage location and mappings for that location and commit your changes","Missing Storage Locations",["No storage locations found"]);let i=hg(t.locations,n),o=[],s=Object.fromEntries(Object.keys(t.locations).map(a=>{let u=i[a],c={schema:!!(u&&u.schema),database:!!(u&&u.database)};if(!c.schema||!c.database){let l=`Storage location "${a}" is missing its ${!c.schema&&!c.database?"schema and database":c.schema?"database":"schema"}`;o.push(l)}return[a,c]}));for(let[a,u]of Object.entries(t.steps)){let{name:c,locationName:l}=u.operation;if(!s[l]){let h=`${c} (${a}) is using an invalid storage location: "${l}"`;o.push(h);continue}if(!Object.values(s[l]).some(h=>!h))continue;let{schema:p,database:A}=s[l],f=`${c} (${a}) is using storage location "${l}" which is not using a valid ${!p&&!A?"schema or database":p?"database":"schema"}.`;o.push(f)}return o.length?this.buildIssue('To Fix: From the build tab, update storage mappings in "Build Settings" >> "Environments" for this environment and commit your changes',"Missing or Invalid Storage Mappings",o):null};userConnection=(t,n)=>{let i="Missing connection information";if(MSr(t))if(n.accountName?.trim()){let o=`Using ${t.connectionType} Auth`,s=Xqr(n);return HH(s,a=>a.snowflakeUsername.trim()&&a.snowflakePassword?null:this.buildIssue(o,i,["Verify your account username and password"]),()=>null,()=>null,a=>a.snowflakeUsername?.trim()?null:this.buildIssue(o,i,["Verify your account username and password"]))}else return this.buildIssue("Verify your account.",i,["Add an account in your environment's 'Settings' tab"]);else return tJc.error("User connection is not valid! userConnection: ",t),this.buildIssue("Verify that you have selected and authenticated a connection type.",i,["Check your environment's 'Settings' and 'User Credentials' tab and ensure required information is correctly filled out and saved"])};nodeTypes=t=>{let n=t.stepTypes,i=[];if(Object.entries(n).forEach(([o,s])=>{let a=oUr(s.name,s.metadata.nodeMetadataSpec).errorString;if(!UBt(s)||a){let u=`Node type with ID: ${o}`;i.push(`${s.name||u} is not a valid node type. ${a}`)}}),i.length){let o='To Fix: From the build tab, correct errors for node types in "Build Settings" >> "Node Types"',s="Invalid Node Type",a=i;return this.buildIssue(o,s,a)}else return null};missingStepTypes=t=>{let n=t.stepTypes,i=t.steps,o=[],s="Missing Node Type",a="Please update the node type for node(s) and commit your changes before attempting to deploy";return Object.keys(i).forEach(u=>{let c=i[u]?.operation?.sqlType;if(!c||!n[c]){let l=i[u]?.operation?.name;o.push(`Node ${l} (ID: ${u}) is using a non-existent node type, node type ID: ${c}`)}}),o.length?this.buildIssue(a,s,o):null};columnSources=t=>{let n=t.steps,i=kTi(n),o=zTi(i);if(Object.keys(o).length){let s="Check join conditions on nodes listed below. Was name or location changed on any dependencies?",a="Non-Existent or Invalid Ref(s) on Nodes",u=Object.values(o);return this.buildIssue(s,a,u)}else return null}},uln=class{_allIssues=sln();getError(t){return new NMe(this.issuesHeader,t)}addStopDeployIssue(t){t&&this._allIssues.stopDeploy.add(t)}addDeployWarningIssue(t){t&&this._allIssues.warning.add(t)}addErrorAsIssue(t,n){if(t instanceof NMe)return t;{let{error:{errorString:i}}=l1(t),o=`${n==="stop"?"Must address":"Consider addressing"} the error(s) below before proceeding`,s=this.buildIssue(o,"Unknown Error(s) detected",[i]);return n==="stop"?this.addStopDeployIssue(s):this.addDeployWarningIssue(s),this.getError(i)}}clearIssues(){this._allIssues=sln()}get allIssues(){return this._allIssues}hasIssues=t=>t==="stop"?!!this._allIssues.stopDeploy.size:t==="warn"?!!this._allIssues.warning.size:!!this._allIssues.stopDeploy.size||!!this._allIssues.warning.size;buildIssue=(t,n,i)=>({subtitle:t,title:n,messages:i});detectIssues(t,n,i,o){let s=new aln(this.buildIssue);this.addStopDeployIssue(s.missingStorageMappings(t,n)),this.addStopDeployIssue(s.userConnection(i,o)),this.addStopDeployIssue(s.nodeTypes(t)),this.addStopDeployIssue(s.missingStepTypes(t)),this.addDeployWarningIssue(s.columnSources(t))}},rGt=class extends uln{issuesHeader='Problems detected (see above "Issues preventing Plan calculation") - terminating plan calculation...';logger=ot.CLI;formatIssuesForLog=t=>[...t].map(n=>{let{title:i,subtitle:o,messages:s}=n;return`${i}: ${o}
3316
3316
  ${s.join(`
3317
3317
  `)}`});detectIssues(t,n,i,o){super.detectIssues(t,n,i,o),this.logIssues()}logIssues(){let t=this.formatIssuesForLog(this._allIssues.stopDeploy),n=this.formatIssuesForLog(this._allIssues.warning);if(this.hasIssues()){let o=[t.length?`
3318
3318