@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.
@@ -69,6 +69,21 @@ var BUILT_IN_KINDS = [
69
69
  return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { owner: id.slice(0, i) } };
70
70
  }
71
71
  },
72
+ // A Guild proposal. Proposal ids count per Guild, so the cache id is `<guildAppId>/<proposalId>`.
73
+ {
74
+ kind: "guild-proposal",
75
+ tags: ["GuildProposal"],
76
+ idProps: ["proposalId", "id"],
77
+ params: ["appId"],
78
+ policy: "live",
79
+ sources: ["algod"],
80
+ normalizeId: (id) => /^(\d+\/)?\d+$/.test(id.trim()) ? id.trim() : void 0,
81
+ composeId: (id, params) => params.appId && !id.includes("/") ? `${params.appId}/${id}` : id,
82
+ decomposeId: (id) => {
83
+ const i = id.indexOf("/");
84
+ return i < 0 ? { id, params: {} } : { id: id.slice(i + 1), params: { appId: id.slice(0, i) } };
85
+ }
86
+ },
72
87
  // Title is the author's own label in their post, not chain data.
73
88
  hosted("private-content", "PrivateContent", ["id"], "slow", { params: ["title"] }),
74
89
  // A page inside the same post. The host supplies its preview and navigation.
@@ -224,4 +239,4 @@ export {
224
239
  hasRefs,
225
240
  serializeRef
226
241
  };
227
- //# sourceMappingURL=chunk-NRZTLFVI.js.map
242
+ //# sourceMappingURL=chunk-6KYOB5JM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/kinds.ts","../src/grammar.ts"],"sourcesContent":["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":";AAsBA,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,OAAgB,iBAAiB,KAAK,GAAG,KAAK,CAAC,IAAI,GAAG,KA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