@bison-lab/payload-core 4.40.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -4
- package/dist/admin.d.mts +21 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +270 -5
- package/dist/admin.mjs.map +1 -1
- package/dist/{capability-DdnN7AHB.mjs → capability-Cb62lWQo.mjs} +1392 -32
- package/dist/capability-Cb62lWQo.mjs.map +1 -0
- package/dist/{capability-BVDhJV8A.d.mts → capability-Dotbq58Q.d.mts} +85 -9
- package/dist/capability-Dotbq58Q.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/locale-B6rUVwpg.mjs.map +1 -1
- package/dist/{locale-5z7KTvRJ.d.mts → locale-CTT3nn6T.d.mts} +5 -4
- package/dist/locale-CTT3nn6T.d.mts.map +1 -0
- package/dist/{messages-Bk1uYO3o.mjs → messages-dZV_aAnR.mjs} +2 -2
- package/dist/{messages-Bk1uYO3o.mjs.map → messages-dZV_aAnR.mjs.map} +1 -1
- package/dist/navigation.d.mts +2 -2
- package/dist/og.d.mts +1 -1
- package/dist/{published-CY5PIy5W.d.mts → published-B3etM6X5.d.mts} +2 -2
- package/dist/{published-CY5PIy5W.d.mts.map → published-B3etM6X5.d.mts.map} +1 -1
- package/dist/{published-BC8kg47c.d.mts → published-QDNmDi02.d.mts} +2 -2
- package/dist/{published-BC8kg47c.d.mts.map → published-QDNmDi02.d.mts.map} +1 -1
- package/dist/{strings-Bafwdg67.mjs → strings-Fd7kUCT7.mjs} +4 -4
- package/dist/strings-Fd7kUCT7.mjs.map +1 -0
- package/dist/theme.d.mts +2 -2
- package/dist/translate-messages-cli.mjs +3 -3
- package/dist/translate-messages-cli.mjs.map +1 -1
- package/dist/translate.d.mts +366 -6
- package/dist/translate.d.mts.map +1 -1
- package/dist/translate.mjs +238 -5
- package/dist/translate.mjs.map +1 -1
- package/package.json +8 -10
- package/dist/capability-BVDhJV8A.d.mts.map +0 -1
- package/dist/capability-DdnN7AHB.mjs.map +0 -1
- package/dist/locale-5z7KTvRJ.d.mts.map +0 -1
- package/dist/strings-Bafwdg67.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translate-messages-cli.mjs","names":[],"sources":["../src/translate/messages-cli.ts","../src/translate-messages-cli.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { basename, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { anthropicTranslator } from \"./anthropic\";\nimport { fillMessages, type MessagesJson } from \"./messages\";\nimport type { TranslateSite, Translator } from \"./types\";\n\nexport const TRANSLATE_MESSAGES_USAGE = `Usage: bison-translate-messages --source <en.json> --out <es.json> [--force]\n [--from <code>] [--to <code>] [--language <name>] [--site-name <name>] [--about <line>]\n [--voice <words>] [--keep <a,b,c>] [--context <hint>]\n\n--language names the --to locale in the prompt, as the plugin's\nsite.languages does (\"Latin American Spanish\"), so message files and CMS\ncopy get the same dialect.\n\nFills keys that are missing or empty in --out from --source. --force\nre-translates every key. Reads ANTHROPIC_API_KEY (and the optional\nANTHROPIC_TRANSLATE_MODEL) from the environment, .env.local or .env.`;\n\ninterface CliDeps {\n env: Record<string, string | undefined>;\n log: (line: string) => void;\n error: (line: string) => void;\n /** Overrides the Anthropic translator (tests). */\n translator?: Translator;\n}\n\n/** Locale code from a message file name: `src/messages/es.json` is `es`. */\nconst codeOf = (path: string) => basename(path).replace(/\\.json$/i, \"\");\n\n/**\n * The `bison-translate-messages` run, as a function: returns the exit code.\n * Writes the target only after every batch has run. A batch that fails (or a\n * translation that loses a `{placeholder}`) keeps the source text, so the\n * file stays complete, and the run exits 1 and says how to redo those keys.\n */\nexport async function runTranslateMessagesCli(argv: string[], deps: CliDeps): Promise<number> {\n let values: Record<string, string | boolean | undefined>;\n try {\n ({ values } = parseArgs({\n args: argv,\n options: {\n source: { type: \"string\" },\n out: { type: \"string\" },\n force: { type: \"boolean\", default: false },\n from: { type: \"string\" },\n to: { type: \"string\" },\n language: { type: \"string\" },\n \"site-name\": { type: \"string\" },\n about: { type: \"string\" },\n voice: { type: \"string\" },\n keep: { type: \"string\" },\n context: { type: \"string\" },\n help: { type: \"boolean\", default: false },\n },\n }));\n } catch (error) {\n deps.error(`${(error as Error).message}\\n\\n${TRANSLATE_MESSAGES_USAGE}`);\n return 2;\n }\n if (values.help) {\n deps.log(TRANSLATE_MESSAGES_USAGE);\n return 0;\n }\n const sourcePath = typeof values.source === \"string\" ? resolve(values.source) : undefined;\n const outPath = typeof values.out === \"string\" ? resolve(values.out) : undefined;\n if (!sourcePath || !outPath) {\n deps.error(TRANSLATE_MESSAGES_USAGE);\n return 2;\n }\n\n const siteName = typeof values[\"site-name\"] === \"string\" ? values[\"site-name\"] : undefined;\n const to = typeof values.to === \"string\" ? values.to : codeOf(outPath);\n const language = typeof values.language === \"string\" && values.language ? values.language : undefined;\n const site: TranslateSite | undefined =\n siteName || language\n ? {\n name: siteName ?? \"\",\n ...(language ? { languages: { [to]: language } } : {}),\n ...(typeof values.about === \"string\" ? { about: values.about } : {}),\n ...(typeof values.voice === \"string\" ? { voice: values.voice } : {}),\n ...(typeof values.keep === \"string\"\n ? {\n keepVerbatim: values.keep\n .split(\",\")\n .map((word) => word.trim())\n .filter(Boolean),\n }\n : {}),\n }\n : undefined;\n const translator =\n deps.translator ??\n anthropicTranslator({ apiKey: deps.env.ANTHROPIC_API_KEY, model: deps.env.ANTHROPIC_TRANSLATE_MODEL });\n if (translator.configured === false) {\n deps.error(\"ANTHROPIC_API_KEY is not set. Add it to .env.local and retry.\");\n return 1;\n }\n\n const source = JSON.parse(readFileSync(sourcePath, \"utf8\")) as MessagesJson;\n const target =\n !values.force && existsSync(outPath) ? (JSON.parse(readFileSync(outPath, \"utf8\")) as MessagesJson) : undefined;\n const from = typeof values.from === \"string\" ? values.from : codeOf(sourcePath);\n\n const result = await fillMessages({\n source,\n ...(target !== undefined ? { target } : {}),\n translator,\n from,\n to,\n force: values.force === true,\n ...(typeof values.context === \"string\" ? { context: values.context } : {}),\n ...(site ? { site } : {}),\n onProgress: (done, total) => deps.log(` ${done}/${total}`),\n });\n if (result.translated === 0 && result.fellBack === 0) {\n deps.log(`${basename(outPath)} is already complete. Nothing to translate.`);\n return 0;\n }\n writeFileSync(outPath, `${JSON.stringify(result.messages, null, 2)}\\n`, \"utf8\");\n deps.log(`Wrote ${outPath} (${result.translated} key(s) translated). Review the diff before committing.`);\n if (result.fellBack > 0) {\n // The keys are now filled (so a plain re-run will skip them); say exactly\n // how to redo them once the transient issue is resolved.\n deps.error(\n `${result.fellBack} key(s) kept the ${from} text because a batch failed or a {placeholder} was lost. ` +\n \"They are not missing anymore, so a plain re-run skips them: re-run with --force, or edit them by hand.\",\n );\n return 1;\n }\n return 0;\n}\n\n/** Loads `.env.local` then `.env` from the working directory, never overriding a set variable. */\nexport function loadEnvFiles(cwd: string): void {\n const load = (process as unknown as { loadEnvFile?: (path: string) => void }).loadEnvFile;\n if (!load) return;\n for (const name of [\".env.local\", \".env\"]) {\n const path = resolve(cwd, name);\n if (!existsSync(path)) continue;\n const before = { ...process.env };\n try {\n load(path);\n } catch {\n continue;\n }\n // loadEnvFile overrides; restore anything that was already set.\n for (const [key, value] of Object.entries(before)) process.env[key] = value;\n }\n}\n","#!/usr/bin/env node\n/**\n * `bison-translate-messages`: fills a next-intl message file from the source\n * locale's file with the Anthropic translator. Run it from the site, which\n * installs `@anthropic-ai/sdk` (an optional peer of this package).\n *\n * bison-translate-messages --source src/messages/en.json --out src/messages/es.json\n * bison-translate-messages --source src/messages/en.json --out src/messages/es.json --force\n *\n * Only keys missing or empty in --out are translated unless --force is\n * passed. --site-name, --about, --voice and --keep (comma list) carry the\n * site's prompt facts. The key is read from ANTHROPIC_API_KEY (the\n * environment, `.env.local` or `.env`), never from arguments.\n */\nimport { loadEnvFiles, runTranslateMessagesCli } from \"./translate/messages-cli\";\n\nloadEnvFiles(process.cwd());\nconst code = await runTranslateMessagesCli(process.argv.slice(2), {\n env: process.env,\n log: (line) => console.log(line),\n error: (line) => console.error(line),\n});\nprocess.exit(code);\n"],"mappings":";;;;;;;AAQA,MAAa,2BAA2B;;;;;;;;;;;;AAqBxC,MAAM,UAAU,SAAiB,SAAS,KAAK,CAAC,QAAQ,YAAY,GAAG;;;;;;;AAQvE,eAAsB,wBAAwB,MAAgB,MAAgC;CAC5F,IAAI;AACJ,KAAI;AACF,GAAC,CAAE,UAAW,UAAU;GACtB,MAAM;GACN,SAAS;IACP,QAAQ,EAAE,MAAM,UAAU;IAC1B,KAAK,EAAE,MAAM,UAAU;IACvB,OAAO;KAAE,MAAM;KAAW,SAAS;KAAO;IAC1C,MAAM,EAAE,MAAM,UAAU;IACxB,IAAI,EAAE,MAAM,UAAU;IACtB,UAAU,EAAE,MAAM,UAAU;IAC5B,aAAa,EAAE,MAAM,UAAU;IAC/B,OAAO,EAAE,MAAM,UAAU;IACzB,OAAO,EAAE,MAAM,UAAU;IACzB,MAAM,EAAE,MAAM,UAAU;IACxB,SAAS,EAAE,MAAM,UAAU;IAC3B,MAAM;KAAE,MAAM;KAAW,SAAS;KAAO;IAC1C;GACF,CAAC;UACK,OAAO;AACd,OAAK,MAAM,GAAI,MAAgB,QAAQ,MAAM,2BAA2B;AACxE,SAAO;;AAET,KAAI,OAAO,MAAM;AACf,OAAK,IAAI,yBAAyB;AAClC,SAAO;;CAET,MAAM,aAAa,OAAO,OAAO,WAAW,WAAW,QAAQ,OAAO,OAAO,GAAG,KAAA;CAChF,MAAM,UAAU,OAAO,OAAO,QAAQ,WAAW,QAAQ,OAAO,IAAI,GAAG,KAAA;AACvE,KAAI,CAAC,cAAc,CAAC,SAAS;AAC3B,OAAK,MAAM,yBAAyB;AACpC,SAAO;;CAGT,MAAM,WAAW,OAAO,OAAO,iBAAiB,WAAW,OAAO,eAAe,KAAA;CACjF,MAAM,KAAK,OAAO,OAAO,OAAO,WAAW,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ACF,KAAI,OAAO,eAAe,KAAK,OAAO,aAAa,GAAG;AACpD,OAAK,IAAI,GAAG,SAAS,QAAQ,CAAC,6CAA6C;AAC3E,SAAO;;AAET,eAAc,SAAS,GAAG,KAAK,UAAU,OAAO,UAAU,MAAM,EAAE,CAAC,KAAK,OAAO;AAC/E,MAAK,IAAI,SAAS,QAAQ,IAAI,OAAO,WAAW,yDAAyD;AACzG,KAAI,OAAO,WAAW,GAAG;AAGvB,OAAK,MACH,GAAG,OAAO,SAAS,mBAAmB,KAAK,kKAE5C;AACD,SAAO;;AAET,QAAO;;;AAIT,SAAgB,aAAa,KAAmB;CAC9C,MAAM,OAAQ,QAAgE;AAC9E,KAAI,CAAC,KAAM;AACX,MAAK,MAAM,QAAQ,CAAC,cAAc,OAAO,EAAE;EACzC,MAAM,OAAO,QAAQ,KAAK,KAAK;AAC/B,MAAI,CAAC,WAAW,KAAK,CAAE;EACvB,MAAM,SAAS,EAAE,GAAG,QAAQ,KAAK;AACjC,MAAI;AACF,QAAK,KAAK;UACJ;AACN;;AAGF,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAAE,SAAQ,IAAI,OAAO;;;;;;;;;;;;;;;;;;ACpI1E,aAAa,QAAQ,KAAK,CAAC;AAC3B,MAAM,OAAO,MAAM,wBAAwB,QAAQ,KAAK,MAAM,EAAE,EAAE;CAChE,KAAK,QAAQ;CACb,MAAM,SAAS,QAAQ,IAAI,KAAK;CAChC,QAAQ,SAAS,QAAQ,MAAM,KAAK;CACrC,CAAC;AACF,QAAQ,KAAK,KAAK"}
|
|
1
|
+
{"version":3,"file":"translate-messages-cli.mjs","names":[],"sources":["../src/translate/messages-cli.ts","../src/translate-messages-cli.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { basename, resolve } from \"node:path\";\nimport { parseArgs } from \"node:util\";\n\nimport { anthropicTranslator } from \"./anthropic\";\nimport { fillMessages, type MessagesJson } from \"./messages\";\nimport type { TranslateSite, Translator } from \"./types\";\n\nexport const TRANSLATE_MESSAGES_USAGE = `Usage: bison-translate-messages --source <en.json> --out <es.json> [--force]\n [--from <code>] [--to <code>] [--language <name>] [--site-name <name>] [--about <line>]\n [--voice <words>] [--keep <a,b,c>] [--context <hint>]\n\n--language names the --to locale in the prompt, as the plugin's\nsite.languages does (\"Latin American Spanish\"), so message files and CMS\ncopy get the same dialect.\n\nFills keys that are missing or empty in --out from --source. --force\nre-translates every key. Reads ANTHROPIC_API_KEY (and the optional\nANTHROPIC_TRANSLATE_MODEL) from the environment, .env.local or .env.`;\n\ninterface CliDeps {\n env: Record<string, string | undefined>;\n log: (line: string) => void;\n error: (line: string) => void;\n /** Overrides the Anthropic translator (tests). */\n translator?: Translator;\n}\n\n/** Locale code from a message file name: `src/messages/es.json` is `es`. */\nconst codeOf = (path: string) => basename(path).replace(/\\.json$/i, \"\");\n\n/**\n * The `bison-translate-messages` run, as a function: returns the exit code.\n * Writes the target only after every batch has run. A batch that fails (or a\n * translation that loses a `{placeholder}`) keeps the source text, so the\n * file stays complete, and the run exits 1 and says how to redo those keys.\n */\nexport async function runTranslateMessagesCli(argv: string[], deps: CliDeps): Promise<number> {\n let values: Record<string, string | boolean | undefined>;\n try {\n ({ values } = parseArgs({\n args: argv,\n options: {\n source: { type: \"string\" },\n out: { type: \"string\" },\n force: { type: \"boolean\", default: false },\n from: { type: \"string\" },\n to: { type: \"string\" },\n language: { type: \"string\" },\n \"site-name\": { type: \"string\" },\n about: { type: \"string\" },\n voice: { type: \"string\" },\n keep: { type: \"string\" },\n context: { type: \"string\" },\n help: { type: \"boolean\", default: false },\n },\n }));\n } catch (error) {\n deps.error(`${(error as Error).message}\\n\\n${TRANSLATE_MESSAGES_USAGE}`);\n return 2;\n }\n if (values.help) {\n deps.log(TRANSLATE_MESSAGES_USAGE);\n return 0;\n }\n const sourcePath = typeof values.source === \"string\" ? resolve(values.source) : undefined;\n const outPath = typeof values.out === \"string\" ? resolve(values.out) : undefined;\n if (!sourcePath || !outPath) {\n deps.error(TRANSLATE_MESSAGES_USAGE);\n return 2;\n }\n\n const siteName = typeof values[\"site-name\"] === \"string\" ? values[\"site-name\"] : undefined;\n const to = typeof values.to === \"string\" ? values.to : codeOf(outPath);\n const language = typeof values.language === \"string\" && values.language ? values.language : undefined;\n const site: TranslateSite | undefined =\n siteName || language\n ? {\n name: siteName ?? \"\",\n ...(language ? { languages: { [to]: language } } : {}),\n ...(typeof values.about === \"string\" ? { about: values.about } : {}),\n ...(typeof values.voice === \"string\" ? { voice: values.voice } : {}),\n ...(typeof values.keep === \"string\"\n ? {\n keepVerbatim: values.keep\n .split(\",\")\n .map((word) => word.trim())\n .filter(Boolean),\n }\n : {}),\n }\n : undefined;\n const translator =\n deps.translator ??\n anthropicTranslator({ apiKey: deps.env.ANTHROPIC_API_KEY, model: deps.env.ANTHROPIC_TRANSLATE_MODEL });\n if (translator.configured === false) {\n deps.error(\"ANTHROPIC_API_KEY is not set. Add it to .env.local and retry.\");\n return 1;\n }\n\n const source = JSON.parse(readFileSync(sourcePath, \"utf8\")) as MessagesJson;\n const target =\n !values.force && existsSync(outPath) ? (JSON.parse(readFileSync(outPath, \"utf8\")) as MessagesJson) : undefined;\n const from = typeof values.from === \"string\" ? values.from : codeOf(sourcePath);\n\n const result = await fillMessages({\n source,\n ...(target !== undefined ? { target } : {}),\n translator,\n from,\n to,\n force: values.force === true,\n ...(typeof values.context === \"string\" ? { context: values.context } : {}),\n ...(site ? { site } : {}),\n onProgress: (done, total) => deps.log(` ${done}/${total}`),\n });\n if (result.translated === 0 && result.fellBack === 0) {\n deps.log(`${basename(outPath)} is already complete. Nothing to translate.`);\n return 0;\n }\n writeFileSync(outPath, `${JSON.stringify(result.messages, null, 2)}\\n`, \"utf8\");\n deps.log(`Wrote ${outPath} (${result.translated} key(s) translated). Review the diff before committing.`);\n if (result.fellBack > 0) {\n // The keys are now filled (so a plain re-run will skip them); say exactly\n // how to redo them once the transient issue is resolved.\n deps.error(\n `${result.fellBack} key(s) kept the ${from} text because a batch failed or a {placeholder} was lost. ` +\n \"They are not missing anymore, so a plain re-run skips them: re-run with --force, or edit them by hand.\",\n );\n return 1;\n }\n return 0;\n}\n\n/** Loads `.env.local` then `.env` from the working directory, never overriding a set variable. */\nexport function loadEnvFiles(cwd: string): void {\n const load = (process as unknown as { loadEnvFile?: (path: string) => void }).loadEnvFile;\n if (!load) return;\n for (const name of [\".env.local\", \".env\"]) {\n const path = resolve(cwd, name);\n if (!existsSync(path)) continue;\n const before = { ...process.env };\n try {\n load(path);\n } catch {\n continue;\n }\n // loadEnvFile overrides; restore anything that was already set.\n for (const [key, value] of Object.entries(before)) process.env[key] = value;\n }\n}\n","#!/usr/bin/env node\n/**\n * `bison-translate-messages`: fills a next-intl message file from the source\n * locale's file with the Anthropic translator. Run it from the site, which\n * installs `@anthropic-ai/sdk` (a peer of this package).\n *\n * bison-translate-messages --source src/messages/en.json --out src/messages/es.json\n * bison-translate-messages --source src/messages/en.json --out src/messages/es.json --force\n *\n * Only keys missing or empty in --out are translated unless --force is\n * passed. --site-name, --about, --voice and --keep (comma list) carry the\n * site's prompt facts. The key is read from ANTHROPIC_API_KEY (the\n * environment, `.env.local` or `.env`), never from arguments.\n */\nimport { loadEnvFiles, runTranslateMessagesCli } from \"./translate/messages-cli\";\n\nloadEnvFiles(process.cwd());\nconst code = await runTranslateMessagesCli(process.argv.slice(2), {\n env: process.env,\n log: (line) => console.log(line),\n error: (line) => console.error(line),\n});\nprocess.exit(code);\n"],"mappings":";;;;;;;AAQA,MAAa,2BAA2B;;;;;;;;;;;;AAqBxC,MAAM,UAAU,SAAiB,SAAS,KAAK,CAAC,QAAQ,YAAY,GAAG;;;;;;;AAQvE,eAAsB,wBAAwB,MAAgB,MAAgC;CAC5F,IAAI;AACJ,KAAI;AACF,GAAC,CAAE,UAAW,UAAU;GACtB,MAAM;GACN,SAAS;IACP,QAAQ,EAAE,MAAM,UAAU;IAC1B,KAAK,EAAE,MAAM,UAAU;IAC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E,KAAI,CAAC,KAAM;AACX,MAAK,MAAM,QAAQ,CAAC,cAAc,OAAO,EAAE;EACzC,MAAM,OAAO,QAAQ,KAAK,KAAK;AAC/B,MAAI,CAAC,WAAW,KAAK,CAAE;EACvB,MAAM,SAAS,EAAE,GAAG,QAAQ,KAAK;AACjC,MAAI;AACF,QAAK,KAAK;UACJ;AACN;;AAGF,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAAE,SAAQ,IAAI,OAAO;;;;;;;;;;;;;;;;;;ACpI1E,aAAa,QAAQ,KAAK,CAAC;AAC3B,MAAM,OAAO,MAAM,wBAAwB,QAAQ,KAAK,MAAM,EAAE,EAAE;CAChE,KAAK,QAAQ;CACb,MAAM,SAAS,QAAQ,IAAI,KAAK;CAChC,QAAQ,SAAS,QAAQ,MAAM,KAAK;CACrC,CAAC;AACF,QAAQ,KAAK,KAAK"}
|
package/dist/translate.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { Block, CollectionAfterChangeHook, Config, Endpoint, Field, Payload, PayloadRequest, Plugin, SanitizedConfig } from "payload";
|
|
1
|
+
import { $ as BisonTranslationKind, A as usageThisMonth, B as KeyCheck, C as RATE_LIMIT_STREAK, D as monthKey, E as UsageMonth, F as resolveApiKey, G as containsWord, H as TRANSLATE_MODEL_PRICES, I as AnthropicMessagesClient, J as parseJsonArray, K as estimateCost, L as AnthropicTranslatorOptions, M as ResolvedKey, N as decryptApiKey, O as recordUsage, P as encryptApiKey, Q as BISON_TRANSLATION_CONTEXT, R as DEFAULT_TRANSLATE_MODEL, S as FAILURE_ADVICE, T as TRANSLATION_USAGE_SLUG, U as TranslatorCallEvent, V as ModelPrice, W as anthropicTranslator, X as verifyAnthropicKey, Y as translationSystemPrompt, Z as AutoTranslateOptions, _ as TranslationSettingsDoc, a as translation, at as TranslatedEntity, b as resolveModel, c as KeyStatus, ct as classifyAnthropicError, d as TRANSLATION_GRANT, et as BisonTranslationMarker, f as TRANSLATION_KEY_PANEL, g as TranslationModelChoice, h as TRANSLATION_STATUS_BAR, i as hasLocalizedFields, it as TranslateSite, j as KeySource, k as usageHistory, l as ResolvedTranslationSettings, m as TRANSLATION_STATE_SLUG, n as TranslationOptions, nt as TranslateLocaleResult, o as TranslationStatus, ot as Translator, p as TRANSLATION_SETTINGS_SLUG, q as modelPrice, r as applyTranslation, rt as TranslateRequest, s as translationSettingsEndpoints, st as TranslationFailureKind, t as TranslationEntityHint, tt as Doc, u as TRANSLATION_ACTIVITY_PANEL, v as invalidateTranslationSettings, w as RecordedFailure, x as siteFromInstructions, y as readTranslationSettings, z as ECONOMY_TRANSLATE_MODEL } from "./capability-Dotbq58Q.mjs";
|
|
2
|
+
import { Block, CollectionAfterChangeHook, CollectionConfig, Config, Endpoint, Field, Payload, PayloadRequest, Plugin, SanitizedConfig } from "payload";
|
|
3
3
|
|
|
4
4
|
//#region src/translate/plugin.d.ts
|
|
5
5
|
/**
|
|
@@ -15,6 +15,364 @@ import { Block, CollectionAfterChangeHook, Config, Endpoint, Field, Payload, Pay
|
|
|
15
15
|
*/
|
|
16
16
|
declare function autoTranslate(options: AutoTranslateOptions): Plugin;
|
|
17
17
|
//#endregion
|
|
18
|
+
//#region src/translate/languages.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* The languages every Bison site carries. The library owns this list: a new
|
|
21
|
+
* language is a library release that sites take by updating the package
|
|
22
|
+
* (and running the migration it brings). The first entry is the default
|
|
23
|
+
* locale of a site that declares no localization of its own.
|
|
24
|
+
*/
|
|
25
|
+
declare const LIBRARY_LOCALES: readonly [{
|
|
26
|
+
readonly code: "en";
|
|
27
|
+
readonly label: "English";
|
|
28
|
+
}, {
|
|
29
|
+
readonly code: "es";
|
|
30
|
+
readonly label: "Español";
|
|
31
|
+
}];
|
|
32
|
+
type LibraryLocaleCode = (typeof LIBRARY_LOCALES)[number]["code"];
|
|
33
|
+
declare const LIBRARY_DEFAULT_LOCALE: LibraryLocaleCode;
|
|
34
|
+
/** The codes of `LIBRARY_LOCALES`, in order. */
|
|
35
|
+
declare const LIBRARY_LOCALE_CODES: readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* A config's `localization` with every library language in it. A site with
|
|
38
|
+
* none gets the library's (English default, `fallback: true`, so an empty
|
|
39
|
+
* Spanish field reads as English). A site with its own keeps its locales,
|
|
40
|
+
* labels and default, and gains any library language it lacks.
|
|
41
|
+
*/
|
|
42
|
+
declare function withLibraryLocales(localization: Config["localization"]): Exclude<Config["localization"], false | undefined>;
|
|
43
|
+
/** What `activeLocales` answers. */
|
|
44
|
+
interface ActiveLocales {
|
|
45
|
+
/** The default (source) locale. Always active. */
|
|
46
|
+
defaultLocale: string;
|
|
47
|
+
/** The default locale and every ticked target locale, in config order. */
|
|
48
|
+
active: string[];
|
|
49
|
+
/** Target locales that are not ticked: no translation, no URL, no switcher entry, no hreflang. */
|
|
50
|
+
inactive: string[];
|
|
51
|
+
}
|
|
52
|
+
/** How long `activeLocales` reuses one read. A save of Settings → Translation in the same process clears it at once. */
|
|
53
|
+
declare const ACTIVE_LOCALES_CACHE_MS = 60000;
|
|
54
|
+
type SettingsReader = Pick<Payload, "findGlobal" | "config">;
|
|
55
|
+
/** After a failed read, how soon to try the database again. */
|
|
56
|
+
/** Drops the cached answer, so the next `activeLocales` reads again. */
|
|
57
|
+
declare function invalidateActiveLocales(payload: object): void;
|
|
58
|
+
/**
|
|
59
|
+
* The site's active languages, for routing and middleware: the default
|
|
60
|
+
* locale plus each target language ticked on Settings → Translation. Cached
|
|
61
|
+
* per process for `ttlMs` (60s by default): a request reads memory, and the
|
|
62
|
+
* database is read only when the cache refreshes, or after a save of the
|
|
63
|
+
* screen in the same process. Never throws. When a read fails it answers
|
|
64
|
+
* with the last good read (or, before the first one, the defaults) and
|
|
65
|
+
* tries the database again after `ACTIVE_LOCALES_RETRY_MS`, so one timeout
|
|
66
|
+
* never stands in for the Admin's ticks for a whole cache period, which
|
|
67
|
+
* would send a ticked language's visitors permanent redirects.
|
|
68
|
+
*/
|
|
69
|
+
declare function activeLocales(payload: SettingsReader, options?: {
|
|
70
|
+
ttlMs?: number;
|
|
71
|
+
}): Promise<ActiveLocales>;
|
|
72
|
+
/**
|
|
73
|
+
* Where a request for an inactive language goes: the same path without
|
|
74
|
+
* its locale prefix, for a 308. `null` when the path is not under an
|
|
75
|
+
* inactive locale. In a site's middleware:
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* const to = inactiveLocaleRedirect(url.pathname, await activeLocales(payload));
|
|
79
|
+
* if (to) {
|
|
80
|
+
* const response = NextResponse.redirect(new URL(to + url.search, url), 308);
|
|
81
|
+
* response.headers.set("Cache-Control", "no-store"); // so ticking the language again works for these visitors
|
|
82
|
+
* return response;
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
declare function inactiveLocaleRedirect(pathname: string, locales: Pick<ActiveLocales, "inactive" | "defaultLocale">): string | null;
|
|
87
|
+
/**
|
|
88
|
+
* A page's language alternates (for hreflang and a language switcher),
|
|
89
|
+
* keeping only active languages. `paths` maps each locale to that
|
|
90
|
+
* language's URL for the page.
|
|
91
|
+
*/
|
|
92
|
+
declare function activeAlternates(paths: Readonly<Record<string, string>>, locales: Pick<ActiveLocales, "active">): Record<string, string>;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/translate/migrate-locales.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* The data migration for a Postgres site going from one locale to several.
|
|
97
|
+
*
|
|
98
|
+
* Turning localization on moves every localized column out of its table
|
|
99
|
+
* into a `<table>_locales` table (one row per locale). `payload
|
|
100
|
+
* migrate:create` writes that as SQL that creates the new tables and then
|
|
101
|
+
* drops the old columns, which throws the copy away. This runs the same
|
|
102
|
+
* SQL with one step in between: after everything else and before any column
|
|
103
|
+
* or type is dropped, each column that moves is copied into its locale
|
|
104
|
+
* table as the default locale's row. Nothing else changes, so the result is
|
|
105
|
+
* exactly the schema Payload generated, holding the content it held before.
|
|
106
|
+
*
|
|
107
|
+
* In the generated migration, replace the body of `up`:
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { localizeExistingContent } from "@bison-lab/payload-core/translate";
|
|
111
|
+
*
|
|
112
|
+
* export async function up({ db, payload }: MigrateUpArgs): Promise<void> {
|
|
113
|
+
* await localizeExistingContent({ db, payload, sql, statements: `
|
|
114
|
+
* ...the SQL migrate:create wrote inside sql`...`, unchanged...
|
|
115
|
+
* ` });
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* Postgres only. The migration has no `down`: going back to one locale
|
|
120
|
+
* would drop every other locale's copy.
|
|
121
|
+
*/
|
|
122
|
+
/** The slice of Payload's `db` (Drizzle) this uses. */
|
|
123
|
+
interface MigrationDb {
|
|
124
|
+
execute(query: never): Promise<unknown>;
|
|
125
|
+
}
|
|
126
|
+
/** `sql` from `@payloadcms/db-postgres`, for `sql.raw`. */
|
|
127
|
+
interface MigrationSql {
|
|
128
|
+
raw: (text: string) => unknown;
|
|
129
|
+
}
|
|
130
|
+
/** The slice of the site's Payload config the relationship step reads (`payload` from the migration's `up`). */
|
|
131
|
+
interface MigrationPayload {
|
|
132
|
+
/** The adapter's table-name suffixes, when a site changed them (`postgresAdapter({ localesSuffix })`). */
|
|
133
|
+
db?: {
|
|
134
|
+
localesSuffix?: string;
|
|
135
|
+
relationshipsSuffix?: string;
|
|
136
|
+
versionsSuffix?: string;
|
|
137
|
+
};
|
|
138
|
+
config: {
|
|
139
|
+
collections?: ReadonlyArray<{
|
|
140
|
+
slug: string;
|
|
141
|
+
dbName?: unknown;
|
|
142
|
+
fields: readonly unknown[];
|
|
143
|
+
}>;
|
|
144
|
+
globals?: ReadonlyArray<{
|
|
145
|
+
slug: string;
|
|
146
|
+
dbName?: unknown;
|
|
147
|
+
fields: readonly unknown[];
|
|
148
|
+
}>; /** Config-level blocks, for blocks fields that use `blockReferences`. */
|
|
149
|
+
blocks?: ReadonlyArray<{
|
|
150
|
+
slug: string;
|
|
151
|
+
fields: readonly unknown[];
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
interface LocalizeExistingContentOptions {
|
|
156
|
+
db: MigrationDb;
|
|
157
|
+
sql: MigrationSql;
|
|
158
|
+
/**
|
|
159
|
+
* The migration's `payload`. Needed when a localized relationship, upload
|
|
160
|
+
* or hasMany text/number field already holds rows: Payload keeps those in
|
|
161
|
+
* shared `_rels` / `_texts` / `_numbers` tables with a `locale` column it
|
|
162
|
+
* adds now, and only the config says which rows belong to a localized
|
|
163
|
+
* field. Without it, such rows make the migration stop with an error
|
|
164
|
+
* rather than lose them.
|
|
165
|
+
*/
|
|
166
|
+
payload?: MigrationPayload;
|
|
167
|
+
/** The SQL `migrate:create` generated for this change, as text. */
|
|
168
|
+
statements: string;
|
|
169
|
+
/** The locale existing content is in. Defaults to `en`. */
|
|
170
|
+
locale?: string;
|
|
171
|
+
/** The Postgres schema Payload's tables are in. Defaults to `public`. */
|
|
172
|
+
schema?: string;
|
|
173
|
+
/** Progress lines; defaults to `console.log`. */
|
|
174
|
+
log?: (line: string) => void;
|
|
175
|
+
}
|
|
176
|
+
interface LocalizedTableCopy {
|
|
177
|
+
table: string;
|
|
178
|
+
into: string;
|
|
179
|
+
columns: string[];
|
|
180
|
+
rows: number;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Splits generated SQL into statements at a `;` that ends a line, keeping a
|
|
184
|
+
* `DO $$ ... $$;` block whole.
|
|
185
|
+
*/
|
|
186
|
+
declare function splitStatements(text: string): string[];
|
|
187
|
+
interface PartitionedStatements {
|
|
188
|
+
/** Everything that does not drop: creates, adds, indexes, constraints. */
|
|
189
|
+
first: string[];
|
|
190
|
+
/** Tables that gain a nullable `locale` column (shared relationship / hasMany tables). */
|
|
191
|
+
localeColumns: string[];
|
|
192
|
+
/** The columns dropped, by table. */
|
|
193
|
+
drops: Map<string, string[]>;
|
|
194
|
+
/** The drops themselves, run last. */
|
|
195
|
+
last: string[];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Sorts statements into what runs before the copy and the drops that run
|
|
199
|
+
* after it. A `_locale NOT NULL` column added to an existing table (a
|
|
200
|
+
* localized array or blocks field) gets the default locale as a default
|
|
201
|
+
* while it is added, so existing rows are kept as that locale's.
|
|
202
|
+
*/
|
|
203
|
+
declare function partitionStatements(statements: readonly string[], locale?: string): PartitionedStatements;
|
|
204
|
+
interface ConfigField {
|
|
205
|
+
type?: string;
|
|
206
|
+
name?: string;
|
|
207
|
+
localized?: boolean;
|
|
208
|
+
fields?: ConfigField[];
|
|
209
|
+
tabs?: Array<{
|
|
210
|
+
name?: string;
|
|
211
|
+
localized?: boolean;
|
|
212
|
+
fields: ConfigField[];
|
|
213
|
+
}>;
|
|
214
|
+
blocks?: Array<{
|
|
215
|
+
slug: string;
|
|
216
|
+
fields: ConfigField[];
|
|
217
|
+
}>;
|
|
218
|
+
blockReferences?: Array<string | {
|
|
219
|
+
slug: string;
|
|
220
|
+
fields: ConfigField[];
|
|
221
|
+
}>;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Whether the stored `path` of a relationship / hasMany row (`related`,
|
|
225
|
+
* `layout.1.items.0.ref`) is a localized field, or sits inside one.
|
|
226
|
+
* `undefined` when the path is not in the config. Throws when blocks
|
|
227
|
+
* disagree (two block types with the same sub-path, one localized).
|
|
228
|
+
*/
|
|
229
|
+
declare function isLocalizedPath(fields: readonly ConfigField[], segments: readonly string[], inherited?: boolean, configBlocks?: ReadonlyArray<{
|
|
230
|
+
slug: string;
|
|
231
|
+
fields: readonly unknown[];
|
|
232
|
+
}>): boolean | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Runs a localization migration without losing content: see the module
|
|
235
|
+
* comment. Returns what it copied. Throws (and Payload rolls the migration
|
|
236
|
+
* back) on any SQL error.
|
|
237
|
+
*/
|
|
238
|
+
declare function localizeExistingContent(options: LocalizeExistingContentOptions): Promise<LocalizedTableCopy[]>;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/translate/jobs.d.ts
|
|
241
|
+
/**
|
|
242
|
+
* Background translation jobs: the backfill that starts when translation
|
|
243
|
+
* is switched on (or a key is saved while it is on), "Fill all blank", and
|
|
244
|
+
* "Apply frozen words to existing Spanish". A job is a row in a hidden
|
|
245
|
+
* collection holding its queue of documents and a cursor, saved after every
|
|
246
|
+
* document, so a job interrupted by a failure or a redeploy resumes where it
|
|
247
|
+
* stopped and never redoes a finished document.
|
|
248
|
+
*
|
|
249
|
+
* A run processes documents for `RUN_BUDGET_MS`, then hands on to the next
|
|
250
|
+
* run with a signed request to its own endpoint, so no single function
|
|
251
|
+
* invocation runs long. A job whose last heartbeat is older than
|
|
252
|
+
* `STALE_AFTER_MS` (its chain broke on a redeploy) is resumed on the next
|
|
253
|
+
* cold start (`onInit`) or the next time the screen polls.
|
|
254
|
+
*/
|
|
255
|
+
declare const TRANSLATION_JOBS_SLUG = "translation-jobs";
|
|
256
|
+
type TranslationJobKind = "backfill" | "fill-blank" | "frozen-fix";
|
|
257
|
+
type TranslationJobStatus = "running" | "paused" | "done" | "failed";
|
|
258
|
+
/** One document a job visits. */
|
|
259
|
+
type JobTarget = {
|
|
260
|
+
collection: string;
|
|
261
|
+
id: number | string;
|
|
262
|
+
} | {
|
|
263
|
+
global: string;
|
|
264
|
+
};
|
|
265
|
+
interface TranslationJobDoc {
|
|
266
|
+
id: number | string;
|
|
267
|
+
kind: TranslationJobKind;
|
|
268
|
+
status: TranslationJobStatus;
|
|
269
|
+
queue: JobTarget[];
|
|
270
|
+
cursor: number;
|
|
271
|
+
/** Strings the estimate counted. */
|
|
272
|
+
strings: number;
|
|
273
|
+
translated: number;
|
|
274
|
+
/** Frozen words the fix looks for. */
|
|
275
|
+
words?: string[] | null;
|
|
276
|
+
startedBy?: string | null;
|
|
277
|
+
origin?: string | null;
|
|
278
|
+
heartbeatAt?: string | null;
|
|
279
|
+
message?: string | null;
|
|
280
|
+
/** Why a job paused on its own: the recorded failure (out of credit, rejected key, cap). */
|
|
281
|
+
reason?: string | null;
|
|
282
|
+
/** Documents a failure the job could not stop for left untranslated. */
|
|
283
|
+
skipped?: number | null;
|
|
284
|
+
/** The runner that holds the job, and until when; one runner at a time. */
|
|
285
|
+
lease?: string | null;
|
|
286
|
+
leaseUntil?: string | null;
|
|
287
|
+
/** Bumped on every claim, so two runners can never both win one. */
|
|
288
|
+
leaseRev?: number | null;
|
|
289
|
+
createdAt?: string;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* How long a claim lasts without renewal. Renewed before every document, so
|
|
293
|
+
* it covers one document's model calls (90s, one retry) with room to spare;
|
|
294
|
+
* a runner silent this long is gone, and the job may be claimed again.
|
|
295
|
+
*/
|
|
296
|
+
declare const LEASE_MS = 300000;
|
|
297
|
+
/** What a job would do: the documents with work, and how many strings. */
|
|
298
|
+
interface JobEstimate {
|
|
299
|
+
documents: number;
|
|
300
|
+
strings: number;
|
|
301
|
+
/** Rough USD, from the model's price; real cost shows in usage once it runs. */
|
|
302
|
+
cost: number;
|
|
303
|
+
queue: JobTarget[];
|
|
304
|
+
/** For the frozen-word fix: the frozen words some translation lost. */
|
|
305
|
+
lostWords: string[];
|
|
306
|
+
}
|
|
307
|
+
/** Strings in the frozen-word fix: English keeps a frozen word (whole word, case-sensitive) and the translation lost it. */
|
|
308
|
+
declare function frozenWordForce(words: readonly string[]): (source: string, existing: unknown) => boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Counts what a job would translate, reading each document's latest version
|
|
311
|
+
* (the published copy, or the current draft when there is one) in every
|
|
312
|
+
* ticked language. Changes nothing.
|
|
313
|
+
*/
|
|
314
|
+
declare function estimateJob(payload: Payload, settings: ResolvedTranslationSettings, kind: TranslationJobKind, words?: readonly string[]): Promise<JobEstimate>;
|
|
315
|
+
/**
|
|
316
|
+
* Takes the job for `lease` if it is running and nobody else holds a live
|
|
317
|
+
* claim. The claim is a compare-and-set on `leaseRev`, so of two runners
|
|
318
|
+
* reading the same job only one can win.
|
|
319
|
+
*/
|
|
320
|
+
declare function claimJob(payload: Payload, id: number | string, lease: string): Promise<boolean>;
|
|
321
|
+
/**
|
|
322
|
+
* Runs one job for up to `budgetMs` while holding `lease`: one document at
|
|
323
|
+
* a time. Before each document it renews the lease (and stops if another
|
|
324
|
+
* runner has it), re-reads the job (stops if it was paused) and the switch
|
|
325
|
+
* (pauses if it is off). A document's write and the cursor after it are
|
|
326
|
+
* made only while the lease is still this runner's. When a document's
|
|
327
|
+
* translation records a stopping failure (out of credit, a rejected key,
|
|
328
|
+
* the cap) the job pauses on that document, which is not counted done, and
|
|
329
|
+
* Resume picks it up after the Admin has fixed the cause. A document that
|
|
330
|
+
* fails for any other reason is skipped and counted. Returns `true` when
|
|
331
|
+
* work is left and the lease is still held, so the caller hands on.
|
|
332
|
+
*/
|
|
333
|
+
declare function runJobSlice(payload: Payload, id: number | string, lease: string, budgetMs?: number): Promise<boolean>;
|
|
334
|
+
/**
|
|
335
|
+
* Restarts running jobs whose runner is gone (its claim lapsed, e.g. a
|
|
336
|
+
* redeploy broke the chain). Safe to call from every poll and every cold
|
|
337
|
+
* start: a fresh runner must win the claim, so at most one picks a job up.
|
|
338
|
+
*/
|
|
339
|
+
declare function resumeStaleJobs(payload: Payload): Promise<number>;
|
|
340
|
+
/**
|
|
341
|
+
* Creates a job from an estimate and starts it. Single-flight: a job
|
|
342
|
+
* already running is returned instead, and if two starts race (switch-on
|
|
343
|
+
* and a key save, two Admins), the newer one stands down for the older.
|
|
344
|
+
*/
|
|
345
|
+
declare function startJob(payload: Payload, input: {
|
|
346
|
+
kind: TranslationJobKind;
|
|
347
|
+
estimate: JobEstimate;
|
|
348
|
+
words?: readonly string[];
|
|
349
|
+
user?: unknown;
|
|
350
|
+
req?: Pick<PayloadRequest, "url" | "headers">;
|
|
351
|
+
}): Promise<TranslationJobDoc>;
|
|
352
|
+
/**
|
|
353
|
+
* The backfill when translation is switched on or a key is saved while it
|
|
354
|
+
* is on: unless a paused job is waiting to be resumed (the screen offers
|
|
355
|
+
* that instead), estimate every blank string and start filling it.
|
|
356
|
+
*/
|
|
357
|
+
declare function startBackfill(payload: Payload, input?: {
|
|
358
|
+
user?: unknown;
|
|
359
|
+
req?: Pick<PayloadRequest, "url" | "headers">;
|
|
360
|
+
}): Promise<TranslationJobDoc | null>;
|
|
361
|
+
/** Public shape of a job for the screen. */
|
|
362
|
+
declare function jobView(job: TranslationJobDoc): {
|
|
363
|
+
id: string | number;
|
|
364
|
+
kind: TranslationJobKind;
|
|
365
|
+
status: TranslationJobStatus;
|
|
366
|
+
done: number;
|
|
367
|
+
total: number;
|
|
368
|
+
strings: number;
|
|
369
|
+
translated: number;
|
|
370
|
+
skipped: number;
|
|
371
|
+
startedBy: string | null;
|
|
372
|
+
message: string | null;
|
|
373
|
+
createdAt: string | null;
|
|
374
|
+
};
|
|
375
|
+
//#endregion
|
|
18
376
|
//#region src/translate/fields.d.ts
|
|
19
377
|
/** Field configs plus the config-level blocks a `blockReferences` field points at. */
|
|
20
378
|
interface FieldSchema {
|
|
@@ -73,7 +431,8 @@ declare function translationJob(input: {
|
|
|
73
431
|
source: Doc;
|
|
74
432
|
target?: Doc | null;
|
|
75
433
|
previous?: Doc | null;
|
|
76
|
-
overwrite?: boolean;
|
|
434
|
+
overwrite?: boolean; /** Also translate the strings this picks, filled target or not (the frozen-word fix). */
|
|
435
|
+
force?: (source: string, existing: unknown) => boolean;
|
|
77
436
|
}): TranslationJob | null;
|
|
78
437
|
//#endregion
|
|
79
438
|
//#region src/translate/hooks.d.ts
|
|
@@ -87,7 +446,7 @@ type TranslateDocumentOptions = ({
|
|
|
87
446
|
} | {
|
|
88
447
|
global: string;
|
|
89
448
|
}) & {
|
|
90
|
-
/** Target locale or locales. Omitted: every
|
|
449
|
+
/** Target locale or locales. Omitted: every ticked target language on Settings → Translation. */locale?: string | readonly string[]; /** Re-translate every filled source string, replacing target copy a person may have corrected. */
|
|
91
450
|
overwrite?: boolean;
|
|
92
451
|
/**
|
|
93
452
|
* The source copy before the change being translated: the last published
|
|
@@ -103,7 +462,8 @@ type TranslateDocumentOptions = ({
|
|
|
103
462
|
*/
|
|
104
463
|
translator?: Translator; /** The prompt hint; defaults to the collection's `context` hint, else the slug and the title. */
|
|
105
464
|
context?: string; /** Defaults to Settings → Translation's instructions (the site's code `site` until the screen is saved). */
|
|
106
|
-
site?: TranslateSite; /**
|
|
465
|
+
site?: TranslateSite; /** Also re-translate the strings this picks, filled target or not (the frozen-word fix). */
|
|
466
|
+
force?: (source: string, existing: unknown) => boolean; /** Why this write happens, carried on each write as `context.bisonTranslation.kind`. Defaults to `manual`. */
|
|
107
467
|
kind?: BisonTranslationKind;
|
|
108
468
|
/**
|
|
109
469
|
* Pass only while the caller's transaction is still open (a seed inside its
|
|
@@ -331,5 +691,5 @@ declare function fillMessages(options: {
|
|
|
331
691
|
onProgress?: (done: number, total: number) => void;
|
|
332
692
|
}): Promise<FillMessagesResult>;
|
|
333
693
|
//#endregion
|
|
334
|
-
export { type AnthropicMessagesClient, type AnthropicTranslatorOptions, type AutoTranslateOptions, type AutoTranslateState, BISON_TRANSLATION_CONTEXT, type BisonTranslationKind, type BisonTranslationMarker, DEFAULT_TRANSLATE_MODEL, type Doc, ECONOMY_TRANSLATE_MODEL, type FieldSchema, type KeyCheck, type KeySource, type KeyStatus, type MessagesJson, type ModelPrice, type ResolvedKey, type ResolvedTranslationSettings, TRANSACTION_TIMEOUT_MS, TRANSLATE_MODEL_PRICES, TRANSLATE_NOW, TRANSLATION_GRANT, TRANSLATION_KEY_PANEL, TRANSLATION_SETTINGS_SLUG, TRANSLATION_STATE_SLUG, type TranslateDocumentOptions, type TranslateLocaleResult, type TranslateRequest, type TranslateSite, type TranslatedEntity, type TranslationEntityHint, type TranslationFailureKind, type TranslationJob, type TranslationModelChoice, type TranslationOptions, type TranslationSettingsDoc, type TranslationStatus, type Translator, type TranslatorCallEvent, anthropicTranslator, applyTranslation, autoTranslate, classifyAnthropicError, collectLocalizedStrings, containsWord, decryptApiKey, draftedTranslationDecision, encryptApiKey, estimateCost, fillMessages, hasLocalizedFields, invalidateTranslationSettings, isAutosave, isTranslatorConfigured, localizedCopyUnchanged, modelPrice, parseJsonArray, readTranslateState, readTranslationSettings, resolveApiKey, resolveModel, runAfterCommit, sameRow, shouldSkipDraftedTranslation, shouldSkipUndraftedTranslation, siteFromInstructions, translateDocument, translateStrings, translation, translationJob, translationSettingsEndpoints, translationSystemPrompt, verifyAnthropicKey, withTranslator };
|
|
694
|
+
export { ACTIVE_LOCALES_CACHE_MS, type ActiveLocales, type AnthropicMessagesClient, type AnthropicTranslatorOptions, type AutoTranslateOptions, type AutoTranslateState, BISON_TRANSLATION_CONTEXT, type BisonTranslationKind, type BisonTranslationMarker, DEFAULT_TRANSLATE_MODEL, type Doc, ECONOMY_TRANSLATE_MODEL, FAILURE_ADVICE, type FieldSchema, type JobEstimate, type JobTarget, type KeyCheck, type KeySource, type KeyStatus, LEASE_MS, LIBRARY_DEFAULT_LOCALE, LIBRARY_LOCALES, LIBRARY_LOCALE_CODES, type LibraryLocaleCode, type LocalizeExistingContentOptions, type LocalizedTableCopy, type MessagesJson, type MigrationDb, type MigrationPayload, type MigrationSql, type ModelPrice, RATE_LIMIT_STREAK, type RecordedFailure, type ResolvedKey, type ResolvedTranslationSettings, TRANSACTION_TIMEOUT_MS, TRANSLATE_MODEL_PRICES, TRANSLATE_NOW, TRANSLATION_ACTIVITY_PANEL, TRANSLATION_GRANT, TRANSLATION_JOBS_SLUG, TRANSLATION_KEY_PANEL, TRANSLATION_SETTINGS_SLUG, TRANSLATION_STATE_SLUG, TRANSLATION_STATUS_BAR, TRANSLATION_USAGE_SLUG, type TranslateDocumentOptions, type TranslateLocaleResult, type TranslateRequest, type TranslateSite, type TranslatedEntity, type TranslationEntityHint, type TranslationFailureKind, type TranslationJob, type TranslationJobDoc, type TranslationJobKind, type TranslationJobStatus, type TranslationModelChoice, type TranslationOptions, type TranslationSettingsDoc, type TranslationStatus, type Translator, type TranslatorCallEvent, type UsageMonth, activeAlternates, activeLocales, anthropicTranslator, applyTranslation, autoTranslate, claimJob, classifyAnthropicError, collectLocalizedStrings, containsWord, decryptApiKey, draftedTranslationDecision, encryptApiKey, estimateCost, estimateJob, fillMessages, frozenWordForce, hasLocalizedFields, inactiveLocaleRedirect, invalidateActiveLocales, invalidateTranslationSettings, isAutosave, isLocalizedPath, isTranslatorConfigured, jobView, localizeExistingContent, localizedCopyUnchanged, modelPrice, monthKey, parseJsonArray, partitionStatements, readTranslateState, readTranslationSettings, recordUsage, resolveApiKey, resolveModel, resumeStaleJobs, runAfterCommit, runJobSlice, sameRow, shouldSkipDraftedTranslation, shouldSkipUndraftedTranslation, siteFromInstructions, splitStatements, startBackfill, startJob, translateDocument, translateStrings, translation, translationJob, translationSettingsEndpoints, translationSystemPrompt, usageHistory, usageThisMonth, verifyAnthropicKey, withLibraryLocales, withTranslator };
|
|
335
695
|
//# sourceMappingURL=translate.d.mts.map
|
package/dist/translate.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translate.d.mts","names":[],"sources":["../src/translate/plugin.ts","../src/translate/fields.ts","../src/translate/hooks.ts","../src/translate/document.ts","../src/translate/strings.ts","../src/translate/guards.ts","../src/translate/after-commit.ts","../src/translate/state.ts","../src/translate/endpoint.ts","../src/translate/messages.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"translate.d.mts","names":[],"sources":["../src/translate/plugin.ts","../src/translate/languages.ts","../src/translate/migrate-locales.ts","../src/translate/jobs.ts","../src/translate/fields.ts","../src/translate/hooks.ts","../src/translate/document.ts","../src/translate/strings.ts","../src/translate/guards.ts","../src/translate/after-commit.ts","../src/translate/state.ts","../src/translate/endpoint.ts","../src/translate/messages.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;iBAAgB,aAAA,CAAc,OAAA,EAAS,oBAAA,GAAuB,MAAA;;;;;;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