@focus-reactive/payload-plugin-translator 0.2.0 → 0.3.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/dist/client/entities/translation/api/queries/useCollectionTranslationStatus.d.ts +77 -13
- package/dist/client/entities/translation/api/queries/useDocumentTranslation.d.ts +77 -13
- package/dist/client/features/collection-translation-form/model/schema.d.ts +2 -2
- package/dist/client/features/translate-document-form/model/schema.d.ts +3 -3
- package/dist/server/features/enqueue-translation/model.d.ts +4 -4
- package/dist/server/features/get-document-status/model.d.ts +1 -1
- package/dist/server/features/translate-document/handler.d.ts +4 -4
- package/dist/server/features/translate-document/handler.js +4 -4
- package/dist/server/features/translate-document/index.d.ts +2 -3
- package/dist/server/features/translate-document/index.js +1 -2
- package/dist/server/features/translate-document/model.d.ts +4 -31
- package/dist/server/features/translate-document/model.js +3 -27
- package/dist/server/modules/task-runner/TaskRunnerProvider.interface.d.ts +5 -4
- package/dist/server/modules/task-runner/payload-jobs-runner/PayloadJobsRunnerProvider.d.ts +4 -4
- package/dist/server/modules/task-runner/payload-jobs-runner/PayloadJobsRunnerProvider.js +46 -20
- package/dist/server/modules/task-runner/payload-jobs-runner/PayloadJobsTaskRunner.d.ts +22 -56
- package/dist/server/modules/task-runner/payload-jobs-runner/PayloadJobsTaskRunner.js +45 -85
- package/dist/server/modules/task-runner/payload-jobs-runner/normalizeJob.d.ts +2 -2
- package/dist/server/modules/task-runner/payload-jobs-runner/normalizeJob.js +14 -12
- package/dist/server/modules/task-runner/payload-jobs-runner/readCollectionRef.d.ts +22 -0
- package/dist/server/modules/task-runner/payload-jobs-runner/readCollectionRef.js +22 -0
- package/dist/server/modules/task-runner/payload-jobs-runner/types.d.ts +13 -5
- package/dist/server/modules/task-runner/sync-runner/SyncTaskRunner.d.ts +5 -5
- package/dist/server/modules/task-runner/sync-runner/SyncTaskRunner.js +7 -6
- package/dist/server/modules/task-runner/types.d.ts +15 -5
- package/package.json +1 -1
- package/dist/server/features/translate-document/task.d.ts +0 -40
- package/dist/server/features/translate-document/task.js +0 -44
|
@@ -8,13 +8,15 @@ type Options = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function useCollectionTranslationStatus({ collection }: Props, options?: Options): {
|
|
10
10
|
invalidate: () => void;
|
|
11
|
-
data: GroupedCollectionTranslationStatus
|
|
11
|
+
data: NoInfer<GroupedCollectionTranslationStatus>;
|
|
12
12
|
error: Error;
|
|
13
13
|
isError: true;
|
|
14
14
|
isPending: false;
|
|
15
|
+
isLoading: false;
|
|
15
16
|
isLoadingError: false;
|
|
16
17
|
isRefetchError: true;
|
|
17
18
|
isSuccess: false;
|
|
19
|
+
isPlaceholderData: false;
|
|
18
20
|
status: "error";
|
|
19
21
|
dataUpdatedAt: number;
|
|
20
22
|
errorUpdatedAt: number;
|
|
@@ -24,23 +26,25 @@ export declare function useCollectionTranslationStatus({ collection }: Props, op
|
|
|
24
26
|
isFetched: boolean;
|
|
25
27
|
isFetchedAfterMount: boolean;
|
|
26
28
|
isFetching: boolean;
|
|
27
|
-
isLoading: boolean;
|
|
28
29
|
isInitialLoading: boolean;
|
|
29
30
|
isPaused: boolean;
|
|
30
|
-
isPlaceholderData: boolean;
|
|
31
31
|
isRefetching: boolean;
|
|
32
32
|
isStale: boolean;
|
|
33
|
-
|
|
33
|
+
isEnabled: boolean;
|
|
34
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<GroupedCollectionTranslationStatus>, Error>>;
|
|
34
35
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
36
|
+
promise: Promise<NoInfer<GroupedCollectionTranslationStatus>>;
|
|
35
37
|
} | {
|
|
36
38
|
invalidate: () => void;
|
|
37
|
-
data: GroupedCollectionTranslationStatus
|
|
39
|
+
data: NoInfer<GroupedCollectionTranslationStatus>;
|
|
38
40
|
error: null;
|
|
39
41
|
isError: false;
|
|
40
42
|
isPending: false;
|
|
43
|
+
isLoading: false;
|
|
41
44
|
isLoadingError: false;
|
|
42
45
|
isRefetchError: false;
|
|
43
46
|
isSuccess: true;
|
|
47
|
+
isPlaceholderData: false;
|
|
44
48
|
status: "success";
|
|
45
49
|
dataUpdatedAt: number;
|
|
46
50
|
errorUpdatedAt: number;
|
|
@@ -50,23 +54,25 @@ export declare function useCollectionTranslationStatus({ collection }: Props, op
|
|
|
50
54
|
isFetched: boolean;
|
|
51
55
|
isFetchedAfterMount: boolean;
|
|
52
56
|
isFetching: boolean;
|
|
53
|
-
isLoading: boolean;
|
|
54
57
|
isInitialLoading: boolean;
|
|
55
58
|
isPaused: boolean;
|
|
56
|
-
isPlaceholderData: boolean;
|
|
57
59
|
isRefetching: boolean;
|
|
58
60
|
isStale: boolean;
|
|
59
|
-
|
|
61
|
+
isEnabled: boolean;
|
|
62
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<GroupedCollectionTranslationStatus>, Error>>;
|
|
60
63
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
64
|
+
promise: Promise<NoInfer<GroupedCollectionTranslationStatus>>;
|
|
61
65
|
} | {
|
|
62
66
|
invalidate: () => void;
|
|
63
67
|
data: undefined;
|
|
64
68
|
error: Error;
|
|
65
69
|
isError: true;
|
|
66
70
|
isPending: false;
|
|
71
|
+
isLoading: false;
|
|
67
72
|
isLoadingError: true;
|
|
68
73
|
isRefetchError: false;
|
|
69
74
|
isSuccess: false;
|
|
75
|
+
isPlaceholderData: false;
|
|
70
76
|
status: "error";
|
|
71
77
|
dataUpdatedAt: number;
|
|
72
78
|
errorUpdatedAt: number;
|
|
@@ -76,14 +82,42 @@ export declare function useCollectionTranslationStatus({ collection }: Props, op
|
|
|
76
82
|
isFetched: boolean;
|
|
77
83
|
isFetchedAfterMount: boolean;
|
|
78
84
|
isFetching: boolean;
|
|
79
|
-
isLoading: boolean;
|
|
80
85
|
isInitialLoading: boolean;
|
|
81
86
|
isPaused: boolean;
|
|
82
|
-
isPlaceholderData: boolean;
|
|
83
87
|
isRefetching: boolean;
|
|
84
88
|
isStale: boolean;
|
|
85
|
-
|
|
89
|
+
isEnabled: boolean;
|
|
90
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<GroupedCollectionTranslationStatus>, Error>>;
|
|
91
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
92
|
+
promise: Promise<NoInfer<GroupedCollectionTranslationStatus>>;
|
|
93
|
+
} | {
|
|
94
|
+
invalidate: () => void;
|
|
95
|
+
data: undefined;
|
|
96
|
+
error: null;
|
|
97
|
+
isError: false;
|
|
98
|
+
isPending: true;
|
|
99
|
+
isLoading: true;
|
|
100
|
+
isLoadingError: false;
|
|
101
|
+
isRefetchError: false;
|
|
102
|
+
isSuccess: false;
|
|
103
|
+
isPlaceholderData: false;
|
|
104
|
+
status: "pending";
|
|
105
|
+
dataUpdatedAt: number;
|
|
106
|
+
errorUpdatedAt: number;
|
|
107
|
+
failureCount: number;
|
|
108
|
+
failureReason: Error | null;
|
|
109
|
+
errorUpdateCount: number;
|
|
110
|
+
isFetched: boolean;
|
|
111
|
+
isFetchedAfterMount: boolean;
|
|
112
|
+
isFetching: boolean;
|
|
113
|
+
isInitialLoading: boolean;
|
|
114
|
+
isPaused: boolean;
|
|
115
|
+
isRefetching: boolean;
|
|
116
|
+
isStale: boolean;
|
|
117
|
+
isEnabled: boolean;
|
|
118
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<GroupedCollectionTranslationStatus>, Error>>;
|
|
86
119
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
120
|
+
promise: Promise<NoInfer<GroupedCollectionTranslationStatus>>;
|
|
87
121
|
} | {
|
|
88
122
|
invalidate: () => void;
|
|
89
123
|
data: undefined;
|
|
@@ -93,6 +127,7 @@ export declare function useCollectionTranslationStatus({ collection }: Props, op
|
|
|
93
127
|
isLoadingError: false;
|
|
94
128
|
isRefetchError: false;
|
|
95
129
|
isSuccess: false;
|
|
130
|
+
isPlaceholderData: false;
|
|
96
131
|
status: "pending";
|
|
97
132
|
dataUpdatedAt: number;
|
|
98
133
|
errorUpdatedAt: number;
|
|
@@ -105,10 +140,39 @@ export declare function useCollectionTranslationStatus({ collection }: Props, op
|
|
|
105
140
|
isLoading: boolean;
|
|
106
141
|
isInitialLoading: boolean;
|
|
107
142
|
isPaused: boolean;
|
|
108
|
-
isPlaceholderData: boolean;
|
|
109
143
|
isRefetching: boolean;
|
|
110
144
|
isStale: boolean;
|
|
111
|
-
|
|
145
|
+
isEnabled: boolean;
|
|
146
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<GroupedCollectionTranslationStatus>, Error>>;
|
|
147
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
148
|
+
promise: Promise<NoInfer<GroupedCollectionTranslationStatus>>;
|
|
149
|
+
} | {
|
|
150
|
+
invalidate: () => void;
|
|
151
|
+
data: NoInfer<GroupedCollectionTranslationStatus>;
|
|
152
|
+
isError: false;
|
|
153
|
+
error: null;
|
|
154
|
+
isPending: false;
|
|
155
|
+
isLoading: false;
|
|
156
|
+
isLoadingError: false;
|
|
157
|
+
isRefetchError: false;
|
|
158
|
+
isSuccess: true;
|
|
159
|
+
isPlaceholderData: true;
|
|
160
|
+
status: "success";
|
|
161
|
+
dataUpdatedAt: number;
|
|
162
|
+
errorUpdatedAt: number;
|
|
163
|
+
failureCount: number;
|
|
164
|
+
failureReason: Error | null;
|
|
165
|
+
errorUpdateCount: number;
|
|
166
|
+
isFetched: boolean;
|
|
167
|
+
isFetchedAfterMount: boolean;
|
|
168
|
+
isFetching: boolean;
|
|
169
|
+
isInitialLoading: boolean;
|
|
170
|
+
isPaused: boolean;
|
|
171
|
+
isRefetching: boolean;
|
|
172
|
+
isStale: boolean;
|
|
173
|
+
isEnabled: boolean;
|
|
174
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<GroupedCollectionTranslationStatus>, Error>>;
|
|
112
175
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
176
|
+
promise: Promise<NoInfer<GroupedCollectionTranslationStatus>>;
|
|
113
177
|
};
|
|
114
178
|
export {};
|
|
@@ -9,13 +9,15 @@ type Options = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function useDocumentTranslation({ collection, id }: Props, options?: Options): {
|
|
11
11
|
invalidate: () => void;
|
|
12
|
-
data: DocumentTranslation
|
|
12
|
+
data: NoInfer<DocumentTranslation>;
|
|
13
13
|
error: Error;
|
|
14
14
|
isError: true;
|
|
15
15
|
isPending: false;
|
|
16
|
+
isLoading: false;
|
|
16
17
|
isLoadingError: false;
|
|
17
18
|
isRefetchError: true;
|
|
18
19
|
isSuccess: false;
|
|
20
|
+
isPlaceholderData: false;
|
|
19
21
|
status: "error";
|
|
20
22
|
dataUpdatedAt: number;
|
|
21
23
|
errorUpdatedAt: number;
|
|
@@ -25,23 +27,25 @@ export declare function useDocumentTranslation({ collection, id }: Props, option
|
|
|
25
27
|
isFetched: boolean;
|
|
26
28
|
isFetchedAfterMount: boolean;
|
|
27
29
|
isFetching: boolean;
|
|
28
|
-
isLoading: boolean;
|
|
29
30
|
isInitialLoading: boolean;
|
|
30
31
|
isPaused: boolean;
|
|
31
|
-
isPlaceholderData: boolean;
|
|
32
32
|
isRefetching: boolean;
|
|
33
33
|
isStale: boolean;
|
|
34
|
-
|
|
34
|
+
isEnabled: boolean;
|
|
35
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<DocumentTranslation>, Error>>;
|
|
35
36
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
37
|
+
promise: Promise<NoInfer<DocumentTranslation>>;
|
|
36
38
|
} | {
|
|
37
39
|
invalidate: () => void;
|
|
38
|
-
data: DocumentTranslation
|
|
40
|
+
data: NoInfer<DocumentTranslation>;
|
|
39
41
|
error: null;
|
|
40
42
|
isError: false;
|
|
41
43
|
isPending: false;
|
|
44
|
+
isLoading: false;
|
|
42
45
|
isLoadingError: false;
|
|
43
46
|
isRefetchError: false;
|
|
44
47
|
isSuccess: true;
|
|
48
|
+
isPlaceholderData: false;
|
|
45
49
|
status: "success";
|
|
46
50
|
dataUpdatedAt: number;
|
|
47
51
|
errorUpdatedAt: number;
|
|
@@ -51,23 +55,25 @@ export declare function useDocumentTranslation({ collection, id }: Props, option
|
|
|
51
55
|
isFetched: boolean;
|
|
52
56
|
isFetchedAfterMount: boolean;
|
|
53
57
|
isFetching: boolean;
|
|
54
|
-
isLoading: boolean;
|
|
55
58
|
isInitialLoading: boolean;
|
|
56
59
|
isPaused: boolean;
|
|
57
|
-
isPlaceholderData: boolean;
|
|
58
60
|
isRefetching: boolean;
|
|
59
61
|
isStale: boolean;
|
|
60
|
-
|
|
62
|
+
isEnabled: boolean;
|
|
63
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<DocumentTranslation>, Error>>;
|
|
61
64
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
65
|
+
promise: Promise<NoInfer<DocumentTranslation>>;
|
|
62
66
|
} | {
|
|
63
67
|
invalidate: () => void;
|
|
64
68
|
data: undefined;
|
|
65
69
|
error: Error;
|
|
66
70
|
isError: true;
|
|
67
71
|
isPending: false;
|
|
72
|
+
isLoading: false;
|
|
68
73
|
isLoadingError: true;
|
|
69
74
|
isRefetchError: false;
|
|
70
75
|
isSuccess: false;
|
|
76
|
+
isPlaceholderData: false;
|
|
71
77
|
status: "error";
|
|
72
78
|
dataUpdatedAt: number;
|
|
73
79
|
errorUpdatedAt: number;
|
|
@@ -77,14 +83,42 @@ export declare function useDocumentTranslation({ collection, id }: Props, option
|
|
|
77
83
|
isFetched: boolean;
|
|
78
84
|
isFetchedAfterMount: boolean;
|
|
79
85
|
isFetching: boolean;
|
|
80
|
-
isLoading: boolean;
|
|
81
86
|
isInitialLoading: boolean;
|
|
82
87
|
isPaused: boolean;
|
|
83
|
-
isPlaceholderData: boolean;
|
|
84
88
|
isRefetching: boolean;
|
|
85
89
|
isStale: boolean;
|
|
86
|
-
|
|
90
|
+
isEnabled: boolean;
|
|
91
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<DocumentTranslation>, Error>>;
|
|
92
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
93
|
+
promise: Promise<NoInfer<DocumentTranslation>>;
|
|
94
|
+
} | {
|
|
95
|
+
invalidate: () => void;
|
|
96
|
+
data: undefined;
|
|
97
|
+
error: null;
|
|
98
|
+
isError: false;
|
|
99
|
+
isPending: true;
|
|
100
|
+
isLoading: true;
|
|
101
|
+
isLoadingError: false;
|
|
102
|
+
isRefetchError: false;
|
|
103
|
+
isSuccess: false;
|
|
104
|
+
isPlaceholderData: false;
|
|
105
|
+
status: "pending";
|
|
106
|
+
dataUpdatedAt: number;
|
|
107
|
+
errorUpdatedAt: number;
|
|
108
|
+
failureCount: number;
|
|
109
|
+
failureReason: Error | null;
|
|
110
|
+
errorUpdateCount: number;
|
|
111
|
+
isFetched: boolean;
|
|
112
|
+
isFetchedAfterMount: boolean;
|
|
113
|
+
isFetching: boolean;
|
|
114
|
+
isInitialLoading: boolean;
|
|
115
|
+
isPaused: boolean;
|
|
116
|
+
isRefetching: boolean;
|
|
117
|
+
isStale: boolean;
|
|
118
|
+
isEnabled: boolean;
|
|
119
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<DocumentTranslation>, Error>>;
|
|
87
120
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
121
|
+
promise: Promise<NoInfer<DocumentTranslation>>;
|
|
88
122
|
} | {
|
|
89
123
|
invalidate: () => void;
|
|
90
124
|
data: undefined;
|
|
@@ -94,6 +128,7 @@ export declare function useDocumentTranslation({ collection, id }: Props, option
|
|
|
94
128
|
isLoadingError: false;
|
|
95
129
|
isRefetchError: false;
|
|
96
130
|
isSuccess: false;
|
|
131
|
+
isPlaceholderData: false;
|
|
97
132
|
status: "pending";
|
|
98
133
|
dataUpdatedAt: number;
|
|
99
134
|
errorUpdatedAt: number;
|
|
@@ -106,10 +141,39 @@ export declare function useDocumentTranslation({ collection, id }: Props, option
|
|
|
106
141
|
isLoading: boolean;
|
|
107
142
|
isInitialLoading: boolean;
|
|
108
143
|
isPaused: boolean;
|
|
109
|
-
isPlaceholderData: boolean;
|
|
110
144
|
isRefetching: boolean;
|
|
111
145
|
isStale: boolean;
|
|
112
|
-
|
|
146
|
+
isEnabled: boolean;
|
|
147
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<DocumentTranslation>, Error>>;
|
|
148
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
149
|
+
promise: Promise<NoInfer<DocumentTranslation>>;
|
|
150
|
+
} | {
|
|
151
|
+
invalidate: () => void;
|
|
152
|
+
data: NoInfer<DocumentTranslation>;
|
|
153
|
+
isError: false;
|
|
154
|
+
error: null;
|
|
155
|
+
isPending: false;
|
|
156
|
+
isLoading: false;
|
|
157
|
+
isLoadingError: false;
|
|
158
|
+
isRefetchError: false;
|
|
159
|
+
isSuccess: true;
|
|
160
|
+
isPlaceholderData: true;
|
|
161
|
+
status: "success";
|
|
162
|
+
dataUpdatedAt: number;
|
|
163
|
+
errorUpdatedAt: number;
|
|
164
|
+
failureCount: number;
|
|
165
|
+
failureReason: Error | null;
|
|
166
|
+
errorUpdateCount: number;
|
|
167
|
+
isFetched: boolean;
|
|
168
|
+
isFetchedAfterMount: boolean;
|
|
169
|
+
isFetching: boolean;
|
|
170
|
+
isInitialLoading: boolean;
|
|
171
|
+
isPaused: boolean;
|
|
172
|
+
isRefetching: boolean;
|
|
173
|
+
isStale: boolean;
|
|
174
|
+
isEnabled: boolean;
|
|
175
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NoInfer<DocumentTranslation>, Error>>;
|
|
113
176
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
177
|
+
promise: Promise<NoInfer<DocumentTranslation>>;
|
|
114
178
|
};
|
|
115
179
|
export {};
|
|
@@ -6,16 +6,16 @@ export declare const validationSchema: z.ZodObject<{
|
|
|
6
6
|
strategy: z.ZodEnum<["overwrite", "skip_existing"]>;
|
|
7
7
|
publish_on_translation: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
collection_slug: string;
|
|
9
10
|
source_lng: string;
|
|
10
11
|
target_lng: string;
|
|
11
12
|
strategy: "overwrite" | "skip_existing";
|
|
12
13
|
publish_on_translation: boolean;
|
|
13
|
-
collection_slug: string;
|
|
14
14
|
}, {
|
|
15
|
+
collection_slug: string;
|
|
15
16
|
source_lng: string;
|
|
16
17
|
target_lng: string;
|
|
17
18
|
strategy: "overwrite" | "skip_existing";
|
|
18
|
-
collection_slug: string;
|
|
19
19
|
publish_on_translation?: boolean | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export type FormValues = z.infer<typeof validationSchema>;
|
|
@@ -7,17 +7,17 @@ export declare const validationSchema: z.ZodObject<{
|
|
|
7
7
|
strategy: z.ZodDefault<z.ZodEnum<["overwrite", "skip_existing"]>>;
|
|
8
8
|
publish_on_translation: z.ZodDefault<z.ZodBoolean>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
collection_slug: string;
|
|
11
|
+
collection_id: string;
|
|
10
12
|
source_lng: string;
|
|
11
13
|
target_lng: string;
|
|
12
14
|
strategy: "overwrite" | "skip_existing";
|
|
13
15
|
publish_on_translation: boolean;
|
|
16
|
+
}, {
|
|
14
17
|
collection_slug: string;
|
|
15
18
|
collection_id: string;
|
|
16
|
-
}, {
|
|
17
19
|
source_lng: string;
|
|
18
20
|
target_lng: string;
|
|
19
|
-
collection_slug: string;
|
|
20
|
-
collection_id: string;
|
|
21
21
|
strategy?: "overwrite" | "skip_existing" | undefined;
|
|
22
22
|
publish_on_translation?: boolean | undefined;
|
|
23
23
|
}>;
|
|
@@ -12,18 +12,18 @@ export declare const EnqueueInputSchema: z.ZodObject<{
|
|
|
12
12
|
strategy: z.ZodDefault<z.ZodOptional<z.ZodEnum<["overwrite", "skip_existing"]>>>;
|
|
13
13
|
publish_on_translation: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
collection_slug: string;
|
|
16
|
+
collection_id: [string, ...string[]];
|
|
15
17
|
source_lng: string;
|
|
16
18
|
target_lng: string;
|
|
17
19
|
strategy: "overwrite" | "skip_existing";
|
|
18
20
|
publish_on_translation: boolean;
|
|
19
|
-
collection_slug: string;
|
|
20
|
-
collection_id: [string, ...string[]];
|
|
21
21
|
select_all?: boolean | undefined;
|
|
22
22
|
}, {
|
|
23
|
-
source_lng: string;
|
|
24
|
-
target_lng: string;
|
|
25
23
|
collection_slug: string;
|
|
26
24
|
collection_id: [string, ...string[]];
|
|
25
|
+
source_lng: string;
|
|
26
|
+
target_lng: string;
|
|
27
27
|
strategy?: "overwrite" | "skip_existing" | undefined;
|
|
28
28
|
publish_on_translation?: boolean | undefined;
|
|
29
29
|
select_all?: boolean | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Payload } from
|
|
2
|
-
import type { Handler } from
|
|
3
|
-
import type { TranslationProvider } from
|
|
4
|
-
import type { CollectionSchemaMap, TranslateDocumentInput, TranslateDocumentOutput } from
|
|
1
|
+
import type { Payload } from "payload";
|
|
2
|
+
import type { Handler } from "../../shared";
|
|
3
|
+
import type { TranslationProvider } from "../../modules/translation-providers";
|
|
4
|
+
import type { CollectionSchemaMap, TranslateDocumentInput, TranslateDocumentOutput } from "./model";
|
|
5
5
|
export type TranslateDocumentDependencies = {
|
|
6
6
|
translationProvider: TranslationProvider;
|
|
7
7
|
schemaMap: CollectionSchemaMap;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { APIError } from
|
|
2
|
-
import { TranslationPipeline } from
|
|
3
|
-
import { createTranslationStrategy } from
|
|
1
|
+
import { APIError } from "payload";
|
|
2
|
+
import { TranslationPipeline } from "../../modules/translation-pipeline";
|
|
3
|
+
import { createTranslationStrategy } from "../../modules/translation-pipeline/strategies";
|
|
4
4
|
/**
|
|
5
5
|
* Translates a single document from source language to target language
|
|
6
6
|
*/ export class TranslateDocumentHandler {
|
|
@@ -53,7 +53,7 @@ import { createTranslationStrategy } from '../../modules/translation-pipeline/st
|
|
|
53
53
|
let isAutosaveEnabled = false;
|
|
54
54
|
const versions = collectionConfig.versions;
|
|
55
55
|
if (versions && versions.drafts) {
|
|
56
|
-
translatedData[
|
|
56
|
+
translatedData["_status"] = publishOnTranslation ? "published" : "draft";
|
|
57
57
|
const drafts = versions.drafts;
|
|
58
58
|
if (!publishOnTranslation && drafts.autosave) isAutosaveEnabled = true;
|
|
59
59
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export type { CollectionSchemaMap, AutoRunConfig } from './model';
|
|
1
|
+
export { TranslateDocumentHandler } from "./handler";
|
|
2
|
+
export type { CollectionSchemaMap } from "./model";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { CollectionSlug, Field } from
|
|
2
|
-
import type {
|
|
1
|
+
import type { CollectionSlug, Field } from "payload";
|
|
2
|
+
import type { ID } from "../../modules/task-runner/types";
|
|
3
|
+
import type { TranslationStrategyName } from "../../modules/translation-pipeline/strategies";
|
|
3
4
|
/**
|
|
4
5
|
* Input for the translate document handler
|
|
5
6
|
*/
|
|
6
7
|
export type TranslateDocumentInput = {
|
|
7
8
|
collection: CollectionSlug;
|
|
8
|
-
collectionId:
|
|
9
|
+
collectionId: ID;
|
|
9
10
|
sourceLng: string;
|
|
10
11
|
targetLng: string;
|
|
11
12
|
strategy: TranslationStrategyName;
|
|
@@ -22,31 +23,3 @@ export type TranslateDocumentOutput = {
|
|
|
22
23
|
* Used to access original schemas before Payload sanitization.
|
|
23
24
|
*/
|
|
24
25
|
export type CollectionSchemaMap = Map<CollectionSlug, Field[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Payload task configuration
|
|
27
|
-
*/
|
|
28
|
-
export type TaskConfig = {
|
|
29
|
-
collections: CollectionSlug[];
|
|
30
|
-
retries?: {
|
|
31
|
-
attempts?: number;
|
|
32
|
-
backoff?: {
|
|
33
|
-
delay?: number;
|
|
34
|
-
type: 'exponential' | 'fixed';
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Auto-run configuration for the job queue
|
|
40
|
-
*/
|
|
41
|
-
export type AutoRunConfig = {
|
|
42
|
-
cron?: string;
|
|
43
|
-
limit?: number;
|
|
44
|
-
queue?: string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Payload input schema for the task
|
|
48
|
-
*/
|
|
49
|
-
export declare const taskInputSchema: Field[];
|
|
50
|
-
export declare const TASK_NAME: "translate_document";
|
|
51
|
-
export declare const QUEUE_NAME: "translations";
|
|
52
|
-
export declare const DEFAULT_AUTO_RUN: AutoRunConfig;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type: 'relationship',
|
|
6
|
-
name: 'collection',
|
|
7
|
-
relationTo: [],
|
|
8
|
-
required: true
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
type: 'text',
|
|
12
|
-
maxLength: 256,
|
|
13
|
-
name: 'source_lng',
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: 'text',
|
|
18
|
-
maxLength: 256,
|
|
19
|
-
name: 'target_lng',
|
|
20
|
-
required: true
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
export const TASK_NAME = 'translate_document';
|
|
24
|
-
export const QUEUE_NAME = 'translations';
|
|
25
|
-
export const DEFAULT_AUTO_RUN = {
|
|
26
|
-
cron: '* * * * *',
|
|
27
|
-
limit: 50
|
|
28
|
-
};
|
|
2
|
+
* Map of collection slug to original field schema.
|
|
3
|
+
* Used to access original schemas before Payload sanitization.
|
|
4
|
+
*/ export { };
|
|
29
5
|
|
|
30
6
|
//# sourceMappingURL=model.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { CollectionSlug, Config, Payload } from
|
|
2
|
-
import type { TaskRunner } from
|
|
3
|
-
import type {
|
|
1
|
+
import type { CollectionSlug, Config, Payload } from "payload";
|
|
2
|
+
import type { TaskRunner } from "./TaskRunner.interface";
|
|
3
|
+
import type { ID } from "./types";
|
|
4
|
+
import type { TranslationStrategyName } from "../translation-pipeline/strategies";
|
|
4
5
|
/**
|
|
5
6
|
* Input for task handler callback
|
|
6
7
|
*/
|
|
7
8
|
export type TaskHandlerInput = {
|
|
8
9
|
collection: CollectionSlug;
|
|
9
|
-
collectionId:
|
|
10
|
+
collectionId: ID;
|
|
10
11
|
sourceLng: string;
|
|
11
12
|
targetLng: string;
|
|
12
13
|
strategy: TranslationStrategyName;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Config, Payload } from
|
|
2
|
-
import type { TaskRunner } from
|
|
3
|
-
import type { PayloadJobsRunnerOptions } from
|
|
4
|
-
import type { TaskRunnerContext, TaskRunnerProvider } from
|
|
1
|
+
import type { Config, Payload } from "payload";
|
|
2
|
+
import type { TaskRunner } from "../TaskRunner.interface";
|
|
3
|
+
import type { PayloadJobsRunnerOptions } from "./types";
|
|
4
|
+
import type { TaskRunnerContext, TaskRunnerProvider } from "../TaskRunnerProvider.interface";
|
|
5
5
|
/**
|
|
6
6
|
* TaskRunnerProvider implementation using Payload Jobs.
|
|
7
7
|
*
|