@platforma-sdk/block-tools 2.6.44 → 2.6.45

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.
Files changed (70) hide show
  1. package/README.md +16 -9
  2. package/bin/dev.js +4 -4
  3. package/bin/run.js +3 -3
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cli.mjs +16 -6
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/cmd/index.d.ts +8 -8
  8. package/dist/cmd/mark-stable.d.ts +1 -1
  9. package/dist/cmd/publish.d.ts +1 -1
  10. package/dist/cmd/restore-overview-from-snapshot.d.ts +1 -1
  11. package/dist/{config-DKBY0B2u.mjs → config-Cc8_zV3b.mjs} +48 -17
  12. package/dist/config-Cc8_zV3b.mjs.map +1 -0
  13. package/dist/config-Ycas5fbX.js.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +6 -4
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/registry_v1/config_schema.d.ts +7 -7
  19. package/dist/registry_v1/v1_repo_schema.d.ts +1 -1
  20. package/dist/v2/model/block_components.d.ts +19 -19
  21. package/dist/v2/model/block_description.d.ts +102 -102
  22. package/dist/v2/model/block_meta.d.ts +20 -20
  23. package/dist/v2/model/content_conversion.d.ts +2 -2
  24. package/dist/v2/registry/registry.d.ts +1 -1
  25. package/dist/v2/source_package.d.ts +1 -1
  26. package/package.json +31 -29
  27. package/src/cmd/build-meta.ts +15 -15
  28. package/src/cmd/build-model.ts +23 -26
  29. package/src/cmd/index.ts +20 -20
  30. package/src/cmd/list-overview-snapshots.ts +12 -12
  31. package/src/cmd/mark-stable.ts +30 -33
  32. package/src/cmd/pack.ts +15 -15
  33. package/src/cmd/publish.ts +46 -34
  34. package/src/cmd/refresh-registry.ts +15 -15
  35. package/src/cmd/restore-overview-from-snapshot.ts +27 -25
  36. package/src/cmd/update-deps.ts +8 -8
  37. package/src/cmd/upload-package-v1.ts +33 -33
  38. package/src/common_types.ts +1 -1
  39. package/src/io/folder_reader.test.ts +13 -13
  40. package/src/io/folder_reader.ts +18 -20
  41. package/src/io/index.ts +2 -2
  42. package/src/io/storage.test.ts +48 -48
  43. package/src/io/storage.ts +20 -15
  44. package/src/lib.ts +3 -3
  45. package/src/registry_v1/config.ts +11 -11
  46. package/src/registry_v1/config_schema.ts +5 -5
  47. package/src/registry_v1/flags.ts +4 -4
  48. package/src/registry_v1/index.ts +3 -3
  49. package/src/registry_v1/registry.test.ts +54 -54
  50. package/src/registry_v1/registry.ts +29 -25
  51. package/src/registry_v1/v1_repo_schema.ts +3 -3
  52. package/src/util.ts +6 -9
  53. package/src/v2/build_dist.test.ts +8 -9
  54. package/src/v2/build_dist.ts +10 -13
  55. package/src/v2/index.ts +4 -4
  56. package/src/v2/model/block_components.ts +5 -5
  57. package/src/v2/model/block_description.ts +12 -8
  58. package/src/v2/model/block_meta.ts +4 -5
  59. package/src/v2/model/content_conversion.ts +44 -44
  60. package/src/v2/model/index.ts +4 -4
  61. package/src/v2/registry/index.ts +3 -3
  62. package/src/v2/registry/registry.test.ts +223 -197
  63. package/src/v2/registry/registry.ts +93 -66
  64. package/src/v2/registry/registry_reader.test.ts +15 -15
  65. package/src/v2/registry/registry_reader.ts +29 -27
  66. package/src/v2/registry/schema_internal.ts +11 -10
  67. package/src/v2/registry/schema_public.ts +56 -47
  68. package/src/v2/source_package.test.ts +15 -15
  69. package/src/v2/source_package.ts +33 -26
  70. package/dist/config-DKBY0B2u.mjs.map +0 -1
