@hatk/hatk 0.0.1-alpha.8 → 0.0.1-alpha.81
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/adapter.d.ts +19 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +111 -0
- package/dist/backfill.d.ts +29 -2
- package/dist/backfill.d.ts.map +1 -1
- package/dist/backfill.js +136 -51
- package/dist/car.d.ts +42 -10
- package/dist/car.d.ts.map +1 -1
- package/dist/car.js +154 -14
- package/dist/cli.js +243 -1043
- package/dist/config.d.ts +82 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -9
- package/dist/database/adapter-factory.d.ts +6 -0
- package/dist/database/adapter-factory.d.ts.map +1 -0
- package/dist/database/adapter-factory.js +20 -0
- package/dist/database/adapters/duckdb-search.d.ts +12 -0
- package/dist/database/adapters/duckdb-search.d.ts.map +1 -0
- package/dist/database/adapters/duckdb-search.js +27 -0
- package/dist/database/adapters/duckdb.d.ts +25 -0
- package/dist/database/adapters/duckdb.d.ts.map +1 -0
- package/dist/database/adapters/duckdb.js +161 -0
- package/dist/database/adapters/sqlite-search.d.ts +16 -0
- package/dist/database/adapters/sqlite-search.d.ts.map +1 -0
- package/dist/database/adapters/sqlite-search.js +76 -0
- package/dist/database/adapters/sqlite.d.ts +18 -0
- package/dist/database/adapters/sqlite.d.ts.map +1 -0
- package/dist/database/adapters/sqlite.js +88 -0
- package/dist/{db.d.ts → database/db.d.ts} +57 -6
- package/dist/database/db.d.ts.map +1 -0
- package/dist/{db.js → database/db.js} +755 -552
- package/dist/database/dialect.d.ts +45 -0
- package/dist/database/dialect.d.ts.map +1 -0
- package/dist/database/dialect.js +72 -0
- package/dist/{fts.d.ts → database/fts.d.ts} +7 -0
- package/dist/database/fts.d.ts.map +1 -0
- package/dist/{fts.js → database/fts.js} +116 -32
- package/dist/database/index.d.ts +7 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +6 -0
- package/dist/database/ports.d.ts +50 -0
- package/dist/database/ports.d.ts.map +1 -0
- package/dist/database/ports.js +1 -0
- package/dist/{schema.d.ts → database/schema.d.ts} +14 -3
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/{schema.js → database/schema.js} +81 -41
- package/dist/dev-entry.d.ts +8 -0
- package/dist/dev-entry.d.ts.map +1 -0
- package/dist/dev-entry.js +125 -0
- package/dist/feeds.d.ts +12 -8
- package/dist/feeds.d.ts.map +1 -1
- package/dist/feeds.js +51 -6
- package/dist/hooks.d.ts +85 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +163 -0
- package/dist/hydrate.d.ts +7 -6
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +4 -16
- package/dist/indexer.d.ts +133 -3
- package/dist/indexer.d.ts.map +1 -1
- package/dist/indexer.js +406 -66
- package/dist/jetstream.d.ts +118 -0
- package/dist/jetstream.d.ts.map +1 -0
- package/dist/jetstream.js +225 -0
- package/dist/labels.d.ts +36 -0
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +71 -6
- package/dist/lexicon-resolve.d.ts.map +1 -1
- package/dist/lexicon-resolve.js +27 -112
- package/dist/lexicons/com/atproto/label/defs.json +75 -0
- package/dist/lexicons/com/atproto/moderation/defs.json +30 -0
- package/dist/lexicons/com/atproto/repo/strongRef.json +21 -0
- package/dist/lexicons/dev/hatk/applyWrites.json +87 -0
- package/dist/lexicons/dev/hatk/createRecord.json +40 -0
- package/dist/lexicons/dev/hatk/createReport.json +48 -0
- package/dist/lexicons/dev/hatk/deleteRecord.json +25 -0
- package/dist/lexicons/dev/hatk/describeCollections.json +41 -0
- package/dist/lexicons/dev/hatk/describeFeeds.json +29 -0
- package/dist/lexicons/dev/hatk/describeLabels.json +45 -0
- package/dist/lexicons/dev/hatk/getFeed.json +30 -0
- package/dist/lexicons/dev/hatk/getPreferences.json +19 -0
- package/dist/lexicons/dev/hatk/getRecord.json +26 -0
- package/dist/lexicons/dev/hatk/getRecords.json +32 -0
- package/dist/lexicons/dev/hatk/putPreference.json +28 -0
- package/dist/lexicons/dev/hatk/putRecord.json +41 -0
- package/dist/lexicons/dev/hatk/searchRecords.json +32 -0
- package/dist/lexicons/dev/hatk/uploadBlob.json +23 -0
- package/dist/logger.d.ts +29 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +29 -0
- package/dist/main.js +169 -74
- package/dist/mst.d.ts +18 -1
- package/dist/mst.d.ts.map +1 -1
- package/dist/mst.js +19 -8
- package/dist/oauth/db.d.ts +3 -1
- package/dist/oauth/db.d.ts.map +1 -1
- package/dist/oauth/db.js +56 -19
- package/dist/oauth/discovery.d.ts.map +1 -1
- package/dist/oauth/discovery.js +13 -1
- package/dist/oauth/server.d.ts +92 -1
- package/dist/oauth/server.d.ts.map +1 -1
- package/dist/oauth/server.js +352 -37
- package/dist/oauth/service-describe.d.ts +31 -0
- package/dist/oauth/service-describe.d.ts.map +1 -0
- package/dist/oauth/service-describe.js +61 -0
- package/dist/oauth/session.d.ts +32 -0
- package/dist/oauth/session.d.ts.map +1 -0
- package/dist/oauth/session.js +131 -0
- package/dist/opengraph.d.ts +10 -0
- package/dist/opengraph.d.ts.map +1 -1
- package/dist/opengraph.js +80 -40
- package/dist/pds-proxy.d.ts +82 -0
- package/dist/pds-proxy.d.ts.map +1 -0
- package/dist/pds-proxy.js +356 -0
- package/dist/private-collections.d.ts +8 -0
- package/dist/private-collections.d.ts.map +1 -0
- package/dist/private-collections.js +22 -0
- package/dist/push.d.ts +54 -0
- package/dist/push.d.ts.map +1 -0
- package/dist/push.js +367 -0
- package/dist/renderer.d.ts +27 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +46 -0
- package/dist/resolve-hatk.d.ts +6 -0
- package/dist/resolve-hatk.d.ts.map +1 -0
- package/dist/resolve-hatk.js +20 -0
- package/dist/response.d.ts +16 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/response.js +69 -0
- package/dist/scanner.d.ts +21 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +88 -0
- package/dist/seed.d.ts +19 -0
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +43 -4
- package/dist/server-init.d.ts +8 -0
- package/dist/server-init.d.ts.map +1 -0
- package/dist/server-init.js +62 -0
- package/dist/server.d.ts +26 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +858 -638
- package/dist/setup.d.ts +28 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +50 -3
- package/dist/templates/feed.tpl +14 -0
- package/dist/templates/hook.tpl +5 -0
- package/dist/templates/label.tpl +15 -0
- package/dist/templates/og.tpl +17 -0
- package/dist/templates/seed.tpl +11 -0
- package/dist/templates/setup.tpl +5 -0
- package/dist/templates/test-feed.tpl +19 -0
- package/dist/templates/test-xrpc.tpl +19 -0
- package/dist/templates/xrpc.tpl +41 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +41 -32
- package/dist/views.js +1 -1
- package/dist/vite-plugin.d.ts +1 -1
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +254 -66
- package/dist/xrpc.d.ts +84 -11
- package/dist/xrpc.d.ts.map +1 -1
- package/dist/xrpc.js +211 -41
- package/package.json +17 -9
- package/public/admin-auth.js +271 -306
- package/public/admin.html +177 -61
- package/dist/db.d.ts.map +0 -1
- package/dist/fts.d.ts.map +0 -1
- package/dist/oauth/hooks.d.ts +0 -10
- package/dist/oauth/hooks.d.ts.map +0 -1
- package/dist/oauth/hooks.js +0 -40
- package/dist/schema.d.ts.map +0 -1
- package/dist/test-browser.d.ts +0 -14
- package/dist/test-browser.d.ts.map +0 -1
- package/dist/test-browser.js +0 -26
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { OAuthConfig } from './config.ts';
|
|
2
|
+
import { type BaseContext } from './hydrate.ts';
|
|
3
|
+
import { type PushInterface } from './push.ts';
|
|
4
|
+
/** Context passed to the on-login hook after a successful OAuth login. */
|
|
5
|
+
export type OnLoginCtx = Omit<BaseContext, 'db'> & {
|
|
6
|
+
/** DID of the user who just logged in. */
|
|
7
|
+
did: string;
|
|
8
|
+
/** Database access with both read and write. */
|
|
9
|
+
db: {
|
|
10
|
+
query: (sql: string, params?: unknown[]) => Promise<unknown[]>;
|
|
11
|
+
run: (sql: string, params?: unknown[]) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
/** Trigger a backfill for a DID and wait for it to complete. */
|
|
14
|
+
ensureRepo: (did: string) => Promise<void>;
|
|
15
|
+
/** Write a record to the user's PDS and index locally. */
|
|
16
|
+
createRecord: (collection: string, record: Record<string, unknown>, opts?: {
|
|
17
|
+
rkey?: string;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
uri?: string;
|
|
20
|
+
cid?: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Create or update a record on the user's PDS and index locally. */
|
|
23
|
+
putRecord: (collection: string, rkey: string, record: Record<string, unknown>) => Promise<{
|
|
24
|
+
uri?: string;
|
|
25
|
+
cid?: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** Delete a record from the user's PDS and local index. */
|
|
28
|
+
deleteRecord: (collection: string, rkey: string) => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
/** Context passed to on-commit hooks after a record is indexed. */
|
|
31
|
+
export type OnCommitCtx = {
|
|
32
|
+
/** Whether the record was created or deleted. */
|
|
33
|
+
action: 'create' | 'delete';
|
|
34
|
+
/** The collection NSID that matched. */
|
|
35
|
+
collection: string;
|
|
36
|
+
/** The record value (null for deletes). */
|
|
37
|
+
record: Record<string, any> | null;
|
|
38
|
+
/** DID of the committing actor. */
|
|
39
|
+
repo: string;
|
|
40
|
+
/** AT URI of the record. */
|
|
41
|
+
uri: string;
|
|
42
|
+
/** Database access (read and write). */
|
|
43
|
+
db: {
|
|
44
|
+
query: (sql: string, params?: unknown[]) => Promise<unknown[]>;
|
|
45
|
+
run: (sql: string, params?: unknown[]) => Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
/** Typed record lookup (same as BaseContext). */
|
|
48
|
+
lookup: BaseContext['lookup'];
|
|
49
|
+
/** Push notification delivery. */
|
|
50
|
+
push: PushInterface;
|
|
51
|
+
};
|
|
52
|
+
export declare function defineHook(event: 'on-login', handler: (ctx: OnLoginCtx) => Promise<void>): {
|
|
53
|
+
__type: 'hook';
|
|
54
|
+
event: 'on-login';
|
|
55
|
+
handler: (ctx: OnLoginCtx) => Promise<void>;
|
|
56
|
+
};
|
|
57
|
+
export declare function defineHook(event: 'on-commit', options: {
|
|
58
|
+
collections: string[];
|
|
59
|
+
}, handler: (ctx: OnCommitCtx) => Promise<void>): {
|
|
60
|
+
__type: 'hook';
|
|
61
|
+
event: 'on-commit';
|
|
62
|
+
collections: string[];
|
|
63
|
+
handler: (ctx: OnCommitCtx) => Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Discover and load the on-login hook from the project's `hooks/` directory.
|
|
67
|
+
* Looks for `on-login.ts` or `on-login.js`. Safe to call if no hook exists.
|
|
68
|
+
*/
|
|
69
|
+
export declare function loadOnLoginHook(hooksDir: string): Promise<void>;
|
|
70
|
+
/** Register a hook from a scanned server/ module. */
|
|
71
|
+
export declare function registerHook(event: string, handler: Function, options?: any): void;
|
|
72
|
+
/** Fire the on-login hook if loaded. Errors are logged but never block login. */
|
|
73
|
+
export declare function fireOnLoginHook(did: string, oauthConfig: OAuthConfig | null): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Fire on-commit hooks for a batch of indexed records.
|
|
76
|
+
* Runs async and non-blocking — errors are logged but never throw.
|
|
77
|
+
*/
|
|
78
|
+
export declare function fireOnCommitHooks(items: Array<{
|
|
79
|
+
action: 'create' | 'delete';
|
|
80
|
+
collection: string;
|
|
81
|
+
uri: string;
|
|
82
|
+
authorDid: string;
|
|
83
|
+
record: Record<string, any> | null;
|
|
84
|
+
}>): void;
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AE,CAAA;AACrF,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,EAClC,OAAO,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAC3C;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAA;AAkB9G;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrE;AASD,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CASlF;AAED,iFAAiF;AACjF,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BjG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,CAAC;IACX,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;CACnC,CAAC,GACD,IAAI,CA6BN"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Lifecycle hooks that run in response to server events.
|
|
11
|
+
*
|
|
12
|
+
* Place hook modules in the `hooks/` directory. Currently supported hooks:
|
|
13
|
+
*
|
|
14
|
+
* - `on-login.ts` — called after each successful OAuth login
|
|
15
|
+
* - `on-commit-*.ts` — called after records are indexed from the firehose
|
|
16
|
+
*
|
|
17
|
+
* Each hook default-exports the result of `defineHook()`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* // hooks/on-login.ts
|
|
22
|
+
* import { defineHook } from '$hatk'
|
|
23
|
+
*
|
|
24
|
+
* export default defineHook("on-login", async (ctx) => {
|
|
25
|
+
* await ctx.ensureRepo(ctx.did)
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // hooks/on-commit-favorite.ts
|
|
32
|
+
* import { defineHook } from '$hatk'
|
|
33
|
+
*
|
|
34
|
+
* export default defineHook("on-commit", { collections: ["social.grain.favorite"] },
|
|
35
|
+
* async ({ action, collection, record, repo, uri, db, lookup, push }) => {
|
|
36
|
+
* if (action !== "create") return
|
|
37
|
+
* // send push notification, etc.
|
|
38
|
+
* }
|
|
39
|
+
* )
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
import { existsSync } from 'node:fs';
|
|
43
|
+
import { resolve } from 'node:path';
|
|
44
|
+
import { pdsCreateRecord, pdsPutRecord, pdsDeleteRecord } from "./pds-proxy.js";
|
|
45
|
+
import { log, emit } from "./logger.js";
|
|
46
|
+
import { setRepoStatus, runSQL } from "./database/db.js";
|
|
47
|
+
import { triggerAutoBackfill, awaitBackfill } from "./indexer.js";
|
|
48
|
+
import { buildBaseContext } from "./hydrate.js";
|
|
49
|
+
import { buildPushInterface, isPushEnabled } from "./push.js";
|
|
50
|
+
export function defineHook(event, ...args) {
|
|
51
|
+
if (event === 'on-login') {
|
|
52
|
+
return { __type: 'hook', event, handler: args[0] };
|
|
53
|
+
}
|
|
54
|
+
if (event === 'on-commit') {
|
|
55
|
+
const options = args[0];
|
|
56
|
+
const handler = args[1];
|
|
57
|
+
return { __type: 'hook', event, collections: options.collections, handler };
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Unknown hook event: ${event}`);
|
|
60
|
+
}
|
|
61
|
+
let onLoginHook = null;
|
|
62
|
+
const onCommitHooks = [];
|
|
63
|
+
/**
|
|
64
|
+
* Discover and load the on-login hook from the project's `hooks/` directory.
|
|
65
|
+
* Looks for `on-login.ts` or `on-login.js`. Safe to call if no hook exists.
|
|
66
|
+
*/
|
|
67
|
+
export async function loadOnLoginHook(hooksDir) {
|
|
68
|
+
const tsPath = resolve(hooksDir, 'on-login.ts');
|
|
69
|
+
const jsPath = resolve(hooksDir, 'on-login.js');
|
|
70
|
+
const path = existsSync(tsPath) ? tsPath : existsSync(jsPath) ? jsPath : null;
|
|
71
|
+
if (!path)
|
|
72
|
+
return;
|
|
73
|
+
const mod = await import(__rewriteRelativeImportExtension(/* @vite-ignore */ `${path}?t=${Date.now()}`));
|
|
74
|
+
onLoginHook = mod.default;
|
|
75
|
+
log('[hooks] on-login hook loaded');
|
|
76
|
+
}
|
|
77
|
+
/** Mark a DID as pending, trigger auto-backfill, and wait for completion. */
|
|
78
|
+
async function ensureRepo(did) {
|
|
79
|
+
await setRepoStatus(did, 'pending');
|
|
80
|
+
triggerAutoBackfill(did);
|
|
81
|
+
await awaitBackfill(did);
|
|
82
|
+
}
|
|
83
|
+
/** Register a hook from a scanned server/ module. */
|
|
84
|
+
export function registerHook(event, handler, options) {
|
|
85
|
+
if (event === 'on-login') {
|
|
86
|
+
onLoginHook = handler;
|
|
87
|
+
log('[hooks] on-login hook registered');
|
|
88
|
+
}
|
|
89
|
+
else if (event === 'on-commit') {
|
|
90
|
+
const collections = new Set(options?.collections || []);
|
|
91
|
+
onCommitHooks.push({ collections, handler: handler });
|
|
92
|
+
log(`[hooks] on-commit hook registered (collections: ${[...collections].join(', ')})`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Fire the on-login hook if loaded. Errors are logged but never block login. */
|
|
96
|
+
export async function fireOnLoginHook(did, oauthConfig) {
|
|
97
|
+
if (!onLoginHook)
|
|
98
|
+
return;
|
|
99
|
+
try {
|
|
100
|
+
const base = buildBaseContext({ did });
|
|
101
|
+
const viewer = { did };
|
|
102
|
+
const hookPromise = onLoginHook({
|
|
103
|
+
...base,
|
|
104
|
+
did,
|
|
105
|
+
db: { query: base.db.query, run: runSQL },
|
|
106
|
+
ensureRepo,
|
|
107
|
+
createRecord: async (collection, record, opts) => {
|
|
108
|
+
if (!oauthConfig)
|
|
109
|
+
throw new Error('No OAuth config — cannot write to PDS');
|
|
110
|
+
return pdsCreateRecord(oauthConfig, viewer, { collection, record, rkey: opts?.rkey });
|
|
111
|
+
},
|
|
112
|
+
putRecord: async (collection, rkey, record) => {
|
|
113
|
+
if (!oauthConfig)
|
|
114
|
+
throw new Error('No OAuth config — cannot write to PDS');
|
|
115
|
+
return pdsPutRecord(oauthConfig, viewer, { collection, rkey, record });
|
|
116
|
+
},
|
|
117
|
+
deleteRecord: async (collection, rkey) => {
|
|
118
|
+
if (!oauthConfig)
|
|
119
|
+
throw new Error('No OAuth config — cannot write to PDS');
|
|
120
|
+
await pdsDeleteRecord(oauthConfig, viewer, { collection, rkey });
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
const timeout = new Promise((_, reject) => setTimeout(() => reject(new Error('on-login hook timed out after 30s')), 30_000));
|
|
124
|
+
await Promise.race([hookPromise, timeout]);
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
emit('hooks', 'on_login_error', { did, error: err.message });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Fire on-commit hooks for a batch of indexed records.
|
|
132
|
+
* Runs async and non-blocking — errors are logged but never throw.
|
|
133
|
+
*/
|
|
134
|
+
export function fireOnCommitHooks(items) {
|
|
135
|
+
if (onCommitHooks.length === 0)
|
|
136
|
+
return;
|
|
137
|
+
const base = buildBaseContext(null);
|
|
138
|
+
const push = isPushEnabled() ? buildPushInterface() : { send: async () => { } };
|
|
139
|
+
for (const item of items) {
|
|
140
|
+
for (const hook of onCommitHooks) {
|
|
141
|
+
if (hook.collections.size > 0 && !hook.collections.has(item.collection))
|
|
142
|
+
continue;
|
|
143
|
+
hook
|
|
144
|
+
.handler({
|
|
145
|
+
action: item.action,
|
|
146
|
+
collection: item.collection,
|
|
147
|
+
record: item.record,
|
|
148
|
+
repo: item.authorDid,
|
|
149
|
+
uri: item.uri,
|
|
150
|
+
db: { query: base.db.query, run: runSQL },
|
|
151
|
+
lookup: base.lookup,
|
|
152
|
+
push,
|
|
153
|
+
})
|
|
154
|
+
.catch((err) => {
|
|
155
|
+
emit('hooks', 'on_commit_error', {
|
|
156
|
+
collection: item.collection,
|
|
157
|
+
uri: item.uri,
|
|
158
|
+
error: err.message,
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
package/dist/hydrate.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Row } from './lex-types.ts';
|
|
2
2
|
export type { Row };
|
|
3
|
-
export interface
|
|
4
|
-
items: Row<T>[];
|
|
3
|
+
export interface BaseContext {
|
|
5
4
|
viewer: {
|
|
6
5
|
did: string;
|
|
6
|
+
handle?: string;
|
|
7
7
|
} | null;
|
|
8
8
|
db: {
|
|
9
9
|
query: (sql: string, params?: unknown[]) => Promise<unknown[]>;
|
|
@@ -12,12 +12,13 @@ export interface HydrateContext<T = unknown> {
|
|
|
12
12
|
lookup: <R = unknown>(collection: string, field: string, values: string[]) => Promise<Map<string, Row<R>>>;
|
|
13
13
|
count: (collection: string, field: string, values: string[]) => Promise<Map<string, number>>;
|
|
14
14
|
labels: (uris: string[]) => Promise<Map<string, unknown[]>>;
|
|
15
|
-
blobUrl: (did: string, ref: unknown, preset?:
|
|
15
|
+
blobUrl: (did: string, ref: unknown, preset?: string) => string | undefined;
|
|
16
16
|
}
|
|
17
17
|
/** Fetch records for URIs, reshape them, and filter out taken-down DIDs. */
|
|
18
18
|
export declare function resolveRecords(uris: string[]): Promise<Row<unknown>[]>;
|
|
19
|
-
/** Build a
|
|
20
|
-
export declare function
|
|
19
|
+
/** Build a BaseContext for hydration. */
|
|
20
|
+
export declare function buildBaseContext(viewer: {
|
|
21
21
|
did: string;
|
|
22
|
-
|
|
22
|
+
handle?: string;
|
|
23
|
+
} | null): BaseContext;
|
|
23
24
|
//# sourceMappingURL=hydrate.d.ts.map
|
package/dist/hydrate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../src/hydrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../src/hydrate.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,YAAY,EAAE,GAAG,EAAE,CAAA;AAInB,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC/C,EAAE,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;KAAE,CAAA;IACtE,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ecordsByUris, reshapeRow, } from "./database/db.js";
|
|
2
2
|
import { blobUrl } from "./xrpc.js";
|
|
3
3
|
// --- Record Resolution ---
|
|
4
4
|
/** Fetch records for URIs, reshape them, and filter out taken-down DIDs. */
|
|
@@ -39,24 +39,12 @@ export async function resolveRecords(uris) {
|
|
|
39
39
|
.filter((r) => r != null);
|
|
40
40
|
}
|
|
41
41
|
// --- Context Builder ---
|
|
42
|
-
/** Build a
|
|
43
|
-
export function
|
|
42
|
+
/** Build a BaseContext for hydration. */
|
|
43
|
+
export function buildBaseContext(viewer) {
|
|
44
44
|
return {
|
|
45
|
-
items,
|
|
46
45
|
viewer,
|
|
47
46
|
db: { query: querySQL },
|
|
48
|
-
getRecords:
|
|
49
|
-
if (uris.length === 0)
|
|
50
|
-
return new Map();
|
|
51
|
-
const records = await getRecordsByUris(collection, uris);
|
|
52
|
-
const map = new Map();
|
|
53
|
-
for (const r of records) {
|
|
54
|
-
const shaped = reshapeRow(r, r?.__childData, r?.__unionData);
|
|
55
|
-
if (shaped)
|
|
56
|
-
map.set(shaped.uri, shaped);
|
|
57
|
-
}
|
|
58
|
-
return map;
|
|
59
|
-
},
|
|
47
|
+
getRecords: getRecordsMap,
|
|
60
48
|
lookup: async (collection, field, values) => {
|
|
61
49
|
if (values.length === 0)
|
|
62
50
|
return new Map();
|
package/dist/indexer.d.ts
CHANGED
|
@@ -1,14 +1,144 @@
|
|
|
1
|
+
/** A single normalized repo operation, independent of the wire it arrived on. */
|
|
2
|
+
export interface CommitOp {
|
|
3
|
+
action: 'create' | 'update' | 'delete';
|
|
4
|
+
collection: string;
|
|
5
|
+
rkey: string;
|
|
6
|
+
/** Absent on deletes. */
|
|
7
|
+
cid?: string;
|
|
8
|
+
/** Absent on deletes. */
|
|
9
|
+
record?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
/** Record the latest firehose sequence seen. Source of truth for cursor persistence and reconnect resume. */
|
|
12
|
+
export declare function noteSeq(seq: number): void;
|
|
13
|
+
/** The highest seq this process has seen, or null before the first event. */
|
|
14
|
+
export declare function getLastSeq(): number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Persist the latest firehose sequence when it has advanced past the stored
|
|
17
|
+
* cursor. Runs on a timer independent of the write path: an app whose
|
|
18
|
+
* collections rarely appear on the firehose never flushes a batch, so the
|
|
19
|
+
* flush-path cursor write alone leaves the stored cursor frozen — and a frozen
|
|
20
|
+
* cursor makes the relay replay its whole retention window at line rate
|
|
21
|
+
* (~135 GB/hour observed against bsky.network) on every boot and reconnect.
|
|
22
|
+
*/
|
|
23
|
+
export declare function checkpointCursor(): Promise<void>;
|
|
24
|
+
/** Point cursor persistence at a stream's own `_cursor` row. See {@link cursorKey}. */
|
|
25
|
+
export declare function setCursorKey(key: 'relay' | 'jetstream'): void;
|
|
26
|
+
/**
|
|
27
|
+
* The cursor a reconnect should resume from: the latest seq this process has
|
|
28
|
+
* seen, falling back to the boot-time cursor before any message has arrived.
|
|
29
|
+
* Reusing the boot-time cursor on every reconnect would replay everything
|
|
30
|
+
* received since the process started.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resumeCursor(liveSeq: number | null, bootCursor: string | null | undefined): string | null | undefined;
|
|
33
|
+
/** Reset module cursor state between tests. */
|
|
34
|
+
export declare function _resetCursorStateForTests(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Drain the write buffer synchronously instead of waiting out
|
|
37
|
+
* FLUSH_INTERVAL_MS. Lets end-to-end tests assert on rows immediately after
|
|
38
|
+
* feeding a frame.
|
|
39
|
+
*/
|
|
40
|
+
export declare function _flushForTests(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Auto-backfill a DID's repo when first seen on the firehose.
|
|
43
|
+
*
|
|
44
|
+
* Fetches the full repo via CAR export, inserts all records, then replays any
|
|
45
|
+
* firehose events that arrived during the backfill. Concurrency is capped at
|
|
46
|
+
* `maxConcurrentBackfills`. Failed backfills retry with exponential delay up
|
|
47
|
+
* to `maxRetries`.
|
|
48
|
+
*/
|
|
49
|
+
/** Wait for a DID's backfill to complete if one is in flight. */
|
|
50
|
+
export declare function awaitBackfill(did: string): Promise<void>;
|
|
1
51
|
export declare function triggerAutoBackfill(did: string, attempt?: number): Promise<void>;
|
|
2
|
-
|
|
3
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Indexing behaviour shared by every stream source. Both the relay firehose
|
|
54
|
+
* and the Jetstream live tail feed the same buffers, backfill signalling, and
|
|
55
|
+
* cursor machinery — only the wire differs.
|
|
56
|
+
*/
|
|
57
|
+
export interface IndexerCoreOpts {
|
|
58
|
+
plcUrl: string;
|
|
4
59
|
collections: Set<string>;
|
|
5
60
|
signalCollections?: Set<string>;
|
|
6
61
|
pinnedRepos?: Set<string>;
|
|
7
|
-
cursor?: string | null;
|
|
8
62
|
fetchTimeout: number;
|
|
9
63
|
maxRetries: number;
|
|
64
|
+
parallelism?: number;
|
|
10
65
|
ftsRebuildInterval?: number;
|
|
11
66
|
}
|
|
67
|
+
/** Configuration for the relay firehose indexer. */
|
|
68
|
+
interface IndexerOpts extends IndexerCoreOpts {
|
|
69
|
+
relayUrl: string;
|
|
70
|
+
cursor?: string | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Connect to the AT Protocol relay firehose and begin indexing.
|
|
74
|
+
*
|
|
75
|
+
* Opens a WebSocket to `subscribeRepos`, processes commit messages synchronously
|
|
76
|
+
* on the event loop to minimize backpressure, and batches writes through
|
|
77
|
+
* {@link flushBuffer}. New DIDs trigger auto-backfill via {@link triggerAutoBackfill}.
|
|
78
|
+
* Reconnects automatically on disconnect after a 3s delay.
|
|
79
|
+
*
|
|
80
|
+
* @returns The WebSocket connection (for shutdown coordination)
|
|
81
|
+
*/
|
|
82
|
+
export declare function configureIndexer(opts: IndexerCoreOpts): Promise<void>;
|
|
12
83
|
export declare function startIndexer(opts: IndexerOpts): Promise<WebSocket>;
|
|
84
|
+
/** Configuration for an auxiliary firehose (see {@link startAuxIndexer}). */
|
|
85
|
+
export interface AuxIndexerOpts {
|
|
86
|
+
relayUrl: string;
|
|
87
|
+
collections: Set<string>;
|
|
88
|
+
cursor?: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** The `_cursor` row an auxiliary firehose persists its position to. */
|
|
91
|
+
export declare function auxCursorKey(relayUrl: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Tail a second `subscribeRepos` alongside the primary stream.
|
|
94
|
+
*
|
|
95
|
+
* A relay is one coordinate system; a PDS tailed directly is another. Nothing
|
|
96
|
+
* below the wire cares which socket a frame arrived on — `processMessage`
|
|
97
|
+
* decodes it and `applyCommit` indexes it — so the only state an extra source
|
|
98
|
+
* needs of its own is a seq and a cursor row. Both live in this closure,
|
|
99
|
+
* keyed by URL, so an aux stream never advances (or resumes from) the primary
|
|
100
|
+
* cursor. Use this when a repo's PDS is not behind the relay being tailed —
|
|
101
|
+
* a self-hosted network, a dev stack with more than one PDS — rather than
|
|
102
|
+
* standing up a relay just to merge two streams.
|
|
103
|
+
*
|
|
104
|
+
* Must be called after {@link configureIndexer} (or {@link startIndexer}),
|
|
105
|
+
* which owns the shared indexer configuration.
|
|
106
|
+
*/
|
|
107
|
+
export declare function startAuxIndexer(opts: AuxIndexerOpts): WebSocket;
|
|
108
|
+
/**
|
|
109
|
+
* Handle a `#identity` firehose event for a DID. The `handle` field on the
|
|
110
|
+
* event is optional per the lexicon, and some emitters omit it (signalling
|
|
111
|
+
* "re-resolve"). When absent, we re-resolve from the PLC directory so handle
|
|
112
|
+
* renames propagate even when the relay payload is sparse.
|
|
113
|
+
*
|
|
114
|
+
* Only updates DIDs we already track (present in repoStatusCache) to avoid
|
|
115
|
+
* writing rows for the entire network.
|
|
116
|
+
*/
|
|
117
|
+
export declare function handleIdentityEvent(did: string, payloadHandle: string | undefined): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Whether a collection's records may be written from network data.
|
|
120
|
+
*
|
|
121
|
+
* Private collections are AppView-authoritative: nothing on the network may
|
|
122
|
+
* write or delete their rows, so stream ops naming them are spoofed by
|
|
123
|
+
* definition and must be dropped regardless of which source delivered them.
|
|
124
|
+
*/
|
|
125
|
+
export declare function isIndexableCollection(collection: string, collections: Set<string>): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Apply a repo's commit ops to the index.
|
|
128
|
+
*
|
|
129
|
+
* Wire-agnostic: the relay path reaches here after CBOR/CAR decoding, the
|
|
130
|
+
* Jetstream path after parsing JSON. Callers must have already filtered `ops`
|
|
131
|
+
* through {@link isIndexableCollection}.
|
|
132
|
+
*
|
|
133
|
+
* Handles auto-backfill signalling, buffering for DIDs mid-backfill, lexicon
|
|
134
|
+
* validation, and delete/put routing.
|
|
135
|
+
*/
|
|
136
|
+
export declare function applyCommit(did: string, ops: CommitOp[]): void;
|
|
137
|
+
/**
|
|
138
|
+
* Process a single firehose message. Decodes the CBOR header/body, filters
|
|
139
|
+
* for relevant collections, validates records against lexicons, and routes
|
|
140
|
+
* writes to the buffer (or pending buffer if the DID is mid-backfill).
|
|
141
|
+
*/
|
|
142
|
+
export declare function processMessage(bytes: Uint8Array, collections: Set<string>, onSeq?: (seq: number) => void): void;
|
|
13
143
|
export {};
|
|
14
144
|
//# sourceMappingURL=indexer.d.ts.map
|
package/dist/indexer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AA8BA,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,CAA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