@pqpo/pragma 0.1.0-next.11 → 0.1.0-next.12

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 (2) hide show
  1. package/dist/cli.js +43 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -421943,7 +421943,7 @@ init_dist13();
421943
421943
  init_integration();
421944
421944
 
421945
421945
  // apps/cli/src/version.ts
421946
- var CLI_VERSION = false ? "0.0.0" : "0.1.0-next.11";
421946
+ var CLI_VERSION = false ? "0.0.0" : "0.1.0-next.12";
421947
421947
 
421948
421948
  // apps/cli/src/composition/default.ts
421949
421949
  function createCliLocalHost(input = {}) {
@@ -422481,18 +422481,47 @@ async function listMissionSnapshots(controller, missionsPath) {
422481
422481
  if (isNodeError4(error52, "ENOENT")) return [];
422482
422482
  throw error52;
422483
422483
  }
422484
+ const missionIds = [];
422485
+ for (const entry of directories) {
422486
+ if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
422487
+ if (!MissionIdSchema.safeParse(entry.name).success) continue;
422488
+ const localHostPath = join76(missionsPath, entry.name, "local-host");
422489
+ let localHostDirectory;
422490
+ try {
422491
+ localHostDirectory = await stat26(localHostPath);
422492
+ } catch (error52) {
422493
+ if (isNodeError4(error52, "ENOENT")) continue;
422494
+ throw localHostStorageError(entry.name);
422495
+ }
422496
+ if (!localHostDirectory.isDirectory()) throw localHostStorageError(entry.name);
422497
+ let aggregate;
422498
+ try {
422499
+ aggregate = await stat26(join76(localHostPath, "aggregate.json"));
422500
+ } catch (error52) {
422501
+ if (isNodeError4(error52, "ENOENT")) throw localHostStorageError(entry.name);
422502
+ throw localHostStorageError(entry.name);
422503
+ }
422504
+ if (!aggregate.isFile()) throw localHostStorageError(entry.name);
422505
+ missionIds.push(entry.name);
422506
+ }
422484
422507
  const snapshots = await Promise.all(
422485
- directories.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map(async (entry) => {
422486
- const snapshot = await controller.readSnapshot({ missionId: entry.name });
422508
+ missionIds.map(async (missionId) => {
422509
+ let snapshot;
422510
+ try {
422511
+ snapshot = await controller.readSnapshot({ missionId });
422512
+ } catch (error52) {
422513
+ if (IntegrationErrorSchema.safeParse(error52).success) throw error52;
422514
+ throw localHostStorageError(missionId);
422515
+ }
422487
422516
  const created = snapshot.events.find((event) => event.type === "mission.created");
422488
422517
  if (created === void 0) return void 0;
422489
422518
  const latest = snapshot.events.at(-1);
422490
422519
  const status = missionStatus(snapshot.events.map((event) => event.type));
422491
422520
  const executor = created.data["executor"];
422492
422521
  return {
422493
- id: entry.name,
422494
- missionId: entry.name,
422495
- title: entry.name,
422522
+ id: missionId,
422523
+ missionId,
422524
+ title: missionId,
422496
422525
  ...executor === void 0 ? {} : { executor },
422497
422526
  ...created.data["workspace"] === void 0 ? {} : { workspace: { canonicalPath: created.data["workspace"] } },
422498
422527
  status,
@@ -422512,6 +422541,14 @@ async function listMissionSnapshots(controller, missionsPath) {
422512
422541
  (left, right) => String(right["updatedAt"]).localeCompare(String(left["updatedAt"]))
422513
422542
  );
422514
422543
  }
422544
+ function localHostStorageError(missionId) {
422545
+ return createIntegrationError({
422546
+ code: "STORAGE_CORRUPTED",
422547
+ category: "protocol",
422548
+ message: "A Local Host Mission aggregate is corrupted.",
422549
+ details: { missionId }
422550
+ });
422551
+ }
422515
422552
  function missionStatus(eventTypes) {
422516
422553
  for (const type of eventTypes.toReversed()) {
422517
422554
  switch (type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pqpo/pragma",
3
- "version": "0.1.0-next.11",
3
+ "version": "0.1.0-next.12",
4
4
  "description": "Pragma command-line interface",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",