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.
Files changed (152) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +2 -1
  3. package/dist/{ApiError-BcjcnTAr.cjs → ApiError-BCjEo_CM.cjs} +1 -1
  4. package/dist/{ApiError-BcjcnTAr.cjs.map → ApiError-BCjEo_CM.cjs.map} +1 -1
  5. package/dist/{ApiError-CUKcz3YS.mjs → ApiError-DxWKM0Xt.mjs} +1 -1
  6. package/dist/{ApiError-CUKcz3YS.mjs.map → ApiError-DxWKM0Xt.mjs.map} +1 -1
  7. package/dist/adapter/createGtApi.d.ts +196 -27
  8. package/dist/adapter/createGtApi.js +561 -117
  9. package/dist/adapter/modelProvider.d.ts +4 -0
  10. package/dist/adapter/modelProvider.js +6 -0
  11. package/dist/derive-Cv5_y8Tf.mjs +656 -0
  12. package/dist/derive-Cv5_y8Tf.mjs.map +1 -0
  13. package/dist/{derive-DBCCXTmL.d.cts → derive-J2NQLqZm.d.cts} +1 -1
  14. package/dist/derive-t_E3ftJN.cjs +733 -0
  15. package/dist/derive-t_E3ftJN.cjs.map +1 -0
  16. package/dist/diagnostics-CqAHg_Vc.d.cts +34 -0
  17. package/dist/diagnostics-DKA2SkZB.mjs +45 -0
  18. package/dist/diagnostics-DKA2SkZB.mjs.map +1 -0
  19. package/dist/{unwrapApiResult-BzGfPw75.mjs → diagnostics-DKtiPUvo.cjs} +12 -31
  20. package/dist/diagnostics-DKtiPUvo.cjs.map +1 -0
  21. package/dist/diagnostics-DYtVjOm5.d.mts +34 -0
  22. package/dist/diagnostics.cjs +4 -0
  23. package/dist/diagnostics.d.cts +2 -0
  24. package/dist/diagnostics.d.mts +2 -0
  25. package/dist/diagnostics.d.ts +1 -0
  26. package/dist/diagnostics.js +1 -0
  27. package/dist/diagnostics.mjs +2 -0
  28. package/dist/errors.cjs +1 -1
  29. package/dist/errors.mjs +1 -1
  30. package/dist/file-B37WkCqM.cjs.map +1 -1
  31. package/dist/file-Dga6cyM8.mjs.map +1 -1
  32. package/dist/{id-X2zyx5Jk.mjs → id-B2wA7-S-.mjs} +19 -3
  33. package/dist/id-B2wA7-S-.mjs.map +1 -0
  34. package/dist/{id-pdr3R1xs.cjs → id-DJ_59q21.cjs} +25 -3
  35. package/dist/id-DJ_59q21.cjs.map +1 -0
  36. package/dist/id.cjs +1 -1
  37. package/dist/id.d.cts +1 -1
  38. package/dist/id.d.mts +1 -1
  39. package/dist/id.mjs +1 -1
  40. package/dist/index.cjs +94 -753
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +14 -33
  43. package/dist/index.d.mts +13 -32
  44. package/dist/index.d.ts +20 -16
  45. package/dist/index.js +110 -98
  46. package/dist/index.mjs +88 -746
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/internal.cjs +16 -186
  49. package/dist/internal.cjs.map +1 -1
  50. package/dist/internal.d.cts +200 -62
  51. package/dist/internal.d.mts +199 -61
  52. package/dist/internal.d.ts +3 -1
  53. package/dist/internal.js +2 -1
  54. package/dist/internal.mjs +6 -178
  55. package/dist/internal.mjs.map +1 -1
  56. package/dist/logging/errors.d.ts +0 -1
  57. package/dist/logging/errors.js +0 -6
  58. package/dist/logging/logger.js +6 -4
  59. package/dist/runtime.cjs +580 -2
  60. package/dist/runtime.cjs.map +1 -0
  61. package/dist/runtime.d.cts +12 -6
  62. package/dist/runtime.d.mts +12 -6
  63. package/dist/runtime.d.ts +10 -4
  64. package/dist/runtime.js +10 -65
  65. package/dist/runtime.mjs +579 -1
  66. package/dist/runtime.mjs.map +1 -0
  67. package/dist/runtimeTranslate-CVw143pQ.mjs +506 -0
  68. package/dist/runtimeTranslate-CVw143pQ.mjs.map +1 -0
  69. package/dist/runtimeTranslate-DJioRjb6.cjs +601 -0
  70. package/dist/runtimeTranslate-DJioRjb6.cjs.map +1 -0
  71. package/dist/translate/awaitJobs.d.ts +2 -2
  72. package/dist/translate/awaitJobs.js +1 -156
  73. package/dist/translate/checkJobStatus.d.ts +2 -1
  74. package/dist/translate/checkJobStatus.js +1 -55
  75. package/dist/translate/createBranch.d.ts +2 -6
  76. package/dist/translate/createBranch.js +1 -53
  77. package/dist/translate/enqueueFiles.js +1 -95
  78. package/dist/translate/getProjectInfo.d.ts +2 -6
  79. package/dist/translate/getProjectInfo.js +1 -54
  80. package/dist/translate/processFileMoves.d.ts +3 -13
  81. package/dist/translate/processFileMoves.js +1 -90
  82. package/dist/translate/publishFiles.d.ts +3 -15
  83. package/dist/translate/publishFiles.js +1 -56
  84. package/dist/translate/queryBranchData.js +1 -53
  85. package/dist/translate/queryFileData.d.ts +3 -41
  86. package/dist/translate/queryFileData.js +1 -71
  87. package/dist/translate/runtimeTranslate.d.ts +6 -0
  88. package/dist/translate/runtimeTranslate.js +297 -0
  89. package/dist/translate/setupProject.d.ts +2 -6
  90. package/dist/translate/setupProject.js +1 -63
  91. package/dist/translate/submitUserEditDiffs.js +1 -68
  92. package/dist/translate/utils/fetchWithTimeout.js +19 -12
  93. package/dist/{types-bCr8pV1Z.d.cts → types-Si4UstLL.d.mts} +41 -165
  94. package/dist/types-dir/__tests__/runtimeTranslate.type-test.js +18 -0
  95. package/dist/types-dir/api/branch.d.ts +3 -9
  96. package/dist/types-dir/api/checkFileTranslations.d.ts +2 -22
  97. package/dist/types-dir/api/downloadFileBatch.d.ts +2 -7
  98. package/dist/types-dir/api/entry.d.ts +3 -8
  99. package/dist/types-dir/api/file.d.ts +2 -1
  100. package/dist/types-dir/api/json.d.ts +1 -4
  101. package/dist/types-dir/api/project.d.ts +2 -7
  102. package/dist/types-dir/api/uploadAssets.d.ts +3 -10
  103. package/dist/types-dir/api/uploadAssets.js +0 -4
  104. package/dist/types-dir/config.d.ts +1 -0
  105. package/dist/{types-Dp1drjxq.d.mts → types-yByDbKnV.d.cts} +41 -165
  106. package/dist/types.d.cts +2 -2
  107. package/dist/types.d.mts +2 -2
  108. package/dist/types.d.ts +26 -7
  109. package/package.json +15 -2
  110. package/dist/derive-2CDqwrvS.cjs +0 -303
  111. package/dist/derive-2CDqwrvS.cjs.map +0 -1
  112. package/dist/derive-CTzR56T_.mjs +0 -233
  113. package/dist/derive-CTzR56T_.mjs.map +0 -1
  114. package/dist/id-X2zyx5Jk.mjs.map +0 -1
  115. package/dist/id-pdr3R1xs.cjs.map +0 -1
  116. package/dist/isVariable-8-Wy5FnX.mjs +0 -20
  117. package/dist/isVariable-8-Wy5FnX.mjs.map +0 -1
  118. package/dist/isVariable-I3nllgeI.cjs +0 -25
  119. package/dist/isVariable-I3nllgeI.cjs.map +0 -1
  120. package/dist/projects/getProjectData.js +0 -87
  121. package/dist/runtime-Bcp4F2ME.mjs +0 -974
  122. package/dist/runtime-Bcp4F2ME.mjs.map +0 -1
  123. package/dist/runtime-C25lwh9m.cjs +0 -1027
  124. package/dist/runtime-C25lwh9m.cjs.map +0 -1
  125. package/dist/translate/api.d.ts +0 -4
  126. package/dist/translate/api.js +0 -4
  127. package/dist/translate/createTag.d.ts +0 -19
  128. package/dist/translate/createTag.js +0 -67
  129. package/dist/translate/downloadFileBatch.d.ts +0 -1
  130. package/dist/translate/downloadFileBatch.js +0 -80
  131. package/dist/translate/getOrphanedFiles.d.ts +0 -8
  132. package/dist/translate/getOrphanedFiles.js +0 -97
  133. package/dist/translate/querySourceFile.d.ts +0 -1
  134. package/dist/translate/querySourceFile.js +0 -67
  135. package/dist/translate/translateMany.d.ts +0 -1
  136. package/dist/translate/translateMany.js +0 -124
  137. package/dist/translate/uploadFonts.d.ts +0 -1
  138. package/dist/translate/uploadFonts.js +0 -74
  139. package/dist/translate/uploadSourceFiles.d.ts +0 -1
  140. package/dist/translate/uploadSourceFiles.js +0 -90
  141. package/dist/translate/uploadTranslations.d.ts +0 -1
  142. package/dist/translate/uploadTranslations.js +0 -106
  143. package/dist/translate/utils/apiRequest.d.ts +0 -1
  144. package/dist/translate/utils/apiRequest.js +0 -167
  145. package/dist/translate/utils/generateRequestHeaders.d.ts +0 -2
  146. package/dist/translate/utils/generateRequestHeaders.js +0 -21
  147. package/dist/translate/utils/handleFetchError.d.ts +0 -1
  148. package/dist/translate/utils/handleFetchError.js +0 -12
  149. package/dist/unwrapApiResult-BzGfPw75.mjs.map +0 -1
  150. package/dist/unwrapApiResult-Dv6Mfw_K.cjs +0 -134
  151. package/dist/unwrapApiResult-Dv6Mfw_K.cjs.map +0 -1
  152. /package/dist/{projects/getProjectData.d.ts → types-dir/__tests__/runtimeTranslate.type-test.d.ts} +0 -0
