@zodic/shared 0.0.243 → 0.0.244

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.
@@ -2174,15 +2174,25 @@ export class ConceptService {
2174
2174
  }
2175
2175
 
2176
2176
  private parseAstrologicalReport(response: string): AstrologicalReport[] {
2177
+ console.log("📌 Starting parseAstrologicalReport");
2178
+
2177
2179
  const reports: AstrologicalReport[] = [];
2178
2180
  const languageSections = response
2179
2181
  .split(/--\s*(EN|PT)\s*\n/)
2180
2182
  .filter(Boolean);
2183
+ console.log(`🔍 Split response into ${languageSections.length} sections`);
2181
2184
 
2182
2185
  for (let i = 0; i < languageSections.length; i += 2) {
2183
2186
  const language = languageSections[i].trim();
2184
2187
  const content = languageSections[i + 1]?.trim();
2185
- if (!content || !language.match(/^(EN|PT)$/)) continue;
2188
+ console.log(`🚀 Processing section ${i / 2 + 1}: Language = ${language}`);
2189
+
2190
+ if (!content || !language.match(/^(EN|PT)$/)) {
2191
+ console.warn(`⚠️ Skipping section ${i / 2 + 1}: Invalid content or language (${language})`);
2192
+ continue;
2193
+ }
2194
+
2195
+ console.log(`📜 Raw content for ${language}:\n${content.slice(0, 500)}${content.length > 500 ? "..." : ""}`);
2186
2196
 
2187
2197
  const report: AstrologicalReport = {
2188
2198
  language,
@@ -2191,35 +2201,50 @@ export class ConceptService {
2191
2201
  };
2192
2202
 
2193
2203
  const lines = content.split('\n').map((line) => line.trim());
2204
+ console.log(`🔢 Split into ${lines.length} lines`);
2205
+
2194
2206
  let currentSection = '';
2195
2207
 
2196
2208
  for (const line of lines) {
2209
+ console.log(`📏 Processing line: "${line}"`);
2210
+
2197
2211
  if (line.startsWith('### ') && report.title.length === 0) {
2212
+ const titleContent = cleanText(line.replace('### ', ''));
2213
+ console.log(`🏷️ Found title: "${titleContent}"`);
2198
2214
  report.title.push({
2199
2215
  type: 'title',
2200
- content: cleanText(line.replace('### ', '')),
2216
+ content: titleContent,
2201
2217
  });
2202
2218
  continue;
2203
2219
  }
2204
2220
 
2205
2221
  if (line.startsWith('#### ')) {
2206
2222
  currentSection = cleanText(line.replace('#### ', '').trim());
2223
+ console.log(`🗂️ New section: "${currentSection}"`);
2207
2224
  report.sections[currentSection] = report.sections[currentSection] || [];
2208
2225
  continue;
2209
2226
  }
2210
2227
 
2211
- if (!line || !currentSection) continue;
2228
+ if (!line || !currentSection) {
2229
+ console.log(`⏩ Skipping line: ${!line ? "Empty" : "No current section"}`);
2230
+ continue;
2231
+ }
2212
2232
 
2213
2233
  if (line.match(/^\d+\.\s/) || line.startsWith('- ')) {
2214
2234
  const listItem = line.replace(/^\d+\.\s|- /, '').trim();
2215
- const boldMatch = listItem.match(/^\*\*(.+?)\*\*[:\s]*(.+)$/); // Updated regex
2235
+ console.log(`🔹 Bullet point detected: "${listItem}"`);
2236
+ const boldMatch = listItem.match(/^\*\*(.+?)\*\*[:\s]*(.+)$/);
2216
2237
  if (boldMatch) {
2238
+ const title = cleanText(boldMatch[1]);
2239
+ const content = cleanText(boldMatch[2]);
2240
+ console.log(`✅ Bold match found - Title: "${title}", Content: "${content}"`);
2217
2241
  report.sections[currentSection].push({
2218
2242
  type: 'bullet-point',
2219
- title: cleanText(boldMatch[1]),
2220
- content: cleanText(boldMatch[2]),
2243
+ title,
2244
+ content,
2221
2245
  });
2222
2246
  } else {
2247
+ console.log(`❌ No bold match - Full content: "${listItem}"`);
2223
2248
  report.sections[currentSection].push({
2224
2249
  type: 'bullet-point',
2225
2250
  content: cleanText(listItem),
@@ -2228,15 +2253,18 @@ export class ConceptService {
2228
2253
  continue;
2229
2254
  }
2230
2255
 
2256
+ console.log(`📝 Paragraph: "${line}"`);
2231
2257
  report.sections[currentSection].push({
2232
2258
  type: 'p',
2233
2259
  content: cleanText(line),
2234
2260
  });
2235
2261
  }
2236
2262
 
2263
+ console.log(`🏁 Finished parsing ${language} section. Result:\n${JSON.stringify(report, null, 2)}`);
2237
2264
  reports.push(report);
2238
2265
  }
2239
2266
 
2267
+ console.log(`🎉 Parsing complete. Total reports: ${reports.length}`);
2240
2268
  return reports;
2241
2269
  }
2242
2270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.243",
3
+ "version": "0.0.244",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {