Last round of prettier: npx prettier --write src/

This commit is contained in:
Scott Idem
2026-03-24 13:27:40 -04:00
parent 23d25bf65a
commit a8f3c29b9f
146 changed files with 13201 additions and 9277 deletions

View File

@@ -46,7 +46,9 @@ export async function load_ae_obj_id__event({
log_lvl?: number;
}): Promise<ae_Event | null> {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event() *** event_id=${event_id} (SWR Optimization)`);
console.log(
`*** load_ae_obj_id__event() *** event_id=${event_id} (SWR Optimization)`
);
}
// Hierarchy Enforcement: Pulling presentations/presenters requires pulling sessions first
@@ -57,20 +59,43 @@ export async function load_ae_obj_id__event({
try {
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.');
if (log_lvl)
console.log(
'EVENT LOAD: Cache hit. Returning stale data immediately.'
);
// Trigger background refresh
_refresh_event_background({
api_cfg, event_id, view, try_cache,
inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_template_li,
enabled, hidden,
api_cfg,
event_id,
view,
try_cache,
inc_device_li,
inc_file_li,
inc_location_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_template_li,
enabled,
hidden,
log_lvl: 0
});
// Still handle nested loads for the cached version to ensure UI richness
return await _handle_nested_loads(cached_event, {
api_cfg, inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_template_li,
enabled, hidden, try_cache, log_lvl
api_cfg,
inc_device_li,
inc_file_li,
inc_location_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_template_li,
enabled,
hidden,
try_cache,
log_lvl
});
}
} catch (e) {
@@ -80,9 +105,19 @@ export async function load_ae_obj_id__event({
// 2. SLOW PATH: Wait for API if cache is empty or try_cache is false
return await _refresh_event_background({
api_cfg, event_id, view, try_cache,
inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_template_li,
enabled, hidden,
api_cfg,
event_id,
view,
try_cache,
inc_device_li,
inc_file_li,
inc_location_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_template_li,
enabled,
hidden,
log_lvl
});
}
@@ -91,9 +126,19 @@ export async function load_ae_obj_id__event({
* Internal helper to perform the actual API fetch and cache update for events
*/
async function _refresh_event_background({
api_cfg, event_id, view, try_cache,
inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_template_li,
enabled, hidden,
api_cfg,
event_id,
view,
try_cache,
inc_device_li,
inc_file_li,
inc_location_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_template_li,
enabled,
hidden,
log_lvl
}: any) {
// Check if offline
@@ -129,8 +174,18 @@ async function _refresh_event_background({
}
return await _handle_nested_loads(processed_obj, {
api_cfg, inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_template_li,
enabled, hidden, try_cache: false, log_lvl
api_cfg,
inc_device_li,
inc_file_li,
inc_location_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_template_li,
enabled,
hidden,
try_cache: false,
log_lvl
});
}
} catch (error: any) {
@@ -142,8 +197,27 @@ async function _refresh_event_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_presentation_li, inc_presenter_li, inc_template_li, enabled, hidden, try_cache, log_lvl }: any) {
if (log_lvl) console.log(`Loading nested collections for event: ${event_obj.event_id} (Devices: ${inc_device_li}, Files: ${inc_file_li}, Locations: ${inc_location_li}, Sessions: ${inc_session_li}, Presentations: ${inc_presentation_li}, Presenters: ${inc_presenter_li}, Templates: ${inc_template_li})`);
async function _handle_nested_loads(
event_obj: any,
{
api_cfg,
inc_device_li,
inc_file_li,
inc_location_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_template_li,
enabled,
hidden,
try_cache,
log_lvl
}: any
) {
if (log_lvl)
console.log(
`Loading nested collections for event: ${event_obj.event_id} (Devices: ${inc_device_li}, Files: ${inc_file_li}, Locations: ${inc_location_li}, Sessions: ${inc_session_li}, Presentations: ${inc_presentation_li}, Presenters: ${inc_presenter_li}, Templates: ${inc_template_li})`
);
// String-Only ID Vision: the '_id' field IS the string ID
const current_event_id = event_obj.id || event_obj.event_id;
@@ -151,56 +225,66 @@ async function _handle_nested_loads(event_obj: any, { api_cfg, inc_device_li, in
const tasks = [];
if (inc_device_li) {
tasks.push(load_ae_obj_li__event_device({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
try_cache,
log_lvl
}).then(res => event_obj.event_device_obj_li = res));
tasks.push(
load_ae_obj_li__event_device({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
try_cache,
log_lvl
}).then((res) => (event_obj.event_device_obj_li = res))
);
}
if (inc_file_li) {
tasks.push(load_ae_obj_li__event_file({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
enabled: 'all',
limit: 100,
try_cache,
log_lvl
}).then(res => event_obj.event_file_li = res));
tasks.push(
load_ae_obj_li__event_file({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
enabled: 'all',
limit: 100,
try_cache,
log_lvl
}).then((res) => (event_obj.event_file_li = res))
);
}
if (inc_location_li) {
tasks.push(load_ae_obj_li__event_location({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
enabled,
hidden,
try_cache,
log_lvl
}).then(res => event_obj.event_location_obj_li = res));
tasks.push(
load_ae_obj_li__event_location({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
enabled,
hidden,
try_cache,
log_lvl
}).then((res) => (event_obj.event_location_obj_li = res))
);
}
if (inc_session_li) {
tasks.push(load_ae_obj_li__event_session({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
try_cache,
log_lvl
}).then(res => event_obj.event_session_obj_li = res));
tasks.push(
load_ae_obj_li__event_session({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
try_cache,
log_lvl
}).then((res) => (event_obj.event_session_obj_li = res))
);
}
if (inc_template_li) {
tasks.push(load_ae_obj_li__event_badge_template({
api_cfg,
event_id: current_event_id,
try_cache,
log_lvl
}).then(res => event_obj.event_badge_template_obj_li = res));
tasks.push(
load_ae_obj_li__event_badge_template({
api_cfg,
event_id: current_event_id,
try_cache,
log_lvl
}).then((res) => (event_obj.event_badge_template_obj_li = res))
);
}
if (tasks.length > 0) await Promise.all(tasks);
@@ -238,20 +322,25 @@ export async function load_ae_obj_li__event({
inc_presenter_li?: boolean;
limit?: number;
offset?: number;
order_by_li?: Record<string, 'ASC' | 'DESC'> | Record<string, 'ASC' | 'DESC'>[];
order_by_li?:
| Record<string, 'ASC' | 'DESC'>
| Record<string, 'ASC' | 'DESC'>[];
params?: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_Event[]> {
// Hierarchy Enforcement: Pulling presentations/presenters requires pulling sessions first
if (inc_presenter_li || inc_presentation_li) inc_session_li = true;
// Check if offline
if (typeof navigator !== 'undefined' && !navigator.onLine) {
if (log_lvl) console.log('Browser is offline. Skipping API and attempting cache load.');
if (log_lvl)
console.log(
'Browser is offline. Skipping API and attempting cache load.'
);
ae_promises.load__event_obj_li = await db_events.event
.where('account_id').equals(for_obj_id)
.where('account_id')
.equals(for_obj_id)
.toArray();
return ae_promises.load__event_obj_li || [];
}
@@ -264,7 +353,11 @@ export async function load_ae_obj_li__event({
};
if (for_obj_id) {
search_query.and.push({ field: `${for_obj_type}_id`, 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({
@@ -319,9 +412,11 @@ export async function load_ae_obj_li__event({
} else {
console.log('No results returned from API.');
if (try_cache) {
if (log_lvl) console.log('Attempting to load from local cache...');
if (log_lvl)
console.log('Attempting to load from local cache...');
ae_promises.load__event_obj_li = await db_events.event
.where('account_id').equals(for_obj_id)
.where('account_id')
.equals(for_obj_id)
.toArray();
} else {
ae_promises.load__event_obj_li = [];
@@ -330,9 +425,13 @@ export async function load_ae_obj_li__event({
} catch (error: any) {
console.log('API request failed.', error);
if (try_cache) {
if (log_lvl) console.log('Attempting to load from local cache after error...');
if (log_lvl)
console.log(
'Attempting to load from local cache after error...'
);
ae_promises.load__event_obj_li = await db_events.event
.where('account_id').equals(for_obj_id)
.where('account_id')
.equals(for_obj_id)
.toArray();
} else {
ae_promises.load__event_obj_li = [];
@@ -340,18 +439,20 @@ export async function load_ae_obj_li__event({
}
if (inc_session_li && ae_promises.load__event_obj_li) {
const session_tasks = ae_promises.load__event_obj_li.map((event_obj: any) => {
const current_event_id = event_obj.id || event_obj.event_id;
return load_ae_obj_li__event_session({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
inc_presentation_li,
inc_presenter_li,
try_cache,
log_lvl
}).then((res) => (event_obj.event_session_obj_li = res));
});
const session_tasks = ae_promises.load__event_obj_li.map(
(event_obj: any) => {
const current_event_id = event_obj.id || event_obj.event_id;
return load_ae_obj_li__event_session({
api_cfg,
for_obj_type: 'event',
for_obj_id: current_event_id,
inc_presentation_li,
inc_presenter_li,
try_cache,
log_lvl
}).then((res) => (event_obj.event_session_obj_li = res));
}
);
await Promise.all(session_tasks);
}
@@ -543,13 +644,21 @@ export async function search__event({
};
const params: key_val = {};
search_query.and.push({ field: 'default_qry_str', op: 'like', value: `%${qry_str.trim()}%` });
params['lk_qry'] = { 'default_qry_str': qry_str.trim() };
search_query.and.push({
field: 'default_qry_str',
op: 'like',
value: `%${qry_str.trim()}%`
});
params['lk_qry'] = { default_qry_str: qry_str.trim() };
if (for_obj_id) {
// V3 Standard: Use random string ID for body filters.
// The API resolves this to the integer column automatically.
search_query.and.push({ field: `${for_obj_type}_id_random`, op: 'eq', value: for_obj_id });
search_query.and.push({
field: `${for_obj_type}_id_random`,
op: 'eq',
value: for_obj_id
});
}
// NOTE: We do NOT push 'physical' and 'virtual' to the server-side query here.
@@ -593,7 +702,11 @@ export async function search__event({
let valid_result_li: ae_Event[] = [];
if (Array.isArray(result_li)) {
valid_result_li = result_li;
} else if (result_li && typeof result_li === 'object' && Array.isArray((result_li as any).data)) {
} else if (
result_li &&
typeof result_li === 'object' &&
Array.isArray((result_li as any).data)
) {
valid_result_li = (result_li as any).data;
} else {
return [];
@@ -641,13 +754,12 @@ export async function search__event({
// Handle person ID filter
if (qry_person_id) {
const match = (
const match =
ev.external_person_id === qry_person_id ||
ev.poc_person_id === qry_person_id ||
ev.poc_person_id_random === qry_person_id ||
ev.poc_event_person_id === qry_person_id ||
ev.poc_event_person_id_random === qry_person_id
);
ev.poc_event_person_id_random === qry_person_id;
if (!match) return false;
}
@@ -655,7 +767,9 @@ export async function search__event({
});
if (log_lvl) {
console.log(`Filter results (Hybrid): Input=${processed_obj_li.length}, Output=${filtered_obj_li.length}`);
console.log(
`Filter results (Hybrid): Input=${processed_obj_li.length}, Output=${filtered_obj_li.length}`
);
}
return filtered_obj_li.slice(0, limit);
@@ -663,7 +777,6 @@ export async function search__event({
export const qry_ae_obj_li__event = search__event;
// Updated 2026-03-10
export const properties_to_save = [
'id',
@@ -780,14 +893,21 @@ async function _process_generic_props<T extends Record<string, any>>({
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on ?? new Date(0).toISOString();
const updated =
processed_obj.updated_on ??
processed_obj.created_on ??
new Date(0).toISOString();
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
}
processed_obj_li.push(processed_obj as T);
@@ -849,7 +969,8 @@ export function sync_config__event_pres_mgmt({
pres_mgmt_cfg_remote?.label__session_poc_name_short ?? 'POC';
pres_mgmt_cfg_local.label__session_poc_name =
pres_mgmt_cfg_remote?.label__session_poc_name ?? 'Point of Contact';
pres_mgmt_cfg_local.hide__session_poc = pres_mgmt_cfg_remote?.hide__session_poc ?? false;
pres_mgmt_cfg_local.hide__session_poc =
pres_mgmt_cfg_remote?.hide__session_poc ?? false;
pres_mgmt_cfg_local.require__presenter_agree =
pres_mgmt_cfg_remote?.require__presenter_agree ?? false;
pres_mgmt_cfg_local.require__session_agree =
@@ -874,27 +995,31 @@ export function sync_config__event_pres_mgmt({
pres_mgmt_cfg_local.hide__presentation_datetime =
pres_mgmt_cfg_remote?.hide__presentation_datetime ?? false;
pres_mgmt_cfg_local.show_content__presentation_description =
pres_mgmt_cfg_remote?.show_content__presentation_description ?? false;
pres_mgmt_cfg_remote?.show_content__presentation_description ??
false;
pres_mgmt_cfg_local.hide__presenter_code =
pres_mgmt_cfg_remote?.hide__presenter_code ?? false;
pres_mgmt_cfg_local.hide__presenter_biography =
pres_mgmt_cfg_remote?.hide__presenter_biography ?? false;
pres_mgmt_cfg_local.hide__session_code = pres_mgmt_cfg_remote?.hide__session_code ?? false;
pres_mgmt_cfg_local.hide__session_code =
pres_mgmt_cfg_remote?.hide__session_code ?? false;
pres_mgmt_cfg_local.hide__session_description =
pres_mgmt_cfg_remote?.hide__session_description ?? false;
pres_mgmt_cfg_local.hide__session_location =
pres_mgmt_cfg_remote?.hide__session_location ?? false;
pres_mgmt_cfg_local.hide__session_msg = pres_mgmt_cfg_remote?.hide__session_msg ?? false;
pres_mgmt_cfg_local.hide__session_msg =
pres_mgmt_cfg_remote?.hide__session_msg ?? false;
pres_mgmt_cfg_local.hide__session_poc_profile =
pres_mgmt_cfg_remote?.hide__session_poc_profile ?? false;
pres_mgmt_cfg_local.hide__session_poc_biography =
pres_mgmt_cfg_remote?.hide__session_poc_biography ?? false;
pres_mgmt_cfg_local.hide__session_poc_profile_pic =
pres_mgmt_cfg_remote?.hide__session_poc_profile_pic ?? false;
pres_mgmt_cfg_local.hide_launcher_link = pres_mgmt_cfg_remote?.hide_launcher_link ?? false;
pres_mgmt_cfg_local.hide_launcher_link =
pres_mgmt_cfg_remote?.hide_launcher_link ?? false;
pres_mgmt_cfg_local.hide_launcher_link_legacy =
pres_mgmt_cfg_remote?.hide_launcher_link_legacy ?? false;
}
return pres_mgmt_cfg_local;
}
}

View File

@@ -9,9 +9,15 @@ vi.mock('$lib/api/api', () => ({
search_ae_obj: vi.fn()
}
}));
vi.mock('$lib/ae_core/core__idb_dexie', () => ({ db_save_ae_obj_li__ae_obj: vi.fn() }));
vi.mock('$lib/ae_events/db_events', () => ({ db_events: { badge: { get: vi.fn(), delete: vi.fn() } } }));
vi.mock('$lib/ae_events/ae_events__event_badge_template', () => ({ load_ae_obj_id__event_badge_template: vi.fn() }));
vi.mock('$lib/ae_core/core__idb_dexie', () => ({
db_save_ae_obj_li__ae_obj: vi.fn()
}));
vi.mock('$lib/ae_events/db_events', () => ({
db_events: { badge: { get: vi.fn(), delete: vi.fn() } }
}));
vi.mock('$lib/ae_events/ae_events__event_badge_template', () => ({
load_ae_obj_id__event_badge_template: vi.fn()
}));
import { create_ae_obj__event_badge } from './ae_events__event_badge';
@@ -25,9 +31,17 @@ describe('create_ae_obj__event_badge', () => {
const api_cfg = { base_url: 'http://localhost', headers: {} };
const event_id = 'evt1';
const data_kv = { full_name_override: 'Test User', email: 't@example.com' };
const data_kv = {
full_name_override: 'Test User',
email: 't@example.com'
};
const result = await create_ae_obj__event_badge({ api_cfg, event_id, data_kv, try_cache: false });
const result = await create_ae_obj__event_badge({
api_cfg,
event_id,
data_kv,
try_cache: false
});
expect(mockCreateNested).toHaveBeenCalled();
expect(mockCreateNested).toHaveBeenCalledWith({
@@ -51,9 +65,16 @@ describe('update_ae_obj__event_badge', () => {
const fakeResult = { event_badge_id: 'eb999', full_name: 'Updated' };
mockUpdate.mockResolvedValue(fakeResult);
const { update_ae_obj__event_badge } = await import('./ae_events__event_badge');
const { update_ae_obj__event_badge } =
await import('./ae_events__event_badge');
const api_cfg = { base_url: 'http://localhost', headers: {} };
const res = await update_ae_obj__event_badge({ api_cfg, event_id: 'evt1', event_badge_id: 'eb999', data_kv: { full_name_override: 'Updated' }, try_cache: false });
const res = await update_ae_obj__event_badge({
api_cfg,
event_id: 'evt1',
event_badge_id: 'eb999',
data_kv: { full_name_override: 'Updated' },
try_cache: false
});
expect(mockUpdate).toHaveBeenCalled();
expect(mockUpdate).toHaveBeenCalledWith({
@@ -79,10 +100,16 @@ describe('delete_ae_obj_id__event_badge', () => {
const db = await import('$lib/ae_events/db_events');
const dbDelete = db.db_events.badge.delete as any;
const { delete_ae_obj_id__event_badge } = await import('./ae_events__event_badge');
const { delete_ae_obj_id__event_badge } =
await import('./ae_events__event_badge');
const api_cfg = { base_url: 'http://localhost', headers: {} };
const res = await delete_ae_obj_id__event_badge({ api_cfg, event_id: 'evt1', event_badge_id: 'ebDel', try_cache: true });
const res = await delete_ae_obj_id__event_badge({
api_cfg,
event_id: 'evt1',
event_badge_id: 'ebDel',
try_cache: true
});
expect(mockDelete).toHaveBeenCalled();
expect(dbDelete).toHaveBeenCalledWith('ebDel');
@@ -97,9 +124,15 @@ describe('search__event_badge', () => {
const fakeList = [{ event_badge_id: 'eb1' }, { event_badge_id: 'eb2' }];
mockSearch.mockResolvedValue({ data: fakeList });
const { search__event_badge } = await import('./ae_events__event_badge');
const { search__event_badge } =
await import('./ae_events__event_badge');
const api_cfg = { base_url: 'http://localhost', headers: {} };
const res = await search__event_badge({ api_cfg, event_id: 'evt1', fulltext_search_qry_str: 'Test', try_cache: false });
const res = await search__event_badge({
api_cfg,
event_id: 'evt1',
fulltext_search_qry_str: 'Test',
try_cache: false
});
expect(mockSearch).toHaveBeenCalled();
expect(Array.isArray(res)).toBe(true);

View File

@@ -35,29 +35,36 @@ export async function load_ae_obj_id__event_badge({
log_lvl?: number;
}): Promise<ae_EventBadge | null> {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`);
console.log(
`*** load_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`
);
}
try {
ae_promises.load__event_badge_obj = await api
.get_ae_obj({
api_cfg,
obj_type: 'event_badge',
obj_id: event_badge_id,
view,
log_lvl
});
ae_promises.load__event_badge_obj = await api.get_ae_obj({
api_cfg,
obj_type: 'event_badge',
obj_id: event_badge_id,
view,
log_lvl
});
if (ae_promises.load__event_badge_obj) {
if (try_cache) {
// In theory we should be able to use the event_id found in the Badge load object. 2026-02-04
// This keeps coming up as undefined: ae_promises.load__event_badge_obj.event_id
if (log_lvl) console.log(`Saving to local cache... Event ID: ${event_id} or ${ae_promises.load__event_badge_obj.event_id}`);
const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: [ae_promises.load__event_badge_obj],
event_id: event_id || ae_promises.load__event_badge_obj.event_id,
log_lvl
});
if (log_lvl)
console.log(
`Saving to local cache... Event ID: ${event_id} or ${ae_promises.load__event_badge_obj.event_id}`
);
const processed_obj_li =
await process_ae_obj__event_badge_props({
obj_li: [ae_promises.load__event_badge_obj],
event_id:
event_id ||
ae_promises.load__event_badge_obj.event_id,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge',
@@ -71,15 +78,21 @@ export async function load_ae_obj_id__event_badge({
} else {
console.log('No results returned from API.');
if (try_cache) {
if (log_lvl) console.log('Attempting to load from local cache...');
ae_promises.load__event_badge_obj = await db_events.badge.get(event_badge_id);
if (log_lvl)
console.log('Attempting to load from local cache...');
ae_promises.load__event_badge_obj =
await db_events.badge.get(event_badge_id);
}
}
} catch (error: any) {
console.log('API request failed.', error);
if (try_cache) {
if (log_lvl) console.log('Attempting to load from local cache after error...');
ae_promises.load__event_badge_obj = await db_events.badge.get(event_badge_id);
if (log_lvl)
console.log(
'Attempting to load from local cache after error...'
);
ae_promises.load__event_badge_obj =
await db_events.badge.get(event_badge_id);
} else {
ae_promises.load__event_badge_obj = null;
}
@@ -87,14 +100,16 @@ export async function load_ae_obj_id__event_badge({
if (inc_template && ae_promises.load__event_badge_obj) {
// Load the templates for the event badge
const current_template_id = ae_promises.load__event_badge_obj.event_badge_template_id;
const current_template_id =
ae_promises.load__event_badge_obj.event_badge_template_id;
if (current_template_id) {
ae_promises.load__event_badge_obj.event_badge_template = await load_ae_obj_id__event_badge_template({
api_cfg: api_cfg,
event_badge_template_id: current_template_id,
try_cache: try_cache,
log_lvl: log_lvl
});
ae_promises.load__event_badge_obj.event_badge_template =
await load_ae_obj_id__event_badge_template({
api_cfg: api_cfg,
event_badge_template_id: current_template_id,
try_cache: try_cache,
log_lvl: log_lvl
});
}
}
@@ -111,7 +126,12 @@ export async function load_ae_obj_li__event_badge({
view = 'default',
limit = 99,
offset = 0,
order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
order_by_li = {
priority: 'DESC',
sort: 'DESC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {},
try_cache = true,
log_lvl = 0
@@ -130,32 +150,34 @@ export async function load_ae_obj_li__event_badge({
log_lvl?: number;
}): Promise<ae_EventBadge[]> {
if (log_lvl) {
console.log(`*** load_ae_obj_li__event_badge() *** event_id=${event_id}`);
console.log(
`*** load_ae_obj_li__event_badge() *** event_id=${event_id}`
);
}
try {
ae_promises.load__event_badge_obj_li = await api
.get_ae_obj_li({
api_cfg,
obj_type: 'event_badge',
for_obj_type: 'event',
for_obj_id: event_id,
enabled: enabled,
hidden: hidden,
view: view,
order_by_li: order_by_li,
limit: limit,
offset: offset,
log_lvl: log_lvl
});
ae_promises.load__event_badge_obj_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_badge',
for_obj_type: 'event',
for_obj_id: event_id,
enabled: enabled,
hidden: hidden,
view: view,
order_by_li: order_by_li,
limit: limit,
offset: offset,
log_lvl: log_lvl
});
if (ae_promises.load__event_badge_obj_li) {
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: ae_promises.load__event_badge_obj_li,
event_id,
log_lvl
});
const processed_obj_li =
await process_ae_obj__event_badge_props({
obj_li: ae_promises.load__event_badge_obj_li,
event_id,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge',
@@ -169,9 +191,11 @@ export async function load_ae_obj_li__event_badge({
} else {
console.log('No results returned from API.');
if (try_cache) {
if (log_lvl) console.log('Attempting to load from local cache...');
if (log_lvl)
console.log('Attempting to load from local cache...');
ae_promises.load__event_badge_obj_li = await db_events.badge
.where('event_id').equals(event_id)
.where('event_id')
.equals(event_id)
.toArray();
} else {
ae_promises.load__event_badge_obj_li = [];
@@ -180,9 +204,13 @@ export async function load_ae_obj_li__event_badge({
} catch (error: any) {
console.log('API request failed.', error);
if (try_cache) {
if (log_lvl) console.log('Attempting to load from local cache after error...');
if (log_lvl)
console.log(
'Attempting to load from local cache after error...'
);
ae_promises.load__event_badge_obj_li = await db_events.badge
.where('event_id').equals(event_id)
.where('event_id')
.equals(event_id)
.toArray();
} else {
ae_promises.load__event_badge_obj_li = [];
@@ -193,12 +221,13 @@ export async function load_ae_obj_li__event_badge({
for (const badge_obj of ae_promises.load__event_badge_obj_li) {
const current_template_id = badge_obj.event_badge_template_id;
if (current_template_id) {
badge_obj.event_badge_template = await load_ae_obj_id__event_badge_template({
api_cfg: api_cfg,
event_badge_template_id: current_template_id,
try_cache: try_cache,
log_lvl: log_lvl
});
badge_obj.event_badge_template =
await load_ae_obj_id__event_badge_template({
api_cfg: api_cfg,
event_badge_template_id: current_template_id,
try_cache: try_cache,
log_lvl: log_lvl
});
}
}
}
@@ -223,7 +252,9 @@ export async function create_ae_obj__event_badge({
log_lvl?: number;
}): Promise<ae_EventBadge | null> {
if (log_lvl) {
console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`);
console.log(
`*** create_ae_obj__event_badge() *** event_id=${event_id}`
);
}
const result = await api.create_nested_obj({
@@ -275,7 +306,9 @@ export async function delete_ae_obj_id__event_badge({
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`);
console.log(
`*** delete_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`
);
}
const result = await api.delete_nested_ae_obj({
@@ -315,7 +348,9 @@ export async function update_ae_obj__event_badge({
log_lvl?: number;
}): Promise<ae_EventBadge | null> {
if (log_lvl) {
console.log(`*** update_ae_obj__event_badge() *** event_badge_id=${event_badge_id}`);
console.log(
`*** update_ae_obj__event_badge() *** event_badge_id=${event_badge_id}`
);
}
const result = await api.update_nested_obj({
@@ -391,7 +426,9 @@ export async function search__event_badge({
log_lvl?: number;
}): Promise<ae_EventBadge[] | false> {
if (log_lvl) {
console.log(`*** search__event_badge() *** event_id=${event_id} ft=${fulltext_search_qry_str}`);
console.log(
`*** search__event_badge() *** event_id=${event_id} ft=${fulltext_search_qry_str}`
);
}
const search_query: any = {
@@ -406,15 +443,23 @@ export async function search__event_badge({
// Multi-word support: Split query by spaces and search for all words (AND logic)
if (fulltext_search_qry_str && fulltext_search_qry_str.trim().length > 0) {
const qry = fulltext_search_qry_str.trim();
const words = qry.split(/\s+/).filter(w => w.length > 0);
const words = qry.split(/\s+/).filter((w) => w.length > 0);
if (words.length === 1) {
// Single word: use simple LIKE
search_query.and.push({ field: 'default_qry_str', op: 'like', value: `%${words[0]}%` });
search_query.and.push({
field: 'default_qry_str',
op: 'like',
value: `%${words[0]}%`
});
} else if (words.length > 1) {
// Multiple words: each word must match (AND logic)
for (const word of words) {
search_query.and.push({ field: 'default_qry_str', op: 'like', value: `%${word}%` });
search_query.and.push({
field: 'default_qry_str',
op: 'like',
value: `%${word}%`
});
}
}
@@ -424,7 +469,11 @@ export async function search__event_badge({
if (affiliations_qry_str && affiliations_qry_str.trim().length > 0) {
const qry = affiliations_qry_str.trim();
search_query.and.push({ field: 'affiliations', op: 'like', value: `%${qry}%` });
search_query.and.push({
field: 'affiliations',
op: 'like',
value: `%${qry}%`
});
params['lk_qry'] = params['lk_qry'] || {};
params['lk_qry']['affiliations'] = qry;
}
@@ -435,11 +484,19 @@ export async function search__event_badge({
}
if (external_event_id) {
search_query.and.push({ field: 'external_event_id', op: 'eq', value: external_event_id });
search_query.and.push({
field: 'external_event_id',
op: 'eq',
value: external_event_id
});
}
if (type_code) {
search_query.and.push({ field: 'badge_type_code', op: 'eq', value: type_code });
search_query.and.push({
field: 'badge_type_code',
op: 'eq',
value: type_code
});
}
if (printed_status === 'printed') {
@@ -448,11 +505,15 @@ export async function search__event_badge({
search_query.and.push({ field: 'print_count', op: 'eq', value: 0 });
}
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: false });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: false });
ae_promises.search__event_badge_obj_li = await api
.search_ae_obj({
@@ -473,17 +534,21 @@ export async function search__event_badge({
let result_li: ae_EventBadge[] = [];
if (Array.isArray(badge_obj_li_get_result)) {
result_li = badge_obj_li_get_result;
} else if (badge_obj_li_get_result?.data && Array.isArray(badge_obj_li_get_result.data)) {
} else if (
badge_obj_li_get_result?.data &&
Array.isArray(badge_obj_li_get_result.data)
) {
result_li = badge_obj_li_get_result.data;
}
if (result_li.length > 0) {
if (try_cache) {
const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: result_li,
event_id,
log_lvl
});
const processed_obj_li =
await process_ae_obj__event_badge_props({
obj_li: result_li,
event_id,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge',
@@ -631,14 +696,21 @@ async function _process_generic_props<T extends Record<string, any>>({
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on ?? new Date(0).toISOString();
const updated =
processed_obj.updated_on ??
processed_obj.created_on ??
new Date(0).toISOString();
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
}
processed_obj_li.push(processed_obj as T);
@@ -663,7 +735,9 @@ export async function process_ae_obj__event_badge_props({
log_lvl,
specific_processor: (obj) => {
if (log_lvl) {
console.log(`*** process_ae_obj__event_badge_props() *** event_id=${event_id}`);
console.log(
`*** process_ae_obj__event_badge_props() *** event_id=${event_id}`
);
}
if (event_id) {
if (!obj.event_id) obj.event_id = event_id;
@@ -672,4 +746,4 @@ export async function process_ae_obj__event_badge_props({
return obj;
}
});
}
}

View File

@@ -87,11 +87,15 @@ async function _process_generic_props<T extends Record<string, any>>({
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
}
processed_obj_li.push(processed_obj as T);
@@ -129,7 +133,9 @@ export async function load_ae_obj_id__event_badge_template({
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event_badge_template() *** [V3] id=${event_badge_template_id}`);
console.log(
`*** load_ae_obj_id__event_badge_template() *** [V3] id=${event_badge_template_id}`
);
}
try {
@@ -156,11 +162,13 @@ export async function load_ae_obj_id__event_badge_template({
});
}
} else if (try_cache) {
ae_promises.load__event_badge_template_obj = await db_events.badge_template.get(event_badge_template_id);
ae_promises.load__event_badge_template_obj =
await db_events.badge_template.get(event_badge_template_id);
}
} catch (error: any) {
if (try_cache) {
ae_promises.load__event_badge_template_obj = await db_events.badge_template.get(event_badge_template_id);
ae_promises.load__event_badge_template_obj =
await db_events.badge_template.get(event_badge_template_id);
}
}
@@ -197,19 +205,21 @@ export async function load_ae_obj_li__event_badge_template({
log_lvl?: number;
}) {
try {
ae_promises.load__event_badge_template_obj_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_badge_template',
for_obj_type: 'event',
for_obj_id: event_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
log_lvl
});
ae_promises.load__event_badge_template_obj_li = await api.get_ae_obj_li(
{
api_cfg,
obj_type: 'event_badge_template',
for_obj_type: 'event',
for_obj_id: event_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
log_lvl
}
);
if (ae_promises.load__event_badge_template_obj_li) {
if (try_cache) {
@@ -226,15 +236,19 @@ export async function load_ae_obj_li__event_badge_template({
});
}
} else if (try_cache) {
ae_promises.load__event_badge_template_obj_li = await db_events.badge_template
.where('event_id').equals(event_id)
.toArray();
ae_promises.load__event_badge_template_obj_li =
await db_events.badge_template
.where('event_id')
.equals(event_id)
.toArray();
}
} catch (error: any) {
if (try_cache) {
ae_promises.load__event_badge_template_obj_li = await db_events.badge_template
.where('event_id').equals(event_id)
.toArray();
ae_promises.load__event_badge_template_obj_li =
await db_events.badge_template
.where('event_id')
.equals(event_id)
.toArray();
}
}
@@ -243,115 +257,115 @@ export async function load_ae_obj_li__event_badge_template({
// Updated 2026-01-20 to V3
export async function create_ae_obj__event_badge_template({
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_badge_template',
fields: { ...data_kv },
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_badge_template',
fields: { ...data_kv },
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_badge_template_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge_template',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
}
return result;
if (result && try_cache) {
const processed_obj_li = await process_ae_badge_template_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge_template',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
}
return result;
}
// Updated 2026-01-20 to V3
export async function delete_ae_obj_id__event_badge_template({
api_cfg,
event_id,
event_badge_template_id,
method = 'delete',
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_badge_template_id,
method = 'delete',
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
event_badge_template_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
event_badge_template_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_badge_template',
obj_id: event_badge_template_id,
method,
log_lvl
});
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_badge_template',
obj_id: event_badge_template_id,
method,
log_lvl
});
if (try_cache) {
await db_events.badge_template.delete(event_badge_template_id);
}
return result;
if (try_cache) {
await db_events.badge_template.delete(event_badge_template_id);
}
return result;
}
// Updated 2026-01-20 to V3
export async function update_ae_obj__event_badge_template({
api_cfg,
event_id,
event_badge_template_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_badge_template_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
event_badge_template_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
event_badge_template_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_badge_template',
obj_id: event_badge_template_id,
fields: data_kv,
log_lvl
});
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_badge_template',
obj_id: event_badge_template_id,
fields: data_kv,
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_badge_template_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge_template',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
}
return result;
if (result && try_cache) {
const processed_obj_li = await process_ae_badge_template_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge_template',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
}
return result;
}
// Updated 2026-01-20 to V3
@@ -388,11 +402,15 @@ export async function search__event_badge_template({
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: false });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: false });
const result_li = await api.search_ae_obj({
api_cfg,
@@ -418,4 +436,4 @@ export async function search__event_badge_template({
});
}
return result_li || [];
}
}

View File

@@ -28,7 +28,9 @@ export async function load_ae_obj_id__event_device({
log_lvl?: number;
}): Promise<ae_EventDevice | null> {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event_device() *** [V3] id=${event_device_id}`);
console.log(
`*** load_ae_obj_id__event_device() *** [V3] id=${event_device_id}`
);
}
try {
@@ -57,26 +59,30 @@ export async function load_ae_obj_id__event_device({
});
}
} else if (try_cache) {
ae_promises.load__event_device_obj = await db_events.device.get(event_device_id);
ae_promises.load__event_device_obj =
await db_events.device.get(event_device_id);
}
} catch (error: any) {
console.log('V3 Request failed.', error);
if (try_cache) {
ae_promises.load__event_device_obj = await db_events.device.get(event_device_id);
ae_promises.load__event_device_obj =
await db_events.device.get(event_device_id);
}
}
if (!ae_promises.load__event_device_obj) return null;
if (inc_location_id) {
const current_location_id = ae_promises.load__event_device_obj.event_location_id;
const current_location_id =
ae_promises.load__event_device_obj.event_location_id;
if (current_location_id) {
ae_promises.load__event_device_obj.event_location_obj = await load_ae_obj_id__event_location({
api_cfg,
event_location_id: current_location_id,
try_cache,
log_lvl
});
ae_promises.load__event_device_obj.event_location_obj =
await load_ae_obj_id__event_location({
api_cfg,
event_location_id: current_location_id,
try_cache,
log_lvl
});
}
}
@@ -115,7 +121,9 @@ export async function load_ae_obj_li__event_device({
log_lvl?: number;
}): Promise<ae_EventDevice[]> {
if (log_lvl) {
console.log(`*** load_ae_obj_li__event_device() *** [V3] for=${for_obj_type}:${for_obj_id}`);
console.log(
`*** load_ae_obj_li__event_device() *** [V3] for=${for_obj_type}:${for_obj_id}`
);
}
try {
@@ -150,14 +158,16 @@ export async function load_ae_obj_li__event_device({
}
} else if (try_cache) {
ae_promises.load__event_device_obj_li = await db_events.device
.where('event_id').equals(for_obj_id)
.where('event_id')
.equals(for_obj_id)
.toArray();
}
} catch (error: any) {
console.log('V3 List Request failed.', error);
if (try_cache) {
ae_promises.load__event_device_obj_li = await db_events.device
.where('event_id').equals(for_obj_id)
.where('event_id')
.equals(for_obj_id)
.toArray();
}
}
@@ -165,12 +175,13 @@ export async function load_ae_obj_li__event_device({
if (inc_location_id && ae_promises.load__event_device_obj_li) {
for (const device of ae_promises.load__event_device_obj_li) {
if (device.event_location_id) {
device.event_location_obj = await load_ae_obj_id__event_location({
api_cfg,
event_location_id: device.event_location_id,
try_cache,
log_lvl
});
device.event_location_obj =
await load_ae_obj_id__event_location({
api_cfg,
event_location_id: device.event_location_id,
try_cache,
log_lvl
});
}
}
}
@@ -180,155 +191,161 @@ export async function load_ae_obj_li__event_device({
// Updated 2026-01-20 to V3
export async function create_ae_obj__event_device({
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id?: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id?: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventDevice | null> {
if (!event_id) event_id = get(slct).event_id;
if (!event_id) {
console.error('create_ae_obj__event_device: event_id is required');
return null;
}
if (log_lvl) {
console.log(`*** create_ae_obj__event_device() *** [V3] event_id=${event_id}`);
}
if (log_lvl) {
console.log(
`*** create_ae_obj__event_device() *** [V3] event_id=${event_id}`
);
}
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_device',
fields: { ...data_kv },
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_device',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
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;
}
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 null;
return null;
}
// Updated 2026-01-20 to V3
export async function delete_ae_obj_id__event_device({
api_cfg,
event_id,
event_device_id,
method = 'delete',
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_device_id,
method = 'delete',
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id?: string;
event_device_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id?: string;
event_device_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
}) {
if (!event_id) event_id = get(slct).event_id;
if (!event_id) {
console.error('delete_ae_obj_id__event_device: event_id is required');
return null;
}
if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_device() *** [V3] id=${event_device_id}`);
}
if (log_lvl) {
console.log(
`*** delete_ae_obj_id__event_device() *** [V3] id=${event_device_id}`
);
}
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_device',
obj_id: event_device_id,
method,
log_lvl
});
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_device',
obj_id: event_device_id,
method,
log_lvl
});
if (try_cache) {
await db_events.device.delete(event_device_id);
}
if (try_cache) {
await db_events.device.delete(event_device_id);
}
return result;
return result;
}
// Updated 2026-01-20 to V3
export async function update_ae_obj__event_device({
api_cfg,
event_id,
event_device_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_device_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id?: string;
event_device_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id?: string;
event_device_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventDevice | null> {
if (!event_id) event_id = get(slct).event_id;
if (!event_id) {
console.error('update_ae_obj__event_device: event_id is required');
return null;
}
if (log_lvl) {
console.log(`*** update_ae_obj__event_device() *** [V3] id=${event_device_id}`);
}
if (log_lvl) {
console.log(
`*** update_ae_obj__event_device() *** [V3] id=${event_device_id}`
);
}
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_device',
obj_id: event_device_id,
fields: data_kv,
log_lvl
});
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_device',
obj_id: event_device_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
if (result) {
const processed = await process_ae_obj__event_device_props({
obj_li: [result],
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;
}
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 null;
return null;
}
// Updated 2026-01-20 to V3
@@ -361,7 +378,9 @@ export async function search__event_device({
log_lvl?: number;
}): Promise<ae_EventDevice[]> {
if (log_lvl) {
console.log(`*** search__event_device() *** [V3] event_id=${event_id} qry=${qry_str}`);
console.log(
`*** search__event_device() *** [V3] event_id=${event_id} qry=${qry_str}`
);
}
const search_query: any = {
@@ -370,11 +389,15 @@ export async function search__event_device({
};
// Logical filters
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: false });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: false });
const result_li = await api.search_ae_obj({
api_cfg,
@@ -499,11 +522,15 @@ async function _process_generic_props<T extends Record<string, any>>({
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
}
processed_obj_li.push(processed_obj as T);

View File

@@ -191,7 +191,9 @@ async function _refresh_file_li_background({
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
if (log_lvl) {
console.log(`📡 [DEBUG] _refresh_file_li_background: Fetching files for ${for_obj_type}:${for_obj_id}`);
console.log(
`📡 [DEBUG] _refresh_file_li_background: Fetching files for ${for_obj_type}:${for_obj_id}`
);
}
const result_li = await api.get_ae_obj_li({
@@ -211,7 +213,10 @@ async function _refresh_file_li_background({
if (result_li) {
if (log_lvl) {
console.log(`📦 [DEBUG] Raw API results count:`, result_li.length);
console.log(
`📦 [DEBUG] Raw API results count:`,
result_li.length
);
if (result_li.length > 0) {
console.log(`🔍 [DEBUG] Sample Raw IDs:`, {
id: result_li[0].id,
@@ -253,7 +258,10 @@ async function _refresh_file_li_background({
}
if (try_cache) {
if (log_lvl) console.log(`💾 [DEBUG] Saving ${processed.length} records to ae_events_db.file`);
if (log_lvl)
console.log(
`💾 [DEBUG] Saving ${processed.length} records to ae_events_db.file`
);
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'file',
@@ -265,10 +273,15 @@ async function _refresh_file_li_background({
return processed;
}
} catch (e) {
if (log_lvl) console.error(`❌ [DEBUG] Error in _refresh_file_li_background:`, e);
if (log_lvl)
console.error(
`❌ [DEBUG] Error in _refresh_file_li_background:`,
e
);
}
return [];
}export async function create_event_file_obj_from_hosted_file_async({
}
export async function create_event_file_obj_from_hosted_file_async({
api_cfg,
hosted_file_id,
params = {},
@@ -459,7 +472,7 @@ export async function search__event_file({
});
}
return processed; // Return processed data with mapped fields
return processed; // Return processed data with mapped fields
}
return [];
@@ -545,7 +558,11 @@ async function _process_generic_props<T extends Record<string, any>>({
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7);
// ONLY overwrite if the random variant has a valid value
if (processed_obj[key] !== null && processed_obj[key] !== undefined && processed_obj[key] !== '') {
if (
processed_obj[key] !== null &&
processed_obj[key] !== undefined &&
processed_obj[key] !== ''
) {
(processed_obj as any)[newKey] = processed_obj[key];
}
}

View File

@@ -37,7 +37,9 @@ export async function load_ae_obj_id__event_location({
log_lvl?: number;
}): Promise<ae_EventLocation | null> {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event_location() *** [V3] id=${event_location_id} (SWR)`);
console.log(
`*** load_ae_obj_id__event_location() *** [V3] id=${event_location_id} (SWR)`
);
}
// 1. FAST PATH: Cache hit
@@ -46,12 +48,26 @@ export async function load_ae_obj_id__event_location({
const cached = await db_events.location.get(event_location_id);
if (cached) {
_refresh_location_id_background({
api_cfg, event_location_id, view, try_cache,
inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
api_cfg,
event_location_id,
view,
try_cache,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl: 0
});
return await _handle_nested_loads(cached, {
api_cfg, inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
api_cfg,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl
});
}
@@ -60,24 +76,65 @@ export async function load_ae_obj_id__event_location({
// 2. SLOW PATH: Wait for API
return await _refresh_location_id_background({
api_cfg, event_location_id, view, try_cache,
inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
api_cfg,
event_location_id,
view,
try_cache,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl
});
}
async function _refresh_location_id_background({ api_cfg, event_location_id, view, try_cache, inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li, log_lvl }: any) {
async function _refresh_location_id_background({
api_cfg,
event_location_id,
view,
try_cache,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_location', obj_id: event_location_id, view, log_lvl });
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_location',
obj_id: event_location_id,
view,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_location_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__event_location_props({
obj_li: [result],
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 });
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 await _handle_nested_loads(processed_obj, {
api_cfg, inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
api_cfg,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl
});
}
@@ -129,23 +186,47 @@ export async function load_ae_obj_li__event_location({
log_lvl?: number;
}): Promise<ae_EventLocation[]> {
if (log_lvl) {
console.log(`*** load_ae_obj_li__event_location() *** [V3] for=${for_obj_type}:${for_obj_id} (SWR)`);
console.log(
`*** load_ae_obj_li__event_location() *** [V3] for=${for_obj_type}:${for_obj_id} (SWR)`
);
}
// 1. FAST PATH: Check cache
if (try_cache) {
try {
const cached_li = await db_events.location.where('event_id').equals(for_obj_id).toArray();
const cached_li = await db_events.location
.where('event_id')
.equals(for_obj_id)
.toArray();
if (cached_li && cached_li.length > 0) {
_refresh_location_li_background({
api_cfg, for_obj_type, for_obj_id,
inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
enabled, hidden, view, limit, offset, order_by_li, try_cache,
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl: 0
});
for (const loc of cached_li) {
_handle_nested_loads(loc, {
api_cfg, inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
api_cfg,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl: 0
});
}
@@ -156,31 +237,89 @@ export async function load_ae_obj_li__event_location({
// 2. SLOW PATH: API
return await _refresh_location_li_background({
api_cfg, for_obj_type, for_obj_id,
inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
enabled, hidden, view, limit, offset, order_by_li, try_cache,
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
});
}
async function _refresh_location_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl }: any) {
async function _refresh_location_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
const result_li = await api.get_ae_obj_li({ api_cfg, obj_type: 'event_location', for_obj_type, for_obj_id, enabled, hidden, view, limit, offset, order_by_li, log_lvl });
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_location',
for_obj_type,
for_obj_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_location_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_location_props({
obj_li: result_li,
log_lvl
});
// String-Only ID Vision: Ensure linking ID is set for indexing
if (for_obj_type === 'event') {
processed.forEach(loc => loc.event_id = for_obj_id);
processed.forEach((loc) => (loc.event_id = for_obj_id));
}
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 });
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'location',
obj_li: processed,
properties_to_save,
log_lvl
});
}
for (const loc of processed) {
_handle_nested_loads(loc, {
api_cfg, inc_file_li, inc_session_li, inc_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li,
api_cfg,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl: 0
});
}
@@ -193,34 +332,66 @@ async function _refresh_location_li_background({ api_cfg, for_obj_type, for_obj_
/**
* 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_presentation_li, inc_presenter_li, inc_device_li, inc_all_file_li, log_lvl }: any) {
const current_location_id = location_obj.id || location_obj.event_location_id;
async function _handle_nested_loads(
location_obj: any,
{
api_cfg,
inc_file_li,
inc_session_li,
inc_presentation_li,
inc_presenter_li,
inc_device_li,
inc_all_file_li,
log_lvl
}: any
) {
const current_location_id =
location_obj.id || location_obj.event_location_id;
if (!current_location_id) return location_obj;
const tasks = [];
if (inc_file_li) {
tasks.push(load_ae_obj_li__event_file({
api_cfg, for_obj_type: 'event_location', for_obj_id: current_location_id,
enabled: 'all', limit: 25, log_lvl
}).then(res => location_obj.event_file_li = res));
tasks.push(
load_ae_obj_li__event_file({
api_cfg,
for_obj_type: 'event_location',
for_obj_id: current_location_id,
enabled: 'all',
limit: 25,
log_lvl
}).then((res) => (location_obj.event_file_li = res))
);
}
if (inc_session_li) {
tasks.push(load_ae_obj_li__event_session({
api_cfg, for_obj_type: 'event_location', for_obj_id: current_location_id,
inc_file_li: inc_all_file_li,
inc_all_file_li: inc_all_file_li,
inc_presentation_li: inc_presentation_li,
inc_presenter_li: inc_presenter_li,
enabled: 'enabled', hidden: 'not_hidden', limit: 150, log_lvl
}).then(res => location_obj.event_session_obj_li = res));
tasks.push(
load_ae_obj_li__event_session({
api_cfg,
for_obj_type: 'event_location',
for_obj_id: current_location_id,
inc_file_li: inc_all_file_li,
inc_all_file_li: inc_all_file_li,
inc_presentation_li: inc_presentation_li,
inc_presenter_li: inc_presenter_li,
enabled: 'enabled',
hidden: 'not_hidden',
limit: 150,
log_lvl
}).then((res) => (location_obj.event_session_obj_li = res))
);
}
if (inc_device_li) {
tasks.push(load_ae_obj_li__event_device({
api_cfg, for_obj_type: 'event_location', for_obj_id: current_location_id,
enabled: 'all', limit: 50, log_lvl
}).then(res => location_obj.event_device_li = res));
tasks.push(
load_ae_obj_li__event_device({
api_cfg,
for_obj_type: 'event_location',
for_obj_id: current_location_id,
enabled: 'all',
limit: 50,
log_lvl
}).then((res) => (location_obj.event_device_li = res))
);
}
if (tasks.length > 0) await Promise.all(tasks);
@@ -229,132 +400,183 @@ async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, i
// Updated 2026-01-20 to V3
export async function create_ae_obj__event_location({
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventLocation | null> {
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_location',
fields: { ...data_kv },
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_location',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_location_props({ obj_li: [result], 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 null;
if (result) {
const processed = await process_ae_obj__event_location_props({
obj_li: [result],
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 null;
}
// Updated 2026-01-20 to V3
export async function delete_ae_obj_id__event_location({
api_cfg,
event_id,
event_location_id,
method = 'delete',
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_location_id,
method = 'delete',
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
event_location_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
event_location_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_location',
obj_id: event_location_id,
method,
log_lvl
});
if (try_cache) await db_events.location.delete(event_location_id);
return result;
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_location',
obj_id: event_location_id,
method,
log_lvl
});
if (try_cache) await db_events.location.delete(event_location_id);
return result;
}
// Updated 2026-01-20 to V3
export async function update_ae_obj__event_location({
api_cfg,
event_id,
event_location_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_location_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
event_location_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
event_location_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventLocation | null> {
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_location',
obj_id: event_location_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_location_props({ obj_li: [result], 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 null;
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_location',
obj_id: event_location_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_location_props({
obj_li: [result],
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 null;
}
// Updated 2026-01-20 to V3
export async function search__event_location({
api_cfg, event_id, qry_str = '', enabled = 'enabled', hidden = 'not_hidden', view = 'default', limit = 25, offset = 0, order_by_li = [{ sort: 'ASC' }, { name: 'ASC' }], try_cache = true, log_lvl = 0
api_cfg,
event_id,
qry_str = '',
enabled = 'enabled',
hidden = 'not_hidden',
view = 'default',
limit = 25,
offset = 0,
order_by_li = [{ sort: 'ASC' }, { name: 'ASC' }],
try_cache = true,
log_lvl = 0
}: {
api_cfg: any; event_id: string; qry_str?: string; enabled?: 'enabled' | 'all' | 'not_enabled'; hidden?: 'hidden' | 'all' | 'not_hidden'; view?: string; limit?: number; offset?: number; order_by_li?: any; try_cache?: boolean; log_lvl?: number;
api_cfg: any;
event_id: string;
qry_str?: string;
enabled?: 'enabled' | 'all' | 'not_enabled';
hidden?: 'hidden' | 'all' | 'not_hidden';
view?: string;
limit?: number;
offset?: number;
order_by_li?: any;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventLocation[]> {
const search_query: any = { q: qry_str, and: [{ field: 'event_id', op: 'eq', value: event_id }] };
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: false });
const search_query: any = {
q: qry_str,
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: true });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: false });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: true });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: false });
const result_li = await api.search_ae_obj({ api_cfg, obj_type: 'event_location', search_query, order_by_li, view, limit, offset, log_lvl });
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_location',
search_query,
order_by_li,
view,
limit,
offset,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_location_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_location_props({
obj_li: result_li,
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 });
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;
}
@@ -362,10 +584,40 @@ export async function search__event_location({
}
export const properties_to_save = [
'id', 'event_location_id', 'event_location_id_random', 'event_id', 'event_id_random', 'external_id', 'code', 'name', 'description', 'passcode', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on', 'tmp_sort_1', 'tmp_sort_2', 'event_name'
'id',
'event_location_id',
'event_location_id_random',
'event_id',
'event_id_random',
'external_id',
'code',
'name',
'description',
'passcode',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
'tmp_sort_1',
'tmp_sort_2',
'event_name'
];
async function _process_generic_props<T extends Record<string, any>>({ obj_li, obj_type, log_lvl = 0, specific_processor }: { obj_li: T[]; obj_type: string; log_lvl?: number; specific_processor?: (obj: T) => Promise<T> | T; }): Promise<T[]> {
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (!obj_li || obj_li.length === 0) return [];
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
@@ -378,24 +630,42 @@ async function _process_generic_props<T extends Record<string, any>>({ obj_li, o
}
const randomIdKey = `${obj_type}_id_random`;
const baseIdKey = `${obj_type}_id`;
if (processed_obj[randomIdKey]) (processed_obj as any).id = processed_obj[randomIdKey];
else if (processed_obj[baseIdKey]) (processed_obj as any).id = processed_obj[baseIdKey];
if (processed_obj[randomIdKey])
(processed_obj as any).id = processed_obj[randomIdKey];
else if (processed_obj[baseIdKey])
(processed_obj as any).id = processed_obj[baseIdKey];
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) processed_obj = await Promise.resolve(specific_processor(processed_obj));
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor)
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
export async function process_ae_obj__event_location_props({ obj_li, log_lvl = 0 }: { obj_li: any[]; log_lvl?: number; }) {
return _process_generic_props({ obj_li, obj_type: 'event_location', log_lvl, specific_processor: (obj) => {
if (obj.event_id_random) obj.event_id = obj.event_id_random;
return obj;
}});
}
export async function process_ae_obj__event_location_props({
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_location',
log_lvl,
specific_processor: (obj) => {
if (obj.event_id_random) obj.event_id = obj.event_id_random;
return obj;
}
});
}

View File

@@ -37,41 +37,116 @@ 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() *** id=${event_presentation_id} (SWR)`);
console.log(
`*** load_ae_obj_id__event_presentation() *** id=${event_presentation_id} (SWR)`
);
}
// 1. FAST PATH: Cache hit
if (try_cache) {
try {
const cached = await db_events.presentation.get(event_presentation_id);
const cached = await db_events.presentation.get(
event_presentation_id
);
if (cached) {
// Background refresh (non-blocking)
_refresh_presentation_id_background({ api_cfg, event_presentation_id, view, try_cache, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, log_lvl: 0 });
_refresh_presentation_id_background({
api_cfg,
event_presentation_id,
view,
try_cache,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
log_lvl: 0
});
// Await nested loads from cache to return a complete object
return await _handle_nested_loads(cached, { api_cfg, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl: 0 });
return await _handle_nested_loads(cached, {
api_cfg,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
try_cache,
log_lvl: 0
});
}
} catch (e) {}
}
// 2. SLOW PATH: Wait for API
return await _refresh_presentation_id_background({ api_cfg, event_presentation_id, view, try_cache, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, log_lvl });
return await _refresh_presentation_id_background({
api_cfg,
event_presentation_id,
view,
try_cache,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
log_lvl
});
}
/**
* Internal background refresh for a single presentation
*/
async function _refresh_presentation_id_background({ api_cfg, event_presentation_id, view, try_cache, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, log_lvl }: any) {
async function _refresh_presentation_id_background({
api_cfg,
event_presentation_id,
view,
try_cache,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
log_lvl
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_presentation', obj_id: event_presentation_id, view, log_lvl });
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_presentation',
obj_id: event_presentation_id,
view,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presentation_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__event_presentation_props({
obj_li: [result],
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 });
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
// During refresh, we disable child SWR to prevent a request storm
return await _handle_nested_loads(processed_obj, { api_cfg, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache: false, log_lvl });
return await _handle_nested_loads(processed_obj, {
api_cfg,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
try_cache: false,
log_lvl
});
}
} catch (e) {}
return null;
@@ -80,23 +155,54 @@ async function _refresh_presentation_id_background({ api_cfg, 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.id || presentation_obj.event_presentation_id;
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.id || presentation_obj.event_presentation_id;
if (!current_presentation_id) return presentation_obj;
const tasks = [];
if (inc_file_li) {
tasks.push(load_ae_obj_li__event_file({
api_cfg, for_obj_type: 'event_presentation', for_obj_id: current_presentation_id,
enabled, limit: 25, try_cache, log_lvl
}).then(res => presentation_obj.event_file_li = res));
tasks.push(
load_ae_obj_li__event_file({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: current_presentation_id,
enabled,
limit: 25,
try_cache,
log_lvl
}).then((res) => (presentation_obj.event_file_li = res))
);
}
if (inc_presenter_li) {
tasks.push(load_ae_obj_li__event_presenter({
api_cfg, for_obj_type: 'event_presentation', for_obj_id: current_presentation_id,
inc_file_li, enabled, hidden, limit, offset, try_cache, log_lvl
}).then(res => presentation_obj.event_presenter_li = res));
tasks.push(
load_ae_obj_li__event_presenter({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: current_presentation_id,
inc_file_li,
enabled,
hidden,
limit,
offset,
try_cache,
log_lvl
}).then((res) => (presentation_obj.event_presenter_li = res))
);
}
if (tasks.length > 0) await Promise.all(tasks);
@@ -140,17 +246,36 @@ 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() *** for=${for_obj_type}:${for_obj_id} (SWR)`);
console.log(
`*** load_ae_obj_li__event_presentation() *** for=${for_obj_type}:${for_obj_id} (SWR)`
);
}
// 1. FAST PATH: Cache hit
if (try_cache) {
try {
// String-Only ID Vision: query event_session_id using the string ID
const cached_li = await db_events.presentation.where('event_session_id').equals(for_obj_id).toArray();
const cached_li = await db_events.presentation
.where('event_session_id')
.equals(for_obj_id)
.toArray();
if (cached_li && cached_li.length > 0) {
// Background refresh (non-blocking)
_refresh_presentation_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, inc_presenter_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl: 0 });
_refresh_presentation_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl: 0
});
// Warm cache for nested loads in the background (FIRE AND FORGET)
// DEPRECATED Optimization: Don't fire child loads for every item in a list here.
@@ -167,23 +292,72 @@ export async function load_ae_obj_li__event_presentation({
}
// 2. SLOW PATH: Wait for API
return await _refresh_presentation_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, inc_presenter_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl });
return await _refresh_presentation_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
});
}
async function _refresh_presentation_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, inc_presenter_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl }: any) {
async function _refresh_presentation_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
const result_li = await api.get_ae_obj_li({ api_cfg, obj_type: 'event_presentation', for_obj_type, for_obj_id, enabled, hidden, view, limit, offset, order_by_li, log_lvl });
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_presentation',
for_obj_type,
for_obj_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_presentation_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_presentation_props({
obj_li: result_li,
log_lvl
});
// Ensure the linking ID is set correctly for indexing
if (for_obj_type === 'event_session') {
processed.forEach(p => p.event_session_id = for_obj_id);
processed.forEach((p) => (p.event_session_id = for_obj_id));
}
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 });
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presentation',
obj_li: processed,
properties_to_save,
log_lvl
});
// CRITICAL FIX (2026-02-26): Yield to microtask queue so Dexie liveQuery observers
// fire before we return. Without this, component-mounted liveQueries may subscribe
// to IDB *before* the write completes, causing empty results on cold-start.
@@ -194,9 +368,21 @@ async function _refresh_presentation_li_background({ api_cfg, for_obj_type, for_
// before presenter data was loaded, causing "refresh twice" bug on cold-start.
// Now we await all nested loads AND preserve try_cache so presenters are written to IDB.
if (inc_file_li || inc_presenter_li) {
await Promise.all(processed.map(p =>
_handle_nested_loads(p, { api_cfg, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl: 0 })
));
await Promise.all(
processed.map((p) =>
_handle_nested_loads(p, {
api_cfg,
inc_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
try_cache,
log_lvl: 0
})
)
);
}
return processed;
}
@@ -206,42 +392,45 @@ async function _refresh_presentation_li_background({ api_cfg, for_obj_type, for_
// Updated 2026-01-20 to V3
export async function create_ae_obj__event_presentation({
api_cfg,
event_session_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_session_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_session_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_session_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventPresentation | null> {
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event_session',
for_obj_id: event_session_id,
obj_type: 'event_presentation',
fields: { ...data_kv },
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event_session',
for_obj_id: event_session_id,
obj_type: 'event_presentation',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presentation_props({ obj_li: [result], 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 null;
if (result) {
const processed = await process_ae_obj__event_presentation_props({
obj_li: [result],
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 null;
}
// Updated 2026-01-20 to V3
@@ -259,7 +448,11 @@ export async function delete_ae_obj_id__event_presentation({
log_lvl?: number;
}) {
const result = await api.delete_ae_obj({
api_cfg, obj_type: 'event_presentation', obj_id: event_presentation_id, method, log_lvl
api_cfg,
obj_type: 'event_presentation',
obj_id: event_presentation_id,
method,
log_lvl
});
if (try_cache) await db_events.presentation.delete(event_presentation_id);
return result;
@@ -280,13 +473,26 @@ export async function update_ae_obj__event_presentation({
log_lvl?: number;
}): Promise<ae_EventPresentation | null> {
const result = await api.update_ae_obj({
api_cfg, obj_type: 'event_presentation', obj_id: event_presentation_id, fields: data_kv, log_lvl
api_cfg,
obj_type: 'event_presentation',
obj_id: event_presentation_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presentation_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__event_presentation_props({
obj_li: [result],
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 });
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;
}
@@ -295,24 +501,74 @@ export async function update_ae_obj__event_presentation({
// Updated 2026-01-21 to Restore Full Aether Search Logic
export async function search__event_presentation({
api_cfg, event_id, fulltext_search_qry_str = '', like_search_qry_str = '', enabled = 'enabled', hidden = 'not_hidden', view = 'default', limit = 50, offset = 0, order_by_li = [{ sort: 'ASC' }, { start_datetime: 'ASC' }, { name: 'ASC' }], try_cache = true, log_lvl = 0
api_cfg,
event_id,
fulltext_search_qry_str = '',
like_search_qry_str = '',
enabled = 'enabled',
hidden = 'not_hidden',
view = 'default',
limit = 50,
offset = 0,
order_by_li = [{ sort: 'ASC' }, { start_datetime: 'ASC' }, { name: 'ASC' }],
try_cache = true,
log_lvl = 0
}: {
api_cfg: any; event_id: string; fulltext_search_qry_str?: string; like_search_qry_str?: string; enabled?: 'enabled' | 'all' | 'not_enabled'; hidden?: 'hidden' | 'all' | 'not_hidden'; view?: string; limit?: number; offset?: number; order_by_li?: any; try_cache?: boolean; log_lvl?: number;
api_cfg: any;
event_id: string;
fulltext_search_qry_str?: string;
like_search_qry_str?: string;
enabled?: 'enabled' | 'all' | 'not_enabled';
hidden?: 'hidden' | 'all' | 'not_hidden';
view?: string;
limit?: number;
offset?: number;
order_by_li?: any;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventPresentation[]> {
const search_query: any = { q: '', and: [{ field: 'event_id', op: 'eq', value: event_id }] };
const search_query: any = {
q: '',
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
const params: key_val = {};
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) params['ft_qry'] = { 'default_qry_str': fulltext_search_qry_str };
if (like_search_qry_str) params['lk_qry'] = { 'default_qry_str': like_search_qry_str };
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2)
params['ft_qry'] = { default_qry_str: fulltext_search_qry_str };
if (like_search_qry_str)
params['lk_qry'] = { default_qry_str: like_search_qry_str };
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
const result_li = await api.search_ae_obj({ api_cfg, obj_type: 'event_presentation', search_query, order_by_li, params, view, limit, offset, log_lvl });
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_presentation',
search_query,
order_by_li,
params,
view,
limit,
offset,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_presentation_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_presentation_props({
obj_li: result_li,
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 });
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;
}
@@ -322,10 +578,53 @@ export async function search__event_presentation({
export const qry__event_presentation = search__event_presentation;
export const properties_to_save = [
'id', 'event_presentation_id', 'event_presentation_id_random', 'external_id', 'code', 'for_type', 'for_id', 'for_id_random', 'type_code', 'event_id', 'event_session_id', 'event_abstract_id', 'event_id_random', 'event_session_id_random', 'event_abstract_id_random', 'abstract_code', 'name', 'description', 'start_datetime', 'end_datetime', 'passcode', 'hide_event_launcher', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on', 'tmp_sort_1', 'tmp_sort_2', 'event_session_code', 'event_session_name'
'id',
'event_presentation_id',
'event_presentation_id_random',
'external_id',
'code',
'for_type',
'for_id',
'for_id_random',
'type_code',
'event_id',
'event_session_id',
'event_abstract_id',
'event_id_random',
'event_session_id_random',
'event_abstract_id_random',
'abstract_code',
'name',
'description',
'start_datetime',
'end_datetime',
'passcode',
'hide_event_launcher',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
'tmp_sort_1',
'tmp_sort_2',
'event_session_code',
'event_session_name'
];
async function _process_generic_props<T extends Record<string, any>>({ obj_li, obj_type, log_lvl = 0, specific_processor }: { obj_li: T[]; obj_type: string; log_lvl?: number; specific_processor?: (obj: T) => Promise<T> | T; }): Promise<T[]> {
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (!obj_li || obj_li.length === 0) return [];
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
@@ -338,26 +637,48 @@ async function _process_generic_props<T extends Record<string, any>>({ obj_li, o
}
const randomIdKey = `${obj_type}_id_random`;
const baseIdKey = `${obj_type}_id`;
if (processed_obj[randomIdKey]) (processed_obj as any).id = processed_obj[randomIdKey];
else if (processed_obj[baseIdKey]) (processed_obj as any).id = processed_obj[baseIdKey];
if (processed_obj[randomIdKey])
(processed_obj as any).id = processed_obj[randomIdKey];
else if (processed_obj[baseIdKey])
(processed_obj as any).id = processed_obj[baseIdKey];
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on ?? new Date(0).toISOString();
const updated =
processed_obj.updated_on ??
processed_obj.created_on ??
new Date(0).toISOString();
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) processed_obj = await Promise.resolve(specific_processor(processed_obj));
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor)
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
export async function process_ae_obj__event_presentation_props({ obj_li, log_lvl = 0 }: { obj_li: any[]; log_lvl?: number; }) {
return _process_generic_props({ obj_li, obj_type: 'event_presentation', log_lvl, specific_processor: (obj) => {
// Ensure linking IDs are the string versions for indexing
if (obj.event_session_id_random) obj.event_session_id = obj.event_session_id_random;
if (obj.event_id_random) obj.event_id = obj.event_id_random;
return obj;
}});
}
export async function process_ae_obj__event_presentation_props({
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_presentation',
log_lvl,
specific_processor: (obj) => {
// Ensure linking IDs are the string versions for indexing
if (obj.event_session_id_random)
obj.event_session_id = obj.event_session_id_random;
if (obj.event_id_random) obj.event_id = obj.event_id_random;
return obj;
}
});
}

View File

@@ -29,7 +29,9 @@ export async function load_ae_obj_id__event_presenter({
log_lvl?: number;
}): Promise<ae_EventPresenter | null> {
if (log_lvl) {
console.log(`*** load_ae_obj_id__event_presenter() *** [V3] id=${event_presenter_id} (SWR)`);
console.log(
`*** load_ae_obj_id__event_presenter() *** [V3] id=${event_presenter_id} (SWR)`
);
}
// 1. FAST PATH: Cache hit
@@ -38,30 +40,71 @@ export async function load_ae_obj_id__event_presenter({
const cached = await db_events.presenter.get(event_presenter_id);
if (cached) {
// Background refresh (non-blocking)
_refresh_presenter_id_background({ api_cfg, event_presenter_id, view, try_cache, inc_file_li, log_lvl: 0 });
_refresh_presenter_id_background({
api_cfg,
event_presenter_id,
view,
try_cache,
inc_file_li,
log_lvl: 0
});
return cached;
}
} catch (e) {}
}
// 2. SLOW PATH: Wait for API
return await _refresh_presenter_id_background({ api_cfg, event_presenter_id, view, try_cache, inc_file_li, log_lvl });
return await _refresh_presenter_id_background({
api_cfg,
event_presenter_id,
view,
try_cache,
inc_file_li,
log_lvl
});
}
async function _refresh_presenter_id_background({ api_cfg, event_presenter_id, view, try_cache, inc_file_li, log_lvl }: any) {
async function _refresh_presenter_id_background({
api_cfg,
event_presenter_id,
view,
try_cache,
inc_file_li,
log_lvl
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_presenter', obj_id: event_presenter_id, view, log_lvl });
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_presenter',
obj_id: event_presenter_id,
view,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__event_presenter_props({
obj_li: [result],
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 });
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
if (inc_file_li) {
processed_obj.event_file_li = await load_ae_obj_li__event_file({
api_cfg, for_obj_type: 'event_presenter', for_obj_id: event_presenter_id,
enabled: 'all', limit: 25, try_cache: false, log_lvl
api_cfg,
for_obj_type: 'event_presenter',
for_obj_id: event_presenter_id,
enabled: 'all',
limit: 25,
try_cache: false,
log_lvl
});
}
return processed_obj;
@@ -104,7 +147,9 @@ export async function load_ae_obj_li__event_presenter({
log_lvl?: number;
}): Promise<ae_EventPresenter[]> {
if (log_lvl) {
console.log(`*** load_ae_obj_li__event_presenter() *** [V3] for=${for_obj_type}:${for_obj_id} (SWR)`);
console.log(
`*** load_ae_obj_li__event_presenter() *** [V3] for=${for_obj_type}:${for_obj_id} (SWR)`
);
}
// 1. FAST PATH: Check cache using specific indices
@@ -112,31 +157,94 @@ export async function load_ae_obj_li__event_presenter({
try {
let cached_li: any[] = [];
if (for_obj_type === 'event_presentation') {
cached_li = await db_events.presenter.where('event_presentation_id').equals(for_obj_id).toArray();
cached_li = await db_events.presenter
.where('event_presentation_id')
.equals(for_obj_id)
.toArray();
} else if (for_obj_type === 'event_session') {
cached_li = await db_events.presenter.where('event_session_id').equals(for_obj_id).toArray();
cached_li = await db_events.presenter
.where('event_session_id')
.equals(for_obj_id)
.toArray();
} else if (for_obj_type === 'event') {
cached_li = await db_events.presenter.where('event_id').equals(for_obj_id).toArray();
cached_li = await db_events.presenter
.where('event_id')
.equals(for_obj_id)
.toArray();
}
if (cached_li && cached_li.length > 0) {
// Background refresh (non-blocking)
_refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl: 0 });
_refresh_presenter_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl: 0
});
return cached_li;
}
} catch (e) {}
}
// 2. SLOW PATH: Wait for API
return await _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl });
return await _refresh_presenter_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
});
}
async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl }: any) {
async function _refresh_presenter_li_background({
api_cfg,
for_obj_type,
for_obj_id,
inc_file_li,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
const result_li = await api.get_ae_obj_li({ api_cfg, obj_type: 'event_presenter', for_obj_type, for_obj_id, enabled, hidden, view, limit, offset, order_by_li, log_lvl });
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_presenter',
for_obj_type,
for_obj_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_presenter_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_presenter_props({
obj_li: result_li,
log_lvl
});
// String-Only ID Vision: Ensure linking ID is set for indexing
processed.forEach((p) => {
@@ -155,7 +263,13 @@ async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj
});
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 });
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'presenter',
obj_li: processed,
properties_to_save,
log_lvl
});
// CRITICAL FIX (2026-02-26): Yield to microtask queue so Dexie liveQuery observers
// fire before we return. Without this, component-mounted liveQueries may subscribe
// to IDB *before* the write completes, causing empty results on cold-start.
@@ -164,10 +278,15 @@ async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj
// Background nested loads for refreshed items (FIRE AND FORGET)
if (inc_file_li) {
processed.forEach(p => {
processed.forEach((p) => {
load_ae_obj_li__event_file({
api_cfg, for_obj_type: 'event_presenter', for_obj_id: p.id,
enabled: 'all', limit: 25, try_cache: false, log_lvl: 0
api_cfg,
for_obj_type: 'event_presenter',
for_obj_id: p.id,
enabled: 'all',
limit: 25,
try_cache: false,
log_lvl: 0
});
});
}
@@ -180,128 +299,143 @@ async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj
// Updated 2026-01-20 to V3
export async function create_ae_obj__event_presenter({
api_cfg,
event_presentation_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_presentation_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_presentation_id?: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_presentation_id?: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventPresenter | null> {
if (!event_presentation_id) event_presentation_id = get(events_slct).event_presentation_id;
if (!event_presentation_id)
event_presentation_id = get(events_slct).event_presentation_id;
if (!event_presentation_id) {
console.error('create_ae_obj__event_presenter: event_presentation_id is required');
console.error(
'create_ae_obj__event_presenter: event_presentation_id is required'
);
return null;
}
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
obj_type: 'event_presenter',
fields: { ...data_kv },
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
obj_type: 'event_presenter',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], 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 null;
if (result) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: [result],
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 null;
}
// Updated 2026-01-20 to V3
export async function delete_ae_obj_id__event_presenter({
api_cfg,
event_presentation_id,
event_presenter_id,
method = 'delete',
try_cache = true,
log_lvl = 0
api_cfg,
event_presentation_id,
event_presenter_id,
method = 'delete',
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_presentation_id?: string;
event_presenter_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_presentation_id?: string;
event_presenter_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
}) {
if (!event_presentation_id) event_presentation_id = get(events_slct).event_presentation_id;
if (!event_presentation_id)
event_presentation_id = get(events_slct).event_presentation_id;
if (!event_presentation_id) {
console.error('delete_ae_obj_id__event_presenter: event_presentation_id is required');
console.error(
'delete_ae_obj_id__event_presenter: event_presentation_id is required'
);
return null;
}
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
obj_type: 'event_presenter',
obj_id: event_presenter_id,
method,
log_lvl
});
if (try_cache) await db_events.presenter.delete(event_presenter_id);
return result;
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
obj_type: 'event_presenter',
obj_id: event_presenter_id,
method,
log_lvl
});
if (try_cache) await db_events.presenter.delete(event_presenter_id);
return result;
}
// Updated 2026-01-20 to V3
export async function update_ae_obj__event_presenter({
api_cfg,
event_presentation_id,
event_presenter_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_presentation_id,
event_presenter_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_presentation_id?: string;
event_presenter_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_presentation_id?: string;
event_presenter_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventPresenter | null> {
if (!event_presentation_id) event_presentation_id = get(events_slct).event_presentation_id;
if (!event_presentation_id)
event_presentation_id = get(events_slct).event_presentation_id;
if (!event_presentation_id) {
console.error('update_ae_obj__event_presenter: event_presentation_id is required');
console.error(
'update_ae_obj__event_presenter: event_presentation_id is required'
);
return null;
}
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
obj_type: 'event_presenter',
obj_id: event_presenter_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], 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 null;
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
obj_type: 'event_presenter',
obj_id: event_presenter_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_presenter_props({
obj_li: [result],
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 null;
}
// Updated 2026-01-21 to Restore Full Aether Search Logic
@@ -320,7 +454,11 @@ export async function search__event_presenter({
view = 'default',
limit = 25,
offset = 0,
order_by_li = [{ sort: 'ASC' }, { given_name: 'ASC' }, { family_name: 'ASC' }],
order_by_li = [
{ sort: 'ASC' },
{ given_name: 'ASC' },
{ family_name: 'ASC' }
],
try_cache = true,
log_lvl = 0
}: {
@@ -342,29 +480,71 @@ export async function search__event_presenter({
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventPresenter[]> {
const search_query: any = { q: '', and: [{ field: 'event_id', op: 'eq', value: event_id }] };
const search_query: any = {
q: '',
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
const params: key_val = {};
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2)
params['ft_qry'] = { default_qry_str: fulltext_search_qry_str };
if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2)
params['ft_qry'] = { ...params['ft_qry'], event_presenter_li_qry_str: ft_presenter_search_qry_str };
if (like_search_qry_str) params['lk_qry'] = { default_qry_str: like_search_qry_str };
params['ft_qry'] = {
...params['ft_qry'],
event_presenter_li_qry_str: ft_presenter_search_qry_str
};
if (like_search_qry_str)
params['lk_qry'] = { default_qry_str: like_search_qry_str };
if (like_presentation_search_qry_str)
params['lk_qry'] = { ...params['lk_qry'], event_presentation_li_qry_str: like_presentation_search_qry_str };
params['lk_qry'] = {
...params['lk_qry'],
event_presentation_li_qry_str: like_presentation_search_qry_str
};
if (like_presenter_search_qry_str)
params['lk_qry'] = { ...params['lk_qry'], event_presenter_li_qry_str: like_presenter_search_qry_str };
if (agree !== null) search_query.and.push({ field: 'agree', op: 'eq', value: agree ? 1 : 0 });
if (biography === true) search_query.and.push({ field: 'biography', op: 'ne', value: '' });
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
params['lk_qry'] = {
...params['lk_qry'],
event_presenter_li_qry_str: like_presenter_search_qry_str
};
if (agree !== null)
search_query.and.push({
field: 'agree',
op: 'eq',
value: agree ? 1 : 0
});
if (biography === true)
search_query.and.push({ field: 'biography', op: 'ne', value: '' });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
const result_li = await api.search_ae_obj({ api_cfg, obj_type: 'event_presenter', search_query, order_by_li, params, view, limit, offset, log_lvl });
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_presenter',
search_query,
order_by_li,
params,
view,
limit,
offset,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_presenter_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_presenter_props({
obj_li: result_li,
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 });
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;
}
@@ -400,8 +580,16 @@ export async function email_sign_in__event_presenter({
session_name?: string | null;
presentation_name?: string | null;
}) {
if (!to_email || !person_id || !person_passcode || !event_id || !event_presenter_id) {
console.error('Missing required parameters for email_sign_in__event_presenter');
if (
!to_email ||
!person_id ||
!person_passcode ||
!event_id ||
!event_presenter_id
) {
console.error(
'Missing required parameters for email_sign_in__event_presenter'
);
return null;
}
const subject = `Pres Mgmt Hub Sign In Link for Presenter: ${to_name ?? 'Presenter'}`;
@@ -420,10 +608,75 @@ export async function email_sign_in__event_presenter({
}
export const properties_to_save = [
'id', 'event_presenter_id', 'event_presenter_id_random', 'external_id', 'code', 'event_id', 'event_session_id', 'event_presentation_id', 'event_person_id', 'person_id', 'person_profile_id', 'person_id_random', 'person_profile_id_random', 'pronouns', 'informal_name', 'title_names', 'given_name', 'middle_name', 'family_name', 'designations', 'professional_title', 'full_name', 'affiliations', 'email', 'biography', 'agree', 'comments', 'passcode', 'hide_event_launcher', 'data_json', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on', 'tmp_sort_1', 'tmp_sort_2', 'file_count', 'event_session_code', 'event_session_name', 'event_session_start_datetime', 'event_presentation_code', 'event_presentation_name', 'event_presentation_start_datetime', 'person_external_id', 'person_external_sys_id', 'person_given_name', 'person_family_name', 'person_full_name', 'person_professional_title', 'person_affiliations', 'person_primary_email', 'person_passcode'
'id',
'event_presenter_id',
'event_presenter_id_random',
'external_id',
'code',
'event_id',
'event_session_id',
'event_presentation_id',
'event_person_id',
'person_id',
'person_profile_id',
'person_id_random',
'person_profile_id_random',
'pronouns',
'informal_name',
'title_names',
'given_name',
'middle_name',
'family_name',
'designations',
'professional_title',
'full_name',
'affiliations',
'email',
'biography',
'agree',
'comments',
'passcode',
'hide_event_launcher',
'data_json',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
'tmp_sort_1',
'tmp_sort_2',
'file_count',
'event_session_code',
'event_session_name',
'event_session_start_datetime',
'event_presentation_code',
'event_presentation_name',
'event_presentation_start_datetime',
'person_external_id',
'person_external_sys_id',
'person_given_name',
'person_family_name',
'person_full_name',
'person_professional_title',
'person_affiliations',
'person_primary_email',
'person_passcode'
];
async function _process_generic_props<T extends Record<string, any>>({ obj_li, obj_type, log_lvl = 0, specific_processor }: { obj_li: T[]; obj_type: string; log_lvl?: number; specific_processor?: (obj: T) => Promise<T> | T; }): Promise<T[]> {
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (!obj_li || obj_li.length === 0) return [];
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
@@ -439,28 +692,50 @@ async function _process_generic_props<T extends Record<string, any>>({ obj_li, o
if (processed_obj[randomIdKey]) {
(processed_obj as any).id = processed_obj[randomIdKey];
(processed_obj as any)[baseIdKey] = processed_obj[randomIdKey];
}
else if (processed_obj[baseIdKey]) (processed_obj as any).id = processed_obj[baseIdKey];
} else if (processed_obj[baseIdKey])
(processed_obj as any).id = processed_obj[baseIdKey];
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on ?? new Date(0).toISOString();
const updated =
processed_obj.updated_on ??
processed_obj.created_on ??
new Date(0).toISOString();
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) processed_obj = await Promise.resolve(specific_processor(processed_obj));
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor)
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
export async function process_ae_obj__event_presenter_props({ obj_li, log_lvl = 0 }: { obj_li: any[]; log_lvl?: number; }) {
return _process_generic_props({ obj_li, obj_type: 'event_presenter', log_lvl, specific_processor: (obj) => {
// String-Only ID Vision: Ensure linking IDs are the string versions for indexing
if (obj.event_presenter_id_random) obj.event_presenter_id = obj.event_presenter_id_random;
if (obj.event_presentation_id_random) obj.event_presentation_id = obj.event_presentation_id_random;
if (obj.event_session_id_random) obj.event_session_id = obj.event_session_id_random;
if (obj.event_id_random) obj.event_id = obj.event_id_random;
return obj;
}});
export async function process_ae_obj__event_presenter_props({
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_presenter',
log_lvl,
specific_processor: (obj) => {
// String-Only ID Vision: Ensure linking IDs are the string versions for indexing
if (obj.event_presenter_id_random)
obj.event_presenter_id = obj.event_presenter_id_random;
if (obj.event_presentation_id_random)
obj.event_presentation_id = obj.event_presentation_id_random;
if (obj.event_session_id_random)
obj.event_session_id = obj.event_session_id_random;
if (obj.event_id_random) obj.event_id = obj.event_id_random;
return obj;
}
});
}

View File

@@ -44,7 +44,9 @@ export async function load_ae_obj_id__event_session({
}): Promise<ae_EventSession | null> {
const start_time = performance.now();
if (log_lvl) {
console.log(`🔎 [Trace] load_ae_obj_id__event_session: START (id=${event_session_id}, try_cache=${try_cache})`);
console.log(
`🔎 [Trace] load_ae_obj_id__event_session: START (id=${event_session_id}, try_cache=${try_cache})`
);
}
// Hierarchy Enforcement: Pulling presenters requires pulling presentations first
@@ -56,65 +58,167 @@ export async function load_ae_obj_id__event_session({
const cached = await db_events.session.get(event_session_id);
if (cached) {
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`✅ [Trace] load_ae_obj_id: CACHE HIT at ${elapsed}ms. Returning stale shell for id=${event_session_id}`);
if (log_lvl)
console.log(
`✅ [Trace] load_ae_obj_id: CACHE HIT at ${elapsed}ms. Returning stale shell for id=${event_session_id}`
);
// Background tasks: refresh parent and warm child caches (non-blocking)
_refresh_session_id_background({
api_cfg, event_session_id, view, try_cache,
inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li,
enabled, hidden, limit, offset, log_lvl: log_lvl > 1 ? log_lvl : 0
api_cfg,
event_session_id,
view,
try_cache,
inc_file_li,
inc_all_file_li,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
// In SWR mode, we fire child loads in background to warm IDB for the view's LiveQueries
_handle_nested_loads(cached, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl: 0 });
_handle_nested_loads(cached, {
api_cfg,
inc_file_li,
inc_all_file_li,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
try_cache,
log_lvl: 0
});
return cached; // Return immediately without awaiting nested loads
} else if (log_lvl) {
console.log(`⏳ [Trace] load_ae_obj_id: CACHE MISS at ${(performance.now() - start_time).toFixed(2)}ms for id=${event_session_id}`);
console.log(
`⏳ [Trace] load_ae_obj_id: CACHE MISS at ${(performance.now() - start_time).toFixed(2)}ms for id=${event_session_id}`
);
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] load_ae_obj_id: Cache access error:`, e);
if (log_lvl)
console.error(
`❌ [Trace] load_ae_obj_id: Cache access error:`,
e
);
}
}
// 2. SLOW PATH: Wait for API
if (log_lvl) console.log(`🚀 [Trace] load_ae_obj_id: Proceeding to API path for id=${event_session_id}`);
return await _refresh_session_id_background({ api_cfg, event_session_id, view, try_cache, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, log_lvl });
if (log_lvl)
console.log(
`🚀 [Trace] load_ae_obj_id: Proceeding to API path for id=${event_session_id}`
);
return await _refresh_session_id_background({
api_cfg,
event_session_id,
view,
try_cache,
inc_file_li,
inc_all_file_li,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
log_lvl
});
}
/**
* Internal background refresh for a single session
*/
async function _refresh_session_id_background({ api_cfg, event_session_id, view, try_cache, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, log_lvl }: any) {
async function _refresh_session_id_background({
api_cfg,
event_session_id,
view,
try_cache,
inc_file_li,
inc_all_file_li,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
log_lvl
}: any) {
const start_time = performance.now();
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
if (log_lvl) console.log(`📡 [Trace] _refresh_session_id: API Fetching id=${event_session_id}`);
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_session', obj_id: event_session_id, view, log_lvl });
if (log_lvl)
console.log(
`📡 [Trace] _refresh_session_id: API Fetching id=${event_session_id}`
);
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_session',
obj_id: event_session_id,
view,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_session_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`📦 [Trace] _refresh_session_id: Received from API at ${elapsed}ms (id=${processed_obj.id})`);
if (log_lvl)
console.log(
`📦 [Trace] _refresh_session_id: Received from API at ${elapsed}ms (id=${processed_obj.id})`
);
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 });
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
// CRITICAL FIX (2026-02-26): Yield to microtask queue so Dexie liveQuery observers
// fire before we return. Without this, component-mounted liveQueries may subscribe
// to IDB *before* the write completes, causing empty results on cold-start.
await Promise.resolve();
if (log_lvl) console.log(`💾 [Trace] _refresh_session_id: Saved to IDB cache.`);
if (log_lvl)
console.log(
`💾 [Trace] _refresh_session_id: Saved to IDB cache.`
);
}
// CRITICAL FIX (2026-02-26): Preserve parent's try_cache value when loading nested data.
// Previously set to `false`, which meant presentations/presenters were fetched from API
// but NEVER written to IndexedDB, causing "refresh twice" bug on cold-start.
// Now nested loads inherit parent's caching behavior for deterministic first-render.
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 });
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) {
if (log_lvl) console.error(`❌ [Trace] _refresh_session_id: API error for id=${event_session_id}:`, e);
if (log_lvl)
console.error(
`❌ [Trace] _refresh_session_id: API error for id=${event_session_id}:`,
e
);
}
return null;
}
@@ -122,29 +226,65 @@ 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) {
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 start_time = performance.now();
const current_session_id = session_obj.id || session_obj.event_session_id;
if (!current_session_id) return session_obj;
const tasks = [];
if (inc_file_li) {
tasks.push(load_ae_obj_li__event_file({
api_cfg, for_obj_type: 'event_session', for_obj_id: current_session_id,
enabled, limit: 15, try_cache, log_lvl
}).then(res => session_obj.event_file_li = res));
tasks.push(
load_ae_obj_li__event_file({
api_cfg,
for_obj_type: 'event_session',
for_obj_id: current_session_id,
enabled,
limit: 15,
try_cache,
log_lvl
}).then((res) => (session_obj.event_file_li = res))
);
}
if (inc_presentation_li) {
tasks.push(load_ae_obj_li__event_presentation({
api_cfg, for_obj_type: 'event_session', for_obj_id: current_session_id,
inc_file_li: inc_all_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl
}).then(res => session_obj.event_presentation_li = res));
tasks.push(
load_ae_obj_li__event_presentation({
api_cfg,
for_obj_type: 'event_session',
for_obj_id: current_session_id,
inc_file_li: inc_all_file_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
try_cache,
log_lvl
}).then((res) => (session_obj.event_presentation_li = res))
);
}
if (tasks.length > 0) {
await Promise.all(tasks);
if (log_lvl) console.log(`🔗 [Trace] _handle_nested_loads: Finished child collections in ${(performance.now() - start_time).toFixed(2)}ms`);
if (log_lvl)
console.log(
`🔗 [Trace] _handle_nested_loads: Finished child collections in ${(performance.now() - start_time).toFixed(2)}ms`
);
}
return session_obj;
}
@@ -191,7 +331,9 @@ export async function load_ae_obj_li__event_session({
}): Promise<ae_EventSession[]> {
const start_time = performance.now();
if (log_lvl) {
console.log(`🔎 [Trace] load_ae_obj_li__event_session: START (for=${for_obj_type}:${for_obj_id}, try_cache=${try_cache})`);
console.log(
`🔎 [Trace] load_ae_obj_li__event_session: START (for=${for_obj_type}:${for_obj_id}, try_cache=${try_cache})`
);
}
// Hierarchy Enforcement: Pulling presenters requires pulling presentations first
@@ -201,226 +343,409 @@ export async function load_ae_obj_li__event_session({
try {
// Robust lookup logic
let query;
if (for_obj_type === 'event_location') query = db_events.session.where('event_location_id').equals(for_obj_id);
else if (for_obj_type === 'event') query = db_events.session.where('event_id').equals(for_obj_id);
if (for_obj_type === 'event_location')
query = db_events.session
.where('event_location_id')
.equals(for_obj_id);
else if (for_obj_type === 'event')
query = db_events.session.where('event_id').equals(for_obj_id);
else query = db_events.session.where('for_id').equals(for_obj_id);
const cached_li = await query.toArray();
if (cached_li && cached_li.length > 0) {
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`✅ [Trace] load_ae_obj_li: CACHE HIT at ${elapsed}ms (${cached_li.length} items).`);
if (log_lvl)
console.log(
`✅ [Trace] load_ae_obj_li: CACHE HIT at ${elapsed}ms (${cached_li.length} items).`
);
// Background refresh (non-blocking)
_refresh_session_li_background({
api_cfg, for_obj_type, for_obj_id, view,
api_cfg,
for_obj_type,
for_obj_id,
view,
// Optimization: Disable nested loads for list members to prevent request storms
inc_file_li: false, inc_all_file_li: false, inc_presentation_li: false, inc_presenter_li: false,
enabled, hidden, limit, offset, order_by_li, try_cache,
inc_file_li: false,
inc_all_file_li: false,
inc_presentation_li: false,
inc_presenter_li: false,
enabled,
hidden,
limit,
offset,
order_by_li,
try_cache,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
return cached_li;
} else if (log_lvl) {
console.log(`⏳ [Trace] load_ae_obj_li: CACHE MISS at ${(performance.now() - start_time).toFixed(2)}ms for type=${for_obj_type} id=${for_obj_id}`);
console.log(
`⏳ [Trace] load_ae_obj_li: CACHE MISS at ${(performance.now() - start_time).toFixed(2)}ms for type=${for_obj_type} id=${for_obj_id}`
);
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] load_ae_obj_li: Cache access error:`, e);
if (log_lvl)
console.error(
`❌ [Trace] load_ae_obj_li: Cache access error:`,
e
);
}
}
return await _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_id, view, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, order_by_li, try_cache, log_lvl });
return await _refresh_session_li_background({
api_cfg,
for_obj_type,
for_obj_id,
view,
inc_file_li,
inc_all_file_li,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
order_by_li,
try_cache,
log_lvl
});
}
async function _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_id, view, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, order_by_li, try_cache, log_lvl }: any) {
async function _refresh_session_li_background({
api_cfg,
for_obj_type,
for_obj_id,
view,
inc_file_li,
inc_all_file_li,
inc_presentation_li,
inc_presenter_li,
enabled,
hidden,
limit,
offset,
order_by_li,
try_cache,
log_lvl
}: any) {
const start_time = performance.now();
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
if (log_lvl) console.log(`📡 [Trace] _refresh_session_li: API Fetching for=${for_obj_type}:${for_obj_id} (view=${view})`);
const result_li = await api.get_ae_obj_li({ api_cfg, obj_type: 'event_session', for_obj_type, for_obj_id, view, enabled, hidden, limit, offset, order_by_li, log_lvl });
if (log_lvl)
console.log(
`📡 [Trace] _refresh_session_li: API Fetching for=${for_obj_type}:${for_obj_id} (view=${view})`
);
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_session',
for_obj_type,
for_obj_id,
view,
enabled,
hidden,
limit,
offset,
order_by_li,
log_lvl
});
if (result_li) {
const processed = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__event_session_props({
obj_li: result_li,
log_lvl
});
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`📦 [Trace] _refresh_session_li: Received ${processed.length} items from API at ${elapsed}ms.`);
if (log_lvl)
console.log(
`📦 [Trace] _refresh_session_li: Received ${processed.length} items from API at ${elapsed}ms.`
);
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 });
if (log_lvl) console.log(`💾 [Trace] _refresh_session_li: Saved to IDB cache.`);
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: processed,
properties_to_save,
log_lvl
});
if (log_lvl)
console.log(
`💾 [Trace] _refresh_session_li: Saved to IDB cache.`
);
}
// Fire nested loads for each session only if explicitly requested (usually only for single objects)
if (inc_file_li || inc_presentation_li) {
processed.forEach(s => {
_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: 0 });
processed.forEach((s) => {
_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: 0
});
});
}
return processed;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] _refresh_session_li: API error:`, e);
if (log_lvl)
console.error(`❌ [Trace] _refresh_session_li: API error:`, e);
}
return [];
}
export async function create_ae_obj__event_session({
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id?: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id?: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventSession | null> {
if (!event_id) event_id = get(slct).event_id;
if (!event_id) {
console.error('create_ae_obj__event_session: event_id is required');
return null;
}
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_session',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_session_props({ obj_li: [result], 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 null;
const result = await api.create_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_session',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
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 null;
}
export async function delete_ae_obj_id__event_session({
api_cfg,
event_id,
event_session_id,
method = 'delete',
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_session_id,
method = 'delete',
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id?: string;
event_session_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id?: string;
event_session_id: string;
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
try_cache?: boolean;
log_lvl?: number;
}) {
if (!event_id) event_id = get(slct).event_id;
if (!event_id) {
console.error('delete_ae_obj_id__event_session: event_id is required');
return null;
}
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_session',
obj_id: event_session_id,
method,
log_lvl
});
if (try_cache) await db_events.session.delete(event_session_id);
return result;
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_session',
obj_id: event_session_id,
method,
log_lvl
});
if (try_cache) await db_events.session.delete(event_session_id);
return result;
}
export async function update_ae_obj__event_session({
api_cfg,
event_id,
event_session_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
event_session_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id?: string;
event_session_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id?: string;
event_session_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventSession | null> {
if (!event_id) event_id = get(slct).event_id;
if (!event_id) {
console.error('update_ae_obj__event_session: event_id is required');
return null;
}
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_session',
obj_id: event_session_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_session_props({ obj_li: [result], 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 null;
const result = await api.update_nested_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
obj_type: 'event_session',
obj_id: event_session_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
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 null;
}
export async function search__event_session({
api_cfg, event_id, fulltext_search_qry_str = '', ft_presenter_search_qry_str = '', like_search_qry_str = '', like_presentation_search_qry_str = '', like_presenter_search_qry_str = '', like_poc_name_qry_str = '', location_name = null, qry_files = null, qry_poc_agree = null, qry_poc_kv_json = null, qry_start_datetime = null, enabled = 'enabled', hidden = 'not_hidden', view = 'default', limit = 50, offset = 0, order_by_li = [{ sort: 'ASC' }, { start_datetime: 'ASC' }, { name: 'ASC' }], try_cache = true, log_lvl = 0
api_cfg,
event_id,
fulltext_search_qry_str = '',
ft_presenter_search_qry_str = '',
like_search_qry_str = '',
like_presentation_search_qry_str = '',
like_presenter_search_qry_str = '',
like_poc_name_qry_str = '',
location_name = null,
qry_files = null,
qry_poc_agree = null,
qry_poc_kv_json = null,
qry_start_datetime = null,
enabled = 'enabled',
hidden = 'not_hidden',
view = 'default',
limit = 50,
offset = 0,
order_by_li = [{ sort: 'ASC' }, { start_datetime: 'ASC' }, { name: 'ASC' }],
try_cache = true,
log_lvl = 0
}: {
api_cfg: any; event_id: string; fulltext_search_qry_str?: string; ft_presenter_search_qry_str?: string | null; like_search_qry_str?: string; like_presentation_search_qry_str?: string; like_presenter_search_qry_str?: string; like_poc_name_qry_str?: string; location_name?: null | string; qry_files?: null | boolean; qry_poc_agree?: null | boolean; qry_poc_kv_json?: null | boolean; qry_start_datetime?: string | null; enabled?: 'enabled' | 'all' | 'not_enabled'; hidden?: 'hidden' | 'all' | 'not_hidden'; view?: string; limit?: number; offset?: number; order_by_li?: any; try_cache?: boolean; log_lvl?: number;
api_cfg: any;
event_id: string;
fulltext_search_qry_str?: string;
ft_presenter_search_qry_str?: string | null;
like_search_qry_str?: string;
like_presentation_search_qry_str?: string;
like_presenter_search_qry_str?: string;
like_poc_name_qry_str?: string;
location_name?: null | string;
qry_files?: null | boolean;
qry_poc_agree?: null | boolean;
qry_poc_kv_json?: null | boolean;
qry_start_datetime?: string | null;
enabled?: 'enabled' | 'all' | 'not_enabled';
hidden?: 'hidden' | 'all' | 'not_hidden';
view?: string;
limit?: number;
offset?: number;
order_by_li?: any;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventSession[]> {
const search_query: any = { q: '', and: [{ field: 'event_id', op: 'eq', value: event_id }] };
const search_query: any = {
q: '',
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
if (fulltext_search_qry_str || ft_presenter_search_qry_str) {
const ft: any = {};
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) ft['default_qry_str'] = fulltext_search_qry_str;
if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) ft['event_presenter_li_qry_str'] = ft_presenter_search_qry_str;
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2)
ft['default_qry_str'] = fulltext_search_qry_str;
if (
ft_presenter_search_qry_str &&
ft_presenter_search_qry_str.length > 2
)
ft['event_presenter_li_qry_str'] = ft_presenter_search_qry_str;
if (Object.keys(ft).length) search_query.params = { ft_qry: ft };
}
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
if (location_name) {
search_query.and.push({ field: 'event_location_name', op: 'eq', value: location_name });
search_query.and.push({
field: 'event_location_name',
op: 'eq',
value: location_name
});
}
const result_li = await api.search_ae_obj({ api_cfg, obj_type: 'event_session', search_query, order_by_li, view, limit, offset, log_lvl });
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_session',
search_query,
order_by_li,
view,
limit,
offset,
log_lvl
});
// Handle V3 API envelope
let valid_result_li: ae_EventSession[] = [];
if (Array.isArray(result_li)) {
valid_result_li = result_li;
} else if (result_li && typeof result_li === 'object' && Array.isArray((result_li as any).data)) {
} else if (
result_li &&
typeof result_li === 'object' &&
Array.isArray((result_li as any).data)
) {
valid_result_li = (result_li as any).data;
}
if (valid_result_li && valid_result_li.length > 0) {
const processed = await process_ae_obj__event_session_props({ obj_li: valid_result_li, log_lvl });
const processed = await process_ae_obj__event_session_props({
obj_li: valid_result_li,
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 });
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;
}
@@ -429,18 +754,103 @@ export async function search__event_session({
export const qry__event_session = search__event_session;
export async function email_sign_in__event_session({ api_cfg, to_email, to_name, base_url, person_id, person_passcode, event_id, event_session_id, session_name }: { api_cfg: any; to_email: string; to_name: string; base_url: string; person_id: string; person_passcode: string; event_id: string; event_session_id: string; session_name: string; }) {
export async function email_sign_in__event_session({
api_cfg,
to_email,
to_name,
base_url,
person_id,
person_passcode,
event_id,
event_session_id,
session_name
}: {
api_cfg: any;
to_email: string;
to_name: string;
base_url: string;
person_id: string;
person_passcode: string;
event_id: string;
event_session_id: string;
session_name: string;
}) {
const subject = `Pres Mgmt Hub Sign In Link for ${session_name}`;
const sign_in_url = encodeURI(`${base_url}/events/${event_id}/session/${event_session_id}?person_id=${person_id}&person_pass=${person_passcode}`);
const sign_in_url = encodeURI(
`${base_url}/events/${event_id}/session/${event_session_id}?person_id=${person_id}&person_pass=${person_passcode}`
);
const body_html = `<div>${to_name},<p>Your sign-in link for ${session_name}: <a href="${sign_in_url}">${sign_in_url}</a></p></div>`;
return await api.send_email({ api_cfg, from_email: 'noreply+presmgmt@oneskyit.com', from_name: 'Aether Pres Mgmt', to_email, subject, body_html });
return await api.send_email({
api_cfg,
from_email: 'noreply+presmgmt@oneskyit.com',
from_name: 'Aether Pres Mgmt',
to_email,
subject,
body_html
});
}
export const properties_to_save = [
'id', 'event_session_id', 'event_session_id_random', 'external_id', 'code', 'for_type', 'for_id', 'for_id_random', 'type_code', 'event_id', 'event_location_id', 'poc_person_id', 'poc_agree', 'poc_kv_json', 'name', 'description', 'start_datetime', 'end_datetime', 'passcode', 'hide_event_launcher', 'alert', 'alert_msg', 'data_json', 'ux_mode', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on', 'tmp_sort_1', 'tmp_sort_2', 'file_count', 'file_count_all', 'internal_use_count', 'event_file_id_li_json', 'poc_person_given_name', 'poc_person_family_name', 'poc_person_full_name', 'poc_person_primary_email', 'poc_person_passcode', 'event_name', 'event_location_code', 'event_location_name', 'event_presentation_li'
'id',
'event_session_id',
'event_session_id_random',
'external_id',
'code',
'for_type',
'for_id',
'for_id_random',
'type_code',
'event_id',
'event_location_id',
'poc_person_id',
'poc_agree',
'poc_kv_json',
'name',
'description',
'start_datetime',
'end_datetime',
'passcode',
'hide_event_launcher',
'alert',
'alert_msg',
'data_json',
'ux_mode',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
'tmp_sort_1',
'tmp_sort_2',
'file_count',
'file_count_all',
'internal_use_count',
'event_file_id_li_json',
'poc_person_given_name',
'poc_person_family_name',
'poc_person_full_name',
'poc_person_primary_email',
'poc_person_passcode',
'event_name',
'event_location_code',
'event_location_name',
'event_presentation_li'
];
async function _process_generic_props<T extends Record<string, any>>({ obj_li, obj_type, log_lvl = 0, specific_processor }: { obj_li: T[]; obj_type: string; log_lvl?: number; specific_processor?: (obj: T) => Promise<T> | T; }): Promise<T[]> {
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (!obj_li || obj_li.length === 0) return [];
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
@@ -456,22 +866,40 @@ async function _process_generic_props<T extends Record<string, any>>({ obj_li, o
if (processed_obj[randomIdKey]) {
(processed_obj as any).id = processed_obj[randomIdKey];
(processed_obj as any)[baseIdKey] = processed_obj[randomIdKey];
}
else if (processed_obj[baseIdKey]) (processed_obj as any).id = processed_obj[baseIdKey];
} else if (processed_obj[baseIdKey])
(processed_obj as any).id = processed_obj[baseIdKey];
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on ?? new Date(0).toISOString();
const updated =
processed_obj.updated_on ??
processed_obj.created_on ??
new Date(0).toISOString();
const name = processed_obj.name ?? '';
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) processed_obj = await Promise.resolve(specific_processor(processed_obj));
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor)
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
export async function process_ae_obj__event_session_props({ obj_li, log_lvl = 0 }: { obj_li: any[]; log_lvl?: number; }) {
return _process_generic_props({ obj_li, obj_type: 'event_session', log_lvl });
}
export async function process_ae_obj__event_session_props({
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_session',
log_lvl
});
}

View File

@@ -24,4 +24,4 @@ export async function load_ae_obj_li__event_track({
view,
log_lvl
});
}
}

View File

@@ -17,4 +17,4 @@ export const editable_fields__event_exhibit = [
'sort',
'group',
'notes'
];
];

View File

@@ -92,11 +92,15 @@ async function _process_generic_props<T extends Record<string, any>>({
(processed_obj as any).description = '';
}
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
}
processed_obj_li.push(processed_obj as T);
@@ -137,7 +141,9 @@ export async function load_ae_obj_id__event_exhibit({
}): Promise<ae_EventExhibit | null> {
const start_time = performance.now();
if (log_lvl) {
console.log(`🔎 [Trace] load_ae_obj_id__event_exhibit: START (id=${exhibit_id}, try_cache=${try_cache})`);
console.log(
`🔎 [Trace] load_ae_obj_id__event_exhibit: START (id=${exhibit_id}, try_cache=${try_cache})`
);
}
// 1. FAST PATH: Return cached data immediately
@@ -146,34 +152,74 @@ export async function load_ae_obj_id__event_exhibit({
const cached = await db_events.exhibit.get(exhibit_id);
if (cached) {
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`✅ [Trace] load_ae_obj_id: CACHE HIT at ${elapsed}ms. Returning stale exhibit shell.`);
if (log_lvl)
console.log(
`✅ [Trace] load_ae_obj_id: CACHE HIT at ${elapsed}ms. Returning stale exhibit shell.`
);
// Background refresh (non-blocking)
_refresh_exhibit_id_background({ api_cfg, exhibit_id, view, try_cache, log_lvl: log_lvl > 1 ? log_lvl : 0 });
_refresh_exhibit_id_background({
api_cfg,
exhibit_id,
view,
try_cache,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
return cached;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] load_ae_obj_id: Cache access error:`, e);
if (log_lvl)
console.error(
`❌ [Trace] load_ae_obj_id: Cache access error:`,
e
);
}
}
// 2. SLOW PATH: Wait for API
return await _refresh_exhibit_id_background({ api_cfg, exhibit_id, view, try_cache, log_lvl });
return await _refresh_exhibit_id_background({
api_cfg,
exhibit_id,
view,
try_cache,
log_lvl
});
}
async function _refresh_exhibit_id_background({ api_cfg, exhibit_id, view, try_cache, log_lvl }: any) {
async function _refresh_exhibit_id_background({
api_cfg,
exhibit_id,
view,
try_cache,
log_lvl
}: any) {
const start_time = performance.now();
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
if (log_lvl) console.log(`📡 [Trace] _refresh_exhibit_id: API Fetching id=${exhibit_id}`);
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_exhibit', obj_id: exhibit_id, view, log_lvl });
if (log_lvl)
console.log(
`📡 [Trace] _refresh_exhibit_id: API Fetching id=${exhibit_id}`
);
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_exhibit',
obj_id: exhibit_id,
view,
log_lvl
});
if (result) {
const processed = await process_ae_obj__exhibit_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__exhibit_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`📦 [Trace] _refresh_exhibit_id: Received from API at ${elapsed}ms`);
if (log_lvl)
console.log(
`📦 [Trace] _refresh_exhibit_id: Received from API at ${elapsed}ms`
);
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
@@ -187,7 +233,11 @@ async function _refresh_exhibit_id_background({ api_cfg, exhibit_id, view, try_c
return processed_obj;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] _refresh_exhibit_id: API error for id=${exhibit_id}:`, e);
if (log_lvl)
console.error(
`❌ [Trace] _refresh_exhibit_id: API error for id=${exhibit_id}:`,
e
);
}
return null;
}
@@ -225,36 +275,82 @@ export async function load_ae_obj_li__event_exhibit({
}): Promise<ae_EventExhibit[]> {
const start_time = performance.now();
if (log_lvl) {
console.log(`🔎 [Trace] load_ae_obj_li__event_exhibit: START (event=${event_id}, try_cache=${try_cache})`);
console.log(
`🔎 [Trace] load_ae_obj_li__event_exhibit: START (event=${event_id}, try_cache=${try_cache})`
);
}
if (try_cache) {
try {
const cached_li = await db_events.exhibit
.where('event_id').equals(event_id)
.where('event_id')
.equals(event_id)
.toArray();
if (cached_li && cached_li.length > 0) {
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`✅ [Trace] load_ae_obj_li: CACHE HIT at ${elapsed}ms (${cached_li.length} items).`);
if (log_lvl)
console.log(
`✅ [Trace] load_ae_obj_li: CACHE HIT at ${elapsed}ms (${cached_li.length} items).`
);
// Background refresh (non-blocking)
_refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl: log_lvl > 1 ? log_lvl : 0 });
_refresh_exhibit_li_background({
api_cfg,
event_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
return cached_li;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] load_ae_obj_li: Cache access error:`, e);
if (log_lvl)
console.error(
`❌ [Trace] load_ae_obj_li: Cache access error:`,
e
);
}
}
return await _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl });
return await _refresh_exhibit_li_background({
api_cfg,
event_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
});
}
async function _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl }: any) {
async function _refresh_exhibit_li_background({
api_cfg,
event_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
}: any) {
const start_time = performance.now();
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
if (log_lvl) console.log(`📡 [Trace] _refresh_exhibit_li: API Fetching exhibits for event=${event_id}`);
if (log_lvl)
console.log(
`📡 [Trace] _refresh_exhibit_li: API Fetching exhibits for event=${event_id}`
);
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_exhibit',
@@ -270,9 +366,15 @@ async function _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidd
});
if (result_li) {
const processed = await process_ae_obj__exhibit_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__exhibit_props({
obj_li: result_li,
log_lvl
});
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`📦 [Trace] _refresh_exhibit_li: Received ${processed.length} items from API at ${elapsed}ms.`);
if (log_lvl)
console.log(
`📦 [Trace] _refresh_exhibit_li: Received ${processed.length} items from API at ${elapsed}ms.`
);
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
@@ -286,7 +388,8 @@ async function _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidd
return processed;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] _refresh_exhibit_li: API error:`, e);
if (log_lvl)
console.error(`❌ [Trace] _refresh_exhibit_li: API error:`, e);
}
return [];
}
@@ -295,87 +398,93 @@ async function _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidd
* Exhibit Create (V3)
*/
export async function create_ae_obj__exhibit({
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventExhibit | null> {
const result = await api.create_nested_obj({
api_cfg,
parent_type: 'event',
parent_id: event_id,
child_type: 'event_exhibit',
fields: { ...data_kv },
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
parent_type: 'event',
parent_id: event_id,
child_type: 'event_exhibit',
fields: { ...data_kv },
log_lvl
});
if (result) {
const processed = await process_ae_obj__exhibit_props({ obj_li: [result], log_lvl });
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit,
log_lvl
});
}
return processed_obj;
}
return null;
if (result) {
const processed = await process_ae_obj__exhibit_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit,
log_lvl
});
}
return processed_obj;
}
return null;
}
/**
* Exhibit Update (V3)
*/
export async function update_ae_obj__exhibit({
api_cfg,
event_id,
exhibit_id,
data_kv,
try_cache = true,
log_lvl = 0
api_cfg,
event_id,
exhibit_id,
data_kv,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
event_id: string;
exhibit_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
event_id: string;
exhibit_id: string;
data_kv: key_val;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventExhibit | null> {
const result = await api.update_nested_obj({
api_cfg,
parent_type: 'event',
parent_id: event_id,
child_type: 'event_exhibit',
child_id: exhibit_id,
fields: data_kv,
log_lvl
});
const result = await api.update_nested_obj({
api_cfg,
parent_type: 'event',
parent_id: event_id,
child_type: 'event_exhibit',
child_id: exhibit_id,
fields: data_kv,
log_lvl
});
if (result) {
const processed = await process_ae_obj__exhibit_props({ obj_li: [result], log_lvl });
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit,
log_lvl
});
}
return processed_obj;
}
return null;
if (result) {
const processed = await process_ae_obj__exhibit_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit,
log_lvl
});
}
return processed_obj;
}
return null;
}
/**
@@ -409,24 +518,30 @@ export async function search__exhibit({
log_lvl?: number;
}): Promise<ae_EventExhibit[]> {
if (log_lvl) {
console.log(`*** search__exhibit() *** event_id=${event_id} ft=${fulltext_search_qry_str}`);
console.log(
`*** search__exhibit() *** event_id=${event_id} ft=${fulltext_search_qry_str}`
);
}
const search_query: any = {
q: fulltext_search_qry_str || '',
and: [
{ field: 'event_id', 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: 1 });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
if (priority === 'priority') search_query.and.push({ field: 'priority', op: 'eq', value: 1 });
else if (priority === 'not_priority') search_query.and.push({ field: 'priority', op: 'eq', value: 0 });
if (priority === 'priority')
search_query.and.push({ field: 'priority', op: 'eq', value: 1 });
else if (priority === 'not_priority')
search_query.and.push({ field: 'priority', op: 'eq', value: 0 });
try {
const result_li = await api.search_ae_obj({
@@ -443,7 +558,10 @@ export async function search__exhibit({
});
if (result_li && Array.isArray(result_li)) {
const processed = await process_ae_obj__exhibit_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__exhibit_props({
obj_li: result_li,
log_lvl
});
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
@@ -460,4 +578,4 @@ export async function search__exhibit({
}
return [];
}
}

View File

@@ -106,11 +106,15 @@ async function _process_generic_props<T extends Record<string, any>>({
(processed_obj as any).exhibitor_notes = '';
}
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
(processed_obj as any).tmp_sort_1 =
`${group}_${priority}_${sort}_${updated}`;
(processed_obj as any).tmp_sort_2 =
`${group}_${priority}_${sort}_${name}_${updated}`;
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
processed_obj = await Promise.resolve(
specific_processor(processed_obj)
);
}
processed_obj_li.push(processed_obj as T);
@@ -151,43 +155,86 @@ export async function load_ae_obj_id__event_exhibit_tracking({
}): Promise<ae_EventExhibitTracking | null> {
const start_time = performance.now();
if (log_lvl) {
console.log(`🔎 [Trace] load_ae_obj_id__event_exhibit_tracking: START (id=${exhibit_tracking_id}, try_cache=${try_cache})`);
console.log(
`🔎 [Trace] load_ae_obj_id__event_exhibit_tracking: START (id=${exhibit_tracking_id}, try_cache=${try_cache})`
);
}
// 1. FAST PATH: Return cached data immediately
if (try_cache) {
try {
const cached = await db_events.exhibit_tracking.get(exhibit_tracking_id);
const cached =
await db_events.exhibit_tracking.get(exhibit_tracking_id);
if (cached) {
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`✅ [Trace] load_ae_obj_id: CACHE HIT at ${elapsed}ms. Returning stale lead shell.`);
if (log_lvl)
console.log(
`✅ [Trace] load_ae_obj_id: CACHE HIT at ${elapsed}ms. Returning stale lead shell.`
);
// Background refresh (non-blocking)
_refresh_tracking_id_background({ api_cfg, exhibit_tracking_id, view, try_cache, log_lvl: log_lvl > 1 ? log_lvl : 0 });
_refresh_tracking_id_background({
api_cfg,
exhibit_tracking_id,
view,
try_cache,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
return cached;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] load_ae_obj_id: Cache access error:`, e);
if (log_lvl)
console.error(
`❌ [Trace] load_ae_obj_id: Cache access error:`,
e
);
}
}
// 2. SLOW PATH: Wait for API
return await _refresh_tracking_id_background({ api_cfg, exhibit_tracking_id, view, try_cache, log_lvl });
return await _refresh_tracking_id_background({
api_cfg,
exhibit_tracking_id,
view,
try_cache,
log_lvl
});
}
async function _refresh_tracking_id_background({ api_cfg, exhibit_tracking_id, view, try_cache, log_lvl }: any) {
async function _refresh_tracking_id_background({
api_cfg,
exhibit_tracking_id,
view,
try_cache,
log_lvl
}: any) {
const start_time = performance.now();
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
if (log_lvl) console.log(`📡 [Trace] _refresh_tracking_id: API Fetching id=${exhibit_tracking_id}`);
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_exhibit_tracking', obj_id: exhibit_tracking_id, view, log_lvl });
if (log_lvl)
console.log(
`📡 [Trace] _refresh_tracking_id: API Fetching id=${exhibit_tracking_id}`
);
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_exhibit_tracking',
obj_id: exhibit_tracking_id,
view,
log_lvl
});
if (result) {
const processed = await process_ae_obj__exhibit_tracking_props({ obj_li: [result], log_lvl });
const processed = await process_ae_obj__exhibit_tracking_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`📦 [Trace] _refresh_tracking_id: Received from API at ${elapsed}ms`);
if (log_lvl)
console.log(
`📦 [Trace] _refresh_tracking_id: Received from API at ${elapsed}ms`
);
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
@@ -201,7 +248,11 @@ async function _refresh_tracking_id_background({ api_cfg, exhibit_tracking_id, v
return processed_obj;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] _refresh_tracking_id: API error for id=${exhibit_tracking_id}:`, e);
if (log_lvl)
console.error(
`❌ [Trace] _refresh_tracking_id: API error for id=${exhibit_tracking_id}:`,
e
);
}
return null;
}
@@ -238,36 +289,82 @@ export async function load_ae_obj_li__event_exhibit_tracking({
}): Promise<ae_EventExhibitTracking[]> {
const start_time = performance.now();
if (log_lvl) {
console.log(`🔎 [Trace] load_ae_obj_li__event_exhibit_tracking: START (exhibit=${exhibit_id}, try_cache=${try_cache})`);
console.log(
`🔎 [Trace] load_ae_obj_li__event_exhibit_tracking: START (exhibit=${exhibit_id}, try_cache=${try_cache})`
);
}
if (try_cache) {
try {
const cached_li = await db_events.exhibit_tracking
.where('event_exhibit_id').equals(exhibit_id)
.where('event_exhibit_id')
.equals(exhibit_id)
.toArray();
if (cached_li && cached_li.length > 0) {
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`✅ [Trace] load_ae_obj_li: CACHE HIT at ${elapsed}ms (${cached_li.length} items).`);
if (log_lvl)
console.log(
`✅ [Trace] load_ae_obj_li: CACHE HIT at ${elapsed}ms (${cached_li.length} items).`
);
// Background refresh (non-blocking)
_refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl: log_lvl > 1 ? log_lvl : 0 });
_refresh_tracking_li_background({
api_cfg,
exhibit_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
return cached_li;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] load_ae_obj_li: Cache access error:`, e);
if (log_lvl)
console.error(
`❌ [Trace] load_ae_obj_li: Cache access error:`,
e
);
}
}
return await _refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl });
return await _refresh_tracking_li_background({
api_cfg,
exhibit_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
});
}
async function _refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl }: any) {
async function _refresh_tracking_li_background({
api_cfg,
exhibit_id,
enabled,
hidden,
view,
limit,
offset,
order_by_li,
try_cache,
log_lvl
}: any) {
const start_time = performance.now();
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
if (log_lvl) console.log(`📡 [Trace] _refresh_tracking_li: API Fetching leads for exhibit=${exhibit_id}`);
if (log_lvl)
console.log(
`📡 [Trace] _refresh_tracking_li: API Fetching leads for exhibit=${exhibit_id}`
);
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_exhibit_tracking',
@@ -283,9 +380,15 @@ async function _refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, h
});
if (result_li) {
const processed = await process_ae_obj__exhibit_tracking_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__exhibit_tracking_props({
obj_li: result_li,
log_lvl
});
const elapsed = (performance.now() - start_time).toFixed(2);
if (log_lvl) console.log(`📦 [Trace] _refresh_tracking_li: Received ${processed.length} items from API at ${elapsed}ms.`);
if (log_lvl)
console.log(
`📦 [Trace] _refresh_tracking_li: Received ${processed.length} items from API at ${elapsed}ms.`
);
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
@@ -299,7 +402,8 @@ async function _refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, h
return processed;
}
} catch (e) {
if (log_lvl) console.error(`❌ [Trace] _refresh_tracking_li: API error:`, e);
if (log_lvl)
console.error(`❌ [Trace] _refresh_tracking_li: API error:`, e);
}
return [];
}
@@ -308,95 +412,101 @@ async function _refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, h
* Lead Capture (V3)
*/
export async function create_ae_obj__exhibit_tracking({
api_cfg,
exhibit_id,
event_badge_id,
external_person_id,
group,
try_cache = true,
log_lvl = 0
api_cfg,
exhibit_id,
event_badge_id,
external_person_id,
group,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
exhibit_id: string;
event_badge_id: string;
external_person_id: string;
group?: string;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
exhibit_id: string;
event_badge_id: string;
external_person_id: string;
group?: string;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventExhibitTracking | null> {
const result = await api.create_nested_obj({
api_cfg,
parent_type: 'event_exhibit',
parent_id: exhibit_id,
child_type: 'event_exhibit_tracking',
fields: {
event_badge_id: event_badge_id,
external_person_id,
group
},
log_lvl
});
const result = await api.create_nested_obj({
api_cfg,
parent_type: 'event_exhibit',
parent_id: exhibit_id,
child_type: 'event_exhibit_tracking',
fields: {
event_badge_id: event_badge_id,
external_person_id,
group
},
log_lvl
});
if (result) {
const processed = await process_ae_obj__exhibit_tracking_props({ obj_li: [result], log_lvl });
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit_tracking',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit_tracking,
log_lvl
});
}
return processed_obj;
}
return null;
if (result) {
const processed = await process_ae_obj__exhibit_tracking_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit_tracking',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit_tracking,
log_lvl
});
}
return processed_obj;
}
return null;
}
/**
* Lead Update (V3)
*/
export async function update_ae_obj__exhibit_tracking({
api_cfg,
exhibit_id,
exhibit_tracking_id,
data,
try_cache = true,
log_lvl = 0
api_cfg,
exhibit_id,
exhibit_tracking_id,
data,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;
exhibit_id: string;
exhibit_tracking_id: string;
data: any;
try_cache?: boolean;
log_lvl?: number;
api_cfg: any;
exhibit_id: string;
exhibit_tracking_id: string;
data: any;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventExhibitTracking | null> {
const result = await api.update_nested_obj({
api_cfg,
parent_type: 'event_exhibit',
parent_id: exhibit_id,
child_type: 'event_exhibit_tracking',
child_id: exhibit_tracking_id,
fields: data,
log_lvl
});
const result = await api.update_nested_obj({
api_cfg,
parent_type: 'event_exhibit',
parent_id: exhibit_id,
child_type: 'event_exhibit_tracking',
child_id: exhibit_tracking_id,
fields: data,
log_lvl
});
if (result) {
const processed = await process_ae_obj__exhibit_tracking_props({ obj_li: [result], log_lvl });
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit_tracking',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit_tracking,
log_lvl
});
}
return processed_obj;
}
return null;
if (result) {
const processed = await process_ae_obj__exhibit_tracking_props({
obj_li: [result],
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'exhibit_tracking',
obj_li: [processed_obj],
properties_to_save: properties_to_save_exhibit_tracking,
log_lvl
});
}
return processed_obj;
}
return null;
}
/**
@@ -428,13 +538,15 @@ export async function download_export__event_exhibit_tracking({
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** download_export__event_exhibit_tracking() *** exhibit_id=${exhibit_id}`);
console.log(
`*** download_export__event_exhibit_tracking() *** exhibit_id=${exhibit_id}`
);
}
const endpoint = `/v3/action/event_exhibit/${exhibit_id}/tracking_export`;
const params: key_val = {
file_type,
return_file: 'true' // V3 convention: string 'true' for bool query flags
return_file: 'true' // V3 convention: string 'true' for bool query flags
};
return await api.get_object({
@@ -485,7 +597,9 @@ export async function search__exhibit_tracking({
log_lvl?: number;
}): Promise<ae_EventExhibitTracking[]> {
if (log_lvl) {
console.log(`*** search__exhibit_tracking() *** exhibit_id=${event_exhibit_id} ft=${fulltext_search_qry_str}`);
console.log(
`*** search__exhibit_tracking() *** exhibit_id=${event_exhibit_id} ft=${fulltext_search_qry_str}`
);
}
if (!event_id || !event_exhibit_id) return [];
@@ -498,15 +612,30 @@ export async function search__exhibit_tracking({
]
};
if (qry_group) search_query.and.push({ field: 'group', op: 'eq', value: qry_group });
if (qry_external_person_id) search_query.and.push({ field: 'external_person_id', op: 'eq', value: qry_external_person_id });
if (qry_badge_id) search_query.and.push({ field: 'event_badge_id', op: 'eq', value: qry_badge_id });
if (qry_group)
search_query.and.push({ field: 'group', op: 'eq', value: qry_group });
if (qry_external_person_id)
search_query.and.push({
field: 'external_person_id',
op: 'eq',
value: qry_external_person_id
});
if (qry_badge_id)
search_query.and.push({
field: 'event_badge_id',
op: 'eq',
value: qry_badge_id
});
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (enabled === 'enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
else if (enabled === 'not_enabled')
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
else if (hidden === 'not_hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
try {
const result_li = await api.search_ae_obj({
@@ -525,7 +654,10 @@ export async function search__exhibit_tracking({
});
if (result_li && Array.isArray(result_li)) {
const processed = await process_ae_obj__exhibit_tracking_props({ obj_li: result_li, log_lvl });
const processed = await process_ae_obj__exhibit_tracking_props({
obj_li: result_li,
log_lvl
});
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
@@ -542,4 +674,4 @@ export async function search__exhibit_tracking({
}
return [];
}
}

View File

@@ -56,13 +56,18 @@ const export_obj = {
search__event_badge: event_badge.search__event_badge,
// Event Badge Templates
load_ae_obj_id__event_badge_template: event_badge_template.load_ae_obj_id__event_badge_template,
load_ae_obj_li__event_badge_template: event_badge_template.load_ae_obj_li__event_badge_template,
create_ae_obj__event_badge_template: event_badge_template.create_ae_obj__event_badge_template,
load_ae_obj_id__event_badge_template:
event_badge_template.load_ae_obj_id__event_badge_template,
load_ae_obj_li__event_badge_template:
event_badge_template.load_ae_obj_li__event_badge_template,
create_ae_obj__event_badge_template:
event_badge_template.create_ae_obj__event_badge_template,
delete_ae_obj_id__event_badge_template:
event_badge_template.delete_ae_obj_id__event_badge_template,
update_ae_obj__event_badge_template: event_badge_template.update_ae_obj__event_badge_template,
search__event_badge_template: event_badge_template.search__event_badge_template,
update_ae_obj__event_badge_template:
event_badge_template.update_ae_obj__event_badge_template,
search__event_badge_template:
event_badge_template.search__event_badge_template,
// Event Devices
load_ae_obj_id__event_device: event_device.load_ae_obj_id__event_device,
@@ -77,53 +82,72 @@ const export_obj = {
search__exhibit: search__exhibit,
create_ae_obj__exhibit: create_ae_obj__exhibit,
update_ae_obj__exhibit: update_ae_obj__exhibit,
load_ae_obj_id__event_exhibit_tracking: load_ae_obj_id__event_exhibit_tracking,
load_ae_obj_li__event_exhibit_tracking: load_ae_obj_li__event_exhibit_tracking,
load_ae_obj_id__event_exhibit_tracking:
load_ae_obj_id__event_exhibit_tracking,
load_ae_obj_li__event_exhibit_tracking:
load_ae_obj_li__event_exhibit_tracking,
search__exhibit_tracking: search__exhibit_tracking,
create_ae_obj__exhibit_tracking: create_ae_obj__exhibit_tracking,
update_ae_obj__exhibit_tracking: update_ae_obj__exhibit_tracking,
download_export__event_exhibit_tracking: download_export__event_exhibit_tracking,
download_export__event_exhibit_tracking:
download_export__event_exhibit_tracking,
// Event Files
load_ae_obj_id__event_file: event_file.load_ae_obj_id__event_file,
load_ae_obj_li__event_file: event_file.load_ae_obj_li__event_file,
create_event_file_obj_from_hosted_file_async: event_file.create_event_file_obj_from_hosted_file_async,
create_event_file_obj_from_hosted_file_async:
event_file.create_event_file_obj_from_hosted_file_async,
delete_ae_obj_id__event_file: event_file.delete_ae_obj_id__event_file,
update_ae_obj__event_file: event_file.update_ae_obj__event_file,
qry__event_file: event_file.qry__event_file,
search__event_file: event_file.search__event_file,
// Event Locations
load_ae_obj_id__event_location: event_location.load_ae_obj_id__event_location,
load_ae_obj_li__event_location: event_location.load_ae_obj_li__event_location,
load_ae_obj_id__event_location:
event_location.load_ae_obj_id__event_location,
load_ae_obj_li__event_location:
event_location.load_ae_obj_li__event_location,
create_ae_obj__event_location: event_location.create_ae_obj__event_location,
delete_ae_obj_id__event_location: event_location.delete_ae_obj_id__event_location,
delete_ae_obj_id__event_location:
event_location.delete_ae_obj_id__event_location,
update_ae_obj__event_location: event_location.update_ae_obj__event_location,
// Event Sessions
load_ae_obj_id__event_session: event_session.load_ae_obj_id__event_session,
load_ae_obj_li__event_session: event_session.load_ae_obj_li__event_session,
create_ae_obj__event_session: event_session.create_ae_obj__event_session,
delete_ae_obj_id__event_session: event_session.delete_ae_obj_id__event_session,
delete_ae_obj_id__event_session:
event_session.delete_ae_obj_id__event_session,
update_ae_obj__event_session: event_session.update_ae_obj__event_session,
qry__event_session: event_session.qry__event_session,
search__event_session: event_session.search__event_session,
email_sign_in__event_session: event_session.email_sign_in__event_session,
// Event Presentations
load_ae_obj_id__event_presentation: event_presentation.load_ae_obj_id__event_presentation,
load_ae_obj_li__event_presentation: event_presentation.load_ae_obj_li__event_presentation,
create_ae_obj__event_presentation: event_presentation.create_ae_obj__event_presentation,
delete_ae_obj_id__event_presentation: event_presentation.delete_ae_obj_id__event_presentation,
update_ae_obj__event_presentation: event_presentation.update_ae_obj__event_presentation,
load_ae_obj_id__event_presentation:
event_presentation.load_ae_obj_id__event_presentation,
load_ae_obj_li__event_presentation:
event_presentation.load_ae_obj_li__event_presentation,
create_ae_obj__event_presentation:
event_presentation.create_ae_obj__event_presentation,
delete_ae_obj_id__event_presentation:
event_presentation.delete_ae_obj_id__event_presentation,
update_ae_obj__event_presentation:
event_presentation.update_ae_obj__event_presentation,
// Event Presenters
load_ae_obj_id__event_presenter: event_presenter.load_ae_obj_id__event_presenter,
load_ae_obj_li__event_presenter: event_presenter.load_ae_obj_li__event_presenter,
create_ae_obj__event_presenter: event_presenter.create_ae_obj__event_presenter,
delete_ae_obj_id__event_presenter: event_presenter.delete_ae_obj_id__event_presenter,
update_ae_obj__event_presenter: event_presenter.update_ae_obj__event_presenter,
load_ae_obj_id__event_presenter:
event_presenter.load_ae_obj_id__event_presenter,
load_ae_obj_li__event_presenter:
event_presenter.load_ae_obj_li__event_presenter,
create_ae_obj__event_presenter:
event_presenter.create_ae_obj__event_presenter,
delete_ae_obj_id__event_presenter:
event_presenter.delete_ae_obj_id__event_presenter,
update_ae_obj__event_presenter:
event_presenter.update_ae_obj__event_presenter,
search__event_presenter: event_presenter.search__event_presenter,
email_sign_in__event_presenter: event_presenter.email_sign_in__event_presenter
email_sign_in__event_presenter:
event_presenter.email_sign_in__event_presenter
};
export const events_func = export_obj;
export const events_func = export_obj;

View File

@@ -18,7 +18,7 @@
/* --- Badge front --- */
[data-layout="badge_4x5_fanfold"] .badge_front {
[data-layout='badge_4x5_fanfold'] .badge_front {
width: 4in;
min-height: 5in;
max-height: 5in;
@@ -28,18 +28,18 @@
}
/* Body area: 5in total ~1in header ~0.5in footer = ~3.5in for content */
[data-layout="badge_4x5_fanfold"] .badge_body {
[data-layout='badge_4x5_fanfold'] .badge_body {
max-height: 3.5in;
}
/* --- Badge back --- */
[data-layout="badge_4x5_fanfold"] .badge_back {
[data-layout='badge_4x5_fanfold'] .badge_back {
width: 4in;
min-height: 5in;
max-height: 5in;
}
[data-layout="badge_4x5_fanfold"] .badge_back_content {
[data-layout='badge_4x5_fanfold'] .badge_back_content {
max-height: 4.5in;
}

View File

@@ -16,19 +16,19 @@
/* --- Badge front --- */
[data-layout="badge_3.5x5.5_pvc"] .badge_front {
[data-layout='badge_3.5x5.5_pvc'] .badge_front {
width: 3.5in;
min-height: 5.5in;
max-height: 5.5in;
/* debug */
/* outline: thick solid orange; */
/* debug */
/* outline: thick solid orange; */
}
/* Outer wrapper: remove the generic 4×6 fanfold defaults so the blue dashed
outline hugs the card tightly. The badge_front CSS above supplies the exact
3.5×5.5in size; wrapper just needs to fit it with no extra space. */
[data-layout="badge_3.5x5.5_pvc"].event_badge_wrapper {
[data-layout='badge_3.5x5.5_pvc'].event_badge_wrapper {
padding: 0;
gap: 0;
min-height: 0;
@@ -37,7 +37,7 @@
}
@media print {
[data-layout="badge_3.5x5.5_pvc"].event_badge_wrapper {
[data-layout='badge_3.5x5.5_pvc'].event_badge_wrapper {
width: 3.5in !important;
height: 5.5in !important;
max-width: 3.5in !important;

View File

@@ -829,7 +829,7 @@ export class MySubClassedDexie extends Dexie {
constructor() {
super('ae_events_db');
this.version(6).stores({
// NO LONGER USE "_random"
// NO LONGER USE "_random"
event: `
id, event_id, event_id_random,
code,