@zodic/shared 0.0.309 → 0.0.311

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.
@@ -963,77 +963,54 @@ export class ArchetypeService {
963
963
  return compositions;
964
964
  }
965
965
 
966
- private parseArchetypeNameBlocks(block: string): {
967
- english: { name: string; essenceLine: string }[];
968
- portuguese: { masc: string; fem: string; essenceLine: string }[];
966
+ parseArchetypeNameBlocks(block: string): {
967
+ english: any[];
968
+ portuguese: any[];
969
969
  } {
970
- const result = {
971
- english: [] as { name: string; essenceLine: string }[],
972
- portuguese: [] as { masc: string; fem: string; essenceLine: string }[],
973
- };
974
-
975
- try {
976
- // Normalize the block by replacing multiple spaces with a single space and ensuring newlines
977
- const normalizedBlock = block
978
- .replace(/\s+/g, ' ')
979
- .replace(/-EN\s*/, '-EN\n')
980
- .replace(/-PT\s*/, '\n-PT\n')
981
- .trim();
982
-
983
- // Split into EN and PT sections
984
- const sections = normalizedBlock.split(/\n?-PT\n/);
985
- const enSection = sections[0]?.replace(/-EN\n/, '').trim() ?? '';
986
- const ptSection = sections[1]?.trim() ?? '';
987
-
988
- // Parse English entries
989
- result.english = enSection
990
- .split(/\n?\d+\.\s*\n?/)
991
- .filter(Boolean)
992
- .map((entry, i) => {
993
- const nameMatch = entry.match(/• Name:\s*([^•]+)/);
994
- const essenceMatch = entry.match(/• Essence:\s*([^•]+)/);
995
- const name = nameMatch?.[1]?.trim() ?? '';
996
- const essenceLine = essenceMatch?.[1]?.trim() ?? '';
997
- if (!name || !essenceLine) {
998
- console.warn(
999
- `⚠️ [Parse] Incomplete English entry ${i + 1}:`,
1000
- entry
1001
- );
1002
- }
1003
- return { name, essenceLine };
1004
- });
1005
-
1006
- // Parse Portuguese entries
1007
- result.portuguese = ptSection
1008
- .split(/\n?\d+\.\s*\n?/)
1009
- .filter(Boolean)
1010
- .map((entry, i) => {
1011
- const mascMatch = entry.match(/• Masculino:\s*([^•]+)/);
1012
- const femMatch = entry.match(/• Feminino:\s*([^•]+)/);
1013
- const essenceMatch = entry.match(/• Essência:\s*([^•]+)/);
1014
- const masc = mascMatch?.[1]?.trim() ?? '';
1015
- const fem = femMatch?.[1]?.trim() ?? '';
1016
- const essenceLine = essenceMatch?.[1]?.trim() ?? '';
1017
- if (!masc || !fem || !essenceLine) {
1018
- console.warn(
1019
- `⚠️ [Parse] Incomplete Portuguese entry ${i + 1}:`,
1020
- entry
1021
- );
1022
- }
1023
- // Validate gender consistency
1024
- if (masc.startsWith('A ') && fem.startsWith('O ')) {
1025
- console.warn(
1026
- `⚠️ [Parse] Gender mismatch in Portuguese entry ${i + 1}:`,
1027
- entry
1028
- );
1029
- return { masc: fem, fem: masc, essenceLine }; // Swap to correct the mismatch
1030
- }
1031
- return { masc, fem, essenceLine };
1032
- });
1033
- } catch (error) {
1034
- console.error('❌ [Parse] Failed to parse block:', error);
970
+ const sections = block.split(/^-EN|^-PT/m).filter((s) => s.trim());
971
+ const english: any[] = [];
972
+ const portuguese: any[] = [];
973
+
974
+ for (const section of sections) {
975
+ if (section.startsWith('EN')) {
976
+ const lines = section.split('\n').filter((l) => l.trim());
977
+ const nameMatch = lines
978
+ .find((l) => l.includes(' Name:'))
979
+ ?.split('• Name:')[1]
980
+ ?.trim();
981
+ const essenceMatch = lines
982
+ .find((l) => l.includes('• Essence:'))
983
+ ?.split('• Essence:')[1]
984
+ ?.trim();
985
+
986
+ if (nameMatch && essenceMatch) {
987
+ english.push({ name: nameMatch, essenceLine: essenceMatch });
988
+ }
989
+ } else if (section.startsWith('PT')) {
990
+ const lines = section.split('\n').filter((l) => l.trim());
991
+ const mascMatch = lines
992
+ .find((l) => l.includes('• Masculino:'))
993
+ ?.split('• Masculino:')[1]
994
+ ?.trim();
995
+ const femMatch = lines
996
+ .find((l) => l.includes('• Feminino:'))
997
+ ?.split('• Feminino:')[1]
998
+ ?.trim();
999
+ const essenceMatch = lines
1000
+ .find((l) => l.includes('• Essência:'))
1001
+ ?.split('• Essência:')[1]
1002
+ ?.trim();
1003
+
1004
+ if (mascMatch && femMatch && essenceMatch) {
1005
+ portuguese.push({
1006
+ masc: mascMatch,
1007
+ fem: femMatch,
1008
+ essenceLine: essenceMatch,
1009
+ });
1010
+ }
1011
+ }
1035
1012
  }
1036
1013
 
1037
- return result;
1014
+ return { english, portuguese };
1038
1015
  }
1039
1016
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.309",
3
+ "version": "0.0.311",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
package/utils/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { jwtVerify } from 'jose';
2
2
  import { AuthCtx, JWKS, Provider, ProviderInfo } from '../types';
3
+ export { eq } from 'drizzle-orm';
3
4
 
4
5
  const base64UrlDecode = (input: string) => {
5
6
  const base64 = input.replace(/-/g, '+').replace(/_/g, '/');