@bison-lab/payload-core 4.39.0 → 5.0.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.
Files changed (75) hide show
  1. package/README.md +63 -33
  2. package/dist/admin.d.mts +19 -7
  3. package/dist/admin.d.mts.map +1 -1
  4. package/dist/admin.mjs +229 -16
  5. package/dist/admin.mjs.map +1 -1
  6. package/dist/block-library.d.mts +1 -1
  7. package/dist/block-library.mjs +1 -1
  8. package/dist/{block-thumbnails-DXOUzGjY.mjs → block-thumbnails-DC34uFtE.mjs} +1 -1
  9. package/dist/{block-thumbnails-DXOUzGjY.mjs.map → block-thumbnails-DC34uFtE.mjs.map} +1 -1
  10. package/dist/block-thumbnails-cli.mjs +1 -1
  11. package/dist/block-thumbnails.mjs +1 -1
  12. package/dist/capability-CqdYCzG1.d.mts +434 -0
  13. package/dist/capability-CqdYCzG1.d.mts.map +1 -0
  14. package/dist/capability-DHPE2kon.mjs +2685 -0
  15. package/dist/capability-DHPE2kon.mjs.map +1 -0
  16. package/dist/{catalogue-FxH10X3v.d.mts → catalogue-DWqHWVE5.d.mts} +1 -1
  17. package/dist/{catalogue-FxH10X3v.d.mts.map → catalogue-DWqHWVE5.d.mts.map} +1 -1
  18. package/dist/{facet-field-DjaZ0C7D.d.mts → facet-field-2K22iuWA.d.mts} +1 -1
  19. package/dist/{facet-field-DjaZ0C7D.d.mts.map → facet-field-2K22iuWA.d.mts.map} +1 -1
  20. package/dist/{facet-field-Uf8S4yL1.mjs → facet-field-DO3VT_Cz.mjs} +1 -1
  21. package/dist/{facet-field-Uf8S4yL1.mjs.map → facet-field-DO3VT_Cz.mjs.map} +1 -1
  22. package/dist/index.d.mts +13 -7
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +25 -667
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/{locale-CFWfB4wP.mjs → locale-B6rUVwpg.mjs} +1 -1
  27. package/dist/locale-B6rUVwpg.mjs.map +1 -0
  28. package/dist/{locale-CWiIcGuU.d.mts → locale-CTT3nn6T.d.mts} +5 -4
  29. package/dist/locale-CTT3nn6T.d.mts.map +1 -0
  30. package/dist/messages-dZV_aAnR.mjs +93 -0
  31. package/dist/messages-dZV_aAnR.mjs.map +1 -0
  32. package/dist/metadata.d.mts +1 -1
  33. package/dist/navigation.d.mts +2 -2
  34. package/dist/navigation.mjs +1 -1
  35. package/dist/og.d.mts +2 -2
  36. package/dist/og.mjs +1 -1
  37. package/dist/{preview-CNBVfmM7.d.mts → preview-1vwxBgm5.d.mts} +2 -2
  38. package/dist/{preview-CNBVfmM7.d.mts.map → preview-1vwxBgm5.d.mts.map} +1 -1
  39. package/dist/{published-_1rrTj_B.d.mts → published-B3etM6X5.d.mts} +3 -3
  40. package/dist/{published-_1rrTj_B.d.mts.map → published-B3etM6X5.d.mts.map} +1 -1
  41. package/dist/{published-D3yVnbxs.mjs → published-BMt7Z5CF.mjs} +2 -2
  42. package/dist/{published-D3yVnbxs.mjs.map → published-BMt7Z5CF.mjs.map} +1 -1
  43. package/dist/{published-DefZv9na.mjs → published-CkqqY08H.mjs} +2 -2
  44. package/dist/{published-DefZv9na.mjs.map → published-CkqqY08H.mjs.map} +1 -1
  45. package/dist/{published-DXjnElZn.d.mts → published-QDNmDi02.d.mts} +2 -2
  46. package/dist/{published-DXjnElZn.d.mts.map → published-QDNmDi02.d.mts.map} +1 -1
  47. package/dist/{published-QyTcDznE.mjs → published-hqtvmVUD.mjs} +1 -1
  48. package/dist/{published-QyTcDznE.mjs.map → published-hqtvmVUD.mjs.map} +1 -1
  49. package/dist/{root-page-key-B86JwL8Z.mjs → root-page-key-kx3C1eyp.mjs} +1 -1
  50. package/dist/{root-page-key-B86JwL8Z.mjs.map → root-page-key-kx3C1eyp.mjs.map} +1 -1
  51. package/dist/seo.mjs +1 -1
  52. package/dist/{messages-Fl1spIwN.mjs → strings-Fd7kUCT7.mjs} +156 -118
  53. package/dist/strings-Fd7kUCT7.mjs.map +1 -0
  54. package/dist/taxonomy.d.mts +1 -1
  55. package/dist/taxonomy.mjs +1 -1
  56. package/dist/theme.d.mts +4 -4
  57. package/dist/theme.mjs +1 -1
  58. package/dist/{title-D_jixG36.d.mts → title-trhUexxM.d.mts} +1 -1
  59. package/dist/{title-D_jixG36.d.mts.map → title-trhUexxM.d.mts.map} +1 -1
  60. package/dist/translate-messages-cli.mjs +3 -2
  61. package/dist/translate-messages-cli.mjs.map +1 -1
  62. package/dist/translate.d.mts +300 -206
  63. package/dist/translate.d.mts.map +1 -1
  64. package/dist/translate.mjs +225 -1027
  65. package/dist/translate.mjs.map +1 -1
  66. package/dist/{types-Db6Iy3hJ.d.mts → types-DLBlHZUd.d.mts} +1 -1
  67. package/dist/{types-Db6Iy3hJ.d.mts.map → types-DLBlHZUd.d.mts.map} +1 -1
  68. package/dist/{wireframe-xcJNJzBf.mjs → wireframe-CXorKFU_.mjs} +1 -1
  69. package/dist/{wireframe-xcJNJzBf.mjs.map → wireframe-CXorKFU_.mjs.map} +1 -1
  70. package/dist/wireframe-cli.mjs +1 -1
  71. package/dist/wireframe.mjs +1 -1
  72. package/package.json +6 -8
  73. package/dist/locale-CFWfB4wP.mjs.map +0 -1
  74. package/dist/locale-CWiIcGuU.d.mts.map +0 -1
  75. package/dist/messages-Fl1spIwN.mjs.map +0 -1
