@pokepc/dataset 6.6.0 → 6.7.0-beta.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.
Files changed (83) hide show
  1. package/build/{box-preset-sanitizer-GjGde3eW.mjs → box-preset-sanitizer-DHGv5TJj.mjs} +2 -2
  2. package/build/{box-preset-sanitizer-GjGde3eW.mjs.map → box-preset-sanitizer-DHGv5TJj.mjs.map} +1 -1
  3. package/build/box-preset-sanitizer-kg68JZPB.d.mts.map +1 -1
  4. package/build/{build-DeFbpXmN.mjs → build-DvGzwIK8.mjs} +74 -17
  5. package/build/build-DvGzwIK8.mjs.map +1 -0
  6. package/build/{build-GIV09lTc.mjs → build-bE_0_-0H.mjs} +4 -10
  7. package/build/{build-GIV09lTc.mjs.map → build-bE_0_-0H.mjs.map} +1 -1
  8. package/build/enums-CCbmORM6.d.mts.map +1 -1
  9. package/build/lib/box-preset-sanitizer.mjs +1 -1
  10. package/build/lib/box-preset-transform.d.mts +4 -6
  11. package/build/lib/box-preset-transform.d.mts.map +1 -1
  12. package/build/lib/box-preset-transform.mjs +2 -2
  13. package/build/lib/constants.d.mts +3 -4
  14. package/build/lib/constants.d.mts.map +1 -1
  15. package/build/lib/fs.d.mts +50 -51
  16. package/build/lib/fs.d.mts.map +1 -1
  17. package/build/lib/fs.mjs +3 -3
  18. package/build/lib/fs.mjs.map +1 -1
  19. package/build/lib/languages.d.mts +11 -12
  20. package/build/lib/languages.d.mts.map +1 -1
  21. package/build/lib/schemas.d.mts +1 -1
  22. package/build/lib/schemas.mjs +1 -1
  23. package/build/lib/search.d.mts +2 -3
  24. package/build/lib/search.d.mts.map +1 -1
  25. package/build/lib/search.mjs.map +1 -1
  26. package/build/lib/types.d.mts +34 -34
  27. package/build/lib/types.d.mts.map +1 -1
  28. package/build/lib/utils.d.mts +16 -17
  29. package/build/lib/utils.d.mts.map +1 -1
  30. package/build/lib/validators.d.mts +1 -1
  31. package/build/lib-next/_build.d.mts +1 -1
  32. package/build/lib-next/_build.mjs +2 -2
  33. package/build/lib-next/enums.d.mts +41 -42
  34. package/build/lib-next/enums.d.mts.map +1 -1
  35. package/build/lib-next/fs.d.mts +3 -4
  36. package/build/lib-next/fs.d.mts.map +1 -1
  37. package/build/lib-next/languages.d.mts +17 -18
  38. package/build/lib-next/languages.d.mts.map +1 -1
  39. package/build/lib-next/schemas.d.mts +230 -232
  40. package/build/lib-next/schemas.d.mts.map +1 -1
  41. package/build/lib-next/schemas.mjs +1 -1
  42. package/build/schemas-Bj1AIX0P.mjs +93 -0
  43. package/build/schemas-Bj1AIX0P.mjs.map +1 -0
  44. package/build/schemas-CcUqoHNr.mjs +349 -0
  45. package/build/schemas-CcUqoHNr.mjs.map +1 -0
  46. package/build/schemas-DZQWOWP4.d.mts +804 -0
  47. package/build/schemas-DZQWOWP4.d.mts.map +1 -0
  48. package/build/utils-BwovRocd.mjs.map +1 -1
  49. package/data/abilities.json +9 -0
  50. package/data/games/champions.json +5 -1
  51. package/data/indices/pokedexes.json +2 -1
  52. package/data/pokedexes/champions-regular-roster-m-b.json +3 -0
  53. package/data/pokedexes/champions-regular-roster-m-c.json +464 -0
  54. package/data/pokemon/absol-mega-z.json +1 -3
  55. package/data/pokemon/baxcalibur.json +1 -1
  56. package/data/pokemon/garchomp-mega-z.json +2 -2
  57. package/data/pokemon/golisopod.json +12 -1
  58. package/data/pokemon/lucario-mega-z.json +1 -3
  59. package/data/pokemon/pyroar-f.json +7 -2
  60. package/data/pokemon/pyroar.json +2 -1
  61. package/data/pokemon/rillaboom.json +1 -1
  62. package/data/pokemon/salamence.json +2 -1
  63. package/data-next/champions/abilities.json +8 -0
  64. package/data-next/champions/i18n/chs/abilities.json +7 -0
  65. package/data-next/champions/i18n/cht/abilities.json +7 -0
  66. package/data-next/champions/i18n/deu/abilities.json +7 -0
  67. package/data-next/champions/i18n/eng/abilities.json +7 -0
  68. package/data-next/champions/i18n/es-es/abilities.json +7 -0
  69. package/data-next/champions/i18n/es-la/abilities.json +7 -0
  70. package/data-next/champions/i18n/fra/abilities.json +7 -0
  71. package/data-next/champions/i18n/ita/abilities.json +7 -0
  72. package/data-next/champions/i18n/jpn/abilities.json +7 -0
  73. package/data-next/champions/i18n/kor/abilities.json +7 -0
  74. package/data-next/champions/i18n/pt-br/abilities.json +7 -0
  75. package/data-next/champions/moves.json +1 -0
  76. package/package.json +10 -10
  77. package/build/build-DeFbpXmN.mjs.map +0 -1
  78. package/build/schemas-B4fI9u0f.mjs +0 -93
  79. package/build/schemas-B4fI9u0f.mjs.map +0 -1
  80. package/build/schemas-CiojUbKN.d.mts +0 -805
  81. package/build/schemas-CiojUbKN.d.mts.map +0 -1
  82. package/build/schemas-Dt7FbAMy.mjs +0 -349
  83. package/build/schemas-Dt7FbAMy.mjs.map +0 -1
@@ -156,7 +156,7 @@ function parsePokeApiResourceId(resourceUrl, kind) {
156
156
  return Number(id);
157
157
  }
158
158
  function pokeApiResourceNameKeys(value) {
159
- return Array.from(new Set([value.toLowerCase(), value.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "")])).filter((key) => key.length > 0);
159
+ return Array.from(/* @__PURE__ */ new Set([value.toLowerCase(), value.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "")])).filter((key) => key.length > 0);
160
160
  }
161
161
  //#endregion
162
162
  //#region src/upstream-adapters/pokeapi/enrich-champions.ts
