@hatk/hatk 0.0.1-alpha.9 → 0.0.1-alpha.92

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.
Files changed (218) hide show
  1. package/dist/adapter.d.ts +19 -0
  2. package/dist/adapter.d.ts.map +1 -0
  3. package/dist/adapter.js +113 -0
  4. package/dist/backfill.d.ts +29 -2
  5. package/dist/backfill.d.ts.map +1 -1
  6. package/dist/backfill.js +142 -51
  7. package/dist/car.d.ts +20 -0
  8. package/dist/car.d.ts.map +1 -1
  9. package/dist/car.js +108 -0
  10. package/dist/cli.js +247 -1043
  11. package/dist/config.d.ts +145 -1
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/config.js +61 -8
  14. package/dist/database/adapter-factory.d.ts +6 -0
  15. package/dist/database/adapter-factory.d.ts.map +1 -0
  16. package/dist/database/adapter-factory.js +20 -0
  17. package/dist/database/adapters/duckdb-search.d.ts +12 -0
  18. package/dist/database/adapters/duckdb-search.d.ts.map +1 -0
  19. package/dist/database/adapters/duckdb-search.js +27 -0
  20. package/dist/database/adapters/duckdb.d.ts +25 -0
  21. package/dist/database/adapters/duckdb.d.ts.map +1 -0
  22. package/dist/database/adapters/duckdb.js +161 -0
  23. package/dist/database/adapters/sqlite-search.d.ts +16 -0
  24. package/dist/database/adapters/sqlite-search.d.ts.map +1 -0
  25. package/dist/database/adapters/sqlite-search.js +76 -0
  26. package/dist/database/adapters/sqlite.d.ts +18 -0
  27. package/dist/database/adapters/sqlite.d.ts.map +1 -0
  28. package/dist/database/adapters/sqlite.js +88 -0
  29. package/dist/{db.d.ts → database/db.d.ts} +68 -6
  30. package/dist/database/db.d.ts.map +1 -0
  31. package/dist/database/db.js +1775 -0
  32. package/dist/database/dialect.d.ts +45 -0
  33. package/dist/database/dialect.d.ts.map +1 -0
  34. package/dist/database/dialect.js +72 -0
  35. package/dist/{fts.d.ts → database/fts.d.ts} +7 -0
  36. package/dist/database/fts.d.ts.map +1 -0
  37. package/dist/{fts.js → database/fts.js} +122 -34
  38. package/dist/database/index.d.ts +7 -0
  39. package/dist/database/index.d.ts.map +1 -0
  40. package/dist/database/index.js +6 -0
  41. package/dist/database/ports.d.ts +50 -0
  42. package/dist/database/ports.d.ts.map +1 -0
  43. package/dist/database/ports.js +1 -0
  44. package/dist/{schema.d.ts → database/schema.d.ts} +16 -3
  45. package/dist/database/schema.d.ts.map +1 -0
  46. package/dist/{schema.js → database/schema.js} +126 -44
  47. package/dist/dev-entry.d.ts +8 -0
  48. package/dist/dev-entry.d.ts.map +1 -0
  49. package/dist/dev-entry.js +127 -0
  50. package/dist/feeds.d.ts +26 -8
  51. package/dist/feeds.d.ts.map +1 -1
  52. package/dist/feeds.js +72 -16
  53. package/dist/hooks.d.ts +102 -0
  54. package/dist/hooks.d.ts.map +1 -0
  55. package/dist/hooks.js +186 -0
  56. package/dist/hydrate.d.ts +49 -6
  57. package/dist/hydrate.d.ts.map +1 -1
  58. package/dist/hydrate.js +21 -20
  59. package/dist/indexer.d.ts +167 -3
  60. package/dist/indexer.d.ts.map +1 -1
  61. package/dist/indexer.js +556 -94
  62. package/dist/jetstream.d.ts +118 -0
  63. package/dist/jetstream.d.ts.map +1 -0
  64. package/dist/jetstream.js +225 -0
  65. package/dist/labels.d.ts +36 -0
  66. package/dist/labels.d.ts.map +1 -1
  67. package/dist/labels.js +71 -6
  68. package/dist/lex-types.d.ts +2 -0
  69. package/dist/lex-types.d.ts.map +1 -1
  70. package/dist/lexicon-resolve.d.ts.map +1 -1
  71. package/dist/lexicon-resolve.js +27 -112
  72. package/dist/lexicons/com/atproto/label/defs.json +75 -0
  73. package/dist/lexicons/com/atproto/moderation/defs.json +30 -0
  74. package/dist/lexicons/com/atproto/repo/strongRef.json +21 -0
  75. package/dist/lexicons/dev/hatk/applyWrites.json +87 -0
  76. package/dist/lexicons/dev/hatk/createRecord.json +40 -0
  77. package/dist/lexicons/dev/hatk/createReport.json +48 -0
  78. package/dist/lexicons/dev/hatk/deleteRecord.json +25 -0
  79. package/dist/lexicons/dev/hatk/describeCollections.json +41 -0
  80. package/dist/lexicons/dev/hatk/describeFeeds.json +29 -0
  81. package/dist/lexicons/dev/hatk/describeLabels.json +45 -0
  82. package/dist/lexicons/dev/hatk/getFeed.json +30 -0
  83. package/dist/lexicons/dev/hatk/getPreferences.json +19 -0
  84. package/dist/lexicons/dev/hatk/getRecord.json +26 -0
  85. package/dist/lexicons/dev/hatk/getRecords.json +32 -0
  86. package/dist/lexicons/dev/hatk/putPreference.json +28 -0
  87. package/dist/lexicons/dev/hatk/putRecord.json +41 -0
  88. package/dist/lexicons/dev/hatk/searchRecords.json +32 -0
  89. package/dist/lexicons/dev/hatk/uploadBlob.json +23 -0
  90. package/dist/logger.d.ts +29 -0
  91. package/dist/logger.d.ts.map +1 -1
  92. package/dist/logger.js +29 -0
  93. package/dist/main.js +198 -75
  94. package/dist/mst.d.ts +15 -0
  95. package/dist/mst.d.ts.map +1 -1
  96. package/dist/mst.js +13 -0
  97. package/dist/oauth/db.d.ts +16 -1
  98. package/dist/oauth/db.d.ts.map +1 -1
  99. package/dist/oauth/db.js +74 -19
  100. package/dist/oauth/discovery.d.ts +10 -0
  101. package/dist/oauth/discovery.d.ts.map +1 -1
  102. package/dist/oauth/discovery.js +54 -2
  103. package/dist/oauth/server.d.ts +93 -1
  104. package/dist/oauth/server.d.ts.map +1 -1
  105. package/dist/oauth/server.js +416 -39
  106. package/dist/oauth/service-describe.d.ts +42 -0
  107. package/dist/oauth/service-describe.d.ts.map +1 -0
  108. package/dist/oauth/service-describe.js +108 -0
  109. package/dist/oauth/session.d.ts +32 -0
  110. package/dist/oauth/session.d.ts.map +1 -0
  111. package/dist/oauth/session.js +131 -0
  112. package/dist/opengraph.d.ts +10 -0
  113. package/dist/opengraph.d.ts.map +1 -1
  114. package/dist/opengraph.js +94 -42
  115. package/dist/pds-proxy.d.ts +82 -0
  116. package/dist/pds-proxy.d.ts.map +1 -0
  117. package/dist/pds-proxy.js +356 -0
  118. package/dist/private-collections.d.ts +13 -0
  119. package/dist/private-collections.d.ts.map +1 -0
  120. package/dist/private-collections.js +27 -0
  121. package/dist/push.d.ts +54 -0
  122. package/dist/push.d.ts.map +1 -0
  123. package/dist/push.js +367 -0
  124. package/dist/renderer.d.ts +27 -0
  125. package/dist/renderer.d.ts.map +1 -0
  126. package/dist/renderer.js +46 -0
  127. package/dist/resolve-hatk.d.ts +6 -0
  128. package/dist/resolve-hatk.d.ts.map +1 -0
  129. package/dist/resolve-hatk.js +20 -0
  130. package/dist/response.d.ts +16 -0
  131. package/dist/response.d.ts.map +1 -0
  132. package/dist/response.js +69 -0
  133. package/dist/scanner.d.ts +21 -0
  134. package/dist/scanner.d.ts.map +1 -0
  135. package/dist/scanner.js +88 -0
  136. package/dist/seed.d.ts +19 -0
  137. package/dist/seed.d.ts.map +1 -1
  138. package/dist/seed.js +43 -4
  139. package/dist/server-init.d.ts +8 -0
  140. package/dist/server-init.d.ts.map +1 -0
  141. package/dist/server-init.js +62 -0
  142. package/dist/server.d.ts +34 -3
  143. package/dist/server.d.ts.map +1 -1
  144. package/dist/server.js +1032 -649
  145. package/dist/setup.d.ts +28 -1
  146. package/dist/setup.d.ts.map +1 -1
  147. package/dist/setup.js +50 -3
  148. package/dist/spaces/blob.d.ts +51 -0
  149. package/dist/spaces/blob.d.ts.map +1 -0
  150. package/dist/spaces/blob.js +111 -0
  151. package/dist/spaces/credential.d.ts +62 -0
  152. package/dist/spaces/credential.d.ts.map +1 -0
  153. package/dist/spaces/credential.js +184 -0
  154. package/dist/spaces/engine.d.ts +97 -0
  155. package/dist/spaces/engine.d.ts.map +1 -0
  156. package/dist/spaces/engine.js +559 -0
  157. package/dist/spaces/guard.d.ts +41 -0
  158. package/dist/spaces/guard.d.ts.map +1 -0
  159. package/dist/spaces/guard.js +79 -0
  160. package/dist/spaces/identity.d.ts +37 -0
  161. package/dist/spaces/identity.d.ts.map +1 -0
  162. package/dist/spaces/identity.js +88 -0
  163. package/dist/spaces/index.d.ts +55 -0
  164. package/dist/spaces/index.d.ts.map +1 -0
  165. package/dist/spaces/index.js +133 -0
  166. package/dist/spaces/notify.d.ts +51 -0
  167. package/dist/spaces/notify.d.ts.map +1 -0
  168. package/dist/spaces/notify.js +121 -0
  169. package/dist/spaces/records.d.ts +37 -0
  170. package/dist/spaces/records.d.ts.map +1 -0
  171. package/dist/spaces/records.js +63 -0
  172. package/dist/spaces/store.d.ts +51 -0
  173. package/dist/spaces/store.d.ts.map +1 -0
  174. package/dist/spaces/store.js +99 -0
  175. package/dist/spaces/uri.d.ts +60 -0
  176. package/dist/spaces/uri.d.ts.map +1 -0
  177. package/dist/spaces/uri.js +97 -0
  178. package/dist/spaces/verify.d.ts +39 -0
  179. package/dist/spaces/verify.d.ts.map +1 -0
  180. package/dist/spaces/verify.js +87 -0
  181. package/dist/spaces/viewer.d.ts +51 -0
  182. package/dist/spaces/viewer.d.ts.map +1 -0
  183. package/dist/spaces/viewer.js +167 -0
  184. package/dist/spaces/visibility.d.ts +57 -0
  185. package/dist/spaces/visibility.d.ts.map +1 -0
  186. package/dist/spaces/visibility.js +81 -0
  187. package/dist/templates/feed.tpl +18 -0
  188. package/dist/templates/hook.tpl +5 -0
  189. package/dist/templates/label.tpl +15 -0
  190. package/dist/templates/og.tpl +17 -0
  191. package/dist/templates/seed.tpl +11 -0
  192. package/dist/templates/setup.tpl +5 -0
  193. package/dist/templates/test-feed.tpl +19 -0
  194. package/dist/templates/test-xrpc.tpl +19 -0
  195. package/dist/templates/xrpc.tpl +53 -0
  196. package/dist/test.d.ts +3 -1
  197. package/dist/test.d.ts.map +1 -1
  198. package/dist/test.js +60 -36
  199. package/dist/views.js +1 -1
  200. package/dist/vite-plugin.d.ts +1 -1
  201. package/dist/vite-plugin.d.ts.map +1 -1
  202. package/dist/vite-plugin.js +254 -66
  203. package/dist/xrpc.d.ts +101 -12
  204. package/dist/xrpc.d.ts.map +1 -1
  205. package/dist/xrpc.js +255 -55
  206. package/package.json +21 -9
  207. package/public/admin-auth.js +271 -306
  208. package/public/admin.html +177 -61
  209. package/dist/db.d.ts.map +0 -1
  210. package/dist/db.js +0 -1361
  211. package/dist/fts.d.ts.map +0 -1
  212. package/dist/oauth/hooks.d.ts +0 -10
  213. package/dist/oauth/hooks.d.ts.map +0 -1
  214. package/dist/oauth/hooks.js +0 -40
  215. package/dist/schema.d.ts.map +0 -1
  216. package/dist/test-browser.d.ts +0 -14
  217. package/dist/test-browser.d.ts.map +0 -1
  218. package/dist/test-browser.js +0 -26
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-describe.d.ts","sourceRoot":"","sources":["../../src/oauth/service-describe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAkD/C;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CA+B1G;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -0,0 +1,108 @@
1
+ import { emit } from "../logger.js";
2
+ const DESCRIBE_NSID = 'community.lexicon.service.describe';
3
+ const PROBE_TIMEOUT_MS = 5000;
4
+ const CACHE_TTL_MS = 60 * 60 * 1000;
5
+ /** Answers are a property of the server, so one entry covers every account on it. */
6
+ const cache = new Map();
7
+ /** An NSID no server routes, for learning how one says "no such method". */
8
+ const CONTROL_NSID = 'dev.hatk.unspecced.methodThatDoesNotExist';
9
+ /** How a server answered, as a comparable string: status and error code. */
10
+ async function signature(pdsEndpoint, nsid) {
11
+ try {
12
+ const res = await fetch(`${pdsEndpoint.replace(/\/$/, '')}/xrpc/${nsid}`, {
13
+ headers: { accept: 'application/json' },
14
+ signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
15
+ });
16
+ const body = (await res.json().catch(() => null));
17
+ return `${res.status}:${body?.error ?? ''}`;
18
+ }
19
+ catch {
20
+ return null;
21
+ }
22
+ }
23
+ /**
24
+ * Which of `candidates` this server appears to route, judged against how it
25
+ * answers for a method that does not exist.
26
+ *
27
+ * Conservative by construction. A server that answers identically either way —
28
+ * bsky.social returns `401 AuthMissing` for both — yields nothing, so a feature
29
+ * it does not have is never claimed. The cost is failing to see support that
30
+ * cannot be distinguished, which is where this started anyway.
31
+ */
32
+ async function probeMethods(pdsEndpoint, candidates) {
33
+ const control = await signature(pdsEndpoint, CONTROL_NSID);
34
+ // Unreachable is not evidence about the server, so claim nothing.
35
+ if (control === null)
36
+ return new Set();
37
+ const answers = await Promise.all(candidates.map((n) => signature(pdsEndpoint, n)));
38
+ const found = new Set();
39
+ candidates.forEach((nsid, i) => {
40
+ const a = answers[i];
41
+ if (a !== null && a !== control)
42
+ found.add(nsid);
43
+ });
44
+ return found;
45
+ }
46
+ /**
47
+ * Every XRPC method a PDS serves, as far as it can be established.
48
+ *
49
+ * `candidates` are the methods the caller needs an answer about. They are only
50
+ * used when describe says nothing — an explicit list is always preferred to
51
+ * inference, and a server that answers describe is taken at its word.
52
+ */
53
+ export async function describeMethods(pdsEndpoint, candidates = []) {
54
+ const cached = cache.get(pdsEndpoint);
55
+ if (cached && cached.expires > Date.now())
56
+ return cached.methods;
57
+ let methods = new Set();
58
+ try {
59
+ const res = await fetch(`${pdsEndpoint.replace(/\/$/, '')}/xrpc/${DESCRIBE_NSID}`, {
60
+ headers: { accept: 'application/json' },
61
+ signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
62
+ });
63
+ if (res.ok) {
64
+ const body = (await res.json().catch(() => null));
65
+ if (Array.isArray(body?.methods)) {
66
+ for (const m of body.methods) {
67
+ if (typeof m?.value === 'string')
68
+ methods.add(m.value);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ catch {
74
+ methods = new Set();
75
+ }
76
+ // No describe, or one that listed nothing: fall back to asking about the
77
+ // methods this caller actually needs. Only those — a probe per method is a
78
+ // request per method, and the conditional sets name two.
79
+ if (methods.size === 0 && candidates.length > 0) {
80
+ methods = await probeMethods(pdsEndpoint, candidates);
81
+ }
82
+ cache.set(pdsEndpoint, { methods, expires: Date.now() + CACHE_TTL_MS });
83
+ return methods;
84
+ }
85
+ /**
86
+ * The scope string to request from this PDS: `base`, plus any conditional set
87
+ * whose `whenMethod` the server serves.
88
+ *
89
+ * Loopback clients are left alone. Their client_id encodes the scope they may
90
+ * request, and the token exchange rebuilds that client_id from config — vary
91
+ * the request and the two disagree. A local setup that needs the extra scopes
92
+ * lists them in its client's own `scope` instead.
93
+ */
94
+ export async function negotiateScope(config, base, pdsEndpoint, isLoopback) {
95
+ const conditional = config.conditionalScopes ?? [];
96
+ if (conditional.length === 0 || !pdsEndpoint || isLoopback)
97
+ return base;
98
+ const methods = await describeMethods(pdsEndpoint, conditional.map((c) => c.whenMethod));
99
+ const granted = conditional.filter((c) => methods.has(c.whenMethod)).flatMap((c) => c.scopes);
100
+ if (granted.length === 0)
101
+ return base;
102
+ emit('oauth', 'conditional_scopes', { pds: pdsEndpoint, scopes: granted });
103
+ return [base, ...granted].join(' ');
104
+ }
105
+ /** Drop cached describe answers. For tests. */
106
+ export function clearDescribeCache() {
107
+ cache.clear();
108
+ }
@@ -0,0 +1,32 @@
1
+ export type SessionData = {
2
+ did: string;
3
+ handle: string;
4
+ };
5
+ export declare function getSessionCookieName(): string;
6
+ /**
7
+ * Companion cookie listing every account this browser has signed in as.
8
+ *
9
+ * The session cookie names the *active* account; this one is the set the
10
+ * browser is entitled to switch between without going back to the PDS. It's
11
+ * encrypted with the same key, so a client can't add a DID to it and assume
12
+ * that identity — which is the whole security gate on `/auth/switch`.
13
+ */
14
+ export declare function getAccountsCookieName(): string;
15
+ export declare function initSession(privateJwk: JsonWebKey, cookieName?: string): void;
16
+ export declare function createSessionCookie(data: SessionData): Promise<string>;
17
+ export declare function sessionCookieHeader(value: string, secure: boolean): string;
18
+ export declare function clearSessionCookieHeader(): string;
19
+ export declare function parseSessionCookie(request: Request): Promise<SessionData | null>;
20
+ export declare function createAccountsCookie(accounts: SessionData[]): Promise<string>;
21
+ export declare function accountsCookieHeader(value: string, secure: boolean): string;
22
+ export declare function clearAccountsCookieHeader(): string;
23
+ /** Every account this browser has signed in as, oldest first. */
24
+ export declare function parseAccountsCookie(request: Request): Promise<SessionData[]>;
25
+ /**
26
+ * Add (or refresh) an account in the browser's list. Existing entries keep
27
+ * their position so the switcher doesn't reshuffle; a re-login just updates
28
+ * the handle.
29
+ */
30
+ export declare function withAccount(accounts: SessionData[], account: SessionData): SessionData[];
31
+ export declare function withoutAccount(accounts: SessionData[], did: string): SessionData[];
32
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/oauth/session.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzD,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAG7E;AAoDD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAE1E;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAOtF;AAID,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAE3E;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED,iEAAiE;AACjE,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAUlF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAMxF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,EAAE,CAElF"}
@@ -0,0 +1,131 @@
1
+ // SSR session cookie — AES-GCM encrypted HttpOnly cookie for server-side viewer resolution.
2
+ // Separate from OAuth protocol flows but uses the same server keypair for key derivation.
3
+ import { base64UrlEncode, base64UrlDecode } from "./crypto.js";
4
+ let _privateJwk;
5
+ let _cookieName = '__hatk_session';
6
+ const MAX_AGE = 30 * 24 * 60 * 60; // 30 days in seconds
7
+ /** Most accounts one browser can keep signed in at once. */
8
+ const MAX_ACCOUNTS = 10;
9
+ export function getSessionCookieName() {
10
+ return _cookieName;
11
+ }
12
+ /**
13
+ * Companion cookie listing every account this browser has signed in as.
14
+ *
15
+ * The session cookie names the *active* account; this one is the set the
16
+ * browser is entitled to switch between without going back to the PDS. It's
17
+ * encrypted with the same key, so a client can't add a DID to it and assume
18
+ * that identity — which is the whole security gate on `/auth/switch`.
19
+ */
20
+ export function getAccountsCookieName() {
21
+ return `${_cookieName}_accounts`;
22
+ }
23
+ export function initSession(privateJwk, cookieName) {
24
+ _privateJwk = privateJwk;
25
+ if (cookieName)
26
+ _cookieName = cookieName;
27
+ }
28
+ async function aesKey() {
29
+ const raw = new TextEncoder().encode(JSON.stringify(_privateJwk, Object.keys(_privateJwk).sort()));
30
+ const keyMaterial = await crypto.subtle.importKey('raw', raw, 'HKDF', false, ['deriveKey']);
31
+ return crypto.subtle.deriveKey({ name: 'HKDF', hash: 'SHA-256', salt: new Uint8Array(0), info: new TextEncoder().encode('hatk-session-cookie') }, keyMaterial, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
32
+ }
33
+ async function encrypt(payload) {
34
+ const iv = crypto.getRandomValues(new Uint8Array(12));
35
+ const key = await aesKey();
36
+ const plaintext = new TextEncoder().encode(JSON.stringify(payload));
37
+ const ciphertext = await crypto.subtle.encrypt({ name: 'AES-GCM', iv }, key, plaintext);
38
+ return `${base64UrlEncode(iv)}.${base64UrlEncode(new Uint8Array(ciphertext))}`;
39
+ }
40
+ async function decrypt(value) {
41
+ const parts = value.split('.');
42
+ if (parts.length !== 2)
43
+ return null;
44
+ try {
45
+ const iv = base64UrlDecode(parts[0]);
46
+ const ciphertext = base64UrlDecode(parts[1]);
47
+ const key = await aesKey();
48
+ const plaintext = await crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, ciphertext);
49
+ return JSON.parse(new TextDecoder().decode(plaintext));
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ function readCookie(request, name) {
56
+ const cookieHeader = request.headers.get('cookie');
57
+ if (!cookieHeader)
58
+ return null;
59
+ const match = cookieHeader
60
+ .split(';')
61
+ .map((c) => c.trim())
62
+ .find((c) => c.startsWith(`${name}=`));
63
+ return match ? match.slice(name.length + 1) : null;
64
+ }
65
+ function cookieHeader(name, value, secure) {
66
+ const parts = [`${name}=${value}`, 'HttpOnly', 'SameSite=Lax', 'Path=/', `Max-Age=${MAX_AGE}`];
67
+ if (secure)
68
+ parts.push('Secure');
69
+ return parts.join('; ');
70
+ }
71
+ export async function createSessionCookie(data) {
72
+ return encrypt({ ...data, ts: Math.floor(Date.now() / 1000) });
73
+ }
74
+ export function sessionCookieHeader(value, secure) {
75
+ return cookieHeader(_cookieName, value, secure);
76
+ }
77
+ export function clearSessionCookieHeader() {
78
+ return `${_cookieName}=; HttpOnly; SameSite=Lax; Path=/; Max-Age=0`;
79
+ }
80
+ export async function parseSessionCookie(request) {
81
+ const value = readCookie(request, _cookieName);
82
+ if (!value)
83
+ return null;
84
+ const data = await decrypt(value);
85
+ if (!data?.did || !data.handle || !data.ts)
86
+ return null;
87
+ if (Date.now() / 1000 - data.ts > MAX_AGE)
88
+ return null;
89
+ return { did: data.did, handle: data.handle };
90
+ }
91
+ // --- Accounts cookie ---
92
+ export async function createAccountsCookie(accounts) {
93
+ return encrypt({ accounts: accounts.slice(-MAX_ACCOUNTS), ts: Math.floor(Date.now() / 1000) });
94
+ }
95
+ export function accountsCookieHeader(value, secure) {
96
+ return cookieHeader(getAccountsCookieName(), value, secure);
97
+ }
98
+ export function clearAccountsCookieHeader() {
99
+ return `${getAccountsCookieName()}=; HttpOnly; SameSite=Lax; Path=/; Max-Age=0`;
100
+ }
101
+ /** Every account this browser has signed in as, oldest first. */
102
+ export async function parseAccountsCookie(request) {
103
+ const value = readCookie(request, getAccountsCookieName());
104
+ if (!value)
105
+ return [];
106
+ const data = await decrypt(value);
107
+ if (!data?.ts || !Array.isArray(data.accounts))
108
+ return [];
109
+ if (Date.now() / 1000 - data.ts > MAX_AGE)
110
+ return [];
111
+ return data.accounts.filter((a) => {
112
+ const account = a;
113
+ return !!account && typeof account.did === 'string' && typeof account.handle === 'string';
114
+ });
115
+ }
116
+ /**
117
+ * Add (or refresh) an account in the browser's list. Existing entries keep
118
+ * their position so the switcher doesn't reshuffle; a re-login just updates
119
+ * the handle.
120
+ */
121
+ export function withAccount(accounts, account) {
122
+ const index = accounts.findIndex((a) => a.did === account.did);
123
+ if (index === -1)
124
+ return [...accounts, account];
125
+ const next = [...accounts];
126
+ next[index] = account;
127
+ return next;
128
+ }
129
+ export function withoutAccount(accounts, did) {
130
+ return accounts.filter((a) => a.did !== did);
131
+ }
@@ -28,7 +28,17 @@ export interface OpengraphResult {
28
28
  description?: string;
29
29
  };
30
30
  }
31
+ export declare function defineOG(path: string, generate: (ctx: OpengraphContext) => Promise<OpengraphResult>): {
32
+ __type: "og";
33
+ path: string;
34
+ generate: (ctx: OpengraphContext) => Promise<OpengraphResult>;
35
+ };
31
36
  export declare function initOpengraph(ogDir: string): Promise<void>;
37
+ /** Register a single OG handler from a scanned server/ module. */
38
+ export declare function registerOgHandler(ogMod: {
39
+ path: string;
40
+ generate: (ctx: OpengraphContext) => Promise<OpengraphResult>;
41
+ }): void;
32
42
  export declare function handleOpengraphRequest(pathname: string): Promise<Buffer | null>;
33
43
  export declare function buildOgMeta(pathname: string, origin: string): string | null;
34
44
  //# sourceMappingURL=opengraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"opengraph.d.ts","sourceRoot":"","sources":["../src/opengraph.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAC3B,QAAQ,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAAA;QAC3C,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CACpD;AAED,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,UAAU,CAAA;IACnB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAA;IAC5D,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAChD;AAkCD,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoGhE;AAED,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA8BrF;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyC3E"}
1
+ {"version":3,"file":"opengraph.d.ts","sourceRoot":"","sources":["../src/opengraph.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAC3B,QAAQ,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAAA;QAC3C,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CACpD;AAED,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,UAAU,CAAA;IACnB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAA;IAC5D,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAChD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC;;;oBAA7C,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC;EAEnG;AAiDD,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEhE;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CAC9D,GAAG,IAAI,CAqDP;AAED,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BrF;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyC3E"}
package/dist/opengraph.js CHANGED
@@ -9,17 +9,43 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
9
9
  import { resolve } from 'node:path';
10
10
  import { readFileSync, readdirSync } from 'node:fs';
11
11
  import { log } from "./logger.js";
12
- import satori from 'satori';
13
- import { Resvg } from '@resvg/resvg-js';
14
- import { querySQL, runSQL, packCursor, unpackCursor, isTakendownDid, filterTakendownDids, searchRecords, findUriByFields, lookupByFieldBatch, countByFieldBatch, queryLabelsForUris, } from "./db.js";
15
- import { resolveRecords } from "./hydrate.js";
16
- import { blobUrl } from "./xrpc.js";
12
+ // Lazy-imported to avoid CJS require() issues in Vite's module runner
13
+ let _satori = null;
14
+ let _Resvg = null;
15
+ async function getSatori() {
16
+ if (!_satori)
17
+ _satori = (await import('satori')).default;
18
+ return _satori;
19
+ }
20
+ async function getResvg() {
21
+ if (!_Resvg)
22
+ _Resvg = (await import('@resvg/resvg-js')).Resvg;
23
+ return _Resvg;
24
+ }
25
+ import { buildXrpcContext } from "./xrpc.js";
26
+ export function defineOG(path, generate) {
27
+ return { __type: 'og', path, generate };
28
+ }
17
29
  const handlers = [];
18
30
  const pageRoutes = [];
19
31
  let defaultFont = null;
20
32
  const cache = new Map();
21
33
  const CACHE_TTL = 5 * 60 * 1000;
22
34
  const CACHE_MAX = 200;
35
+ /**
36
+ * Read a font file as an ArrayBuffer holding *only* that font's bytes.
37
+ *
38
+ * `readFileSync` returns a Buffer that, for small files, is a view into Node's
39
+ * shared 64 KB allocation pool — so `buffer.buffer` is the whole pool, not the
40
+ * font, and the font generally starts at a nonzero `byteOffset`. Handing that
41
+ * to satori makes it read whatever happened to be pooled before the font and
42
+ * reject the result with "Unsupported OpenType signature". Slice out the
43
+ * view's own range instead.
44
+ */
45
+ function readFontData(fontPath) {
46
+ const fontData = readFileSync(fontPath);
47
+ return fontData.buffer.slice(fontData.byteOffset, fontData.byteOffset + fontData.byteLength);
48
+ }
23
49
  function compilePath(path) {
24
50
  const paramNames = [];
25
51
  const re = path.replace(/:([^/]+)/g, (_, name) => {
@@ -32,8 +58,7 @@ export async function initOpengraph(ogDir) {
32
58
  // Load default font
33
59
  try {
34
60
  const fontPath = resolve(import.meta.dirname, '..', 'fonts', 'Inter-Regular.woff');
35
- const fontData = readFileSync(fontPath);
36
- defaultFont = { name: 'Inter', data: fontData.buffer, weight: 400, style: 'normal' };
61
+ defaultFont = { name: 'Inter', data: readFontData(fontPath), weight: 400, style: 'normal' };
37
62
  log('[opengraph] loaded default font: Inter');
38
63
  }
39
64
  catch {
@@ -51,7 +76,7 @@ export async function initOpengraph(ogDir) {
51
76
  for (const file of files) {
52
77
  const name = file.replace(/\.(ts|js)$/, '');
53
78
  const scriptPath = resolve(ogDir, file);
54
- const mod = await import(__rewriteRelativeImportExtension(scriptPath));
79
+ const mod = await import(__rewriteRelativeImportExtension(/* @vite-ignore */ `${scriptPath}?t=${Date.now()}`));
55
80
  const handler = mod.default;
56
81
  if (!handler.path) {
57
82
  console.warn(`[opengraph] ${file} missing 'path' export, skipping`);
@@ -64,38 +89,10 @@ export async function initOpengraph(ogDir) {
64
89
  pattern,
65
90
  paramNames,
66
91
  execute: async (params) => {
67
- const ctx = {
68
- db: { query: querySQL, run: runSQL },
69
- params,
70
- input: {},
71
- limit: 1,
72
- viewer: null,
73
- packCursor,
74
- unpackCursor,
75
- isTakendown: isTakendownDid,
76
- filterTakendownDids,
77
- search: searchRecords,
78
- resolve: resolveRecords,
79
- lookup: async (collection, field, values) => {
80
- if (values.length === 0)
81
- return new Map();
82
- const unique = [...new Set(values.filter(Boolean))];
83
- return lookupByFieldBatch(collection, field, unique);
84
- },
85
- count: async (collection, field, values) => {
86
- if (values.length === 0)
87
- return new Map();
88
- const unique = [...new Set(values.filter(Boolean))];
89
- return countByFieldBatch(collection, field, unique);
90
- },
91
- exists: async (collection, filters) => {
92
- const conditions = Object.entries(filters).map(([field, value]) => ({ field, value }));
93
- const uri = await findUriByFields(collection, conditions);
94
- return uri !== null;
95
- },
96
- labels: queryLabelsForUris,
97
- blobUrl,
98
- };
92
+ const ctx = buildXrpcContext(params, undefined, 1, null);
93
+ // Override blobUrl to use _og presets (jpeg) — satori doesn't support webp
94
+ const origBlobUrl = ctx.blobUrl;
95
+ ctx.blobUrl = (did, ref, preset = 'avatar') => origBlobUrl(did, ref, `${preset}_og`);
99
96
  ctx.fetchImage = async (url) => {
100
97
  try {
101
98
  const resp = await fetch(url, { redirect: 'follow' });
@@ -117,7 +114,7 @@ export async function initOpengraph(ogDir) {
117
114
  ...result.options,
118
115
  fonts: [...(defaultFont ? [defaultFont] : []), ...(result.options?.fonts || [])],
119
116
  };
120
- const svg = await satori(element, options);
117
+ const svg = await (await getSatori())(element, options);
121
118
  return { svg, meta: result.meta };
122
119
  },
123
120
  });
@@ -129,6 +126,60 @@ export async function initOpengraph(ogDir) {
129
126
  }
130
127
  }
131
128
  }
129
+ /** Register a single OG handler from a scanned server/ module. */
130
+ export function registerOgHandler(ogMod) {
131
+ const { pattern, paramNames } = compilePath(ogMod.path);
132
+ const name = ogMod.path.replace(/^\//, '').replace(/\//g, '-').replace(/:/g, '');
133
+ // Load default font if not already loaded
134
+ if (!defaultFont) {
135
+ try {
136
+ const fontPath = resolve(import.meta.dirname, '..', 'fonts', 'Inter-Regular.woff');
137
+ defaultFont = { name: 'Inter', data: readFontData(fontPath), weight: 400, style: 'normal' };
138
+ }
139
+ catch { }
140
+ }
141
+ handlers.push({
142
+ name,
143
+ path: ogMod.path,
144
+ pattern,
145
+ paramNames,
146
+ execute: async (params) => {
147
+ const ctx = buildXrpcContext(params, undefined, 1, null);
148
+ // Override blobUrl to use _og presets (jpeg) — satori doesn't support webp
149
+ const origBlobUrl = ctx.blobUrl;
150
+ ctx.blobUrl = (did, ref, preset = 'avatar') => origBlobUrl(did, ref, `${preset}_og`);
151
+ ctx.fetchImage = async (url) => {
152
+ try {
153
+ const resp = await fetch(url, { redirect: 'follow' });
154
+ if (!resp.ok)
155
+ return null;
156
+ const buf = Buffer.from(await resp.arrayBuffer());
157
+ const contentType = resp.headers.get('content-type') || 'image/jpeg';
158
+ return `data:${contentType};base64,${buf.toString('base64')}`;
159
+ }
160
+ catch {
161
+ return null;
162
+ }
163
+ };
164
+ const result = await ogMod.generate(ctx);
165
+ const element = result.element;
166
+ const options = {
167
+ width: 1200,
168
+ height: 630,
169
+ ...result.options,
170
+ fonts: [...(defaultFont ? [defaultFont] : []), ...(result.options?.fonts || [])],
171
+ };
172
+ const svg = await (await getSatori())(element, options);
173
+ return { svg, meta: result.meta };
174
+ },
175
+ });
176
+ const pagePath = ogMod.path.replace(/^\/og/, '');
177
+ if (pagePath !== ogMod.path) {
178
+ const compiled = compilePath(pagePath);
179
+ pageRoutes.push({ ogPath: ogMod.path, pattern: compiled.pattern, paramNames: compiled.paramNames, name });
180
+ }
181
+ log(`[opengraph] registered: ${name} → ${ogMod.path}`);
182
+ }
132
183
  export async function handleOpengraphRequest(pathname) {
133
184
  const cached = cache.get(pathname);
134
185
  if (cached && cached.expires > Date.now())
@@ -143,6 +194,7 @@ export async function handleOpengraphRequest(pathname) {
143
194
  });
144
195
  try {
145
196
  const { svg, meta } = await handler.execute(params);
197
+ const Resvg = await getResvg();
146
198
  const png = new Resvg(svg, { fitTo: { mode: 'width', value: 1200 } }).render().asPng();
147
199
  if (cache.size >= CACHE_MAX) {
148
200
  const oldest = cache.keys().next().value;
@@ -153,7 +205,7 @@ export async function handleOpengraphRequest(pathname) {
153
205
  return png;
154
206
  }
155
207
  catch (err) {
156
- console.error(`[opengraph] error in ${handler.name}:`, err.message);
208
+ console.error(`[opengraph] error in ${handler.name}:`, err.message, err.stack);
157
209
  return null;
158
210
  }
159
211
  }
@@ -0,0 +1,82 @@
1
+ import type { OAuthConfig } from './config.ts';
2
+ export declare class ProxyError extends Error {
3
+ status: number;
4
+ constructor(status: number, message: string);
5
+ }
6
+ export declare class ScopeMissingProxyError extends ProxyError {
7
+ constructor();
8
+ }
9
+ export interface PdsXrpcOptions {
10
+ /** Defaults to GET, matching the XRPC convention for queries. */
11
+ method?: 'GET' | 'POST';
12
+ /** Query parameters. Undefined values are dropped; arrays repeat the key. */
13
+ params?: Record<string, string | number | boolean | string[] | undefined>;
14
+ /** JSON request body. Ignored for GET. */
15
+ body?: unknown;
16
+ }
17
+ /**
18
+ * Call any XRPC method on the user's PDS with their session.
19
+ *
20
+ * The escape hatch beside the typed record helpers above, for methods hatk has
21
+ * no opinion about — `com.atproto.space.*` and the rest of proposal 0016 being
22
+ * the case it was added for. Nothing is validated or indexed: the response is
23
+ * whatever the PDS sent, and it is the caller's job to know its shape.
24
+ *
25
+ * The session's granted scopes still apply. A method the user never authorized
26
+ * comes back as a 403 from the PDS, not from here.
27
+ */
28
+ export declare function pdsXrpc(oauthConfig: OAuthConfig, viewer: {
29
+ did: string;
30
+ }, nsid: string, options?: PdsXrpcOptions): Promise<Record<string, unknown>>;
31
+ export declare function pdsCreateRecord(oauthConfig: OAuthConfig, viewer: {
32
+ did: string;
33
+ }, input: {
34
+ collection: string;
35
+ repo?: string;
36
+ rkey?: string;
37
+ record: Record<string, unknown>;
38
+ }): Promise<{
39
+ uri?: string;
40
+ cid?: string;
41
+ }>;
42
+ export declare function pdsDeleteRecord(oauthConfig: OAuthConfig, viewer: {
43
+ did: string;
44
+ }, input: {
45
+ collection: string;
46
+ rkey: string;
47
+ }): Promise<Record<string, unknown>>;
48
+ export declare function pdsPutRecord(oauthConfig: OAuthConfig, viewer: {
49
+ did: string;
50
+ }, input: {
51
+ collection: string;
52
+ rkey: string;
53
+ record: Record<string, unknown>;
54
+ repo?: string;
55
+ }): Promise<{
56
+ uri?: string;
57
+ cid?: string;
58
+ }>;
59
+ export interface ApplyWritesOp {
60
+ $type: string;
61
+ collection: string;
62
+ rkey?: string;
63
+ value?: Record<string, unknown>;
64
+ }
65
+ export interface ApplyWritesResult {
66
+ $type: string;
67
+ uri?: string;
68
+ cid?: string;
69
+ }
70
+ export declare function pdsApplyWrites(oauthConfig: OAuthConfig, viewer: {
71
+ did: string;
72
+ }, input: {
73
+ writes: ApplyWritesOp[];
74
+ }): Promise<{
75
+ results?: ApplyWritesResult[];
76
+ }>;
77
+ export declare function pdsUploadBlob(oauthConfig: OAuthConfig, viewer: {
78
+ did: string;
79
+ }, body: Uint8Array, contentType: string): Promise<{
80
+ blob: unknown;
81
+ }>;
82
+ //# sourceMappingURL=pds-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pds-proxy.d.ts","sourceRoot":"","sources":["../src/pds-proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAU9C,qBAAa,UAAW,SAAQ,KAAK;IAE1B,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAIlB;AAED,qBAAa,sBAAuB,SAAQ,UAAU;;CAIrD;AAuKD,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACvB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;IACzE,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAC3B,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAoBlC;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC3F,OAAO,CAAC;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCzC;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyBlC;AAED,wBAAsB,YAAY,CAChC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1F,OAAO,CAAC;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAqCzC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAYD,wBAAsB,cAAc,CAClC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE;IAAE,MAAM,EAAE,aAAa,EAAE,CAAA;CAAE,GACjC,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAgE5C;AAED,wBAAsB,aAAa,CACjC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACvB,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAS5B"}