generaltranslation 9.4.2 → 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 (153) hide show
  1. package/CHANGELOG.md +34 -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/openapi.json +2344 -845
  60. package/dist/runtime.cjs +580 -2
  61. package/dist/runtime.cjs.map +1 -0
  62. package/dist/runtime.d.cts +12 -6
  63. package/dist/runtime.d.mts +12 -6
  64. package/dist/runtime.d.ts +10 -4
  65. package/dist/runtime.js +10 -65
  66. package/dist/runtime.mjs +579 -1
  67. package/dist/runtime.mjs.map +1 -0
  68. package/dist/runtimeTranslate-CVw143pQ.mjs +506 -0
  69. package/dist/runtimeTranslate-CVw143pQ.mjs.map +1 -0
  70. package/dist/runtimeTranslate-DJioRjb6.cjs +601 -0
  71. package/dist/runtimeTranslate-DJioRjb6.cjs.map +1 -0
  72. package/dist/translate/awaitJobs.d.ts +2 -2
  73. package/dist/translate/awaitJobs.js +1 -156
  74. package/dist/translate/checkJobStatus.d.ts +2 -1
  75. package/dist/translate/checkJobStatus.js +1 -55
  76. package/dist/translate/createBranch.d.ts +2 -6
  77. package/dist/translate/createBranch.js +1 -53
  78. package/dist/translate/enqueueFiles.js +1 -95
  79. package/dist/translate/getProjectInfo.d.ts +2 -6
  80. package/dist/translate/getProjectInfo.js +1 -54
  81. package/dist/translate/processFileMoves.d.ts +3 -13
  82. package/dist/translate/processFileMoves.js +1 -90
  83. package/dist/translate/publishFiles.d.ts +3 -15
  84. package/dist/translate/publishFiles.js +1 -56
  85. package/dist/translate/queryBranchData.js +1 -53
  86. package/dist/translate/queryFileData.d.ts +3 -41
  87. package/dist/translate/queryFileData.js +1 -71
  88. package/dist/translate/runtimeTranslate.d.ts +6 -0
  89. package/dist/translate/runtimeTranslate.js +297 -0
  90. package/dist/translate/setupProject.d.ts +2 -6
  91. package/dist/translate/setupProject.js +1 -63
  92. package/dist/translate/submitUserEditDiffs.js +1 -68
  93. package/dist/translate/utils/fetchWithTimeout.js +19 -12
  94. package/dist/{types-bCr8pV1Z.d.cts → types-Si4UstLL.d.mts} +41 -165
  95. package/dist/types-dir/__tests__/runtimeTranslate.type-test.js +18 -0
  96. package/dist/types-dir/api/branch.d.ts +3 -9
  97. package/dist/types-dir/api/checkFileTranslations.d.ts +2 -22
  98. package/dist/types-dir/api/downloadFileBatch.d.ts +2 -7
  99. package/dist/types-dir/api/entry.d.ts +3 -8
  100. package/dist/types-dir/api/file.d.ts +2 -1
  101. package/dist/types-dir/api/json.d.ts +1 -4
  102. package/dist/types-dir/api/project.d.ts +2 -7
  103. package/dist/types-dir/api/uploadAssets.d.ts +3 -10
  104. package/dist/types-dir/api/uploadAssets.js +0 -4
  105. package/dist/types-dir/config.d.ts +1 -0
  106. package/dist/{types-Dp1drjxq.d.mts → types-yByDbKnV.d.cts} +41 -165
  107. package/dist/types.d.cts +2 -2
  108. package/dist/types.d.mts +2 -2
  109. package/dist/types.d.ts +26 -7
  110. package/package.json +15 -2
  111. package/dist/derive-2CDqwrvS.cjs +0 -303
  112. package/dist/derive-2CDqwrvS.cjs.map +0 -1
  113. package/dist/derive-CTzR56T_.mjs +0 -233
  114. package/dist/derive-CTzR56T_.mjs.map +0 -1
  115. package/dist/id-X2zyx5Jk.mjs.map +0 -1
  116. package/dist/id-pdr3R1xs.cjs.map +0 -1
  117. package/dist/isVariable-8-Wy5FnX.mjs +0 -20
  118. package/dist/isVariable-8-Wy5FnX.mjs.map +0 -1
  119. package/dist/isVariable-I3nllgeI.cjs +0 -25
  120. package/dist/isVariable-I3nllgeI.cjs.map +0 -1
  121. package/dist/projects/getProjectData.js +0 -87
  122. package/dist/runtime-Bcp4F2ME.mjs +0 -974
  123. package/dist/runtime-Bcp4F2ME.mjs.map +0 -1
  124. package/dist/runtime-C25lwh9m.cjs +0 -1027
  125. package/dist/runtime-C25lwh9m.cjs.map +0 -1
  126. package/dist/translate/api.d.ts +0 -4
  127. package/dist/translate/api.js +0 -4
  128. package/dist/translate/createTag.d.ts +0 -19
  129. package/dist/translate/createTag.js +0 -67
  130. package/dist/translate/downloadFileBatch.d.ts +0 -1
  131. package/dist/translate/downloadFileBatch.js +0 -80
  132. package/dist/translate/getOrphanedFiles.d.ts +0 -8
  133. package/dist/translate/getOrphanedFiles.js +0 -97
  134. package/dist/translate/querySourceFile.d.ts +0 -1
  135. package/dist/translate/querySourceFile.js +0 -67
  136. package/dist/translate/translateMany.d.ts +0 -1
  137. package/dist/translate/translateMany.js +0 -124
  138. package/dist/translate/uploadFonts.d.ts +0 -1
  139. package/dist/translate/uploadFonts.js +0 -74
  140. package/dist/translate/uploadSourceFiles.d.ts +0 -1
  141. package/dist/translate/uploadSourceFiles.js +0 -90
  142. package/dist/translate/uploadTranslations.d.ts +0 -1
  143. package/dist/translate/uploadTranslations.js +0 -106
  144. package/dist/translate/utils/apiRequest.d.ts +0 -1
  145. package/dist/translate/utils/apiRequest.js +0 -167
  146. package/dist/translate/utils/generateRequestHeaders.d.ts +0 -2
  147. package/dist/translate/utils/generateRequestHeaders.js +0 -21
  148. package/dist/translate/utils/handleFetchError.d.ts +0 -1
  149. package/dist/translate/utils/handleFetchError.js +0 -12
  150. package/dist/unwrapApiResult-BzGfPw75.mjs.map +0 -1
  151. package/dist/unwrapApiResult-Dv6Mfw_K.cjs +0 -134
  152. package/dist/unwrapApiResult-Dv6Mfw_K.cjs.map +0 -1
  153. /package/dist/{projects/getProjectData.d.ts → types-dir/__tests__/runtimeTranslate.type-test.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive-t_E3ftJN.cjs","names":["isBinaryFileFormat","translate","translateWithConfig","translateMany","translateManyWithConfig","unwrapApiResult","isModelProvider","createDiagnosticMessage","supportedModelProviders","DEFAULT_BATCH_SIZE","TYPE","TYPE"],"sources":["../src/utils/base64.ts","../src/utils/isSupportedFileFormatTransform.ts","../src/translate/utils/validateFileFormatTransform.ts","../src/adapter/createGtApi.ts","../src/derive/utils/traverseIcu.ts","../src/derive/utils/constants.ts","../src/derive/utils/regex.ts","../src/derive/utils/traverseHelpers.ts","../src/derive/decodeVars.ts","../src/derive/utils/sanitizeVar.ts","../src/derive/declareVar.ts","../src/derive/derive.ts"],"sourcesContent":["import { isBinaryFileFormat, type FileFormat } from '../types-dir/api/file';\n\n// Encode a string to base64\nexport function encode(data: string): string {\n if (typeof Buffer !== 'undefined') {\n // Node.js path.\n return Buffer.from(data, 'utf8').toString('base64');\n }\n // Browser path.\n const bytes = new TextEncoder().encode(data);\n let binary = '';\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n}\n\n// Decode a base64 string to a string\nexport function decode(base64: string): string {\n if (typeof Buffer !== 'undefined') {\n // Node.js path.\n return Buffer.from(base64, 'base64').toString('utf8');\n }\n // Browser path.\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return new TextDecoder().decode(bytes);\n}\n\nexport function encodeFileContent(\n content: string,\n fileFormat: FileFormat\n): string {\n return isBinaryFileFormat(fileFormat) ? content : encode(content);\n}\n\nexport function decodeFileContent(\n content: string,\n fileFormat: FileFormat\n): string {\n return isBinaryFileFormat(fileFormat) ? content : decode(content);\n}\n","import type { FileFormat } from '../types-dir/api/file';\n\nconst SUPPORTED_TRANSFORMATIONS = {\n GTJSON: ['GTJSON'],\n JSON: ['JSON'],\n PO: ['PO'],\n // POT templates can produce translated PO catalog files.\n POT: ['POT', 'PO'],\n YAML: ['YAML'],\n MDX: ['MDX'],\n MD: ['MD'],\n TS: ['TS'],\n JS: ['JS'],\n HTML: ['HTML'],\n TXT: ['TXT'],\n TWILIO_CONTENT_JSON: ['TWILIO_CONTENT_JSON'],\n LOTTIE: ['LOTTIE'],\n SVG: ['SVG'],\n DOT_STRINGS: ['DOT_STRINGS'],\n DOT_STRINGSDICT: ['DOT_STRINGSDICT'],\n ANDROID_STRINGS: ['ANDROID_STRINGS'],\n XCSTRINGS: ['XCSTRINGS'],\n} as const satisfies Record<FileFormat, FileFormat[]>;\n\n/**\n * This function checks if a file format transformation is supported during translation\n * @param from - The source file format.\n * @param to - The target file format.\n * @returns True if the transformation is supported, false otherwise\n */\nexport function isSupportedFileFormatTransform(\n from: FileFormat,\n to: FileFormat\n): boolean {\n const toFormats: FileFormat[] | undefined = SUPPORTED_TRANSFORMATIONS[from];\n return toFormats?.includes(to) ?? false;\n}\n","import type { FileFormat } from '../../types-dir/api/file';\nimport { isSupportedFileFormatTransform } from '../../utils/isSupportedFileFormatTransform';\n\nexport type FileFormatTransformInput = {\n fileFormat?: FileFormat;\n transformFormat?: FileFormat;\n fileName?: string;\n fileId?: string;\n};\n\n/**\n * Returns a user-facing validation error when a requested file format transform\n * is missing source format context or is not currently supported.\n */\nexport function getFileFormatTransformError(\n file: FileFormatTransformInput\n): string | undefined {\n if (!file.transformFormat) return undefined;\n const fileLabel = file.fileName ?? file.fileId ?? 'unknown file';\n if (!file.fileFormat) {\n return `fileFormat is required when transformFormat is provided for ${fileLabel}`;\n }\n if (!isSupportedFileFormatTransform(file.fileFormat, file.transformFormat)) {\n return `Unsupported file format transform: ${file.fileFormat} -> ${file.transformFormat}`;\n }\n return undefined;\n}\n\n/**\n * Validates file format transforms before sending upload/enqueue requests.\n */\nexport function validateFileFormatTransforms(\n files: FileFormatTransformInput[]\n): void {\n for (const file of files) {\n const error = getFileFormatTransformError(file);\n if (error) throw new Error(error);\n }\n}\n","import {\n createApiClient,\n createBranch,\n createProject,\n createProjectApiKey,\n createTag,\n DEFAULT_BATCH_SIZE,\n downloadFiles,\n enqueueFileTranslations,\n generateProjectContext,\n getBranchInfo,\n getFileInfo,\n getOrphanedFiles,\n getProjectInfo,\n getTranslationJobInfo,\n getTranslationStatus,\n listOrgs,\n listProjects,\n pollJobs,\n processBatches,\n processFileMoves,\n publishFiles,\n submitUserEditDiffs,\n uploadAssets,\n uploadSourceFiles,\n uploadTranslations,\n type ApiClientConfig,\n type AwaitJobsOptions,\n type CreateBranchData,\n type CreateProjectApiKeyData,\n type CreateProjectData,\n type CreateTagData,\n type DownloadFilesData,\n type EnqueueFileTranslationsData,\n type GenerateProjectContextData,\n type GetBranchInfoData,\n type GetFileInfoData,\n type GetTranslationJobInfoResponse,\n type GetTranslationStatusData,\n type ProcessFileMovesData,\n type PublishFilesData,\n type SubmitUserEditDiffsData,\n type UploadAssetsData,\n type UploadSourceFilesData,\n type UploadTranslationsData,\n} from '@generaltranslation/api';\nimport {\n resolveAliasLocale,\n resolveCanonicalLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport type { DownloadedFile } from '../types-dir/api/downloadFileBatch';\nimport type {\n TranslateManyEntry,\n TranslateOptions,\n} from '../types-dir/api/entry';\nimport type { TranslateManyResult, TranslationResult } from '../types';\nimport { createDiagnosticMessage } from '../logging/diagnostics';\nimport {\n translate as translateWithConfig,\n translateMany as translateManyWithConfig,\n} from '../translate/runtimeTranslate';\nimport { decodeFileContent, encodeFileContent } from '../utils/base64';\nimport { unwrapApiResult } from '../translate/utils/unwrapApiResult';\nimport { validateFileFormatTransforms } from '../translate/utils/validateFileFormatTransform';\nimport { isModelProvider, supportedModelProviders } from './modelProvider';\n\n// Follows nextCursor until the service reports the last page.\nasync function collectPages<T>(\n loadPage: (\n cursor: string | undefined\n ) => Promise<{ items: T[]; nextCursor: string | null }>\n): Promise<T[]> {\n const items: T[] = [];\n let cursor: string | undefined;\n do {\n const page = await loadPage(cursor);\n items.push(...page.items);\n cursor = page.nextCursor ?? undefined;\n } while (cursor);\n return items;\n}\n\nfunction normalizeJobStatus(job: GetTranslationJobInfoResponse[number]): {\n jobId: string;\n status: GetTranslationJobInfoResponse[number]['status'];\n error?: { message: string };\n} {\n return {\n jobId: job.jobId,\n status: job.status,\n ...(job.status === 'failed'\n ? { error: { message: job.error.message ?? '' } }\n : {}),\n };\n}\n\nexport type GtApiAdapterConfig = ApiClientConfig & {\n customMapping?: CustomMapping;\n};\n\nexport function createGtApiAdapter(defaultConfig?: GtApiAdapterConfig) {\n let client: ReturnType<typeof createApiClient> | undefined;\n let config: GtApiAdapterConfig | undefined;\n\n // Mapping resolves aliases; standardization also canonicalizes configured\n // spellings such as en-us before they cross the service boundary.\n function resolveServiceLocale(locale: string): string {\n return standardizeLocale(\n resolveCanonicalLocale(locale, config?.customMapping)\n );\n }\n\n // Upload responses echo the canonical locale; callers key lockfile entries\n // by the configured alias, so map it back before it leaves the adapter.\n function aliasUploadedFileLocale<T extends { locale?: string }>(file: T): T {\n return file.locale\n ? {\n ...file,\n locale: resolveAliasLocale(file.locale, config?.customMapping),\n }\n : file;\n }\n\n function getConfig(): GtApiAdapterConfig {\n if (!config) {\n throw new Error(\n 'API client not configured — call configureApiClient first'\n );\n }\n return config;\n }\n\n function getClient(timeoutMs?: number): ReturnType<typeof createApiClient> {\n if (timeoutMs === undefined && client) return client;\n return createApiClient({ ...getConfig(), timeoutMs });\n }\n\n function configure(nextConfig: GtApiAdapterConfig): void {\n client = createApiClient(nextConfig);\n config = { ...nextConfig };\n }\n\n async function translate(\n source: TranslateManyEntry,\n options: string | TranslateOptions,\n timeoutMs?: number | false\n ) {\n return translateWithConfig(source, options, {\n ...getConfig(),\n ...(timeoutMs !== undefined && { timeoutMs }),\n });\n }\n\n function translateMany(\n sources: TranslateManyEntry[],\n options: string | TranslateOptions,\n timeoutMs?: number | false\n ): Promise<TranslateManyResult>;\n function translateMany(\n sources: Record<string, TranslateManyEntry>,\n options: string | TranslateOptions,\n timeoutMs?: number | false\n ): Promise<Record<string, TranslationResult>>;\n async function translateMany(\n sources: TranslateManyEntry[] | Record<string, TranslateManyEntry>,\n options: string | TranslateOptions,\n timeoutMs?: number | false\n ): Promise<TranslateManyResult | Record<string, TranslationResult>> {\n return translateManyWithConfig(sources, options, {\n ...getConfig(),\n ...(timeoutMs !== undefined && { timeoutMs }),\n });\n }\n\n if (defaultConfig) configure(defaultConfig);\n\n // Raw service responses; the normalized adapter methods build on these and\n // compatibility facades (CLI) expose them unchanged.\n async function loadJobStatuses(\n jobIds: readonly string[],\n options: { signal?: AbortSignal; timeoutMs?: number } = {}\n ): Promise<GetTranslationJobInfoResponse> {\n return unwrapApiResult(\n await getTranslationJobInfo({\n body: { jobIds: [...jobIds] },\n client: getClient(options.timeoutMs),\n signal: options.signal,\n })\n );\n }\n\n async function loadProjectInfo(projectId?: string, timeoutMs?: number) {\n const resolvedProjectId = projectId ?? getConfig().projectId;\n if (!resolvedProjectId) {\n throw new Error('Project ID is required to fetch project information');\n }\n return unwrapApiResult(\n await getProjectInfo({\n client: getClient(timeoutMs),\n path: { projectId: resolvedProjectId },\n })\n );\n }\n\n return {\n configure,\n getClient,\n\n resolveAliasLocale(locale: string) {\n return resolveAliasLocale(locale, config?.customMapping);\n },\n\n resolveCanonicalLocale(locale: string) {\n return resolveServiceLocale(locale);\n },\n\n translate,\n translateMany,\n\n async queryBranchData(body: GetBranchInfoData['body']) {\n return unwrapApiResult(\n await getBranchInfo({ body, client: getClient() })\n );\n },\n\n async createBranch(body: CreateBranchData['body']) {\n return unwrapApiResult(await createBranch({ body, client: getClient() }));\n },\n\n async processFileMoves(\n moves: ProcessFileMovesData['body']['moves'],\n options: Pick<ProcessFileMovesData['body'], 'branchId'> & {\n timeout?: number;\n } = {}\n ) {\n const results = await processBatches(moves, async (batch) => {\n const response = unwrapApiResult(\n await processFileMoves({\n body: { branchId: options.branchId, moves: batch },\n client: getClient(options.timeout),\n })\n );\n return response.results;\n });\n const succeeded = results.filter(({ success }) => success).length;\n return {\n results,\n summary: {\n total: moves.length,\n succeeded,\n failed: results.length - succeeded,\n },\n };\n },\n\n async getOrphanedFiles(\n branchId: string,\n fileIds: string[],\n options: { timeout?: number } = {}\n ) {\n const request = async (batch: string[]) =>\n unwrapApiResult(\n await getOrphanedFiles({\n body: { branchId, fileIds: batch },\n client: getClient(options.timeout),\n })\n );\n\n if (fileIds.length === 0) return request([]);\n\n const results = await processBatches(fileIds, async (batch) => [\n await request(batch),\n ]);\n const orphanedFiles = new Map(\n results[0].orphanedFiles.map((file) => [file.fileId, file])\n );\n for (const result of results.slice(1)) {\n const batchFileIds = new Set(\n result.orphanedFiles.map((file) => file.fileId)\n );\n for (const fileId of Array.from(orphanedFiles.keys())) {\n if (!batchFileIds.has(fileId)) orphanedFiles.delete(fileId);\n }\n }\n return { orphanedFiles: Array.from(orphanedFiles.values()) };\n },\n\n async setupProject(\n files: GenerateProjectContextData['body']['files'],\n options: Omit<GenerateProjectContextData['body'], 'files'> & {\n timeoutMs?: number;\n } = {}\n ) {\n return unwrapApiResult(\n await generateProjectContext({\n body: {\n files: files.map(({ branchId, fileId, versionId }) => ({\n branchId,\n fileId,\n versionId,\n })),\n locales: options.locales?.map((locale) =>\n resolveServiceLocale(locale)\n ),\n force: options.force,\n },\n client: getClient(options.timeoutMs),\n })\n );\n },\n\n loadJobStatuses,\n\n async checkJobStatus(jobIds: string[], timeoutMs?: number) {\n const statuses = await loadJobStatuses(jobIds, { timeoutMs });\n return statuses.map(normalizeJobStatus);\n },\n\n async awaitJobs(jobIds: readonly string[], options?: AwaitJobsOptions) {\n const result = await pollJobs(\n jobIds,\n (pendingJobIds, signal) => loadJobStatuses(pendingJobIds, { signal }),\n options\n );\n return {\n ...result,\n jobs: result.jobs.map(normalizeJobStatus),\n };\n },\n\n async enqueueFiles(\n files: EnqueueFileTranslationsData['body']['files'],\n options: {\n sourceLocale?: string;\n targetLocales: string[];\n modelProvider?: string;\n force?: boolean;\n timeout?: number;\n }\n ) {\n validateFileFormatTransforms(files);\n const modelProvider = options.modelProvider;\n if (modelProvider !== undefined && !isModelProvider(modelProvider)) {\n throw new Error(\n createDiagnosticMessage({\n source: 'generaltranslation',\n severity: 'Error',\n whatHappened: `Unsupported model provider \\`${modelProvider}\\``,\n fix: `Use one of: ${supportedModelProviders.join(', ')}`,\n })\n );\n }\n const targetLocales = options.targetLocales.map((locale) =>\n resolveServiceLocale(locale)\n );\n const result = await processBatches(files, async (batch) => {\n const response = unwrapApiResult(\n await enqueueFileTranslations({\n body: {\n files: batch.map(\n ({\n branchId,\n fileId,\n versionId,\n fileName,\n transformFormat,\n }) => ({\n branchId,\n fileId,\n versionId,\n fileName,\n transformFormat,\n })\n ),\n targetLocales,\n sourceLocale: options.sourceLocale\n ? resolveServiceLocale(options.sourceLocale)\n : undefined,\n modelProvider,\n force: options.force,\n },\n client: getClient(options.timeout),\n })\n );\n const jobData =\n 'jobData' in response ? response.jobData : response.data;\n return Object.entries(jobData);\n });\n\n return {\n jobData: Object.fromEntries(result),\n locales: targetLocales,\n message: `Successfully enqueued ${result.length} file translation jobs in ${Math.ceil(files.length / DEFAULT_BATCH_SIZE)} batch(es)`,\n };\n },\n\n async createTag(body: CreateTagData['body']) {\n return unwrapApiResult(await createTag({ body, client: getClient() }));\n },\n\n async publishFiles(files: PublishFilesData['body']['files']) {\n // Compatibility callers pass entries carrying fileName; map only the\n // contract fields so nothing outside the generated body reaches the wire.\n return unwrapApiResult(\n await publishFiles({\n body: {\n files: files.map(({ fileId, versionId, branchId, publish }) => ({\n fileId,\n versionId,\n branchId,\n publish,\n })),\n },\n client: getClient(),\n })\n );\n },\n\n async submitUserEditDiffs(\n body: SubmitUserEditDiffsData['body'],\n options: { timeout?: number } = {}\n ) {\n return processBatches(body.diffs, async (diffs) => [\n unwrapApiResult(\n await submitUserEditDiffs({\n body: {\n projectId: body.projectId,\n diffs: diffs.map(\n ({\n diff,\n branchId,\n versionId,\n fileId,\n localContent,\n locale,\n }) => ({\n diff,\n branchId,\n versionId,\n fileId,\n localContent,\n locale: resolveServiceLocale(locale),\n })\n ),\n },\n client: getClient(options.timeout),\n })\n ),\n ]);\n },\n\n async createProject(\n orgId: CreateProjectData['path']['orgId'],\n body: CreateProjectData['body']\n ) {\n return unwrapApiResult(\n await createProject({\n path: { orgId },\n body: {\n ...body,\n defaultLocale: resolveServiceLocale(body.defaultLocale),\n },\n client: getClient(),\n })\n );\n },\n\n /** Every project the configured credentials can read. */\n async listProjects() {\n return collectPages(async (cursor) => {\n const { projects, nextCursor } = unwrapApiResult(\n await listProjects({\n query: cursor ? { cursor } : undefined,\n client: getClient(),\n })\n );\n return { items: projects, nextCursor };\n });\n },\n\n /** Organizations where the signed-in user can create projects; user tokens only. */\n async listOrgs() {\n return collectPages(async (cursor) => {\n const { orgs, nextCursor } = unwrapApiResult(\n await listOrgs({\n query: cursor ? { cursor } : undefined,\n client: getClient(),\n })\n );\n return { items: orgs, nextCursor };\n });\n },\n\n async createProjectApiKey(\n projectId: CreateProjectApiKeyData['path']['projectId'],\n body: CreateProjectApiKeyData['body']\n ) {\n return unwrapApiResult(\n await createProjectApiKey({\n path: { projectId },\n body,\n client: getClient(),\n })\n );\n },\n\n loadProjectInfo,\n\n async getProjectInfo(projectId?: string, timeoutMs?: number) {\n const result = await loadProjectInfo(projectId, timeoutMs);\n return {\n ...result,\n defaultLocale: resolveAliasLocale(\n result.defaultLocale,\n config?.customMapping\n ),\n currentLocales: result.currentLocales.map((locale) =>\n resolveAliasLocale(locale, config?.customMapping)\n ),\n };\n },\n\n async queryFileData(body: GetFileInfoData['body'], timeoutMs?: number) {\n const result = unwrapApiResult(\n await getFileInfo({\n body: {\n ...body,\n translatedFiles: body.translatedFiles?.map((file) => ({\n ...file,\n locale: resolveServiceLocale(file.locale),\n })),\n },\n client: getClient(timeoutMs),\n })\n );\n return {\n ...result,\n translatedFiles: result.translatedFiles.map((file) => ({\n ...file,\n locale: resolveAliasLocale(file.locale, config?.customMapping),\n })),\n sourceFiles: result.sourceFiles.map((file) => ({\n ...file,\n sourceLocale: resolveAliasLocale(\n file.sourceLocale,\n config?.customMapping\n ),\n locales: file.locales.map((locale) =>\n resolveAliasLocale(locale, config?.customMapping)\n ),\n })),\n };\n },\n\n async querySourceFile(\n path: GetTranslationStatusData['path'],\n query: GetTranslationStatusData['query'] = {},\n timeoutMs?: number\n ) {\n const result = unwrapApiResult(\n await getTranslationStatus({\n path,\n query,\n client: getClient(timeoutMs),\n })\n );\n return {\n ...result,\n translations: result.translations.map((translation) => ({\n ...translation,\n locale: resolveAliasLocale(translation.locale, config?.customMapping),\n })),\n sourceFile: {\n ...result.sourceFile,\n sourceLocale: resolveAliasLocale(\n result.sourceFile.sourceLocale,\n config?.customMapping\n ),\n locales: result.sourceFile.locales.map((locale) =>\n resolveAliasLocale(locale, config?.customMapping)\n ),\n },\n };\n },\n\n async downloadFileBatch(\n files: DownloadFilesData['body'],\n options: { timeout?: number } = {}\n ) {\n const request = async (batch: DownloadFilesData['body']) =>\n unwrapApiResult(\n await downloadFiles({\n body: batch.map((file) => ({\n ...file,\n locale: file.locale\n ? resolveServiceLocale(file.locale)\n : undefined,\n })),\n client: getClient(options.timeout),\n })\n );\n const responses = await processBatches(files, async (batch) => [\n await request(batch),\n ]);\n return {\n files: responses.flatMap((response) =>\n response.files.map(\n (file): DownloadedFile => ({\n ...file,\n ...(file.locale && {\n locale: resolveAliasLocale(file.locale, config?.customMapping),\n }),\n data: decodeFileContent(file.data, file.fileFormat),\n metadata: file.metadata,\n })\n )\n ),\n count: responses.reduce((count, response) => count + response.count, 0),\n pending: responses.flatMap((response) =>\n (response.pending ?? []).map((file) => ({\n ...file,\n locale: resolveAliasLocale(file.locale, config?.customMapping),\n }))\n ),\n };\n },\n\n async uploadSourceFiles(\n files: Array<{\n source: UploadSourceFilesData['body']['data'][number]['source'];\n }>,\n options: { sourceLocale: string; timeout?: number }\n ) {\n const sourceLocale = resolveServiceLocale(options.sourceLocale);\n const result = await processBatches(files, async (batch) => {\n const response = unwrapApiResult(\n await uploadSourceFiles({\n body: {\n data: batch.map(({ source }) => ({\n source: {\n ...source,\n content: encodeFileContent(source.content, source.fileFormat),\n locale: resolveServiceLocale(source.locale),\n },\n })),\n sourceLocale,\n },\n client: getClient(options.timeout),\n })\n );\n return response.uploadedFiles.map(aliasUploadedFileLocale);\n });\n\n return { uploadedFiles: result };\n },\n\n async uploadFonts(\n fonts: UploadAssetsData['body']['assets'],\n options: { timeout?: number } = {}\n ) {\n const assets = await processBatches(\n fonts,\n async (batch) => {\n const result = unwrapApiResult(\n await uploadAssets({\n body: { assets: batch },\n client: getClient(options.timeout),\n })\n );\n return result.assets;\n },\n { batchSize: 50 }\n );\n return { assets, count: assets.length };\n },\n\n async uploadTranslations(\n files: UploadTranslationsData['body']['data'],\n options: { sourceLocale: string; timeout?: number }\n ) {\n validateFileFormatTransforms(files.map(({ source }) => source));\n const result = await processBatches(files, async (batch) => {\n const response = unwrapApiResult(\n await uploadTranslations({\n body: {\n data: batch.map(({ source, translations }) => ({\n source: {\n ...source,\n content: encodeFileContent(source.content, source.fileFormat),\n locale: resolveServiceLocale(source.locale),\n },\n translations: translations.map((translation) => ({\n ...translation,\n locale: resolveServiceLocale(translation.locale),\n content: encodeFileContent(\n translation.content,\n translation.fileFormat\n ),\n })),\n })),\n sourceLocale: resolveServiceLocale(options.sourceLocale),\n },\n client: getClient(options.timeout),\n })\n );\n return response.uploadedFiles.map(aliasUploadedFileLocale);\n });\n\n return { uploadedFiles: result };\n },\n };\n}\n\nexport type GtApiAdapter = ReturnType<typeof createGtApiAdapter>;\n","import {\n parse,\n TYPE,\n type MessageFormatElement,\n type ParserOptions,\n} from '@generaltranslation/icu';\n\ntype TraverseIcuOptions = ParserOptions & {\n recurseIntoVisited?: boolean;\n};\n\n/**\n * Given an ICU string, traverse the AST and call the visitor function for each element that matches the type T\n * @param icu - The ICU string to traverse\n * @param shouldVisit - A function that returns true if the element should be visited\n * @param visitor - A function that is called for each element that matches the type T\n * @returns The modified AST of the ICU string.\n *\n * @note This function is a heavy operation, use sparingly\n */\nexport function traverseIcu<T extends MessageFormatElement>({\n icuString,\n shouldVisit,\n visitor,\n options: { recurseIntoVisited = true, ...otherOptions },\n}: {\n icuString: string;\n shouldVisit: (element: MessageFormatElement) => element is T;\n visitor: (element: T) => void;\n options: TraverseIcuOptions;\n}): MessageFormatElement[] {\n const ast = parse(icuString, otherOptions);\n handleChildren(ast);\n return ast;\n\n function handleChildren(children: MessageFormatElement[]): void {\n children.map(handleChild);\n }\n\n function handleChild(child: MessageFormatElement) {\n // handle select var\n let visited = false;\n if (shouldVisit(child)) {\n visitor(child);\n visited = true;\n }\n // recurse on children\n if (!visited || recurseIntoVisited) {\n if (child.type === TYPE.select || child.type === TYPE.plural) {\n Object.values(child.options)\n .map((option) => option.value)\n .map(handleChildren);\n } else if (child.type === TYPE.tag) {\n handleChildren(child.children);\n }\n }\n }\n}\n","export const VAR_IDENTIFIER = '_gt_';\nexport const VAR_NAME_IDENTIFIER = '_gt_var_name';\n","import { VAR_IDENTIFIER } from './constants';\n\n// Regex for _gt_# select\nexport const GT_INDEXED_IDENTIFIER_REGEX = new RegExp(\n `^${VAR_IDENTIFIER}\\\\d+$`\n);\n\nexport const GT_UNINDEXED_IDENTIFIER_REGEX = new RegExp(`^${VAR_IDENTIFIER}$`);\n","import {\n GT_INDEXED_IDENTIFIER_REGEX,\n GT_UNINDEXED_IDENTIFIER_REGEX,\n} from './regex';\nimport { GTIndexedSelectElement, GTUnindexedSelectElement } from './types';\nimport { TYPE, type MessageFormatElement } from '@generaltranslation/icu';\n\n// Visit any _gt_# select\nexport function isGTIndexedSelectElement(\n child: MessageFormatElement\n): child is GTIndexedSelectElement {\n return (\n child.type === TYPE.select &&\n GT_INDEXED_IDENTIFIER_REGEX.test(child.value) &&\n !!child.options.other &&\n (child.options.other.value.length === 0 ||\n (child.options.other.value.length > 0 &&\n child.options.other.value[0]?.type === TYPE.literal))\n );\n}\n\n// Visit any _gt_ select\nexport function isGTUnindexedSelectElement(\n child: MessageFormatElement\n): child is GTUnindexedSelectElement {\n return (\n child.type === TYPE.select &&\n GT_UNINDEXED_IDENTIFIER_REGEX.test(child.value) &&\n !!child.options.other &&\n (child.options.other.value.length === 0 ||\n (child.options.other.value.length > 0 &&\n child.options.other.value[0]?.type === TYPE.literal))\n );\n}\n","import { traverseIcu } from './utils/traverseIcu';\nimport { VAR_IDENTIFIER } from './utils/constants';\nimport { GTUnindexedSelectElement } from './utils/types';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\n\ntype Location = {\n start: number;\n end: number;\n value: string;\n};\n\n/**\n * Given an encoded ICU string, interpolate only _gt_ variables that have been marked with declareVar()\n * @example\n * const encodedIcu = \"Hi\" + declareVar(\"Brian\") + \", my name is {name}\"\n * // 'Hi {_gt_, select, other {Brian}}, my name is {name}'\n * decodeVars(encodedIcu)\n * // 'Hi Brian, my name is {name}'\n */\nexport function decodeVars(icuString: string): string {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return icuString;\n }\n\n // Record the location of the variable\n const variableLocations: Location[] = [];\n function visitor(child: GTUnindexedSelectElement): void {\n variableLocations.push({\n start: child.location?.start.offset ?? 0,\n end: child.location?.end.offset ?? 0,\n value:\n child.options.other.value.length > 0\n ? child.options.other.value[0].value\n : '',\n });\n }\n\n // Find all variable identifiers.\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: {\n recurseIntoVisited: false,\n captureLocation: true,\n },\n });\n\n // Construct output string\n let previousIndex = 0;\n const outputList = [];\n for (let i = 0; i < variableLocations.length; i++) {\n outputList.push(icuString.slice(previousIndex, variableLocations[i].start));\n outputList.push(variableLocations[i].value);\n previousIndex = variableLocations[i].end;\n }\n if (previousIndex < icuString.length) {\n outputList.push(icuString.slice(previousIndex));\n }\n const outputString = outputList.join('');\n\n return outputString;\n}\n","/**\n * Sanitizes string by escaping ICU syntax\n *\n * Sanitize arbitrary string so it does not break the following ICU message syntax:\n * {_gt_, select, other {string_here}}\n *\n * Escapes ICU special characters by:\n * 1. Doubling all single quotes (U+0027 ')\n * 2. Adding a single quote before the first special character ({}<>)\n * 3. Adding a single quote after the last special character ({}<>)\n */\nexport function sanitizeVar(string: string): string {\n // First, double all single quotes (both ASCII and Unicode).\n let result = string.replace(/'/g, \"''\");\n\n // Find first and last positions of special characters\n const specialChars = /[{}<>]/;\n const firstSpecialIndex = result.search(specialChars);\n\n if (firstSpecialIndex === -1) {\n // No special characters; return with just doubled quotes.\n return result;\n }\n\n // Find last special character position\n let lastSpecialIndex = -1;\n for (let i = result.length - 1; i >= 0; i--) {\n if (specialChars.test(result[i])) {\n lastSpecialIndex = i;\n break;\n }\n }\n\n // Insert quotes around the special character region.\n result =\n result.slice(0, firstSpecialIndex) +\n \"'\" +\n result.slice(firstSpecialIndex, lastSpecialIndex + 1) +\n \"'\" +\n result.slice(lastSpecialIndex + 1);\n\n return result;\n}\n","import { VAR_IDENTIFIER, VAR_NAME_IDENTIFIER } from './utils/constants';\nimport { sanitizeVar } from './utils/sanitizeVar';\n\n/**\n * Mark as a non-translatable string. Use within a derive() call to mark content as not derivable (e.g., not possible to statically analyze).\n *\n * @example\n * function nonDerivableFunction() {\n * return Math.random();\n * }\n *\n * function derivableFunction() {\n * if (condition) {\n * return declareVar(nonDerivableFunction())\n * }\n * return 'John Doe';\n * }\n *\n * const gt = useGT();\n * gt(`My name is ${derive(derivableFunction())}`);\n *\n * @param {string | number | boolean | null | undefined} variable - The variable to sanitize.\n * @param {Object} [options] - The options for the sanitization.\n * @param {string} [options.$name] - The name of the variable.\n * @returns {string} The sanitized value.\n */\nexport function declareVar(\n variable: string | number | boolean | null | undefined,\n options?: { $name?: string }\n): string {\n // Variable section.\n const sanitizedVariable = sanitizeVar(String(variable ?? ''));\n const variableSection = ` other {${sanitizedVariable}}`;\n\n // Name section.\n let nameSection = '';\n if (options?.$name) {\n const sanitizedName = sanitizeVar(options.$name);\n nameSection = ` ${VAR_NAME_IDENTIFIER} {${sanitizedName}}`;\n }\n\n // interpolate\n return `{${VAR_IDENTIFIER}, select,${variableSection}${nameSection}}`;\n}\n","/**\n * Marks content as derivable by the GT compiler and CLI.\n *\n * Use `derive()` when a translation string or context needs content that is\n * computed from source code, but should still be discovered during extraction\n * instead of treated as a runtime interpolation variable. The CLI attempts to\n * resolve the derivable expression into every possible static value and\n * includes those values in the source content that gets translated.\n *\n * `derive()` returns its argument unchanged at runtime.\n *\n * Run `gt validate` after adding or changing `derive()` calls to verify that\n * each derivable expression can be resolved by the CLI before translating or\n * building.\n *\n * @example\n * ```jsx\n * function getSubject() {\n * return (Math.random() > 0.5) ? \"Alice\" : \"Brian\";\n * }\n * ...\n * gt(`My name is ${derive(getSubject())}`);\n * ```\n *\n * @param {T extends string | boolean | number | null | undefined} content - Content to derive for translation extraction.\n * @returns {T} The same content, unchanged at runtime.\n */\nexport function derive<T extends string | boolean | number | null | undefined>(\n content: T\n): T {\n return content;\n}\n"],"mappings":";;;;;;;AAGA,SAAgB,OAAO,MAAsB;AAC3C,KAAI,OAAO,WAAW,YAEpB,QAAO,OAAO,KAAK,MAAM,OAAO,CAAC,SAAS,SAAS;CAGrD,MAAM,QAAQ,IAAI,aAAa,CAAC,OAAO,KAAK;CAC5C,IAAI,SAAS;AACb,MAAK,IAAI,IAAI,GAAG,IAA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AM,eAAe,kBAAkB,GAAG,MAAM,CAAC;AAC3E,aAAW,KAAK,kBAAkB,GAAG,MAAM;AAC3C,kBAAgB,kBAAkB,GAAG;;AAEvC,KAAI,gBAAgB,UAAU,OAC5B,YAAW,KAAK,UAAU,MAAM,cAAc,CAAC;AAIjD,QAFqB,WAAW,KAAK,GAElB;;;;;;;;;;;;;;;ACnDrB,SAAgB,YAAY,QAAwB;CAElD,IAAI,SAAS,OAAO,QAAQ,MAAM,KAAK;CAGvC,MAAM,eAAe;CACrB,MAAM,oBAAoB,OAAO,OAAO,aAAa;AAErD,KAAI,sBAAsB,GAExB,QAAO;CAIT,IAAI,mBAAmB;AACvB,MAAK,IAAI,IAAI,OAAO,SAAS,GAAG,KAAK,GAAG,IACtC,KAAI,aAAa,KAAK,OAAO,GAAG,EAAE;AAChC,qBAAmB;AACnB;;AAKJ,UACE,OAAO,MAAM,GAAG,kBAAkB,GAClC,MACA,OAAO,MAAM,mBAAmB,mBAAmB,EAAE,GACrD,MACA,OAAO,MAAM,mBAAmB,EAAE;AAEpC,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfT,SAAgB,WACd,UACA,SACQ;CAGR,MAAM,kBAAkB,WADE,YAAY,OAAO,YAAY,GAAG,CACR,CAAC;CAGrD,IAAI,cAAc;AAClB,KAAI,SAAS,MAEX,eAAc,IAAI,oBAAoB,IADhB,YAAY,QAAQ,MACa,CAAC;AAI1D,QAAO,IAAI,eAAe,WAAW,kBAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfrE,SAAgB,OACd,SACG;AACH,QAAO"}
@@ -0,0 +1,34 @@
1
+ //#region src/logging/diagnostics.d.ts
2
+ type DiagnosticSeverity = 'Error' | 'Warning';
3
+ /**
4
+ * Text slots follow the five-part error message model:
5
+ * what happened, reassurance, why it happened, how to fix it, and a way out.
6
+ * Clauses that are combined into another sentence should use their intended
7
+ * in-sentence casing.
8
+ */
9
+ type DiagnosticMessageInput = {
10
+ source?: string;
11
+ severity?: DiagnosticSeverity;
12
+ whatHappened: string;
13
+ reassurance?: string;
14
+ why?: string;
15
+ fix?: string;
16
+ wayOut?: string;
17
+ details?: string | string[];
18
+ docsUrl?: string;
19
+ };
20
+ declare function formatDiagnosticErrorDetails(error: unknown): string | undefined;
21
+ declare function createDiagnosticMessage({
22
+ source,
23
+ severity,
24
+ whatHappened,
25
+ reassurance,
26
+ why,
27
+ fix,
28
+ wayOut,
29
+ details,
30
+ docsUrl
31
+ }: DiagnosticMessageInput): string;
32
+ //#endregion
33
+ export { formatDiagnosticErrorDetails as i, DiagnosticSeverity as n, createDiagnosticMessage as r, DiagnosticMessageInput as t };
34
+ //# sourceMappingURL=diagnostics-CqAHg_Vc.d.cts.map
@@ -0,0 +1,45 @@
1
+ //#region src/logging/diagnostics.ts
2
+ function ensureSentence(text) {
3
+ const trimmed = text.trim();
4
+ if (!trimmed) return "";
5
+ return /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;
6
+ }
7
+ function stripSentence(text) {
8
+ const trimmed = text.trim();
9
+ let end = trimmed.length;
10
+ while (end > 0) {
11
+ const char = trimmed[end - 1];
12
+ if (char !== "." && char !== "!" && char !== "?") break;
13
+ end -= 1;
14
+ }
15
+ return trimmed.slice(0, end);
16
+ }
17
+ function formatDetails(details) {
18
+ if (!details) return "";
19
+ const detailText = Array.isArray(details) ? details.join(", ") : details;
20
+ if (!detailText.trim()) return "";
21
+ return ensureSentence(`Details: ${detailText}`);
22
+ }
23
+ function formatDiagnosticErrorDetails(error) {
24
+ if (error == null) return void 0;
25
+ return String(error);
26
+ }
27
+ function createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {
28
+ const prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : "";
29
+ const whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;
30
+ const shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));
31
+ const messageParts = [
32
+ whatAndWhy,
33
+ reassurance,
34
+ shouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,
35
+ shouldCombineWayOut ? void 0 : wayOut,
36
+ formatDetails(details)
37
+ ].filter((part) => !!part).map(ensureSentence);
38
+ if (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);
39
+ const message = messageParts.join(" ");
40
+ return prefix ? `${prefix} ${message}` : message;
41
+ }
42
+ //#endregion
43
+ export { formatDiagnosticErrorDetails as n, createDiagnosticMessage as t };
44
+
45
+ //# sourceMappingURL=diagnostics-DKA2SkZB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-DKA2SkZB.mjs","names":[],"sources":["../src/logging/diagnostics.ts"],"sourcesContent":["export type DiagnosticSeverity = 'Error' | 'Warning';\n\n/**\n * Text slots follow the five-part error message model:\n * what happened, reassurance, why it happened, how to fix it, and a way out.\n * Clauses that are combined into another sentence should use their intended\n * in-sentence casing.\n */\nexport type DiagnosticMessageInput = {\n source?: string;\n severity?: DiagnosticSeverity;\n whatHappened: string;\n reassurance?: string;\n why?: string;\n fix?: string;\n wayOut?: string;\n details?: string | string[];\n docsUrl?: string;\n};\n\nfunction ensureSentence(text: string): string {\n const trimmed = text.trim();\n if (!trimmed) return '';\n return /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\n\nfunction stripSentence(text: string): string {\n const trimmed = text.trim();\n let end = trimmed.length;\n while (end > 0) {\n const char = trimmed[end - 1];\n if (char !== '.' && char !== '!' && char !== '?') break;\n end -= 1;\n }\n return trimmed.slice(0, end);\n}\n\nfunction formatDetails(details: string | string[] | undefined): string {\n if (!details) return '';\n const detailText = Array.isArray(details) ? details.join(', ') : details;\n if (!detailText.trim()) return '';\n return ensureSentence(`Details: ${detailText}`);\n}\n\nexport function formatDiagnosticErrorDetails(\n error: unknown\n): string | undefined {\n if (error == null) return undefined;\n return String(error);\n}\n\nexport function createDiagnosticMessage({\n source,\n severity,\n whatHappened,\n reassurance,\n why,\n fix,\n wayOut,\n details,\n docsUrl,\n}: DiagnosticMessageInput): string {\n const prefix = source\n ? severity\n ? `${source} ${severity}:`\n : `${source}:`\n : severity\n ? `${severity}:`\n : '';\n const whatAndWhy = why\n ? `${stripSentence(whatHappened)} because ${stripSentence(why)}`\n : whatHappened;\n const shouldCombineWayOut =\n !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n const fixAndWayOut = shouldCombineWayOut\n ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}`\n : fix;\n const messageParts = [\n whatAndWhy,\n reassurance,\n fixAndWayOut,\n shouldCombineWayOut ? undefined : wayOut,\n formatDetails(details),\n ]\n .filter((part): part is string => !!part)\n .map(ensureSentence);\n\n if (docsUrl) {\n messageParts.push(`Learn more: ${docsUrl}`);\n }\n\n const message = messageParts.join(' ');\n return prefix ? `${prefix} ${message}` : message;\n}\n"],"mappings":";AAoBA,SAAS,eAAe,MAAsB;CAC5C,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,UAAU,KAAK,QAAQ,GAAG,UAAU,GAAG,QAAQ;;AAGxD,SAAS,cAAc,MAAsB;CAC3C,MAAM,UAAU,KAAK,MAAM;CAC3B,IAAI,MAAM,QAAQ;AAClB,QAAO,MAAM,GAAG;EACd,MAAM,OAAO,QAAQ,MAAM;AAC3B,MAAI,SAAS,OAAO,SAAS,OAAO,SAAS,IAAK;AAClD,SAAO;;AAET,QAAO,QAAQ,MAAM,GAAG,IAAI;;AAG9B,SAAS,cAAc,SAAgD;AACrE,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,aAAa,MAAM,QAAQ,QAAQ,GAAG,QAAQ,KAAK,KAAK,GAAG;AACjE,KAAI,CAAC,WAAW,MAAM,CAAE,QAAO;AAC/B,QAAO,eAAe,YAAY,aAAa;;AAGjD,SAAgB,6BACd,OACoB;AACpB,KAAI,SAAS,KAAM,QAAO,KAAA;AAC1B,QAAO,OAAO,MAAM;;AAGtB,SAAgB,wBAAwB,EACtC,QACA,UACA,cACA,aACA,KACA,KACA,QACA,SACA,WACiC;CACjC,MAAM,SAAS,SACX,WACE,GAAG,OAAO,GAAG,SAAS,KACtB,GAAG,OAAO,KACZ,WACE,GAAG,SAAS,KACZ;CACN,MAAM,aAAa,MACf,GAAG,cAAc,aAAa,CAAC,WAAW,cAAc,IAAI,KAC5D;CACJ,MAAM,sBACJ,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,SAAS,KAAK,cAAc,OAAO,CAAC;CAI3D,MAAM,eAAe;EACnB;EACA;EALmB,sBACjB,GAAG,cAAc,IAAI,CAAC,OAAO,cAAc,OAAO,KAClD;EAKF,sBAAsB,KAAA,IAAY;EAClC,cAAc,QAAQ;EACvB,CACE,QAAQ,SAAyB,CAAC,CAAC,KAAK,CACxC,IAAI,eAAe;AAEtB,KAAI,QACF,cAAa,KAAK,eAAe,UAAU;CAG7C,MAAM,UAAU,aAAa,KAAK,IAAI;AACtC,QAAO,SAAS,GAAG,OAAO,GAAG,YAAY"}
@@ -1,8 +1,3 @@
1
- import { t as ApiError } from "./ApiError-CUKcz3YS.mjs";
2
- //#region src/settings/settings.ts
3
- const libraryDefaultLocale = "en";
4
- const defaultTimeout = 6e4;
5
- //#endregion
6
1
  //#region src/logging/diagnostics.ts
