@pokepc/dataset 6.5.1 → 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.
- package/build/{box-preset-sanitizer-GjGde3eW.mjs → box-preset-sanitizer-DHGv5TJj.mjs} +2 -2
- package/build/{box-preset-sanitizer-GjGde3eW.mjs.map → box-preset-sanitizer-DHGv5TJj.mjs.map} +1 -1
- package/build/box-preset-sanitizer-kg68JZPB.d.mts.map +1 -1
- package/build/{build-DeFbpXmN.mjs → build-DvGzwIK8.mjs} +74 -17
- package/build/build-DvGzwIK8.mjs.map +1 -0
- package/build/{build-DlK17pH-.mjs → build-bE_0_-0H.mjs} +16 -15
- package/build/build-bE_0_-0H.mjs.map +1 -0
- package/build/enums-CCbmORM6.d.mts.map +1 -1
- package/build/lib/box-preset-sanitizer.mjs +1 -1
- package/build/lib/box-preset-transform.d.mts +4 -6
- package/build/lib/box-preset-transform.d.mts.map +1 -1
- package/build/lib/box-preset-transform.mjs +2 -2
- package/build/lib/constants.d.mts +3 -4
- package/build/lib/constants.d.mts.map +1 -1
- package/build/lib/fs.d.mts +52 -53
- package/build/lib/fs.d.mts.map +1 -1
- package/build/lib/fs.mjs +3 -3
- package/build/lib/fs.mjs.map +1 -1
- package/build/lib/languages.d.mts +11 -12
- package/build/lib/languages.d.mts.map +1 -1
- package/build/lib/schemas.d.mts +1 -1
- package/build/lib/schemas.mjs +1 -1
- package/build/lib/search.d.mts +2 -3
- package/build/lib/search.d.mts.map +1 -1
- package/build/lib/search.mjs.map +1 -1
- package/build/lib/types.d.mts +34 -34
- package/build/lib/types.d.mts.map +1 -1
- package/build/lib/utils.d.mts +16 -17
- package/build/lib/utils.d.mts.map +1 -1
- package/build/lib/validators.d.mts +1 -1
- package/build/lib-next/_build.d.mts +1 -1
- package/build/lib-next/_build.mjs +2 -2
- package/build/lib-next/enums.d.mts +41 -42
- package/build/lib-next/enums.d.mts.map +1 -1
- package/build/lib-next/fs.d.mts +3 -4
- package/build/lib-next/fs.d.mts.map +1 -1
- package/build/lib-next/languages.d.mts +17 -18
- package/build/lib-next/languages.d.mts.map +1 -1
- package/build/lib-next/schemas.d.mts +230 -232
- package/build/lib-next/schemas.d.mts.map +1 -1
- package/build/lib-next/schemas.mjs +1 -1
- package/build/schemas-Bj1AIX0P.mjs +93 -0
- package/build/schemas-Bj1AIX0P.mjs.map +1 -0
- package/build/schemas-CcUqoHNr.mjs +349 -0
- package/build/schemas-CcUqoHNr.mjs.map +1 -0
- package/build/schemas-DZQWOWP4.d.mts +804 -0
- package/build/schemas-DZQWOWP4.d.mts.map +1 -0
- package/build/utils-BwovRocd.mjs.map +1 -1
- package/data/abilities.json +9 -0
- package/data/games/champions.json +5 -1
- package/data/games/pokopia-bubblybasin.json +42 -0
- package/data/games/pokopia.json +1 -1
- package/data/indices/games.json +1 -0
- package/data/indices/pokedexes.json +3 -1
- package/data/pokedexes/champions-regular-roster-m-b.json +3 -0
- package/data/pokedexes/champions-regular-roster-m-c.json +464 -0
- package/data/pokedexes/paldea-kitakami.json +0 -2
- package/data/pokedexes/pokopia-basin.json +63 -0
- package/data/pokedexes/pokopia-event.json +6 -2
- package/data/pokemon/absol-mega-z.json +1 -3
- package/data/pokemon/baxcalibur.json +1 -1
- package/data/pokemon/garchomp-mega-z.json +2 -2
- package/data/pokemon/golisopod.json +12 -1
- package/data/pokemon/lucario-mega-z.json +1 -3
- package/data/pokemon/pyroar-f.json +7 -2
- package/data/pokemon/pyroar.json +2 -1
- package/data/pokemon/rillaboom.json +1 -1
- package/data/pokemon/salamence.json +2 -1
- package/data-next/champions/abilities.json +10 -0
- package/data-next/champions/i18n/chs/abilities.json +7 -0
- package/data-next/champions/i18n/cht/abilities.json +7 -0
- package/data-next/champions/i18n/deu/abilities.json +7 -0
- package/data-next/champions/i18n/eng/abilities.json +7 -0
- package/data-next/champions/i18n/es-es/abilities.json +7 -0
- package/data-next/champions/i18n/es-la/abilities.json +7 -0
- package/data-next/champions/i18n/fra/abilities.json +7 -0
- package/data-next/champions/i18n/ita/abilities.json +7 -0
- package/data-next/champions/i18n/jpn/abilities.json +7 -0
- package/data-next/champions/i18n/kor/abilities.json +7 -0
- package/data-next/champions/i18n/pt-br/abilities.json +7 -0
- package/data-next/champions/items.json +34 -0
- package/data-next/champions/moves.json +1 -0
- package/package.json +10 -10
- package/build/build-DeFbpXmN.mjs.map +0 -1
- package/build/build-DlK17pH-.mjs.map +0 -1
- package/build/schemas-B4fI9u0f.mjs +0 -93
- package/build/schemas-B4fI9u0f.mjs.map +0 -1
- package/build/schemas-BCuqOH_X.d.mts +0 -805
- package/build/schemas-BCuqOH_X.d.mts.map +0 -1
- package/build/schemas-Dt7FbAMy.mjs +0 -349
- package/build/schemas-Dt7FbAMy.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-DlK17pH-.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\n if (index.byId.has(idKey)) {\n throw new Error(`Duplicate PokeAPI ${kind} resource id: ${idKey}`)\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 throw new Error(\n `Duplicate PokeAPI ${kind} resource lookup key ${nameKey}: ${existingEntry.name}, ${resource.name}`,\n )\n }\n\n index.byName.set(nameKey, entry)\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(formatMissingPokeApiResourcesError(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 formatMissingPokeApiResourcesError(result: EnrichChampionsDataResult): string {\n const lines = ['Missing PokeAPI resources; no Champions JSON files were written.']\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,MAAM,OAAO;CACzD,MAAM,QAA8B;EAClC,sBAAM,IAAI,IAAI;EACd,wBAAQ,IAAI,IAAI;CAClB;CAEA,KAAK,MAAM,YAAY,KAAK,SAAS;EACnC,MAAM,KAAK,uBAAuB,SAAS,KAAK,IAAI;EACpD,MAAM,QAAQ;GAAE;GAAI,MAAM,SAAS;EAAK;EACxC,MAAM,QAAQ,OAAO,EAAE;EAEvB,IAAI,MAAM,K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,+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,93 +0,0 @@
|
|
|
1
|
-
import { c as itemCategories, d as moveClasses, f as moveTargets, h as pokemonTypes, n as battleStates, u as moveCategories } from "./enums-DlMg7WLl.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region src/lib-next/schemas.ts
|
|
4
|
-
const slugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
5
|
-
const baseSchema = z.object({
|
|
6
|
-
id: z.string(),
|
|
7
|
-
slug: slugSchema,
|
|
8
|
-
name: z.string(),
|
|
9
|
-
description: z.string()
|
|
10
|
-
});
|
|
11
|
-
const championsLinkedBaseSchema = z.object({
|
|
12
|
-
id: slugSchema,
|
|
13
|
-
championsId: z.string(),
|
|
14
|
-
pokeApiId: z.number().int().positive().optional(),
|
|
15
|
-
slug: slugSchema,
|
|
16
|
-
name: z.string(),
|
|
17
|
-
description: z.string()
|
|
18
|
-
});
|
|
19
|
-
const i18nSchema = z.object({
|
|
20
|
-
id: z.string(),
|
|
21
|
-
slug: slugSchema,
|
|
22
|
-
slugLoc: slugSchema,
|
|
23
|
-
name: z.string(),
|
|
24
|
-
description: z.string()
|
|
25
|
-
});
|
|
26
|
-
const i18nRecordsSchema = z.array(i18nSchema);
|
|
27
|
-
const itemI18nSchema = i18nSchema.extend({ pluralName: z.string() });
|
|
28
|
-
const itemI18nRecordsSchema = z.array(itemI18nSchema);
|
|
29
|
-
const moveSchema = championsLinkedBaseSchema.extend({
|
|
30
|
-
type: z.enum(pokemonTypes),
|
|
31
|
-
category: z.enum(moveCategories),
|
|
32
|
-
power: z.number().min(0).max(999),
|
|
33
|
-
pp: z.number().min(0).max(99),
|
|
34
|
-
accuracy: z.number().min(0).max(101),
|
|
35
|
-
priority: z.number().min(-10).max(10),
|
|
36
|
-
target: z.enum(moveTargets),
|
|
37
|
-
classification: z.array(z.enum(moveClasses)),
|
|
38
|
-
contact: z.boolean(),
|
|
39
|
-
usable: z.boolean()
|
|
40
|
-
});
|
|
41
|
-
const movesSchema = z.array(moveSchema);
|
|
42
|
-
const abilitySchema = championsLinkedBaseSchema.extend({});
|
|
43
|
-
const abilitiesSchema = z.array(abilitySchema);
|
|
44
|
-
const itemSchema = championsLinkedBaseSchema.extend({
|
|
45
|
-
pluralName: z.string(),
|
|
46
|
-
categories: z.array(z.enum(itemCategories))
|
|
47
|
-
});
|
|
48
|
-
const itemsSchema = z.array(itemSchema);
|
|
49
|
-
const battleStateSchema = baseSchema.extend({ state: z.enum(battleStates) });
|
|
50
|
-
const battleStatesSchema = z.array(battleStateSchema);
|
|
51
|
-
const pokemonSchema = z.object({
|
|
52
|
-
id: slugSchema,
|
|
53
|
-
nid: slugSchema,
|
|
54
|
-
name: z.string(),
|
|
55
|
-
formName: z.string().optional(),
|
|
56
|
-
pokeApiId: z.number().int().positive(),
|
|
57
|
-
pokeApiFormId: z.number().int().positive().optional(),
|
|
58
|
-
showdownId: z.string(),
|
|
59
|
-
baseSpecies: slugSchema.optional(),
|
|
60
|
-
championsId: z.string().regex(/^\d{7}$/),
|
|
61
|
-
type1: z.enum(pokemonTypes),
|
|
62
|
-
type2: z.enum(pokemonTypes).nullable(),
|
|
63
|
-
abilities: z.array(slugSchema),
|
|
64
|
-
baseHp: z.number().int().min(1),
|
|
65
|
-
baseAtk: z.number().int().min(1),
|
|
66
|
-
baseDef: z.number().int().min(1),
|
|
67
|
-
baseSpAtk: z.number().int().min(1),
|
|
68
|
-
baseSpDef: z.number().int().min(1),
|
|
69
|
-
baseSpeed: z.number().int().min(1),
|
|
70
|
-
height: z.number().int().min(-1),
|
|
71
|
-
weight: z.number().int().min(-1),
|
|
72
|
-
isForm: z.boolean(),
|
|
73
|
-
isBattleOnly: z.boolean(),
|
|
74
|
-
isCosmetic: z.boolean(),
|
|
75
|
-
isFemale: z.boolean()
|
|
76
|
-
});
|
|
77
|
-
const pokemonListSchema = z.array(pokemonSchema);
|
|
78
|
-
const pokemonI18nSchema = z.object({
|
|
79
|
-
id: slugSchema,
|
|
80
|
-
championsId: z.string().regex(/^\d{7}$/),
|
|
81
|
-
name: z.string(),
|
|
82
|
-
formName: z.string().optional()
|
|
83
|
-
});
|
|
84
|
-
const pokemonI18nRecordsSchema = z.array(pokemonI18nSchema);
|
|
85
|
-
const pokemonMovesRecordSchema = z.object({
|
|
86
|
-
id: slugSchema,
|
|
87
|
-
moves: z.array(slugSchema)
|
|
88
|
-
});
|
|
89
|
-
const pokemonMovesSchema = z.array(pokemonMovesRecordSchema);
|
|
90
|
-
//#endregion
|
|
91
|
-
export { pokemonListSchema as _, battleStatesSchema as a, pokemonSchema as b, i18nSchema as c, itemSchema as d, itemsSchema as f, pokemonI18nSchema as g, pokemonI18nRecordsSchema as h, battleStateSchema as i, itemI18nRecordsSchema as l, movesSchema as m, abilitySchema as n, championsLinkedBaseSchema as o, moveSchema as p, baseSchema as r, i18nRecordsSchema as s, abilitiesSchema as t, itemI18nSchema as u, pokemonMovesRecordSchema as v, slugSchema as x, pokemonMovesSchema as y };
|
|
92
|
-
|
|
93
|
-
//# sourceMappingURL=schemas-B4fI9u0f.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas-B4fI9u0f.mjs","names":[],"sources":["../src/lib-next/schemas.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n battleStates,\n itemCategories,\n moveCategories,\n moveClasses,\n moveTargets,\n pokemonTypes,\n} from './enums'\n\nexport const slugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)\n\nexport const baseSchema = z.object({\n id: z.string(),\n slug: slugSchema,\n name: z.string(),\n description: z.string(),\n})\n\nexport const championsLinkedBaseSchema = z.object({\n id: slugSchema,\n championsId: z.string(),\n pokeApiId: z.number().int().positive().optional(),\n slug: slugSchema,\n name: z.string(),\n description: z.string(),\n})\n\nexport const i18nSchema = z.object({\n id: z.string(),\n slug: slugSchema,\n slugLoc: slugSchema,\n name: z.string(),\n description: z.string(), // description template, with placeholders like `{0}`\n})\nexport type I18nRecord = z.infer<typeof i18nSchema>\nexport const i18nRecordsSchema = z.array(i18nSchema)\nexport type I18nRecords = z.infer<typeof i18nRecordsSchema>\n\nexport const itemI18nSchema = i18nSchema.extend({\n pluralName: z.string(),\n})\nexport type ItemI18nRecord = z.infer<typeof itemI18nSchema>\nexport const itemI18nRecordsSchema = z.array(itemI18nSchema)\nexport type ItemI18nRecords = z.infer<typeof itemI18nRecordsSchema>\n\nexport const moveSchema = championsLinkedBaseSchema.extend({\n type: z.enum(pokemonTypes),\n category: z.enum(moveCategories),\n power: z.number().min(0).max(999),\n pp: z.number().min(0).max(99),\n accuracy: z.number().min(0).max(101),\n priority: z.number().min(-10).max(10),\n target: z.enum(moveTargets),\n classification: z.array(z.enum(moveClasses)),\n contact: z.boolean(), // if its a direct contact move or not\n usable: z.boolean(), // if the game allows you to use it or not (e.g. legacy)\n})\nexport type MoveRecord = z.infer<typeof moveSchema>\nexport const movesSchema = z.array(moveSchema)\nexport type MoveRecords = z.infer<typeof movesSchema>\n\nexport const abilitySchema = championsLinkedBaseSchema.extend({})\nexport type AbilityRecord = z.infer<typeof abilitySchema>\nexport const abilitiesSchema = z.array(abilitySchema)\nexport type AbilityRecords = z.infer<typeof abilitiesSchema>\n\nexport const itemSchema = championsLinkedBaseSchema.extend({\n pluralName: z.string(),\n categories: z.array(z.enum(itemCategories)),\n})\nexport type ItemRecord = z.infer<typeof itemSchema>\nexport const itemsSchema = z.array(itemSchema)\nexport type ItemRecords = z.infer<typeof itemsSchema>\n\nexport const battleStateSchema = baseSchema.extend({\n state: z.enum(battleStates),\n})\nexport type BattleStateRecord = z.infer<typeof battleStateSchema>\nexport const battleStatesSchema = z.array(battleStateSchema)\nexport type BattleStateRecords = z.infer<typeof battleStatesSchema>\n\nexport const pokemonSchema = z.object({\n id: slugSchema,\n nid: slugSchema,\n name: z.string(),\n formName: z.string().optional(),\n pokeApiId: z.number().int().positive(),\n pokeApiFormId: z.number().int().positive().optional(),\n showdownId: z.string(),\n baseSpecies: slugSchema.optional(),\n championsId: z.string().regex(/^\\d{7}$/),\n type1: z.enum(pokemonTypes),\n type2: z.enum(pokemonTypes).nullable(),\n abilities: z.array(slugSchema),\n baseHp: z.number().int().min(1),\n baseAtk: z.number().int().min(1),\n baseDef: z.number().int().min(1),\n baseSpAtk: z.number().int().min(1),\n baseSpDef: z.number().int().min(1),\n baseSpeed: z.number().int().min(1),\n height: z.number().int().min(-1),\n weight: z.number().int().min(-1),\n isForm: z.boolean(),\n isBattleOnly: z.boolean(),\n isCosmetic: z.boolean(),\n isFemale: z.boolean(),\n})\nexport type PokemonRecord = z.infer<typeof pokemonSchema>\nexport const pokemonListSchema = z.array(pokemonSchema)\nexport type PokemonRecords = z.infer<typeof pokemonListSchema>\n\nexport const pokemonI18nSchema = z.object({\n id: slugSchema,\n championsId: z.string().regex(/^\\d{7}$/),\n name: z.string(),\n formName: z.string().optional(),\n})\nexport type PokemonI18nRecord = z.infer<typeof pokemonI18nSchema>\nexport const pokemonI18nRecordsSchema = z.array(pokemonI18nSchema)\nexport type PokemonI18nRecords = z.infer<typeof pokemonI18nRecordsSchema>\n\nexport const pokemonMovesRecordSchema = z.object({\n id: slugSchema,\n moves: z.array(slugSchema),\n})\nexport type PokemonMovesRecord = z.infer<typeof pokemonMovesRecordSchema>\n\nexport const pokemonMovesSchema = z.array(pokemonMovesRecordSchema)\nexport type PokemonMovesRecords = z.infer<typeof pokemonMovesSchema>\n"],"mappings":";;;AAUA,MAAa,aAAa,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