@@ -252,16 +252,10 @@ function pokeApiIdCandidates(kind, id) {
252
252
  function withPokeApiId(record, pokeApiId) {
253
253
  const { id, championsId, slug, ...rest } = record;
254
254
  delete rest.pokeApiId;
255
- if (pokeApiId === void 0) return {
256
- id,
257
- championsId,
258
- slug,
259
- ...rest
260
- };
261
255
  return {
262
256
  id,
263
257
  championsId,
264
- pokeApiId,
258
+ pokeApiId: pokeApiId ?? null,
265
259
  slug,
266
260
  ...rest
267
261
  };
@@ -290,7 +284,7 @@ function formatDomainSummary(domain, result) {
290
284
  return `${result.matched} ${domain} with PokeAPI IDs${missing}`;
291
285
  }
292
286
  function formatMissingPokeApiResourcesWarning(result) {
293
- const lines = ["Missing PokeAPI resources; they were written without a pokeApiId."];
287
+ const lines = ["Missing PokeAPI resources; they were written with a null pokeApiId."];
294
288
  for (const [domain, domainResult] of Object.entries(result)) {
295
289
  if (domainResult.missing.length === 0) continue;
296
290
  lines.push(`${domain}: ${domainResult.missing.length} missing`);
@@ -308,4 +302,4 @@ console.log(formatEnrichChampionsDataSummary(result));
308
302
  //#endregion
309
303
  export {};
310
304
 
311
- //# sourceMappingURL=build-GIV09lTc.mjs.map
305
+ //# sourceMappingURL=build-bE_0_-0H.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-GIV09lTc.mjs","names":[],"sources":["../src/upstream-adapters/projectpokemon-champout/fixtures/pokeapi.ts","../src/upstream-adapters/pokeapi/client.ts","../src/upstream-adapters/pokeapi/enrich-champions.ts","../src/upstream-adapters/pokeapi/build.ts"],"sourcesContent":["export const champoutPokeApiResourceNameAliases: Partial<\n Record<'ability' | 'item' | 'move', Record<string, readonly string[]>>\n> = {\n move: {\n visegrip: ['vicegrip', 'vice-grip'],\n },\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nexport const DEFAULT_POKEAPI_BASE_URL = 'https://pokeapi.co/api/v2'\nexport const DEFAULT_POKEAPI_CACHE_DIR = join(process.cwd(), '.local/pokeapi')\n\nexport const pokeApiResourceKinds = ['ability', 'item', 'move'] as const\nexport type PokeApiResourceKind = (typeof pokeApiResourceKinds)[number]\n\nexport type PokeApiResourceSummary = {\n name: string\n url: string\n}\n\nexport type PokeApiResourceIndexEntry = {\n id: number\n name: string\n}\n\nexport type PokeApiResourceIndex = {\n byId: Map<string, PokeApiResourceIndexEntry>\n byName: Map<string, PokeApiResourceIndexEntry>\n}\nexport type PokeApiResourceIndexes = Record<PokeApiResourceKind, PokeApiResourceIndex>\n\nexport type PokeApiFetchOptions = {\n baseUrl?: string\n cache?: boolean\n cacheDir?: string\n forceRefresh?: boolean\n retries?: number\n}\n\ntype PokeApiResourceListResponse = {\n count: number\n results: PokeApiResourceSummary[]\n}\n\nexport async function fetchPokeApiResourceIndexes(\n baseUrlOrOptions: string | PokeApiFetchOptions = DEFAULT_POKEAPI_BASE_URL,\n): Promise<PokeApiResourceIndexes> {\n const options = normalizePokeApiFetchOptions(baseUrlOrOptions)\n const [ability, item, move] = await Promise.all(\n pokeApiResourceKinds.map((kind) => fetchPokeApiResourceIndex(kind, options)),\n )\n\n return { ability, item, move }\n}\n\nasync function fetchPokeApiResourceIndex(\n kind: PokeApiResourceKind,\n options: PokeApiFetchOptions,\n): Promise<PokeApiResourceIndex> {\n const list = await fetchPokeApiResourceList(kind, options)\n const index: PokeApiResourceIndex = {\n byId: new Map(),\n byName: new Map(),\n }\n\n for (const resource of list.results) {\n const id = parsePokeApiResourceId(resource.url, kind)\n const entry = { id, name: resource.name }\n const idKey = String(id)\n const existingIdEntry = index.byId.get(idKey)\n\n if (existingIdEntry !== undefined && existingIdEntry.name !== resource.name) {\n throw new Error(\n `Duplicate PokeAPI ${kind} resource id ${idKey}: ${existingIdEntry.name}, ${resource.name}`,\n )\n }\n\n index.byId.set(idKey, entry)\n\n for (const nameKey of pokeApiResourceNameKeys(resource.name)) {\n const existingEntry = index.byName.get(nameKey)\n\n if (existingEntry === undefined || existingEntry.id === id) {\n index.byName.set(nameKey, entry)\n continue\n }\n\n if (existingEntry.name !== resource.name) {\n throw new Error(\n `Duplicate PokeAPI ${kind} resource lookup key ${nameKey}: ${existingEntry.name}, ${resource.name}`,\n )\n }\n\n // Upstream sometimes lists the same resource name under two ids; keep the lowest so\n // lookups stay stable when a newer duplicate row appears.\n const keptEntry = existingEntry.id < id ? existingEntry : entry\n\n console.warn(\n `Duplicate PokeAPI ${kind} resource name ${resource.name} (ids ${existingEntry.id}, ${id}); keeping id ${keptEntry.id} for lookup key ${nameKey}`,\n )\n index.byName.set(nameKey, keptEntry)\n }\n }\n\n return index\n}\n\nasync function fetchPokeApiResourceList(\n kind: PokeApiResourceKind,\n options: PokeApiFetchOptions,\n): Promise<PokeApiResourceListResponse> {\n const baseUrl = options.baseUrl ?? DEFAULT_POKEAPI_BASE_URL\n const url = new URL(`${baseUrl.replace(/\\/+$/, '')}/${kind}/`)\n url.searchParams.set('limit', '100000')\n url.searchParams.set('offset', '0')\n\n const json = await fetchPokeApiJson(url, options)\n\n if (!isPokeApiResourceListResponse(json)) {\n throw new Error(`Unexpected PokeAPI ${kind} list response shape`)\n }\n\n if (json.results.length < json.count) {\n throw new Error(\n `Expected all PokeAPI ${kind} resources in one list response, got ${json.results.length} of ${json.count}`,\n )\n }\n\n return json\n}\n\nexport async function fetchPokeApiJson(\n pathnameOrUrl: string | URL,\n options: PokeApiFetchOptions = {},\n): Promise<unknown> {\n const resolvedOptions = normalizePokeApiFetchOptions(options)\n const url = resolvePokeApiUrl(pathnameOrUrl, resolvedOptions.baseUrl)\n const cacheEnabled = resolvedOptions.cache ?? process.env.POKEAPI_CACHE !== '0'\n const cachePath = pokeApiCachePath(url, resolvedOptions.cacheDir)\n\n if (cacheEnabled && !resolvedOptions.forceRefresh) {\n const cachedJson = readCachedPokeApiJson(cachePath)\n\n if (cachedJson !== undefined) {\n return cachedJson\n }\n }\n\n const json = await fetchPokeApiJsonFromNetwork(url, resolvedOptions.retries)\n\n if (cacheEnabled) {\n writeCachedPokeApiJson(cachePath, json)\n }\n\n return json\n}\n\nfunction normalizePokeApiFetchOptions(\n options: string | PokeApiFetchOptions,\n): Required<PokeApiFetchOptions> {\n const input = typeof options === 'string' ? { baseUrl: options } : options\n\n return {\n baseUrl: input.baseUrl ?? DEFAULT_POKEAPI_BASE_URL,\n cache: input.cache ?? process.env.POKEAPI_CACHE !== '0',\n cacheDir: input.cacheDir ?? process.env.POKEAPI_CACHE_DIR ?? DEFAULT_POKEAPI_CACHE_DIR,\n forceRefresh: input.forceRefresh ?? process.env.POKEAPI_REFRESH_CACHE === '1',\n retries: input.retries ?? 3,\n }\n}\n\nfunction resolvePokeApiUrl(pathnameOrUrl: string | URL, baseUrl: string): URL {\n if (pathnameOrUrl instanceof URL) {\n return pathnameOrUrl\n }\n\n if (/^https?:\\/\\//i.test(pathnameOrUrl)) {\n return new URL(pathnameOrUrl)\n }\n\n const base = baseUrl.replace(/\\/+$/, '')\n const pathname = pathnameOrUrl.replace(/^\\/+/, '').replace(/\\/?$/, '/')\n return new URL(`${base}/${pathname}`)\n}\n\nasync function fetchPokeApiJsonFromNetwork(url: URL, retries: number): Promise<unknown> {\n let lastError: unknown\n\n for (let attempt = 1; attempt <= retries; attempt += 1) {\n try {\n const response = await fetch(url, {\n headers: {\n accept: 'application/json',\n },\n })\n\n if (response.ok) {\n return await response.json()\n }\n\n const body = await response.text()\n lastError = new Error(\n `${response.status} ${response.statusText}${body.length > 0 ? `: ${body.slice(0, 240)}` : ''}`,\n )\n\n if (response.status !== 429 && response.status < 500) {\n break\n }\n } catch (error) {\n lastError = error\n }\n\n await sleep(backoffMs(attempt))\n }\n\n throw lastError instanceof Error ? lastError : new Error(String(lastError))\n}\n\nfunction readCachedPokeApiJson(cachePath: string): unknown | undefined {\n if (!existsSync(cachePath)) {\n return undefined\n }\n\n try {\n return JSON.parse(readFileSync(cachePath, 'utf8'))\n } catch {\n return undefined\n }\n}\n\nfunction writeCachedPokeApiJson(cachePath: string, json: unknown): void {\n mkdirSync(dirname(cachePath), { recursive: true })\n writeFileSync(cachePath, `${JSON.stringify(json)}\\n`)\n}\n\nfunction pokeApiCachePath(url: URL, cacheDir: string): string {\n const segments = [\n sanitizeCachePathSegment(url.hostname),\n ...url.pathname.split('/').filter(Boolean).map(sanitizeCachePathSegment),\n ]\n const searchSuffix = url.search.length > 0 ? `-${stableSearchSuffix(url.searchParams)}` : ''\n const filename = `${segments.pop() ?? 'index'}${searchSuffix}.json`\n\n return join(cacheDir, ...segments, filename)\n}\n\nfunction stableSearchSuffix(searchParams: URLSearchParams): string {\n return Array.from(searchParams.entries())\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n `${leftKey}=${leftValue}`.localeCompare(`${rightKey}=${rightValue}`),\n )\n .map(([key, value]) => `${sanitizeCachePathSegment(key)}-${sanitizeCachePathSegment(value)}`)\n .join('-')\n}\n\nfunction sanitizeCachePathSegment(value: string): string {\n const sanitized = value.replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+|-+$/g, '')\n return sanitized.length > 0 ? sanitized : '_'\n}\n\nfunction backoffMs(attempt: number): number {\n return Math.min(15_000, 750 * 2 ** Math.max(0, attempt - 1))\n}\n\nasync function sleep(ms: number): Promise<void> {\n if (ms <= 0) {\n return\n }\n\n await new Promise((resolveSleep) => setTimeout(resolveSleep, ms))\n}\n\nfunction isPokeApiResourceListResponse(value: unknown): value is PokeApiResourceListResponse {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const response = value as Record<string, unknown>\n\n return (\n typeof response.count === 'number' &&\n Array.isArray(response.results) &&\n response.results.every(isPokeApiResourceSummary)\n )\n}\n\nfunction isPokeApiResourceSummary(value: unknown): value is PokeApiResourceSummary {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const resource = value as Record<string, unknown>\n\n return typeof resource.name === 'string' && typeof resource.url === 'string'\n}\n\nfunction parsePokeApiResourceId(resourceUrl: string, kind: PokeApiResourceKind): number {\n const url = new URL(resourceUrl)\n const segments = url.pathname.split('/').filter(Boolean)\n const kindIndex = segments.lastIndexOf(kind)\n const id = kindIndex === -1 ? undefined : segments[kindIndex + 1]\n\n if (id === undefined || !/^\\d+$/.test(id)) {\n throw new Error(`Could not parse PokeAPI ${kind} id from URL: ${resourceUrl}`)\n }\n\n return Number(id)\n}\n\nexport function pokeApiResourceNameKeys(value: string): string[] {\n return Array.from(\n new Set([\n value.toLowerCase(),\n value\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-z0-9]+/g, ''),\n ]),\n ).filter((key) => key.length > 0)\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { champoutPokeApiResourceNameAliases } from '../projectpokemon-champout/fixtures/pokeapi'\nimport {\n DEFAULT_POKEAPI_BASE_URL,\n fetchPokeApiResourceIndexes,\n pokeApiResourceNameKeys,\n type PokeApiResourceIndex,\n type PokeApiResourceIndexEntry,\n type PokeApiResourceKind,\n} from './client'\n\nexport const DEFAULT_CHAMPIONS_DATA_ROOT = join(process.cwd(), 'data-next/champions')\n\nexport type EnrichChampionsDataOptions = {\n championsDataRoot?: string\n pokeApiBaseUrl?: string\n}\n\nexport type EnrichedChampionsDomainResult = {\n filePath: string\n matched: number\n missing: MissingPokeApiResource[]\n}\n\nexport type EnrichChampionsDataResult = Record<\n 'abilities' | 'items' | 'moves',\n EnrichedChampionsDomainResult\n>\n\nexport type MissingPokeApiResource = {\n id: string\n championsId: string\n slug: string\n name: string\n triedIdCandidates: string[]\n championsIdMatchedResource?: PokeApiResourceIndexEntry\n}\n\ntype ChampionsDomain = {\n key: keyof EnrichChampionsDataResult\n kind: PokeApiResourceKind\n fileName: string\n}\n\ntype JsonRecord = Record<string, unknown>\n\ntype PreparedChampionsDomain = EnrichedChampionsDomainResult & {\n records: JsonRecord[]\n}\n\nconst championsDomains = [\n { key: 'abilities', kind: 'ability', fileName: 'abilities.json' },\n { key: 'items', kind: 'item', fileName: 'items.json' },\n { key: 'moves', kind: 'move', fileName: 'moves.json' },\n] as const satisfies readonly ChampionsDomain[]\n\nexport async function enrichChampionsDataWithPokeApiIds(\n options: EnrichChampionsDataOptions = {},\n): Promise<EnrichChampionsDataResult> {\n const championsDataRoot = options.championsDataRoot ?? DEFAULT_CHAMPIONS_DATA_ROOT\n const pokeApiBaseUrl = options.pokeApiBaseUrl ?? DEFAULT_POKEAPI_BASE_URL\n const resourceIndexes = await fetchPokeApiResourceIndexes(pokeApiBaseUrl)\n const preparedDomains = championsDomains.map((domain) =>\n prepareChampionsDomainWithPokeApiIds(\n domain.kind,\n join(championsDataRoot, domain.fileName),\n resourceIndexes[domain.kind],\n ),\n )\n const result = Object.fromEntries(\n championsDomains.map((domain, index) => {\n const preparedDomain = preparedDomains[index]\n\n return [\n domain.key,\n {\n filePath: preparedDomain.filePath,\n matched: preparedDomain.matched,\n missing: preparedDomain.missing,\n },\n ]\n }),\n ) as EnrichChampionsDataResult\n\n const missingCount = Object.values(result).reduce(\n (count, domainResult) => count + domainResult.missing.length,\n 0,\n )\n\n if (missingCount > 0) {\n console.warn(formatMissingPokeApiResourcesWarning(result))\n }\n\n for (const preparedDomain of preparedDomains) {\n writeJsonFile(preparedDomain.filePath, preparedDomain.records)\n }\n\n return result\n}\n\nexport function formatEnrichChampionsDataSummary(result: EnrichChampionsDataResult): string {\n return [\n formatDomainSummary('abilities', result.abilities),\n formatDomainSummary('items', result.items),\n formatDomainSummary('moves', result.moves),\n ].join(', ')\n}\n\nfunction prepareChampionsDomainWithPokeApiIds(\n kind: PokeApiResourceKind,\n filePath: string,\n resourceIndex: PokeApiResourceIndex,\n): PreparedChampionsDomain {\n const records = readJsonRecordArray(filePath)\n const missing: MissingPokeApiResource[] = []\n let matched = 0\n\n const enrichedRecords = records.map((record, index) => {\n const id = requiredString(record, 'id', filePath, index)\n const championsId = requiredString(record, 'championsId', filePath, index)\n const slug = requiredString(record, 'slug', filePath, index)\n const name = requiredString(record, 'name', filePath, index)\n const triedIdCandidates = pokeApiIdCandidates(kind, id)\n const championsIdMatchedResource = resourceIndex.byId.get(championsId)\n const pokeApiId = findPokeApiId(resourceIndex, championsId, triedIdCandidates)\n\n if (pokeApiId === undefined) {\n missing.push({\n id,\n championsId,\n slug,\n name,\n triedIdCandidates,\n championsIdMatchedResource,\n })\n } else {\n matched += 1\n }\n\n return withPokeApiId(record, pokeApiId)\n })\n\n return { filePath, matched, missing, records: enrichedRecords }\n}\n\nfunction findPokeApiId(\n resourceIndex: PokeApiResourceIndex,\n championsId: string,\n idCandidates: string[],\n): number | undefined {\n for (const candidate of idCandidates) {\n const resource = findPokeApiResourceByName(resourceIndex, candidate)\n\n if (resource !== undefined) {\n return resource.id\n }\n }\n\n const resourceByChampionsId = resourceIndex.byId.get(championsId)\n\n if (resourceByChampionsId === undefined) {\n return undefined\n }\n\n return resourceByChampionsId.id\n}\n\nfunction findPokeApiResourceByName(\n resourceIndex: PokeApiResourceIndex,\n candidate: string,\n): PokeApiResourceIndexEntry | undefined {\n for (const key of pokeApiResourceNameKeys(candidate)) {\n const resource = resourceIndex.byName.get(key)\n\n if (resource !== undefined) {\n return resource\n }\n }\n\n return undefined\n}\n\nfunction pokeApiIdCandidates(kind: PokeApiResourceKind, id: string): string[] {\n return uniqueStrings([id, ...(champoutPokeApiResourceNameAliases[kind]?.[id] ?? [])])\n}\n\nfunction withPokeApiId(record: JsonRecord, pokeApiId: number | undefined): JsonRecord {\n const { id, championsId, slug, ...rest } = record\n delete rest.pokeApiId\n\n if (pokeApiId === undefined) {\n return { id, championsId, slug, ...rest }\n }\n\n return { id, championsId, pokeApiId, slug, ...rest }\n}\n\nfunction readJsonRecordArray(filePath: string): JsonRecord[] {\n const json: unknown = JSON.parse(readFileSync(filePath, 'utf8'))\n\n if (!Array.isArray(json)) {\n throw new Error(`Expected ${filePath} to contain an array`)\n }\n\n return json.map((record, index) => {\n if (typeof record !== 'object' || record === null || Array.isArray(record)) {\n throw new Error(`Expected ${filePath}[${index}] to contain an object`)\n }\n\n return record as JsonRecord\n })\n}\n\nfunction writeJsonFile(filePath: string, data: unknown): void {\n writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\\n`)\n}\n\nfunction requiredString(record: JsonRecord, key: string, filePath: string, index: number): string {\n const value = record[key]\n\n if (typeof value !== 'string' || value.length === 0) {\n throw new Error(`Expected ${filePath}[${index}].${key} to be a non-empty string`)\n }\n\n return value\n}\n\nfunction uniqueStrings(values: readonly unknown[]): string[] {\n return Array.from(new Set(values.filter((value): value is string => typeof value === 'string')))\n}\n\nfunction formatDomainSummary(\n domain: keyof EnrichChampionsDataResult,\n result: EnrichedChampionsDomainResult,\n): string {\n const missing = result.missing.length === 0 ? '' : `, ${result.missing.length} unmatched`\n\n return `${result.matched} ${domain} with PokeAPI IDs${missing}`\n}\n\nfunction formatMissingPokeApiResourcesWarning(result: EnrichChampionsDataResult): string {\n const lines = ['Missing PokeAPI resources; they were written without a pokeApiId.']\n\n for (const [domain, domainResult] of Object.entries(result)) {\n if (domainResult.missing.length === 0) {\n continue\n }\n\n lines.push(`${domain}: ${domainResult.missing.length} missing`)\n\n for (const missing of domainResult.missing) {\n const championsIdMatch =\n missing.championsIdMatchedResource === undefined\n ? 'no PokeAPI resource with that numeric id'\n : `numeric id belongs to ${missing.championsIdMatchedResource.name}`\n\n lines.push(\n `- ${missing.id} (${missing.name}; championsId ${missing.championsId}; tried id candidates ${missing.triedIdCandidates.join(', ')}; ${championsIdMatch})`,\n )\n }\n }\n\n return lines.join('\\n')\n}\n","import {\n enrichChampionsDataWithPokeApiIds,\n formatEnrichChampionsDataSummary,\n} from './enrich-champions'\n\nconst result = await enrichChampionsDataWithPokeApiIds()\n\nconsole.log(formatEnrichChampionsDataSummary(result))\n"],"mappings":";;;AAAA,MAAa,qCAET,EACF,MAAM,EACJ,UAAU,CAAC,YAAY,WAAW,EACpC,EACF;;;ACHA,MAAa,2BAA2B;AACxC,MAAa,4BAA4B,KAAK,QAAQ,IAAI,GAAG,gBAAgB;AAE7E,MAAa,uBAAuB;CAAC;CAAW;CAAQ;AAAM;AAgC9D,eAAsB,4BACpB,mBAAiD,0BAChB;CACjC,MAAM,UAAU,6BAA6B,gBAAgB;CAC7D,MAAM,CAAC,SAAS,MAAM,QAAQ,MAAM,QAAQ,IAC1C,qBAAqB,KAAK,SAAS,0BAA0B,MAAM,OAAO,CAAC,CAC7E;CAEA,OAAO;EAAE;EAAS;EAAM;CAAK;AAC/B;AAEA,eAAe,0BACb,MACA,SAC+B;CAC/B,MAAM,OAAO,MAAM,yBAAyB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AAM,IAAI,IAAI,0BAA0B;CAGlF,OAAO;AACT;AAEA,SAAS,cAAc,QAAsC;CAC3D,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,QAAQ,UAA2B,OAAO,UAAU,QAAQ,CAAC,CAAC;AACjG;AAEA,SAAS,oBACP,QACA,QACQ;CACR,MAAM,UAAU,OAAO,QAAQ,WAAW,IAAI,KAAK,KAAK,OAAO,QAAQ,OAAO;CAE9E,OAAO,GAAG,OAAO,QAAQ,GAAG,OAAO,mBAAmB;AACxD;AAEA,SAAS,qCAAqC,QAA2C;CACvF,MAAM,QAAQ,CAAC,mEAAmE;CAElF,KAAK,MAAM,CAAC,QAAQ,iBAAiB,OAAO,QAAQ,MAAM,GAAG;EAC3D,IAAI,aAAa,QAAQ,WAAW,GAClC;EAGF,MAAM,KAAK,GAAG,OAAO,IAAI,aAAa,QAAQ,OAAO,SAAS;EAE9D,KAAK,MAAM,WAAW,aAAa,SAAS;GAC1C,MAAM,mBACJ,QAAQ,+BAA+B,KAAA,IACnC,6CACA,yBAAyB,QAAQ,2BAA2B;GAElE,MAAM,KACJ,KAAK,QAAQ,GAAG,IAAI,QAAQ,KAAK,gBAAgB,QAAQ,YAAY,wBAAwB,QAAQ,kBAAkB,KAAK,IAAI,EAAE,IAAI,iBAAiB,EACzJ;EACF;CACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB;;;ACnQA,MAAM,SAAS,MAAM,kCAAkC;AAEvD,QAAQ,IAAI,iCAAiC,MAAM,CAAC"}
1
+ {"version":3,"file":"build-bE_0_-0H.mjs","names":[],"sources":["../src/upstream-adapters/projectpokemon-champout/fixtures/pokeapi.ts","../src/upstream-adapters/pokeapi/client.ts","../src/upstream-adapters/pokeapi/enrich-champions.ts","../src/upstream-adapters/pokeapi/build.ts"],"sourcesContent":["export const champoutPokeApiResourceNameAliases: Partial<\n Record<'ability' | 'item' | 'move', Record<string, readonly string[]>>\n> = {\n move: {\n visegrip: ['vicegrip', 'vice-grip'],\n },\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nexport const DEFAULT_POKEAPI_BASE_URL = 'https://pokeapi.co/api/v2'\nexport const DEFAULT_POKEAPI_CACHE_DIR = join(process.cwd(), '.local/pokeapi')\n\nexport const pokeApiResourceKinds = ['ability', 'item', 'move'] as const\nexport type PokeApiResourceKind = (typeof pokeApiResourceKinds)[number]\n\nexport type PokeApiResourceSummary = {\n name: string\n url: string\n}\n\nexport type PokeApiResourceIndexEntry = {\n id: number\n name: string\n}\n\nexport type PokeApiResourceIndex = {\n byId: Map<string, PokeApiResourceIndexEntry>\n byName: Map<string, PokeApiResourceIndexEntry>\n}\nexport type PokeApiResourceIndexes = Record<PokeApiResourceKind, PokeApiResourceIndex>\n\nexport type PokeApiFetchOptions = {\n baseUrl?: string\n cache?: boolean\n cacheDir?: string\n forceRefresh?: boolean\n retries?: number\n}\n\ntype PokeApiResourceListResponse = {\n count: number\n results: PokeApiResourceSummary[]\n}\n\nexport async function fetchPokeApiResourceIndexes(\n baseUrlOrOptions: string | PokeApiFetchOptions = DEFAULT_POKEAPI_BASE_URL,\n): Promise<PokeApiResourceIndexes> {\n const options = normalizePokeApiFetchOptions(baseUrlOrOptions)\n const [ability, item, move] = await Promise.all(\n pokeApiResourceKinds.map((kind) => fetchPokeApiResourceIndex(kind, options)),\n )\n\n return { ability, item, move }\n}\n\nasync function fetchPokeApiResourceIndex(\n kind: PokeApiResourceKind,\n options: PokeApiFetchOptions,\n): Promise<PokeApiResourceIndex> {\n const list = await fetchPokeApiResourceList(kind, options)\n const index: PokeApiResourceIndex = {\n byId: new Map(),\n byName: new Map(),\n }\n\n for (const resource of list.results) {\n const id = parsePokeApiResourceId(resource.url, kind)\n const entry = { id, name: resource.name }\n const idKey = String(id)\n const existingIdEntry = index.byId.get(idKey)\n\n if (existingIdEntry !== undefined && existingIdEntry.name !== resource.name) {\n throw new Error(\n `Duplicate PokeAPI ${kind} resource id ${idKey}: ${existingIdEntry.name}, ${resource.name}`,\n )\n }\n\n index.byId.set(idKey, entry)\n\n for (const nameKey of pokeApiResourceNameKeys(resource.name)) {\n const existingEntry = index.byName.get(nameKey)\n\n if (existingEntry === undefined || existingEntry.id === id) {\n index.byName.set(nameKey, entry)\n continue\n }\n\n if (existingEntry.name !== resource.name) {\n throw new Error(\n `Duplicate PokeAPI ${kind} resource lookup key ${nameKey}: ${existingEntry.name}, ${resource.name}`,\n )\n }\n\n // Upstream sometimes lists the same resource name under two ids; keep the lowest so\n // lookups stay stable when a newer duplicate row appears.\n const keptEntry = existingEntry.id < id ? existingEntry : entry\n\n console.warn(\n `Duplicate PokeAPI ${kind} resource name ${resource.name} (ids ${existingEntry.id}, ${id}); keeping id ${keptEntry.id} for lookup key ${nameKey}`,\n )\n index.byName.set(nameKey, keptEntry)\n }\n }\n\n return index\n}\n\nasync function fetchPokeApiResourceList(\n kind: PokeApiResourceKind,\n options: PokeApiFetchOptions,\n): Promise<PokeApiResourceListResponse> {\n const baseUrl = options.baseUrl ?? DEFAULT_POKEAPI_BASE_URL\n const url = new URL(`${baseUrl.replace(/\\/+$/, '')}/${kind}/`)\n url.searchParams.set('limit', '100000')\n url.searchParams.set('offset', '0')\n\n const json = await fetchPokeApiJson(url, options)\n\n if (!isPokeApiResourceListResponse(json)) {\n throw new Error(`Unexpected PokeAPI ${kind} list response shape`)\n }\n\n if (json.results.length < json.count) {\n throw new Error(\n `Expected all PokeAPI ${kind} resources in one list response, got ${json.results.length} of ${json.count}`,\n )\n }\n\n return json\n}\n\nexport async function fetchPokeApiJson(\n pathnameOrUrl: string | URL,\n options: PokeApiFetchOptions = {},\n): Promise<unknown> {\n const resolvedOptions = normalizePokeApiFetchOptions(options)\n const url = resolvePokeApiUrl(pathnameOrUrl, resolvedOptions.baseUrl)\n const cacheEnabled = resolvedOptions.cache ?? process.env.POKEAPI_CACHE !== '0'\n const cachePath = pokeApiCachePath(url, resolvedOptions.cacheDir)\n\n if (cacheEnabled && !resolvedOptions.forceRefresh) {\n const cachedJson = readCachedPokeApiJson(cachePath)\n\n if (cachedJson !== undefined) {\n return cachedJson\n }\n }\n\n const json = await fetchPokeApiJsonFromNetwork(url, resolvedOptions.retries)\n\n if (cacheEnabled) {\n writeCachedPokeApiJson(cachePath, json)\n }\n\n return json\n}\n\nfunction normalizePokeApiFetchOptions(\n options: string | PokeApiFetchOptions,\n): Required<PokeApiFetchOptions> {\n const input = typeof options === 'string' ? { baseUrl: options } : options\n\n return {\n baseUrl: input.baseUrl ?? DEFAULT_POKEAPI_BASE_URL,\n cache: input.cache ?? process.env.POKEAPI_CACHE !== '0',\n cacheDir: input.cacheDir ?? process.env.POKEAPI_CACHE_DIR ?? DEFAULT_POKEAPI_CACHE_DIR,\n forceRefresh: input.forceRefresh ?? process.env.POKEAPI_REFRESH_CACHE === '1',\n retries: input.retries ?? 3,\n }\n}\n\nfunction resolvePokeApiUrl(pathnameOrUrl: string | URL, baseUrl: string): URL {\n if (pathnameOrUrl instanceof URL) {\n return pathnameOrUrl\n }\n\n if (/^https?:\\/\\//i.test(pathnameOrUrl)) {\n return new URL(pathnameOrUrl)\n }\n\n const base = baseUrl.replace(/\\/+$/, '')\n const pathname = pathnameOrUrl.replace(/^\\/+/, '').replace(/\\/?$/, '/')\n return new URL(`${base}/${pathname}`)\n}\n\nasync function fetchPokeApiJsonFromNetwork(url: URL, retries: number): Promise<unknown> {\n let lastError: unknown\n\n for (let attempt = 1; attempt <= retries; attempt += 1) {\n try {\n const response = await fetch(url, {\n headers: {\n accept: 'application/json',\n },\n })\n\n if (response.ok) {\n return await response.json()\n }\n\n const body = await response.text()\n lastError = new Error(\n `${response.status} ${response.statusText}${body.length > 0 ? `: ${body.slice(0, 240)}` : ''}`,\n )\n\n if (response.status !== 429 && response.status < 500) {\n break\n }\n } catch (error) {\n lastError = error\n }\n\n await sleep(backoffMs(attempt))\n }\n\n throw lastError instanceof Error ? lastError : new Error(String(lastError))\n}\n\nfunction readCachedPokeApiJson(cachePath: string): unknown | undefined {\n if (!existsSync(cachePath)) {\n return undefined\n }\n\n try {\n return JSON.parse(readFileSync(cachePath, 'utf8'))\n } catch {\n return undefined\n }\n}\n\nfunction writeCachedPokeApiJson(cachePath: string, json: unknown): void {\n mkdirSync(dirname(cachePath), { recursive: true })\n writeFileSync(cachePath, `${JSON.stringify(json)}\\n`)\n}\n\nfunction pokeApiCachePath(url: URL, cacheDir: string): string {\n const segments = [\n sanitizeCachePathSegment(url.hostname),\n ...url.pathname.split('/').filter(Boolean).map(sanitizeCachePathSegment),\n ]\n const searchSuffix = url.search.length > 0 ? `-${stableSearchSuffix(url.searchParams)}` : ''\n const filename = `${segments.pop() ?? 'index'}${searchSuffix}.json`\n\n return join(cacheDir, ...segments, filename)\n}\n\nfunction stableSearchSuffix(searchParams: URLSearchParams): string {\n return Array.from(searchParams.entries())\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n `${leftKey}=${leftValue}`.localeCompare(`${rightKey}=${rightValue}`),\n )\n .map(([key, value]) => `${sanitizeCachePathSegment(key)}-${sanitizeCachePathSegment(value)}`)\n .join('-')\n}\n\nfunction sanitizeCachePathSegment(value: string): string {\n const sanitized = value.replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+|-+$/g, '')\n return sanitized.length > 0 ? sanitized : '_'\n}\n\nfunction backoffMs(attempt: number): number {\n return Math.min(15_000, 750 * 2 ** Math.max(0, attempt - 1))\n}\n\nasync function sleep(ms: number): Promise<void> {\n if (ms <= 0) {\n return\n }\n\n await new Promise((resolveSleep) => setTimeout(resolveSleep, ms))\n}\n\nfunction isPokeApiResourceListResponse(value: unknown): value is PokeApiResourceListResponse {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const response = value as Record<string, unknown>\n\n return (\n typeof response.count === 'number' &&\n Array.isArray(response.results) &&\n response.results.every(isPokeApiResourceSummary)\n )\n}\n\nfunction isPokeApiResourceSummary(value: unknown): value is PokeApiResourceSummary {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const resource = value as Record<string, unknown>\n\n return typeof resource.name === 'string' && typeof resource.url === 'string'\n}\n\nfunction parsePokeApiResourceId(resourceUrl: string, kind: PokeApiResourceKind): number {\n const url = new URL(resourceUrl)\n const segments = url.pathname.split('/').filter(Boolean)\n const kindIndex = segments.lastIndexOf(kind)\n const id = kindIndex === -1 ? undefined : segments[kindIndex + 1]\n\n if (id === undefined || !/^\\d+$/.test(id)) {\n throw new Error(`Could not parse PokeAPI ${kind} id from URL: ${resourceUrl}`)\n }\n\n return Number(id)\n}\n\nexport function pokeApiResourceNameKeys(value: string): string[] {\n return Array.from(\n new Set([\n value.toLowerCase(),\n value\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-z0-9]+/g, ''),\n ]),\n ).filter((key) => key.length > 0)\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { champoutPokeApiResourceNameAliases } from '../projectpokemon-champout/fixtures/pokeapi'\nimport {\n DEFAULT_POKEAPI_BASE_URL,\n fetchPokeApiResourceIndexes,\n pokeApiResourceNameKeys,\n type PokeApiResourceIndex,\n type PokeApiResourceIndexEntry,\n type PokeApiResourceKind,\n} from './client'\n\nexport const DEFAULT_CHAMPIONS_DATA_ROOT = join(process.cwd(), 'data-next/champions')\n\nexport type EnrichChampionsDataOptions = {\n championsDataRoot?: string\n pokeApiBaseUrl?: string\n}\n\nexport type EnrichedChampionsDomainResult = {\n filePath: string\n matched: number\n missing: MissingPokeApiResource[]\n}\n\nexport type EnrichChampionsDataResult = Record<\n 'abilities' | 'items' | 'moves',\n EnrichedChampionsDomainResult\n>\n\nexport type MissingPokeApiResource = {\n id: string\n championsId: string\n slug: string\n name: string\n triedIdCandidates: string[]\n championsIdMatchedResource?: PokeApiResourceIndexEntry\n}\n\ntype ChampionsDomain = {\n key: keyof EnrichChampionsDataResult\n kind: PokeApiResourceKind\n fileName: string\n}\n\ntype JsonRecord = Record<string, unknown>\n\ntype PreparedChampionsDomain = EnrichedChampionsDomainResult & {\n records: JsonRecord[]\n}\n\nconst championsDomains = [\n { key: 'abilities', kind: 'ability', fileName: 'abilities.json' },\n { key: 'items', kind: 'item', fileName: 'items.json' },\n { key: 'moves', kind: 'move', fileName: 'moves.json' },\n] as const satisfies readonly ChampionsDomain[]\n\nexport async function enrichChampionsDataWithPokeApiIds(\n options: EnrichChampionsDataOptions = {},\n): Promise<EnrichChampionsDataResult> {\n const championsDataRoot = options.championsDataRoot ?? DEFAULT_CHAMPIONS_DATA_ROOT\n const pokeApiBaseUrl = options.pokeApiBaseUrl ?? DEFAULT_POKEAPI_BASE_URL\n const resourceIndexes = await fetchPokeApiResourceIndexes(pokeApiBaseUrl)\n const preparedDomains = championsDomains.map((domain) =>\n prepareChampionsDomainWithPokeApiIds(\n domain.kind,\n join(championsDataRoot, domain.fileName),\n resourceIndexes[domain.kind],\n ),\n )\n const result = Object.fromEntries(\n championsDomains.map((domain, index) => {\n const preparedDomain = preparedDomains[index]\n\n return [\n domain.key,\n {\n filePath: preparedDomain.filePath,\n matched: preparedDomain.matched,\n missing: preparedDomain.missing,\n },\n ]\n }),\n ) as EnrichChampionsDataResult\n\n const missingCount = Object.values(result).reduce(\n (count, domainResult) => count + domainResult.missing.length,\n 0,\n )\n\n if (missingCount > 0) {\n console.warn(formatMissingPokeApiResourcesWarning(result))\n }\n\n for (const preparedDomain of preparedDomains) {\n writeJsonFile(preparedDomain.filePath, preparedDomain.records)\n }\n\n return result\n}\n\nexport function formatEnrichChampionsDataSummary(result: EnrichChampionsDataResult): string {\n return [\n formatDomainSummary('abilities', result.abilities),\n formatDomainSummary('items', result.items),\n formatDomainSummary('moves', result.moves),\n ].join(', ')\n}\n\nfunction prepareChampionsDomainWithPokeApiIds(\n kind: PokeApiResourceKind,\n filePath: string,\n resourceIndex: PokeApiResourceIndex,\n): PreparedChampionsDomain {\n const records = readJsonRecordArray(filePath)\n const missing: MissingPokeApiResource[] = []\n let matched = 0\n\n const enrichedRecords = records.map((record, index) => {\n const id = requiredString(record, 'id', filePath, index)\n const championsId = requiredString(record, 'championsId', filePath, index)\n const slug = requiredString(record, 'slug', filePath, index)\n const name = requiredString(record, 'name', filePath, index)\n const triedIdCandidates = pokeApiIdCandidates(kind, id)\n const championsIdMatchedResource = resourceIndex.byId.get(championsId)\n const pokeApiId = findPokeApiId(resourceIndex, championsId, triedIdCandidates)\n\n if (pokeApiId === undefined) {\n missing.push({\n id,\n championsId,\n slug,\n name,\n triedIdCandidates,\n championsIdMatchedResource,\n })\n } else {\n matched += 1\n }\n\n return withPokeApiId(record, pokeApiId)\n })\n\n return { filePath, matched, missing, records: enrichedRecords }\n}\n\nfunction findPokeApiId(\n resourceIndex: PokeApiResourceIndex,\n championsId: string,\n idCandidates: string[],\n): number | undefined {\n for (const candidate of idCandidates) {\n const resource = findPokeApiResourceByName(resourceIndex, candidate)\n\n if (resource !== undefined) {\n return resource.id\n }\n }\n\n const resourceByChampionsId = resourceIndex.byId.get(championsId)\n\n if (resourceByChampionsId === undefined) {\n return undefined\n }\n\n return resourceByChampionsId.id\n}\n\nfunction findPokeApiResourceByName(\n resourceIndex: PokeApiResourceIndex,\n candidate: string,\n): PokeApiResourceIndexEntry | undefined {\n for (const key of pokeApiResourceNameKeys(candidate)) {\n const resource = resourceIndex.byName.get(key)\n\n if (resource !== undefined) {\n return resource\n }\n }\n\n return undefined\n}\n\nfunction pokeApiIdCandidates(kind: PokeApiResourceKind, id: string): string[] {\n return uniqueStrings([id, ...(champoutPokeApiResourceNameAliases[kind]?.[id] ?? [])])\n}\n\nfunction withPokeApiId(record: JsonRecord, pokeApiId: number | undefined): JsonRecord {\n const { id, championsId, slug, ...rest } = record\n delete rest.pokeApiId\n\n // Null rather than absent, so \"PokeAPI has no id for this yet\" is stated in\n // the data instead of looking like a field nobody got round to filling in.\n // Anything hand-written here is replaced: an id PokeAPI has not published is\n // a guess, and a guess that outlives a build is worse than a null.\n return { id, championsId, pokeApiId: pokeApiId ?? null, slug, ...rest }\n}\n\nfunction readJsonRecordArray(filePath: string): JsonRecord[] {\n const json: unknown = JSON.parse(readFileSync(filePath, 'utf8'))\n\n if (!Array.isArray(json)) {\n throw new Error(`Expected ${filePath} to contain an array`)\n }\n\n return json.map((record, index) => {\n if (typeof record !== 'object' || record === null || Array.isArray(record)) {\n throw new Error(`Expected ${filePath}[${index}] to contain an object`)\n }\n\n return record as JsonRecord\n })\n}\n\nfunction writeJsonFile(filePath: string, data: unknown): void {\n writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\\n`)\n}\n\nfunction requiredString(record: JsonRecord, key: string, filePath: string, index: number): string {\n const value = record[key]\n\n if (typeof value !== 'string' || value.length === 0) {\n throw new Error(`Expected ${filePath}[${index}].${key} to be a non-empty string`)\n }\n\n return value\n}\n\nfunction uniqueStrings(values: readonly unknown[]): string[] {\n return Array.from(new Set(values.filter((value): value is string => typeof value === 'string')))\n}\n\nfunction formatDomainSummary(\n domain: keyof EnrichChampionsDataResult,\n result: EnrichedChampionsDomainResult,\n): string {\n const missing = result.missing.length === 0 ? '' : `, ${result.missing.length} unmatched`\n\n return `${result.matched} ${domain} with PokeAPI IDs${missing}`\n}\n\nfunction formatMissingPokeApiResourcesWarning(result: EnrichChampionsDataResult): string {\n const lines = ['Missing PokeAPI resources; they were written with a null pokeApiId.']\n\n for (const [domain, domainResult] of Object.entries(result)) {\n if (domainResult.missing.length === 0) {\n continue\n }\n\n lines.push(`${domain}: ${domainResult.missing.length} missing`)\n\n for (const missing of domainResult.missing) {\n const championsIdMatch =\n missing.championsIdMatchedResource === undefined\n ? 'no PokeAPI resource with that numeric id'\n : `numeric id belongs to ${missing.championsIdMatchedResource.name}`\n\n lines.push(\n `- ${missing.id} (${missing.name}; championsId ${missing.championsId}; tried id candidates ${missing.triedIdCandidates.join(', ')}; ${championsIdMatch})`,\n )\n }\n }\n\n return lines.join('\\n')\n}\n","import {\n enrichChampionsDataWithPokeApiIds,\n formatEnrichChampionsDataSummary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I,QAAQ,KAAK,gBAAgB,QAAQ,YAAY,wBAAwB,QAAQ,kBAAkB,KAAK,IAAI,EAAE,IAAI,iBAAiB,EACzJ;EACF;CACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB;;;ACnQA,MAAM,SAAS,MAAM,kCAAkC;AAEvD,QAAQ,IAAI,iCAAiC,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"enums-CCbmORM6.d.mts","names":[],"sources":["../src/lib/enums.ts"],"mappings":";cAAa,QAAA;AAAA,cACA,aAAA;AAAA,cAaA,UAAA;AAAA,cACA,YAAA;AAAA,cAcA,gBAAA;AAAA,cACA,WAAA;AAAA,cAaA,mBAAA;;;;cAiBA,mBAAA;AAAA,cAcA,cAAA;AAAA,cACA,OAAA;;cAyBA,aAAA;AAAA,cAyBA,OAAA;AAAA,cACA,YAAA;AAAA,cACA,OAAA;AAAA,cACA,UAAA;AAAA,cACA,YAAA;AAAA,cAWA,aAAA;AAAA,cAEA,YAAA;AAAA,cACA,UAAA"}
1
+ {"version":3,"file":"enums-CCbmORM6.d.mts","names":[],"sources":["../src/lib/enums.ts"],"mappings":";cAAa;cACA;cAaA;cACA;cAcA;cACA;cAaA;;;;cAiBA;cAcA;cACA;;cAyBA;cAyBA;cACA;cACA;cACA;cACA;cAWA;cAEA;cACA"}
@@ -1,2 +1,2 @@
1
- import { a as sanitizeModernBoxPresetSlots, i as sanitizeModernBoxPresetSlot, n as incompatibleClassicPokemonIds, r as modernBoxPresetSlotFilters, t as collectModernBoxPresetSanitizerDiagnostics } from "../box-preset-sanitizer-GjGde3eW.mjs";
1
+ import { a as sanitizeModernBoxPresetSlots, i as sanitizeModernBoxPresetSlot, n as incompatibleClassicPokemonIds, r as modernBoxPresetSlotFilters, t as collectModernBoxPresetSanitizerDiagnostics } from "../box-preset-sanitizer-DHGv5TJj.mjs";
2
2
  export { collectModernBoxPresetSanitizerDiagnostics, incompatibleClassicPokemonIds, modernBoxPresetSlotFilters, sanitizeModernBoxPresetSlot, sanitizeModernBoxPresetSlots };
@@ -1,20 +1,18 @@
1
1
  import { t as ModernBoxPresetSanitizerDiagnostic } from "../box-preset-sanitizer-kg68JZPB.mjs";
2
-
3
2
  //#region src/lib/box-preset-transform.d.ts
4
- type TransformModernBoxPresetsOptions = {
3
+ export type TransformModernBoxPresetsOptions = {
5
4
  datasetDir: string;
6
5
  validPokemonIds: ReadonlySet<string>;
7
6
  };
8
- type TransformModernBoxPresetsResult = {
7
+ export type TransformModernBoxPresetsResult = {
9
8
  gameSets: string[];
10
9
  presetCount: number;
11
10
  diagnostics: ModernBoxPresetSanitizerDiagnostic[];
12
11
  };
13
- declare function transformClassicBoxPreset(gameSet: string, preset: Pkds.LegacyBoxPreset, validPokemonIds: ReadonlySet<string>): {
12
+ export declare function transformClassicBoxPreset(gameSet: string, preset: Pkds.LegacyBoxPreset, validPokemonIds: ReadonlySet<string>): {
14
13
  preset: Pkds.ModernBoxPreset;
15
14
  diagnostics: ModernBoxPresetSanitizerDiagnostic[];
16
15
  };
17
- declare function transformModernBoxPresets(options: TransformModernBoxPresetsOptions): TransformModernBoxPresetsResult;
16
+ export declare function transformModernBoxPresets(options: TransformModernBoxPresetsOptions): TransformModernBoxPresetsResult;
18
17
  //#endregion
19
- export { TransformModernBoxPresetsOptions, TransformModernBoxPresetsResult, transformClassicBoxPreset, transformModernBoxPresets };
20
18
  //# sourceMappingURL=box-preset-transform.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"box-preset-transform.d.mts","names":[],"sources":["../../src/lib/box-preset-transform.ts"],"mappings":";;;KASY,gCAAA;EACV,UAAA;EACA,eAAA,EAAiB,WAAW;AAAA;AAAA,KAGlB,+BAAA;EACV,QAAA;EACA,WAAA;EACA,WAAA,EAAa,kCAAkC;AAAA;AAAA,iBA+DjC,yBAAA,CACd,OAAA,UACA,MAAA,EAAQ,IAAA,CAAK,eAAA,EACb,eAAA,EAAiB,WAAA;EAEjB,MAAA,EAAQ,IAAA,CAAK,eAAA;EACb,WAAA,EAAa,kCAAA;AAAA;AAAA,iBAgDC,yBAAA,CACd,OAAA,EAAS,gCAAA,GACR,+BAA+B"}
1
+ {"version":3,"file":"box-preset-transform.d.mts","names":[],"sources":["../../src/lib/box-preset-transform.ts"],"mappings":";;YASY;EACV;EACA,iBAAiB;;YAGP;EACV;EACA;EACA,aAAa;;wBA+DC,0BACd,iBACA,QAAQ,KAAK,iBACb,iBAAiB;EAEjB,QAAQ,KAAK;EACb,aAAa;;wBAgDC,0BACd,SAAS,mCACR"}
@@ -1,5 +1,5 @@
1
- import { _ as modernBoxPresetIndexSchema, o as boxPresetSchema, v as modernBoxPresetSchema } from "../schemas-Dt7FbAMy.mjs";
2
- import { a as sanitizeModernBoxPresetSlots, t as collectModernBoxPresetSanitizerDiagnostics } from "../box-preset-sanitizer-GjGde3eW.mjs";
1
+ import { _ as modernBoxPresetIndexSchema, o as boxPresetSchema, v as modernBoxPresetSchema } from "../schemas-CcUqoHNr.mjs";
2
+ import { a as sanitizeModernBoxPresetSlots, t as collectModernBoxPresetSanitizerDiagnostics } from "../box-preset-sanitizer-DHGv5TJj.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  //#region src/lib/box-preset-transform.ts
@@ -1,7 +1,6 @@
1
1
  //#region src/lib/constants.d.ts
2
- declare const POKEPC_LATEST_GENERATION = 10;
3
- declare const POKEPC_UNRELEASED_GAMES: string[];
4
- declare const NON_CANONICAL_POKEMON_IDS: string[];
2
+ export declare const POKEPC_LATEST_GENERATION = 10;
3
+ export declare const POKEPC_UNRELEASED_GAMES: string[];
4
+ export declare const NON_CANONICAL_POKEMON_IDS: string[];
5
5
  //#endregion
6
- export { NON_CANONICAL_POKEMON_IDS, POKEPC_LATEST_GENERATION, POKEPC_UNRELEASED_GAMES };
7
6
  //# sourceMappingURL=constants.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","names":[],"sources":["../../src/lib/constants.ts"],"mappings":";cAAa,wBAAA;AAAA,cACA,uBAAA;AAAA,cAEA,yBAAA"}
1
+ {"version":3,"file":"constants.d.mts","names":[],"sources":["../../src/lib/constants.ts"],"mappings":";qBAAa;qBACA;qBAEA"}
@@ -1,38 +1,38 @@
1
1
  //#region src/lib/fs.d.ts
2
- declare function absDatasetFile(fileName: string): string;
3
- declare function readDatasetFile<T>(filePath: string): T;
4
- declare function writeDatasetFile(data: any, filePath: string, minified?: boolean): void;
5
- declare const itemsFs: import("yolodb").YoloDbTable<{
2
+ export declare function absDatasetFile(fileName: string): string;
3
+ export declare function readDatasetFile<T>(filePath: string): T;
4
+ export declare function writeDatasetFile(data: any, filePath: string, minified?: boolean): void;
5
+ export declare const itemsFs: import("yolodb").YoloDbTable<{
6
6
  id: string;
7
7
  name: string;
8
8
  psName: string;
9
9
  gen: number;
10
10
  shortDesc: string;
11
11
  desc: string | null;
12
- category: "berry" | "other" | "ball" | "medicine" | "battle" | "machine" | "megastone" | "zcrystal" | "treasure" | "ingredient" | "material" | "key";
12
+ category: "other" | "ball" | "medicine" | "battle" | "berry" | "machine" | "megastone" | "zcrystal" | "treasure" | "ingredient" | "material" | "key";
13
13
  unholdable?: boolean | undefined;
14
14
  }>;
15
- declare const pokeballsFs: import("yolodb").YoloDbTable<{
15
+ export declare const pokeballsFs: import("yolodb").YoloDbTable<{
16
16
  id: string;
17
17
  name: string;
18
18
  gen: number;
19
19
  shortDesc: string;
20
20
  desc: string | null;
21
- category: "special" | "other" | "regular" | "hisuian";
21
+ category: "other" | "regular" | "special" | "hisuian";
22
22
  unusable?: boolean | undefined;
23
23
  }>;
24
- declare const abilitiesFs: import("yolodb").YoloDbTable<{
24
+ export declare const abilitiesFs: import("yolodb").YoloDbTable<{
25
25
  id: string;
26
26
  name: string;
27
27
  psName: string;
28
28
  gen: number;
29
29
  shortDesc: string;
30
30
  desc: string | null;
31
- tags: ("defense" | "other" | "alert" | "ally-helper" | "stat-boost" | "move-boost" | "bypass" | "handicap" | "heal" | "items" | "priority-control" | "damage" | "target-weaken" | "status-trigger" | "status-immunity" | "steal" | "weather" | "terrain" | "trap" | "ability-change" | "type-change" | "species-specific")[];
31
+ tags: ("alert" | "ally-helper" | "stat-boost" | "move-boost" | "bypass" | "defense" | "handicap" | "heal" | "items" | "priority-control" | "damage" | "target-weaken" | "status-trigger" | "status-immunity" | "steal" | "weather" | "terrain" | "trap" | "ability-change" | "type-change" | "species-specific" | "other")[];
32
32
  immunities?: ("normal" | "fire" | "water" | "electric" | "grass" | "ice" | "fighting" | "poison" | "ground" | "flying" | "psychic" | "bug" | "rock" | "ghost" | "dragon" | "dark" | "steel" | "fairy" | "stellar")[] | undefined;
33
33
  weaknesses?: ("normal" | "fire" | "water" | "electric" | "grass" | "ice" | "fighting" | "poison" | "ground" | "flying" | "psychic" | "bug" | "rock" | "ghost" | "dragon" | "dark" | "steel" | "fairy" | "stellar")[] | undefined;
34
34
  }>;
35
- declare const movesFs: import("yolodb").YoloDbTable<{
35
+ export declare const movesFs: import("yolodb").YoloDbTable<{
36
36
  id: string;
37
37
  name: string;
38
38
  psName: string;
@@ -43,16 +43,16 @@ declare const movesFs: import("yolodb").YoloDbTable<{
43
43
  power: number;
44
44
  accuracy: number;
45
45
  pp: number;
46
- category: "physical" | "special" | "status";
46
+ category: "special" | "physical" | "status";
47
47
  priority: number;
48
48
  isZ: boolean;
49
49
  isGmax: boolean;
50
50
  }>;
51
- declare const charactersFs: import("yolodb").YoloDbTable<{
51
+ export declare const charactersFs: import("yolodb").YoloDbTable<{
52
52
  id: string;
53
53
  name: string;
54
54
  }>;
55
- declare const ribbonsFs: import("yolodb").YoloDbTable<{
55
+ export declare const ribbonsFs: import("yolodb").YoloDbTable<{
56
56
  id: string;
57
57
  name: string;
58
58
  gen: number;
@@ -61,7 +61,7 @@ declare const ribbonsFs: import("yolodb").YoloDbTable<{
61
61
  title: string;
62
62
  category: "league" | "contest" | "tower" | "memory" | "gift";
63
63
  }>;
64
- declare const marksFs: import("yolodb").YoloDbTable<{
64
+ export declare const marksFs: import("yolodb").YoloDbTable<{
65
65
  id: string;
66
66
  name: string;
67
67
  gen: number;
@@ -72,76 +72,75 @@ declare const marksFs: import("yolodb").YoloDbTable<{
72
72
  chance: string;
73
73
  chanceCharm: string;
74
74
  }>;
75
- declare const originMarksFs: import("yolodb").YoloDbTable<{
75
+ export declare const originMarksFs: import("yolodb").YoloDbTable<{
76
76
  id: string;
77
77
  name: string;
78
78
  }>;
79
- declare const typesFs: import("yolodb").YoloDbTable<{
79
+ export declare const typesFs: import("yolodb").YoloDbTable<{
80
80
  id: string;
81
81
  name: string;
82
82
  color: string;
83
83
  isCanonical: boolean;
84
84
  }>;
85
- declare const naturesFs: import("yolodb").YoloDbTable<{
85
+ export declare const naturesFs: import("yolodb").YoloDbTable<{
86
86
  id: string;
87
87
  name: string;
88
88
  raises: "def" | "hp" | "atk" | "spa" | "spd" | "spe" | "acc" | "eva" | null;
89
89
  lowers: "def" | "hp" | "atk" | "spa" | "spd" | "spe" | "acc" | "eva" | null;
90
90
  }>;
91
- declare const personalitiesFs: import("yolodb").YoloDbTable<{
91
+ export declare const personalitiesFs: import("yolodb").YoloDbTable<{
92
92
  id: string;
93
93
  shortDesc: string;
94
94
  }>;
95
- declare const regionsFs: import("yolodb").YoloDbTable<{
95
+ export declare const regionsFs: import("yolodb").YoloDbTable<{
96
96
  id: string;
97
97
  name: string;
98
98
  }>;
99
- declare const colorsFs: import("yolodb").YoloDbTable<{
99
+ export declare const colorsFs: import("yolodb").YoloDbTable<{
100
100
  id: string;
101
101
  name: string;
102
102
  color: string;
103
103
  }>;
104
- declare const languagesFs: import("yolodb").YoloDbTable<{
105
- id: "en" | "es" | "esla" | "fr" | "de" | "it" | "ja" | "ko" | "chs" | "cht" | "pt";
104
+ export declare const languagesFs: import("yolodb").YoloDbTable<{
105
+ id: "esla" | "chs" | "cht" | "en" | "es" | "fr" | "de" | "it" | "ja" | "ko" | "pt";
106
106
  name: string;
107
107
  nameEng: string;
108
- alpha3: "esla" | "chs" | "cht" | "eng" | "esp" | "fra" | "deu" | "ita" | "jap" | "kor" | "por";
108
+ alpha3: "eng" | "esp" | "esla" | "fra" | "deu" | "ita" | "jap" | "kor" | "chs" | "cht" | "por";
109
109
  inGameCode: "ENG" | "ES-ES" | "ES-LA" | "FRA" | "DEU" | "ITA" | "JPN" | "KOR" | "CHT" | "CHS" | "PT-BR";
110
110
  locale: string;
111
111
  flag: string;
112
112
  pkApiId: string | null;
113
113
  }>;
114
- declare const generationsFs: import("yolodb").YoloDbTable<{
114
+ export declare const generationsFs: import("yolodb").YoloDbTable<{
115
115
  id: number;
116
116
  minDexNum: number;
117
117
  maxDexNum: number;
118
118
  }>;
119
- declare function joinPokemonFilesFromIndex(index: string[]): Pkds.Pokemon[];
120
- declare function joinGamesFilesFromIndex(index: string[]): Pkds.Game[];
121
- declare function joinPokedexesFilesFromIndex(index: string[]): Pkds.Pokedex[];
122
- declare function joinBoxPresetFilesFromIndex(index: string[], variant?: 'classic' | 'modern'): Array<Pkds.LegacyBoxPresetByGameset>;
123
- declare function readIndexFile(indexName: 'pokemon' | 'games' | 'pokedexes'): string[];
124
- declare function regeneratePokemonIndexFile(): string[];
125
- declare function loadAllPokemon(): Pkds.Pokemon[];
126
- declare function loadAllGameSets(): Pkds.Game[];
127
- declare function loadAllBoxPresets(variant?: 'classic' | 'modern'): Array<Pkds.LegacyBoxPresetByGameset>;
128
- declare function loadAllGames(): Pkds.Game[];
129
- declare function loadAllPokedexes(): Pkds.Pokedex[];
130
- declare function loadAllCharacters(): Pkds.Character[];
131
- declare function loadAllItems(): Pkds.Item[];
132
- declare function loadAllPokeballs(): Pkds.Pokeball[];
133
- declare function loadAllAbilities(): Pkds.Ability[];
134
- declare function loadAllMoves(): Pkds.Move[];
135
- declare function loadAllRibbons(): Pkds.Ribbon[];
136
- declare function loadAllMarks(): Pkds.Mark[];
137
- declare function loadAllOriginMarks(): Pkds.OriginMark[];
138
- declare function loadAllTypes(): Pkds.Type[];
139
- declare function loadAllNatures(): Pkds.Nature[];
140
- declare function loadAllPersonalities(): Pkds.Personality[];
141
- declare function loadAllRegions(): Pkds.Region[];
142
- declare function loadAllColors(): Pkds.Color[];
143
- declare function loadAllLanguages(): Pkds.Language[];
144
- declare function loadAllGenerations(): Pkds.Generation[];
119
+ export declare function joinPokemonFilesFromIndex(index: string[]): Pkds.Pokemon[];
120
+ export declare function joinGamesFilesFromIndex(index: string[]): Pkds.Game[];
121
+ export declare function joinPokedexesFilesFromIndex(index: string[]): Pkds.Pokedex[];
122
+ export declare function joinBoxPresetFilesFromIndex(index: string[], variant?: 'classic' | 'modern'): Array<Pkds.LegacyBoxPresetByGameset>;
123
+ export declare function readIndexFile(indexName: 'pokemon' | 'games' | 'pokedexes'): string[];
124
+ export declare function regeneratePokemonIndexFile(): string[];
125
+ export declare function loadAllPokemon(): Pkds.Pokemon[];
126
+ export declare function loadAllGameSets(): Pkds.Game[];
127
+ export declare function loadAllBoxPresets(variant?: 'classic' | 'modern'): Array<Pkds.LegacyBoxPresetByGameset>;
128
+ export declare function loadAllGames(): Pkds.Game[];
129
+ export declare function loadAllPokedexes(): Pkds.Pokedex[];
130
+ export declare function loadAllCharacters(): Pkds.Character[];
131
+ export declare function loadAllItems(): Pkds.Item[];
132
+ export declare function loadAllPokeballs(): Pkds.Pokeball[];
133
+ export declare function loadAllAbilities(): Pkds.Ability[];
134
+ export declare function loadAllMoves(): Pkds.Move[];
135
+ export declare function loadAllRibbons(): Pkds.Ribbon[];
136
+ export declare function loadAllMarks(): Pkds.Mark[];
137
+ export declare function loadAllOriginMarks(): Pkds.OriginMark[];
138
+ export declare function loadAllTypes(): Pkds.Type[];
139
+ export declare function loadAllNatures(): Pkds.Nature[];
140
+ export declare function loadAllPersonalities(): Pkds.Personality[];
141
+ export declare function loadAllRegions(): Pkds.Region[];
142
+ export declare function loadAllColors(): Pkds.Color[];
143
+ export declare function loadAllLanguages(): Pkds.Language[];
144
+ export declare function loadAllGenerations(): Pkds.Generation[];
145
145
  //#endregion
146
- export { abilitiesFs, absDatasetFile, charactersFs, colorsFs, generationsFs, itemsFs, joinBoxPresetFilesFromIndex, joinGamesFilesFromIndex, joinPokedexesFilesFromIndex, joinPokemonFilesFromIndex, languagesFs, loadAllAbilities, loadAllBoxPresets, loadAllCharacters, loadAllColors, loadAllGameSets, loadAllGames, loadAllGenerations, loadAllItems, loadAllLanguages, loadAllMarks, loadAllMoves, loadAllNatures, loadAllOriginMarks, loadAllPersonalities, loadAllPokeballs, loadAllPokedexes, loadAllPokemon, loadAllRegions, loadAllRibbons, loadAllTypes, marksFs, movesFs, naturesFs, originMarksFs, personalitiesFs, pokeballsFs, readDatasetFile, readIndexFile, regeneratePokemonIndexFile, regionsFs, ribbonsFs, typesFs, writeDatasetFile };
147
146
  //# sourceMappingURL=fs.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/lib/fs.ts"],"mappings":";iBA8DgB,cAAA,CAAe,QAAgB;AAAA,iBAI/B,eAAA,IAAmB,QAAA,WAAmB,CAAC;AAAA,iBAMvC,gBAAA,CAAiB,IAAA,OAAW,QAAA,UAAkB,QAAA;AAAA,cAOjD,OAAA,mBAAO,WAAA;;;;;;;;;;cAIP,WAAA,mBAAW,WAAA;;;;;;;;;cAIX,WAAA,mBAAW,WAAA;;;;;;;;;;;cAIX,OAAA,mBAAO,WAAA;;;;;;;;;;;;;;;;cAIP,YAAA,mBAAY,WAAA;;;;cAIZ,SAAA,mBAAS,WAAA;;;;;;;;;cAIT,OAAA,mBAAO,WAAA;;;;;;;;;;;cAIP,aAAA,mBAAa,WAAA;;;;cAIb,OAAA,mBAAO,WAAA;;;;;;cAIP,SAAA,mBAAS,WAAA;;;;;;cAIT,eAAA,mBAAe,WAAA;;;;cASf,SAAA,mBAAS,WAAA;;;;cAIT,QAAA,mBAAQ,WAAA;;;;;cAIR,WAAA,mBAAW,WAAA;;;;;;;;;;cAIX,aAAA,mBAAa,WAAA;;;;;iBAIV,yBAAA,CAA0B,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"}
1
+ {"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/lib/fs.ts"],"mappings":";wBA8DgB,eAAe;wBAIf,gBAAgB,GAAG,mBAAmB;wBAMtC,iBAAiB,WAAW,kBAAkB;qBAOjD,0BAAO;;;;;;;;;;qBAIP,8BAAW;;;;;;;;;qBAIX,8BAAW;;;;;;;;;;;qBAIX,0BAAO;;;;;;;;;;;;;;;;qBAIP,+BAAY;;;;qBAIZ,4BAAS;;;;;;;;;qBAIT,0BAAO;;;;;;;;;;;qBAIP,gCAAa;;;;qBAIb,0BAAO;;;;;;qBAIP,4BAAS;;;;;;qBAIT,kCAAe;;;;qBASf,4BAAS;;;;qBAIT,2BAAQ;;;;;qBAIR,8BAAW;;;;;;;;;;qBAIX,gCAAa;;;;;wBAIV,0BAA0B,kBAAkB,KAAK;wBAejD,wBAAwB,kBAAkB,KAAK;wBAe/C,4BAA4B,kBAAkB,KAAK;wBAenD,4BACd,iBACA,iCACC,MAAM,KAAK;wBAgBE,cAAc;wBAQd;wBAOA,kBAAkB,KAAK;wBAOvB,mBAAmB,KAAK;wBAYxB,kBACd,iCACC,MAAM,KAAK;wBAOE,gBAAgB,KAAK;wBAOrB,oBAAoB,KAAK;wBAOzB,qBAAqB,KAAK;wBAI1B,gBAAgB,KAAK;wBAIrB,oBAAoB,KAAK;wBAIzB,oBAAoB,KAAK;wBAIzB,gBAAgB,KAAK;wBAIrB,kBAAkB,KAAK;wBAIvB,gBAAgB,KAAK;wBAIrB,sBAAsB,KAAK;wBAI3B,gBAAgB,KAAK;wBAIrB,kBAAkB,KAAK;wBAIvB,wBAAwB,KAAK;wBAI7B,kBAAkB,KAAK;wBAIvB,iBAAiB,KAAK;wBAItB,oBAAoB,KAAK;wBAIzB,sBAAsB,KAAK"}
package/build/lib/fs.mjs CHANGED
@@ -5,8 +5,8 @@ import { fileURLToPath } from "node:url";
5
5
  import { yolodb } from "yolodb";
6
6
  //#region src/utils/memory-cache.ts
7
7
  var MemoryCache = class {
8
- defaultTTL = 1e3 * 60;
9
- constructor(defaultTTL = 1e3 * 10) {
8
+ defaultTTL = 6e4;
9
+ constructor(defaultTTL = 1e4) {
10
10
  this.defaultTTL = defaultTTL;
11
11
  }
12
12
  #cache = /* @__PURE__ */ new Map();
@@ -81,7 +81,7 @@ if (!RESOLVED_DATASET_DIR) {
81
81
  }
82
82
  const DATASET_DIR = RESOLVED_DATASET_DIR;
83
83
  console.debug("Resolved POKEPC dataset directory:", DATASET_DIR);
84
- const DEFAULT_CACHE_TTL = 1e3 * 10;
84
+ const DEFAULT_CACHE_TTL = 1e4;
85
85
  const memoryCache = new MemoryCache(DEFAULT_CACHE_TTL);
86
86
  const MEMORY_CACHE_DISABLED = process.env.POKEPC_DISABLE_MEMORY_CACHE === "1";
87
87
  function cached(key, fn, ttl = DEFAULT_CACHE_TTL) {
@@ -1 +1 @@
1
- {"version":3,"file":"fs.mjs","names":["#cache"],"sources":["../../src/utils/memory-cache.ts","../../src/lib/fs.ts"],"sourcesContent":["export class MemoryCache {\n defaultTTL: number = 1000 * 60\n\n constructor(defaultTTL: number = 1000 * 10) {\n this.defaultTTL = defaultTTL\n }\n\n #cache: Map<string, { exptime: number; value: any }> = new Map()\n\n get<T>(key: string): T | undefined {\n const value = this.#cache.get(key)\n if (!value) {\n return undefined\n }\n if (value.exptime > Date.now() || value.exptime === 0) {\n return value.value\n }\n this.#cache.delete(key)\n return undefined\n }\n\n set(key: string, value: any, ttl: number = this.defaultTTL) {\n this.#cache.set(key, { exptime: ttl === 0 ? 0 : Date.now() + ttl, value })\n }\n\n delete(key: string) {\n this.#cache.delete(key)\n }\n\n has(key: string) {\n const value = this.#cache.get(key)\n return Boolean(value && (value.exptime > Date.now() || value.exptime === 0))\n }\n\n clear() {\n this.#cache.clear()\n }\n\n keys() {\n return Array.from(this.#cache.keys())\n }\n\n values() {\n return Array.from(this.#cache.values()).map((value) => value.value)\n }\n\n entries() {\n return Array.from(this.#cache.entries()).map(([key, value]) => [key, value.value])\n }\n\n size() {\n return this.#cache.size\n }\n\n cached<T>(key: string, fn: () => T, ttl: number = this.defaultTTL): T {\n const value = this.get<T>(key)\n if (value) {\n return value\n }\n const result = fn()\n this.set(key, result, ttl)\n return result\n }\n}\n","import { MemoryCache } from '../utils/memory-cache'\nimport { arrayUnique } from '../utils/utils-internal'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { yolodb } from 'yolodb'\n\nconst DATASET_PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')\nconst MONOREPO_ROOT = path.resolve(DATASET_PACKAGE_ROOT, '..', '..')\n\nfunction uniquePaths(paths: string[]) {\n return Array.from(new Set(paths))\n}\n\nfunction resolveDatasetDirCandidates(value: string | undefined) {\n if (!value) {\n return uniquePaths([\n path.join(DATASET_PACKAGE_ROOT, 'data'),\n path.join(process.cwd(), 'data'),\n path.join(MONOREPO_ROOT, 'packages/dataset/data'),\n ])\n }\n\n if (path.isAbsolute(value)) {\n return [value]\n }\n\n return uniquePaths([\n path.resolve(process.cwd(), value),\n path.resolve(MONOREPO_ROOT, value),\n path.resolve(DATASET_PACKAGE_ROOT, value),\n ])\n}\n\nconst DATASET_DIR_CANDIDATES = [...resolveDatasetDirCandidates(process.env.POKEPC_DATASET_DIR)]\nconst RESOLVED_DATASET_DIR = DATASET_DIR_CANDIDATES.find((candidate) =>\n fs.existsSync(path.join(candidate, 'types.json')),\n)\n\nif (!RESOLVED_DATASET_DIR) {\n const errMsg =\n 'Could not find dataset directory. Set POKEPC_DATASET_DIR and try again. Tried: ' +\n DATASET_DIR_CANDIDATES.join(', ')\n console.error(errMsg)\n throw new Error(errMsg)\n}\n\nconst DATASET_DIR = RESOLVED_DATASET_DIR\n\nconsole.debug('Resolved POKEPC dataset directory:', DATASET_DIR)\n\nconst DEFAULT_CACHE_TTL = 1000 * 10 // 10 seconds\nconst memoryCache = new MemoryCache(DEFAULT_CACHE_TTL)\nconst MEMORY_CACHE_DISABLED = process.env.POKEPC_DISABLE_MEMORY_CACHE === '1'\n\nfunction cached<T>(key: string, fn: () => T, ttl: number = DEFAULT_CACHE_TTL): T {\n if (MEMORY_CACHE_DISABLED) {\n return fn()\n }\n return memoryCache.cached(key, fn, ttl)\n}\n\nexport function absDatasetFile(fileName: string) {\n return path.join(DATASET_DIR, fileName)\n}\n\nexport function readDatasetFile<T>(filePath: string): T {\n const absFilePath = absDatasetFile(filePath)\n const data = fs.readFileSync(absFilePath, 'utf8')\n return JSON.parse(data)\n}\n\nexport function writeDatasetFile(data: any, filePath: string, minified: boolean = false) {\n const absFilePath = absDatasetFile(filePath)\n let jsonData = typeof data === 'string' ? data : JSON.stringify(data, null, minified ? 0 : 2)\n fs.mkdirSync(path.dirname(absFilePath), { recursive: true })\n fs.writeFileSync(absFilePath, jsonData)\n}\n\nexport const itemsFs = yolodb<Pkds.Item>(absDatasetFile('items.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const pokeballsFs = yolodb<Pkds.Pokeball>(absDatasetFile('pokeballs.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const abilitiesFs = yolodb<Pkds.Ability>(absDatasetFile('abilities.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const movesFs = yolodb<Pkds.Move>(absDatasetFile('moves.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const charactersFs = yolodb<Pkds.Character>(absDatasetFile('characters.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const ribbonsFs = yolodb<Pkds.Ribbon>(absDatasetFile('ribbons.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const marksFs = yolodb<Pkds.Mark>(absDatasetFile('marks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const originMarksFs = yolodb<Pkds.OriginMark>(absDatasetFile('originmarks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const typesFs = yolodb<Pkds.Type>(absDatasetFile('types.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const naturesFs = yolodb<Pkds.Nature>(absDatasetFile('natures.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const personalitiesFs = yolodb<Pkds.Personality>(\n absDatasetFile('personalities.json'),\n 'id',\n [],\n {\n superjsonEnabled: false,\n },\n)\n\nexport const regionsFs = yolodb<Pkds.Region>(absDatasetFile('regions.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const colorsFs = yolodb<Pkds.Color>(absDatasetFile('colors.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const languagesFs = yolodb<Pkds.Language>(absDatasetFile('languages.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const generationsFs = yolodb<Pkds.Generation>(absDatasetFile('generations.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport function joinPokemonFilesFromIndex(index: string[]): Pkds.Pokemon[] {\n const pokemon: Pkds.Pokemon[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokemon/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokemon ${item} not found at ${filePath}`)\n }\n const pkm = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokemonSchema.parse(pkm)\n pokemon.push(pkm)\n }\n\n return pokemon\n}\n\nexport function joinGamesFilesFromIndex(index: string[]): Pkds.Game[] {\n const games: Pkds.Game[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`games/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Game ${item} not found at ${filePath}`)\n }\n const game = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = gameSchema.parse(game)\n games.push(game)\n }\n\n return games\n}\n\nexport function joinPokedexesFilesFromIndex(index: string[]): Pkds.Pokedex[] {\n const pokedexes: Pkds.Pokedex[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokedexes/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokedex ${item} not found at ${filePath}`)\n }\n const pokedex = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokedexSchema.parse(pokedex)\n pokedexes.push(pokedex)\n }\n\n return pokedexes\n}\n\nexport function joinBoxPresetFilesFromIndex(\n index: string[],\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n const boxPresetGroups: Array<Pkds.LegacyBoxPresetByGameset> = []\n for (const item of index) {\n const filePath = absDatasetFile(`boxpresets/${variant}/${item}.json`)\n if (!fs.existsSync(filePath)) {\n console.error(`Box preset ${item} not found at ${filePath}`)\n continue\n }\n const boxPresets = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = legacyBoxPresetSchema.parse(boxPreset)\n boxPresetGroups.push({ gameset: item, presets: Object.values(boxPresets) })\n }\n\n return boxPresetGroups\n}\n\nexport function readIndexFile(indexName: 'pokemon' | 'games' | 'pokedexes'): string[] {\n const indexFilePath = absDatasetFile(`indices/${indexName}.json`)\n if (!fs.existsSync(indexFilePath)) {\n throw new Error(`Index file ${indexName} not found at ${indexFilePath}`)\n }\n return JSON.parse(fs.readFileSync(indexFilePath, 'utf8'))\n}\n\nexport function regeneratePokemonIndexFile(): string[] {\n const allPokemon = loadAllPokemon()\n const index = allPokemon.flatMap((pkm) => [pkm.id, ...pkm.forms.map((form) => form)])\n writeDatasetFile(arrayUnique(index), 'indices/pokemon.json', false)\n return index\n}\n\nexport function loadAllPokemon(): Pkds.Pokemon[] {\n return cached('allPokemon', () => {\n const index = readIndexFile('pokemon')\n return joinPokemonFilesFromIndex(index)\n })\n}\n\nexport function loadAllGameSets(): Pkds.Game[] {\n return loadAllGames().filter((game) => {\n if (game.type === 'set') {\n return true\n }\n if (game.type === 'game' && !game.gameSet) {\n return true\n }\n return false\n })\n}\n\nexport function loadAllBoxPresets(\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n return cached(`allBoxPresets-${variant}`, () => {\n const filenames = loadAllGameSets().map((game) => game.id)\n return joinBoxPresetFilesFromIndex(filenames, variant)\n })\n}\n\nexport function loadAllGames(): Pkds.Game[] {\n return cached('allGames', () => {\n const index = readIndexFile('games')\n return joinGamesFilesFromIndex(index)\n })\n}\n\nexport function loadAllPokedexes(): Pkds.Pokedex[] {\n return cached('allPokedexes', () => {\n const index = readIndexFile('pokedexes')\n return joinPokedexesFilesFromIndex(index)\n })\n}\n\nexport function loadAllCharacters(): Pkds.Character[] {\n return charactersFs.all()\n}\n\nexport function loadAllItems(): Pkds.Item[] {\n return itemsFs.all()\n}\n\nexport function loadAllPokeballs(): Pkds.Pokeball[] {\n return pokeballsFs.all()\n}\n\nexport function loadAllAbilities(): Pkds.Ability[] {\n return abilitiesFs.all()\n}\n\nexport function loadAllMoves(): Pkds.Move[] {\n return movesFs.all()\n}\n\nexport function loadAllRibbons(): Pkds.Ribbon[] {\n return ribbonsFs.all()\n}\n\nexport function loadAllMarks(): Pkds.Mark[] {\n return marksFs.all()\n}\n\nexport function loadAllOriginMarks(): Pkds.OriginMark[] {\n return originMarksFs.all()\n}\n\nexport function loadAllTypes(): Pkds.Type[] {\n return typesFs.all()\n}\n\nexport function loadAllNatures(): Pkds.Nature[] {\n return naturesFs.all()\n}\n\nexport function loadAllPersonalities(): Pkds.Personality[] {\n return personalitiesFs.all()\n}\n\nexport function loadAllRegions(): Pkds.Region[] {\n return regionsFs.all()\n}\n\nexport function loadAllColors(): Pkds.Color[] {\n return colorsFs.all()\n}\n\nexport function loadAllLanguages(): Pkds.Language[] {\n return languagesFs.all()\n}\n\nexport function loadAllGenerations(): Pkds.Generation[] {\n return generationsFs.all()\n}\n"],"mappings":";;;;;;AAAA,IAAa,cAAb,MAAyB;CACvB,aAAqB,MAAO;CAE5B,YAAY,aAAqB,MAAO,IAAI;EAC1C,KAAK,aAAa;CACpB;CAEA,yBAAuD,IAAI,IAAI;CAE/D,IAAO,KAA4B;EACjC,MAAM,QAAQ,KAAKA,OAAO,IAAI,GAAG;EACjC,IAAI,CAAC,OACH;EAEF,IAAI,MAAM,UAAU,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iBAAiB;EAE9C,OAAO,4BADW,gBAAgB,CAAC,CAAC,KAAK,SAAS,KAAK,EACZ,GAAG,OAAO;CACvD,CAAC;AACH;AAEA,SAAgB,eAA4B;CAC1C,OAAO,OAAO,kBAAkB;EAE9B,OAAO,wBADO,cAAc,OACO,CAAC;CACtC,CAAC;AACH;AAEA,SAAgB,mBAAmC;CACjD,OAAO,OAAO,sBAAsB;EAElC,OAAO,4BADO,cAAc,WACW,CAAC;CAC1C,CAAC;AACH;AAEA,SAAgB,oBAAsC;CACpD,OAAO,aAAa,IAAI;AAC1B;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,mBAAoC;CAClD,OAAO,YAAY,IAAI;AACzB;AAEA,SAAgB,mBAAmC;CACjD,OAAO,YAAY,IAAI;AACzB;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,qBAAwC;CACtD,OAAO,cAAc,IAAI;AAC3B;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,uBAA2C;CACzD,OAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,gBAA8B;CAC5C,OAAO,SAAS,IAAI;AACtB;AAEA,SAAgB,mBAAoC;CAClD,OAAO,YAAY,IAAI;AACzB;AAEA,SAAgB,qBAAwC;CACtD,OAAO,cAAc,IAAI;AAC3B"}
1
+ {"version":3,"file":"fs.mjs","names":[],"sources":["../../src/utils/memory-cache.ts","../../src/lib/fs.ts"],"sourcesContent":["export class MemoryCache {\n defaultTTL: number = 1000 * 60\n\n constructor(defaultTTL: number = 1000 * 10) {\n this.defaultTTL = defaultTTL\n }\n\n #cache: Map<string, { exptime: number; value: any }> = new Map()\n\n get<T>(key: string): T | undefined {\n const value = this.#cache.get(key)\n if (!value) {\n return undefined\n }\n if (value.exptime > Date.now() || value.exptime === 0) {\n return value.value\n }\n this.#cache.delete(key)\n return undefined\n }\n\n set(key: string, value: any, ttl: number = this.defaultTTL) {\n this.#cache.set(key, { exptime: ttl === 0 ? 0 : Date.now() + ttl, value })\n }\n\n delete(key: string) {\n this.#cache.delete(key)\n }\n\n has(key: string) {\n const value = this.#cache.get(key)\n return Boolean(value && (value.exptime > Date.now() || value.exptime === 0))\n }\n\n clear() {\n this.#cache.clear()\n }\n\n keys() {\n return Array.from(this.#cache.keys())\n }\n\n values() {\n return Array.from(this.#cache.values()).map((value) => value.value)\n }\n\n entries() {\n return Array.from(this.#cache.entries()).map(([key, value]) => [key, value.value])\n }\n\n size() {\n return this.#cache.size\n }\n\n cached<T>(key: string, fn: () => T, ttl: number = this.defaultTTL): T {\n const value = this.get<T>(key)\n if (value) {\n return value\n }\n const result = fn()\n this.set(key, result, ttl)\n return result\n }\n}\n","import { MemoryCache } from '../utils/memory-cache'\nimport { arrayUnique } from '../utils/utils-internal'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { yolodb } from 'yolodb'\n\nconst DATASET_PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')\nconst MONOREPO_ROOT = path.resolve(DATASET_PACKAGE_ROOT, '..', '..')\n\nfunction uniquePaths(paths: string[]) {\n return Array.from(new Set(paths))\n}\n\nfunction resolveDatasetDirCandidates(value: string | undefined) {\n if (!value) {\n return uniquePaths([\n path.join(DATASET_PACKAGE_ROOT, 'data'),\n path.join(process.cwd(), 'data'),\n path.join(MONOREPO_ROOT, 'packages/dataset/data'),\n ])\n }\n\n if (path.isAbsolute(value)) {\n return [value]\n }\n\n return uniquePaths([\n path.resolve(process.cwd(), value),\n path.resolve(MONOREPO_ROOT, value),\n path.resolve(DATASET_PACKAGE_ROOT, value),\n ])\n}\n\nconst DATASET_DIR_CANDIDATES = [...resolveDatasetDirCandidates(process.env.POKEPC_DATASET_DIR)]\nconst RESOLVED_DATASET_DIR = DATASET_DIR_CANDIDATES.find((candidate) =>\n fs.existsSync(path.join(candidate, 'types.json')),\n)\n\nif (!RESOLVED_DATASET_DIR) {\n const errMsg =\n 'Could not find dataset directory. Set POKEPC_DATASET_DIR and try again. Tried: ' +\n DATASET_DIR_CANDIDATES.join(', ')\n console.error(errMsg)\n throw new Error(errMsg)\n}\n\nconst DATASET_DIR = RESOLVED_DATASET_DIR\n\nconsole.debug('Resolved POKEPC dataset directory:', DATASET_DIR)\n\nconst DEFAULT_CACHE_TTL = 1000 * 10 // 10 seconds\nconst memoryCache = new MemoryCache(DEFAULT_CACHE_TTL)\nconst MEMORY_CACHE_DISABLED = process.env.POKEPC_DISABLE_MEMORY_CACHE === '1'\n\nfunction cached<T>(key: string, fn: () => T, ttl: number = DEFAULT_CACHE_TTL): T {\n if (MEMORY_CACHE_DISABLED) {\n return fn()\n }\n return memoryCache.cached(key, fn, ttl)\n}\n\nexport function absDatasetFile(fileName: string) {\n return path.join(DATASET_DIR, fileName)\n}\n\nexport function readDatasetFile<T>(filePath: string): T {\n const absFilePath = absDatasetFile(filePath)\n const data = fs.readFileSync(absFilePath, 'utf8')\n return JSON.parse(data)\n}\n\nexport function writeDatasetFile(data: any, filePath: string, minified: boolean = false) {\n const absFilePath = absDatasetFile(filePath)\n let jsonData = typeof data === 'string' ? data : JSON.stringify(data, null, minified ? 0 : 2)\n fs.mkdirSync(path.dirname(absFilePath), { recursive: true })\n fs.writeFileSync(absFilePath, jsonData)\n}\n\nexport const itemsFs = yolodb<Pkds.Item>(absDatasetFile('items.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const pokeballsFs = yolodb<Pkds.Pokeball>(absDatasetFile('pokeballs.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const abilitiesFs = yolodb<Pkds.Ability>(absDatasetFile('abilities.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const movesFs = yolodb<Pkds.Move>(absDatasetFile('moves.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const charactersFs = yolodb<Pkds.Character>(absDatasetFile('characters.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const ribbonsFs = yolodb<Pkds.Ribbon>(absDatasetFile('ribbons.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const marksFs = yolodb<Pkds.Mark>(absDatasetFile('marks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const originMarksFs = yolodb<Pkds.OriginMark>(absDatasetFile('originmarks.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const typesFs = yolodb<Pkds.Type>(absDatasetFile('types.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const naturesFs = yolodb<Pkds.Nature>(absDatasetFile('natures.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const personalitiesFs = yolodb<Pkds.Personality>(\n absDatasetFile('personalities.json'),\n 'id',\n [],\n {\n superjsonEnabled: false,\n },\n)\n\nexport const regionsFs = yolodb<Pkds.Region>(absDatasetFile('regions.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const colorsFs = yolodb<Pkds.Color>(absDatasetFile('colors.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const languagesFs = yolodb<Pkds.Language>(absDatasetFile('languages.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport const generationsFs = yolodb<Pkds.Generation>(absDatasetFile('generations.json'), 'id', [], {\n superjsonEnabled: false,\n})\n\nexport function joinPokemonFilesFromIndex(index: string[]): Pkds.Pokemon[] {\n const pokemon: Pkds.Pokemon[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokemon/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokemon ${item} not found at ${filePath}`)\n }\n const pkm = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokemonSchema.parse(pkm)\n pokemon.push(pkm)\n }\n\n return pokemon\n}\n\nexport function joinGamesFilesFromIndex(index: string[]): Pkds.Game[] {\n const games: Pkds.Game[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`games/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Game ${item} not found at ${filePath}`)\n }\n const game = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = gameSchema.parse(game)\n games.push(game)\n }\n\n return games\n}\n\nexport function joinPokedexesFilesFromIndex(index: string[]): Pkds.Pokedex[] {\n const pokedexes: Pkds.Pokedex[] = []\n for (const item of index) {\n const filePath = absDatasetFile(`pokedexes/${item}.json`)\n if (!fs.existsSync(filePath)) {\n throw new Error(`Pokedex ${item} not found at ${filePath}`)\n }\n const pokedex = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = pokedexSchema.parse(pokedex)\n pokedexes.push(pokedex)\n }\n\n return pokedexes\n}\n\nexport function joinBoxPresetFilesFromIndex(\n index: string[],\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n const boxPresetGroups: Array<Pkds.LegacyBoxPresetByGameset> = []\n for (const item of index) {\n const filePath = absDatasetFile(`boxpresets/${variant}/${item}.json`)\n if (!fs.existsSync(filePath)) {\n console.error(`Box preset ${item} not found at ${filePath}`)\n continue\n }\n const boxPresets = JSON.parse(fs.readFileSync(filePath, 'utf8'))\n // const parsed = legacyBoxPresetSchema.parse(boxPreset)\n boxPresetGroups.push({ gameset: item, presets: Object.values(boxPresets) })\n }\n\n return boxPresetGroups\n}\n\nexport function readIndexFile(indexName: 'pokemon' | 'games' | 'pokedexes'): string[] {\n const indexFilePath = absDatasetFile(`indices/${indexName}.json`)\n if (!fs.existsSync(indexFilePath)) {\n throw new Error(`Index file ${indexName} not found at ${indexFilePath}`)\n }\n return JSON.parse(fs.readFileSync(indexFilePath, 'utf8'))\n}\n\nexport function regeneratePokemonIndexFile(): string[] {\n const allPokemon = loadAllPokemon()\n const index = allPokemon.flatMap((pkm) => [pkm.id, ...pkm.forms.map((form) => form)])\n writeDatasetFile(arrayUnique(index), 'indices/pokemon.json', false)\n return index\n}\n\nexport function loadAllPokemon(): Pkds.Pokemon[] {\n return cached('allPokemon', () => {\n const index = readIndexFile('pokemon')\n return joinPokemonFilesFromIndex(index)\n })\n}\n\nexport function loadAllGameSets(): Pkds.Game[] {\n return loadAllGames().filter((game) => {\n if (game.type === 'set') {\n return true\n }\n if (game.type === 'game' && !game.gameSet) {\n return true\n }\n return false\n })\n}\n\nexport function loadAllBoxPresets(\n variant: 'classic' | 'modern' = 'classic',\n): Array<Pkds.LegacyBoxPresetByGameset> {\n return cached(`allBoxPresets-${variant}`, () => {\n const filenames = loadAllGameSets().map((game) => game.id)\n return joinBoxPresetFilesFromIndex(filenames, variant)\n })\n}\n\nexport function loadAllGames(): Pkds.Game[] {\n return cached('allGames', () => {\n const index = readIndexFile('games')\n return joinGamesFilesFromIndex(index)\n })\n}\n\nexport function loadAllPokedexes(): Pkds.Pokedex[] {\n return cached('allPokedexes', () => {\n const index = readIndexFile('pokedexes')\n return joinPokedexesFilesFromIndex(index)\n })\n}\n\nexport function loadAllCharacters(): Pkds.Character[] {\n return charactersFs.all()\n}\n\nexport function loadAllItems(): Pkds.Item[] {\n return itemsFs.all()\n}\n\nexport function loadAllPokeballs(): Pkds.Pokeball[] {\n return pokeballsFs.all()\n}\n\nexport function loadAllAbilities(): Pkds.Ability[] {\n return abilitiesFs.all()\n}\n\nexport function loadAllMoves(): Pkds.Move[] {\n return movesFs.all()\n}\n\nexport function loadAllRibbons(): Pkds.Ribbon[] {\n return ribbonsFs.all()\n}\n\nexport function loadAllMarks(): Pkds.Mark[] {\n return marksFs.all()\n}\n\nexport function loadAllOriginMarks(): Pkds.OriginMark[] {\n return originMarksFs.all()\n}\n\nexport function loadAllTypes(): Pkds.Type[] {\n return typesFs.all()\n}\n\nexport function loadAllNatures(): Pkds.Nature[] {\n return naturesFs.all()\n}\n\nexport function loadAllPersonalities(): Pkds.Personality[] {\n return personalitiesFs.all()\n}\n\nexport function loadAllRegions(): Pkds.Region[] {\n return regionsFs.all()\n}\n\nexport function loadAllColors(): Pkds.Color[] {\n return colorsFs.all()\n}\n\nexport function loadAllLanguages(): Pkds.Language[] {\n return languagesFs.all()\n}\n\nexport function loadAllGenerations(): Pkds.Generation[] {\n return generationsFs.all()\n}\n"],"mappings":";;;;;;AAAA,IAAa,cAAb,MAAyB;CACvB,aAAqB;CAErB,YAAY,aAAqB,KAAW;EAC1C,KAAK,aAAa;CACpB;CAEA,yBAAuD,IAAI,IAAI;CAE/D,IAAO,KAA4B;EACjC,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;EACjC,IAAI,CAAC,OACH;EAEF,IAAI,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,YAAY,GAClD,OAAO,MAAM;EAEf,KAAK,OAAO,OAAO,GAAG;CAExB;CAEA,IAAI,KAAa,OAAY,MAAc,KAAK,YAAY;EAC1D,KAAK,OAAO,IAAI,KAAK;GAAE,SAAS,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI;GAAK;EAAM,CAAC;CAC3E;CAEA,OAAO,KAAa;EAClB,KAAK,OAAO,OAAO,GAAG;CACxB;CAEA,IAAI,KAAa;EACf,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;EACjC,OAAO,QAAQ,UAAU,MAAM,UAAU,KAAK,IAAI,KAAK,MAAM,YAAY,EAAE;CAC7E;CAEA,QAAQ;EACN,KAAK,OAAO,MAAM;CACpB;CAEA,OAAO;EACL,OAAO,MAAM,KAAK,KAAK,OAAO,KAAK,CAAC;CACtC;CAEA,SAAS;EACP,OAAO,MAAM,KAAK,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,MAAM,KAAK;CACpE;CAEA,UAAU;EACR,OAAO,MAAM,KAAK,KAAK,OAAO,QA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AAc,IAAI;AAC3B;AAEA,SAAgB,eAA4B;CAC1C,OAAO,QAAQ,IAAI;AACrB;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,uBAA2C;CACzD,OAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAgB,iBAAgC;CAC9C,OAAO,UAAU,IAAI;AACvB;AAEA,SAAgB,gBAA8B;CAC5C,OAAO,SAAS,IAAI;AACtB;AAEA,SAAgB,mBAAoC;CAClD,OAAO,YAAY,IAAI;AACzB;AAEA,SAAgB,qBAAwC;CACtD,OAAO,cAAc,IAAI;AAC3B"}
@@ -1,8 +1,8 @@
1
1
  //#region src/lib/languages.d.ts
2
- type SupportedPokeLang2Char = Exclude<Pkds.LanguageAlpha2, 'esla'>;
3
- type SupportedPokeLang3Char = Exclude<Pkds.LanguageAlpha3, 'esla'>;
4
- type SupportedPokeLang = SupportedPokeLang2Char | SupportedPokeLang3Char;
5
- type PokeLangData = {
2
+ export type SupportedPokeLang2Char = Exclude<Pkds.LanguageAlpha2, 'esla'>;
3
+ export type SupportedPokeLang3Char = Exclude<Pkds.LanguageAlpha3, 'esla'>;
4
+ export type SupportedPokeLang = SupportedPokeLang2Char | SupportedPokeLang3Char;
5
+ export type PokeLangData = {
6
6
  flag: string;
7
7
  code2Char: Pkds.LanguageAlpha2;
8
8
  code3Char: Pkds.LanguageAlpha3;
@@ -11,16 +11,15 @@ type PokeLangData = {
11
11
  fullTitle: string;
12
12
  synonyms: string[];
13
13
  };
14
- declare const pokeLangData: Record<`${SupportedPokeLang2Char}`, PokeLangData>;
15
- type PokemonGameLocaleData = {
14
+ export declare const pokeLangData: Record<`${SupportedPokeLang2Char}`, PokeLangData>;
15
+ export type PokemonGameLocaleData = {
16
16
  id: Pkds.LanguageInGameCode;
17
17
  name: string;
18
18
  };
19
- declare const pokemonGameLocales: Array<PokemonGameLocaleData>;
20
- declare const pokemonLangToGameLocale: Record<Pkds.LanguageAlpha2 | Pkds.LanguageAlpha3, Pkds.LanguageInGameCode>;
21
- declare const supportedPokeLangs: Record<SupportedPokeLang, PokeLangData>;
22
- declare const supportedPokeLangIds2Char: SupportedPokeLang2Char[];
23
- declare const supportedPokeLangIds3Char: SupportedPokeLang3Char[];
19
+ export declare const pokemonGameLocales: Array<PokemonGameLocaleData>;
20
+ export declare const pokemonLangToGameLocale: Record<Pkds.LanguageAlpha2 | Pkds.LanguageAlpha3, Pkds.LanguageInGameCode>;
21
+ export declare const supportedPokeLangs: Record<SupportedPokeLang, PokeLangData>;
22
+ export declare const supportedPokeLangIds2Char: SupportedPokeLang2Char[];
23
+ export declare const supportedPokeLangIds3Char: SupportedPokeLang3Char[];
24
24
  //#endregion
25
- export { PokeLangData, PokemonGameLocaleData, SupportedPokeLang, SupportedPokeLang2Char, SupportedPokeLang3Char, pokeLangData, pokemonGameLocales, pokemonLangToGameLocale, supportedPokeLangIds2Char, supportedPokeLangIds3Char, supportedPokeLangs };
26
25
  //# sourceMappingURL=languages.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"languages.d.mts","names":[],"sources":["../../src/lib/languages.ts"],"mappings":";KAAY,sBAAA,GAAyB,OAAO,CAAC,IAAA,CAAK,cAAA;AAAA,KACtC,sBAAA,GAAyB,OAAO,CAAC,IAAA,CAAK,cAAA;AAAA,KACtC,iBAAA,GAAoB,sBAAA,GAAyB,sBAAsB;AAAA,KAEnE,YAAA;EACV,IAAA;EACA,SAAA,EAAW,IAAA,CAAK,cAAA;EAChB,SAAA,EAAW,IAAA,CAAK,cAAc;EAC9B,MAAA;EACA,KAAA;EACA,SAAA;EACA,QAAA;AAAA;AAAA,cAGW,YAAA,EAAc,MAAA,IAAU,sBAAA,IAA0B,YAAA;AAAA,KA6FnD,qBAAA;EACV,EAAA,EAAI,IAAA,CAAK,kBAAkB;EAC3B,IAAA;AAAA;AAAA,cAGW,kBAAA,EAAoB,KAAK,CAAC,qBAAA;AAAA,cAc1B,uBAAA,EAAyB,MAAA,CACpC,IAAA,CAAK,cAAA,GAAiB,IAAA,CAAK,cAAA,EAC3B,IAAA,CAAK,kBAAA;AAAA,cAuBM,kBAAA,EAAoB,MAAA,CAAO,iBAAA,EAAmB,YAAA;AAAA,cAqB9C,yBAAA,EAA2B,sBAAsB;AAAA,cAajD,yBAAA,EAA2B,sBAAsB"}
1
+ {"version":3,"file":"languages.d.mts","names":[],"sources":["../../src/lib/languages.ts"],"mappings":";YAAY,yBAAyB,QAAQ,KAAK;YACtC,yBAAyB,QAAQ,KAAK;YACtC,oBAAoB,yBAAyB;YAE7C;EACV;EACA,WAAW,KAAK;EAChB,WAAW,KAAK;EAChB;EACA;EACA;EACA;;qBAGW,cAAc,UAAU,0BAA0B;YA6FnD;EACV,IAAI,KAAK;EACT;;qBAGW,oBAAoB,MAAM;qBAc1B,yBAAyB,OACpC,KAAK,iBAAiB,KAAK,gBAC3B,KAAK;qBAuBM,oBAAoB,OAAO,mBAAmB;qBAqB9C,2BAA2B;qBAa3B,2BAA2B"}