generaltranslation 9.4.3 → 9.5.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/CHANGELOG.md +27 -0
- package/README.md +2 -1
- package/dist/{ApiError-BcjcnTAr.cjs → ApiError-BCjEo_CM.cjs} +1 -1
- package/dist/{ApiError-BcjcnTAr.cjs.map → ApiError-BCjEo_CM.cjs.map} +1 -1
- package/dist/{ApiError-CUKcz3YS.mjs → ApiError-DxWKM0Xt.mjs} +1 -1
- package/dist/{ApiError-CUKcz3YS.mjs.map → ApiError-DxWKM0Xt.mjs.map} +1 -1
- package/dist/adapter/createGtApi.d.ts +196 -27
- package/dist/adapter/createGtApi.js +561 -117
- package/dist/adapter/modelProvider.d.ts +4 -0
- package/dist/adapter/modelProvider.js +6 -0
- package/dist/derive-Cv5_y8Tf.mjs +656 -0
- package/dist/derive-Cv5_y8Tf.mjs.map +1 -0
- package/dist/{derive-DBCCXTmL.d.cts → derive-J2NQLqZm.d.cts} +1 -1
- package/dist/derive-t_E3ftJN.cjs +733 -0
- package/dist/derive-t_E3ftJN.cjs.map +1 -0
- package/dist/diagnostics-CqAHg_Vc.d.cts +34 -0
- package/dist/diagnostics-DKA2SkZB.mjs +45 -0
- package/dist/diagnostics-DKA2SkZB.mjs.map +1 -0
- package/dist/{unwrapApiResult-BzGfPw75.mjs → diagnostics-DKtiPUvo.cjs} +12 -31
- package/dist/diagnostics-DKtiPUvo.cjs.map +1 -0
- package/dist/diagnostics-DYtVjOm5.d.mts +34 -0
- package/dist/diagnostics.cjs +4 -0
- package/dist/diagnostics.d.cts +2 -0
- package/dist/diagnostics.d.mts +2 -0
- package/dist/diagnostics.d.ts +1 -0
- package/dist/diagnostics.js +1 -0
- package/dist/diagnostics.mjs +2 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/file-B37WkCqM.cjs.map +1 -1
- package/dist/file-Dga6cyM8.mjs.map +1 -1
- package/dist/{id-X2zyx5Jk.mjs → id-B2wA7-S-.mjs} +19 -3
- package/dist/id-B2wA7-S-.mjs.map +1 -0
- package/dist/{id-pdr3R1xs.cjs → id-DJ_59q21.cjs} +25 -3
- package/dist/id-DJ_59q21.cjs.map +1 -0
- package/dist/id.cjs +1 -1
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/id.mjs +1 -1
- package/dist/index.cjs +94 -753
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -33
- package/dist/index.d.mts +13 -32
- package/dist/index.d.ts +20 -16
- package/dist/index.js +110 -98
- package/dist/index.mjs +88 -746
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +16 -186
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +200 -62
- package/dist/internal.d.mts +199 -61
- package/dist/internal.d.ts +3 -1
- package/dist/internal.js +2 -1
- package/dist/internal.mjs +6 -178
- package/dist/internal.mjs.map +1 -1
- package/dist/logging/errors.d.ts +0 -1
- package/dist/logging/errors.js +0 -6
- package/dist/logging/logger.js +6 -4
- package/dist/runtime.cjs +580 -2
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +12 -6
- package/dist/runtime.d.mts +12 -6
- package/dist/runtime.d.ts +10 -4
- package/dist/runtime.js +10 -65
- package/dist/runtime.mjs +579 -1
- package/dist/runtime.mjs.map +1 -0
- package/dist/runtimeTranslate-CVw143pQ.mjs +506 -0
- package/dist/runtimeTranslate-CVw143pQ.mjs.map +1 -0
- package/dist/runtimeTranslate-DJioRjb6.cjs +601 -0
- package/dist/runtimeTranslate-DJioRjb6.cjs.map +1 -0
- package/dist/translate/awaitJobs.d.ts +2 -2
- package/dist/translate/awaitJobs.js +1 -156
- package/dist/translate/checkJobStatus.d.ts +2 -1
- package/dist/translate/checkJobStatus.js +1 -55
- package/dist/translate/createBranch.d.ts +2 -6
- package/dist/translate/createBranch.js +1 -53
- package/dist/translate/enqueueFiles.js +1 -95
- package/dist/translate/getProjectInfo.d.ts +2 -6
- package/dist/translate/getProjectInfo.js +1 -54
- package/dist/translate/processFileMoves.d.ts +3 -13
- package/dist/translate/processFileMoves.js +1 -90
- package/dist/translate/publishFiles.d.ts +3 -15
- package/dist/translate/publishFiles.js +1 -56
- package/dist/translate/queryBranchData.js +1 -53
- package/dist/translate/queryFileData.d.ts +3 -41
- package/dist/translate/queryFileData.js +1 -71
- package/dist/translate/runtimeTranslate.d.ts +6 -0
- package/dist/translate/runtimeTranslate.js +297 -0
- package/dist/translate/setupProject.d.ts +2 -6
- package/dist/translate/setupProject.js +1 -63
- package/dist/translate/submitUserEditDiffs.js +1 -68
- package/dist/translate/utils/fetchWithTimeout.js +19 -12
- package/dist/{types-bCr8pV1Z.d.cts → types-Si4UstLL.d.mts} +41 -165
- package/dist/types-dir/__tests__/runtimeTranslate.type-test.js +18 -0
- package/dist/types-dir/api/branch.d.ts +3 -9
- package/dist/types-dir/api/checkFileTranslations.d.ts +2 -22
- package/dist/types-dir/api/downloadFileBatch.d.ts +2 -7
- package/dist/types-dir/api/entry.d.ts +3 -8
- package/dist/types-dir/api/file.d.ts +2 -1
- package/dist/types-dir/api/json.d.ts +1 -4
- package/dist/types-dir/api/project.d.ts +2 -7
- package/dist/types-dir/api/uploadAssets.d.ts +3 -10
- package/dist/types-dir/api/uploadAssets.js +0 -4
- package/dist/types-dir/config.d.ts +1 -0
- package/dist/{types-Dp1drjxq.d.mts → types-yByDbKnV.d.cts} +41 -165
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +26 -7
- package/package.json +15 -2
- package/dist/derive-2CDqwrvS.cjs +0 -303
- package/dist/derive-2CDqwrvS.cjs.map +0 -1
- package/dist/derive-CTzR56T_.mjs +0 -233
- package/dist/derive-CTzR56T_.mjs.map +0 -1
- package/dist/id-X2zyx5Jk.mjs.map +0 -1
- package/dist/id-pdr3R1xs.cjs.map +0 -1
- package/dist/isVariable-8-Wy5FnX.mjs +0 -20
- package/dist/isVariable-8-Wy5FnX.mjs.map +0 -1
- package/dist/isVariable-I3nllgeI.cjs +0 -25
- package/dist/isVariable-I3nllgeI.cjs.map +0 -1
- package/dist/projects/getProjectData.js +0 -87
- package/dist/runtime-Bcp4F2ME.mjs +0 -974
- package/dist/runtime-Bcp4F2ME.mjs.map +0 -1
- package/dist/runtime-C25lwh9m.cjs +0 -1027
- package/dist/runtime-C25lwh9m.cjs.map +0 -1
- package/dist/translate/api.d.ts +0 -4
- package/dist/translate/api.js +0 -4
- package/dist/translate/createTag.d.ts +0 -19
- package/dist/translate/createTag.js +0 -67
- package/dist/translate/downloadFileBatch.d.ts +0 -1
- package/dist/translate/downloadFileBatch.js +0 -80
- package/dist/translate/getOrphanedFiles.d.ts +0 -8
- package/dist/translate/getOrphanedFiles.js +0 -97
- package/dist/translate/querySourceFile.d.ts +0 -1
- package/dist/translate/querySourceFile.js +0 -67
- package/dist/translate/translateMany.d.ts +0 -1
- package/dist/translate/translateMany.js +0 -124
- package/dist/translate/uploadFonts.d.ts +0 -1
- package/dist/translate/uploadFonts.js +0 -74
- package/dist/translate/uploadSourceFiles.d.ts +0 -1
- package/dist/translate/uploadSourceFiles.js +0 -90
- package/dist/translate/uploadTranslations.d.ts +0 -1
- package/dist/translate/uploadTranslations.js +0 -106
- package/dist/translate/utils/apiRequest.d.ts +0 -1
- package/dist/translate/utils/apiRequest.js +0 -167
- package/dist/translate/utils/generateRequestHeaders.d.ts +0 -2
- package/dist/translate/utils/generateRequestHeaders.js +0 -21
- package/dist/translate/utils/handleFetchError.d.ts +0 -1
- package/dist/translate/utils/handleFetchError.js +0 -12
- package/dist/unwrapApiResult-BzGfPw75.mjs.map +0 -1
- package/dist/unwrapApiResult-Dv6Mfw_K.cjs +0 -134
- package/dist/unwrapApiResult-Dv6Mfw_K.cjs.map +0 -1
- /package/dist/{projects/getProjectData.d.ts → types-dir/__tests__/runtimeTranslate.type-test.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# generaltranslation
|
|
2
2
|
|
|
3
|
+
## 9.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`78e3a57`](https://github.com/generaltranslation/gt/commit/78e3a57c19caffe8fbce2e9bc74e573071d662e8) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Expose diagnostics through the public `generaltranslation/diagnostics` subpath and fail fast with a diagnostic when an unsupported model provider would otherwise be forwarded and rejected by the server. Migrate the CLI to the diagnostics subpath and API version export, and report invalid model-provider settings with the validation diagnostic.
|
|
8
|
+
|
|
9
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`c734b08`](https://github.com/generaltranslation/gt/commit/c734b084f0a50d1b2787c86ec790403f88803650) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Add `gt login`, `gt logout`, and `gt whoami`. Login uses openid-client with the seeded public `gt-cli` client, S256 PKCE and a loopback callback against the General Translation dashboard. When `--no-browser` is set or the loopback listener cannot bind, login uses device authorization with a displayed verification code. Device polling and retries follow openid-client policy (not blanket network/all-5xx retries). Signed identity tokens are validated before saving per-server credentials in `$XDG_STATE_HOME/gt/credentials.json` (default `~/.local/state/gt/credentials.json`, 0600); refresh preserves the validated account identity. Obsolete pre-release logins require `gt login` again without resetting other servers' entries. Login requests a token for the project's configured `baseUrl` (`GT_API_URL` overrides), records that resource with the credentials, and the CLI refuses to send a login issued for a different API instead of letting the server reject it. The API client and core request path accept a refreshable user-token provider, used only when no API key is configured — an explicit API key always wins. The former development-key rejection is gone; every `gtx-` key is just a key with its own permissions.
|
|
10
|
+
|
|
11
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`322e927`](https://github.com/generaltranslation/gt/commit/322e9279b7efb17faf220e626a5a3696efc5d863) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Route the `GT` project and file methods through the generated OpenAPI SDK while preserving their published signatures. Requests now use the SDK's idempotency-aware retry policy, so POST requests are no longer retried automatically after network errors or server failures; rate-limit (429) responses are still retried for every method. Remove the stale `deduped` field from uploaded font results because the server has never returned it.
|
|
12
|
+
|
|
13
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`d5649a4`](https://github.com/generaltranslation/gt/commit/d5649a4d9711c3f752a1706348398935bf44e8e1) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Expose `translate` and `translateMany` on the shared tooling API adapter used by the CLI and Sanity, sharing the `GT`/`GTRuntime` preparation and wire path. Translation requests now honor a configured custom `fetch`, `apiVersion` and `timeoutMs` (`0` is a literal zero, `false` disables the runtime timer) instead of silently dropping them. Translation still performs no generic retries even when the adapter configures a management `retryPolicy`, and the positional class timeout keeps its existing behavior, where `0` selects the default. Cancellation from a caller signal or custom `fetch` now propagates its original `AbortError` across class and adapter translation instead of being reported as an SDK timeout; the timeout diagnostic is raised only when the runtime-owned timer caused the abort.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`87fa5b1`](https://github.com/generaltranslation/gt/commit/87fa5b17cc2dcd265bc96ab77259e4bc4a6c987f) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - `gt auth` and the `gt init` wizard no longer ask for a key type; `-t/--key-type` is removed. There is one kind of project API key, and its permissions are checked by the server. The wizard now saves only the project ID and the framework-prefixed `GT_DEV_API_KEY` that enables hot reload and runtime translation in development; it no longer writes `GT_API_KEY`, which belongs in your hosting environment (production runtime translation) or CI secrets, and both commands print that guidance. `gt init` signs you in (`gt login`) first when no API key is configured, so the CLI translates as you. On the `GT` and `GTRuntime` constructors, `devApiKey` is deprecated in favor of `apiKey`.
|
|
18
|
+
|
|
19
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`0e87e42`](https://github.com/generaltranslation/gt/commit/0e87e42ac5d93a1c9ee1f5993d074d4c9a4ae387) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Mark logger and model-provider initializers as pure so downstream bundlers can remove them when unused, keeping constant-only imports such as `libraryDefaultLocale` small.
|
|
20
|
+
|
|
21
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`370c31f`](https://github.com/generaltranslation/gt/commit/370c31f975cd1d2bfa9609ea1827c2900f812665) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Adopt the enriched OpenAPI contract types for runtime translations, download metadata, and action types.
|
|
22
|
+
|
|
23
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`052d499`](https://github.com/generaltranslation/gt/commit/052d499556f3dcf7c6801d2ba91399783608e70b) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - `gt init` sets up development credentials without the dashboard wizard. After signing in (or with an explicit `GT_API_KEY`), it lists the projects you can access and lets you pick one, or creates a new project in an organization where you can create projects. It then mints a development key limited to `project:translations:generate` and saves the project ID and that key to `.env.local` under the names your framework expects (for example `NEXT_PUBLIC_`, `VITE_`, `GATSBY_`, `REACT_APP_`, `REDWOOD_ENV_`). Existing `.env.local` lines, comments, and any `GT_API_KEY` are preserved; rerunning replaces only those two variables. A project ID already in `gt.config.json` or the environment is used directly, and setup is skipped when a runtime key for it is already configured. `--config` and `--src` now reach the config written by `gt init`. The shared API adapter gains paginated `listProjects` and `listOrgs` plus `createProjectApiKey`.
|
|
24
|
+
|
|
25
|
+
- [#2205](https://github.com/generaltranslation/gt/pull/2205) [`abc7fea`](https://github.com/generaltranslation/gt/commit/abc7feaeb8be41709178d34db550d7af36c809af) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Consolidate CLI and Sanity request construction on the shared core API adapter, which now owns `createProject` and exposes raw project-info and job-status loaders for compatibility facades.
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`c734b08`](https://github.com/generaltranslation/gt/commit/c734b084f0a50d1b2787c86ec790403f88803650), [`08e6d82`](https://github.com/generaltranslation/gt/commit/08e6d82df8f02045f43bfcc87b35e9a4ae4a9f69)]:
|
|
28
|
+
- @generaltranslation/api@0.4.0
|
|
29
|
+
|
|
3
30
|
## 9.4.3
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
# generaltranslation
|
|
15
15
|
|
|
16
|
-
Core library for General Translation. Used
|
|
16
|
+
Core translation, locale, and formatting library for General Translation. Used by
|
|
17
|
+
`gt-react`, `gt-next`, and other GT integrations.
|
|
17
18
|
|
|
18
19
|
## Installation
|
|
19
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError-
|
|
1
|
+
{"version":3,"file":"ApiError-BCjEo_CM.cjs","names":[],"sources":["../src/errors/ApiError.ts"],"sourcesContent":["export class ApiError extends Error {\n public code: number;\n public message: string;\n\n constructor(error: string, code: number, message: string) {\n super(error);\n this.name = 'ApiError';\n this.code = code;\n this.message = message;\n }\n}\n"],"mappings":";AAAA,IAAa,WAAb,cAA8B,MAAM;CAIlC,YAAY,OAAe,MAAc,SAAiB;AACxD,QAAM,MAAM;AACZ,OAAK,OAAO;AACZ,OAAK,OAAO;AACZ,OAAK,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError-
|
|
1
|
+
{"version":3,"file":"ApiError-DxWKM0Xt.mjs","names":[],"sources":["../src/errors/ApiError.ts"],"sourcesContent":["export class ApiError extends Error {\n public code: number;\n public message: string;\n\n constructor(error: string, code: number, message: string) {\n super(error);\n this.name = 'ApiError';\n this.code = code;\n this.message = message;\n }\n}\n"],"mappings":";AAAA,IAAa,WAAb,cAA8B,MAAM;CAIlC,YAAY,OAAe,MAAc,SAAiB;AACxD,QAAM,MAAM;AACZ,OAAK,OAAO;AACZ,OAAK,OAAO;AACZ,OAAK,UAAU"}
|
|
@@ -1,19 +1,170 @@
|
|
|
1
|
-
import { createApiClient, type ApiClientConfig, type AwaitJobsOptions, type CreateBranchData, type DownloadFilesData, type EnqueueFileTranslationsData, type GenerateProjectContextData, type GetFileInfoData, type UploadSourceFilesData, type UploadTranslationsData } from '@generaltranslation/api';
|
|
1
|
+
import { createApiClient, type ApiClientConfig, type AwaitJobsOptions, type CreateBranchData, type CreateProjectApiKeyData, type CreateProjectData, type CreateTagData, type DownloadFilesData, type EnqueueFileTranslationsData, type GenerateProjectContextData, type GetBranchInfoData, type GetFileInfoData, type GetTranslationJobInfoResponse, type GetTranslationStatusData, type ProcessFileMovesData, type PublishFilesData, type SubmitUserEditDiffsData, type UploadAssetsData, type UploadSourceFilesData, type UploadTranslationsData } from '@generaltranslation/api';
|
|
2
2
|
import type { CustomMapping } from '@generaltranslation/format/types';
|
|
3
3
|
import type { DownloadedFile } from '../types-dir/api/downloadFileBatch';
|
|
4
|
+
import type { TranslateManyEntry, TranslateOptions } from '../types-dir/api/entry';
|
|
5
|
+
import type { TranslateManyResult, TranslationResult } from '../types';
|
|
4
6
|
export type GtApiAdapterConfig = ApiClientConfig & {
|
|
5
7
|
customMapping?: CustomMapping;
|
|
6
8
|
};
|
|
7
|
-
export declare function createGtApiAdapter(defaultConfig?:
|
|
8
|
-
configure: (
|
|
9
|
-
getClient: () => ReturnType<typeof createApiClient>;
|
|
10
|
-
getClientConfig: () => ApiClientConfig;
|
|
9
|
+
export declare function createGtApiAdapter(defaultConfig?: GtApiAdapterConfig): {
|
|
10
|
+
configure: (nextConfig: GtApiAdapterConfig) => void;
|
|
11
|
+
getClient: (timeoutMs?: number) => ReturnType<typeof createApiClient>;
|
|
11
12
|
resolveAliasLocale(locale: string): string;
|
|
12
13
|
resolveCanonicalLocale(locale: string): string;
|
|
14
|
+
translate: (source: TranslateManyEntry, options: string | TranslateOptions, timeoutMs?: number | false) => Promise<TranslationResult>;
|
|
15
|
+
translateMany: {
|
|
16
|
+
(sources: TranslateManyEntry[], options: string | TranslateOptions, timeoutMs?: number | false): Promise<TranslateManyResult>;
|
|
17
|
+
(sources: Record<string, TranslateManyEntry>, options: string | TranslateOptions, timeoutMs?: number | false): Promise<Record<string, TranslationResult>>;
|
|
18
|
+
};
|
|
19
|
+
queryBranchData(body: GetBranchInfoData["body"]): Promise<{
|
|
20
|
+
branches: Array<import("@generaltranslation/api").Branch>;
|
|
21
|
+
defaultBranch: import("@generaltranslation/api").Branch & ({
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
} | null);
|
|
24
|
+
}>;
|
|
13
25
|
createBranch(body: CreateBranchData["body"]): Promise<{
|
|
14
26
|
branch: import("@generaltranslation/api").Branch;
|
|
15
27
|
}>;
|
|
16
|
-
|
|
28
|
+
processFileMoves(moves: ProcessFileMovesData["body"]["moves"], options?: Pick<ProcessFileMovesData["body"], "branchId"> & {
|
|
29
|
+
timeout?: number;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
results: {
|
|
32
|
+
oldFileId: string;
|
|
33
|
+
newFileId: string;
|
|
34
|
+
success: boolean;
|
|
35
|
+
newSourceFileId?: string;
|
|
36
|
+
clonedTranslationsCount?: number;
|
|
37
|
+
error?: string;
|
|
38
|
+
}[];
|
|
39
|
+
summary: {
|
|
40
|
+
total: number;
|
|
41
|
+
succeeded: number;
|
|
42
|
+
failed: number;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
getOrphanedFiles(branchId: string, fileIds: string[], options?: {
|
|
46
|
+
timeout?: number;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
orphanedFiles: Array<{
|
|
49
|
+
fileId: string;
|
|
50
|
+
versionId: string;
|
|
51
|
+
fileName: string;
|
|
52
|
+
}>;
|
|
53
|
+
}>;
|
|
54
|
+
setupProject(files: GenerateProjectContextData["body"]["files"], options?: Omit<GenerateProjectContextData["body"], "files"> & {
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
status: "completed";
|
|
58
|
+
} | {
|
|
59
|
+
setupJobId: string;
|
|
60
|
+
status: "queued";
|
|
61
|
+
}>;
|
|
62
|
+
loadJobStatuses: (jobIds: readonly string[], options?: {
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
timeoutMs?: number;
|
|
65
|
+
}) => Promise<GetTranslationJobInfoResponse>;
|
|
66
|
+
checkJobStatus(jobIds: string[], timeoutMs?: number): Promise<{
|
|
67
|
+
jobId: string;
|
|
68
|
+
status: GetTranslationJobInfoResponse[number]["status"];
|
|
69
|
+
error?: {
|
|
70
|
+
message: string;
|
|
71
|
+
};
|
|
72
|
+
}[]>;
|
|
73
|
+
awaitJobs(jobIds: readonly string[], options?: AwaitJobsOptions): Promise<{
|
|
74
|
+
jobs: {
|
|
75
|
+
jobId: string;
|
|
76
|
+
status: GetTranslationJobInfoResponse[number]["status"];
|
|
77
|
+
error?: {
|
|
78
|
+
message: string;
|
|
79
|
+
};
|
|
80
|
+
}[];
|
|
81
|
+
complete: boolean;
|
|
82
|
+
}>;
|
|
83
|
+
enqueueFiles(files: EnqueueFileTranslationsData["body"]["files"], options: {
|
|
84
|
+
sourceLocale?: string;
|
|
85
|
+
targetLocales: string[];
|
|
86
|
+
modelProvider?: string;
|
|
87
|
+
force?: boolean;
|
|
88
|
+
timeout?: number;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
jobData: {
|
|
91
|
+
[k: string]: any;
|
|
92
|
+
};
|
|
93
|
+
locales: string[];
|
|
94
|
+
message: string;
|
|
95
|
+
}>;
|
|
96
|
+
createTag(body: CreateTagData["body"]): Promise<{
|
|
97
|
+
tag: {
|
|
98
|
+
id: string;
|
|
99
|
+
tagId: string;
|
|
100
|
+
message: string | null;
|
|
101
|
+
createdAt: string;
|
|
102
|
+
updatedAt: string;
|
|
103
|
+
};
|
|
104
|
+
}>;
|
|
105
|
+
publishFiles(files: PublishFilesData["body"]["files"]): Promise<{
|
|
106
|
+
results: Array<{
|
|
107
|
+
fileId: string;
|
|
108
|
+
versionId: string;
|
|
109
|
+
locale?: string;
|
|
110
|
+
branchId: string;
|
|
111
|
+
success: boolean;
|
|
112
|
+
error?: string;
|
|
113
|
+
}>;
|
|
114
|
+
}>;
|
|
115
|
+
submitUserEditDiffs(body: SubmitUserEditDiffsData["body"], options?: {
|
|
116
|
+
timeout?: number;
|
|
117
|
+
}): Promise<{
|
|
118
|
+
filesProcessed: number;
|
|
119
|
+
entriesReceived: number;
|
|
120
|
+
message: string;
|
|
121
|
+
}[]>;
|
|
122
|
+
createProject(orgId: CreateProjectData["path"]["orgId"], body: CreateProjectData["body"]): Promise<{
|
|
123
|
+
project: {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
orgId: string;
|
|
127
|
+
defaultLocale: string;
|
|
128
|
+
};
|
|
129
|
+
}>;
|
|
130
|
+
/** Every project the configured credentials can read. */
|
|
131
|
+
listProjects(): Promise<{
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
orgId: string;
|
|
135
|
+
orgName: string;
|
|
136
|
+
}[]>;
|
|
137
|
+
/** Organizations where the signed-in user can create projects; user tokens only. */
|
|
138
|
+
listOrgs(): Promise<{
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
}[]>;
|
|
142
|
+
createProjectApiKey(projectId: CreateProjectApiKeyData["path"]["projectId"], body: CreateProjectApiKeyData["body"]): Promise<{
|
|
143
|
+
apiKey: {
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
key: string;
|
|
147
|
+
projectId: string;
|
|
148
|
+
type: "production";
|
|
149
|
+
};
|
|
150
|
+
}>;
|
|
151
|
+
loadProjectInfo: (projectId?: string, timeoutMs?: number) => Promise<{
|
|
152
|
+
id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
orgId: string;
|
|
155
|
+
defaultLocale: string;
|
|
156
|
+
currentLocales: Array<string>;
|
|
157
|
+
autoApprove: boolean;
|
|
158
|
+
}>;
|
|
159
|
+
getProjectInfo(projectId?: string, timeoutMs?: number): Promise<{
|
|
160
|
+
defaultLocale: string;
|
|
161
|
+
currentLocales: string[];
|
|
162
|
+
id: string;
|
|
163
|
+
name: string;
|
|
164
|
+
orgId: string;
|
|
165
|
+
autoApprove: boolean;
|
|
166
|
+
}>;
|
|
167
|
+
queryFileData(body: GetFileInfoData["body"], timeoutMs?: number): Promise<{
|
|
17
168
|
translatedFiles: {
|
|
18
169
|
locale: string;
|
|
19
170
|
branchId: string;
|
|
@@ -41,38 +192,46 @@ export declare function createGtApiAdapter(defaultConfig?: ApiClientConfig): {
|
|
|
41
192
|
publishedAt: string | null;
|
|
42
193
|
}[];
|
|
43
194
|
}>;
|
|
44
|
-
|
|
195
|
+
querySourceFile(path: GetTranslationStatusData["path"], query?: GetTranslationStatusData["query"], timeoutMs?: number): Promise<{
|
|
196
|
+
translations: {
|
|
197
|
+
locale: string;
|
|
198
|
+
completedAt: string | null;
|
|
199
|
+
approvedAt: string | null;
|
|
200
|
+
publishedAt: string | null;
|
|
201
|
+
createdAt: string | null;
|
|
202
|
+
updatedAt: string | null;
|
|
203
|
+
}[];
|
|
204
|
+
sourceFile: {
|
|
205
|
+
sourceLocale: string;
|
|
206
|
+
locales: string[];
|
|
207
|
+
id: string;
|
|
208
|
+
branchId: string;
|
|
209
|
+
fileId: string;
|
|
210
|
+
versionId: string;
|
|
211
|
+
fileName: string;
|
|
212
|
+
fileFormat: import("@generaltranslation/api").FileFormat;
|
|
213
|
+
dataFormat: string | null;
|
|
214
|
+
createdAt: string;
|
|
215
|
+
updatedAt: string;
|
|
216
|
+
};
|
|
217
|
+
}>;
|
|
218
|
+
downloadFileBatch(files: DownloadFilesData["body"], options?: {
|
|
219
|
+
timeout?: number;
|
|
220
|
+
}): Promise<{
|
|
45
221
|
files: DownloadedFile[];
|
|
46
222
|
count: number;
|
|
47
223
|
pending: {
|
|
224
|
+
locale: string;
|
|
48
225
|
branchId: string;
|
|
49
226
|
fileId: string;
|
|
50
|
-
locale: string;
|
|
51
227
|
versionId: string;
|
|
52
228
|
}[];
|
|
53
229
|
}>;
|
|
54
|
-
setupProject(files: GenerateProjectContextData["body"]["files"], options?: Omit<GenerateProjectContextData["body"], "files">): Promise<{
|
|
55
|
-
status: "completed";
|
|
56
|
-
} | {
|
|
57
|
-
setupJobId: string;
|
|
58
|
-
status: "queued";
|
|
59
|
-
}>;
|
|
60
|
-
enqueueFiles(files: EnqueueFileTranslationsData["body"]["files"], options: {
|
|
61
|
-
sourceLocale?: string;
|
|
62
|
-
targetLocales: string[];
|
|
63
|
-
modelProvider?: string;
|
|
64
|
-
force?: boolean;
|
|
65
|
-
}): Promise<{
|
|
66
|
-
jobData: {
|
|
67
|
-
[k: string]: any;
|
|
68
|
-
};
|
|
69
|
-
locales: string[];
|
|
70
|
-
message: string;
|
|
71
|
-
}>;
|
|
72
230
|
uploadSourceFiles(files: Array<{
|
|
73
231
|
source: UploadSourceFilesData["body"]["data"][number]["source"];
|
|
74
232
|
}>, options: {
|
|
75
233
|
sourceLocale: string;
|
|
234
|
+
timeout?: number;
|
|
76
235
|
}): Promise<{
|
|
77
236
|
uploadedFiles: {
|
|
78
237
|
branchId: string;
|
|
@@ -84,9 +243,19 @@ export declare function createGtApiAdapter(defaultConfig?: ApiClientConfig): {
|
|
|
84
243
|
locale?: string;
|
|
85
244
|
}[];
|
|
86
245
|
}>;
|
|
87
|
-
|
|
246
|
+
uploadFonts(fonts: UploadAssetsData["body"]["assets"], options?: {
|
|
247
|
+
timeout?: number;
|
|
248
|
+
}): Promise<{
|
|
249
|
+
assets: {
|
|
250
|
+
id: string;
|
|
251
|
+
assetKey: string;
|
|
252
|
+
fileName: string;
|
|
253
|
+
}[];
|
|
254
|
+
count: number;
|
|
255
|
+
}>;
|
|
88
256
|
uploadTranslations(files: UploadTranslationsData["body"]["data"], options: {
|
|
89
257
|
sourceLocale: string;
|
|
258
|
+
timeout?: number;
|
|
90
259
|
}): Promise<{
|
|
91
260
|
uploadedFiles: {
|
|
92
261
|
branchId: string;
|