generaltranslation 8.2.6 → 8.2.7

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 (162) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/ApiError-4zIP-twr.cjs +24 -0
  3. package/dist/ApiError-4zIP-twr.cjs.map +1 -0
  4. package/dist/ApiError-Bv7vlzyQ.mjs +19 -0
  5. package/dist/ApiError-Bv7vlzyQ.mjs.map +1 -0
  6. package/dist/errors.cjs +3 -0
  7. package/dist/errors.d.cts +11 -0
  8. package/dist/errors.d.mts +11 -0
  9. package/dist/errors.mjs +2 -0
  10. package/dist/id-CPbVYREY.mjs +74 -0
  11. package/dist/id-CPbVYREY.mjs.map +1 -0
  12. package/dist/id-VXBgyXu2.cjs +89 -0
  13. package/dist/id-VXBgyXu2.cjs.map +1 -0
  14. package/dist/id.cjs +5 -0
  15. package/dist/{id/hashSource.d.ts → id.d.cts} +20 -5
  16. package/dist/id.d.mts +40 -0
  17. package/dist/id.mjs +2 -0
  18. package/dist/index.cjs +3354 -0
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.cts +1157 -0
  21. package/dist/index.d.mts +1157 -0
  22. package/dist/index.mjs +3305 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/dist/internal-CTeI8uLd.mjs +774 -0
  25. package/dist/internal-CTeI8uLd.mjs.map +1 -0
  26. package/dist/internal-PCKq4YMW.cjs +1012 -0
  27. package/dist/internal-PCKq4YMW.cjs.map +1 -0
  28. package/dist/internal.cjs +43 -0
  29. package/dist/{internal.d.ts → internal.d.cts} +62 -114
  30. package/dist/internal.d.mts +242 -0
  31. package/dist/internal.mjs +3 -0
  32. package/dist/sha2-DKowBr6H.cjs +747 -0
  33. package/dist/sha2-DKowBr6H.cjs.map +1 -0
  34. package/dist/stableStringify-DgDlE_pD.mjs +53 -0
  35. package/dist/stableStringify-DgDlE_pD.mjs.map +1 -0
  36. package/dist/types-D2fTTTvZ.d.cts +737 -0
  37. package/dist/types-fUW4_Ole.d.mts +737 -0
  38. package/dist/types.cjs +17 -0
  39. package/dist/types.cjs.map +1 -0
  40. package/dist/types.d.cts +2 -0
  41. package/dist/types.d.mts +2 -0
  42. package/dist/types.mjs +16 -0
  43. package/dist/types.mjs.map +1 -0
  44. package/package.json +52 -32
  45. package/dist/backwards-compatability/dataConversion.d.ts +0 -23
  46. package/dist/backwards-compatability/oldHashJsxChildren.d.ts +0 -23
  47. package/dist/backwards-compatability/oldTypes.d.ts +0 -21
  48. package/dist/backwards-compatability/typeChecking.d.ts +0 -21
  49. package/dist/cache/IntlCache.d.ts +0 -26
  50. package/dist/cache/types.d.ts +0 -32
  51. package/dist/derive/condenseVars.d.ts +0 -7
  52. package/dist/derive/declareVar.d.ts +0 -26
  53. package/dist/derive/decodeVars.d.ts +0 -9
  54. package/dist/derive/derive.d.ts +0 -38
  55. package/dist/derive/extractVars.d.ts +0 -9
  56. package/dist/derive/index.d.ts +0 -7
  57. package/dist/derive/indexVars.d.ts +0 -6
  58. package/dist/derive/utils/constants.d.ts +0 -2
  59. package/dist/derive/utils/regex.d.ts +0 -2
  60. package/dist/derive/utils/sanitizeVar.d.ts +0 -12
  61. package/dist/derive/utils/traverseHelpers.d.ts +0 -4
  62. package/dist/derive/utils/traverseIcu.d.ts +0 -20
  63. package/dist/derive/utils/types.d.ts +0 -23
  64. package/dist/errors/ApiError.d.ts +0 -7
  65. package/dist/errors/formattingErrors.d.ts +0 -1
  66. package/dist/errors.cjs.min.cjs +0 -2
  67. package/dist/errors.cjs.min.cjs.map +0 -1
  68. package/dist/errors.d.ts +0 -9
  69. package/dist/errors.esm.min.mjs +0 -2
  70. package/dist/errors.esm.min.mjs.map +0 -1
  71. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
  72. package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
  73. package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
  74. package/dist/formatting/format.d.ts +0 -1
  75. package/dist/id/hashTemplate.d.ts +0 -4
  76. package/dist/id/types.d.ts +0 -7
  77. package/dist/id.cjs.min.cjs +0 -2
  78. package/dist/id.cjs.min.cjs.map +0 -1
  79. package/dist/id.d.ts +0 -86
  80. package/dist/id.esm.min.mjs +0 -2
  81. package/dist/id.esm.min.mjs.map +0 -1
  82. package/dist/index.cjs.min.cjs +0 -2
  83. package/dist/index.cjs.min.cjs.map +0 -1
  84. package/dist/index.d.ts +0 -1627
  85. package/dist/index.esm.min.mjs +0 -2
  86. package/dist/index.esm.min.mjs.map +0 -1
  87. package/dist/internal.cjs.min.cjs +0 -2
  88. package/dist/internal.cjs.min.cjs.map +0 -1
  89. package/dist/internal.esm.min.mjs +0 -2
  90. package/dist/internal.esm.min.mjs.map +0 -1
  91. package/dist/locales/customLocaleMapping.d.ts +0 -11
  92. package/dist/locales/determineLocale.d.ts +0 -1
  93. package/dist/locales/getLocaleDirection.d.ts +0 -1
  94. package/dist/locales/getLocaleEmoji.d.ts +0 -2
  95. package/dist/locales/getLocaleName.d.ts +0 -1
  96. package/dist/locales/getLocaleProperties.d.ts +0 -32
  97. package/dist/locales/getPluralForm.d.ts +0 -9
  98. package/dist/locales/getRegionProperties.d.ts +0 -7
  99. package/dist/locales/isSameDialect.d.ts +0 -1
  100. package/dist/locales/isSameLanguage.d.ts +0 -1
  101. package/dist/locales/isSupersetLocale.d.ts +0 -1
  102. package/dist/locales/isValidLocale.d.ts +0 -1
  103. package/dist/locales/requiresTranslation.d.ts +0 -1
  104. package/dist/locales/resolveAliasLocale.d.ts +0 -8
  105. package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
  106. package/dist/logging/errors.d.ts +0 -10
  107. package/dist/logging/logger.d.ts +0 -117
  108. package/dist/logging/warnings.d.ts +0 -2
  109. package/dist/projects/getProjectData.d.ts +0 -1
  110. package/dist/settings/plurals.d.ts +0 -3
  111. package/dist/settings/settings.d.ts +0 -2
  112. package/dist/settings/settingsUrls.d.ts +0 -3
  113. package/dist/translate/api.d.ts +0 -1
  114. package/dist/translate/awaitJobs.d.ts +0 -19
  115. package/dist/translate/checkJobStatus.d.ts +0 -8
  116. package/dist/translate/createBranch.d.ts +0 -10
  117. package/dist/translate/createTag.d.ts +0 -19
  118. package/dist/translate/downloadFileBatch.d.ts +0 -1
  119. package/dist/translate/enqueueFiles.d.ts +0 -8
  120. package/dist/translate/getOrphanedFiles.d.ts +0 -8
  121. package/dist/translate/processFileMoves.d.ts +0 -25
  122. package/dist/translate/publishFiles.d.ts +0 -17
  123. package/dist/translate/queryBranchData.d.ts +0 -3
  124. package/dist/translate/queryFileData.d.ts +0 -42
  125. package/dist/translate/querySourceFile.d.ts +0 -1
  126. package/dist/translate/setupProject.d.ts +0 -11
  127. package/dist/translate/submitUserEditDiffs.d.ts +0 -12
  128. package/dist/translate/translateMany.d.ts +0 -1
  129. package/dist/translate/uploadSourceFiles.d.ts +0 -1
  130. package/dist/translate/uploadTranslations.d.ts +0 -1
  131. package/dist/translate/utils/apiRequest.d.ts +0 -1
  132. package/dist/translate/utils/batch.d.ts +0 -52
  133. package/dist/translate/utils/fetchWithTimeout.d.ts +0 -1
  134. package/dist/translate/utils/generateRequestHeaders.d.ts +0 -2
  135. package/dist/translate/utils/handleFetchError.d.ts +0 -1
  136. package/dist/translate/utils/validateResponse.d.ts +0 -1
  137. package/dist/types-dir/api/branch.d.ts +0 -10
  138. package/dist/types-dir/api/checkFileTranslations.d.ts +0 -37
  139. package/dist/types-dir/api/downloadFile.d.ts +0 -3
  140. package/dist/types-dir/api/downloadFileBatch.d.ts +0 -34
  141. package/dist/types-dir/api/enqueueEntries.d.ts +0 -21
  142. package/dist/types-dir/api/enqueueFiles.d.ts +0 -56
  143. package/dist/types-dir/api/entry.d.ts +0 -36
  144. package/dist/types-dir/api/fetchTranslations.d.ts +0 -11
  145. package/dist/types-dir/api/file.d.ts +0 -54
  146. package/dist/types-dir/api/project.d.ts +0 -7
  147. package/dist/types-dir/api/translate.d.ts +0 -34
  148. package/dist/types-dir/api/translateMany.d.ts +0 -5
  149. package/dist/types-dir/api/translationStatus.d.ts +0 -9
  150. package/dist/types-dir/api/uploadFiles.d.ts +0 -43
  151. package/dist/types-dir/jsx/content.d.ts +0 -61
  152. package/dist/types-dir/jsx/variables.d.ts +0 -9
  153. package/dist/types-dir/transformations.d.ts +0 -8
  154. package/dist/types.cjs.min.cjs +0 -2
  155. package/dist/types.cjs.min.cjs.map +0 -1
  156. package/dist/types.d.ts +0 -652
  157. package/dist/types.esm.min.mjs +0 -2
  158. package/dist/types.esm.min.mjs.map +0 -1
  159. package/dist/utils/base64.d.ts +0 -2
  160. package/dist/utils/isVariable.d.ts +0 -2
  161. package/dist/utils/minify.d.ts +0 -2
  162. package/dist/utils/stableStringify.d.ts +0 -1