@@ -1,163 +1,306 @@
1
- import { Block, Config, Endpoint, Field, Payload, PayloadRequest, Plugin, SanitizedConfig } from "payload";
1
+ import { A as ModelPrice, B as AutoTranslateOptions, C as encryptApiKey, D as DEFAULT_TRANSLATE_MODEL, E as AnthropicTranslatorOptions, F as estimateCost, G as TranslateLocaleResult, H as BisonTranslationKind, I as modelPrice, J as TranslatedEntity, K as TranslateRequest, L as parseJsonArray, M as TranslatorCallEvent, N as anthropicTranslator, O as ECONOMY_TRANSLATE_MODEL, P as containsWord, R as translationSystemPrompt, S as decryptApiKey, T as AnthropicMessagesClient, U as BisonTranslationMarker, V as BISON_TRANSLATION_CONTEXT, W as Doc, X as TranslationFailureKind, Y as Translator, Z as classifyAnthropicError, _ as readTranslationSettings, a as translation, b as KeySource, c as KeyStatus, d as TRANSLATION_KEY_PANEL, f as TRANSLATION_SETTINGS_SLUG, g as invalidateTranslationSettings, h as TranslationSettingsDoc, i as hasLocalizedFields, j as TRANSLATE_MODEL_PRICES, k as KeyCheck, l as ResolvedTranslationSettings, m as TranslationModelChoice, n as TranslationOptions, o as TranslationStatus, p as TRANSLATION_STATE_SLUG, q as TranslateSite, r as applyTranslation, s as translationSettingsEndpoints, t as TranslationEntityHint, u as TRANSLATION_GRANT, v as resolveModel, w as resolveApiKey, x as ResolvedKey, y as siteFromInstructions, z as verifyAnthropicKey } from "./capability-CqdYCzG1.mjs";
2
+ import { Block, CollectionAfterChangeHook, Config, Endpoint, Field, Payload, PayloadRequest, Plugin, SanitizedConfig } from "payload";
2
3
 
