@focus-reactive/payload-plugin-translator 0.6.0 → 0.6.2
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 +172 -306
- package/dist/client/app/cache/CacheProvider.d.ts +1 -1
- package/dist/client/app/cache/CacheProvider.export.d.ts +1 -1
- package/dist/client/app/cache/CacheProvider.export.js +2 -2
- package/dist/client/app/cache/CacheProvider.js +5 -5
- package/dist/client/app/config/TranslateKitConfigContext.d.ts +1 -1
- package/dist/client/app/config/TranslateKitConfigContext.js +3 -3
- package/dist/client/app/config/index.d.ts +2 -2
- package/dist/client/app/config/index.js +1 -1
- package/dist/client/entities/translation/api/mutations/useCancelCollectionTranslations.js +7 -7
- package/dist/client/entities/translation/api/mutations/useCancelDocumentTranslation.js +7 -7
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslation.d.ts +1 -1
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslation.js +8 -8
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslations.js +6 -6
- package/dist/client/entities/translation/api/mutations/useRunDocumentTranslation.js +7 -7
- package/dist/client/entities/translation/api/mutations/useTranslateField.d.ts +1 -1
- package/dist/client/entities/translation/api/queries/useCollectionTranslationStatus.d.ts +2 -2
- package/dist/client/entities/translation/api/queries/useCollectionTranslationStatus.js +9 -10
- package/dist/client/entities/translation/api/queries/useDocumentTranslation.d.ts +2 -2
- package/dist/client/entities/translation/api/queries/useDocumentTranslation.js +9 -10
- package/dist/client/entities/translation/index.d.ts +12 -12
- package/dist/client/entities/translation/index.js +11 -11
- package/dist/client/entities/translation/model/types.d.ts +1 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/CompletedTranslationStatus.js +12 -12
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/styles.module.scss +1 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/FailedTranslationStatus.js +8 -8
- package/dist/client/entities/translation/ui/FailedTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/styles.module.scss +1 -1
- package/dist/client/entities/translation/ui/PendingTranslationStatus/PendingTranslationStatus.js +14 -14
- package/dist/client/entities/translation/ui/PendingTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/PendingTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/RunningTranslationStatus/RunningTranslationStatus.js +13 -13
- package/dist/client/entities/translation/ui/RunningTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/RunningTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/TranslationDirection.d.ts +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/TranslationDirection.js +2 -2
- package/dist/client/entities/translation/ui/TranslationDirection/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/index.js +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/styles.module.scss +1 -1
- package/dist/client/features/collection-translation-form/index.client.d.ts +1 -1
- package/dist/client/features/collection-translation-form/index.client.js +1 -1
- package/dist/client/features/collection-translation-form/index.d.ts +3 -3
- package/dist/client/features/collection-translation-form/index.js +2 -2
- package/dist/client/features/collection-translation-form/model/constants.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/constants.js +9 -9
- package/dist/client/features/collection-translation-form/model/form-model.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/index.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/index.js +1 -1
- package/dist/client/features/collection-translation-form/model/schema.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/schema.js +6 -6
- package/dist/client/features/collection-translation-form/ui/CollectionTranslationForm.d.ts +1 -1
- package/dist/client/features/collection-translation-form/ui/index.d.ts +1 -1
- package/dist/client/features/collection-translation-form/ui/index.js +1 -1
- package/dist/client/features/collection-translation-form/ui/styles.module.scss +1 -1
- package/dist/client/features/collection-translation-popup/index.d.ts +1 -1
- package/dist/client/features/collection-translation-popup/index.js +1 -1
- package/dist/client/features/collection-translation-popup/ui/CollectionTranslationPopup.d.ts +1 -1
- package/dist/client/features/collection-translation-popup/ui/styles.module.scss +1 -1
- package/dist/client/features/collection-translation-progress/index.d.ts +1 -1
- package/dist/client/features/collection-translation-progress/index.js +1 -1
- package/dist/client/features/collection-translation-progress/ui/CollectionTranslationProgress.d.ts +2 -2
- package/dist/client/features/collection-translation-progress/ui/CollectionTranslationProgress.js +13 -13
- package/dist/client/features/collection-translation-progress/ui/styles.module.scss +1 -1
- package/dist/client/features/document-translation-progress-failed/index.d.ts +1 -1
- package/dist/client/features/document-translation-progress-failed/index.js +1 -1
- package/dist/client/features/document-translation-progress-failed/ui/DocumentTranslationProgressFailed.d.ts +2 -2
- package/dist/client/features/document-translation-progress-failed/ui/DocumentTranslationProgressFailed.js +3 -3
- package/dist/client/features/document-translation-progress-pending/index.d.ts +1 -1
- package/dist/client/features/document-translation-progress-pending/index.js +1 -1
- package/dist/client/features/document-translation-progress-pending/ui/DocumentTranslationProgressPending.d.ts +2 -2
- package/dist/client/features/document-translation-progress-pending/ui/DocumentTranslationProgressPending.js +5 -5
- package/dist/client/features/document-translation-progress-running/index.d.ts +1 -1
- package/dist/client/features/document-translation-progress-running/index.js +1 -1
- package/dist/client/features/document-translation-progress-running/ui/DocumentTranslationProgressRunning.d.ts +2 -2
- package/dist/client/features/document-translation-progress-running/ui/DocumentTranslationProgressRunning.js +3 -3
- package/dist/client/features/open-document-translation-popup/index.d.ts +1 -1
- package/dist/client/features/open-document-translation-popup/index.js +1 -1
- package/dist/client/features/open-document-translation-popup/ui/styles.module.scss +1 -1
- package/dist/client/features/translate-document-form/index.client.d.ts +1 -1
- package/dist/client/features/translate-document-form/index.client.js +1 -1
- package/dist/client/features/translate-document-form/index.d.ts +3 -3
- package/dist/client/features/translate-document-form/index.js +2 -2
- package/dist/client/features/translate-document-form/model/constants.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/constants.js +11 -11
- package/dist/client/features/translate-document-form/model/form-model.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/index.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/index.js +1 -1
- package/dist/client/features/translate-document-form/model/schema.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/schema.js +5 -5
- package/dist/client/features/translate-document-form/ui/DocumentTranslationForm.d.ts +1 -1
- package/dist/client/features/translate-document-form/ui/index.d.ts +1 -1
- package/dist/client/features/translate-document-form/ui/index.js +1 -1
- package/dist/client/features/translate-document-form/ui/styles.module.scss +1 -1
- package/dist/client/shared/lib/errors/handleApiError.d.ts +1 -1
- package/dist/client/shared/lib/errors/handleApiError.js +2 -2
- package/dist/client/shared/lib/forms/handle-form-error.d.ts +1 -1
- package/dist/client/shared/lib/forms/handle-form-error.js +6 -6
- package/dist/client/shared/lib/payload/hooks/useCollectionDashboardUrlParams.d.ts +1 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDashboardUrlParams.js +1 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDocumentUrlParams.d.ts +1 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDocumentUrlParams.js +2 -2
- package/dist/client/shared/lib/payload/hooks/useLocaleOptions.js +2 -2
- package/dist/client/shared/lib/utils/errors/handleApiError.d.ts +1 -1
- package/dist/client/shared/lib/utils/errors/handleApiError.js +2 -2
- package/dist/client/shared/lib/utils/react/useToggle.js +1 -1
- package/dist/client/shared/providers/CacheClientProvider/CacheClientProvider.factory.d.ts +2 -2
- package/dist/client/shared/providers/CacheClientProvider/CacheClientProvider.factory.js +3 -3
- package/dist/client/shared/providers/CacheClientProvider/index.d.ts +1 -1
- package/dist/client/shared/providers/CacheClientProvider/index.js +1 -1
- package/dist/client/shared/types/AccessGuard.d.ts +1 -1
- package/dist/client/shared/ui/Alert/Alert.d.ts +2 -2
- package/dist/client/shared/ui/Alert/Alert.js +18 -18
- package/dist/client/shared/ui/Alert/index.d.ts +1 -1
- package/dist/client/shared/ui/Alert/index.js +1 -1
- package/dist/client/shared/ui/Alert/styles.module.scss +1 -1
- package/dist/client/shared/ui/Button/index.d.ts +1 -1
- package/dist/client/shared/ui/Button/index.js +1 -1
- package/dist/client/shared/ui/Button/styles.module.scss +6 -3
- package/dist/client/shared/ui/Checkbox/Checkbox.d.ts +2 -2
- package/dist/client/shared/ui/Checkbox/Checkbox.js +4 -4
- package/dist/client/shared/ui/Checkbox/index.d.ts +1 -1
- package/dist/client/shared/ui/Checkbox/index.js +1 -1
- package/dist/client/shared/ui/Checkbox/styles.module.scss +1 -1
- package/dist/client/shared/ui/ColorIndicator/ColorIndicator.d.ts +2 -2
- package/dist/client/shared/ui/ColorIndicator/ColorIndicator.js +2 -2
- package/dist/client/shared/ui/ColorIndicator/index.d.ts +1 -1
- package/dist/client/shared/ui/ColorIndicator/index.js +1 -1
- package/dist/client/shared/ui/ColorIndicator/styles.module.scss +1 -1
- package/dist/client/shared/ui/Description/Description.d.ts +3 -3
- package/dist/client/shared/ui/Description/Description.js +4 -4
- package/dist/client/shared/ui/Description/index.d.ts +1 -1
- package/dist/client/shared/ui/Description/index.js +1 -1
- package/dist/client/shared/ui/Description/styles.module.scss +1 -1
- package/dist/client/shared/ui/Divider/Divider.d.ts +4 -4
- package/dist/client/shared/ui/Divider/Divider.js +4 -4
- package/dist/client/shared/ui/Divider/index.d.ts +1 -1
- package/dist/client/shared/ui/Divider/index.js +1 -1
- package/dist/client/shared/ui/Divider/styles.module.scss +1 -1
- package/dist/client/shared/ui/Label/Label.d.ts +2 -2
- package/dist/client/shared/ui/Label/Label.js +3 -3
- package/dist/client/shared/ui/Label/index.d.ts +1 -1
- package/dist/client/shared/ui/Label/index.js +1 -1
- package/dist/client/shared/ui/Label/styles.module.scss +1 -1
- package/dist/client/shared/ui/Loading/Loading.d.ts +1 -1
- package/dist/client/shared/ui/Loading/Loading.js +9 -9
- package/dist/client/shared/ui/Loading/index.d.ts +1 -1
- package/dist/client/shared/ui/Loading/index.js +1 -1
- package/dist/client/shared/ui/Loading/styles.module.scss +2 -2
- package/dist/client/shared/ui/Popup/Popup.d.ts +1 -1
- package/dist/client/shared/ui/Popup/index.d.ts +1 -1
- package/dist/client/shared/ui/Popup/index.js +1 -1
- package/dist/client/shared/ui/Popup/styles.module.scss +1 -1
- package/dist/client/shared/ui/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/client/shared/ui/ProgressBar/ProgressBar.js +3 -3
- package/dist/client/shared/ui/ProgressBar/index.d.ts +1 -1
- package/dist/client/shared/ui/ProgressBar/index.js +1 -1
- package/dist/client/shared/ui/ProgressBar/styles.module.scss +1 -1
- package/dist/client/shared/ui/Select/index.d.ts +1 -1
- package/dist/client/shared/ui/Select/index.js +1 -1
- package/dist/client/shared/ui/Select/styles.module.scss +1 -1
- package/dist/client/shared/ui/StatusCounter/StatusCounter.d.ts +2 -2
- package/dist/client/shared/ui/StatusCounter/StatusCounter.js +13 -13
- package/dist/client/shared/ui/StatusCounter/index.d.ts +1 -1
- package/dist/client/shared/ui/StatusCounter/index.js +1 -1
- package/dist/client/shared/ui/StatusCounter/styles.module.scss +1 -1
- package/dist/client/shared/ui/StatusIndicator/StatusIndicator.d.ts +3 -3
- package/dist/client/shared/ui/StatusIndicator/StatusIndicator.js +4 -4
- package/dist/client/shared/ui/StatusIndicator/index.d.ts +1 -1
- package/dist/client/shared/ui/StatusIndicator/index.js +1 -1
- package/dist/client/shared/ui/StatusIndicator/styles.module.scss +1 -1
- package/dist/client/shared/ui/Tooltip/Tooltip.d.ts +2 -2
- package/dist/client/shared/ui/Tooltip/Tooltip.js +4 -4
- package/dist/client/shared/ui/Tooltip/index.d.ts +1 -1
- package/dist/client/shared/ui/Tooltip/index.js +1 -1
- package/dist/client/shared/ui/Tooltip/styles.module.scss +5 -5
- package/dist/client/shared/ui/form/FormCheckbox/FormCheckbox.d.ts +1 -1
- package/dist/client/shared/ui/form/FormCheckbox/FormCheckbox.js +6 -6
- package/dist/client/shared/ui/form/FormCheckbox/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormCheckbox/index.js +1 -1
- package/dist/client/shared/ui/form/FormCheckbox/styles.module.scss +1 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/FormCheckboxPublish.js +5 -5
- package/dist/client/shared/ui/form/FormCheckboxPublish/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/index.js +1 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/styles.module.scss +1 -1
- package/dist/client/shared/ui/form/FormSelect/FormSelect.d.ts +5 -5
- package/dist/client/shared/ui/form/FormSelect/FormSelect.js +9 -9
- package/dist/client/shared/ui/form/FormSelect/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormSelect/index.js +1 -1
- package/dist/client/shared/ui/form/FormSelectLocale/FormSelectLocale.d.ts +1 -1
- package/dist/client/shared/ui/form/FormSelectLocale/FormSelectLocale.js +2 -2
- package/dist/client/shared/ui/form/FormSelectLocale/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormSelectLocale/index.js +1 -1
- package/dist/client/shared/ui/form/FormSelectStrategy/FormSelectStrategy.d.ts +2 -2
- package/dist/client/shared/ui/form/FormSelectStrategy/FormSelectStrategy.js +9 -9
- package/dist/client/shared/ui/form/FormSelectStrategy/index.d.ts +2 -2
- package/dist/client/shared/ui/form/FormSelectStrategy/index.js +1 -1
- package/dist/client/shared/ui/form/FormSelectStrategy/styles.module.scss +1 -1
- package/dist/client/shared/utils/componentPath.js +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/index.d.ts +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/index.js +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.d.ts +2 -2
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.js +3 -3
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.js +11 -11
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.d.ts +2 -2
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.js +3 -3
- package/dist/client/widgets/bulk-translation-dashboard/ui/index.d.ts +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/index.js +1 -1
- package/dist/client/widgets/translate-document/index.d.ts +1 -1
- package/dist/client/widgets/translate-document/index.js +1 -1
- package/dist/client/widgets/translate-document/ui/TranslateDocument.export.d.ts +3 -3
- package/dist/client/widgets/translate-document/ui/TranslateDocument.export.js +3 -3
- package/dist/client/widgets/translate-document/ui/TranslateDocument.js +16 -16
- package/dist/client/widgets/translate-document/ui/TranslateDocument.server.d.ts +2 -2
- package/dist/client/widgets/translate-document/ui/TranslateDocument.server.js +3 -3
- package/dist/client/widgets/translate-document/ui/index.d.ts +1 -1
- package/dist/client/widgets/translate-document/ui/index.js +1 -1
- package/dist/client/widgets/translate-field-control/ui/TranslateFieldControl.export.d.ts +1 -1
- package/dist/client/widgets/translate-field-control/ui/styles.module.scss +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/collectionLevel.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/collectionLevel.js +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/documentLevel.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/documentLevel.js +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/fieldLevel.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/fieldLevel.js +1 -1
- package/dist/composition/levels/index.d.ts +3 -0
- package/dist/composition/levels/index.js +5 -0
- package/dist/{server/modules/translation-levels → composition/levels}/useDocTranslationApi.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/useDocTranslationApi.js +1 -1
- package/dist/core/content-projection/contentProjector.d.ts +28 -0
- package/dist/core/content-projection/contentProjector.js +97 -0
- package/dist/core/content-projection/fingerprinter.d.ts +28 -0
- package/dist/core/content-projection/fingerprinter.js +29 -0
- package/dist/core/content-projection/idPath.d.ts +48 -0
- package/dist/core/content-projection/idPath.js +64 -0
- package/dist/core/content-projection/translatableLeaf.d.ts +27 -0
- package/dist/core/content-projection/translatableLeaf.js +37 -0
- package/dist/core/field-config/getFieldConfig.d.ts +23 -0
- package/dist/{server/shared → core}/field-config/getFieldConfig.js +5 -5
- package/dist/{server/shared → core}/field-config/index.d.ts +3 -3
- package/dist/core/field-config/index.js +4 -0
- package/dist/{server/shared → core}/field-traversal/findFieldByPath.d.ts +2 -3
- package/dist/core/field-traversal/guards.d.ts +19 -0
- package/dist/core/field-traversal/guards.js +20 -0
- package/dist/core/field-traversal/index.d.ts +7 -0
- package/dist/core/field-traversal/index.js +7 -0
- package/dist/{server/shared → core}/field-traversal/kernel.d.ts +7 -8
- package/dist/{server/shared → core}/field-traversal/kernel.js +6 -6
- package/dist/core/field-traversal/predicates.d.ts +24 -0
- package/dist/core/field-traversal/predicates.js +17 -0
- package/dist/{server/shared → core}/field-traversal/types.d.ts +129 -27
- package/dist/{server/shared → core}/field-traversal/types.js +6 -0
- package/dist/{server/shared → core}/field-traversal/walkFields.d.ts +2 -3
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +14 -0
- package/dist/{server/shared → core}/lexical/collectTextNodes.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/collectTextNodes.js +1 -1
- package/dist/{server/shared → core}/lexical/guards.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/guards.js +4 -4
- package/dist/core/lexical/index.d.ts +6 -0
- package/dist/core/lexical/index.js +6 -0
- package/dist/{server/shared → core}/lexical/isEmptyRichText.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/isEmptyRichText.js +3 -3
- package/dist/{server/shared → core}/lexical/traverseLexicalTree.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/traverseLexicalTree.js +1 -1
- package/dist/core/lexical/types.d.ts +33 -0
- package/dist/core/lexical/types.js +11 -0
- package/dist/{server/modules → core}/translation-pipeline/TranslationPipeline.d.ts +4 -4
- package/dist/{server/modules → core}/translation-pipeline/TranslationPipeline.js +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.js +3 -2
- package/dist/core/translation-pipeline/stages/data-reconciler/index.d.ts +2 -0
- package/dist/core/translation-pipeline/stages/data-reconciler/index.js +4 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.js +18 -4
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.stage.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.stage.js +2 -2
- package/dist/core/translation-pipeline/stages/field-collector/index.d.ts +2 -0
- package/dist/core/translation-pipeline/stages/field-collector/index.js +4 -0
- package/dist/core/translation-pipeline/stages/index.d.ts +6 -0
- package/dist/core/translation-pipeline/stages/index.js +7 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/PlainTextExpander.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/PlainTextExpander.js +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/RichTextExpander.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/RichTextExpander.js +3 -3
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.stage.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.stage.js +4 -4
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextExpander.interface.d.ts +1 -1
- package/dist/core/translation-pipeline/stages/text-expander/index.d.ts +6 -0
- package/dist/core/translation-pipeline/stages/text-expander/index.js +6 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/translation/Translation.stage.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/translation/Translation.stage.js +1 -1
- package/dist/core/translation-pipeline/stages/translation/index.d.ts +1 -0
- package/dist/core/translation-pipeline/stages/translation/index.js +3 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.js +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.stage.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.stage.js +2 -2
- package/dist/core/translation-pipeline/stages/translation-applicator/index.d.ts +2 -0
- package/dist/core/translation-pipeline/stages/translation-applicator/index.js +4 -0
- package/dist/{server/modules → core}/translation-pipeline/strategies/Overwrite.strategy.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/strategies/Overwrite.strategy.js +1 -1
- package/dist/{server/modules → core}/translation-pipeline/strategies/SkipExisting.strategy.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/strategies/SkipExisting.strategy.js +3 -1
- package/dist/core/translation-pipeline/strategies/index.d.ts +13 -0
- package/dist/{server/modules → core}/translation-pipeline/strategies/index.js +4 -4
- package/dist/{server/modules → core}/translation-pipeline/translateContent.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/types/FieldChunk.d.ts +3 -3
- package/dist/{server/modules → core}/translation-pipeline/types/Pipeline.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/types/PipelineContext.d.ts +4 -4
- package/dist/{server/modules → core}/translation-pipeline/types/TextChunk.d.ts +3 -3
- package/dist/{server/modules → core}/translation-pipeline/types/TextChunk.js +2 -2
- package/dist/core/translation-pipeline/types/index.d.ts +5 -0
- package/dist/core/translation-pipeline/types/index.js +3 -0
- package/dist/core/translation-providers/index.d.ts +1 -0
- package/dist/core/translation-providers/index.js +5 -0
- package/dist/core/utils/index.d.ts +2 -0
- package/dist/core/utils/index.js +4 -0
- package/dist/{server/shared → core}/utils/isEmpty.js +2 -2
- package/dist/{server/shared → core}/utils/isObject.js +1 -1
- package/dist/field-actions.d.ts +1 -1
- package/dist/field-config.d.ts +1 -1
- package/dist/field-config.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -4
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +1 -1
- package/dist/server/features/_lib/collection-utils.d.ts +1 -1
- package/dist/server/features/_lib/index.d.ts +1 -1
- package/dist/server/features/_lib/index.js +1 -1
- package/dist/server/features/cancel/index.d.ts +1 -1
- package/dist/server/features/cancel/index.js +1 -1
- package/dist/server/features/cancel-by-collection/index.d.ts +1 -1
- package/dist/server/features/cancel-by-collection/index.js +1 -1
- package/dist/server/features/cancel-by-collection/model.d.ts +2 -2
- package/dist/server/features/cancel-by-collection/model.js +1 -1
- package/dist/server/features/createTranslationRoutes.d.ts +1 -1
- package/dist/server/features/enqueue-translation/index.d.ts +1 -1
- package/dist/server/features/enqueue-translation/index.js +1 -1
- package/dist/server/features/enqueue-translation/model.d.ts +2 -2
- package/dist/server/features/enqueue-translation/model.js +4 -4
- package/dist/server/features/get-collection-status/index.d.ts +1 -1
- package/dist/server/features/get-collection-status/index.js +1 -1
- package/dist/server/features/get-collection-status/model.d.ts +3 -3
- package/dist/server/features/get-collection-status/model.js +1 -1
- package/dist/server/features/get-document-status/index.d.ts +2 -2
- package/dist/server/features/get-document-status/index.js +2 -2
- package/dist/server/features/run-translation/index.d.ts +1 -1
- package/dist/server/features/run-translation/index.js +1 -1
- package/dist/server/features/translate-document/handler.d.ts +3 -2
- package/dist/server/features/translate-document/handler.js +1 -1
- package/dist/server/features/translate-document/index.d.ts +1 -1
- package/dist/server/features/translate-document/model.d.ts +2 -7
- package/dist/server/features/translate-document/model.js +1 -2
- package/dist/server/features/translate-field/handler.js +1 -1
- package/dist/server/features/translate-field/index.d.ts +2 -1
- package/dist/server/features/translate-field/model.d.ts +2 -19
- package/dist/server/features/translate-field/resolveFieldSubtree.js +1 -1
- package/dist/server/features/translate-field/route.d.ts +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +3 -3
- package/dist/server/modules/index.d.ts +2 -2
- package/dist/server/modules/index.js +2 -2
- package/dist/server/modules/task-runner/TaskRunner.interface.d.ts +2 -2
- package/dist/server/modules/task-runner/TaskRunnerProvider.interface.d.ts +1 -1
- package/dist/server/modules/task-runner/index.d.ts +1 -1
- package/dist/server/modules/task-runner/payload-jobs-runner/index.d.ts +2 -2
- package/dist/server/modules/task-runner/payload-jobs-runner/index.js +1 -1
- package/dist/server/modules/task-runner/sync-runner/index.d.ts +1 -1
- package/dist/server/modules/task-runner/sync-runner/index.js +1 -1
- package/dist/server/modules/translation-levels/PluginConfigBuilder.d.ts +3 -3
- package/dist/server/modules/translation-levels/index.d.ts +1 -4
- package/dist/server/modules/translation-levels/index.js +1 -3
- package/dist/server/modules/translation-levels/types.d.ts +3 -3
- package/dist/server/shared/access/AnyAccessGuard.d.ts +1 -1
- package/dist/server/shared/access/handler.d.ts +1 -1
- package/dist/server/shared/access/index.d.ts +3 -3
- package/dist/server/shared/access/index.js +1 -1
- package/dist/server/shared/access/types.d.ts +1 -1
- package/dist/server/shared/guards/collection-guards.d.ts +1 -1
- package/dist/server/shared/guards/collection-guards.js +2 -2
- package/dist/server/shared/guards/field-guards.d.ts +9 -20
- package/dist/server/shared/guards/field-guards.js +5 -20
- package/dist/server/shared/guards/index.d.ts +3 -3
- package/dist/server/shared/guards/index.js +2 -2
- package/dist/server/shared/http/ServerResponse.js +15 -15
- package/dist/server/shared/http/index.d.ts +3 -3
- package/dist/server/shared/http/index.js +3 -3
- package/dist/server/shared/http/withAccessCheck.d.ts +2 -2
- package/dist/server/shared/http/withAccessCheck.js +1 -1
- package/dist/server/shared/http/withErrorHandler.js +3 -3
- package/dist/server/shared/index.d.ts +6 -5
- package/dist/server/shared/index.js +4 -3
- package/dist/server/shared/utils/filterLocalizedFields.js +2 -2
- package/dist/server/shared/utils/getByPath.js +2 -2
- package/dist/server/shared/utils/index.d.ts +9 -9
- package/dist/server/shared/utils/index.js +8 -8
- package/dist/server/shared/utils/normalizePath.js +3 -3
- package/dist/server/shared/utils/setByPath.js +2 -2
- package/dist/translation-providers/index.d.ts +2 -0
- package/dist/translation-providers/index.js +10 -0
- package/dist/{server/modules/translation-providers → translation-providers/openai}/OpenAITranslation.provider.d.ts +1 -1
- package/dist/{server/modules/translation-providers → translation-providers/openai}/OpenAITranslation.provider.js +1 -1
- package/dist/translation-providers/openai/index.d.ts +1 -0
- package/dist/translation-providers/openai/index.js +5 -0
- package/dist/types/CollectionSchemaMap.d.ts +6 -0
- package/dist/types/CollectionSchemaMap.js +6 -0
- package/dist/{client/shared/types → types}/PayloadComponentExport.d.ts +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/wire/field-translation.d.ts +17 -0
- package/dist/types/wire/field-translation.js +7 -0
- package/package.json +3 -1
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/index.d.ts +0 -2
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/index.js +0 -4
- package/dist/server/modules/translation-pipeline/stages/field-collector/index.d.ts +0 -2
- package/dist/server/modules/translation-pipeline/stages/field-collector/index.js +0 -4
- package/dist/server/modules/translation-pipeline/stages/index.d.ts +0 -6
- package/dist/server/modules/translation-pipeline/stages/index.js +0 -7
- package/dist/server/modules/translation-pipeline/stages/text-expander/index.d.ts +0 -6
- package/dist/server/modules/translation-pipeline/stages/text-expander/index.js +0 -6
- package/dist/server/modules/translation-pipeline/stages/translation/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation/index.js +0 -3
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/index.d.ts +0 -2
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/index.js +0 -4
- package/dist/server/modules/translation-pipeline/strategies/index.d.ts +0 -13
- package/dist/server/modules/translation-pipeline/types/index.d.ts +0 -5
- package/dist/server/modules/translation-pipeline/types/index.js +0 -3
- package/dist/server/modules/translation-providers/index.d.ts +0 -2
- package/dist/server/modules/translation-providers/index.js +0 -3
- package/dist/server/shared/field-config/getFieldConfig.d.ts +0 -20
- package/dist/server/shared/field-config/index.js +0 -4
- package/dist/server/shared/field-traversal/index.d.ts +0 -5
- package/dist/server/shared/field-traversal/index.js +0 -5
- package/dist/server/shared/lexical/index.d.ts +0 -6
- package/dist/server/shared/lexical/index.js +0 -6
- package/dist/server/shared/lexical/types.d.ts +0 -19
- package/dist/server/shared/lexical/types.js +0 -8
- /package/dist/{server/shared → core}/field-config/types.d.ts +0 -0
- /package/dist/{server/shared → core}/field-config/types.js +0 -0
- /package/dist/{server/shared → core}/field-traversal/findFieldByPath.js +0 -0
- /package/dist/{server/shared → core}/field-traversal/walkFields.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/index.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/index.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.stage.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.stage.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextExpander.interface.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/strategies/TranslationStrategy.interface.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/strategies/TranslationStrategy.interface.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/translateContent.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/types/FieldChunk.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/types/Pipeline.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/types/PipelineContext.js +0 -0
- /package/dist/{server/modules → core}/translation-providers/TranslationProvider.interface.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-providers/TranslationProvider.interface.js +0 -0
- /package/dist/{server/shared → core}/utils/isEmpty.d.ts +0 -0
- /package/dist/{server/shared → core}/utils/isObject.d.ts +0 -0
- /package/dist/{client/shared/types → types}/PayloadComponentExport.js +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { isSerializedLexicalRoot, isSerializedLexicalTextNode, hasChildren } from "./guards";
|
|
2
|
+
export { isEmptyRichText } from "./isEmptyRichText";
|
|
3
|
+
export { traverseLexicalTree } from "./traverseLexicalTree";
|
|
4
|
+
export { collectSerializedLexicalTextNodes } from "./collectTextNodes";
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { traverseLexicalTree } from
|
|
2
|
-
import { isSerializedLexicalTextNode } from
|
|
1
|
+
import { traverseLexicalTree } from "./traverseLexicalTree";
|
|
2
|
+
import { isSerializedLexicalTextNode } from "./guards";
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a serialized Lexical richText structure is empty.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@ import { isSerializedLexicalTextNode } from './guards';
|
|
|
14
14
|
let hasContent = false;
|
|
15
15
|
traverseLexicalTree(value.root, (node)=>{
|
|
16
16
|
const { type } = node;
|
|
17
|
-
if (type !==
|
|
17
|
+
if (type !== "paragraph" && type !== "text" && type !== "root") {
|
|
18
18
|
hasContent = true;
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locally-owned structural views of the serialized Lexical JSON stored in Payload richText
|
|
3
|
+
* fields. Defined here (rather than imported from `@payloadcms/richtext-lexical`) so this layer
|
|
4
|
+
* stays framework-agnostic for the `@repo/translator-core` extraction. They are intentionally a
|
|
5
|
+
* structural SUPERSET of what this package reads (`type`, `text`, `children`) — Payload's concrete
|
|
6
|
+
* `Serialized*` nodes remain assignable to them (guarded by `types.conformance.test.ts`).
|
|
7
|
+
*/
|
|
8
|
+
/** Base serialized Lexical node. `version` is carried by real nodes but never read here. */
|
|
9
|
+
export type SerializedLexicalNode = {
|
|
10
|
+
type: string;
|
|
11
|
+
version?: number;
|
|
12
|
+
};
|
|
13
|
+
/** A serialized text node — the only node whose `text` this package translates (and mutates). */
|
|
14
|
+
export type SerializedTextNode = SerializedLexicalNode & {
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
/** An element node that carries children (e.g. the editor root, paragraphs). */
|
|
18
|
+
export type SerializedRootNode = SerializedLexicalNode & {
|
|
19
|
+
children: SerializedLexicalNode[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Serialized Lexical root structure as stored in Payload CMS richText fields.
|
|
23
|
+
* Wraps the root node in a { root: ... } object.
|
|
24
|
+
*/
|
|
25
|
+
export type SerializedLexicalRoot = {
|
|
26
|
+
root: SerializedLexicalNode;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reference to a serialized text node for mutation during translation.
|
|
30
|
+
*/
|
|
31
|
+
export type SerializedTextNodeRef = {
|
|
32
|
+
node: SerializedTextNode;
|
|
33
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locally-owned structural views of the serialized Lexical JSON stored in Payload richText
|
|
3
|
+
* fields. Defined here (rather than imported from `@payloadcms/richtext-lexical`) so this layer
|
|
4
|
+
* stays framework-agnostic for the `@repo/translator-core` extraction. They are intentionally a
|
|
5
|
+
* structural SUPERSET of what this package reads (`type`, `text`, `children`) — Payload's concrete
|
|
6
|
+
* `Serialized*` nodes remain assignable to them (guarded by `types.conformance.test.ts`).
|
|
7
|
+
*/ /** Base serialized Lexical node. `version` is carried by real nodes but never read here. */ /**
|
|
8
|
+
* Reference to a serialized text node for mutation during translation.
|
|
9
|
+
*/ export { };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TranslationProvider } from
|
|
2
|
-
import type { PipelineConfig, PipelineResult } from
|
|
3
|
-
import type { TranslationStrategy } from
|
|
4
|
-
import type { TextExpander } from
|
|
1
|
+
import type { TranslationProvider } from "../translation-providers";
|
|
2
|
+
import type { PipelineConfig, PipelineResult } from "./types";
|
|
3
|
+
import type { TranslationStrategy } from "./strategies";
|
|
4
|
+
import type { TextExpander } from "./stages";
|
|
5
5
|
/**
|
|
6
6
|
* Options for TranslationPipeline.
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataReconcilerStage, FieldChunkCollectorStage, TranslationStage, TextChunkExpanderStage, TranslationMutatorStage } from
|
|
1
|
+
import { DataReconcilerStage, FieldChunkCollectorStage, TranslationStage, TextChunkExpanderStage, TranslationMutatorStage } from "./stages";
|
|
2
2
|
/**
|
|
3
3
|
* Main orchestrator for the translation pipeline.
|
|
4
4
|
* Coordinates all stages in sequence via PipelineContext.
|
package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FieldLike } from "../../../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.
|
|
@@ -7,7 +7,7 @@ import type { Field } from "payload";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class DataReconciler {
|
|
9
9
|
private readonly schema;
|
|
10
|
-
constructor(schema:
|
|
10
|
+
constructor(schema: FieldLike[]);
|
|
11
11
|
/**
|
|
12
12
|
* Reconciles source and target data into a complete document shape.
|
|
13
13
|
*
|
package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.js
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isEmpty
|
|
2
|
-
import {
|
|
1
|
+
import { isEmpty } from "../../../utils/isEmpty";
|
|
2
|
+
import { isObject } from "../../../utils/isObject";
|
|
3
|
+
import { matchElementById, resolveBlockFields, walkFields } from "../../../field-traversal";
|
|
3
4
|
const asObject = (value)=>isObject(value) ? value : {};
|
|
4
5
|
/**
|
|
5
6
|
* Reconcile walker: produces the full document shape from source + target, with target
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FieldLike } from "../../../field-traversal";
|
|
2
2
|
import type { TranslationStrategy } from "../../strategies";
|
|
3
3
|
import type { FieldChunk } from "../../types";
|
|
4
4
|
/**
|
|
@@ -22,7 +22,7 @@ export declare class FieldChunkCollector {
|
|
|
22
22
|
private readonly sourceData;
|
|
23
23
|
private readonly targetData;
|
|
24
24
|
private readonly strategy;
|
|
25
|
-
constructor(schema:
|
|
25
|
+
constructor(schema: FieldLike[], filteredData: Record<string, unknown>, sourceData: Record<string, unknown>, targetData: Record<string, unknown>, strategy: TranslationStrategy);
|
|
26
26
|
/** Collects translatable field chunks that need translation. */
|
|
27
27
|
collect(): FieldChunk[];
|
|
28
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { matchElementById, resolveBlockFields, walkFields } from "
|
|
1
|
+
import { isTranslatableLeaf } from "../../../content-projection/translatableLeaf";
|
|
2
|
+
import { matchElementById, resolveBlockFields, walkFields } from "../../../field-traversal";
|
|
3
|
+
import { isObject } from "../../../utils/isObject";
|
|
3
4
|
const asObject = (value)=>isObject(value) ? value : {};
|
|
4
5
|
/**
|
|
5
6
|
* Collects FieldChunks by walking schema + data with the shared {@link walkFields} engine.
|
|
@@ -29,6 +30,10 @@ const asObject = (value)=>isObject(value) ? value : {};
|
|
|
29
30
|
this.strategy = strategy;
|
|
30
31
|
}
|
|
31
32
|
/** Collects translatable field chunks that need translation. */ collect() {
|
|
33
|
+
// The read walk SELECTS translatable leaves (via the shared selection core) and records, per
|
|
34
|
+
// selected leaf, the source value to translate plus its write target. The mutation is applied
|
|
35
|
+
// in a separate explicit pass below — read and write are no longer fused inside the walk.
|
|
36
|
+
const selected = [];
|
|
32
37
|
const chunks = [];
|
|
33
38
|
const { strategy } = this;
|
|
34
39
|
const walker = {
|
|
@@ -83,11 +88,15 @@ const asObject = (value)=>isObject(value) ? value : {};
|
|
|
83
88
|
if (value === undefined || value === null) return undefined;
|
|
84
89
|
const sourceValue = cursor.source[field.name];
|
|
85
90
|
const targetValue = cursor.target[field.name];
|
|
86
|
-
if (
|
|
91
|
+
if (isTranslatableLeaf(field) && strategy.shouldTranslate({
|
|
87
92
|
sourceValue,
|
|
88
93
|
targetValue
|
|
89
94
|
})) {
|
|
90
|
-
|
|
95
|
+
selected.push({
|
|
96
|
+
dataRef: cursor.data,
|
|
97
|
+
key: field.name,
|
|
98
|
+
sourceValue
|
|
99
|
+
});
|
|
91
100
|
chunks.push({
|
|
92
101
|
schema: field,
|
|
93
102
|
dataRef: cursor.data,
|
|
@@ -110,6 +119,11 @@ const asObject = (value)=>isObject(value) ? value : {};
|
|
|
110
119
|
target: this.targetData,
|
|
111
120
|
path: []
|
|
112
121
|
}, walker);
|
|
122
|
+
// Apply pass: write each selected leaf's source value into filteredData — this is what gets
|
|
123
|
+
// translated. Kept separate from the read walk above so selection stays read-only.
|
|
124
|
+
for (const { dataRef, key, sourceValue } of selected){
|
|
125
|
+
dataRef[key] = sourceValue;
|
|
126
|
+
}
|
|
113
127
|
return chunks;
|
|
114
128
|
}
|
|
115
129
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PipelineContext, PipelineStage } from
|
|
2
|
-
import type { TranslationStrategy } from
|
|
1
|
+
import type { PipelineContext, PipelineStage } from "../../types";
|
|
2
|
+
import type { TranslationStrategy } from "../../strategies";
|
|
3
3
|
/**
|
|
4
4
|
* Collects FieldChunks with schema metadata and data references.
|
|
5
5
|
* Applies all filtering logic including strategy.shouldTranslate().
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldChunkCollector } from
|
|
1
|
+
import { FieldChunkCollector } from "./FieldChunkCollector";
|
|
2
2
|
/**
|
|
3
3
|
* Collects FieldChunks with schema metadata and data references.
|
|
4
4
|
* Applies all filtering logic including strategy.shouldTranslate().
|
|
@@ -10,7 +10,7 @@ import { FieldChunkCollector } from './FieldChunkCollector';
|
|
|
10
10
|
}
|
|
11
11
|
execute(ctx) {
|
|
12
12
|
if (!ctx.filteredData) {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error("FieldChunkCollectorStage requires filteredData from previous stage");
|
|
14
14
|
}
|
|
15
15
|
const collector = new FieldChunkCollector(ctx.schema, ctx.filteredData, ctx.sourceData, ctx.targetData, this.strategy);
|
|
16
16
|
return {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DataReconciler, DataReconcilerStage } from "./data-reconciler";
|
|
2
|
+
export { FieldChunkCollector, FieldChunkCollectorStage } from "./field-collector";
|
|
3
|
+
export { TextChunkExpander, PlainTextExpander, RichTextExpander, TextChunkExpanderStage, } from "./text-expander";
|
|
4
|
+
export type { TextExpansionResult, TextExpander, ExpansionResult } from "./text-expander";
|
|
5
|
+
export { TranslationStage } from "./translation";
|
|
6
|
+
export { TranslationMutator, TranslationMutatorStage } from "./translation-applicator";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DataReconciler, DataReconcilerStage } from "./data-reconciler";
|
|
2
|
+
export { FieldChunkCollector, FieldChunkCollectorStage } from "./field-collector";
|
|
3
|
+
export { TextChunkExpander, PlainTextExpander, RichTextExpander, TextChunkExpanderStage } from "./text-expander";
|
|
4
|
+
export { TranslationStage } from "./translation";
|
|
5
|
+
export { TranslationMutator, TranslationMutatorStage } from "./translation-applicator";
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldChunk } from
|
|
2
|
-
import type { ExpansionResult, TextExpander } from
|
|
1
|
+
import type { FieldChunk } from "../../types";
|
|
2
|
+
import type { ExpansionResult, TextExpander } from "./TextExpander.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Expands plain text and textarea fields into PlainTextChunks.
|
|
5
5
|
*/
|
package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/PlainTextExpander.js
RENAMED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Expands plain text and textarea fields into PlainTextChunks.
|
|
3
3
|
*/ export class PlainTextExpander {
|
|
4
4
|
canExpand(_chunk, value) {
|
|
5
|
-
return typeof value ===
|
|
5
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
6
6
|
}
|
|
7
7
|
expand(chunk, value, startIndex) {
|
|
8
8
|
const text = value;
|
|
9
9
|
const textChunk = {
|
|
10
|
-
type:
|
|
10
|
+
type: "plain",
|
|
11
11
|
index: startIndex,
|
|
12
12
|
text,
|
|
13
13
|
dataRef: chunk.dataRef,
|
package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/RichTextExpander.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldChunk } from
|
|
2
|
-
import type { ExpansionResult, TextExpander } from
|
|
1
|
+
import type { FieldChunk } from "../../types";
|
|
2
|
+
import type { ExpansionResult, TextExpander } from "./TextExpander.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Expands richText fields into multiple RichTextChunks (one per text node).
|
|
5
5
|
*/
|
package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/RichTextExpander.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isSerializedLexicalRoot, collectSerializedLexicalTextNodes } from
|
|
1
|
+
import { isSerializedLexicalRoot, collectSerializedLexicalTextNodes } from "../../../lexical";
|
|
2
2
|
/**
|
|
3
3
|
* Expands richText fields into multiple RichTextChunks (one per text node).
|
|
4
4
|
*/ export class RichTextExpander {
|
|
5
5
|
canExpand(chunk, value) {
|
|
6
|
-
return chunk.schema.type ===
|
|
6
|
+
return chunk.schema.type === "richText" && isSerializedLexicalRoot(value);
|
|
7
7
|
}
|
|
8
8
|
expand(_chunk, value, startIndex) {
|
|
9
9
|
const root = value;
|
|
@@ -13,7 +13,7 @@ import { isSerializedLexicalRoot, collectSerializedLexicalTextNodes } from '../.
|
|
|
13
13
|
let index = startIndex;
|
|
14
14
|
for (const ref of textNodeRefs){
|
|
15
15
|
chunks.push({
|
|
16
|
-
type:
|
|
16
|
+
type: "richText",
|
|
17
17
|
index,
|
|
18
18
|
text: ref.node.text,
|
|
19
19
|
nodeRef: ref.node
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldChunk, TextChunk } from
|
|
2
|
-
import type { TextExpander } from
|
|
1
|
+
import type { FieldChunk, TextChunk } from "../../types";
|
|
2
|
+
import type { TextExpander } from "./TextExpander.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Result of text chunk expansion.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PipelineContext, PipelineStage } from
|
|
2
|
-
import type { TextExpander } from
|
|
1
|
+
import type { PipelineContext, PipelineStage } from "../../types";
|
|
2
|
+
import type { TextExpander } from "./TextExpander.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Expands FieldChunks to TextChunks (schema-free).
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TextChunkExpander } from
|
|
2
|
-
import { RichTextExpander } from
|
|
3
|
-
import { PlainTextExpander } from
|
|
1
|
+
import { TextChunkExpander } from "./TextChunkExpander";
|
|
2
|
+
import { RichTextExpander } from "./RichTextExpander";
|
|
3
|
+
import { PlainTextExpander } from "./PlainTextExpander";
|
|
4
4
|
const defaultExpanders = [
|
|
5
5
|
new RichTextExpander(),
|
|
6
6
|
new PlainTextExpander()
|
|
@@ -14,7 +14,7 @@ const defaultExpanders = [
|
|
|
14
14
|
}
|
|
15
15
|
execute(ctx) {
|
|
16
16
|
if (!ctx.fieldChunks) {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error("TextChunkExpanderStage requires fieldChunks from previous stage");
|
|
18
18
|
}
|
|
19
19
|
const expander = new TextChunkExpander(this.expanders);
|
|
20
20
|
const { textChunks, textMap } = expander.expand(ctx.fieldChunks);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { TextChunkExpander } from "./TextChunkExpander";
|
|
2
|
+
export type { TextExpansionResult } from "./TextChunkExpander";
|
|
3
|
+
export type { TextExpander, ExpansionResult } from "./TextExpander.interface";
|
|
4
|
+
export { PlainTextExpander } from "./PlainTextExpander";
|
|
5
|
+
export { RichTextExpander } from "./RichTextExpander";
|
|
6
|
+
export { TextChunkExpanderStage } from "./TextChunkExpander.stage";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { TextChunkExpander } from "./TextChunkExpander";
|
|
2
|
+
export { PlainTextExpander } from "./PlainTextExpander";
|
|
3
|
+
export { RichTextExpander } from "./RichTextExpander";
|
|
4
|
+
export { TextChunkExpanderStage } from "./TextChunkExpander.stage";
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/dist/{server/modules → core}/translation-pipeline/stages/translation/Translation.stage.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PipelineContext, PipelineStage } from
|
|
2
|
-
import type { TranslationProvider } from
|
|
1
|
+
import type { PipelineContext, PipelineStage } from "../../types";
|
|
2
|
+
import type { TranslationProvider } from "../../../translation-providers";
|
|
3
3
|
/**
|
|
4
4
|
* Calls translation provider to translate text.
|
|
5
5
|
*/
|
package/dist/{server/modules → core}/translation-pipeline/stages/translation/Translation.stage.js
RENAMED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
const translations = await this.provider.translate(ctx.textMap, ctx.sourceLng, ctx.targetLng);
|
|
13
13
|
if (!translations) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error("Translation provider returned null");
|
|
15
15
|
}
|
|
16
16
|
return {
|
|
17
17
|
...ctx,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TranslationStage } from "./Translation.stage";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TranslationMutator } from
|
|
1
|
+
import { TranslationMutator } from "./TranslationMutator";
|
|
2
2
|
/**
|
|
3
3
|
* Applies translations to data via mutation.
|
|
4
4
|
*/ export class TranslationMutatorStage {
|
|
5
5
|
execute(ctx) {
|
|
6
6
|
if (!ctx.textChunks || !ctx.translations) {
|
|
7
|
-
throw new Error(
|
|
7
|
+
throw new Error("TranslationMutatorStage requires textChunks and translations");
|
|
8
8
|
}
|
|
9
9
|
const mutator = new TranslationMutator();
|
|
10
10
|
mutator.apply(ctx.textChunks, ctx.translations);
|
package/dist/{server/modules → core}/translation-pipeline/strategies/Overwrite.strategy.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TranslationStrategy, StrategyContext } from
|
|
1
|
+
import type { TranslationStrategy, StrategyContext } from "./TranslationStrategy.interface";
|
|
2
2
|
/**
|
|
3
3
|
* Translates all fields, overwriting existing translations.
|
|
4
4
|
* This is the default strategy.
|
package/dist/{server/modules → core}/translation-pipeline/strategies/SkipExisting.strategy.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TranslationStrategy, StrategyContext } from
|
|
1
|
+
import type { TranslationStrategy, StrategyContext } from "./TranslationStrategy.interface";
|
|
2
2
|
/**
|
|
3
3
|
* Only translates fields that are empty or missing in the target locale.
|
|
4
4
|
* Existing translations are preserved.
|
package/dist/{server/modules → core}/translation-pipeline/strategies/SkipExisting.strategy.js
RENAMED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEmptyRichText } from "../../lexical/isEmptyRichText";
|
|
2
|
+
import { isSerializedLexicalRoot } from "../../lexical/guards";
|
|
3
|
+
import { isEmpty } from "../../utils/isEmpty";
|
|
2
4
|
/**
|
|
3
5
|
* Only translates fields that are empty or missing in the target locale.
|
|
4
6
|
* Existing translations are preserved.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TranslationStrategy } from "./TranslationStrategy.interface";
|
|
2
|
+
import { OverwriteStrategy } from "./Overwrite.strategy";
|
|
3
|
+
import { SkipExistingStrategy } from "./SkipExisting.strategy";
|
|
4
|
+
export type { TranslationStrategy, StrategyContext } from "./TranslationStrategy.interface";
|
|
5
|
+
export { OverwriteStrategy, SkipExistingStrategy };
|
|
6
|
+
/**
|
|
7
|
+
* Strategy names for runtime selection.
|
|
8
|
+
*/
|
|
9
|
+
export type TranslationStrategyName = "overwrite" | "skip_existing";
|
|
10
|
+
/**
|
|
11
|
+
* Creates a TranslationStrategy instance by name.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createTranslationStrategy(name: TranslationStrategyName): TranslationStrategy;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { OverwriteStrategy } from
|
|
2
|
-
import { SkipExistingStrategy } from
|
|
1
|
+
import { OverwriteStrategy } from "./Overwrite.strategy";
|
|
2
|
+
import { SkipExistingStrategy } from "./SkipExisting.strategy";
|
|
3
3
|
export { OverwriteStrategy, SkipExistingStrategy };
|
|
4
4
|
/**
|
|
5
5
|
* Creates a TranslationStrategy instance by name.
|
|
6
6
|
*/ export function createTranslationStrategy(name) {
|
|
7
7
|
switch(name){
|
|
8
|
-
case
|
|
8
|
+
case "skip_existing":
|
|
9
9
|
return new SkipExistingStrategy();
|
|
10
|
-
case
|
|
10
|
+
case "overwrite":
|
|
11
11
|
default:
|
|
12
12
|
return new OverwriteStrategy();
|
|
13
13
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FieldLike } from "../field-traversal";
|
|
2
2
|
import type { TranslationProvider } from "../translation-providers";
|
|
3
3
|
import type { TranslationStrategyName } from "./strategies";
|
|
4
4
|
export type TranslateContentArgs = {
|
|
5
5
|
/** Schema subtree to translate (e.g. `[declaredFieldConfig]`). */
|
|
6
|
-
schema:
|
|
6
|
+
schema: FieldLike[];
|
|
7
7
|
/** Source values, rooted to match `schema` (e.g. `{ [fieldName]: value }`). */
|
|
8
8
|
sourceData: Record<string, unknown>;
|
|
9
9
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LeafFieldLike } from "../../field-traversal/types";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a field-level chunk containing schema metadata.
|
|
4
4
|
* Used in stages 1-3 where schema awareness is needed.
|
|
@@ -6,8 +6,8 @@ import type { Field } from 'payload';
|
|
|
6
6
|
* Contains a reference to the parent data object for later mutation.
|
|
7
7
|
*/
|
|
8
8
|
export type FieldChunk = {
|
|
9
|
-
/** The field schema
|
|
10
|
-
schema:
|
|
9
|
+
/** The leaf field schema (only `type`/`name` are read downstream). */
|
|
10
|
+
schema: LeafFieldLike;
|
|
11
11
|
/** Reference to the parent data object (for mutation) */
|
|
12
12
|
dataRef: Record<string, unknown>;
|
|
13
13
|
/** The key in the dataRef object */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FieldLike } from "../../field-traversal";
|
|
2
2
|
/**
|
|
3
3
|
* Pipeline configuration for translation execution.
|
|
4
4
|
* Contains only data transformation inputs — no persistence concerns.
|
|
5
5
|
*/
|
|
6
6
|
export type PipelineConfig = {
|
|
7
|
-
schema:
|
|
7
|
+
schema: FieldLike[];
|
|
8
8
|
sourceData: Record<string, unknown>;
|
|
9
9
|
targetData: Record<string, unknown>;
|
|
10
10
|
sourceLng: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FieldChunk } from
|
|
3
|
-
import type { TextChunk } from
|
|
1
|
+
import type { FieldLike } from "../../field-traversal";
|
|
2
|
+
import type { FieldChunk } from "./FieldChunk";
|
|
3
|
+
import type { TextChunk } from "./TextChunk";
|
|
4
4
|
/**
|
|
5
5
|
* Pipeline context passed through all stages.
|
|
6
6
|
* Each stage reads from context and writes its results back.
|
|
7
7
|
*/
|
|
8
8
|
export type PipelineContext = {
|
|
9
|
-
readonly schema:
|
|
9
|
+
readonly schema: FieldLike[];
|
|
10
10
|
readonly sourceData: Record<string, unknown>;
|
|
11
11
|
readonly targetData: Record<string, unknown>;
|
|
12
12
|
readonly sourceLng: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { SerializedTextNode } from
|
|
1
|
+
import type { SerializedTextNode } from "../../lexical";
|
|
2
2
|
/**
|
|
3
3
|
* Text chunk for plain text/textarea fields.
|
|
4
4
|
* Mutates dataRef[key] directly.
|
|
5
5
|
*/
|
|
6
6
|
export type PlainTextChunk = {
|
|
7
|
-
type:
|
|
7
|
+
type: "plain";
|
|
8
8
|
/** Unique index for translation mapping */
|
|
9
9
|
index: number;
|
|
10
10
|
/** Original text value */
|
|
@@ -19,7 +19,7 @@ export type PlainTextChunk = {
|
|
|
19
19
|
* Mutates nodeRef.text directly.
|
|
20
20
|
*/
|
|
21
21
|
export type RichTextChunk = {
|
|
22
|
-
type:
|
|
22
|
+
type: "richText";
|
|
23
23
|
/** Unique index for translation mapping */
|
|
24
24
|
index: number;
|
|
25
25
|
/** Original text value */
|