@platforma-sdk/block-tools 2.4.6 → 2.4.8
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 +4 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-MTiP2z4I.mjs → config-dqDSqXfz.mjs} +5 -5
- package/dist/{config-MTiP2z4I.mjs.map → config-dqDSqXfz.mjs.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +180 -169
- package/dist/index.mjs.map +1 -1
- package/dist/io/folder_reader.d.ts.map +1 -1
- package/dist/v2/registry/registry_reader.d.ts +2 -3
- package/dist/v2/registry/registry_reader.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/io/folder_reader.ts +3 -2
- package/src/v2/registry/registry_reader.test.ts +2 -2
- package/src/v2/registry/registry_reader.ts +100 -86
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var u=(
|
|
1
|
+
"use strict";var f=Object.defineProperty;var u=(o,t,a)=>t in o?f(o,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[t]=a;var s=(o,t,a)=>u(o,typeof t!="symbol"?t+"":t,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./config-ClvGIy46.js"),y=require("undici"),n=require("node:path"),d=require("node:path/posix"),m=require("node:fs/promises"),R=require("@milaboratories/pl-http"),p=require("@milaboratories/pl-model-middle-layer"),v=require("canonicalize");require("zod");require("mime-types");require("tar");require("@milaboratories/resolve-helper");const h=require("lru-cache"),l=require("@milaboratories/ts-helpers"),B={cacheBlockListFor:45e3,keepStaleBlockListFor:3e5};class C{constructor(t,a){s(this,"v2RootFolderReader");s(this,"ops");s(this,"embeddedGlobalMetaCache",new h.LRUCache({max:500,fetchMethod:async(t,a,i)=>await l.retry(async()=>{const r=i.context.relativeTo!==void 0?this.v2RootFolderReader.relativeReader(e.packageContentPrefixInsideV2(i.context.relativeTo)).getContentReader():this.v2RootFolderReader.getContentReader();return await e.BlockPackMetaEmbedBytes(r).parseAsync(i.context.meta)},l.Retry2TimesWithDelay)}));s(this,"listCacheTimestamp",0);s(this,"listCache");s(this,"componentsCache",new h.LRUCache({max:500,fetchMethod:async(t,a,{context:i})=>await l.retry(async()=>{const r=this.v2RootFolderReader.relativeReader(e.packageContentPrefixInsideV2(i)),c=p.BlockPackManifest.parse(JSON.parse(Buffer.from(await r.readFile(e.ManifestFileName)).toString()));return e.BlockComponentsAbsoluteUrl(r.rootUrl.toString()).parse(c.description.components)},l.Retry2TimesWithDelay)}));this.registryReader=t,this.v2RootFolderReader=t.relativeReader(e.MainPrefix),this.ops={...B,...a??{}}}async embedMetaContent(t,a,i,r){return await this.embeddedGlobalMetaCache.forceFetch(v({id:t,sha256:a,absolutePath:i}),{context:{meta:r,relativeTo:i?void 0:t}})}async listBlockPacks(){if(this.listCache!==void 0&&Date.now()-this.listCacheTimestamp<=this.ops.cacheBlockListFor)return this.listCache;try{return await l.retry(async()=>{const t=e.GlobalOverviewReg.parse(JSON.parse(Buffer.from(await this.v2RootFolderReader.readFile(e.GlobalOverviewFileName)).toString())),a=await Promise.all(t.packages.map(async i=>{const r=await Promise.all(Object.entries(i.latestByChannel).map(async([c,P])=>[c,{id:P.description.id,meta:await this.embedMetaContent(i.latest.id,i.latestManifestSha256,!0,i.latest.meta),spec:{type:"from-registry-v2",id:i.latest.id,registryUrl:this.registryReader.rootUrl.toString(),channel:c}}]));return{id:i.id,latestByChannel:Object.fromEntries(r),allVersions:i.allVersionsWithChannels}}));return this.listCache=a,this.listCacheTimestamp=Date.now(),a},l.Retry2TimesWithDelay)}catch(t){if(this.listCache!==void 0&&Date.now()-this.listCacheTimestamp<=this.ops.keepStaleBlockListFor)return this.listCache;throw t}}async getLatestOverview(t,a){return await l.retry(async()=>{const i=(await this.listBlockPacks()).find(r=>p.blockPackIdNoVersionEquals(t,r.id));if(i!==void 0)return i.latestByChannel[a]},l.Retry2TimesWithDelay)}async getSpecificOverview(t,a){return await l.retry(async()=>{const i=await this.v2RootFolderReader.readFile(e.packageContentPrefixInsideV2(t)+e.ManifestSuffix),r=p.BlockPackManifest.parse(JSON.parse(Buffer.from(i).toString()));return{id:t,meta:await this.embedMetaContent(t,await e.calculateSha256(i),!1,r.description.meta),spec:{type:"from-registry-v2",id:t,registryUrl:this.registryReader.rootUrl.toString(),channel:a}}},l.Retry2TimesWithDelay)}async getComponents(t){return await this.componentsCache.forceFetch(v(t),{context:t})}}class k{constructor(t,a){this.rootUrl=t,this.httpDispatcher=a}async readFile(t){const a=new URL(t,this.rootUrl),i=await y.request(a,{dispatcher:this.httpDispatcher});return Buffer.from(await i.body.arrayBuffer())}relativeReader(t){return t.endsWith("/")||(t=t+"/"),new k(new URL(t,this.rootUrl),this.httpDispatcher)}getContentReader(t){let a=this;return t!==void 0&&(a=a.relativeReader(t)),i=>a.readFile(i)}}class g{constructor(t,a){this.rootUrl=t,this.root=a}async readFile(t){const a=n.join(this.root,...t.split(d.sep));return await m.readFile(a)}relativeReader(t){return t.endsWith("/")||(t=t+"/"),new g(new URL(t,this.rootUrl),n.join(this.root,...t.split(d.sep)))}getContentReader(t){let a=this;return t!==void 0&&(a=a.relativeReader(t)),i=>a.readFile(i)}}function w(o){return o.split(d.sep).join(n.sep)}function b(o){return o.split(n.sep).join(d.sep)}function F(o,t){o.endsWith("/")||(o=o+"/");const a=new URL(o,`file:${b(n.resolve("."))}/`);switch(a.protocol){case"file:":const i=w(a.pathname);return new g(a,i);case"https:":case"http:":return new k(a,t??R.defaultHttpDispatcher());default:throw new Error(`Unknown protocol: ${a.protocol}`)}}const x=Object.freeze(Object.defineProperty({__proto__:null,GlobalOverviewPath:e.GlobalOverviewPath,MetaFile:e.MetaFile,PlPackageConfigData:e.PlPackageConfigData,PlPackageJsonConfigFile:e.PlPackageJsonConfigFile,PlPackageYamlConfigFile:e.PlPackageYamlConfigFile,PlRegCommonConfigData:e.PlRegCommonConfigData,PlRegFullPackageConfigData:e.PlRegFullPackageConfigData,PlRegPackageConfig:e.PlRegPackageConfig,PlRegPackageConfigDataShard:e.PlRegPackageConfigDataShard,packageContentPrefix:e.packageContentPrefix,packageOverviewPath:e.packageOverviewPath,payloadFilePath:e.payloadFilePath},Symbol.toStringTag,{value:"Module"}));exports.BlockComponentsAbsoluteUrl=e.BlockComponentsAbsoluteUrl;exports.BlockComponentsConsolidate=e.BlockComponentsConsolidate;exports.BlockComponentsDescription=e.BlockComponentsDescription;exports.BlockDescriptionPackageJsonField=e.BlockDescriptionPackageJsonField;exports.BlockDescriptionToExplicitBinaryBytes=e.BlockDescriptionToExplicitBinaryBytes;exports.BlockPackDescriptionConsolidateToFolder=e.BlockPackDescriptionConsolidateToFolder;exports.BlockPackDescriptionManifestAddRelativePathPrefix=e.BlockPackDescriptionManifestAddRelativePathPrefix;exports.BlockPackMetaConsolidate=e.BlockPackMetaConsolidate;exports.BlockPackMetaDescription=e.BlockPackMetaDescription;exports.BlockPackMetaEmbedAbsoluteBase64=e.BlockPackMetaEmbedAbsoluteBase64;exports.BlockPackMetaEmbedAbsoluteBytes=e.BlockPackMetaEmbedAbsoluteBytes;exports.BlockPackMetaEmbedBytes=e.BlockPackMetaEmbedBytes;exports.BlockRegistryV2=e.BlockRegistryV2;exports.ChannelNameRegexp=e.ChannelNameRegexp;exports.ChannelsFolder=e.ChannelsFolder;exports.FSStorage=e.FSStorage;exports.GlobalOverview=e.GlobalOverview;exports.GlobalOverviewEntry=e.GlobalOverviewEntry;exports.GlobalOverviewEntryReg=e.GlobalOverviewEntryReg;exports.GlobalOverviewFileName=e.GlobalOverviewFileName;exports.GlobalOverviewPath=e.GlobalOverviewPath$1;exports.GlobalOverviewReg=e.GlobalOverviewReg;exports.GlobalOverviewToExplicitBinaryBase64=e.GlobalOverviewToExplicitBinaryBase64;exports.GlobalOverviewToExplicitBinaryBytes=e.GlobalOverviewToExplicitBinaryBytes;exports.MainPrefix=e.MainPrefix;exports.ManifestFileName=e.ManifestFileName;exports.ManifestSuffix=e.ManifestSuffix;exports.PackageOverview=e.PackageOverview;exports.PackageOverviewFileName=e.PackageOverviewFileName;exports.PackageOverviewVersionEntry=e.PackageOverviewVersionEntry;exports.ResolvedBlockPackDescriptionFromPackageJson=e.ResolvedBlockPackDescriptionFromPackageJson;exports.ResolvedModuleFile=e.ResolvedModuleFile;exports.ResolvedModuleFolder=e.ResolvedModuleFolder;exports.S3Storage=e.S3Storage;exports.absoluteToBase64=e.absoluteToBase64;exports.absoluteToBytes=e.absoluteToBytes;exports.absoluteToString=e.absoluteToString;exports.buildBlockPackDist=e.buildBlockPackDist;exports.cpAbsoluteToRelative=e.cpAbsoluteToRelative;exports.loadPackDescription=e.loadPackDescription;exports.loadPackDescriptionRaw=e.loadPackDescriptionRaw;exports.mapLocalToAbsolute=e.mapLocalToAbsolute;exports.packFolderToRelativeTgz=e.packFolderToRelativeTgz;exports.packageChannelPrefix=e.packageChannelPrefix;exports.packageChannelPrefixInsideV2=e.packageChannelPrefixInsideV2;exports.packageContentPrefix=e.packageContentPrefix$1;exports.packageContentPrefixInsideV2=e.packageContentPrefixInsideV2;exports.packageOverviewPath=e.packageOverviewPath$1;exports.packageOverviewPathInsideV2=e.packageOverviewPathInsideV2;exports.parsePackageName=e.parsePackageName;exports.relativeToContentString=e.relativeToContentString;exports.relativeToExplicitBinary64=e.relativeToExplicitBinary64;exports.relativeToExplicitBytes=e.relativeToExplicitBytes;exports.relativeToExplicitString=e.relativeToExplicitString;exports.storageByUrl=e.storageByUrl;exports.tryLoadPackDescription=e.tryLoadPackDescription;exports.RegistryV1=x;exports.RegistryV2Reader=C;exports.folderReaderByUrl=F;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/v2/registry/registry_reader.ts","../src/io/folder_reader.ts"],"sourcesContent":["import {\n BlockPackId,\n BlockPackIdNoVersion,\n blockPackIdNoVersionEquals,\n BlockPackManifest,\n BlockPackMetaEmbeddedBytes,\n BlockPackMetaManifest,\n BlockPackOverview,\n SingleBlockPackOverview\n} from '@milaboratories/pl-model-middle-layer';\nimport { FolderReader } from '../../io';\nimport canonicalize from 'canonicalize';\nimport {\n GlobalOverviewFileName,\n GlobalOverviewReg,\n MainPrefix,\n ManifestFileName,\n packageContentPrefixInsideV2,\n packageOverviewPathInsideV2\n} from './schema_public';\nimport { BlockComponentsAbsoluteUrl, BlockPackMetaEmbedBytes } from '../model';\nimport { LRUCache } from 'lru-cache';\nimport { calculateSha256 } from '../../util';\n\nexport type BlockPackOverviewNoRegLabel = Omit<BlockPackOverview, 'registryId'>;\nexport type SingleBlockPackOverviewNoRegLabel = Omit<SingleBlockPackOverview, 'registryId'>;\n\nexport type RegistryV2ReaderOps = {\n /** Number of milliseconds to cache retrieved block list for */\n cacheBlockListFor: number;\n /** Number of milliseconds to keep cached retrieved block list for, if new requests returns error */\n keepStaleBlockListFor: number;\n};\n\nconst DefaultRegistryV2ReaderOps: RegistryV2ReaderOps = {\n cacheBlockListFor: 45e3, // 45 seconds\n keepStaleBlockListFor: 300e3 // 5 minutes\n};\n\nexport class RegistryV2Reader {\n private readonly v2RootFolderReader: FolderReader;\n private readonly ops: RegistryV2ReaderOps;\n\n constructor(\n private readonly registryReader: FolderReader,\n ops?: Partial<RegistryV2ReaderOps>\n ) {\n this.v2RootFolderReader = registryReader.relativeReader(MainPrefix);\n this.ops = { ...DefaultRegistryV2ReaderOps, ...(ops ?? {}) };\n }\n\n /**\n * Embeds meta infromation relative to registry root.\n * Meta information that looks like:\n *\n * */\n private readonly embeddedGlobalMetaCache = new LRUCache<\n string,\n BlockPackMetaEmbeddedBytes,\n { meta: BlockPackMetaManifest; relativeTo?: BlockPackId }\n >({\n max: 500,\n fetchMethod: async (_key, _staleValue, options) => {\n const contentReader =\n options.context.relativeTo !== undefined\n ? this.v2RootFolderReader\n .relativeReader(packageContentPrefixInsideV2(options.context.relativeTo))\n .getContentReader()\n : this.v2RootFolderReader.getContentReader();\n return await BlockPackMetaEmbedBytes(contentReader).parseAsync(options.context.meta);\n }\n });\n\n private async embedMetaContent(\n id: BlockPackId,\n sha256: string,\n absolutePath: boolean,\n meta: BlockPackMetaManifest\n ): Promise<BlockPackMetaEmbeddedBytes> {\n return await this.embeddedGlobalMetaCache.forceFetch(\n canonicalize({ id, sha256, absolutePath })!,\n { context: { meta, relativeTo: absolutePath ? undefined : id } }\n );\n }\n\n private listCacheTimestamp: number = 0;\n private listCache: BlockPackOverviewNoRegLabel[] | undefined = undefined;\n\n public async listBlockPacks(): Promise<BlockPackOverviewNoRegLabel[]> {\n if (\n this.listCache !== undefined &&\n Date.now() - this.listCacheTimestamp <= this.ops.cacheBlockListFor\n )\n return this.listCache;\n try {\n // const rootContentReader = this.v2RootFolderReader.getContentReader();\n const globalOverview = GlobalOverviewReg.parse(\n JSON.parse(\n Buffer.from(await this.v2RootFolderReader.readFile(GlobalOverviewFileName)).toString()\n )\n );\n\n const result = await Promise.all(\n globalOverview.packages.map(async (p) => {\n const byChannelEntries = await Promise.all(\n Object.entries(p.latestByChannel).map(async ([channel, data]) => [\n channel,\n {\n id: data.description.id,\n meta: await this.embedMetaContent(\n p.latest.id,\n p.latestManifestSha256,\n true,\n p.latest.meta\n ),\n spec: {\n type: 'from-registry-v2',\n id: p.latest.id,\n registryUrl: this.registryReader.rootUrl.toString(),\n channel\n }\n }\n ])\n );\n return {\n id: p.id,\n latestByChannel: Object.fromEntries(byChannelEntries),\n allVersions: p.allVersionsWithChannels\n } satisfies BlockPackOverviewNoRegLabel;\n })\n );\n\n this.listCache = result;\n this.listCacheTimestamp = Date.now();\n\n return result;\n } catch (e: unknown) {\n if (\n this.listCache !== undefined &&\n Date.now() - this.listCacheTimestamp <= this.ops.keepStaleBlockListFor\n )\n return this.listCache;\n throw e;\n }\n }\n\n public async getLatestOverview(\n id: BlockPackIdNoVersion,\n channel: string\n ): Promise<SingleBlockPackOverviewNoRegLabel | undefined> {\n const overview = (await this.listBlockPacks()).find((e) =>\n blockPackIdNoVersionEquals(id, e.id)\n );\n if (overview === undefined) return undefined;\n return overview.latestByChannel[channel];\n }\n\n public async getSpecificOverview(id: BlockPackId): Promise<SingleBlockPackOverviewNoRegLabel> {\n const overviewContent = await this.v2RootFolderReader.readFile(packageOverviewPathInsideV2(id));\n const overview = BlockPackManifest.parse(JSON.parse(Buffer.from(overviewContent).toString()));\n return {\n id: id,\n meta: await this.embedMetaContent(\n id,\n await calculateSha256(overviewContent),\n false,\n overview.description.meta\n ),\n spec: {\n type: 'from-registry-v2',\n id,\n registryUrl: this.registryReader.rootUrl.toString()\n }\n };\n }\n\n private readonly componentsCache = new LRUCache<string, BlockComponentsAbsoluteUrl, BlockPackId>({\n max: 500,\n fetchMethod: async (key, staleValue, { context: id }) => {\n const packageFolderReader = this.v2RootFolderReader.relativeReader(\n packageContentPrefixInsideV2(id)\n );\n const manifest = BlockPackManifest.parse(\n JSON.parse(Buffer.from(await packageFolderReader.readFile(ManifestFileName)).toString())\n );\n return BlockComponentsAbsoluteUrl(packageFolderReader.rootUrl.toString()).parse(\n manifest.description.components\n );\n }\n });\n\n public async getComponents(id: BlockPackId): Promise<BlockComponentsAbsoluteUrl> {\n return await this.componentsCache.forceFetch(canonicalize(id)!, { context: id });\n }\n}\n","import { Agent, Dispatcher, request } from 'undici';\nimport { RelativeContentReader } from '../v2';\nimport path from 'node:path';\nimport pathPosix from 'node:path/posix';\nimport fsp from 'node:fs/promises';\n\nexport interface FolderReader {\n readonly rootUrl: URL;\n relativeReader(relativePath: string): FolderReader;\n readFile(file: string): Promise<Buffer>;\n getContentReader(relativePath?: string): RelativeContentReader;\n}\n\nclass HttpFolderReader implements FolderReader {\n constructor(\n public readonly rootUrl: URL,\n private readonly httpDispatcher: Dispatcher\n ) {}\n\n public async readFile(file: string): Promise<Buffer> {\n const targetUrl = new URL(file, this.rootUrl);\n const response = await request(targetUrl, {\n dispatcher: this.httpDispatcher\n });\n return Buffer.from(await response.body.arrayBuffer());\n }\n\n public relativeReader(relativePath: string): HttpFolderReader {\n if (!relativePath.endsWith('/')) relativePath = relativePath + '/';\n return new HttpFolderReader(new URL(relativePath, this.rootUrl), this.httpDispatcher);\n }\n\n public getContentReader(relativePath?: string): RelativeContentReader {\n let reader: HttpFolderReader = this;\n if (relativePath !== undefined) reader = reader.relativeReader(relativePath);\n return (path) => reader.readFile(path);\n }\n}\n\nclass FSFolderReader implements FolderReader {\n constructor(\n public readonly rootUrl: URL,\n private readonly root: string\n ) {}\n\n public async readFile(file: string): Promise<Buffer> {\n const targetPath = path.join(this.root, ...file.split(pathPosix.sep));\n return await fsp.readFile(targetPath);\n }\n\n public relativeReader(relativePath: string): FSFolderReader {\n if (!relativePath.endsWith('/')) relativePath = relativePath + '/';\n return new FSFolderReader(\n new URL(relativePath, this.rootUrl),\n path.join(this.root, ...relativePath.split(pathPosix.sep))\n );\n }\n\n public getContentReader(relativePath?: string): RelativeContentReader {\n let reader: FSFolderReader = this;\n if (relativePath !== undefined) reader = reader.relativeReader(relativePath);\n return (path) => reader.readFile(path);\n }\n}\n\nfunction posixToLocalPath(p: string): string {\n return p.split(pathPosix.sep).join(path.sep);\n}\n\nfunction localToPosix(p: string): string {\n return p.split(path.sep).join(pathPosix.sep);\n}\n\nexport function folderReaderByUrl(address: string, httpDispatcher?: Dispatcher): FolderReader {\n if (!address.endsWith('/')) address = address + '/';\n const url = new URL(address, `file:${localToPosix(path.resolve('.'))}/`);\n switch (url.protocol) {\n case 'file:':\n const rootPath = posixToLocalPath(url.pathname);\n return new FSFolderReader(url, rootPath);\n case 'https:':\n case 'http:':\n return new HttpFolderReader(url, httpDispatcher ?? new Agent());\n default:\n throw new Error(`Unknown protocol: ${url.protocol}`);\n }\n}\n"],"names":["DefaultRegistryV2ReaderOps","RegistryV2Reader","registryReader","ops","__publicField","LRUCache","_key","_staleValue","options","contentReader","packageContentPrefixInsideV2","BlockPackMetaEmbedBytes","key","staleValue","id","packageFolderReader","manifest","BlockPackManifest","ManifestFileName","BlockComponentsAbsoluteUrl","MainPrefix","sha256","absolutePath","meta","canonicalize","globalOverview","GlobalOverviewReg","GlobalOverviewFileName","result","p","byChannelEntries","channel","data","e","overview","blockPackIdNoVersionEquals","overviewContent","packageOverviewPathInsideV2","calculateSha256","HttpFolderReader","rootUrl","httpDispatcher","file","targetUrl","response","request","relativePath","reader","path","FSFolderReader","root","targetPath","pathPosix","fsp","posixToLocalPath","localToPosix","folderReaderByUrl","address","url","rootPath","Agent"],"mappings":"0kBAkCMA,EAAkD,CACtD,kBAAmB,KACnB,sBAAuB,GACzB,EAEO,MAAMC,CAAiB,CAI5B,YACmBC,EACjBC,EACA,CANeC,EAAA,2BACAA,EAAA,YAeAA,EAAA,+BAA0B,IAAIC,EAAAA,SAI7C,CACA,IAAK,IACL,YAAa,MAAOC,EAAMC,EAAaC,IAAY,CACjD,MAAMC,EACJD,EAAQ,QAAQ,aAAe,OAC3B,KAAK,mBACF,eAAeE,EAAA,6BAA6BF,EAAQ,QAAQ,UAAU,CAAC,EACvE,mBACH,KAAK,mBAAmB,iBAAiB,EAC/C,OAAO,MAAMG,EAAwB,wBAAAF,CAAa,EAAE,WAAWD,EAAQ,QAAQ,IAAI,CAAA,CACrF,CACD,GAcOJ,EAAA,0BAA6B,GAC7BA,EAAA,kBA0FSA,EAAA,uBAAkB,IAAIC,EAAAA,SAA0D,CAC/F,IAAK,IACL,YAAa,MAAOO,EAAKC,EAAY,CAAE,QAASC,KAAS,CACjD,MAAAC,EAAsB,KAAK,mBAAmB,eAClDL,EAAAA,6BAA6BI,CAAE,CACjC,EACME,EAAWC,EAAAA,kBAAkB,MACjC,KAAK,MAAM,OAAO,KAAK,MAAMF,EAAoB,SAASG,EAAAA,gBAAgB,CAAC,EAAE,SAAU,CAAA,CACzF,EACA,OAAOC,EAA2B,2BAAAJ,EAAoB,QAAQ,SAAA,C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SAAU,CACpB,IAAK,QACG,MAAAC,EAAWL,EAAiBI,EAAI,QAAQ,EACvC,OAAA,IAAIT,EAAeS,EAAKC,CAAQ,EACzC,IAAK,SACL,IAAK,QACH,OAAO,IAAIpB,EAAiBmB,EAAKjB,GAAkB,IAAImB,OAAO,EAChE,QACE,MAAM,IAAI,MAAM,qBAAqBF,EAAI,QAAQ,EAAE,CAAA,CAEzD"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/v2/registry/registry_reader.ts","../src/io/folder_reader.ts"],"sourcesContent":["import {\n BlockPackId,\n BlockPackIdNoVersion,\n blockPackIdNoVersionEquals,\n BlockPackManifest,\n BlockPackMetaEmbeddedBytes,\n BlockPackMetaManifest,\n BlockPackOverview,\n SingleBlockPackOverview\n} from '@milaboratories/pl-model-middle-layer';\nimport { FolderReader } from '../../io';\nimport canonicalize from 'canonicalize';\nimport {\n GlobalOverviewFileName,\n GlobalOverviewReg,\n MainPrefix,\n ManifestFileName,\n ManifestSuffix,\n packageContentPrefixInsideV2\n} from './schema_public';\nimport { BlockComponentsAbsoluteUrl, BlockPackMetaEmbedBytes } from '../model';\nimport { LRUCache } from 'lru-cache';\nimport { calculateSha256 } from '../../util';\nimport { retry, Retry2TimesWithDelay } from '@milaboratories/ts-helpers';\n\nexport type BlockPackOverviewNoRegLabel = Omit<BlockPackOverview, 'registryId'>;\n\nexport type RegistryV2ReaderOps = {\n /** Number of milliseconds to cache retrieved block list for */\n cacheBlockListFor: number;\n /** Number of milliseconds to keep cached retrieved block list for, if new requests returns error */\n keepStaleBlockListFor: number;\n};\n\nconst DefaultRegistryV2ReaderOps: RegistryV2ReaderOps = {\n cacheBlockListFor: 45e3, // 45 seconds\n keepStaleBlockListFor: 300e3 // 5 minutes\n};\n\nexport class RegistryV2Reader {\n private readonly v2RootFolderReader: FolderReader;\n private readonly ops: RegistryV2ReaderOps;\n\n constructor(\n private readonly registryReader: FolderReader,\n ops?: Partial<RegistryV2ReaderOps>\n ) {\n this.v2RootFolderReader = registryReader.relativeReader(MainPrefix);\n this.ops = { ...DefaultRegistryV2ReaderOps, ...(ops ?? {}) };\n }\n\n /**\n * Embeds meta infromation relative to registry root.\n * Meta information that looks like:\n *\n * */\n private readonly embeddedGlobalMetaCache = new LRUCache<\n string,\n BlockPackMetaEmbeddedBytes,\n { meta: BlockPackMetaManifest; relativeTo?: BlockPackId }\n >({\n max: 500,\n fetchMethod: async (_key, _staleValue, options) =>\n await retry(async () => {\n const contentReader =\n options.context.relativeTo !== undefined\n ? this.v2RootFolderReader\n .relativeReader(packageContentPrefixInsideV2(options.context.relativeTo))\n .getContentReader()\n : this.v2RootFolderReader.getContentReader();\n return await BlockPackMetaEmbedBytes(contentReader).parseAsync(options.context.meta);\n }, Retry2TimesWithDelay)\n });\n\n private async embedMetaContent(\n id: BlockPackId,\n sha256: string,\n absolutePath: boolean,\n meta: BlockPackMetaManifest\n ): Promise<BlockPackMetaEmbeddedBytes> {\n return await this.embeddedGlobalMetaCache.forceFetch(\n canonicalize({ id, sha256, absolutePath })!,\n { context: { meta, relativeTo: absolutePath ? undefined : id } }\n );\n }\n\n private listCacheTimestamp: number = 0;\n private listCache: BlockPackOverviewNoRegLabel[] | undefined = undefined;\n\n public async listBlockPacks(): Promise<BlockPackOverviewNoRegLabel[]> {\n if (\n this.listCache !== undefined &&\n Date.now() - this.listCacheTimestamp <= this.ops.cacheBlockListFor\n )\n return this.listCache;\n try {\n return await retry(async () => {\n // const rootContentReader = this.v2RootFolderReader.getContentReader();\n const globalOverview = GlobalOverviewReg.parse(\n JSON.parse(\n Buffer.from(await this.v2RootFolderReader.readFile(GlobalOverviewFileName)).toString()\n )\n );\n\n const result = await Promise.all(\n globalOverview.packages.map(async (p) => {\n const byChannelEntries = await Promise.all(\n Object.entries(p.latestByChannel).map(async ([channel, data]) => [\n channel,\n {\n id: data.description.id,\n meta: await this.embedMetaContent(\n p.latest.id,\n p.latestManifestSha256,\n true,\n p.latest.meta\n ),\n spec: {\n type: 'from-registry-v2',\n id: p.latest.id,\n registryUrl: this.registryReader.rootUrl.toString(),\n channel\n }\n }\n ])\n );\n return {\n id: p.id,\n latestByChannel: Object.fromEntries(byChannelEntries),\n allVersions: p.allVersionsWithChannels\n } satisfies BlockPackOverviewNoRegLabel;\n })\n );\n\n this.listCache = result;\n this.listCacheTimestamp = Date.now();\n\n return result;\n }, Retry2TimesWithDelay);\n } catch (e: unknown) {\n if (\n this.listCache !== undefined &&\n Date.now() - this.listCacheTimestamp <= this.ops.keepStaleBlockListFor\n )\n return this.listCache;\n throw e;\n }\n }\n\n public async getLatestOverview(\n id: BlockPackIdNoVersion,\n channel: string\n ): Promise<SingleBlockPackOverview | undefined> {\n return await retry(async () => {\n const overview = (await this.listBlockPacks()).find((e) =>\n blockPackIdNoVersionEquals(id, e.id)\n );\n if (overview === undefined) return undefined;\n return overview.latestByChannel[channel];\n }, Retry2TimesWithDelay);\n }\n\n public async getSpecificOverview(\n id: BlockPackId,\n channel: string\n ): Promise<SingleBlockPackOverview> {\n return await retry(async () => {\n const manifestContent = await this.v2RootFolderReader.readFile(\n packageContentPrefixInsideV2(id) + ManifestSuffix\n );\n const overview = BlockPackManifest.parse(JSON.parse(Buffer.from(manifestContent).toString()));\n return {\n id: id,\n meta: await this.embedMetaContent(\n id,\n await calculateSha256(manifestContent),\n false,\n overview.description.meta\n ),\n spec: {\n type: 'from-registry-v2',\n id,\n registryUrl: this.registryReader.rootUrl.toString(),\n channel\n }\n };\n }, Retry2TimesWithDelay);\n }\n\n private readonly componentsCache = new LRUCache<string, BlockComponentsAbsoluteUrl, BlockPackId>({\n max: 500,\n fetchMethod: async (key, staleValue, { context: id }) =>\n await retry(async () => {\n const packageFolderReader = this.v2RootFolderReader.relativeReader(\n packageContentPrefixInsideV2(id)\n );\n const manifest = BlockPackManifest.parse(\n JSON.parse(Buffer.from(await packageFolderReader.readFile(ManifestFileName)).toString())\n );\n return BlockComponentsAbsoluteUrl(packageFolderReader.rootUrl.toString()).parse(\n manifest.description.components\n );\n }, Retry2TimesWithDelay)\n });\n\n public async getComponents(id: BlockPackId): Promise<BlockComponentsAbsoluteUrl> {\n return await this.componentsCache.forceFetch(canonicalize(id)!, { context: id });\n }\n}\n","import { Dispatcher, request } from 'undici';\nimport { RelativeContentReader } from '../v2';\nimport path from 'node:path';\nimport pathPosix from 'node:path/posix';\nimport fsp from 'node:fs/promises';\nimport { defaultHttpDispatcher } from '@milaboratories/pl-http';\n\nexport interface FolderReader {\n readonly rootUrl: URL;\n relativeReader(relativePath: string): FolderReader;\n readFile(file: string): Promise<Buffer>;\n getContentReader(relativePath?: string): RelativeContentReader;\n}\n\nclass HttpFolderReader implements FolderReader {\n constructor(\n public readonly rootUrl: URL,\n private readonly httpDispatcher: Dispatcher\n ) {}\n\n public async readFile(file: string): Promise<Buffer> {\n const targetUrl = new URL(file, this.rootUrl);\n const response = await request(targetUrl, {\n dispatcher: this.httpDispatcher\n });\n return Buffer.from(await response.body.arrayBuffer());\n }\n\n public relativeReader(relativePath: string): HttpFolderReader {\n if (!relativePath.endsWith('/')) relativePath = relativePath + '/';\n return new HttpFolderReader(new URL(relativePath, this.rootUrl), this.httpDispatcher);\n }\n\n public getContentReader(relativePath?: string): RelativeContentReader {\n let reader: HttpFolderReader = this;\n if (relativePath !== undefined) reader = reader.relativeReader(relativePath);\n return (path) => reader.readFile(path);\n }\n}\n\nclass FSFolderReader implements FolderReader {\n constructor(\n public readonly rootUrl: URL,\n private readonly root: string\n ) {}\n\n public async readFile(file: string): Promise<Buffer> {\n const targetPath = path.join(this.root, ...file.split(pathPosix.sep));\n return await fsp.readFile(targetPath);\n }\n\n public relativeReader(relativePath: string): FSFolderReader {\n if (!relativePath.endsWith('/')) relativePath = relativePath + '/';\n return new FSFolderReader(\n new URL(relativePath, this.rootUrl),\n path.join(this.root, ...relativePath.split(pathPosix.sep))\n );\n }\n\n public getContentReader(relativePath?: string): RelativeContentReader {\n let reader: FSFolderReader = this;\n if (relativePath !== undefined) reader = reader.relativeReader(relativePath);\n return (path) => reader.readFile(path);\n }\n}\n\nfunction posixToLocalPath(p: string): string {\n return p.split(pathPosix.sep).join(path.sep);\n}\n\nfunction localToPosix(p: string): string {\n return p.split(path.sep).join(pathPosix.sep);\n}\n\nexport function folderReaderByUrl(address: string, httpDispatcher?: Dispatcher): FolderReader {\n if (!address.endsWith('/')) address = address + '/';\n const url = new URL(address, `file:${localToPosix(path.resolve('.'))}/`);\n switch (url.protocol) {\n case 'file:':\n const rootPath = posixToLocalPath(url.pathname);\n return new FSFolderReader(url, rootPath);\n case 'https:':\n case 'http:':\n return new HttpFolderReader(url, httpDispatcher ?? defaultHttpDispatcher());\n default:\n throw new Error(`Unknown protocol: ${url.protocol}`);\n }\n}\n"],"names":["DefaultRegistryV2ReaderOps","RegistryV2Reader","registryReader","ops","__publicField","LRUCache","_key","_staleValue","options","retry","contentReader","packageContentPrefixInsideV2","BlockPackMetaEmbedBytes","Retry2TimesWithDelay","key","staleValue","id","packageFolderReader","manifest","BlockPackManifest","ManifestFileName","BlockComponentsAbsoluteUrl","MainPrefix","sha256","absolutePath","meta","canonicalize","globalOverview","GlobalOverviewReg","GlobalOverviewFileName","result","p","byChannelEntries","channel","data","e","overview","blockPackIdNoVersionEquals","manifestContent","ManifestSuffix","calculateSha256","HttpFolderReader","rootUrl","httpDispatcher","file","targetUrl","response","request","relativePath","reader","path","FSFolderReader","root","targetPath","pathPosix","fsp","posixToLocalPath","localToPosix","folderReaderByUrl","address","url","rootPath","defaultHttpDispatcher"],"mappings":"upBAkCMA,EAAkD,CACtD,kBAAmB,KACnB,sBAAuB,GACzB,EAEO,MAAMC,CAAiB,CAI5B,YACmBC,EACjBC,EACA,CANeC,EAAA,2BACAA,EAAA,YAeAA,EAAA,+BAA0B,IAAIC,EAAAA,SAI7C,CACA,IAAK,IACL,YAAa,MAAOC,EAAMC,EAAaC,IACrC,MAAMC,QAAM,SAAY,CACtB,MAAMC,EACJF,EAAQ,QAAQ,aAAe,OAC3B,KAAK,mBACF,eAAe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{
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import f from "
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var y = (o, e, a) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[e] = a;
|
|
3
|
+
var r = (o, e, a) => y(o, typeof e != "symbol" ? e + "" : e, a);
|
|
4
|
+
import { e as w, p as d, f as R, G as C, h as P, i as B, j as F, M as b, k as x, m as O, n as T, o as S, q as D, r as M, t as U, u as E, v as L, P as V, w as G, x as N, y as j } from "./config-dqDSqXfz.mjs";
|
|
5
|
+
import { U as me, T as fe, Y as ve, ad as ge, W as ke, X as ue, O as ye, a as we, B as Re, Q as Ce, b as Pe, a1 as Be, a0 as Fe, F as be, ac as xe, aa as Oe, ab as Te, a9 as Se, af as De, ae as Me, a4 as Ue, $ as Ee, a3 as Le, V as Ve, R as Ge, z as Ne, S as je, D as Ae, E as Je, C as We, d as Ie, H as _e, c as ze, l as qe, A as $e, I as He, a8 as Ye, a7 as Ke, a2 as Qe, a6 as Xe, a5 as Ze, Z as ea, K as aa, L as ta, N as oa, J as sa, s as ra, _ as ia } from "./config-dqDSqXfz.mjs";
|
|
6
|
+
import { request as A } from "undici";
|
|
7
|
+
import l from "node:path";
|
|
8
|
+
import p from "node:path/posix";
|
|
9
|
+
import J from "node:fs/promises";
|
|
10
|
+
import { defaultHttpDispatcher as W } from "@milaboratories/pl-http";
|
|
11
|
+
import { blockPackIdNoVersionEquals as I, BlockPackManifest as f } from "@milaboratories/pl-model-middle-layer";
|
|
12
|
+
import v from "canonicalize";
|
|
12
13
|
import "zod";
|
|
13
14
|
import "mime-types";
|
|
14
15
|
import "tar";
|
|
15
16
|
import "@milaboratories/resolve-helper";
|
|
16
|
-
import { LRUCache as
|
|
17
|
-
|
|
17
|
+
import { LRUCache as g } from "lru-cache";
|
|
18
|
+
import { retry as i, Retry2TimesWithDelay as n } from "@milaboratories/ts-helpers";
|
|
19
|
+
const _ = {
|
|
18
20
|
cacheBlockListFor: 45e3,
|
|
19
21
|
// 45 seconds
|
|
20
22
|
keepStaleBlockListFor: 3e5
|
|
21
23
|
// 5 minutes
|
|
22
24
|
};
|
|
23
|
-
class
|
|
25
|
+
class le {
|
|
24
26
|
constructor(e, a) {
|
|
25
27
|
r(this, "v2RootFolderReader");
|
|
26
28
|
r(this, "ops");
|
|
@@ -29,33 +31,33 @@ class se {
|
|
|
29
31
|
* Meta information that looks like:
|
|
30
32
|
*
|
|
31
33
|
* */
|
|
32
|
-
r(this, "embeddedGlobalMetaCache", new
|
|
34
|
+
r(this, "embeddedGlobalMetaCache", new g({
|
|
33
35
|
max: 500,
|
|
34
|
-
fetchMethod: async (e, a, t) => {
|
|
36
|
+
fetchMethod: async (e, a, t) => await i(async () => {
|
|
35
37
|
const s = t.context.relativeTo !== void 0 ? this.v2RootFolderReader.relativeReader(d(t.context.relativeTo)).getContentReader() : this.v2RootFolderReader.getContentReader();
|
|
36
|
-
return await
|
|
37
|
-
}
|
|
38
|
+
return await R(s).parseAsync(t.context.meta);
|
|
39
|
+
}, n)
|
|
38
40
|
}));
|
|
39
41
|
r(this, "listCacheTimestamp", 0);
|
|
40
42
|
r(this, "listCache");
|
|
41
|
-
r(this, "componentsCache", new
|
|
43
|
+
r(this, "componentsCache", new g({
|
|
42
44
|
max: 500,
|
|
43
|
-
fetchMethod: async (e, a, { context: t }) => {
|
|
45
|
+
fetchMethod: async (e, a, { context: t }) => await i(async () => {
|
|
44
46
|
const s = this.v2RootFolderReader.relativeReader(
|
|
45
47
|
d(t)
|
|
46
|
-
),
|
|
47
|
-
JSON.parse(Buffer.from(await s.readFile(
|
|
48
|
+
), c = f.parse(
|
|
49
|
+
JSON.parse(Buffer.from(await s.readFile(b)).toString())
|
|
48
50
|
);
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
+
return x(s.rootUrl.toString()).parse(
|
|
52
|
+
c.description.components
|
|
51
53
|
);
|
|
52
|
-
}
|
|
54
|
+
}, n)
|
|
53
55
|
}));
|
|
54
|
-
this.registryReader = e, this.v2RootFolderReader = e.relativeReader(
|
|
56
|
+
this.registryReader = e, this.v2RootFolderReader = e.relativeReader(w), this.ops = { ..._, ...a ?? {} };
|
|
55
57
|
}
|
|
56
58
|
async embedMetaContent(e, a, t, s) {
|
|
57
59
|
return await this.embeddedGlobalMetaCache.forceFetch(
|
|
58
|
-
|
|
60
|
+
v({ id: e, sha256: a, absolutePath: t }),
|
|
59
61
|
{ context: { meta: s, relativeTo: t ? void 0 : e } }
|
|
60
62
|
);
|
|
61
63
|
}
|
|
@@ -63,40 +65,42 @@ class se {
|
|
|
63
65
|
if (this.listCache !== void 0 && Date.now() - this.listCacheTimestamp <= this.ops.cacheBlockListFor)
|
|
64
66
|
return this.listCache;
|
|
65
67
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
return await i(async () => {
|
|
69
|
+
const e = C.parse(
|
|
70
|
+
JSON.parse(
|
|
71
|
+
Buffer.from(await this.v2RootFolderReader.readFile(P)).toString()
|
|
72
|
+
)
|
|
73
|
+
), a = await Promise.all(
|
|
74
|
+
e.packages.map(async (t) => {
|
|
75
|
+
const s = await Promise.all(
|
|
76
|
+
Object.entries(t.latestByChannel).map(async ([c, k]) => [
|
|
77
|
+
c,
|
|
78
|
+
{
|
|
79
|
+
id: k.description.id,
|
|
80
|
+
meta: await this.embedMetaContent(
|
|
81
|
+
t.latest.id,
|
|
82
|
+
t.latestManifestSha256,
|
|
83
|
+
!0,
|
|
84
|
+
t.latest.meta
|
|
85
|
+
),
|
|
86
|
+
spec: {
|
|
87
|
+
type: "from-registry-v2",
|
|
88
|
+
id: t.latest.id,
|
|
89
|
+
registryUrl: this.registryReader.rootUrl.toString(),
|
|
90
|
+
channel: c
|
|
91
|
+
}
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
])
|
|
94
|
+
);
|
|
95
|
+
return {
|
|
96
|
+
id: t.id,
|
|
97
|
+
latestByChannel: Object.fromEntries(s),
|
|
98
|
+
allVersions: t.allVersionsWithChannels
|
|
99
|
+
};
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
return this.listCache = a, this.listCacheTimestamp = Date.now(), a;
|
|
103
|
+
}, n);
|
|
100
104
|
} catch (e) {
|
|
101
105
|
if (this.listCache !== void 0 && Date.now() - this.listCacheTimestamp <= this.ops.keepStaleBlockListFor)
|
|
102
106
|
return this.listCache;
|
|
@@ -104,63 +108,70 @@ class se {
|
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
async getLatestOverview(e, a) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
return await i(async () => {
|
|
112
|
+
const t = (await this.listBlockPacks()).find(
|
|
113
|
+
(s) => I(e, s.id)
|
|
114
|
+
);
|
|
115
|
+
if (t !== void 0)
|
|
116
|
+
return t.latestByChannel[a];
|
|
117
|
+
}, n);
|
|
112
118
|
}
|
|
113
|
-
async getSpecificOverview(e) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await P(a),
|
|
120
|
-
!1,
|
|
121
|
-
t.description.meta
|
|
122
|
-
),
|
|
123
|
-
spec: {
|
|
124
|
-
type: "from-registry-v2",
|
|
119
|
+
async getSpecificOverview(e, a) {
|
|
120
|
+
return await i(async () => {
|
|
121
|
+
const t = await this.v2RootFolderReader.readFile(
|
|
122
|
+
d(e) + B
|
|
123
|
+
), s = f.parse(JSON.parse(Buffer.from(t).toString()));
|
|
124
|
+
return {
|
|
125
125
|
id: e,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
meta: await this.embedMetaContent(
|
|
127
|
+
e,
|
|
128
|
+
await F(t),
|
|
129
|
+
!1,
|
|
130
|
+
s.description.meta
|
|
131
|
+
),
|
|
132
|
+
spec: {
|
|
133
|
+
type: "from-registry-v2",
|
|
134
|
+
id: e,
|
|
135
|
+
registryUrl: this.registryReader.rootUrl.toString(),
|
|
136
|
+
channel: a
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}, n);
|
|
129
140
|
}
|
|
130
141
|
async getComponents(e) {
|
|
131
|
-
return await this.componentsCache.forceFetch(
|
|
142
|
+
return await this.componentsCache.forceFetch(v(e), { context: e });
|
|
132
143
|
}
|
|
133
144
|
}
|
|
134
|
-
class
|
|
145
|
+
class h {
|
|
135
146
|
constructor(e, a) {
|
|
136
147
|
this.rootUrl = e, this.httpDispatcher = a;
|
|
137
148
|
}
|
|
138
149
|
async readFile(e) {
|
|
139
|
-
const a = new URL(e, this.rootUrl), t = await
|
|
150
|
+
const a = new URL(e, this.rootUrl), t = await A(a, {
|
|
140
151
|
dispatcher: this.httpDispatcher
|
|
141
152
|
});
|
|
142
153
|
return Buffer.from(await t.body.arrayBuffer());
|
|
143
154
|
}
|
|
144
155
|
relativeReader(e) {
|
|
145
|
-
return e.endsWith("/") || (e = e + "/"), new
|
|
156
|
+
return e.endsWith("/") || (e = e + "/"), new h(new URL(e, this.rootUrl), this.httpDispatcher);
|
|
146
157
|
}
|
|
147
158
|
getContentReader(e) {
|
|
148
159
|
let a = this;
|
|
149
160
|
return e !== void 0 && (a = a.relativeReader(e)), (t) => a.readFile(t);
|
|
150
161
|
}
|
|
151
162
|
}
|
|
152
|
-
class
|
|
163
|
+
class m {
|
|
153
164
|
constructor(e, a) {
|
|
154
165
|
this.rootUrl = e, this.root = a;
|
|
155
166
|
}
|
|
156
167
|
async readFile(e) {
|
|
157
|
-
const a =
|
|
158
|
-
return await
|
|
168
|
+
const a = l.join(this.root, ...e.split(p.sep));
|
|
169
|
+
return await J.readFile(a);
|
|
159
170
|
}
|
|
160
171
|
relativeReader(e) {
|
|
161
|
-
return e.endsWith("/") || (e = e + "/"), new
|
|
172
|
+
return e.endsWith("/") || (e = e + "/"), new m(
|
|
162
173
|
new URL(e, this.rootUrl),
|
|
163
|
-
|
|
174
|
+
l.join(this.root, ...e.split(p.sep))
|
|
164
175
|
);
|
|
165
176
|
}
|
|
166
177
|
getContentReader(e) {
|
|
@@ -168,100 +179,100 @@ class p {
|
|
|
168
179
|
return e !== void 0 && (a = a.relativeReader(e)), (t) => a.readFile(t);
|
|
169
180
|
}
|
|
170
181
|
}
|
|
171
|
-
function
|
|
172
|
-
return o.split(
|
|
182
|
+
function z(o) {
|
|
183
|
+
return o.split(p.sep).join(l.sep);
|
|
173
184
|
}
|
|
174
|
-
function
|
|
175
|
-
return o.split(
|
|
185
|
+
function q(o) {
|
|
186
|
+
return o.split(l.sep).join(p.sep);
|
|
176
187
|
}
|
|
177
|
-
function
|
|
188
|
+
function ce(o, e) {
|
|
178
189
|
o.endsWith("/") || (o = o + "/");
|
|
179
|
-
const a = new URL(o, `file:${
|
|
190
|
+
const a = new URL(o, `file:${q(l.resolve("."))}/`);
|
|
180
191
|
switch (a.protocol) {
|
|
181
192
|
case "file:":
|
|
182
|
-
const t =
|
|
183
|
-
return new
|
|
193
|
+
const t = z(a.pathname);
|
|
194
|
+
return new m(a, t);
|
|
184
195
|
case "https:":
|
|
185
196
|
case "http:":
|
|
186
|
-
return new
|
|
197
|
+
return new h(a, e ?? W());
|
|
187
198
|
default:
|
|
188
199
|
throw new Error(`Unknown protocol: ${a.protocol}`);
|
|
189
200
|
}
|
|
190
201
|
}
|
|
191
|
-
const
|
|
202
|
+
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
192
203
|
__proto__: null,
|
|
193
|
-
GlobalOverviewPath:
|
|
194
|
-
MetaFile:
|
|
195
|
-
PlPackageConfigData:
|
|
196
|
-
PlPackageJsonConfigFile:
|
|
197
|
-
PlPackageYamlConfigFile:
|
|
198
|
-
PlRegCommonConfigData:
|
|
199
|
-
PlRegFullPackageConfigData:
|
|
200
|
-
PlRegPackageConfig:
|
|
201
|
-
PlRegPackageConfigDataShard:
|
|
202
|
-
packageContentPrefix:
|
|
203
|
-
packageOverviewPath:
|
|
204
|
-
payloadFilePath:
|
|
204
|
+
GlobalOverviewPath: O,
|
|
205
|
+
MetaFile: T,
|
|
206
|
+
PlPackageConfigData: S,
|
|
207
|
+
PlPackageJsonConfigFile: D,
|
|
208
|
+
PlPackageYamlConfigFile: M,
|
|
209
|
+
PlRegCommonConfigData: U,
|
|
210
|
+
PlRegFullPackageConfigData: E,
|
|
211
|
+
PlRegPackageConfig: L,
|
|
212
|
+
PlRegPackageConfigDataShard: V,
|
|
213
|
+
packageContentPrefix: G,
|
|
214
|
+
packageOverviewPath: N,
|
|
215
|
+
payloadFilePath: j
|
|
205
216
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
206
217
|
export {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
218
|
+
x as BlockComponentsAbsoluteUrl,
|
|
219
|
+
me as BlockComponentsConsolidate,
|
|
220
|
+
fe as BlockComponentsDescription,
|
|
221
|
+
ve as BlockDescriptionPackageJsonField,
|
|
222
|
+
ge as BlockDescriptionToExplicitBinaryBytes,
|
|
223
|
+
ke as BlockPackDescriptionConsolidateToFolder,
|
|
224
|
+
ue as BlockPackDescriptionManifestAddRelativePathPrefix,
|
|
225
|
+
ye as BlockPackMetaConsolidate,
|
|
226
|
+
we as BlockPackMetaDescription,
|
|
227
|
+
Re as BlockPackMetaEmbedAbsoluteBase64,
|
|
228
|
+
Ce as BlockPackMetaEmbedAbsoluteBytes,
|
|
229
|
+
R as BlockPackMetaEmbedBytes,
|
|
230
|
+
Pe as BlockRegistryV2,
|
|
231
|
+
Be as ChannelNameRegexp,
|
|
232
|
+
Fe as ChannelsFolder,
|
|
233
|
+
be as FSStorage,
|
|
234
|
+
xe as GlobalOverview,
|
|
235
|
+
Oe as GlobalOverviewEntry,
|
|
236
|
+
Te as GlobalOverviewEntryReg,
|
|
237
|
+
P as GlobalOverviewFileName,
|
|
238
|
+
Se as GlobalOverviewPath,
|
|
239
|
+
C as GlobalOverviewReg,
|
|
240
|
+
De as GlobalOverviewToExplicitBinaryBase64,
|
|
241
|
+
Me as GlobalOverviewToExplicitBinaryBytes,
|
|
242
|
+
w as MainPrefix,
|
|
243
|
+
b as ManifestFileName,
|
|
244
|
+
B as ManifestSuffix,
|
|
245
|
+
Ue as PackageOverview,
|
|
246
|
+
Ee as PackageOverviewFileName,
|
|
247
|
+
Le as PackageOverviewVersionEntry,
|
|
248
|
+
pe as RegistryV1,
|
|
249
|
+
le as RegistryV2Reader,
|
|
250
|
+
Ve as ResolvedBlockPackDescriptionFromPackageJson,
|
|
251
|
+
Ge as ResolvedModuleFile,
|
|
252
|
+
Ne as ResolvedModuleFolder,
|
|
253
|
+
je as S3Storage,
|
|
254
|
+
Ae as absoluteToBase64,
|
|
255
|
+
Je as absoluteToBytes,
|
|
256
|
+
We as absoluteToString,
|
|
257
|
+
Ie as buildBlockPackDist,
|
|
258
|
+
_e as cpAbsoluteToRelative,
|
|
259
|
+
ce as folderReaderByUrl,
|
|
260
|
+
ze as loadPackDescription,
|
|
261
|
+
qe as loadPackDescriptionRaw,
|
|
262
|
+
$e as mapLocalToAbsolute,
|
|
263
|
+
He as packFolderToRelativeTgz,
|
|
264
|
+
Ye as packageChannelPrefix,
|
|
265
|
+
Ke as packageChannelPrefixInsideV2,
|
|
266
|
+
Qe as packageContentPrefix,
|
|
256
267
|
d as packageContentPrefixInsideV2,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
268
|
+
Xe as packageOverviewPath,
|
|
269
|
+
Ze as packageOverviewPathInsideV2,
|
|
270
|
+
ea as parsePackageName,
|
|
271
|
+
aa as relativeToContentString,
|
|
272
|
+
ta as relativeToExplicitBinary64,
|
|
273
|
+
oa as relativeToExplicitBytes,
|
|
274
|
+
sa as relativeToExplicitString,
|
|
275
|
+
ra as storageByUrl,
|
|
276
|
+
ia as tryLoadPackDescription
|
|
266
277
|
};
|
|
267
278
|
//# sourceMappingURL=index.mjs.map
|