@seedprotocol/query 0.7.9-next.1110.g7eb9e57 → 0.7.9-next.1189.g5e63267
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 +7 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/assembleSeeds.d.ts +4 -2
- package/dist/assembleSeeds.d.ts.map +1 -1
- package/dist/cache/CacheManager.d.ts +12 -0
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/config.d.ts +1 -0
- package/dist/cache/config.d.ts.map +1 -1
- package/dist/cache/types.d.ts +9 -2
- package/dist/cache/types.d.ts.map +1 -1
- package/dist/changelog.d.ts +2 -0
- package/dist/changelog.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.node.js +5 -5
- package/dist/index.node.js.map +1 -1
- package/dist/node.js +4 -4
- package/dist/node.js.map +1 -1
- package/dist/{registerNodeArweave-rFbHhv2d.js → registerNodeArweave-VGXwzQt4.js} +2 -2
- package/dist/{registerNodeArweave-rFbHhv2d.js.map → registerNodeArweave-VGXwzQt4.js.map} +1 -1
- package/dist/{src-D20xeLMs.js → src-BnsF-Zyi.js} +363 -328
- package/dist/src-BnsF-Zyi.js.map +1 -0
- package/dist/{types-BgGzWcrW.js → types-BjCYpItx.js} +22 -12
- package/dist/types-BjCYpItx.js.map +1 -0
- package/dist/types.d.ts +25 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/src-D20xeLMs.js.map +0 -1
- package/dist/types-BgGzWcrW.js.map +0 -1
package/README.md
CHANGED
|
@@ -74,7 +74,9 @@ const { items: matches } = await queryBySchema('post', { uidPrefix: 'fd8c50ca',
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Options on every API: `
|
|
77
|
+
Options on every API: `relations` (default `'expand'`), `hydrateStorage` (default `true`), `cache` (default: follow env; pass `false` to bypass), `source` (default `'remote'`).
|
|
78
|
+
|
|
79
|
+
`relations` sets how relation properties come back. `'expand'` resolves Html/File relations to Arweave URLs and nests other related seeds as objects. `'urls'` resolves Html/File relations to URLs and leaves the rest as seed UIDs. `'uids'` leaves every relation as a seed UID under its stored key (`author_id`, `author_ids`) and fetches no related seeds, so a listing makes three indexer requests (seeds, versions, properties) instead of up to seven; `hydrateStorage` still reads the requested seeds' own storage fields. `expandRelations` is deprecated: `true` is `'expand'`, `false` is `'urls'`, and `relations` wins when both are given.
|
|
78
80
|
|
|
79
81
|
## Many seeds (`getSeeds`)
|
|
80
82
|
|
|
@@ -166,13 +168,15 @@ Controlled by the same env vars as feed content cache (ops compatibility):
|
|
|
166
168
|
|----------|---------|--------|
|
|
167
169
|
| `CACHE_ENABLED` | on in prod; **off** when `NODE_ENV=development` | Set `true`/`false` to force |
|
|
168
170
|
| `CACHE_TTL` | `3600` | Seconds from an entry's last full assembly until it is rebuilt from scratch |
|
|
171
|
+
| `CACHE_MAX_AGE` | `0` | Seconds after a collection was last checked during which `queryBySchema` returns it with no request; per call, `maxAge` |
|
|
169
172
|
| `CACHE_DIR` | `./cache` | Collections: `collections/{schema}.{opts}.json`; items: `items/{seedUid}-{opts}.json` |
|
|
170
173
|
|
|
171
174
|
Behavior:
|
|
172
175
|
|
|
173
176
|
- **Change checks** — every cache hit asks EAS, in one request, for attestations created or revoked since the entry was last checked that touch what it was built from: the seed, its head Version, and the seeds it relates to (and their head Versions). New Versions, property edits on the same Version (the default `patch` publish), and revocations are all seen. Only changed seeds are assembled again; a cached seed that was revoked drops out. The TTL is a backstop for anything a check can't see (e.g. relations of related seeds).
|
|
174
|
-
- **Collection cache** — only for **remote** `queryBySchema` with `skip === 0`, per schema and options fingerprint. Each hit fetches the seed list (
|
|
175
|
-
-
|
|
177
|
+
- **Collection cache** — only for **remote** `queryBySchema` with `skip === 0`, per schema and options fingerprint. Each hit fetches the seed list (shows new and revoked seeds) and, in the same round, checks every cached seed for changes; then it assembles only new or changed ones.
|
|
178
|
+
- **`maxAge`** — off by default. With `maxAge: 60` (or `CACHE_MAX_AGE=60`), a collection checked less than 60 seconds ago in this process is returned with no request, so new, changed and revoked seeds show up to 60 seconds late. The time is kept in memory per schema, options and `limit`.
|
|
179
|
+
- **Item cache** — keyed by `seedUid` + options fingerprint (`relations` / `hydrateStorage` / `include` / changelog filters / `versionUid` / `asOf`). Default latest-only key remains `e1-h1`; `relations` maps to `e1` (`'expand'`), `e0` (`'urls'`) and `e2` (`'uids'`), so keys written with `expandRelations` still match. Filled by remote `getSeed` and `getSeeds` and write-through from collection/month queries; a `getSeed` or `getSeeds` hit is checked for changes first.
|
|
176
180
|
- **ETags** — from content, so they change with any edit (not only a new `versionUid`).
|
|
177
181
|
- **Arweave bodies** — cached in memory by transaction id (their content never changes), whether or not the query cache is enabled.
|
|
178
182
|
- **Read-only results** — records from a cached read are the cache's own objects, shared with every later caller, so `SeedRecord` is typed read-only (`data: SeedData`, `changelog: readonly ChangelogEntry[]`). Outside `NODE_ENV=production`, records are also deep-frozen as they enter the memory cache (stored, or loaded from disk), so a write throws a `TypeError` instead of silently changing what later callers see and leaving the ETag stale. Production skips the freeze. Copy before changing anything, nested values included (copy-on-write, as feed's `applyFeedDefaultsDeep` does). `queryBySchema`'s `items` array is the caller's own. Set `freezeRecords` on the cache config to override.
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EAEnB,UAAU,EAEX,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EAEnB,UAAU,EAEX,MAAM,YAAY,CAAA;AAwLnB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhE;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CA4D9B;AA0DD,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAgH/B;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CA6FlC;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC,CAuBvB"}
|
package/dist/assembleSeeds.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QueryDataSource } from './source/types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type AssembleOptions, type AttestationLike, type SeedRecord, type VersionPin } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* What an assembled record was built from, so a cache can tell when it changed: an attestation
|
|
5
5
|
* created or revoked later that references one of `refUIDs` (a new or revoked Version of the seed
|
|
@@ -35,7 +35,9 @@ prefetched?: {
|
|
|
35
35
|
/**
|
|
36
36
|
* Records for `seeds`, in order, which may be of different schemas, with each record's
|
|
37
37
|
* dependencies by seedUid. One set of requests for all of them: seeds and versions, properties,
|
|
38
|
-
* related seeds and their versions, related properties, then storage bodies.
|
|
38
|
+
* related seeds and their versions, related properties, then storage bodies. With
|
|
39
|
+
* `relations: 'uids'` it stops after properties (storage bodies are still read): relation values
|
|
40
|
+
* stay seed UIDs and a record depends only on its seed and head version.
|
|
39
41
|
*/
|
|
40
42
|
export declare function assembleSeedRecords(seeds: AttestationLike[], options: AssembleOptions | undefined, dataSource: QueryDataSource, request?: AssembleRequest): Promise<{
|
|
41
43
|
records: SeedRecord[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assembleSeeds.d.ts","sourceRoot":"","sources":["../src/assembleSeeds.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assembleSeeds.d.ts","sourceRoot":"","sources":["../src/assembleSeeds.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,YAAY,CAAA;AA0hBnB;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,GAAG,EAAE,MAAM,EAAE,CAAA;CACd,CAAA;AAeD,MAAM,MAAM,eAAe,GAAG;IAC5B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CACvC,CAAA;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,CAAC,EAAE,eAAe,EACzB,UAAU,GAAE,eAA4C;AACxD,qFAAqF;AACrF,UAAU,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,GAC5C,OAAO,CAAC;IAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAAE,CAAC,CAKjF;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,EAAE,eAAe,GAAG,SAAS,EACpC,UAAU,EAAE,eAAe,EAC3B,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAAE,CAAC,CA6CjF;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,CAAC,EAAE,eAAe,EACzB,UAAU,GAAE,eAA4C,GACvD,OAAO,CAAC,UAAU,EAAE,CAAC,CAEvB"}
|
|
@@ -14,6 +14,11 @@ export declare class CacheManager {
|
|
|
14
14
|
private memoryCache;
|
|
15
15
|
private persistent;
|
|
16
16
|
private config;
|
|
17
|
+
/**
|
|
18
|
+
* When each collection read (by refresh-lock key) was last checked, and the ETag it produced.
|
|
19
|
+
* In memory only: the window is for a warm process serving many reads.
|
|
20
|
+
*/
|
|
21
|
+
private collectionChecks;
|
|
17
22
|
private stats;
|
|
18
23
|
constructor(config: QueryCacheConfig, persistent?: PersistentCache | null);
|
|
19
24
|
get enabled(): boolean;
|
|
@@ -26,6 +31,13 @@ export declare class CacheManager {
|
|
|
26
31
|
setItem(data: Omit<CachedItemData, 'etag'>): Promise<CachedItemData | null>;
|
|
27
32
|
writeThroughItems(items: Array<Omit<CachedItemData, 'etag'>>): Promise<void>;
|
|
28
33
|
clearItem(seedUid: string, optionsKey: string): Promise<void>;
|
|
34
|
+
/** Records that the collection read under `key` was checked just now and produced `etag`. */
|
|
35
|
+
markCollectionChecked(key: string, etag: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* The cached collection, if the read under `key` was checked less than `maxAge` seconds ago and
|
|
38
|
+
* the cache still holds what that check produced (another `limit` may have rewritten it since).
|
|
39
|
+
*/
|
|
40
|
+
getCheckedCollection(key: string, schemaName: string, optionsKey: string, maxAge: number): Promise<CachedCollectionData | null>;
|
|
29
41
|
/** Every options variant of the schema's collection. */
|
|
30
42
|
clearCollection(schemaName: string): Promise<void>;
|
|
31
43
|
clearAll(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheManager.d.ts","sourceRoot":"","sources":["../../src/cache/CacheManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAA;AAGnB,KAAK,sBAAsB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,eAAe,GAAG,IAAI,CAAA;AAIlF;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAEN;AA6BD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAKZ;gBAEW,MAAM,EAAE,gBAAgB,EAAE,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI;IAUzE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,SAAS,IAAI,gBAAgB;IAIvB,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA6BvC,0EAA0E;IACpE,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,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AAE,MAAM,EACX,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC;IAIb,iFAAiF;IACjF,aAAa,IAAI,IAAI;IAIrB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAKrD,QAAQ,IAAI,eAAe,GAAG;QAC5B,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;KACjD;IAOD,UAAU,IAAI,IAAI;CAQnB"}
|
package/dist/cache/config.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { QueryCacheConfig } from './types.js';
|
|
|
6
6
|
* - CACHE_ENABLED
|
|
7
7
|
* - CACHE_TTL (default 3600)
|
|
8
8
|
* - CACHE_DIR (default ./cache)
|
|
9
|
+
* - CACHE_MAX_AGE (default 0): seconds a checked collection is served without a request
|
|
9
10
|
* - CACHE_BACKGROUND_REFRESH / CACHE_REFRESH_INTERVAL (unused stubs)
|
|
10
11
|
*
|
|
11
12
|
* In development (NODE_ENV=development), cache is disabled unless
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cache/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQlD
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cache/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQlD;;;;;;;;;;;;;;;GAeG;AACH;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,CAwCvD"}
|
package/dist/cache/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ChangelogInclude, type GetSeedOptions, type GetSeedResult, type RelationsMode, type SeedRecord } from '../types.js';
|
|
2
2
|
import type { SeedDependencies } from '../assembleSeeds.js';
|
|
3
3
|
/**
|
|
4
4
|
* How a cached entry is kept current: changes (see QueryDataSource.listChangesSince) after
|
|
@@ -45,6 +45,11 @@ export type QueryCacheConfig = {
|
|
|
45
45
|
enabled: boolean;
|
|
46
46
|
backgroundRefresh: boolean;
|
|
47
47
|
refreshInterval: number;
|
|
48
|
+
/**
|
|
49
|
+
* Seconds after a collection was last checked during which `queryBySchema` returns it without
|
|
50
|
+
* any request (see QueryBySchemaOptions.maxAge). 0 (the default) checks on every read.
|
|
51
|
+
*/
|
|
52
|
+
maxAge?: number;
|
|
48
53
|
/**
|
|
49
54
|
* Deep-freeze records as they enter the memory cache (set, or loaded from the persistent layer).
|
|
50
55
|
* Default: on unless NODE_ENV=production.
|
|
@@ -70,9 +75,11 @@ export type PersistentCache = {
|
|
|
70
75
|
};
|
|
71
76
|
/**
|
|
72
77
|
* Build a stable key for assemble options that affect cached payloads.
|
|
73
|
-
* Default latest-only (`include: 'data'`) keeps Phase 2 key `e1-h1`.
|
|
78
|
+
* Default latest-only (`include: 'data'`) keeps Phase 2 key `e1-h1`. Relations modes map to
|
|
79
|
+
* `e1` (expand), `e0` (urls) and `e2` (uids), so keys from `expandRelations` are unchanged.
|
|
74
80
|
*/
|
|
75
81
|
export declare function buildAssembleOptionsKey(options?: {
|
|
82
|
+
relations?: RelationsMode;
|
|
76
83
|
expandRelations?: boolean;
|
|
77
84
|
hydrateStorage?: boolean;
|
|
78
85
|
include?: ChangelogInclude;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cache/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cache/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,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AAE,MAAM,GAAG,MAAM,CAE9D"}
|
package/dist/changelog.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export type DecodedProperty = {
|
|
|
7
7
|
propertyName: string;
|
|
8
8
|
value: string | string[];
|
|
9
9
|
camelName?: string;
|
|
10
|
+
/** The attestation records the property's removal (ADR 0021): readers treat it as absent. */
|
|
11
|
+
removed?: boolean;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* Decode a single property attestation into name + value (no relation expand).
|
package/dist/changelog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../src/changelog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAMnB;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAWpE;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../src/changelog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAMnB;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAWpE;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,eAAe,GACxB,eAAe,GAAG,IAAI,CAkDxB;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,eAAe,EAAE,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B,CAAA;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,eAAe,EAAE,GACjC,qBAAqB,EAAE,CA0BzB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,eAAe,EAAE,GAC5B,sBAAsB,EAAE,CA0C1B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,EAAE,EACzB,OAAO,CAAC,EAAE,gBAAgB,GACzB,cAAc,EAAE,CAiBlB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { getSeed, getSeeds, normalizeUidPrefix, queryBySchema, queryBySchemaForM
|
|
|
6
6
|
export { registerLocalQuerySource, clearLocalQuerySource, getRegisteredLocalQuerySource, hasLocalQuerySource, createRemoteQueryDataSource, getRemoteQueryDataSource, resolveQuerySource, normalizeSourceMode, } from './source/index.js';
|
|
7
7
|
export type { QueryDataSource, ResolvedQuerySource } from './source/index.js';
|
|
8
8
|
export { buildFlatSnapshotFromProperties, diffVersionSnapshots, diffPropertyAttestations, applyChangelogFilters, decodePropertyAttestation, changelogValuesEqual, } from './changelog.js';
|
|
9
|
-
export type { SeedData, SeedRecord, AssembleOptions, QuerySourceMode, GetSeedOptions, GetSeedResult, GetSeedsOptions, VersionPin, ChangelogInclude, ChangelogOptions, ChangelogEntry, VersionChangelogEntry, PropertyChangelogEntry, QueryBySchemaOptions, QueryBySchemaResult, AttestationChange, AttestationLike, } from './types.js';
|
|
9
|
+
export type { SeedData, SeedRecord, AssembleOptions, RelationsMode, QuerySourceMode, GetSeedOptions, GetSeedResult, GetSeedsOptions, VersionPin, ChangelogInclude, ChangelogOptions, ChangelogEntry, VersionChangelogEntry, PropertyChangelogEntry, QueryBySchemaOptions, QueryBySchemaResult, AttestationChange, AttestationLike, } from './types.js';
|
|
10
10
|
export { getQueryCacheManager, resetQueryCacheManager, createQueryCacheManager, loadQueryCacheConfig, CacheManager, buildAssembleOptionsKey, } from './cache/index.js';
|
|
11
11
|
export type { CachedCollectionData, CachedItemData, PersistentCache, QueryCacheConfig, QueryCacheStats, } from './cache/index.js';
|
|
12
12
|
export { getArweaveUrlForTransaction } from './arweaveUrl.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EACL,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,qBAAqB,GACtB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;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,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,6BAA6B,CAAA;AACpC,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
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, et as L, f as R, h as z, i as B, j as V, k as H, l as U, m as W, n as G, o as K, p as q, q as J, r as Y, s as X, t as Z, u as Q, v as $, w as ee, x as te, y as ne, z as re } from "./src-
|
|
3
|
-
export { z as CacheManager,
|
|
1
|
+
import { c as e, i as t, o as n, s as r, t as i } from "./types-BjCYpItx.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, et as L, f as R, h as z, i as B, j as V, k as H, l as U, m as W, n as G, o as K, p as q, q as J, r as Y, s as X, t as Z, u as Q, v as $, w as ee, x as te, y as ne, z as re } from "./src-BnsF-Zyi.js";
|
|
3
|
+
export { z as CacheManager, t as DEFAULT_ARWEAVE_HOST, d as FEED_RICH_BODY_STORAGE_SCHEMAS, m as RICH_BODY_STORAGE_SCHEMAS, ne as applyChangelogFilters, $ as assembleSeedChangelog, T as assembleSeeds, i as buildAssembleOptionsKey, P as buildFlatSnapshotFromProperties, te as changelogValuesEqual, F as clearLocalQuerySource, R as createQueryCacheManager, u as createRemoteQueryDataSource, w as decodePropertyAttestation, c as diffPropertyAttestations, ee as diffVersionSnapshots, A as enrichImageSeedClone, k as enrichImageSeedCloneForFeed, _ as feedRichBodyModelPriority, L as getArweaveUrlForTransaction, C as getFeedFieldStorageModels, re as getFeedListElementStorageModels, s as getFieldStorageModels, D as getListElementStorageModels, q as getQueryCacheManager, U as getRegisteredLocalQuerySource, l as getRemoteQueryDataSource, Z as getSeed, G as getSeeds, Q as hasLocalQuerySource, V as hydrateArweaveRichTextInFeedItems, v as hydrateArweaveRichTextInItems, n as initializeQueryPlatform, y as isArweaveTransactionGatewayUrl, p as isFeedRichBodyStorageSchema, r as isQueryPlatformInitialized, E as isRichBodyStorageSchema, M as loadQueryCacheConfig, K as normalizeSourceMode, Y as normalizeUidPrefix, H as parseEasPropertyMetadata, o as parseEasPropertyMetadataForFeed, b as parseEasRelationPropertyName, j as publicListRelationPropertyKey, B as queryBySchema, N as queryBySchemaForMonth, I as registerLocalQuerySource, x as resetArweaveBodyCache, W as resetQueryCacheManager, X as resolveQuerySource, O as richBodyModelPriority, f as setFeedFieldStorageModel, g as setFeedListElementStorageModels, J as setFieldStorageModel, h as setListElementStorageModels, S as stripListRelationStorageAliasesForPublicKey, e as teardownQueryPlatform, a as tryCoerceJsonStringArray };
|
package/dist/index.node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 te, Z as A, _ as j, a as M, b as N, c as P, d as F, et as I, f as L, g as R, h as z, i as B, j as V, k as H, l as U, m as W, n as G, o as K, p as q, q as J, r as Y, s as X, t as Z, u as Q, v as ne, w as re, x as ie, y as ae, z as oe } from "./src-
|
|
3
|
-
import { n as $, t as se } from "./registerNodeArweave-
|
|
4
|
-
R((e) => new $(e)),
|
|
1
|
+
import { a as e, c as t, i as n, o as ee, s as r, t as i } from "./types-BjCYpItx.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, et as I, f as L, g as R, h as z, i as B, j as V, k as H, l as U, m as W, n as G, o as K, p as q, q as J, r as Y, s as X, t as Z, u as Q, v as ne, w as re, x as ie, y as ae, z as oe } from "./src-BnsF-Zyi.js";
|
|
3
|
+
import { n as $, t as se } from "./registerNodeArweave-VGXwzQt4.js";
|
|
4
|
+
R((e) => new $(e)), e(se);
|
|
5
5
|
//#endregion
|
|
6
|
-
export { z as CacheManager,
|
|
6
|
+
export { z as CacheManager, n as DEFAULT_ARWEAVE_HOST, d as FEED_RICH_BODY_STORAGE_SCHEMAS, $ as FileCache, m as RICH_BODY_STORAGE_SCHEMAS, ae as applyChangelogFilters, ne as assembleSeedChangelog, T as assembleSeeds, i as buildAssembleOptionsKey, N as buildFlatSnapshotFromProperties, ie as changelogValuesEqual, P as clearLocalQuerySource, L as createQueryCacheManager, u as createRemoteQueryDataSource, w as decodePropertyAttestation, c as diffPropertyAttestations, re as diffVersionSnapshots, te as enrichImageSeedClone, k as enrichImageSeedCloneForFeed, _ as feedRichBodyModelPriority, I as getArweaveUrlForTransaction, C as getFeedFieldStorageModels, oe as getFeedListElementStorageModels, s as getFieldStorageModels, D as getListElementStorageModels, q as getQueryCacheManager, U as getRegisteredLocalQuerySource, l as getRemoteQueryDataSource, Z as getSeed, G as getSeeds, Q as hasLocalQuerySource, V as hydrateArweaveRichTextInFeedItems, v as hydrateArweaveRichTextInItems, ee as initializeQueryPlatform, y as isArweaveTransactionGatewayUrl, p as isFeedRichBodyStorageSchema, r as isQueryPlatformInitialized, E as isRichBodyStorageSchema, j as loadQueryCacheConfig, K as normalizeSourceMode, Y as normalizeUidPrefix, H as parseEasPropertyMetadata, o as parseEasPropertyMetadataForFeed, b as parseEasRelationPropertyName, A as publicListRelationPropertyKey, B as queryBySchema, M as queryBySchemaForMonth, F as registerLocalQuerySource, x as resetArweaveBodyCache, W as resetQueryCacheManager, X as resolveQuerySource, O as richBodyModelPriority, f as setFeedFieldStorageModel, g as setFeedListElementStorageModels, J as setFieldStorageModel, h as setListElementStorageModels, S as stripListRelationStorageAliasesForPublicKey, t as teardownQueryPlatform, a as tryCoerceJsonStringArray };
|
|
7
7
|
|
|
8
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":["configureQueryArweavePlatform","teardownQueryPlatform","DEFAULT_ARWEAVE_HOST","initializeQueryPlatform","isQueryPlatformInitialized","buildAssembleOptionsKey","tryCoerceJsonStringArray","parseEasPropertyMetadataForFeed","getFieldStorageModels","diffPropertyAttestations","getRemoteQueryDataSource","createRemoteQueryDataSource","FEED_RICH_BODY_STORAGE_SCHEMAS","setFeedFieldStorageModel","isFeedRichBodyStorageSchema","RICH_BODY_STORAGE_SCHEMAS","setListElementStorageModels","setFeedListElementStorageModels","feedRichBodyModelPriority","hydrateArweaveRichTextInItems","isArweaveTransactionGatewayUrl","parseEasRelationPropertyName","resetArweaveBodyCache","stripListRelationStorageAliasesForPublicKey","getFeedFieldStorageModels","decodePropertyAttestation","isRichBodyStorageSchema","getListElementStorageModels","richBodyModelPriority","enrichImageSeedCloneForFeed","enrichImageSeedClone","publicListRelationPropertyKey","loadQueryCacheConfig","queryBySchemaForMonth","buildFlatSnapshotFromProperties","clearLocalQuerySource","registerLocalQuerySource","getArweaveUrlForTransaction","createQueryCacheManager","configurePersistentCacheFactory","CacheManager","queryBySchema","hydrateArweaveRichTextInFeedItems","parseEasPropertyMetadata","getRegisteredLocalQuerySource","resetQueryCacheManager","getSeeds","normalizeSourceMode","getQueryCacheManager","setFieldStorageModel","normalizeUidPrefix","resolveQuerySource","getSeed","hasLocalQuerySource","assembleSeedChangelog","diffVersionSnapshots","changelogValuesEqual","applyChangelogFilters","getFeedListElementStorageModels","FileCache","registerNodeArweave","config","assembleSeeds"],"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,IAAIoB,EAAUE,CAAM,CAAC,GACjE7D,EAA8B4D,EAAmB"}
|
package/dist/node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as e,
|
|
2
|
-
import { n as i, t as a } from "./registerNodeArweave-
|
|
1
|
+
import { a as e, c as t, o as n, s as r } from "./types-BjCYpItx.js";
|
|
2
|
+
import { n as i, t as a } from "./registerNodeArweave-VGXwzQt4.js";
|
|
3
3
|
//#region src/node/index.ts
|
|
4
|
-
|
|
4
|
+
e(a);
|
|
5
5
|
//#endregion
|
|
6
|
-
export { i as FileCache,
|
|
6
|
+
export { i as FileCache, n as initializeQueryPlatform, r as isQueryPlatformInitialized, t as teardownQueryPlatform };
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","names":["
|
|
1
|
+
{"version":3,"file":"node.js","names":["configureQueryArweavePlatform","teardownQueryPlatform","initializeQueryPlatform","isQueryPlatformInitialized","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":";;;AAGAA,EAA8BK,CAAmB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "./types-
|
|
1
|
+
import { n as e } from "./types-BjCYpItx.js";
|
|
2
2
|
import { promises as t } from "fs";
|
|
3
3
|
import { join as n } from "path";
|
|
4
4
|
//#region src/cache/FileCache.ts
|
|
@@ -100,4 +100,4 @@ var r = class {
|
|
|
100
100
|
//#endregion
|
|
101
101
|
export { r as n, i as t };
|
|
102
102
|
|
|
103
|
-
//# sourceMappingURL=registerNodeArweave-
|
|
103
|
+
//# sourceMappingURL=registerNodeArweave-VGXwzQt4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerNodeArweave-
|
|
1
|
+
{"version":3,"file":"registerNodeArweave-VGXwzQt4.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,MAA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