@nubbin/store-fs 0.1.0-rc.6 → 0.1.0

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/README.md CHANGED
@@ -5,7 +5,7 @@ file per route, and no aggregate document — so two publishes to different rout
5
5
  each other's write, because there is no shared file to read and rewrite.
6
6
 
7
7
  ```bash
8
- npm install @nubbin/store-fs@rc
8
+ npm install @nubbin/store-fs
9
9
  ```
10
10
 
11
11
  ```ts
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ async function fsManifest(root) {
39
39
  }
40
40
 
41
41
  // src/fsPublish.ts
42
- import { parseMatchKind } from "@nubbin/core";
42
+ import { NubbinIssueCode, parseMatchKind, refuse } from "@nubbin/core";
43
43
 
44
44
  // src/pointerPath.ts
45
45
  import { join as join3 } from "path";
@@ -57,9 +57,11 @@ function pointerPath(root, route) {
57
57
  // src/writeJsonAtomic.ts
58
58
  import { mkdir, rename, writeFile } from "fs/promises";
59
59
  import { dirname } from "path";
60
+ var writes = 0;
60
61
  async function writeJsonAtomic(filePath, value) {
61
62
  await mkdir(dirname(filePath), { recursive: true });
62
- const temp = `${filePath}.${process.pid}.tmp`;
63
+ writes += 1;
64
+ const temp = `${filePath}.${process.pid}.${writes}.tmp`;
63
65
  await writeFile(temp, JSON.stringify(value, null, 2));
64
66
  await rename(temp, filePath);
65
67
  }
@@ -67,7 +69,11 @@ async function writeJsonAtomic(filePath, value) {
67
69
  // src/fsPublish.ts
68
70
  async function fsPublish(root, route, hash) {
69
71
  if (!await readJsonOrNull(artifactPath(root, hash))) {
70
- throw new Error(`cannot publish ${route}: artifact ${hash} is not in the store`);
72
+ refuse(
73
+ NubbinIssueCode.ArtifactNotStored,
74
+ `cannot publish ${route}: artifact ${hash} is not in the store`,
75
+ route
76
+ );
71
77
  }
72
78
  const pointer = {
73
79
  route,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubbin/store-fs",
3
- "version": "0.1.0-rc.6",
3
+ "version": "0.1.0",
4
4
  "description": "The reference artifact store for Nubbin: one file per artifact, one pointer file per route, and no aggregate to lose a write.",
5
5
  "keywords": [
6
6
  "nubbin",
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@nubbin/core": "0.1.0-rc.6"
35
+ "@nubbin/core": "0.1.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "25.9.2",