@hatk/hatk 0.0.1-alpha.90 → 0.0.1-alpha.93

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 +1 @@
1
- {"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAE/D;AAGD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,6CAA6C;AAC7C,UAAU,YAAY;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,wDAAwD;IACxD,MAAM,EAAE,cAAc,CAAA;CACvB;AAWD;oFACoF;AACpF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAID;8EAC8E;AAC9E,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMzD;AAsFD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0K/G;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIrE"}
1
+ {"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../src/backfill.ts"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAE/D;AAGD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,6CAA6C;AAC7C,UAAU,YAAY;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,wDAAwD;IACxD,MAAM,EAAE,cAAc,CAAA;CACvB;AAWD;oFACoF;AACpF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAID;8EAC8E;AAC9E,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMzD;AAsFD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+K/G;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIrE"}
package/dist/backfill.js CHANGED
@@ -223,21 +223,26 @@ export async function backfillRepo(did, collections, fetchTimeout) {
223
223
  // Walk MST to find all record paths
224
224
  const entries = walkMst(blocks, commit.data.$link);
225
225
  // Delete existing records for this DID before re-importing so deletions are reflected
226
- // Only on full imports (no since) — diff CARs only contain changes
226
+ // Only on full imports (no since) — diff CARs only contain changes.
227
+ //
228
+ // Only the rows this repo holds. A record the same account wrote into a
229
+ // permissioned space is not in its repo: it lives with the space, is read
230
+ // through the space sync, and stays put across a re-import of the repo.
227
231
  if (!lastRev) {
228
232
  for (const col of purgeableCollections(collections)) {
229
233
  const schema = getSchema(col);
230
234
  if (!schema)
231
235
  continue;
232
- await runSQL(`DELETE FROM ${schema.tableName} WHERE did = $1`, [did]);
236
+ const ownRows = `SELECT uri FROM ${schema.tableName} WHERE did = $1 AND space IS NULL`;
233
237
  for (const child of schema.children) {
234
- await runSQL(`DELETE FROM ${child.tableName} WHERE parent_did = $1`, [did]);
238
+ await runSQL(`DELETE FROM ${child.tableName} WHERE parent_uri IN (${ownRows})`, [did]);
235
239
  }
236
240
  for (const union of schema.unions) {
237
241
  for (const branch of union.branches) {
238
- await runSQL(`DELETE FROM ${branch.tableName} WHERE parent_did = $1`, [did]);
242
+ await runSQL(`DELETE FROM ${branch.tableName} WHERE parent_uri IN (${ownRows})`, [did]);
239
243
  }
240
244
  }
245
+ await runSQL(`DELETE FROM ${schema.tableName} WHERE did = $1 AND space IS NULL`, [did]);
241
246
  }
242
247
  }
243
248
  // Insert records in chunks to limit memory usage
package/dist/indexer.d.ts CHANGED
@@ -33,6 +33,17 @@ export declare function setCursorKey(key: 'relay' | 'jetstream'): void;
33
33
  export declare function resumeCursor(liveSeq: number | null, bootCursor: string | null | undefined): string | null | undefined;
34
34
  /** Reset module cursor state between tests. */
35
35
  export declare function _resetCursorStateForTests(): void;
36
+ /**
37
+ * Forget which repos this process is tracking.
38
+ *
39
+ * The status cache is deliberately process-global — it is what keeps the
40
+ * commit hot path off the database — and it outlives any table a test
41
+ * truncates. A suite that clears `_repos` between cases and does not clear
42
+ * this sees the second case behave as though the first one's repos were
43
+ * still known, which is how the seam between tracking and backfill went
44
+ * untested.
45
+ */
46
+ export declare function _resetRepoTrackingForTests(): void;
36
47
  /**
37
48
  * Drain the write buffer instead of waiting out FLUSH_INTERVAL_MS. Lets
38
49
  * end-to-end tests assert on rows immediately after feeding a frame — deletes
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AA+ChD,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,yBAAyB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B;AAgMD,6GAA6G;AAC7G,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAE1C;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAStD;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAErH;AAED,+CAA+C;AAC/C,wBAAgB,yBAAyB,IAAI,IAAI,CAIhD;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAMpD;AAED;;;;;;;GAOG;AACH,iEAAiE;AAC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AAI,CAAC,CA4CvG;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAE3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,IAAI,CAmE9D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,KAAK,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAc,GACrC,IAAI,CAoDN"}
package/dist/indexer.js CHANGED
@@ -235,6 +235,23 @@ export function _resetCursorStateForTests() {
235
235
  lastPersistedSeq = null;
236
236
  cursorKey = 'relay';
237
237
  }
238
+ /**
239
+ * Forget which repos this process is tracking.
240
+ *
241
+ * The status cache is deliberately process-global — it is what keeps the
242
+ * commit hot path off the database — and it outlives any table a test
243
+ * truncates. A suite that clears `_repos` between cases and does not clear
244
+ * this sees the second case behave as though the first one's repos were
245
+ * still known, which is how the seam between tracking and backfill went
246
+ * untested.
247
+ */
248
+ export function _resetRepoTrackingForTests() {
249
+ repoStatusCache.clear();
250
+ backfillInFlight.clear();
251
+ backfillPromises.clear();
252
+ pendingReschedule.clear();
253
+ pendingBuffers.clear();
254
+ }
238
255
  /**
239
256
  * Drain the write buffer instead of waiting out FLUSH_INTERVAL_MS. Lets
240
257
  * end-to-end tests assert on rows immediately after feeding a frame — deletes
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAsEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAuE9C;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CA2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ACzB,MAAM,GAAE,MAAM,EAAO,EACrB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAC5D,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,WAAW,EAAE,MAAM,CAG5B"}
package/dist/server.js CHANGED
@@ -1261,8 +1261,19 @@ export function createHandler(config) {
1261
1261
  });
1262
1262
  }
1263
1263
  catch (err) {
1264
- if (err instanceof NoticeError)
1264
+ if (err instanceof NoticeError) {
1265
+ // Loud on this side too. A refused notice is otherwise visible
1266
+ // only in the authority's log, which belongs to somebody else —
1267
+ // so an appview silently falls back to the sweep and looks merely
1268
+ // slow rather than broken.
1269
+ emit('spaces', 'notice_refused', {
1270
+ space: notice.space,
1271
+ repo: notice.repo,
1272
+ status: err.status,
1273
+ reason: err.message,
1274
+ });
1265
1275
  return withCors(jsonError(err.status, err.message, acceptEncoding));
1276
+ }
1266
1277
  throw err;
1267
1278
  }
1268
1279
  // Debounced per repo: one member writing a gallery sends a notice per
@@ -34,6 +34,13 @@ export declare function parseMultibaseKey(multibase: string): PublicKey;
34
34
  * Low-S is required — atproto mandates it and a malleable signature would let
35
35
  * the same assertion be presented twice with different bytes — and is what
36
36
  * @noble enforces by default.
37
+ *
38
+ * `prehash: false` says the second argument is already a digest, and is not
39
+ * optional: @noble/curves hashes it again without it, so every signature from
40
+ * a real counterparty is rejected while one this module both makes and checks
41
+ * still matches. A test that signs through the same call cannot see that, so
42
+ * the vectors in the suite are fixed bytes from the library atproto signs
43
+ * with rather than a round trip through this one.
37
44
  */
38
45
  export declare function verifySignature(key: PublicKey, signature: Uint8Array, message: Uint8Array): boolean;
39
46
  //# sourceMappingURL=verify.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/spaces/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,CAAA;AAE/C,qBAAa,cAAe,SAAQ,KAAK;CAAG;AAE5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAuBzD;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,YAAY,CAAA;IACnB,sCAAsC;IACtC,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAO9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAUnG"}
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/spaces/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,CAAA;AAE/C,qBAAa,cAAe,SAAQ,KAAK;CAAG;AAE5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAuBzD;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,YAAY,CAAA;IACnB,sCAAsC;IACtC,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAO9D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAUnG"}
@@ -71,6 +71,13 @@ export function parseMultibaseKey(multibase) {
71
71
  * Low-S is required — atproto mandates it and a malleable signature would let
72
72
  * the same assertion be presented twice with different bytes — and is what
73
73
  * @noble enforces by default.
74
+ *
75
+ * `prehash: false` says the second argument is already a digest, and is not
76
+ * optional: @noble/curves hashes it again without it, so every signature from
77
+ * a real counterparty is rejected while one this module both makes and checks
78
+ * still matches. A test that signs through the same call cannot see that, so
79
+ * the vectors in the suite are fixed bytes from the library atproto signs
80
+ * with rather than a round trip through this one.
74
81
  */
75
82
  export function verifySignature(key, signature, message) {
76
83
  if (signature.length !== 64)
@@ -78,7 +85,7 @@ export function verifySignature(key, signature, message) {
78
85
  const digest = sha256(message);
79
86
  try {
80
87
  const curve = key.curve === 'secp256k1' ? secp256k1 : p256;
81
- return curve.verify(signature, digest, key.bytes);
88
+ return curve.verify(signature, digest, key.bytes, { prehash: false });
82
89
  }
83
90
  catch {
84
91
  // A malformed point or scalar is a failed verification, not a crash.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatk/hatk",
3
- "version": "0.0.1-alpha.90",
3
+ "version": "0.0.1-alpha.93",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "hatk": "dist/cli.js"