@platforma-sdk/block-tools 2.7.5 → 2.7.6

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.
@@ -19,6 +19,7 @@ import { request as ye } from "undici";
19
19
  import { defaultHttpDispatcher as be } from "@milaboratories/pl-http";
20
20
  import xe from "yaml";
21
21
  import * as Se from "node:os";
22
+ //#region \0rolldown/runtime.js
22
23
  var Ce = Object.create, A = Object.defineProperty, we = Object.getOwnPropertyDescriptor, Te = Object.getOwnPropertyNames, Ee = Object.getPrototypeOf, De = Object.prototype.hasOwnProperty, j = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Oe = (e, t) => {
23
24
  let n = {};
24
25
  for (var r in e) A(n, r, {
@@ -39,7 +40,8 @@ var Ce = Object.create, A = Object.defineProperty, we = Object.getOwnPropertyDes
39
40
  if (typeof require < "u") return require.apply(this, arguments);
40
41
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
41
42
  });
42
- /** Zod type that resolves node module request into absolute content */
43
+ //#endregion
44
+ //#region src/v2/model/content_conversion.ts
43
45
  function Me(e) {
44
46
  return n.string().transform((t, r) => {
45
47
  let i = o(e, t);
@@ -52,10 +54,6 @@ function Me(e) {
52
54
  };
53
55
  });
54
56
  }
55
- /**
56
- * Zod type that resolves node module request for folder into absolute folder,
57
- * given a list of expected index files in that folder
58
- * */
59
57
  function Ne(e, ...t) {
60
58
  return n.string().transform((r, i) => {
61
59
  let a = r.endsWith("/") ? r : `${r}/`;
@@ -177,16 +175,20 @@ function N(e) {
177
175
  };
178
176
  };
179
177
  }
178
+ //#endregion
179
+ //#region src/v2/model/block_meta.ts
180
180
  function He(e) {
181
181
  return h(te.transform(Pe(e)), ee.transform(Pe(e)));
182
182
  }
183
183
  function Ue(e, t) {
184
184
  return h(b.transform(M(e, t)), v.transform(M(e, t)));
185
185
  }
186
- const We = h(b.transform(Fe()), v.transform(Ie())).pipe(g), Ge = h(b.transform(Fe()), v.transform(Le())).pipe(_);
186
+ var We = h(b.transform(Fe()), v.transform(Ie())).pipe(g), Ge = h(b.transform(Fe()), v.transform(Le())).pipe(_);
187
187
  function Ke(e) {
188
188
  return h(C.transform(Be(e)), S.transform(N(e))).pipe(_);
189
189
  }
190
+ //#endregion
191
+ //#region src/v2/model/block_components.ts
190
192
  function qe(e) {
191
193
  return c(Me(e), Ne(e, "index.html"));
192
194
  }
@@ -196,6 +198,8 @@ function Je(e, t) {
196
198
  function Ye(e) {
197
199
  return c(x.transform(oe(e)), x.transform(oe(e)));
198
200
  }
201
+ //#endregion
202
+ //#region src/v2/model/block_description.ts
199
203
  function Xe(e) {
200
204
  return w(qe(e), He(e)).transform(async (e, t) => {
201
205
  let n = se(JSON.parse(await r.readFile(e.components.model.file, "utf-8"))).featureFlags;
@@ -212,6 +216,8 @@ function Qe(e) {
212
216
  let t = re(e);
213
217
  return d.pipe(w(c(x.transform(t), x.transform(t)), h(C.transform(t), S.transform(t)))).pipe(d);
214
218
  }
219
+ //#endregion
220
+ //#region src/util.ts
215
221
  async function $e(e, t) {
216
222
  try {
217
223
  return t(await r.readFile(e));
@@ -223,6 +229,8 @@ async function $e(e, t) {
223
229
  function et(e) {
224
230
  return Promise.resolve(ce("sha256").update(ArrayBuffer.isView(e) ? e : Buffer.from(e)).digest("hex").toUpperCase());
225
231
  }
232
+ //#endregion
233
+ //#region src/v2/build_dist.ts
226
234
  async function tt(t, n) {
227
235
  await r.mkdir(n, { recursive: !0 });
228
236
  let i = [], a = await Ze(n, i).parseAsync(t), o = await Promise.all(i.map(async (t) => {
@@ -240,8 +248,9 @@ async function tt(t, n) {
240
248
  });
241
249
  return await r.writeFile(e.resolve(n, m), JSON.stringify(s)), s;
242
250
  }
243
- const P = "block";
244
- var nt = /(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;
251
+ //#endregion
252
+ //#region src/v2/source_package.ts
253
+ var P = "block", nt = /(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;
245
254
  function rt(e) {
246
255
  let t = e.match(nt);
247
256
  if (!t) throw Error(`Malformed package name (${e}), can't infer organization and block pack name.`);
@@ -289,6 +298,8 @@ async function ot(e) {
289
298
  let t = await at(e);
290
299
  return await Xe(e).parseAsync(t);
291
300
  }
301
+ //#endregion
302
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
292
303
  var F = /* @__PURE__ */ j(((e, t) => {
293
304
  var n = "2.0.0", r = 256;
294
305
  t.exports = {
@@ -438,7 +449,7 @@ var F = /* @__PURE__ */ j(((e, t) => {
438
449
  this.prerelease.length === 0 && this.patch++, this.prerelease = [];
439
450
  break;
440
451
  case "pre": {
441
- let e = Number(n) ? 1 : 0;
452
+ let e = +!!Number(n);
442
453
  if (this.prerelease.length === 0) this.prerelease = [e];
443
454
  else {
444
455
  let r = this.prerelease.length;
@@ -815,6 +826,7 @@ var F = /* @__PURE__ */ j(((e, t) => {
815
826
  break;
816
827
  case "<":
817
828
  case "<=": break;
829
+ /* istanbul ignore next */
818
830
  default: throw Error(`Unexpected operation: ${e.operator}`);
819
831
  }
820
832
  }), o && (!a || i(a, o)) && (a = o);
@@ -932,7 +944,7 @@ var F = /* @__PURE__ */ j(((e, t) => {
932
944
  return r < 0 ? e : r > 0 || t.operator === "<" && e.operator === "<=" ? t : e;
933
945
  };
934
946
  t.exports = s;
935
- })), Vt = /* @__PURE__ */ j(((e, t) => {
947
+ })), G = /* @__PURE__ */ Ae((/* @__PURE__ */ j(((e, t) => {
936
948
  var n = L(), r = F(), i = R(), a = ct();
937
949
  t.exports = {
938
950
  parse: z(),
@@ -981,32 +993,33 @@ var F = /* @__PURE__ */ j(((e, t) => {
981
993
  compareIdentifiers: a.compareIdentifiers,
982
994
  rcompareIdentifiers: a.rcompareIdentifiers
983
995
  };
984
- }));
985
- const Ht = "_updates_v2/per_package_version/";
986
- function Ut(e, t) {
987
- return `${Ht}${e.organization}/${e.name}/${e.version}/${t}`;
996
+ })))()), Vt = "_updates_v2/per_package_version/";
997
+ function Ht(e, t) {
998
+ return `${Vt}${e.organization}/${e.name}/${e.version}/${t}`;
988
999
  }
989
- const Wt = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/(?<seed>[^/]+)$/, Gt = "_updates_v2/_global_update_in", Kt = "_updates_v2/_global_update_out", qt = "_overview_snapshots_v2/global/", Jt = /^(?<timestamp>\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z-[a-z0-9]+)\.json\.gz$/;
1000
+ var Ut = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/(?<seed>[^/]+)$/, Wt = "_updates_v2/_global_update_in", Gt = "_updates_v2/_global_update_out", Kt = "_overview_snapshots_v2/global/", qt = "_overview_snapshots_v2/per_package/", Jt = /^(?<timestamp>\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z-[a-z0-9]+)\.json\.gz$/;
990
1001
  function Yt(e) {
991
- return `${qt}${e}.json.gz`;
1002
+ return `${Kt}${e}.json.gz`;
992
1003
  }
993
1004
  function Xt(e, t) {
994
- return `_overview_snapshots_v2/per_package/${e.organization}/${e.name}/${t}.json.gz`;
1005
+ return `${qt}${e.organization}/${e.name}/${t}.json.gz`;
995
1006
  }
996
- const Zt = "v2/", Qt = "overview.json", $t = "overview.json.gz", en = "overview.json", tn = "manifest.json", G = "channels", K = /^[-a-z0-9]+$/;
997
- function q(e) {
1007
+ //#endregion
1008
+ //#region src/v2/registry/schema_public.ts
1009
+ var Zt = "v2/", Qt = "overview.json", $t = "overview.json.gz", en = "overview.json", K = "manifest.json", q = "channels", J = /^[-a-z0-9]+$/;
1010
+ function Y(e) {
998
1011
  return `${e.organization}/${e.name}/${e.version}`;
999
1012
  }
1000
- function J(e) {
1001
- return `v2/${q(e)}`;
1013
+ function X(e) {
1014
+ return `v2/${Y(e)}`;
1002
1015
  }
1003
- const nn = "/" + tn, rn = n.object({
1016
+ var tn = "/" + K, nn = n.object({
1004
1017
  description: d,
1005
1018
  channels: n.array(n.string()).default(() => []),
1006
1019
  manifestSha256: E
1007
- }).passthrough(), Y = n.object({
1020
+ }).passthrough(), rn = n.object({
1008
1021
  schema: n.literal("v2"),
1009
- versions: n.array(rn)
1022
+ versions: n.array(nn)
1010
1023
  }).passthrough();
1011
1024
  function an(e) {
1012
1025
  return `${e.organization}/${e.name}/${en}`;
@@ -1015,12 +1028,12 @@ function on(e) {
1015
1028
  return `v2/${an(e)}`;
1016
1029
  }
1017
1030
  function sn(e) {
1018
- return `${q(e)}/${G}/`;
1031
+ return `${Y(e)}/${q}/`;
1019
1032
  }
1020
1033
  function cn(e) {
1021
1034
  return `v2/${sn(e)}`;
1022
1035
  }
1023
- const ln = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/manifest\.json$/, X = `v2/${Qt}`, un = `v2/${$t}`;
1036
+ var ln = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<name>[^/]+))\/(?<version>[^/]+)\/manifest\.json$/, Z = `v2/${Qt}`, un = `v2/${$t}`;
1024
1037
  function dn(e) {
1025
1038
  let t = n.object({
1026
1039
  id: f,
@@ -1050,14 +1063,14 @@ function dn(e) {
1050
1063
  }
1051
1064
  }).pipe(t.required({ allVersionsWithChannels: !0 }));
1052
1065
  }
1053
- const fn = dn(d);
1066
+ var fn = dn(d);
1054
1067
  function pn(e) {
1055
1068
  return n.object({
1056
1069
  schema: n.literal("v2"),
1057
1070
  packages: n.array(dn(e))
1058
1071
  }).passthrough();
1059
1072
  }
1060
- const Z = pn(d);
1073
+ var Q = pn(d);
1061
1074
  function mn(e) {
1062
1075
  return w(l, h(C.transform(ze(e)), S.transform(N(e))));
1063
1076
  }
@@ -1067,7 +1080,9 @@ function hn(e) {
1067
1080
  function gn(e) {
1068
1081
  return pn(w(l, h(C.transform(ze(e)), S.transform(N(e)))));
1069
1082
  }
1070
- var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1083
+ //#endregion
1084
+ //#region src/v2/registry/registry.ts
1085
+ var _n = class {
1071
1086
  gzipAsync = me(pe);
1072
1087
  gunzipAsync = me(fe);
1073
1088
  constructor(e, t = new ue(), n = {}) {
@@ -1097,7 +1112,7 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1097
1112
  }
1098
1113
  async updateRegistry(e = "normal") {
1099
1114
  this.logger.info("Initiating registry refresh...");
1100
- let t = this.generateTimestamp(), n = /* @__PURE__ */ new Map(), r = [], i = await this.storage.listFiles(Ht), a = ({ organization: e, name: t, version: r }) => {
1115
+ let t = this.generateTimestamp(), n = /* @__PURE__ */ new Map(), r = [], i = await this.storage.listFiles(Vt), a = ({ organization: e, name: t, version: r }) => {
1101
1116
  let i = `${e}:${t}`, a = n.get(i);
1102
1117
  return a ? a.versions.has(r) ? !1 : (a.versions.add(r), !0) : (n.set(i, {
1103
1118
  package: {
@@ -1109,7 +1124,7 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1109
1124
  };
1110
1125
  this.logger.info("Packages to be updated:");
1111
1126
  for (let e of i) {
1112
- let t = e.match(Wt);
1127
+ let t = e.match(Ut);
1113
1128
  if (!t) continue;
1114
1129
  r.push(e);
1115
1130
  let { organization: n, name: i, version: o, seed: s } = t.groups, c = a({
@@ -1132,7 +1147,7 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1132
1147
  this.logger.info(` - ${n}:${r}:${i} force_added:${o}`);
1133
1148
  }
1134
1149
  }
1135
- let o = await this.storage.getFile(X);
1150
+ let o = await this.storage.getFile(Z);
1136
1151
  if (e === "force" && o !== void 0) {
1137
1152
  let e = this.generatePreWriteTimestamp();
1138
1153
  await this.createGlobalOverviewSnapshot(o.toString(), e);
@@ -1140,34 +1155,34 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1140
1155
  let c = (e === "force" || o === void 0 ? {
1141
1156
  schema: "v2",
1142
1157
  packages: []
1143
- } : Z.parse(JSON.parse(o.toString()))).packages;
1158
+ } : Q.parse(JSON.parse(o.toString()))).packages;
1144
1159
  this.logger.info(`Global overview ${e === "force" ? "starting empty (force mode)" : "loaded"}, ${c.length} records`);
1145
1160
  for (let [, r] of n.entries()) {
1146
1161
  let n = on(r.package), i = await this.storage.getFile(n);
1147
1162
  if (e === "force" && i !== void 0) {
1148
- let e = this.generatePreWriteTimestamp(), t = Y.parse(JSON.parse(i.toString()));
1163
+ let e = this.generatePreWriteTimestamp(), t = rn.parse(JSON.parse(i.toString()));
1149
1164
  await this.createPackageOverviewSnapshot(r.package, t, e);
1150
1165
  }
1151
1166
  let a = e === "force" || i === void 0 ? {
1152
1167
  schema: "v2",
1153
1168
  versions: []
1154
- } : Y.parse(JSON.parse(i.toString()));
1169
+ } : rn.parse(JSON.parse(i.toString()));
1155
1170
  this.logger.info(`Updating ${r.package.organization}:${r.package.name} overview${e === "force" ? " (starting empty in force mode)" : ""}, ${a.versions.length} records`);
1156
1171
  let o = a.versions.filter((e) => !r.versions.has(e.description.id.version));
1157
1172
  for (let [e] of r.versions.entries()) {
1158
1173
  let t = e.toString(), n = {
1159
1174
  ...r.package,
1160
1175
  version: t
1161
- }, i = await this.storage.getFile(J(n) + nn);
1176
+ }, i = await this.storage.getFile(X(n) + tn);
1162
1177
  if (!i) continue;
1163
- let a = await et(i), s = (await this.storage.listFiles(cn(n))).filter((e) => e.match(K) ? !0 : (this.logger.warn(`Unexpected channel in ${ae(n)}: ${e}`), !1));
1178
+ let a = await et(i), s = (await this.storage.listFiles(cn(n))).filter((e) => e.match(J) ? !0 : (this.logger.warn(`Unexpected channel in ${ae(n)}: ${e}`), !1));
1164
1179
  o.push({
1165
1180
  description: Qe(t).parse(p.parse(JSON.parse(i.toString("utf8"))).description),
1166
1181
  manifestSha256: a,
1167
1182
  channels: s
1168
1183
  });
1169
1184
  }
1170
- o.sort((e, t) => (0, Q.compare)(t.description.id.version, e.description.id.version));
1185
+ o.sort((e, t) => (0, G.compare)(t.description.id.version, e.description.id.version));
1171
1186
  let l = {
1172
1187
  schema: "v2",
1173
1188
  versions: o
@@ -1204,15 +1219,15 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1204
1219
  schema: "v2",
1205
1220
  packages: c
1206
1221
  }), n = Buffer.from(e);
1207
- await this.storage.putFile(X, n);
1222
+ await this.storage.putFile(Z, n);
1208
1223
  let r = await this.gzipAsync(e);
1209
1224
  await this.storage.putFile(un, Buffer.from(r)), await this.createGlobalOverviewSnapshot(e, t);
1210
1225
  }
1211
- this.logger.info(`Global overview updated (${c.length} records)`), e !== "dry-run" && await this.storage.deleteFiles(...r.map((e) => `${Ht}${e}`)), this.logger.info("Version update requests cleared");
1226
+ this.logger.info(`Global overview updated (${c.length} records)`), e !== "dry-run" && await this.storage.deleteFiles(...r.map((e) => `${Vt}${e}`)), this.logger.info("Version update requests cleared");
1212
1227
  }
1213
1228
  async updateIfNeeded(e = "normal") {
1214
1229
  this.logger.info("Checking if registry requires refresh...");
1215
- let t = await this.storage.getFile(Gt), n = await this.storage.getFile(Kt);
1230
+ let t = await this.storage.getFile(Wt), n = await this.storage.getFile(Gt);
1216
1231
  if (e !== "force" && t === void 0 && n === void 0) {
1217
1232
  this.logger.info("No global seed files found, update not needed.");
1218
1233
  return;
@@ -1221,39 +1236,39 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1221
1236
  this.logger.info("Registry is up to date.");
1222
1237
  return;
1223
1238
  }
1224
- await this.updateRegistry(e), t && (e !== "dry-run" && await this.storage.putFile(Kt, t), this.logger.info("Refresh finished."));
1239
+ await this.updateRegistry(e), t && (e !== "dry-run" && await this.storage.putFile(Gt, t), this.logger.info("Refresh finished."));
1225
1240
  }
1226
1241
  async getPackageOverview(e) {
1227
1242
  let t = await this.storage.getFile(on(e));
1228
- if (t !== void 0) return Y.parse(JSON.parse(t.toString()));
1243
+ if (t !== void 0) return rn.parse(JSON.parse(t.toString()));
1229
1244
  }
1230
1245
  async getGlobalOverview() {
1231
- let e = await this.storage.getFile(X);
1232
- if (e !== void 0) return Z.parse(JSON.parse(e.toString()));
1246
+ let e = await this.storage.getFile(Z);
1247
+ if (e !== void 0) return Q.parse(JSON.parse(e.toString()));
1233
1248
  }
1234
1249
  async marchChanged(e) {
1235
- let t = le(), n = Ut(e, t);
1236
- this.logger.info(`Creating update seed at ${n} ...`), await this.storage.putFile(n, Buffer.from(t)), this.logger.info(`Touching global update seed ${Gt} ...`), await this.storage.putFile(Gt, Buffer.from(t));
1250
+ let t = le(), n = Ht(e, t);
1251
+ this.logger.info(`Creating update seed at ${n} ...`), await this.storage.putFile(n, Buffer.from(t)), this.logger.info(`Touching global update seed ${Wt} ...`), await this.storage.putFile(Wt, Buffer.from(t));
1237
1252
  }
1238
1253
  async addPackageToChannel(e, t) {
1239
- if (!t.match(K)) throw Error(`Illegal characters in channel name: ${t}`);
1240
- let n = J(e);
1254
+ if (!t.match(J)) throw Error(`Illegal characters in channel name: ${t}`);
1255
+ let n = X(e);
1241
1256
  if (await this.storage.getFile(`${n}/manifest.json`) === void 0) throw Error(`Package ${ae(e)} not found in the registry.`);
1242
- await this.storage.putFile(`${n}/${G}/${t}`, Buffer.from(t)), await this.marchChanged(e);
1257
+ await this.storage.putFile(`${n}/${q}/${t}`, Buffer.from(t)), await this.marchChanged(e);
1243
1258
  }
1244
1259
  async removePackageFromChannel(e, t) {
1245
- if (!t.match(K)) throw Error(`Illegal characters in channel name: ${t}`);
1246
- let n = J(e);
1260
+ if (!t.match(J)) throw Error(`Illegal characters in channel name: ${t}`);
1261
+ let n = X(e);
1247
1262
  if (await this.storage.getFile(`${n}/manifest.json`) === void 0) throw Error(`Package ${ae(e)} not found in the registry.`);
1248
- await this.storage.deleteFiles(`${n}/${G}/${t}`), await this.marchChanged(e);
1263
+ await this.storage.deleteFiles(`${n}/${q}/${t}`), await this.marchChanged(e);
1249
1264
  }
1250
1265
  async listGlobalOverviewSnapshots() {
1251
- let e = await this.storage.listFiles(qt), t = [];
1266
+ let e = await this.storage.listFiles(Kt), t = [];
1252
1267
  for (let n of e) {
1253
1268
  let e = n.indexOf("/") === -1 ? n : n.substring(n.lastIndexOf("/") + 1), r = e.match(Jt);
1254
1269
  r && t.push({
1255
1270
  timestamp: r.groups.timestamp,
1256
- path: qt + e
1271
+ path: Kt + e
1257
1272
  });
1258
1273
  }
1259
1274
  return t.sort((e, t) => t.timestamp.localeCompare(e.timestamp)), t;
@@ -1263,17 +1278,17 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1263
1278
  if (!n) throw Error(`Snapshot ${e} not found at ${t}`);
1264
1279
  let r = (await this.gunzipAsync(n)).toString("utf8");
1265
1280
  try {
1266
- Z.parse(JSON.parse(r));
1281
+ Q.parse(JSON.parse(r));
1267
1282
  } catch (t) {
1268
1283
  throw Error(`Invalid snapshot data in ${e}: ${String(t)}`);
1269
1284
  }
1270
1285
  let i = Buffer.from(r);
1271
- await this.storage.putFile(X, i);
1286
+ await this.storage.putFile(Z, i);
1272
1287
  let a = await this.gzipAsync(r);
1273
1288
  await this.storage.putFile(un, Buffer.from(a)), this.logger.info(`Global overview restored from snapshot ${e}`);
1274
1289
  }
1275
1290
  async publishPackage(e, t) {
1276
- let n = J(e.description.id);
1291
+ let n = X(e.description.id);
1277
1292
  for (let r of e.files) {
1278
1293
  let e = await t(r.name);
1279
1294
  if (e.length !== r.size) throw Error(`Actual file size don't match file size from the manifest file for ${r.name} (actual = ${e.length}; manifest = ${r.size})`);
@@ -1282,16 +1297,15 @@ var Q = /* @__PURE__ */ Ae(Vt()), _n = class {
1282
1297
  let a = n + "/" + r.name;
1283
1298
  this.logger.info(`Uploading ${r.name} -> ${a} ...`), await this.storage.putFile(a, e);
1284
1299
  }
1285
- let r = n + "/manifest.json";
1300
+ let r = n + "/" + K;
1286
1301
  this.logger.info(`Uploading manifest to ${r} ...`), await this.storage.putFile(r, Buffer.from(JSON.stringify(e))), await this.marchChanged(e.description.id);
1287
1302
  }
1288
1303
  }, vn = {
1289
1304
  cacheBlockListFor: 45e3,
1290
1305
  keepStaleBlockListFor: 3e5
1291
1306
  };
1292
- /** @param availableVersions must be reverse sorted (from highest version to lowest) */
1293
1307
  function yn(e, t) {
1294
- let n = Q.inc(e, "minor"), r = Q.inc(e, "major"), i = [], a = t.find((t) => Q.gt(t, e) && Q.lt(t, n)), o = t.find((e) => Q.gte(e, n) && Q.lt(e, r)), s = t.find((e) => Q.gte(e, r));
1308
+ let n = G.inc(e, "minor"), r = G.inc(e, "major"), i = [], a = t.find((t) => G.gt(t, e) && G.lt(t, n)), o = t.find((e) => G.gte(e, n) && G.lt(e, r)), s = t.find((e) => G.gte(e, r));
1295
1309
  return a && i.push({
1296
1310
  type: "patch",
1297
1311
  update: a
@@ -1312,14 +1326,9 @@ var bn = class {
1312
1326
  ...t
1313
1327
  };
1314
1328
  }
1315
- /**
1316
- * Embeds meta infromation relative to registry root.
1317
- * Meta information that looks like:
1318
- *
1319
- * */
1320
1329
  embeddedGlobalMetaCache = new ge({
1321
1330
  max: 500,
1322
- fetchMethod: async (e, t, n) => await O(async () => await Ke(n.context.relativeTo === void 0 ? this.v2RootFolderReader.getContentReader() : this.v2RootFolderReader.relativeReader(q(n.context.relativeTo)).getContentReader()).parseAsync(n.context.meta), D)
1331
+ fetchMethod: async (e, t, n) => await O(async () => await Ke(n.context.relativeTo === void 0 ? this.v2RootFolderReader.getContentReader() : this.v2RootFolderReader.relativeReader(Y(n.context.relativeTo)).getContentReader()).parseAsync(n.context.meta), D)
1323
1332
  });
1324
1333
  async embedMetaContent(e, t, n, r) {
1325
1334
  return await this.embeddedGlobalMetaCache.forceFetch(he({
@@ -1337,7 +1346,7 @@ var bn = class {
1337
1346
  if (this.listCache !== void 0 && Date.now() - this.listCacheTimestamp <= this.ops.cacheBlockListFor) return this.listCache;
1338
1347
  try {
1339
1348
  return await O(async () => {
1340
- let e = Z.parse(JSON.parse(Buffer.from(await this.v2RootFolderReader.readFile(Qt)).toString())), t = await Promise.all(e.packages.map(async (e) => {
1349
+ let e = Q.parse(JSON.parse(Buffer.from(await this.v2RootFolderReader.readFile(Qt)).toString())), t = await Promise.all(e.packages.map(async (e) => {
1341
1350
  let t = await Promise.all(Object.entries(e.latestByChannel).map(async ([e, t]) => [e, {
1342
1351
  id: t.description.id,
1343
1352
  meta: await this.embedMetaContent(t.description.id, t.manifestSha256, !0, t.description.meta),
@@ -1374,7 +1383,7 @@ var bn = class {
1374
1383
  }
1375
1384
  async getSpecificOverview(e, t) {
1376
1385
  return await O(async () => {
1377
- let n = await this.v2RootFolderReader.readFile(q(e) + nn), r = p.parse(JSON.parse(Buffer.from(n).toString()));
1386
+ let n = await this.v2RootFolderReader.readFile(Y(e) + tn), r = p.parse(JSON.parse(Buffer.from(n).toString()));
1378
1387
  return {
1379
1388
  id: e,
1380
1389
  meta: await this.embedMetaContent(e, await et(n), !1, r.description.meta),
@@ -1390,7 +1399,7 @@ var bn = class {
1390
1399
  componentsCache = new ge({
1391
1400
  max: 500,
1392
1401
  fetchMethod: async (e, t, { context: n }) => await O(async () => {
1393
- let e = this.v2RootFolderReader.relativeReader(q(n)), t = p.parse(JSON.parse(Buffer.from(await e.readFile(tn)).toString()));
1402
+ let e = this.v2RootFolderReader.relativeReader(Y(n)), t = p.parse(JSON.parse(Buffer.from(await e.readFile(K)).toString()));
1394
1403
  return Ye(e.rootUrl.toString()).parse(t.description.components);
1395
1404
  }, D)
1396
1405
  });
@@ -1435,7 +1444,6 @@ var bn = class {
1435
1444
  if (t.Errors !== void 0 && t.Errors.length > 0) throw Error(`Errors encountered while deleting files: ${t.Errors.map((e) => e.Message ?? e.Code ?? "Unknown error").join("\n")}`);
1436
1445
  }
1437
1446
  }, Sn = class {
1438
- /** Absolute path */
1439
1447
  root;
1440
1448
  constructor(t) {
1441
1449
  this.root = e.resolve(t);
@@ -1485,6 +1493,8 @@ function Cn(t) {
1485
1493
  default: throw Error(`Unknown protocol: ${n.protocol}`);
1486
1494
  }
1487
1495
  }
1496
+ //#endregion
1497
+ //#region src/io/folder_reader.ts
1488
1498
  var wn = class e {
1489
1499
  constructor(e, t) {
1490
1500
  this.rootUrl = e, this.httpDispatcher = t;
@@ -1532,7 +1542,9 @@ function On(t, n) {
1532
1542
  default: throw Error(`Unknown protocol: ${r.protocol}`);
1533
1543
  }
1534
1544
  }
1535
- const kn = n.string().regex(/^(?:s3:|file:)/), An = n.object({
1545
+ //#endregion
1546
+ //#region src/common_types.ts
1547
+ var kn = n.string().regex(/^(?:s3:|file:)/), An = n.object({
1536
1548
  organization: n.string(),
1537
1549
  package: n.string(),
1538
1550
  version: T.optional(),
@@ -1547,8 +1559,7 @@ const kn = n.string().regex(/^(?:s3:|file:)/), An = n.object({
1547
1559
  }), Nn = Mn.partial().required({
1548
1560
  registries: !0,
1549
1561
  files: !0
1550
- }), Pn = "pl.package.json", Fn = "pl.package.yaml";
1551
- var In = "v1/";
1562
+ }), Pn = "pl.package.json", Fn = "pl.package.yaml", In = "v1/";
1552
1563
  function Ln(e) {
1553
1564
  return `${In}${e.organization}/${e.package}/${e.version}`;
1554
1565
  }
@@ -1558,8 +1569,7 @@ function Rn(e, t) {
1558
1569
  function zn(e) {
1559
1570
  return `${In}${e.organization}/${e.package}/overview.json`;
1560
1571
  }
1561
- const Bn = `${In}overview.json`, Vn = "meta.json";
1562
- var Hn = "_updates_v1/per_package_version/";
1572
+ var Bn = `${In}overview.json`, Vn = "meta.json", Hn = "_updates_v1/per_package_version/";
1563
1573
  function Un(e, t) {
1564
1574
  return `${Hn}${e.organization}/${e.package}/${e.version}/${t}`;
1565
1575
  }
@@ -1602,7 +1612,7 @@ var Wn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<pkg>[^/]+))\/(?
1602
1612
  meta: JSON.parse(i.toString())
1603
1613
  });
1604
1614
  }
1605
- r.sort((e, t) => Q.compare(t.version, e.version)), await this.storage.putFile(e, Buffer.from(JSON.stringify(r))), this.logger?.info(`Done (${r.length} records)`), i = i.filter((e) => e.organization !== t.package.organization || e.package !== t.package.package), i.push({
1615
+ r.sort((e, t) => G.compare(t.version, e.version)), await this.storage.putFile(e, Buffer.from(JSON.stringify(r))), this.logger?.info(`Done (${r.length} records)`), i = i.filter((e) => e.organization !== t.package.organization || e.package !== t.package.package), i.push({
1606
1616
  organization: t.package.organization,
1607
1617
  package: t.package.package,
1608
1618
  allVersions: r.map((e) => e.version).reverse(),
@@ -1642,6 +1652,8 @@ var Wn = /(?<packageKeyWithoutVersion>(?<organization>[^/]+)\/(?<pkg>[^/]+))\/(?
1642
1652
  await this.storage.putFile(Un(this.name, this.seed), Buffer.of(0)), await this.storage.putFile(Gn, Buffer.from(this.seed));
1643
1653
  }
1644
1654
  };
1655
+ //#endregion
1656
+ //#region src/registry_v1/config.ts
1645
1657
  function $(e, t) {
1646
1658
  return t === void 0 ? e : {
1647
1659
  ...e,
@@ -1691,6 +1703,7 @@ async function $n(e) {
1691
1703
  let t = await Zn();
1692
1704
  return new Qn(Mn.parse($(t, e)));
1693
1705
  }
1694
- export { Ze as $, X as A, rn as B, G as C, je as Ct, Qt as D, fn as E, tn as F, on as G, sn as H, nn as I, ot as J, an as K, ln as L, gn as M, hn as N, $t as O, Zt as P, tt as Q, Y as R, K as S, Oe as St, dn as T, J as U, cn as V, q as W, rt as X, at as Y, it as Z, Cn as _, Re as _t, Ln as a, Ue as at, _n as b, N as bt, An as c, Ge as ct, jn as d, Ne as dt, Qe as et, Mn as f, Ie as ft, xn as g, Pe as gt, Sn as h, M as ht, Vn as i, qe as it, Z as j, un as k, Pn as l, Ke as lt, On as m, Fe as mt, $n as n, Ye as nt, zn as o, He as ot, Nn as p, Le as pt, P as q, Bn as r, Je as rt, Rn as s, We as st, Qn as t, Xe as tt, Fn as u, Me as ut, bn as v, Be as vt, pn as w, mn as x, ze as xt, yn as y, Ve as yt, en as z };
1706
+ //#endregion
1707
+ export { Ze as $, Z as A, nn as B, q as C, je as Ct, Qt as D, fn as E, K as F, on as G, sn as H, tn as I, ot as J, an as K, ln as L, gn as M, hn as N, $t as O, Zt as P, tt as Q, rn as R, J as S, Oe as St, dn as T, X as U, cn as V, Y as W, rt as X, at as Y, it as Z, Cn as _, Re as _t, Ln as a, Ue as at, _n as b, N as bt, An as c, Ge as ct, jn as d, Ne as dt, Qe as et, Mn as f, Ie as ft, xn as g, Pe as gt, Sn as h, M as ht, Vn as i, qe as it, Q as j, un as k, Pn as l, Ke as lt, On as m, Fe as mt, $n as n, Ye as nt, zn as o, He as ot, Nn as p, Le as pt, P as q, Bn as r, Je as rt, Rn as s, We as st, Qn as t, Xe as tt, Fn as u, Me as ut, bn as v, Be as vt, pn as w, mn as x, ze as xt, yn as y, Ve as yt, en as z };
1695
1708
 
1696
- //# sourceMappingURL=config-CZZ2gdZH.mjs.map
1709
+ //# sourceMappingURL=config-BQmQyP3s.mjs.map