package/dist/types.d.ts DELETED
@@ -1,652 +0,0 @@
1
- type CustomMapping = Record<string, string | Partial<LocaleProperties>>;
2
-
3
- type LocaleProperties = {
4
- code: string;
5
- name: string;
6
- nativeName: string;
7
- languageCode: string;
8
- languageName: string;
9
- nativeLanguageName: string;
10
- nameWithRegionCode: string;
11
- nativeNameWithRegionCode: string;
12
- regionCode: string;
13
- regionName: string;
14
- nativeRegionName: string;
15
- scriptCode: string;
16
- scriptName: string;
17
- nativeScriptName: string;
18
- maximizedCode: string;
19
- maximizedName: string;
20
- nativeMaximizedName: string;
21
- minimizedCode: string;
22
- minimizedName: string;
23
- nativeMinimizedName: string;
24
- emoji: string;
25
- };
26
-
27
- type VariableType = 'v' | 'n' | 'd' | 'c' | 'rt';
28
- /**
29
- * Variables are used to store the variable name and type.
30
- */
31
- type Variable = {
32
- k: string;
33
- i?: number;
34
- v?: VariableType;
35
- };
36
-
37
- /**
38
- * Map of data-_gt properties to their corresponding React props
39
- */
40
- declare const HTML_CONTENT_PROPS: {
41
- readonly pl: "placeholder";
42
- readonly ti: "title";
43
- readonly alt: "alt";
44
- readonly arl: "aria-label";
45
- readonly arb: "aria-labelledby";
46
- readonly ard: "aria-describedby";
47
- };
48
- type HtmlContentPropKeysRecord = Partial<Record<keyof typeof HTML_CONTENT_PROPS, string>>;
49
- type HtmlContentPropValuesRecord = Partial<Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>>;
50
- /**
51
- * GTProp is an internal property used to contain data for translating and rendering elements.
52
- * note, transformations are only read on the server side if they are 'plural' or 'branch'
53
- */
54
- type GTProp = {
55
- b?: Record<string, JsxChildren>;
56
- t?: 'p' | 'b';
57
- } & HtmlContentPropKeysRecord;
58
- type JsxElement = {
59
- t?: string;
60
- i?: number;
61
- d?: GTProp;
62
- c?: JsxChildren;
63
- };
64
- type JsxChild = string | JsxElement | Variable;
65
- /**
66
- * The format of the string content
67
- */
68
- type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';
69
- /**
70
- * The format of the content
71
- */
72
- type DataFormat = 'JSX' | StringFormat;
73
- /**
74
- * String format content
75
- */
76
- type StringContent = IcuMessage | StringMessage | I18nextMessage;
77
- /**
78
- * A content type representing JSX, ICU, and I18next messages
79
- */
80
- type Content = JsxChildren | StringContent;
81
- /**
82
- * A content type representing JSX elements
83
- */
84
- type JsxChildren = JsxChild | JsxChild[];
85
- /**
86
- * A content type representing ICU messages
87
- */
88
- type IcuMessage = string;
89
- /**
90
- * A content type representing I18next messages
91
- */
92
- type I18nextMessage = string;
93
- /**
94
- * A content type representing plain strings
95
- */
96
- type StringMessage = string;
97
-
98
- /**
99
- * ActionType is the type of action to perform on the request.
100
- *
101
- * @param fast - The fast action type (mini model).
102
- */
103
- type ActionType = 'fast';
104
- /**
105
- * EntryMetadata is the metadata for a GTRequest.
106
- *
107
- * @param context - The context of the request.
108
- * @param id - The id of the request.
109
- * @param maxChars - The maxChars of the request.
110
- * @param hash - The hash of the request.
111
- */
112
- type EntryMetadata = {
113
- id?: string;
114
- hash?: string;
115
- context?: string;
116
- maxChars?: number;
117
- dataFormat?: DataFormat;
118
- actionType?: ActionType;
119
- };
120
- /**
121
- * TranslateManyEntry is the input type for translateMany.
122
- * Can be a plain string or an object with source and entry metadata fields.
123
- */
124
- type TranslateManyEntry = string | {
125
- source: Content;
126
- metadata?: EntryMetadata;
127
- };
128
-
129
- type HashMetadata = {
130
- context?: string;
131
- id?: string;
132
- maxChars?: number;
133
- dataFormat?: DataFormat;
134
- };
135
-
136
- type TranslationStatusResult = {
137
- count: number;
138
- availableLocales: string[];
139
- locales: string[];
140
- localesWaitingForApproval: any[];
141
- };
142
-
143
- type FileTranslationQuery = {
144
- versionId: string;
145
- fileName?: string;
146
- fileId?: string;
147
- locale: string;
148
- };
149
- type CheckFileTranslationsOptions = {
150
- timeout?: number;
151
- };
152
-
153
- type Updates = ({
154
- metadata: Record<string, any> & {
155
- staticId?: string;
156
- };
157
- } & ({
158
- dataFormat: 'JSX';
159
- source: JsxChildren;
160
- } | {
161
- dataFormat: 'ICU';
162
- source: string;
163
- } | {
164
- dataFormat: 'I18NEXT';
165
- source: string;
166
- } | {
167
- dataFormat: 'STRING';
168
- source: string;
169
- }))[];
170
- /**
171
- * Options for enqueueing files
172
- * @param requireApproval - Whether to require approval for the files
173
- * @param description - Optional description for the project
174
- * @param sourceLocale - The project's source locale
175
- * @param targetLocales - The locales to translate the files to
176
- * @param version - Optional custom version ID to specify
177
- * @param timeout - Optional timeout for the request
178
- * @param modelProvider - Optional model provider to use
179
- */
180
- type EnqueueFilesOptions = {
181
- requireApproval?: boolean;
182
- description?: string;
183
- sourceLocale?: string;
184
- targetLocales: string[];
185
- version?: string;
186
- _versionId?: string;
187
- timeout?: number;
188
- modelProvider?: string;
189
- force?: boolean;
190
- };
191
- type EnqueueFilesResult = {
192
- jobData: {
193
- [jobId: string]: {
194
- sourceFileId: string;
195
- fileId: string;
196
- versionId: string;
197
- branchId: string;
198
- targetLocale: string;
199
- projectId: string;
200
- force: boolean;
201
- modelProvider?: string;
202
- };
203
- };
204
- locales: string[];
205
- message: string;
206
- };
207
-
208
- type FileFormat = 'GTJSON' | 'JSON' | 'YAML' | 'MDX' | 'MD' | 'TS' | 'JS' | 'HTML' | 'TXT' | 'TWILIO_CONTENT_JSON';
209
- /**
210
- * Metadata for files or entries
211
- */
212
- type FormatMetadata = Record<string, any> | Updates[number]['metadata'];
213
- /**
214
- * File object structure for uploading files
215
- * @see {@link FileReferenceOptionalBranchId}
216
- * @property {string} content - Content of the file
217
- * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)
218
- * @property {FormatMetadata} [formatMetadata] - Optional metadata for the file, specific to the format of the file
219
- * @property {string} [incomingBranchId] - The ID of the incoming branch of the file
220
- * @property {string} [checkedOutBranchId] - The ID of the checked out branch of the file
221
- */
222
- type FileToUpload = Omit<FileReference, 'branchId'> & {
223
- content: string;
224
- locale: string;
225
- formatMetadata?: FormatMetadata;
226
- branchId?: string;
227
- incomingBranchId?: string;
228
- checkedOutBranchId?: string;
229
- };
230
- /**
231
- * File object structure for referencing files
232
- * @property {string} fileId - The ID of the file
233
- * @property {string} versionId - The ID of the version of the file
234
- * @property {string} branchId - The ID of the branch of the file
235
- * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)
236
- * @property {string} fileName - The name of the file
237
- * @property {FileFormat} fileFormat - The format of the file (JSON, MDX, MD, etc.)
238
- * @property {DataFormat} [dataFormat] - Optional format of the data within the file
239
- */
240
- type FileReference = {
241
- fileId: string;
242
- versionId: string;
243
- branchId: string;
244
- fileName: string;
245
- fileFormat: FileFormat;
246
- dataFormat?: DataFormat;
247
- };
248
-
249
- type DownloadFileBatchOptions = {
250
- timeout?: number;
251
- };
252
- type DownloadedFile = {
253
- id: string;
254
- branchId: string;
255
- fileId: string;
256
- versionId: string;
257
- locale?: string;
258
- fileName?: string;
259
- data: string;
260
- metadata: Record<string, any>;
261
- fileFormat: FileFormat;
262
- };
263
- type DownloadFileBatchResult = {
264
- files: DownloadedFile[];
265
- count: number;
266
- };
267
-
268
- type FetchTranslationsOptions = {
269
- timeout?: number;
270
- };
271
- type RetrievedTranslation = {
272
- locale: string;
273
- translation: any;
274
- };
275
- type RetrievedTranslations = RetrievedTranslation[];
276
- type FetchTranslationsResult = {
277
- translations: RetrievedTranslations;
278
- };
279
-
280
- type CreateTagFileReference = {
281
- fileId: string;
282
- versionId: string;
283
- branchId: string;
284
- };
285
- type CreateTagOptions = {
286
- tagId: string;
287
- files: CreateTagFileReference[];
288
- message?: string;
289
- };
290
- type CreateTagResult = {
291
- tag: {
292
- id: string;
293
- tagId: string;
294
- message: string | null;
295
- createdAt: string;
296
- updatedAt: string;
297
- };
298
- };
299
-
300
- /**
301
- * Metadata stored alongside GTJSON file entries.
302
- * Keys correspond to the entry id/hash in the GTJSON body.
303
- */
304
- type GTJsonFormatMetadata = Record<string, {
305
- context?: string;
306
- id?: string;
307
- domain?: string;
308
- maxChars?: number;
309
- dataFormat?: 'JSX' | 'ICU' | 'I18NEXT';
310
- requestVersion?: number;
311
- approved_at?: string | null;
312
- approved_by?: string | null;
313
- hash?: string;
314
- staticId?: string;
315
- filePaths?: string[];
316
- }>;
317
- type FileUpload = {
318
- branchId?: string;
319
- incomingBranchId?: string;
320
- checkedOutBranchId?: string;
321
- content: string;
322
- fileName: string;
323
- fileFormat: FileFormat;
324
- dataFormat?: DataFormat;
325
- locale: string;
326
- formatMetadata?: GTJsonFormatMetadata;
327
- versionId?: string;
328
- fileId?: string;
329
- };
330
-
331
- type EnqueueEntriesOptions = {
332
- timeout?: number;
333
- sourceLocale?: string;
334
- targetLocales?: string[];
335
- dataFormat?: DataFormat;
336
- version?: string;
337
- description?: string;
338
- requireApproval?: boolean;
339
- modelProvider?: string;
340
- };
341
- type EnqueueEntriesResult = {
342
- versionId: string;
343
- locales: string[];
344
- message: string;
345
- projectSettings: {
346
- cdnEnabled: boolean;
347
- requireApproval: boolean;
348
- };
349
- };
350
-
351
- type PublishFileEntry = {
352
- fileId: string;
353
- versionId: string;
354
- branchId?: string;
355
- publish: boolean;
356
- fileName?: string;
357
- };
358
- type PublishFilesResult = {
359
- results: {
360
- fileId: string;
361
- versionId: string;
362
- locale?: string;
363
- branchId: string;
364
- success: boolean;
365
- error?: string;
366
- }[];
367
- };
368
-
369
- type DownloadFileOptions = {
370
- timeout?: number;
371
- };
372
-
373
- /**
374
- * TranslationResultReference is used to store the reference for a translation result.
375
- */
376
- type TranslationResultReference = {
377
- id?: string;
378
- hash: string;
379
- };
380
- /**
381
- * TypedResult is a union type that represents the different types of translations that can be returned.
382
- */
383
- type TypedResult = {
384
- translation: JsxChildren;
385
- dataFormat: 'JSX';
386
- } | {
387
- translation: I18nextMessage | IcuMessage | StringMessage;
388
- dataFormat: 'ICU' | 'I18NEXT' | 'STRING';
389
- };
390
- /**
391
- * RequestError is a type that represents an error that occurred during a translation request.
392
- */
393
- type TranslationError = {
394
- success: false;
395
- error: string;
396
- code: number;
397
- };
398
- /**
399
- * RequestSuccess is a type that represents a successful translation request.
400
- */
401
- type RequestSuccess = TypedResult & {
402
- success: true;
403
- locale: string;
404
- };
405
- type TranslationResult = RequestSuccess | TranslationError;
406
-
407
- /**
408
- * BatchTranslationResult is the result of a batch translation request.
409
- */
410
- type TranslateManyResult = TranslationResult[];
411
-
412
- type BranchDataResult = {
413
- branches: {
414
- id: string;
415
- name: string;
416
- }[];
417
- defaultBranch: {
418
- id: string;
419
- name: string;
420
- } | null;
421
- };
422
-
423
- type BranchQuery = {
424
- branchNames: string[];
425
- };
426
-
427
- type FileDataQuery = {
428
- sourceFiles?: {
429
- fileId: string;
430
- versionId: string;
431
- branchId: string;
432
- }[];
433
- translatedFiles?: {
434
- fileId: string;
435
- versionId: string;
436
- branchId: string;
437
- locale: string;
438
- }[];
439
- };
440
- type FileDataResult = {
441
- sourceFiles?: {
442
- branchId: string;
443
- fileId: string;
444
- versionId: string;
445
- fileName: string;
446
- fileFormat: string;
447
- dataFormat: string | null;
448
- createdAt: string;
449
- updatedAt: string;
450
- approvalRequiredAt: string | null;
451
- publishedAt: string | null;
452
- locales: string[];
453
- sourceLocale: string;
454
- }[];
455
- translatedFiles?: {
456
- branchId: string;
457
- fileId: string;
458
- versionId: string;
459
- fileFormat: string;
460
- dataFormat: string | null;
461
- createdAt: string;
462
- updatedAt: string;
463
- approvedAt: string | null;
464
- publishedAt: string | null;
465
- completedAt: string | null;
466
- locale: string;
467
- }[];
468
- };
469
-
470
- type OrphanedFile = {
471
- fileId: string;
472
- versionId: string;
473
- fileName: string;
474
- };
475
- type GetOrphanedFilesResult = {
476
- orphanedFiles: OrphanedFile[];
477
- };
478
-
479
- type MoveMapping = {
480
- oldFileId: string;
481
- newFileId: string;
482
- newFileName: string;
483
- };
484
- type MoveResult = {
485
- oldFileId: string;
486
- newFileId: string;
487
- success: boolean;
488
- newSourceFileId?: string;
489
- clonedTranslationsCount?: number;
490
- error?: string;
491
- };
492
- type ProcessMovesResponse = {
493
- results: MoveResult[];
494
- summary: {
495
- total: number;
496
- succeeded: number;
497
- failed: number;
498
- };
499
- };
500
- type ProcessMovesOptions = {
501
- timeout?: number;
502
- branchId?: string;
503
- };
504
-
505
- type JobStatus = 'queued' | 'processing' | 'completed' | 'failed' | 'unknown';
506
- type CheckJobStatusResult = {
507
- jobId: string;
508
- status: JobStatus;
509
- error?: {
510
- message: string;
511
- };
512
- }[];
513
-
514
- type AwaitJobsOptions = {
515
- /** Polling interval in seconds. Defaults to 5. */
516
- pollingIntervalSeconds?: number;
517
- /** Timeout in seconds. Defaults to 600 (10 minutes). If reached, resolves with whatever status is current. */
518
- timeoutSeconds?: number;
519
- };
520
- type JobResult = {
521
- jobId: string;
522
- status: JobStatus;
523
- error?: {
524
- message: string;
525
- };
526
- };
527
- type AwaitJobsResult = {
528
- /** Whether all jobs completed (none still in progress). */
529
- complete: boolean;
530
- jobs: JobResult[];
531
- };
532
-
533
- type SubmitUserEditDiff = {
534
- fileName: string;
535
- locale: string;
536
- diff: string;
537
- branchId: string;
538
- versionId: string;
539
- fileId: string;
540
- localContent: string;
541
- };
542
- type SubmitUserEditDiffsPayload = {
543
- diffs: SubmitUserEditDiff[];
544
- };
545
-
546
- /**
547
- * Transformations are made from a prefix and a suffix.
548
- */
549
- type Transformation = BaseTransformation | `${BaseTransformation}-${InjectionType}`;
550
- type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-relative-time' | 'plural' | 'branch' | 'derive';
551
- type TransformationPrefix = 'translate' | 'variable' | 'plural' | 'branch' | 'fragment' | 'derive';
552
- type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | 'relative-time';
553
- type InjectionType = 'automatic' | 'manual';
554
-
555
- /**
556
- * @deprecated Use {@link Content} instead.
557
- */
558
- type _Content = string | Array<string | Variable>;
559
-
560
- type Metadata = {
561
- maxChars?: number;
562
- context?: string;
563
- id?: string;
564
- sourceLocale?: string;
565
- actionType?: 'standard' | 'fast' | string;
566
- filePaths?: string[];
567
- [key: string]: any;
568
- };
569
- type FormatVariables = Record<string, string | number | boolean | null | undefined | Date>;
570
- /**
571
- * @deprecated This type is deprecated and will be removed in a future version.
572
- */
573
- type Update = {
574
- type: 'content';
575
- data: {
576
- source: _Content;
577
- metadata: Metadata;
578
- };
579
- } | {
580
- type: 'jsx';
581
- data: {
582
- source: JsxChildren;
583
- metadata: Metadata;
584
- };
585
- };
586
- /**
587
- * @deprecated This type is deprecated and will be removed in a future version.
588
- */
589
- type Request = {
590
- type: 'content';
591
- data: {
592
- source: _Content;
593
- targetLocale: string;
594
- metadata: Metadata;
595
- };
596
- } | {
597
- type: 'jsx';
598
- data: {
599
- source: JsxChildren;
600
- targetLocale: string;
601
- metadata: Metadata;
602
- };
603
- };
604
- /**
605
- * @deprecated Use {@link TranslationResult} instead.
606
- */
607
- type ContentTranslationResult = {
608
- translation: _Content;
609
- locale: string;
610
- reference?: {
611
- id: string;
612
- key: string;
613
- };
614
- };
615
- /**
616
- * @deprecated Use {@link TranslationResult} instead.
617
- */
618
- type IcuTranslationResult = {
619
- translation: string;
620
- locale: string;
621
- reference?: {
622
- id: string;
623
- key: string;
624
- };
625
- };
626
- /**
627
- * @deprecated Use {@link TranslationResult} instead.
628
- */
629
- type JsxTranslationResult = {
630
- translation: JsxChildren;
631
- locale: string;
632
- reference?: {
633
- id: string;
634
- key: string;
635
- };
636
- };
637
-
638
- /**
639
- * TranslationRequestConfig is used to configure the translation request.
640
- *
641
- * @param projectId - The project id of the translation request.
642
- * @param baseUrl - The base url of the translation request.
643
- * @param apiKey - The api key of the translation request.
644
- */
645
- type TranslationRequestConfig = {
646
- projectId: string;
647
- baseUrl?: string;
648
- apiKey?: string;
649
- };
650
-
651
- export { HTML_CONTENT_PROPS };
652
- export type { AwaitJobsOptions, AwaitJobsResult, BranchDataResult, BranchQuery, CheckFileTranslationsOptions, CheckJobStatusResult, Content, ContentTranslationResult, CreateTagOptions, CreateTagResult, CustomMapping, DataFormat, DownloadFileBatchOptions, DownloadFileBatchResult, DownloadFileOptions, DownloadedFile, EnqueueEntriesOptions, EnqueueEntriesResult, EnqueueFilesOptions, EnqueueFilesResult, ActionType as EntryActionType, EntryMetadata, FetchTranslationsOptions, FetchTranslationsResult, FileDataQuery, FileDataResult, FileFormat, FileReference, FileToUpload, FileTranslationQuery, FileUpload, FormatVariables, GTProp, GetOrphanedFilesResult, HashMetadata, HtmlContentPropKeysRecord, HtmlContentPropValuesRecord, I18nextMessage, IcuMessage, IcuTranslationResult, InjectionType, JobResult, JobStatus, JsxChild, JsxChildren, JsxElement, JsxTranslationResult, LocaleProperties, Metadata, MoveMapping, MoveResult, OrphanedFile, ProcessMovesOptions, ProcessMovesResponse, PublishFileEntry, PublishFilesResult, Request, RetrievedTranslations, StringContent, StringFormat, StringMessage, SubmitUserEditDiff, SubmitUserEditDiffsPayload, Transformation, TransformationPrefix, TranslateManyEntry, TranslateManyResult, TranslationError, TranslationRequestConfig, TranslationResult, TranslationResultReference, TranslationStatusResult, Update, Updates, Variable, VariableTransformationSuffix, VariableType, _Content };
@@ -1,2 +0,0 @@
1
- var a={pl:"placeholder",ti:"title",alt:"alt",arl:"aria-label",arb:"aria-labelledby",ard:"aria-describedby"};export{a as HTML_CONTENT_PROPS};
2
- //# sourceMappingURL=types.esm.min.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.esm.min.mjs","sources":["../src/types-dir/jsx/content.ts"],"sourcesContent":["import { Variable } from './variables';\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the string content\n */\nexport type StringFormat = 'ICU' | 'I18NEXT' | 'STRING';\n\n/**\n * The format of the content\n */\nexport type DataFormat = 'JSX' | StringFormat;\n\n/**\n * String format content\n */\nexport type StringContent = IcuMessage | StringMessage | I18nextMessage;\n\n/**\n * A content type representing JSX, ICU, and I18next messages\n */\nexport type Content = JsxChildren | StringContent;\n\n/**\n * A content type representing JSX elements\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages\n */\nexport type I18nextMessage = string;\n\n/**\n * A content type representing plain strings\n */\nexport type StringMessage = string;\n"],"names":["HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard"],"mappings":"AAKO,IAAMA,EAAqB,CAChCC,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}
@@ -1,2 +0,0 @@
1
- export declare function encode(data: string): string;
2
- export declare function decode(base64: string): string;
@@ -1,2 +0,0 @@
1
- import { Variable } from '../types';
2
- export default function isVariable(obj: unknown): obj is Variable;
@@ -1,2 +0,0 @@
1
- import { VariableTransformationSuffix, VariableType } from '../types';
2
- export declare function minifyVariableType(variableType: VariableTransformationSuffix): VariableType;
@@ -1 +0,0 @@
1
- export declare function stableStringify(data: unknown): string;