@zodic/shared 0.0.249 → 0.0.251
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/app/services/ConceptService.ts +197 -161
- package/db/migrations/0003_thin_valeria_richards.sql +28 -0
- package/db/migrations/meta/0003_snapshot.json +2417 -0
- package/db/migrations/meta/_journal.json +7 -0
- package/db/schema.ts +41 -16
- package/package.json +1 -1
- package/types/scopes/generic.ts +25 -0
- package/utils/astroPrompts/index.ts +26 -0
package/db/schema.ts
CHANGED
|
@@ -189,8 +189,10 @@ export const astroReports = sqliteTable(
|
|
|
189
189
|
name: text('name').notNull(), // Slug (e.g., 'sun', 'pars_fortuna')
|
|
190
190
|
sign: text('sign'), // Slug (e.g., 'aries', 'taurus') - nullable for house-only reports
|
|
191
191
|
house: integer('house'), // Nullable, only for applicable placements
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
descriptionTemplateId: text('description_template_id').references(
|
|
193
|
+
() => astroDescriptionTemplates.id,
|
|
194
|
+
{ onDelete: 'set null' }
|
|
195
|
+
), // NEW: Foreign key to astro_description_templates.id
|
|
194
196
|
enReport: text('en_report'), // Full report content in English
|
|
195
197
|
ptReport: text('pt_report'), // Full report content in Portuguese
|
|
196
198
|
createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
|
|
@@ -209,8 +211,10 @@ export const houseReports = sqliteTable(
|
|
|
209
211
|
id: text('id').primaryKey(), // Unique identifier
|
|
210
212
|
sign: text('sign').notNull(), // Lowercase slug (e.g., 'aries', 'taurus')
|
|
211
213
|
house: integer('house').notNull(), // House placement (1-12)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
+
descriptionTemplateId: text('description_template_id').references(
|
|
215
|
+
() => astroDescriptionTemplates.id,
|
|
216
|
+
{ onDelete: 'set null' }
|
|
217
|
+
), // NEW: Foreign key to astro_description_templates.id
|
|
214
218
|
enReport: text('en_report'), // Full report content in English
|
|
215
219
|
ptReport: text('pt_report'), // Full report content in Portuguese
|
|
216
220
|
createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
|
|
@@ -218,6 +222,7 @@ export const houseReports = sqliteTable(
|
|
|
218
222
|
},
|
|
219
223
|
(t) => [
|
|
220
224
|
index('house_reports_sign_house_idx').on(t.sign, t.house), // Optimized index for sign + house lookups
|
|
225
|
+
index('house_reports_description_template_idx').on(t.descriptionTemplateId), // NEW: Index for foreign key performance
|
|
221
226
|
]
|
|
222
227
|
);
|
|
223
228
|
|
|
@@ -228,8 +233,10 @@ export const aspectReports = sqliteTable(
|
|
|
228
233
|
aspectingPlanet: text('aspecting_planet').notNull(), // Planet/point initiating the aspect (e.g., 'sun', 'mars')
|
|
229
234
|
aspectedPlanet: text('aspected_planet').notNull(), // Planet/point receiving the aspect (e.g., 'moon', 'venus')
|
|
230
235
|
aspect: text('aspect').notNull(), // Aspect type ('conjunction', 'trine', 'square', etc.)
|
|
231
|
-
|
|
232
|
-
|
|
236
|
+
descriptionTemplateId: text('description_template_id').references(
|
|
237
|
+
() => astroDescriptionTemplates.id,
|
|
238
|
+
{ onDelete: 'set null' }
|
|
239
|
+
), // NEW: Foreign key to astro_description_templates.id
|
|
233
240
|
enReport: text('en_report'), // Full report content in English
|
|
234
241
|
ptReport: text('pt_report'), // Full report content in Portuguese
|
|
235
242
|
createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
|
|
@@ -239,11 +246,8 @@ export const aspectReports = sqliteTable(
|
|
|
239
246
|
index('aspect_reports_aspecting_idx').on(t.aspectingPlanet),
|
|
240
247
|
index('aspect_reports_aspected_idx').on(t.aspectedPlanet),
|
|
241
248
|
index('aspect_reports_aspect_idx').on(t.aspect),
|
|
242
|
-
index('aspect_reports_combined_idx').on(
|
|
243
|
-
|
|
244
|
-
t.aspectedPlanet,
|
|
245
|
-
t.aspect
|
|
246
|
-
), // Optimized for aspect lookups
|
|
249
|
+
index('aspect_reports_combined_idx').on(t.aspectingPlanet, t.aspectedPlanet, t.aspect),
|
|
250
|
+
index('aspect_reports_description_template_idx').on(t.descriptionTemplateId), // NEW: Index for foreign key performance
|
|
247
251
|
]
|
|
248
252
|
);
|
|
249
253
|
|
|
@@ -251,17 +255,38 @@ export const astroFeatureReports = sqliteTable(
|
|
|
251
255
|
'astro_feature_reports',
|
|
252
256
|
{
|
|
253
257
|
id: text('id').primaryKey(), // Unique identifier
|
|
254
|
-
featureType: text('feature_type').notNull(), // e.g., "moon_phase", "element", "mode", "hemisphere_east_west", "hemisphere_north_south"
|
|
255
|
-
name: text('name').notNull(), // e.g., "last-quarter-moon", "fire", "cardinal", "east
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
featureType: text('feature_type').notNull(), // e.g., "moon_phase", "element", "mode", "hemisphere_east_west", "hemisphere_north_south"
|
|
259
|
+
name: text('name').notNull(), // e.g., "last-quarter-moon", "fire", "cardinal", "east", "north"
|
|
260
|
+
descriptionTemplateId: text('description_template_id').references(
|
|
261
|
+
() => astroDescriptionTemplates.id,
|
|
262
|
+
{ onDelete: 'set null' }
|
|
263
|
+
), // NEW: Foreign key to astro_description_templates.id
|
|
258
264
|
enReport: text('en_report'), // Full report content in English (JSON string)
|
|
259
265
|
ptReport: text('pt_report'), // Full report content in Portuguese (JSON string)
|
|
260
266
|
createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
|
|
261
267
|
updatedAt: integer('updated_at').default(sql`CURRENT_TIMESTAMP`),
|
|
262
268
|
},
|
|
263
269
|
(t) => [
|
|
264
|
-
index('astro_feature_reports_type_name_idx').on(t.featureType, t.name),
|
|
270
|
+
index('astro_feature_reports_type_name_idx').on(t.featureType, t.name),
|
|
271
|
+
index('astro_feature_reports_description_template_idx').on(t.descriptionTemplateId), // NEW: Index for foreign key performance
|
|
272
|
+
]
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
export const astroDescriptionTemplates = sqliteTable(
|
|
276
|
+
'astro_description_templates',
|
|
277
|
+
{
|
|
278
|
+
id: text('id').primaryKey(), // Unique identifier
|
|
279
|
+
entityType: text('entity_type').notNull(), // e.g., "planet", "key_point", "karmic_point", "arabic_part", "house", "aspect", "moon_phase", "element", "mode", "hemisphere_east_west", "hemisphere_north_south"
|
|
280
|
+
name: text('name').notNull(), // Slug (e.g., "last-quarter-moon", "fire", "cardinal", "east", "house_1")
|
|
281
|
+
enName: text('en_name'), // Optional human-readable name in English (e.g., "Last Quarter Moon", "Fire")
|
|
282
|
+
ptName: text('pt_name'), // Optional human-readable name in Portuguese (e.g., "Lua Minguante", "Fogo")
|
|
283
|
+
enDescription: text('en_description').notNull(), // Shared 150–180 word intro in English
|
|
284
|
+
ptDescription: text('pt_description').notNull(), // Shared 150–180 word intro in Portuguese
|
|
285
|
+
createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
|
|
286
|
+
updatedAt: integer('updated_at').default(sql`CURRENT_TIMESTAMP`),
|
|
287
|
+
},
|
|
288
|
+
(t) => [
|
|
289
|
+
index('astro_description_templates_type_name_idx').on(t.entityType, t.name), // Optimized for lookups by type and slug
|
|
265
290
|
]
|
|
266
291
|
);
|
|
267
292
|
|
package/package.json
CHANGED
package/types/scopes/generic.ts
CHANGED
|
@@ -45,6 +45,31 @@ export interface AstrologicalReport {
|
|
|
45
45
|
sections: Record<string, ContentItem[]>;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export interface AstroReportRow {
|
|
49
|
+
id: string;
|
|
50
|
+
type?: string; // For astroReports
|
|
51
|
+
name?: string;
|
|
52
|
+
sign?: string;
|
|
53
|
+
house?: number;
|
|
54
|
+
featureType?: string; // For astroFeatureReports
|
|
55
|
+
enReport: string | null;
|
|
56
|
+
ptReport: string | null;
|
|
57
|
+
enDescription?: string | null;
|
|
58
|
+
ptDescription?: string | null;
|
|
59
|
+
createdAt: number | null;
|
|
60
|
+
updatedAt: number | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface DescriptionTemplateRow {
|
|
64
|
+
id: string;
|
|
65
|
+
entityType: string;
|
|
66
|
+
name: string;
|
|
67
|
+
enDescription: string | null;
|
|
68
|
+
ptDescription: string | null;
|
|
69
|
+
createdAt: number | null;
|
|
70
|
+
updatedAt: number | null;
|
|
71
|
+
}
|
|
72
|
+
|
|
48
73
|
export type AstroReportParams =
|
|
49
74
|
| {
|
|
50
75
|
reportType: 'sign';
|
|
@@ -49,6 +49,12 @@ interface AspectParams {
|
|
|
49
49
|
aspectingType: AspectType;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
interface DescriptionParams {
|
|
53
|
+
entityType: string;
|
|
54
|
+
name: string;
|
|
55
|
+
isGeneric?: boolean; // Flag for generic descriptions (aspects, moon phases, elements, modes, hemispheres)
|
|
56
|
+
}
|
|
57
|
+
|
|
52
58
|
export const astroPrompts = {
|
|
53
59
|
planetOrPoint: ({ type, sign, pointName }: PlanetOrPointParams): string => {
|
|
54
60
|
const validTypes = ['planet', 'key_point', 'karmic_point', 'arabic_part'];
|
|
@@ -224,4 +230,24 @@ export const astroPrompts = {
|
|
|
224
230
|
throw new Error(`Unknown feature type in params: ${params}`);
|
|
225
231
|
}
|
|
226
232
|
},
|
|
233
|
+
|
|
234
|
+
makeIntroDescription: ({ entityType, name, isGeneric }: DescriptionParams): string => {
|
|
235
|
+
const baseFormat = `
|
|
236
|
+
Make me an introductory, explanatory description of 150 to 180 words about the astrological ${entityType}.
|
|
237
|
+
The result must have an English version and a Portuguese version.
|
|
238
|
+
The result format must be exactly like the following:
|
|
239
|
+
-- EN
|
|
240
|
+
[Single block of plain text with English version]
|
|
241
|
+
-- PT
|
|
242
|
+
[Single block of plain text with Portuguese version]
|
|
243
|
+
`.trim();
|
|
244
|
+
|
|
245
|
+
if (isGeneric) {
|
|
246
|
+
return `
|
|
247
|
+
${baseFormat.replace("astrological", "astrological concept representing").replace("about the astrological", "about what the")}
|
|
248
|
+
`.trim();
|
|
249
|
+
} else {
|
|
250
|
+
return `${baseFormat} ${name ? `named ${name}.` : ""}`.trim();
|
|
251
|
+
}
|
|
252
|
+
},
|
|
227
253
|
};
|