@@ -191,7 +191,11 @@ function Zr(t) {
191
191
  Bs(t),
192
192
  qs(t)
193
193
  ).transform(async (e, r) => {
194
- const i = Os(JSON.parse(await U.readFile(e.components.model.file, "utf-8"))).featureFlags;
194
+ const i = Os(
195
+ JSON.parse(
196
+ await U.readFile(e.components.model.file, "utf-8")
197
+ )
198
+ ).featureFlags;
195
199
  return {
196
200
  ...e,
197
201
  featureFlags: i
@@ -273,7 +277,10 @@ async function ci(t, e) {
273
277
  ...Xr.parse(i),
274
278
  id: {
275
279
  ...Kr(
276
- Wr(s.name, `"name" not found in ${r}`)
280
+ Wr(
281
+ s.name,
282
+ `"name" not found in ${r}`
283
+ )
277
284
  ),
278
285
  version: Tt.parse(s.version)
279
286
  }
@@ -287,7 +294,9 @@ async function ci(t, e) {
287
294
  }
288
295
  }
289
296
  async function js(t) {
290
- const e = B.resolve(t, "package.json"), r = JSON.parse(await U.readFile(e, { encoding: "utf-8" })), s = r[Pt];
297
+ const e = B.resolve(t, "package.json"), r = JSON.parse(
298
+ await U.readFile(e, { encoding: "utf-8" })
299
+ ), s = r[Pt];
291
300
  if (s === void 0)
292
301
  throw new Error(
293
302
  `Block description (field ${Pt}) not found in ${e}.`
@@ -296,7 +305,10 @@ async function js(t) {
296
305
  ...Xr.parse(s),
297
306
  id: {
298
307
  ...Kr(
299
- Wr(r.name, `"name" not found in ${e}`)
308
+ Wr(
309
+ r.name,
310
+ `"name" not found in ${e}`
311
+ )
300
312
  ),
301
313
  version: Tt.parse(r.version)
302
314
  },
@@ -1461,9 +1473,13 @@ class gi {
1461
1473
  if (!this.settings.skipSnapshotCreation)
1462
1474
  try {
1463
1475
  const i = JSON.stringify(r), l = await this.gzipAsync(i), a = En(e, s);
1464
- await this.storage.putFile(a, Buffer.from(l)), this.logger.info(`Package overview snapshot created at ${a} for ${e.organization}:${e.name}`);
1476
+ await this.storage.putFile(a, Buffer.from(l)), this.logger.info(
1477
+ `Package overview snapshot created at ${a} for ${e.organization}:${e.name}`
1478
+ );
1465
1479
  } catch (i) {
1466
- this.logger.warn(`Failed to create package overview snapshot for ${e.organization}:${e.name}: ${String(i)}`);
1480
+ this.logger.warn(
1481
+ `Failed to create package overview snapshot for ${e.organization}:${e.name}: ${String(i)}`
1482
+ );
1467
1483
  }
1468
1484
  }
1469
1485
  async updateRegistry(e = "normal") {
@@ -1502,12 +1518,18 @@ class gi {
1502
1518
  await this.createGlobalOverviewSnapshot(h.toString(), n);
1503
1519
  }
1504
1520
  let o = (e === "force" ? { packages: [] } : h === void 0 ? { packages: [] } : Et.parse(JSON.parse(h.toString()))).packages;
1505
- this.logger.info(`Global overview ${e === "force" ? "starting empty (force mode)" : "loaded"}, ${o.length} records`);
1521
+ this.logger.info(
1522
+ `Global overview ${e === "force" ? "starting empty (force mode)" : "loaded"}, ${o.length} records`
1523
+ );
1506
1524
  for (const [, n] of s.entries()) {
1507
1525
  const f = xr(n.package), u = await this.storage.getFile(f);
1508
1526
  if (e === "force" && u !== void 0) {
1509
1527
  const w = this.generatePreWriteTimestamp(), R = vt.parse(JSON.parse(u.toString()));
1510
- await this.createPackageOverviewSnapshot(n.package, R, w);
1528
+ await this.createPackageOverviewSnapshot(
1529
+ n.package,
1530
+ R,
1531
+ w
1532
+ );
1511
1533
  }
1512
1534
  const g = e === "force" ? { versions: [] } : u === void 0 ? { versions: [] } : vt.parse(JSON.parse(u.toString()));
1513
1535
  this.logger.info(
@@ -1537,10 +1559,11 @@ class gi {
1537
1559
  (w, R) => ss.compare(R.description.id.version, w.description.id.version)
1538
1560
  );
1539
1561
  const p = { schema: "v2", versions: m };
1540
- e !== "dry-run" && (await this.storage.putFile(
1541
- f,
1542
- Buffer.from(JSON.stringify(p))
1543
- ), await this.createPackageOverviewSnapshot(n.package, p, r)), this.logger.info(`Done (${m.length} records)`);
1562
+ e !== "dry-run" && (await this.storage.putFile(f, Buffer.from(JSON.stringify(p))), await this.createPackageOverviewSnapshot(
1563
+ n.package,
1564
+ p,
1565
+ r
1566
+ )), this.logger.info(`Done (${m.length} records)`);
1544
1567
  const S = /* @__PURE__ */ new Set();
1545
1568
  for (const w of m) for (const R of w.channels) S.add(R);
1546
1569
  o = o.filter(
@@ -1577,7 +1600,10 @@ class gi {
1577
1600
  });
1578
1601
  }
1579
1602
  if (e !== "dry-run") {
1580
- const n = JSON.stringify({ schema: "v2", packages: o }), f = Buffer.from(n);
1603
+ const n = JSON.stringify({
1604
+ schema: "v2",
1605
+ packages: o
1606
+ }), f = Buffer.from(n);
1581
1607
  await this.storage.putFile(ie, f);
1582
1608
  const u = await this.gzipAsync(n);
1583
1609
  await this.storage.putFile(jr, Buffer.from(u)), await this.createGlobalOverviewSnapshot(n, r);
@@ -1719,8 +1745,10 @@ class kn {
1719
1745
  }
1720
1746
  });
1721
1747
  if (r.Errors !== void 0 && r.Errors.length > 0)
1722
- throw new Error(`Errors encountered while deleting files: ${r.Errors.map((s) => s.Message ?? s.Code ?? "Unknown error").join(`
1723
- `)}`);
1748
+ throw new Error(
1749
+ `Errors encountered while deleting files: ${r.Errors.map((s) => s.Message ?? s.Code ?? "Unknown error").join(`
1750
+ `)}`
1751
+ );
1724
1752
  }
1725
1753
  }
1726
1754
  class Ln {
@@ -1847,7 +1875,10 @@ class _n {
1847
1875
  cs
1848
1876
  )
1849
1877
  );
1850
- T && P.push({ version: R, meta: JSON.parse(T.toString()) });
1878
+ T && P.push({
1879
+ version: R,
1880
+ meta: JSON.parse(T.toString())
1881
+ });
1851
1882
  }
1852
1883
  P.sort((w, R) => ss.compare(R.version, w.version)), await this.storage.putFile(p, Buffer.from(JSON.stringify(P))), (f = this.logger) == null || f.info(`Done (${P.length} records)`), l = l.filter(
1853
1884
  (w) => w.organization !== m.package.organization || w.package !== m.package.package
@@ -2016,4 +2047,4 @@ export {
2016
2047
  Ur as y,
2017
2048
  os as z
2018
2049
  };
2019
- //# sourceMappingURL=config-DKBY0B2u.mjs.map
2050
+ //# sourceMappingURL=config-Cc8_zV3b.mjs.map