generaltranslation 8.1.19 → 8.1.21
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/CHANGELOG.md +14 -0
- package/README.md +2 -3
- package/dist/index.cjs.min.cjs +3 -3
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/index.esm.min.mjs +3 -3
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/translate/awaitJobs.d.ts +19 -0
- package/dist/translate/enqueueFiles.d.ts +1 -1
- package/dist/translate/publishFiles.d.ts +2 -0
- package/dist/types-dir/api/downloadFileBatch.d.ts +1 -0
- package/dist/types-dir/api/file.d.ts +6 -2
- package/dist/types.d.ts +24 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -195,8 +195,11 @@ type FileReference = {
|
|
|
195
195
|
* @see {@link FileReference}
|
|
196
196
|
* @property {string} [branchId] - The ID of the branch of the file
|
|
197
197
|
*/
|
|
198
|
-
type
|
|
198
|
+
type FileReferenceIds = Omit<FileReference, 'branchId' | 'fileName' | 'fileFormat' | 'dataFormat'> & {
|
|
199
199
|
branchId?: string;
|
|
200
|
+
fileName?: string;
|
|
201
|
+
fileFormat?: FileFormat;
|
|
202
|
+
dataFormat?: DataFormat;
|
|
200
203
|
};
|
|
201
204
|
|
|
202
205
|
type DownloadFileBatchRequest = {
|
|
@@ -204,6 +207,7 @@ type DownloadFileBatchRequest = {
|
|
|
204
207
|
branchId?: string;
|
|
205
208
|
versionId?: string;
|
|
206
209
|
locale?: string;
|
|
210
|
+
useLatestAvailableVersion?: boolean;
|
|
207
211
|
}[];
|
|
208
212
|
type DownloadFileBatchOptions = {
|
|
209
213
|
timeout?: number;
|
|
@@ -276,6 +280,8 @@ type PublishFilesResult = {
|
|
|
276
280
|
results: {
|
|
277
281
|
fileId: string;
|
|
278
282
|
versionId: string;
|
|
283
|
+
locale?: string;
|
|
284
|
+
branchId: string;
|
|
279
285
|
success: boolean;
|
|
280
286
|
error?: string;
|
|
281
287
|
}[];
|
|
@@ -419,6 +425,25 @@ type CheckJobStatusResult = {
|
|
|
419
425
|
};
|
|
420
426
|
}[];
|
|
421
427
|
|
|
428
|
+
type AwaitJobsOptions = {
|
|
429
|
+
/** Polling interval in seconds. Defaults to 5. */
|
|
430
|
+
pollingIntervalSeconds?: number;
|
|
431
|
+
/** Timeout in seconds. Defaults to 600 (10 minutes). If reached, resolves with whatever status is current. */
|
|
432
|
+
timeoutSeconds?: number;
|
|
433
|
+
};
|
|
434
|
+
type JobResult = {
|
|
435
|
+
jobId: string;
|
|
436
|
+
status: JobStatus;
|
|
437
|
+
error?: {
|
|
438
|
+
message: string;
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
type AwaitJobsResult = {
|
|
442
|
+
/** Whether all jobs completed (none still in progress). */
|
|
443
|
+
complete: boolean;
|
|
444
|
+
jobs: JobResult[];
|
|
445
|
+
};
|
|
446
|
+
|
|
422
447
|
type SubmitUserEditDiff = {
|
|
423
448
|
fileName: string;
|
|
424
449
|
locale: string;
|
|
@@ -447,7 +472,7 @@ type SetupProjectOptions = {
|
|
|
447
472
|
};
|
|
448
473
|
|
|
449
474
|
type EnqueueOptions = {
|
|
450
|
-
sourceLocale
|
|
475
|
+
sourceLocale?: string;
|
|
451
476
|
targetLocales: string[];
|
|
452
477
|
requireApproval?: boolean;
|
|
453
478
|
modelProvider?: string;
|
|
@@ -653,6 +678,14 @@ declare class GT {
|
|
|
653
678
|
* });
|
|
654
679
|
*/
|
|
655
680
|
checkJobStatus(jobIds: string[], timeoutMs?: number): Promise<CheckJobStatusResult>;
|
|
681
|
+
/**
|
|
682
|
+
* Polls job statuses until all jobs from enqueueFiles are finished or the timeout is reached.
|
|
683
|
+
*
|
|
684
|
+
* @param {EnqueueFilesResult} enqueueResult - The result returned from enqueueFiles
|
|
685
|
+
* @param {AwaitJobsOptions} [options] - Polling configuration (interval, timeout)
|
|
686
|
+
* @returns {Promise<AwaitJobsResult>} The final status of all jobs and whether they all completed
|
|
687
|
+
*/
|
|
688
|
+
awaitJobs(enqueueResult: EnqueueFilesResult, options?: AwaitJobsOptions): Promise<AwaitJobsResult>;
|
|
656
689
|
/**
|
|
657
690
|
* Enqueues translation jobs for previously uploaded source files.
|
|
658
691
|
*
|
|
@@ -662,11 +695,11 @@ declare class GT {
|
|
|
662
695
|
* uploadSourceFiles. The translation jobs are queued for processing and will
|
|
663
696
|
* generate translated content based on the source files and target locales provided.
|
|
664
697
|
*
|
|
665
|
-
* @param {
|
|
698
|
+
* @param {FileReferenceIds[]} files - Array of file references containing IDs of previously uploaded source files
|
|
666
699
|
* @param {EnqueueOptions} options - Configuration options including source locale, target locales, and job settings
|
|
667
700
|
* @returns {Promise<EnqueueFilesResult>} Result containing job IDs, queue status, and processing information
|
|
668
701
|
*/
|
|
669
|
-
enqueueFiles(files:
|
|
702
|
+
enqueueFiles(files: FileReferenceIds[], options: EnqueueOptions): Promise<EnqueueFilesResult>;
|
|
670
703
|
/**
|
|
671
704
|
* Publishes or unpublishes files on the CDN.
|
|
672
705
|
*
|
|
@@ -758,6 +791,7 @@ declare class GT {
|
|
|
758
791
|
branchId?: string;
|
|
759
792
|
locale?: string;
|
|
760
793
|
versionId?: string;
|
|
794
|
+
useLatestAvailableVersion?: boolean;
|
|
761
795
|
}, options?: DownloadFileOptions): Promise<string>;
|
|
762
796
|
/**
|
|
763
797
|
* Downloads multiple files in a batch.
|