@focus-reactive/payload-plugin-translator 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-translate-config.d.ts +2 -2
- package/dist/auto-translate-config.js +1 -1
- package/dist/client/entities/translation/model/autoTranslateSummary.js +1 -1
- package/dist/core/{auto-translate-config → domain/auto-translate}/getAutoTranslateConfig.js +1 -1
- package/dist/core/{auto-translate → domain/auto-translate}/hasSourceContentChanged.d.ts +1 -1
- package/dist/core/{auto-translate-config → domain/auto-translate}/index.d.ts +1 -0
- package/dist/core/{auto-translate-config → domain/auto-translate}/index.js +1 -0
- package/dist/core/{content-projection → domain/content-projection}/computeSourceFingerprint.d.ts +1 -1
- package/dist/core/{content-projection → domain/content-projection}/contentProjector.d.ts +1 -1
- package/dist/core/{content-projection → domain/content-projection}/contentProjector.js +2 -2
- package/dist/core/{content-projection → domain/content-projection}/translatableLeaf.d.ts +1 -1
- package/dist/core/{content-projection → domain/content-projection}/translatableLeaf.js +2 -2
- package/dist/core/index.d.ts +10 -10
- package/dist/core/index.js +5 -5
- package/dist/core/translation-pipeline/TranslationPipeline.d.ts +1 -1
- package/dist/core/translation-pipeline/stages/data-reconciler/DataReconciler.d.ts +1 -1
- package/dist/core/translation-pipeline/stages/data-reconciler/DataReconciler.js +3 -3
- package/dist/core/translation-pipeline/stages/field-collector/FieldChunkCollector.d.ts +1 -1
- package/dist/core/translation-pipeline/stages/field-collector/FieldChunkCollector.js +3 -3
- package/dist/core/translation-pipeline/stages/text-expander/RichTextExpander.js +1 -1
- package/dist/core/translation-pipeline/stages/translation/Translation.stage.d.ts +1 -1
- package/dist/core/translation-pipeline/strategies/Overwrite.strategy.js +1 -1
- package/dist/core/translation-pipeline/strategies/SkipExisting.strategy.js +3 -3
- package/dist/core/translation-pipeline/translateContent.d.ts +2 -2
- package/dist/core/translation-pipeline/types/FieldChunk.d.ts +1 -1
- package/dist/core/translation-pipeline/types/Pipeline.d.ts +1 -1
- package/dist/core/translation-pipeline/types/PipelineContext.d.ts +1 -1
- package/dist/core/translation-pipeline/types/TextChunk.d.ts +1 -1
- package/dist/field-config.d.ts +1 -1
- package/dist/field-config.js +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/server/features/translate-document/handler.d.ts +1 -1
- package/dist/server/features/translate-document/wireTranslateRunner.d.ts +1 -1
- package/dist/server/features/translate-field/model.d.ts +1 -1
- package/dist/server/features/translate-field/resolveFieldSubtree.js +1 -1
- package/dist/server/modules/auto-translate/AutoTranslate.policy.d.ts +1 -1
- package/dist/server/modules/auto-translate/AutoTranslate.wiring.js +1 -1
- package/dist/server/modules/auto-translate/AutoTranslateEnqueue.hook.js +2 -2
- package/dist/server/modules/auto-translate/index.js +1 -1
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/index.js +1 -1
- package/dist/server/modules/provenance/Provenance.service.d.ts +1 -1
- package/dist/server/modules/provenance/Provenance.service.js +2 -2
- package/dist/server/modules/provenance/Provenance.store.d.ts +1 -1
- package/dist/server/modules/provenance/index.js +1 -1
- package/dist/server/modules/translation-levels/PluginConfigBuilder.d.ts +1 -1
- package/dist/server/modules/translation-levels/types.d.ts +1 -1
- package/dist/server/shared/index.d.ts +5 -5
- package/dist/server/shared/index.js +3 -3
- package/dist/server/shared/utils/filterLocalizedFields.js +2 -2
- package/dist/server/shared/utils/getByPath.js +1 -1
- package/dist/server/shared/utils/index.d.ts +2 -2
- package/dist/server/shared/utils/index.js +2 -2
- package/dist/server/shared/utils/setByPath.js +1 -1
- package/dist/translation-providers/index.d.ts +1 -1
- package/dist/translation-providers/openai/OpenAITranslation.provider.d.ts +1 -1
- package/dist/translation-providers/openai/OpenAITranslation.provider.js +1 -1
- package/package.json +1 -1
- package/dist/core/auto-translate/index.d.ts +0 -1
- package/dist/core/auto-translate/index.js +0 -3
- /package/dist/core/{auto-translate-config → domain/auto-translate}/getAutoTranslateConfig.d.ts +0 -0
- /package/dist/core/{auto-translate → domain/auto-translate}/hasSourceContentChanged.js +0 -0
- /package/dist/core/{auto-translate-config → domain/auto-translate}/types.d.ts +0 -0
- /package/dist/core/{auto-translate-config → domain/auto-translate}/types.js +0 -0
- /package/dist/core/{content-projection → domain/content-projection}/computeSourceFingerprint.js +0 -0
- /package/dist/core/{content-projection → domain/content-projection}/fingerprinter.d.ts +0 -0
- /package/dist/core/{content-projection → domain/content-projection}/fingerprinter.js +0 -0
- /package/dist/core/{content-projection → domain/content-projection}/idPath.d.ts +0 -0
- /package/dist/core/{content-projection → domain/content-projection}/idPath.js +0 -0
- /package/dist/core/{field-config → domain/field-config}/getFieldConfig.d.ts +0 -0
- /package/dist/core/{field-config → domain/field-config}/getFieldConfig.js +0 -0
- /package/dist/core/{field-config → domain/field-config}/index.d.ts +0 -0
- /package/dist/core/{field-config → domain/field-config}/index.js +0 -0
- /package/dist/core/{field-config → domain/field-config}/types.d.ts +0 -0
- /package/dist/core/{field-config → domain/field-config}/types.js +0 -0
- /package/dist/core/{provenance → domain/provenance}/ProvenanceStore.interface.d.ts +0 -0
- /package/dist/core/{provenance → domain/provenance}/ProvenanceStore.interface.js +0 -0
- /package/dist/core/{provenance → domain/provenance}/index.d.ts +0 -0
- /package/dist/core/{provenance → domain/provenance}/index.js +0 -0
- /package/dist/core/{provenance → domain/provenance}/staleness.d.ts +0 -0
- /package/dist/core/{provenance → domain/provenance}/staleness.js +0 -0
- /package/dist/core/{translation-providers → domain/translation-providers}/TranslationProvider.interface.d.ts +0 -0
- /package/dist/core/{translation-providers → domain/translation-providers}/TranslationProvider.interface.js +0 -0
- /package/dist/core/{translation-providers → domain/translation-providers}/index.d.ts +0 -0
- /package/dist/core/{translation-providers → domain/translation-providers}/index.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/findFieldByPath.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/findFieldByPath.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/guards.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/guards.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/index.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/index.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/kernel.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/kernel.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/predicates.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/predicates.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/types.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/types.js +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/walkFields.d.ts +0 -0
- /package/dist/core/{field-traversal → kernel/field-traversal}/walkFields.js +0 -0
- /package/dist/core/{lexical → kernel/lexical}/collectTextNodes.d.ts +0 -0
- /package/dist/core/{lexical → kernel/lexical}/collectTextNodes.js +0 -0
- /package/dist/core/{lexical → kernel/lexical}/guards.d.ts +0 -0
- /package/dist/core/{lexical → kernel/lexical}/guards.js +0 -0
- /package/dist/core/{lexical → kernel/lexical}/index.d.ts +0 -0
- /package/dist/core/{lexical → kernel/lexical}/index.js +0 -0
- /package/dist/core/{lexical → kernel/lexical}/isEmptyRichText.d.ts +0 -0
- /package/dist/core/{lexical → kernel/lexical}/isEmptyRichText.js +0 -0
- /package/dist/core/{lexical → kernel/lexical}/traverseLexicalTree.d.ts +0 -0
- /package/dist/core/{lexical → kernel/lexical}/traverseLexicalTree.js +0 -0
- /package/dist/core/{lexical → kernel/lexical}/types.d.ts +0 -0
- /package/dist/core/{lexical → kernel/lexical}/types.js +0 -0
- /package/dist/core/{utils → kernel/utils}/index.d.ts +0 -0
- /package/dist/core/{utils → kernel/utils}/index.js +0 -0
- /package/dist/core/{utils → kernel/utils}/isEmpty.d.ts +0 -0
- /package/dist/core/{utils → kernel/utils}/isEmpty.js +0 -0
- /package/dist/core/{utils → kernel/utils}/isObject.d.ts +0 -0
- /package/dist/core/{utils → kernel/utils}/isObject.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CollectionConfig } from "payload";
|
|
2
|
-
import type { AutoTranslateConfig } from "./core/auto-translate
|
|
2
|
+
import type { AutoTranslateConfig } from "./core/domain/auto-translate";
|
|
3
3
|
export type { AutoTranslateConfig };
|
|
4
|
-
export type { AutoTranslateStrategy } from "./core/auto-translate
|
|
4
|
+
export type { AutoTranslateStrategy } from "./core/domain/auto-translate";
|
|
5
5
|
/**
|
|
6
6
|
* Enable opt-in **auto-translate** for a collection: when a document's source-locale content changes
|
|
7
7
|
* (and is published), the plugin automatically queues translations into the configured target locales.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AUTO_TRANSLATE_CUSTOM_KEY } from "./core/auto-translate
|
|
1
|
+
import { AUTO_TRANSLATE_CUSTOM_KEY } from "./core/domain/auto-translate";
|
|
2
2
|
/**
|
|
3
3
|
* Enable opt-in **auto-translate** for a collection: when a document's source-locale content changes
|
|
4
4
|
* (and is published), the plugin automatically queues translations into the configured target locales.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAutoTranslateConfig } from "../../../../core/auto-translate
|
|
1
|
+
import { getAutoTranslateConfig } from "../../../../core/domain/auto-translate";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve a collection's auto-translate summary for the popup marker, or `null` when it should not
|
|
4
4
|
* render. Reads the opt-in from the collection's `custom` (propagated onto the registered collection at
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldLike } from "
|
|
1
|
+
import type { FieldLike } from "../../kernel/field-traversal";
|
|
2
2
|
/**
|
|
3
3
|
* Whether a source-locale save actually changed translatable content — the auto-translate drift-gate,
|
|
4
4
|
* in one place. Compares the translatable-content fingerprint of the previous vs the current document
|
package/dist/core/{content-projection → domain/content-projection}/computeSourceFingerprint.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldLike } from "
|
|
1
|
+
import type { FieldLike } from "../../kernel/field-traversal";
|
|
2
2
|
/**
|
|
3
3
|
* The staleness baseline: a stable hash of a document's translatable content.
|
|
4
4
|
* `CURRENT = computeSourceFingerprint(sourceDoc, schema)` — the value provenance stores at translation
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* translation can never disagree on which content is translatable. Payload-free and read-only:
|
|
10
10
|
* it never mutates the document and never captures write handles.
|
|
11
11
|
*/
|
|
12
|
-
import type { FieldLike } from "
|
|
12
|
+
import type { FieldLike } from "../../kernel/field-traversal/types";
|
|
13
13
|
import type { IdPath } from "./idPath";
|
|
14
14
|
/** One translatable leaf of a document: WHERE it lives ({@link IdPath}) and WHAT text it holds. */
|
|
15
15
|
export interface ProjectionEntry {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* {@link leafSourceText}) as the translation pipeline's `FieldChunkCollector`, so projection and
|
|
9
9
|
* translation can never disagree on which content is translatable. Payload-free and read-only:
|
|
10
10
|
* it never mutates the document and never captures write handles.
|
|
11
|
-
*/ import { resolveBlockFields, walkFields } from "
|
|
12
|
-
import { isObject } from "
|
|
11
|
+
*/ import { resolveBlockFields, walkFields } from "../../kernel/field-traversal";
|
|
12
|
+
import { isObject } from "../../kernel/utils/isObject";
|
|
13
13
|
import { elementSegment, makeIdPath } from "./idPath";
|
|
14
14
|
import { isTranslatableLeaf, leafSourceText } from "./translatableLeaf";
|
|
15
15
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Payload-free (structural {@link FieldLike} + owned `Serialized*` views only) so it can move to
|
|
8
8
|
* `@repo/translator-core` unchanged.
|
|
9
9
|
*/
|
|
10
|
-
import type { FieldLike, LeafFieldLike } from "
|
|
10
|
+
import type { FieldLike, LeafFieldLike } from "../../kernel/field-traversal/types";
|
|
11
11
|
/**
|
|
12
12
|
* The leaf-SELECTION decision shared by projection and translation: a leaf is a translation target
|
|
13
13
|
* iff it is a translatable text type, localized, and not excluded via `custom.translateKit`.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Payload-free (structural {@link FieldLike} + owned `Serialized*` views only) so it can move to
|
|
8
8
|
* `@repo/translator-core` unchanged.
|
|
9
9
|
*/ import { isFieldExcludedFromTranslation } from "../field-config";
|
|
10
|
-
import { collectSerializedLexicalTextNodes } from "
|
|
11
|
-
import { isSerializedLexicalRoot } from "
|
|
10
|
+
import { collectSerializedLexicalTextNodes } from "../../kernel/lexical/collectTextNodes";
|
|
11
|
+
import { isSerializedLexicalRoot } from "../../kernel/lexical/guards";
|
|
12
12
|
/** The field types this package translates (mirrors `isTranslatableField`, payload-free). */ const isTranslatableFieldType = (field)=>field.type === "text" || field.type === "textarea" || field.type === "richText";
|
|
13
13
|
/** Mirrors `isLocalizedField` structurally. */ const isLocalizedFieldLike = (field)=>field.localized === true;
|
|
14
14
|
/**
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export type { TranslationProvider, TranslationInput, TranslationOutput, TranslationIndex, } from "./translation-providers";
|
|
1
|
+
export type { TranslationProvider, TranslationInput, TranslationOutput, TranslationIndex, } from "./domain/translation-providers";
|
|
2
2
|
export { TranslationPipeline, translateContent } from "./translation-pipeline";
|
|
3
3
|
export type { TranslateContentArgs, TranslationStrategy } from "./translation-pipeline";
|
|
4
|
-
export type { ProvenanceKey, ProvenanceStore, TranslationProvenanceRecord } from "./provenance";
|
|
5
|
-
export { projectTranslatableContent } from "./content-projection/contentProjector";
|
|
6
|
-
export type { ProjectionEntry } from "./content-projection/contentProjector";
|
|
7
|
-
export { fingerprint } from "./content-projection/fingerprinter";
|
|
8
|
-
export { computeSourceFingerprint } from "./content-projection/computeSourceFingerprint";
|
|
9
|
-
export { makeIdPath } from "./content-projection/idPath";
|
|
10
|
-
export type { IdPath, PathSegment } from "./content-projection/idPath";
|
|
11
|
-
export { classifyField, findFieldByPath, hasFields, isBlockItem, isTabsField, matchElementById, resolveBlockFields, tabScopes, walkFields, } from "./field-traversal";
|
|
12
|
-
export type { ArrayFieldLike, BlockLike, BlocksFieldLike, FieldLike, FieldStructure, FieldWalker, GroupFieldLike, LeafField, LeafFieldLike, TabLike, TabScope, TabsFieldLike, } from "./field-traversal";
|
|
4
|
+
export type { ProvenanceKey, ProvenanceStore, TranslationProvenanceRecord, } from "./domain/provenance";
|
|
5
|
+
export { projectTranslatableContent } from "./domain/content-projection/contentProjector";
|
|
6
|
+
export type { ProjectionEntry } from "./domain/content-projection/contentProjector";
|
|
7
|
+
export { fingerprint } from "./domain/content-projection/fingerprinter";
|
|
8
|
+
export { computeSourceFingerprint } from "./domain/content-projection/computeSourceFingerprint";
|
|
9
|
+
export { makeIdPath } from "./domain/content-projection/idPath";
|
|
10
|
+
export type { IdPath, PathSegment } from "./domain/content-projection/idPath";
|
|
11
|
+
export { classifyField, findFieldByPath, hasFields, isBlockItem, isTabsField, matchElementById, resolveBlockFields, tabScopes, walkFields, } from "./kernel/field-traversal";
|
|
12
|
+
export type { ArrayFieldLike, BlockLike, BlocksFieldLike, FieldLike, FieldStructure, FieldWalker, GroupFieldLike, LeafField, LeafFieldLike, TabLike, TabScope, TabsFieldLike, } from "./kernel/field-traversal";
|
package/dist/core/index.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
// Translation pipeline
|
|
6
6
|
export { TranslationPipeline, translateContent } from "./translation-pipeline";
|
|
7
7
|
// Content projection
|
|
8
|
-
export { projectTranslatableContent } from "./content-projection/contentProjector";
|
|
9
|
-
export { fingerprint } from "./content-projection/fingerprinter";
|
|
10
|
-
export { computeSourceFingerprint } from "./content-projection/computeSourceFingerprint";
|
|
11
|
-
export { makeIdPath } from "./content-projection/idPath";
|
|
8
|
+
export { projectTranslatableContent } from "./domain/content-projection/contentProjector";
|
|
9
|
+
export { fingerprint } from "./domain/content-projection/fingerprinter";
|
|
10
|
+
export { computeSourceFingerprint } from "./domain/content-projection/computeSourceFingerprint";
|
|
11
|
+
export { makeIdPath } from "./domain/content-projection/idPath";
|
|
12
12
|
// Field traversal
|
|
13
|
-
export { classifyField, findFieldByPath, hasFields, isBlockItem, isTabsField, matchElementById, resolveBlockFields, tabScopes, walkFields } from "./field-traversal";
|
|
13
|
+
export { classifyField, findFieldByPath, hasFields, isBlockItem, isTabsField, matchElementById, resolveBlockFields, tabScopes, walkFields } from "./kernel/field-traversal";
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TranslationProvider } from "../translation-providers";
|
|
1
|
+
import type { TranslationProvider } from "../domain/translation-providers";
|
|
2
2
|
import type { PipelineConfig, PipelineResult } from "./types";
|
|
3
3
|
import type { TranslationStrategy } from "./strategies";
|
|
4
4
|
import type { TextExpander } from "./stages";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldLike } from "../../../field-traversal";
|
|
1
|
+
import type { FieldLike } from "../../../kernel/field-traversal";
|
|
2
2
|
/**
|
|
3
3
|
* Deep-merges source and target data with target priority, producing the full document shape
|
|
4
4
|
* Payload validation needs. Built on the shared {@link walkFields} engine.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isEmpty } from "../../../utils/isEmpty";
|
|
2
|
-
import { isObject } from "../../../utils/isObject";
|
|
3
|
-
import { matchElementById, resolveBlockFields, walkFields } from "../../../field-traversal";
|
|
1
|
+
import { isEmpty } from "../../../kernel/utils/isEmpty";
|
|
2
|
+
import { isObject } from "../../../kernel/utils/isObject";
|
|
3
|
+
import { matchElementById, resolveBlockFields, walkFields } from "../../../kernel/field-traversal";
|
|
4
4
|
const asObject = (value)=>isObject(value) ? value : {};
|
|
5
5
|
/**
|
|
6
6
|
* Reconcile walker: produces the full document shape from source + target, with target
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isTranslatableLeaf } from "../../../content-projection/translatableLeaf";
|
|
2
|
-
import { matchElementById, resolveBlockFields, walkFields } from "../../../field-traversal";
|
|
3
|
-
import { isObject } from "../../../utils/isObject";
|
|
1
|
+
import { isTranslatableLeaf } from "../../../domain/content-projection/translatableLeaf";
|
|
2
|
+
import { matchElementById, resolveBlockFields, walkFields } from "../../../kernel/field-traversal";
|
|
3
|
+
import { isObject } from "../../../kernel/utils/isObject";
|
|
4
4
|
const asObject = (value)=>isObject(value) ? value : {};
|
|
5
5
|
/**
|
|
6
6
|
* Collects FieldChunks by walking schema + data with the shared {@link walkFields} engine.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSerializedLexicalRoot, collectSerializedLexicalTextNodes } from "../../../lexical";
|
|
1
|
+
import { isSerializedLexicalRoot, collectSerializedLexicalTextNodes } from "../../../kernel/lexical";
|
|
2
2
|
/**
|
|
3
3
|
* Expands richText fields into multiple RichTextChunks (one per text node).
|
|
4
4
|
*/ export class RichTextExpander {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PipelineContext, PipelineStage } from "../../types";
|
|
2
|
-
import type { TranslationProvider } from "../../../translation-providers";
|
|
2
|
+
import type { TranslationProvider } from "../../../domain/translation-providers";
|
|
3
3
|
/**
|
|
4
4
|
* Calls translation provider to translate text.
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isEmptyRichText } from "../../lexical/isEmptyRichText";
|
|
2
|
-
import { isSerializedLexicalRoot } from "../../lexical/guards";
|
|
3
|
-
import { isEmpty } from "../../utils/isEmpty";
|
|
1
|
+
import { isEmptyRichText } from "../../kernel/lexical/isEmptyRichText";
|
|
2
|
+
import { isSerializedLexicalRoot } from "../../kernel/lexical/guards";
|
|
3
|
+
import { isEmpty } from "../../kernel/utils/isEmpty";
|
|
4
4
|
/**
|
|
5
5
|
* Only translates fields that are empty or missing in the target locale.
|
|
6
6
|
* Existing translations are preserved.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldLike } from "../field-traversal";
|
|
2
|
-
import type { TranslationProvider } from "../translation-providers";
|
|
1
|
+
import type { FieldLike } from "../kernel/field-traversal";
|
|
2
|
+
import type { TranslationProvider } from "../domain/translation-providers";
|
|
3
3
|
import type { TranslationStrategyName } from "./strategies";
|
|
4
4
|
export type TranslateContentArgs = {
|
|
5
5
|
/** Schema subtree to translate (e.g. `[declaredFieldConfig]`). */
|
package/dist/field-config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Field, RichTextField, TextareaField, TextField } from "payload";
|
|
2
|
-
import type { FieldTranslationConfig } from "./core/field-config";
|
|
2
|
+
import type { FieldTranslationConfig } from "./core/domain/field-config";
|
|
3
3
|
export type { FieldTranslationConfig };
|
|
4
4
|
/**
|
|
5
5
|
* Field types eligible for the per-field translate control — the same text-bearing
|
package/dist/field-config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TRANSLATE_KIT_CUSTOM_KEY } from "./core/field-config";
|
|
1
|
+
import { TRANSLATE_KIT_CUSTOM_KEY } from "./core/domain/field-config";
|
|
2
2
|
import { TranslateFieldControlExport } from "./client/widgets/translate-field-control/ui/TranslateFieldControl.export";
|
|
3
3
|
import { beforeInputPositioner } from "./field-actions";
|
|
4
4
|
/**
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollectionConfig, Config } from "payload";
|
|
2
2
|
import type { AccessGuard } from "./types/AccessGuard";
|
|
3
|
-
import type { TranslationProvider } from "./core/translation-providers";
|
|
3
|
+
import type { TranslationProvider } from "./core/domain/translation-providers";
|
|
4
4
|
import type { TaskRunnerProvider } from "./server/modules/task-runner";
|
|
5
5
|
import type { TranslationLifecycleCallbacks } from "./server/modules/lifecycle";
|
|
6
6
|
import type { TranslationLevel } from "./server/modules/translation-levels";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Payload } from "payload";
|
|
2
2
|
import type { Handler } from "../../shared";
|
|
3
|
-
import type { TranslationProvider } from "../../../core/translation-providers";
|
|
3
|
+
import type { TranslationProvider } from "../../../core/domain/translation-providers";
|
|
4
4
|
import type { ProvenanceServiceFactory } from "../../modules/provenance";
|
|
5
5
|
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
6
6
|
import type { TranslateDocumentInput, TranslateDocumentOutput } from "./model";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CollectionSlug } from "payload";
|
|
2
|
-
import type { TranslationProvider } from "../../../core/translation-providers";
|
|
2
|
+
import type { TranslationProvider } from "../../../core/domain/translation-providers";
|
|
3
3
|
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
4
4
|
import type { ConfigModifier } from "../../../types/ConfigModifier";
|
|
5
5
|
import type { ProvenanceServiceFactory } from "../../modules/provenance";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
3
|
-
import type { TranslationProvider } from "../../../core/translation-providers";
|
|
3
|
+
import type { TranslationProvider } from "../../../core/domain/translation-providers";
|
|
4
4
|
/**
|
|
5
5
|
* Max serialized size of the value the endpoint will translate — the value read from the
|
|
6
6
|
* source-locale document (the request body no longer carries one; this is from-locale only). The
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isTranslatableField } from "../../shared";
|
|
2
|
-
import { findFieldByPath } from "../../../core/field-traversal";
|
|
2
|
+
import { findFieldByPath } from "../../../core/kernel/field-traversal";
|
|
3
3
|
/**
|
|
4
4
|
* Map a declared `fieldPath` to the `{ schema, sourceData }` pair `translateContent` expects.
|
|
5
5
|
* Walks the schema via the shared {@link findFieldByPath}. Descends transparently through
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CollectionSlug } from "payload";
|
|
2
|
-
import type { AutoTranslateConfig } from "../../../core/auto-translate
|
|
2
|
+
import type { AutoTranslateConfig } from "../../../core/domain/auto-translate";
|
|
3
3
|
import type { TaskInput } from "../task-runner/types";
|
|
4
4
|
/** A collection's auto-translate rule with defaults resolved — the shape the hook consumes. */
|
|
5
5
|
export type NormalizedAutoTranslatePolicy = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAutoTranslateConfig } from "../../../core/auto-translate
|
|
1
|
+
import { getAutoTranslateConfig } from "../../../core/domain/auto-translate";
|
|
2
2
|
import { extractLocaleCodes, filterPolicyToKnownLocales, makeCollectionPolicyResolver, normalizeAutoTranslateConfig } from "./AutoTranslate.policy";
|
|
3
3
|
import { injectAutoTranslateHook, makeAutoTranslateHook, propagateAutoTranslateCustom } from "./AutoTranslateEnqueue.hook";
|
|
4
4
|
const NOOP = (config)=>config;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { hasSourceContentChanged } from "../../../core/auto-translate";
|
|
2
|
-
import { AUTO_TRANSLATE_CUSTOM_KEY } from "../../../core/auto-translate
|
|
1
|
+
import { hasSourceContentChanged } from "../../../core/domain/auto-translate";
|
|
2
|
+
import { AUTO_TRANSLATE_CUSTOM_KEY } from "../../../core/domain/auto-translate";
|
|
3
3
|
import { AUTO_TRANSLATE_SKIP_CONTEXT_KEY } from "../../../types/AutoTranslateContext";
|
|
4
4
|
import { buildAutoTranslateTasks, passesPublishGate } from "./AutoTranslate.policy";
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Auto-translate adapter (Payload-backed). The payload-free drift predicate + config reader live in
|
|
2
|
-
// the core (src/core/auto-translate
|
|
2
|
+
// the core (src/core/domain/auto-translate, src/core/domain/content-projection); this module is the config-time
|
|
3
3
|
// wiring + the afterChange hook that enqueues translations on a source-locale change (#51).
|
|
4
4
|
export { configureAutoTranslate } from "./AutoTranslate.wiring";
|
|
5
5
|
export { makeAutoTranslateHook, injectAutoTranslateHook } from "./AutoTranslateEnqueue.hook";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "../../core/translation-providers";
|
|
1
|
+
export * from "../../core/domain/translation-providers";
|
|
2
2
|
export * from "../../core/translation-pipeline";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CollectionSlug, Payload } from "payload";
|
|
2
|
-
import type { ProvenanceKey, ProvenanceStore } from "../../../core/provenance";
|
|
2
|
+
import type { ProvenanceKey, ProvenanceStore } from "../../../core/domain/provenance";
|
|
3
3
|
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
4
4
|
/** Per-locale staleness for one document (snake_case, matching the other translation endpoints). */
|
|
5
5
|
export type StalenessLocale = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computeSourceFingerprint } from "../../../core/content-projection/computeSourceFingerprint";
|
|
2
|
-
import { isRecordStale } from "../../../core/provenance";
|
|
1
|
+
import { computeSourceFingerprint } from "../../../core/domain/content-projection/computeSourceFingerprint";
|
|
2
|
+
import { isRecordStale } from "../../../core/domain/provenance";
|
|
3
3
|
import { fetchSourceDocument } from "../../shared/payload/sourceDocument";
|
|
4
4
|
/**
|
|
5
5
|
* The single owner of provenance fingerprint policy — how the source is hashed on write, re-hashed on
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Payload } from "payload";
|
|
2
|
-
import type { ProvenanceKey, ProvenanceStore, TranslationProvenanceRecord } from "../../../core/provenance";
|
|
2
|
+
import type { ProvenanceKey, ProvenanceStore, TranslationProvenanceRecord } from "../../../core/domain/provenance";
|
|
3
3
|
/** Builds a provenance store bound to a Payload instance; absent when provenance is disabled. */
|
|
4
4
|
export type ProvenanceStoreFactory = (payload: Payload) => ProvenanceStore;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Provenance adapter (Payload-backed). The framework-agnostic port + record types live in the core
|
|
2
|
-
// (src/core/provenance); this module is the plugin-side implementation + its config-time wiring.
|
|
2
|
+
// (src/core/domain/provenance); this module is the plugin-side implementation + its config-time wiring.
|
|
3
3
|
export { DEFAULT_PROVENANCE_SLUG, isProvenanceCollection, makeProvenanceCollection } from "./Provenance.collection";
|
|
4
4
|
export { PayloadProvenanceStore } from "./Provenance.store";
|
|
5
5
|
export { injectProvenanceCleanup, makeProvenanceCleanupHook } from "./ProvenanceCleanup.hook";
|
|
@@ -3,7 +3,7 @@ import type { AccessGuard } from "../../../types/AccessGuard";
|
|
|
3
3
|
import type { RawPayloadComponentExport } from "../../../types/PayloadComponentExport";
|
|
4
4
|
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
5
5
|
import type { ConfigModifier } from "../../../types/ConfigModifier";
|
|
6
|
-
import type { TranslationProvider } from "../../../core/translation-providers";
|
|
6
|
+
import type { TranslationProvider } from "../../../core/domain/translation-providers";
|
|
7
7
|
import type { TaskRunnerFactory } from "../task-runner";
|
|
8
8
|
import type { ProvenanceServiceFactory } from "../provenance";
|
|
9
9
|
import type { CollectionAdminSlot, LevelContext, TranslationContext } from "./types";
|
|
@@ -2,7 +2,7 @@ import type { CollectionConfig, Endpoint } from "payload";
|
|
|
2
2
|
import type { AccessGuard } from "../../../types/AccessGuard";
|
|
3
3
|
import type { RawPayloadComponentExport } from "../../../types/PayloadComponentExport";
|
|
4
4
|
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
5
|
-
import type { TranslationProvider } from "../../../core/translation-providers";
|
|
5
|
+
import type { TranslationProvider } from "../../../core/domain/translation-providers";
|
|
6
6
|
import type { TaskRunnerFactory } from "../task-runner";
|
|
7
7
|
import type { ProvenanceServiceFactory } from "../provenance";
|
|
8
8
|
export type CollectionAdminSlot = "beforeDocumentControls" | "beforeListTable";
|
|
@@ -4,9 +4,9 @@ export type { AccessGuard, AccessGuardRequest, Handler } from "./access";
|
|
|
4
4
|
export { isEmpty, isObject, normalizePath, pipe, getByPath, setByPath, filterLocalizedFields, } from "./utils";
|
|
5
5
|
export type { TranslatableField } from "./guards";
|
|
6
6
|
export { isTranslatableField, isLocalizedField, isRelationshipField } from "./guards";
|
|
7
|
-
export { isTabsField, isBlockItem, hasFields } from "../../core/field-traversal";
|
|
8
|
-
export { isFieldExcludedFromTranslation, getTranslateKitFieldConfig, } from "../../core/field-config";
|
|
9
|
-
export type { TranslateKitFieldConfig } from "../../core/field-config";
|
|
10
|
-
export { isSerializedLexicalRoot, isEmptyRichText, traverseLexicalTree, collectSerializedLexicalTextNodes, } from "../../core/lexical";
|
|
11
|
-
export type { SerializedTextNodeRef } from "../../core/lexical";
|
|
7
|
+
export { isTabsField, isBlockItem, hasFields } from "../../core/kernel/field-traversal";
|
|
8
|
+
export { isFieldExcludedFromTranslation, getTranslateKitFieldConfig, } from "../../core/domain/field-config";
|
|
9
|
+
export type { TranslateKitFieldConfig } from "../../core/domain/field-config";
|
|
10
|
+
export { isSerializedLexicalRoot, isEmptyRichText, traverseLexicalTree, collectSerializedLexicalTextNodes, } from "../../core/kernel/lexical";
|
|
11
|
+
export type { SerializedTextNodeRef } from "../../core/kernel/lexical";
|
|
12
12
|
export { JobIdSchema } from "./validation";
|
|
@@ -5,11 +5,11 @@ export { AnyAccessGuard } from "./access";
|
|
|
5
5
|
// General utilities
|
|
6
6
|
export { isEmpty, isObject, normalizePath, pipe, getByPath, setByPath, filterLocalizedFields } from "./utils";
|
|
7
7
|
export { isTranslatableField, isLocalizedField, isRelationshipField } from "./guards";
|
|
8
|
-
export { isTabsField, isBlockItem, hasFields } from "../../core/field-traversal";
|
|
8
|
+
export { isTabsField, isBlockItem, hasFields } from "../../core/kernel/field-traversal";
|
|
9
9
|
// Field config
|
|
10
|
-
export { isFieldExcludedFromTranslation, getTranslateKitFieldConfig } from "../../core/field-config";
|
|
10
|
+
export { isFieldExcludedFromTranslation, getTranslateKitFieldConfig } from "../../core/domain/field-config";
|
|
11
11
|
// Lexical utilities
|
|
12
|
-
export { isSerializedLexicalRoot, isEmptyRichText, traverseLexicalTree, collectSerializedLexicalTextNodes } from "../../core/lexical";
|
|
12
|
+
export { isSerializedLexicalRoot, isEmptyRichText, traverseLexicalTree, collectSerializedLexicalTextNodes } from "../../core/kernel/lexical";
|
|
13
13
|
// Validation primitives
|
|
14
14
|
export { JobIdSchema } from "./validation";
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolveBlockFields, walkFields } from "../../../core/field-traversal";
|
|
1
|
+
import { resolveBlockFields, walkFields } from "../../../core/kernel/field-traversal";
|
|
2
2
|
import { isLocalizedField, isTranslatableField } from "../guards";
|
|
3
|
-
import { isObject } from "../../../core/utils/isObject";
|
|
3
|
+
import { isObject } from "../../../core/kernel/utils/isObject";
|
|
4
4
|
/**
|
|
5
5
|
* Filter walker: keeps only translatable, localized leaves, rebuilding the surrounding
|
|
6
6
|
* object/array/blocks structure and dropping any container left empty. `id` (array/block
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { isEmpty } from "../../../core/utils/isEmpty";
|
|
2
|
-
export { isObject } from "../../../core/utils/isObject";
|
|
1
|
+
export { isEmpty } from "../../../core/kernel/utils/isEmpty";
|
|
2
|
+
export { isObject } from "../../../core/kernel/utils/isObject";
|
|
3
3
|
export { normalizePath } from "./normalizePath";
|
|
4
4
|
export { getByPath } from "./getByPath";
|
|
5
5
|
export { setByPath } from "./setByPath";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { isEmpty } from "../../../core/utils/isEmpty";
|
|
2
|
-
export { isObject } from "../../../core/utils/isObject";
|
|
1
|
+
export { isEmpty } from "../../../core/kernel/utils/isEmpty";
|
|
2
|
+
export { isObject } from "../../../core/kernel/utils/isObject";
|
|
3
3
|
export { normalizePath } from "./normalizePath";
|
|
4
4
|
export { getByPath } from "./getByPath";
|
|
5
5
|
export { setByPath } from "./setByPath";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { TranslationProvider, TranslationInput, TranslationOutput, } from "../core/translation-providers";
|
|
1
|
+
export type { TranslationProvider, TranslationInput, TranslationOutput, } from "../core/domain/translation-providers";
|
|
2
2
|
export * from "./openai";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TranslationProvider, TranslationInput, TranslationOutput } from "../../core/translation-providers/TranslationProvider.interface";
|
|
1
|
+
import type { TranslationProvider, TranslationInput, TranslationOutput } from "../../core/domain/translation-providers/TranslationProvider.interface";
|
|
2
2
|
import type { ChatModel } from "openai/resources/index.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Function to transform text in dry run mode.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
|
-
import { isObject } from "../../core/utils/isObject";
|
|
2
|
+
import { isObject } from "../../core/kernel/utils/isObject";
|
|
3
3
|
/** @deprecated Use `createOpenAIProvider` function instead */ export class OpenAITranslationProvider {
|
|
4
4
|
openAiClient;
|
|
5
5
|
config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@focus-reactive/payload-plugin-translator",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Translation plugin for Payload CMS 3.x. Automatically translate your localized content using any translation provider.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { hasSourceContentChanged } from "./hasSourceContentChanged";
|
/package/dist/core/{auto-translate-config → domain/auto-translate}/getAutoTranslateConfig.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/core/{content-projection → domain/content-projection}/computeSourceFingerprint.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|