3
- //#region src/translate/types.d.ts
4
- /** A document as one locale's depth-0 read returns it. */
5
- type Doc = Record<string, unknown>;
4
+ //#region src/translate/plugin.d.ts
6
5
  /**
7
- * What a site tells the model about itself. The library owns the generic
8
- * rules (JSON in and out, placeholders, tags, URLs, literal legal copy);
9
- * these are the facts only a site has.
6
+ * @deprecated Every site now has translation through `adminNav()` (or
7
+ * `translation()`), switched on by an Admin in Settings → Translation, and
8
+ * it covers every collection and global with localized fields. This keeps
9
+ * an existing `autoTranslate({ ... })` line working: `enabled: false`
10
+ * returns the config untouched; `enabled: true` applies the capability with
11
+ * its `site` (the instructions' first values), `waitUntil`, the listed
12
+ * entities' `context` hints, and `translator`, which then replaces the
13
+ * screen's key and model (tests). The listed slugs must exist. The screen's
14
+ * switch governs it either way.
10
15
  */
11
- interface TranslateSite {
12
- /** The brand name, kept verbatim. */
13
- name: string;
14
- /** One line on what the site is, for word choice ("a gigabit fiber provider in Kansas"). */
15
- about?: string;
16
- /** The voice to keep ("confident, friendly, speed-first"). */
17
- voice?: string;
18
- /** Brand, product and place names the model must never translate. */
19
- keepVerbatim?: string[];
20
- /**
21
- * How to name a locale's language in the prompt, per locale code
22
- * (`{ es: "Latin American Spanish" }`). A code left out is named by
23
- * `Intl.DisplayNames`.
24
- */
25
- languages?: Record<string, string>;
26
- }
27
- /** One translation call: from which locale, into which, and where the strings appear. */
28
- interface TranslateRequest {
29
- from: string;
30
- to: string;
31
- /** A short hint about where the strings appear, to improve word choice. */
32
- context?: string;
33
- /** The plugin's `site`, when it was given one. */
34
- site?: TranslateSite;
35
- }
16
+ declare function autoTranslate(options: AutoTranslateOptions): Plugin;
17
+ //#endregion
18
+ //#region src/translate/languages.d.ts
36
19
  /**
37
- * Translates a batch of strings, returning them in the same order and the
38
- * same length, or `null` on any failure. It never throws on purpose; a
39
- * throw is caught and read as `null`.
40
- *
41
- * `configured: false` says the translator cannot run (no API key): the
42
- * plugin then logs a warning on publish instead of deferring work, and
43
- * hides "Translate now". Leave it unset on a translator that always runs.
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.
44
24
  */
45
- type Translator = ((strings: string[], request: TranslateRequest) => Promise<string[] | null>) & {
46
- configured?: boolean;
47
- };
48
- /** A collection or global the plugin translates, by slug or with a prompt hint. */
49
- type TranslatedEntity = string | {
50
- slug: string; /** The prompt hint for one document, from its source-locale read (`Internet plan: Fiber 1000`). */
51
- context?: (doc: Doc) => string;
52
- };
53
- interface AutoTranslateOptions {
54
- /**
55
- * The per-site switch. `false` registers nothing at all: no hooks,
56
- * endpoints, admin components or config, the same config as leaving the
57
- * plugin out.
58
- */
59
- enabled: boolean;
60
- /** Collections whose source-locale publishes fill every other locale. */
61
- collections?: TranslatedEntity[];
62
- /** Globals whose source-locale publishes fill every other locale. */
63
- globals?: TranslatedEntity[];
64
- /** What turns strings into another language: `anthropicTranslator(...)` or your own. */
65
- translator: Translator;
66
- /**
67
- * Keeps the deferred translation alive after the response is sent, e.g.
68
- * `waitUntil` from `@vercel/functions`. Off a serverless host leave it
69
- * out; the work runs in the same process either way.
70
- */
71
- waitUntil?: (promise: Promise<unknown>) => void;
72
- /** Site facts passed to the translator on every call (see `TranslateSite`). */
73
- site?: TranslateSite;
74
- }
75
- /** What happened in one target locale. */
76
- interface TranslateLocaleResult {
77
- locale: string;
78
- /** `nothing`: every string already in step; `failed`: the translator gave no usable result. */
79
- status: "translated" | "nothing" | "failed";
80
- /** Strings written. */
81
- count: number;
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[];
82
51
  }
