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

@@ -14,7 +14,7 @@ import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file
const ae_promises: key_val = {};
// Updated 2026-01-26 (Stale-While-Revalidate Optimization)
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_id__event({
api_cfg,
event_id,
@@ -42,12 +42,10 @@ export async function load_ae_obj_id__event({
console.log(`*** load_ae_obj_id__event() *** event_id=${event_id} (SWR Optimization)`);
}
let cached_event: any = null;
// 1. FAST PATH: Return cached data immediately
if (try_cache) {
try {
cached_event = await db_events.event.get(event_id);
const cached_event = await db_events.event.get(event_id);
if (cached_event) {
if (log_lvl) console.log('EVENT LOAD: Cache hit. Returning stale data immediately.');
@@ -91,7 +89,7 @@ async function _refresh_event_v3_background({
}
try {
const event_obj_get_result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj_v3({
api_cfg: api_cfg,
obj_type: 'event',
obj_id: event_id,
@@ -99,22 +97,24 @@ async function _refresh_event_v3_background({
log_lvl: log_lvl
});
if (event_obj_get_result) {
if (result) {
let processed_obj = result;
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_props({
obj_li: [event_obj_get_result],
const processed = await process_ae_obj__event_props({
obj_li: [result],
log_lvl: log_lvl
});
processed_obj = processed[0];
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'event',
obj_li: processed_obj_li,
obj_li: processed,
properties_to_save: properties_to_save,
log_lvl: log_lvl
});
}
return await _handle_nested_loads(event_obj_get_result, {
return await _handle_nested_loads(processed_obj, {
api_cfg, inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_template_li, log_lvl
});
}
@@ -128,7 +128,8 @@ async function _refresh_event_v3_background({
* Shared logic for loading nested child collections
*/
async function _handle_nested_loads(event_obj: any, { api_cfg, inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_template_li, log_lvl }: any) {
const current_event_id = event_obj.event_id_random || event_obj.event_id || event_obj.id;
// String-Only ID Vision: the '_id' field IS the string ID
const current_event_id = event_obj.id || event_obj.event_id;
// Use Promise.all for concurrent nested loads to further reduce delay
const tasks = [];
@@ -180,7 +181,7 @@ async function _handle_nested_loads(event_obj: any, { api_cfg, inc_device_li, in
return event_obj;
}
// Updated 2026-01-06
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_li__event({
api_cfg,
for_obj_type = 'account',
@@ -224,20 +225,17 @@ export async function load_ae_obj_li__event({
let promise;
if (qry_conference !== null) {
// V3 Search now permits 'conference' field.
const search_query: any = {
and: [{ field: 'conference', op: 'eq', value: qry_conference }]
};
// Fix for "Integer Trap": Inject account context directly into search body and remove from URL params
if (for_obj_id) {
search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id });
search_query.and.push({ field: `${for_obj_type}_id`, op: 'eq', value: for_obj_id });
}
promise = api.search_ae_obj_v3({
api_cfg,
obj_type: 'event',
// Headers for Auth context
headers: { 'x-account-id': for_obj_id },
search_query,
enabled,
@@ -265,29 +263,25 @@ export async function load_ae_obj_li__event({
}
try {
const event_obj_li_get_result = await promise;
if (event_obj_li_get_result) {
let filtered_results = event_obj_li_get_result;
// Optional: Keep local filter as a fallback safety
if (qry_conference !== null) {
filtered_results = event_obj_li_get_result.filter((ev: any) => ev.conference === qry_conference);
}
const result_li = await promise;
if (result_li) {
let processed_results = result_li;
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_props({
obj_li: filtered_results,
const processed = await process_ae_obj__event_props({
obj_li: result_li,
log_lvl: log_lvl
});
processed_results = processed;
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'event',
obj_li: processed_obj_li,
obj_li: processed,
properties_to_save: properties_to_save,
log_lvl: log_lvl
});
}
ae_promises.load__event_obj_li = filtered_results;
ae_promises.load__event_obj_li = processed_results;
} else {
console.log('No results returned from API.');
if (try_cache) {
@@ -313,7 +307,7 @@ export async function load_ae_obj_li__event({
if (inc_session_li && ae_promises.load__event_obj_li) {
for (const event_obj of ae_promises.load__event_obj_li) {
const current_event_id = event_obj.event_id || event_obj.id;
const current_event_id = event_obj.id || event_obj.event_id;
event_obj.event_session_obj_li = await load_ae_obj_li__event_session({
api_cfg,
for_obj_type: 'event',
@@ -346,28 +340,33 @@ export async function create_ae_obj__event({
api_cfg,
obj_type: 'event',
fields: {
account_id_random: account_id,
account_id,
...data_kv
},
params,
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_props({
if (result) {
const processed = await process_ae_obj__event_props({
obj_li: [result],
log_lvl: log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'event',
obj_li: processed_obj_li,
properties_to_save: properties_to_save,
log_lvl: log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'event',
obj_li: processed,
properties_to_save: properties_to_save,
log_lvl: log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-06
@@ -427,21 +426,26 @@ export async function update_ae_obj__event({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_props({
if (result) {
const processed = await process_ae_obj__event_props({
obj_li: [result],
log_lvl: log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'event',
obj_li: processed_obj_li,
properties_to_save: properties_to_save,
log_lvl: log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'event',
obj_li: processed,
properties_to_save: properties_to_save,
log_lvl: log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-21
@@ -498,9 +502,8 @@ export async function search__event({
search_query.and.push({ field: 'default_qry_str', op: 'like', value: `%${qry_str.trim()}%` });
params['lk_qry'] = { 'default_qry_str': qry_str.trim() };
// Use raw field name to bypass backend mapping conflicts
if (for_obj_id) {
search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id });
search_query.and.push({ field: `${for_obj_type}_id`, op: 'eq', value: for_obj_id });
}
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
@@ -754,10 +757,8 @@ export async function qry_ae_obj_li__event_v2({
export const properties_to_save = [
'id',
'event_id',
'event_id_random',
'code',
'account_id',
'account_id_random',
'conference',
'type',
'name',
@@ -880,11 +881,8 @@ export async function process_ae_obj__event_props({
obj.code = obj.event_code;
}
// Ensure ID consistency for components relying on specific ID fields
if (!obj.event_id_random && obj.id_random) {
obj.event_id_random = obj.id_random;
}
if (obj.event_id_random && !obj.id) {
obj.id = obj.event_id_random;
if (obj.id && !obj.event_id) {
obj.event_id = obj.id;
}
return obj;
}

View File

@@ -9,7 +9,7 @@ import { load_ae_obj_id__event_location } from './ae_events__event_location';
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_device({
api_cfg,
event_device_id,
@@ -28,31 +28,31 @@ export async function load_ae_obj_id__event_device({
}
try {
ae_promises.load__event_device_obj = await api.get_ae_obj_v3({
const result = await api.get_ae_obj_v3({
api_cfg,
obj_type: 'event_device',
obj_id: event_device_id,
log_lvl
});
if (ae_promises.load__event_device_obj) {
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
log_lvl
});
ae_promises.load__event_device_obj = processed[0];
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: [ae_promises.load__event_device_obj],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'device',
obj_li: processed_obj_li,
obj_li: [ae_promises.load__event_device_obj],
properties_to_save,
log_lvl
});
}
} else {
if (try_cache) {
ae_promises.load__event_device_obj = await db_events.device.get(event_device_id);
}
} else if (try_cache) {
ae_promises.load__event_device_obj = await db_events.device.get(event_device_id);
}
} catch (error: any) {
console.log('V3 Request failed.', error);
@@ -78,7 +78,7 @@ export async function load_ae_obj_id__event_device({
return ae_promises.load__event_device_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_device({
api_cfg,
for_obj_type = 'event',
@@ -114,7 +114,7 @@ export async function load_ae_obj_li__event_device({
}
try {
ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_v3({
const result_li = await api.get_ae_obj_li_v3({
api_cfg,
obj_type: 'event_device',
for_obj_type,
@@ -127,16 +127,18 @@ export async function load_ae_obj_li__event_device({
log_lvl
});
if (ae_promises.load__event_device_obj_li) {
if (result_li) {
const processed = await process_ae_obj__event_device_props({
obj_li: result_li,
log_lvl
});
ae_promises.load__event_device_obj_li = processed;
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: ae_promises.load__event_device_obj_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'device',
obj_li: processed_obj_li,
obj_li: ae_promises.load__event_device_obj_li,
properties_to_save,
log_lvl
});
@@ -193,27 +195,32 @@ export async function create_ae_obj__event_device({
api_cfg,
obj_type: 'event_device',
fields: {
event_id_random: event_id,
event_id,
...data_kv
},
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_device_props({
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'device',
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: 'device',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -275,21 +282,26 @@ export async function update_ae_obj__event_device({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_device_props({
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'device',
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: 'device',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -327,7 +339,7 @@ export async function search__event_device({
const search_query: any = {
q: qry_str,
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
// Logical filters
@@ -347,21 +359,25 @@ export async function search__event_device({
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_device_props({
if (result_li) {
const processed = await process_ae_obj__event_device_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'device',
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: 'device',
obj_li: processed,
properties_to_save,
log_lvl
});
}
return processed;
}
return result_li || [];
return [];
}
export const properties_to_save = [
@@ -443,6 +459,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];

View File

@@ -9,7 +9,7 @@ import { load_ae_obj_li__event_session } from '$lib/ae_events/ae_events__event_s
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_location({
api_cfg,
event_location_id,
@@ -34,7 +34,7 @@ export async function load_ae_obj_id__event_location({
}
try {
ae_promises.load__event_location_obj = await api.get_ae_obj_v3({
const result = await api.get_ae_obj_v3({
api_cfg,
obj_type: 'event_location',
obj_id: event_location_id,
@@ -42,16 +42,18 @@ export async function load_ae_obj_id__event_location({
log_lvl
});
if (ae_promises.load__event_location_obj) {
if (result) {
const processed = await process_ae_obj__event_location_props({
obj_li: [result],
log_lvl
});
ae_promises.load__event_location_obj = processed[0];
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: [ae_promises.load__event_location_obj],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'location',
obj_li: processed_obj_li,
obj_li: [ae_promises.load__event_location_obj],
properties_to_save,
log_lvl
});
@@ -73,7 +75,7 @@ export async function load_ae_obj_id__event_location({
return await _handle_nested_loads(ae_promises.load__event_location_obj, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl });
}
// Updated 2026-01-20 to V3
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_li__event_location({
api_cfg,
for_obj_type = 'event',
@@ -113,7 +115,7 @@ export async function load_ae_obj_li__event_location({
}
try {
ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_v3({
const result_li = await api.get_ae_obj_li_v3({
api_cfg,
obj_type: 'event_location',
for_obj_type,
@@ -126,16 +128,18 @@ export async function load_ae_obj_li__event_location({
log_lvl
});
if (ae_promises.load__event_location_obj_li) {
if (result_li) {
const processed = await process_ae_obj__event_location_props({
obj_li: result_li,
log_lvl
});
ae_promises.load__event_location_obj_li = processed;
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: ae_promises.load__event_location_obj_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'location',
obj_li: processed_obj_li,
obj_li: ae_promises.load__event_location_obj_li,
properties_to_save,
log_lvl
});
@@ -167,7 +171,8 @@ export async function load_ae_obj_li__event_location({
* Handle nested data loads for a single location object.
*/
async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl }: any) {
const current_location_id = location_obj.event_location_id_random || location_obj.event_location_id || location_obj.id;
// String-Only ID Vision: the '_id' field IS the string ID
const current_location_id = location_obj.id || location_obj.event_location_id;
if (inc_file_li) {
location_obj.event_file_li = await load_ae_obj_li__event_file({
@@ -221,27 +226,32 @@ export async function create_ae_obj__event_location({
api_cfg,
obj_type: 'event_location',
fields: {
event_id_random: event_id,
event_id,
...data_kv
},
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_location_props({
if (result) {
const processed = await process_ae_obj__event_location_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'location',
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: 'location',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -303,21 +313,26 @@ export async function update_ae_obj__event_location({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_location_props({
if (result) {
const processed = await process_ae_obj__event_location_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'location',
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: 'location',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -355,7 +370,7 @@ export async function search__event_location({
const search_query: any = {
q: qry_str,
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true });
@@ -374,21 +389,25 @@ export async function search__event_location({
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_location_props({
if (result_li) {
const processed = await process_ae_obj__event_location_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'location',
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: 'location',
obj_li: processed,
properties_to_save,
log_lvl
});
}
return processed;
}
return result_li || [];
return [];
}
export const properties_to_save = [
@@ -441,6 +460,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];

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];

View File

@@ -9,7 +9,7 @@ import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file
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_presenter({
api_cfg,
event_presenter_id,
@@ -30,7 +30,7 @@ export async function load_ae_obj_id__event_presenter({
}
try {
ae_promises.load__event_presenter_obj = await api.get_ae_obj_v3({
const result = await api.get_ae_obj_v3({
api_cfg,
obj_type: 'event_presenter',
obj_id: event_presenter_id,
@@ -38,16 +38,18 @@ export async function load_ae_obj_id__event_presenter({
log_lvl
});
if (ae_promises.load__event_presenter_obj) {
if (result) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: [result],
log_lvl
});
ae_promises.load__event_presenter_obj = processed[0];
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: [ae_promises.load__event_presenter_obj],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
obj_li: processed_obj_li,
obj_li: [ae_promises.load__event_presenter_obj],
properties_to_save,
log_lvl
});
@@ -79,7 +81,7 @@ export async function load_ae_obj_id__event_presenter({
return ae_promises.load__event_presenter_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_presenter({
api_cfg,
for_obj_type = 'event_presentation',
@@ -115,7 +117,7 @@ export async function load_ae_obj_li__event_presenter({
}
try {
ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_v3({
const result_li = await api.get_ae_obj_li_v3({
api_cfg,
obj_type: 'event_presenter',
for_obj_type,
@@ -128,16 +130,18 @@ export async function load_ae_obj_li__event_presenter({
log_lvl
});
if (ae_promises.load__event_presenter_obj_li) {
if (result_li) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: result_li,
log_lvl
});
ae_promises.load__event_presenter_obj_li = processed;
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: ae_promises.load__event_presenter_obj_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
obj_li: processed_obj_li,
obj_li: ae_promises.load__event_presenter_obj_li,
properties_to_save,
log_lvl
});
@@ -158,7 +162,7 @@ export async function load_ae_obj_li__event_presenter({
if (inc_file_li && ae_promises.load__event_presenter_obj_li) {
for (const presenter of ae_promises.load__event_presenter_obj_li) {
const current_presenter_id = presenter.event_presenter_id_random || presenter.event_presenter_id || presenter.id;
const current_presenter_id = presenter.id || presenter.event_presenter_id;
presenter.event_file_li = await load_ae_obj_li__event_file({
api_cfg,
for_obj_type: 'event_presenter',
@@ -200,29 +204,34 @@ export async function create_ae_obj__event_presenter({
api_cfg,
obj_type: 'event_presenter',
fields: {
event_id_random: event_id,
event_session_id_random: event_session_id,
event_presentation_id_random: event_presentation_id,
event_id,
event_session_id,
event_presentation_id,
...data_kv
},
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_presenter_props({
if (result) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
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: 'presenter',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -284,21 +293,26 @@ export async function update_ae_obj__event_presenter({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_presenter_props({
if (result) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
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: 'presenter',
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
@@ -341,7 +355,7 @@ export async function search__event_presenter({
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 = {};
@@ -376,21 +390,25 @@ export async function search__event_presenter({
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_presenter_props({
if (result_li) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
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: 'presenter',
obj_li: processed,
properties_to_save,
log_lvl
});
}
return processed;
}
return result_li || [];
return [];
}
/**
@@ -528,6 +546,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];

View File

@@ -10,7 +10,7 @@ import { load_ae_obj_li__event_presentation } from '$lib/ae_events/ae_events__ev
const ae_promises: key_val = {};
// Updated 2026-01-26 (SWR Optimization)
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_id__event_session({
api_cfg,
event_session_id,
@@ -76,11 +76,13 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view,
try {
const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_session', obj_id: event_session_id, view, log_lvl });
if (result) {
let processed_obj = result;
if (try_cache) {
const processed = await process_ae_obj__event_session_props({ obj_li: [result], log_lvl });
processed_obj = processed[0];
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl });
}
return await _handle_nested_loads(result, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl });
return await _handle_nested_loads(processed_obj, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl });
}
} catch (e) {}
return null;
@@ -90,7 +92,8 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view,
* Helper to handle nested collection loads for a session
*/
async function _handle_nested_loads(session_obj: any, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }: any) {
const current_session_id = session_obj.event_session_id_random || session_obj.event_session_id || session_obj.id;
// String-Only ID Vision: the '_id' field IS the string ID
const current_session_id = session_obj.id || session_obj.event_session_id;
const tasks = [];
if (inc_file_li) {
@@ -111,7 +114,7 @@ async function _handle_nested_loads(session_obj: any, { api_cfg, inc_file_li, in
return session_obj;
}
// Updated 2026-01-26 (SWR Optimization)
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_li__event_session({
api_cfg,
for_obj_type = 'event',
@@ -183,14 +186,15 @@ async function _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_i
try {
const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_session', for_obj_type, for_obj_id, enabled, hidden, limit, offset, order_by_li, log_lvl });
if (result_li) {
let processed_li = result_li;
if (try_cache) {
const processed = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl });
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl });
processed_li = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl });
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed_li, properties_to_save, log_lvl });
}
for (const s of result_li) {
for (const s of processed_li) {
await _handle_nested_loads(s, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl });
}
return result_li;
return processed_li;
}
} catch (e) {}
return [];
@@ -218,27 +222,32 @@ export async function create_ae_obj__event_session({
api_cfg,
obj_type: 'event_session',
fields: {
event_id_random: event_id,
event_id,
...data_kv
},
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_session_props({
if (result) {
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
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: 'session',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -300,21 +309,26 @@ export async function update_ae_obj__event_session({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_session_props({
if (result) {
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
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: 'session',
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
@@ -363,7 +377,7 @@ export async function search__event_session({
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 = {};
@@ -413,21 +427,25 @@ export async function search__event_session({
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_session_props({
if (result_li) {
const processed = await process_ae_obj__event_session_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
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: 'session',
obj_li: processed,
properties_to_save,
log_lvl
});
}
return processed;
}
return result_li || [];
return [];
}
export const qry__event_session = search__event_session;
@@ -553,6 +571,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];