7
2
  function ensureSentence(text) {
8
3
  const trimmed = text.trim();
@@ -45,31 +40,17 @@ function createDiagnosticMessage({ source, severity, whatHappened, reassurance,
45
40
  return prefix ? `${prefix} ${message}` : message;
46
41
  }
47
42
  //#endregion
48
- //#region src/settings/settingsUrls.ts
49
- const defaultCacheUrl = "https://cdn.gtx.dev";
50
- const defaultBaseUrl = "https://api.gtx.dev";
51
- const defaultRuntimeApiUrl = "https://api.gtx.dev";
52
- //#endregion
53
- //#region src/translate/utils/unwrapApiResult.ts
54
- function isErrorResult(error) {
55
- return typeof error === "object" && error !== null && "error" in error && typeof error.error === "string";
56
- }
57
- function hasDecodedError(result) {
58
- return isErrorResult(result.error) || typeof result.error === "string";
59
- }
60
- /**
61
- * Unwraps a `@generaltranslation/api` SDK result, returning its data or
62
- * throwing an `ApiError` built from the failed response.
63
- */
64
- function unwrapApiResult(result) {
65
- if (result.data !== void 0) return result.data;
66
- if (result.response) {
67
- const details = isErrorResult(result.error) ? result.error.error : typeof result.error === "string" ? result.error : result.response.statusText;
68
- throw new ApiError(details, result.response.status, details);
43
+ Object.defineProperty(exports, "createDiagnosticMessage", {
44
+ enumerable: true,
45
+ get: function() {
46
+ return createDiagnosticMessage;
69
47
  }
70
- throw result.error;
71
- }
72
- //#endregion
73
- export { defaultCacheUrl as a, formatDiagnosticErrorDetails as c, defaultBaseUrl as i, defaultTimeout as l, isErrorResult as n, defaultRuntimeApiUrl as o, unwrapApiResult as r, createDiagnosticMessage as s, hasDecodedError as t, libraryDefaultLocale as u };
48
+ });
49
+ Object.defineProperty(exports, "formatDiagnosticErrorDetails", {
50
+ enumerable: true,
51
+ get: function() {
52
+ return formatDiagnosticErrorDetails;
53
+ }
54
+ });
74
55
 
75
- //# sourceMappingURL=unwrapApiResult-BzGfPw75.mjs.map
56
+ //# sourceMappingURL=diagnostics-DKtiPUvo.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-DKtiPUvo.cjs","names":[],"sources":["../src/logging/diagnostics.ts"],"sourcesContent":["export type DiagnosticSeverity = 'Error' | 'Warning';\n\n/**\n * Text slots follow the five-part error message model:\n * what happened, reassurance, why it happened, how to fix it, and a way out.\n * Clauses that are combined into another sentence should use their intended\n * in-sentence casing.\n */\nexport type DiagnosticMessageInput = {\n source?: string;\n severity?: DiagnosticSeverity;\n whatHappened: string;\n reassurance?: string;\n why?: string;\n fix?: string;\n wayOut?: string;\n details?: string | string[];\n docsUrl?: string;\n};\n\nfunction ensureSentence(text: string): string {\n const trimmed = text.trim();\n if (!trimmed) return '';\n return /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\n\nfunction stripSentence(text: string): string {\n const trimmed = text.trim();\n let end = trimmed.length;\n while (end > 0) {\n const char = trimmed[end - 1];\n if (char !== '.' && char !== '!' && char !== '?') break;\n end -= 1;\n }\n return trimmed.slice(0, end);\n}\n\nfunction formatDetails(details: string | string[] | undefined): string {\n if (!details) return '';\n const detailText = Array.isArray(details) ? details.join(', ') : details;\n if (!detailText.trim()) return '';\n return ensureSentence(`Details: ${detailText}`);\n}\n\nexport function formatDiagnosticErrorDetails(\n error: unknown\n): string | undefined {\n if (error == null) return undefined;\n return String(error);\n}\n\nexport function createDiagnosticMessage({\n source,\n severity,\n whatHappened,\n reassurance,\n why,\n fix,\n wayOut,\n details,\n docsUrl,\n}: DiagnosticMessageInput): string {\n const prefix = source\n ? severity\n ? `${source} ${severity}:`\n : `${source}:`\n : severity\n ? `${severity}:`\n : '';\n const whatAndWhy = why\n ? `${stripSentence(whatHappened)} because ${stripSentence(why)}`\n : whatHappened;\n const shouldCombineWayOut =\n !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n const fixAndWayOut = shouldCombineWayOut\n ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}`\n : fix;\n const messageParts = [\n whatAndWhy,\n reassurance,\n fixAndWayOut,\n shouldCombineWayOut ? undefined : wayOut,\n formatDetails(details),\n ]\n .filter((part): part is string => !!part)\n .map(ensureSentence);\n\n if (docsUrl) {\n messageParts.push(`Learn more: ${docsUrl}`);\n }\n\n const message = messageParts.join(' ');\n return prefix ? `${prefix} ${message}` : message;\n}\n"],"mappings":";AAoBA,SAAS,eAAe,MAAsB;CAC5C,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,UAAU,KAAK,QAAQ,GAAG,UAAU,GAAG,QAAQ;;AAGxD,SAAS,cAAc,MAAsB;CAC3C,MAAM,UAAU,KAAK,MAAM;CAC3B,IAAI,MAAM,QAAQ;AAClB,QAAO,MAAM,GAAG;EACd,MAAM,OAAO,QAAQ,MAAM;AAC3B,MAAI,SAAS,OAAO,SAAS,OAAO,SAAS,IAAK;AAClD,SAAO;;AAET,QAAO,QAAQ,MAAM,GAAG,IAAI;;AAG9B,SAAS,cAAc,SAAgD;AACrE,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,aAAa,MAAM,QAAQ,QAAQ,GAAG,QAAQ,KAAK,KAAK,GAAG;AACjE,KAAI,CAAC,WAAW,MAAM,CAAE,QAAO;AAC/B,QAAO,eAAe,YAAY,aAAa;;AAGjD,SAAgB,6BACd,OACoB;AACpB,KAAI,SAAS,KAAM,QAAO,KAAA;AAC1B,QAAO,OAAO,MAAM;;AAGtB,SAAgB,wBAAwB,EACtC,QACA,UACA,cACA,aACA,KACA,KACA,QACA,SACA,WACiC;CACjC,MAAM,SAAS,SACX,WACE,GAAG,OAAO,GAAG,SAAS,KACtB,GAAG,OAAO,KACZ,WACE,GAAG,SAAS,KACZ;CACN,MAAM,aAAa,MACf,GAAG,cAAc,aAAa,CAAC,WAAW,cAAc,IAAI,KAC5D;CACJ,MAAM,sBACJ,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,SAAS,KAAK,cAAc,OAAO,CAAC;CAI3D,MAAM,eAAe;EACnB;EACA;EALmB,sBACjB,GAAG,cAAc,IAAI,CAAC,OAAO,cAAc,OAAO,KAClD;EAKF,sBAAsB,KAAA,IAAY;EAClC,cAAc,QAAQ;EACvB,CACE,QAAQ,SAAyB,CAAC,CAAC,KAAK,CACxC,IAAI,eAAe;AAEtB,KAAI,QACF,cAAa,KAAK,eAAe,UAAU;CAG7C,MAAM,UAAU,aAAa,KAAK,IAAI;AACtC,QAAO,SAAS,GAAG,OAAO,GAAG,YAAY"}
@@ -0,0 +1,34 @@
1
+ //#region src/logging/diagnostics.d.ts
2
+ type DiagnosticSeverity = 'Error' | 'Warning';
3
+ /**
4
+ * Text slots follow the five-part error message model:
5
+ * what happened, reassurance, why it happened, how to fix it, and a way out.
6
+ * Clauses that are combined into another sentence should use their intended
7
+ * in-sentence casing.
8
+ */
9
+ type DiagnosticMessageInput = {
10
+ source?: string;
11
+ severity?: DiagnosticSeverity;
12
+ whatHappened: string;
13
+ reassurance?: string;
14
+ why?: string;
15
+ fix?: string;
16
+ wayOut?: string;
17
+ details?: string | string[];
18
+ docsUrl?: string;
19
+ };
20
+ declare function formatDiagnosticErrorDetails(error: unknown): string | undefined;
21
+ declare function createDiagnosticMessage({
22
+ source,
23
+ severity,
24
+ whatHappened,
25
+ reassurance,
26
+ why,
27
+ fix,
28
+ wayOut,
29
+ details,
30
+ docsUrl
31
+ }: DiagnosticMessageInput): string;
32
+ //#endregion
33
+ export { formatDiagnosticErrorDetails as i, DiagnosticSeverity as n, createDiagnosticMessage as r, DiagnosticMessageInput as t };
34
+ //# sourceMappingURL=diagnostics-DYtVjOm5.d.mts.map
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_diagnostics = require("./diagnostics-DKtiPUvo.cjs");
3
+ exports.createDiagnosticMessage = require_diagnostics.createDiagnosticMessage;
4
+ exports.formatDiagnosticErrorDetails = require_diagnostics.formatDiagnosticErrorDetails;
@@ -0,0 +1,2 @@
1
+ import { i as formatDiagnosticErrorDetails, n as DiagnosticSeverity, r as createDiagnosticMessage, t as DiagnosticMessageInput } from "./diagnostics-CqAHg_Vc.cjs";
2
+ export { type DiagnosticMessageInput, type DiagnosticSeverity, createDiagnosticMessage, formatDiagnosticErrorDetails };
@@ -0,0 +1,2 @@
1
+ import { i as formatDiagnosticErrorDetails, n as DiagnosticSeverity, r as createDiagnosticMessage, t as DiagnosticMessageInput } from "./diagnostics-DYtVjOm5.mjs";
2
+ export { type DiagnosticMessageInput, type DiagnosticSeverity, createDiagnosticMessage, formatDiagnosticErrorDetails };
@@ -0,0 +1 @@
1
+ export { createDiagnosticMessage, formatDiagnosticErrorDetails, type DiagnosticMessageInput, type DiagnosticSeverity, } from './logging/diagnostics';
@@ -0,0 +1 @@
1
+ export { createDiagnosticMessage, formatDiagnosticErrorDetails, } from './logging/diagnostics';
@@ -0,0 +1,2 @@
1
+ import { n as formatDiagnosticErrorDetails, t as createDiagnosticMessage } from "./diagnostics-DKA2SkZB.mjs";
2
+ export { createDiagnosticMessage, formatDiagnosticErrorDetails };
package/dist/errors.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ApiError = require("./ApiError-BcjcnTAr.cjs");
2
+ const require_ApiError = require("./ApiError-BCjEo_CM.cjs");
3
3
  exports.ApiError = require_ApiError.ApiError;
package/dist/errors.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as ApiError } from "./ApiError-CUKcz3YS.mjs";
1
+ import { t as ApiError } from "./ApiError-DxWKM0Xt.mjs";
2
2
  export { ApiError };
@@ -1 +1 @@
1
- {"version":3,"file":"file-B37WkCqM.cjs","names":[],"sources":["../src/types-dir/api/file.ts"],"sourcesContent":["import type { DataFormat } from '@generaltranslation/format/types';\nimport { Updates } from './enqueueFiles';\nimport type { JsonObject } from './json';\n\nexport type FileFormat = import('@generaltranslation/api').FileFormat;\n\n/**\n * File formats whose content travels through the pipeline already\n * base64-encoded, so the usual UTF-8 encode/decode steps are skipped and the\n * bytes reach the API unaltered.\n *\n * LOTTIE qualifies because it is a zip bundle. Apple's `.strings` and\n * `.stringsdict` do not: they are text in whichever encoding Xcode wrote, and\n * the client decodes that to UTF-8 before upload and restores it on write, so\n * only the client ever handles their bytes.\n */\nexport const BINARY_FILE_FORMATS: ReadonlySet<FileFormat> = new Set<FileFormat>(\n ['LOTTIE']\n);\n\n/**\n * Whether a file format's content is carried as base64 end-to-end rather than\n * as a UTF-8 text string.\n */\nexport function isBinaryFileFormat(fileFormat: FileFormat): boolean {\n return BINARY_FILE_FORMATS.has(fileFormat);\n}\n\n/**\n * Metadata for files or entries.\n */\nexport type FormatMetadata = JsonObject | Updates[number]['metadata'];\n\n/**\n * File object structure for uploading files.\n * @see {@link FileReferenceOptionalBranchId}\n * @property {string} content - Content of the file.\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {FormatMetadata} [formatMetadata] - Optional metadata for the file, specific to the format of the file\n * @property {string} [incomingBranchId] - The ID of the incoming branch of the file.\n * @property {string} [checkedOutBranchId] - The ID of the checked-out branch of the file.\n */\nexport type FileToUpload = Omit<FileReference, 'branchId'> & {\n content: string;\n locale: string;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n formatMetadata?: FormatMetadata;\n branchId?: string;\n incomingBranchId?: string;\n checkedOutBranchId?: string;\n};\n\n/**\n * File object structure for referencing files.\n * @property {string} fileId - The ID of the file.\n * @property {string} versionId - The ID of the version of the file\n * @property {string} branchId - The ID of the branch of the file\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {string} fileName - The name of the file.\n * @property {FileFormat} fileFormat - The format of the file (JSON, MDX, MD, etc.).\n * @property {DataFormat} [dataFormat] - Optional format of the data within the file.\n */\nexport type FileReference = {\n fileId: string;\n versionId: string;\n branchId: string;\n fileName: string;\n fileFormat: FileFormat;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n\n/**\n * File reference object structure for referencing files.\n * @see {@link FileReference}\n * @property {string} [branchId] - The ID of the branch of the file\n */\nexport type FileReferenceIds = Omit<\n FileReference,\n 'branchId' | 'fileName' | 'fileFormat' | 'dataFormat'\n> & {\n branchId?: string;\n fileName?: string;\n fileFormat?: FileFormat;\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,sBAA+C,IAAI,IAC9D,CAAC,SAAS,CACX;;;;;AAMD,SAAgB,mBAAmB,YAAiC;AAClE,QAAO,oBAAoB,IAAI,WAAW"}
1
+ {"version":3,"file":"file-B37WkCqM.cjs","names":[],"sources":["../src/types-dir/api/file.ts"],"sourcesContent":["import type { FileFormat } from '@generaltranslation/api';\nimport type { DataFormat } from '@generaltranslation/format/types';\nimport { Updates } from './enqueueFiles';\nimport type { JsonObject } from './json';\n\nexport type { FileFormat };\n\n/**\n * File formats whose content travels through the pipeline already\n * base64-encoded, so the usual UTF-8 encode/decode steps are skipped and the\n * bytes reach the API unaltered.\n *\n * LOTTIE qualifies because it is a zip bundle. Apple's `.strings` and\n * `.stringsdict` do not: they are text in whichever encoding Xcode wrote, and\n * the client decodes that to UTF-8 before upload and restores it on write, so\n * only the client ever handles their bytes.\n */\nexport const BINARY_FILE_FORMATS: ReadonlySet<FileFormat> = new Set<FileFormat>(\n ['LOTTIE']\n);\n\n/**\n * Whether a file format's content is carried as base64 end-to-end rather than\n * as a UTF-8 text string.\n */\nexport function isBinaryFileFormat(fileFormat: FileFormat): boolean {\n return BINARY_FILE_FORMATS.has(fileFormat);\n}\n\n/**\n * Metadata for files or entries.\n */\nexport type FormatMetadata = JsonObject | Updates[number]['metadata'];\n\n/**\n * File object structure for uploading files.\n * @see {@link FileReferenceOptionalBranchId}\n * @property {string} content - Content of the file.\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {FormatMetadata} [formatMetadata] - Optional metadata for the file, specific to the format of the file\n * @property {string} [incomingBranchId] - The ID of the incoming branch of the file.\n * @property {string} [checkedOutBranchId] - The ID of the checked-out branch of the file.\n */\nexport type FileToUpload = Omit<FileReference, 'branchId'> & {\n content: string;\n locale: string;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n formatMetadata?: FormatMetadata;\n branchId?: string;\n incomingBranchId?: string;\n checkedOutBranchId?: string;\n};\n\n/**\n * File object structure for referencing files.\n * @property {string} fileId - The ID of the file.\n * @property {string} versionId - The ID of the version of the file\n * @property {string} branchId - The ID of the branch of the file\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {string} fileName - The name of the file.\n * @property {FileFormat} fileFormat - The format of the file (JSON, MDX, MD, etc.).\n * @property {DataFormat} [dataFormat] - Optional format of the data within the file.\n */\nexport type FileReference = {\n fileId: string;\n versionId: string;\n branchId: string;\n fileName: string;\n fileFormat: FileFormat;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n\n/**\n * File reference object structure for referencing files.\n * @see {@link FileReference}\n * @property {string} [branchId] - The ID of the branch of the file\n */\nexport type FileReferenceIds = Omit<\n FileReference,\n 'branchId' | 'fileName' | 'fileFormat' | 'dataFormat'\n> & {\n branchId?: string;\n fileName?: string;\n fileFormat?: FileFormat;\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n"],"mappings":";;;;;;;;;;;AAiBA,MAAa,sBAA+C,IAAI,IAC9D,CAAC,SAAS,CACX;;;;;AAMD,SAAgB,mBAAmB,YAAiC;AAClE,QAAO,oBAAoB,IAAI,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"file-Dga6cyM8.mjs","names":[],"sources":["../src/types-dir/api/file.ts"],"sourcesContent":["import type { DataFormat } from '@generaltranslation/format/types';\nimport { Updates } from './enqueueFiles';\nimport type { JsonObject } from './json';\n\nexport type FileFormat = import('@generaltranslation/api').FileFormat;\n\n/**\n * File formats whose content travels through the pipeline already\n * base64-encoded, so the usual UTF-8 encode/decode steps are skipped and the\n * bytes reach the API unaltered.\n *\n * LOTTIE qualifies because it is a zip bundle. Apple's `.strings` and\n * `.stringsdict` do not: they are text in whichever encoding Xcode wrote, and\n * the client decodes that to UTF-8 before upload and restores it on write, so\n * only the client ever handles their bytes.\n */\nexport const BINARY_FILE_FORMATS: ReadonlySet<FileFormat> = new Set<FileFormat>(\n ['LOTTIE']\n);\n\n/**\n * Whether a file format's content is carried as base64 end-to-end rather than\n * as a UTF-8 text string.\n */\nexport function isBinaryFileFormat(fileFormat: FileFormat): boolean {\n return BINARY_FILE_FORMATS.has(fileFormat);\n}\n\n/**\n * Metadata for files or entries.\n */\nexport type FormatMetadata = JsonObject | Updates[number]['metadata'];\n\n/**\n * File object structure for uploading files.\n * @see {@link FileReferenceOptionalBranchId}\n * @property {string} content - Content of the file.\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {FormatMetadata} [formatMetadata] - Optional metadata for the file, specific to the format of the file\n * @property {string} [incomingBranchId] - The ID of the incoming branch of the file.\n * @property {string} [checkedOutBranchId] - The ID of the checked-out branch of the file.\n */\nexport type FileToUpload = Omit<FileReference, 'branchId'> & {\n content: string;\n locale: string;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n formatMetadata?: FormatMetadata;\n branchId?: string;\n incomingBranchId?: string;\n checkedOutBranchId?: string;\n};\n\n/**\n * File object structure for referencing files.\n * @property {string} fileId - The ID of the file.\n * @property {string} versionId - The ID of the version of the file\n * @property {string} branchId - The ID of the branch of the file\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {string} fileName - The name of the file.\n * @property {FileFormat} fileFormat - The format of the file (JSON, MDX, MD, etc.).\n * @property {DataFormat} [dataFormat] - Optional format of the data within the file.\n */\nexport type FileReference = {\n fileId: string;\n versionId: string;\n branchId: string;\n fileName: string;\n fileFormat: FileFormat;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n\n/**\n * File reference object structure for referencing files.\n * @see {@link FileReference}\n * @property {string} [branchId] - The ID of the branch of the file\n */\nexport type FileReferenceIds = Omit<\n FileReference,\n 'branchId' | 'fileName' | 'fileFormat' | 'dataFormat'\n> & {\n branchId?: string;\n fileName?: string;\n fileFormat?: FileFormat;\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,sBAA+C,IAAI,IAC9D,CAAC,SAAS,CACX;;;;;AAMD,SAAgB,mBAAmB,YAAiC;AAClE,QAAO,oBAAoB,IAAI,WAAW"}
1
+ {"version":3,"file":"file-Dga6cyM8.mjs","names":[],"sources":["../src/types-dir/api/file.ts"],"sourcesContent":["import type { FileFormat } from '@generaltranslation/api';\nimport type { DataFormat } from '@generaltranslation/format/types';\nimport { Updates } from './enqueueFiles';\nimport type { JsonObject } from './json';\n\nexport type { FileFormat };\n\n/**\n * File formats whose content travels through the pipeline already\n * base64-encoded, so the usual UTF-8 encode/decode steps are skipped and the\n * bytes reach the API unaltered.\n *\n * LOTTIE qualifies because it is a zip bundle. Apple's `.strings` and\n * `.stringsdict` do not: they are text in whichever encoding Xcode wrote, and\n * the client decodes that to UTF-8 before upload and restores it on write, so\n * only the client ever handles their bytes.\n */\nexport const BINARY_FILE_FORMATS: ReadonlySet<FileFormat> = new Set<FileFormat>(\n ['LOTTIE']\n);\n\n/**\n * Whether a file format's content is carried as base64 end-to-end rather than\n * as a UTF-8 text string.\n */\nexport function isBinaryFileFormat(fileFormat: FileFormat): boolean {\n return BINARY_FILE_FORMATS.has(fileFormat);\n}\n\n/**\n * Metadata for files or entries.\n */\nexport type FormatMetadata = JsonObject | Updates[number]['metadata'];\n\n/**\n * File object structure for uploading files.\n * @see {@link FileReferenceOptionalBranchId}\n * @property {string} content - Content of the file.\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {FormatMetadata} [formatMetadata] - Optional metadata for the file, specific to the format of the file\n * @property {string} [incomingBranchId] - The ID of the incoming branch of the file.\n * @property {string} [checkedOutBranchId] - The ID of the checked-out branch of the file.\n */\nexport type FileToUpload = Omit<FileReference, 'branchId'> & {\n content: string;\n locale: string;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n formatMetadata?: FormatMetadata;\n branchId?: string;\n incomingBranchId?: string;\n checkedOutBranchId?: string;\n};\n\n/**\n * File object structure for referencing files.\n * @property {string} fileId - The ID of the file.\n * @property {string} versionId - The ID of the version of the file\n * @property {string} branchId - The ID of the branch of the file\n * @property {string} locale - The locale of the file (e.g. 'en', 'de', 'es', etc.)\n * @property {string} fileName - The name of the file.\n * @property {FileFormat} fileFormat - The format of the file (JSON, MDX, MD, etc.).\n * @property {DataFormat} [dataFormat] - Optional format of the data within the file.\n */\nexport type FileReference = {\n fileId: string;\n versionId: string;\n branchId: string;\n fileName: string;\n fileFormat: FileFormat;\n // Optional output format requested for generated translations.\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n\n/**\n * File reference object structure for referencing files.\n * @see {@link FileReference}\n * @property {string} [branchId] - The ID of the branch of the file\n */\nexport type FileReferenceIds = Omit<\n FileReference,\n 'branchId' | 'fileName' | 'fileFormat' | 'dataFormat'\n> & {\n branchId?: string;\n fileName?: string;\n fileFormat?: FileFormat;\n transformFormat?: FileFormat;\n dataFormat?: DataFormat;\n};\n"],"mappings":";;;;;;;;;;;AAiBA,MAAa,sBAA+C,IAAI,IAC9D,CAAC,SAAS,CACX;;;;;AAMD,SAAgB,mBAAmB,YAAiC;AAClE,QAAO,oBAAoB,IAAI,WAAW"}
@@ -1,4 +1,3 @@
1
- import { t as isVariable } from "./isVariable-8-Wy5FnX.mjs";
2
1
  import { sha256 } from "@noble/hashes/sha2.js";
3
2
  import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
4
3
  //#region src/utils/stableStringify.ts
@@ -34,6 +33,23 @@ function stableStringify(data) {
34
33
  return _stringify(data) ?? "";
35
34
  }
36
35
  //#endregion
36
+ //#region src/utils/isVariable.ts
37
+ function isVariable(obj) {
38
+ const variableObj = obj;
39
+ if (variableObj && typeof variableObj === "object" && typeof variableObj.k === "string") {
40
+ const k = Object.keys(variableObj);
41
+ if (k.length === 1) return true;
42
+ if (k.length === 2) {
43
+ if (typeof variableObj.i === "number") return true;
44
+ if (typeof variableObj.v === "string") return true;
45
+ }
46
+ if (k.length === 3) {
47
+ if (typeof variableObj.v === "string" && typeof variableObj.i === "number") return true;
48
+ }
49
+ }
50
+ return false;
51
+ }
52
+ //#endregion
37
53
  //#region src/id/hashSource.ts
38
54
  /**
39
55
  * Calculates a unique hash for a given string using SHA-256.
@@ -101,6 +117,6 @@ function sanitizeJsxChildren(childrenAsObjects) {
101
117
  return Array.isArray(childrenAsObjects) ? childrenAsObjects.map(sanitizeChild) : sanitizeChild(childrenAsObjects);
102
118
  }
103
119
  //#endregion
104
- export { hashString as n, hashSource as t };
120
+ export { hashString as n, isVariable as r, hashSource as t };
105
121
 
106
- //# sourceMappingURL=id-X2zyx5Jk.mjs.map
122
+ //# sourceMappingURL=id-B2wA7-S-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-B2wA7-S-.mjs","names":["stringify"],"sources":["../src/utils/stableStringify.ts","../src/utils/isVariable.ts","../src/id/hashSource.ts"],"sourcesContent":["/**\n * Deterministic JSON stringification with sorted object keys.\n * Drop-in replacement for `fast-json-stable-stringify` for plain\n * JSON-compatible data (no toJSON, no circular references).\n */\nfunction _stringify(node: unknown): string | undefined {\n if (node === undefined) return undefined;\n if (node === null) return 'null';\n if (typeof node === 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n if (Array.isArray(node)) {\n let out = '[';\n for (let i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += _stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n const keys = Object.keys(node as Record<string, unknown>).sort();\n let out = '';\n for (const key of keys) {\n const value = _stringify((node as Record<string, unknown>)[key]);\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n return '{' + out + '}';\n}\n\nexport function stableStringify(data: unknown): string {\n return _stringify(data) ?? '';\n}\n","import { Variable } from '../types';\n\nexport function isVariable(obj: unknown): obj is Variable {\n const variableObj = obj as Variable;\n if (\n variableObj &&\n typeof variableObj === 'object' &&\n typeof (variableObj as Variable).k === 'string'\n ) {\n const k = Object.keys(variableObj);\n if (k.length === 1) return true;\n if (k.length === 2) {\n if (typeof variableObj.i === 'number') return true;\n if (typeof variableObj.v === 'string') return true;\n }\n if (k.length === 3) {\n if (\n typeof variableObj.v === 'string' &&\n typeof variableObj.i === 'number'\n )\n return true;\n }\n }\n return false;\n}\n","// Functions provided to other GT libraries\n\nimport { JsxChild, JsxChildren, Variable } from '../types';\nimport { stableStringify as stringify } from '../utils/stableStringify';\nimport { sha256 } from '@noble/hashes/sha2.js';\nimport { bytesToHex, utf8ToBytes } from '@noble/hashes/utils.js';\nimport { isVariable } from '../utils/isVariable';\nimport { HashMetadata } from './types';\n\n// ----- FUNCTIONS ----- //\n/**\n * Calculates a unique hash for a given string using SHA-256.\n *\n * First 16 characters of hash, hex encoded.\n *\n * @param {string} string - The string to be hashed.\n * @returns {string} The resulting hash as a hexadecimal string.\n */\nexport function hashString(string: string): string {\n return bytesToHex(sha256(utf8ToBytes(string))).slice(0, 16);\n}\n\n/**\n * Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.\n *\n * @param {any} childrenAsObjects - The children objects to be hashed.\n * @param {string} [context] - The context for the children.\n * @param {string} [id] - Deprecated custom ID. It remains part of the hash for\n * backward compatibility, but will be removed in the next major version.\n * @param {number} [maxChars] - The maxChars limit for the JSX children object.\n * @param {string} [dataFormat] - The data format of the sources.\n * @param {string} [fileFormat] - The file format when the source is a whole document.\n * @param {function} [hashFunction] - Custom hash function.\n * @returns {string} - The unique hash of the children.\n */\nexport function hashSource(\n {\n source,\n context,\n id,\n maxChars,\n requiresReview,\n dataFormat,\n fileFormat,\n }: {\n source: JsxChildren | string;\n } & HashMetadata,\n hashFunction: (string: string) => string = hashString\n): string {\n let sanitizedSource: SanitizedChildren | string;\n if (dataFormat === 'JSX') {\n sanitizedSource = sanitizeJsxChildren(source);\n } else {\n sanitizedSource = source as string;\n }\n const sanitizedData: {\n source?: SanitizedChildren;\n } & HashMetadata = {\n source: sanitizedSource,\n ...(id && { id }),\n ...(context && { context }),\n ...(maxChars != null && { maxChars: Math.abs(maxChars) }),\n // Only mixed in when true: false/absent must hash identically to\n // pre-requiresReview versions so existing projects keep their hashes\n ...(requiresReview === true && { requiresReview: true }),\n ...(dataFormat && { dataFormat }),\n ...(fileFormat && { fileFormat }),\n };\n const stringifiedData = stringify(sanitizedData);\n return hashFunction(stringifiedData);\n}\n\ntype SanitizedVariable = Omit<Variable, 'i'>;\n\ntype SanitizedElement = {\n b?: {\n [k: string]: SanitizedChildren; // Branches\n };\n c?: SanitizedChildren; // Children\n t?: string; // Branch Transformation\n};\ntype SanitizedChild =\n | boolean\n | null\n | SanitizedElement\n | SanitizedVariable\n | string;\ntype SanitizedChildren = SanitizedChild | SanitizedChild[];\n\n/**\n * Sanitizes a child object by removing the data-_gt attribute and its branches.\n *\n * @param child - The child object to sanitize.\n * @returns The sanitized child object.\n *\n */\nconst sanitizeChild = (child: boolean | null | JsxChild): SanitizedChild => {\n if (child && typeof child === 'object') {\n const newChild: SanitizedChild = {};\n if ('c' in child && child.c) {\n newChild.c = sanitizeJsxChildren(child.c);\n }\n if ('d' in child) {\n const generaltranslation = child?.d;\n if (generaltranslation?.b) {\n // The only thing that prevents sanitizeJsx from being stable is\n // the order of the keys in the branches object.\n // We don't sort them because stable-stringify sorts them anyways\n newChild.b = Object.fromEntries(\n Object.entries(generaltranslation.b).map(([key, value]) => [\n key,\n sanitizeJsxChildren(value as JsxChildren),\n ])\n );\n }\n if (generaltranslation?.t) {\n newChild.t = generaltranslation.t;\n }\n }\n if (isVariable(child)) {\n return {\n k: child.k,\n ...(child.v && {\n v: child.v,\n }),\n };\n }\n return newChild;\n }\n return child;\n};\n\nfunction sanitizeJsxChildren(\n childrenAsObjects: JsxChildren\n): SanitizedChildren {\n return Array.isArray(childrenAsObjects)\n ? childrenAsObjects.map(sanitizeChild)\n : sanitizeChild(childrenAsObjects);\n}\n"],"mappings":";;;;;;;;AAKA,SAAS,WAAW,MAAmC;AACrD,KAAI,SAAS,KAAA,EAAW,QAAO,KAAA;AAC/B,KAAI,SAAS,KAAM,QAAO;AAC1B,KAAI,OAAO,SAAS,SAAU,QAAO,SAAS,KAAK,GAAG,KAAK,OAAO;AAClE,KAAI,OAAO,SAAS,SAAU,QAAO,KAAK,UAAU,KAAK;AAEzD,KAAI,MAAM,QAAQ,KAAK,EAAE;EACvB,IAAI,MAA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AC1B,GAAI,YAAY,QAAQ,EAAE,UAAU,KAAK,IAAI,SAAS,EAAE;EAGxD,GAAI,mBAAmB,QAAQ,EAAE,gBAAgB,MAAM;EACvD,GAAI,cAAc,EAAE,YAAY;EAChC,GAAI,cAAc,EAAE,YAAY;EAEa,CACZ,CAAC;;;;;;;;;AA2BtC,MAAM,iBAAiB,UAAqD;AAC1E,KAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,WAA2B,EAAE;AACnC,MAAI,OAAO,SAAS,MAAM,EACxB,UAAS,IAAI,oBAAoB,MAAM,EAAE;AAE3C,MAAI,OAAO,OAAO;GAChB,MAAM,qBAAqB,OAAO;AAClC,OAAI,oBAAoB,EAItB,UAAS,IAAI,OAAO,YAClB,OAAO,QAAQ,mBAAmB,EAAE,CAAC,KAAK,CAAC,KAAK,WAAW,CACzD,KACA,oBAAoB,MAAqB,CAC1C,CAAC,CACH;AAEH,OAAI,oBAAoB,EACtB,UAAS,IAAI,mBAAmB;;AAGpC,MAAI,WAAW,MAAM,CACnB,QAAO;GACL,GAAG,MAAM;GACT,GAAI,MAAM,KAAK,EACb,GAAG,MAAM,GACV;GACF;AAEH,SAAO;;AAET,QAAO;;AAGT,SAAS,oBACP,mBACmB;AACnB,QAAO,MAAM,QAAQ,kBAAkB,GACnC,kBAAkB,IAAI,cAAc,GACpC,cAAc,kBAAkB"}
@@ -1,4 +1,3 @@
1
- const require_isVariable = require("./isVariable-I3nllgeI.cjs");
2
1
  //#region src/utils/stableStringify.ts
3
2
  /**
4
3
  * Deterministic JSON stringification with sorted object keys.
@@ -697,6 +696,23 @@ K512[1];
697
696
  */
698
697
  const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), /* @__PURE__ */ oidNist(1));
699
698
  //#endregion
699
+ //#region src/utils/isVariable.ts
700
+ function isVariable(obj) {
701
+ const variableObj = obj;
702
+ if (variableObj && typeof variableObj === "object" && typeof variableObj.k === "string") {
703
+ const k = Object.keys(variableObj);
704
+ if (k.length === 1) return true;
705
+ if (k.length === 2) {
706
+ if (typeof variableObj.i === "number") return true;
707
+ if (typeof variableObj.v === "string") return true;
708
+ }
709
+ if (k.length === 3) {
710
+ if (typeof variableObj.v === "string" && typeof variableObj.i === "number") return true;
711
+ }
712
+ }
713
+ return false;
714
+ }
715
+ //#endregion
700
716
  //#region src/id/hashSource.ts
701
717
  /**
702
718
  * Calculates a unique hash for a given string using SHA-256.
@@ -752,7 +768,7 @@ const sanitizeChild = (child) => {
752
768
  if (generaltranslation?.b) newChild.b = Object.fromEntries(Object.entries(generaltranslation.b).map(([key, value]) => [key, sanitizeJsxChildren(value)]));
753
769
  if (generaltranslation?.t) newChild.t = generaltranslation.t;
754
770
  }
755
- if (require_isVariable.isVariable(child)) return {
771
+ if (isVariable(child)) return {
756
772
  k: child.k,
757
773
  ...child.v && { v: child.v }
758
774
  };
@@ -776,5 +792,11 @@ Object.defineProperty(exports, "hashString", {
776
792
  return hashString;
777
793
  }
778
794
  });
795
+ Object.defineProperty(exports, "isVariable", {
796
+ enumerable: true,
797
+ get: function() {
798
+ return isVariable;
799
+ }
800
+ });
779
801
 
780
- //# sourceMappingURL=id-pdr3R1xs.cjs.map
802
+ //# sourceMappingURL=id-DJ_59q21.cjs.map