83
- //#endregion
84
- //#region src/translate/plugin.d.ts
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;
85
58
  /**
86
- * Fills every locale but the default from the default whenever copy is
87
- * published, without overwriting a translation a person corrected. Each site
88
- * switches it on or off in its own `payload.config.ts`:
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:
89
76
  *
90
77
  * ```ts
91
- * autoTranslate({
92
- * enabled: true,
93
- * collections: ["pages", { slug: "plans", context: (doc) => `Internet plan: ${doc.name}` }],
94
- * translator: anthropicTranslator({ apiKey: process.env.ANTHROPIC_API_KEY, site: { name: "ZoomFiber" } }),
95
- * waitUntil,
96
- * })
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
+ * }
97
84
  * ```
98
- *
99
- * `enabled: false` returns the config untouched. Without `localization` (or
100
- * with one locale) it logs one warning and registers nothing. Otherwise each
101
- * listed collection gets an `afterChange` hook, `POST /api/<slug>/:id/translate`
102
- * and a "Translate now" item in the document menu (`TRANSLATE_NOW`, run
103
- * `payload generate:importmap`). The item is registered whether or not the
104
- * translator has a key, so the import map never depends on the environment;
105
- * it renders nothing when there is no key. Each listed
106
- * global gets the hook.
107
85
  */
108
- declare function autoTranslate(options: AutoTranslateOptions): Plugin;
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>;
109
93
  //#endregion
110
- //#region src/translate/anthropic.d.ts
94
+ //#region src/translate/migrate-locales.d.ts
111
95
  /**
112
- * The library's default model. Translating marketing copy does not need the
113
- * most capable model; a current Sonnet handles it well at a fraction of the
114
- * price. A site overrides it per environment (`ANTHROPIC_TRANSLATE_MODEL`).
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.
115
121
  */
116
- declare const DEFAULT_TRANSLATE_MODEL = "claude-sonnet-5-5";
117
- /** The slice of the Anthropic client this translator calls. */
118
- interface AnthropicMessagesClient {
119
- messages: {
120
- create(body: Record<string, unknown>, options?: {
121
- timeout?: number;
122
- maxRetries?: number;
123
- }): Promise<{
124
- content: Array<{
125
- type: string;
126
- text?: string;
127
- }>;
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[];
128
152
  }>;
129
153
  };
130
154
  }
131
- interface AnthropicTranslatorOptions {
155
+ interface LocalizeExistingContentOptions {
156
+ db: MigrationDb;
157
+ sql: MigrationSql;
132
158
  /**
133
- * The API key, usually `process.env.ANTHROPIC_API_KEY`. Without one the
134
- * translator reports `configured: false`: publishes still work, a
135
- * warning is logged, and "Translate now" is hidden.
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.
136
165
  */
137
- apiKey?: string | null;
138
- /** The model id; omitted or blank uses `DEFAULT_TRANSLATE_MODEL`. */
139
- model?: string | null;
140
- /** The site facts the prompt carries. The plugin's own `site`, when given, wins. */
141
- site?: TranslateSite;
142
- /** A client to use instead of constructing one (tests, a proxied client). */
143
- client?: AnthropicMessagesClient;
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
+ }>;
144
222
  }
145
223
  /**
146
- * The system prompt: the library's generic rules plus the site's own facts.
147
- * Exported so a site can read exactly what the model is told.
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/fields.d.ts
241
+ /** Field configs plus the config-level blocks a `blockReferences` field points at. */
242
+ interface FieldSchema {
243
+ fields: readonly Field[];
244
+ /** `config.blocks`, for blocks fields that use `blockReferences`. */
245
+ blocks?: readonly Block[];
246
+ }
247
+ /**
248
+ * The row of `rows` that is the same row as `row`, where the two lists are
249
+ * one Payload array read twice (in two locales, or before and after a
250
+ * save): by id when the row has one, else by position.
251
+ *
252
+ * Payload gives every stored array row an id and keeps it across locales, so
253
+ * a row with an id is matched by it and by nothing else: a row that has an id
254
+ * and no partner has no partner, whatever sits at its position. Position is
255
+ * for rows that have no id yet (a row not saved, a fixture), and for rows of
256
+ * a localized array, whose ids differ per locale.
257
+ */
258
+ declare function sameRow(rows: readonly Doc[] | undefined, row: Doc, index: number, byPosition?: boolean): Doc | undefined;
259
+ /**
260
+ * Every localized string in `doc`, each prefixed with its path, in config
261
+ * order. Two reads of a document compare equal exactly when no copy
262
+ * changed; the path keeps a string moved from one field to another from
263
+ * reading as unchanged.
148
264
  */
