@focus-reactive/payload-plugin-translator 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- 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/computeSourceFingerprint.d.ts +15 -0
- package/dist/core/content-projection/computeSourceFingerprint.js +19 -0
- 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 +12 -0
- package/dist/core/index.js +15 -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/core/provenance/ProvenanceStore.interface.d.ts +99 -0
- package/dist/core/provenance/ProvenanceStore.interface.js +37 -0
- package/dist/core/provenance/index.d.ts +1 -0
- package/dist/core/provenance/index.js +5 -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 +7 -4
- package/dist/index.js +4 -4
- package/dist/plugin.d.ts +27 -1
- package/dist/plugin.js +56 -16
- 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 +6 -3
- package/dist/server/features/translate-document/handler.js +28 -2
- 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/lifecycle/LifecycleNotifier.d.ts +21 -0
- package/dist/server/modules/lifecycle/LifecycleNotifier.js +38 -0
- package/dist/server/modules/lifecycle/index.d.ts +4 -0
- package/dist/server/modules/lifecycle/index.js +7 -0
- package/dist/server/modules/lifecycle/taskMapping.d.ts +7 -0
- package/dist/server/modules/lifecycle/taskMapping.js +16 -0
- package/dist/server/modules/lifecycle/types.d.ts +45 -0
- package/dist/server/modules/lifecycle/types.js +21 -0
- package/dist/server/modules/lifecycle/withQueuedNotification.d.ts +9 -0
- package/dist/server/modules/lifecycle/withQueuedNotification.js +19 -0
- package/dist/server/modules/provenance/PayloadProvenanceStore.d.ts +21 -0
- package/dist/server/modules/provenance/PayloadProvenanceStore.js +109 -0
- package/dist/server/modules/provenance/index.d.ts +5 -0
- package/dist/server/modules/provenance/index.js +8 -0
- package/dist/server/modules/provenance/provenanceCleanupHook.d.ts +18 -0
- package/dist/server/modules/provenance/provenanceCleanupHook.js +41 -0
- package/dist/server/modules/provenance/provenanceCollection.d.ts +23 -0
- package/dist/server/modules/provenance/provenanceCollection.js +82 -0
- package/dist/server/modules/provenance/slugGuard.d.ts +16 -0
- package/dist/server/modules/provenance/slugGuard.js +19 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Input validation schema
|
|
4
4
|
*/ export const EnqueueInputSchema = z.object({
|
|
@@ -8,9 +8,9 @@ import { z } from 'zod';
|
|
|
8
8
|
collection_id: z.array(z.coerce.string()).nonempty(),
|
|
9
9
|
select_all: z.boolean().optional(),
|
|
10
10
|
strategy: z.enum([
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
]).optional().default(
|
|
11
|
+
"overwrite",
|
|
12
|
+
"skip_existing"
|
|
13
|
+
]).optional().default("overwrite"),
|
|
14
14
|
publish_on_translation: z.boolean().optional().default(false)
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createGetCollectionStatusRoute } from
|
|
1
|
+
export { createGetCollectionStatusRoute } from "./route";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import type { CollectionSlug } from
|
|
3
|
-
import type { TaskStatus } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CollectionSlug } from "payload";
|
|
3
|
+
import type { TaskStatus } from "../../modules/task-runner";
|
|
4
4
|
/**
|
|
5
5
|
* Input validation schema
|
|
6
6
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createGetDocumentStatusRoute } from
|
|
2
|
-
export { taskToJobStatusOutput } from
|
|
1
|
+
export { createGetDocumentStatusRoute } from "./route";
|
|
2
|
+
export { taskToJobStatusOutput } from "./model";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createRunRoute } from
|
|
1
|
+
export { createRunRoute } from "./route";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Payload } from "payload";
|
|
2
2
|
import type { Handler } from "../../shared";
|
|
3
|
-
import type { TranslationProvider } from "
|
|
4
|
-
import type {
|
|
3
|
+
import type { TranslationProvider } from "../../../core/translation-providers";
|
|
4
|
+
import type { ProvenanceStoreFactory } from "../../modules/provenance";
|
|
5
|
+
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
6
|
+
import type { TranslateDocumentInput, TranslateDocumentOutput } from "./model";
|
|
5
7
|
export type TranslateDocumentDependencies = {
|
|
6
8
|
translationProvider: TranslationProvider;
|
|
7
9
|
schemaMap: CollectionSchemaMap;
|
|
@@ -12,7 +14,8 @@ export type TranslateDocumentDependencies = {
|
|
|
12
14
|
export declare class TranslateDocumentHandler implements Handler<TranslateDocumentInput, TranslateDocumentOutput> {
|
|
13
15
|
private readonly translationProvider;
|
|
14
16
|
private readonly schemaMap;
|
|
15
|
-
|
|
17
|
+
private readonly provenanceStoreFactory?;
|
|
18
|
+
constructor(translationProvider: TranslationProvider, schemaMap: CollectionSchemaMap, provenanceStoreFactory?: ProvenanceStoreFactory);
|
|
16
19
|
handle(payload: Payload, input: TranslateDocumentInput): Promise<TranslateDocumentOutput>;
|
|
17
20
|
private saveTranslatedDocument;
|
|
18
21
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { APIError } from "payload";
|
|
2
|
-
import { translateContent } from "
|
|
2
|
+
import { translateContent } from "../../../core/translation-pipeline";
|
|
3
|
+
import { computeSourceFingerprint } from "../../../core/content-projection/computeSourceFingerprint";
|
|
3
4
|
/**
|
|
4
5
|
* Translates a single document from source language to target language
|
|
5
6
|
*/ export class TranslateDocumentHandler {
|
|
6
7
|
translationProvider;
|
|
7
8
|
schemaMap;
|
|
8
|
-
|
|
9
|
+
provenanceStoreFactory;
|
|
10
|
+
constructor(translationProvider, schemaMap, provenanceStoreFactory){
|
|
9
11
|
this.translationProvider = translationProvider;
|
|
10
12
|
this.schemaMap = schemaMap;
|
|
13
|
+
this.provenanceStoreFactory = provenanceStoreFactory;
|
|
11
14
|
}
|
|
12
15
|
async handle(payload, input) {
|
|
13
16
|
const { collection, collectionId, sourceLng, targetLng, strategy, publishOnTranslation } = input;
|
|
@@ -41,6 +44,29 @@ import { translateContent } from "../../modules/translation-pipeline";
|
|
|
41
44
|
};
|
|
42
45
|
const collectionConfig = payload.collections[collection].config;
|
|
43
46
|
await this.saveTranslatedDocument(payload, collection, collectionId, translatedData, targetLng, sourceLng, collectionConfig, publishOnTranslation);
|
|
47
|
+
if (this.provenanceStoreFactory) {
|
|
48
|
+
const store = this.provenanceStoreFactory(payload);
|
|
49
|
+
try {
|
|
50
|
+
await store.upsert({
|
|
51
|
+
collectionSlug: collection,
|
|
52
|
+
documentId: String(collectionId),
|
|
53
|
+
targetLocale: targetLng,
|
|
54
|
+
sourceLocale: sourceLng,
|
|
55
|
+
sourceFingerprint: computeSourceFingerprint(sourceData, schema),
|
|
56
|
+
translatedAt: new Date().toISOString(),
|
|
57
|
+
dismissedFingerprint: null
|
|
58
|
+
});
|
|
59
|
+
} catch (error) {
|
|
60
|
+
payload.logger.error({
|
|
61
|
+
err: error,
|
|
62
|
+
collection,
|
|
63
|
+
documentId: String(collectionId),
|
|
64
|
+
targetLocale: targetLng,
|
|
65
|
+
sourceLocale: sourceLng,
|
|
66
|
+
msg: "translator: failed to record translation provenance"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
44
70
|
return {
|
|
45
71
|
success: true
|
|
46
72
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TranslateDocumentHandler } from "./handler";
|
|
2
|
-
export type { CollectionSchemaMap } from "
|
|
2
|
+
export type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CollectionSlug
|
|
1
|
+
import type { CollectionSlug } from "payload";
|
|
2
2
|
import type { ID } from "../../modules/task-runner/types";
|
|
3
|
-
import type { TranslationStrategyName } from "
|
|
3
|
+
import type { TranslationStrategyName } from "../../../core/translation-pipeline/strategies";
|
|
4
4
|
/**
|
|
5
5
|
* Input for the translate document handler
|
|
6
6
|
*/
|
|
@@ -18,8 +18,3 @@ export type TranslateDocumentInput = {
|
|
|
18
18
|
export type TranslateDocumentOutput = {
|
|
19
19
|
success: true;
|
|
20
20
|
};
|
|
21
|
-
/**
|
|
22
|
-
* Map of collection slug to original field schema.
|
|
23
|
-
* Used to access original schemas before Payload sanitization.
|
|
24
|
-
*/
|
|
25
|
-
export type CollectionSchemaMap = Map<CollectionSlug, Field[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getByPath, ServerResponse } from "../../shared";
|
|
2
|
-
import { translateContent } from "
|
|
2
|
+
import { translateContent } from "../../../core/translation-pipeline";
|
|
3
3
|
import { FieldTranslationInputSchema, MAX_FIELD_VALUE_BYTES } from "./model";
|
|
4
4
|
import { resolveFieldSubtree } from "./resolveFieldSubtree";
|
|
5
5
|
const byteLength = (value)=>new TextEncoder().encode(JSON.stringify(value) ?? "").length;
|
|
@@ -3,4 +3,5 @@ export type { CreateFieldRouteArgs } from "./route";
|
|
|
3
3
|
export { TranslateFieldHandler } from "./handler";
|
|
4
4
|
export { resolveFieldSubtree } from "./resolveFieldSubtree";
|
|
5
5
|
export type { FieldSubtreeResolution } from "./resolveFieldSubtree";
|
|
6
|
-
export type { FieldTranslationConfig, FieldTranslationInput
|
|
6
|
+
export type { FieldTranslationConfig, FieldTranslationInput } from "./model";
|
|
7
|
+
export type { FieldTranslationNotice, FieldTranslationResult, } from "../../../types/wire/field-translation";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { CollectionSchemaMap } from "
|
|
3
|
-
import type { TranslationProvider } from "
|
|
2
|
+
import type { CollectionSchemaMap } from "../../../types/CollectionSchemaMap";
|
|
3
|
+
import type { TranslationProvider } from "../../../core/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
|
|
@@ -43,20 +43,3 @@ export type FieldTranslationConfig = {
|
|
|
43
43
|
schemaMap: CollectionSchemaMap;
|
|
44
44
|
translationProvider: TranslationProvider;
|
|
45
45
|
};
|
|
46
|
-
export type FieldTranslationNotice = {
|
|
47
|
-
level: "info" | "warning";
|
|
48
|
-
message: string;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Successful response. Never an error for "couldn't translate": a field with no
|
|
52
|
-
* localized content (or a path our resolver can't handle yet) is a `noop` with a
|
|
53
|
-
* calm notice, not an HTTP error.
|
|
54
|
-
*/
|
|
55
|
-
export type FieldTranslationResult = {
|
|
56
|
-
status: "translated";
|
|
57
|
-
value: unknown;
|
|
58
|
-
} | {
|
|
59
|
-
status: "noop";
|
|
60
|
-
value: unknown;
|
|
61
|
-
notice: FieldTranslationNotice;
|
|
62
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isTranslatableField } from "../../shared";
|
|
2
|
-
import { findFieldByPath } from "
|
|
2
|
+
import { findFieldByPath } from "../../../core/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
|
|
@@ -9,4 +9,4 @@ export type CreateFieldRouteArgs = FieldTranslationConfig & {
|
|
|
9
9
|
* Creates the synchronous field-translation endpoint: `POST {basePath}/field`.
|
|
10
10
|
* Wired with the same access + error-envelope plumbing as the document routes.
|
|
11
11
|
*/
|
|
12
|
-
export declare function createFieldRoute({ schemaMap, translationProvider, access, basePath }: CreateFieldRouteArgs): Endpoint;
|
|
12
|
+
export declare function createFieldRoute({ schemaMap, translationProvider, access, basePath, }: CreateFieldRouteArgs): Endpoint;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./features";
|
|
2
|
+
export * from "./modules";
|
|
3
|
+
export * from "./shared";
|
package/dist/server/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "../../core/translation-providers";
|
|
2
|
+
export * from "../../core/translation-pipeline";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TranslationLifecycleCallbacks, TranslationTask } from "./types";
|
|
2
|
+
/** Minimal logger surface used for swallowed callback errors (Payload's `payload.logger` satisfies it). */
|
|
3
|
+
type LifecycleLogger = {
|
|
4
|
+
error: (obj: unknown) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Fires the host's translation lifecycle callbacks, best-effort. Each callback is invoked in a
|
|
8
|
+
* try/catch (covering both synchronous throws and rejected promises); a failure is logged and
|
|
9
|
+
* swallowed, never propagated — a broken host callback must not fail the translation. Absent
|
|
10
|
+
* callbacks are a no-op.
|
|
11
|
+
*/
|
|
12
|
+
export declare class LifecycleNotifier {
|
|
13
|
+
private readonly callbacks;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
constructor(callbacks: TranslationLifecycleCallbacks, logger: LifecycleLogger);
|
|
16
|
+
queued(task: TranslationTask): Promise<void>;
|
|
17
|
+
completed(task: TranslationTask): Promise<void>;
|
|
18
|
+
failed(task: TranslationTask, error: unknown): Promise<void>;
|
|
19
|
+
private safe;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fires the host's translation lifecycle callbacks, best-effort. Each callback is invoked in a
|
|
3
|
+
* try/catch (covering both synchronous throws and rejected promises); a failure is logged and
|
|
4
|
+
* swallowed, never propagated — a broken host callback must not fail the translation. Absent
|
|
5
|
+
* callbacks are a no-op.
|
|
6
|
+
*/ export class LifecycleNotifier {
|
|
7
|
+
callbacks;
|
|
8
|
+
logger;
|
|
9
|
+
constructor(callbacks, logger){
|
|
10
|
+
this.callbacks = callbacks;
|
|
11
|
+
this.logger = logger;
|
|
12
|
+
}
|
|
13
|
+
queued(task) {
|
|
14
|
+
const callback = this.callbacks.onQueued;
|
|
15
|
+
return this.safe("lifecycle.onQueued", callback && (()=>callback(task)));
|
|
16
|
+
}
|
|
17
|
+
completed(task) {
|
|
18
|
+
const callback = this.callbacks.onCompleted;
|
|
19
|
+
return this.safe("lifecycle.onCompleted", callback && (()=>callback(task)));
|
|
20
|
+
}
|
|
21
|
+
failed(task, error) {
|
|
22
|
+
const callback = this.callbacks.onFailed;
|
|
23
|
+
return this.safe("lifecycle.onFailed", callback && (()=>callback(task, error)));
|
|
24
|
+
}
|
|
25
|
+
async safe(name, thunk) {
|
|
26
|
+
if (!thunk) return;
|
|
27
|
+
try {
|
|
28
|
+
await thunk();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
this.logger.error({
|
|
31
|
+
err: error,
|
|
32
|
+
msg: `translator: ${name} callback threw`
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=LifecycleNotifier.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { LifecycleNotifier } from "./LifecycleNotifier";
|
|
2
|
+
export { withQueuedNotification } from "./withQueuedNotification";
|
|
3
|
+
export { taskFromHandlerInput, taskFromInput } from "./taskMapping";
|
|
4
|
+
export type { TranslationLifecycleCallbacks, TranslationTask } from "./types";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Translation lifecycle callbacks — always-on host hooks fired around the runner (not gated by the
|
|
2
|
+
// provenance opt-in, no schema/migration).
|
|
3
|
+
export { LifecycleNotifier } from "./LifecycleNotifier";
|
|
4
|
+
export { withQueuedNotification } from "./withQueuedNotification";
|
|
5
|
+
export { taskFromHandlerInput, taskFromInput } from "./taskMapping";
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaskInput } from "../task-runner/types";
|
|
2
|
+
import type { TaskHandlerInput } from "../task-runner/TaskRunnerProvider.interface";
|
|
3
|
+
import type { TranslationTask } from "./types";
|
|
4
|
+
/** Map an enqueue-side {@link TaskInput} to the public {@link TranslationTask}. */
|
|
5
|
+
export declare const taskFromInput: (task: TaskInput) => TranslationTask;
|
|
6
|
+
/** Map an execution-side {@link TaskHandlerInput} to the public {@link TranslationTask}. */
|
|
7
|
+
export declare const taskFromHandlerInput: (input: TaskHandlerInput) => TranslationTask;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Map an enqueue-side {@link TaskInput} to the public {@link TranslationTask}. */ export const taskFromInput = (task)=>({
|
|
2
|
+
collection: task.collectionSlug,
|
|
3
|
+
id: task.collectionId,
|
|
4
|
+
sourceLng: task.sourceLng,
|
|
5
|
+
targetLng: task.targetLng,
|
|
6
|
+
strategy: task.strategy
|
|
7
|
+
});
|
|
8
|
+
/** Map an execution-side {@link TaskHandlerInput} to the public {@link TranslationTask}. */ export const taskFromHandlerInput = (input)=>({
|
|
9
|
+
collection: input.collection,
|
|
10
|
+
id: input.collectionId,
|
|
11
|
+
sourceLng: input.sourceLng,
|
|
12
|
+
targetLng: input.targetLng,
|
|
13
|
+
strategy: input.strategy
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=taskMapping.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Descriptor passed to the lifecycle callbacks — a stable, framework-neutral view of one translation
|
|
3
|
+
* task. Mirrors the fields the runner already threads through; `publishOnTranslation` is intentionally
|
|
4
|
+
* omitted (an internal write concern, not lifecycle-relevant). `id` is a string: the plugin is
|
|
5
|
+
* ID-agnostic and normalizes every document id to a string at ingress.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.7.0
|
|
8
|
+
*/
|
|
9
|
+
export type TranslationTask = {
|
|
10
|
+
collection: string;
|
|
11
|
+
id: string;
|
|
12
|
+
sourceLng: string;
|
|
13
|
+
targetLng: string;
|
|
14
|
+
/**
|
|
15
|
+
* The resolution strategy for the task. Deliberately widened to `string` (not the internal
|
|
16
|
+
* `"overwrite" | "skip_existing"` union) so adding a strategy is not a breaking change to this
|
|
17
|
+
* public type; host callbacks should treat unknown values gracefully.
|
|
18
|
+
*/
|
|
19
|
+
strategy: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Optional server-side hooks the host can supply to react to translation lifecycle events, passed as
|
|
23
|
+
* the plugin's `lifecycle` config object. Always available (no schema, no migration) and independent
|
|
24
|
+
* of the `provenance` opt-in. A throwing callback never fails the translation — it is caught and
|
|
25
|
+
* logged (see {@link LifecycleNotifier}).
|
|
26
|
+
*
|
|
27
|
+
* `onCompleted` / `onFailed` fire per **execution attempt**: the Payload Jobs runner may retry a
|
|
28
|
+
* failed task, so a task that fails then succeeds fires `onFailed` on each failed attempt and
|
|
29
|
+
* `onCompleted` on the one that succeeds. `onQueued` fires once, when the task is enqueued.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.7.0
|
|
32
|
+
*/
|
|
33
|
+
export type TranslationLifecycleCallbacks = {
|
|
34
|
+
/**
|
|
35
|
+
* Fired for each task as it is queued. Best-effort: emitted just before the task is handed to the
|
|
36
|
+
* runner, so if enqueueing then throws it may fire for a task that never actually queued.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.7.0
|
|
39
|
+
*/
|
|
40
|
+
onQueued?: (task: TranslationTask) => void | Promise<void>;
|
|
41
|
+
/** Fired after a task completes without error. @since 0.7.0 */
|
|
42
|
+
onCompleted?: (task: TranslationTask) => void | Promise<void>;
|
|
43
|
+
/** Fired when a task's translation throws, with the error. @since 0.7.0 */
|
|
44
|
+
onFailed?: (task: TranslationTask, error: unknown) => void | Promise<void>;
|
|
45
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Descriptor passed to the lifecycle callbacks — a stable, framework-neutral view of one translation
|
|
3
|
+
* task. Mirrors the fields the runner already threads through; `publishOnTranslation` is intentionally
|
|
4
|
+
* omitted (an internal write concern, not lifecycle-relevant). `id` is a string: the plugin is
|
|
5
|
+
* ID-agnostic and normalizes every document id to a string at ingress.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.7.0
|
|
8
|
+
*/ /**
|
|
9
|
+
* Optional server-side hooks the host can supply to react to translation lifecycle events, passed as
|
|
10
|
+
* the plugin's `lifecycle` config object. Always available (no schema, no migration) and independent
|
|
11
|
+
* of the `provenance` opt-in. A throwing callback never fails the translation — it is caught and
|
|
12
|
+
* logged (see {@link LifecycleNotifier}).
|
|
13
|
+
*
|
|
14
|
+
* `onCompleted` / `onFailed` fire per **execution attempt**: the Payload Jobs runner may retry a
|
|
15
|
+
* failed task, so a task that fails then succeeds fires `onFailed` on each failed attempt and
|
|
16
|
+
* `onCompleted` on the one that succeeds. `onQueued` fires once, when the task is enqueued.
|
|
17
|
+
*
|
|
18
|
+
* @since 0.7.0
|
|
19
|
+
*/ export { };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TaskRunner } from "../task-runner/TaskRunner.interface";
|
|
2
|
+
import type { LifecycleNotifier } from "./LifecycleNotifier";
|
|
3
|
+
/**
|
|
4
|
+
* Decorate a {@link TaskRunner} so `enqueue` fires the `queued` lifecycle callback for each task.
|
|
5
|
+
* Fired BEFORE delegating: a synchronous runner (the sync runner) may execute a task inline during
|
|
6
|
+
* `enqueue` and fire `completed`, so emitting `queued` first preserves the queued → completed order.
|
|
7
|
+
* All other methods delegate unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withQueuedNotification(runner: TaskRunner, notifier: LifecycleNotifier): TaskRunner;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { taskFromInput } from "./taskMapping";
|
|
2
|
+
/**
|
|
3
|
+
* Decorate a {@link TaskRunner} so `enqueue` fires the `queued` lifecycle callback for each task.
|
|
4
|
+
* Fired BEFORE delegating: a synchronous runner (the sync runner) may execute a task inline during
|
|
5
|
+
* `enqueue` and fire `completed`, so emitting `queued` first preserves the queued → completed order.
|
|
6
|
+
* All other methods delegate unchanged.
|
|
7
|
+
*/ export function withQueuedNotification(runner, notifier) {
|
|
8
|
+
return {
|
|
9
|
+
async enqueue (tasks) {
|
|
10
|
+
await Promise.all(tasks.map((task)=>notifier.queued(taskFromInput(task))));
|
|
11
|
+
await runner.enqueue(tasks);
|
|
12
|
+
},
|
|
13
|
+
cancel: (taskIds)=>runner.cancel(taskIds),
|
|
14
|
+
run: (taskId)=>runner.run(taskId),
|
|
15
|
+
findByCollection: (collectionSlug, documentIds)=>runner.findByCollection(collectionSlug, documentIds)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=withQueuedNotification.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Payload } from "payload";
|
|
2
|
+
import type { ProvenanceKey, ProvenanceStore, TranslationProvenanceRecord } from "../../../core/provenance";
|
|
3
|
+
/** Builds a provenance store bound to a Payload instance; absent when provenance is disabled. */
|
|
4
|
+
export type ProvenanceStoreFactory = (payload: Payload) => ProvenanceStore;
|
|
5
|
+
/**
|
|
6
|
+
* Payload-backed {@link ProvenanceStore}. All Payload coupling for provenance lives here; the core
|
|
7
|
+
* knows only the port. Records are keyed by `(collectionSlug, documentId, targetLocale)`; `upsert`
|
|
8
|
+
* matches on that key so a re-translation updates the row in place instead of duplicating it.
|
|
9
|
+
*
|
|
10
|
+
* The sidecar holds custom fields that no generated collection type describes, so the slug is cast to
|
|
11
|
+
* `CollectionSlug` once; the record shape is guaranteed by {@link makeProvenanceCollection}.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PayloadProvenanceStore implements ProvenanceStore {
|
|
14
|
+
private readonly payload;
|
|
15
|
+
private readonly collection;
|
|
16
|
+
constructor(payload: Payload, slug: string);
|
|
17
|
+
upsert(record: TranslationProvenanceRecord): Promise<void>;
|
|
18
|
+
find(key: ProvenanceKey): Promise<TranslationProvenanceRecord | null>;
|
|
19
|
+
deleteByDocument(collectionSlug: string, documentId: string): Promise<void>;
|
|
20
|
+
private findDoc;
|
|
21
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
function keyWhere(key) {
|
|
2
|
+
return {
|
|
3
|
+
and: [
|
|
4
|
+
{
|
|
5
|
+
collectionSlug: {
|
|
6
|
+
equals: key.collectionSlug
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
documentId: {
|
|
11
|
+
equals: key.documentId
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
targetLocale: {
|
|
16
|
+
equals: key.targetLocale
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function toRecord(doc) {
|
|
23
|
+
return {
|
|
24
|
+
collectionSlug: String(doc.collectionSlug),
|
|
25
|
+
documentId: String(doc.documentId),
|
|
26
|
+
targetLocale: String(doc.targetLocale),
|
|
27
|
+
sourceLocale: String(doc.sourceLocale),
|
|
28
|
+
sourceFingerprint: String(doc.sourceFingerprint),
|
|
29
|
+
// `translatedAt` is backed by a `date` field, which Payload may hand back as a Date; normalize to
|
|
30
|
+
// ISO-8601 so the stored contract holds and #50's fingerprint comparison stays format-stable.
|
|
31
|
+
translatedAt: new Date(doc.translatedAt).toISOString(),
|
|
32
|
+
dismissedFingerprint: doc.dismissedFingerprint == null ? null : String(doc.dismissedFingerprint)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Payload-backed {@link ProvenanceStore}. All Payload coupling for provenance lives here; the core
|
|
37
|
+
* knows only the port. Records are keyed by `(collectionSlug, documentId, targetLocale)`; `upsert`
|
|
38
|
+
* matches on that key so a re-translation updates the row in place instead of duplicating it.
|
|
39
|
+
*
|
|
40
|
+
* The sidecar holds custom fields that no generated collection type describes, so the slug is cast to
|
|
41
|
+
* `CollectionSlug` once; the record shape is guaranteed by {@link makeProvenanceCollection}.
|
|
42
|
+
*/ export class PayloadProvenanceStore {
|
|
43
|
+
payload;
|
|
44
|
+
collection;
|
|
45
|
+
constructor(payload, slug){
|
|
46
|
+
this.payload = payload;
|
|
47
|
+
this.collection = slug;
|
|
48
|
+
}
|
|
49
|
+
async upsert(record) {
|
|
50
|
+
const existing = await this.findDoc(record);
|
|
51
|
+
if (existing === null) {
|
|
52
|
+
try {
|
|
53
|
+
await this.payload.create({
|
|
54
|
+
collection: this.collection,
|
|
55
|
+
data: record
|
|
56
|
+
});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
const raceWinner = await this.findDoc(record);
|
|
59
|
+
if (raceWinner === null) throw error;
|
|
60
|
+
await this.payload.update({
|
|
61
|
+
collection: this.collection,
|
|
62
|
+
id: raceWinner.id,
|
|
63
|
+
data: record
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
await this.payload.update({
|
|
68
|
+
collection: this.collection,
|
|
69
|
+
id: existing.id,
|
|
70
|
+
data: record
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async find(key) {
|
|
75
|
+
const doc = await this.findDoc(key);
|
|
76
|
+
return doc === null ? null : toRecord(doc);
|
|
77
|
+
}
|
|
78
|
+
async deleteByDocument(collectionSlug, documentId) {
|
|
79
|
+
await this.payload.delete({
|
|
80
|
+
collection: this.collection,
|
|
81
|
+
where: {
|
|
82
|
+
and: [
|
|
83
|
+
{
|
|
84
|
+
collectionSlug: {
|
|
85
|
+
equals: collectionSlug
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
documentId: {
|
|
90
|
+
equals: documentId
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async findDoc(key) {
|
|
98
|
+
const result = await this.payload.find({
|
|
99
|
+
collection: this.collection,
|
|
100
|
+
where: keyWhere(key),
|
|
101
|
+
limit: 1,
|
|
102
|
+
depth: 0,
|
|
103
|
+
pagination: false
|
|
104
|
+
});
|
|
105
|
+
return result.docs[0] ?? null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=PayloadProvenanceStore.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DEFAULT_PROVENANCE_SLUG, isProvenanceCollection, makeProvenanceCollection, } from "./provenanceCollection";
|
|
2
|
+
export { PayloadProvenanceStore } from "./PayloadProvenanceStore";
|
|
3
|
+
export type { ProvenanceStoreFactory } from "./PayloadProvenanceStore";
|
|
4
|
+
export { injectProvenanceCleanup, makeProvenanceCleanupHook } from "./provenanceCleanupHook";
|
|
5
|
+
export { assertProvenanceSlugFree } from "./slugGuard";
|
|
@@ -0,0 +1,8 @@
|
|
|
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.
|
|
3
|
+
export { DEFAULT_PROVENANCE_SLUG, isProvenanceCollection, makeProvenanceCollection } from "./provenanceCollection";
|
|
4
|
+
export { PayloadProvenanceStore } from "./PayloadProvenanceStore";
|
|
5
|
+
export { injectProvenanceCleanup, makeProvenanceCleanupHook } from "./provenanceCleanupHook";
|
|
6
|
+
export { assertProvenanceSlugFree } from "./slugGuard";
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=index.js.map
|