refactor(events): harden V3 String-Only ID vision and fix Session Alert store error

- Standardized Event module logic files to strictly use random string IDs, ensuring frontend consistency and avoiding 'Integer Trap' 404s.
- Refactored 'ae_comp__event_session_alert.svelte' to accept a plain object instead of a store/observable, resolving the 'store_invalid_shape' error in list loops.
- Updated all callers of the alert component to pass unwrapped session objects.
- Cleaned up event-related UI components to remove redundant '_random' field lookups and align with V3 CRUD patterns.
- Updated project metadata (GEMINI.md, TODO.md) to reflect the new memory structure and latest hardened state.
This commit is contained in:
Scott Idem
2026-01-27 12:18:12 -05:00
parent a704779d1b
commit 30413e32d2
15 changed files with 589 additions and 473 deletions

View File

@@ -10,7 +10,7 @@ import { load_ae_obj_li__event_presenter } from '$lib/ae_events/ae_events__event
const ae_promises: key_val = {};
// Updated 2026-01-20 to V3
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_id__event_presentation({
api_cfg,
event_presentation_id,
@@ -37,11 +37,11 @@ export async function load_ae_obj_id__event_presentation({
log_lvl?: number;
}): Promise<ae_EventPresentation | null> {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event_presentation() *** [V3] id=${event_presentation_id}`);
console.log(`*** load_ae_obj_id__event_presentation() *** id=${event_presentation_id}`);
}
try {
ae_promises.load__event_presentation_obj = await api.get_ae_obj_v3({
const result = await api.get_ae_obj_v3({
api_cfg,
obj_type: 'event_presentation',
obj_id: event_presentation_id,
@@ -49,16 +49,18 @@ export async function load_ae_obj_id__event_presentation({
log_lvl
});
if (ae_promises.load__event_presentation_obj) {
if (result) {
const processed = await process_ae_obj__event_presentation_props({
obj_li: [result],
log_lvl
});
ae_promises.load__event_presentation_obj = processed[0];
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: [ae_promises.load__event_presentation_obj],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed_obj_li,
obj_li: [ae_promises.load__event_presentation_obj],
properties_to_save,
log_lvl
});
@@ -84,7 +86,8 @@ export async function load_ae_obj_id__event_presentation({
* Helper to handle nested collection loads for a presentation
*/
async function _handle_nested_loads(presentation_obj: any, { api_cfg, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }: any) {
const current_presentation_id = presentation_obj.event_presentation_id_random || presentation_obj.event_presentation_id || presentation_obj.id;
// String-Only ID Vision: the '_id' field IS the string ID
const current_presentation_id = presentation_obj.id || presentation_obj.event_presentation_id;
if (inc_file_li) {
presentation_obj.event_file_li = await load_ae_obj_li__event_file({
@@ -116,7 +119,7 @@ async function _handle_nested_loads(presentation_obj: any, { api_cfg, inc_file_l
return presentation_obj;
}
// Updated 2026-01-20 to V3
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_li__event_presentation({
api_cfg,
for_obj_type = 'event_session',
@@ -151,11 +154,11 @@ export async function load_ae_obj_li__event_presentation({
log_lvl?: number;
}): Promise<ae_EventPresentation[]> {
if (log_lvl) {
console.log(`*** load_ae_obj_li__event_presentation() *** [V3] for=${for_obj_type}:${for_obj_id}`);
console.log(`*** load_ae_obj_li__event_presentation() *** for=${for_obj_type}:${for_obj_id}`);
}
try {
ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_v3({
const result_li = await api.get_ae_obj_li_v3({
api_cfg,
obj_type: 'event_presentation',
for_obj_type,
@@ -168,16 +171,18 @@ export async function load_ae_obj_li__event_presentation({
log_lvl
});
if (ae_promises.load__event_presentation_obj_li) {
if (result_li) {
const processed = await process_ae_obj__event_presentation_props({
obj_li: result_li,
log_lvl
});
ae_promises.load__event_presentation_obj_li = processed;
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: ae_promises.load__event_presentation_obj_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed_obj_li,
obj_li: ae_promises.load__event_presentation_obj_li,
properties_to_save,
log_lvl
});
@@ -224,35 +229,40 @@ export async function create_ae_obj__event_presentation({
log_lvl?: number;
}): Promise<ae_EventPresentation | null> {
if (log_lvl) {
console.log(`*** create_ae_obj__event_presentation() *** [V3] session=${event_session_id}`);
console.log(`*** create_ae_obj__event_presentation() *** session=${event_session_id}`);
}
const result = await api.create_ae_obj_v3({
api_cfg,
obj_type: 'event_presentation',
fields: {
event_id_random: event_id,
event_session_id_random: event_session_id,
event_id,
event_session_id,
...data_kv
},
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_presentation_props({
if (result) {
const processed = await process_ae_obj__event_presentation_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -270,7 +280,7 @@ export async function delete_ae_obj_id__event_presentation({
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_presentation() *** [V3] id=${event_presentation_id}`);
console.log(`*** delete_ae_obj_id__event_presentation() *** id=${event_presentation_id}`);
}
const result = await api.delete_ae_obj_v3({
@@ -303,7 +313,7 @@ export async function update_ae_obj__event_presentation({
log_lvl?: number;
}): Promise<ae_EventPresentation | null> {
if (log_lvl) {
console.log(`*** update_ae_obj__event_presentation() *** [V3] id=${event_presentation_id}`);
console.log(`*** update_ae_obj__event_presentation() *** id=${event_presentation_id}`);
}
const result = await api.update_ae_obj_v3({
@@ -314,21 +324,26 @@ export async function update_ae_obj__event_presentation({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_presentation_props({
if (result) {
const processed = await process_ae_obj__event_presentation_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-21 to Restore Full Aether Search Logic
@@ -362,12 +377,12 @@ export async function search__event_presentation({
log_lvl?: number;
}): Promise<ae_EventPresentation[]> {
if (log_lvl) {
console.log(`*** search__event_presentation() *** [V3] event_id=${event_id} ft=${fulltext_search_qry_str}`);
console.log(`*** search__event_presentation() *** event_id=${event_id} ft=${fulltext_search_qry_str}`);
}
const search_query: any = {
q: '',
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
const params: key_val = {};
@@ -399,21 +414,25 @@ export async function search__event_presentation({
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_presentation_props({
if (result_li) {
const processed = await process_ae_obj__event_presentation_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed,
properties_to_save,
log_lvl
});
}
return processed;
}
return result_li || [];
return [];
}
export const properties_to_save = [
@@ -477,6 +496,7 @@ async function _process_generic_props<T extends Record<string, any>>({
(processed_obj as any)[newKey] = processed_obj[key];
}
}
// String-Only ID Vision: Map [obj_type]_id_random to 'id'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
(processed_obj as any).id = processed_obj[randomIdKey];