@ollang-dev/sdk 0.3.3 → 0.3.5

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.
@@ -9,6 +9,7 @@ const tms_js_1 = require("../tms.js");
9
9
  const auto_detect_js_1 = require("../detector/auto-detect.js");
10
10
  const strapi_pusher_js_1 = require("./strapi-pusher.js");
11
11
  const strapi_schema_js_1 = require("./strapi-schema.js");
12
+ const logger_js_1 = require("../../logger.js");
12
13
  const app = (0, express_1.default)();
13
14
  const strapiSchemaCache = new Map();
14
15
  const PORT = process.env.TMS_PORT || 5972;
@@ -88,13 +89,13 @@ async function updateCurrentScan(folderName) {
88
89
  const state = getOrCreateFolderState(folderName);
89
90
  const { currentScanId, texts, videos, images, audios } = state;
90
91
  if (!tms) {
91
- console.warn('⚠️ Cannot update scan: Ollang not initialized');
92
+ logger_js_1.logger.warn('Cannot update scan: Ollang not initialized');
92
93
  return;
93
94
  }
94
95
  try {
95
96
  const sdk = tms.getSDK();
96
97
  if (!sdk) {
97
- console.warn('⚠️ SDK not available');
98
+ logger_js_1.logger.warn('SDK not available');
98
99
  return;
99
100
  }
100
101
  if (!currentScanId) {
@@ -104,7 +105,7 @@ async function updateCurrentScan(folderName) {
104
105
  state.currentScanId = previousScans[0].id;
105
106
  }
106
107
  else {
107
- console.warn('⚠️ No existing scan found, cannot update');
108
+ logger_js_1.logger.warn('No existing scan found, cannot update');
108
109
  return;
109
110
  }
110
111
  }
@@ -117,7 +118,7 @@ async function updateCurrentScan(folderName) {
117
118
  : existingScan.scanData || {};
118
119
  }
119
120
  catch (error) {
120
- console.warn('⚠️ Could not load existing scan data while updating scan:', error?.message || error);
121
+ logger_js_1.logger.warn('Could not load existing scan data while updating scan');
121
122
  existingScanData = {};
122
123
  }
123
124
  const i18nSetup = tms.getI18nSetup();
@@ -136,8 +137,7 @@ async function updateCurrentScan(folderName) {
136
137
  });
137
138
  }
138
139
  catch (error) {
139
- console.error('Failed to update scan:', error.message);
140
- console.error('❌ Error stack:', error.stack);
140
+ logger_js_1.logger.error('Failed to update scan', error);
141
141
  }
142
142
  }
143
143
  async function initTMS() {
@@ -176,7 +176,7 @@ async function initTMS() {
176
176
  }
177
177
  }
178
178
  catch (e) {
179
- console.warn('⚠️ Failed to read ollang.config.ts, falling back to env/defaults');
179
+ logger_js_1.logger.warn('Failed to read ollang.config.ts, falling back to env/defaults');
180
180
  }
181
181
  const sourceLanguage = fileConfig.sourceLanguage || process.env.TMS_SOURCE_LANGUAGE || 'en';
182
182
  const targetLanguages = fileConfig.targetLanguages ||
@@ -190,7 +190,7 @@ async function initTMS() {
190
190
  targetLanguages,
191
191
  ollang: {
192
192
  apiKey,
193
- baseUrl: 'http://localhost:8080',
193
+ baseUrl: 'https://api-integration.ollang.com',
194
194
  projectId,
195
195
  defaultLevel: 0,
196
196
  mockMode: process.env.TMS_MOCK_MODE === 'true',
@@ -213,7 +213,7 @@ async function initTMS() {
213
213
  },
214
214
  });
215
215
  if (!apiKey) {
216
- console.warn('⚠️ OLLANG_API_KEY not set. Translation features will not work.');
216
+ logger_js_1.logger.warn('OLLANG_API_KEY not set. Translation features will not work.');
217
217
  }
218
218
  return tms;
219
219
  }
@@ -260,7 +260,7 @@ app.get('/api/projects', async (req, res) => {
260
260
  });
261
261
  }
