@akita-protocol/algomd-core 1.0.0-alpha.0 → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.cjs CHANGED
@@ -34,6 +34,7 @@ __export(react_exports, {
34
34
  useDualStake: () => useDualStake,
35
35
  useEntities: () => useEntities,
36
36
  useEntity: () => useEntity,
37
+ useGuildProposal: () => useGuildProposal,
37
38
  useIdentity: () => useIdentity,
38
39
  useListing: () => useListing,
39
40
  useNfd: () => useNfd,
@@ -122,6 +123,21 @@ var BUILT_IN_KINDS = [
122
123
  return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { owner: id.slice(0, i) } };
123
124
  }
124
125
  },
126
+ // A Guild proposal. Proposal ids count per Guild, so the cache id is `<guildAppId>/<proposalId>`.
127
+ {
128
+ kind: "guild-proposal",
129
+ tags: ["GuildProposal"],
130
+ idProps: ["proposalId", "id"],
131
+ params: ["appId"],
132
+ policy: "live",
133
+ sources: ["algod"],
134
+ normalizeId: (id) => /^(\d+\/)?\d+$/.test(id.trim()) ? id.trim() : void 0,
135
+ composeId: (id, params) => params.appId && !id.includes("/") ? `${params.appId}/${id}` : id,
136
+ decomposeId: (id) => {
137
+ const i = id.indexOf("/");
138
+ return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { appId: id.slice(0, i) } };
139
+ }
140
+ },
125
141
  // Title is the author's own label in their post, not chain data.
126
142
  hosted("private-content", "PrivateContent", ["id"], "slow", { params: ["title"] }),
127
143
  // A page inside the same post. The host supplies its preview and navigation.
@@ -308,6 +324,7 @@ var useSubscription = (id, o) => useEntity("subscription", id, o);
308
324
  var useTrade = (offerId, o) => useEntity("trade", offerId, o);
309
325
  var useDualStake = (appId, o) => useEntity("dual-stake", appId, o);
310
326
  var usePrivateContent = (id, o) => useEntity("private-content", id, o);
327
+ var useGuildProposal = (id, o) => useEntity("guild-proposal", id, o);
311
328
  var usePrizeBox = (appId, o) => useEntity("prize-box", appId, o);