149
- declare function translationSystemPrompt(request: Pick<TranslateRequest, "from" | "to" | "site">): string;
150
- /** Tolerant JSON-array parse: strips accidental ``` fences and prose around the array, and checks the shape. */
151
- declare function parseJsonArray(text: string): string[] | null;
265
+ declare function collectLocalizedStrings(schema: FieldSchema, doc: unknown): string[];
266
+ /** The strings to translate for one target locale, and the write that lands them. */
267
+ interface TranslationJob {
268
+ /** Source-locale strings to translate, in order. May repeat; `translateStrings` dedupes. */
269
+ sources: string[];
270
+ /** The target-locale `data` for an update, given the translations of `sources` in the same order. */
271
+ patch: (translated: readonly string[]) => Doc;
272
+ }
152
273
  /**
153
- * The provided `Translator`: one Anthropic Messages call per batch, the
154
- * strings as a JSON array in and out. `@anthropic-ai/sdk` is an optional
155
- * peer, loaded on the first call, so a site with translation off installs
156
- * nothing. Every failure (no key, the SDK missing, a network error, a
157
- * refusal, a malformed or wrong-length reply) returns `null` and is logged
158
- * by the caller; it never throws.
274
+ * What to translate in one target locale, or `null` when the target is
275
+ * already in step with the source.
276
+ *
277
+ * - `source`: the document in the source locale, read at depth 0 so
278
+ * uploads are ids and array rows carry their real ids.
279
+ * - `target`: the document in the target locale, read with
280
+ * `fallbackLocale: false`. With fallback on, a blank target reads as the
281
+ * source, looks "already translated", and nothing is ever written.
282
+ * - `previous`: the source as it was before this change (the last
283
+ * published version, or the hook's `previousDoc` on a collection without
284
+ * drafts). `null` or omitted: there is none.
285
+ *
286
+ * The write carries only the top-level fields that hold a translated
287
+ * string. Inside them it is built from the source's structure (so
288
+ * non-localized values such as links and images are kept, and each array
289
+ * row keeps the source row's id, which is how Payload lands the target copy
290
+ * on the right row), with every localized string set to its translation or
291
+ * to the target copy it already had.
159
292
  */
160
- declare function anthropicTranslator(options: AnthropicTranslatorOptions): Translator;
293
+ declare function translationJob(input: {
294
+ schema: FieldSchema;
295
+ source: Doc;
296
+ target?: Doc | null;
297
+ previous?: Doc | null;
298
+ overwrite?: boolean;
299
+ }): TranslationJob | null;
300
+ //#endregion
301
+ //#region src/translate/hooks.d.ts
302
+ /** True for the admin's autosave (`?autosave=true`), which never translates. */
303
+ declare function isAutosave(req: PayloadRequest): boolean;
161
304
  //#endregion
162
305
  //#region src/translate/document.d.ts
