@hatk/hatk 0.0.1-alpha.86 → 0.0.1-alpha.87
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/indexer.d.ts +12 -0
- package/dist/indexer.d.ts.map +1 -1
- package/dist/indexer.js +20 -0
- package/dist/spaces/engine.d.ts.map +1 -1
- package/dist/spaces/engine.js +5 -0
- package/package.json +1 -1
package/dist/indexer.d.ts
CHANGED
|
@@ -49,6 +49,18 @@ export declare function _flushForTests(): Promise<void>;
|
|
|
49
49
|
*/
|
|
50
50
|
/** Wait for a DID's backfill to complete if one is in flight. */
|
|
51
51
|
export declare function awaitBackfill(did: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Track a repo no signal collection will ever point at.
|
|
54
|
+
*
|
|
55
|
+
* Backfill and the stream find repos by what they write into the signal
|
|
56
|
+
* collections. A writer in a followed space is wanted for another reason:
|
|
57
|
+
* their public profile is what puts a name and a face on everything they
|
|
58
|
+
* wrote there, and an app that only indexes the community's own records
|
|
59
|
+
* would render every member as a DID. So the space engine names them here,
|
|
60
|
+
* and an unknown one is backfilled like a repo the stream just surfaced.
|
|
61
|
+
* Idempotent and cheap: a repo already known is a map lookup.
|
|
62
|
+
*/
|
|
63
|
+
export declare function trackRepo(did: string): void;
|
|
52
64
|
export declare function triggerAutoBackfill(did: string, attempt?: number): Promise<void>;
|
|
53
65
|
/**
|
|
54
66
|
* Indexing behaviour shared by every stream source. Both the relay firehose
|
package/dist/indexer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AA2CA,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,G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,CAAC,IAAI,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,CAkE9D;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
|
@@ -258,6 +258,26 @@ export function awaitBackfill(did) {
|
|
|
258
258
|
const entry = backfillPromises.get(did);
|
|
259
259
|
return entry ? entry.promise : Promise.resolve();
|
|
260
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Track a repo no signal collection will ever point at.
|
|
263
|
+
*
|
|
264
|
+
* Backfill and the stream find repos by what they write into the signal
|
|
265
|
+
* collections. A writer in a followed space is wanted for another reason:
|
|
266
|
+
* their public profile is what puts a name and a face on everything they
|
|
267
|
+
* wrote there, and an app that only indexes the community's own records
|
|
268
|
+
* would render every member as a DID. So the space engine names them here,
|
|
269
|
+
* and an unknown one is backfilled like a repo the stream just surfaced.
|
|
270
|
+
* Idempotent and cheap: a repo already known is a map lookup.
|
|
271
|
+
*/
|
|
272
|
+
export function trackRepo(did) {
|
|
273
|
+
if (indexerPinnedRepos && !indexerPinnedRepos.has(did))
|
|
274
|
+
return;
|
|
275
|
+
const status = repoStatusCache.get(did);
|
|
276
|
+
if (status && status !== 'unknown')
|
|
277
|
+
return;
|
|
278
|
+
repoStatusCache.set(did, 'pending');
|
|
279
|
+
void triggerAutoBackfill(did);
|
|
280
|
+
}
|
|
261
281
|
export async function triggerAutoBackfill(did, attempt = 0) {
|
|
262
282
|
if (backfillInFlight.has(did))
|
|
263
283
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/spaces/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/spaces/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAQ/C,OAAO,EAA0D,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE9G,OAAO,EAUL,KAAK,UAAU,EAChB,MAAM,YAAY,CAAA;AAMnB,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,WAAW,CAAA;IAClB,4EAA4E;IAC5E,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAClB,mFAAmF;IACnF,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAaD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAEnE;AAOD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAQnE;AAkUD,iFAAiF;AACjF,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBjH;AAkED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCrE;AAID,oDAAoD;AACpD,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAUnE;AAED,kEAAkE;AAClE,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW/D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAKjG;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAclD"}
|
package/dist/spaces/engine.js
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
import { getLexicon, getLexiconArray } from "../database/schema.js";
|
|
31
31
|
import { bulkInsertRecords, deleteRecord, insertRecord, purgeSpaceRecords } from "../database/db.js";
|
|
32
32
|
import { validateRecord } from '@bigmoves/lexicon';
|
|
33
|
+
import { trackRepo } from "../indexer.js";
|
|
33
34
|
import { emit, timer } from "../logger.js";
|
|
34
35
|
import { isPrivateCollection } from "../private-collections.js";
|
|
35
36
|
import { listSessionDids } from "../oauth/db.js";
|
|
@@ -452,6 +453,10 @@ export async function reconcileSpace(watch) {
|
|
|
452
453
|
await ensureRegistered(watch, credential);
|
|
453
454
|
const writers = await listWriters(watch, credential);
|
|
454
455
|
const remote = new Set(writers.map((w) => w.did));
|
|
456
|
+
// Whoever writes into the space is somebody the app will name, so their
|
|
457
|
+
// public repo — profile first of all — is indexed too.
|
|
458
|
+
for (const writer of writers)
|
|
459
|
+
trackRepo(writer.did);
|
|
455
460
|
let synced = 0;
|
|
456
461
|
for (const writer of writers) {
|
|
457
462
|
const local = await getSpaceRepo(watch.space, writer.did);
|