@camstack/system 1.1.37 → 1.1.38

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/index.js CHANGED
@@ -92987,6 +92987,30 @@ var StagingArea = class {
92987
92987
  force: true
92988
92988
  });
92989
92989
  }
92990
+ /**
92991
+ * Remove every staged dir under `stagingDir`. Safe — and meant — to run once
92992
+ * at boot: `cleanup(jobId)` only fires when a lifecycle job finishes, so a
92993
+ * restart (or crash) that interrupts a job mid-flight leaves its
92994
+ * `<stagingDir>/<jobId>/` behind forever. At boot no job is in flight, so any
92995
+ * entry present is an orphan. Returns the number of orphan dirs removed.
92996
+ */
92997
+ sweepOrphans() {
92998
+ let entries;
92999
+ try {
93000
+ entries = node_fs.readdirSync(this.stagingDir);
93001
+ } catch {
93002
+ return 0;
93003
+ }
93004
+ let removed = 0;
93005
+ for (const name of entries) try {
93006
+ node_fs.rmSync(node_path.join(this.stagingDir, name), {
93007
+ recursive: true,
93008
+ force: true
93009
+ });
93010
+ removed += 1;
93011
+ } catch {}
93012
+ return removed;
93013
+ }
92990
93014
  };
92991
93015
  //#endregion
92992
93016
  //#region src/kernel/lifecycle/lifecycle-job-engine.ts
package/dist/index.mjs CHANGED
@@ -92979,6 +92979,30 @@ var StagingArea = class {
92979
92979
  force: true
92980
92980
  });
92981
92981
  }
92982
+ /**
92983
+ * Remove every staged dir under `stagingDir`. Safe — and meant — to run once
92984
+ * at boot: `cleanup(jobId)` only fires when a lifecycle job finishes, so a
92985
+ * restart (or crash) that interrupts a job mid-flight leaves its
92986
+ * `<stagingDir>/<jobId>/` behind forever. At boot no job is in flight, so any
92987
+ * entry present is an orphan. Returns the number of orphan dirs removed.
92988
+ */
92989
+ sweepOrphans() {
92990
+ let entries;
92991
+ try {
92992
+ entries = fs$17.readdirSync(this.stagingDir);
92993
+ } catch {
92994
+ return 0;
92995
+ }
92996
+ let removed = 0;
92997
+ for (const name of entries) try {
92998
+ fs$17.rmSync(path$39.join(this.stagingDir, name), {
92999
+ recursive: true,
93000
+ force: true
93001
+ });
93002
+ removed += 1;
93003
+ } catch {}
93004
+ return removed;
93005
+ }
92982
93006
  };
92983
93007
  //#endregion
92984
93008
  //#region src/kernel/lifecycle/lifecycle-job-engine.ts
@@ -18,5 +18,13 @@ export declare class StagingArea {
18
18
  stagedPath: string;
19
19
  }>;
20
20
  cleanup(jobId: string): void;
21
+ /**
22
+ * Remove every staged dir under `stagingDir`. Safe — and meant — to run once
23
+ * at boot: `cleanup(jobId)` only fires when a lifecycle job finishes, so a
24
+ * restart (or crash) that interrupts a job mid-flight leaves its
25
+ * `<stagingDir>/<jobId>/` behind forever. At boot no job is in flight, so any
26
+ * entry present is an orphan. Returns the number of orphan dirs removed.
27
+ */
28
+ sweepOrphans(): number;
21
29
  }
22
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",