@verbatra/sdk 0.4.2 → 0.4.4

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/dist/index.d.cts CHANGED
@@ -37,7 +37,7 @@ type TranslationEntry$1 = Readonly<z.infer<typeof translationEntrySchema$1>>;
37
37
  * (counts matter). Always returned (never thrown) for an ordinary mismatch.
38
38
  */
39
39
  interface PlaceholderIntegrityResult {
40
- /** True when nothing is missing or extra and order is preserved. */
40
+ /** True when nothing is missing or extra: the multisets match, regardless of order. */
41
41
  readonly matches: boolean;
42
42
  /** Occurrences present in source but absent from the translation, one per dropped occurrence. Sorted. */
43
43
  readonly missing: readonly string[];
@@ -153,8 +153,11 @@ type AnthropicModel = Anthropic.Messages.Model;
153
153
  *
154
154
  * - `FORMALITY_DOWNGRADED`: a requested formality was not applied (the free tier does not support it).
155
155
  * - `GLOSSARY_IGNORED`: a supplied generic glossary was not applied.
156
+ * - `PLACEHOLDER_UNSUPPORTED`: at least one placeholder- or ICU-bearing entry was left untranslated
157
+ * because DeepL cannot preserve those tokens; such entries are withheld (absent from the result maps)
158
+ * rather than sent to DeepL and mangled.
156
159
  */
157
- type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED";
160
+ type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED" | "PLACEHOLDER_UNSUPPORTED";
158
161
  /**
159
162
  * An observable, structured signal that something was gracefully degraded (not an
160
163
  * error). Carries only a stable code and a static message, never a key or content.
@@ -378,6 +381,8 @@ declare function loadConfig(options?: LoadConfigOptions): Promise<VerbatraConfig
378
381
  * (thrown by `loadConfig`).
379
382
  * - `CONFIG_INVALID`: a config was found but is unparseable or fails validation (thrown by `loadConfig`).
380
383
  * - `UNKNOWN_FORMAT`: no adapter is registered for the configured format (thrown by `translate`).
384
+ * - `UNKNOWN_LOCALE`: a requested locale is not among the configured target locales (thrown by
385
+ * `check`, `diff`, and `exportWorkbook` via the shared locale selection).
381
386
  * - `PROVIDER_CONSTRUCTION_FAILED`: the provider factory threw; wraps the provider's own error, including
382
387
  * a missing `*_API_KEY` reported as `MISSING_API_KEY` (thrown by `translate`, non-dry-run only).
383
388
  * - `SOURCE_UNREADABLE`: the source locale file is absent (thrown by `translate`, and by `watch` at startup).
@@ -388,7 +393,7 @@ declare function loadConfig(options?: LoadConfigOptions): Promise<VerbatraConfig
388
393
  * per-locale failure carries no string code of its own. See the surfaced-not-thrown distinction on
389
394
  * `translate`.
390
395
  */
391
- type SdkErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "UNKNOWN_FORMAT" | "PROVIDER_CONSTRUCTION_FAILED" | "SOURCE_UNREADABLE" | "SOURCE_INVALID" | "LOCK_FILE_INVALID" | "LOCALE_FAILED";
396
+ type SdkErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "UNKNOWN_FORMAT" | "UNKNOWN_LOCALE" | "PROVIDER_CONSTRUCTION_FAILED" | "SOURCE_UNREADABLE" | "SOURCE_INVALID" | "LOCK_FILE_INVALID" | "LOCALE_FAILED";
392
397
  /** The single structured error the SDK throws or records. Never carries a secret. */
393
398
  declare class SdkError extends Error {
394
399
  /** The stable {@link SdkErrorCode} for this failure; branch on this, not the message. */
@@ -648,7 +653,8 @@ interface CheckDeps {
648
653
  * @param deps - Optional composition seams (registry, file system) for tests.
649
654
  * @returns The aggregate and per-locale drift status.
650
655
  * @throws {@link SdkError} `UNKNOWN_FORMAT`, `SOURCE_UNREADABLE`, `SOURCE_INVALID`, `LOCK_FILE_INVALID`
651
- * with the same meanings as in `translate`.
656
+ * with the same meanings as in `translate`, or `UNKNOWN_LOCALE` when a requested locale is not
657
+ * among the configured target locales.
652
658
  */
653
659
  declare function check(input: CheckInput, deps?: CheckDeps): Promise<CheckSummary>;
654
660
 
@@ -697,12 +703,13 @@ interface DiffDeps {
697
703
  * @param deps - Optional composition seams (registry, file system) for tests.
698
704
  * @returns The aggregate and per-locale pending change.
699
705
  * @throws {@link SdkError} `UNKNOWN_FORMAT`, `SOURCE_UNREADABLE`, `SOURCE_INVALID`, `LOCK_FILE_INVALID`
700
- * with the same meanings as in `translate`.
706
+ * with the same meanings as in `translate`, or `UNKNOWN_LOCALE` when a requested locale is not
707
+ * among the configured target locales.
701
708
  */
702
709
  declare function diff(input: DiffInput, deps?: DiffDeps): Promise<DiffSummary>;
703
710
 
704
711
  /** A stable code for an SDK-originated notice (not a provider notice). */
705
- type SdkNoticeCode = "PLURAL_CATEGORIES_INCOMPLETE" | "SUB_BATCH_FAILED";
712
+ type SdkNoticeCode = "PLURAL_CATEGORIES_INCOMPLETE" | "SUB_BATCH_FAILED" | "BLANK_ROW_BASELINE_RETAINED";
706
713
  /**
707
714
  * A notice raised by the SDK itself (not a provider), structurally identical to a {@link ProviderNotice}
708
715
  * so both share the {@link LocaleSummary.notices} channel. Carries only a stable code and a static,
@@ -739,8 +746,20 @@ interface LocaleSummary {
739
746
  readonly pruned: readonly string[];
740
747
  /** Source keys flagged invalid-ICU that were skipped for translation this run. */
741
748
  readonly invalidIcuSource: readonly string[];
742
- /** Translated keys that failed the placeholder-integrity check and were withheld. */
749
+ /**
750
+ * Translated keys that failed the placeholder-integrity check and were withheld. Never includes a
751
+ * key withheld because the provider call itself failed; see {@link LocaleSummary.providerFailures}
752
+ * for that case.
753
+ */
743
754
  readonly integrityMismatches: readonly string[];
755
+ /**
756
+ * Keys withheld because the provider call itself failed (for example a revoked API key, a rate
757
+ * limit, or a network timeout), as distinct from a translation that came back and failed the
758
+ * placeholder-integrity check. Nothing was translated for these keys. The corresponding
759
+ * {@link LocaleSummary.notices} entry carries the secret-free failure code and message. Empty in a
760
+ * dry-run and empty unless a provider call threw.
761
+ */
762
+ readonly providerFailures: readonly string[];
744
763
  /**
745
764
  * Plural-category keys verbatra synthesized this run (for example a Polish `items_few` the source
746
765
  * never supplied), kept distinct from {@link translated}. Empty unless plural generation was enabled
@@ -897,7 +916,8 @@ interface ExportWorkbookResult {
897
916
  * @param deps - Optional composition seams (registry, file system) for tests.
898
917
  * @returns Where the workbook was written and the per-locale row counts.
899
918
  * @throws {@link SdkError} `UNKNOWN_FORMAT`, `SOURCE_UNREADABLE`, `SOURCE_INVALID`, `LOCK_FILE_INVALID`
900
- * with the same meanings as in `translate`.
919
+ * with the same meanings as in `translate`, or `UNKNOWN_LOCALE` when a requested locale is not
920
+ * among the configured target locales.
901
921
  */
902
922
  declare function exportWorkbook(input: ExportWorkbookInput, deps?: ExportWorkbookDeps): Promise<ExportWorkbookResult>;
903
923
 
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ type TranslationEntry$1 = Readonly<z.infer<typeof translationEntrySchema$1>>;
37
37
  * (counts matter). Always returned (never thrown) for an ordinary mismatch.
38
38
  */
39
39
  interface PlaceholderIntegrityResult {
40
- /** True when nothing is missing or extra and order is preserved. */
40
+ /** True when nothing is missing or extra: the multisets match, regardless of order. */
41
41
  readonly matches: boolean;
42
42
  /** Occurrences present in source but absent from the translation, one per dropped occurrence. Sorted. */
43
43
  readonly missing: readonly string[];
@@ -153,8 +153,11 @@ type AnthropicModel = Anthropic.Messages.Model;
153
153
  *
154
154
  * - `FORMALITY_DOWNGRADED`: a requested formality was not applied (the free tier does not support it).
155
155
  * - `GLOSSARY_IGNORED`: a supplied generic glossary was not applied.
156
+ * - `PLACEHOLDER_UNSUPPORTED`: at least one placeholder- or ICU-bearing entry was left untranslated
157
+ * because DeepL cannot preserve those tokens; such entries are withheld (absent from the result maps)
158
+ * rather than sent to DeepL and mangled.
156
159
  */
157
- type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED";
160
+ type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED" | "PLACEHOLDER_UNSUPPORTED";
158
161
  /**
159
162
  * An observable, structured signal that something was gracefully degraded (not an
160
163
  * error). Carries only a stable code and a static message, never a key or content.
@@ -378,6 +381,8 @@ declare function loadConfig(options?: LoadConfigOptions): Promise<VerbatraConfig
378
381
  * (thrown by `loadConfig`).
379
382
  * - `CONFIG_INVALID`: a config was found but is unparseable or fails validation (thrown by `loadConfig`).
380
383
  * - `UNKNOWN_FORMAT`: no adapter is registered for the configured format (thrown by `translate`).
384
+ * - `UNKNOWN_LOCALE`: a requested locale is not among the configured target locales (thrown by
385
+ * `check`, `diff`, and `exportWorkbook` via the shared locale selection).
381
386
  * - `PROVIDER_CONSTRUCTION_FAILED`: the provider factory threw; wraps the provider's own error, including
382
387
  * a missing `*_API_KEY` reported as `MISSING_API_KEY` (thrown by `translate`, non-dry-run only).
383
388
  * - `SOURCE_UNREADABLE`: the source locale file is absent (thrown by `translate`, and by `watch` at startup).
@@ -388,7 +393,7 @@ declare function loadConfig(options?: LoadConfigOptions): Promise<VerbatraConfig
388
393
  * per-locale failure carries no string code of its own. See the surfaced-not-thrown distinction on
389
394
  * `translate`.
390
395
  */
391
- type SdkErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "UNKNOWN_FORMAT" | "PROVIDER_CONSTRUCTION_FAILED" | "SOURCE_UNREADABLE" | "SOURCE_INVALID" | "LOCK_FILE_INVALID" | "LOCALE_FAILED";
396
+ type SdkErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "UNKNOWN_FORMAT" | "UNKNOWN_LOCALE" | "PROVIDER_CONSTRUCTION_FAILED" | "SOURCE_UNREADABLE" | "SOURCE_INVALID" | "LOCK_FILE_INVALID" | "LOCALE_FAILED";
392
397
  /** The single structured error the SDK throws or records. Never carries a secret. */
393
398
  declare class SdkError extends Error {
394
399
  /** The stable {@link SdkErrorCode} for this failure; branch on this, not the message. */
@@ -648,7 +653,8 @@ interface CheckDeps {
648
653
  * @param deps - Optional composition seams (registry, file system) for tests.
649
654
  * @returns The aggregate and per-locale drift status.
650
655
  * @throws {@link SdkError} `UNKNOWN_FORMAT`, `SOURCE_UNREADABLE`, `SOURCE_INVALID`, `LOCK_FILE_INVALID`
651
- * with the same meanings as in `translate`.
656
+ * with the same meanings as in `translate`, or `UNKNOWN_LOCALE` when a requested locale is not
657
+ * among the configured target locales.
652
658
  */
653
659
  declare function check(input: CheckInput, deps?: CheckDeps): Promise<CheckSummary>;
654
660
 
@@ -697,12 +703,13 @@ interface DiffDeps {
697
703
  * @param deps - Optional composition seams (registry, file system) for tests.
698
704
  * @returns The aggregate and per-locale pending change.
699
705
  * @throws {@link SdkError} `UNKNOWN_FORMAT`, `SOURCE_UNREADABLE`, `SOURCE_INVALID`, `LOCK_FILE_INVALID`
700
- * with the same meanings as in `translate`.
706
+ * with the same meanings as in `translate`, or `UNKNOWN_LOCALE` when a requested locale is not
707
+ * among the configured target locales.
701
708
  */
702
709
  declare function diff(input: DiffInput, deps?: DiffDeps): Promise<DiffSummary>;
703
710
 
704
711
  /** A stable code for an SDK-originated notice (not a provider notice). */
705
- type SdkNoticeCode = "PLURAL_CATEGORIES_INCOMPLETE" | "SUB_BATCH_FAILED";
712
+ type SdkNoticeCode = "PLURAL_CATEGORIES_INCOMPLETE" | "SUB_BATCH_FAILED" | "BLANK_ROW_BASELINE_RETAINED";
706
713
  /**
707
714
  * A notice raised by the SDK itself (not a provider), structurally identical to a {@link ProviderNotice}
708
715
  * so both share the {@link LocaleSummary.notices} channel. Carries only a stable code and a static,
@@ -739,8 +746,20 @@ interface LocaleSummary {
739
746
  readonly pruned: readonly string[];
740
747
  /** Source keys flagged invalid-ICU that were skipped for translation this run. */
741
748
  readonly invalidIcuSource: readonly string[];
742
- /** Translated keys that failed the placeholder-integrity check and were withheld. */
749
+ /**
750
+ * Translated keys that failed the placeholder-integrity check and were withheld. Never includes a
751
+ * key withheld because the provider call itself failed; see {@link LocaleSummary.providerFailures}
752
+ * for that case.
753
+ */
743
754
  readonly integrityMismatches: readonly string[];
755
+ /**
756
+ * Keys withheld because the provider call itself failed (for example a revoked API key, a rate
757
+ * limit, or a network timeout), as distinct from a translation that came back and failed the
758
+ * placeholder-integrity check. Nothing was translated for these keys. The corresponding
759
+ * {@link LocaleSummary.notices} entry carries the secret-free failure code and message. Empty in a
760
+ * dry-run and empty unless a provider call threw.
761
+ */
762
+ readonly providerFailures: readonly string[];
744
763
  /**
745
764
  * Plural-category keys verbatra synthesized this run (for example a Polish `items_few` the source
746
765
  * never supplied), kept distinct from {@link translated}. Empty unless plural generation was enabled
@@ -897,7 +916,8 @@ interface ExportWorkbookResult {
897
916
  * @param deps - Optional composition seams (registry, file system) for tests.
898
917
  * @returns Where the workbook was written and the per-locale row counts.
899
918
  * @throws {@link SdkError} `UNKNOWN_FORMAT`, `SOURCE_UNREADABLE`, `SOURCE_INVALID`, `LOCK_FILE_INVALID`
900
- * with the same meanings as in `translate`.
919
+ * with the same meanings as in `translate`, or `UNKNOWN_LOCALE` when a requested locale is not
920
+ * among the configured target locales.
901
921
  */
902
922
  declare function exportWorkbook(input: ExportWorkbookInput, deps?: ExportWorkbookDeps): Promise<ExportWorkbookResult>;
903
923