@verbatra/sdk 0.9.3 → 0.11.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 +56 -112
- package/dist/config-schema.json +200 -10
- package/dist/index.cjs +15450 -4566
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3152 -714
- package/dist/index.d.ts +3152 -714
- package/dist/index.js +15411 -4548
- package/dist/index.js.map +1 -1
- package/package.json +16 -15
package/README.md
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
<h1 align="center">@verbatra/sdk</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
Programmatic API to automate i18n translation and keep your locale files in sync across languages, using OpenAI, Anthropic, Gemini, DeepL, or an openai-compatible local or self-hosted model.
|
|
8
|
+
Programmatic API to automate i18n translation and keep your locale files in sync across languages, using OpenAI, Anthropic, Gemini, DeepL, Google Cloud Translation, or an openai-compatible local or self-hosted model.
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="https://www.npmjs.com/package/@verbatra/sdk"><img src="https://img.shields.io/npm/v
|
|
13
|
-
<a href="https://
|
|
14
|
-
<a href="https://
|
|
15
|
-
<a href="https://github.com/verbatra/verbatra/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue
|
|
12
|
+
<a href="https://www.npmjs.com/package/@verbatra/sdk"><img src="https://img.shields.io/npm/v/%40verbatra%2Fsdk?label=%40verbatra%2Fsdk&color=7b1fa2&labelColor=0b0b12" alt="@verbatra/sdk npm version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@verbatra/sdk"><img src="https://img.shields.io/npm/types/%40verbatra%2Fsdk?color=7b1fa2&labelColor=0b0b12" alt="Ships TypeScript types" /></a>
|
|
14
|
+
<a href="https://github.com/verbatra/verbatra/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/verbatra/verbatra/ci.yml?branch=main&label=CI&labelColor=0b0b12" alt="CI status on main" /></a>
|
|
15
|
+
<a href="https://github.com/verbatra/verbatra/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?color=7b1fa2&labelColor=0b0b12" alt="License: MIT" /></a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
## Description
|
|
19
19
|
|
|
20
|
-
`@verbatra/sdk` is the engine behind verbatra: load and validate a config,
|
|
20
|
+
`@verbatra/sdk` is the engine behind verbatra: load and validate a config, translate every target locale once, watch the source and re-translate on each change, check or diff your locales without writing, validate the whole project setup before you spend anything, extract keys from your application source, or hand strings off to a human translator and read them back. Each run diffs your source against the lock file and sends only what changed, and every candidate value, whatever produced it, passes one integrity gate before it is written. [`@verbatra/cli`](https://www.npmjs.com/package/@verbatra/cli) is a thin wrapper over this package.
|
|
21
21
|
|
|
22
22
|
## Requirements
|
|
23
23
|
|
|
@@ -73,153 +73,97 @@ export default defineConfig({
|
|
|
73
73
|
});
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
`files.pattern` must contain the `{locale}` token, `targetLocales` must
|
|
76
|
+
`files.pattern` must contain the `{locale}` token, and `targetLocales` must neither include `sourceLocale` nor list one locale twice. Beyond the required keys, the config carries optional `glossary` and `tone`, opt-in `prune` and `generatePlurals`, per-key `maxLength` review budgets, and the `maxTokens`/`budgetBehavior` run budget. Every key, every default, and every provider's option shape is documented on the [Configuration page](https://verbatra.kreitz-webdev.de/docs/config-file); the providers and their key variables are on the [Providers page](https://verbatra.kreitz-webdev.de/docs/providers).
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
API keys are never part of the config. Each provider reads its own environment variable, and the SDK never accepts one as an argument.
|
|
79
79
|
|
|
80
80
|
## API reference
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
Every flow takes an `input` object and an optional `deps` object for injecting the file system, the provider factory, or an adapter registry of your own; the two config helpers below take neither. The signatures below are the ones the package publishes in `dist/index.d.ts`.
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
### `defineConfig(config): VerbatraConfigInput`
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Discovers and validates the configuration. With no arguments it searches upward from the current working directory; `options` accepts `cwd`, an explicit `configPath`, an in-memory `configOverride`, and an `fs` seam. Precedence is `configOverride`, then `configPath`, then the search. Resolves to the validated `VerbatraConfig`, and throws an `SdkError` if no config is found (`CONFIG_NOT_FOUND`) or it fails validation (`CONFIG_INVALID`). A `glossary` given as a file path is read and validated here, so every downstream call receives a plain term map.
|
|
89
|
-
|
|
90
|
-
### `translate(input): Promise<RunSummary>`
|
|
91
|
-
|
|
92
|
-
Runs the one-shot read, diff, translate, write flow over every target locale. `input` is a `TranslateInput`: `{ config, cwd?, locales?, dryRun?, prune?, generatePlurals?, cache?, concurrency?, lockAcquireTimeoutMs?, onProgress?, onLockWait? }`. With `dryRun: true` it reads, diffs, and reports without calling the provider or writing anything. `locales` narrows the run to a subset of the configured target locales, exactly as it does on `check` and `diff`, and a locale that is not configured raises `UNKNOWN_LOCALE` before anything is read or spent. `prune` and `generatePlurals` each override the matching config option for this run.
|
|
93
|
-
|
|
94
|
-
`cache` (on by default, and ignored on a dry run) toggles the local content-addressed translation-memory cache in `verbatra.cache.json`: a key whose source content is unchanged, including under a renamed key or shared with another key, is served from the cache instead of being re-sent to the provider. A cached value is re-checked against that key's own current source first, and one that fails the gate falls through to the provider rather than being written. `concurrency` (defaults to 1, strictly serial) is how many target locales may run at once; it must be an integer of at least 1, and on a live run a value above 1 is refused when the config sets `maxTokens`, because concurrent locales would overshoot the budget nondeterministically. `lockAcquireTimeoutMs` overrides how long a locale's write lock keeps retrying before it fails. `onProgress` receives a structured event once per locale before and after it runs, once per provider sub-batch, and once when the locale loop ends; `onLockWait` fires while a locale's write lock is blocked on another process holding it. The SDK writes to no stream, so these callbacks are the only progress signal.
|
|
95
|
-
|
|
96
|
-
Resolves to a `RunSummary`: `dryRun`, `locales`, `succeeded`, `partial`, `failed`, plus `usage` when any provider call reported tokens and `budget` when `maxTokens` is configured. A locale's `status` is `"succeeded"` when nothing was withheld (a no-op with no candidate keys included), `"partial"` when it accepted at least one key and withheld at least one, and `"failed"` when it withheld keys and accepted none, or threw. Each `LocaleSummary` carries `locale`, `status`, `translated`, `unchanged`, `orphaned`, `pruned`, `invalidIcuSource`, `cacheHits`, `integrityMismatches`, `providerFailures`, `budgetWithheld`, `generated`, `notices`, `needsReview`, `unfilled`, `malformedRows`, `duplicateKeys`, an optional `usage`, and an optional `error` on a locale that threw. `cacheHits` are keys served from the translation-memory cache rather than the provider. `integrityMismatches` is a translation that came back and was withheld by verbatra's integrity gate, whose rejection reasons are the exported `IntegrityGateReason` union. `providerFailures` is a key withheld because nothing was translated for it (the provider call failed, or the response was still missing that key), with any secret-free failure code and message reported in `notices`. `budgetWithheld` is a candidate never sent because a `maxTokens` budget in `"stop"` mode had already tripped. `needsReview` flags accepted keys the review heuristics want a human to look at, and never withholds anything. `unfilled`, `malformedRows`, and `duplicateKeys` are populated only by `importWorkbook`, which returns this same shape. Every withheld key keeps its prior lock hash and is retried next run.
|
|
97
|
-
|
|
98
|
-
Whole-run failures throw an `SdkError`: an unknown format, a `locales` entry that is not a configured target, provider construction (including a missing API key), an unreadable or invalid source file, a corrupt lock file, an invalid `concurrency`, or the concurrency-and-budget conflict above. A per-locale failure never throws; it is isolated on that locale's summary. On a non-dry run the flow also writes `.verbatra-local/run-status.json` (best-effort, read back through `runStatus`).
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
const preview = await translate({ config, dryRun: true });
|
|
102
|
-
```
|
|
86
|
+
Identity helper that types a config literal against the provider you name in `provider.id`. See [Configuration](https://verbatra.kreitz-webdev.de/docs/config-file).
|
|
103
87
|
|
|
104
|
-
### `
|
|
105
|
-
|
|
106
|
-
Watches the source file and re-runs the translate flow on each debounced change. `input` is `{ config, cwd?, locales?, debounceMs?, onRun, cache?, concurrency?, lockAcquireTimeoutMs?, onLockWait?, onProgress? }`; `debounceMs` defaults to 300, `locales` narrows every run of the session to a subset of the configured target locales and is validated once at startup rather than per cycle, and the last five are passed straight through to every run. One run starts immediately at startup, before any change arrives. Runs are serialized, so changes during a run collapse into a single follow-up.
|
|
107
|
-
|
|
108
|
-
`onRun` receives a `WatchRunResult` per run: `{ status: "succeeded", summary }` or `{ status: "failed", error }` with a secret-free `{ code, message }`, so a failing run is reported and watching continues. `watch` itself throws only at startup: `UNKNOWN_LOCALE` for a `locales` entry that is not a configured target, `CONCURRENCY_INVALID` or `CONCURRENCY_BUDGET_CONFLICT` for a `concurrency` no cycle could honor (resolved once, before the watcher exists, rather than failing every cycle), and `SOURCE_UNREADABLE` when the source locale file is absent. Resolves to a `WatchController` whose `stop()` closes the watcher and awaits the in-flight run.
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
import { loadConfig, watch } from "@verbatra/sdk";
|
|
112
|
-
|
|
113
|
-
const config = await loadConfig();
|
|
114
|
-
const controller = await watch({
|
|
115
|
-
config,
|
|
116
|
-
onRun: (result) => console.log(result.status),
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// Stop cleanly on Ctrl-C.
|
|
120
|
-
process.on("SIGINT", () => void controller.stop());
|
|
121
|
-
```
|
|
88
|
+
### `loadConfig(options?): Promise<VerbatraConfig>`
|
|
122
89
|
|
|
123
|
-
|
|
90
|
+
Discover, load, and validate the project config, searching upward from the working directory. Throws an `SdkError` when no config is found or validation fails.
|
|
124
91
|
|
|
125
|
-
|
|
92
|
+
### `translate(input, deps?): Promise<RunSummary>`
|
|
126
93
|
|
|
127
|
-
|
|
128
|
-
import { check, loadConfig } from "@verbatra/sdk";
|
|
94
|
+
Translate every configured target locale once. The summary splits locales into succeeded, partial, and failed, and carries the run's notices, review flags, token usage, and budget standing. See [`verbatra translate`](https://verbatra.kreitz-webdev.de/docs/cli/translate).
|
|
129
95
|
|
|
130
|
-
|
|
131
|
-
const summary = await check({ config });
|
|
132
|
-
|
|
133
|
-
if (!summary.inSync) {
|
|
134
|
-
console.log("Locales are out of sync; run verbatra translate.");
|
|
135
|
-
}
|
|
136
|
-
```
|
|
96
|
+
### `watch(input, deps?): Promise<WatchController>`
|
|
137
97
|
|
|
138
|
-
|
|
98
|
+
Watch the source locale file and re-translate on every change until the returned controller is stopped. Each run gets a fresh budget. See [`verbatra watch`](https://verbatra.kreitz-webdev.de/docs/cli/watch).
|
|
139
99
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
```ts
|
|
143
|
-
import { diff, loadConfig } from "@verbatra/sdk";
|
|
144
|
-
|
|
145
|
-
const config = await loadConfig();
|
|
146
|
-
const summary = await diff({ config });
|
|
147
|
-
```
|
|
100
|
+
### `check(input, deps?): Promise<CheckSummary>`
|
|
148
101
|
|
|
149
|
-
|
|
102
|
+
Count missing, stale, and up-to-date keys per locale. Calls no provider and writes nothing. See [`verbatra check`](https://verbatra.kreitz-webdev.de/docs/cli/check).
|
|
150
103
|
|
|
151
|
-
|
|
104
|
+
### `diff(input, deps?): Promise<DiffSummary>`
|
|
152
105
|
|
|
153
|
-
|
|
154
|
-
import { doctor } from "@verbatra/sdk";
|
|
106
|
+
Name the keys that would be added, re-translated, or orphaned per locale. Calls no provider and writes nothing. See [`verbatra diff`](https://verbatra.kreitz-webdev.de/docs/cli/diff).
|
|
155
107
|
|
|
156
|
-
|
|
108
|
+
### `doctor(input?, deps?): Promise<DoctorResult>`
|
|
157
109
|
|
|
158
|
-
|
|
159
|
-
console.log(`${entry.status}: ${entry.title} - ${entry.detail}`);
|
|
160
|
-
}
|
|
110
|
+
Validate the config, the format adapter, the provider, its key variable, and the source locale file in one pass, reporting every problem at once. Reads no key value. See [`verbatra doctor`](https://verbatra.kreitz-webdev.de/docs/cli/doctor).
|
|
161
111
|
|
|
162
|
-
|
|
163
|
-
```
|
|
112
|
+
### `extract(input, deps?): Promise<ExtractResult>`
|
|
164
113
|
|
|
165
|
-
|
|
114
|
+
Scan your application source for translation call sites and add the new keys to the source locale file. See [`verbatra extract`](https://verbatra.kreitz-webdev.de/docs/cli/extract).
|
|
166
115
|
|
|
167
|
-
|
|
116
|
+
### `generateTypes(input, deps?): Promise<GenerateTypesResult>`
|
|
168
117
|
|
|
169
|
-
|
|
118
|
+
Generate a TypeScript declaration of every source catalog key and the arguments its message interpolates. See [`verbatra types`](https://verbatra.kreitz-webdev.de/docs/cli/types).
|
|
170
119
|
|
|
171
|
-
### `
|
|
120
|
+
### `pseudolocalize(input, deps?): Promise<PseudolocalizeResult>`
|
|
172
121
|
|
|
173
|
-
|
|
122
|
+
Build a pseudolocale from the source strings, accented, expanded, and bracketed, without calling a provider. See [`verbatra pseudo`](https://verbatra.kreitz-webdev.de/docs/cli/pseudo).
|
|
174
123
|
|
|
175
|
-
|
|
124
|
+
### `exportWorkbook(input, deps?): Promise<ExportWorkbookResult>`
|
|
176
125
|
|
|
177
|
-
|
|
178
|
-
import { exportWorkbook, importWorkbook, loadConfig } from "@verbatra/sdk";
|
|
126
|
+
Write the strings that need translating to a translator handoff: a styled Excel workbook, or one CSV or TSV file per locale. See [Manual translation](https://verbatra.kreitz-webdev.de/docs/manual-translation).
|
|
179
127
|
|
|
180
|
-
|
|
128
|
+
### `importWorkbook(input, deps?): Promise<RunSummary>`
|
|
181
129
|
|
|
182
|
-
|
|
183
|
-
const { path } = await exportWorkbook({ config });
|
|
130
|
+
Read a filled handoff back into the locale files, through the same integrity gate a translate run applies, returning the same `RunSummary` shape.
|
|
184
131
|
|
|
185
|
-
|
|
186
|
-
const summary = await importWorkbook({ config, workbook: path });
|
|
187
|
-
```
|
|
132
|
+
### `exportTmx(input, deps?)` and `importTmx(input, deps?)`
|
|
188
133
|
|
|
189
|
-
See [
|
|
134
|
+
Move the whole translation memory out as a TMX file any other translation tool can read, or read one in. See [`verbatra tmx`](https://verbatra.kreitz-webdev.de/docs/cli/tmx).
|
|
190
135
|
|
|
191
136
|
### More entry points
|
|
192
137
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
- `verbatraConfigSchema` is the zod schema `loadConfig` validates against, for validating a config object you assembled yourself. The same schema is published as a JSON Schema document at `@verbatra/sdk/config-schema.json`, generated at build time, so an editor can complete and validate a `.verbatrarc.json` or YAML config; the config accepts an optional top-level `$schema` key to point at it, which is ignored at runtime. `scaffoldingMetadata` carries the facts a project generator needs to write a first config (each provider's key environment variable, a starting model, the token-limit option name it takes, and the supported formats), which is what `verbatra init` renders from. Neither holds an API key value.
|
|
210
|
-
- `SdkFs` is the file-system port every file the SDK touches goes through, so supplying your own as the `deps.fs` option redirects all of it and an entire run can be held in memory: the run-status file, the lock file, the config glossary, the workbook and delimited I/O, and the locale files themselves, which the format adapters read and write through a port built from this one. Reads are size-bounded by contract and writes are expected to be atomic. The single exception is a caller-supplied `deps.adapterRegistry`: those adapters were constructed by you, so `deps.fs` cannot reach them and passing both means you own that wiring.
|
|
138
|
+
The remaining exports are the building blocks Verbatra Studio, the MCP server, and other tooling sit on. Most are a one-call read or a locked single-key write.
|
|
139
|
+
|
|
140
|
+
| Export | What it does |
|
|
141
|
+
| --- | --- |
|
|
142
|
+
| `editEntry`, `retranslateEntry` | Save a manual translation for one key, or re-run the provider for one key. Both run the candidate through the same integrity gate as a full run and hold the same per-locale write lock; a rejection names an `IntegrityGateReason` and writes nothing |
|
|
143
|
+
| `keyValue`, `localeValues` | Read one key's current source and target values, or a whole locale's key/value pairs |
|
|
144
|
+
| `keyIntegrity` | Report, per changed key, whether its placeholders, inline markup, and ICU still match the locked baseline |
|
|
145
|
+
| `lockState`, `loadLockFile` | Read the lock file's existence, version, and per-locale drift, or the lock file itself |
|
|
146
|
+
| `runStatus`, `budgetStanding` | Read the review-flag and token-usage snapshot the last non-dry run left behind, and turn a `RunBudget` into a standing |
|
|
147
|
+
| `readLocaleFileSnapshot`, `diffLocaleSnapshots` | Snapshot one locale file as per-key content hashes and compare two snapshots: the primitives behind live-refresh watching |
|
|
148
|
+
| `loadConfigWithMeta`, `readGlossaryFile`, `updateGlossaryTerm` | `loadConfig` plus config-source and glossary provenance, and the file-backed glossary read and single-term write that take that provenance rather than a path |
|
|
149
|
+
| `createLocalePathResolver` | Build the two-way locale-to-path mapping from a config, so a watcher can decide whether a changed file concerns verbatra at all |
|
|
150
|
+
| `createDefaultRegistry`, `createTreeFileAdapter`, `createFlatFileAdapter`, `AdapterRegistry`, `nodeAdapterFs` | The format-adapter construction surface: build an adapter for a format verbatra does not ship and hand the registry to a flow as `deps.adapterRegistry` |
|
|
151
|
+
| `verbatraConfigSchema`, `scaffoldingMetadata` | The zod schema `loadConfig` validates against (also published as `@verbatra/sdk/config-schema.json`), and the facts a project generator needs to write a first config |
|
|
152
|
+
| `LOCK_FILE_NAME`, `CACHE_FILE_NAME`, `EXCHANGE_FORMATS`, `DEFAULT_EXCHANGE_FORMAT`, `DEFAULT_WORKBOOK_PATH`, `DEFAULT_DELIMITED_PATH`, `DEFAULT_TMX_PATH`, `DEFAULT_TYPES_PATH` | The file names and handoff formats a run uses, so tooling can find, offer, or gitignore them without restating the list |
|
|
153
|
+
| `SdkFs`, `redact`, `resolveDryRun`, `isCustomFormatId`, `tmxErrorLocation` | The file-system port every file the SDK touches goes through, the secret-redaction pass, and small helpers for agreeing with verbatra rather than restating it |
|
|
211
154
|
|
|
212
155
|
## Errors and results
|
|
213
156
|
|
|
214
|
-
`SdkError` is the SDK's own structured error type, thrown for whole-run failures such as a missing or invalid config or an unreadable source file. It carries a stable `code` from the exported `SdkErrorCode` union and never contains an API key. It is not the only error a caller can see: `retranslateEntry` propagates the provider's own `ProviderError
|
|
157
|
+
`SdkError` is the SDK's own structured error type, thrown for whole-run failures such as a missing or invalid config or an unreadable source file. It carries a stable `code` from the exported `SdkErrorCode` union and never contains an API key. It is not the only error a caller can see: `retranslateEntry` propagates the provider's own `ProviderError`, and a target locale file that exists but is malformed rejects with the adapter's own `AdapterError`.
|
|
215
158
|
|
|
216
|
-
Per-locale failures do not throw
|
|
159
|
+
Per-locale failures do not throw. They are recorded on the `RunSummary` so one failing locale never aborts the others, including a locale whose write lock could not be acquired. A locale's `error.code` is a preserved string from the underlying provider or adapter failure (`"LOCALE_FAILED"` is only the fallback), deliberately wider than `SdkErrorCode`, so do not treat it as a closed set.
|
|
217
160
|
|
|
218
161
|
## Documentation
|
|
219
162
|
|
|
220
163
|
- [Documentation site](https://verbatra.kreitz-webdev.de)
|
|
221
|
-
- [
|
|
222
|
-
- [
|
|
164
|
+
- [SDK reference](https://verbatra.kreitz-webdev.de/docs/sdk)
|
|
165
|
+
- [Configuration](https://verbatra.kreitz-webdev.de/docs/config-file)
|
|
166
|
+
- [`@verbatra/cli`](https://www.npmjs.com/package/@verbatra/cli) for the command-line tool
|
|
223
167
|
|
|
224
168
|
## License
|
|
225
169
|
|
package/dist/config-schema.json
CHANGED
|
@@ -18,16 +18,30 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"format": {
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
"anyOf": [
|
|
22
|
+
{
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": [
|
|
25
|
+
"i18next-json",
|
|
26
|
+
"vue-i18n-json",
|
|
27
|
+
"next-intl-json",
|
|
28
|
+
"ngx-translate-json",
|
|
29
|
+
"xliff",
|
|
30
|
+
"yaml",
|
|
31
|
+
"arb",
|
|
32
|
+
"properties",
|
|
33
|
+
"apple-strings",
|
|
34
|
+
"apple-xcstrings",
|
|
35
|
+
"android-xml",
|
|
36
|
+
"gettext-po",
|
|
37
|
+
"ini",
|
|
38
|
+
"resx"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"type": "string",
|
|
43
|
+
"pattern": "^custom:[a-z0-9]+(?:-[a-z0-9]+)*$"
|
|
44
|
+
}
|
|
31
45
|
]
|
|
32
46
|
},
|
|
33
47
|
"files": {
|
|
@@ -197,6 +211,31 @@
|
|
|
197
211
|
],
|
|
198
212
|
"additionalProperties": false
|
|
199
213
|
},
|
|
214
|
+
{
|
|
215
|
+
"type": "object",
|
|
216
|
+
"properties": {
|
|
217
|
+
"id": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"const": "google-translate"
|
|
220
|
+
},
|
|
221
|
+
"options": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"properties": {
|
|
224
|
+
"requestTimeoutMs": {
|
|
225
|
+
"type": "integer",
|
|
226
|
+
"exclusiveMinimum": 0,
|
|
227
|
+
"maximum": 9007199254740991
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"additionalProperties": false
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"required": [
|
|
234
|
+
"id",
|
|
235
|
+
"options"
|
|
236
|
+
],
|
|
237
|
+
"additionalProperties": false
|
|
238
|
+
},
|
|
200
239
|
{
|
|
201
240
|
"type": "object",
|
|
202
241
|
"properties": {
|
|
@@ -277,11 +316,40 @@
|
|
|
277
316
|
"generatePlurals": {
|
|
278
317
|
"type": "boolean"
|
|
279
318
|
},
|
|
319
|
+
"fuzzyCache": {
|
|
320
|
+
"type": "object",
|
|
321
|
+
"properties": {
|
|
322
|
+
"enabled": {
|
|
323
|
+
"type": "boolean"
|
|
324
|
+
},
|
|
325
|
+
"threshold": {
|
|
326
|
+
"type": "number",
|
|
327
|
+
"minimum": 0.5,
|
|
328
|
+
"maximum": 1
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"required": [
|
|
332
|
+
"enabled"
|
|
333
|
+
],
|
|
334
|
+
"additionalProperties": false
|
|
335
|
+
},
|
|
280
336
|
"maxBatchSize": {
|
|
281
337
|
"type": "integer",
|
|
282
338
|
"exclusiveMinimum": 0,
|
|
283
339
|
"maximum": 9007199254740991
|
|
284
340
|
},
|
|
341
|
+
"maxLength": {
|
|
342
|
+
"type": "object",
|
|
343
|
+
"propertyNames": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"minLength": 1
|
|
346
|
+
},
|
|
347
|
+
"additionalProperties": {
|
|
348
|
+
"type": "integer",
|
|
349
|
+
"exclusiveMinimum": 0,
|
|
350
|
+
"maximum": 9007199254740991
|
|
351
|
+
}
|
|
352
|
+
},
|
|
285
353
|
"maxTokens": {
|
|
286
354
|
"type": "integer",
|
|
287
355
|
"exclusiveMinimum": 0,
|
|
@@ -293,6 +361,128 @@
|
|
|
293
361
|
"warn",
|
|
294
362
|
"stop"
|
|
295
363
|
]
|
|
364
|
+
},
|
|
365
|
+
"rates": {
|
|
366
|
+
"type": "object",
|
|
367
|
+
"properties": {
|
|
368
|
+
"asOf": {
|
|
369
|
+
"type": "string",
|
|
370
|
+
"format": "date",
|
|
371
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
|
|
372
|
+
},
|
|
373
|
+
"currency": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"pattern": "^[A-Z]{3}$"
|
|
376
|
+
},
|
|
377
|
+
"table": {
|
|
378
|
+
"type": "object",
|
|
379
|
+
"propertyNames": {
|
|
380
|
+
"type": "string",
|
|
381
|
+
"minLength": 1
|
|
382
|
+
},
|
|
383
|
+
"additionalProperties": {
|
|
384
|
+
"anyOf": [
|
|
385
|
+
{
|
|
386
|
+
"type": "object",
|
|
387
|
+
"properties": {
|
|
388
|
+
"inputPerMillionTokens": {
|
|
389
|
+
"type": "number",
|
|
390
|
+
"minimum": 0,
|
|
391
|
+
"maximum": 1000000000
|
|
392
|
+
},
|
|
393
|
+
"outputPerMillionTokens": {
|
|
394
|
+
"type": "number",
|
|
395
|
+
"minimum": 0,
|
|
396
|
+
"maximum": 1000000000
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
"required": [
|
|
400
|
+
"inputPerMillionTokens",
|
|
401
|
+
"outputPerMillionTokens"
|
|
402
|
+
],
|
|
403
|
+
"additionalProperties": false
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"type": "object",
|
|
407
|
+
"properties": {
|
|
408
|
+
"perMillionCharacters": {
|
|
409
|
+
"type": "number",
|
|
410
|
+
"minimum": 0,
|
|
411
|
+
"maximum": 1000000000
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"required": [
|
|
415
|
+
"perMillionCharacters"
|
|
416
|
+
],
|
|
417
|
+
"additionalProperties": false
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"required": [
|
|
424
|
+
"asOf",
|
|
425
|
+
"currency",
|
|
426
|
+
"table"
|
|
427
|
+
],
|
|
428
|
+
"additionalProperties": false
|
|
429
|
+
},
|
|
430
|
+
"extract": {
|
|
431
|
+
"type": "object",
|
|
432
|
+
"properties": {
|
|
433
|
+
"framework": {
|
|
434
|
+
"type": "string",
|
|
435
|
+
"enum": [
|
|
436
|
+
"i18next"
|
|
437
|
+
]
|
|
438
|
+
},
|
|
439
|
+
"roots": {
|
|
440
|
+
"minItems": 1,
|
|
441
|
+
"type": "array",
|
|
442
|
+
"items": {
|
|
443
|
+
"type": "string",
|
|
444
|
+
"minLength": 1
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"exclude": {
|
|
448
|
+
"type": "array",
|
|
449
|
+
"items": {
|
|
450
|
+
"type": "string",
|
|
451
|
+
"minLength": 1
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
"literals": {
|
|
455
|
+
"type": "object",
|
|
456
|
+
"properties": {
|
|
457
|
+
"ignore": {
|
|
458
|
+
"type": "array",
|
|
459
|
+
"items": {
|
|
460
|
+
"type": "string",
|
|
461
|
+
"minLength": 1
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"additionalProperties": false
|
|
466
|
+
},
|
|
467
|
+
"unused": {
|
|
468
|
+
"type": "object",
|
|
469
|
+
"properties": {
|
|
470
|
+
"ignore": {
|
|
471
|
+
"type": "array",
|
|
472
|
+
"items": {
|
|
473
|
+
"type": "string",
|
|
474
|
+
"minLength": 1
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
"additionalProperties": false
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
"required": [
|
|
482
|
+
"framework",
|
|
483
|
+
"roots"
|
|
484
|
+
],
|
|
485
|
+
"additionalProperties": false
|
|
296
486
|
}
|
|
297
487
|
},
|
|
298
488
|
"required": [
|