@seedprotocol/query 0.7.2 → 0.7.3-next.654.g52217f6
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/README.md +9 -1
- package/dist/bootstrap.d.ts +14 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/hydrateArweaveRichText.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +5 -6
- package/dist/index.node.js.map +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/registerNodeArweave.d.ts +4 -0
- package/dist/node/registerNodeArweave.d.ts.map +1 -0
- package/dist/node.js +8 -3
- package/dist/node.js.map +1 -0
- package/dist/{FileCache-CQuj0MeF.js → registerNodeArweave-Chi3MW9V.js} +6 -3
- package/dist/registerNodeArweave-Chi3MW9V.js.map +1 -0
- package/dist/{src-CBgjwvGT.js → src-C-tFmAwQ.js} +284 -284
- package/dist/src-C-tFmAwQ.js.map +1 -0
- package/dist/types-hBkSfFgl.js +37 -0
- package/dist/types-hBkSfFgl.js.map +1 -0
- package/package.json +3 -3
- package/dist/FileCache-CQuj0MeF.js.map +0 -1
- package/dist/src-CBgjwvGT.js.map +0 -1
- package/dist/types-DHRoT30t.js +0 -37
- package/dist/types-DHRoT30t.js.map +0 -1
package/README.md
CHANGED
|
@@ -149,6 +149,14 @@ Feed still owns serialized RSS/Atom/JSON bodies, HTTP `ETag` / 304, and image-me
|
|
|
149
149
|
|
|
150
150
|
## Init
|
|
151
151
|
|
|
152
|
-
Call `initializeQueryPlatform()` once
|
|
152
|
+
Call `initializeQueryPlatform()` once, or rely on `getSeed` / `queryBySchema` which initialize automatically.
|
|
153
|
+
|
|
154
|
+
Init only fills in what is missing. EAS and Arweave clients that are already registered, such as SeedClient's in a page or process running the SDK, are used as they are, along with the SDK's chain and Arweave gateway. So query can run beside SeedClient without replacing its clients.
|
|
155
|
+
|
|
156
|
+
- **EAS:** registers the default fetch-based EAS and query clients (`ensureEasPlatform()` from `@seedprotocol/eas`) when none are registered.
|
|
157
|
+
- **Arweave:** with no Arweave client registered, the Node entry registers the Node client. The browser entry only sets the read gateway, because query only needs the host. It never loads `@seedprotocol/eas/node` or `@seedprotocol/arweave/node`.
|
|
158
|
+
- **`arweaveDomain`:** when passed, it always sets the gateway host.
|
|
159
|
+
|
|
160
|
+
`source: 'remote'` (the default) always reads EAS, even when a local source is registered.
|
|
153
161
|
|
|
154
162
|
For local reads, also ensure the SDK client has initialized (registers `registerLocalQuerySource`) or call `registerSeedQueryLocalSource()` / `registerLocalQuerySource` yourself.
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
export type InitializeQueryPlatformOptions = {
|
|
2
2
|
arweaveDomain?: string;
|
|
3
3
|
};
|
|
4
|
-
/**
|
|
4
|
+
/** Fills in Arweave for a process where nothing has registered an Arweave client. */
|
|
5
|
+
export type QueryArweavePlatformRegistrar = (options: {
|
|
6
|
+
arweaveDomain: string;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* @internal Set by the Node entries, which register the Node Arweave client when none is
|
|
10
|
+
* configured. The browser entry keeps the default so its graph never loads `@seedprotocol/arweave/node`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function configureQueryArweavePlatform(registrar: QueryArweavePlatformRegistrar): void;
|
|
13
|
+
/**
|
|
14
|
+
* Make sure EAS and Arweave are usable for remote query. Clients already registered (by the SDK
|
|
15
|
+
* or a host app) are used as they are, so query can run in a page or process where SeedClient is
|
|
16
|
+
* running without replacing its clients or its Arweave gateway. Only missing pieces get defaults.
|
|
17
|
+
*/
|
|
5
18
|
export declare function initializeQueryPlatform(options?: InitializeQueryPlatformOptions): Promise<void>;
|
|
6
19
|
export declare function teardownQueryPlatform(): Promise<void>;
|
|
7
20
|
export declare function isQueryPlatformInitialized(): boolean;
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,8BAA8B,GAAG;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,qFAAqF;AACrF,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAYjG;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,6BAA6B,GAAG,IAAI,CAE5F;AAMD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,IAAI,CAAC,CAYf;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3D;AAED,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrateArweaveRichText.d.ts","sourceRoot":"","sources":["../src/hydrateArweaveRichText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hydrateArweaveRichText.d.ts","sourceRoot":"","sources":["../src/hydrateArweaveRichText.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,qBAAqB,GAAG;IAClC,iFAAiF;IACjF,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE;QACtB,YAAY,EAAE,MAAM,CAAA;QACpB,KAAK,EAAE,OAAO,CAAA;QACd,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC7B,CAAA;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAenE;AAkCD,gDAAgD;AAChD,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAuED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAyCf;AAED,4DAA4D;AAC5D,eAAO,MAAM,iCAAiC,sCAAgC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as e,
|
|
2
|
-
import { $ as a, A as o, B as s, C as c, D as l, E as u, F as d, G as f, H as p, I as m, J as h, K as g, L as _, M as v, N as y, O as b, P as x, Q as S, R as C, S as w, T, U as E, V as D, W as O, X as k, Y as A, Z as j, _ as M, a as N, b as P, c as F, d as I, f as L, g as R, i as z, j as B, k as V, l as H, m as U, n as W, o as G, p as K, q, r as J, s as Y, t as X, u as Z, v as Q, w as $, x as ee, y as te, z as ne } from "./src-
|
|
3
|
-
export { U as CacheManager,
|
|
1
|
+
import { a as e, o as t, r as n, s as r, t as i } from "./types-hBkSfFgl.js";
|
|
2
|
+
import { $ as a, A as o, B as s, C as c, D as l, E as u, F as d, G as f, H as p, I as m, J as h, K as g, L as _, M as v, N as y, O as b, P as x, Q as S, R as C, S as w, T, U as E, V as D, W as O, X as k, Y as A, Z as j, _ as M, a as N, b as P, c as F, d as I, f as L, g as R, i as z, j as B, k as V, l as H, m as U, n as W, o as G, p as K, q, r as J, s as Y, t as X, u as Z, v as Q, w as $, x as ee, y as te, z as ne } from "./src-C-tFmAwQ.js";
|
|
3
|
+
export { U as CacheManager, n as DEFAULT_ARWEAVE_HOST, x as FEED_RICH_BODY_STORAGE_SCHEMAS, d as RICH_BODY_STORAGE_SCHEMAS, Q as applyChangelogFilters, M as assembleSeedChangelog, $ as assembleSeeds, i as buildAssembleOptionsKey, te as buildFlatSnapshotFromProperties, P as changelogValuesEqual, Y as clearLocalQuerySource, I as createQueryCacheManager, T as createRemoteQueryDataSource, ee as decodePropertyAttestation, w as diffPropertyAttestations, c as diffVersionSnapshots, h as enrichImageSeedClone, A as enrichImageSeedCloneForFeed, m as feedRichBodyModelPriority, a as getArweaveUrlForTransaction, _ as getFeedFieldStorageModels, C as getFeedListElementStorageModels, ne as getFieldStorageModels, s as getListElementStorageModels, L as getQueryCacheManager, F as getRegisteredLocalQuerySource, u as getRemoteQueryDataSource, X as getSeed, H as hasLocalQuerySource, o as hydrateArweaveRichTextInFeedItems, B as hydrateArweaveRichTextInItems, e as initializeQueryPlatform, v as isArweaveTransactionGatewayUrl, D as isFeedRichBodyStorageSchema, t as isQueryPlatformInitialized, p as isRichBodyStorageSchema, R as loadQueryCacheConfig, N as normalizeSourceMode, W as normalizeUidPrefix, b as parseEasPropertyMetadata, V as parseEasPropertyMetadataForFeed, l as parseEasRelationPropertyName, k as publicListRelationPropertyKey, J as queryBySchema, z as queryBySchemaForMonth, Z as registerLocalQuerySource, y as resetArweaveBodyCache, K as resetQueryCacheManager, G as resolveQuerySource, E as richBodyModelPriority, O as setFeedFieldStorageModel, f as setFeedListElementStorageModels, g as setFieldStorageModel, q as setListElementStorageModels, j as stripListRelationStorageAliasesForPublicKey, r as teardownQueryPlatform, S as tryCoerceJsonStringArray };
|
package/dist/index.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAQA,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/index.node.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as e, i as t, o as n, r as ee,
|
|
2
|
-
import { $ as
|
|
3
|
-
import { t as
|
|
4
|
-
|
|
5
|
-
L((e) => new $(e));
|
|
1
|
+
import { a as e, i as t, o as n, r as ee, s as r, t as i } from "./types-hBkSfFgl.js";
|
|
2
|
+
import { $ as a, A as o, B as s, C as c, D as l, E as u, F as d, G as f, H as p, I as m, J as h, K as g, L as _, M as v, N as y, O as b, P as x, Q as S, R as C, S as w, T, U as E, V as D, W as O, X as k, Y as te, Z as A, _ as j, a as M, b as N, c as P, d as F, f as I, g as L, h as R, i as z, j as B, k as V, l as H, m as U, n as W, o as G, p as K, q, r as J, s as Y, t as X, u as Z, v as Q, w as ne, x as re, y as ie, z as ae } from "./src-C-tFmAwQ.js";
|
|
3
|
+
import { n as $, t as oe } from "./registerNodeArweave-Chi3MW9V.js";
|
|
4
|
+
R((e) => new $(e)), t(oe);
|
|
6
5
|
//#endregion
|
|
7
|
-
export {
|
|
6
|
+
export { U as CacheManager, ee as DEFAULT_ARWEAVE_HOST, x as FEED_RICH_BODY_STORAGE_SCHEMAS, $ as FileCache, d as RICH_BODY_STORAGE_SCHEMAS, Q as applyChangelogFilters, j as assembleSeedChangelog, ne as assembleSeeds, i as buildAssembleOptionsKey, ie as buildFlatSnapshotFromProperties, N as changelogValuesEqual, Y as clearLocalQuerySource, F as createQueryCacheManager, T as createRemoteQueryDataSource, re as decodePropertyAttestation, w as diffPropertyAttestations, c as diffVersionSnapshots, h as enrichImageSeedClone, te as enrichImageSeedCloneForFeed, m as feedRichBodyModelPriority, a as getArweaveUrlForTransaction, _ as getFeedFieldStorageModels, C as getFeedListElementStorageModels, ae as getFieldStorageModels, s as getListElementStorageModels, I as getQueryCacheManager, P as getRegisteredLocalQuerySource, u as getRemoteQueryDataSource, X as getSeed, H as hasLocalQuerySource, o as hydrateArweaveRichTextInFeedItems, B as hydrateArweaveRichTextInItems, e as initializeQueryPlatform, v as isArweaveTransactionGatewayUrl, D as isFeedRichBodyStorageSchema, n as isQueryPlatformInitialized, p as isRichBodyStorageSchema, L as loadQueryCacheConfig, M as normalizeSourceMode, W as normalizeUidPrefix, b as parseEasPropertyMetadata, V as parseEasPropertyMetadataForFeed, l as parseEasRelationPropertyName, k as publicListRelationPropertyKey, J as queryBySchema, z as queryBySchemaForMonth, Z as registerLocalQuerySource, y as resetArweaveBodyCache, K as resetQueryCacheManager, G as resolveQuerySource, E as richBodyModelPriority, O as setFeedFieldStorageModel, f as setFeedListElementStorageModels, g as setFieldStorageModel, q as setListElementStorageModels, A as stripListRelationStorageAliasesForPublicKey, r as teardownQueryPlatform, S as tryCoerceJsonStringArray };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=index.node.js.map
|
package/dist/index.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.js","names":["
|
|
1
|
+
{"version":3,"file":"index.node.js","names":["initializeQueryPlatform","configureQueryArweavePlatform","isQueryPlatformInitialized","DEFAULT_ARWEAVE_HOST","teardownQueryPlatform","buildAssembleOptionsKey","getArweaveUrlForTransaction","hydrateArweaveRichTextInFeedItems","getListElementStorageModels","diffVersionSnapshots","parseEasRelationPropertyName","getRemoteQueryDataSource","RICH_BODY_STORAGE_SCHEMAS","setFeedListElementStorageModels","isRichBodyStorageSchema","feedRichBodyModelPriority","enrichImageSeedClone","setFieldStorageModel","getFeedFieldStorageModels","isArweaveTransactionGatewayUrl","resetArweaveBodyCache","parseEasPropertyMetadata","FEED_RICH_BODY_STORAGE_SCHEMAS","tryCoerceJsonStringArray","getFeedListElementStorageModels","diffPropertyAttestations","richBodyModelPriority","isFeedRichBodyStorageSchema","setFeedFieldStorageModel","publicListRelationPropertyKey","enrichImageSeedCloneForFeed","stripListRelationStorageAliasesForPublicKey","assembleSeedChangelog","normalizeSourceMode","changelogValuesEqual","getRegisteredLocalQuerySource","createQueryCacheManager","getQueryCacheManager","loadQueryCacheConfig","configurePersistentCacheFactory","queryBySchemaForMonth","hydrateArweaveRichTextInItems","parseEasPropertyMetadataForFeed","hasLocalQuerySource","CacheManager","normalizeUidPrefix","resolveQuerySource","resetQueryCacheManager","queryBySchema","clearLocalQuerySource","getSeed","registerLocalQuerySource","applyChangelogFilters","assembleSeeds","decodePropertyAttestation","buildFlatSnapshotFromProperties","getFieldStorageModels","FileCache","registerNodeArweave","config","createRemoteQueryDataSource","setListElementStorageModels"],"sources":["../src/index.node.ts"],"sourcesContent":["import { FileCache } from './cache/FileCache.js'\nimport { configurePersistentCacheFactory } from './cache/CacheManager.js'\nimport { configureQueryArweavePlatform } from './bootstrap.js'\nimport { registerNodeArweave } from './node/registerNodeArweave.js'\n\nconfigurePersistentCacheFactory((config) => new FileCache(config))\nconfigureQueryArweavePlatform(registerNodeArweave)\n\nexport * from './index.js'\nexport { FileCache } from './cache/FileCache.js'\n"],"mappings":";;;AAKAuC,GAAiC,MAAW,IAAIkB,EAAUE,CAAM,CAAC,GACjE1D,EAA8ByD,EAAmB"}
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAC5G,YAAY,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { QueryArweavePlatformRegistrar } from '../bootstrap.js';
|
|
2
|
+
/** Registers the Node Arweave client (and read gateway) when nothing else has. */
|
|
3
|
+
export declare const registerNodeArweave: QueryArweavePlatformRegistrar;
|
|
4
|
+
//# sourceMappingURL=registerNodeArweave.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerNodeArweave.d.ts","sourceRoot":"","sources":["../../src/node/registerNodeArweave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAA;AAEpE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,EAAE,6BAGjC,CAAA"}
|
package/dist/node.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { a as e, i as t, o as n } from "./types-
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
1
|
+
import { a as e, i as t, o as n, s as r } from "./types-hBkSfFgl.js";
|
|
2
|
+
import { n as i, t as a } from "./registerNodeArweave-Chi3MW9V.js";
|
|
3
|
+
//#region src/node/index.ts
|
|
4
|
+
t(a);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { i as FileCache, e as initializeQueryPlatform, n as isQueryPlatformInitialized, r as teardownQueryPlatform };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","names":["initializeQueryPlatform","configureQueryArweavePlatform","isQueryPlatformInitialized","teardownQueryPlatform","FileCache","registerNodeArweave"],"sources":["../src/node/index.ts"],"sourcesContent":["import { configureQueryArweavePlatform } from '../bootstrap.js'\nimport { registerNodeArweave } from './registerNodeArweave.js'\n\nconfigureQueryArweavePlatform(registerNodeArweave)\n\nexport { initializeQueryPlatform, teardownQueryPlatform, isQueryPlatformInitialized } from '../bootstrap.js'\nexport type { InitializeQueryPlatformOptions } from '../bootstrap.js'\nexport { FileCache } from '../cache/FileCache.js'\n"],"mappings":";;;AAGAC,EAA8BI,CAAmB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "./types-
|
|
1
|
+
import { n as e } from "./types-hBkSfFgl.js";
|
|
2
2
|
import { promises as t } from "fs";
|
|
3
3
|
import { join as n } from "path";
|
|
4
4
|
//#region src/cache/FileCache.ts
|
|
@@ -93,8 +93,11 @@ var r = class {
|
|
|
93
93
|
console.error("Error clearing all query caches:", e);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
}, i = async ({ arweaveDomain: e }) => {
|
|
97
|
+
let { registerNodeArweavePlatform: t } = await import("@seedprotocol/arweave/node");
|
|
98
|
+
t({ arweaveDomain: e });
|
|
96
99
|
};
|
|
97
100
|
//#endregion
|
|
98
|
-
export { r as t };
|
|
101
|
+
export { r as n, i as t };
|
|
99
102
|
|
|
100
|
-
//# sourceMappingURL=
|
|
103
|
+
//# sourceMappingURL=registerNodeArweave-Chi3MW9V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerNodeArweave-Chi3MW9V.js","names":["fs","sanitizeSeedUidForPath","FileCache","config","err","promises","error","join","schemaName","optionsKey","safe","seedUid","path","data","cached","prefix","files","file","dir","dirFiles","registerNodeArweave"],"sources":["../src/cache/FileCache.ts","../src/node/registerNodeArweave.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { join } from 'path'\nimport type {\n CachedCollectionData,\n CachedItemData,\n QueryCacheConfig,\n} from './types.js'\nimport { sanitizeSeedUidForPath } from './types.js'\n\n/**\n * File-based persistent cache for collections and items (Node / best-effort).\n */\nexport class FileCache {\n private cacheDir: string\n private config: QueryCacheConfig\n\n constructor(config: QueryCacheConfig) {\n this.cacheDir = config.cacheDir\n this.config = config\n this.ensureCacheDir().catch((err) => {\n console.error('Failed to create query cache directory:', err)\n })\n }\n\n private async ensureCacheDir(): Promise<void> {\n try {\n await fs.mkdir(this.cacheDir, { recursive: true })\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'EEXIST') {\n throw error\n }\n }\n }\n\n private async ensureItemsDir(): Promise<void> {\n try {\n await fs.mkdir(join(this.cacheDir, 'items'), { recursive: true })\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'EEXIST') {\n throw error\n }\n }\n }\n\n private collectionsDir(): string {\n return join(this.cacheDir, 'collections')\n }\n\n /** Under `collections/`, so feed's own `{schema}-{format}.json` cleanup never matches it. */\n private collectionPath(schemaName: string, optionsKey: string): string {\n return join(this.collectionsDir(), `${sanitizeSeedUidForPath(schemaName)}.${optionsKey}.json`)\n }\n\n private itemPath(seedUid: string, optionsKey: string): string {\n const safe = sanitizeSeedUidForPath(seedUid)\n return join(this.cacheDir, 'items', `${safe}-${optionsKey}.json`)\n }\n\n async getCollection(\n schemaName: string,\n optionsKey: string,\n ): Promise<CachedCollectionData | null> {\n const path = this.collectionPath(schemaName, optionsKey)\n try {\n const data = await fs.readFile(path, 'utf-8')\n const cached: CachedCollectionData = JSON.parse(data)\n const now = Math.floor(Date.now() / 1000)\n if (now - cached.lastUpdated > this.config.ttl) {\n await fs.unlink(path).catch(() => {})\n return null\n }\n return cached\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return null\n }\n console.error(\n `Error reading query collection cache for ${schemaName}:`,\n error,\n )\n return null\n }\n }\n\n async setCollection(\n schemaName: string,\n optionsKey: string,\n data: CachedCollectionData,\n ): Promise<void> {\n try {\n await fs.mkdir(this.collectionsDir(), { recursive: true })\n await fs.writeFile(\n this.collectionPath(schemaName, optionsKey),\n JSON.stringify(data, null, 2),\n 'utf-8',\n )\n } catch (error) {\n console.error(\n `Error writing query collection cache for ${schemaName}:`,\n error,\n )\n }\n }\n\n async getItem(\n seedUid: string,\n optionsKey: string,\n ): Promise<CachedItemData | null> {\n try {\n const data = await fs.readFile(\n this.itemPath(seedUid, optionsKey),\n 'utf-8',\n )\n const cached: CachedItemData = JSON.parse(data)\n const now = Math.floor(Date.now() / 1000)\n if (now - cached.lastUpdated > this.config.ttl) {\n await this.clearItem(seedUid, optionsKey)\n return null\n }\n return cached\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return null\n }\n console.error(`Error reading query item cache for ${seedUid}:`, error)\n return null\n }\n }\n\n async setItem(data: CachedItemData): Promise<void> {\n try {\n await this.ensureItemsDir()\n await fs.writeFile(\n this.itemPath(data.record.seedUid, data.optionsKey),\n JSON.stringify(data, null, 2),\n 'utf-8',\n )\n } catch (error) {\n console.error(\n `Error writing query item cache for ${data.record.seedUid}:`,\n error,\n )\n }\n }\n\n async clearCollection(schemaName: string): Promise<void> {\n const prefix = `${sanitizeSeedUidForPath(schemaName)}.`\n try {\n const files = await fs.readdir(this.collectionsDir())\n for (const file of files) {\n if (file.startsWith(prefix) && file.endsWith('.json')) {\n await fs.unlink(join(this.collectionsDir(), file))\n }\n }\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n console.error(\n `Error clearing query collection cache for ${schemaName}:`,\n error,\n )\n }\n }\n }\n\n async clearItem(seedUid: string, optionsKey: string): Promise<void> {\n try {\n await fs.unlink(this.itemPath(seedUid, optionsKey))\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n console.error(\n `Error clearing query item cache for ${seedUid}:`,\n error,\n )\n }\n }\n }\n\n async clearAll(): Promise<void> {\n try {\n const files = await fs.readdir(this.cacheDir)\n for (const file of files) {\n if (file.endsWith('.json')) {\n await fs.unlink(join(this.cacheDir, file))\n }\n }\n for (const dir of [join(this.cacheDir, 'items'), this.collectionsDir()]) {\n try {\n const dirFiles = await fs.readdir(dir)\n for (const file of dirFiles) {\n if (file.endsWith('.json')) {\n await fs.unlink(join(dir, file))\n }\n }\n } catch {\n // dir may not exist\n }\n }\n } catch (error) {\n console.error('Error clearing all query caches:', error)\n }\n }\n}\n","import type { QueryArweavePlatformRegistrar } from '../bootstrap.js'\n\n/** Registers the Node Arweave client (and read gateway) when nothing else has. */\nexport const registerNodeArweave: QueryArweavePlatformRegistrar = async ({ arweaveDomain }) => {\n const { registerNodeArweavePlatform } = await import('@seedprotocol/arweave/node')\n registerNodeArweavePlatform({ arweaveDomain })\n}\n"],"mappings":";;;;AAYA,IAAaE,IAAb,MAAuB;CACrB;CACA;CAEA,YAAY,GAA0B;EAGpC,AAFA,KAAK,WAAWC,EAAO,UACvB,KAAK,SAASA,GACd,KAAK,e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