sml-cli 2026.6.1-rc.4 → 2026.6.1-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -631,7 +631,7 @@ ${r}`,JYr=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),UYr=Obj
631
631
  `),E=PQe(n);T===l&&o===E||(l=T,o=E,T=twe(T,E,{trim:!1,hard:!0,wordWrap:!1}),n.write(iue.eraseLines(i)+T),i=T.split(`
632
632
  `).length)};return _.clear=()=>{n.write(iue.eraseLines(i)),p()},_.done=()=>{p(),r||bQe.show()},_}var NQe,mKr,PQe,hKr,gKr,yKr,vKr,w4t=dy(()=>{NQe=zl(require("node:process"),1);QMt();a4t();EQe();C4t();YEe();mKr=24,PQe=({columns:n=80})=>n,hKr=(n,r)=>{let i=n.rows??mKr,o=r.split(`
633
633
  `),l=Math.max(0,o.length-i);return l?kQe(r,G$(o.slice(0,l).join(`
634
- `)).length+1):r};gKr=OQe(NQe.default.stdout),yKr=gKr,vKr=OQe(NQe.default.stderr)});function FQe(n){return Number.isInteger(n)?n>=4352&&(n<=4447||n===9001||n===9002||11904<=n&&n<=12871&&n!==12351||12880<=n&&n<=19903||19968<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65131||65281<=n&&n<=65376||65504<=n&&n<=65510||110592<=n&&n<=110593||127488<=n&&n<=127569||131072<=n&&n<=262141):!1}var A4t=dy(()=>{});function nF(n,r,i){let o=[...n],l=[],p=typeof i=="number"?i:o.length,_=!1,b,T=0,E="";for(let[k,j]of o.entries()){let z=!1;if(k4t.includes(j)){let X=/\d[^m]*/.exec(n.slice(k,k+18));b=X&&X.length>0?X[0]:void 0,T<p&&(_=!0,b!==void 0&&l.push(b))}else _&&j==="m"&&(_=!1,z=!0);if(!_&&!z&&T++,!bKr.test(j)&&FQe(j.codePointAt())&&(T++,typeof i!="number"&&p++),T>r&&T<=p)E+=j;else if(T===r&&!_&&b!==void 0)E=I4t(l);else if(T>=p){E+=I4t(l,!0,b);break}}return E}var bKr,k4t,rwe,I4t,P4t=dy(()=>{A4t();XEe();bKr=/^[\uD800-\uDBFF][\uDC00-\uDFFF]$/,k4t=["\x1B","\x9B"],rwe=n=>`${k4t[0]}[${n}m`,I4t=(n,r,i)=>{let o=[];n=[...n];for(let l of n){let p=l;l.includes(";")&&(l=l.split(";")[0][0]+"0");let _=jC.codes.get(Number.parseInt(l,10));if(_){let b=n.indexOf(_.toString());b===-1?o.push(rwe(r?_:p)):n.splice(b,1)}else if(r){o.push(rwe(0));break}else o.push(rwe(p))}if(r&&(o=o.filter((l,p)=>o.indexOf(l)===p),i!==void 0)){let l=rwe(jC.codes.get(Number.parseInt(i,10)));o=o.reduce((p,_)=>_===l?[_,...p]:[...p,_],[])}return o.join("")}});var O4t={};Rse(O4t,{default:()=>N4t});function nwe(n,r,i){if(n.charAt(r)===" ")return r;let o=i?1:-1;for(let l=0;l<=3;l++){let p=r+l*o;if(n.charAt(p)===" ")return p}return r}function N4t(n,r,i={}){let{position:o="end",space:l=!1,preferTruncationOnSpace:p=!1}=i,{truncationCharacter:_="\u2026"}=i;if(typeof n!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof n}`);if(typeof r!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof r}`);if(r<1)return"";if(r===1)return _;let b=IA(n);if(b<=r)return n;if(o==="start"){if(p){let T=nwe(n,b-r+1,!0);return _+nF(n,T,b).trim()}return l===!0&&(_+=" "),_+nF(n,b-r+IA(_),b)}if(o==="middle"){l===!0&&(_=` ${_} `);let T=Math.floor(r/2);if(p){let E=nwe(n,T),k=nwe(n,b-(r-T)+1,!0);return nF(n,0,E)+_+nF(n,k,b).trim()}return nF(n,0,T)+_+nF(n,b-(r-T)+IA(_),b)}if(o==="end"){if(p){let T=nwe(n,r-1);return nF(n,0,T)+_}return l===!0&&(_=` ${_}`),nF(n,0,r-IA(_))+_}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${o}`)}var F4t=dy(()=>{P4t();xQe()});var IXr={};Rse(IXr,{COMMANDS:()=>wXr,INIT_HOOK:()=>T8t,run:()=>AXr});module.exports=Sdr(IXr);(function(){Mse().config(Object.assign({},Wgt(),Ggt()(process.argv)))})();var C8t=zl(eQ());var q6t=zl(require("path")),BY=zl(eQ()),PEe=zl(rQ());var Vh;(function(n){n.Catalog="catalog",n.Model="model",n.ModelSettings="model_settings",n.GlobalSettings="global_settings",n.Dimension="dimension",n.Dataset="dataset",n.Metric="metric",n.MetricCalc="metric_calc",n.Connection="connection",n.RowSecurity="row_security",n.CompositeModel="composite_model"})(Vh||(Vh={}));var Zm={...Vh,Unknown:"Unknown",Folder:"Folder",Text:"Text",Environment:"Environment"},OO=["md","gitignore"],ML="env";var LL="Root";var t3=class n{static{this.fileName=".env"}static{this.relativePath=`${n.fileName}`}static create(){return new n}buildFile(){return{compilationOutput:[],rawContent:"",type:Zm.Environment,origin:"R",relativePath:n.relativePath,packageName:LL}}};var FO=class{static hasProps(r,...i){let o=Object.keys(r);return i.every(l=>o.includes(l.toString()))}static hasNoProps(r,...i){let o=Object.keys(r);return i.every(l=>!o.includes(l.toString()))}};var Wwr={isYamlFile(n){let r=n;return r.data!==void 0&&r.data.object_type!==void 0},isTextFile(n){return n.type===Zm.Text},isRawFile(n){return FO.hasProps(n,"rawContent","relativePath")},isPackageFile(n){return FO.hasProps(n,"version","packages")},isFileDimensionType(n){return n.type===Zm.Dimension},isFileModelType(n){return n.type===Zm.Model},isFileCompositeModelType(n){return n.type===Zm.CompositeModel},isEnvFile(n){return n.type===Zm.Environment}},j1=Wwr;var r3=class extends Error{};var Pa=class{static hasProps(r,...i){let o=Object.keys(r);return i.every(l=>o.includes(l.toString()))}static hasNoProps(r,...i){let o=Object.keys(r);return i.every(l=>!o.includes(l.toString()))}};var zwr=n=>`${n} is required`,qJe=class n{constructor(r){this.ErrorConstructor=r}forError(r){return new n(r)}should(r,i){if(!r)throw new this.ErrorConstructor(i)}exists(r,i){this.should(r!=null,i),typeof r=="number"&&this.should(!isNaN(r),i)}notEmpty(r,i){let o=r!=null&&r.trim()!=="";this.should(o,i)}allRequired(r){r.forEach(([i,o])=>{let l=zwr(o);typeof i=="string"&&this.notEmpty(i,l),this.exists(i,l)})}ensure(r,i){if(this.exists(r,i),!r)throw new this.ErrorConstructor(i);return r}ensureType(r,i,o){if(i(r))return r;throw new this.ErrorConstructor(o)}},fs=new qJe(Error),Vb=fs;var Gwr=n=>n?n instanceof Error?n.message:typeof n=="string"?n:`${n}`:"unknown error",Wd={getErrorMessage(n,r){let i=Gwr(n);return r?.removeStartString&&i.startsWith(r.removeStartString)?i.substring(r.removeStartString.length).trim():i},getError(n){return new Error(this.getErrorMessage(n))},hasErrorCode:n=>{if(!n)return!1;let r=n.code;return r?typeof r=="string":!1},async executeQueryOrThrow(n){try{return await n()}catch(r){let i;if(r.response)try{i=(await r.response.json()).message}catch(o){i=`Could not get json error. Error ${Wd.getErrorMessage(o)}. Original error: ${Wd.getErrorMessage(r)}`}else i=`Error: ${Wd.getErrorMessage(r)}`;throw new Error(i)}}},Cxe=Wd;var BJe=class{async wait(r=50){return new Promise(i=>{setTimeout(()=>i(),r)})}async returnDelayed(r,i=300){return await this.wait(i),r}},cin=new BJe;var Hwr={cloneFunctions:!1},bC=class n{static deep(r,i={}){let o={...Hwr,...i};if(r==null)return r;let l=typeof r=="function";if(!l&&!(typeof r=="object"))return r;if(l)return o.cloneFunctions?r:void 0;if(Array.isArray(r))return r.map(_=>n.deep(_,o));if(r instanceof Date)return new Date(r.getTime());{let _={},b=Object.keys(r);for(let T of b)_[T]=n.deep(r[T],o);return _}}static cleanEmptyProperties(r){let i={};for(let o in r){let l=r[o];l===""||l===void 0||l===null||(typeof l=="object"?i[o]=n.cleanEmptyProperties(l):i[o]=l)}return i}};var Qwr=/token/i,Ywr=/password/i,Kwr=/secret/i,C2t=[Qwr,Ywr,Kwr],$Je=class{constructor(){this.undefinedString="[undefined]";this.functionString="[function]";this.circularString="[Circular]";this.obfuscatedString="***"}obfuscate(r){return typeof r=="string"?r==null?this.obfuscatedString:r.length<=6?this.obfuscatedString:r.length<=9?`${this.obfuscatedString}${r.substring(r.length-3)}`:`${r.substring(0,3)}${this.obfuscatedString}${r.substring(r.length-3)}`:this.obfuscatedString}getMaxObjectDepthError(r){return`Max object depth (${r.maxObjectDepth}) exceeded. Current depth: ${r.currentDepth}`}obfuscateObject(r,i,o,l=1){if(l>i.maxObjectDepth)return this.getMaxObjectDepthError({maxObjectDepth:i.maxObjectDepth,currentDepth:l});if(r instanceof Date)return r.toISOString();if(r instanceof Map){let p={};for(let[_,b]of r.entries()){let T=typeof _=="string"?_:i.jsonSerialize(_);C2t.some(E=>E.test(T))?p[T]=this.obfuscate(b):p[T]=this.obfuscateObject(b,i,o,l+1)}return p}if(r instanceof Set)return Array.from(r).map(p=>this.obfuscateObject(p,i,o,l+1));if(typeof r=="bigint")return r.toString();if(r===void 0)return i.serializeUndefined?this.undefinedString:r;if(typeof r=="function")return i.serializeFunctions?this.functionString:r;if(typeof r=="symbol")return i.serializeSymbols?r.toString():r;if(Array.isArray(r))return r.map(p=>this.obfuscateObject(p,i,o,l+1));if(r!==null&&typeof r=="object"){if(o.has(r))return this.circularString;o.add(r);let p={};for(let[_,b]of Object.entries(r))_.toLowerCase()!=="prototype"&&(typeof b=="function"&&!i.serializeFunctions||(typeof b=="string"&&C2t.some(T=>T.test(_))?p[_]=this.obfuscate(b):p[_]=this.obfuscateObject(b,i,o,l+1)));return p}return r}safeToString(r,i){let l=Object.assign({serializeUndefined:!0,serializeFunctions:!1,serializeSymbols:!1,rethrowErrors:!1,maxObjectDepth:10,jsonSerialize:JSON.stringify},i??{});try{let p=new WeakSet,_=this.obfuscateObject(r,l,p);return l.jsonSerialize(_,null,l.space)}catch(p){let _=`Error serializing object: ${Cxe.getErrorMessage(p)}`;if(l.rethrowErrors)throw Error(_);return _}}},hin=new $Je;var RO=n=>n!=null;var E2t=zl(require("crypto")),wxe=new Uint8Array(256),Exe=wxe.length;function JJe(){return Exe>wxe.length-16&&(E2t.default.randomFillSync(wxe),Exe=0),wxe.slice(Exe,Exe+=16)}var w2t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Xwr(n){return typeof n=="string"&&w2t.test(n)}var n3=Xwr;var Wb=[];for(let n=0;n<256;++n)Wb.push((n+256).toString(16).slice(1));function Axe(n,r=0){return(Wb[n[r+0]]+Wb[n[r+1]]+Wb[n[r+2]]+Wb[n[r+3]]+"-"+Wb[n[r+4]]+Wb[n[r+5]]+"-"+Wb[n[r+6]]+Wb[n[r+7]]+"-"+Wb[n[r+8]]+Wb[n[r+9]]+"-"+Wb[n[r+10]]+Wb[n[r+11]]+Wb[n[r+12]]+Wb[n[r+13]]+Wb[n[r+14]]+Wb[n[r+15]]).toLowerCase()}function Zwr(n){if(!n3(n))throw TypeError("Invalid UUID");let r,i=new Uint8Array(16);return i[0]=(r=parseInt(n.slice(0,8),16))>>>24,i[1]=r>>>16&255,i[2]=r>>>8&255,i[3]=r&255,i[4]=(r=parseInt(n.slice(9,13),16))>>>8,i[5]=r&255,i[6]=(r=parseInt(n.slice(14,18),16))>>>8,i[7]=r&255,i[8]=(r=parseInt(n.slice(19,23),16))>>>8,i[9]=r&255,i[10]=(r=parseInt(n.slice(24,36),16))/1099511627776&255,i[11]=r/4294967296&255,i[12]=r>>>24&255,i[13]=r>>>16&255,i[14]=r>>>8&255,i[15]=r&255,i}var bB=Zwr;function eAr(n){n=unescape(encodeURIComponent(n));let r=[];for(let i=0;i<n.length;++i)r.push(n.charCodeAt(i));return r}var tAr="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rAr="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UJe(n,r,i){function o(l,p,_,b){var T;if(typeof l=="string"&&(l=eAr(l)),typeof p=="string"&&(p=bB(p)),((T=p)===null||T===void 0?void 0:T.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let E=new Uint8Array(16+l.length);if(E.set(p),E.set(l,p.length),E=i(E),E[6]=E[6]&15|r,E[8]=E[8]&63|128,_){b=b||0;for(let k=0;k<16;++k)_[b+k]=E[k];return _}return Axe(E)}try{o.name=n}catch{}return o.DNS=tAr,o.URL=rAr,o}var A2t=zl(require("crypto")),VJe={randomUUID:A2t.default.randomUUID};function nAr(n,r,i){if(VJe.randomUUID&&!r&&!n)return VJe.randomUUID();n=n||{};let o=n.random||(n.rng||JJe)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,r){i=i||0;for(let l=0;l<16;++l)r[i+l]=o[l];return r}return Axe(o)}var SB=nAr;var I2t=zl(require("crypto"));function iAr(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),I2t.default.createHash("sha1").update(n).digest()}var k2t=iAr;var sAr=UJe("v5",80,k2t),qL=sAr;var aAr="4d2cacb5-5b53-4da4-b120-709089990e91",WJe=class{generateNew(){return SB()}generateNewPredictable(r){return qL(r,aAr)}validate(r){return n3(r)}parse(r){return bB(r)}},zJe=new WJe;var lAr=(n,r)=>{let i=r===void 0?"string":r,o=Object.keys(n).map(l=>n[l]);if(i==="string")return o;if(i==="number")return o.map(l=>parseInt(l)).filter(l=>!isNaN(l));throw new Error(`result type "${r}" is not supported in EnumUtil.getAllValues`)},Rk={getAllValues:lAr},P2t=Rk;var R2t=(p=>(p.Second="s",p.Minute="m",p.Hour="h",p.Day="d",p.Week="w",p))(R2t||{}),N2t=P2t.getAllValues(R2t,"string"),O2t=/^\d{1,10}[smhdw]$/,F2t=/^\d+$/,GJe=[{unit:"w",factor:1},{unit:"d",factor:7},{unit:"h",factor:24},{unit:"m",factor:60},{unit:"s",factor:60}],i3={isValidNonNegativeInteger:n=>F2t.test(n.trim()),isValidDuration:n=>O2t.test(n.trim()),toString:n=>n.unit?`${n.value}${n.unit}`:`${n.value}`,parse:n=>{let r=n.trim();if(F2t.test(r))return{value:parseInt(r,10)};Vb.should(O2t.test(r),`invalid input for duration: "${n}"`);let i=r[r.length-1];Vb.should(N2t.includes(i),`invalid time unit in "${n}". Unit "${i}" should be one of ${N2t.join(", ")} `);let o=i;return{value:parseInt(r.substring(0,r.length-1)),unit:o}},toSeconds:n=>{if(!n.unit)return n.value;let r=GJe.findIndex(o=>o.unit===n.unit);Vb.should(r>=0,`Cannot convert duration with time unit: ${n.unit}. No mapping was found`);let i=n.value;for(let o=r+1;o<GJe.length;o++)i=i*GJe[o].factor;return i}};var L2t="\\",HJe="/",M2t=[HJe,L2t],QJe=class{constructor(){this._pathSeparator=typeof process<"u"&&process.platform==="win32"?L2t:HJe;this._pathSeparatorChanged=!1}get pathSeparator(){return this._pathSeparator}set pathSeparator(r){Vb.should(!this._pathSeparatorChanged,`Path separator is already changed to ${this._pathSeparator}. For protection it can be set only once.`),Vb.should(M2t.includes(r),`Cannot set pathSeparator to '${r}'. It is invalid. It should be one of: ${M2t.join(",")}`),this._pathSeparatorChanged=!0,this._pathSeparator=r}joinTwo(r,i){if(r==="")return i;if(i==="")return r;let o=r.endsWith(this.pathSeparator)?r.slice(void 0,r.length-1):r,l=i.startsWith(this.pathSeparator)?i.slice(1):i;return`${o}${this.pathSeparator}${l}`}join(...r){return Vb.ensure(r.length>1,"Cannot join path for less than two paths"),r.slice(1).reduce((i,o)=>this.joinTwo(i,o),r[0])}areEqual(r,i){if(r===i)return!0;if(r===void 0||i===void 0)return!1;let o=r.startsWith(this.pathSeparator)?r.substring(1):r,l=i.startsWith(this.pathSeparator)?i.substring(1):i;return o.endsWith(this.pathSeparator)&&(o=o.substring(0,o.length-1)),l.endsWith(this.pathSeparator)&&(l=l.substring(0,l.length-1)),o===l}getExtensionFromPath(r){let i=r.lastIndexOf(this.pathSeparator),o=i===-1?0:i+1,l=r.substring(o),p=l.lastIndexOf(".");if(!(p===-1||p===l.length-1))return l.substring(p+1)}getFileNameFromPath(r){let i=r.lastIndexOf(this.pathSeparator);return i!==-1?r.substring(i+1):r}getFileNameFromPathWithoutExtension(r){let i=this.getFileNameFromPath(r),o=this.getExtensionFromPath(r);return o?i.replace("."+o,""):i}isFileOnRootLevel(r){let i=r.lastIndexOf(this.pathSeparator);return i===-1?!0:!r.substring(0,i).length}getPath(r,i){let o=this.pathSeparator===HJe,l=`${r}${i}`;return r.endsWith(this.pathSeparator)&&i.startsWith(this.pathSeparator)&&(l=`${r}${i.slice(1)}`),!r.endsWith(this.pathSeparator)&&!i.startsWith(this.pathSeparator)&&(l=`${r}${this.pathSeparator}${i}`),o&&!l.startsWith(this.pathSeparator)?`${this.pathSeparator}${l}`:l}getPathWithoutFileName(r){if(this.isFileOnRootLevel(r))return this.pathSeparator;let i=r.lastIndexOf(this.pathSeparator);return r.substring(0,i)}rewriteFolderPath(r,i){Vb.ensure(r.startsWith(this.pathSeparator)&&r.endsWith(this.pathSeparator),"Path is not a folder path");let l=[...r.split(this.pathSeparator).filter(p=>p!=="").slice(0,-1),i];return`${this.pathSeparator}${l.join(this.pathSeparator)}${this.pathSeparator}`}getFolderPath(r,i){return`${r}${i}${this.pathSeparator}`}getFolders(r){let i=this.isFolderPath(r),o=r.split(this.pathSeparator).filter(l=>l!=="");return i?o:o.slice(0,-1)}isFolderPath(r){return r.endsWith(this.pathSeparator)}getParentFolderPath(r){let i=this.isFolderPath(r),o=this.getFolders(r);return o=i?o.slice(0,-1):o,`${o.join(this.pathSeparator)}${this.pathSeparator}`}},No=new QJe;function BL(n){return({unique_name:r,uniqueName:i})=>r===n||i===n}function Ixe(n){return({id:r})=>r===n}var eh=n=>{if(n.length===0)return"";if(n.length===1)return`"${n[0]}"`;let r=n.slice(0,-1).join('", "'),i=n[n.length-1];return`"${r}" and "${i}"`};var kxe=zl(j2t(),1),q2t=Symbol.for("Dexie"),Pxe=globalThis[q2t]||(globalThis[q2t]=kxe.default);if(kxe.default.semVer!==Pxe.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${kxe.default.semVer} and ${Pxe.semVer}`);var{liveQuery:Ysn,mergeRanges:Ksn,rangesOverlap:Xsn,RangeSet:Zsn,cmp:ean,Entity:tan,PropModification:ran,replacePrefix:nan,add:ian,remove:san}=Pxe;var Nxe=Pxe;var XJe=class extends Nxe{constructor(r){super(r),this.version(1).stores({logs:`++id,
634
+ `)).length+1):r};gKr=OQe(NQe.default.stdout),yKr=gKr,vKr=OQe(NQe.default.stderr)});function FQe(n){return Number.isInteger(n)?n>=4352&&(n<=4447||n===9001||n===9002||11904<=n&&n<=12871&&n!==12351||12880<=n&&n<=19903||19968<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65131||65281<=n&&n<=65376||65504<=n&&n<=65510||110592<=n&&n<=110593||127488<=n&&n<=127569||131072<=n&&n<=262141):!1}var A4t=dy(()=>{});function nF(n,r,i){let o=[...n],l=[],p=typeof i=="number"?i:o.length,_=!1,b,T=0,E="";for(let[k,j]of o.entries()){let z=!1;if(k4t.includes(j)){let X=/\d[^m]*/.exec(n.slice(k,k+18));b=X&&X.length>0?X[0]:void 0,T<p&&(_=!0,b!==void 0&&l.push(b))}else _&&j==="m"&&(_=!1,z=!0);if(!_&&!z&&T++,!bKr.test(j)&&FQe(j.codePointAt())&&(T++,typeof i!="number"&&p++),T>r&&T<=p)E+=j;else if(T===r&&!_&&b!==void 0)E=I4t(l);else if(T>=p){E+=I4t(l,!0,b);break}}return E}var bKr,k4t,rwe,I4t,P4t=dy(()=>{A4t();XEe();bKr=/^[\uD800-\uDBFF][\uDC00-\uDFFF]$/,k4t=["\x1B","\x9B"],rwe=n=>`${k4t[0]}[${n}m`,I4t=(n,r,i)=>{let o=[];n=[...n];for(let l of n){let p=l;l.includes(";")&&(l=l.split(";")[0][0]+"0");let _=jC.codes.get(Number.parseInt(l,10));if(_){let b=n.indexOf(_.toString());b===-1?o.push(rwe(r?_:p)):n.splice(b,1)}else if(r){o.push(rwe(0));break}else o.push(rwe(p))}if(r&&(o=o.filter((l,p)=>o.indexOf(l)===p),i!==void 0)){let l=rwe(jC.codes.get(Number.parseInt(i,10)));o=o.reduce((p,_)=>_===l?[_,...p]:[...p,_],[])}return o.join("")}});var O4t={};Rse(O4t,{default:()=>N4t});function nwe(n,r,i){if(n.charAt(r)===" ")return r;let o=i?1:-1;for(let l=0;l<=3;l++){let p=r+l*o;if(n.charAt(p)===" ")return p}return r}function N4t(n,r,i={}){let{position:o="end",space:l=!1,preferTruncationOnSpace:p=!1}=i,{truncationCharacter:_="\u2026"}=i;if(typeof n!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof n}`);if(typeof r!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof r}`);if(r<1)return"";if(r===1)return _;let b=IA(n);if(b<=r)return n;if(o==="start"){if(p){let T=nwe(n,b-r+1,!0);return _+nF(n,T,b).trim()}return l===!0&&(_+=" "),_+nF(n,b-r+IA(_),b)}if(o==="middle"){l===!0&&(_=` ${_} `);let T=Math.floor(r/2);if(p){let E=nwe(n,T),k=nwe(n,b-(r-T)+1,!0);return nF(n,0,E)+_+nF(n,k,b).trim()}return nF(n,0,T)+_+nF(n,b-(r-T)+IA(_),b)}if(o==="end"){if(p){let T=nwe(n,r-1);return nF(n,0,T)+_}return l===!0&&(_=` ${_}`),nF(n,0,r-IA(_))+_}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${o}`)}var F4t=dy(()=>{P4t();xQe()});var IXr={};Rse(IXr,{COMMANDS:()=>wXr,INIT_HOOK:()=>T8t,run:()=>AXr});module.exports=Sdr(IXr);(function(){Mse().config(Object.assign({},Wgt(),Ggt()(process.argv)))})();var C8t=zl(eQ());var q6t=zl(require("path")),BY=zl(eQ()),PEe=zl(rQ());var Vh;(function(n){n.Catalog="catalog",n.Model="model",n.ModelSettings="model_settings",n.GlobalSettings="global_settings",n.Dimension="dimension",n.Dataset="dataset",n.Metric="metric",n.MetricCalc="metric_calc",n.Connection="connection",n.RowSecurity="row_security",n.CompositeModel="composite_model"})(Vh||(Vh={}));var Zm={...Vh,Unknown:"Unknown",Folder:"Folder",Text:"Text",Environment:"Environment"},OO=["md","gitignore"],ML="env";var LL="Root";var t3=class n{static{this.fileName=".env"}static{this.relativePath=`${n.fileName}`}static create(){return new n}buildFile(){return{compilationOutput:[],rawContent:"",type:Zm.Environment,origin:"R",relativePath:n.relativePath,packageName:LL}}};var FO=class{static hasProps(r,...i){let o=Object.keys(r);return i.every(l=>o.includes(l.toString()))}static hasNoProps(r,...i){let o=Object.keys(r);return i.every(l=>!o.includes(l.toString()))}};var Wwr={isYamlFile(n){let r=n;return r.data!==void 0&&r.data.object_type!==void 0},isTextFile(n){return n.type===Zm.Text},isRawFile(n){return FO.hasProps(n,"rawContent","relativePath")},isPackageFile(n){return FO.hasProps(n,"version","packages")},isFileDimensionType(n){return n.type===Zm.Dimension},isFileModelType(n){return n.type===Zm.Model},isFileCompositeModelType(n){return n.type===Zm.CompositeModel},isEnvFile(n){return n.type===Zm.Environment}},j1=Wwr;var r3=class extends Error{};var Pa=class{static hasProps(r,...i){let o=Object.keys(r);return i.every(l=>o.includes(l.toString()))}static hasNoProps(r,...i){let o=Object.keys(r);return i.every(l=>!o.includes(l.toString()))}};var zwr=n=>`${n} is required`,qJe=class n{constructor(r){this.ErrorConstructor=r}forError(r){return new n(r)}should(r,i){if(!r)throw new this.ErrorConstructor(i)}exists(r,i){this.should(r!=null,i),typeof r=="number"&&this.should(!isNaN(r),i)}notEmpty(r,i){let o=r!=null&&r.trim()!=="";this.should(o,i)}allRequired(r){r.forEach(([i,o])=>{let l=zwr(o);typeof i=="string"&&this.notEmpty(i,l),this.exists(i,l)})}ensure(r,i){if(this.exists(r,i),!r)throw new this.ErrorConstructor(i);return r}ensureType(r,i,o){if(i(r))return r;throw new this.ErrorConstructor(o)}},fs=new qJe(Error),Vb=fs;var Gwr=n=>n?n instanceof Error?n.message:typeof n=="string"?n:`${n}`:"unknown error",Wd={getErrorMessage(n,r){let i=Gwr(n);return r?.removeStartString&&i.startsWith(r.removeStartString)?i.substring(r.removeStartString.length).trim():i},getError(n){return new Error(this.getErrorMessage(n))},hasErrorCode:n=>{if(!n)return!1;let r=n.code;return r?typeof r=="string":!1},async executeQueryOrThrow(n){try{return await n()}catch(r){let i;if(r.response)try{i=(await r.response.json()).message}catch(l){i=`Could not get json error. Error ${Wd.getErrorMessage(l)}. Original error: ${Wd.getErrorMessage(r)}`}else i=`Error: ${Wd.getErrorMessage(r)}`;let o=new Error(i);throw o.status=r.response?.status,o}}},Cxe=Wd;var BJe=class{async wait(r=50){return new Promise(i=>{setTimeout(()=>i(),r)})}async returnDelayed(r,i=300){return await this.wait(i),r}},cin=new BJe;var Hwr={cloneFunctions:!1},bC=class n{static deep(r,i={}){let o={...Hwr,...i};if(r==null)return r;let l=typeof r=="function";if(!l&&!(typeof r=="object"))return r;if(l)return o.cloneFunctions?r:void 0;if(Array.isArray(r))return r.map(_=>n.deep(_,o));if(r instanceof Date)return new Date(r.getTime());{let _={},b=Object.keys(r);for(let T of b)_[T]=n.deep(r[T],o);return _}}static cleanEmptyProperties(r){let i={};for(let o in r){let l=r[o];l===""||l===void 0||l===null||(typeof l=="object"?i[o]=n.cleanEmptyProperties(l):i[o]=l)}return i}};var Qwr=/token/i,Ywr=/password/i,Kwr=/secret/i,C2t=[Qwr,Ywr,Kwr],$Je=class{constructor(){this.undefinedString="[undefined]";this.functionString="[function]";this.circularString="[Circular]";this.obfuscatedString="***"}obfuscate(r){return typeof r=="string"?r==null?this.obfuscatedString:r.length<=6?this.obfuscatedString:r.length<=9?`${this.obfuscatedString}${r.substring(r.length-3)}`:`${r.substring(0,3)}${this.obfuscatedString}${r.substring(r.length-3)}`:this.obfuscatedString}getMaxObjectDepthError(r){return`Max object depth (${r.maxObjectDepth}) exceeded. Current depth: ${r.currentDepth}`}obfuscateObject(r,i,o,l=1){if(l>i.maxObjectDepth)return this.getMaxObjectDepthError({maxObjectDepth:i.maxObjectDepth,currentDepth:l});if(r instanceof Date)return r.toISOString();if(r instanceof Map){let p={};for(let[_,b]of r.entries()){let T=typeof _=="string"?_:i.jsonSerialize(_);C2t.some(E=>E.test(T))?p[T]=this.obfuscate(b):p[T]=this.obfuscateObject(b,i,o,l+1)}return p}if(r instanceof Set)return Array.from(r).map(p=>this.obfuscateObject(p,i,o,l+1));if(typeof r=="bigint")return r.toString();if(r===void 0)return i.serializeUndefined?this.undefinedString:r;if(typeof r=="function")return i.serializeFunctions?this.functionString:r;if(typeof r=="symbol")return i.serializeSymbols?r.toString():r;if(Array.isArray(r))return r.map(p=>this.obfuscateObject(p,i,o,l+1));if(r!==null&&typeof r=="object"){if(o.has(r))return this.circularString;o.add(r);let p={};for(let[_,b]of Object.entries(r))_.toLowerCase()!=="prototype"&&(typeof b=="function"&&!i.serializeFunctions||(typeof b=="string"&&C2t.some(T=>T.test(_))?p[_]=this.obfuscate(b):p[_]=this.obfuscateObject(b,i,o,l+1)));return p}return r}safeToString(r,i){let l=Object.assign({serializeUndefined:!0,serializeFunctions:!1,serializeSymbols:!1,rethrowErrors:!1,maxObjectDepth:10,jsonSerialize:JSON.stringify},i??{});try{let p=new WeakSet,_=this.obfuscateObject(r,l,p);return l.jsonSerialize(_,null,l.space)}catch(p){let _=`Error serializing object: ${Cxe.getErrorMessage(p)}`;if(l.rethrowErrors)throw Error(_);return _}}},hin=new $Je;var RO=n=>n!=null;var E2t=zl(require("crypto")),wxe=new Uint8Array(256),Exe=wxe.length;function JJe(){return Exe>wxe.length-16&&(E2t.default.randomFillSync(wxe),Exe=0),wxe.slice(Exe,Exe+=16)}var w2t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Xwr(n){return typeof n=="string"&&w2t.test(n)}var n3=Xwr;var Wb=[];for(let n=0;n<256;++n)Wb.push((n+256).toString(16).slice(1));function Axe(n,r=0){return(Wb[n[r+0]]+Wb[n[r+1]]+Wb[n[r+2]]+Wb[n[r+3]]+"-"+Wb[n[r+4]]+Wb[n[r+5]]+"-"+Wb[n[r+6]]+Wb[n[r+7]]+"-"+Wb[n[r+8]]+Wb[n[r+9]]+"-"+Wb[n[r+10]]+Wb[n[r+11]]+Wb[n[r+12]]+Wb[n[r+13]]+Wb[n[r+14]]+Wb[n[r+15]]).toLowerCase()}function Zwr(n){if(!n3(n))throw TypeError("Invalid UUID");let r,i=new Uint8Array(16);return i[0]=(r=parseInt(n.slice(0,8),16))>>>24,i[1]=r>>>16&255,i[2]=r>>>8&255,i[3]=r&255,i[4]=(r=parseInt(n.slice(9,13),16))>>>8,i[5]=r&255,i[6]=(r=parseInt(n.slice(14,18),16))>>>8,i[7]=r&255,i[8]=(r=parseInt(n.slice(19,23),16))>>>8,i[9]=r&255,i[10]=(r=parseInt(n.slice(24,36),16))/1099511627776&255,i[11]=r/4294967296&255,i[12]=r>>>24&255,i[13]=r>>>16&255,i[14]=r>>>8&255,i[15]=r&255,i}var bB=Zwr;function eAr(n){n=unescape(encodeURIComponent(n));let r=[];for(let i=0;i<n.length;++i)r.push(n.charCodeAt(i));return r}var tAr="6ba7b810-9dad-11d1-80b4-00c04fd430c8",rAr="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UJe(n,r,i){function o(l,p,_,b){var T;if(typeof l=="string"&&(l=eAr(l)),typeof p=="string"&&(p=bB(p)),((T=p)===null||T===void 0?void 0:T.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let E=new Uint8Array(16+l.length);if(E.set(p),E.set(l,p.length),E=i(E),E[6]=E[6]&15|r,E[8]=E[8]&63|128,_){b=b||0;for(let k=0;k<16;++k)_[b+k]=E[k];return _}return Axe(E)}try{o.name=n}catch{}return o.DNS=tAr,o.URL=rAr,o}var A2t=zl(require("crypto")),VJe={randomUUID:A2t.default.randomUUID};function nAr(n,r,i){if(VJe.randomUUID&&!r&&!n)return VJe.randomUUID();n=n||{};let o=n.random||(n.rng||JJe)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,r){i=i||0;for(let l=0;l<16;++l)r[i+l]=o[l];return r}return Axe(o)}var SB=nAr;var I2t=zl(require("crypto"));function iAr(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),I2t.default.createHash("sha1").update(n).digest()}var k2t=iAr;var sAr=UJe("v5",80,k2t),qL=sAr;var aAr="4d2cacb5-5b53-4da4-b120-709089990e91",WJe=class{generateNew(){return SB()}generateNewPredictable(r){return qL(r,aAr)}validate(r){return n3(r)}parse(r){return bB(r)}},zJe=new WJe;var lAr=(n,r)=>{let i=r===void 0?"string":r,o=Object.keys(n).map(l=>n[l]);if(i==="string")return o;if(i==="number")return o.map(l=>parseInt(l)).filter(l=>!isNaN(l));throw new Error(`result type "${r}" is not supported in EnumUtil.getAllValues`)},Rk={getAllValues:lAr},P2t=Rk;var R2t=(p=>(p.Second="s",p.Minute="m",p.Hour="h",p.Day="d",p.Week="w",p))(R2t||{}),N2t=P2t.getAllValues(R2t,"string"),O2t=/^\d{1,10}[smhdw]$/,F2t=/^\d+$/,GJe=[{unit:"w",factor:1},{unit:"d",factor:7},{unit:"h",factor:24},{unit:"m",factor:60},{unit:"s",factor:60}],i3={isValidNonNegativeInteger:n=>F2t.test(n.trim()),isValidDuration:n=>O2t.test(n.trim()),toString:n=>n.unit?`${n.value}${n.unit}`:`${n.value}`,parse:n=>{let r=n.trim();if(F2t.test(r))return{value:parseInt(r,10)};Vb.should(O2t.test(r),`invalid input for duration: "${n}"`);let i=r[r.length-1];Vb.should(N2t.includes(i),`invalid time unit in "${n}". Unit "${i}" should be one of ${N2t.join(", ")} `);let o=i;return{value:parseInt(r.substring(0,r.length-1)),unit:o}},toSeconds:n=>{if(!n.unit)return n.value;let r=GJe.findIndex(o=>o.unit===n.unit);Vb.should(r>=0,`Cannot convert duration with time unit: ${n.unit}. No mapping was found`);let i=n.value;for(let o=r+1;o<GJe.length;o++)i=i*GJe[o].factor;return i}};var L2t="\\",HJe="/",M2t=[HJe,L2t],QJe=class{constructor(){this._pathSeparator=typeof process<"u"&&process.platform==="win32"?L2t:HJe;this._pathSeparatorChanged=!1}get pathSeparator(){return this._pathSeparator}set pathSeparator(r){Vb.should(!this._pathSeparatorChanged,`Path separator is already changed to ${this._pathSeparator}. For protection it can be set only once.`),Vb.should(M2t.includes(r),`Cannot set pathSeparator to '${r}'. It is invalid. It should be one of: ${M2t.join(",")}`),this._pathSeparatorChanged=!0,this._pathSeparator=r}joinTwo(r,i){if(r==="")return i;if(i==="")return r;let o=r.endsWith(this.pathSeparator)?r.slice(void 0,r.length-1):r,l=i.startsWith(this.pathSeparator)?i.slice(1):i;return`${o}${this.pathSeparator}${l}`}join(...r){return Vb.ensure(r.length>1,"Cannot join path for less than two paths"),r.slice(1).reduce((i,o)=>this.joinTwo(i,o),r[0])}areEqual(r,i){if(r===i)return!0;if(r===void 0||i===void 0)return!1;let o=r.startsWith(this.pathSeparator)?r.substring(1):r,l=i.startsWith(this.pathSeparator)?i.substring(1):i;return o.endsWith(this.pathSeparator)&&(o=o.substring(0,o.length-1)),l.endsWith(this.pathSeparator)&&(l=l.substring(0,l.length-1)),o===l}getExtensionFromPath(r){let i=r.lastIndexOf(this.pathSeparator),o=i===-1?0:i+1,l=r.substring(o),p=l.lastIndexOf(".");if(!(p===-1||p===l.length-1))return l.substring(p+1)}getFileNameFromPath(r){let i=r.lastIndexOf(this.pathSeparator);return i!==-1?r.substring(i+1):r}getFileNameFromPathWithoutExtension(r){let i=this.getFileNameFromPath(r),o=this.getExtensionFromPath(r);return o?i.replace("."+o,""):i}isFileOnRootLevel(r){let i=r.lastIndexOf(this.pathSeparator);return i===-1?!0:!r.substring(0,i).length}getPath(r,i){let o=this.pathSeparator===HJe,l=`${r}${i}`;return r.endsWith(this.pathSeparator)&&i.startsWith(this.pathSeparator)&&(l=`${r}${i.slice(1)}`),!r.endsWith(this.pathSeparator)&&!i.startsWith(this.pathSeparator)&&(l=`${r}${this.pathSeparator}${i}`),o&&!l.startsWith(this.pathSeparator)?`${this.pathSeparator}${l}`:l}getPathWithoutFileName(r){if(this.isFileOnRootLevel(r))return this.pathSeparator;let i=r.lastIndexOf(this.pathSeparator);return r.substring(0,i)}rewriteFolderPath(r,i){Vb.ensure(r.startsWith(this.pathSeparator)&&r.endsWith(this.pathSeparator),"Path is not a folder path");let l=[...r.split(this.pathSeparator).filter(p=>p!=="").slice(0,-1),i];return`${this.pathSeparator}${l.join(this.pathSeparator)}${this.pathSeparator}`}getFolderPath(r,i){return`${r}${i}${this.pathSeparator}`}getFolders(r){let i=this.isFolderPath(r),o=r.split(this.pathSeparator).filter(l=>l!=="");return i?o:o.slice(0,-1)}isFolderPath(r){return r.endsWith(this.pathSeparator)}getParentFolderPath(r){let i=this.isFolderPath(r),o=this.getFolders(r);return o=i?o.slice(0,-1):o,`${o.join(this.pathSeparator)}${this.pathSeparator}`}},No=new QJe;function BL(n){return({unique_name:r,uniqueName:i})=>r===n||i===n}function Ixe(n){return({id:r})=>r===n}var eh=n=>{if(n.length===0)return"";if(n.length===1)return`"${n[0]}"`;let r=n.slice(0,-1).join('", "'),i=n[n.length-1];return`"${r}" and "${i}"`};var kxe=zl(j2t(),1),q2t=Symbol.for("Dexie"),Pxe=globalThis[q2t]||(globalThis[q2t]=kxe.default);if(kxe.default.semVer!==Pxe.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${kxe.default.semVer} and ${Pxe.semVer}`);var{liveQuery:Ysn,mergeRanges:Ksn,rangesOverlap:Xsn,RangeSet:Zsn,cmp:ean,Entity:tan,PropModification:ran,replacePrefix:nan,add:ian,remove:san}=Pxe;var Nxe=Pxe;var XJe=class extends Nxe{constructor(r){super(r),this.version(1).stores({logs:`++id,
635
635
  timestamp,
636
636
  level,
637
637
  loggerName`})}},uAr=new XJe("LogsDB");function Oxe(n){return n=n.replace(/^(https:\/\/|git@)/,""),n=n.replace(":","/"),n.replace(/\.git$/,"").toLowerCase()}var nQ=n=>n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/--.*$/gm,"");var _A=n=>{let r=/(?<=\[Measures\]\.\[).+?(?=])/g;return nQ(n).match(r)||[]};var jae=class{static firstDefined(...r){let i=r.find(o=>o==null?!1:typeof o=="string"?o!=="":!0);return Vb.ensure(i,"Cannot get first defined value. All are undefined, null or empty string.")}};var fAr={maxAttempts:3,initialDelayMs:20,maxDelayMs:1e3,backoffMultiplier:2,shouldRetry:()=>!0},ZJe=class{async execute(r,i={}){let o={...fAr,...i};Vb.should(o.maxAttempts>0,"Execution aborted: maxAttempts is less than or equal to 0"),Vb.should(o.initialDelayMs>=0,`Execution aborted: initialDelayMs (${o.initialDelayMs}) must be >= 0`),Vb.should(o.maxDelayMs>=0,`Execution aborted: maxDelayMs (${o.maxDelayMs}) must be >= 0`),Vb.should(o.backoffMultiplier>=1,`Execution aborted: backoffMultiplier (${o.backoffMultiplier}) must be >= 1`),Vb.should(o.initialDelayMs<=o.maxDelayMs,`Execution aborted: initialDelayMs (${o.initialDelayMs}) must not exceed maxDelayMs (${o.maxDelayMs})`);let l=o.initialDelayMs;for(let p=1;p<=o.maxAttempts;p++)try{return await r()}catch(_){if(p===o.maxAttempts||!o.shouldRetry(_))throw _;await new Promise(b=>setTimeout(b,l)),l=Math.min(l*o.backoffMultiplier,o.maxDelayMs)}throw new Error("Retry loop exited without returning or throwing.")}},oon=new ZJe;var eUe=/\$\$?\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g;function B2t(n,r){return n.replace(eUe,(i,o)=>i.startsWith("$$")?i.slice(1):r[o]??"")}function Fxe(n){for(let r of n.matchAll(eUe))if(!r[0].startsWith("$$"))return!0;return!1}function $2t(n){let r=new Set;for(let i of n.matchAll(eUe)){let[o,l]=i;o.startsWith("$$")||r.add(l)}return[...r]}var nl=(j=>(j.Catalog="catalog",j.Model="model",j.ModelSettings="model_settings",j.GlobalSettings="global_settings",j.Dimension="dimension",j.Dataset="dataset",j.Metric="metric",j.MetricCalc="metric_calc",j.Connection="connection",j.RowSecurity="row_security",j.CompositeModel="composite_model",j))(nl||{});var pAr={connection:[{path:"unique_name",allowTemplate:!1},{path:"object_type",allowTemplate:!1},{path:"*",allowTemplate:!0}],dataset:[{path:"sql",allowTemplate:!0},{path:"dialects[*].sql",allowTemplate:!0},{path:"*",allowTemplate:!1}]};function dAr(n,r){if(n==="*")return!0;let i="^"+n.replace(/\./g,"\\.").replace(/\[\*\]/g,"\\[\\d+\\]").replace(/\*/g,"[^.\\[\\]]+")+"$";return new RegExp(i).test(r)}function _Ar(n,r){for(let i of r)if(dAr(i.path,n))return i.allowTemplate;return!0}function mAr(n,r){let o=$2t(n).filter(l=>!(l in r));if(o.length)throw new Error(`The variable \${${o[0]}} is not defined in the .env file or the engine environment variables (sml.environment.variables). Please add ${o[0]}="your_value_here" to the .env file or configure it in the engine settings to resolve this issue.`)}function Rxe(n,r,i,o=""){if(!i)return n;let l=pAr[r]||[];if(typeof n=="string"){let p=Fxe(n);if(p&&!_Ar(o,l))throw new Error(`Variables cannot be used in the "${o}" field. Please provide a fixed value.`);return p?(mAr(n,i),B2t(n,i)):n}if(Array.isArray(n))return n.map((p,_)=>Rxe(p,r,i,`${o}[${_}]`));if(n&&typeof n=="object"){let p={};for(let _ in n)if(n.hasOwnProperty(_)){let b=o?`${o}.${_}`:_;p[_]=Rxe(n[_],r,i,b)}return p}return n}var tUe=["connection","dataset"];var J2t=zl(Mse()),qae=class n{static create(){return new n}parse(r){return{...r,data:J2t.parse(r.rawContent),compilationOutput:[]}}};var Bae=class n{static create(){return new n}parse(r){return{...r,data:JSON.parse(r.rawContent),compilationOutput:[]}}};function iEt(n){return typeof n>"u"||n===null}function hAr(n){return typeof n=="object"&&n!==null}function gAr(n){return Array.isArray(n)?n:iEt(n)?[]:[n]}function yAr(n,r){var i,o,l,p;if(r)for(p=Object.keys(r),i=0,o=p.length;i<o;i+=1)l=p[i],n[l]=r[l];return n}function vAr(n,r){var i="",o;for(o=0;o<r;o+=1)i+=n;return i}function bAr(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}var SAr=iEt,DAr=hAr,xAr=gAr,TAr=vAr,CAr=bAr,EAr=yAr,Iv={isNothing:SAr,isObject:DAr,toArray:xAr,repeat:TAr,isNegativeZero:CAr,extend:EAr};function sEt(n,r){var i="",o=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(i+='in "'+n.mark.name+'" '),i+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(i+=`
@@ -665,7 +665,7 @@ ${r}`,JYr=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),UYr=Obj
665
665
  `+n.slice(l,p),l=p+1),_=b;return T+=`
666
666
  `,n.length-l>r&&_>l?T+=n.slice(l,_)+`
667
667
  `+n.slice(_+1):T+=n.slice(l),T.slice(1)}function dkr(n){for(var r="",i=0,o,l=0;l<n.length;i>=65536?l+=2:l++)i=$ae(n,l),o=oD[i],!o&&Wae(i)?(r+=n[l],i>=65536&&(r+=n[l+1])):r+=o||ikr(i);return r}function _kr(n,r,i){var o="",l=n.tag,p,_,b;for(p=0,_=i.length;p<_;p+=1)b=i[p],n.replacer&&(b=n.replacer.call(i,String(p),b)),(s3(n,r,b,!1,!1)||typeof b>"u"&&s3(n,r,null,!1,!1))&&(o!==""&&(o+=","+(n.condenseFlow?"":" ")),o+=n.dump);n.tag=l,n.dump="["+o+"]"}function rEt(n,r,i,o){var l="",p=n.tag,_,b,T;for(_=0,b=i.length;_<b;_+=1)T=i[_],n.replacer&&(T=n.replacer.call(i,String(_),T)),(s3(n,r+1,T,!0,!0,!1,!0)||typeof T>"u"&&s3(n,r+1,null,!0,!0,!1,!0))&&((!o||l!=="")&&(l+=oUe(n,r)),n.dump&&Uae===n.dump.charCodeAt(0)?l+="-":l+="- ",l+=n.dump);n.tag=p,n.dump=l||"[]"}function mkr(n,r,i){var o="",l=n.tag,p=Object.keys(i),_,b,T,E,k;for(_=0,b=p.length;_<b;_+=1)k="",o!==""&&(k+=", "),n.condenseFlow&&(k+='"'),T=p[_],E=i[T],n.replacer&&(E=n.replacer.call(i,T,E)),s3(n,r,T,!1,!1)&&(n.dump.length>1024&&(k+="? "),k+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),s3(n,r,E,!1,!1)&&(k+=n.dump,o+=k));n.tag=l,n.dump="{"+o+"}"}function hkr(n,r,i,o){var l="",p=n.tag,_=Object.keys(i),b,T,E,k,j,z;if(n.sortKeys===!0)_.sort();else if(typeof n.sortKeys=="function")_.sort(n.sortKeys);else if(n.sortKeys)throw new Px("sortKeys must be a boolean or a function");for(b=0,T=_.length;b<T;b+=1)z="",(!o||l!=="")&&(z+=oUe(n,r)),E=_[b],k=i[E],n.replacer&&(k=n.replacer.call(i,E,k)),s3(n,r+1,E,!0,!0,!0)&&(j=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,j&&(n.dump&&Uae===n.dump.charCodeAt(0)?z+="?":z+="? "),z+=n.dump,j&&(z+=oUe(n,r)),s3(n,r+1,k,!0,j)&&(n.dump&&Uae===n.dump.charCodeAt(0)?z+=":":z+=": ",z+=n.dump,l+=z));n.tag=p,n.dump=l||"{}"}function nEt(n,r,i){var o,l,p,_,b,T;for(l=i?n.explicitTypes:n.implicitTypes,p=0,_=l.length;p<_;p+=1)if(b=l[p],(b.instanceOf||b.predicate)&&(!b.instanceOf||typeof r=="object"&&r instanceof b.instanceOf)&&(!b.predicate||b.predicate(r))){if(i?b.multi&&b.representName?n.tag=b.representName(r):n.tag=b.tag:n.tag="?",b.represent){if(T=n.styleMap[b.tag]||b.defaultStyle,REt.call(b.represent)==="[object Function]")o=b.represent(r,T);else if(MEt.call(b.represent,T))o=b.represent[T](r,T);else throw new Px("!<"+b.tag+'> tag resolver accepts not "'+T+'" style');n.dump=o}return!0}return!1}function s3(n,r,i,o,l,p,_){n.tag=null,n.dump=i,nEt(n,i,!1)||nEt(n,i,!0);var b=REt.call(n.dump),T=o,E;o&&(o=n.flowLevel<0||n.flowLevel>r);var k=b==="[object Object]"||b==="[object Array]",j,z;if(k&&(j=n.duplicates.indexOf(i),z=j!==-1),(n.tag!==null&&n.tag!=="?"||z||n.indent!==2&&r>0)&&(l=!1),z&&n.usedDuplicates[j])n.dump="*ref_"+j;else{if(k&&z&&!n.usedDuplicates[j]&&(n.usedDuplicates[j]=!0),b==="[object Object]")o&&Object.keys(n.dump).length!==0?(hkr(n,r,n.dump,l),z&&(n.dump="&ref_"+j+n.dump)):(mkr(n,r,n.dump),z&&(n.dump="&ref_"+j+" "+n.dump));else if(b==="[object Array]")o&&n.dump.length!==0?(n.noArrayIndent&&!_&&r>0?rEt(n,r-1,n.dump,l):rEt(n,r,n.dump,l),z&&(n.dump="&ref_"+j+n.dump)):(_kr(n,r,n.dump),z&&(n.dump="&ref_"+j+" "+n.dump));else if(b==="[object String]")n.tag!=="?"&&fkr(n,n.dump,r,p,T);else{if(b==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new Px("unacceptable kind of an object to dump "+b)}n.tag!==null&&n.tag!=="?"&&(E=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?E="!"+E:E.slice(0,18)==="tag:yaml.org,2002:"?E="!!"+E.slice(18):E="!<"+E+">",n.dump=E+" "+n.dump)}return!0}function gkr(n,r){var i=[],o=[],l,p;for(lUe(n,i,o),l=0,p=o.length;l<p;l+=1)r.duplicates.push(i[o[l]]);r.usedDuplicates=new Array(p)}function lUe(n,r,i){var o,l,p;if(n!==null&&typeof n=="object")if(l=r.indexOf(n),l!==-1)i.indexOf(l)===-1&&i.push(l);else if(r.push(n),Array.isArray(n))for(l=0,p=n.length;l<p;l+=1)lUe(n[l],r,i);else for(o=Object.keys(n),l=0,p=o.length;l<p;l+=1)lUe(n[o[l]],r,i)}function ykr(n,r){r=r||{};var i=new akr(r);i.noRefs||gkr(n,i);var o=n;return i.replacer&&(o=i.replacer.call({"":o},"",o)),s3(i,0,o,!0,!0)?i.dump+`
668
- `:""}var vkr=ykr,bkr={dump:vkr};function mUe(n,r){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var Skr=zb,Dkr=aEt,xkr=uEt,zae=mEt,Tkr=hEt,Ckr=fUe,Gae=FEt.load,Ekr=FEt.loadAll,wkr=bkr.dump,Hae=Px,Akr={binary:SEt,float:_Et,map:lEt,null:fEt,pairs:xEt,set:TEt,timestamp:vEt,bool:pEt,int:dEt,merge:bEt,omap:DEt,seq:cEt,str:oEt},Ikr=mUe("safeLoad","load"),kkr=mUe("safeLoadAll","loadAll"),Pkr=mUe("safeDump","dump"),Qae={Type:Skr,Schema:Dkr,FAILSAFE_SCHEMA:xkr,JSON_SCHEMA:zae,CORE_SCHEMA:Tkr,DEFAULT_SCHEMA:Ckr,load:Gae,loadAll:Ekr,dump:wkr,YAMLException:Hae,types:Akr,safeLoad:Ikr,safeLoadAll:kkr,safeDump:Pkr};var UL=class n{static create(){return new n}parse(r){let i=Gae(r.rawContent,{schema:zae});return{...r,data:i,compilationOutput:[]}}};var Nkr={yaml:UL.create(),yml:UL.create(),json:Bae.create(),env:qae.create()},TB=class n{constructor(r=Nkr){this.mappings=r}static create(){return new n}parseRawContent(r,i="yaml"){let o={rawContent:r,relativePath:`name.${i}`};return this.parse(o).data}parse(r){let i=No.getExtensionFromPath(r.relativePath);return i?(this.mappings[i]||this.defaultParser()).parse(r):this.defaultParser().parse(r)}defaultParser(){return{parse(r){return{...r,data:r.rawContent,compilationOutput:[]}},parseRawContent(r){return r}}}};var Okr=n=>n.trim()===""||n.trim().startsWith("#")?!0:/^[A-Za-z_]+[A-Za-z0-9_]*=(.*)$/.test(n),Yae=class{getErrors(r){let i=[];return r.split(/\r?\n/).forEach((l,p)=>{Okr(l)||i.push(`Invalid format at line ${p+1}: "${l}"`)}),i}};var Kae=class{getErrors(r){try{return JSON.parse(r),[]}catch(i){return typeof i=="string"?[i]:i instanceof Error?[i.message]:[`${i}`]}}};var cQ=class{getErrors(r){let i=[];try{Qae.load(r)}catch(o){o instanceof Hae?i.push(o.message):i.push(`Unknown yaml parsing error: ${Wd.getErrorMessage(o)}`)}return i}};var Fkr={yml:new cQ,yaml:new cQ,json:new Kae,env:new Yae},Xae=class{constructor(r=Fkr){this.mappings=r}getValidator(r){let i=this.getExtensionFromPath(r);return i?this.mappings[i]||this.dummyValidator():this.dummyValidator()}dummyValidator(){return{getErrors:()=>[]}}getExtensionFromPath(r){let i=r.lastIndexOf("/"),o=i===-1?0:i+1,l=r.substring(o),p=l.lastIndexOf(".");if(!(p===-1||p===l.length-1))return l.substring(p+1)}};var Mk=class{static traverse(r,i){r.files.forEach(i),r.folders.flatMap(o=>this.traverse(o,i))}};var hUe={unknownObjectTypeWarning:"Unknown object type. File will be skipped.",notSupportedObjectTypeError:n=>`Not supported object type ${n}`},CB=class{getType(r,i){let o=r.data;if(!o||!o.object_type){r.compilationOutput.push({message:hUe.unknownObjectTypeWarning,severity:"warning"}),i.file(r).addWarning(hUe.unknownObjectTypeWarning);return}if(!Object.values(nl).filter(p=>isNaN(Number(p))).includes(o.object_type)){i.file(r).addError(hUe.notSupportedObjectTypeError(o.object_type));return}return o.object_type}};var Rkr=n=>Pa.hasProps("rawContent")&&(n.rawContent||"").length>0,Zae=n=>({relativePath:n.relativePath,compilationOutput:[],origin:n.origin,type:"Unknown",data:n.data,rawContent:n.rawContent,packageName:n.packageName}),VL=class{constructor(r={}){this.compilerSettings=r.compilerSettings||{amlFileExtensions:["yaml","yml"]},this.fileTypeValidationFactory=r.fileTypeValidationFactory||new Xae,this.yamlObjectTypeExtractor=r.yamlObjectTypeExtractor||new CB,this.fileParser=r.fileParser||new TB}parseFolderStructure(r,i,o){let l=r.files.find(E=>E.relativePath===t3.relativePath),p=l?this.parseFile(l,i):void 0,_=p?.data,b=o||_?{...o,..._}:void 0;l&&(r.files=r.files.filter(E=>E.relativePath!==t3.relativePath)??[]);let T=this.parseFolderStructureInternal(r,i,b);return p&&T.files.push(p),T}parseFolderStructureInternal(r,i,o,l=1){if(l>=50){let _=`Max folder depth exceed. Max folder depth is 50. Current folder path: ${r.path}`;throw i.global().addError(_),new r3(_)}let p={path:r.path,origin:r.origin,files:[],folders:[],packageName:r.packageName};return p.files=r.files.map(_=>this.parseFile(_,i,o)),p.folders=r.folders.map(_=>this.parseFolderStructureInternal(_,i,o,l+1)),p}getTextFile(r){return{...r,type:Zm.Text,data:void 0}}getEnvFile(r,i){return{...r,type:Zm.Environment,data:i}}parseFile(r,i,o){let l=[...this.compilerSettings.amlFileExtensions,ML,...OO];if(!this.hasValidExtension(l,r))return i.file(r).addInfo("File is not recognized as atscale file and will be skipped"),Zae(r);let p=this.compilerSettings.amlFileExtensions.includes(No.getExtensionFromPath(r.relativePath)||""),_=j1.isEnvFile(r);if(_&&!No.isFileOnRootLevel(r.relativePath)&&i.file(r).addWarning("Environment files should be on root level"),Rkr(r)){let T=this.fileTypeValidationFactory.getValidator(r.relativePath).getErrors(r.rawContent);if(T.length>0)return T.forEach(j=>{i.file(r).addWarning(j)}),_?this.getEnvFile(r):p?this.getTextFile(r):Zae(r);let E={},k;try{E=this.fileParser.parse(r);let j=No.getExtensionFromPath(r.relativePath)||"";k=OO.includes(j)?void 0:this.yamlObjectTypeExtractor.getType(E,i),E=this.handleEnvironmentVariableInParsedFile({file:E,objectType:k,environmentVariables:o,validatorOutput:i})}catch(j){return i.file(r).addError(`File content is invalid. It cannot be parsed. ${Wd.getErrorMessage(j)}`),_?this.getEnvFile(r):p?this.getTextFile(r):Zae(r)}return k?{...r,type:k,data:E.data}:_?this.getEnvFile(r,E.data):j1.isTextFile(r)||p?this.getTextFile(r):Zae(r)}else return _?(i.file(r).addWarning("Environment file is empty"),this.getEnvFile(r)):j1.isTextFile(r)?this.getTextFile(r):(i.file(r).addInfo("File has no rawContent and will be skipped"),Zae(r))}extractYamlFiles(r){let i=[];return Mk.traverse(r,o=>{if(j1.isYamlFile(o)&&this.hasValidExtension(this.compilerSettings.amlFileExtensions,o)){if(this.isFileTypeCatalog(o.type)&&o.origin!=="R")return;i.push(o)}}),i}hasValidExtension(r,i){let o=No.getExtensionFromPath(i.relativePath);return!!o&&r.includes(o)}getYamlFilesWithValidObjectType(r,i){let o=[];return r.forEach(l=>{j1.isYamlFile(l)&&this.yamlObjectTypeExtractor.getType(l,i)&&o.push(l)}),o}isFileTypeCatalog(r){return r===Zm.Catalog}handleEnvironmentVariableInParsedFile({file:r,objectType:i,environmentVariables:o,validatorOutput:l}){if(!Fxe(r.rawContent))return r;if(i&&!tUe.includes(i))return l.file(r).addError(`Variable placeholders (e.g., \${VARIABLE_NAME}) were detected in a ${i} file. Variable replacement is only supported for the following file types: ${tUe.join(", ")}.`),r;if(!o)return l.file(r).addError("Referenced variables were detected, but no environment variables are configured. Please create a .env file or configure the engine environment variables (sml.environment.variables)."),r;let _=r.data;try{_=this.replaceVariablesInData(r.data,o)}catch(b){return l.file(r).addError(Wd.getErrorMessage(b)),r}return{...r,data:_}}replaceVariablesInData(r,i){return Rxe(r,r.object_type,i)}};var DC="package.yml";var Mkr=n=>`${n} is required`,gUe=class n{constructor(r){this.ErrorConstructor=r}forError(r){return new n(r)}should(r,i){if(!r)throw new this.ErrorConstructor(i)}exists(r,i){this.should(r!=null,i),typeof r=="number"&&this.should(!isNaN(r),i)}notEmpty(r,i){let o=r!=null&&r.trim()!=="";this.should(o,i)}allRequired(r){r.forEach(([i,o])=>{let l=Mkr(o);typeof i=="string"&&this.notEmpty(i,l),this.exists(i,l)})}ensure(r,i){if(this.exists(r,i),!r)throw new this.ErrorConstructor(i);return r}ensureType(r,i,o){if(i(r))return r;throw new this.ErrorConstructor(o)}},eoe=new gUe(Error),nE=eoe;var Lkr=function(n,r,i,o){function l(p){return p instanceof i?p:new i(function(_){_(p)})}return new(i||(i=Promise))(function(p,_){function b(k){try{E(o.next(k))}catch(j){_(j)}}function T(k){try{E(o.throw(k))}catch(j){_(j)}}function E(k){k.done?p(k.value):l(k.value).then(b,T)}E((o=o.apply(n,r||[])).next())})},jkr=n=>n?n instanceof Error?n.message:typeof n=="string"?n:`${n}`:"unknown error",Lk={getErrorMessage(n,r){let i=jkr(n);return r?.removeStartString&&i.startsWith(r.removeStartString)?i.substring(r.removeStartString.length).trim():i},getError(n){return new Error(this.getErrorMessage(n))},hasErrorCode:n=>{if(!n)return!1;let r=n.code;return r?typeof r=="string":!1},executeQueryOrThrow(n){return Lkr(this,void 0,void 0,function*(){try{return yield n()}catch(r){let i;if(r.response)try{i=(yield r.response.json()).message}catch(o){i=`Could not get json error. Error ${Lk.getErrorMessage(o)}. Original error: ${Lk.getErrorMessage(r)}`}else i=`Error: ${Lk.getErrorMessage(r)}`;throw new Error(i)}})}},Jxe=Lk;var zEt=function(n,r,i,o){function l(p){return p instanceof i?p:new i(function(_){_(p)})}return new(i||(i=Promise))(function(p,_){function b(k){try{E(o.next(k))}catch(j){_(j)}}function T(k){try{E(o.throw(k))}catch(j){_(j)}}function E(k){k.done?p(k.value):l(k.value).then(b,T)}E((o=o.apply(n,r||[])).next())})},yUe=class{wait(r=50){return zEt(this,void 0,void 0,function*(){return new Promise(i=>{setTimeout(()=>i(),r)})})}returnDelayed(r,i=300){return zEt(this,void 0,void 0,function*(){return yield this.wait(i),r})}},Scn=new yUe;var qkr={cloneFunctions:!1},lQ=class n{static deep(r,i={}){let o=Object.assign(Object.assign({},qkr),i);if(r==null)return r;let l=typeof r=="function";if(!l&&!(typeof r=="object"))return r;if(l)return o.cloneFunctions?r:void 0;if(Array.isArray(r))return r.map(_=>n.deep(_,o));if(r instanceof Date)return new Date(r.getTime());{let _={},b=Object.keys(r);for(let T of b)_[T]=n.deep(r[T],o);return _}}static cleanEmptyProperties(r){let i={};for(let o in r){let l=r[o];l===""||l===void 0||l===null||(typeof l=="object"?i[o]=n.cleanEmptyProperties(l):i[o]=l)}return i}};var Bkr=/token/i,$kr=/password/i,Jkr=/secret/i,GEt=[Bkr,$kr,Jkr],vUe=class{constructor(){this.undefinedString="[undefined]",this.functionString="[function]",this.circularString="[Circular]",this.obfuscatedString="***"}obfuscate(r){return typeof r=="string"?r==null?this.obfuscatedString:r.length<=6?this.obfuscatedString:r.length<=9?`${this.obfuscatedString}${r.substring(r.length-3)}`:`${r.substring(0,3)}${this.obfuscatedString}${r.substring(r.length-3)}`:this.obfuscatedString}getMaxObjectDepthError(r){return`Max object depth (${r.maxObjectDepth}) exceeded. Current depth: ${r.currentDepth}`}obfuscateObject(r,i,o,l=1){if(l>i.maxObjectDepth)return this.getMaxObjectDepthError({maxObjectDepth:i.maxObjectDepth,currentDepth:l});if(r instanceof Date)return r.toISOString();if(r instanceof Map){let p={};for(let[_,b]of r.entries()){let T=typeof _=="string"?_:i.jsonSerialize(_);GEt.some(E=>E.test(T))?p[T]=this.obfuscate(b):p[T]=this.obfuscateObject(b,i,o,l+1)}return p}if(r instanceof Set)return Array.from(r).map(p=>this.obfuscateObject(p,i,o,l+1));if(typeof r=="bigint")return r.toString();if(r===void 0)return i.serializeUndefined?this.undefinedString:r;if(typeof r=="function")return i.serializeFunctions?this.functionString:r;if(typeof r=="symbol")return i.serializeSymbols?r.toString():r;if(Array.isArray(r))return r.map(p=>this.obfuscateObject(p,i,o,l+1));if(r!==null&&typeof r=="object"){if(o.has(r))return this.circularString;o.add(r);let p={};for(let[_,b]of Object.entries(r))_.toLowerCase()!=="prototype"&&(typeof b=="function"&&!i.serializeFunctions||(typeof b=="string"&&GEt.some(T=>T.test(_))?p[_]=this.obfuscate(b):p[_]=this.obfuscateObject(b,i,o,l+1)));return p}return r}safeToString(r,i){let l=Object.assign({serializeUndefined:!0,serializeFunctions:!1,serializeSymbols:!1,rethrowErrors:!1,maxObjectDepth:10,jsonSerialize:JSON.stringify},i??{});try{let p=new WeakSet,_=this.obfuscateObject(r,l,p);return l.jsonSerialize(_,null,l.space)}catch(p){let _=`Error serializing object: ${Jxe.getErrorMessage(p)}`;if(l.rethrowErrors)throw Error(_);return _}}},Icn=new vUe;var Ukr="4d2cacb5-5b53-4da4-b120-709089990e91",bUe=class{generateNew(){return SB()}generateNewPredictable(r){return qL(r,Ukr)}validate(r){return n3(r)}parse(r){return bB(r)}},SUe=new bUe;var Vkr=(n,r)=>{let i=r===void 0?"string":r,o=Object.keys(n).map(l=>n[l]);if(i==="string")return o;if(i==="number")return o.map(l=>parseInt(l)).filter(l=>!isNaN(l));throw new Error(`result type "${r}" is not supported in EnumUtil.getAllValues`)},Wkr={getAllValues:Vkr},HEt=Wkr;var WL;(function(n){n.Second="s",n.Minute="m",n.Hour="h",n.Day="d",n.Week="w"})(WL||(WL={}));var Gcn=HEt.getAllValues(WL,"string");var Hcn=[{unit:WL.Week,factor:1},{unit:WL.Day,factor:7},{unit:WL.Hour,factor:24},{unit:WL.Minute,factor:60},{unit:WL.Second,factor:60}];var YEt="\\",DUe="/",QEt=[DUe,YEt],xUe=class{constructor(){this._pathSeparator=typeof process<"u"&&process.platform==="win32"?YEt:DUe,this._pathSeparatorChanged=!1}get pathSeparator(){return this._pathSeparator}set pathSeparator(r){nE.should(!this._pathSeparatorChanged,`Path separator is already changed to ${this._pathSeparator}. For protection it can be set only once.`),nE.should(QEt.includes(r),`Cannot set pathSeparator to '${r}'. It is invalid. It should be one of: ${QEt.join(",")}`),this._pathSeparatorChanged=!0,this._pathSeparator=r}joinTwo(r,i){if(r==="")return i;if(i==="")return r;let o=r.endsWith(this.pathSeparator)?r.slice(void 0,r.length-1):r,l=i.startsWith(this.pathSeparator)?i.slice(1):i;return`${o}${this.pathSeparator}${l}`}join(...r){return nE.ensure(r.length>1,"Cannot join path for less than two paths"),r.slice(1).reduce((i,o)=>this.joinTwo(i,o),r[0])}areEqual(r,i){if(r===i)return!0;if(r===void 0||i===void 0)return!1;let o=r.startsWith(this.pathSeparator)?r.substring(1):r,l=i.startsWith(this.pathSeparator)?i.substring(1):i;return o.endsWith(this.pathSeparator)&&(o=o.substring(0,o.length-1)),l.endsWith(this.pathSeparator)&&(l=l.substring(0,l.length-1)),o===l}getExtensionFromPath(r){let i=r.lastIndexOf(this.pathSeparator),o=i===-1?0:i+1,l=r.substring(o),p=l.lastIndexOf(".");if(!(p===-1||p===l.length-1))return l.substring(p+1)}getFileNameFromPath(r){let i=r.lastIndexOf(this.pathSeparator);return i!==-1?r.substring(i+1):r}getFileNameFromPathWithoutExtension(r){let i=this.getFileNameFromPath(r),o=this.getExtensionFromPath(r);return o?i.replace("."+o,""):i}isFileOnRootLevel(r){let i=r.lastIndexOf(this.pathSeparator);return i===-1?!0:!r.substring(0,i).length}getPath(r,i){let o=this.pathSeparator===DUe,l=`${r}${i}`;return r.endsWith(this.pathSeparator)&&i.startsWith(this.pathSeparator)&&(l=`${r}${i.slice(1)}`),!r.endsWith(this.pathSeparator)&&!i.startsWith(this.pathSeparator)&&(l=`${r}${this.pathSeparator}${i}`),o&&!l.startsWith(this.pathSeparator)?`${this.pathSeparator}${l}`:l}getPathWithoutFileName(r){if(this.isFileOnRootLevel(r))return this.pathSeparator;let i=r.lastIndexOf(this.pathSeparator);return r.substring(0,i)}rewriteFolderPath(r,i){nE.ensure(r.startsWith(this.pathSeparator)&&r.endsWith(this.pathSeparator),"Path is not a folder path");let l=[...r.split(this.pathSeparator).filter(p=>p!=="").slice(0,-1),i];return`${this.pathSeparator}${l.join(this.pathSeparator)}${this.pathSeparator}`}getFolderPath(r,i){return`${r}${i}${this.pathSeparator}`}getFolders(r){let i=this.isFolderPath(r),o=r.split(this.pathSeparator).filter(l=>l!=="");return i?o:o.slice(0,-1)}isFolderPath(r){return r.endsWith(this.pathSeparator)}getParentFolderPath(r){let i=this.isFolderPath(r),o=this.getFolders(r);return o=i?o.slice(0,-1):o,`${o.join(this.pathSeparator)}${this.pathSeparator}`}},zkr=new xUe;var KEt=n=>n.replace(/(['"\w])\s+(?=[A-Za-z_][A-Za-z0-9_]*=)/g,`$1
668
+ `:""}var vkr=ykr,bkr={dump:vkr};function mUe(n,r){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var Skr=zb,Dkr=aEt,xkr=uEt,zae=mEt,Tkr=hEt,Ckr=fUe,Gae=FEt.load,Ekr=FEt.loadAll,wkr=bkr.dump,Hae=Px,Akr={binary:SEt,float:_Et,map:lEt,null:fEt,pairs:xEt,set:TEt,timestamp:vEt,bool:pEt,int:dEt,merge:bEt,omap:DEt,seq:cEt,str:oEt},Ikr=mUe("safeLoad","load"),kkr=mUe("safeLoadAll","loadAll"),Pkr=mUe("safeDump","dump"),Qae={Type:Skr,Schema:Dkr,FAILSAFE_SCHEMA:xkr,JSON_SCHEMA:zae,CORE_SCHEMA:Tkr,DEFAULT_SCHEMA:Ckr,load:Gae,loadAll:Ekr,dump:wkr,YAMLException:Hae,types:Akr,safeLoad:Ikr,safeLoadAll:kkr,safeDump:Pkr};var UL=class n{static create(){return new n}parse(r){let i=Gae(r.rawContent,{schema:zae});return{...r,data:i,compilationOutput:[]}}};var Nkr={yaml:UL.create(),yml:UL.create(),json:Bae.create(),env:qae.create()},TB=class n{constructor(r=Nkr){this.mappings=r}static create(){return new n}parseRawContent(r,i="yaml"){let o={rawContent:r,relativePath:`name.${i}`};return this.parse(o).data}parse(r){let i=No.getExtensionFromPath(r.relativePath);return i?(this.mappings[i]||this.defaultParser()).parse(r):this.defaultParser().parse(r)}defaultParser(){return{parse(r){return{...r,data:r.rawContent,compilationOutput:[]}},parseRawContent(r){return r}}}};var Okr=n=>n.trim()===""||n.trim().startsWith("#")?!0:/^[A-Za-z_]+[A-Za-z0-9_]*=(.*)$/.test(n),Yae=class{getErrors(r){let i=[];return r.split(/\r?\n/).forEach((l,p)=>{Okr(l)||i.push(`Invalid format at line ${p+1}: "${l}"`)}),i}};var Kae=class{getErrors(r){try{return JSON.parse(r),[]}catch(i){return typeof i=="string"?[i]:i instanceof Error?[i.message]:[`${i}`]}}};var cQ=class{getErrors(r){let i=[];try{Qae.load(r)}catch(o){o instanceof Hae?i.push(o.message):i.push(`Unknown yaml parsing error: ${Wd.getErrorMessage(o)}`)}return i}};var Fkr={yml:new cQ,yaml:new cQ,json:new Kae,env:new Yae},Xae=class{constructor(r=Fkr){this.mappings=r}getValidator(r){let i=this.getExtensionFromPath(r);return i?this.mappings[i]||this.dummyValidator():this.dummyValidator()}dummyValidator(){return{getErrors:()=>[]}}getExtensionFromPath(r){let i=r.lastIndexOf("/"),o=i===-1?0:i+1,l=r.substring(o),p=l.lastIndexOf(".");if(!(p===-1||p===l.length-1))return l.substring(p+1)}};var Mk=class{static traverse(r,i){r.files.forEach(i),r.folders.flatMap(o=>this.traverse(o,i))}};var hUe={unknownObjectTypeWarning:"Unknown object type. File will be skipped.",notSupportedObjectTypeError:n=>`Not supported object type ${n}`},CB=class{getType(r,i){let o=r.data;if(!o||!o.object_type){r.compilationOutput.push({message:hUe.unknownObjectTypeWarning,severity:"warning"}),i.file(r).addWarning(hUe.unknownObjectTypeWarning);return}if(!Object.values(nl).filter(p=>isNaN(Number(p))).includes(o.object_type)){i.file(r).addError(hUe.notSupportedObjectTypeError(o.object_type));return}return o.object_type}};var Rkr=n=>Pa.hasProps("rawContent")&&(n.rawContent||"").length>0,Zae=n=>({relativePath:n.relativePath,compilationOutput:[],origin:n.origin,type:"Unknown",data:n.data,rawContent:n.rawContent,packageName:n.packageName}),VL=class{constructor(r={}){this.compilerSettings=r.compilerSettings||{amlFileExtensions:["yaml","yml"]},this.fileTypeValidationFactory=r.fileTypeValidationFactory||new Xae,this.yamlObjectTypeExtractor=r.yamlObjectTypeExtractor||new CB,this.fileParser=r.fileParser||new TB}parseFolderStructure(r,i,o){let l=r.files.find(E=>E.relativePath===t3.relativePath),p=l?this.parseFile(l,i):void 0,_=p?.data,b=o||_?{...o,..._}:void 0;l&&(r.files=r.files.filter(E=>E.relativePath!==t3.relativePath)??[]);let T=this.parseFolderStructureInternal(r,i,b);return p&&T.files.push(p),T}parseFolderStructureInternal(r,i,o,l=1){if(l>=50){let _=`Max folder depth exceed. Max folder depth is 50. Current folder path: ${r.path}`;throw i.global().addError(_),new r3(_)}let p={path:r.path,origin:r.origin,files:[],folders:[],packageName:r.packageName};return p.files=r.files.map(_=>this.parseFile(_,i,o)),p.folders=r.folders.map(_=>this.parseFolderStructureInternal(_,i,o,l+1)),p}getTextFile(r){return{...r,type:Zm.Text,data:void 0}}getEnvFile(r,i){return{...r,type:Zm.Environment,data:i}}parseFile(r,i,o){let l=[...this.compilerSettings.amlFileExtensions,ML,...OO];if(!this.hasValidExtension(l,r))return i.file(r).addInfo("File is not recognized as atscale file and will be skipped"),Zae(r);let p=this.compilerSettings.amlFileExtensions.includes(No.getExtensionFromPath(r.relativePath)||""),_=j1.isEnvFile(r);if(_&&!No.isFileOnRootLevel(r.relativePath)&&i.file(r).addWarning("Environment files should be on root level"),Rkr(r)){let T=this.fileTypeValidationFactory.getValidator(r.relativePath).getErrors(r.rawContent);if(T.length>0)return T.forEach(j=>{i.file(r).addWarning(j)}),_?this.getEnvFile(r):p?this.getTextFile(r):Zae(r);let E={},k;try{E=this.fileParser.parse(r);let j=No.getExtensionFromPath(r.relativePath)||"";k=OO.includes(j)?void 0:this.yamlObjectTypeExtractor.getType(E,i),E=this.handleEnvironmentVariableInParsedFile({file:E,objectType:k,environmentVariables:o,validatorOutput:i})}catch(j){return i.file(r).addError(`File content is invalid. It cannot be parsed. ${Wd.getErrorMessage(j)}`),_?this.getEnvFile(r):p?this.getTextFile(r):Zae(r)}return k?{...r,type:k,data:E.data}:_?this.getEnvFile(r,E.data):j1.isTextFile(r)||p?this.getTextFile(r):Zae(r)}else return _?(i.file(r).addWarning("Environment file is empty"),this.getEnvFile(r)):j1.isTextFile(r)?this.getTextFile(r):(i.file(r).addInfo("File has no rawContent and will be skipped"),Zae(r))}extractYamlFiles(r){let i=[];return Mk.traverse(r,o=>{if(j1.isYamlFile(o)&&this.hasValidExtension(this.compilerSettings.amlFileExtensions,o)){if(this.isFileTypeCatalog(o.type)&&o.origin!=="R")return;i.push(o)}}),i}hasValidExtension(r,i){let o=No.getExtensionFromPath(i.relativePath);return!!o&&r.includes(o)}getYamlFilesWithValidObjectType(r,i){let o=[];return r.forEach(l=>{j1.isYamlFile(l)&&this.yamlObjectTypeExtractor.getType(l,i)&&o.push(l)}),o}isFileTypeCatalog(r){return r===Zm.Catalog}handleEnvironmentVariableInParsedFile({file:r,objectType:i,environmentVariables:o,validatorOutput:l}){if(!Fxe(r.rawContent))return r;if(i&&!tUe.includes(i))return l.file(r).addError(`Variable placeholders (e.g., \${VARIABLE_NAME}) were detected in a ${i} file. Variable replacement is only supported for the following file types: ${tUe.join(", ")}.`),r;if(!o)return l.file(r).addError("Referenced variables were detected, but no environment variables are configured. Please create a .env file or configure the engine environment variables (sml.environment.variables)."),r;let _=r.data;try{_=this.replaceVariablesInData(r.data,o)}catch(b){return l.file(r).addError(Wd.getErrorMessage(b)),r}return{...r,data:_}}replaceVariablesInData(r,i){return Rxe(r,r.object_type,i)}};var DC="package.yml";var Mkr=n=>`${n} is required`,gUe=class n{constructor(r){this.ErrorConstructor=r}forError(r){return new n(r)}should(r,i){if(!r)throw new this.ErrorConstructor(i)}exists(r,i){this.should(r!=null,i),typeof r=="number"&&this.should(!isNaN(r),i)}notEmpty(r,i){let o=r!=null&&r.trim()!=="";this.should(o,i)}allRequired(r){r.forEach(([i,o])=>{let l=Mkr(o);typeof i=="string"&&this.notEmpty(i,l),this.exists(i,l)})}ensure(r,i){if(this.exists(r,i),!r)throw new this.ErrorConstructor(i);return r}ensureType(r,i,o){if(i(r))return r;throw new this.ErrorConstructor(o)}},eoe=new gUe(Error),nE=eoe;var Lkr=function(n,r,i,o){function l(p){return p instanceof i?p:new i(function(_){_(p)})}return new(i||(i=Promise))(function(p,_){function b(k){try{E(o.next(k))}catch(j){_(j)}}function T(k){try{E(o.throw(k))}catch(j){_(j)}}function E(k){k.done?p(k.value):l(k.value).then(b,T)}E((o=o.apply(n,r||[])).next())})},jkr=n=>n?n instanceof Error?n.message:typeof n=="string"?n:`${n}`:"unknown error",Lk={getErrorMessage(n,r){let i=jkr(n);return r?.removeStartString&&i.startsWith(r.removeStartString)?i.substring(r.removeStartString.length).trim():i},getError(n){return new Error(this.getErrorMessage(n))},hasErrorCode:n=>{if(!n)return!1;let r=n.code;return r?typeof r=="string":!1},executeQueryOrThrow(n){var r;return Lkr(this,void 0,void 0,function*(){try{return yield n()}catch(i){let o;if(i.response)try{o=(yield i.response.json()).message}catch(p){o=`Could not get json error. Error ${Lk.getErrorMessage(p)}. Original error: ${Lk.getErrorMessage(i)}`}else o=`Error: ${Lk.getErrorMessage(i)}`;let l=new Error(o);throw l.status=(r=i.response)===null||r===void 0?void 0:r.status,l}})}},Jxe=Lk;var zEt=function(n,r,i,o){function l(p){return p instanceof i?p:new i(function(_){_(p)})}return new(i||(i=Promise))(function(p,_){function b(k){try{E(o.next(k))}catch(j){_(j)}}function T(k){try{E(o.throw(k))}catch(j){_(j)}}function E(k){k.done?p(k.value):l(k.value).then(b,T)}E((o=o.apply(n,r||[])).next())})},yUe=class{wait(r=50){return zEt(this,void 0,void 0,function*(){return new Promise(i=>{setTimeout(()=>i(),r)})})}returnDelayed(r,i=300){return zEt(this,void 0,void 0,function*(){return yield this.wait(i),r})}},Scn=new yUe;var qkr={cloneFunctions:!1},lQ=class n{static deep(r,i={}){let o=Object.assign(Object.assign({},qkr),i);if(r==null)return r;let l=typeof r=="function";if(!l&&!(typeof r=="object"))return r;if(l)return o.cloneFunctions?r:void 0;if(Array.isArray(r))return r.map(_=>n.deep(_,o));if(r instanceof Date)return new Date(r.getTime());{let _={},b=Object.keys(r);for(let T of b)_[T]=n.deep(r[T],o);return _}}static cleanEmptyProperties(r){let i={};for(let o in r){let l=r[o];l===""||l===void 0||l===null||(typeof l=="object"?i[o]=n.cleanEmptyProperties(l):i[o]=l)}return i}};var Bkr=/token/i,$kr=/password/i,Jkr=/secret/i,GEt=[Bkr,$kr,Jkr],vUe=class{constructor(){this.undefinedString="[undefined]",this.functionString="[function]",this.circularString="[Circular]",this.obfuscatedString="***"}obfuscate(r){return typeof r=="string"?r==null?this.obfuscatedString:r.length<=6?this.obfuscatedString:r.length<=9?`${this.obfuscatedString}${r.substring(r.length-3)}`:`${r.substring(0,3)}${this.obfuscatedString}${r.substring(r.length-3)}`:this.obfuscatedString}getMaxObjectDepthError(r){return`Max object depth (${r.maxObjectDepth}) exceeded. Current depth: ${r.currentDepth}`}obfuscateObject(r,i,o,l=1){if(l>i.maxObjectDepth)return this.getMaxObjectDepthError({maxObjectDepth:i.maxObjectDepth,currentDepth:l});if(r instanceof Date)return r.toISOString();if(r instanceof Map){let p={};for(let[_,b]of r.entries()){let T=typeof _=="string"?_:i.jsonSerialize(_);GEt.some(E=>E.test(T))?p[T]=this.obfuscate(b):p[T]=this.obfuscateObject(b,i,o,l+1)}return p}if(r instanceof Set)return Array.from(r).map(p=>this.obfuscateObject(p,i,o,l+1));if(typeof r=="bigint")return r.toString();if(r===void 0)return i.serializeUndefined?this.undefinedString:r;if(typeof r=="function")return i.serializeFunctions?this.functionString:r;if(typeof r=="symbol")return i.serializeSymbols?r.toString():r;if(Array.isArray(r))return r.map(p=>this.obfuscateObject(p,i,o,l+1));if(r!==null&&typeof r=="object"){if(o.has(r))return this.circularString;o.add(r);let p={};for(let[_,b]of Object.entries(r))_.toLowerCase()!=="prototype"&&(typeof b=="function"&&!i.serializeFunctions||(typeof b=="string"&&GEt.some(T=>T.test(_))?p[_]=this.obfuscate(b):p[_]=this.obfuscateObject(b,i,o,l+1)));return p}return r}safeToString(r,i){let l=Object.assign({serializeUndefined:!0,serializeFunctions:!1,serializeSymbols:!1,rethrowErrors:!1,maxObjectDepth:10,jsonSerialize:JSON.stringify},i??{});try{let p=new WeakSet,_=this.obfuscateObject(r,l,p);return l.jsonSerialize(_,null,l.space)}catch(p){let _=`Error serializing object: ${Jxe.getErrorMessage(p)}`;if(l.rethrowErrors)throw Error(_);return _}}},Icn=new vUe;var Ukr="4d2cacb5-5b53-4da4-b120-709089990e91",bUe=class{generateNew(){return SB()}generateNewPredictable(r){return qL(r,Ukr)}validate(r){return n3(r)}parse(r){return bB(r)}},SUe=new bUe;var Vkr=(n,r)=>{let i=r===void 0?"string":r,o=Object.keys(n).map(l=>n[l]);if(i==="string")return o;if(i==="number")return o.map(l=>parseInt(l)).filter(l=>!isNaN(l));throw new Error(`result type "${r}" is not supported in EnumUtil.getAllValues`)},Wkr={getAllValues:Vkr},HEt=Wkr;var WL;(function(n){n.Second="s",n.Minute="m",n.Hour="h",n.Day="d",n.Week="w"})(WL||(WL={}));var Gcn=HEt.getAllValues(WL,"string");var Hcn=[{unit:WL.Week,factor:1},{unit:WL.Day,factor:7},{unit:WL.Hour,factor:24},{unit:WL.Minute,factor:60},{unit:WL.Second,factor:60}];var YEt="\\",DUe="/",QEt=[DUe,YEt],xUe=class{constructor(){this._pathSeparator=typeof process<"u"&&process.platform==="win32"?YEt:DUe,this._pathSeparatorChanged=!1}get pathSeparator(){return this._pathSeparator}set pathSeparator(r){nE.should(!this._pathSeparatorChanged,`Path separator is already changed to ${this._pathSeparator}. For protection it can be set only once.`),nE.should(QEt.includes(r),`Cannot set pathSeparator to '${r}'. It is invalid. It should be one of: ${QEt.join(",")}`),this._pathSeparatorChanged=!0,this._pathSeparator=r}joinTwo(r,i){if(r==="")return i;if(i==="")return r;let o=r.endsWith(this.pathSeparator)?r.slice(void 0,r.length-1):r,l=i.startsWith(this.pathSeparator)?i.slice(1):i;return`${o}${this.pathSeparator}${l}`}join(...r){return nE.ensure(r.length>1,"Cannot join path for less than two paths"),r.slice(1).reduce((i,o)=>this.joinTwo(i,o),r[0])}areEqual(r,i){if(r===i)return!0;if(r===void 0||i===void 0)return!1;let o=r.startsWith(this.pathSeparator)?r.substring(1):r,l=i.startsWith(this.pathSeparator)?i.substring(1):i;return o.endsWith(this.pathSeparator)&&(o=o.substring(0,o.length-1)),l.endsWith(this.pathSeparator)&&(l=l.substring(0,l.length-1)),o===l}getExtensionFromPath(r){let i=r.lastIndexOf(this.pathSeparator),o=i===-1?0:i+1,l=r.substring(o),p=l.lastIndexOf(".");if(!(p===-1||p===l.length-1))return l.substring(p+1)}getFileNameFromPath(r){let i=r.lastIndexOf(this.pathSeparator);return i!==-1?r.substring(i+1):r}getFileNameFromPathWithoutExtension(r){let i=this.getFileNameFromPath(r),o=this.getExtensionFromPath(r);return o?i.replace("."+o,""):i}isFileOnRootLevel(r){let i=r.lastIndexOf(this.pathSeparator);return i===-1?!0:!r.substring(0,i).length}getPath(r,i){let o=this.pathSeparator===DUe,l=`${r}${i}`;return r.endsWith(this.pathSeparator)&&i.startsWith(this.pathSeparator)&&(l=`${r}${i.slice(1)}`),!r.endsWith(this.pathSeparator)&&!i.startsWith(this.pathSeparator)&&(l=`${r}${this.pathSeparator}${i}`),o&&!l.startsWith(this.pathSeparator)?`${this.pathSeparator}${l}`:l}getPathWithoutFileName(r){if(this.isFileOnRootLevel(r))return this.pathSeparator;let i=r.lastIndexOf(this.pathSeparator);return r.substring(0,i)}rewriteFolderPath(r,i){nE.ensure(r.startsWith(this.pathSeparator)&&r.endsWith(this.pathSeparator),"Path is not a folder path");let l=[...r.split(this.pathSeparator).filter(p=>p!=="").slice(0,-1),i];return`${this.pathSeparator}${l.join(this.pathSeparator)}${this.pathSeparator}`}getFolderPath(r,i){return`${r}${i}${this.pathSeparator}`}getFolders(r){let i=this.isFolderPath(r),o=r.split(this.pathSeparator).filter(l=>l!=="");return i?o:o.slice(0,-1)}isFolderPath(r){return r.endsWith(this.pathSeparator)}getParentFolderPath(r){let i=this.isFolderPath(r),o=this.getFolders(r);return o=i?o.slice(0,-1):o,`${o.join(this.pathSeparator)}${this.pathSeparator}`}},zkr=new xUe;var KEt=n=>n.replace(/(['"\w])\s+(?=[A-Za-z_][A-Za-z0-9_]*=)/g,`$1
669
669
  `);var TUe;(function(n){n.Info="Info",n.Warning="Warning",n.Error="Error"})(TUe||(TUe={}));var CUe=class extends Nxe{constructor(r){super(r),this.version(1).stores({logs:`++id,
670
670
  timestamp,
671
671
  level,
@@ -118,5 +118,5 @@
118
118
  "strict": true
119
119
  }
120
120
  },
121
- "version": "2026.6.1-rc.4"
121
+ "version": "2026.6.1-rc.6"
122
122
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sml-cli",
3
3
  "description": "Semantic Modeling Language CLI",
4
- "version": "2026.6.1-rc.4",
4
+ "version": "2026.6.1-rc.6",
5
5
  "bin": {
6
6
  "sml-cli": "./bin/run.js"
7
7
  },