@hatk/hatk 0.0.1-alpha.13 → 0.0.1-alpha.14
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/backfill.d.ts.map +1 -1
- package/dist/backfill.js +18 -3
- package/dist/main.js +5 -0
- package/package.json +1 -1
package/dist/backfill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,6CAA6C;AAC7C,UAAU,YAAY;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,qDAAqD;IACrD,MAAM,EAAE,cAAc,CAAA;CACvB;AAuGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,6CAA6C;AAC7C,UAAU,YAAY;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,qDAAqD;IACrD,MAAM,EAAE,cAAc,CAAA;CACvB;AAuGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsJ/G;AAgCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiInE"}
|
package/dist/backfill.js
CHANGED
|
@@ -153,10 +153,25 @@ export async function backfillRepo(did, collections, fetchTimeout) {
|
|
|
153
153
|
throw httpErr;
|
|
154
154
|
}
|
|
155
155
|
resolvedSince = lastRev;
|
|
156
|
-
|
|
156
|
+
let { roots, blocks, byteLength } = await parseCarStream(res.body);
|
|
157
157
|
carSizeBytes = byteLength;
|
|
158
|
-
// Decode commit to get MST root
|
|
159
|
-
|
|
158
|
+
// Decode commit to get MST root — if the diff CAR is missing the root block,
|
|
159
|
+
// fall back to a full import (the PDS compacted past our `since` rev)
|
|
160
|
+
let rootData = blocks.get(roots[0]);
|
|
161
|
+
if (!rootData && lastRev) {
|
|
162
|
+
lastRev = null;
|
|
163
|
+
resolvedSince = null;
|
|
164
|
+
res = await fetch(baseUrl, { signal: controller.signal });
|
|
165
|
+
if (!res.ok) {
|
|
166
|
+
const httpErr = new Error(`getRepo failed for ${did}: ${res.status}`);
|
|
167
|
+
httpErr.httpStatus = res.status;
|
|
168
|
+
throw httpErr;
|
|
169
|
+
}
|
|
170
|
+
;
|
|
171
|
+
({ roots, blocks, byteLength } = await parseCarStream(res.body));
|
|
172
|
+
carSizeBytes = byteLength;
|
|
173
|
+
rootData = blocks.get(roots[0]);
|
|
174
|
+
}
|
|
160
175
|
if (!rootData)
|
|
161
176
|
throw new Error(`No root block for ${did}`);
|
|
162
177
|
const { value: commit } = cborDecode(rootData);
|
package/dist/main.js
CHANGED