@@ -1,63 +1 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { apiRequest } from './utils/apiRequest';
38
- /**
39
- * @internal
40
- * Enqueues files for project setup the General Translation API.
41
- * @param files - References of files to translate (file content already uploaded)
42
- * @param config - The configuration for the API call.
43
- * @param timeoutMS - The timeout in milliseconds
44
- * @returns The result of the API call.
45
- */
46
- export function _setupProject(files, config, options) {
47
- return __awaiter(this, void 0, void 0, function () {
48
- return __generator(this, function (_a) {
49
- return [2 /*return*/, apiRequest(config, '/v2/project/setup/generate', {
50
- body: {
51
- files: files.map(function (f) { return ({
52
- branchId: f.branchId,
53
- fileId: f.fileId,
54
- versionId: f.versionId,
55
- }); }),
56
- locales: options === null || options === void 0 ? void 0 : options.locales,
57
- force: options === null || options === void 0 ? void 0 : options.force,
58
- },
59
- timeout: options === null || options === void 0 ? void 0 : options.timeoutMs,
60
- })];
61
- });
62
- });
63
- }
1
+ export {};
@@ -1,68 +1 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { apiRequest } from './utils/apiRequest';
38
- import { processBatches } from './utils/batch';
39
- /**
40
- * @internal
41
- * Submits user edit diffs so the service can learn/persist user-intended rules.
42
- */
43
- export function _submitUserEditDiffs(payload_1, config_1) {
44
- return __awaiter(this, arguments, void 0, function (payload, config, options) {
45
- var _this = this;
46
- if (options === void 0) { options = {}; }
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0: return [4 /*yield*/, processBatches(payload.diffs, function (batch) { return __awaiter(_this, void 0, void 0, function () {
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0: return [4 /*yield*/, apiRequest(config, '/v2/project/files/diffs', {
53
- body: { diffs: batch },
54
- timeout: options.timeout,
55
- })];
56
- case 1:
57
- _a.sent();
58
- return [2 /*return*/, [{ success: true }]];
59
- }
60
- });
61
- }); }, { batchSize: 100 })];
62
- case 1:
63
- _a.sent();
64
- return [2 /*return*/, { success: true }];
65
- }
66
- });
67
- });
68
- }
1
+ export {};
@@ -50,16 +50,20 @@ import { defaultTimeout } from '../../settings/settings';
50
50
  /**
51
51
  * @internal
52
52
  *
53
- * Wraps the fetch function with a timeout.
53
+ * Wraps a fetch implementation with the runtime translation timeout.
54
54
  *
55
55
  * @param url - The URL to fetch.
56
56
  * @param options - The options to pass to the fetch function.
57
- * @param timeout - The timeout in milliseconds.
57
+ * @param timeoutMs - The timeout in milliseconds. Omitted selects `defaultTimeout`,
58
+ * `0` is a literal zero, and `false` disables the runtime-owned timer.
59
+ * @param fetchImplementation - The fetch implementation to call. Defaults to global fetch.
58
60
  * @returns The response from the fetch function.
59
61
  */
