@platforma-sdk/block-tools 2.5.3 → 2.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{config-Dvh9BG_1.mjs → config-BhgCn4u4.mjs} +62 -59
- package/dist/config-BhgCn4u4.mjs.map +1 -0
- package/dist/config-CnMHgekz.js +3 -0
- package/dist/config-CnMHgekz.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +191 -178
- package/dist/index.mjs.map +1 -1
- package/dist/v2/model/block_components.d.ts +5 -5
- package/dist/v2/model/block_description.d.ts +48 -48
- package/dist/v2/registry/registry_reader.d.ts +4 -1
- package/dist/v2/registry/registry_reader.d.ts.map +1 -1
- package/dist/v2/registry/schema_public.d.ts +639 -639
- package/dist/v2/source_package.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/v2/registry/registry.test.ts +52 -1
- package/src/v2/registry/registry_reader.ts +48 -7
- package/src/v2/source_package.ts +2 -2
- package/dist/config-B2n8i1gx.js +0 -3
- package/dist/config-B2n8i1gx.js.map +0 -1
- package/dist/config-Dvh9BG_1.mjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var O=Object.defineProperty;var L=(o,e,t)=>e in o?O(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var r=(o,e,t)=>L(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@oclif/core"),d=require("node:path"),m=require("node:fs");require("zod");require("mime-types");require("tar");require("@milaboratories/resolve-helper");const i=require("./config-
|
|
1
|
+
"use strict";var O=Object.defineProperty;var L=(o,e,t)=>e in o?O(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var r=(o,e,t)=>L(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@oclif/core"),d=require("node:path"),m=require("node:fs");require("zod");require("mime-types");require("tar");require("@milaboratories/resolve-helper");const i=require("./config-CnMHgekz.js"),k=require("@milaboratories/pl-model-middle-layer");require("@milaboratories/ts-helpers");require("canonicalize");require("lru-cache");require("undici");require("@milaboratories/pl-http");const F=require("@milaboratories/ts-helpers-oclif"),C=require("yaml"),f=class f extends a.Command{async run(){const{flags:e}=await this.parse(f),t=d.resolve(e.modulePath),s=await i.loadPackDescriptionRaw(t),n=await i.BlockPackMetaEmbedAbsoluteBase64.parseAsync(i.BlockPackMetaDescription(t).parse(s.meta));await m.promises.writeFile(d.resolve(e.destination),JSON.stringify(n))}};r(f,"description","Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section."),r(f,"flags",{modulePath:a.Flags.string({char:"i",summary:"input module path",helpValue:"<path>",default:"."}),destination:a.Flags.string({char:"o",summary:"output meta.json file",helpValue:"<path>",required:!0})});let b=f;async function x(o){try{return await m.promises.readFile(o,"utf8")}catch(e){if(e.code==="ENOENT")return;throw e}}const g=class g extends a.Command{async run(){const{flags:e}=await this.parse(g),t=d.resolve(e.modulePath);let{model:s,platforma:n}=require(t);if(s||(s=n),!s)throw new Error('"model" export not found');const{config:l}=s;if(!l)throw new Error('Malformed "model" object, check it is created with "BlockModel" and ".done()" is executed as the call in the chain.');if(!("canRun"in l||"inputsValid"in l)||!("outputs"in l)||!("sections"in l))throw new Error('"config" has unexpected structure');const u=await x(e.sourceBundle);u!==void 0&&(l.code={type:"plain",content:u}),await m.promises.writeFile(d.resolve(e.destination),JSON.stringify(l))}};r(g,"description","Extracts and outputs block model JSON from pre-built block model module"),r(g,"flags",{modulePath:a.Flags.string({char:"i",summary:"input module path",helpValue:"<path>",default:"."}),sourceBundle:a.Flags.string({char:"b",summary:"bundled model code to embed into the model for callback-based rendering to work",helpValue:"<path>",default:"./dist/bundle.js"}),destination:a.Flags.string({char:"o",summary:"output model file",helpValue:"<path>",default:"./dist/model.json"})});let P=g;const h=class h extends a.Command{async run(){const{flags:e}=await this.parse(h);let t=await i.loadPackDescriptionRaw(d.resolve(e.modulePath));e["version-override"]&&(t=k.overrideDescriptionVersion(t,e["version-override"]));const s=i.storageByUrl(e.registry),n=new i.BlockRegistryV2(s,new F.OclifLoggerAdapter(this));e.unmark?await n.removePackageFromChannel(t.id,e.channel):await n.addPackageToChannel(t.id,e.channel),e.refresh&&await n.updateIfNeeded()}};r(h,"description","Mark target block stable"),r(h,"flags",{modulePath:a.Flags.string({char:"i",summary:"input module path",helpValue:"<path>",default:"."}),channel:a.Flags.string({char:"c",hidden:!0,summary:"custom channel",helpValue:"<channel name>",default:k.StableChannel}),"version-override":a.Flags.file({char:"v",summary:"override package version"}),registry:a.Flags.string({char:"r",summary:"full address of the registry",helpValue:"<address>",env:"PL_REGISTRY",required:!0}),refresh:a.Flags.boolean({summary:"refresh repository after adding the package",default:!0,allowNo:!0,env:"PL_REGISTRY_REFRESH"}),unmark:a.Flags.boolean({summary:'reverses meaning of this command, flag can be used to remove "stable" flag from the package',default:!1})});let R=h;const p=class p extends a.Command{async run(){const{flags:e}=await this.parse(p),t=await i.loadPackDescription(d.resolve(e.modulePath));await i.buildBlockPackDist(t,d.resolve(e.destinationPath))}};r(p,"description","Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder"),r(p,"flags",{modulePath:a.Flags.string({char:"i",summary:"input module path",helpValue:"<path>",default:"."}),destinationPath:a.Flags.string({char:"o",summary:"output folder",helpValue:"<path>",default:"./block-pack"})});let E=p;const y=class y extends a.Command{async run(){const{flags:e}=await this.parse(y),t=d.resolve(e.manifest);let s=k.BlockPackManifest.parse(JSON.parse(await m.promises.readFile(t,{encoding:"utf-8"})));const n=d.dirname(t);this.log(`Manifest root = ${n}`),e["version-override"]&&(s=k.overrideManifestVersion(s,e["version-override"]));const l=i.storageByUrl(e.registry),u=new i.BlockRegistryV2(l,new F.OclifLoggerAdapter(this));await u.publishPackage(s,async c=>Buffer.from(await m.promises.readFile(d.resolve(n,c)))),e.refresh&&await u.updateIfNeeded()}};r(y,"description","Publishes the block package and refreshes the registry (for v2 block-pack schema)"),r(y,"flags",{registry:a.Flags.string({char:"r",summary:"full address of the registry",helpValue:"<address>",env:"PL_REGISTRY",required:!0}),manifest:a.Flags.file({char:"m",summary:"manifest file path",exists:!0,default:`./block-pack/${i.ManifestFileName}`}),"version-override":a.Flags.file({char:"v",summary:"override package version"}),refresh:a.Flags.boolean({summary:"refresh repository after adding the package",default:!0,allowNo:!0,env:"PL_REGISTRY_REFRESH"})});let N=y;const w=class w extends a.Command{async run(){const{flags:e}=await this.parse(w),t=i.storageByUrl(e.registry);await new i.BlockRegistryV2(t,new F.OclifLoggerAdapter(this)).updateIfNeeded(e.mode)}};r(w,"description","Refresh overview files based on published but not proecessed artefacts"),r(w,"flags",{registry:a.Flags.string({char:"r",summary:"full address of the registry",helpValue:"<address>",env:"PL_REGISTRY",required:!0}),mode:a.Flags.string({char:"m",summary:'refresh mode (allowed valiues: "force", "normal", "dry-run")',helpValue:"<mode>",options:["force","normal","dry-run"],env:"PL_REGISTRY_REFRESH_DRY_RUN",default:"normal"})});let q=w;function I(o){const e=o.match(/(?<destName>[^\/\\]+)=(?<src>.*)/);if(e){const{src:t,destName:s}=e.groups;return{src:t,destName:s}}else return{src:o,destName:d.basename(o)}}const T=a.Flags.custom({summary:"target files to upload",helpValue:"file_path | package_name=file_path",parse:async o=>I(o)}),G=["registry","organization","package","version"],v=class v extends a.Command{async run(){const{flags:e}=await this.parse(v),t=i.PlRegPackageConfigDataShard.parse({});for(const c of G)e[c]&&(t[c]=e[c]);e.meta&&(e.meta.endsWith(".json")?t.meta=JSON.parse(await m.promises.readFile(e.meta,{encoding:"utf-8"})):e.meta.endsWith(".yaml")&&(t.meta=C.parse(await m.promises.readFile(e.meta,{encoding:"utf-8"}))));for(const c of e.file)t.files[c.destName]=c.src;const s=await i.getConfig(t);this.log(C.stringify(s.conf));const n=s.createRegistry(new F.OclifLoggerAdapter(this)),l=s.fullPackageName,u=n.constructNewPackage(l);for(const[c,V]of Object.entries(s.conf.files)){this.log(`Uploading ${V} -> ${c} ...`);const A=await m.promises.readFile(V);await u.addFile(c,A)}this.log("Uploading meta information..."),await u.writeMeta(s.conf.meta),await u.finish(),e.refresh&&await n.updateIfNeeded()}};r(v,"description","Uploads V1 package and refreshes the registry"),r(v,"flags",{registry:a.Flags.string({char:"r",summary:"full address of the registry or alias from .pl.reg",helpValue:"<address|alias>",env:"PL_REGISTRY"}),organization:a.Flags.string({char:"o",summary:"target organisation",env:"PL_PACKAGE_ORGANIZATION"}),package:a.Flags.string({char:"p",summary:"target package",env:"PL_PACKAGE_NAME"}),version:a.Flags.string({char:"v",summary:"target version",env:"PL_PACKAGE_VERSION"}),meta:a.Flags.file({char:"m",summary:"json file containing meta information to associate with tha package",exists:!0}),file:T({char:"f",summary:"package files",multiple:!0,default:[]}),refresh:a.Flags.boolean({summary:"refresh repository after adding the package",default:!0,allowNo:!0,env:"PL_REGISTRY_REFRESH"})});let S=v;const j={"build-meta":b,"build-model":P,"mark-stable":R,pack:E,publish:N,"refresh-registry":q,"upload-package-v1":S};exports.COMMANDS=j;
|
|
2
2
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import "zod";
|
|
|
8
8
|
import "mime-types";
|
|
9
9
|
import "tar";
|
|
10
10
|
import "@milaboratories/resolve-helper";
|
|
11
|
-
import { l as L, B as T, a as Y, s as V, b as x, c as j, d as D, M, P as q, g as B } from "./config-
|
|
11
|
+
import { l as L, B as T, a as Y, s as V, b as x, c as j, d as D, M, P as q, g as B } from "./config-BhgCn4u4.mjs";
|
|
12
12
|
import { StableChannel as J, overrideDescriptionVersion as H, BlockPackManifest as _, overrideManifestVersion as $ } from "@milaboratories/pl-model-middle-layer";
|
|
13
13
|
import "@milaboratories/ts-helpers";
|
|
14
14
|
import "canonicalize";
|
|
@@ -265,9 +265,11 @@ async function Ei(r, e) {
|
|
|
265
265
|
version: ze.parse(s.version)
|
|
266
266
|
}
|
|
267
267
|
}, c = await xt(r).safeParseAsync(i);
|
|
268
|
-
|
|
268
|
+
if (c.success) return c.data;
|
|
269
|
+
e == null || e.warn(c.error);
|
|
270
|
+
return;
|
|
269
271
|
} catch (s) {
|
|
270
|
-
e == null || e.
|
|
272
|
+
e == null || e.warn(s);
|
|
271
273
|
return;
|
|
272
274
|
}
|
|
273
275
|
}
|
|
@@ -1625,76 +1627,77 @@ async function Ni(r) {
|
|
|
1625
1627
|
);
|
|
1626
1628
|
}
|
|
1627
1629
|
export {
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
+
Ei as $,
|
|
1631
|
+
Or as A,
|
|
1630
1632
|
pi as B,
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1633
|
+
nt as C,
|
|
1634
|
+
Gt as D,
|
|
1635
|
+
Nr as E,
|
|
1634
1636
|
Va as F,
|
|
1635
1637
|
Tt as G,
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1638
|
+
Pr as H,
|
|
1639
|
+
_e as I,
|
|
1640
|
+
kr as J,
|
|
1641
|
+
Me as K,
|
|
1642
|
+
Lr as L,
|
|
1641
1643
|
ce as M,
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
+
hi as N,
|
|
1645
|
+
de as O,
|
|
1644
1646
|
tt as P,
|
|
1645
|
-
|
|
1647
|
+
Cr as Q,
|
|
1646
1648
|
Ir as R,
|
|
1647
1649
|
Ua as S,
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1650
|
+
gi as T,
|
|
1651
|
+
Ar as U,
|
|
1652
|
+
Fr as V,
|
|
1653
|
+
xt as W,
|
|
1654
|
+
br as X,
|
|
1655
|
+
at as Y,
|
|
1656
|
+
Be as Z,
|
|
1657
|
+
Ut as _,
|
|
1656
1658
|
Tr as a,
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1659
|
+
ba as a0,
|
|
1660
|
+
xe as a1,
|
|
1661
|
+
Le as a2,
|
|
1662
|
+
oe as a3,
|
|
1663
|
+
Da as a4,
|
|
1664
|
+
kt as a5,
|
|
1665
|
+
Ba as a6,
|
|
1666
|
+
Lt as a7,
|
|
1667
|
+
ja as a8,
|
|
1668
|
+
Ga as a9,
|
|
1669
|
+
xa as aa,
|
|
1670
|
+
Te as ab,
|
|
1671
|
+
Kt as ac,
|
|
1672
|
+
wi as ad,
|
|
1673
|
+
et as ae,
|
|
1674
|
+
Ri as af,
|
|
1675
|
+
yi as ag,
|
|
1676
|
+
Si as ah,
|
|
1674
1677
|
Ii as b,
|
|
1675
1678
|
vi as c,
|
|
1676
1679
|
$i as d,
|
|
1677
|
-
|
|
1678
|
-
|
|
1680
|
+
Ta as e,
|
|
1681
|
+
ee as f,
|
|
1679
1682
|
Ni as g,
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1683
|
+
di as h,
|
|
1684
|
+
Fa as i,
|
|
1685
|
+
_a as j,
|
|
1686
|
+
De as k,
|
|
1684
1687
|
Dr as l,
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
+
mi as m,
|
|
1689
|
+
Ce as n,
|
|
1690
|
+
er as o,
|
|
1688
1691
|
Yt as p,
|
|
1689
|
-
|
|
1690
|
-
|
|
1692
|
+
Xa as q,
|
|
1693
|
+
Wa as r,
|
|
1691
1694
|
za as s,
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1695
|
+
qa as t,
|
|
1696
|
+
Ja as u,
|
|
1697
|
+
Zt as v,
|
|
1698
|
+
ei as w,
|
|
1699
|
+
Oi as x,
|
|
1700
|
+
Ct as y,
|
|
1701
|
+
Qt as z
|
|
1699
1702
|
};
|
|
1700
|
-
//# sourceMappingURL=config-
|
|
1703
|
+
//# sourceMappingURL=config-BhgCn4u4.mjs.map
|