@tsdoctor/snapshot 0.5.9 → 0.5.11

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.
@@ -1,5 +1,6 @@
1
1
  import { hashContent } from "./content-hash.js";
2
2
  import { Context, Data, Effect, Layer, Option } from "effect";
3
+ import { ErrorText } from "@effected/engine";
3
4
  import { Store } from "@effected/store";
4
5
 
5
6
  // src/SnapshotService.ts
@@ -109,7 +110,7 @@ function toSnapshotDbError(error) {
109
110
  return new SnapshotDbError({
110
111
  operation: "query",
111
112
  dbPath: "snapshot-db",
112
- reason: error instanceof Error ? error.message : String(error)
113
+ reason: ErrorText.describe(error)
113
114
  });
114
115
  }
115
116
  const migrations = [{
package/content-hash.js CHANGED
@@ -3,6 +3,7 @@ import { JsoncFingerprint } from "@effected/jsonc";
3
3
  import { Result } from "effect";
4
4
 
5
5
  // src/content-hash.ts
6
+ const digest = (bytes) => createHash("sha256").update(bytes).digest();
6
7
  /**
7
8
  * Normalizes content string for consistent hashing.
8
9
  *
@@ -48,8 +49,7 @@ function normalizeContent(content) {
48
49
  * @public
49
50
  */
50
51
  function hashContent(content) {
51
- const normalized = normalizeContent(content);
52
- return createHash("sha256").update(normalized).digest("hex");
52
+ return Result.getOrThrow(JsoncFingerprint.hashTextResult(normalizeContent(content), digest));
53
53
  }
54
54
  const TIMESTAMP_KEYS = /* @__PURE__ */ new Set([
55
55
  "publishedTime",
@@ -156,9 +156,9 @@ function hashFrontmatter(frontmatter) {
156
156
  if (TIMESTAMP_KEYS.has(key)) continue;
157
157
  filtered[key] = stripTimestamps(frontmatter[key]);
158
158
  }
159
- const canonical = JsoncFingerprint.canonicalizeResult(filtered);
160
- if (Result.isFailure(canonical)) throw new Error(`Frontmatter cannot be canonicalized for hashing: ${canonical.failure.message}`);
161
- return createHash("sha256").update(canonical.success).digest("hex");
159
+ const hash = JsoncFingerprint.hashResult(filtered, digest);
160
+ if (Result.isFailure(hash)) throw new Error(`Frontmatter cannot be canonicalized for hashing: ${hash.failure.message}`);
161
+ return hash.success;
162
162
  }
163
163
 
164
164
  export { hashContent, hashFrontmatter, normalizeContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsdoctor/snapshot",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "private": false,
5
5
  "description": "Incremental-build snapshot tracking for static documentation pipelines: a schema-versioned SQLite store of per-file content hashes and timestamps, built on @effected/store, plus the pure SHA-256 content-hashing helpers that feed it.",
6
6
  "keywords": [
@@ -37,11 +37,12 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "dependencies": {
40
- "@effected/jsonc": "^0.20.0"
40
+ "@effected/engine": "^0.10.0",
41
+ "@effected/jsonc": "^0.21.0"
41
42
  },
42
43
  "peerDependencies": {
43
- "@effected/store": "^0.19.0",
44
- "effect": "^4.0.6"
44
+ "@effected/store": "^0.21.0",
45
+ "effect": "^4.0.7"
45
46
  },
46
47
  "engines": {
47
48
  "node": ">=24.11.0"
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.4"
8
+ "packageVersion": "7.60.0"
9
9
  }
10
10
  ]
11
11
  }