262
262
  catch (error) {
263
- console.error('Failed to load projects:', error.message);
263
+ logger_js_1.logger.error('Failed to load projects', error);
264
264
  res.status(500).json({
265
265
  success: false,
266
266
  error: error.message,
@@ -288,6 +288,7 @@ app.post('/api/config/apikey', async (req, res) => {
288
288
  if (!baseUrl) {
289
289
  throw new Error('Base URL is not configured');
290
290
  }
291
+ logger_js_1.logger.debug('Validating API key with base URL:', baseUrl);
291
292
  const response = await fetch(`${baseUrl}/scans/folders`, {
292
293
  method: 'GET',
293
294
  headers: {
@@ -303,14 +304,14 @@ app.post('/api/config/apikey', async (req, res) => {
303
304
  if (!folders || !Array.isArray(folders)) {
304
305
  throw new Error('Invalid response from server while validating API key');
305
306
  }
306
- console.log(`✅ API key validated successfully. Accessible folders: ${folders.length}`);
307
+ logger_js_1.logger.debug(`API key validated successfully. Accessible folders: ${folders.length}`);
307
308
  res.json({
308
309
  success: true,
309
310
  message: 'API key validated and updated successfully',
310
311
  });
311
312
  }
312
313
  catch (validationError) {
313
- console.error(' API key validation failed:', validationError.message);
314
+ logger_js_1.logger.error('Test API key validation failed', validationError);
314
315
  process.env.OLLANG_API_KEY = previousApiKey;
315
316
  tms = await initTMS();
316
317
  return res.status(401).json({
@@ -320,7 +321,7 @@ app.post('/api/config/apikey', async (req, res) => {
320
321
  }
321
322
  }
322
323
  catch (error) {
323
- console.error('Failed to update API key:', error.message);
324
+ logger_js_1.logger.error('Failed to update API key', error);
324
325
  res.status(500).json({
325
326
  success: false,
326
327
  error: error.message,
@@ -375,7 +376,7 @@ app.post('/api/config/update', async (req, res) => {
375
376
  });
376
377
  }
377
378
  catch (error) {
378
- console.error('Failed to update config:', error.message);
379
+ logger_js_1.logger.error('Failed to update config', error);
379
380
  res.status(500).json({
380
381
  success: false,
381
382
  error: error.message,
@@ -490,7 +491,7 @@ app.post('/api/scan', async (req, res) => {
490
491
  }
491
492
  }
492
493
  catch (e) {
493
- console.error('⚠️ Could not load previous scans via listScans:', e?.message || e);
494
+ logger_js_1.logger.error('Could not load previous scans via listScans', e);
494
495
  }
495
496
  if (latestScanData && latestScanData.texts && folderState.currentScanId) {
496
497
  const previousTextsMap = new Map(latestScanData.texts.map((t) => [t.id, t]));
@@ -557,7 +558,7 @@ app.post('/api/scan', async (req, res) => {
557
558
  }
558
559
  }
559
560
  catch (saveError) {
560
- console.error('⚠️ Failed to save scan results:', saveError.message);
561
+ logger_js_1.logger.error('Failed to save scan results', saveError);
561
562
  }
562
563
  const scanTime = new Date().toISOString();
563
564
  res.json({
@@ -575,7 +576,7 @@ app.post('/api/scan', async (req, res) => {
575
576
  });
576
577
  }
577
578
  catch (error) {
578
- console.error('Scan error:', error.message);
579
+ logger_js_1.logger.error('Scan error', error);
579
580
  res.status(500).json({
580
581
  success: false,
581
582
  error: error.message,
@@ -614,7 +615,7 @@ app.post('/api/translate', async (req, res) => {
614
615
  const sdk = tms.getSDK();
615
616
  if (sdk && folderName) {
616
617
  try {
617
- console.log(`📂 Loading latest scan for folder: ${folderName}`);
618
+ logger_js_1.logger.debug(`Loading latest scan for folder: ${folderName}`);
618
619
  // Get folderId from Ollang server's /api/folders endpoint
619
620
  try {
620
621
  const axios = require('axios');
@@ -623,11 +624,11 @@ app.post('/api/translate', async (req, res) => {
623
624
  const targetFolder = folders.find((f) => f.name === folderName);
624
625
  if (targetFolder && targetFolder.id) {
625
626
  folderId = targetFolder.id;
626
- console.log(`📁 Found folderId: ${folderId} for folder: ${folderName}`);
627
+ logger_js_1.logger.debug(`Found folderId: ${folderId} for folder: ${folderName}`);
627
628
  }
628
629
  }
629
630
  catch (folderError) {
630
- console.warn('⚠️ Could not get folders:', folderError.message);
631
+ logger_js_1.logger.warn('Could not get folders');
631
632
  }
632
633
  const scans = await sdk.scans.listScans();
633
634
  // Find the latest scan for this folder
@@ -643,12 +644,12 @@ app.post('/api/translate', async (req, res) => {
643
644
  : latestScan.scanData;
644
645
  if (scanData.texts) {
645
646
  folderState.texts = scanData.texts;
646
- console.log(`✅ Loaded ${folderState.texts.length} items from folder ${folderName}`);
647
+ logger_js_1.logger.debug(`Loaded ${folderState.texts.length} items from folder ${folderName}`);
647
648
  }
648
649
  }
649
650
  }
650
651
  catch (error) {
651
- console.warn('⚠️ Could not load folder scan:', error.message);
652
+ logger_js_1.logger.warn('Could not load folder scan');
652
653
  }
653
654
  }
654
655
  else if (sdk && folderState.currentScanId) {
@@ -658,19 +659,19 @@ app.post('/api/translate', async (req, res) => {
658
659
  const scanData = typeof scan.scanData === 'string' ? JSON.parse(scan.scanData) : scan.scanData;
659
660
  if (scanData.texts) {
660
661
  folderState.texts = scanData.texts;
661
- console.log(`✅ Reloaded ${folderState.texts.length} items from scan ${folderState.currentScanId}`);
662
+ logger_js_1.logger.debug(`Reloaded ${folderState.texts.length} items from scan ${folderState.currentScanId}`);
662
663
  }
663
664
  }
664
665
  catch (error) {
665
- console.warn('⚠️ Could not reload scan data, using cached currentTexts');
666
+ logger_js_1.logger.warn('Could not reload scan data, using cached currentTexts');
666
667
  }
667
668
  }
668
669
  // Items are already grouped by entry (each entry = one item with cmsFields).
669
670
  // Direct lookup by textIds is sufficient.
670
671
  const selectedItems = folderState.texts.filter((t) => textIds.includes(t.id));
671
672
  if (selectedItems.length === 0) {
672
- console.error(`❌ No items found. Requested IDs: ${textIds.slice(0, 3).join(', ')}...`);
673
- console.error(`❌ Available IDs: ${folderState.texts
673
+ logger_js_1.logger.debug(`No items found. Requested IDs: ${textIds.slice(0, 3).join(', ')}...`);
674
+ logger_js_1.logger.debug(`Available IDs: ${folderState.texts
674
675
  .slice(0, 3)
675
676
  .map((t) => t.id)
676
677
  .join(', ')}...`);
@@ -684,15 +685,11 @@ app.post('/api/translate', async (req, res) => {
684
685
  const videoItems = selectedItems.filter((item) => item.category === 'video');
685
686
  const imageItems = selectedItems.filter((item) => item.category === 'image');
686
687
  const audioItems = selectedItems.filter((item) => item.category === 'audio');
687
- console.log(`📊 Translation breakdown:`);
688
- console.log(` - i18n texts: ${i18nItems.length}`);
689
- console.log(` - Videos: ${videoItems.length}`);
690
- console.log(` - Images: ${imageItems.length}`);
691
- console.log(` - Audios: ${audioItems.length}`);
688
+ logger_js_1.logger.debug(`Translation breakdown: i18n=${i18nItems.length}, videos=${videoItems.length}, images=${imageItems.length}, audios=${audioItems.length}`);
692
689
  // Log cmsFields info for entry-based items
693
690
  for (const item of i18nItems) {
694
691
  if (item.cmsFields) {
695
- console.log(` 📦 Entry ${item.id}: ${Object.keys(item.cmsFields).length} fields [${Object.keys(item.cmsFields).join(', ')}]`);
692
+ logger_js_1.logger.debug(`Entry ${item.id}: ${Object.keys(item.cmsFields).length} fields [${Object.keys(item.cmsFields).join(', ')}]`);
696
693
  }
697
694
  }
698
695
  // Update all items to 'translating' status immediately (per language)
@@ -716,7 +713,7 @@ app.post('/api/translate', async (req, res) => {
716
713
  await updateCurrentScan(folderName);
717
714
  }
718
715
  catch (saveError) {
719
- console.error('⚠️ Failed to save translating status:', saveError.message);
716
+ logger_js_1.logger.error('Failed to save translating status', saveError);
720
717
  }
721
718
  // Return immediately with translating status
722
719
  res.json({
@@ -736,7 +733,7 @@ app.post('/api/translate', async (req, res) => {
736
733
  const primaryLang = languages[0];
737
734
  if (i18nItems.length > 0) {
738
735
  for (const lang of languages) {
739
- console.log(`🌍 Translating ${i18nItems.length} i18n texts to ${lang}...`);
736
+ logger_js_1.logger.debug(`Translating ${i18nItems.length} i18n texts to ${lang}...`);
740
737
  try {
741
738
  const order = await tms.translate(i18nItems, lang, level || 0, folderName, folderId);
742
739
  const translations = tms.getTranslations();
@@ -792,18 +789,18 @@ app.post('/api/translate', async (req, res) => {
792
789
  });
793
790
  }
794
791
  catch (error) {
795
- console.error(`❌ i18n translation error for lang ${lang}:`, error.message);
792
+ logger_js_1.logger.error(`i18n translation error for lang ${lang}`, error);
796
793
  }
797
794
  }
798
795
  }
799
796
  if (videoItems.length > 0) {
800
- console.log(`🎬 Translating ${videoItems.length} videos to ${primaryLang}...`);
797
+ logger_js_1.logger.debug(`Translating ${videoItems.length} videos to ${primaryLang}...`);
801
798
  for (const item of videoItems) {
802
799
  try {
803
800
  const videoData = item._videoData;
804
801
  if (videoData) {
805
802
  const orderId = await tms.translateVideo(videoData, primaryLang, level || 0);
806
- console.log(`✅ Video translation order created: ${orderId}`);
803
+ logger_js_1.logger.debug(`Video translation order created: ${orderId}`);
807
804
  const textIndex = folderState.texts.findIndex((t) => t.id === item.id);
808
805
  if (textIndex !== -1) {
809
806
  folderState.texts[textIndex] = {
@@ -815,7 +812,7 @@ app.post('/api/translate', async (req, res) => {
815
812
  }
816
813
  }
817
814
  catch (error) {
818
- console.error(`❌ Video translation error for ${item.id}:`, error.message);
815
+ logger_js_1.logger.error(`Video translation error for ${item.id}`, error);
819
816
  const textIndex = folderState.texts.findIndex((t) => t.id === item.id);
820
817
  if (textIndex !== -1) {
821
818
  folderState.texts[textIndex] = {
@@ -827,14 +824,14 @@ app.post('/api/translate', async (req, res) => {
827
824
  }
828
825
  }
829
826
  if (imageItems.length > 0) {
830
- console.log(`🖼️ Translating ${imageItems.length} images to ${primaryLang}...`);
827
+ logger_js_1.logger.debug(`Translating ${imageItems.length} images to ${primaryLang}...`);
831
828
  for (const item of imageItems) {
832
829
  try {
833
830
  const imageData = item._imageData;
834
831
  if (imageData) {
835
832
  imageData.textItemId = item.id;
836
833
  const orderId = await tms.translateImage(imageData, primaryLang, level || 0);
837
- console.log(`✅ Image translation order created: ${orderId}`);
834
+ logger_js_1.logger.debug(`Image translation order created: ${orderId}`);
838
835
  const textIndex = folderState.texts.findIndex((t) => t.id === item.id);
839
836
  if (textIndex !== -1) {
840
837
  folderState.texts[textIndex] = {
@@ -846,7 +843,7 @@ app.post('/api/translate', async (req, res) => {
846
843
  }
847
844
  }
848
845
  catch (error) {
849
- console.error(`❌ Image translation error for ${item.id}:`, error.message);
846
+ logger_js_1.logger.error(`Image translation error for ${item.id}`, error);
850
847
  const textIndex = folderState.texts.findIndex((t) => t.id === item.id);
851
848
  if (textIndex !== -1) {
852
849
  folderState.texts[textIndex] = {
@@ -858,7 +855,7 @@ app.post('/api/translate', async (req, res) => {
858
855
  }
859
856
  }
860
857
  if (audioItems.length > 0) {
861
- console.log(`🎵 Translating ${audioItems.length} audios to ${primaryLang}...`);
858
+ logger_js_1.logger.debug(`Translating ${audioItems.length} audios to ${primaryLang}...`);
862
859
  for (const item of audioItems) {
863
860
  try {
864
861
  const audioData = item._audioData;
@@ -875,7 +872,7 @@ app.post('/api/translate', async (req, res) => {
875
872
  }
876
873
  }
877
874
  catch (error) {
878
- console.error(`❌ Audio translation error for ${item.id}:`, error.message);
875
+ logger_js_1.logger.error(`Audio translation error for ${item.id}`, error);
879
876
  const textIndex = folderState.texts.findIndex((t) => t.id === item.id);
880
877
  if (textIndex !== -1) {
881
878
  folderState.texts[textIndex] = {
@@ -888,19 +885,19 @@ app.post('/api/translate', async (req, res) => {
888
885
  }
889
886
  try {
890
887
  await updateCurrentScan(folderName);
891
- console.log('All translations completed and saved');
888
+ logger_js_1.logger.debug('All translations completed and saved');
892
889
  }
893
890
  catch (saveError) {
894
- console.warn('⚠️ Failed to save translation statuses:', saveError.message);
891
+ logger_js_1.logger.warn('Failed to save translation statuses');
895
892
  }
896
893
  }
897
894
  catch (error) {
898
- console.error('Translation error:', error.message);
895
+ logger_js_1.logger.error('Translation error', error);
899
896
  }
900
897
  })();
901
898
  }
902
899
  catch (error) {
903
- console.error('Translation error:', error.message);
900
+ logger_js_1.logger.error('Translation error', error);
904
901
  res.status(500).json({
905
902
  success: false,
906
903
  error: error.message,
@@ -944,7 +941,7 @@ app.post('/api/apply', async (req, res) => {
944
941
  }
945
942
  }
946
943
  catch (error) {
947
- console.error('⚠️ Could not load folder scan:', error.message);
944
+ logger_js_1.logger.error('Could not load folder scan', error);
948
945
  }
949
946
  }
950
947
  let translations = tms.getTranslations();
@@ -994,20 +991,19 @@ app.post('/api/apply', async (req, res) => {
994
991
  let updatedFiles = 0;
995
992
  let strapiResults = { pushed: 0, failed: 0 };
996
993
  if (fileItems.length > 0) {
997
- console.log(`📝 Applying ${fileItems.length} file-based translations...`);
994
+ logger_js_1.logger.debug(`Applying ${fileItems.length} file-based translations...`);
998
995
  tms['state'].texts = folderState.texts;
999
996
  updatedFiles = await tms.applyTranslations(targetLanguage, fileItems);
1000
- console.log(`✅ Updated ${updatedFiles} files`);
997
+ logger_js_1.logger.debug(`Updated ${updatedFiles} files`);
1001
998
  }
1002
999
  if (cmsEntryItems.length > 0) {
1003
1000
  const strapiUrl = reqStrapiUrl || process.env.STRAPI_URL || process.env.STRAPI_BASE_URL || '';
1004
1001
  const strapiToken = effectiveStrapiToken || process.env.STRAPI_TOKEN || process.env.STRAPI_API_TOKEN || '';
1005
1002
  if (!strapiUrl || !strapiToken) {
1006
- console.warn('⚠️ STRAPI_URL and STRAPI_TOKEN env vars required for CMS push. Skipping Strapi push.');
1007
- console.warn(' Set: STRAPI_URL=https://cms.ollang.com STRAPI_TOKEN=your-token');
1003
+ logger_js_1.logger.warn('STRAPI_URL and STRAPI_TOKEN env vars required for CMS push. Skipping Strapi push.');
1008
1004
  }
1009
1005
  else {
1010
- console.log(`🌐 Pushing ${cmsEntryItems.length} CMS entries to Strapi (${strapiUrl})...`);
1006
+ logger_js_1.logger.debug(`Pushing ${cmsEntryItems.length} CMS entries to Strapi (${strapiUrl})...`);
1011
1007
  const pusher = new strapi_pusher_js_1.StrapiPusher({ strapiUrl, strapiToken });
1012
1008
  const strapiTranslations = [];
1013
1009
  for (const item of cmsEntryItems) {
@@ -1050,7 +1046,7 @@ app.post('/api/apply', async (req, res) => {
1050
1046
  errors: result.errors,
1051
1047
  };
1052
1048
  if (result.errors.length > 0) {
1053
- console.error(' Strapi push errors (per field):', JSON.stringify(result.errors, null, 2));
1049
+ logger_js_1.logger.error('Strapi push errors encountered');
1054
1050
  }
1055
1051
  }
1056
1052
  }
@@ -1079,7 +1075,7 @@ app.post('/api/apply', async (req, res) => {
1079
1075
  await updateCurrentScan(folderName);
1080
1076
  }
1081
1077
  catch (saveError) {
1082
- console.error('⚠️ Failed to save apply statuses:', saveError.message);
1078
+ logger_js_1.logger.error('Failed to save apply statuses', saveError);
1083
1079
  }
1084
1080
  const appliedCount = appliedTextIds.length;
1085
1081
  res.json({
@@ -1093,7 +1089,7 @@ app.post('/api/apply', async (req, res) => {
1093
1089
  });
1094
1090
  }
1095
1091
  catch (error) {
1096
- console.error('Apply error:', error.message);
1092
+ logger_js_1.logger.error('Apply error', error);
1097
1093
  res.status(500).json({
1098
1094
  success: false,
1099
1095
  error: error.message,
@@ -1119,7 +1115,7 @@ function getOllangBackendBase() {
1119
1115
  backendBase = tms.getConfig().ollang.baseUrl || '';
1120
1116
  }
1121
1117
  if (!backendBase) {
1122
- backendBase = 'http://localhost:8080';
1118
+ backendBase = 'https://api-integration.ollang.com';
1123
1119
  }
1124
1120
  backendBase = backendBase.replace(/\/$/, '');
1125
1121
  try {
@@ -1128,13 +1124,13 @@ function getOllangBackendBase() {
1128
1124
  const extraHosts = (process.env.OLLANG_ALLOWED_HOSTS || '').split(',').filter(Boolean);
1129
1125
  extraHosts.forEach((h) => allowedHosts.add(h.trim()));
1130
1126
  if (!allowedHosts.has(parsed.hostname)) {
1131
- console.warn(`\u26a0\ufe0f Backend URL hostname "${parsed.hostname}" not in allowlist, using default`);
1132
- return 'http://localhost:8080';
1127
+ logger_js_1.logger.warn(`Backend URL hostname "${parsed.hostname}" not in allowlist, using default`);
1128
+ return 'https://api-integration.ollang.com';
1133
1129
  }
1134
1130
  }
1135
1131
  catch {
1136
- console.warn('\u26a0\ufe0f Invalid backend URL format, using default');
1137
- return 'http://localhost:8080';
1132
+ logger_js_1.logger.warn('Invalid backend URL format, using default');
1133
+ return 'https://api-integration.ollang.com';
1138
1134
  }
1139
1135
  return backendBase;
1140
1136
  }
@@ -1153,7 +1149,7 @@ app.get('/scans/folders', async (req, res) => {
1153
1149
  res.status(response.status).json(data);
1154
1150
  }
1155
1151
  catch (error) {
1156
- console.error('/scans/folders proxy error:', error?.message);
1152
+ logger_js_1.logger.error('/scans/folders proxy error', error);
1157
1153
  res.status(500).json({
1158
1154
  success: false,
1159
1155
  error: error?.message || 'Failed to reach Ollang API',
@@ -1177,7 +1173,7 @@ app.get('/scans', async (req, res) => {
1177
1173
  res.status(response.status).json(data);
1178
1174
  }
1179
1175
  catch (error) {
1180
- console.error('GET /scans proxy error:', error?.message);
1176
+ logger_js_1.logger.error('GET /scans proxy error', error);
1181
1177
  res.status(500).json({
1182
1178
  success: false,
1183
1179
  error: error?.message || 'Failed to reach Ollang API',
@@ -1200,7 +1196,7 @@ app.post('/scans', async (req, res) => {
1200
1196
  res.status(response.status).json(data);
1201
1197
  }
1202
1198
  catch (error) {
1203
- console.error('POST /scans proxy error:', error?.message);
1199
+ logger_js_1.logger.error('POST /scans proxy error', error);
1204
1200
  res.status(500).json({
1205
1201
  success: false,
1206
1202
  error: error?.message || 'Failed to reach Ollang API',
@@ -1230,7 +1226,7 @@ app.patch('/scans/:id', async (req, res) => {
1230
1226
  res.status(response.status).json(data);
1231
1227
  }
1232
1228
  catch (error) {
1233
- console.error('PATCH /scans/:id proxy error:', error?.message);
1229
+ logger_js_1.logger.error('PATCH /scans/:id proxy error', error);
1234
1230
  res.status(500).json({
1235
1231
  success: false,
1236
1232
  error: error?.message || 'Failed to reach Ollang API',
@@ -1269,8 +1265,7 @@ app.get('/api/folders', async (req, res) => {
1269
1265
  });
1270
1266
  }
1271
1267
  catch (error) {
1272
- console.error('Failed to load folders:', error.message);
1273
- console.error('❌ Error details:', error.response?.data);
1268
+ logger_js_1.logger.error('Failed to load folders', error);
1274
1269
  res.status(500).json({
1275
1270
  success: false,
1276
1271
  error: error.message,
@@ -1298,7 +1293,7 @@ app.get('/api/scans', async (req, res) => {
1298
1293
  });
1299
1294
  }
1300
1295
  catch (error) {
1301
- console.warn('⚠️ Could not load folders for mapping');
1296
+ logger_js_1.logger.warn('Could not load folders for mapping');
1302
1297
  }
1303
1298
  const scansWithFolderName = scans.map((scan) => {
1304
1299
  const scanData = typeof scan.scanData === 'string' ? JSON.parse(scan.scanData) : scan.scanData;
@@ -1332,7 +1327,7 @@ app.get('/api/scans', async (req, res) => {
1332
1327
  });
1333
1328
  }
1334
1329
  catch (error) {
1335
- console.error('Failed to load scans:', error.message);
1330
+ logger_js_1.logger.error('Failed to load scans', error);
1336
1331
  res.status(500).json({
1337
1332
  success: false,
1338
1333
  error: error.message,
@@ -1373,7 +1368,7 @@ app.get('/api/scans/:scanId', async (req, res) => {
1373
1368
  });
1374
1369
  }
1375
1370
  catch (error) {
1376
- console.error('Failed to load scan:', error.message);
1371
+ logger_js_1.logger.error('Failed to load scan', error);
1377
1372
  res.status(500).json({
1378
1373
  success: false,
1379
1374
  error: error.message,
@@ -1427,7 +1422,7 @@ app.post('/api/strapi-schema', async (req, res) => {
1427
1422
  });
1428
1423
  }
1429
1424
  catch (error) {
1430
- console.error('Strapi schema fetch failed:', error?.message || error);
1425
+ logger_js_1.logger.error('Strapi schema fetch failed', error);
1431
1426
  return res.status(500).json({
1432
1427
  success: false,
1433
1428
  error: error?.message || 'Failed to fetch Strapi schema',
@@ -1461,12 +1456,12 @@ app.get('*', (_req, res) => {
1461
1456
  res.sendFile(path_1.default.join(__dirname, '../ui-dist/index.html'));
1462
1457
  });
1463
1458
  app.listen(PORT, () => {
1464
- console.log('🚀 Translation Management System starting...');
1465
- console.log(`📦 Project: ${PROJECT_ROOT}`);
1466
- console.log(`🌐 Control panel: http://localhost:${PORT}`);
1467
- console.log(`💡 Opening in your browser...`);
1468
- console.log(` If not opened: http://localhost:${PORT}`);
1469
- console.log(`⌨️ To stop: Ctrl+C\n`);
1459
+ logger_js_1.logger.info('🚀 Translation Management System starting...');
1460
+ logger_js_1.logger.info(`📦 Project: ${PROJECT_ROOT}`);
1461
+ logger_js_1.logger.info(`🌐 Control panel: http://localhost:${PORT}`);
1462
+ logger_js_1.logger.info(`💡 Opening in your browser...`);
1463
+ logger_js_1.logger.info(` If not opened: http://localhost:${PORT}`);
1464
+ logger_js_1.logger.info(`⌨️ To stop: Ctrl+C\n`);
1470
1465
  const open = require('open');
1471
1466
  open(`http://localhost:${PORT}`).catch(() => { });
1472
1467
  });