@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
package/README.md
CHANGED
|
@@ -141,6 +141,8 @@ Allowed on **`text`, `textarea`, and `richText`** fields (a compile error on oth
|
|
|
141
141
|
| `access` | `AccessGuard` | No | `undefined` | Access guard (`{ check }`) for the translation endpoints; omit to leave them open. |
|
|
142
142
|
| `basePath` | `string` | No | `'/translate'` | Base path for the plugin's API endpoints. |
|
|
143
143
|
| `levels` | `TranslationLevel[]` | No | `[documentLevel(), collectionLevel()]` | Which surfaces to enable — see [Translation surfaces](#translation-surfaces-levels). |
|
|
144
|
+
| `provenance` | `boolean \| { slug?: string }` | No | `false` (disabled) | Opt in to recording a provenance record per translation. _Since v0.7.0._ See [Provenance](#provenance-opt-in) below. |
|
|
145
|
+
| `lifecycle` | `{ onQueued?, onCompleted?, onFailed? }` | No | `undefined` | Server-side callbacks fired around each task. _Since v0.7.0._ See [Lifecycle callbacks](#lifecycle-callbacks). |
|
|
144
146
|
|
|
145
147
|
```typescript
|
|
146
148
|
translatorPlugin({
|
|
@@ -151,6 +153,59 @@ translatorPlugin({
|
|
|
151
153
|
});
|
|
152
154
|
```
|
|
153
155
|
|
|
156
|
+
### Provenance (opt-in)
|
|
157
|
+
|
|
158
|
+
_Since v0.7.0._
|
|
159
|
+
|
|
160
|
+
Set `provenance: true` (or `{}`) to record, after each successful translation, a durable per-locale
|
|
161
|
+
provenance entry — what source state a translation was derived from. Use `{ slug }` to customise the
|
|
162
|
+
sidecar collection's slug (default `'translator-provenance'`), e.g. to resolve a name collision with
|
|
163
|
+
one of your own collections. Omit (or set `false`) to leave everything as-is: no collection, no
|
|
164
|
+
migration, no behavior change.
|
|
165
|
+
|
|
166
|
+
Enabling it adds a plugin-managed, hidden sidecar collection to your config. **On a SQL database
|
|
167
|
+
(Postgres/SQLite) this requires a migration** — run `payload migrate:create` then `payload migrate`
|
|
168
|
+
(or let dev push apply it in development). MongoDB infers the collection with no migration step.
|
|
169
|
+
|
|
170
|
+
When a translated document is deleted, its provenance rows are cleaned up automatically (across all
|
|
171
|
+
locales). The cleanup is best-effort — a failure is logged and never blocks the delete. The exported
|
|
172
|
+
`TranslationProvenanceRecord` type describes a stored row if you query the sidecar collection directly.
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
translatorPlugin({
|
|
176
|
+
collections: [Posts, Pages],
|
|
177
|
+
translationProvider: createOpenAIProvider({ apiKey: process.env.OPENAI_API_KEY }),
|
|
178
|
+
runner: createPayloadJobsRunner(),
|
|
179
|
+
provenance: true, // or { slug: "my-provenance" }
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Lifecycle callbacks
|
|
184
|
+
|
|
185
|
+
_Since v0.7.0._
|
|
186
|
+
|
|
187
|
+
Optional server-side hooks fired around each translation task — for logging, notifications, cache
|
|
188
|
+
invalidation, or feeding a dashboard. They need no schema or migration and are independent of the
|
|
189
|
+
`provenance` opt-in. Each receives a `TranslationTask` descriptor
|
|
190
|
+
(`{ collection, id, sourceLng, targetLng, strategy }`); `onFailed` also receives the error.
|
|
191
|
+
|
|
192
|
+
A callback that throws is caught and logged — it never fails the translation. `onCompleted` /
|
|
193
|
+
`onFailed` fire per execution attempt (the Payload Jobs runner may retry a failed task); `onQueued`
|
|
194
|
+
fires once at enqueue.
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
translatorPlugin({
|
|
198
|
+
collections: [Posts, Pages],
|
|
199
|
+
translationProvider: createOpenAIProvider({ apiKey: process.env.OPENAI_API_KEY }),
|
|
200
|
+
runner: createPayloadJobsRunner(),
|
|
201
|
+
lifecycle: {
|
|
202
|
+
onQueued: (task) => console.log("queued", task),
|
|
203
|
+
onCompleted: (task) => console.log("done", task),
|
|
204
|
+
onFailed: (task, error) => console.error("failed", task, error),
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
154
209
|
### Providers
|
|
155
210
|
|
|
156
211
|
#### OpenAI (built in) — `createOpenAIProvider(config)`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RawPayloadComponentExport } from
|
|
1
|
+
import type { RawPayloadComponentExport } from "../../../types/PayloadComponentExport";
|
|
2
2
|
export declare class CacheProviderExport implements RawPayloadComponentExport {
|
|
3
3
|
path: string;
|
|
4
4
|
serverProps?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { clientComponentPath } from
|
|
1
|
+
import { clientComponentPath } from "../../shared/utils/componentPath";
|
|
2
2
|
export class CacheProviderExport {
|
|
3
|
-
path = clientComponentPath(
|
|
3
|
+
path = clientComponentPath("app/cache/CacheProvider");
|
|
4
4
|
serverProps;
|
|
5
5
|
constructor(basePath){
|
|
6
6
|
this.serverProps = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { QueryClientProvider } from
|
|
4
|
-
import { CacheClientProviderFactory } from
|
|
5
|
-
import { TranslateKitConfigProvider } from
|
|
6
|
-
const queryClient = new CacheClientProviderFactory().create(
|
|
3
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
import { CacheClientProviderFactory } from "../../shared/providers/CacheClientProvider";
|
|
5
|
+
import { TranslateKitConfigProvider } from "../config";
|
|
6
|
+
const queryClient = new CacheClientProviderFactory().create("client");
|
|
7
7
|
export function CacheProvider({ basePath, children }) {
|
|
8
8
|
return /*#__PURE__*/ _jsx(TranslateKitConfigProvider, {
|
|
9
9
|
basePath: basePath,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useMemo } from
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
4
|
const defaultConfig = {
|
|
5
|
-
basePath:
|
|
5
|
+
basePath: "/translate"
|
|
6
6
|
};
|
|
7
7
|
const TranslateKitConfigContext = /*#__PURE__*/ createContext(defaultConfig);
|
|
8
8
|
export function TranslateKitConfigProvider({ basePath = defaultConfig.basePath, children }) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TranslateKitConfigProvider, useTranslateKitConfig } from
|
|
2
|
-
export type { TranslateKitConfigProviderProps } from
|
|
1
|
+
export { TranslateKitConfigProvider, useTranslateKitConfig } from "./TranslateKitConfigContext";
|
|
2
|
+
export type { TranslateKitConfigProviderProps } from "./TranslateKitConfigContext";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useTranslateKitConfig } from
|
|
4
|
-
import { handleNextApiError } from
|
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
4
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
5
5
|
export function useCancelCollectionTranslations() {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
const { basePath } = useTranslateKitConfig();
|
|
8
8
|
return useMutation({
|
|
9
9
|
mutationKey: [
|
|
10
|
-
|
|
10
|
+
"cancel-collection-translations"
|
|
11
11
|
],
|
|
12
12
|
mutationFn: async (variables)=>{
|
|
13
13
|
await handleNextApiError(()=>ofetch(`/api${basePath}/cancel-by-collection/${variables.collection}`, {
|
|
14
|
-
method:
|
|
14
|
+
method: "delete"
|
|
15
15
|
}));
|
|
16
16
|
},
|
|
17
17
|
onSuccess: ()=>{
|
|
18
18
|
queryClient.invalidateQueries({
|
|
19
19
|
queryKey: [
|
|
20
|
-
|
|
20
|
+
"collection-translation-status"
|
|
21
21
|
]
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useTranslateKitConfig } from
|
|
4
|
-
import { handleNextApiError } from
|
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
4
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
5
5
|
export function useCancelDocumentTranslation() {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
const { basePath } = useTranslateKitConfig();
|
|
8
8
|
return useMutation({
|
|
9
9
|
mutationKey: [
|
|
10
|
-
|
|
10
|
+
"cancel-document-translation"
|
|
11
11
|
],
|
|
12
12
|
mutationFn: async (variables)=>{
|
|
13
13
|
await handleNextApiError(()=>{
|
|
14
14
|
return ofetch(`/api${basePath}/cancel`, {
|
|
15
|
-
method:
|
|
15
|
+
method: "delete",
|
|
16
16
|
body: {
|
|
17
17
|
ids: [
|
|
18
18
|
variables.id
|
|
@@ -24,7 +24,7 @@ export function useCancelDocumentTranslation() {
|
|
|
24
24
|
onSuccess: ()=>{
|
|
25
25
|
queryClient.invalidateQueries({
|
|
26
26
|
queryKey: [
|
|
27
|
-
|
|
27
|
+
"document-translation-status"
|
|
28
28
|
]
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useTranslateKitConfig } from
|
|
4
|
-
import { handleNextApiError } from
|
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
4
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
5
5
|
export function useQueueDocumentTranslation() {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
const { basePath } = useTranslateKitConfig();
|
|
8
8
|
return useMutation({
|
|
9
9
|
mutationKey: [
|
|
10
|
-
|
|
10
|
+
"queue-document-translation"
|
|
11
11
|
],
|
|
12
12
|
mutationFn: async (variables)=>{
|
|
13
13
|
await handleNextApiError(()=>ofetch(`/api${basePath}/enqueue`, {
|
|
14
|
-
method:
|
|
14
|
+
method: "post",
|
|
15
15
|
body: variables
|
|
16
16
|
}));
|
|
17
17
|
},
|
|
18
18
|
onSuccess: ()=>{
|
|
19
19
|
queryClient.invalidateQueries({
|
|
20
20
|
queryKey: [
|
|
21
|
-
|
|
21
|
+
"document-translation-status"
|
|
22
22
|
]
|
|
23
23
|
});
|
|
24
24
|
queryClient.invalidateQueries({
|
|
25
25
|
queryKey: [
|
|
26
|
-
|
|
26
|
+
"collection-translation-status"
|
|
27
27
|
]
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useMutation } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useTranslateKitConfig } from
|
|
4
|
-
import { handleNextApiError } from
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
4
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
5
5
|
export function useQueueDocumentTranslations() {
|
|
6
6
|
const { basePath } = useTranslateKitConfig();
|
|
7
7
|
return useMutation({
|
|
8
8
|
mutationKey: [
|
|
9
|
-
|
|
9
|
+
"queue-document-translations"
|
|
10
10
|
],
|
|
11
11
|
mutationFn: async (variables)=>{
|
|
12
12
|
await handleNextApiError(()=>ofetch(`/api${basePath}/enqueue-many`, {
|
|
13
|
-
method:
|
|
13
|
+
method: "post",
|
|
14
14
|
body: variables
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useTranslateKitConfig } from
|
|
4
|
-
import { handleNextApiError } from
|
|
1
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
4
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
5
5
|
export function useRunDocumentTranslation() {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
const { basePath } = useTranslateKitConfig();
|
|
8
8
|
return useMutation({
|
|
9
9
|
mutationKey: [
|
|
10
|
-
|
|
10
|
+
"run-document-translation"
|
|
11
11
|
],
|
|
12
12
|
mutationFn: async (variables)=>{
|
|
13
13
|
await handleNextApiError(()=>ofetch(`/api${basePath}/run/${variables.id}`, {
|
|
14
|
-
method:
|
|
14
|
+
method: "post"
|
|
15
15
|
}));
|
|
16
16
|
},
|
|
17
17
|
onSuccess: ()=>{
|
|
18
18
|
queryClient.invalidateQueries({
|
|
19
19
|
queryKey: [
|
|
20
|
-
|
|
20
|
+
"document-translation-status"
|
|
21
21
|
]
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CollectionSlug } from
|
|
2
|
-
import type { GroupedCollectionTranslationStatus } from
|
|
1
|
+
import type { CollectionSlug } from "payload";
|
|
2
|
+
import type { GroupedCollectionTranslationStatus } from "../../model/types";
|
|
3
3
|
type Props = {
|
|
4
4
|
collection: CollectionSlug;
|
|
5
5
|
};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { useQuery, useQueryClient } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useCallback } from
|
|
4
|
-
import { useTranslateKitConfig } from
|
|
5
|
-
import { handleNextApiError } from
|
|
6
|
-
import { DocumentTranslationStatus } from
|
|
1
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
5
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
6
|
+
import { DocumentTranslationStatus } from "../../model/enums";
|
|
7
7
|
const getCollectionTranslationQueryKey = ({ collection })=>{
|
|
8
8
|
return [
|
|
9
|
-
|
|
9
|
+
"collection-translation-status",
|
|
10
10
|
collection
|
|
11
11
|
];
|
|
12
12
|
};
|
|
13
|
-
const POLLING_INTERVAL_MILLISECONDS = 20000 // 20 sec
|
|
14
|
-
;
|
|
13
|
+
const POLLING_INTERVAL_MILLISECONDS = 20000; // 20 sec
|
|
15
14
|
export function useCollectionTranslationStatus({ collection }, options) {
|
|
16
15
|
const queryClient = useQueryClient();
|
|
17
16
|
const { basePath } = useTranslateKitConfig();
|
|
@@ -22,7 +21,7 @@ export function useCollectionTranslationStatus({ collection }, options) {
|
|
|
22
21
|
queryFn: async ({ signal })=>{
|
|
23
22
|
return handleNextApiError(async ()=>{
|
|
24
23
|
const response = await ofetch(`/api${basePath}/collection/${collection}`, {
|
|
25
|
-
method:
|
|
24
|
+
method: "get",
|
|
26
25
|
signal
|
|
27
26
|
});
|
|
28
27
|
return response.data;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CollectionSlug } from
|
|
2
|
-
import type { DocumentTranslation } from
|
|
1
|
+
import type { CollectionSlug } from "payload";
|
|
2
|
+
import type { DocumentTranslation } from "../../model/types";
|
|
3
3
|
type Props = {
|
|
4
4
|
collection: CollectionSlug;
|
|
5
5
|
id: string;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { useQuery, useQueryClient } from
|
|
2
|
-
import { ofetch } from
|
|
3
|
-
import { useCallback } from
|
|
4
|
-
import { useTranslateKitConfig } from
|
|
5
|
-
import { handleNextApiError } from
|
|
1
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useTranslateKitConfig } from "../../../../app/config";
|
|
5
|
+
import { handleNextApiError } from "../../../../shared/lib/errors/handleApiError";
|
|
6
6
|
const getDocumentTranslationQueryKey = ({ collection, id })=>{
|
|
7
7
|
return [
|
|
8
|
-
|
|
8
|
+
"document-translation-status",
|
|
9
9
|
collection,
|
|
10
10
|
id
|
|
11
11
|
];
|
|
12
12
|
};
|
|
13
|
-
const POLLING_INTERVAL_MILLISECONDS = 20000 // 20 sec
|
|
14
|
-
;
|
|
13
|
+
const POLLING_INTERVAL_MILLISECONDS = 20000; // 20 sec
|
|
15
14
|
export function useDocumentTranslation({ collection, id }, options) {
|
|
16
15
|
const queryClient = useQueryClient();
|
|
17
16
|
const { basePath } = useTranslateKitConfig();
|
|
@@ -23,7 +22,7 @@ export function useDocumentTranslation({ collection, id }, options) {
|
|
|
23
22
|
queryFn: async ({ signal })=>{
|
|
24
23
|
return handleNextApiError(async ()=>{
|
|
25
24
|
const response = await ofetch(`/api${basePath}/document/${collection}/${id}`, {
|
|
26
|
-
method:
|
|
25
|
+
method: "get",
|
|
27
26
|
signal
|
|
28
27
|
});
|
|
29
28
|
return response.data;
|
|
@@ -31,7 +30,7 @@ export function useDocumentTranslation({ collection, id }, options) {
|
|
|
31
30
|
},
|
|
32
31
|
enabled: options?.enabled,
|
|
33
32
|
refetchInterval: (query)=>{
|
|
34
|
-
return query.state.data?.status ===
|
|
33
|
+
return query.state.data?.status === "failed" || query.state.data?.status === "completed" ? false : POLLING_INTERVAL_MILLISECONDS;
|
|
35
34
|
}
|
|
36
35
|
});
|
|
37
36
|
const invalidate = useCallback(()=>{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useCancelCollectionTranslations } from
|
|
2
|
-
import { useCancelDocumentTranslation } from
|
|
3
|
-
import { useQueueDocumentTranslation } from
|
|
4
|
-
import { useRunDocumentTranslation } from
|
|
5
|
-
import { useCollectionTranslationStatus } from
|
|
6
|
-
import { useDocumentTranslation } from
|
|
7
|
-
export { CompletedTranslationStatus } from
|
|
8
|
-
export { FailedTranslationStatus } from
|
|
9
|
-
export { RunningTranslationStatus } from
|
|
1
|
+
import { useCancelCollectionTranslations } from "./api/mutations/useCancelCollectionTranslations";
|
|
2
|
+
import { useCancelDocumentTranslation } from "./api/mutations/useCancelDocumentTranslation";
|
|
3
|
+
import { useQueueDocumentTranslation } from "./api/mutations/useQueueDocumentTranslation";
|
|
4
|
+
import { useRunDocumentTranslation } from "./api/mutations/useRunDocumentTranslation";
|
|
5
|
+
import { useCollectionTranslationStatus } from "./api/queries/useCollectionTranslationStatus";
|
|
6
|
+
import { useDocumentTranslation } from "./api/queries/useDocumentTranslation";
|
|
7
|
+
export { CompletedTranslationStatus } from "./ui/CompletedTranslationStatus";
|
|
8
|
+
export { FailedTranslationStatus } from "./ui/FailedTranslationStatus";
|
|
9
|
+
export { RunningTranslationStatus } from "./ui/RunningTranslationStatus";
|
|
10
10
|
export declare const TranslationsApi: {
|
|
11
11
|
useRunDocumentTranslation: typeof useRunDocumentTranslation;
|
|
12
12
|
useQueueDocumentTranslation: typeof useQueueDocumentTranslation;
|
|
@@ -15,6 +15,6 @@ export declare const TranslationsApi: {
|
|
|
15
15
|
useCollectionTranslationStatus: typeof useCollectionTranslationStatus;
|
|
16
16
|
useCancelCollectionTranslations: typeof useCancelCollectionTranslations;
|
|
17
17
|
};
|
|
18
|
-
export { PendingTranslationStatus } from
|
|
19
|
-
export type { DocumentTranslation, DocumentTranslationCompleted, DocumentTranslationFailed, DocumentTranslationPending, DocumentTranslationRunning, CollectionTranslationStatus, CollectionTranslationStatusItem, GroupedCollectionTranslationStatus, } from
|
|
20
|
-
export { DocumentTranslationStatus } from
|
|
18
|
+
export { PendingTranslationStatus } from "./ui/PendingTranslationStatus";
|
|
19
|
+
export type { DocumentTranslation, DocumentTranslationCompleted, DocumentTranslationFailed, DocumentTranslationPending, DocumentTranslationRunning, CollectionTranslationStatus, CollectionTranslationStatusItem, GroupedCollectionTranslationStatus, } from "./model/types";
|
|
20
|
+
export { DocumentTranslationStatus } from "./model/enums";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useCancelCollectionTranslations } from
|
|
2
|
-
import { useCancelDocumentTranslation } from
|
|
3
|
-
import { useQueueDocumentTranslation } from
|
|
4
|
-
import { useRunDocumentTranslation } from
|
|
5
|
-
import { useCollectionTranslationStatus } from
|
|
6
|
-
import { useDocumentTranslation } from
|
|
7
|
-
export { CompletedTranslationStatus } from
|
|
8
|
-
export { FailedTranslationStatus } from
|
|
9
|
-
export { RunningTranslationStatus } from
|
|
1
|
+
import { useCancelCollectionTranslations } from "./api/mutations/useCancelCollectionTranslations";
|
|
2
|
+
import { useCancelDocumentTranslation } from "./api/mutations/useCancelDocumentTranslation";
|
|
3
|
+
import { useQueueDocumentTranslation } from "./api/mutations/useQueueDocumentTranslation";
|
|
4
|
+
import { useRunDocumentTranslation } from "./api/mutations/useRunDocumentTranslation";
|
|
5
|
+
import { useCollectionTranslationStatus } from "./api/queries/useCollectionTranslationStatus";
|
|
6
|
+
import { useDocumentTranslation } from "./api/queries/useDocumentTranslation";
|
|
7
|
+
export { CompletedTranslationStatus } from "./ui/CompletedTranslationStatus";
|
|
8
|
+
export { FailedTranslationStatus } from "./ui/FailedTranslationStatus";
|
|
9
|
+
export { RunningTranslationStatus } from "./ui/RunningTranslationStatus";
|
|
10
10
|
export const TranslationsApi = {
|
|
11
11
|
useRunDocumentTranslation,
|
|
12
12
|
useQueueDocumentTranslation,
|
|
@@ -15,7 +15,7 @@ export const TranslationsApi = {
|
|
|
15
15
|
useCollectionTranslationStatus,
|
|
16
16
|
useCancelCollectionTranslations
|
|
17
17
|
};
|
|
18
|
-
export { PendingTranslationStatus } from
|
|
19
|
-
export { DocumentTranslationStatus } from
|
|
18
|
+
export { PendingTranslationStatus } from "./ui/PendingTranslationStatus";
|
|
19
|
+
export { DocumentTranslationStatus } from "./model/enums";
|
|
20
20
|
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
package/dist/client/entities/translation/ui/CompletedTranslationStatus/CompletedTranslationStatus.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { LanguageTranslateIcon } from
|
|
3
|
-
import Button from
|
|
4
|
-
import StatusIndicator from
|
|
5
|
-
import Tooltip from
|
|
6
|
-
import { TranslationDirection } from
|
|
7
|
-
import styles from
|
|
2
|
+
import { LanguageTranslateIcon } from "../../../../shared/lib/assets/icons/LanguageTranslateIcon";
|
|
3
|
+
import Button from "../../../../shared/ui/Button";
|
|
4
|
+
import StatusIndicator from "../../../../shared/ui/StatusIndicator";
|
|
5
|
+
import Tooltip from "../../../../shared/ui/Tooltip";
|
|
6
|
+
import { TranslationDirection } from "../TranslationDirection";
|
|
7
|
+
import styles from "./styles.module.scss";
|
|
8
8
|
export function CompletedTranslationStatus({ completed_at, sourceLocale, targetLocale }) {
|
|
9
9
|
return /*#__PURE__*/ _jsxs(StatusIndicator, {
|
|
10
10
|
className: styles.indicator,
|
|
@@ -18,13 +18,13 @@ export function CompletedTranslationStatus({ completed_at, sourceLocale, targetL
|
|
|
18
18
|
dateTime: completed_at,
|
|
19
19
|
children: [
|
|
20
20
|
"Completed at:",
|
|
21
|
-
|
|
21
|
+
" ",
|
|
22
22
|
new Date(completed_at).toLocaleString(undefined, {
|
|
23
|
-
year:
|
|
24
|
-
month:
|
|
25
|
-
day:
|
|
26
|
-
hour:
|
|
27
|
-
minute:
|
|
23
|
+
year: "numeric",
|
|
24
|
+
month: "short",
|
|
25
|
+
day: "numeric",
|
|
26
|
+
hour: "2-digit",
|
|
27
|
+
minute: "2-digit"
|
|
28
28
|
})
|
|
29
29
|
]
|
|
30
30
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CompletedTranslationStatus } from
|
|
1
|
+
export { CompletedTranslationStatus } from "./CompletedTranslationStatus";
|
package/dist/client/entities/translation/ui/FailedTranslationStatus/FailedTranslationStatus.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { LanguageTranslateIcon } from
|
|
3
|
-
import { ReloadIcon } from
|
|
4
|
-
import Button from
|
|
5
|
-
import Divider from
|
|
6
|
-
import StatusIndicator from
|
|
7
|
-
import Tooltip from
|
|
8
|
-
import { TranslationDirection } from
|
|
9
|
-
import styles from
|
|
2
|
+
import { LanguageTranslateIcon } from "../../../../shared/lib/assets/icons/LanguageTranslateIcon";
|
|
3
|
+
import { ReloadIcon } from "../../../../shared/lib/assets/icons/ReloadIcon";
|
|
4
|
+
import Button from "../../../../shared/ui/Button";
|
|
5
|
+
import Divider from "../../../../shared/ui/Divider";
|
|
6
|
+
import StatusIndicator from "../../../../shared/ui/StatusIndicator";
|
|
7
|
+
import Tooltip from "../../../../shared/ui/Tooltip";
|
|
8
|
+
import { TranslationDirection } from "../TranslationDirection";
|
|
9
|
+
import styles from "./styles.module.scss";
|
|
10
10
|
export function FailedTranslationStatus({ onRetry, message, isLoading, sourceLocale, targetLocale }) {
|
|
11
11
|
return /*#__PURE__*/ _jsxs(StatusIndicator, {
|
|
12
12
|
$color: "red",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FailedTranslationStatus } from
|
|
1
|
+
export { FailedTranslationStatus } from "./FailedTranslationStatus";
|