@zodic/shared 0.0.242 → 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,53 +2174,77 @@ 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);
2181
-
2183
+ console.log(`🔍 Split response into ${languageSections.length} sections`);
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;
2186
-
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 ? "..." : ""}`);
2196
+
2187
2197
  const report: AstrologicalReport = {
2188
2198
  language,
2189
2199
  title: [],
2190
2200
  sections: {},
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());
2207
- report.sections[currentSection] =
2208
- report.sections[currentSection] || [];
2223
+ console.log(`🗂️ New section: "${currentSection}"`);
2224
+ report.sections[currentSection] = report.sections[currentSection] || [];
2209
2225
  continue;
2210
2226
  }
2211
-
2212
- if (!line || !currentSection) continue;
2213
-
2227
+
2228
+ if (!line || !currentSection) {
2229
+ console.log(`⏩ Skipping line: ${!line ? "Empty" : "No current section"}`);
2230
+ continue;
2231
+ }
2232
+
2214
2233
  if (line.match(/^\d+\.\s/) || line.startsWith('- ')) {
2215
2234
  const listItem = line.replace(/^\d+\.\s|- /, '').trim();
2216
- const boldMatch = listItem.match(/^\*\*(.+?)\*\*:\s*(.+)$/);
2235
+ console.log(`🔹 Bullet point detected: "${listItem}"`);
2236
+ const boldMatch = listItem.match(/^\*\*(.+?)\*\*[:\s]*(.+)$/);
2217
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}"`);
2218
2241
  report.sections[currentSection].push({
2219
2242
  type: 'bullet-point',
2220
- title: cleanText(boldMatch[1]),
2221
- content: cleanText(boldMatch[2]),
2243
+ title,
2244
+ content,
2222
2245
  });
2223
2246
  } else {
2247
+ console.log(`❌ No bold match - Full content: "${listItem}"`);
2224
2248
  report.sections[currentSection].push({
2225
2249
  type: 'bullet-point',
2226
2250
  content: cleanText(listItem),
@@ -2228,16 +2252,19 @@ export class ConceptService {
2228
2252
  }
2229
2253
  continue;
2230
2254
  }
2231
-
2255
+
2256
+ console.log(`📝 Paragraph: "${line}"`);
2232
2257
  report.sections[currentSection].push({
2233
2258
  type: 'p',
2234
2259
  content: cleanText(line),
2235
2260
  });
2236
2261
  }
2237
-
2262
+
2263
+ console.log(`🏁 Finished parsing ${language} section. Result:\n${JSON.stringify(report, null, 2)}`);
2238
2264
  reports.push(report);
2239
2265
  }
2240
-
2266
+
2267
+ console.log(`🎉 Parsing complete. Total reports: ${reports.length}`);
2241
2268
  return reports;
2242
2269
  }
2243
2270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.242",
3
+ "version": "0.0.244",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {