@platforma-sdk/block-tools 2.5.53 → 2.5.55
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/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{config-DrI3vxIZ.mjs → config-7hVPHpfZ.mjs} +535 -535
- package/dist/config-7hVPHpfZ.mjs.map +1 -0
- package/dist/config-BJeRGQPb.js +3 -0
- package/dist/config-BJeRGQPb.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +10 -10
- package/dist/config-DrI3vxIZ.mjs.map +0 -1
- package/dist/config-NXo7pge0.js +0 -3
- package/dist/config-NXo7pge0.js.map +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";var wn=Object.defineProperty;var kn=(e,t,r)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var te=(e,t,r)=>kn(e,typeof t!="symbol"?t+"":t,r);const g=require("@milaboratories/pl-model-middle-layer"),L=require("zod"),x=require("node:path"),U=require("node:fs/promises"),Pn=require("mime-types"),yn=require("tar"),qr=require("@milaboratories/resolve-helper"),Ct=require("@milaboratories/ts-helpers"),Dr=require("node:crypto"),Sn=require("yaml"),Cn=require("node:os"),M=require("node:path/posix"),xr=require("@aws-sdk/client-s3"),On=require("node:fs");function ue(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const fe=ue(Pn),In=ue(yn),zt=ue(Cn),Y=ue(On);function _r(e){return L.z.string().transform((t,r)=>{const n=qr.tryResolve(e,t);return n===void 0?(r.addIssue({code:L.z.ZodIssueCode.custom,message:`Can't resolve ${t} against ${e}`}),L.z.NEVER):{type:"absolute-file",file:n}})}function jr(e,...t){return L.z.string().transform((r,n)=>{const a=r.endsWith("/")?r:`${r}/`;for(const u of t){const c=qr.tryResolve(e,a+u);if(c!==void 0){if(!c.endsWith(u))throw new Error(`Unexpected resolve result ${c} with index file ${u}`);return{type:"absolute-folder",folder:c.slice(0,c.length-u.length)}}}return n.addIssue({code:L.z.ZodIssueCode.custom,message:`Can't resolve ${r} folder against ${e}, no index file found (${t.join(", ")})`}),L.z.NEVER})}function vt(e){return t=>t.type==="relative"?{type:"absolute-file",file:x.resolve(e,t.path)}:t}function Ot(){return async e=>e.type==="absolute-file"?await U.readFile(e.file,{encoding:"utf-8"}):e.content}function Gr(){return async e=>{if(e.type==="absolute-file"){const t=fe.lookup(e.file);if(!t)throw new Error(`Can't recognize mime type of the file: ${e.file}.`);return{type:"explicit-base64",mimeType:t,content:await U.readFile(e.file,{encoding:"base64"})}}else return e}}function zr(){return async e=>{if(e.type==="absolute-file"){const t=fe.lookup(e.file);if(!t)throw new Error(`Can't recognize mime type of the file: ${e.file}.`);return{type:"explicit-bytes",mimeType:t,content:Buffer.from(await U.readFile(e.file))}}else return e.type==="explicit-base64"?{type:"explicit-bytes",mimeType:e.mimeType,content:Buffer.from(e.content,"base64")}:e}}function ae(e,t){return async r=>{if(r.type==="absolute-file"){const n=x.basename(r.file),a=x.resolve(e,n);return t==null||t.push(n),await U.cp(r.file,a),{type:"relative",path:n}}else return r}}function Mr(e,t,r){if(!t.endsWith(".tgz"))throw new Error(`Unexpected tgz file name: ${t}`);return async n=>{const a=x.resolve(e,t);return await In.create({gzip:!0,file:a,cwd:n.folder},["."]),r==null||r.push(t),{type:"relative",path:t}}}function he(e){return async t=>t.type==="explicit-string"?t:{type:"explicit-string",content:(await e(t.path)).toString("utf8")}}function Ur(e){return async t=>t.type==="explicit-string"?t.content:(await e(t.path)).toString("utf8")}function Nn(e){return async t=>{if(t.type==="explicit-base64")return t;const r=fe.lookup(t.path);if(!r)throw new Error(`Can't recognize mime type of the file: ${t.path}.`);return{type:"explicit-base64",mimeType:r,content:(await e(t.path)).toString("base64")}}}function Q(e){return async t=>{if(t.type==="explicit-base64")return{type:"explicit-bytes",mimeType:t.mimeType,content:Buffer.from(t.content,"base64")};const r=fe.lookup(t.path);if(!r)throw new Error(`Can't recognize mime type of the file: ${t.path}.`);return{type:"explicit-bytes",mimeType:r,content:await e(t.path)}}}function Vr(e){return g.BlockPackMeta(g.DescriptionContentText.transform(vt(e)),g.DescriptionContentBinary.transform(vt(e)))}function Xr(e,t){return g.BlockPackMeta(g.ContentAbsoluteTextLocal.transform(ae(e,t)),g.ContentAbsoluteBinaryLocal.transform(ae(e,t)))}const Ln=g.BlockPackMeta(g.ContentAbsoluteTextLocal.transform(Ot()),g.ContentAbsoluteBinaryLocal.transform(Gr())).pipe(g.BlockPackMetaEmbeddedBase64),Tn=g.BlockPackMeta(g.ContentAbsoluteTextLocal.transform(Ot()),g.ContentAbsoluteBinaryLocal.transform(zr())).pipe(g.BlockPackMetaEmbeddedBytes);function An(e){return g.BlockPackMeta(g.ContentRelativeText.transform(Ur(e)),g.ContentRelativeBinary.transform(Q(e))).pipe(g.BlockPackMetaEmbeddedBytes)}function Jr(e){return g.BlockComponents(_r(e),jr(e,"index.html"))}function Wr(e,t){return g.BlockComponents(g.ContentAbsoluteBinaryLocal.transform(ae(e,t)),g.ContentAbsoluteFolder.transform(Mr(e,"ui.tgz",t))).pipe(g.BlockComponentsManifest)}function Bn(e){return g.BlockComponents(g.ContentRelative.transform(g.mapRemoteToAbsolute(e)),g.ContentRelative.transform(g.mapRemoteToAbsolute(e)))}function It(e){return g.CreateBlockPackDescriptionSchema(Jr(e),Vr(e))}function Hr(e,t){return g.CreateBlockPackDescriptionSchema(Wr(e,t),Xr(e,t)).pipe(g.BlockPackDescriptionManifest)}function $t(e){const t=g.addPrefixToRelative(e);return g.BlockPackDescriptionManifest.pipe(g.CreateBlockPackDescriptionSchema(g.BlockComponents(g.ContentRelative.transform(t),g.ContentRelative.transform(t)),g.BlockPackMeta(g.ContentRelativeText.transform(t),g.ContentRelativeBinary.transform(t)))).pipe(g.BlockPackDescriptionManifest)}async function Nt(e,t){try{return t(await U.readFile(e))}catch(r){if(r.code=="ENOENT")return;throw new Error("",{cause:r})}}async function oe(e){return Buffer.from(await crypto.subtle.digest("sha-256",e)).toString("hex").toUpperCase()}async function Fn(e,t){await U.mkdir(t,{recursive:!0});const r=[],n=await Hr(t,r).parseAsync(e),a=await Promise.all(r.map(async c=>{const h=await U.readFile(x.resolve(t,c)),o=await oe(h);return{name:c,size:h.length,sha256:o}})),u=g.BlockPackManifest.parse({schema:"v2",description:n,files:a,timestamp:Date.now()});return await U.writeFile(x.resolve(t,g.BlockPackManifestFile),JSON.stringify(u)),u}const ce="block",bn=/(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;function Lt(e){const t=e.match(bn);if(!t)throw new Error(`Malformed package name (${e}), can't infer organization and block pack name.`);const{name:r,organization:n}=t.groups;return{name:r,organization:n}}async function qn(e,t){const r=x.resolve(e,"package.json");try{const n=await Nt(r,h=>JSON.parse(h.toString("utf-8")));if(n===void 0)return;const a=n[ce];if(a===void 0)return;const u={...g.BlockPackDescriptionFromPackageJsonRaw.parse(a),id:{...Lt(Ct.notEmpty(n.name,`"name" not found in ${r}`)),version:g.SemVer.parse(n.version)}},c=await It(e).safeParseAsync(u);if(c.success)return c.data;t==null||t.warn(c.error);return}catch(n){t==null||t.warn(n);return}}async function Yr(e){const t=x.resolve(e,"package.json"),r=JSON.parse(await U.readFile(t,{encoding:"utf-8"})),n=r[ce];if(n===void 0)throw new Error(`Block description (field ${ce}) not found in ${t}.`);return{...g.BlockPackDescriptionFromPackageJsonRaw.parse(n),id:{...Lt(Ct.notEmpty(r.name,`"name" not found in ${t}`)),version:g.SemVer.parse(r.version)}}}async function Dn(e){const t=await Yr(e);return await It(e).parseAsync(t)}function xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re={exports:{}},Se,Mt;function pe(){if(Mt)return Se;Mt=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,a=t-6;return Se={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Se}var Ce,Ut;function de(){return Ut||(Ut=1,Ce=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Ce}var Vt;function ee(){return Vt||(Vt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=pe(),u=de();t=e.exports={};const c=t.re=[],h=t.safeRe=[],o=t.src=[],i=t.safeSrc=[],s=t.t={};let l=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",a],[f,n]],k=v=>{for(const[$,I]of d)v=v.split(`${$}*`).join(`${$}{0,${I}}`).split(`${$}+`).join(`${$}{1,${I}}`);return v},p=(v,$,I)=>{const S=k($),F=l++;u(v,F,$),s[v]=F,o[F]=$,i[F]=S,c[F]=new RegExp($,I?"g":void 0),h[F]=new RegExp(S,I?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),p("MAINVERSION",`(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})\\.(${o[s.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})\\.(${o[s.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${o[s.NONNUMERICIDENTIFIER]}|${o[s.NUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${o[s.NONNUMERICIDENTIFIER]}|${o[s.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASE",`(?:-(${o[s.PRERELEASEIDENTIFIER]}(?:\\.${o[s.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${o[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[s.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${f}+`),p("BUILD",`(?:\\+(${o[s.BUILDIDENTIFIER]}(?:\\.${o[s.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${o[s.MAINVERSION]}${o[s.PRERELEASE]}?${o[s.BUILD]}?`),p("FULL",`^${o[s.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${o[s.MAINVERSIONLOOSE]}${o[s.PRERELEASELOOSE]}?${o[s.BUILD]}?`),p("LOOSE",`^${o[s.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${o[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${o[s.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:\\.(${o[s.XRANGEIDENTIFIER]})(?:${o[s.PRERELEASE]})?${o[s.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[s.XRANGEIDENTIFIERLOOSE]})(?:${o[s.PRERELEASELOOSE]})?${o[s.BUILD]}?)?)?`),p("XRANGE",`^${o[s.GTLT]}\\s*${o[s.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${o[s.GTLT]}\\s*${o[s.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${o[s.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",o[s.COERCEPLAIN]+`(?:${o[s.PRERELEASE]})?(?:${o[s.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",o[s.COERCE],!0),p("COERCERTLFULL",o[s.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${o[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${o[s.LONETILDE]}${o[s.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${o[s.LONETILDE]}${o[s.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${o[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${o[s.LONECARET]}${o[s.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${o[s.LONECARET]}${o[s.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${o[s.GTLT]}\\s*(${o[s.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${o[s.GTLT]}\\s*(${o[s.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${o[s.GTLT]}\\s*(${o[s.LOOSEPLAIN]}|${o[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${o[s.XRANGEPLAIN]})\\s+-\\s+(${o[s.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${o[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[s.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(re,re.exports)),re.exports}var Oe,Xt;function Tt(){if(Xt)return Oe;Xt=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return Oe=n=>n?typeof n!="object"?e:n:t,Oe}var Ie,Jt;function Kr(){if(Jt)return Ie;Jt=1;const e=/^[0-9]+$/,t=(n,a)=>{const u=e.test(n),c=e.test(a);return u&&c&&(n=+n,a=+a),n===a?0:u&&!c?-1:c&&!u?1:n<a?-1:1};return Ie={compareIdentifiers:t,rcompareIdentifiers:(n,a)=>t(a,n)},Ie}var Ne,Wt;function j(){if(Wt)return Ne;Wt=1;const e=de(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=pe(),{safeRe:n,t:a}=ee(),u=Tt(),{compareIdentifiers:c}=Kr();class h{constructor(i,s){if(s=u(s),i instanceof h){if(i.loose===!!s.loose&&i.includePrerelease===!!s.includePrerelease)return i;i=i.version}else if(typeof i!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);if(i.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",i,s),this.options=s,this.loose=!!s.loose,this.includePrerelease=!!s.includePrerelease;const l=i.trim().match(s.loose?n[a.LOOSE]:n[a.FULL]);if(!l)throw new TypeError(`Invalid Version: ${i}`);if(this.raw=i,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(f=>{if(/^[0-9]+$/.test(f)){const d=+f;if(d>=0&&d<r)return d}return f}):this.prerelease=[],this.build=l[5]?l[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(i){if(e("SemVer.compare",this.version,this.options,i),!(i instanceof h)){if(typeof i=="string"&&i===this.version)return 0;i=new h(i,this.options)}return i.version===this.version?0:this.compareMain(i)||this.comparePre(i)}compareMain(i){return i instanceof h||(i=new h(i,this.options)),c(this.major,i.major)||c(this.minor,i.minor)||c(this.patch,i.patch)}comparePre(i){if(i instanceof h||(i=new h(i,this.options)),this.prerelease.length&&!i.prerelease.length)return-1;if(!this.prerelease.length&&i.prerelease.length)return 1;if(!this.prerelease.length&&!i.prerelease.length)return 0;let s=0;do{const l=this.prerelease[s],f=i.prerelease[s];if(e("prerelease compare",s,l,f),l===void 0&&f===void 0)return 0;if(f===void 0)return 1;if(l===void 0)return-1;if(l===f)continue;return c(l,f)}while(++s)}compareBuild(i){i instanceof h||(i=new h(i,this.options));let s=0;do{const l=this.build[s],f=i.build[s];if(e("build compare",s,l,f),l===void 0&&f===void 0)return 0;if(f===void 0)return 1;if(l===void 0)return-1;if(l===f)continue;return c(l,f)}while(++s)}inc(i,s,l){if(i.startsWith("pre")){if(!s&&l===!1)throw new Error("invalid increment argument: identifier is empty");if(s){const f=`-${s}`.match(this.options.loose?n[a.PRERELEASELOOSE]:n[a.PRERELEASE]);if(!f||f[1]!==s)throw new Error(`invalid identifier: ${s}`)}}switch(i){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",s,l);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",s,l);break;case"prepatch":this.prerelease.length=0,this.inc("patch",s,l),this.inc("pre",s,l);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",s,l),this.inc("pre",s,l);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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":{const f=Number(l)?1:0;if(this.prerelease.length===0)this.prerelease=[f];else{let d=this.prerelease.length;for(;--d>=0;)typeof this.prerelease[d]=="number"&&(this.prerelease[d]++,d=-2);if(d===-1){if(s===this.prerelease.join(".")&&l===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(f)}}if(s){let d=[s,f];l===!1&&(d=[s]),c(this.prerelease[0],s)===0?isNaN(this.prerelease[1])&&(this.prerelease=d):this.prerelease=d}break}default:throw new Error(`invalid increment argument: ${i}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ne=h,Ne}var Le,Ht;function X(){if(Ht)return Le;Ht=1;const e=j();return Le=(r,n,a=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(u){if(!a)return null;throw u}},Le}var Te,Yt;function _n(){if(Yt)return Te;Yt=1;const e=X();return Te=(r,n)=>{const a=e(r,n);return a?a.version:null},Te}var Ae,Kt;function jn(){if(Kt)return Ae;Kt=1;const e=X();return Ae=(r,n)=>{const a=e(r.trim().replace(/^[=v]+/,""),n);return a?a.version:null},Ae}var Be,Zt;function Gn(){if(Zt)return Be;Zt=1;const e=j();return Be=(r,n,a,u,c)=>{typeof a=="string"&&(c=u,u=a,a=void 0);try{return new e(r instanceof e?r.version:r,a).inc(n,u,c).version}catch{return null}},Be}var Fe,Qt;function zn(){if(Qt)return Fe;Qt=1;const e=X();return Fe=(r,n)=>{const a=e(r,null,!0),u=e(n,null,!0),c=a.compare(u);if(c===0)return null;const h=c>0,o=h?a:u,i=h?u:a,s=!!o.prerelease.length;if(!!i.prerelease.length&&!s){if(!i.patch&&!i.minor)return"major";if(i.compareMain(o)===0)return i.minor&&!i.patch?"minor":"patch"}const f=s?"pre":"";return a.major!==u.major?f+"major":a.minor!==u.minor?f+"minor":a.patch!==u.patch?f+"patch":"prerelease"},Fe}var be,er;function Mn(){if(er)return be;er=1;const e=j();return be=(r,n)=>new e(r,n).major,be}var qe,tr;function Un(){if(tr)return qe;tr=1;const e=j();return qe=(r,n)=>new e(r,n).minor,qe}var De,rr;function Vn(){if(rr)return De;rr=1;const e=j();return De=(r,n)=>new e(r,n).patch,De}var xe,nr;function Xn(){if(nr)return xe;nr=1;const e=X();return xe=(r,n)=>{const a=e(r,n);return a&&a.prerelease.length?a.prerelease:null},xe}var _e,sr;function G(){if(sr)return _e;sr=1;const e=j();return _e=(r,n,a)=>new e(r,a).compare(new e(n,a)),_e}var je,ir;function Jn(){if(ir)return je;ir=1;const e=G();return je=(r,n,a)=>e(n,r,a),je}var Ge,ar;function Wn(){if(ar)return Ge;ar=1;const e=G();return Ge=(r,n)=>e(r,n,!0),Ge}var ze,or;function At(){if(or)return ze;or=1;const e=j();return ze=(r,n,a)=>{const u=new e(r,a),c=new e(n,a);return u.compare(c)||u.compareBuild(c)},ze}var Me,cr;function Hn(){if(cr)return Me;cr=1;const e=At();return Me=(r,n)=>r.sort((a,u)=>e(a,u,n)),Me}var Ue,lr;function Yn(){if(lr)return Ue;lr=1;const e=At();return Ue=(r,n)=>r.sort((a,u)=>e(u,a,n)),Ue}var Ve,ur;function ge(){if(ur)return Ve;ur=1;const e=G();return Ve=(r,n,a)=>e(r,n,a)>0,Ve}var Xe,fr;function Bt(){if(fr)return Xe;fr=1;const e=G();return Xe=(r,n,a)=>e(r,n,a)<0,Xe}var Je,hr;function Zr(){if(hr)return Je;hr=1;const e=G();return Je=(r,n,a)=>e(r,n,a)===0,Je}var We,pr;function Qr(){if(pr)return We;pr=1;const e=G();return We=(r,n,a)=>e(r,n,a)!==0,We}var He,dr;function Ft(){if(dr)return He;dr=1;const e=G();return He=(r,n,a)=>e(r,n,a)>=0,He}var Ye,gr;function bt(){if(gr)return Ye;gr=1;const e=G();return Ye=(r,n,a)=>e(r,n,a)<=0,Ye}var Ke,mr;function en(){if(mr)return Ke;mr=1;const e=Zr(),t=Qr(),r=ge(),n=Ft(),a=Bt(),u=bt();return Ke=(h,o,i,s)=>{switch(o){case"===":return typeof h=="object"&&(h=h.version),typeof i=="object"&&(i=i.version),h===i;case"!==":return typeof h=="object"&&(h=h.version),typeof i=="object"&&(i=i.version),h!==i;case"":case"=":case"==":return e(h,i,s);case"!=":return t(h,i,s);case">":return r(h,i,s);case">=":return n(h,i,s);case"<":return a(h,i,s);case"<=":return u(h,i,s);default:throw new TypeError(`Invalid operator: ${o}`)}},Ke}var Ze,Er;function Kn(){if(Er)return Ze;Er=1;const e=j(),t=X(),{safeRe:r,t:n}=ee();return Ze=(u,c)=>{if(u instanceof e)return u;if(typeof u=="number"&&(u=String(u)),typeof u!="string")return null;c=c||{};let h=null;if(!c.rtl)h=u.match(c.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const d=c.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let k;for(;(k=d.exec(u))&&(!h||h.index+h[0].length!==u.length);)(!h||k.index+k[0].length!==h.index+h[0].length)&&(h=k),d.lastIndex=k.index+k[1].length+k[2].length;d.lastIndex=-1}if(h===null)return null;const o=h[2],i=h[3]||"0",s=h[4]||"0",l=c.includePrerelease&&h[5]?`-${h[5]}`:"",f=c.includePrerelease&&h[6]?`+${h[6]}`:"";return t(`${o}.${i}.${s}${l}${f}`,c)},Ze}var Qe,vr;function Zn(){if(vr)return Qe;vr=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const u=this.map.keys().next().value;this.delete(u)}this.map.set(r,n)}return this}}return Qe=e,Qe}var et,$r;function z(){if($r)return et;$r=1;const e=/\s+/g;class t{constructor(m,P){if(P=a(P),m instanceof t)return m.loose===!!P.loose&&m.includePrerelease===!!P.includePrerelease?m:new t(m.raw,P);if(m instanceof u)return this.raw=m.value,this.set=[[m]],this.formatted=void 0,this;if(this.options=P,this.loose=!!P.loose,this.includePrerelease=!!P.includePrerelease,this.raw=m.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(y=>!p(y[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const y of this.set)if(y.length===1&&v(y[0])){this.set=[y];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let m=0;m<this.set.length;m++){m>0&&(this.formatted+="||");const P=this.set[m];for(let R=0;R<P.length;R++)R>0&&(this.formatted+=" "),this.formatted+=P[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(m){const R=((this.options.includePrerelease&&d)|(this.options.loose&&k))+":"+m,y=n.get(R);if(y)return y;const w=this.options.loose,C=w?o[i.HYPHENRANGELOOSE]:o[i.HYPHENRANGE];m=m.replace(C,Pe(this.options.includePrerelease)),c("hyphen replace",m),m=m.replace(o[i.COMPARATORTRIM],s),c("comparator trim",m),m=m.replace(o[i.TILDETRIM],l),c("tilde trim",m),m=m.replace(o[i.CARETTRIM],f),c("caret trim",m);let T=m.split(" ").map(q=>I(q,this.options)).join(" ").split(/\s+/).map(q=>ke(q,this.options));w&&(T=T.filter(q=>(c("loose invalid filter",q,this.options),!!q.match(o[i.COMPARATORLOOSE])))),c("range list",T);const N=new Map,B=T.map(q=>new u(q,this.options));for(const q of B){if(p(q))return[q];N.set(q.value,q)}N.size>1&&N.has("")&&N.delete("");const _=[...N.values()];return n.set(R,_),_}intersects(m,P){if(!(m instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>$(R,P)&&m.set.some(y=>$(y,P)&&R.every(w=>y.every(C=>w.intersects(C,P)))))}test(m){if(!m)return!1;if(typeof m=="string")try{m=new h(m,this.options)}catch{return!1}for(let P=0;P<this.set.length;P++)if(ye(this.set[P],m,this.options))return!0;return!1}}et=t;const r=Zn(),n=new r,a=Tt(),u=me(),c=de(),h=j(),{safeRe:o,t:i,comparatorTrimReplace:s,tildeTrimReplace:l,caretTrimReplace:f}=ee(),{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:k}=pe(),p=E=>E.value==="<0.0.0-0",v=E=>E.value==="",$=(E,m)=>{let P=!0;const R=E.slice();let y=R.pop();for(;P&&R.length;)P=R.every(w=>y.intersects(w,m)),y=R.pop();return P},I=(E,m)=>(c("comp",E,m),E=A(E,m),c("caret",E),E=F(E,m),c("tildes",E),E=O(E,m),c("xrange",E),E=we(E,m),c("stars",E),E),S=E=>!E||E.toLowerCase()==="x"||E==="*",F=(E,m)=>E.trim().split(/\s+/).map(P=>b(P,m)).join(" "),b=(E,m)=>{const P=m.loose?o[i.TILDELOOSE]:o[i.TILDE];return E.replace(P,(R,y,w,C,T)=>{c("tilde",E,R,y,w,C,T);let N;return S(y)?N="":S(w)?N=`>=${y}.0.0 <${+y+1}.0.0-0`:S(C)?N=`>=${y}.${w}.0 <${y}.${+w+1}.0-0`:T?(c("replaceTilde pr",T),N=`>=${y}.${w}.${C}-${T} <${y}.${+w+1}.0-0`):N=`>=${y}.${w}.${C} <${y}.${+w+1}.0-0`,c("tilde return",N),N})},A=(E,m)=>E.trim().split(/\s+/).map(P=>D(P,m)).join(" "),D=(E,m)=>{c("caret",E,m);const P=m.loose?o[i.CARETLOOSE]:o[i.CARET],R=m.includePrerelease?"-0":"";return E.replace(P,(y,w,C,T,N)=>{c("caret",E,y,w,C,T,N);let B;return S(w)?B="":S(C)?B=`>=${w}.0.0${R} <${+w+1}.0.0-0`:S(T)?w==="0"?B=`>=${w}.${C}.0${R} <${w}.${+C+1}.0-0`:B=`>=${w}.${C}.0${R} <${+w+1}.0.0-0`:N?(c("replaceCaret pr",N),w==="0"?C==="0"?B=`>=${w}.${C}.${T}-${N} <${w}.${C}.${+T+1}-0`:B=`>=${w}.${C}.${T}-${N} <${w}.${+C+1}.0-0`:B=`>=${w}.${C}.${T}-${N} <${+w+1}.0.0-0`):(c("no pr"),w==="0"?C==="0"?B=`>=${w}.${C}.${T}${R} <${w}.${C}.${+T+1}-0`:B=`>=${w}.${C}.${T}${R} <${w}.${+C+1}.0-0`:B=`>=${w}.${C}.${T} <${+w+1}.0.0-0`),c("caret return",B),B})},O=(E,m)=>(c("replaceXRanges",E,m),E.split(/\s+/).map(P=>W(P,m)).join(" ")),W=(E,m)=>{E=E.trim();const P=m.loose?o[i.XRANGELOOSE]:o[i.XRANGE];return E.replace(P,(R,y,w,C,T,N)=>{c("xRange",E,R,y,w,C,T,N);const B=S(w),_=B||S(C),q=_||S(T),H=q;return y==="="&&H&&(y=""),N=m.includePrerelease?"-0":"",B?y===">"||y==="<"?R="<0.0.0-0":R="*":y&&H?(_&&(C=0),T=0,y===">"?(y=">=",_?(w=+w+1,C=0,T=0):(C=+C+1,T=0)):y==="<="&&(y="<",_?w=+w+1:C=+C+1),y==="<"&&(N="-0"),R=`${y+w}.${C}.${T}${N}`):_?R=`>=${w}.0.0${N} <${+w+1}.0.0-0`:q&&(R=`>=${w}.${C}.0${N} <${w}.${+C+1}.0-0`),c("xRange return",R),R})},we=(E,m)=>(c("replaceStars",E,m),E.trim().replace(o[i.STAR],"")),ke=(E,m)=>(c("replaceGTE0",E,m),E.trim().replace(o[m.includePrerelease?i.GTE0PRE:i.GTE0],"")),Pe=E=>(m,P,R,y,w,C,T,N,B,_,q,H)=>(S(R)?P="":S(y)?P=`>=${R}.0.0${E?"-0":""}`:S(w)?P=`>=${R}.${y}.0${E?"-0":""}`:C?P=`>=${P}`:P=`>=${P}${E?"-0":""}`,S(B)?N="":S(_)?N=`<${+B+1}.0.0-0`:S(q)?N=`<${B}.${+_+1}.0-0`:H?N=`<=${B}.${_}.${q}-${H}`:E?N=`<${B}.${_}.${+q+1}-0`:N=`<=${N}`,`${P} ${N}`.trim()),ye=(E,m,P)=>{for(let R=0;R<E.length;R++)if(!E[R].test(m))return!1;if(m.prerelease.length&&!P.includePrerelease){for(let R=0;R<E.length;R++)if(c(E[R].semver),E[R].semver!==u.ANY&&E[R].semver.prerelease.length>0){const y=E[R].semver;if(y.major===m.major&&y.minor===m.minor&&y.patch===m.patch)return!0}return!1}return!0};return et}var tt,Rr;function me(){if(Rr)return tt;Rr=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(s,l){if(l=r(l),s instanceof t){if(s.loose===!!l.loose)return s;s=s.value}s=s.trim().split(/\s+/).join(" "),c("comparator",s,l),this.options=l,this.loose=!!l.loose,this.parse(s),this.semver===e?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(s){const l=this.options.loose?n[a.COMPARATORLOOSE]:n[a.COMPARATOR],f=s.match(l);if(!f)throw new TypeError(`Invalid comparator: ${s}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new h(f[2],this.options.loose):this.semver=e}toString(){return this.value}test(s){if(c("Comparator.test",s,this.options.loose),this.semver===e||s===e)return!0;if(typeof s=="string")try{s=new h(s,this.options)}catch{return!1}return u(s,this.operator,this.semver,this.options)}intersects(s,l){if(!(s instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new o(s.value,l).test(this.value):s.operator===""?s.value===""?!0:new o(this.value,l).test(s.semver):(l=r(l),l.includePrerelease&&(this.value==="<0.0.0-0"||s.value==="<0.0.0-0")||!l.includePrerelease&&(this.value.startsWith("<0.0.0")||s.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&s.operator.startsWith(">")||this.operator.startsWith("<")&&s.operator.startsWith("<")||this.semver.version===s.semver.version&&this.operator.includes("=")&&s.operator.includes("=")||u(this.semver,"<",s.semver,l)&&this.operator.startsWith(">")&&s.operator.startsWith("<")||u(this.semver,">",s.semver,l)&&this.operator.startsWith("<")&&s.operator.startsWith(">")))}}tt=t;const r=Tt(),{safeRe:n,t:a}=ee(),u=en(),c=de(),h=j(),o=z();return tt}var rt,wr;function Ee(){if(wr)return rt;wr=1;const e=z();return rt=(r,n,a)=>{try{n=new e(n,a)}catch{return!1}return n.test(r)},rt}var nt,kr;function Qn(){if(kr)return nt;kr=1;const e=z();return nt=(r,n)=>new e(r,n).set.map(a=>a.map(u=>u.value).join(" ").trim().split(" ")),nt}var st,Pr;function es(){if(Pr)return st;Pr=1;const e=j(),t=z();return st=(n,a,u)=>{let c=null,h=null,o=null;try{o=new t(a,u)}catch{return null}return n.forEach(i=>{o.test(i)&&(!c||h.compare(i)===-1)&&(c=i,h=new e(c,u))}),c},st}var it,yr;function ts(){if(yr)return it;yr=1;const e=j(),t=z();return it=(n,a,u)=>{let c=null,h=null,o=null;try{o=new t(a,u)}catch{return null}return n.forEach(i=>{o.test(i)&&(!c||h.compare(i)===1)&&(c=i,h=new e(c,u))}),c},it}var at,Sr;function rs(){if(Sr)return at;Sr=1;const e=j(),t=z(),r=ge();return at=(a,u)=>{a=new t(a,u);let c=new e("0.0.0");if(a.test(c)||(c=new e("0.0.0-0"),a.test(c)))return c;c=null;for(let h=0;h<a.set.length;++h){const o=a.set[h];let i=null;o.forEach(s=>{const l=new e(s.semver.version);switch(s.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!i||r(l,i))&&(i=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!c||r(c,i))&&(c=i)}return c&&a.test(c)?c:null},at}var ot,Cr;function ns(){if(Cr)return ot;Cr=1;const e=z();return ot=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},ot}var ct,Or;function qt(){if(Or)return ct;Or=1;const e=j(),t=me(),{ANY:r}=t,n=z(),a=Ee(),u=ge(),c=Bt(),h=bt(),o=Ft();return ct=(s,l,f,d)=>{s=new e(s,d),l=new n(l,d);let k,p,v,$,I;switch(f){case">":k=u,p=h,v=c,$=">",I=">=";break;case"<":k=c,p=o,v=u,$="<",I="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(s,l,d))return!1;for(let S=0;S<l.set.length;++S){const F=l.set[S];let b=null,A=null;if(F.forEach(D=>{D.semver===r&&(D=new t(">=0.0.0")),b=b||D,A=A||D,k(D.semver,b.semver,d)?b=D:v(D.semver,A.semver,d)&&(A=D)}),b.operator===$||b.operator===I||(!A.operator||A.operator===$)&&p(s,A.semver))return!1;if(A.operator===I&&v(s,A.semver))return!1}return!0},ct}var lt,Ir;function ss(){if(Ir)return lt;Ir=1;const e=qt();return lt=(r,n,a)=>e(r,n,">",a),lt}var ut,Nr;function is(){if(Nr)return ut;Nr=1;const e=qt();return ut=(r,n,a)=>e(r,n,"<",a),ut}var ft,Lr;function as(){if(Lr)return ft;Lr=1;const e=z();return ft=(r,n,a)=>(r=new e(r,a),n=new e(n,a),r.intersects(n,a)),ft}var ht,Tr;function os(){if(Tr)return ht;Tr=1;const e=Ee(),t=G();return ht=(r,n,a)=>{const u=[];let c=null,h=null;const o=r.sort((f,d)=>t(f,d,a));for(const f of o)e(f,n,a)?(h=f,c||(c=f)):(h&&u.push([c,h]),h=null,c=null);c&&u.push([c,null]);const i=[];for(const[f,d]of u)f===d?i.push(f):!d&&f===o[0]?i.push("*"):d?f===o[0]?i.push(`<=${d}`):i.push(`${f} - ${d}`):i.push(`>=${f}`);const s=i.join(" || "),l=typeof n.raw=="string"?n.raw:String(n);return s.length<l.length?s:n},ht}var pt,Ar;function cs(){if(Ar)return pt;Ar=1;const e=z(),t=me(),{ANY:r}=t,n=Ee(),a=G(),u=(l,f,d={})=>{if(l===f)return!0;l=new e(l,d),f=new e(f,d);let k=!1;e:for(const p of l.set){for(const v of f.set){const $=o(p,v,d);if(k=k||$!==null,$)continue e}if(k)return!1}return!0},c=[new t(">=0.0.0-0")],h=[new t(">=0.0.0")],o=(l,f,d)=>{if(l===f)return!0;if(l.length===1&&l[0].semver===r){if(f.length===1&&f[0].semver===r)return!0;d.includePrerelease?l=c:l=h}if(f.length===1&&f[0].semver===r){if(d.includePrerelease)return!0;f=h}const k=new Set;let p,v;for(const O of l)O.operator===">"||O.operator===">="?p=i(p,O,d):O.operator==="<"||O.operator==="<="?v=s(v,O,d):k.add(O.semver);if(k.size>1)return null;let $;if(p&&v){if($=a(p.semver,v.semver,d),$>0)return null;if($===0&&(p.operator!==">="||v.operator!=="<="))return null}for(const O of k){if(p&&!n(O,String(p),d)||v&&!n(O,String(v),d))return null;for(const W of f)if(!n(O,String(W),d))return!1;return!0}let I,S,F,b,A=v&&!d.includePrerelease&&v.semver.prerelease.length?v.semver:!1,D=p&&!d.includePrerelease&&p.semver.prerelease.length?p.semver:!1;A&&A.prerelease.length===1&&v.operator==="<"&&A.prerelease[0]===0&&(A=!1);for(const O of f){if(b=b||O.operator===">"||O.operator===">=",F=F||O.operator==="<"||O.operator==="<=",p){if(D&&O.semver.prerelease&&O.semver.prerelease.length&&O.semver.major===D.major&&O.semver.minor===D.minor&&O.semver.patch===D.patch&&(D=!1),O.operator===">"||O.operator===">="){if(I=i(p,O,d),I===O&&I!==p)return!1}else if(p.operator===">="&&!n(p.semver,String(O),d))return!1}if(v){if(A&&O.semver.prerelease&&O.semver.prerelease.length&&O.semver.major===A.major&&O.semver.minor===A.minor&&O.semver.patch===A.patch&&(A=!1),O.operator==="<"||O.operator==="<="){if(S=s(v,O,d),S===O&&S!==v)return!1}else if(v.operator==="<="&&!n(v.semver,String(O),d))return!1}if(!O.operator&&(v||p)&&$!==0)return!1}return!(p&&F&&!v&&$!==0||v&&b&&!p&&$!==0||D||A)},i=(l,f,d)=>{if(!l)return f;const k=a(l.semver,f.semver,d);return k>0?l:k<0||f.operator===">"&&l.operator===">="?f:l},s=(l,f,d)=>{if(!l)return f;const k=a(l.semver,f.semver,d);return k<0?l:k>0||f.operator==="<"&&l.operator==="<="?f:l};return pt=u,pt}var dt,Br;function ls(){if(Br)return dt;Br=1;const e=ee(),t=pe(),r=j(),n=Kr(),a=X(),u=_n(),c=jn(),h=Gn(),o=zn(),i=Mn(),s=Un(),l=Vn(),f=Xn(),d=G(),k=Jn(),p=Wn(),v=At(),$=Hn(),I=Yn(),S=ge(),F=Bt(),b=Zr(),A=Qr(),D=Ft(),O=bt(),W=en(),we=Kn(),ke=me(),Pe=z(),ye=Ee(),E=Qn(),m=es(),P=ts(),R=rs(),y=ns(),w=qt(),C=ss(),T=is(),N=as(),B=os(),_=cs();return dt={parse:a,valid:u,clean:c,inc:h,diff:o,major:i,minor:s,patch:l,prerelease:f,compare:d,rcompare:k,compareLoose:p,compareBuild:v,sort:$,rsort:I,gt:S,lt:F,eq:b,neq:A,gte:D,lte:O,cmp:W,coerce:we,Comparator:ke,Range:Pe,satisfies:ye,toComparators:E,maxSatisfying:m,minSatisfying:P,minVersion:R,validRange:y,outside:w,gtr:C,ltr:T,intersects:N,simplifyRange:B,subset:_,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},dt}var tn=ls();const rn=xn(tn),Rt="_updates_v2/per_package_version/";function us(e,t){return`${Rt}${e.organization}/${e.name}/${e.version}/${t}`}const fs=/(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<name>[^\/]+))\/(?<version>[^\/]+)\/(?<seed>[^\/]+)$/,gt="_updates_v2/_global_update_in",Fr="_updates_v2/_global_update_out",J="v2/",nn="overview.json",sn="overview.json",Z="manifest.json",le="channels",ne=/^[-a-z0-9]+$/;function Dt(e){return`${e.organization}/${e.name}/${e.version}`}function K(e){return`${J}${Dt(e)}`}const an="/"+Z,on=L.z.object({description:g.BlockPackDescriptionManifest,channels:L.z.array(L.z.string()).default(()=>[]),manifestSha256:g.Sha256Schema}),wt=L.z.object({schema:L.z.literal("v2"),versions:L.z.array(on)});function cn(e){return`${e.organization}/${e.name}/${sn}`}function kt(e){return`${J}${cn(e)}`}function ln(e){return`${Dt(e)}/${le}/`}function un(e){return`${J}${ln(e)}`}const fn=/(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<name>[^\/]+))\/(?<version>[^\/]+)\/manifest\.json$/,se=`${J}${nn}`;function xt(e){const t=L.z.object({id:g.BlockPackIdNoVersion,allVersions:L.z.array(L.z.string()).optional(),allVersionsWithChannels:L.z.array(g.VersionWithChannels).optional(),latest:e,latestManifestSha256:g.Sha256Schema,latestByChannel:L.z.record(L.z.string(),L.z.object({description:e,manifestSha256:g.Sha256Schema})).default({})});return t.transform(r=>r.allVersionsWithChannels?r:{...r,allVersionsWithChannels:r.allVersions.map(n=>({version:n,channels:[]}))}).transform(r=>r.latestByChannel[g.AnyChannel]?r:{...r,latestByChannel:{...r.latestByChannel,[g.AnyChannel]:{description:r.latest,manifestSha256:r.latestManifestSha256}}}).pipe(t.required({allVersionsWithChannels:!0}))}const hs=xt(g.BlockPackDescriptionManifest);function ve(e){return L.z.object({schema:L.z.literal("v2"),packages:L.z.array(xt(e))})}const Pt=ve(g.BlockPackDescriptionManifest);function ps(e){return g.CreateBlockPackDescriptionSchema(g.BlockComponentsManifest,g.BlockPackMeta(g.ContentRelativeText.transform(he(e)),g.ContentRelativeBinary.transform(Q(e))))}function ds(e){return ve(g.CreateBlockPackDescriptionSchema(g.BlockComponentsManifest,g.BlockPackMeta(g.ContentRelativeText.transform(he(e)),g.ContentRelativeBinary.transform(Q(e)))))}function gs(e){return ve(g.CreateBlockPackDescriptionSchema(g.BlockComponentsManifest,g.BlockPackMeta(g.ContentRelativeText.transform(he(e)),g.ContentRelativeBinary.transform(Q(e)))))}class ms{constructor(t,r=new Ct.ConsoleLoggerAdapter){this.storage=t,this.logger=r}async updateRegistry(t="normal"){this.logger.info("Initiating registry refresh...");const r=new Map,n=[],a=await this.storage.listFiles(Rt),u=({organization:i,name:s,version:l})=>{const f=`${i}:${s}`;let d=r.get(f);if(d){if(!d.versions.has(l))return d.versions.add(l),!0}else return r.set(f,{package:{organization:i,name:s},versions:new Set([l])}),!0;return!1};this.logger.info("Packages to be updated:");for(const i of a){const s=i.match(fs);if(!s)continue;n.push(i);const{organization:l,name:f,version:d,seed:k}=s.groups,p=u({organization:l,name:f,version:d});this.logger.info(` - ${l}:${f}:${d} added:${p}`)}if(t==="force"){const i=await this.storage.listFiles(J);for(const s of i){const l=s.match(fn);if(!l)continue;const{organization:f,name:d,version:k}=l.groups,p=u({organization:f,name:d,version:k});this.logger.info(` - ${f}:${d}:${k} force_added:${p}`)}}const c=await this.storage.getFile(se);let o=(c===void 0?{packages:[]}:Pt.parse(JSON.parse(c.toString()))).packages;this.logger.info(`Global overview loaded, ${o.length} records`);for(const[,i]of r.entries()){const s=kt(i.package),l=await this.storage.getFile(s),f=l===void 0?{versions:[]}:wt.parse(JSON.parse(l.toString()));this.logger.info(`Updating ${i.package.organization}:${i.package.name} overview, ${f.versions.length} records`);const d=f.versions.filter(v=>!i.versions.has(v.description.id.version));for(const[v]of i.versions.entries()){const $=v.toString(),I={...i.package,version:$},S=await this.storage.getFile(K(I)+an);if(!S)continue;const F=await oe(S),b=(await this.storage.listFiles(un(I))).filter(A=>A.match(ne)?!0:(this.logger.warn(`Unexpected channel in ${g.blockPackIdToString(I)}: ${A}`),!1));d.push({description:$t($).parse(g.BlockPackManifest.parse(JSON.parse(S.toString("utf8"))).description),manifestSha256:F,channels:b})}d.sort((v,$)=>tn.compare($.description.id.version,v.description.id.version)),t!=="dry-run"&&await this.storage.putFile(s,Buffer.from(JSON.stringify({schema:"v2",versions:d}))),this.logger.info(`Done (${d.length} records)`);const k=new Set;for(const v of d)for(const $ of v.channels)k.add($);o=o.filter(v=>v.id.organization!==i.package.organization||v.id.name!==i.package.name);const p=$t(`${i.package.organization}/${i.package.name}`);o.push({id:{organization:i.package.organization,name:i.package.name},allVersions:d.map(v=>v.description.id.version).reverse(),allVersionsWithChannels:d.map(v=>({version:v.description.id.version,channels:v.channels})).reverse(),latest:p.parse(d[0].description),latestManifestSha256:d[0].manifestSha256,latestByChannel:Object.fromEntries([...k,g.AnyChannel].map(v=>{const $=d.find(I=>v===g.AnyChannel||I.channels.indexOf(v)!==-1);if(!$)throw new Error("Assertion error");return[v,{description:p.parse($.description),manifestSha256:$==null?void 0:$.manifestSha256}]}))})}t!=="dry-run"&&await this.storage.putFile(se,Buffer.from(JSON.stringify({schema:"v2",packages:o}))),this.logger.info(`Global overview updated (${o.length} records)`),t!=="dry-run"&&await this.storage.deleteFiles(...n.map(i=>`${Rt}${i}`)),this.logger.info("Version update requests cleared")}async updateIfNeeded(t="normal"){this.logger.info("Checking if registry requires refresh...");const r=await this.storage.getFile(gt),n=await this.storage.getFile(Fr);if(t!=="force"&&r===void 0&&n===void 0){this.logger.info("No global seed files found, update not needed.");return}if(t!=="force"&&r!==void 0&&n!==void 0&&r.equals(n)){this.logger.info("Registry is up to date.");return}await this.updateRegistry(t),r&&(t!=="dry-run"&&await this.storage.putFile(Fr,r),this.logger.info("Refresh finished."))}async getPackageOverview(t){const r=await this.storage.getFile(kt(t));if(r!==void 0)return wt.parse(JSON.parse(r.toString()))}async getGlobalOverview(){const t=await this.storage.getFile(se);if(t!==void 0)return Pt.parse(JSON.parse(t.toString()))}async marchChanged(t){const r=Dr.randomUUID(),n=us(t,r);this.logger.info(`Creating update seed at ${n} ...`),await this.storage.putFile(n,Buffer.from(r)),this.logger.info(`Touching global update seed ${gt} ...`),await this.storage.putFile(gt,Buffer.from(r))}async addPackageToChannel(t,r){if(!r.match(ne))throw new Error(`Illegal characters in channel name: ${r}`);const n=K(t);if(await this.storage.getFile(`${n}/${Z}`)===void 0)throw new Error(`Package ${g.blockPackIdToString(t)} not found in the registry.`);await this.storage.putFile(`${n}/${le}/${r}`,Buffer.from(r)),await this.marchChanged(t)}async removePackageFromChannel(t,r){if(!r.match(ne))throw new Error(`Illegal characters in channel name: ${r}`);const n=K(t);if(await this.storage.getFile(`${n}/${Z}`)===void 0)throw new Error(`Package ${g.blockPackIdToString(t)} not found in the registry.`);await this.storage.deleteFiles(`${n}/${le}/${r}`),await this.marchChanged(t)}async publishPackage(t,r){const n=K(t.description.id);for(const u of t.files){const c=await r(u.name);if(c.length!==u.size)throw new Error(`Actual file size don't match file size from the manifest file for ${u.name} (actual = ${c.length}; manifest = ${u.size})`);const h=await oe(c);if(h!==u.sha256.toUpperCase())throw new Error(`Actual file SHA-256 don't match the checksum from the manifest file for ${u.name} (actual = ${h}; manifest = ${u.sha256.toUpperCase()})`);const o=n+"/"+u.name;this.logger.info(`Uploading ${u.name} -> ${o} ...`),await this.storage.putFile(o,c)}const a=n+"/"+Z;this.logger.info(`Uploading manifest to ${a} ...`),await this.storage.putFile(a,Buffer.from(JSON.stringify(t))),await this.marchChanged(t.description.id)}}class hn{constructor(t,r,n){this.client=t,this.bucket=r,this.root=n}async getFile(t){try{return Buffer.from(await(await this.client.getObject({Bucket:this.bucket,Key:M.join(this.root,t)})).Body.transformToByteArray())}catch(r){if(r.name==="NoSuchKey")return;throw r}}async listFiles(t){const r=M.join(this.root,t),n=xr.paginateListObjectsV2({client:this.client},{Bucket:this.bucket,Prefix:r}),a=[];for await(const u of n)a.push(...(u.Contents??[]).map(c=>M.relative(r,c.Key)));return a}async putFile(t,r){await this.client.putObject({Bucket:this.bucket,Key:M.join(this.root,t),Body:r})}async deleteFiles(...t){const r=await this.client.deleteObjects({Bucket:this.bucket,Delete:{Objects:t.map(n=>({Key:M.join(this.root,n)}))}});if(r.Errors!==void 0&&r.Errors.length>0)throw new Error(`Errors encountered while deleting files: ${r.Errors.join(`
|
|
2
|
+
`)}`)}}class pn{constructor(t){te(this,"root");this.root=x.resolve(t)}toAbsolutePath(t){if(M.isAbsolute(t))throw new Error("absolute path");return x.resolve(this.root,t.split(M.sep).join(x.sep))}async getFile(t){try{return await Y.promises.readFile(this.toAbsolutePath(t))}catch(r){if(r.code=="ENOENT")return;throw new Error("",{cause:r})}}async listFiles(t){try{const r=this.toAbsolutePath(t);return(await Y.promises.readdir(r,{recursive:!0,withFileTypes:!0})).filter(n=>n.isFile()).map(n=>x.relative(r,x.resolve(n.path,n.name)).split(x.sep).join(M.sep))}catch(r){if(r.code=="ENOENT")return[];throw new Error("",{cause:r})}}async putFile(t,r){const n=this.toAbsolutePath(t);await Y.promises.mkdir(x.dirname(n),{recursive:!0}),await Y.promises.writeFile(n,r)}async deleteFiles(...t){for(const r of t)await Y.promises.rm(this.toAbsolutePath(r))}}function dn(e){const t=new URL(e,`file:${x.resolve(".").split(x.sep).join(M.sep)}/`);switch(t.protocol){case"file:":const r=x.resolve(t.pathname);return new pn(r);case"s3:":const n={},a=t.searchParams.get("region");a&&(n.region=a);const u=t.hostname;return new hn(new xr.S3(n),u,t.pathname.replace(/^\//,""));default:throw new Error(`Unknown protocol: ${t.protocol}`)}}const Es=L.z.string().regex(/^(?:s3:|file:)/),gn=L.z.object({organization:L.z.string(),package:L.z.string(),version:g.SemVer.optional(),files:L.z.record(L.z.string().regex(/^[^\/]+$/),L.z.string()).default({}),meta:L.z.object({}).passthrough()}),mn=L.z.object({registries:L.z.record(L.z.string(),Es).default({}),registry:L.z.string().optional()}),_t=mn.merge(gn).required({registry:!0,version:!0}),$e=_t.partial().required({registries:!0,files:!0}),En="pl.package.json",vn="pl.package.yaml",Re="v1/";function vs(e){return`${Re}${e.organization}/${e.package}/${e.version}`}function jt(e,t){return`${Re}${e.organization}/${e.package}/${e.version}/${t}`}function yt(e){return`${Re}${e.organization}/${e.package}/overview.json`}const ie=`${Re}overview.json`,Gt="meta.json",St="_updates_v1/per_package_version/";function $s(e,t){return`${St}${e.organization}/${e.package}/${e.version}/${t}`}const Rs=/(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<pkg>[^\/]+))\/(?<version>[^\/]+)\/(?<seed>[^\/]+)$/,$n="_updates_v1/_global_update_in",br="_updates_v1/_global_update_out";class ws{constructor(t,r){this.storage=t,this.logger=r}constructNewPackage(t){return new ks(this.storage,t)}async updateRegistry(){var c,h,o,i,s,l,f,d;(c=this.logger)==null||c.info("Initiating registry refresh...");const t=new Map,r=[],n=await this.storage.listFiles(St);(h=this.logger)==null||h.info("Packages to be updated:");for(const k of n){const p=k.match(Rs);if(!p)continue;r.push(k);const{packageKeyWithoutVersion:v,organization:$,pkg:I,version:S,seed:F}=p.groups;let b=t.get(v);b?b.versions.has(S)||b.versions.add(S):t.set(v,{package:{organization:$,package:I},versions:new Set([S])}),(o=this.logger)==null||o.info(` - ${$}:${I}:${S}`)}const a=await this.storage.getFile(ie);let u=a===void 0?[]:JSON.parse(a.toString());(i=this.logger)==null||i.info(`Global overview loaded, ${u.length} records`);for(const[,k]of t.entries()){const p=yt(k.package),v=await this.storage.getFile(p);let $=v===void 0?[]:JSON.parse(v.toString());(s=this.logger)==null||s.info(`Updating ${k.package.organization}:${k.package.package} overview, ${$.length} records`),$=$.filter(I=>!k.versions.has(I.version));for(const[I]of k.versions.entries()){const S=I.toString(),F=await this.storage.getFile(jt({...k.package,version:S},Gt));F&&$.push({version:S,meta:JSON.parse(F.toString())})}$.sort((I,S)=>rn.compare(S.version,I.version)),await this.storage.putFile(p,Buffer.from(JSON.stringify($))),(l=this.logger)==null||l.info(`Done (${$.length} records)`),u=u.filter(I=>I.organization!==k.package.organization||I.package!==k.package.package),u.push({organization:k.package.organization,package:k.package.package,allVersions:$.map(I=>I.version).reverse(),latestVersion:$[0].version,latestMeta:$[0].meta})}await this.storage.putFile(ie,Buffer.from(JSON.stringify(u))),(f=this.logger)==null||f.info(`Global overview updated (${u.length} records)`),await this.storage.deleteFiles(...r.map(k=>`${St}${k}`)),(d=this.logger)==null||d.info("Version update requests cleared")}async updateIfNeeded(t=!1){var a,u;(a=this.logger)==null||a.info("Checking if registry requires refresh...");const r=await this.storage.getFile($n),n=await this.storage.getFile(br);!t&&r===void 0&&n===void 0||!t&&r!==void 0&&n!==void 0&&r.equals(n)||(await this.updateRegistry(),r&&(await this.storage.putFile(br,r),(u=this.logger)==null||u.info("Refresh finished")))}async getPackageOverview(t){const r=await this.storage.getFile(yt(t));if(r!==void 0)return JSON.parse(r.toString())}async getGlobalOverview(){const t=await this.storage.getFile(ie);if(t!==void 0)return JSON.parse(t.toString())}}class ks{constructor(t,r){te(this,"metaAdded",!1);te(this,"seed",Dr.randomUUID());this.storage=t,this.name=r}async addFile(t,r){await this.storage.putFile(jt(this.name,t),r)}async writeMeta(t){await this.addFile(Gt,Buffer.from(JSON.stringify(t))),this.metaAdded=!0}async finish(){if(!this.metaAdded)throw new Error("meta not added");await this.storage.putFile($s(this.name,this.seed),Buffer.of(0)),await this.storage.putFile($n,Buffer.from(this.seed))}}function V(e,t){return t===void 0?e:{...e,...t,registries:{...e.registries,...t.registries},files:{...e.files,...t.files}}}async function mt(e){return Nt(e,t=>$e.parse(JSON.parse(t.toString())))}async function Et(e){return Nt(e,t=>$e.parse(Sn.parse(t.toString())))}async function Ps(){let e=$e.parse({});return e=V(e,await mt("./.pl.reg.json")),e=V(e,await Et("./.pl.reg.yaml")),e=V(e,await mt(`${zt.homedir()}/.pl.reg.json`)),e=V(e,await Et(`${zt.homedir()}/.pl.reg.yaml`)),e=V(e,await mt(En)),e=V(e,await Et(vn)),e}class Rn{constructor(t){this.conf=t}createRegistry(t){let r=this.conf.registry;if(!r.startsWith("file:")&&!r.startsWith("s3:")){const n=this.conf.registries[r];if(!n)throw new Error(`Registry with alias "${r}" not found`);r=n}return new ws(dn(r),t)}get fullPackageName(){return{organization:this.conf.organization,package:this.conf.package,version:this.conf.version}}}async function ys(e){const t=await Ps();return new Rn(_t.parse(V(t,e)))}exports.BlockComponentsAbsoluteUrl=Bn;exports.BlockComponentsConsolidate=Wr;exports.BlockComponentsDescription=Jr;exports.BlockDescriptionPackageJsonField=ce;exports.BlockDescriptionToExplicitBinaryBytes=ps;exports.BlockPackDescriptionConsolidateToFolder=Hr;exports.BlockPackDescriptionManifestAddRelativePathPrefix=$t;exports.BlockPackMetaConsolidate=Xr;exports.BlockPackMetaDescription=Vr;exports.BlockPackMetaEmbedAbsoluteBase64=Ln;exports.BlockPackMetaEmbedAbsoluteBytes=Tn;exports.BlockPackMetaEmbedBytes=An;exports.BlockRegistryV2=ms;exports.ChannelNameRegexp=ne;exports.ChannelsFolder=le;exports.FSStorage=pn;exports.GlobalOverview=ve;exports.GlobalOverviewEntry=xt;exports.GlobalOverviewEntryReg=hs;exports.GlobalOverviewFileName=nn;exports.GlobalOverviewPath=ie;exports.GlobalOverviewPath$1=se;exports.GlobalOverviewReg=Pt;exports.GlobalOverviewToExplicitBinaryBase64=gs;exports.GlobalOverviewToExplicitBinaryBytes=ds;exports.MainPrefix=J;exports.ManifestFileName=Z;exports.ManifestSuffix=an;exports.MetaFile=Gt;exports.PackageManifestPattern=fn;exports.PackageOverview=wt;exports.PackageOverviewFileName=sn;exports.PackageOverviewVersionEntry=on;exports.PlPackageConfigData=gn;exports.PlPackageJsonConfigFile=En;exports.PlPackageYamlConfigFile=vn;exports.PlRegCommonConfigData=mn;exports.PlRegFullPackageConfigData=_t;exports.PlRegPackageConfig=Rn;exports.PlRegPackageConfigDataShard=$e;exports.ResolvedBlockPackDescriptionFromPackageJson=It;exports.ResolvedModuleFile=_r;exports.ResolvedModuleFolder=jr;exports.S3Storage=hn;exports.absoluteToBase64=Gr;exports.absoluteToBytes=zr;exports.absoluteToString=Ot;exports.buildBlockPackDist=Fn;exports.calculateSha256=oe;exports.cpAbsoluteToRelative=ae;exports.getConfig=ys;exports.loadPackDescription=Dn;exports.loadPackDescriptionRaw=Yr;exports.mapLocalToAbsolute=vt;exports.packFolderToRelativeTgz=Mr;exports.packageChannelPrefix=un;exports.packageChannelPrefixInsideV2=ln;exports.packageContentPrefix=vs;exports.packageContentPrefix$1=K;exports.packageContentPrefixInsideV2=Dt;exports.packageOverviewPath=yt;exports.packageOverviewPath$1=kt;exports.packageOverviewPathInsideV2=cn;exports.parsePackageName=Lt;exports.payloadFilePath=jt;exports.relativeToContentString=Ur;exports.relativeToExplicitBinary64=Nn;exports.relativeToExplicitBytes=Q;exports.relativeToExplicitString=he;exports.semver=rn;exports.storageByUrl=dn;exports.tryLoadPackDescription=qn;
|
|
3
|
+
//# sourceMappingURL=config-BJeRGQPb.js.map
|