@zodic/shared 0.0.237 → 0.0.239
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.
- package/db/schema.ts +62 -0
- package/package.json +1 -1
- package/types/scopes/legacy.ts +100 -12
- package/utils/astroPrompts/index.ts +91 -0
- package/utils/astroPrompts/pointNameMap.ts +29 -0
- package/utils/index.ts +10 -1
package/db/schema.ts
CHANGED
|
@@ -181,6 +181,68 @@ export const astroAspects = sqliteTable(
|
|
|
181
181
|
]
|
|
182
182
|
);
|
|
183
183
|
|
|
184
|
+
export const astroReports = sqliteTable(
|
|
185
|
+
"astro_reports",
|
|
186
|
+
{
|
|
187
|
+
id: text("id").primaryKey(), // Unique identifier
|
|
188
|
+
type: text("type").notNull(), // 'planet', 'key_point', 'karmic_point', 'hermetic_part'
|
|
189
|
+
name: text("name").notNull(), // Slug (e.g., 'sun', 'pars_fortuna')
|
|
190
|
+
sign: text("sign"), // Slug (e.g., 'aries', 'taurus') - nullable for house-only reports
|
|
191
|
+
house: integer("house"), // Nullable, only for applicable placements
|
|
192
|
+
enDescription: text("en_description"), // General explanation of the placement
|
|
193
|
+
ptDescription: text("pt_description"),
|
|
194
|
+
enReport: text("en_report"), // Full report content in English
|
|
195
|
+
ptReport: text("pt_report"), // Full report content in Portuguese
|
|
196
|
+
createdAt: integer("created_at").default(sql`CURRENT_TIMESTAMP`),
|
|
197
|
+
updatedAt: integer("updated_at").default(sql`CURRENT_TIMESTAMP`),
|
|
198
|
+
},
|
|
199
|
+
(t) => [
|
|
200
|
+
index("astro_reports_type_idx").on(t.type),
|
|
201
|
+
index("astro_reports_name_sign_idx").on(t.name, t.sign), // Most critical index (name + sign)
|
|
202
|
+
index("astro_reports_name_house_idx").on(t.name, t.house), // Most critical index (name + house)
|
|
203
|
+
]
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
export const houseReports = sqliteTable(
|
|
207
|
+
"house_reports",
|
|
208
|
+
{
|
|
209
|
+
id: text("id").primaryKey(), // Unique identifier
|
|
210
|
+
sign: text("sign").notNull(), // Lowercase slug (e.g., 'aries', 'taurus')
|
|
211
|
+
house: integer("house").notNull(), // House placement (1-12)
|
|
212
|
+
enDescription: text("en_description"), // General explanation of the sign in a house
|
|
213
|
+
ptDescription: text("pt_description"),
|
|
214
|
+
enReport: text("en_report"), // Full report content in English
|
|
215
|
+
ptReport: text("pt_report"), // Full report content in Portuguese
|
|
216
|
+
createdAt: integer("created_at").default(sql`CURRENT_TIMESTAMP`),
|
|
217
|
+
updatedAt: integer("updated_at").default(sql`CURRENT_TIMESTAMP`),
|
|
218
|
+
},
|
|
219
|
+
(t) => [
|
|
220
|
+
index("house_reports_sign_house_idx").on(t.sign, t.house), // Optimized index for sign + house lookups
|
|
221
|
+
]
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
export const aspectReports = sqliteTable(
|
|
225
|
+
"aspect_reports",
|
|
226
|
+
{
|
|
227
|
+
id: text("id").primaryKey(), // Unique identifier
|
|
228
|
+
aspectingPlanet: text("aspecting_planet").notNull(), // Planet/point initiating the aspect (e.g., 'sun', 'mars')
|
|
229
|
+
aspectedPlanet: text("aspected_planet").notNull(), // Planet/point receiving the aspect (e.g., 'moon', 'venus')
|
|
230
|
+
aspect: text("aspect").notNull(), // Aspect type ('conjunction', 'trine', 'square', etc.)
|
|
231
|
+
enDescription: text("en_description"), // General explanation of the aspect
|
|
232
|
+
ptDescription: text("pt_description"),
|
|
233
|
+
enReport: text("en_report"), // Full report content in English
|
|
234
|
+
ptReport: text("pt_report"), // Full report content in Portuguese
|
|
235
|
+
createdAt: integer("created_at").default(sql`CURRENT_TIMESTAMP`),
|
|
236
|
+
updatedAt: integer("updated_at").default(sql`CURRENT_TIMESTAMP`),
|
|
237
|
+
},
|
|
238
|
+
(t) => [
|
|
239
|
+
index("aspect_reports_aspecting_idx").on(t.aspectingPlanet),
|
|
240
|
+
index("aspect_reports_aspected_idx").on(t.aspectedPlanet),
|
|
241
|
+
index("aspect_reports_aspect_idx").on(t.aspect),
|
|
242
|
+
index("aspect_reports_combined_idx").on(t.aspectingPlanet, t.aspectedPlanet, t.aspect), // Optimized for aspect lookups
|
|
243
|
+
]
|
|
244
|
+
);
|
|
245
|
+
|
|
184
246
|
export const concepts = sqliteTable(
|
|
185
247
|
'concepts',
|
|
186
248
|
{
|
package/package.json
CHANGED
package/types/scopes/legacy.ts
CHANGED
|
@@ -1,21 +1,109 @@
|
|
|
1
|
+
import { pointNameMap } from '../../utils/astroPrompts/pointNameMap';
|
|
1
2
|
import { BackendBindings } from './cloudflare';
|
|
2
3
|
import { ControlNetConfig, Gender } from './generic';
|
|
3
4
|
|
|
4
5
|
export const zodiacSigns = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
"aries",
|
|
7
|
+
"taurus",
|
|
8
|
+
"gemini",
|
|
9
|
+
"cancer",
|
|
10
|
+
"leo",
|
|
11
|
+
"virgo",
|
|
12
|
+
"libra",
|
|
13
|
+
"scorpio",
|
|
14
|
+
"sagittarius",
|
|
15
|
+
"capricorn",
|
|
16
|
+
"aquarius",
|
|
17
|
+
"pisces",
|
|
18
|
+
] as const;
|
|
19
|
+
export type ZodiacSignSlug = (typeof zodiacSigns)[number];
|
|
20
|
+
|
|
21
|
+
// Houses
|
|
22
|
+
export const houses = Array.from({ length: 12 }, (_, i) => i + 1);
|
|
23
|
+
|
|
24
|
+
// Aspects
|
|
25
|
+
export const aspects = ["conjunction", "opposition", "trine", "square", "sextile"] as const;
|
|
26
|
+
export type AspectType = (typeof aspects)[number];
|
|
27
|
+
|
|
28
|
+
export const pointTypes: Record<PointSlug, string> = {
|
|
29
|
+
sun: "planet",
|
|
30
|
+
moon: "planet",
|
|
31
|
+
mercury: "planet",
|
|
32
|
+
venus: "planet",
|
|
33
|
+
mars: "planet",
|
|
34
|
+
jupiter: "planet",
|
|
35
|
+
saturn: "planet",
|
|
36
|
+
uranus: "planet",
|
|
37
|
+
neptune: "planet",
|
|
38
|
+
pluto: "planet",
|
|
39
|
+
ascendant: "key_point",
|
|
40
|
+
descendant: "key_point",
|
|
41
|
+
midheaven: "key_point",
|
|
42
|
+
imum_coeli: "key_point",
|
|
43
|
+
north_node: "karmic_point",
|
|
44
|
+
south_node: "karmic_point",
|
|
45
|
+
chiron: "karmic_point",
|
|
46
|
+
lilith: "hermetic_part",
|
|
47
|
+
vertex: "hermetic_part",
|
|
48
|
+
antivertex: "hermetic_part",
|
|
49
|
+
pars_fortuna: "hermetic_part",
|
|
50
|
+
pars_spiritus: "hermetic_part",
|
|
51
|
+
pars_victoria: "hermetic_part",
|
|
52
|
+
pars_amoris: "hermetic_part",
|
|
53
|
+
pars_eros: "hermetic_part",
|
|
54
|
+
pars_fortitudo: "hermetic_part",
|
|
55
|
+
pars_necessitatis: "hermetic_part",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Subset of 14 points for aspects
|
|
59
|
+
export const aspectPoints: PointSlug[] = [
|
|
60
|
+
"sun",
|
|
61
|
+
"moon",
|
|
62
|
+
"mercury",
|
|
63
|
+
"venus",
|
|
64
|
+
"mars",
|
|
65
|
+
"jupiter",
|
|
66
|
+
"saturn",
|
|
67
|
+
"uranus",
|
|
68
|
+
"neptune",
|
|
69
|
+
"pluto",
|
|
70
|
+
"ascendant",
|
|
71
|
+
"descendant",
|
|
72
|
+
"midheaven",
|
|
73
|
+
"imum_coeli",
|
|
17
74
|
];
|
|
18
75
|
|
|
76
|
+
export type PointSlug = keyof typeof pointNameMap;
|
|
77
|
+
|
|
78
|
+
export type ZodiacSign =
|
|
79
|
+
| 'aries'
|
|
80
|
+
| 'taurus'
|
|
81
|
+
| 'gemini'
|
|
82
|
+
| 'cancer'
|
|
83
|
+
| 'leo'
|
|
84
|
+
| 'virgo'
|
|
85
|
+
| 'libra'
|
|
86
|
+
| 'scorpio'
|
|
87
|
+
| 'sagittarius'
|
|
88
|
+
| 'capricorn'
|
|
89
|
+
| 'aquarius'
|
|
90
|
+
| 'pisces';
|
|
91
|
+
|
|
92
|
+
export const zodiacSignMap: Record<ZodiacSign, string> = {
|
|
93
|
+
aries: 'Aries',
|
|
94
|
+
taurus: 'Taurus',
|
|
95
|
+
gemini: 'Gemini',
|
|
96
|
+
cancer: 'Cancer',
|
|
97
|
+
leo: 'Leo',
|
|
98
|
+
virgo: 'Virgo',
|
|
99
|
+
libra: 'Libra',
|
|
100
|
+
scorpio: 'Scorpio',
|
|
101
|
+
sagittarius: 'Sagittarius',
|
|
102
|
+
capricorn: 'Capricorn',
|
|
103
|
+
aquarius: 'Aquarius',
|
|
104
|
+
pisces: 'Pisces',
|
|
105
|
+
};
|
|
106
|
+
|
|
19
107
|
export interface ChatGPTOptions {
|
|
20
108
|
model?: string;
|
|
21
109
|
options?: Record<string, any>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { PointSlug, ZodiacSign, zodiacSignMap } from '../../types/scopes/legacy';
|
|
2
|
+
import { pointNameMap } from './pointNameMap';
|
|
3
|
+
|
|
4
|
+
// Interfaces for each function's parameters
|
|
5
|
+
interface PlanetOrPointParams {
|
|
6
|
+
type: 'planet' | 'key_point' | 'karmic_point' | 'hermetic_part';
|
|
7
|
+
sign: ZodiacSign;
|
|
8
|
+
pointName: PointSlug;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface HouseParams {
|
|
12
|
+
houseNumber: number; // e.g., "1", "2", etc.
|
|
13
|
+
sign: ZodiacSign;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface AspectParams {
|
|
17
|
+
aspectingPlanet: PointSlug;
|
|
18
|
+
aspectedPlanet: PointSlug;
|
|
19
|
+
aspectingType: string; // e.g., "conjunct", "square", "trine"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Modular astroPrompts object
|
|
23
|
+
export const astroPrompts = {
|
|
24
|
+
planetOrPoint: ({ type, sign, pointName }: PlanetOrPointParams): string => {
|
|
25
|
+
const validTypes = ['planet', 'key_point', 'karmic_point', 'hermetic_part'];
|
|
26
|
+
if (!validTypes.includes(type)) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Invalid type for planetOrPoint: ${type}. Must be one of ${validTypes.join(
|
|
29
|
+
', '
|
|
30
|
+
)}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const formattedPointName = pointNameMap[pointName] || pointName;
|
|
35
|
+
return `
|
|
36
|
+
Make me a report for the astrological placement: ${formattedPointName} in ${zodiacSignMap[sign]}.
|
|
37
|
+
The response should include an English version and a Portuguese version.
|
|
38
|
+
Use "###" for titles and "####" for subtitles.
|
|
39
|
+
The response format should be exactly like this:
|
|
40
|
+
|
|
41
|
+
-- EN
|
|
42
|
+
|
|
43
|
+
[English Report - structured with headings, sections, and detailed explanations]
|
|
44
|
+
|
|
45
|
+
-- PT
|
|
46
|
+
|
|
47
|
+
[Portuguese Report - structured exactly the same as the English version]
|
|
48
|
+
`.trim();
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
house: ({ houseNumber, sign }: HouseParams): string => {
|
|
52
|
+
return `
|
|
53
|
+
Make me a report for the astrological placement: House ${houseNumber} in ${zodiacSignMap[sign]}.
|
|
54
|
+
The response should include an English version and a Portuguese version.
|
|
55
|
+
Use "###" for titles and "####" for subtitles.
|
|
56
|
+
The response format should be exactly like this:
|
|
57
|
+
|
|
58
|
+
-- EN
|
|
59
|
+
|
|
60
|
+
[English Report - structured with headings, sections, and detailed explanations]
|
|
61
|
+
|
|
62
|
+
-- PT
|
|
63
|
+
|
|
64
|
+
[Portuguese Report - structured exactly the same as the English version]
|
|
65
|
+
`.trim();
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
aspect: ({
|
|
69
|
+
aspectingPlanet,
|
|
70
|
+
aspectedPlanet,
|
|
71
|
+
aspectingType,
|
|
72
|
+
}: AspectParams): string => {
|
|
73
|
+
return `
|
|
74
|
+
Make me a report for the astrological aspect: ${
|
|
75
|
+
pointNameMap[aspectingPlanet] || aspectingPlanet
|
|
76
|
+
} ${aspectingType} ${pointNameMap[aspectedPlanet] || aspectedPlanet}.
|
|
77
|
+
The response should include an English version and a Portuguese version.
|
|
78
|
+
Use "###" for titles and "####" for subtitles.
|
|
79
|
+
The response format should be exactly like this:
|
|
80
|
+
|
|
81
|
+
-- EN
|
|
82
|
+
|
|
83
|
+
[English Report - structured with headings, sections, and detailed explanations]
|
|
84
|
+
|
|
85
|
+
-- PT
|
|
86
|
+
|
|
87
|
+
[Portuguese Report - structured exactly the same as the English version]
|
|
88
|
+
`.trim();
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const pointNameMap: Record<string, string> = {
|
|
2
|
+
sun: "Sun",
|
|
3
|
+
moon: "Moon",
|
|
4
|
+
mercury: "Mercury",
|
|
5
|
+
venus: "Venus",
|
|
6
|
+
mars: "Mars",
|
|
7
|
+
jupiter: "Jupiter",
|
|
8
|
+
saturn: "Saturn",
|
|
9
|
+
uranus: "Uranus",
|
|
10
|
+
neptune: "Neptune",
|
|
11
|
+
pluto: "Pluto",
|
|
12
|
+
ascendant: "Ascendant",
|
|
13
|
+
descendant: "Descendant",
|
|
14
|
+
midheaven: "Midheaven",
|
|
15
|
+
imum_coeli: "Imum Coeli",
|
|
16
|
+
north_node: "North Node",
|
|
17
|
+
south_node: "South Node",
|
|
18
|
+
chiron: "Chiron",
|
|
19
|
+
lilith: "Lilith",
|
|
20
|
+
vertex: "Vertex",
|
|
21
|
+
antivertex: "Antivertex",
|
|
22
|
+
pars_fortuna: "Pars Fortuna",
|
|
23
|
+
pars_spiritus: "Pars Spiritus",
|
|
24
|
+
pars_victoria: "Pars Victoria",
|
|
25
|
+
pars_amoris: "Pars Amoris",
|
|
26
|
+
pars_eros: "Pars Eros",
|
|
27
|
+
pars_fortitudo: "Pars Fortitudo",
|
|
28
|
+
pars_necessitatis: "Pars Necessitatis",
|
|
29
|
+
};
|
package/utils/index.ts
CHANGED
|
@@ -101,7 +101,9 @@ export const verifyToken = async (
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
export const providers: (c: AuthCtx) => Record<Provider, ProviderInfo> = (
|
|
104
|
+
export const providers: (c: AuthCtx) => Record<Provider, ProviderInfo> = (
|
|
105
|
+
c
|
|
106
|
+
) => ({
|
|
105
107
|
google: {
|
|
106
108
|
serverUrl: 'https://accounts.google.com/.well-known/openid-configuration', // ✅ Correct Discovery URL
|
|
107
109
|
clientId: c.env.GOOGLE_OAUTH_CLIENT_ID!,
|
|
@@ -120,3 +122,10 @@ export function normalizeName(name: string): string {
|
|
|
120
122
|
return name.toLowerCase().replace(/\s+/g, '-');
|
|
121
123
|
}
|
|
122
124
|
|
|
125
|
+
export function chunkArray<T>(array: T[], size: number): T[][] {
|
|
126
|
+
const result = [];
|
|
127
|
+
for (let i = 0; i < array.length; i += size) {
|
|
128
|
+
result.push(array.slice(i, i + size));
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|