@platforma-sdk/block-tools 2.5.81 → 2.5.82
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.js.map +1 -1
- package/dist/cli.mjs +61 -56
- package/dist/cli.mjs.map +1 -1
- package/dist/cmd/publish.d.ts +1 -0
- package/dist/cmd/publish.d.ts.map +1 -1
- package/dist/{config-DwOM2V6u.mjs → config-VnABe7ki.mjs} +489 -483
- package/dist/config-VnABe7ki.mjs.map +1 -0
- package/dist/config-t7F2nAAr.js +3 -0
- package/dist/config-t7F2nAAr.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +47 -45
- package/dist/v2/registry/registry.d.ts +1 -0
- package/dist/v2/registry/registry.d.ts.map +1 -1
- package/dist/v2/registry/schema_public.d.ts +2 -0
- package/dist/v2/registry/schema_public.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/cmd/publish.ts +12 -1
- package/src/v2/registry/registry.ts +16 -7
- package/src/v2/registry/schema_public.ts +2 -0
- package/dist/config-26zalc5o.js +0 -3
- package/dist/config-26zalc5o.js.map +0 -1
- package/dist/config-DwOM2V6u.mjs.map +0 -1
package/dist/config-26zalc5o.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";var wn=Object.defineProperty;var kn=(t,e,r)=>e in t?wn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var te=(t,e,r)=>kn(t,typeof e!="symbol"?e+"":e,r);const g=require("@milaboratories/pl-model-middle-layer"),L=require("zod"),x=require("node:path"),z=require("node:fs/promises"),Pn=require("mime-types"),yn=require("tar"),qr=require("@milaboratories/resolve-helper"),Ct=require("@milaboratories/ts-helpers"),Sn=require("@milaboratories/pl-model-common"),Dr=require("node:crypto"),Cn=require("yaml"),On=require("node:os"),U=require("node:path/posix"),xr=require("@aws-sdk/client-s3"),In=require("node:fs");function ue(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const fe=ue(Pn),Nn=ue(yn),Mt=ue(On),Y=ue(In);function _r(t){return L.z.string().transform((e,r)=>{const n=qr.tryResolve(t,e);return n===void 0?(r.addIssue({code:L.z.ZodIssueCode.custom,message:`Can't resolve ${e} against ${t}`}),L.z.NEVER):{type:"absolute-file",file:n}})}function Gr(t,...e){return L.z.string().transform((r,n)=>{const a=r.endsWith("/")?r:`${r}/`;for(const u of e){const c=qr.tryResolve(t,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 ${t}, no index file found (${e.join(", ")})`}),L.z.NEVER})}function vt(t){return e=>e.type==="relative"?{type:"absolute-file",file:x.resolve(t,e.path)}:e}function Ot(){return async t=>t.type==="absolute-file"?await z.readFile(t.file,{encoding:"utf-8"}):t.content}function jr(){return async t=>{if(t.type==="absolute-file"){const e=fe.lookup(t.file);if(!e)throw new Error(`Can't recognize mime type of the file: ${t.file}.`);return{type:"explicit-base64",mimeType:e,content:await z.readFile(t.file,{encoding:"base64"})}}else return t}}function Mr(){return async t=>{if(t.type==="absolute-file"){const e=fe.lookup(t.file);if(!e)throw new Error(`Can't recognize mime type of the file: ${t.file}.`);return{type:"explicit-bytes",mimeType:e,content:Buffer.from(await z.readFile(t.file))}}else return t.type==="explicit-base64"?{type:"explicit-bytes",mimeType:t.mimeType,content:Buffer.from(t.content,"base64")}:t}}function ae(t,e){return async r=>{if(r.type==="absolute-file"){const n=x.basename(r.file),a=x.resolve(t,n);return e==null||e.push(n),await z.cp(r.file,a),{type:"relative",path:n}}else return r}}function zr(t,e,r){if(!e.endsWith(".tgz"))throw new Error(`Unexpected tgz file name: ${e}`);return async n=>{const a=x.resolve(t,e);return await Nn.create({gzip:!0,file:a,cwd:n.folder},["."]),r==null||r.push(e),{type:"relative",path:e}}}function he(t){return async e=>e.type==="explicit-string"?e:{type:"explicit-string",content:(await t(e.path)).toString("utf8")}}function Ur(t){return async e=>e.type==="explicit-string"?e.content:(await t(e.path)).toString("utf8")}function Ln(t){return async e=>{if(e.type==="explicit-base64")return e;const r=fe.lookup(e.path);if(!r)throw new Error(`Can't recognize mime type of the file: ${e.path}.`);return{type:"explicit-base64",mimeType:r,content:(await t(e.path)).toString("base64")}}}function Q(t){return async e=>{if(e.type==="explicit-base64")return{type:"explicit-bytes",mimeType:e.mimeType,content:Buffer.from(e.content,"base64")};const r=fe.lookup(e.path);if(!r)throw new Error(`Can't recognize mime type of the file: ${e.path}.`);return{type:"explicit-bytes",mimeType:r,content:await t(e.path)}}}function Vr(t){return g.BlockPackMeta(g.DescriptionContentText.transform(vt(t)),g.DescriptionContentBinary.transform(vt(t)))}function Xr(t,e){return g.BlockPackMeta(g.ContentAbsoluteTextLocal.transform(ae(t,e)),g.ContentAbsoluteBinaryLocal.transform(ae(t,e)))}const Tn=g.BlockPackMeta(g.ContentAbsoluteTextLocal.transform(Ot()),g.ContentAbsoluteBinaryLocal.transform(jr())).pipe(g.BlockPackMetaEmbeddedBase64),An=g.BlockPackMeta(g.ContentAbsoluteTextLocal.transform(Ot()),g.ContentAbsoluteBinaryLocal.transform(Mr())).pipe(g.BlockPackMetaEmbeddedBytes);function Fn(t){return g.BlockPackMeta(g.ContentRelativeText.transform(Ur(t)),g.ContentRelativeBinary.transform(Q(t))).pipe(g.BlockPackMetaEmbeddedBytes)}function Jr(t){return g.BlockComponents(_r(t),Gr(t,"index.html"))}function Wr(t,e){return g.BlockComponents(g.ContentAbsoluteBinaryLocal.transform(ae(t,e)),g.ContentAbsoluteFolder.transform(zr(t,"ui.tgz",e))).pipe(g.BlockComponentsManifest)}function Bn(t){return g.BlockComponents(g.ContentRelative.transform(g.mapRemoteToAbsolute(t)),g.ContentRelative.transform(g.mapRemoteToAbsolute(t)))}function It(t){return g.CreateBlockPackDescriptionSchema(Jr(t),Vr(t)).transform(async(e,r)=>{const a=Sn.extractConfigGeneric(JSON.parse(await z.readFile(e.components.model.file,"utf-8"))).featureFlags;return{...e,featureFlags:a}})}function Hr(t,e){return g.CreateBlockPackDescriptionSchema(Wr(t,e),Xr(t,e)).pipe(g.BlockPackDescriptionManifest)}function $t(t){const e=g.addPrefixToRelative(t);return g.BlockPackDescriptionManifest.pipe(g.CreateBlockPackDescriptionSchema(g.BlockComponents(g.ContentRelative.transform(e),g.ContentRelative.transform(e)),g.BlockPackMeta(g.ContentRelativeText.transform(e),g.ContentRelativeBinary.transform(e)))).pipe(g.BlockPackDescriptionManifest)}async function Nt(t,e){try{return e(await z.readFile(t))}catch(r){if(r.code=="ENOENT")return;throw new Error("",{cause:r})}}async function oe(t){return Buffer.from(await crypto.subtle.digest("sha-256",t)).toString("hex").toUpperCase()}async function bn(t,e){await z.mkdir(e,{recursive:!0});const r=[],n=await Hr(e,r).parseAsync(t),a=await Promise.all(r.map(async c=>{const h=await z.readFile(x.resolve(e,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 z.writeFile(x.resolve(e,g.BlockPackManifestFile),JSON.stringify(u)),u}const ce="block",qn=/(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;function Lt(t){const e=t.match(qn);if(!e)throw new Error(`Malformed package name (${t}), can't infer organization and block pack name.`);const{name:r,organization:n}=e.groups;return{name:r,organization:n}}async function Dn(t,e){const r=x.resolve(t,"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(t).safeParseAsync(u);if(c.success)return c.data;e==null||e.warn(c.error);return}catch(n){e==null||e.warn(n);return}}async function Yr(t){const e=x.resolve(t,"package.json"),r=JSON.parse(await z.readFile(e,{encoding:"utf-8"})),n=r[ce];if(n===void 0)throw new Error(`Block description (field ${ce}) not found in ${e}.`);return{...g.BlockPackDescriptionFromPackageJsonRaw.parse(n),id:{...Lt(Ct.notEmpty(r.name,`"name" not found in ${e}`)),version:g.SemVer.parse(r.version)},featureFlags:{}}}async function xn(t){const e=await Yr(t);return await It(t).parseAsync(e)}function _n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var re={exports:{}},Se,zt;function pe(){if(zt)return Se;zt=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,a=e-6;return Se={MAX_LENGTH:e,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:t,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)?(...e)=>console.error("SEMVER",...e):()=>{}),Ce}var Vt;function ee(){return Vt||(Vt=1,function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=pe(),u=de();e=t.exports={};const c=e.re=[],h=e.safeRe=[],o=e.src=[],i=e.safeSrc=[],s=e.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($),B=l++;u(v,B,$),s[v]=B,o[B]=$,i[B]=S,c[B]=new RegExp($,I?"g":void 0),h[B]=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),e.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),e.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),e.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 t=Object.freeze({loose:!0}),e=Object.freeze({});return Oe=n=>n?typeof n!="object"?t:n:e,Oe}var Ie,Jt;function Kr(){if(Jt)return Ie;Jt=1;const t=/^[0-9]+$/,e=(n,a)=>{const u=t.test(n),c=t.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:e,rcompareIdentifiers:(n,a)=>e(a,n)},Ie}var Ne,Wt;function G(){if(Wt)return Ne;Wt=1;const t=de(),{MAX_LENGTH:e,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>e)throw new TypeError(`version is longer than ${e} characters`);t("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(t("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(t("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(t("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 t=G();return Le=(r,n,a=!1)=>{if(r instanceof t)return r;try{return new t(r,n)}catch(u){if(!a)return null;throw u}},Le}var Te,Yt;function Gn(){if(Yt)return Te;Yt=1;const t=X();return Te=(r,n)=>{const a=t(r,n);return a?a.version:null},Te}var Ae,Kt;function jn(){if(Kt)return Ae;Kt=1;const t=X();return Ae=(r,n)=>{const a=t(r.trim().replace(/^[=v]+/,""),n);return a?a.version:null},Ae}var Fe,Zt;function Mn(){if(Zt)return Fe;Zt=1;const t=G();return Fe=(r,n,a,u,c)=>{typeof a=="string"&&(c=u,u=a,a=void 0);try{return new t(r instanceof t?r.version:r,a).inc(n,u,c).version}catch{return null}},Fe}var Be,Qt;function zn(){if(Qt)return Be;Qt=1;const t=X();return Be=(r,n)=>{const a=t(r,null,!0),u=t(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"},Be}var be,er;function Un(){if(er)return be;er=1;const t=G();return be=(r,n)=>new t(r,n).major,be}var qe,tr;function Vn(){if(tr)return qe;tr=1;const t=G();return qe=(r,n)=>new t(r,n).minor,qe}var De,rr;function Xn(){if(rr)return De;rr=1;const t=G();return De=(r,n)=>new t(r,n).patch,De}var xe,nr;function Jn(){if(nr)return xe;nr=1;const t=X();return xe=(r,n)=>{const a=t(r,n);return a&&a.prerelease.length?a.prerelease:null},xe}var _e,sr;function j(){if(sr)return _e;sr=1;const t=G();return _e=(r,n,a)=>new t(r,a).compare(new t(n,a)),_e}var Ge,ir;function Wn(){if(ir)return Ge;ir=1;const t=j();return Ge=(r,n,a)=>t(n,r,a),Ge}var je,ar;function Hn(){if(ar)return je;ar=1;const t=j();return je=(r,n)=>t(r,n,!0),je}var Me,or;function At(){if(or)return Me;or=1;const t=G();return Me=(r,n,a)=>{const u=new t(r,a),c=new t(n,a);return u.compare(c)||u.compareBuild(c)},Me}var ze,cr;function Yn(){if(cr)return ze;cr=1;const t=At();return ze=(r,n)=>r.sort((a,u)=>t(a,u,n)),ze}var Ue,lr;function Kn(){if(lr)return Ue;lr=1;const t=At();return Ue=(r,n)=>r.sort((a,u)=>t(u,a,n)),Ue}var Ve,ur;function ge(){if(ur)return Ve;ur=1;const t=j();return Ve=(r,n,a)=>t(r,n,a)>0,Ve}var Xe,fr;function Ft(){if(fr)return Xe;fr=1;const t=j();return Xe=(r,n,a)=>t(r,n,a)<0,Xe}var Je,hr;function Zr(){if(hr)return Je;hr=1;const t=j();return Je=(r,n,a)=>t(r,n,a)===0,Je}var We,pr;function Qr(){if(pr)return We;pr=1;const t=j();return We=(r,n,a)=>t(r,n,a)!==0,We}var He,dr;function Bt(){if(dr)return He;dr=1;const t=j();return He=(r,n,a)=>t(r,n,a)>=0,He}var Ye,gr;function bt(){if(gr)return Ye;gr=1;const t=j();return Ye=(r,n,a)=>t(r,n,a)<=0,Ye}var Ke,mr;function en(){if(mr)return Ke;mr=1;const t=Zr(),e=Qr(),r=ge(),n=Bt(),a=Ft(),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 t(h,i,s);case"!=":return e(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 Zn(){if(Er)return Ze;Er=1;const t=G(),e=X(),{safeRe:r,t:n}=ee();return Ze=(u,c)=>{if(u instanceof t)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 e(`${o}.${i}.${s}${l}${f}`,c)},Ze}var Qe,vr;function Qn(){if(vr)return Qe;vr=1;class t{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=t,Qe}var et,$r;function M(){if($r)return et;$r=1;const t=/\s+/g;class e{constructor(m,P){if(P=a(P),m instanceof e)return m.loose===!!P.loose&&m.includePrerelease===!!P.includePrerelease?m:new e(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(t," "),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,F=T.map(q=>new u(q,this.options));for(const q of F){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 e))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=e;const r=Qn(),n=new r,a=Tt(),u=me(),c=de(),h=G(),{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=B(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==="*",B=(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 F;return S(w)?F="":S(C)?F=`>=${w}.0.0${R} <${+w+1}.0.0-0`:S(T)?w==="0"?F=`>=${w}.${C}.0${R} <${w}.${+C+1}.0-0`:F=`>=${w}.${C}.0${R} <${+w+1}.0.0-0`:N?(c("replaceCaret pr",N),w==="0"?C==="0"?F=`>=${w}.${C}.${T}-${N} <${w}.${C}.${+T+1}-0`:F=`>=${w}.${C}.${T}-${N} <${w}.${+C+1}.0-0`:F=`>=${w}.${C}.${T}-${N} <${+w+1}.0.0-0`):(c("no pr"),w==="0"?C==="0"?F=`>=${w}.${C}.${T}${R} <${w}.${C}.${+T+1}-0`:F=`>=${w}.${C}.${T}${R} <${w}.${+C+1}.0-0`:F=`>=${w}.${C}.${T} <${+w+1}.0.0-0`),c("caret return",F),F})},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 F=S(w),_=F||S(C),q=_||S(T),H=q;return y==="="&&H&&(y=""),N=m.includePrerelease?"-0":"",F?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,F,_,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(F)?N="":S(_)?N=`<${+F+1}.0.0-0`:S(q)?N=`<${F}.${+_+1}.0-0`:H?N=`<=${F}.${_}.${q}-${H}`:E?N=`<${F}.${_}.${+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 t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(s,l){if(l=r(l),s instanceof e){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===t?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=t}toString(){return this.value}test(s){if(c("Comparator.test",s,this.options.loose),this.semver===t||s===t)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 e))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=e;const r=Tt(),{safeRe:n,t:a}=ee(),u=en(),c=de(),h=G(),o=M();return tt}var rt,wr;function Ee(){if(wr)return rt;wr=1;const t=M();return rt=(r,n,a)=>{try{n=new t(n,a)}catch{return!1}return n.test(r)},rt}var nt,kr;function es(){if(kr)return nt;kr=1;const t=M();return nt=(r,n)=>new t(r,n).set.map(a=>a.map(u=>u.value).join(" ").trim().split(" ")),nt}var st,Pr;function ts(){if(Pr)return st;Pr=1;const t=G(),e=M();return st=(n,a,u)=>{let c=null,h=null,o=null;try{o=new e(a,u)}catch{return null}return n.forEach(i=>{o.test(i)&&(!c||h.compare(i)===-1)&&(c=i,h=new t(c,u))}),c},st}var it,yr;function rs(){if(yr)return it;yr=1;const t=G(),e=M();return it=(n,a,u)=>{let c=null,h=null,o=null;try{o=new e(a,u)}catch{return null}return n.forEach(i=>{o.test(i)&&(!c||h.compare(i)===1)&&(c=i,h=new t(c,u))}),c},it}var at,Sr;function ns(){if(Sr)return at;Sr=1;const t=G(),e=M(),r=ge();return at=(a,u)=>{a=new e(a,u);let c=new t("0.0.0");if(a.test(c)||(c=new t("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 t(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 ss(){if(Cr)return ot;Cr=1;const t=M();return ot=(r,n)=>{try{return new t(r,n).range||"*"}catch{return null}},ot}var ct,Or;function qt(){if(Or)return ct;Or=1;const t=G(),e=me(),{ANY:r}=e,n=M(),a=Ee(),u=ge(),c=Ft(),h=bt(),o=Bt();return ct=(s,l,f,d)=>{s=new t(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 B=l.set[S];let b=null,A=null;if(B.forEach(D=>{D.semver===r&&(D=new e(">=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 is(){if(Ir)return lt;Ir=1;const t=qt();return lt=(r,n,a)=>t(r,n,">",a),lt}var ut,Nr;function as(){if(Nr)return ut;Nr=1;const t=qt();return ut=(r,n,a)=>t(r,n,"<",a),ut}var ft,Lr;function os(){if(Lr)return ft;Lr=1;const t=M();return ft=(r,n,a)=>(r=new t(r,a),n=new t(n,a),r.intersects(n,a)),ft}var ht,Tr;function cs(){if(Tr)return ht;Tr=1;const t=Ee(),e=j();return ht=(r,n,a)=>{const u=[];let c=null,h=null;const o=r.sort((f,d)=>e(f,d,a));for(const f of o)t(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 ls(){if(Ar)return pt;Ar=1;const t=M(),e=me(),{ANY:r}=e,n=Ee(),a=j(),u=(l,f,d={})=>{if(l===f)return!0;l=new t(l,d),f=new t(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 e(">=0.0.0-0")],h=[new e(">=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,B,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===">=",B=B||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&&B&&!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,Fr;function us(){if(Fr)return dt;Fr=1;const t=ee(),e=pe(),r=G(),n=Kr(),a=X(),u=Gn(),c=jn(),h=Mn(),o=zn(),i=Un(),s=Vn(),l=Xn(),f=Jn(),d=j(),k=Wn(),p=Hn(),v=At(),$=Yn(),I=Kn(),S=ge(),B=Ft(),b=Zr(),A=Qr(),D=Bt(),O=bt(),W=en(),we=Zn(),ke=me(),Pe=M(),ye=Ee(),E=es(),m=ts(),P=rs(),R=ns(),y=ss(),w=qt(),C=is(),T=as(),N=os(),F=cs(),_=ls();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:B,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:F,subset:_,SemVer:r,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},dt}var tn=us();const rn=_n(tn),Rt="_updates_v2/per_package_version/";function fs(t,e){return`${Rt}${t.organization}/${t.name}/${t.version}/${e}`}const hs=/(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<name>[^\/]+))\/(?<version>[^\/]+)\/(?<seed>[^\/]+)$/,gt="_updates_v2/_global_update_in",Br="_updates_v2/_global_update_out",J="v2/",nn="overview.json",sn="overview.json",Z="manifest.json",le="channels",ne=/^[-a-z0-9]+$/;function Dt(t){return`${t.organization}/${t.name}/${t.version}`}function K(t){return`${J}${Dt(t)}`}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(t){return`${t.organization}/${t.name}/${sn}`}function kt(t){return`${J}${cn(t)}`}function ln(t){return`${Dt(t)}/${le}/`}function un(t){return`${J}${ln(t)}`}const fn=/(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<name>[^\/]+))\/(?<version>[^\/]+)\/manifest\.json$/,se=`${J}${nn}`;function xt(t){const e=L.z.object({id:g.BlockPackIdNoVersion,allVersions:L.z.array(L.z.string()).optional(),allVersionsWithChannels:L.z.array(g.VersionWithChannels).optional(),latest:t,latestManifestSha256:g.Sha256Schema,latestByChannel:L.z.record(L.z.string(),L.z.object({description:t,manifestSha256:g.Sha256Schema})).default({})});return e.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(e.required({allVersionsWithChannels:!0}))}const ps=xt(g.BlockPackDescriptionManifest);function ve(t){return L.z.object({schema:L.z.literal("v2"),packages:L.z.array(xt(t))})}const Pt=ve(g.BlockPackDescriptionManifest);function ds(t){return g.CreateBlockPackDescriptionSchema(g.BlockComponentsManifest,g.BlockPackMeta(g.ContentRelativeText.transform(he(t)),g.ContentRelativeBinary.transform(Q(t))))}function gs(t){return ve(g.CreateBlockPackDescriptionSchema(g.BlockComponentsManifest,g.BlockPackMeta(g.ContentRelativeText.transform(he(t)),g.ContentRelativeBinary.transform(Q(t)))))}function ms(t){return ve(g.CreateBlockPackDescriptionSchema(g.BlockComponentsManifest,g.BlockPackMeta(g.ContentRelativeText.transform(he(t)),g.ContentRelativeBinary.transform(Q(t)))))}class Es{constructor(e,r=new Ct.ConsoleLoggerAdapter){this.storage=e,this.logger=r}async updateRegistry(e="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(hs);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(e==="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 B=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:B,channels:b})}d.sort((v,$)=>tn.compare($.description.id.version,v.description.id.version)),e!=="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}]}))})}e!=="dry-run"&&await this.storage.putFile(se,Buffer.from(JSON.stringify({schema:"v2",packages:o}))),this.logger.info(`Global overview updated (${o.length} records)`),e!=="dry-run"&&await this.storage.deleteFiles(...n.map(i=>`${Rt}${i}`)),this.logger.info("Version update requests cleared")}async updateIfNeeded(e="normal"){this.logger.info("Checking if registry requires refresh...");const r=await this.storage.getFile(gt),n=await this.storage.getFile(Br);if(e!=="force"&&r===void 0&&n===void 0){this.logger.info("No global seed files found, update not needed.");return}if(e!=="force"&&r!==void 0&&n!==void 0&&r.equals(n)){this.logger.info("Registry is up to date.");return}await this.updateRegistry(e),r&&(e!=="dry-run"&&await this.storage.putFile(Br,r),this.logger.info("Refresh finished."))}async getPackageOverview(e){const r=await this.storage.getFile(kt(e));if(r!==void 0)return wt.parse(JSON.parse(r.toString()))}async getGlobalOverview(){const e=await this.storage.getFile(se);if(e!==void 0)return Pt.parse(JSON.parse(e.toString()))}async marchChanged(e){const r=Dr.randomUUID(),n=fs(e,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(e,r){if(!r.match(ne))throw new Error(`Illegal characters in channel name: ${r}`);const n=K(e);if(await this.storage.getFile(`${n}/${Z}`)===void 0)throw new Error(`Package ${g.blockPackIdToString(e)} not found in the registry.`);await this.storage.putFile(`${n}/${le}/${r}`,Buffer.from(r)),await this.marchChanged(e)}async removePackageFromChannel(e,r){if(!r.match(ne))throw new Error(`Illegal characters in channel name: ${r}`);const n=K(e);if(await this.storage.getFile(`${n}/${Z}`)===void 0)throw new Error(`Package ${g.blockPackIdToString(e)} not found in the registry.`);await this.storage.deleteFiles(`${n}/${le}/${r}`),await this.marchChanged(e)}async publishPackage(e,r){const n=K(e.description.id);for(const u of e.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(e))),await this.marchChanged(e.description.id)}}class hn{constructor(e,r,n){this.client=e,this.bucket=r,this.root=n}async getFile(e){try{return Buffer.from(await(await this.client.getObject({Bucket:this.bucket,Key:U.join(this.root,e)})).Body.transformToByteArray())}catch(r){if(r.name==="NoSuchKey")return;throw r}}async listFiles(e){const r=U.join(this.root,e),n=xr.paginateListObjectsV2({client:this.client},{Bucket:this.bucket,Prefix:r}),a=[];for await(const u of n)a.push(...(u.Contents??[]).map(c=>U.relative(r,c.Key)));return a}async putFile(e,r){await this.client.putObject({Bucket:this.bucket,Key:U.join(this.root,e),Body:r})}async deleteFiles(...e){const r=await this.client.deleteObjects({Bucket:this.bucket,Delete:{Objects:e.map(n=>({Key:U.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(e){te(this,"root");this.root=x.resolve(e)}toAbsolutePath(e){if(U.isAbsolute(e))throw new Error("absolute path");return x.resolve(this.root,e.split(U.sep).join(x.sep))}async getFile(e){try{return await Y.promises.readFile(this.toAbsolutePath(e))}catch(r){if(r.code=="ENOENT")return;throw new Error("",{cause:r})}}async listFiles(e){try{const r=this.toAbsolutePath(e);return(await Y.promises.readdir(r,{recursive:!0,withFileTypes:!0})).filter(n=>n.isFile()).map(n=>x.relative(r,x.resolve(n.parentPath,n.name)).split(x.sep).join(U.sep))}catch(r){if(r.code=="ENOENT")return[];throw new Error("",{cause:r})}}async putFile(e,r){const n=this.toAbsolutePath(e);await Y.promises.mkdir(x.dirname(n),{recursive:!0}),await Y.promises.writeFile(n,r)}async deleteFiles(...e){for(const r of e)await Y.promises.rm(this.toAbsolutePath(r))}}function dn(t){const e=new URL(t,`file:${x.resolve(".").split(x.sep).join(U.sep)}/`);switch(e.protocol){case"file:":const r=x.resolve(e.pathname);return new pn(r);case"s3:":const n={},a=e.searchParams.get("region");a&&(n.region=a);const u=e.hostname;return new hn(new xr.S3(n),u,e.pathname.replace(/^\//,""));default:throw new Error(`Unknown protocol: ${e.protocol}`)}}const vs=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(),vs).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 $s(t){return`${Re}${t.organization}/${t.package}/${t.version}`}function Gt(t,e){return`${Re}${t.organization}/${t.package}/${t.version}/${e}`}function yt(t){return`${Re}${t.organization}/${t.package}/overview.json`}const ie=`${Re}overview.json`,jt="meta.json",St="_updates_v1/per_package_version/";function Rs(t,e){return`${St}${t.organization}/${t.package}/${t.version}/${e}`}const ws=/(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<pkg>[^\/]+))\/(?<version>[^\/]+)\/(?<seed>[^\/]+)$/,$n="_updates_v1/_global_update_in",br="_updates_v1/_global_update_out";class ks{constructor(e,r){this.storage=e,this.logger=r}constructNewPackage(e){return new Ps(this.storage,e)}async updateRegistry(){var c,h,o,i,s,l,f,d;(c=this.logger)==null||c.info("Initiating registry refresh...");const e=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(ws);if(!p)continue;r.push(k);const{packageKeyWithoutVersion:v,organization:$,pkg:I,version:S,seed:B}=p.groups;let b=e.get(v);b?b.versions.has(S)||b.versions.add(S):e.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 e.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(),B=await this.storage.getFile(Gt({...k.package,version:S},jt));B&&$.push({version:S,meta:JSON.parse(B.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(e=!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);!e&&r===void 0&&n===void 0||!e&&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(e){const r=await this.storage.getFile(yt(e));if(r!==void 0)return JSON.parse(r.toString())}async getGlobalOverview(){const e=await this.storage.getFile(ie);if(e!==void 0)return JSON.parse(e.toString())}}class Ps{constructor(e,r){te(this,"metaAdded",!1);te(this,"seed",Dr.randomUUID());this.storage=e,this.name=r}async addFile(e,r){await this.storage.putFile(Gt(this.name,e),r)}async writeMeta(e){await this.addFile(jt,Buffer.from(JSON.stringify(e))),this.metaAdded=!0}async finish(){if(!this.metaAdded)throw new Error("meta not added");await this.storage.putFile(Rs(this.name,this.seed),Buffer.of(0)),await this.storage.putFile($n,Buffer.from(this.seed))}}function V(t,e){return e===void 0?t:{...t,...e,registries:{...t.registries,...e.registries},files:{...t.files,...e.files}}}async function mt(t){return Nt(t,e=>$e.parse(JSON.parse(e.toString())))}async function Et(t){return Nt(t,e=>$e.parse(Cn.parse(e.toString())))}async function ys(){let t=$e.parse({});return t=V(t,await mt("./.pl.reg.json")),t=V(t,await Et("./.pl.reg.yaml")),t=V(t,await mt(`${Mt.homedir()}/.pl.reg.json`)),t=V(t,await Et(`${Mt.homedir()}/.pl.reg.yaml`)),t=V(t,await mt(En)),t=V(t,await Et(vn)),t}class Rn{constructor(e){this.conf=e}createRegistry(e){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 ks(dn(r),e)}get fullPackageName(){return{organization:this.conf.organization,package:this.conf.package,version:this.conf.version}}}async function Ss(t){const e=await ys();return new Rn(_t.parse(V(e,t)))}exports.BlockComponentsAbsoluteUrl=Bn;exports.BlockComponentsConsolidate=Wr;exports.BlockComponentsDescription=Jr;exports.BlockDescriptionPackageJsonField=ce;exports.BlockDescriptionToExplicitBinaryBytes=ds;exports.BlockPackDescriptionConsolidateToFolder=Hr;exports.BlockPackDescriptionManifestAddRelativePathPrefix=$t;exports.BlockPackMetaConsolidate=Xr;exports.BlockPackMetaDescription=Vr;exports.BlockPackMetaEmbedAbsoluteBase64=Tn;exports.BlockPackMetaEmbedAbsoluteBytes=An;exports.BlockPackMetaEmbedBytes=Fn;exports.BlockRegistryV2=Es;exports.ChannelNameRegexp=ne;exports.ChannelsFolder=le;exports.FSStorage=pn;exports.GlobalOverview=ve;exports.GlobalOverviewEntry=xt;exports.GlobalOverviewEntryReg=ps;exports.GlobalOverviewFileName=nn;exports.GlobalOverviewPath=ie;exports.GlobalOverviewPath$1=se;exports.GlobalOverviewReg=Pt;exports.GlobalOverviewToExplicitBinaryBase64=ms;exports.GlobalOverviewToExplicitBinaryBytes=gs;exports.MainPrefix=J;exports.ManifestFileName=Z;exports.ManifestSuffix=an;exports.MetaFile=jt;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=Gr;exports.S3Storage=hn;exports.absoluteToBase64=jr;exports.absoluteToBytes=Mr;exports.absoluteToString=Ot;exports.buildBlockPackDist=bn;exports.calculateSha256=oe;exports.cpAbsoluteToRelative=ae;exports.getConfig=Ss;exports.loadPackDescription=xn;exports.loadPackDescriptionRaw=Yr;exports.mapLocalToAbsolute=vt;exports.packFolderToRelativeTgz=zr;exports.packageChannelPrefix=un;exports.packageChannelPrefixInsideV2=ln;exports.packageContentPrefix=$s;exports.packageContentPrefix$1=K;exports.packageContentPrefixInsideV2=Dt;exports.packageOverviewPath=yt;exports.packageOverviewPath$1=kt;exports.packageOverviewPathInsideV2=cn;exports.parsePackageName=Lt;exports.payloadFilePath=Gt;exports.relativeToContentString=Ur;exports.relativeToExplicitBinary64=Ln;exports.relativeToExplicitBytes=Q;exports.relativeToExplicitString=he;exports.semver=rn;exports.storageByUrl=dn;exports.tryLoadPackDescription=Dn;
|
|
3
|
-
//# sourceMappingURL=config-26zalc5o.js.map
|