163
306
  type TranslateDocumentOptions = ({
@@ -166,7 +309,7 @@ type TranslateDocumentOptions = ({
166
309
  } | {
167
310
  global: string;
168
311
  }) & {
169
- /** Target locale or locales. Omitted: every locale but the default. */locale?: string | readonly string[]; /** Re-translate every filled source string, replacing target copy a person may have corrected. */
312
+ /** 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. */
170
313
  overwrite?: boolean;
171
314
  /**
172
315
  * The source copy before the change being translated: the last published
@@ -174,10 +317,16 @@ type TranslateDocumentOptions = ({
174
317
  * source string that differs from it is re-translated. Omitted: there is
175
318
  * nothing to compare with, so only blank target strings are filled.
176
319
  */
177
- previous?: Doc | null; /** Defaults to the translator the enabled `autoTranslate` plugin registered. */
178
- translator?: Translator; /** The prompt hint; defaults to the plugin's `context` for the slug, else the slug and the title. */
179
- context?: string; /** Defaults to the plugin's `site`. */
180
- site?: TranslateSite;
320
+ previous?: Doc | null;
321
+ /**
322
+ * Defaults to the test translator a config registered (`autoTranslate({
323
+ * translator })`), else the one Settings → Translation describes: its key,
324
+ * model and instructions.
325
+ */
326
+ translator?: Translator; /** The prompt hint; defaults to the collection's `context` hint, else the slug and the title. */
327
+ context?: string; /** Defaults to Settings → Translation's instructions (the site's code `site` until the screen is saved). */
328
+ site?: TranslateSite; /** Why this write happens, carried on each write as `context.bisonTranslation.kind`. Defaults to `manual`. */
329
+ kind?: BisonTranslationKind;
181
330
  /**
182
331
  * Pass only while the caller's transaction is still open (a seed inside its
183
332
  * own transaction): the reads and writes then join it instead of opening a
@@ -230,67 +379,6 @@ declare function translateStrings(strings: readonly string[], options: Translate
230
379
  /** True unless the translator says it cannot run (an Anthropic translator with no API key). */
231
380
  declare function isTranslatorConfigured(translator: Translator | undefined): translator is Translator;
232
381
  //#endregion
233
- //#region src/translate/fields.d.ts
234
- /** Field configs plus the config-level blocks a `blockReferences` field points at. */
235
- interface FieldSchema {
236
- fields: readonly Field[];
237
- /** `config.blocks`, for blocks fields that use `blockReferences`. */
238
- blocks?: readonly Block[];
239
- }
240
- /**
241
- * The row of `rows` that is the same row as `row`, where the two lists are
242
- * one Payload array read twice (in two locales, or before and after a
243
- * save): by id when the row has one, else by position.
244
- *
245
- * Payload gives every stored array row an id and keeps it across locales, so
246
- * a row with an id is matched by it and by nothing else: a row that has an id
247
- * and no partner has no partner, whatever sits at its position. Position is
248
- * for rows that have no id yet (a row not saved, a fixture), and for rows of
249
- * a localized array, whose ids differ per locale.
250
- */
251
- declare function sameRow(rows: readonly Doc[] | undefined, row: Doc, index: number, byPosition?: boolean): Doc | undefined;
252
- /**
253
- * Every localized string in `doc`, each prefixed with its path, in config
254
- * order. Two reads of a document compare equal exactly when no copy
255
- * changed; the path keeps a string moved from one field to another from
256
- * reading as unchanged.
257
- */
258
- declare function collectLocalizedStrings(schema: FieldSchema, doc: unknown): string[];
259
- /** The strings to translate for one target locale, and the write that lands them. */
260
- interface TranslationJob {
261
- /** Source-locale strings to translate, in order. May repeat; `translateStrings` dedupes. */
262
- sources: string[];
263
- /** The target-locale `data` for an update, given the translations of `sources` in the same order. */
264
- patch: (translated: readonly string[]) => Doc;
265
- }
266
- /**
267
- * What to translate in one target locale, or `null` when the target is
268
- * already in step with the source.
269
- *
270
- * - `source`: the document in the source locale, read at depth 0 so
271
- * uploads are ids and array rows carry their real ids.
272
- * - `target`: the document in the target locale, read with
273
- * `fallbackLocale: false`. With fallback on, a blank target reads as the
274
- * source, looks "already translated", and nothing is ever written.
275
- * - `previous`: the source as it was before this change (the last
276
- * published version, or the hook's `previousDoc` on a collection without
277
- * drafts). `null` or omitted: there is none.
278
- *
279
- * The write carries only the top-level fields that hold a translated
280
- * string. Inside them it is built from the source's structure (so
281
- * non-localized values such as links and images are kept, and each array
282
- * row keeps the source row's id, which is how Payload lands the target copy
283
- * on the right row), with every localized string set to its translation or
284
- * to the target copy it already had.
285
- */
286
- declare function translationJob(input: {
287
- schema: FieldSchema;
288
- source: Doc;
289
- target?: Doc | null;
290
- previous?: Doc | null;
291
- overwrite?: boolean;
292
- }): TranslationJob | null;
293
- //#endregion
294
382
  //#region src/translate/guards.d.ts
295
383
  /**
296
384
  * Any document shape: the guard reads `_status` (absent on collections without
@@ -389,16 +477,22 @@ declare function runAfterCommit(req: PayloadRequest, label: string, work: () =>
389
477
  //#endregion
390
478
  //#region src/translate/state.d.ts
391
479
  interface AutoTranslateState {
392
- translator: Translator;
480
+ /**
481
+ * A translator that replaces the one Settings → Translation describes
482
+ * (its key, model and instructions). For tests and scripts; a site leaves
483
+ * it out. The screen's switch still governs it.
484
+ */
485
+ translator?: Translator;
486
+ /** The site's code `site` option: the instructions until an Admin saves the screen. */
393
487
  site?: TranslateSite;
394
488
  waitUntil?: (promise: Promise<unknown>) => void;
395
489
  sourceLocale: string;
396
490
  targetLocales: string[];
397
- /** Per collection slug, its prompt hint builder. */
491
+ /** Per translated collection slug (every one with localized fields), its prompt hint builder. */
398
492
  collections: Record<string, {
399
493
  context?: (doc: Doc) => string;
400
494
  }>;
401
- /** Per global slug, its prompt hint builder. */
495
+ /** Per translated global slug, its prompt hint builder. */
402
496
  globals: Record<string, {
403
497
  context?: (doc: Doc) => string;
404
498
  }>;
@@ -459,5 +553,5 @@ declare function fillMessages(options: {
459
553
  onProgress?: (done: number, total: number) => void;
460
554
  }): Promise<FillMessagesResult>;
461
555
  //#endregion
462
- export { type AnthropicMessagesClient, type AnthropicTranslatorOptions, type AutoTranslateOptions, type AutoTranslateState, DEFAULT_TRANSLATE_MODEL, type Doc, type FieldSchema, type MessagesJson, TRANSACTION_TIMEOUT_MS, TRANSLATE_NOW, type TranslateDocumentOptions, type TranslateLocaleResult, type TranslateRequest, type TranslateSite, type TranslatedEntity, type TranslationJob, type Translator, anthropicTranslator, autoTranslate, collectLocalizedStrings, draftedTranslationDecision, fillMessages, isTranslatorConfigured, localizedCopyUnchanged, parseJsonArray, readTranslateState, runAfterCommit, sameRow, shouldSkipDraftedTranslation, shouldSkipUndraftedTranslation, translateDocument, translateStrings, translationJob, translationSystemPrompt, withTranslator };
556
+ 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, type FieldSchema, type KeyCheck, type KeySource, type KeyStatus, LIBRARY_DEFAULT_LOCALE, LIBRARY_LOCALES, LIBRARY_LOCALE_CODES, type LibraryLocaleCode, type LocalizeExistingContentOptions, type LocalizedTableCopy, type MessagesJson, type MigrationDb, type MigrationPayload, type MigrationSql, 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, activeAlternates, activeLocales, anthropicTranslator, applyTranslation, autoTranslate, classifyAnthropicError, collectLocalizedStrings, containsWord, decryptApiKey, draftedTranslationDecision, encryptApiKey, estimateCost, fillMessages, hasLocalizedFields, inactiveLocaleRedirect, invalidateActiveLocales, invalidateTranslationSettings, isAutosave, isLocalizedPath, isTranslatorConfigured, localizeExistingContent, localizedCopyUnchanged, modelPrice, parseJsonArray, partitionStatements, readTranslateState, readTranslationSettings, resolveApiKey, resolveModel, runAfterCommit, sameRow, shouldSkipDraftedTranslation, shouldSkipUndraftedTranslation, siteFromInstructions, splitStatements, translateDocument, translateStrings, translation, translationJob, translationSettingsEndpoints, translationSystemPrompt, verifyAnthropicKey, withLibraryLocales, withTranslator };
463
557
  //# sourceMappingURL=translate.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translate.d.mts","names":[],"sources":["../src/translate/types.ts","../src/translate/plugin.ts","../src/translate/anthropic.ts","../src/translate/document.ts","../src/translate/strings.ts","../src/translate/fields.ts","../src/translate/guards.ts","../src/translate/after-commit.ts","../src/translate/state.ts","../src/translate/endpoint.ts","../src/translate/messages.ts"],"mappings":";;;;KACY,GAAA,GAAM,MAAA;;AAAlB;;;;UAOiB,aAAA;EAAA;EAEf,IAAA;;EAEA,KAAA;EAFA;EAIA,KAAA;EAAA;EAEA,YAAA;EAMA;;;;AAIF;EAJE,SAAA,GAAY,MAAA;AAAA;;UAIG,gBAAA;EACf,IAAA;EACA,EAAA;EAIA;EAFA,OAAA;EAEoB;EAApB,IAAA,GAAO,aAAA;AAAA;;;;;;;;;;KAYG,UAAA,KAAe,OAAA,YAAmB,OAAA,EAAS,gBAAA,KAAqB,OAAA;EAC1E,UAAA;AAAA;;KAIU,gBAAA;EAGN,IAAA,UAEA;EAAA,OAAA,IAAW,GAAA,EAAK,GAAA;AAAA;AAAA,UAGL,oBAAA;EAHQ;AAGzB;;;;EAME,OAAA;EAMY;EAJZ,WAAA,GAAc,gBAAA;EAYP;EAVP,OAAA,GAAU,gBAAA;EAUU;EARpB,UAAA,EAAY,UAAA;EAJZ;;;;;EAUA,SAAA,IAAa,OAAA,EAAS,OAAA;EAAtB;EAEA,IAAA,GAAO,aAAA;AAAA;;UAOQ,qBAAA;EACf,MAAA;EAIA;EAFA,MAAA;EAEK;EAAL,KAAA;AAAA;;;;AAxFF;;;;;AAOA;;;;;;;;;;;;AAkBA;;;;;iBCkDgB,aAAA,CAAc,OAAA,EAAS,oBAAA,GAAuB,MAAA;;;;;AD3E9D;;;cEMa,uBAAA;;UAYI,uBAAA;EACf,QAAA;IACE,MAAA,CACE,IAAA,EAAM,MAAA,mBACN,OAAA;MAAY,OAAA;MAAkB,UAAA;IAAA,IAC7B,OAAA;MAAU,OAAA,EAAS,KAAA;QAAQ,IAAA;QAAc,IAAA;MAAA;IAAA;EAAA;AAAA;AAAA,UAI/B,0BAAA;;;;;;EAMf,MA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;IAAiB,OAAA,IAAW,GAAA,EAAK,GAAA;EAAA;AAAA;;;;;;;iBAc5B,kBAAA,CACd,MAAA,EAAQ,MAAA,GAAS,eAAA,GAAkB,OAAA,aAClC,QAAA,CAAS,kBAAA;ARQZ;;;;;;AAAA,iBQEgB,cAAA,WAAyB,MAAA,GAAS,eAAA,CAAA,CAAiB,MAAA,EAAQ,CAAA,EAAG,UAAA,EAAY,UAAA,GAAa,CAAA;;;;cCvC1F,aAAA;;;;KCHD,YAAA,sCAAkD,YAAA;EAAA,CAAoB,GAAA,WAAc,YAAA;AAAA;AAAA,UAgE/E,kBAAA;EV5DA;EU8Df,QAAA,EAAU,YAAA;;EAEV,UAAA;EV9DA;;;;;;EUqEA,QAAA;AAAA;AVrDF;;;;;;;AAAA,iBU+DsB,YAAA,CAAa,OAAA;EACjC,MAAA,EAAQ,YAAA;EACR,MAAA,GAAS,YAAA;EACT,UAAA,EAAY,UAAA;EACZ,IAAA;EACA,EAAA;EACA,KAAA;EACA,OAAA;EACA,IAAA,GAAO,aAAA;EACP,UAAA,IAAc,IAAA,UAAc,KAAA;AAAA,IAC1B,OAAA,CAAQ,kBAAA"}
1
+ {"version":3,"file":"translate.d.mts","names":[],"sources":["../src/translate/plugin.ts","../src/translate/languages.ts","../src/translate/migrate-locales.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;;;;;;AAA9D;;;cCda,eAAA;EAAA;;;;;;KAKD,iBAAA,WAA4B,eAAA;AAAA,cAE3B,sBAAA,EAAwB,iBAAA;AAPrC;AAAA,cAUa,oBAAA;;;;;;;iBAcG,kBAAA,CACd,YAAA,EAAc,MAAA,mBACb,OAAA,CAAQ,MAAA;;UAyBM,aAAA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