@tsdoctor/snapshot 0.5.10 → 0.6.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/SnapshotService.js +2 -1
- package/content-hash.js +5 -5
- package/package.json +5 -4
- package/tsdoc-metadata.json +1 -1
package/SnapshotService.js
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
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
|
|
160
|
-
if (Result.isFailure(
|
|
161
|
-
return
|
|
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.
|
|
3
|
+
"version": "0.6.0",
|
|
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/
|
|
40
|
+
"@effected/engine": "^0.11.0",
|
|
41
|
+
"@effected/jsonc": "^0.22.0"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
|
-
"@effected/store": "^0.
|
|
44
|
-
"effect": "
|
|
44
|
+
"@effected/store": "^0.22.0",
|
|
45
|
+
"effect": "~4.1.1"
|
|
45
46
|
},
|
|
46
47
|
"engines": {
|
|
47
48
|
"node": ">=24.11.0"
|