@intlayer/cli 6.1.6 → 7.0.0-canary.1

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 (287) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +187 -239
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_utils_asset.cjs +104 -0
  4. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  5. package/dist/cjs/build.cjs +23 -42
  6. package/dist/cjs/build.cjs.map +1 -1
  7. package/dist/cjs/cli.cjs +370 -431
  8. package/dist/cjs/cli.cjs.map +1 -1
  9. package/dist/cjs/config.cjs +10 -35
  10. package/dist/cjs/config.cjs.map +1 -1
  11. package/dist/cjs/editor.cjs +51 -66
  12. package/dist/cjs/editor.cjs.map +1 -1
  13. package/dist/cjs/fill/fill.cjs +73 -301
  14. package/dist/cjs/fill/fill.cjs.map +1 -1
  15. package/dist/cjs/fill/formatAutoFillData.cjs +48 -106
  16. package/dist/cjs/fill/formatAutoFillData.cjs.map +1 -1
  17. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +27 -43
  18. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  19. package/dist/cjs/fill/formatFillData.cjs +50 -0
  20. package/dist/cjs/fill/formatFillData.cjs.map +1 -0
  21. package/dist/cjs/fill/groupLimiter.cjs +42 -0
  22. package/dist/cjs/fill/groupLimiter.cjs.map +1 -0
  23. package/dist/cjs/fill/index.cjs +5 -25
  24. package/dist/cjs/fill/listTranslationsTasks.cjs +77 -0
  25. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -0
  26. package/dist/cjs/fill/test-original-case.cjs +10 -0
  27. package/dist/cjs/fill/test-original-case.cjs.map +1 -0
  28. package/dist/cjs/fill/translateDictionary.cjs +148 -0
  29. package/dist/cjs/fill/translateDictionary.cjs.map +1 -0
  30. package/dist/cjs/fill/writeAutoFill.cjs +48 -0
  31. package/dist/cjs/fill/writeAutoFill.cjs.map +1 -0
  32. package/dist/cjs/fill/writeFill.cjs +50 -0
  33. package/dist/cjs/fill/writeFill.cjs.map +1 -0
  34. package/dist/cjs/getTargetDictionary.cjs +36 -76
  35. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  36. package/dist/cjs/index.cjs +31 -45
  37. package/dist/cjs/listContentDeclaration.cjs +36 -64
  38. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  39. package/dist/cjs/liveSync.cjs +146 -221
  40. package/dist/cjs/liveSync.cjs.map +1 -1
  41. package/dist/cjs/pull.cjs +132 -195
  42. package/dist/cjs/pull.cjs.map +1 -1
  43. package/dist/cjs/push/pullLog.cjs +101 -144
  44. package/dist/cjs/push/pullLog.cjs.map +1 -1
  45. package/dist/cjs/push/push.cjs +159 -249
  46. package/dist/cjs/push/push.cjs.map +1 -1
  47. package/dist/cjs/pushConfig.cjs +18 -45
  48. package/dist/cjs/pushConfig.cjs.map +1 -1
  49. package/dist/cjs/pushLog.cjs +87 -128
  50. package/dist/cjs/pushLog.cjs.map +1 -1
  51. package/dist/cjs/reviewDoc.cjs +183 -291
  52. package/dist/cjs/reviewDoc.cjs.map +1 -1
  53. package/dist/cjs/test/index.cjs +52 -91
  54. package/dist/cjs/test/index.cjs.map +1 -1
  55. package/dist/cjs/test/listMissingTranslations.cjs +35 -62
  56. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  57. package/dist/cjs/translateDoc.cjs +127 -221
  58. package/dist/cjs/translateDoc.cjs.map +1 -1
  59. package/dist/cjs/utils/calculateChunks.cjs +85 -115
  60. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  61. package/dist/cjs/utils/checkAccess.cjs +33 -72
  62. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  63. package/dist/cjs/utils/checkFileModifiedRange.cjs +75 -91
  64. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  65. package/dist/cjs/utils/checkLastUpdateTime.cjs +17 -30
  66. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  67. package/dist/cjs/utils/chunkInference.cjs +28 -47
  68. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  69. package/dist/cjs/utils/fixChunkStartEndChars.cjs +23 -42
  70. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  71. package/dist/cjs/utils/formatTimeDiff.cjs +17 -43
  72. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  73. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +13 -32
  74. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  75. package/dist/cjs/utils/getOutputFilePath.cjs +71 -86
  76. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  77. package/dist/cjs/utils/getParentPackageJSON.cjs +19 -44
  78. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  79. package/dist/cjs/utils/listSpecialChars.cjs +49 -73
  80. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  81. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +90 -132
  82. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  83. package/dist/cjs/utils/reorderParagraphs.cjs +86 -118
  84. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  85. package/dist/cjs/watch.cjs +21 -39
  86. package/dist/cjs/watch.cjs.map +1 -1
  87. package/dist/esm/IntlayerEventListener.mjs +178 -201
  88. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  89. package/dist/esm/_virtual/_utils_asset.mjs +100 -0
  90. package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
  91. package/dist/esm/build.mjs +20 -23
  92. package/dist/esm/build.mjs.map +1 -1
  93. package/dist/esm/cli.mjs +349 -380
  94. package/dist/esm/cli.mjs.map +1 -1
  95. package/dist/esm/config.mjs +8 -14
  96. package/dist/esm/config.mjs.map +1 -1
  97. package/dist/esm/editor.mjs +47 -41
  98. package/dist/esm/editor.mjs.map +1 -1
  99. package/dist/esm/fill/fill.mjs +68 -300
  100. package/dist/esm/fill/fill.mjs.map +1 -1
  101. package/dist/esm/fill/formatAutoFillData.mjs +47 -81
  102. package/dist/esm/fill/formatAutoFillData.mjs.map +1 -1
  103. package/dist/esm/fill/formatAutoFilledFilePath.mjs +25 -19
  104. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  105. package/dist/esm/fill/formatFillData.mjs +50 -0
  106. package/dist/esm/fill/formatFillData.mjs.map +1 -0
  107. package/dist/esm/fill/groupLimiter.mjs +40 -0
  108. package/dist/esm/fill/groupLimiter.mjs.map +1 -0
  109. package/dist/esm/fill/index.mjs +4 -3
  110. package/dist/esm/fill/listTranslationsTasks.mjs +70 -0
  111. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -0
  112. package/dist/esm/fill/test-original-case.mjs +10 -0
  113. package/dist/esm/fill/test-original-case.mjs.map +1 -0
  114. package/dist/esm/fill/translateDictionary.mjs +141 -0
  115. package/dist/esm/fill/translateDictionary.mjs.map +1 -0
  116. package/dist/esm/fill/writeAutoFill.mjs +44 -0
  117. package/dist/esm/fill/writeAutoFill.mjs.map +1 -0
  118. package/dist/esm/fill/writeFill.mjs +45 -0
  119. package/dist/esm/fill/writeFill.mjs.map +1 -0
  120. package/dist/esm/getTargetDictionary.mjs +27 -48
  121. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  122. package/dist/esm/index.mjs +15 -13
  123. package/dist/esm/listContentDeclaration.mjs +28 -43
  124. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  125. package/dist/esm/liveSync.mjs +135 -187
  126. package/dist/esm/liveSync.mjs.map +1 -1
  127. package/dist/esm/pull.mjs +125 -178
  128. package/dist/esm/pull.mjs.map +1 -1
  129. package/dist/esm/push/pullLog.mjs +99 -125
  130. package/dist/esm/push/pullLog.mjs.map +1 -1
  131. package/dist/esm/push/push.mjs +149 -221
  132. package/dist/esm/push/push.mjs.map +1 -1
  133. package/dist/esm/pushConfig.mjs +14 -23
  134. package/dist/esm/pushConfig.mjs.map +1 -1
  135. package/dist/esm/pushLog.mjs +85 -109
  136. package/dist/esm/pushLog.mjs.map +1 -1
  137. package/dist/esm/reviewDoc.mjs +167 -264
  138. package/dist/esm/reviewDoc.mjs.map +1 -1
  139. package/dist/esm/test/index.mjs +47 -73
  140. package/dist/esm/test/index.mjs.map +1 -1
  141. package/dist/esm/test/listMissingTranslations.mjs +30 -41
  142. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  143. package/dist/esm/translateDoc.mjs +114 -193
  144. package/dist/esm/translateDoc.mjs.map +1 -1
  145. package/dist/esm/utils/calculateChunks.mjs +83 -91
  146. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  147. package/dist/esm/utils/checkAccess.mjs +28 -46
  148. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  149. package/dist/esm/utils/checkFileModifiedRange.mjs +73 -65
  150. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  151. package/dist/esm/utils/checkLastUpdateTime.mjs +15 -6
  152. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  153. package/dist/esm/utils/chunkInference.mjs +24 -24
  154. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  155. package/dist/esm/utils/fixChunkStartEndChars.mjs +22 -18
  156. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  157. package/dist/esm/utils/formatTimeDiff.mjs +16 -19
  158. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  159. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +11 -8
  160. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  161. package/dist/esm/utils/getOutputFilePath.mjs +70 -62
  162. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  163. package/dist/esm/utils/getParentPackageJSON.mjs +16 -20
  164. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  165. package/dist/esm/utils/listSpecialChars.mjs +48 -49
  166. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  167. package/dist/esm/utils/mapChunksBetweenFiles.mjs +87 -107
  168. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  169. package/dist/esm/utils/reorderParagraphs.mjs +85 -93
  170. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  171. package/dist/esm/watch.mjs +17 -17
  172. package/dist/esm/watch.mjs.map +1 -1
  173. package/dist/types/IntlayerEventListener.d.ts +63 -59
  174. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  175. package/dist/types/build.d.ts +10 -7
  176. package/dist/types/build.d.ts.map +1 -1
  177. package/dist/types/cli.d.ts +13 -10
  178. package/dist/types/cli.d.ts.map +1 -1
  179. package/dist/types/config.d.ts +7 -4
  180. package/dist/types/config.d.ts.map +1 -1
  181. package/dist/types/editor.d.ts +6 -4
  182. package/dist/types/editor.d.ts.map +1 -1
  183. package/dist/types/fill/fill.d.ts +20 -14
  184. package/dist/types/fill/fill.d.ts.map +1 -1
  185. package/dist/types/fill/formatAutoFillData.d.ts +10 -7
  186. package/dist/types/fill/formatAutoFillData.d.ts.map +1 -1
  187. package/dist/types/fill/formatAutoFilledFilePath.d.ts +6 -2
  188. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
  189. package/dist/types/fill/formatFillData.d.ts +12 -0
  190. package/dist/types/fill/formatFillData.d.ts.map +1 -0
  191. package/dist/types/fill/groupLimiter.d.ts +15 -0
  192. package/dist/types/fill/groupLimiter.d.ts.map +1 -0
  193. package/dist/types/fill/index.d.ts +3 -3
  194. package/dist/types/fill/listTranslationsTasks.d.ts +15 -0
  195. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -0
  196. package/dist/types/fill/test-original-case.d.ts +1 -0
  197. package/dist/types/fill/translateDictionary.d.ts +19 -0
  198. package/dist/types/fill/translateDictionary.d.ts.map +1 -0
  199. package/dist/types/fill/writeAutoFill.d.ts +7 -0
  200. package/dist/types/fill/writeAutoFill.d.ts.map +1 -0
  201. package/dist/types/fill/writeFill.d.ts +7 -0
  202. package/dist/types/fill/writeFill.d.ts.map +1 -0
  203. package/dist/types/getTargetDictionary.d.ts +17 -13
  204. package/dist/types/getTargetDictionary.d.ts.map +1 -1
  205. package/dist/types/index.d.ts +15 -14
  206. package/dist/types/listContentDeclaration.d.ts +10 -7
  207. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  208. package/dist/types/liveSync.d.ts +8 -3
  209. package/dist/types/liveSync.d.ts.map +1 -1
  210. package/dist/types/pull.d.ts +9 -6
  211. package/dist/types/pull.d.ts.map +1 -1
  212. package/dist/types/push/pullLog.d.ts +25 -21
  213. package/dist/types/push/pullLog.d.ts.map +1 -1
  214. package/dist/types/push/push.d.ts +13 -9
  215. package/dist/types/push/push.d.ts.map +1 -1
  216. package/dist/types/pushConfig.d.ts +7 -4
  217. package/dist/types/pushConfig.d.ts.map +1 -1
  218. package/dist/types/pushLog.d.ts +23 -20
  219. package/dist/types/pushLog.d.ts.map +1 -1
  220. package/dist/types/reviewDoc.d.ts +34 -17
  221. package/dist/types/reviewDoc.d.ts.map +1 -1
  222. package/dist/types/test/index.d.ts +9 -5
  223. package/dist/types/test/index.d.ts.map +1 -1
  224. package/dist/types/test/listMissingTranslations.d.ts +14 -10
  225. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  226. package/dist/types/translateDoc.d.ts +34 -17
  227. package/dist/types/translateDoc.d.ts.map +1 -1
  228. package/dist/types/utils/calculateChunks.d.ts +10 -7
  229. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  230. package/dist/types/utils/checkAccess.d.ts +8 -4
  231. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  232. package/dist/types/utils/checkFileModifiedRange.d.ts +8 -6
  233. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  234. package/dist/types/utils/checkLastUpdateTime.d.ts +4 -1
  235. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  236. package/dist/types/utils/chunkInference.d.ts +9 -6
  237. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  238. package/dist/types/utils/fixChunkStartEndChars.d.ts +4 -1
  239. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  240. package/dist/types/utils/formatTimeDiff.d.ts +4 -1
  241. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  242. package/dist/types/utils/getIsFileUpdatedRecently.d.ts +4 -1
  243. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  244. package/dist/types/utils/getOutputFilePath.d.ts +7 -2
  245. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  246. package/dist/types/utils/getParentPackageJSON.d.ts +30 -28
  247. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  248. package/dist/types/utils/listSpecialChars.d.ts +9 -7
  249. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  250. package/dist/types/utils/mapChunksBetweenFiles.d.ts +10 -6
  251. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  252. package/dist/types/utils/reorderParagraphs.d.ts +4 -1
  253. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  254. package/dist/types/watch.d.ts +9 -6
  255. package/dist/types/watch.d.ts.map +1 -1
  256. package/package.json +42 -47
  257. package/LICENSE +0 -202
  258. package/dist/cjs/fill/autoFill.cjs +0 -105
  259. package/dist/cjs/fill/autoFill.cjs.map +0 -1
  260. package/dist/cjs/fill/index.cjs.map +0 -1
  261. package/dist/cjs/index.cjs.map +0 -1
  262. package/dist/cjs/utils/getChunk.cjs +0 -77
  263. package/dist/cjs/utils/getChunk.cjs.map +0 -1
  264. package/dist/cjs/utils/splitTextByLine.cjs +0 -35
  265. package/dist/cjs/utils/splitTextByLine.cjs.map +0 -1
  266. package/dist/esm/fill/autoFill.mjs +0 -92
  267. package/dist/esm/fill/autoFill.mjs.map +0 -1
  268. package/dist/esm/fill/index.mjs.map +0 -1
  269. package/dist/esm/index.mjs.map +0 -1
  270. package/dist/esm/prompts/REVIEW_PROMPT.md +0 -37
  271. package/dist/esm/prompts/TRANSLATE_PROMPT.md +0 -38
  272. package/dist/esm/utils/calculrateChunkTest.md +0 -9
  273. package/dist/esm/utils/getChunk.mjs +0 -53
  274. package/dist/esm/utils/getChunk.mjs.map +0 -1
  275. package/dist/esm/utils/splitTextByLine.mjs +0 -11
  276. package/dist/esm/utils/splitTextByLine.mjs.map +0 -1
  277. package/dist/types/fill/autoFill.d.ts +0 -4
  278. package/dist/types/fill/autoFill.d.ts.map +0 -1
  279. package/dist/types/fill/index.d.ts.map +0 -1
  280. package/dist/types/index.d.ts.map +0 -1
  281. package/dist/types/utils/getChunk.d.ts +0 -9
  282. package/dist/types/utils/getChunk.d.ts.map +0 -1
  283. package/dist/types/utils/splitTextByLine.d.ts +0 -2
  284. package/dist/types/utils/splitTextByLine.d.ts.map +0 -1
  285. /package/dist/{cjs → assets}/prompts/REVIEW_PROMPT.md +0 -0
  286. /package/dist/{cjs → assets}/prompts/TRANSLATE_PROMPT.md +0 -0
  287. /package/dist/{cjs/utils/calculrateChunkTest.md → assets/utils/_calculateChunkTest.md} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/push/pullLog.ts"],"sourcesContent":["import { type DictionaryStatus } from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colorize,\n getConfiguration,\n spinnerFrames,\n} from '@intlayer/config';\n\nexport type PullStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching';\n errorMessage?: string;\n};\n\nexport class PullLogger {\n private statuses: PullStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n\n constructor() {\n const configuration = getConfiguration();\n this.prefix = configuration.log.prefix;\n }\n\n update(newStatuses: PullStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) => s.dictionaryKey === status.dictionaryKey\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private render() {\n const { total, done, success, errors } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const lines: string[] = [];\n\n const isDone = done === total;\n const progressLabel = `dictionaries: ${done}/${total}`;\n const details: string[] = [];\n if (success > 0) details.push(`ok: ${success}`);\n if (errors > 0) details.push(colorize(`errors: ${errors}`, ANSIColors.RED));\n\n const suffix = details.length > 0 ? ` (${details.join(', ')})` : '';\n\n if (isDone) {\n lines.push(\n `${this.prefix} ${colorize('✔', ANSIColors.GREEN)} fetched ${progressLabel}${suffix}`\n );\n } else {\n lines.push(\n `${this.prefix} ${colorize(frame, ANSIColors.BLUE)} fetching ${progressLabel}${suffix}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const keys = new Set(this.statuses.map((s) => s.dictionaryKey));\n\n const doneSet = new Set<DictionaryStatus | 'error'>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n 'error',\n ] as const);\n\n const successesSet = new Set<DictionaryStatus>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n ] as const);\n\n const done = this.statuses.filter((s) =>\n doneSet.has(s.status as any)\n ).length;\n const success = this.statuses.filter((s) =>\n successesSet.has(s.status as any)\n ).length;\n const errors = this.statuses.filter((s) => s.status === 'error').length;\n\n return {\n total: keys.size,\n done,\n success,\n errors,\n } as const;\n }\n}\n"],"mappings":"AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQA,MAAM,WAAW;AAAA,EACd,WAAyB,CAAC;AAAA,EAC1B,eAAsC;AAAA,EACtC,eAAe;AAAA,EACf,gBAAgB;AAAA,EACP,gBAAgB;AAAA,EACzB,aAAa;AAAA,EACJ;AAAA,EACT,oBAA4B;AAAA,EAEpC,cAAc;AACZ,UAAM,gBAAgB,iBAAiB;AACvC,SAAK,SAAS,cAAc,IAAI;AAAA,EAClC;AAAA,EAEA,OAAO,aAA2B;AAChC,QAAI,KAAK,WAAY;AACrB,eAAW,UAAU,aAAa;AAChC,YAAM,QAAQ,KAAK,SAAS;AAAA,QAC1B,CAAC,MAAM,EAAE,kBAAkB,OAAO;AAAA,MACpC;AACA,UAAI,SAAS,GAAG;AACd,aAAK,SAAS,KAAK,IAAI;AAAA,MACzB,OAAO;AACL,aAAK,SAAS,KAAK,MAAM;AAAA,MAC3B;AAAA,IACF;AAEA,SAAK,aAAa;AAClB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,SAAS;AACP,SAAK,aAAa;AAClB,SAAK,YAAY;AACjB,SAAK,OAAO;AAAA,EACd;AAAA,EAEQ,eAAe;AACrB,QAAI,KAAK,gBAAgB,KAAK,WAAY;AAC1C,SAAK,eAAe,YAAY,MAAM;AACpC,WAAK,gBAAgB,KAAK,eAAe,KAAK,KAAK,cAAc;AACjE,WAAK,OAAO;AAAA,IACd,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C;AACpB,UAAI,SAAS,QAAW;AACtB,gBAAQ,OAAO,MAAM,IAAI;AAAA,MAC3B;AACA,cAAQ,OAAO,MAAM,IAAI;AAAA,IAC3B;AAEA,SAAK,gBAAgB,MAAM;AAAA,EAC7B;AAAA,EAEQ,kBAAkB;AACxB,UAAM,OAAO,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC;AAE9D,UAAM,UAAU,oBAAI,IAAgC;AAAA,MAClD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAU;AAEV,UAAM,eAAe,oBAAI,IAAsB;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAU;AAEV,UAAM,OAAO,KAAK,SAAS;AAAA,MAAO,CAAC,MACjC,QAAQ,IAAI,EAAE,MAAa;AAAA,IAC7B,EAAE;AACF,UAAM,UAAU,KAAK,SAAS;AAAA,MAAO,CAAC,MACpC,aAAa,IAAI,EAAE,MAAa;AAAA,IAClC,EAAE;AACF,UAAM,SAAS,KAAK,SAAS,OAAO,CAAC,MAAM,EAAE,WAAW,OAAO,EAAE;AAEjE,WAAO;AAAA,MACL,OAAO,KAAK;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"pullLog.mjs","names":["lines: string[]","details: string[]"],"sources":["../../../src/push/pullLog.ts"],"sourcesContent":["import type { DictionaryStatus } from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colorize,\n getConfiguration,\n spinnerFrames,\n} from '@intlayer/config';\n\nexport type PullStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching';\n errorMessage?: string;\n};\n\nexport class PullLogger {\n private statuses: PullStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n\n constructor() {\n const configuration = getConfiguration();\n this.prefix = configuration.log.prefix;\n }\n\n update(newStatuses: PullStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) => s.dictionaryKey === status.dictionaryKey\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private render() {\n const { total, done, success, errors } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const lines: string[] = [];\n\n const isDone = done === total;\n const progressLabel = `dictionaries: ${done}/${total}`;\n const details: string[] = [];\n if (success > 0) details.push(`ok: ${success}`);\n if (errors > 0) details.push(colorize(`errors: ${errors}`, ANSIColors.RED));\n\n const suffix = details.length > 0 ? ` (${details.join(', ')})` : '';\n\n if (isDone) {\n lines.push(\n `${this.prefix} ${colorize('✔', ANSIColors.GREEN)} fetched ${progressLabel}${suffix}`\n );\n } else {\n lines.push(\n `${this.prefix} ${colorize(frame, ANSIColors.BLUE)} fetching ${progressLabel}${suffix}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const keys = new Set(this.statuses.map((s) => s.dictionaryKey));\n\n const doneSet = new Set<DictionaryStatus | 'error'>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n 'error',\n ] as const);\n\n const successesSet = new Set<DictionaryStatus>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n ] as const);\n\n const done = this.statuses.filter((s) =>\n doneSet.has(s.status as any)\n ).length;\n const success = this.statuses.filter((s) =>\n successesSet.has(s.status as any)\n ).length;\n const errors = this.statuses.filter((s) => s.status === 'error').length;\n\n return {\n total: keys.size,\n done,\n success,\n errors,\n } as const;\n }\n}\n"],"mappings":";;;AAcA,IAAa,aAAb,MAAwB;CACtB,AAAQ,WAAyB,EAAE;CACnC,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgB;CACjC,AAAQ,aAAa;CACrB,AAAiB;CACjB,AAAQ,oBAA4B;CAEpC,cAAc;AAEZ,OAAK,SADiB,kBAAkB,CACZ,IAAI;;CAGlC,OAAO,aAA2B;AAChC,MAAI,KAAK,WAAY;AACrB,OAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MAAM,EAAE,kBAAkB,OAAO,cACnC;AACD,OAAI,SAAS,EACX,MAAK,SAAS,SAAS;OAEvB,MAAK,SAAS,KAAK,OAAO;;AAI9B,OAAK,cAAc;AACnB,OAAK,QAAQ;;CAGf,SAAS;AACP,OAAK,aAAa;AAClB,OAAK,aAAa;AAClB,OAAK,QAAQ;;CAGf,AAAQ,eAAe;AACrB,MAAI,KAAK,gBAAgB,KAAK,WAAY;AAC1C,OAAK,eAAe,kBAAkB;AACpC,QAAK,gBAAgB,KAAK,eAAe,KAAK,KAAK,cAAc;A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MAAM,OAAO,IAAI,IAAI,KAAK,SAAS,KAAK,MAAM,EAAE,cAAc,CAAC;EAE/D,MAAM,UAAU,IAAI,IAAgC;GAClD;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAU;EAEX,MAAM,eAAe,IAAI,IAAsB;GAC7C;GACA;GACA;GACA;GACA;GACA;GACD,CAAU;EAEX,MAAM,OAAO,KAAK,SAAS,QAAQ,MACjC,QAAQ,IAAI,EAAE,OAAc,CAC7B,CAAC;EACF,MAAM,UAAU,KAAK,SAAS,QAAQ,MACpC,aAAa,IAAI,EAAE,OAAc,CAClC,CAAC;EACF,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,QAAQ,CAAC;AAEjE,SAAO;GACL,OAAO,KAAK;GACZ;GACA;GACA;GACD"}
@@ -1,230 +1,158 @@
1
+ import { checkCMSAuth } from "../utils/checkAccess.mjs";
2
+ import { PushLogger } from "../pushLog.mjs";
1
3
  import { getIntlayerAPIProxy } from "@intlayer/api";
2
- import {
3
- formatPath,
4
- listGitFiles,
5
- parallelize
6
- } from "@intlayer/chokidar";
7
- import {
8
- ANSIColors,
9
- getAppLogger,
10
- getConfiguration
11
- } from "@intlayer/config";
4
+ import { formatPath, listGitFiles, parallelize, prepareIntlayer } from "@intlayer/chokidar";
5
+ import { ANSIColors, getAppLogger, getConfiguration } from "@intlayer/config";
6
+ import { join } from "node:path";
12
7
  import { getDictionaries } from "@intlayer/dictionaries-entry";
13
- import * as fsPromises from "fs/promises";
14
- import { join } from "path";
15
- import * as readline from "readline";
16
- import { PushLogger } from "../pushLog.mjs";
17
- import { checkCMSAuth } from "../utils/checkAccess.mjs";
8
+ import * as fsPromises from "node:fs/promises";
9
+ import * as readline from "node:readline";
10
+
11
+ //#region src/push/push.ts
12
+ /**
13
+ * Get all local dictionaries and push them simultaneously.
14
+ */
18
15
  const push = async (options) => {
19
- const config = getConfiguration(options?.configOptions);
20
- const appLogger = getAppLogger(config, {
21
- config: {
22
- prefix: ""
23
- }
24
- });
25
- try {
26
- const hasCMSAuth = await checkCMSAuth(config);
27
- if (!hasCMSAuth) return;
28
- const intlayerAPI = getIntlayerAPIProxy(void 0, config);
29
- const dictionariesRecord = getDictionaries(config);
30
- let dictionaries = Object.values(dictionariesRecord);
31
- const existingDictionariesKeys = Object.keys(dictionariesRecord);
32
- if (options?.dictionaries) {
33
- const noneExistingDictionariesOption = options.dictionaries.filter(
34
- (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)
35
- );
36
- if (noneExistingDictionariesOption.length > 0) {
37
- appLogger(
38
- `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(
39
- ", "
40
- )} and have been ignored.`,
41
- {
42
- level: "error"
43
- }
44
- );
45
- }
46
- dictionaries = dictionaries.filter(
47
- (dictionary) => options.dictionaries.includes(dictionary.key)
48
- );
49
- }
50
- if (options?.gitOptions) {
51
- const gitFiles = await listGitFiles(options.gitOptions);
52
- dictionaries = dictionaries.filter(
53
- (dictionary) => gitFiles.includes(
54
- join(config.content.baseDir, dictionary.filePath ?? "")
55
- )
56
- );
57
- }
58
- if (dictionaries.length === 0) {
59
- appLogger("No local dictionaries found", {
60
- level: "error"
61
- });
62
- return;
63
- }
64
- appLogger("Pushing dictionaries:", {});
65
- const dictionariesStatuses = dictionaries.map(
66
- (dictionary) => ({
67
- dictionary,
68
- status: "pending"
69
- })
70
- );
71
- const logger = new PushLogger();
72
- logger.update(
73
- dictionariesStatuses.map((s) => ({
74
- dictionaryKey: s.dictionary.key,
75
- status: "pending"
76
- }))
77
- );
78
- const successfullyPushedDictionaries = [];
79
- const processDictionary = async (statusObj) => {
80
- statusObj.status = "pushing";
81
- logger.update([
82
- { dictionaryKey: statusObj.dictionary.key, status: "pushing" }
83
- ]);
84
- try {
85
- const pushResult = await intlayerAPI.dictionary.pushDictionaries([
86
- statusObj.dictionary
87
- ]);
88
- const updatedDictionaries = pushResult.data?.updatedDictionaries || [];
89
- const newDictionaries = pushResult.data?.newDictionaries || [];
90
- if (updatedDictionaries.includes(statusObj.dictionary.key)) {
91
- statusObj.status = "modified";
92
- successfullyPushedDictionaries.push(statusObj.dictionary);
93
- logger.update([
94
- { dictionaryKey: statusObj.dictionary.key, status: "modified" }
95
- ]);
96
- } else if (newDictionaries.includes(statusObj.dictionary.key)) {
97
- statusObj.status = "pushed";
98
- successfullyPushedDictionaries.push(statusObj.dictionary);
99
- logger.update([
100
- { dictionaryKey: statusObj.dictionary.key, status: "pushed" }
101
- ]);
102
- } else {
103
- statusObj.status = "unknown";
104
- }
105
- } catch (error) {
106
- statusObj.status = "error";
107
- statusObj.error = error;
108
- statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;
109
- logger.update([
110
- { dictionaryKey: statusObj.dictionary.key, status: "error" }
111
- ]);
112
- }
113
- };
114
- await parallelize(dictionariesStatuses, processDictionary, 5);
115
- logger.finish();
116
- const iconFor = (status) => {
117
- switch (status) {
118
- case "pushed":
119
- case "modified":
120
- return "\u2714";
121
- case "error":
122
- return "\u2716";
123
- default:
124
- return "\u23F2";
125
- }
126
- };
127
- const colorFor = (status) => {
128
- switch (status) {
129
- case "pushed":
130
- case "modified":
131
- return ANSIColors.GREEN;
132
- case "error":
133
- return ANSIColors.RED;
134
- default:
135
- return ANSIColors.BLUE;
136
- }
137
- };
138
- for (const s of dictionariesStatuses) {
139
- const icon = iconFor(s.status);
140
- const color = colorFor(s.status);
141
- appLogger(
142
- ` - ${s.dictionary.key} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`
143
- );
144
- }
145
- for (const statusObj of dictionariesStatuses) {
146
- if (statusObj.errorMessage) {
147
- appLogger(statusObj.errorMessage, {
148
- level: "error"
149
- });
150
- }
151
- }
152
- const deleteOption = options?.deleteLocaleDictionary;
153
- const keepOption = options?.keepLocaleDictionary;
154
- if (deleteOption && keepOption) {
155
- throw new Error(
156
- "Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options."
157
- );
158
- }
159
- if (deleteOption) {
160
- await deleteLocalDictionaries(successfullyPushedDictionaries, options);
161
- } else if (keepOption) {
162
- } else {
163
- const answer = await askUser(
164
- "Do you want to delete the local dictionaries that were successfully pushed? (yes/no): "
165
- );
166
- if (answer.toLowerCase() === "yes" || answer.toLowerCase() === "y") {
167
- await deleteLocalDictionaries(successfullyPushedDictionaries, options);
168
- }
169
- }
170
- } catch (error) {
171
- appLogger(error, {
172
- level: "error"
173
- });
174
- }
16
+ const config = getConfiguration(options?.configOptions);
17
+ const appLogger = getAppLogger(config, { config: { prefix: "" } });
18
+ if (options?.build === true) await prepareIntlayer(config, { forceRun: true });
19
+ else if (typeof options?.build === "undefined") await prepareIntlayer(config);
20
+ try {
21
+ if (!await checkCMSAuth(config)) return;
22
+ const intlayerAPI = getIntlayerAPIProxy(void 0, config);
23
+ const dictionariesRecord = getDictionaries(config);
24
+ let dictionaries = Object.values(dictionariesRecord);
25
+ const existingDictionariesKeys = Object.keys(dictionariesRecord);
26
+ if (options?.dictionaries) {
27
+ const noneExistingDictionariesOption = options.dictionaries.filter((dictionaryId) => !existingDictionariesKeys.includes(dictionaryId));
28
+ if (noneExistingDictionariesOption.length > 0) appLogger(`The following dictionaries do not exist: ${noneExistingDictionariesOption.join(", ")} and have been ignored.`, { level: "error" });
29
+ dictionaries = dictionaries.filter((dictionary) => options.dictionaries?.includes(dictionary.key));
30
+ }
31
+ if (options?.gitOptions) {
32
+ const gitFiles = await listGitFiles(options.gitOptions);
33
+ dictionaries = dictionaries.filter((dictionary) => gitFiles.includes(join(config.content.baseDir, dictionary.filePath ?? "")));
34
+ }
35
+ if (dictionaries.length === 0) {
36
+ appLogger("No local dictionaries found", { level: "error" });
37
+ return;
38
+ }
39
+ appLogger("Pushing dictionaries:", {});
40
+ const dictionariesStatuses = dictionaries.map((dictionary) => ({
41
+ dictionary,
42
+ status: "pending"
43
+ }));
44
+ const logger = new PushLogger();
45
+ logger.update(dictionariesStatuses.map((s) => ({
46
+ dictionaryKey: s.dictionary.key,
47
+ status: "pending"
48
+ })));
49
+ const successfullyPushedDictionaries = [];
50
+ const processDictionary = async (statusObj) => {
51
+ statusObj.status = "pushing";
52
+ logger.update([{
53
+ dictionaryKey: statusObj.dictionary.key,
54
+ status: "pushing"
55
+ }]);
56
+ try {
57
+ const pushResult = await intlayerAPI.dictionary.pushDictionaries([statusObj.dictionary]);
58
+ const updatedDictionaries = pushResult.data?.updatedDictionaries || [];
59
+ const newDictionaries = pushResult.data?.newDictionaries || [];
60
+ if (updatedDictionaries.includes(statusObj.dictionary.key)) {
61
+ statusObj.status = "modified";
62
+ successfullyPushedDictionaries.push(statusObj.dictionary);
63
+ logger.update([{
64
+ dictionaryKey: statusObj.dictionary.key,
65
+ status: "modified"
66
+ }]);
67
+ } else if (newDictionaries.includes(statusObj.dictionary.key)) {
68
+ statusObj.status = "pushed";
69
+ successfullyPushedDictionaries.push(statusObj.dictionary);
70
+ logger.update([{
71
+ dictionaryKey: statusObj.dictionary.key,
72
+ status: "pushed"
73
+ }]);
74
+ } else statusObj.status = "unknown";
75
+ } catch (error) {
76
+ statusObj.status = "error";
77
+ statusObj.error = error;
78
+ statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;
79
+ logger.update([{
80
+ dictionaryKey: statusObj.dictionary.key,
81
+ status: "error"
82
+ }]);
83
+ }
84
+ };
85
+ await parallelize(dictionariesStatuses, processDictionary, 5);
86
+ logger.finish();
87
+ const iconFor = (status) => {
88
+ switch (status) {
89
+ case "pushed":
90
+ case "modified": return "✔";
91
+ case "error": return "";
92
+ default: return "⏲";
93
+ }
94
+ };
95
+ const colorFor = (status) => {
96
+ switch (status) {
97
+ case "pushed":
98
+ case "modified": return ANSIColors.GREEN;
99
+ case "error": return ANSIColors.RED;
100
+ default: return ANSIColors.BLUE;
101
+ }
102
+ };
103
+ for (const s of dictionariesStatuses) {
104
+ const icon = iconFor(s.status);
105
+ const color = colorFor(s.status);
106
+ appLogger(` - ${s.dictionary.key} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`);
107
+ }
108
+ for (const statusObj of dictionariesStatuses) if (statusObj.errorMessage) appLogger(statusObj.errorMessage, { level: "error" });
109
+ const deleteOption = options?.deleteLocaleDictionary;
110
+ const keepOption = options?.keepLocaleDictionary;
111
+ if (deleteOption && keepOption) throw new Error("Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.");
112
+ if (deleteOption) await deleteLocalDictionaries(successfullyPushedDictionaries, options);
113
+ else if (keepOption) {} else {
114
+ const answer = await askUser("Do you want to delete the local dictionaries that were successfully pushed? (yes/no): ");
115
+ if (answer.toLowerCase() === "yes" || answer.toLowerCase() === "y") await deleteLocalDictionaries(successfullyPushedDictionaries, options);
116
+ }
117
+ } catch (error) {
118
+ appLogger(error, { level: "error" });
119
+ }
175
120
  };
176
121
  const askUser = (question) => {
177
- const rl = readline.createInterface({
178
- input: process.stdin,
179
- output: process.stdout
180
- });
181
- return new Promise((resolve) => {
182
- rl.question(question, (answer) => {
183
- rl.close();
184
- resolve(answer);
185
- });
186
- });
122
+ const rl = readline.createInterface({
123
+ input: process.stdin,
124
+ output: process.stdout
125
+ });
126
+ return new Promise((resolve$1) => {
127
+ rl.question(question, (answer) => {
128
+ rl.close();
129
+ resolve$1(answer);
130
+ });
131
+ });
187
132
  };
188
133
  const deleteLocalDictionaries = async (dictionariesToDelete, options) => {
189
- const config = getConfiguration(options?.configOptions);
190
- const appLogger = getAppLogger(config, {
191
- config: {
192
- prefix: ""
193
- }
194
- });
195
- const filePathsSet = /* @__PURE__ */ new Set();
196
- for (const dictionary of dictionariesToDelete) {
197
- const { filePath } = dictionary;
198
- if (!filePath) {
199
- appLogger(`Dictionary ${dictionary.key} does not have a file path`, {
200
- level: "error"
201
- });
202
- continue;
203
- }
204
- filePathsSet.add(filePath);
205
- }
206
- for (const filePath of filePathsSet) {
207
- try {
208
- const stats = await fsPromises.lstat(filePath);
209
- if (stats.isFile()) {
210
- await fsPromises.unlink(filePath);
211
- appLogger(`Deleted file ${formatPath(filePath)}`, {});
212
- } else if (stats.isDirectory()) {
213
- appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});
214
- } else {
215
- appLogger(
216
- `Unknown file type for ${formatPath(filePath)}, skipping.`,
217
- {}
218
- );
219
- }
220
- } catch (err) {
221
- appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {
222
- level: "error"
223
- });
224
- }
225
- }
226
- };
227
- export {
228
- push
134
+ const appLogger = getAppLogger(getConfiguration(options?.configOptions), { config: { prefix: "" } });
135
+ const filePathsSet = /* @__PURE__ */ new Set();
136
+ for (const dictionary of dictionariesToDelete) {
137
+ const { filePath } = dictionary;
138
+ if (!filePath) {
139
+ appLogger(`Dictionary ${dictionary.key} does not have a file path`, { level: "error" });
140
+ continue;
141
+ }
142
+ filePathsSet.add(filePath);
143
+ }
144
+ for (const filePath of filePathsSet) try {
145
+ const stats = await fsPromises.lstat(filePath);
146
+ if (stats.isFile()) {
147
+ await fsPromises.unlink(filePath);
148
+ appLogger(`Deleted file ${formatPath(filePath)}`, {});
149
+ } else if (stats.isDirectory()) appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});
150
+ else appLogger(`Unknown file type for ${formatPath(filePath)}, skipping.`, {});
151
+ } catch (err) {
152
+ appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, { level: "error" });
153
+ }
229
154
  };
155
+
156
+ //#endregion
157
+ export { push };
230
158
  //# sourceMappingURL=push.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/push/push.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n formatPath,\n listGitFiles,\n ListGitFilesOptions,\n parallelize,\n} from '@intlayer/chokidar';\nimport {\n ANSIColors,\n getAppLogger,\n getConfiguration,\n GetConfigurationOptions,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport * as fsPromises from 'fs/promises';\nimport { join } from 'path';\nimport * as readline from 'readline';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth } from '../utils/checkAccess';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status: 'pending' | 'pushing' | 'modified' | 'pushed' | 'unknown' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n try {\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const dictionariesRecord = getDictionaries(config);\n let dictionaries: Dictionary[] = Object.values(dictionariesRecord);\n const existingDictionariesKeys: string[] = Object.keys(dictionariesRecord);\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries!.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.content.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:', {});\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries || [];\n const newDictionaries = pushResult.data?.newDictionaries || [];\n\n if (updatedDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (newDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n // Print per-dictionary summary similar to loadDictionaries\n const iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'pushed':\n case 'modified':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n };\n\n const colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'pushed':\n case 'modified':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n };\n\n for (const s of dictionariesStatuses) {\n const icon = iconFor(s.status);\n const color = colorFor(s.status);\n appLogger(\n ` - ${s.dictionary.key} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const answer = await askUser(\n 'Do you want to delete the local dictionaries that were successfully pushed? (yes/no): '\n );\n if (answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y') {\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst askUser = (question: string): Promise<string> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n return new Promise((resolve) => {\n rl.question(question, (answer: string) => {\n rl.close();\n resolve(answer);\n });\n });\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(`Dictionary ${dictionary.key} does not have a file path`, {\n level: 'error',\n });\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,uBAAuB;AAChC,YAAY,gBAAgB;AAC5B,SAAS,YAAY;AACrB,YAAY,cAAc;AAC1B,SAAS,kBAAmC;AAC5C,SAAS,oBAAoB;AAoBtB,MAAM,OAAO,OAAO,YAAyC;AAClE,QAAM,SAAS,iBAAiB,SAAS,aAAa;AACtD,QAAM,YAAY,aAAa,QAAQ;AAAA,IACrC,QAAQ;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,EACF,CAAC;AAED,MAAI;AACF,UAAM,aAAa,MAAM,aAAa,MAAM;AAE5C,QAAI,CAAC,WAAY;AAEjB,UAAM,cAAc,oBAAoB,QAAW,MAAM;AAEzD,UAAM,qBAAqB,gBAAgB,MAAM;AACjD,QAAI,eAA6B,OAAO,OAAO,kBAAkB;AACjE,UAAM,2BAAqC,OAAO,KAAK,kBAAkB;AAEzE,QAAI,SAAS,cAAc;AAEzB,YAAM,iCAAiC,QAAQ,aAAa;AAAA,QAC1D,CAAC,iBAAiB,CAAC,yBAAyB,SAAS,YAAY;AAAA,MACnE;AAEA,UAAI,+BAA+B,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AsB;AAC7C,UAAM,EAAE,SAAS,IAAI;AAErB,QAAI,CAAC,UAAU;AACb,gBAAU,cAAc,WAAW,GAAG,8BAA8B;AAAA,QAClE,OAAO;AAAA,MACT,CAAC;AACD;AAAA,IACF;AAEA,iBAAa,IAAI,QAAQ;AAAA,EAC3B;AAEA,aAAW,YAAY,cAAc;AACnC,QAAI;AACF,YAAM,QAAQ,MAAM,WAAW,MAAM,QAAQ;AAE7C,UAAI,MAAM,OAAO,GAAG;AAClB,cAAM,WAAW,OAAO,QAAQ;AAChC,kBAAU,gBAAgB,WAAW,QAAQ,CAAC,IAAI,CAAC,CAAC;AAAA,MACtD,WAAW,MAAM,YAAY,GAAG;AAC9B,kBAAU,uBAAuB,WAAW,QAAQ,CAAC,eAAe,CAAC,CAAC;AAAA,MACxE,OAAO;AACL;AAAA,UACE,yBAAyB,WAAW,QAAQ,CAAC;AAAA,UAC7C,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,gBAAU,kBAAkB,WAAW,QAAQ,CAAC,KAAK,GAAG,IAAI;AAAA,QAC1D,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"push.mjs","names":["dictionaries: Dictionary[]","existingDictionariesKeys: string[]","dictionariesStatuses: DictionariesStatus[]","successfullyPushedDictionaries: Dictionary[]","filePathsSet: Set<string>"],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport * as readline from 'node:readline';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n formatPath,\n type ListGitFilesOptions,\n listGitFiles,\n parallelize,\n prepareIntlayer,\n} from '@intlayer/chokidar';\nimport {\n ANSIColors,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary } from '@intlayer/types';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth } from '../utils/checkAccess';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status: 'pending' | 'pushing' | 'modified' | 'pushed' | 'unknown' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const dictionariesRecord = getDictionaries(config);\n let dictionaries: Dictionary[] = Object.values(dictionariesRecord);\n const existingDictionariesKeys: string[] = Object.keys(dictionariesRecord);\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.content.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:', {});\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries || [];\n const newDictionaries = pushResult.data?.newDictionaries || [];\n\n if (updatedDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (newDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n // Print per-dictionary summary similar to loadDictionaries\n const iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'pushed':\n case 'modified':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n };\n\n const colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'pushed':\n case 'modified':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n };\n\n for (const s of dictionariesStatuses) {\n const icon = iconFor(s.status);\n const color = colorFor(s.status);\n appLogger(\n ` - ${s.dictionary.key} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const answer = await askUser(\n 'Do you want to delete the local dictionaries that were successfully pushed? (yes/no): '\n );\n if (answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y') {\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst askUser = (question: string): Promise<string> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n return new Promise((resolve) => {\n rl.question(question, (answer: string) => {\n rl.close();\n resolve(answer);\n });\n });\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(`Dictionary ${dictionary.key} does not have a file path`, {\n level: 'error',\n });\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAyCA,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,MAAM,YAAY,aAAa,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAEF,KAAI,SAAS,UAAU,KACrB,OAAM,gBAAgB,QAAQ,EAAE,UAAU,MAAM,CAAC;UACxC,OAAO,SAAS,UAAU,YACnC,OAAM,gBAAgB,OAAO;AAG/B,KAAI;AAGF,MAAI,CAFe,MAAM,aAAa,OAAO,CAE5B;EAEjB,MAAM,cAAc,oBAAoB,QAAW,OAAO;EAE1D,MAAM,qBAAqB,gBAAgB,OAAO;EAClD,IAAIA,eAA6B,OAAO,OAAO,mBAAmB;EAClE,MAAMC,2BAAqC,OAAO,KAAK,mBAAmB;AAE1E,MAAI,SAAS,cAAc;GAEzB,MAAM,iCAAiC,QAAQ,aAAa,QACzD,iBAAiB,CAAC,yBAAyB,SAAS,aAAa,CACnE;AAED,OAAI,+BAA+B,SAAS,EAC1C,WACE,4CAA4C,+BAA+B,KACzE,KACD,CAAC,0BACF,EACE,OAAO,SACR,CACF;AAIH,kBAAe,aAAa,QAAQ,eAClC,QAAQ,cAAc,SAAS,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QAAQ;EACjB,CAAC;AACF,QAAO,IAAI,SAAS,cAAY;AAC9B,KAAG,SAAS,WAAW,WAAmB;AACxC,MAAG,OAAO;AACV,aAAQ,OAAO;IACf;GACF;;AAGJ,MAAM,0BAA0B,OAC9B,sBACA,YACkB;CAElB,MAAM,YAAY,aADH,iBAAiB,SAAS,cAAc,EAChB,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;CAGF,MAAMC,+BAA4B,IAAI,KAAK;AAE3C,MAAK,MAAM,cAAc,sBAAsB;EAC7C,MAAM,EAAE,aAAa;AAErB,MAAI,CAAC,UAAU;AACb,aAAU,cAAc,WAAW,IAAI,6BAA6B,EAClE,OAAO,SACR,CAAC;AACF;;AAGF,eAAa,IAAI,SAAS;;AAG5B,MAAK,MAAM,YAAY,aACrB,KAAI;EACF,MAAM,QAAQ,MAAM,WAAW,MAAM,SAAS;AAE9C,MAAI,MAAM,QAAQ,EAAE;AAClB,SAAM,WAAW,OAAO,SAAS;AACjC,aAAU,gBAAgB,WAAW,SAAS,IAAI,EAAE,CAAC;aAC5C,MAAM,aAAa,CAC5B,WAAU,uBAAuB,WAAW,SAAS,CAAC,cAAc,EAAE,CAAC;MAEvE,WACE,yBAAyB,WAAW,SAAS,CAAC,cAC9C,EAAE,CACH;UAEI,KAAK;AACZ,YAAU,kBAAkB,WAAW,SAAS,CAAC,IAAI,OAAO,EAC1D,OAAO,SACR,CAAC"}
@@ -1,27 +1,18 @@
1
- import { getIntlayerAPIProxy } from "@intlayer/api";
2
- import {
3
- getAppLogger,
4
- getConfiguration
5
- } from "@intlayer/config";
6
1
  import { checkCMSAuth } from "./utils/checkAccess.mjs";
2
+ import { getIntlayerAPIProxy } from "@intlayer/api";
3
+ import { getAppLogger, getConfiguration } from "@intlayer/config";
4
+
5
+ //#region src/pushConfig.ts
7
6
  const pushConfig = async (options) => {
8
- const config = getConfiguration(options?.configOptions);
9
- const appLogger = getAppLogger(config, {
10
- config: {
11
- prefix: ""
12
- }
13
- });
14
- const hasCMSAuth = await checkCMSAuth(config);
15
- if (!hasCMSAuth) return;
16
- const intlayerAPI = getIntlayerAPIProxy(void 0, config);
17
- const getDictionariesKeysResult = await intlayerAPI.project.pushProjectConfiguration(config);
18
- if (!getDictionariesKeysResult.data) {
19
- throw new Error("Error pushing project configuration");
20
- }
21
- appLogger("Project configuration pushed successfully");
22
- appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));
23
- };
24
- export {
25
- pushConfig
7
+ const config = getConfiguration(options?.configOptions);
8
+ const appLogger = getAppLogger(config, { config: { prefix: "" } });
9
+ if (!await checkCMSAuth(config)) return;
10
+ const getDictionariesKeysResult = await getIntlayerAPIProxy(void 0, config).project.pushProjectConfiguration(config);
11
+ if (!getDictionariesKeysResult.data) throw new Error("Error pushing project configuration");
12
+ appLogger("Project configuration pushed successfully");
13
+ appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));
26
14
  };
15
+
16
+ //#endregion
17
+ export { pushConfig };
27
18
  //# sourceMappingURL=pushConfig.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n getAppLogger,\n getConfiguration,\n type GetConfigurationOptions,\n} from '@intlayer/config';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,oBAAoB;AAMtB,MAAM,aAAa,OAAO,YAA0B;AACzD,QAAM,SAAS,iBAAiB,SAAS,aAAa;AACtD,QAAM,YAAY,aAAa,QAAQ;AAAA,IACrC,QAAQ;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,EACF,CAAC;AAED,QAAM,aAAa,MAAM,aAAa,MAAM;AAE5C,MAAI,CAAC,WAAY;AAEjB,QAAM,cAAc,oBAAoB,QAAW,MAAM;AAGzD,QAAM,4BACJ,MAAM,YAAY,QAAQ,yBAAyB,MAAM;AAE3D,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AAEA,YAAU,2CAA2C;AAErD,YAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,CAAC,CAAC;AACnE;","names":[]}
1
+ {"version":3,"file":"pushConfig.mjs","names":[],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":";;;;;AAYA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,MAAM,YAAY,aAAa,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,CAFe,MAAM,aAAa,OAAO,CAE5B;CAKjB,MAAM,4BACJ,MAJkB,oBAAoB,QAAW,OAAO,CAItC,QAAQ,yBAAyB,OAAO;AAE5D,KAAI,CAAC,0BAA0B,KAC7B,OAAM,IAAI,MAAM,sCAAsC;AAGxD,WAAU,4CAA4C;AAEtD,WAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,EAAE,CAAC"}