60
- export function fetchWithTimeout(url, options, timeout) {
61
- return __awaiter(this, void 0, void 0, function () {
62
- var controller, signals, signal, timeoutId, response, error_1;
62
+ export function fetchWithTimeout(url_1, options_1) {
63
+ return __awaiter(this, arguments, void 0, function (url, options, timeoutMs, fetchImplementation) {
64
+ var controller, signals, signal, timedOut, timeoutId, response, error_1;
65
+ if (timeoutMs === void 0) { timeoutMs = defaultTimeout; }
66
+ if (fetchImplementation === void 0) { fetchImplementation = globalThis.fetch; }
63
67
  return __generator(this, function (_a) {
64
68
  switch (_a.label) {
65
69
  case 0:
@@ -70,21 +74,24 @@ export function fetchWithTimeout(url, options, timeout) {
70
74
  if (url instanceof Request)
71
75
  signals.push(url.signal);
72
76
  signal = AbortSignal.any(signals);
73
- timeout = timeout ? timeout : defaultTimeout;
74
- timeoutId = timeout
75
- ? setTimeout(function () { return controller.abort(); }, timeout)
76
- : null;
77
+ timedOut = false;
78
+ timeoutId = timeoutMs === false
79
+ ? null
80
+ : setTimeout(function () {
81
+ timedOut = !signal.aborted;
82
+ controller.abort();
83
+ }, timeoutMs);
77
84
  _a.label = 1;
78
85
  case 1:
79
86
  _a.trys.push([1, 3, 4, 5]);
80
- return [4 /*yield*/, fetch(url, __assign(__assign({}, options), { signal: signal }))];
87
+ return [4 /*yield*/, fetchImplementation(url, __assign(__assign({}, options), { signal: signal }))];
81
88
  case 2:
82
89
  response = _a.sent();
83
90
  return [2 /*return*/, response];
84
91
  case 3:
85
92
  error_1 = _a.sent();
86
- if (error_1 instanceof Error && error_1.name === 'AbortError') {
87
- throw translationTimeoutError(timeout);
93
+ if (timedOut && timeoutMs !== false && error_1 === controller.signal.reason) {
94
+ throw translationTimeoutError(timeoutMs);
88
95
  }
89
96
  throw error_1;
90
97
  case 4:
@@ -1,14 +1,8 @@
1
- import * as _$_generaltranslation_api0 from "@generaltranslation/api";
2
- import { RuntimeFileFormat, RuntimeFileFormat as RuntimeFileFormat$1 } from "@generaltranslation/api";
1
+ import { ApiClientConfig, Branch, CreateTagData, CreateTagResponse, DownloadFilesData, FileFormat, GenerateProjectContextResponse, GetBranchInfoResponse, GetFileInfoData, GetFileInfoResponse, GetOrphanedFilesResponse, GetTranslationJobInfoResponse, GetTranslationStatusResponse, JsonObject, JsonValue, ProcessFileMovesData, ProcessFileMovesResponse, PublishFilesData, PublishFilesResponse, RuntimeFileFormat, RuntimeFileFormat as RuntimeFileFormat$1, TranslateData } from "@generaltranslation/api";
3
2
  import { Content, CustomMapping, CustomMapping as CustomMapping$1, CustomRegionMapping as CustomRegionMapping$1, CutoffFormatOptions as CutoffFormatOptions$1, DataFormat, DataFormat as DataFormat$1, FormatVariables as FormatVariables$1, GTProp, HTML_CONTENT_PROPS, HtmlContentPropKeysRecord, HtmlContentPropValuesRecord, I18nextMessage, I18nextMessage as I18nextMessage$1, IcuMessage, IcuMessage as IcuMessage$1, JsxChild, JsxChildren, JsxChildren as JsxChildren$1, JsxElement, LocaleProperties as LocaleProperties$1, StringContent, StringFormat as StringFormat$1, StringMessage, StringMessage as StringMessage$1, Variable, VariableType } from "@generaltranslation/format/types";
4
3
 
5
4
  //#region src/types-dir/api/entry.d.ts
6
- /**
7
- * ActionType is the type of action to perform on the request.
8
- *
9
- * @param fast - The fast action type (mini model).
10
- */
11
- type ActionType = 'fast';
5
+ type ActionType = NonNullable<NonNullable<TranslateData['body']['requests'][string]['metadata']>['actionType']>;
12
6
  /**
13
7
  * EntryMetadata is the metadata for a GTRequest.
14
8
  *
@@ -110,7 +104,7 @@ type GTConfig = {
110
104
  customMapping?: CustomMapping;
111
105
  enableI18n?: boolean; /** Enable framework-provided locale path routing when supported. */
112
106
  localeRouting?: boolean;
113
- projectId?: string;
107
+ projectId?: string; /** @deprecated Pass the key as `apiKey`; there is one kind of API key. */
114
108
  devApiKey?: string;
115
109
  apiKey?: string;
116
110
  _versionId?: string;
@@ -140,10 +134,6 @@ type GTConfig = {
140
134
  //#endregion
141
135
  //#region src/types-dir/api/json.d.ts
142
136
  type JsonPrimitive = string | number | boolean | null;
143
- type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
144
- type JsonObject = {
145
- [key: string]: JsonValue;
146
- };
147
137
  //#endregion
148
138
  //#region src/types-dir/api/checkFileTranslations.d.ts
149
139
  type CheckFileTranslationsOptions = {
@@ -154,28 +144,7 @@ type FileQuery = {
154
144
  branchId?: string;
155
145
  versionId?: string;
156
146
  };
157
- type FileQueryResult = {
158
- sourceFile: {
159
- id: string;
160
- fileId: string;
161
- versionId: string;
162
- sourceLocale: string;
163
- fileName: string;
164
- fileFormat: string;
165
- dataFormat: string | null;
166
- createdAt: string;
167
- updatedAt: string;
168
- locales: string[];
169
- };
170
- translations: {
171
- locale: string;
172
- completedAt: string | null;
173
- approvedAt: string | null;
174
- publishedAt: string | null;
175
- createdAt: string | null;
176
- updatedAt: string | null;
177
- }[];
178
- };
147
+ type FileQueryResult = GetTranslationStatusResponse;
179
148
  //#endregion
180
149
  //#region src/types-dir/api/enqueueFiles.d.ts
181
150
  type UpdateMetadata = {
@@ -227,7 +196,6 @@ type EnqueueFilesResult = {
227
196
  };
228
197
  //#endregion
229
198
  //#region src/types-dir/api/file.d.ts
230
- type FileFormat = _$_generaltranslation_api0.FileFormat;
231
199
  /**
232
200
  * File formats whose content travels through the pipeline already
233
201
  * base64-encoded, so the usual UTF-8 encode/decode steps are skipped and the
@@ -299,13 +267,7 @@ type FileReferenceIds = Omit<FileReference, 'branchId' | 'fileName' | 'fileForma
299
267
  };
300
268
  //#endregion
301
269
  //#region src/types-dir/api/downloadFileBatch.d.ts
302
- type DownloadFileBatchRequest = {
303
- fileId: string;
304
- branchId?: string;
305
- versionId?: string;
306
- locale?: string;
307
- useLatestAvailableVersion?: boolean;
308
- }[];
270
+ type DownloadFileBatchRequest = DownloadFilesData['body'];
309
271
  type DownloadFileBatchOptions = {
310
272
  timeout?: number;
311
273
  };
@@ -334,35 +296,9 @@ type EnqueueFilesOptions = {
334
296
  timeout?: number;
335
297
  };
336
298
  //#endregion
337
- //#region src/translate/createTag.d.ts
338
- type CreateTagFileReference = {
339
- fileId: string;
340
- versionId: string;
341
- branchId: string;
342
- };
343
- type CreateTagOptions = {
344
- tagId: string;
345
- files: CreateTagFileReference[];
346
- message?: string;
347
- };
348
- type CreateTagResult = {
349
- tag: {
350
- id: string;
351
- tagId: string;
352
- message: string | null;
353
- createdAt: string;
354
- updatedAt: string;
355
- };
356
- };
357
- //#endregion
358
299
  //#region src/translate/setupProject.d.ts
359
300
  type SetupProjectFileReference = Pick<FileReference, 'branchId' | 'fileId' | 'versionId'>;
360
- type SetupProjectResult = {
361
- setupJobId: string;
362
- status: 'queued';
363
- } | {
364
- status: 'completed';
365
- };
301
+ type SetupProjectResult = GenerateProjectContextResponse;
366
302
  type SetupProjectOptions = {
367
303
  force?: boolean;
368
304
  locales?: string[];
@@ -413,23 +349,10 @@ type UploadFilesResponse = {
413
349
  };
414
350
  //#endregion
415
351
  //#region src/translate/publishFiles.d.ts
416
- type PublishFileEntry = {
417
- fileId: string;
418
- versionId: string;
419
- branchId?: string;
420
- publish: boolean;
352
+ type PublishFileEntry = PublishFilesData['body']['files'][number] & {
421
353
  fileName?: string;
422
354
  };
423
- type PublishFilesResult = {
424
- results: {
425
- fileId: string;
426
- versionId: string;
427
- locale?: string;
428
- branchId: string;
429
- success: boolean;
430
- error?: string;
431
- }[];
432
- };
355
+ type PublishFilesResult = PublishFilesResponse;
433
356
  //#endregion
434
357
  //#region src/types-dir/api/downloadFile.d.ts
435
358
  type DownloadFileOptions = {
@@ -478,15 +401,8 @@ type TranslationResult = RequestSuccess | TranslationError;
478
401
  type TranslateManyResult = TranslationResult[];
479
402
  //#endregion
480
403
  //#region src/types-dir/api/branch.d.ts
481
- type BranchDataResult = {
482
- branches: {
483
- id: string;
484
- name: string;
485
- }[];
486
- defaultBranch: {
487
- id: string;
488
- name: string;
489
- } | null;
404
+ type BranchDataResult = Pick<GetBranchInfoResponse, 'branches'> & {
405
+ defaultBranch: Branch | null;
490
406
  };
491
407
  //#endregion
492
408
  //#region src/translate/queryBranchData.d.ts
@@ -495,72 +411,12 @@ type BranchQuery = {
495
411
  };
496
412
  //#endregion
497
413
  //#region src/translate/queryFileData.d.ts
498
- type FileDataQuery = {
499
- sourceFiles?: {
500
- fileId: string;
501
- versionId: string;
502
- branchId: string;
503
- }[];
504
- translatedFiles?: {
505
- fileId: string;
506
- versionId: string;
507
- branchId: string;
508
- locale: string;
509
- }[];
510
- };
511
- type FileDataResult = {
512
- sourceFiles?: {
513
- branchId: string;
514
- fileId: string;
515
- versionId: string;
516
- fileName: string;
517
- fileFormat: string;
518
- dataFormat: string | null;
519
- createdAt: string;
520
- updatedAt: string;
521
- publishedAt: string | null;
522
- locales: string[];
523
- sourceLocale: string;
524
- }[];
525
- translatedFiles?: {
526
- branchId: string;
527
- fileId: string;
528
- versionId: string;
529
- fileFormat: string;
530
- dataFormat: string | null;
531
- createdAt: string;
532
- updatedAt: string;
533
- approvedAt: string | null;
534
- publishedAt: string | null;
535
- completedAt: string | null;
536
- locale: string;
537
- }[];
538
- };
539
- //#endregion
540
- //#region src/translate/getOrphanedFiles.d.ts
541
- type OrphanedFile = {
542
- fileId: string;
543
- versionId: string;
544
- fileName: string;
545
- };
546
- type GetOrphanedFilesResult = {
547
- orphanedFiles: OrphanedFile[];
548
- };
414
+ type FileDataQuery = GetFileInfoData['body'];
415
+ type FileDataResult = Partial<GetFileInfoResponse>;
549
416
  //#endregion
550
417
  //#region src/translate/processFileMoves.d.ts
551
- type MoveMapping = {
552
- oldFileId: string;
553
- newFileId: string;
554
- newFileName: string;
555
- };
556
- type MoveResult = {
557
- oldFileId: string;
558
- newFileId: string;
559
- success: boolean;
560
- newSourceFileId?: string;
561
- clonedTranslationsCount?: number;
562
- error?: string;
563
- };
418
+ type MoveMapping = ProcessFileMovesData['body']['moves'][number];
419
+ type MoveResult = ProcessFileMovesResponse['results'][number];
564
420
  type ProcessMovesResponse = {
565
421
  results: MoveResult[];
566
422
  summary: {
@@ -575,7 +431,7 @@ type ProcessMovesOptions = {
575
431
  };
576
432
  //#endregion
577
433
  //#region src/translate/checkJobStatus.d.ts
578
- type JobStatus = 'queued' | 'processing' | 'completed' | 'failed' | 'unknown';
434
+ type JobStatus = GetTranslationJobInfoResponse[number]['status'];
579
435
  type CheckJobStatusResult = {
580
436
  jobId: string;
581
437
  status: JobStatus;
@@ -586,7 +442,7 @@ type CheckJobStatusResult = {
586
442
  //#endregion
587
443
  //#region src/translate/awaitJobs.d.ts
588
444
  type AwaitJobsOptions$1 = {
589
- /** Polling interval in seconds. Defaults to 5. */pollingIntervalSeconds?: number; /** Timeout in seconds. Defaults to 600 (10 minutes). If reached, resolves with whatever status is current. */
445
+ /** Polling interval in seconds. Defaults to 5. */pollingIntervalSeconds?: number; /** Timeout in seconds. Defaults to 600 (10 minutes). */
590
446
  timeoutSeconds?: number;
591
447
  };
592
448
  type JobResult = {
@@ -626,6 +482,10 @@ type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'curren
626
482
  type InjectionType = 'automatic' | 'manual';
627
483
  //#endregion
628
484
  //#region src/types.d.ts
485
+ type CreateTagOptions = CreateTagData['body'];
486
+ type CreateTagResult = CreateTagResponse;
487
+ type OrphanedFile = GetOrphanedFilesResponse['orphanedFiles'][number];
488
+ type GetOrphanedFilesResult = GetOrphanedFilesResponse;
629
489
  type Metadata = {
630
490
  maxChars?: number;
631
491
  context?: string;
@@ -643,14 +503,30 @@ type Metadata = {
643
503
  * TranslationRequestConfig is used to configure the translation request.
644
504
  *
645
505
  * @param projectId - The project ID of the translation request.
646
- * @param baseUrl - The base URL of the translation request.
506
+ * @param baseUrl - The base URL of the translation request. Defaults to the runtime API URL.
647
507
  * @param apiKey - The API key of the translation request.
508
+ * @param apiVersion - The `gt-api-version` header value. Defaults to the SDK's current version.
509
+ * @param fetch - A custom fetch implementation. Timeout and error adaptation still wrap it.
510
+ * @param timeoutMs - Request timeout. Omitted selects the runtime default, `0` is a
511
+ * literal zero, and `false` disables the runtime-owned timer (a custom fetch may still cancel).
512
+ * @param userTokenProvider - Lazily supplies a user access token when no API key is set.
648
513
  */
649
- type TranslationRequestConfig = {
514
+ type TranslationRequestConfig = Pick<ApiClientConfig, 'apiKey' | 'apiVersion' | 'fetch' | 'timeoutMs' | 'userTokenProvider'> & {
650
515
  projectId: string;
651
516
  baseUrl?: string;
652
- apiKey?: string;
517
+ };
518
+ /**
519
+ * TranslateConfig is the explicit configuration the shared translation helpers
520
+ * receive from the class and the tooling adapter. Nothing is read from the
521
+ * environment; a missing API key/provider or project ID fails before any
522
+ * request is sent.
523
+ *
524
+ * @param customMapping - Custom locale mapping used to canonicalize request locales.
525
+ */
526
+ type TranslateConfig = Omit<TranslationRequestConfig, 'projectId'> & {
527
+ projectId?: string;
528
+ customMapping?: CustomMapping;
653
529
  };
654
530
  //#endregion
655
- export { FileUpload as $, SubmitUserEditDiffsPayload as A, HashMetadata as At, GetOrphanedFilesResult as B, Variable as C, JsonObject as Ct, TransformationPrefix as D, GTFilesConfig as Dt, Transformation as E, GTConfig as Et, JobStatus as F, TranslateOptions as Ft, BranchDataResult as G, FileDataQuery as H, MoveMapping as I, TranslationResult as J, TranslateManyResult as K, MoveResult as L, AwaitJobsResult as M, EntryMetadata as Mt, JobResult as N, RuntimeTranslateManyOptions as Nt, VariableTransformationSuffix as O, GTOutputFileConfig as Ot, CheckJobStatusResult as P, TranslateManyEntry as Pt, PublishFilesResult as Q, ProcessMovesOptions as R, TranslationRequestConfig as S, FileQueryResult as St, InjectionType as T, JsonValue as Tt, FileDataResult as U, OrphanedFile as V, BranchQuery as W, DownloadFileOptions as X, TranslationResultReference as Y, PublishFileEntry as Z, Metadata as _, isBinaryFileFormat as _t, DataFormat$1 as a, CreateTagOptions as at, StringFormat$1 as b, CheckFileTranslationsOptions as bt, HTML_CONTENT_PROPS as c, DownloadFileBatchOptions as ct, I18nextMessage$1 as d, DownloadedFile as dt, UploadFilesOptions as et, IcuMessage$1 as f, BINARY_FILE_FORMATS as ft, LocaleProperties$1 as g, FileToUpload as gt, JsxElement as h, FileReferenceIds as ht, CutoffFormatOptions$1 as i, SetupProjectResult as it, AwaitJobsOptions$1 as j, ActionType as jt, SubmitUserEditDiff as k, GTParsingFlags as kt, HtmlContentPropKeysRecord as l, DownloadFileBatchRequest as lt, JsxChildren$1 as m, FileReference as mt, CustomMapping$1 as n, SetupProjectFileReference as nt, FormatVariables$1 as o, CreateTagResult as ot, JsxChild as p, FileFormat as pt, TranslationError as q, CustomRegionMapping$1 as r, SetupProjectOptions as rt, GTProp as s, EnqueueFilesOptions as st, Content as t, UploadFilesResponse as tt, HtmlContentPropValuesRecord as u, DownloadFileBatchResult as ut, RuntimeFileFormat$1 as v, EnqueueFilesResult as vt, VariableType as w, JsonPrimitive as wt, StringMessage$1 as x, FileQuery as xt, StringContent as y, Updates as yt, ProcessMovesResponse as z };
656
- //# sourceMappingURL=types-bCr8pV1Z.d.cts.map
531
+ export { DownloadFileOptions as $, InjectionType as A, GTParsingFlags as At, JobStatus as B, StringContent as C, FileQueryResult as Ct, TranslationRequestConfig as D, GTConfig as Dt, TranslateConfig as E, JsonValue as Et, SubmitUserEditDiffsPayload as F, TranslateManyEntry as Ft, FileDataQuery as G, MoveResult as H, AwaitJobsOptions$1 as I, TranslateOptions as It, BranchDataResult as J, FileDataResult as K, AwaitJobsResult as L, TransformationPrefix as M, ActionType as Mt, VariableTransformationSuffix as N, EntryMetadata as Nt, Variable as O, GTFilesConfig as Ot, SubmitUserEditDiff as P, RuntimeTranslateManyOptions as Pt, TranslationResultReference as Q, JobResult as R, RuntimeFileFormat$1 as S, FileQuery as St, StringMessage$1 as T, JsonPrimitive as Tt, ProcessMovesOptions as U, MoveMapping as V, ProcessMovesResponse as W, TranslationError as X, TranslateManyResult as Y, TranslationResult as Z, JsxChildren$1 as _, FileToUpload as _t, CustomRegionMapping$1 as a, SetupProjectFileReference as at, Metadata as b, Updates as bt, FormatVariables$1 as c, EnqueueFilesOptions as ct, HTML_CONTENT_PROPS as d, DownloadFileBatchResult as dt, PublishFileEntry as et, HtmlContentPropKeysRecord as f, DownloadedFile as ft, JsxChild as g, FileReferenceIds as gt, IcuMessage$1 as h, FileReference as ht, CustomMapping$1 as i, UploadFilesResponse as it, Transformation as j, HashMetadata as jt, VariableType as k, GTOutputFileConfig as kt, GTProp as l, DownloadFileBatchOptions as lt, I18nextMessage$1 as m, FileFormat as mt, CreateTagOptions as n, FileUpload as nt, CutoffFormatOptions$1 as o, SetupProjectOptions as ot, HtmlContentPropValuesRecord as p, BINARY_FILE_FORMATS as pt, BranchQuery as q, CreateTagResult as r, UploadFilesOptions as rt, DataFormat$1 as s, SetupProjectResult as st, Content as t, PublishFilesResult as tt, GetOrphanedFilesResult as u, DownloadFileBatchRequest as ut, JsxElement as v, isBinaryFileFormat as vt, StringFormat$1 as w, JsonObject as wt, OrphanedFile as x, CheckFileTranslationsOptions as xt, LocaleProperties$1 as y, EnqueueFilesResult as yt, CheckJobStatusResult as z };
532
+ //# sourceMappingURL=types-Si4UstLL.d.mts.map
@@ -0,0 +1,18 @@
1
+ // Array input infers an ordered array; record input infers a keyed record.
2
+ var adapterArray = adapter.translateMany(['Hello'], { targetLocale: 'es' });
3
+ var adapterRecord = adapter.translateMany({ key: 'Hello' }, 'es', false);
4
+ // timeoutMs is the single new spelling; `false` disables the runtime timer.
5
+ var transport = {
6
+ projectId: 'project',
7
+ timeoutMs: false,
8
+ fetch: globalThis.fetch,
9
+ apiVersion: '2026-03-06.v1',
10
+ };
11
+ void transport;
12
+ var invalidTimeoutSpelling = {
13
+ projectId: 'project',
14
+ // @ts-expect-error the new configuration contract uses timeoutMs.
15
+ timeout: 1000,
16
+ };
17
+ void invalidTimeoutSpelling;
18
+ export {};
@@ -1,10 +1,4 @@
1
- export type BranchDataResult = {
2
- branches: {
3
- id: string;
4
- name: string;
5
- }[];
6
- defaultBranch: {
7
- id: string;
8
- name: string;
9
- } | null;
1
+ import type { Branch, GetBranchInfoResponse } from '@generaltranslation/api';
2
+ export type BranchDataResult = Pick<GetBranchInfoResponse, 'branches'> & {
3
+ defaultBranch: Branch | null;
10
4
  };
@@ -1,3 +1,4 @@
1
+ import type { GetTranslationStatusResponse } from '@generaltranslation/api';
1
2
  export type CheckFileTranslationsOptions = {
2
3
  timeout?: number;
3
4
  };
@@ -6,25 +7,4 @@ export type FileQuery = {
6
7
  branchId?: string;
7
8
  versionId?: string;
8
9
  };
9
- export type FileQueryResult = {
10
- sourceFile: {
11
- id: string;
12
- fileId: string;
13
- versionId: string;
14
- sourceLocale: string;
15
- fileName: string;
16
- fileFormat: string;
17
- dataFormat: string | null;
18
- createdAt: string;
19
- updatedAt: string;
20
- locales: string[];
21
- };
22
- translations: {
23
- locale: string;
24
- completedAt: string | null;
25
- approvedAt: string | null;
26
- publishedAt: string | null;
27
- createdAt: string | null;
28
- updatedAt: string | null;
29
- }[];
30
- };
10
+ export type FileQueryResult = GetTranslationStatusResponse;
@@ -1,12 +1,7 @@
1
+ import type { DownloadFilesData } from '@generaltranslation/api';
1
2
  import { FileFormat } from './file';
2
3
  import type { JsonObject } from './json';
3
- export type DownloadFileBatchRequest = {
4
- fileId: string;
5
- branchId?: string;
6
- versionId?: string;
7
- locale?: string;
8
- useLatestAvailableVersion?: boolean;
9
- }[];
4
+ export type DownloadFileBatchRequest = DownloadFilesData['body'];
10
5
  export type DownloadFileBatchOptions = {
11
6
  timeout?: number;
12
7
  };
@@ -1,11 +1,6 @@
1
- import type { RuntimeFileFormat } from '@generaltranslation/api';
2
- import { Content, DataFormat } from '../../types';
3
- /**
4
- * ActionType is the type of action to perform on the request.
5
- *
6
- * @param fast - The fast action type (mini model).
7
- */
8
- export type ActionType = 'fast';
1
+ import type { RuntimeFileFormat, TranslateData } from '@generaltranslation/api';
2
+ import type { Content, DataFormat } from '../../types';
3
+ export type ActionType = NonNullable<NonNullable<TranslateData['body']['requests'][string]['metadata']>['actionType']>;
9
4
  /**
10
5
  * EntryMetadata is the metadata for a GTRequest.
11
6
  *
@@ -1,7 +1,8 @@
1
+ import type { FileFormat } from '@generaltranslation/api';
1
2
  import type { DataFormat } from '@generaltranslation/format/types';
2
3
  import { Updates } from './enqueueFiles';
3
4
  import type { JsonObject } from './json';
4
- export type FileFormat = import('@generaltranslation/api').FileFormat;
5
+ export type { FileFormat };
5
6
  /**
6
7
  * File formats whose content travels through the pipeline already
7
8
  * base64-encoded, so the usual UTF-8 encode/decode steps are skipped and the
@@ -1,5 +1,2 @@
1
+ export type { JsonObject, JsonValue } from '@generaltranslation/api';
1
2
  export type JsonPrimitive = string | number | boolean | null;
2
- export type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
3
- export type JsonObject = {
4
- [key: string]: JsonValue;
5
- };
@@ -1,7 +1,2 @@
1
- export type ProjectData = {
2
- id: string;
3
- name: string;
4
- orgId: string;
5
- defaultLocale: string;
6
- currentLocales: string[];
7
- };
1
+ import type { GetProjectInfoResponse } from '@generaltranslation/api';
2
+ export type ProjectData = Omit<GetProjectInfoResponse, 'autoApprove'>;
@@ -1,3 +1,4 @@
1
+ import type { UploadAssetsResponse } from '@generaltranslation/api';
1
2
  export type AssetUpload = {
2
3
  assetType: 'FONT';
3
4
  content: string;
@@ -6,13 +7,5 @@ export type AssetUpload = {
6
7
  export type UploadAssetsOptions = {
7
8
  timeout?: number;
8
9
  };
9
- export type UploadedAsset = {
10
- id: string;
11
- assetKey: string;
12
- fileName: string;
13
- deduped: boolean;
14
- };
15
- export type UploadAssetsResponse = {
16
- assets: UploadedAsset[];
17
- count: number;
18
- };
10
+ export type UploadedAsset = UploadAssetsResponse['assets'][number];
11
+ export type { UploadAssetsResponse };