312
329
  function prefetchContent(queryClient, client, contents) {
313
330
  const refs = /* @__PURE__ */ new Map();
@@ -341,6 +358,7 @@ function shouldPersistQuery(client, query) {
341
358
  useDualStake,
342
359
  useEntities,
343
360
  useEntity,
361
+ useGuildProposal,
344
362
  useIdentity,
345
363
  useListing,
346
364
  useNfd,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/react/index.ts","../src/kinds.ts","../src/grammar.ts"],"sourcesContent":["import { useQueries, useQuery, useQueryClient, type QueryClient, type UseQueryResult } from '@tanstack/react-query'\nimport { createContext, createElement, useContext, useState, type ReactNode } from 'react'\nimport type { AuctionData, ListingData, PollData, PrizeBoxData, RaffleData } from '../archive/families'\nimport type { AlgomdClient, CacheAdapter } from '../client'\nimport { extractRefs } from '../grammar'\nimport type { IdentityData } from '../identity'\nimport type { AccountData, ApplicationData, AssetData, CollectionData } from '../sources/chain-data'\nimport type { NfdData } from '../sources/nfd'\nimport type { DualStakeData, PrivateContentData, RewardData, StakingPoolData, SubscriptionData, TradeData } from '../akita'\nimport type { AssetMediaData } from '../media'\nimport type { Entity, Ref } from '../types'\nimport type { IndexerTransaction } from '../chain/indexer-types'\n\nconst ClientContext = createContext<AlgomdClient | null>(null)\n\n/** A cache adapter over the host's QueryClient, so the app and AlgoMD share entries. */\nexport function queryClientCache(queryClient: QueryClient): CacheAdapter {\n return {\n get: (key) => queryClient.getQueryData<Entity>(key),\n set: (key, entity) => void queryClient.setQueryData(key, entity),\n }\n}\n\nexport interface AlgomdProviderProps {\n client: AlgomdClient\n children?: ReactNode\n}\n\n/** Must sit inside the host's QueryClientProvider. */\nexport function AlgomdProvider({ client, children }: AlgomdProviderProps) {\n const queryClient = useQueryClient()\n useState(() => {\n client.setCache(queryClientCache(queryClient))\n return null\n })\n return createElement(ClientContext.Provider, { value: client }, children)\n}\n\nexport function useAlgomdClient(): AlgomdClient {\n const client = useContext(ClientContext)\n if (!client) throw new Error('AlgoMD hooks need an <AlgomdProvider>')\n return client\n}\n\nexport interface UseEntityOptions {\n enabled?: boolean\n /** Live entities refetch only while visible. Renderers pass their visibility here. */\n visible?: boolean\n params?: Record<string, string>\n}\n\nfunction entityQuery<T>(client: AlgomdClient, kind: string, id: string | undefined, options: UseEntityOptions = {}) {\n const nid = id ? client.normalizeId(kind, id) : undefined\n const visible = options.visible ?? true\n return {\n queryKey: client.key(kind, nid ?? '∅'),\n queryFn: () => client.load(kind, nid!, { params: options.params, fresh: true }) as Promise<Entity<T>>,\n enabled: (options.enabled ?? true) && Boolean(nid),\n staleTime: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).staleTime,\n gcTime: client.policy(kind).gcTime,\n refetchInterval: (q: { state: { data?: Entity<T> } }) => (visible ? client.policy(kind, q.state.data).refetchInterval : false),\n refetchOnWindowFocus: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).name === 'live',\n }\n}\n\n/** One entity through the shared cache. Every component and screen asking for it shares one fetch. */\nexport function useEntity<T = unknown>(kind: string, id: string | undefined, options?: UseEntityOptions): UseQueryResult<Entity<T>> {\n const client = useAlgomdClient()\n return useQuery(entityQuery<T>(client, kind, id, options))\n}\n\nexport function useEntities(refs: Ref[], options?: Omit<UseEntityOptions, 'params'>): UseQueryResult<Entity>[] {\n const client = useAlgomdClient()\n return useQueries({ queries: refs.map((r) => entityQuery(client, r.kind, r.id, { ...options, params: r.params })) })\n}\n\nexport const useAccount = (address?: string, o?: UseEntityOptions) => useEntity<AccountData>('account', address, o)\nexport const useIdentity = (address?: string, o?: UseEntityOptions) => useEntity<IdentityData>('identity', address, o)\nexport const useAsset = (id?: string, o?: UseEntityOptions) => useEntity<AssetData>('asset', id, o)\nexport const useAssetMedia = (id?: string, o?: UseEntityOptions) => useEntity<AssetMediaData>('asset-media', id, o)\nexport const useApplication = (id?: string, o?: UseEntityOptions) => useEntity<ApplicationData>('application', id, o)\nexport const useNfd = (name?: string, o?: UseEntityOptions) => useEntity<NfdData>('nfd', name, o)\nexport const useCollection = (id?: string, o?: UseEntityOptions) => useEntity<CollectionData>('collection', id, o)\nexport const useTransaction = (txId?: string, o?: UseEntityOptions) => useEntity<IndexerTransaction>('transaction', txId, o)\nexport const useListing = (appId?: string, o?: UseEntityOptions) => useEntity<ListingData>('listing', appId, o)\nexport const useAuction = (appId?: string, o?: UseEntityOptions) => useEntity<AuctionData>('auction', appId, o)\nexport const useRaffle = (appId?: string, o?: UseEntityOptions) => useEntity<RaffleData>('raffle', appId, o)\nexport const usePoll = (appId?: string, o?: UseEntityOptions) => useEntity<PollData>('poll', appId, o)\nexport const useStakingPool = (appId?: string, o?: UseEntityOptions) => useEntity<StakingPoolData>('staking-pool', appId, o)\nexport const useReward = (id?: string, o?: UseEntityOptions) => useEntity<RewardData>('reward', id, o)\nexport const useSubscription = (id?: string, o?: UseEntityOptions) => useEntity<SubscriptionData>('subscription', id, o)\nexport const useTrade = (offerId?: string, o?: UseEntityOptions) => useEntity<TradeData>('trade', offerId, o)\nexport const useDualStake = (appId?: string, o?: UseEntityOptions) => useEntity<DualStakeData>('dual-stake', appId, o)\nexport const usePrivateContent = (id?: string, o?: UseEntityOptions) => useEntity<PrivateContentData>('private-content', id, o)\nexport const usePrizeBox = (appId?: string, o?: UseEntityOptions) => useEntity<PrizeBoxData>('prize-box', appId, o)\n\n/**\n * Starts loading every reference in some content, e.g. for a page of feed\n * posts. The loads batch together, so a page costs a few calls, not one per ref.\n */\nexport function prefetchContent(queryClient: QueryClient, client: AlgomdClient, contents: string[]): Promise<void> {\n const refs = new Map<string, Ref>()\n for (const c of contents) for (const r of extractRefs(c, client.registry)) refs.set(`${r.kind}:${r.id}`, r)\n return Promise.all(\n [...refs.values()].map((r) => {\n const { queryKey, queryFn, staleTime } = entityQuery(client, r.kind, r.id, { params: r.params })\n return queryClient.prefetchQuery({ queryKey, queryFn, staleTime: staleTime({ state: { data: queryClient.getQueryData(queryKey) } }) })\n }),\n ).then(() => undefined)\n}\n\n/** For host persisters: whether a cached query should be written to disk. */\nexport function shouldPersistQuery(client: AlgomdClient, query: { queryKey: readonly unknown[]; state: { data?: unknown } }): boolean {\n const [root, network, kind] = query.queryKey\n if (root !== 'algomd' || network !== client.network || typeof kind !== 'string') return false\n const data = query.state.data as Entity | undefined\n return Boolean(data && data.status !== 'missing' && client.policy(kind, data).persist)\n}\n","import type { PolicyName } from './policy'\n\nexport interface KindDef {\n kind: string\n /** Tag names that store this kind in content. The first one is used when serializing. */\n tags: string[]\n /** Props that carry the id, in priority order. The first is used when serializing. */\n idProps: string[]\n /** Extra identifying props kept on the ref (never display data). */\n params?: string[]\n policy: PolicyName\n /** Source names to try, in order. Sources not configured on the client are skipped. */\n sources: string[]\n /** Contract family for chain sources (live state and archive reconstruction). */\n family?: string\n normalizeId?: (id: string) => string | undefined\n /** Builds the cache id from the tag id and params, for kinds keyed by more than one value. */\n composeId?: (id: string, params: Record<string, string>) => string\n /** Inverse of composeId, used when serializing a ref back to a tag. */\n decomposeId?: (id: string) => { id: string; params: Record<string, string> }\n}\n\nconst uint = (id: string) => (/^\\d+$/.test(id.trim()) ? String(BigInt(id.trim())) : undefined)\nconst address = (id: string) => (/^[A-Z2-7]{58}$/.test(id.trim()) ? id.trim() : undefined)\nconst nfdName = (id: string) => {\n const n = id.trim().toLowerCase()\n if (!n) return undefined\n return n.endsWith('.algo') ? n : `${n}.algo`\n}\nconst txid = (id: string) => (/^[A-Z2-7]{52}$/.test(id.trim()) ? id.trim() : undefined)\nconst any = (id: string) => (id.trim() ? id.trim() : undefined)\n\nconst contract = (kind: string, tag: string, family: string): KindDef => ({\n kind,\n tags: [tag],\n idProps: ['appId', 'id'],\n policy: 'live',\n sources: ['resolver', 'algod', 'indexer'],\n family,\n normalizeId: uint,\n})\n\nconst hosted = (kind: string, tag: string, idProps: string[], policy: PolicyName, extra: Partial<KindDef> = {}): KindDef => ({\n kind,\n tags: [tag],\n idProps,\n policy,\n sources: ['resolver'],\n normalizeId: any,\n ...extra,\n})\n\nexport const BUILT_IN_KINDS: KindDef[] = [\n { kind: 'account', tags: ['Account'], idProps: ['address', 'id'], policy: 'live', sources: ['algod', 'indexer'], normalizeId: address },\n { kind: 'identity', tags: [], idProps: ['address'], policy: 'slow', sources: ['identity'], normalizeId: address },\n { kind: 'asset', tags: ['ASA', 'Asset'], idProps: ['id', 'assetId'], policy: 'slow', sources: ['resolver', 'algod', 'indexer'], normalizeId: uint },\n { kind: 'application', tags: ['Application'], idProps: ['id', 'appId'], policy: 'slow', sources: ['resolver', 'indexer', 'algod'], normalizeId: uint },\n // A contract's ARC-56 interface: its `ui` actions and cards. Keyed by app id.\n { kind: 'interface', tags: [], idProps: ['appId', 'id'], policy: 'slow', sources: ['interface'], normalizeId: uint },\n { kind: 'asset-media', tags: [], idProps: ['id'], policy: 'slow', sources: ['media'], normalizeId: uint },\n { kind: 'transaction', tags: ['Transaction'], idProps: ['id', 'txId', 'txid'], policy: 'immutable', sources: ['indexer'], normalizeId: txid },\n { kind: 'nfd', tags: ['NFDProfile'], idProps: ['name', 'id'], policy: 'slow', sources: ['nfd'], normalizeId: nfdName },\n { kind: 'nfd-address', tags: [], idProps: ['address'], policy: 'slow', sources: ['nfd'], normalizeId: address },\n contract('listing', 'NFTListing', 'listing'),\n contract('auction', 'AuctionListing', 'auction'),\n contract('raffle', 'RaffleListing', 'raffle'),\n contract('poll', 'Poll', 'poll'),\n contract('prize-box', 'PrizeBox', 'prize-box'),\n hosted('collection', 'Collection', ['id', 'collectionId'], 'slow'),\n contract('staking-pool', 'StakingPool', 'staking-pool'),\n // HyperSwap is a singleton, so an offer id is enough. Older app tags also carry appId.\n // Chain first while the box exists; the resolver keeps closed offers and their participants.\n { kind: 'trade', tags: ['TradeOffer'], idProps: ['offerId', 'id'], params: ['appId'], policy: 'live', sources: ['algod', 'resolver'], normalizeId: uint },\n hosted('dual-stake', 'DualStakePool', ['appId', 'id'], 'live', { params: ['rewardAssetId'], normalizeId: uint }),\n // A disbursement id in the Rewards singleton.\n { kind: 'reward', tags: ['Reward'], idProps: ['id'], policy: 'live', sources: ['algod', 'resolver'], normalizeId: uint },\n // Services are numbered per owner, so the cache id is `<owner>/<serviceId>` when the owner is known.\n {\n kind: 'subscription',\n tags: ['Subscription'],\n idProps: ['id', 'serviceId'],\n params: ['owner', 'creator', 'address'],\n policy: 'slow',\n // Without an owner only the resolver can find the service.\n sources: ['algod', 'resolver'],\n normalizeId: (id) => (/^([A-Z2-7]{58}\\/)?\\d+$/.test(id.trim()) ? id.trim() : undefined),\n composeId: (id, params) => {\n const owner = params.owner ?? params.creator ?? params.address\n return owner && !id.includes('/') ? `${owner}/${id}` : id\n },\n decomposeId: (id): { id: string; params: Record<string, string> } => {\n const i = id.indexOf('/')\n return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { owner: id.slice(0, i) } }\n },\n },\n // Title is the author's own label in their post, not chain data.\n hosted('private-content', 'PrivateContent', ['id'], 'slow', { params: ['title'] }),\n // A page inside the same post. The host supplies its preview and navigation.\n { kind: 'page-card', tags: ['PageCard'], idProps: ['page', 'next', 'href', 'id'], params: ['title'], policy: 'immutable', sources: [], normalizeId: any },\n]\n\nexport class KindRegistry {\n private byKind = new Map<string, KindDef>()\n private byTag = new Map<string, KindDef>()\n\n constructor(defs: KindDef[] = BUILT_IN_KINDS) {\n defs.forEach((d) => this.register(d))\n }\n\n register(def: KindDef): void {\n this.byKind.set(def.kind, def)\n for (const tag of def.tags) this.byTag.set(tag, def)\n }\n\n get(kind: string): KindDef | undefined {\n return this.byKind.get(kind)\n }\n\n require(kind: string): KindDef {\n const def = this.byKind.get(kind)\n if (!def) throw new Error(`Unknown AlgoMD kind: ${kind}`)\n return def\n }\n\n forTag(tag: string): KindDef | undefined {\n return this.byTag.get(tag)\n }\n\n tags(): string[] {\n return [...this.byTag.keys()]\n }\n\n all(): KindDef[] {\n return [...this.byKind.values()]\n }\n}\n\nexport const defaultRegistry = new KindRegistry()\n","import { defaultRegistry, type KindRegistry } from './kinds'\nimport type { Ref, Size } from './types'\n\n/**\n * The AlgoMD content grammar. Stored content uses self-closing tags such as\n * `<ASA id=\"31566704\" />`. Existing posts are a compatibility boundary: tag\n * names, id props and legacy size props keep working.\n *\n * Only identifiers survive parsing. Any other prop is dropped, so content can\n * never supply the data that gets displayed.\n */\n\nexport interface RefSegment {\n type: 'ref'\n ref: Ref & { size?: Size }\n tag: string\n raw: string\n}\n\nexport interface TextSegment {\n type: 'text'\n content: string\n}\n\nexport type Segment = TextSegment | RefSegment\n\nconst PROPS = `((?:\"[^\"]*\"|'[^']*'|“[^”]*”|‘[^’]*’|\\\\{[^}]*\\\\}|[^'\"“”‘’>])*)`\nconst PROP_RE = /([A-Za-z_][\\w-]*)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{([^}]*)\\}|“([^”]*)”|‘([^’]*)’))?/g\nconst FENCE_RE = /```[\\s\\S]*?```/g\nconst ENTITIES: Record<string, string> = { amp: '&', quot: '\"', apos: \"'\", lt: '<', gt: '>' }\n\nconst tagRegexCache = new WeakMap<KindRegistry, { source: string; tags: string }>()\n\nfunction tagRegex(registry: KindRegistry): RegExp {\n const tags = registry.tags().sort((a, b) => b.length - a.length).join('|')\n let cached = tagRegexCache.get(registry)\n if (!cached || cached.tags !== tags) {\n cached = { tags, source: `<(${tags})\\\\b${PROPS}\\\\/>` }\n tagRegexCache.set(registry, cached)\n }\n return new RegExp(cached.source, 'g')\n}\n\nfunction decodeEntities(value: string): string {\n return value.replace(/&(amp|quot|apos|lt|gt);/g, (_, e: string) => ENTITIES[e] ?? _)\n}\n\nexport function parseProps(raw: string): Record<string, string> {\n const props: Record<string, string> = {}\n for (const m of raw.matchAll(PROP_RE)) {\n const name = m[1]!\n props[name] = decodeEntities(m[2] ?? m[3] ?? m[4] ?? m[5] ?? m[6] ?? 'true').trim()\n }\n return props\n}\n\n/** Maps current and legacy size props to a size. */\nexport function sizeFromProps(props: Record<string, string>): Size | undefined {\n const size = props.size?.toLowerCase()\n switch (size) {\n case 'inline':\n case 'small':\n case 'large':\n return size\n case 'xs':\n case 'sm':\n return 'inline'\n // Legacy `full` meant a full-width card. The full-screen size is stored as `fullscreen`.\n case 'md':\n case 'lg':\n case 'xl':\n case 'full':\n return 'large'\n case 'fullscreen':\n return 'full'\n }\n if (props.inline === 'true' || props.compact === 'true') return 'inline'\n return undefined\n}\n\n/** Builds a ref from a tag name and its props, or undefined if the id is missing or malformed. */\nexport function refFromTag(tag: string, props: Record<string, string>, registry: KindRegistry = defaultRegistry): (Ref & { size?: Size }) | undefined {\n const def = registry.forTag(tag)\n if (!def) return undefined\n const rawId = def.idProps.map((p) => props[p]).find((v) => v && v !== 'true')\n if (!rawId) return undefined\n const params = Object.fromEntries((def.params ?? []).filter((p) => props[p]).map((p) => [p, props[p]!]))\n const composed = def.composeId ? def.composeId(rawId, params) : rawId\n const id = def.normalizeId ? def.normalizeId(composed) : composed\n if (!id) return undefined\n const ref: Ref & { size?: Size } = { kind: def.kind, id }\n if (Object.keys(params).length) ref.params = params\n const size = sizeFromProps(props)\n if (size) ref.size = size\n return ref\n}\n\n/** Splits content into text and reference segments. Tags inside fenced code stay text. */\nexport function parseContent(content: string, registry: KindRegistry = defaultRegistry): Segment[] {\n if (!content) return []\n const fences = [...content.matchAll(FENCE_RE)].map((m) => [m.index!, m.index! + m[0].length] as const)\n const inFence = (i: number) => fences.some(([s, e]) => i >= s && i < e)\n\n const out: Segment[] = []\n let last = 0\n for (const m of content.matchAll(tagRegex(registry))) {\n const at = m.index!\n if (inFence(at)) continue\n const ref = refFromTag(m[1]!, parseProps(m[2] ?? ''), registry)\n if (!ref) continue\n if (at > last) out.push({ type: 'text', content: content.slice(last, at) })\n out.push({ type: 'ref', ref, tag: m[1]!, raw: m[0] })\n last = at + m[0].length\n }\n if (last < content.length) out.push({ type: 'text', content: content.slice(last) })\n return out\n}\n\n/** Every distinct reference in the content, in order of first appearance. */\nexport function extractRefs(content: string, registry: KindRegistry = defaultRegistry): Ref[] {\n const seen = new Map<string, Ref>()\n for (const s of parseContent(content, registry)) {\n if (s.type !== 'ref') continue\n const key = `${s.ref.kind}:${s.ref.id}`\n if (!seen.has(key)) seen.set(key, { kind: s.ref.kind, id: s.ref.id, ...(s.ref.params ? { params: s.ref.params } : {}) })\n }\n return [...seen.values()]\n}\n\nexport function hasRefs(content: string, registry: KindRegistry = defaultRegistry): boolean {\n return parseContent(content, registry).some((s) => s.type === 'ref')\n}\n\nconst attr = (v: string) => v.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n\n/**\n * Serializes a reference as a tag. Sizes are written in a form that older\n * clients also understand: inline as `compact`, full as `size=\"fullscreen\"`.\n */\nexport function serializeRef(ref: Ref & { size?: Size }, registry: KindRegistry = defaultRegistry): string {\n const def = registry.require(ref.kind)\n const tag = def.tags[0]\n if (!tag) throw new Error(`Kind ${ref.kind} has no tag and cannot be stored in content`)\n const split = def.decomposeId ? def.decomposeId(ref.id) : { id: ref.id, params: {} as Record<string, string> }\n const params = { ...split.params, ...ref.params }\n const parts = [`${def.idProps[0]}=\"${attr(split.id)}\"`]\n for (const p of def.params ?? []) if (params[p]) parts.push(`${p}=\"${attr(params[p])}\"`)\n if (ref.size === 'inline') parts.push('compact')\n else if (ref.size === 'small') parts.push('size=\"small\"')\n else if (ref.size === 'full') parts.push('size=\"fullscreen\"')\n return `<${tag} ${parts.join(' ')} />`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4F;AAC5F,mBAAmF;;;ACqBnF,IAAM,OAAO,CAAC,OAAgB,QAAQ,KAAK,GAAG,KAAK,CAAC,IAAI,OAAO,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI;AACpF,IAAM,UAAU,CA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EAAE,IAAI,CAAC;AAC1G,SAAO,QAAQ;AAAA,IACb,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM;AAC5B,YAAM,EAAE,UAAU,SAAS,UAAU,IAAI,YAAY,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC;AAC/F,aAAO,YAAY,cAAc,EAAE,UAAU,SAAS,WAAW,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,aAAa,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC;AAAA,IACvI,CAAC;AAAA,EACH,EAAE,KAAK,MAAM,MAAS;AACxB;AAGO,SAAS,mBAAmB,QAAsB,OAA6E;AACpI,QAAM,CAAC,MAAM,SAAS,IAAI,IAAI,MAAM;AACpC,MAAI,SAAS,YAAY,YAAY,OAAO,WAAW,OAAO,SAAS,SAAU,QAAO;AACxF,QAAM,OAAO,MAAM,MAAM;AACzB,SAAO,QAAQ,QAAQ,KAAK,WAAW,aAAa,OAAO,OAAO,MAAM,IAAI,EAAE,OAAO;AACvF;","names":["address"]}
1
+ {"version":3,"sources":["../src/react/index.ts","../src/kinds.ts","../src/grammar.ts"],"sourcesContent":["import { useQueries, useQuery, useQueryClient, type QueryClient, type UseQueryResult } from '@tanstack/react-query'\nimport { createContext, createElement, useContext, useState, type ReactNode } from 'react'\nimport type { AuctionData, ListingData, PollData, PrizeBoxData, RaffleData } from '../archive/families'\nimport type { AlgomdClient, CacheAdapter } from '../client'\nimport { extractRefs } from '../grammar'\nimport type { IdentityData } from '../identity'\nimport type { AccountData, ApplicationData, AssetData, CollectionData } from '../sources/chain-data'\nimport type { NfdData } from '../sources/nfd'\nimport type { GuildProposalData } from '../guild'\nimport type { DualStakeData, PrivateContentData, RewardData, StakingPoolData, SubscriptionData, TradeData } from '../akita'\nimport type { AssetMediaData } from '../media'\nimport type { Entity, Ref } from '../types'\nimport type { IndexerTransaction } from '../chain/indexer-types'\n\nconst ClientContext = createContext<AlgomdClient | null>(null)\n\n/** A cache adapter over the host's QueryClient, so the app and AlgoMD share entries. */\nexport function queryClientCache(queryClient: QueryClient): CacheAdapter {\n return {\n get: (key) => queryClient.getQueryData<Entity>(key),\n set: (key, entity) => void queryClient.setQueryData(key, entity),\n }\n}\n\nexport interface AlgomdProviderProps {\n client: AlgomdClient\n children?: ReactNode\n}\n\n/** Must sit inside the host's QueryClientProvider. */\nexport function AlgomdProvider({ client, children }: AlgomdProviderProps) {\n const queryClient = useQueryClient()\n useState(() => {\n client.setCache(queryClientCache(queryClient))\n return null\n })\n return createElement(ClientContext.Provider, { value: client }, children)\n}\n\nexport function useAlgomdClient(): AlgomdClient {\n const client = useContext(ClientContext)\n if (!client) throw new Error('AlgoMD hooks need an <AlgomdProvider>')\n return client\n}\n\nexport interface UseEntityOptions {\n enabled?: boolean\n /** Live entities refetch only while visible. Renderers pass their visibility here. */\n visible?: boolean\n params?: Record<string, string>\n}\n\nfunction entityQuery<T>(client: AlgomdClient, kind: string, id: string | undefined, options: UseEntityOptions = {}) {\n const nid = id ? client.normalizeId(kind, id) : undefined\n const visible = options.visible ?? true\n return {\n queryKey: client.key(kind, nid ?? '∅'),\n queryFn: () => client.load(kind, nid!, { params: options.params, fresh: true }) as Promise<Entity<T>>,\n enabled: (options.enabled ?? true) && Boolean(nid),\n staleTime: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).staleTime,\n gcTime: client.policy(kind).gcTime,\n refetchInterval: (q: { state: { data?: Entity<T> } }) => (visible ? client.policy(kind, q.state.data).refetchInterval : false),\n refetchOnWindowFocus: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).name === 'live',\n }\n}\n\n/** One entity through the shared cache. Every component and screen asking for it shares one fetch. */\nexport function useEntity<T = unknown>(kind: string, id: string | undefined, options?: UseEntityOptions): UseQueryResult<Entity<T>> {\n const client = useAlgomdClient()\n return useQuery(entityQuery<T>(client, kind, id, options))\n}\n\nexport function useEntities(refs: Ref[], options?: Omit<UseEntityOptions, 'params'>): UseQueryResult<Entity>[] {\n const client = useAlgomdClient()\n return useQueries({ queries: refs.map((r) => entityQuery(client, r.kind, r.id, { ...options, params: r.params })) })\n}\n\nexport const useAccount = (address?: string, o?: UseEntityOptions) => useEntity<AccountData>('account', address, o)\nexport const useIdentity = (address?: string, o?: UseEntityOptions) => useEntity<IdentityData>('identity', address, o)\nexport const useAsset = (id?: string, o?: UseEntityOptions) => useEntity<AssetData>('asset', id, o)\nexport const useAssetMedia = (id?: string, o?: UseEntityOptions) => useEntity<AssetMediaData>('asset-media', id, o)\nexport const useApplication = (id?: string, o?: UseEntityOptions) => useEntity<ApplicationData>('application', id, o)\nexport const useNfd = (name?: string, o?: UseEntityOptions) => useEntity<NfdData>('nfd', name, o)\nexport const useCollection = (id?: string, o?: UseEntityOptions) => useEntity<CollectionData>('collection', id, o)\nexport const useTransaction = (txId?: string, o?: UseEntityOptions) => useEntity<IndexerTransaction>('transaction', txId, o)\nexport const useListing = (appId?: string, o?: UseEntityOptions) => useEntity<ListingData>('listing', appId, o)\nexport const useAuction = (appId?: string, o?: UseEntityOptions) => useEntity<AuctionData>('auction', appId, o)\nexport const useRaffle = (appId?: string, o?: UseEntityOptions) => useEntity<RaffleData>('raffle', appId, o)\nexport const usePoll = (appId?: string, o?: UseEntityOptions) => useEntity<PollData>('poll', appId, o)\nexport const useStakingPool = (appId?: string, o?: UseEntityOptions) => useEntity<StakingPoolData>('staking-pool', appId, o)\nexport const useReward = (id?: string, o?: UseEntityOptions) => useEntity<RewardData>('reward', id, o)\nexport const useSubscription = (id?: string, o?: UseEntityOptions) => useEntity<SubscriptionData>('subscription', id, o)\nexport const useTrade = (offerId?: string, o?: UseEntityOptions) => useEntity<TradeData>('trade', offerId, o)\nexport const useDualStake = (appId?: string, o?: UseEntityOptions) => useEntity<DualStakeData>('dual-stake', appId, o)\nexport const usePrivateContent = (id?: string, o?: UseEntityOptions) => useEntity<PrivateContentData>('private-content', id, o)\n/** A Guild proposal; `id` is `<guildAppId>/<proposalId>`. */\nexport const useGuildProposal = (id?: string, o?: UseEntityOptions) => useEntity<GuildProposalData>('guild-proposal', id, o)\nexport const usePrizeBox = (appId?: string, o?: UseEntityOptions) => useEntity<PrizeBoxData>('prize-box', appId, o)\n\n/**\n * Starts loading every reference in some content, e.g. for a page of feed\n * posts. The loads batch together, so a page costs a few calls, not one per ref.\n */\nexport function prefetchContent(queryClient: QueryClient, client: AlgomdClient, contents: string[]): Promise<void> {\n const refs = new Map<string, Ref>()\n for (const c of contents) for (const r of extractRefs(c, client.registry)) refs.set(`${r.kind}:${r.id}`, r)\n return Promise.all(\n [...refs.values()].map((r) => {\n const { queryKey, queryFn, staleTime } = entityQuery(client, r.kind, r.id, { params: r.params })\n return queryClient.prefetchQuery({ queryKey, queryFn, staleTime: staleTime({ state: { data: queryClient.getQueryData(queryKey) } }) })\n }),\n ).then(() => undefined)\n}\n\n/** For host persisters: whether a cached query should be written to disk. */\nexport function shouldPersistQuery(client: AlgomdClient, query: { queryKey: readonly unknown[]; state: { data?: unknown } }): boolean {\n const [root, network, kind] = query.queryKey\n if (root !== 'algomd' || network !== client.network || typeof kind !== 'string') return false\n const data = query.state.data as Entity | undefined\n return Boolean(data && data.status !== 'missing' && client.policy(kind, data).persist)\n}\n","import type { PolicyName } from './policy'\n\nexport interface KindDef {\n kind: string\n /** Tag names that store this kind in content. The first one is used when serializing. */\n tags: string[]\n /** Props that carry the id, in priority order. The first is used when serializing. */\n idProps: string[]\n /** Extra identifying props kept on the ref (never display data). */\n params?: string[]\n policy: PolicyName\n /** Source names to try, in order. Sources not configured on the client are skipped. */\n sources: string[]\n /** Contract family for chain sources (live state and archive reconstruction). */\n family?: string\n normalizeId?: (id: string) => string | undefined\n /** Builds the cache id from the tag id and params, for kinds keyed by more than one value. */\n composeId?: (id: string, params: Record<string, string>) => string\n /** Inverse of composeId, used when serializing a ref back to a tag. */\n decomposeId?: (id: string) => { id: string; params: Record<string, string> }\n}\n\nconst uint = (id: string) => (/^\\d+$/.test(id.trim()) ? String(BigInt(id.trim())) : undefined)\nconst address = (id: string) => (/^[A-Z2-7]{58}$/.test(id.trim()) ? id.trim() : undefined)\nconst nfdName = (id: string) => {\n const n = id.trim().toLowerCase()\n if (!n) return undefined\n return n.endsWith('.algo') ? n : `${n}.algo`\n}\nconst txid = (id: string) => (/^[A-Z2-7]{52}$/.test(id.trim()) ? id.trim() : undefined)\nconst any = (id: string) => (id.trim() ? id.trim() : undefined)\n\nconst contract = (kind: string, tag: string, family: string): KindDef => ({\n kind,\n tags: [tag],\n idProps: ['appId', 'id'],\n policy: 'live',\n sources: ['resolver', 'algod', 'indexer'],\n family,\n normalizeId: uint,\n})\n\nconst hosted = (kind: string, tag: string, idProps: string[], policy: PolicyName, extra: Partial<KindDef> = {}): KindDef => ({\n kind,\n tags: [tag],\n idProps,\n policy,\n sources: ['resolver'],\n normalizeId: any,\n ...extra,\n})\n\nexport const BUILT_IN_KINDS: KindDef[] = [\n { kind: 'account', tags: ['Account'], idProps: ['address', 'id'], policy: 'live', sources: ['algod', 'indexer'], normalizeId: address },\n { kind: 'identity', tags: [], idProps: ['address'], policy: 'slow', sources: ['identity'], normalizeId: address },\n { kind: 'asset', tags: ['ASA', 'Asset'], idProps: ['id', 'assetId'], policy: 'slow', sources: ['resolver', 'algod', 'indexer'], normalizeId: uint },\n { kind: 'application', tags: ['Application'], idProps: ['id', 'appId'], policy: 'slow', sources: ['resolver', 'indexer', 'algod'], normalizeId: uint },\n // A contract's ARC-56 interface: its `ui` actions and cards. Keyed by app id.\n { kind: 'interface', tags: [], idProps: ['appId', 'id'], policy: 'slow', sources: ['interface'], normalizeId: uint },\n { kind: 'asset-media', tags: [], idProps: ['id'], policy: 'slow', sources: ['media'], normalizeId: uint },\n { kind: 'transaction', tags: ['Transaction'], idProps: ['id', 'txId', 'txid'], policy: 'immutable', sources: ['indexer'], normalizeId: txid },\n { kind: 'nfd', tags: ['NFDProfile'], idProps: ['name', 'id'], policy: 'slow', sources: ['nfd'], normalizeId: nfdName },\n { kind: 'nfd-address', tags: [], idProps: ['address'], policy: 'slow', sources: ['nfd'], normalizeId: address },\n contract('listing', 'NFTListing', 'listing'),\n contract('auction', 'AuctionListing', 'auction'),\n contract('raffle', 'RaffleListing', 'raffle'),\n contract('poll', 'Poll', 'poll'),\n contract('prize-box', 'PrizeBox', 'prize-box'),\n hosted('collection', 'Collection', ['id', 'collectionId'], 'slow'),\n contract('staking-pool', 'StakingPool', 'staking-pool'),\n // HyperSwap is a singleton, so an offer id is enough. Older app tags also carry appId.\n // Chain first while the box exists; the resolver keeps closed offers and their participants.\n { kind: 'trade', tags: ['TradeOffer'], idProps: ['offerId', 'id'], params: ['appId'], policy: 'live', sources: ['algod', 'resolver'], normalizeId: uint },\n hosted('dual-stake', 'DualStakePool', ['appId', 'id'], 'live', { params: ['rewardAssetId'], normalizeId: uint }),\n // A disbursement id in the Rewards singleton.\n { kind: 'reward', tags: ['Reward'], idProps: ['id'], policy: 'live', sources: ['algod', 'resolver'], normalizeId: uint },\n // Services are numbered per owner, so the cache id is `<owner>/<serviceId>` when the owner is known.\n {\n kind: 'subscription',\n tags: ['Subscription'],\n idProps: ['id', 'serviceId'],\n params: ['owner', 'creator', 'address'],\n policy: 'slow',\n // Without an owner only the resolver can find the service.\n sources: ['algod', 'resolver'],\n normalizeId: (id) => (/^([A-Z2-7]{58}\\/)?\\d+$/.test(id.trim()) ? id.trim() : undefined),\n composeId: (id, params) => {\n const owner = params.owner ?? params.creator ?? params.address\n return owner && !id.includes('/') ? `${owner}/${id}` : id\n },\n decomposeId: (id): { id: string; params: Record<string, string> } => {\n const i = id.indexOf('/')\n return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { owner: id.slice(0, i) } }\n },\n },\n // A Guild proposal. Proposal ids count per Guild, so the cache id is `<guildAppId>/<proposalId>`.\n {\n kind: 'guild-proposal',\n tags: ['GuildProposal'],\n idProps: ['proposalId', 'id'],\n params: ['appId'],\n policy: 'live',\n sources: ['algod'],\n normalizeId: (id) => (/^(\\d+\\/)?\\d+$/.test(id.trim()) ? id.trim() : undefined),\n composeId: (id, params) => (params.appId && !id.includes('/') ? `${params.appId}/${id}` : id),\n decomposeId: (id): { id: string; params: Record<string, string> } => {\n const i = id.indexOf('/')\n return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { appId: id.slice(0, i) } }\n },\n },\n // Title is the author's own label in their post, not chain data.\n hosted('private-content', 'PrivateContent', ['id'], 'slow', { params: ['title'] }),\n // A page inside the same post. The host supplies its preview and navigation.\n { kind: 'page-card', tags: ['PageCard'], idProps: ['page', 'next', 'href', 'id'], params: ['title'], policy: 'immutable', sources: [], normalizeId: any },\n]\n\nexport class KindRegistry {\n private byKind = new Map<string, KindDef>()\n private byTag = new Map<string, KindDef>()\n\n constructor(defs: KindDef[] = BUILT_IN_KINDS) {\n defs.forEach((d) => this.register(d))\n }\n\n register(def: KindDef): void {\n this.byKind.set(def.kind, def)\n for (const tag of def.tags) this.byTag.set(tag, def)\n }\n\n get(kind: string): KindDef | undefined {\n return this.byKind.get(kind)\n }\n\n require(kind: string): KindDef {\n const def = this.byKind.get(kind)\n if (!def) throw new Error(`Unknown AlgoMD kind: ${kind}`)\n return def\n }\n\n forTag(tag: string): KindDef | undefined {\n return this.byTag.get(tag)\n }\n\n tags(): string[] {\n return [...this.byTag.keys()]\n }\n\n all(): KindDef[] {\n return [...this.byKind.values()]\n }\n}\n\nexport const defaultRegistry = new KindRegistry()\n","import { defaultRegistry, type KindRegistry } from './kinds'\nimport type { Ref, Size } from './types'\n\n/**\n * The AlgoMD content grammar. Stored content uses self-closing tags such as\n * `<ASA id=\"31566704\" />`. Existing posts are a compatibility boundary: tag\n * names, id props and legacy size props keep working.\n *\n * Only identifiers survive parsing. Any other prop is dropped, so content can\n * never supply the data that gets displayed.\n */\n\nexport interface RefSegment {\n type: 'ref'\n ref: Ref & { size?: Size }\n tag: string\n raw: string\n}\n\nexport interface TextSegment {\n type: 'text'\n content: string\n}\n\nexport type Segment = TextSegment | RefSegment\n\nconst PROPS = `((?:\"[^\"]*\"|'[^']*'|“[^”]*”|‘[^’]*’|\\\\{[^}]*\\\\}|[^'\"“”‘’>])*)`\nconst PROP_RE = /([A-Za-z_][\\w-]*)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{([^}]*)\\}|“([^”]*)”|‘([^’]*)’))?/g\nconst FENCE_RE = /```[\\s\\S]*?```/g\nconst ENTITIES: Record<string, string> = { amp: '&', quot: '\"', apos: \"'\", lt: '<', gt: '>' }\n\nconst tagRegexCache = new WeakMap<KindRegistry, { source: string; tags: string }>()\n\nfunction tagRegex(registry: KindRegistry): RegExp {\n const tags = registry.tags().sort((a, b) => b.length - a.length).join('|')\n let cached = tagRegexCache.get(registry)\n if (!cached || cached.tags !== tags) {\n cached = { tags, source: `<(${tags})\\\\b${PROPS}\\\\/>` }\n tagRegexCache.set(registry, cached)\n }\n return new RegExp(cached.source, 'g')\n}\n\nfunction decodeEntities(value: string): string {\n return value.replace(/&(amp|quot|apos|lt|gt);/g, (_, e: string) => ENTITIES[e] ?? _)\n}\n\nexport function parseProps(raw: string): Record<string, string> {\n const props: Record<string, string> = {}\n for (const m of raw.matchAll(PROP_RE)) {\n const name = m[1]!\n props[name] = decodeEntities(m[2] ?? m[3] ?? m[4] ?? m[5] ?? m[6] ?? 'true').trim()\n }\n return props\n}\n\n/** Maps current and legacy size props to a size. */\nexport function sizeFromProps(props: Record<string, string>): Size | undefined {\n const size = props.size?.toLowerCase()\n switch (size) {\n case 'inline':\n case 'small':\n case 'large':\n return size\n case 'xs':\n case 'sm':\n return 'inline'\n // Legacy `full` meant a full-width card. The full-screen size is stored as `fullscreen`.\n case 'md':\n case 'lg':\n case 'xl':\n case 'full':\n return 'large'\n case 'fullscreen':\n return 'full'\n }\n if (props.inline === 'true' || props.compact === 'true') return 'inline'\n return undefined\n}\n\n/** Builds a ref from a tag name and its props, or undefined if the id is missing or malformed. */\nexport function refFromTag(tag: string, props: Record<string, string>, registry: KindRegistry = defaultRegistry): (Ref & { size?: Size }) | undefined {\n const def = registry.forTag(tag)\n if (!def) return undefined\n const rawId = def.idProps.map((p) => props[p]).find((v) => v && v !== 'true')\n if (!rawId) return undefined\n const params = Object.fromEntries((def.params ?? []).filter((p) => props[p]).map((p) => [p, props[p]!]))\n const composed = def.composeId ? def.composeId(rawId, params) : rawId\n const id = def.normalizeId ? def.normalizeId(composed) : composed\n if (!id) return undefined\n const ref: Ref & { size?: Size } = { kind: def.kind, id }\n if (Object.keys(params).length) ref.params = params\n const size = sizeFromProps(props)\n if (size) ref.size = size\n return ref\n}\n\n/** Splits content into text and reference segments. Tags inside fenced code stay text. */\nexport function parseContent(content: string, registry: KindRegistry = defaultRegistry): Segment[] {\n if (!content) return []\n const fences = [...content.matchAll(FENCE_RE)].map((m) => [m.index!, m.index! + m[0].length] as const)\n const inFence = (i: number) => fences.some(([s, e]) => i >= s && i < e)\n\n const out: Segment[] = []\n let last = 0\n for (const m of content.matchAll(tagRegex(registry))) {\n const at = m.index!\n if (inFence(at)) continue\n const ref = refFromTag(m[1]!, parseProps(m[2] ?? ''), registry)\n if (!ref) continue\n if (at > last) out.push({ type: 'text', content: content.slice(last, at) })\n out.push({ type: 'ref', ref, tag: m[1]!, raw: m[0] })\n last = at + m[0].length\n }\n if (last < content.length) out.push({ type: 'text', content: content.slice(last) })\n return out\n}\n\n/** Every distinct reference in the content, in order of first appearance. */\nexport function extractRefs(content: string, registry: KindRegistry = defaultRegistry): Ref[] {\n const seen = new Map<string, Ref>()\n for (const s of parseContent(content, registry)) {\n if (s.type !== 'ref') continue\n const key = `${s.ref.kind}:${s.ref.id}`\n if (!seen.has(key)) seen.set(key, { kind: s.ref.kind, id: s.ref.id, ...(s.ref.params ? { params: s.ref.params } : {}) })\n }\n return [...seen.values()]\n}\n\nexport function hasRefs(content: string, registry: KindRegistry = defaultRegistry): boolean {\n return parseContent(content, registry).some((s) => s.type === 'ref')\n}\n\nconst attr = (v: string) => v.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n\n/**\n * Serializes a reference as a tag. Sizes are written in a form that older\n * clients also understand: inline as `compact`, full as `size=\"fullscreen\"`.\n */\nexport function serializeRef(ref: Ref & { size?: Size }, registry: KindRegistry = defaultRegistry): string {\n const def = registry.require(ref.kind)\n const tag = def.tags[0]\n if (!tag) throw new Error(`Kind ${ref.kind} has no tag and cannot be stored in content`)\n const split = def.decomposeId ? def.decomposeId(ref.id) : { id: ref.id, params: {} as Record<string, string> }\n const params = { ...split.params, ...ref.params }\n const parts = [`${def.idProps[0]}=\"${attr(split.id)}\"`]\n for (const p of def.params ?? []) if (params[p]) parts.push(`${p}=\"${attr(params[p])}\"`)\n if (ref.size === 'inline') parts.push('compact')\n else if (ref.size === 'small') parts.push('size=\"small\"')\n else if (ref.size === 'full') parts.push('size=\"fullscreen\"')\n return `<${tag} ${parts.join(' ')} />`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4F;AAC5F,mBAAmF;;;ACqBnF,IAAM,OAAO,CAAC,OAAgB,QAAQ,KAAK,GAAG,KAAK,CAAC,IAAI,OAAO,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI;AACpF,IAAM,UAAU,CAAC,OAAgB,iBAAiB,KAAK,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,IAAI;AAChF,IAAM,UAAU,CAAC,OAAe;AAC9B,QAAM,IAAI,GAAG,KAAK,EAAE,YAAY;AAChC,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,SAAS,OAAO,IAAI,IAAI,GAAG,CAAC;AACvC;AACA,IAAM,OAAO,CAAC,O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Result } from '@tanstack/react-query';
4
- import { h as AlgomdClient, p as CacheAdapter, f as Entity, g as AccountData, j as ApplicationData, l as AssetData, m as AssetMediaData, o as AuctionData, r as CollectionData, y as DualStakeData, R as Ref, O as IdentityData, Z as ListingData, a3 as NfdData, a6 as PollData, a7 as PrivateContentData, a8 as PrizeBoxData, aa as RaffleData, ac as RewardData, ae as StakingPoolData, ag as SubscriptionData, aj as TradeData, I as IndexerTransaction } from './families-CiQWc-YP.cjs';
4
+ import { h as AlgomdClient, p as CacheAdapter, f as Entity, g as AccountData, j as ApplicationData, l as AssetData, m as AssetMediaData, o as AuctionData, r as CollectionData, y as DualStakeData, R as Ref, P as GuildProposalData, V as IdentityData, a2 as ListingData, a8 as NfdData, ab as PollData, ac as PrivateContentData, ad as PrizeBoxData, af as RaffleData, ah as RewardData, aj as StakingPoolData, al as SubscriptionData, ao as TradeData, I as IndexerTransaction } from './families-R1GgJpSO.cjs';
5
5
 
6
6
  /** A cache adapter over the host's QueryClient, so the app and AlgoMD share entries. */
7
7
  declare function queryClientCache(queryClient: QueryClient): CacheAdapter;
@@ -39,6 +39,8 @@ declare const useSubscription: (id?: string, o?: UseEntityOptions) => UseQueryRe
39
39
  declare const useTrade: (offerId?: string, o?: UseEntityOptions) => UseQueryResult<Entity<TradeData>>;
40
40
  declare const useDualStake: (appId?: string, o?: UseEntityOptions) => UseQueryResult<Entity<DualStakeData>>;
41
41
  declare const usePrivateContent: (id?: string, o?: UseEntityOptions) => UseQueryResult<Entity<PrivateContentData>>;
42
+ /** A Guild proposal; `id` is `<guildAppId>/<proposalId>`. */
43
+ declare const useGuildProposal: (id?: string, o?: UseEntityOptions) => UseQueryResult<Entity<GuildProposalData>>;
42
44
  declare const usePrizeBox: (appId?: string, o?: UseEntityOptions) => UseQueryResult<Entity<PrizeBoxData>>;
43
45
  /**
44
46
  * Starts loading every reference in some content, e.g. for a page of feed
@@ -53,4 +55,4 @@ declare function shouldPersistQuery(client: AlgomdClient, query: {
53
55
  };
54
56
  }): boolean;
55
57
 
56
- export { AlgomdProvider, type AlgomdProviderProps, type UseEntityOptions, prefetchContent, queryClientCache, shouldPersistQuery, useAccount, useAlgomdClient, useApplication, useAsset, useAssetMedia, useAuction, useCollection, useDualStake, useEntities, useEntity, useIdentity, useListing, useNfd, usePoll, usePrivateContent, usePrizeBox, useRaffle, useReward, useStakingPool, useSubscription, useTrade, useTransaction };
58
+ export { AlgomdProvider, type AlgomdProviderProps, type UseEntityOptions, prefetchContent, queryClientCache, shouldPersistQuery, useAccount, useAlgomdClient, useApplication, useAsset, useAssetMedia, useAuction, useCollection, useDualStake, useEntities, useEntity, useGuildProposal, useIdentity, useListing, useNfd, usePoll, usePrivateContent, usePrizeBox, useRaffle, useReward, useStakingPool, useSubscription, useTrade, useTransaction };
package/dist/react.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { QueryClient, UseQueryResult } from '@tanstack/react-query';
4
- import { h as AlgomdClient, p as CacheAdapter, f as Entity, g as AccountData, j as ApplicationData, l as AssetData, m as AssetMediaData, o as AuctionData, r as CollectionData, y as DualStakeData, R as Ref, O as IdentityData, Z as ListingData, a3 as NfdData, a6 as PollData, a7 as PrivateContentData, a8 as PrizeBoxData, aa as RaffleData, ac as RewardData, ae as StakingPoolData, ag as SubscriptionData, aj as TradeData, I as IndexerTransaction } from './families-CiQWc-YP.js';
4
+ import { h as AlgomdClient, p as CacheAdapter, f as Entity, g as AccountData, j as ApplicationData, l as AssetData, m as AssetMediaData, o as AuctionData, r as CollectionData, y as DualStakeData, R as Ref, P as GuildProposalData, V as IdentityData, a2 as ListingData, a8 as NfdData, ab as PollData, ac as PrivateContentData, ad as PrizeBoxData, af as RaffleData, ah as RewardData, aj as StakingPoolData, al as SubscriptionData, ao as TradeData, I as IndexerTransaction } from './families-R1GgJpSO.js';
5
5
 
6
6
  /** A cache adapter over the host's QueryClient, so the app and AlgoMD share entries. */
7
7
  declare function queryClientCache(queryClient: QueryClient): CacheAdapter;
@@ -39,6 +39,8 @@ declare const useSubscription: (id?: string, o?: UseEntityOptions) => UseQueryRe
39
39
  declare const useTrade: (offerId?: string, o?: UseEntityOptions) => UseQueryResult<Entity<TradeData>>;
40
40
  declare const useDualStake: (appId?: string, o?: UseEntityOptions) => UseQueryResult<Entity<DualStakeData>>;
41
41
  declare const usePrivateContent: (id?: string, o?: UseEntityOptions) => UseQueryResult<Entity<PrivateContentData>>;
42
+ /** A Guild proposal; `id` is `<guildAppId>/<proposalId>`. */
43
+ declare const useGuildProposal: (id?: string, o?: UseEntityOptions) => UseQueryResult<Entity<GuildProposalData>>;
42
44
  declare const usePrizeBox: (appId?: string, o?: UseEntityOptions) => UseQueryResult<Entity<PrizeBoxData>>;
43
45
  /**
44
46
  * Starts loading every reference in some content, e.g. for a page of feed
@@ -53,4 +55,4 @@ declare function shouldPersistQuery(client: AlgomdClient, query: {
53
55
  };
54
56
  }): boolean;
55
57
 
56
- export { AlgomdProvider, type AlgomdProviderProps, type UseEntityOptions, prefetchContent, queryClientCache, shouldPersistQuery, useAccount, useAlgomdClient, useApplication, useAsset, useAssetMedia, useAuction, useCollection, useDualStake, useEntities, useEntity, useIdentity, useListing, useNfd, usePoll, usePrivateContent, usePrizeBox, useRaffle, useReward, useStakingPool, useSubscription, useTrade, useTransaction };
58
+ export { AlgomdProvider, type AlgomdProviderProps, type UseEntityOptions, prefetchContent, queryClientCache, shouldPersistQuery, useAccount, useAlgomdClient, useApplication, useAsset, useAssetMedia, useAuction, useCollection, useDualStake, useEntities, useEntity, useGuildProposal, useIdentity, useListing, useNfd, usePoll, usePrivateContent, usePrizeBox, useRaffle, useReward, useStakingPool, useSubscription, useTrade, useTransaction };
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  extractRefs
3
- } from "./chunk-NRZTLFVI.js";
3
+ } from "./chunk-6KYOB5JM.js";
4
4
 
5
5
  // src/react/index.ts
6
6
  import { useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -64,6 +64,7 @@ var useSubscription = (id, o) => useEntity("subscription", id, o);
64
64
  var useTrade = (offerId, o) => useEntity("trade", offerId, o);
65
65
  var useDualStake = (appId, o) => useEntity("dual-stake", appId, o);
66
66
  var usePrivateContent = (id, o) => useEntity("private-content", id, o);
67
+ var useGuildProposal = (id, o) => useEntity("guild-proposal", id, o);
67
68
  var usePrizeBox = (appId, o) => useEntity("prize-box", appId, o);
68
69
  function prefetchContent(queryClient, client, contents) {
69
70
  const refs = /* @__PURE__ */ new Map();
@@ -96,6 +97,7 @@ export {
96
97
  useDualStake,
97
98
  useEntities,
98
99
  useEntity,
100
+ useGuildProposal,
99
101
  useIdentity,
100
102
  useListing,
101
103
  useNfd,
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/react/index.ts"],"sourcesContent":["import { useQueries, useQuery, useQueryClient, type QueryClient, type UseQueryResult } from '@tanstack/react-query'\nimport { createContext, createElement, useContext, useState, type ReactNode } from 'react'\nimport type { AuctionData, ListingData, PollData, PrizeBoxData, RaffleData } from '../archive/families'\nimport type { AlgomdClient, CacheAdapter } from '../client'\nimport { extractRefs } from '../grammar'\nimport type { IdentityData } from '../identity'\nimport type { AccountData, ApplicationData, AssetData, CollectionData } from '../sources/chain-data'\nimport type { NfdData } from '../sources/nfd'\nimport type { DualStakeData, PrivateContentData, RewardData, StakingPoolData, SubscriptionData, TradeData } from '../akita'\nimport type { AssetMediaData } from '../media'\nimport type { Entity, Ref } from '../types'\nimport type { IndexerTransaction } from '../chain/indexer-types'\n\nconst ClientContext = createContext<AlgomdClient | null>(null)\n\n/** A cache adapter over the host's QueryClient, so the app and AlgoMD share entries. */\nexport function queryClientCache(queryClient: QueryClient): CacheAdapter {\n return {\n get: (key) => queryClient.getQueryData<Entity>(key),\n set: (key, entity) => void queryClient.setQueryData(key, entity),\n }\n}\n\nexport interface AlgomdProviderProps {\n client: AlgomdClient\n children?: ReactNode\n}\n\n/** Must sit inside the host's QueryClientProvider. */\nexport function AlgomdProvider({ client, children }: AlgomdProviderProps) {\n const queryClient = useQueryClient()\n useState(() => {\n client.setCache(queryClientCache(queryClient))\n return null\n })\n return createElement(ClientContext.Provider, { value: client }, children)\n}\n\nexport function useAlgomdClient(): AlgomdClient {\n const client = useContext(ClientContext)\n if (!client) throw new Error('AlgoMD hooks need an <AlgomdProvider>')\n return client\n}\n\nexport interface UseEntityOptions {\n enabled?: boolean\n /** Live entities refetch only while visible. Renderers pass their visibility here. */\n visible?: boolean\n params?: Record<string, string>\n}\n\nfunction entityQuery<T>(client: AlgomdClient, kind: string, id: string | undefined, options: UseEntityOptions = {}) {\n const nid = id ? client.normalizeId(kind, id) : undefined\n const visible = options.visible ?? true\n return {\n queryKey: client.key(kind, nid ?? '∅'),\n queryFn: () => client.load(kind, nid!, { params: options.params, fresh: true }) as Promise<Entity<T>>,\n enabled: (options.enabled ?? true) && Boolean(nid),\n staleTime: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).staleTime,\n gcTime: client.policy(kind).gcTime,\n refetchInterval: (q: { state: { data?: Entity<T> } }) => (visible ? client.policy(kind, q.state.data).refetchInterval : false),\n refetchOnWindowFocus: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).name === 'live',\n }\n}\n\n/** One entity through the shared cache. Every component and screen asking for it shares one fetch. */\nexport function useEntity<T = unknown>(kind: string, id: string | undefined, options?: UseEntityOptions): UseQueryResult<Entity<T>> {\n const client = useAlgomdClient()\n return useQuery(entityQuery<T>(client, kind, id, options))\n}\n\nexport function useEntities(refs: Ref[], options?: Omit<UseEntityOptions, 'params'>): UseQueryResult<Entity>[] {\n const client = useAlgomdClient()\n return useQueries({ queries: refs.map((r) => entityQuery(client, r.kind, r.id, { ...options, params: r.params })) })\n}\n\nexport const useAccount = (address?: string, o?: UseEntityOptions) => useEntity<AccountData>('account', address, o)\nexport const useIdentity = (address?: string, o?: UseEntityOptions) => useEntity<IdentityData>('identity', address, o)\nexport const useAsset = (id?: string, o?: UseEntityOptions) => useEntity<AssetData>('asset', id, o)\nexport const useAssetMedia = (id?: string, o?: UseEntityOptions) => useEntity<AssetMediaData>('asset-media', id, o)\nexport const useApplication = (id?: string, o?: UseEntityOptions) => useEntity<ApplicationData>('application', id, o)\nexport const useNfd = (name?: string, o?: UseEntityOptions) => useEntity<NfdData>('nfd', name, o)\nexport const useCollection = (id?: string, o?: UseEntityOptions) => useEntity<CollectionData>('collection', id, o)\nexport const useTransaction = (txId?: string, o?: UseEntityOptions) => useEntity<IndexerTransaction>('transaction', txId, o)\nexport const useListing = (appId?: string, o?: UseEntityOptions) => useEntity<ListingData>('listing', appId, o)\nexport const useAuction = (appId?: string, o?: UseEntityOptions) => useEntity<AuctionData>('auction', appId, o)\nexport const useRaffle = (appId?: string, o?: UseEntityOptions) => useEntity<RaffleData>('raffle', appId, o)\nexport const usePoll = (appId?: string, o?: UseEntityOptions) => useEntity<PollData>('poll', appId, o)\nexport const useStakingPool = (appId?: string, o?: UseEntityOptions) => useEntity<StakingPoolData>('staking-pool', appId, o)\nexport const useReward = (id?: string, o?: UseEntityOptions) => useEntity<RewardData>('reward', id, o)\nexport const useSubscription = (id?: string, o?: UseEntityOptions) => useEntity<SubscriptionData>('subscription', id, o)\nexport const useTrade = (offerId?: string, o?: UseEntityOptions) => useEntity<TradeData>('trade', offerId, o)\nexport const useDualStake = (appId?: string, o?: UseEntityOptions) => useEntity<DualStakeData>('dual-stake', appId, o)\nexport const usePrivateContent = (id?: string, o?: UseEntityOptions) => useEntity<PrivateContentData>('private-content', id, o)\nexport const usePrizeBox = (appId?: string, o?: UseEntityOptions) => useEntity<PrizeBoxData>('prize-box', appId, o)\n\n/**\n * Starts loading every reference in some content, e.g. for a page of feed\n * posts. The loads batch together, so a page costs a few calls, not one per ref.\n */\nexport function prefetchContent(queryClient: QueryClient, client: AlgomdClient, contents: string[]): Promise<void> {\n const refs = new Map<string, Ref>()\n for (const c of contents) for (const r of extractRefs(c, client.registry)) refs.set(`${r.kind}:${r.id}`, r)\n return Promise.all(\n [...refs.values()].map((r) => {\n const { queryKey, queryFn, staleTime } = entityQuery(client, r.kind, r.id, { params: r.params })\n return queryClient.prefetchQuery({ queryKey, queryFn, staleTime: staleTime({ state: { data: queryClient.getQueryData(queryKey) } }) })\n }),\n ).then(() => undefined)\n}\n\n/** For host persisters: whether a cached query should be written to disk. */\nexport function shouldPersistQuery(client: AlgomdClient, query: { queryKey: readonly unknown[]; state: { data?: unknown } }): boolean {\n const [root, network, kind] = query.queryKey\n if (root !== 'algomd' || network !== client.network || typeof kind !== 'string') return false\n const data = query.state.data as Entity | undefined\n return Boolean(data && data.status !== 'missing' && client.policy(kind, data).persist)\n}\n"],"mappings":";;;;;AAAA,SAAS,YAAY,UAAU,sBAA6D;AAC5F,SAAS,eAAe,eAAe,YAAY,gBAAgC;AAYnF,IAAM,gBAAgB,cAAmC,IAAI;AAGtD,SAAS,iBAAiB,aAAwC;AACvE,SAAO;AAAA,IACL,KAAK,CAAC,QAAQ,YAAY,aAAqB,GAAG;AAAA,IAClD,KAAK,CAAC,KAAK,WAAW,KAAK,YAAY,aAAa,KAAK,MAAM;AAAA,EACjE;AACF;AAQO,SAAS,eAAe,EAAE,QAAQ,SAAS,GAAwB;AACxE,QAAM,cAAc,eAAe;AACnC,WAAS,MAAM;AACb,WAAO,SAAS,iBAAiB,WAAW,CAAC;AAC7C,WAAO;AAAA,EACT,CAAC;AACD,SAAO,cAAc,cAAc,UAAU,EAAE,OAAO,OAAO,GAAG,QAAQ;AAC1E;AAEO,SAAS,kBAAgC;AAC9C,QAAM,SAAS,WAAW,aAAa;AACvC,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACpE,SAAO;AACT;AASA,SAAS,YAAe,QAAsB,MAAc,IAAwB,UAA4B,CAAC,GAAG;AAClH,QAAM,MAAM,KAAK,OAAO,YAAY,MAAM,EAAE,IAAI;AAChD,QAAM,UAAU,QAAQ,WAAW;AACnC,SA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,QAAQ,EAAE,OAAO,CAAC;AAC/F,aAAO,YAAY,cAAc,EAAE,UAAU,SAAS,WAAW,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,aAAa,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC;AAAA,IACvI,CAAC;AAAA,EACH,EAAE,KAAK,MAAM,MAAS;AACxB;AAGO,SAAS,mBAAmB,QAAsB,OAA6E;AACpI,QAAM,CAAC,MAAM,SAAS,IAAI,IAAI,MAAM;AACpC,MAAI,SAAS,YAAY,YAAY,OAAO,WAAW,OAAO,SAAS,SAAU,QAAO;AACxF,QAAM,OAAO,MAAM,MAAM;AACzB,SAAO,QAAQ,QAAQ,KAAK,WAAW,aAAa,OAAO,OAAO,MAAM,IAAI,EAAE,OAAO;AACvF;","names":[]}
1
+ {"version":3,"sources":["../src/react/index.ts"],"sourcesContent":["import { useQueries, useQuery, useQueryClient, type QueryClient, type UseQueryResult } from '@tanstack/react-query'\nimport { createContext, createElement, useContext, useState, type ReactNode } from 'react'\nimport type { AuctionData, ListingData, PollData, PrizeBoxData, RaffleData } from '../archive/families'\nimport type { AlgomdClient, CacheAdapter } from '../client'\nimport { extractRefs } from '../grammar'\nimport type { IdentityData } from '../identity'\nimport type { AccountData, ApplicationData, AssetData, CollectionData } from '../sources/chain-data'\nimport type { NfdData } from '../sources/nfd'\nimport type { GuildProposalData } from '../guild'\nimport type { DualStakeData, PrivateContentData, RewardData, StakingPoolData, SubscriptionData, TradeData } from '../akita'\nimport type { AssetMediaData } from '../media'\nimport type { Entity, Ref } from '../types'\nimport type { IndexerTransaction } from '../chain/indexer-types'\n\nconst ClientContext = createContext<AlgomdClient | null>(null)\n\n/** A cache adapter over the host's QueryClient, so the app and AlgoMD share entries. */\nexport function queryClientCache(queryClient: QueryClient): CacheAdapter {\n return {\n get: (key) => queryClient.getQueryData<Entity>(key),\n set: (key, entity) => void queryClient.setQueryData(key, entity),\n }\n}\n\nexport interface AlgomdProviderProps {\n client: AlgomdClient\n children?: ReactNode\n}\n\n/** Must sit inside the host's QueryClientProvider. */\nexport function AlgomdProvider({ client, children }: AlgomdProviderProps) {\n const queryClient = useQueryClient()\n useState(() => {\n client.setCache(queryClientCache(queryClient))\n return null\n })\n return createElement(ClientContext.Provider, { value: client }, children)\n}\n\nexport function useAlgomdClient(): AlgomdClient {\n const client = useContext(ClientContext)\n if (!client) throw new Error('AlgoMD hooks need an <AlgomdProvider>')\n return client\n}\n\nexport interface UseEntityOptions {\n enabled?: boolean\n /** Live entities refetch only while visible. Renderers pass their visibility here. */\n visible?: boolean\n params?: Record<string, string>\n}\n\nfunction entityQuery<T>(client: AlgomdClient, kind: string, id: string | undefined, options: UseEntityOptions = {}) {\n const nid = id ? client.normalizeId(kind, id) : undefined\n const visible = options.visible ?? true\n return {\n queryKey: client.key(kind, nid ?? '∅'),\n queryFn: () => client.load(kind, nid!, { params: options.params, fresh: true }) as Promise<Entity<T>>,\n enabled: (options.enabled ?? true) && Boolean(nid),\n staleTime: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).staleTime,\n gcTime: client.policy(kind).gcTime,\n refetchInterval: (q: { state: { data?: Entity<T> } }) => (visible ? client.policy(kind, q.state.data).refetchInterval : false),\n refetchOnWindowFocus: (q: { state: { data?: Entity<T> } }) => client.policy(kind, q.state.data).name === 'live',\n }\n}\n\n/** One entity through the shared cache. Every component and screen asking for it shares one fetch. */\nexport function useEntity<T = unknown>(kind: string, id: string | undefined, options?: UseEntityOptions): UseQueryResult<Entity<T>> {\n const client = useAlgomdClient()\n return useQuery(entityQuery<T>(client, kind, id, options))\n}\n\nexport function useEntities(refs: Ref[], options?: Omit<UseEntityOptions, 'params'>): UseQueryResult<Entity>[] {\n const client = useAlgomdClient()\n return useQueries({ queries: refs.map((r) => entityQuery(client, r.kind, r.id, { ...options, params: r.params })) })\n}\n\nexport const useAccount = (address?: string, o?: UseEntityOptions) => useEntity<AccountData>('account', address, o)\nexport const useIdentity = (address?: string, o?: UseEntityOptions) => useEntity<IdentityData>('identity', address, o)\nexport const useAsset = (id?: string, o?: UseEntityOptions) => useEntity<AssetData>('asset', id, o)\nexport const useAssetMedia = (id?: string, o?: UseEntityOptions) => useEntity<AssetMediaData>('asset-media', id, o)\nexport const useApplication = (id?: string, o?: UseEntityOptions) => useEntity<ApplicationData>('application', id, o)\nexport const useNfd = (name?: string, o?: UseEntityOptions) => useEntity<NfdData>('nfd', name, o)\nexport const useCollection = (id?: string, o?: UseEntityOptions) => useEntity<CollectionData>('collection', id, o)\nexport const useTransaction = (txId?: string, o?: UseEntityOptions) => useEntity<IndexerTransaction>('transaction', txId, o)\nexport const useListing = (appId?: string, o?: UseEntityOptions) => useEntity<ListingData>('listing', appId, o)\nexport const useAuction = (appId?: string, o?: UseEntityOptions) => useEntity<AuctionData>('auction', appId, o)\nexport const useRaffle = (appId?: string, o?: UseEntityOptions) => useEntity<RaffleData>('raffle', appId, o)\nexport const usePoll = (appId?: string, o?: UseEntityOptions) => useEntity<PollData>('poll', appId, o)\nexport const useStakingPool = (appId?: string, o?: UseEntityOptions) => useEntity<StakingPoolData>('staking-pool', appId, o)\nexport const useReward = (id?: string, o?: UseEntityOptions) => useEntity<RewardData>('reward', id, o)\nexport const useSubscription = (id?: string, o?: UseEntityOptions) => useEntity<SubscriptionData>('subscription', id, o)\nexport const useTrade = (offerId?: string, o?: UseEntityOptions) => useEntity<TradeData>('trade', offerId, o)\nexport const useDualStake = (appId?: string, o?: UseEntityOptions) => useEntity<DualStakeData>('dual-stake', appId, o)\nexport const usePrivateContent = (id?: string, o?: UseEntityOptions) => useEntity<PrivateContentData>('private-content', id, o)\n/** A Guild proposal; `id` is `<guildAppId>/<proposalId>`. */\nexport const useGuildProposal = (id?: string, o?: UseEntityOptions) => useEntity<GuildProposalData>('guild-proposal', id, o)\nexport const usePrizeBox = (appId?: string, o?: UseEntityOptions) => useEntity<PrizeBoxData>('prize-box', appId, o)\n\n/**\n * Starts loading every reference in some content, e.g. for a page of feed\n * posts. The loads batch together, so a page costs a few calls, not one per ref.\n */\nexport function prefetchContent(queryClient: QueryClient, client: AlgomdClient, contents: string[]): Promise<void> {\n const refs = new Map<string, Ref>()\n for (const c of contents) for (const r of extractRefs(c, client.registry)) refs.set(`${r.kind}:${r.id}`, r)\n return Promise.all(\n [...refs.values()].map((r) => {\n const { queryKey, queryFn, staleTime } = entityQuery(client, r.kind, r.id, { params: r.params })\n return queryClient.prefetchQuery({ queryKey, queryFn, staleTime: staleTime({ state: { data: queryClient.getQueryData(queryKey) } }) })\n }),\n ).then(() => undefined)\n}\n\n/** For host persisters: whether a cached query should be written to disk. */\nexport function shouldPersistQuery(client: AlgomdClient, query: { queryKey: readonly unknown[]; state: { data?: unknown } }): boolean {\n const [root, network, kind] = query.queryKey\n if (root !== 'algomd' || network !== client.network || typeof kind !== 'string') return false\n const data = query.state.data as Entity | undefined\n return Boolean(data && data.status !== 'missing' && client.policy(kind, data).persist)\n}\n"],"mappings":";;;;;AAAA,SAAS,YAAY,UAAU,sBAA6D;AAC5F,SAAS,eAAe,eAAe,YAAY,gBAAgC;AAanF,IAAM,gBAAgB,cAAmC,IAAI;AAGtD,SAAS,iBAAiB,aAAwC;AACvE,SAAO;AAAA,IACL,KAAK,CAAC,QAAQ,YAAY,aAAqB,GAAG;AAAA,IAClD,KAAK,CAAC,KAAK,WAAW,KAAK,YAAY,aAAa,KAAK,MAAM;AAAA,EACjE;AACF;AAQO,SAAS,eAAe,EAAE,QAAQ,SAAS,GAAwB;AACxE,QAAM,cAAc,eAAe;AACnC,WAAS,MAAM;AACb,WAAO,SAAS,iBAAiB,WAAW,CAAC;AAC7C,WAAO;AAAA,EACT,CAAC;AACD,SAAO,cAAc,cAAc,UAAU,EAAE,OAAO,OAAO,GAAG,QAAQ;AAC1E;AAEO,SAAS,kBAAgC;AAC9C,QAAM,SAAS,WAAW,aAAa;AACvC,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACpE,SAAO;AACT;AASA,SAAS,YAAe,QAAsB,MA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AE,EAAE,IAAI,CAAC;AAC1G,SAAO,QAAQ;AAAA,IACb,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM;AAC5B,YAAM,EAAE,UAAU,SAAS,UAAU,IAAI,YAAY,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC;AAC/F,aAAO,YAAY,cAAc,EAAE,UAAU,SAAS,WAAW,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,aAAa,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC;AAAA,IACvI,CAAC;AAAA,EACH,EAAE,KAAK,MAAM,MAAS;AACxB;AAGO,SAAS,mBAAmB,QAAsB,OAA6E;AACpI,QAAM,CAAC,MAAM,SAAS,IAAI,IAAI,MAAM;AACpC,MAAI,SAAS,YAAY,YAAY,OAAO,WAAW,OAAO,SAAS,SAAU,QAAO;AACxF,QAAM,OAAO,MAAM,MAAM;AACzB,SAAO,QAAQ,QAAQ,KAAK,WAAW,aAAa,OAAO,OAAO,MAAM,IAAI,EAAE,OAAO;AACvF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akita-protocol/algomd-core",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "Data layer for AlgoMD on-chain references: grammar, batched and verified fetching, shared cache, archive reconstruction.",
5
5
  "license": "MIT",
6
6
  "type": "module",