More code clean up

This commit is contained in:
Scott Idem
2026-03-24 10:54:40 -04:00
parent 8e61bd0ba1
commit 42358efe7d
43 changed files with 228 additions and 228 deletions

View File

@@ -704,7 +704,7 @@ delete_ae_obj_id__event_badge({ event_badge_id, event_id, method })
### Key Test Lessons Learned
**Search API path is FLAT, not nested.** `search_ae_obj_v3` builds `/v3/crud/{obj_type}/search` — always flat regardless of the parent relationship. Mocks must match this:
**Search API path is FLAT, not nested.** `search_ae_obj` builds `/v3/crud/{obj_type}/search` — always flat regardless of the parent relationship. Mocks must match this:
```typescript
// CORRECT — flat path
url.includes('/v3/crud/event_badge/search') && method === 'POST'
@@ -712,7 +712,7 @@ url.includes('/v3/crud/event_badge/search') && method === 'POST'
url.includes(`/v3/crud/event/${event_id}/event_badge/search`) && method === 'POST'
```
**List API (GET) is also FLAT with query params.** `get_ae_obj_li_v3` builds `/v3/crud/{obj_type}/?for_obj_id=...` — always flat. Mocks must check `url.includes('/v3/crud/event_badge_template/') && url.includes('for_obj_id')`.
**List API (GET) is also FLAT with query params.** `get_ae_obj_li` builds `/v3/crud/{obj_type}/?for_obj_id=...` — always flat. Mocks must check `url.includes('/v3/crud/event_badge_template/') && url.includes('for_obj_id')`.
**CSS `input[value*=...]` selectors don't work with Svelte bind:value.** The CSS selector checks the HTML *attribute*; Svelte's `bind:value` sets the DOM *property* only. In Playwright tests, use `page.getByLabel()` or `locator.inputValue()` instead.
@@ -726,7 +726,7 @@ All API mock responses in tests need these fields.
**Badge view requires both badge AND template.** `ae_comp__badge_obj_view.svelte` wraps everything in `{#if $lq__event_badge_obj && $lq__event_badge_template_obj}` — if the template isn't loaded, edit/print buttons and the badge itself don't render. Tests must mock the badge template endpoint.
**Badge GET endpoint (single object):** `/v3/crud/event_badge/{id}` (NOT nested under event). Matches `api.get_ae_obj_v3()` which uses the flat path.
**Badge GET endpoint (single object):** `/v3/crud/event_badge/{id}` (NOT nested under event). Matches `api.get_ae_obj()` which uses the flat path.
**Badge PATCH endpoint (update):** `/v3/crud/event/${event_id}/event_badge/${badge_id}` (nested under event). Matches `api.patch_ae_obj_v3()` which uses the nested path.

View File

@@ -32,7 +32,7 @@ This document outlines the modernization of the Journals module UI in the Svelte
### Frontend (In Progress)
* **State Management:** `src/lib/ae_journals/ae_journals_stores.ts`
* **Local Storage:** Dexie.js (`db_journals`)
* **API Client:** `src/lib/api/api.ts` -> `get_ae_obj_v3`
* **API Client:** `src/lib/api/api.ts` -> `get_ae_obj`
* **Export Engine:** Centralized templates in `src/lib/ae_journals/ae_journals_export_templates.ts`.
---

View File

@@ -60,17 +60,17 @@ For each file listed above, follow this standard refactoring pattern:
1. **Imports:**
* Remove imports of `create_ae_obj_crud`, `update_ae_obj_id_crud`, etc.
* Import V3 helpers: `get_ae_obj_v3`, `create_ae_obj_v3`, `update_ae_obj_v3`, `delete_ae_obj_v3`, `search_ae_obj_v3`.
* Import V3 helpers: `get_ae_obj`, `create_ae_obj_v3`, `update_ae_obj_v3`, `delete_ae_obj`, `search_ae_obj`.
2. **Pattern Replacement:**
* **Get (Single):**
* *Old:* `get_ae_obj_id_crud({ api_cfg, obj_type: 'event_session', obj_id: '...' })`
* *New:* `get_ae_obj_v3({ api_cfg, obj_type: 'event_session', obj_id: '...' })`
* *New:* `get_ae_obj({ api_cfg, obj_type: 'event_session', obj_id: '...' })`
* **Get (List):**
* *Old:* `get_ae_obj_li_for_obj_id_crud_v2(...)`
* *New:* `get_ae_obj_li_v3(...)` or `search_ae_obj_v3(...)` if complex filtering is needed.
* *New:* `get_ae_obj_li(...)` or `search_ae_obj(...)` if complex filtering is needed.
* **Update:**
* *Old:* `update_ae_obj_id_crud({ ..., fields: { name: 'New Name' } })`

View File

@@ -14,7 +14,7 @@ interface GetAeObjV3Params {
/**
* Get a single object by ID (V3)
*/
export async function get_ae_obj_v3({
export async function get_ae_obj({
api_cfg,
obj_type,
obj_id,
@@ -27,7 +27,7 @@ export async function get_ae_obj_v3({
const query_params: key_val = { view, ...params };
if (log_lvl) {
console.log('*** get_ae_obj_v3 ***');
console.log('*** get_ae_obj ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
}
@@ -56,7 +56,7 @@ interface GetNestedAeObjV3Params {
/**
* Get a single nested object by ID (V3)
*/
export async function get_nested_ae_obj_v3({
export async function get_nested_ae_obj({
api_cfg,
parent_type,
parent_id,
@@ -71,7 +71,7 @@ export async function get_nested_ae_obj_v3({
const query_params: key_val = { view, ...params };
if (log_lvl) {
console.log('*** get_nested_ae_obj_v3 ***');
console.log('*** get_nested_ae_obj ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
}
@@ -102,7 +102,7 @@ interface GetAeObjLiV3Params {
log_lvl?: number;
}
export async function get_ae_obj_li_v3({
export async function get_ae_obj_li({
api_cfg,
obj_type,
for_obj_type,
@@ -137,7 +137,7 @@ export async function get_ae_obj_li_v3({
if (delay_ms > 0) query_params['delay_ms'] = delay_ms;
if (log_lvl) {
console.log('*** get_ae_obj_li_v3 ***');
console.log('*** get_ae_obj_li ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
console.log('Headers:', headers);
@@ -167,7 +167,7 @@ interface GetNestedObjLiV3Params {
log_lvl?: number;
}
export async function get_nested_obj_li_v3({
export async function get_nested_obj_li({
api_cfg,
parent_type,
parent_id,
@@ -195,7 +195,7 @@ export async function get_nested_obj_li_v3({
if (delay_ms > 0) params['delay_ms'] = delay_ms;
if (log_lvl) {
console.log('*** get_nested_obj_li_v3 ***');
console.log('*** get_nested_obj_li ***');
console.log('Endpoint:', endpoint);
console.log('Params:', params);
}

View File

@@ -5,10 +5,10 @@ import type { key_val } from '$lib/stores/ae_stores';
* Get a list of lookup objects (V3)
* Standardized lookup data like countries, timezones, and subdivisions.
* Updated 2026-02-20
*
*
* Endpoint: GET /v3/lookup/{lu_type}/list
*/
export async function get_ae_lookup_li_v3({
export async function get_ae_lookup_li({
api_cfg,
lu_type,
site_id,
@@ -38,11 +38,11 @@ export async function get_ae_lookup_li_v3({
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** get_ae_lookup_li_v3() *** lu_type=${lu_type}`);
console.log(`*** get_ae_lookup_li() *** lu_type=${lu_type}`);
}
const endpoint = `/v3/lookup/${lu_type}/list`;
// Build query params
if (site_id) params['site_id'] = site_id;
if (for_type) params['for_type'] = for_type;
@@ -53,11 +53,11 @@ export async function get_ae_lookup_li_v3({
if (limit != null) params['limit'] = limit;
if (offset != null) params['offset'] = offset;
// Lookup data is often global; ensure account context is handled if needed,
// Lookup data is often global; ensure account context is handled if needed,
// but GUIDE says it uses site Whitelist Policy.
// If no account_id is present in api_cfg, we might need 'x-no-account-id'
// If no account_id is present in api_cfg, we might need 'x-no-account-id'
// for some lookups if they are public.
return await get_object({
api_cfg,
endpoint,

View File

@@ -23,7 +23,7 @@ export async function create_ae_obj_v3({
log_lvl = 0
}: CreateAeObjV3Params) {
const endpoint = `/v3/crud/${obj_type}/`;
if (log_lvl) {
console.log('*** create_ae_obj_v3 ***');
console.log('Endpoint:', endpoint);
@@ -61,7 +61,7 @@ interface CreateNestedObjV3Params {
for_obj_type?: string;
for_obj_id?: string;
obj_type?: string;
fields: key_val;
params?: key_val;
log_lvl?: number;
@@ -233,7 +233,7 @@ interface DeleteAeObjV3Params {
* Delete a single object by ID (V3)
* Supports 'delete' (hard), 'soft_delete', 'disable' (enable=false), and 'hide' (hide=true).
*/
export async function delete_ae_obj_v3({
export async function delete_ae_obj({
api_cfg,
obj_type,
obj_id,
@@ -245,7 +245,7 @@ export async function delete_ae_obj_v3({
const query_params = { ...params, method };
if (log_lvl) {
console.log('*** delete_ae_obj_v3 ***');
console.log('*** delete_ae_obj ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
}
@@ -278,7 +278,7 @@ interface DeleteNestedAeObjV3Params {
/**
* Delete a single nested object by ID (V3)
*/
export async function delete_nested_ae_obj_v3({
export async function delete_nested_ae_obj({
api_cfg,
parent_type,
parent_id,
@@ -301,7 +301,7 @@ export async function delete_nested_ae_obj_v3({
const query_params = { ...params, method };
if (log_lvl) {
console.log('*** delete_nested_ae_obj_v3 ***');
console.log('*** delete_nested_ae_obj ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
}

View File

@@ -19,7 +19,7 @@ interface SearchAeObjV3Params {
log_lvl?: number;
}
export async function search_ae_obj_v3({
export async function search_ae_obj({
api_cfg,
obj_type,
search_query,
@@ -61,7 +61,7 @@ export async function search_ae_obj_v3({
}
if (log_lvl) {
console.log('*** search_ae_obj_v3 ***');
console.log('*** search_ae_obj ***');
console.log('Endpoint:', endpoint);
console.log('Params:', query_params);
console.log('Search Query:', search_query);

View File

@@ -40,7 +40,7 @@ export async function load_ae_obj_id__archive({
}
ae_promises.load__archive_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'archive',
obj_id: archive_id,
@@ -135,15 +135,15 @@ export async function load_ae_obj_li__archive({
`*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
}
// DEBUG: Trace massive content loads
if (inc_content_li) {
console.warn(`load_ae_obj_li__archive: Loading content for ALL archives in list! Limit: ${limit}`);
// console.trace();
// console.trace();
}
ae_promises.load__archive_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg,
obj_type: 'archive',
for_obj_type,
@@ -271,7 +271,7 @@ export async function delete_ae_obj_id__archive({
console.log(`*** delete_ae_obj_id__archive() *** archive_id=${archive_id}`);
}
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'archive',
obj_id: archive_id,
@@ -373,7 +373,7 @@ export async function qry__archive({
search_query.q = qry_str;
}
ae_promises.load__archive_obj_li = await api.search_ae_obj_v3({
ae_promises.load__archive_obj_li = await api.search_ae_obj({
api_cfg,
obj_type: 'archive',
search_query,

View File

@@ -30,7 +30,7 @@ export async function load_ae_obj_id__archive_content({
}
ae_promises.load__archive_content_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'archive_content',
obj_id: archive_content_id,
@@ -108,7 +108,7 @@ export async function load_ae_obj_li__archive_content({
}
ae_promises.load__archive_content_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg: api_cfg,
obj_type: 'archive_content',
for_obj_type,
@@ -219,7 +219,7 @@ export async function delete_ae_obj_id__archive_content({
);
}
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'archive_content',
obj_id: archive_content_id,

View File

@@ -28,7 +28,7 @@ export async function load_ae_obj_id__account({
}
ae_promises.load__account_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'account',
obj_id: account_id,
@@ -100,7 +100,7 @@ export async function load_ae_obj_li__account({
}
ae_promises.load__account_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg,
obj_type: 'account',
enabled,
@@ -260,7 +260,7 @@ export async function delete_ae_obj_id__account({
}
ae_promises.delete__account_obj = await api
.delete_ae_obj_v3({
.delete_ae_obj({
api_cfg,
obj_type: 'account',
obj_id: account_id,

View File

@@ -22,7 +22,7 @@ export async function load_ae_obj_id__activity_log({
console.log(`*** load_ae_obj_id__activity_log() *** activity_log_id=${activity_log_id}`);
}
ae_promises.load__activity_log_obj = await api.get_ae_obj_v3({
ae_promises.load__activity_log_obj = await api.get_ae_obj({
api_cfg,
obj_type: 'activity_log',
obj_id: activity_log_id,
@@ -64,7 +64,7 @@ export async function load_ae_obj_li__activity_log({
console.log(`*** load_ae_obj_li__activity_log() *** for_obj_id=${for_obj_id}`);
}
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li_v3({
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'activity_log',
for_obj_type,
@@ -238,7 +238,7 @@ export async function qry__activity_log({
ae_promises.load__activity_log_obj_li = await api.search_ae_obj_v3({
ae_promises.load__activity_log_obj_li = await api.search_ae_obj({
api_cfg,

View File

@@ -23,7 +23,7 @@ export async function load_ae_obj_id__address({
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_Address | null> {
ae_promises.load__address_obj = await api.get_ae_obj_v3({
ae_promises.load__address_obj = await api.get_ae_obj({
api_cfg,
obj_type: 'address',
obj_id: address_id,
@@ -77,7 +77,7 @@ export async function load_ae_obj_li__address({
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_Address[]> {
ae_promises.load__address_obj_li = await api.get_ae_obj_li_v3({
ae_promises.load__address_obj_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'address',
for_obj_type,
@@ -202,7 +202,7 @@ export async function delete_ae_obj_id__address({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'address',
obj_id: address_id,

View File

@@ -23,7 +23,7 @@ export async function load_ae_obj_id__contact({
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_Contact | null> {
ae_promises.load__contact_obj = await api.get_ae_obj_v3({
ae_promises.load__contact_obj = await api.get_ae_obj({
api_cfg,
obj_type: 'contact',
obj_id: contact_id,
@@ -75,7 +75,7 @@ export async function load_ae_obj_li__contact({
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_Contact[]> {
ae_promises.load__contact_obj_li = await api.get_ae_obj_li_v3({
ae_promises.load__contact_obj_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'contact',
for_obj_type,
@@ -200,7 +200,7 @@ export async function delete_ae_obj_id__contact({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'contact',
obj_id: contact_id,

View File

@@ -14,7 +14,7 @@ export async function load_ae_obj_id__organization({
organization_id: string;
log_lvl?: number;
}): Promise<ae_Organization | null> {
return await api.get_ae_obj_v3({
return await api.get_ae_obj({
api_cfg,
obj_type: 'organization',
obj_id: organization_id,

View File

@@ -28,7 +28,7 @@ export async function load_ae_obj_id__person({
}
ae_promises.load__person_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg,
obj_type: 'person',
obj_id: person_id,
@@ -136,7 +136,7 @@ export async function load_ae_obj_li__person({
search_query.and.push({ field: 'hide', op: 'eq', value: false });
}
promise = api.search_ae_obj_v3({
promise = api.search_ae_obj({
api_cfg,
obj_type: 'person',
search_query,
@@ -146,7 +146,7 @@ export async function load_ae_obj_li__person({
log_lvl
});
} else {
promise = api.get_ae_obj_li_v3({
promise = api.get_ae_obj_li({
api_cfg,
obj_type: 'person',
for_obj_type,
@@ -290,7 +290,7 @@ export async function delete_ae_obj_id__person({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'person',
obj_id: person_id,

View File

@@ -60,7 +60,7 @@ export async function lookup_site_domain({
if (log_lvl) console.log('Attempting to load site domain from local cache...');
const cached = await db_core.site_domain.where('fqdn').equals(fqdn).first();
if (cached) {
return cached as any;
}
@@ -113,10 +113,10 @@ export async function lookup_site_domain_v3({
cached = await db_core.site_domain.where('fqdn').equals(fqdn).first();
if (cached) {
if (log_lvl) console.log('BOOTSTRAP: Cache hit. Returning cached site domain immediately.');
// Trigger background refresh to keep cache fresh, but don't await it
_refresh_site_domain_v3_background({ api_cfg, fqdn, view, log_lvl: 0 });
return cached as any;
}
} catch (err) {
@@ -134,15 +134,15 @@ async function _refresh_site_domain_v3_background({ api_cfg, fqdn, view, log_lvl
try {
const guest_api_cfg = { ...api_cfg };
guest_api_cfg.headers = { ...api_cfg.headers };
const auth_props = [
'x-account-id',
'Authorization',
'authorization',
'jwt',
'x-account-id',
'Authorization',
'authorization',
'jwt',
'JWT'
];
auth_props.forEach(prop => {
delete guest_api_cfg.headers[prop];
delete guest_api_cfg.headers[prop.toLowerCase()];
@@ -155,7 +155,7 @@ async function _refresh_site_domain_v3_background({ api_cfg, fqdn, view, log_lvl
and: [{ field: 'fqdn', op: 'eq', value: fqdn }]
};
const result_li = await api.search_ae_obj_v3({
const result_li = await api.search_ae_obj({
api_cfg: guest_api_cfg,
obj_type: 'site_domain',
search_query,
@@ -207,7 +207,7 @@ export async function load_ae_obj_id__site({
}
ae_promises.load__site_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg,
obj_type: 'site',
obj_id: site_id,
@@ -278,7 +278,7 @@ export async function load_ae_obj_li__site({
}
ae_promises.load__site_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg,
obj_type: 'site',
for_obj_type,
@@ -417,7 +417,7 @@ export async function delete_ae_obj_id__site({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'site',
obj_id: site_id,
@@ -464,7 +464,7 @@ export async function load_ae_obj_li__site_domain({
log_lvl?: number;
}): Promise<ae_SiteDomain[]> {
ae_promises.load__site_domain_li = await api
.get_nested_obj_li_v3({
.get_nested_obj_li({
api_cfg,
parent_type: 'site',
parent_id: site_id,
@@ -611,7 +611,7 @@ export async function delete_ae_obj_id__site_domain({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
parent_type: 'site',
parent_id: site_id,

View File

@@ -28,7 +28,7 @@ export async function load_ae_obj_id__user({
}
ae_promises.load__user_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg,
obj_type: 'user',
obj_id: user_id,
@@ -112,7 +112,7 @@ export async function load_ae_obj_li__user({
search_query.and.push({ field: `account_id_random`, op: 'eq', value: null });
}
return await api.search_ae_obj_v3({
return await api.search_ae_obj({
api_cfg,
obj_type: 'user',
search_query,
@@ -133,7 +133,7 @@ export async function load_ae_obj_li__user({
load_ae_obj_li__user({ api_cfg, for_obj_id, include_global: false, enabled, hidden, view, limit, log_lvl }),
load_ae_obj_li__user({ api_cfg, for_obj_id: null, include_global: true, enabled, hidden, view, limit, log_lvl })
]);
// Merge and unique-ify by ID
const merged = [...acct_users, ...global_users];
const unique = Array.from(new Map(merged.map(u => [u.user_id_random, u])).values());
@@ -147,7 +147,7 @@ export async function load_ae_obj_li__user({
const search_query = {
and: [{ field: 'account_id_random', op: 'eq', value: null }]
};
return await api.search_ae_obj_v3({
return await api.search_ae_obj({
api_cfg,
obj_type: 'user',
search_query,
@@ -163,7 +163,7 @@ export async function load_ae_obj_li__user({
// SCENARIO D: Account Only or Everything (confirmed working List API)
if (log_lvl) console.log(`Strategy: Standard List API (for_obj_id=${for_obj_id})`);
return await api.get_ae_obj_li_v3({
return await api.get_ae_obj_li({
api_cfg,
obj_type: 'user',
for_obj_type: for_obj_id ? for_obj_type : undefined,
@@ -280,7 +280,7 @@ export async function delete_ae_obj_id__user({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'user',
obj_id: user_id,
@@ -540,7 +540,7 @@ export async function qry_ae_obj_li__user_email({
params['email'] = email; // Required
params['null_account_id'] = null_account_id || false;
ae_promises.qry__user_email = await api
.get_object({
api_cfg: use_api_cfg,

View File

@@ -26,7 +26,7 @@ export async function load_ae_obj_id__hosted_file({
}
try {
ae_promises.load__hosted_file_obj = await api.get_ae_obj_v3({
ae_promises.load__hosted_file_obj = await api.get_ae_obj({
api_cfg,
obj_type: 'hosted_file',
obj_id: hosted_file_id,
@@ -94,7 +94,7 @@ export async function load_ae_obj_li__hosted_file({
}
try {
ae_promises.load__hosted_file_obj_li = await api.get_ae_obj_li_v3({
ae_promises.load__hosted_file_obj_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'hosted_file',
for_obj_type,

View File

@@ -103,7 +103,7 @@ async function _refresh_event_v3_background({
}
try {
const result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'event',
obj_id: event_id,
@@ -267,7 +267,7 @@ export async function load_ae_obj_li__event({
search_query.and.push({ field: `${for_obj_type}_id`, op: 'eq', value: for_obj_id });
}
promise = api.search_ae_obj_v3({
promise = api.search_ae_obj({
api_cfg,
obj_type: 'event',
headers: { 'x-account-id': for_obj_id },
@@ -281,7 +281,7 @@ export async function load_ae_obj_li__event({
log_lvl
});
} else {
promise = api.get_ae_obj_li_v3({
promise = api.get_ae_obj_li({
api_cfg,
obj_type: 'event',
for_obj_type,
@@ -423,7 +423,7 @@ export async function delete_ae_obj_id__event({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'event',
obj_id: event_id,
@@ -557,7 +557,7 @@ export async function search__event({
// meetings that are only physical or only virtual if both filters are active.
// We handle this in the Client-side Filter Layer below for correct OR logic.
result_li = await api.search_ae_obj_v3({
result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event',
headers: { 'x-account-id': for_obj_id },
@@ -573,7 +573,7 @@ export async function search__event({
});
} else {
// Option B: List All
result_li = await api.get_ae_obj_li_v3({
result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event',
for_obj_type,

View File

@@ -5,8 +5,8 @@ vi.mock('$lib/api/api', () => ({
api: {
create_nested_obj_v3: vi.fn(),
update_nested_obj_v3: vi.fn(),
delete_nested_ae_obj_v3: vi.fn(),
search_ae_obj_v3: vi.fn()
delete_nested_ae_obj: vi.fn(),
search_ae_obj: vi.fn()
}
}));
vi.mock('$lib/ae_core/core__idb_dexie', () => ({ db_save_ae_obj_li__ae_obj: vi.fn() }));
@@ -71,9 +71,9 @@ describe('update_ae_obj__event_badge', () => {
});
describe('delete_ae_obj_id__event_badge', () => {
it('calls api.delete_nested_ae_obj_v3 and deletes from local DB when try_cache true', async () => {
it('calls api.delete_nested_ae_obj and deletes from local DB when try_cache true', async () => {
const mocked = await import('$lib/api/api');
const mockDelete = mocked.api.delete_nested_ae_obj_v3 as any;
const mockDelete = mocked.api.delete_nested_ae_obj as any;
mockDelete.mockResolvedValue({ success: true });
const db = await import('$lib/ae_events/db_events');
@@ -91,9 +91,9 @@ describe('delete_ae_obj_id__event_badge', () => {
});
describe('search__event_badge', () => {
it('calls api.search_ae_obj_v3 and returns list (handles data envelope)', async () => {
it('calls api.search_ae_obj and returns list (handles data envelope)', async () => {
const mocked = await import('$lib/api/api');
const mockSearch = mocked.api.search_ae_obj_v3 as any;
const mockSearch = mocked.api.search_ae_obj as any;
const fakeList = [{ event_badge_id: 'eb1' }, { event_badge_id: 'eb2' }];
mockSearch.mockResolvedValue({ data: fakeList });

View File

@@ -40,7 +40,7 @@ export async function load_ae_obj_id__event_badge({
try {
ae_promises.load__event_badge_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg,
obj_type: 'event_badge',
obj_id: event_badge_id,
@@ -135,7 +135,7 @@ export async function load_ae_obj_li__event_badge({
try {
ae_promises.load__event_badge_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg,
obj_type: 'event_badge',
for_obj_type: 'event',
@@ -278,7 +278,7 @@ export async function delete_ae_obj_id__event_badge({
console.log(`*** delete_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`);
}
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
parent_type: 'event',
parent_id: event_id,
@@ -455,7 +455,7 @@ export async function search__event_badge({
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_v3({
.search_ae_obj({
api_cfg: api_cfg,
obj_type: 'event_badge',
search_query,

View File

@@ -133,7 +133,7 @@ export async function load_ae_obj_id__event_badge_template({
}
try {
ae_promises.load__event_badge_template_obj = await api.get_ae_obj_v3({
ae_promises.load__event_badge_template_obj = await api.get_ae_obj({
api_cfg,
obj_type: 'event_badge_template',
obj_id: event_badge_template_id,
@@ -197,7 +197,7 @@ 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_v3({
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',
@@ -296,7 +296,7 @@ export async function delete_ae_obj_id__event_badge_template({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
@@ -394,7 +394,7 @@ export async function search__event_badge_template({
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_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_badge_template',
search_query,

View File

@@ -32,7 +32,7 @@ export async function load_ae_obj_id__event_device({
}
try {
const result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_device',
obj_id: event_device_id,
@@ -119,7 +119,7 @@ export async function load_ae_obj_li__event_device({
}
try {
const result_li = await api.get_ae_obj_li_v3({
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_device',
for_obj_type,
@@ -257,7 +257,7 @@ export async function delete_ae_obj_id__event_device({
console.log(`*** delete_ae_obj_id__event_device() *** [V3] id=${event_device_id}`);
}
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
@@ -376,7 +376,7 @@ export async function search__event_device({
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_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_device',
search_query,
@@ -524,7 +524,7 @@ export async function process_ae_obj__event_device_props({
obj_type: 'event_device',
log_lvl,
specific_processor: (obj) => {
// Note: V3 API returns proper ISO strings.
// Note: V3 API returns proper ISO strings.
// We no longer manually append 'Z' to avoid timezone corruption.
return obj;
}

View File

@@ -66,7 +66,7 @@ async function _refresh_file_id_background({
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'event_file',
obj_id: event_file_id,
@@ -194,7 +194,7 @@ async function _refresh_file_li_background({
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_v3({
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_file',
for_obj_type,
@@ -318,7 +318,7 @@ export async function delete_ae_obj_id__event_file({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'event_file',
obj_id: event_file_id,
@@ -427,7 +427,7 @@ export async function search__event_file({
op: 'eq',
value: qry_file_purpose
});
const result_li = await api.search_ae_obj_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_file',
search_query,

View File

@@ -45,40 +45,40 @@ export async function load_ae_obj_id__event_location({
try {
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,
log_lvl: 0
_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: 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,
log_lvl
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,
log_lvl
});
}
} catch (e) {}
}
// 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,
log_lvl
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,
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) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj_v3({ 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_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 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,
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,
log_lvl
});
}
} catch (e) {}
@@ -137,16 +137,16 @@ export async function load_ae_obj_li__event_location({
try {
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,
log_lvl: 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,
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,
log_lvl: 0
_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,
log_lvl: 0
});
}
return cached_li;
@@ -155,21 +155,21 @@ 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,
log_lvl
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,
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) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
const result_li = await api.get_ae_obj_li_v3({ 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 });
// 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);
@@ -179,9 +179,9 @@ async function _refresh_location_li_background({ api_cfg, for_obj_type, for_obj_
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,
log_lvl: 0
_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,
log_lvl: 0
});
}
return processed;
@@ -208,9 +208,9 @@ async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, i
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_file_li: inc_all_file_li,
inc_all_file_li: inc_all_file_li,
inc_presentation_li: inc_presentation_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));
@@ -283,7 +283,7 @@ export async function delete_ae_obj_id__event_location({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
@@ -350,7 +350,7 @@ export async function search__event_location({
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_v3({ 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 });
if (try_cache) {

View File

@@ -63,7 +63,7 @@ export async function load_ae_obj_id__event_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) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj_v3({ 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_obj = processed[0];
@@ -173,7 +173,7 @@ export async function load_ae_obj_li__event_presentation({
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_v3({ 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 });
@@ -258,7 +258,7 @@ export async function delete_ae_obj_id__event_presentation({
try_cache?: boolean;
log_lvl?: number;
}) {
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
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);
@@ -308,7 +308,7 @@ export async function search__event_presentation({
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_v3({ 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 });
if (try_cache) {

View File

@@ -51,7 +51,7 @@ export async function load_ae_obj_id__event_presenter({
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_v3({ 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_obj = processed[0];
@@ -134,7 +134,7 @@ export async function load_ae_obj_li__event_presenter({
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_v3({ 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 });
@@ -244,7 +244,7 @@ export async function delete_ae_obj_id__event_presenter({
console.error('delete_ae_obj_id__event_presenter: event_presentation_id is required');
return null;
}
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id,
@@ -360,7 +360,7 @@ export async function search__event_presenter({
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_v3({ 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 });
if (try_cache) {

View File

@@ -90,7 +90,7 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view,
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_v3({ api_cfg, obj_type: 'event_session', obj_id: event_session_id, view, log_lvl });
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 });
@@ -237,7 +237,7 @@ async function _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_i
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_v3({ api_cfg, obj_type: 'event_session', for_obj_type, for_obj_id, view, enabled, hidden, limit, offset, order_by_li, log_lvl });
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 });
@@ -327,7 +327,7 @@ export async function delete_ae_obj_id__event_session({
console.error('delete_ae_obj_id__event_session: event_id is required');
return null;
}
const result = await api.delete_nested_ae_obj_v3({
const result = await api.delete_nested_ae_obj({
api_cfg,
for_obj_type: 'event',
for_obj_id: event_id,
@@ -407,7 +407,7 @@ export async function search__event_session({
search_query.and.push({ field: 'event_location_name', op: 'eq', value: location_name });
}
const result_li = await api.search_ae_obj_v3({ 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[] = [];

View File

@@ -16,7 +16,7 @@ export async function load_ae_obj_li__event_track({
view?: string;
log_lvl?: number;
}): Promise<ae_EventTrack[]> {
return await api.get_ae_obj_li_v3({
return await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_track',
for_obj_type: 'event',

View File

@@ -166,7 +166,7 @@ async function _refresh_exhibit_id_background({ api_cfg, exhibit_id, view, try_c
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_v3({ api_cfg, obj_type: 'event_exhibit', obj_id: exhibit_id, view, log_lvl });
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 });
@@ -255,7 +255,7 @@ async function _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidd
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
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_v3({
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_exhibit',
for_obj_type: 'event',
@@ -429,7 +429,7 @@ export async function search__exhibit({
else if (priority === 'not_priority') search_query.and.push({ field: 'priority', op: 'eq', value: 0 });
try {
const result_li = await api.search_ae_obj_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_exhibit',
search_query,

View File

@@ -86,7 +86,7 @@ async function _process_generic_props<T extends Record<string, any>>({
// 2. Primary Key Mapping (Dexie compatible)
const randomIdKey = `${obj_type}_id_random`;
const baseIdKey = `${obj_type}_id`;
// Prioritize the base ID field as the primary source of truth
if (processed_obj[baseIdKey]) {
(processed_obj as any).id = String(processed_obj[baseIdKey]);
@@ -180,7 +180,7 @@ async function _refresh_tracking_id_background({ api_cfg, exhibit_tracking_id, v
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_v3({ api_cfg, obj_type: 'event_exhibit_tracking', obj_id: exhibit_tracking_id, view, log_lvl });
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 });
@@ -268,7 +268,7 @@ async function _refresh_tracking_li_background({ api_cfg, exhibit_id, enabled, h
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
try {
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_v3({
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'event_exhibit_tracking',
for_obj_type: 'event_exhibit',
@@ -509,7 +509,7 @@ export async function search__exhibit_tracking({
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
try {
const result_li = await api.search_ae_obj_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'event_exhibit_tracking',
for_obj_type: 'event_exhibit',

View File

@@ -131,7 +131,7 @@ async function _refresh_journal_id_background({
}: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'journal',
obj_id: journal_id,
@@ -301,7 +301,7 @@ async function _refresh_journal_li_background({
if (hidden === 'hidden')
search_query.and.push({ field: 'hide', op: 'eq', value: true });
promise = api.search_ae_obj_v3({
promise = api.search_ae_obj({
api_cfg,
obj_type: 'journal',
search_query,
@@ -311,7 +311,7 @@ async function _refresh_journal_li_background({
log_lvl
});
} else {
promise = api.get_ae_obj_li_v3({
promise = api.get_ae_obj_li({
api_cfg,
obj_type: 'journal',
for_obj_type,
@@ -462,7 +462,7 @@ export async function delete_ae_obj_id__journal({
}
ae_promises.delete__journal_obj = await api
.delete_ae_obj_v3({
.delete_ae_obj({
api_cfg: api_cfg,
obj_type: 'journal',
obj_id: journal_id,
@@ -637,7 +637,7 @@ export async function qry__journal({
}
ae_promises.load__journal_obj_li = await api
.search_ae_obj_v3({
.search_ae_obj({
api_cfg: api_cfg,
obj_type: 'journal',
search_query,

View File

@@ -28,7 +28,7 @@ export async function load_ae_obj_id__journal_entry({
}
ae_promises.load__journal_entry_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'journal_entry',
obj_id: journal_entry_id,
@@ -109,7 +109,7 @@ export async function load_ae_obj_li__journal_entry({
let promise;
if (for_obj_type === 'journal' && for_obj_id) {
promise = api.get_nested_obj_li_v3({
promise = api.get_nested_obj_li({
api_cfg,
parent_type: 'journal',
parent_id: for_obj_id,
@@ -122,7 +122,7 @@ export async function load_ae_obj_li__journal_entry({
log_lvl
});
} else {
promise = api.get_ae_obj_li_v3({
promise = api.get_ae_obj_li({
api_cfg,
obj_type: 'journal_entry',
for_obj_type,
@@ -281,7 +281,7 @@ export async function delete_ae_obj_id__journal_entry({
}
ae_promises.delete__journal_entry_obj = await api
.delete_ae_obj_v3({
.delete_ae_obj({
api_cfg: api_cfg,
obj_type: 'journal_entry',
obj_id: journal_entry_id,
@@ -426,7 +426,7 @@ export async function qry__journal_entry({
}
ae_promises.load__journal_entry_obj_li = await api
.search_ae_obj_v3({
.search_ae_obj({
api_cfg: api_cfg,
obj_type: 'journal_entry',
search_query,

View File

@@ -40,7 +40,7 @@ export async function load_ae_obj_id__post({
}
ae_promises.load__post_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'post',
obj_id: post_id,
@@ -133,7 +133,7 @@ export async function load_ae_obj_li__post({
}
ae_promises.load__post_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg: api_cfg,
obj_type: 'post',
for_obj_type,
@@ -258,7 +258,7 @@ export async function delete_ae_obj_id__post({
console.log(`*** delete_ae_obj_id__post() *** post_id=${post_id}`);
}
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'post',
obj_id: post_id,
@@ -393,7 +393,7 @@ export async function qry__post({
// }
ae_promises.load__post_obj_li = await api
.search_ae_obj_v3({
.search_ae_obj({
api_cfg,
obj_type: 'post',
search_query,

View File

@@ -28,7 +28,7 @@ export async function load_ae_obj_id__post_comment({
}
ae_promises.load__post_comment_obj = await api
.get_ae_obj_v3({
.get_ae_obj({
api_cfg: api_cfg,
obj_type: 'post_comment',
obj_id: post_comment_id,
@@ -105,7 +105,7 @@ export async function load_ae_obj_li__post_comment({
}
ae_promises.load__post_comment_obj_li = await api
.get_ae_obj_li_v3({
.get_ae_obj_li({
api_cfg: api_cfg,
obj_type: 'post_comment',
for_obj_type,
@@ -215,7 +215,7 @@ export async function delete_ae_obj_id__post_comment({
console.log(`*** delete_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`);
}
const result = await api.delete_ae_obj_v3({
const result = await api.delete_ae_obj({
api_cfg,
obj_type: 'post_comment',
obj_id: post_comment_id,

View File

@@ -46,7 +46,7 @@ export async function qry__jitsi_report({
]
};
const result = await api.search_ae_obj_v3({
const result = await api.search_ae_obj({
api_cfg: api_cfg,
obj_type: 'activity_log',
search_query,

View File

@@ -15,7 +15,7 @@ export async function load_ae_obj_id__sponsorship({
sponsorship_id: string;
log_lvl?: number;
}): Promise<ae_Sponsorship | null> {
return await api.get_ae_obj_v3({
return await api.get_ae_obj({
api_cfg,
obj_type: 'sponsorship',
obj_id: sponsorship_id,
@@ -32,7 +32,7 @@ export async function load_ae_obj_li__sponsorship({
for_obj_id: string;
log_lvl?: number;
}): Promise<ae_Sponsorship[]> {
return await api.get_ae_obj_li_v3({
return await api.get_ae_obj_li({
api_cfg,
obj_type: 'sponsorship',
for_obj_type: 'account',

View File

@@ -222,7 +222,7 @@ export async function load_ae_obj_id__sponsorship_cfg({
async function _refresh_sponsorship_cfg_id_background({ api_cfg, sponsorship_cfg_id, try_cache, log_lvl }: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'sponsorship_cfg',
obj_id: sponsorship_cfg_id,
@@ -279,7 +279,7 @@ export async function load_ae_obj_id__sponsorship({
async function _refresh_sponsorship_id_background({ api_cfg, sponsorship_id, try_cache, log_lvl }: any) {
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
try {
const result = await api.get_ae_obj_v3({
const result = await api.get_ae_obj({
api_cfg,
obj_type: 'sponsorship',
obj_id: sponsorship_id,
@@ -335,7 +335,7 @@ export async function load_ae_obj_li__sponsorship({
console.log(`*** load_ae_obj_li__sponsorship() *** [V3] for=${for_obj_type}:${for_obj_id}`);
}
const result_li = await api.get_ae_obj_li_v3({
const result_li = await api.get_ae_obj_li({
api_cfg,
obj_type: 'sponsorship',
for_obj_type,
@@ -420,7 +420,7 @@ export async function delete_ae_obj__sponsorship({
sponsorship_id: string;
log_lvl?: number;
}) {
return await api.delete_ae_obj_v3({
return await api.delete_ae_obj({
api_cfg,
obj_type: 'sponsorship',
obj_id: sponsorship_id,

View File

@@ -10,22 +10,22 @@ import { patch_object } from '$lib/ae_api/api_patch_object'; // Exported at the
import { post_object } from '$lib/ae_api/api_post_object'; // Exported at the end of this file
import { get_ae_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_id';
import { get_ae_lookup_li_v3 } from '$lib/ae_api/api_get__lookup';
import { get_ae_lookup_li } from '$lib/ae_api/api_get__lookup';
import {
get_ae_obj_v3,
get_nested_ae_obj_v3,
get_ae_obj_li_v3,
get_nested_obj_li_v3
get_ae_obj,
get_nested_ae_obj,
get_ae_obj_li,
get_nested_obj_li
} from '$lib/ae_api/api_get__crud_obj_li';
import { search_ae_obj_v3 } from '$lib/ae_api/api_post__crud_search';
import { search_ae_obj } from '$lib/ae_api/api_post__crud_search';
import {
create_ae_obj_v3,
create_nested_obj_v3,
update_ae_obj_v3,
update_nested_obj_v3,
delete_ae_obj_v3,
delete_nested_ae_obj_v3
} from '$lib/ae_api/api_post__crud_obj_v3';
delete_ae_obj,
delete_nested_ae_obj
} from '$lib/ae_api/api_post__crud_obj';
import { get_data_store } from '$lib/ae_api/api_get__data_store';
@@ -72,7 +72,7 @@ export const get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu({
// More lists will be added in the future. For now, just country, subdivision, and time_zone.
if (['country', 'country_subdivision', 'time_zone'].includes(for_lu_type)) {
return await get_ae_lookup_li_v3({
return await get_ae_lookup_li({
api_cfg,
lu_type: for_lu_type,
include_disabled: enabled === 'all',
@@ -654,17 +654,17 @@ const obj = {
patch_object: patch_object,
post_object: post_object,
get_ae_obj_id_crud: get_ae_obj_id_crud,
get_ae_obj_v3: get_ae_obj_v3,
get_nested_ae_obj_v3: get_nested_ae_obj_v3,
get_ae_obj_li_v3: get_ae_obj_li_v3,
get_nested_obj_li_v3: get_nested_obj_li_v3,
search_ae_obj_v3: search_ae_obj_v3,
get_ae_obj: get_ae_obj,
get_nested_ae_obj: get_nested_ae_obj,
get_ae_obj_li: get_ae_obj_li,
get_nested_obj_li: get_nested_obj_li,
search_ae_obj: search_ae_obj,
create_ae_obj_v3: create_ae_obj_v3,
create_nested_obj_v3: create_nested_obj_v3,
update_ae_obj_v3: update_ae_obj_v3,
update_nested_obj_v3: update_nested_obj_v3,
delete_ae_obj_v3: delete_ae_obj_v3,
delete_nested_ae_obj_v3: delete_nested_ae_obj_v3,
delete_ae_obj:delete_ae_obj,
delete_nested_ae_obj: delete_nested_ae_obj,
create_ae_obj_crud: create_ae_obj_crud,
update_ae_obj_id_crud: update_ae_obj_id_crud,
delete_ae_obj_id_crud: delete_ae_obj_id_crud,

View File

@@ -289,7 +289,7 @@
if (!$lq__ds_obj?.id || !confirm('Are you sure you want to delete this data store?')) return;
const api_cfg = untrack(() => $ae_api);
const res = await api.delete_ae_obj_v3({
const res = await api.delete_ae_obj({
api_cfg,
obj_type: 'data_store',
obj_id: $lq__ds_obj.id,

View File

@@ -2,13 +2,13 @@
import { Filter, Plus, Search, SearchCode, User } from '@lucide/svelte';
import { ae_api, ae_loc, slct } from '$lib/stores/ae_stores';
import { load_ae_obj_li__person } from '$lib/ae_core/ae_core__person';
interface Props {
on_results: (results: any[]) => void;
}
let { on_results }: Props = $props();
let qry_str = $state('');
let loading = $state(false);
let qry_enabled = $state('enabled');
@@ -17,21 +17,21 @@
async function handle_search() {
if (!$ae_loc.account_id) return;
loading = true;
// V3 search logic
const results = await load_ae_obj_li__person({
api_cfg: $ae_api,
for_obj_id: $ae_loc.account_id,
enabled: qry_enabled as any,
hidden: qry_hidden as any,
// qry_str: qry_str || null, // Assuming load_ae_obj_li__person supports qry_str in the future or we use search_ae_obj_v3
// qry_str: qry_str || null, // Assuming load_ae_obj_li__person supports qry_str in the future or we use search_ae_obj
log_lvl: 1
});
// Filter locally for now if needed, or update the API wrapper to support search_query
const filtered = qry_str
? results.filter(p =>
p.full_name?.toLowerCase().includes(qry_str.toLowerCase()) ||
const filtered = qry_str
? results.filter(p =>
p.full_name?.toLowerCase().includes(qry_str.toLowerCase()) ||
p.primary_email?.toLowerCase().includes(qry_str.toLowerCase()) ||
p.person_id_random?.toLowerCase().includes(qry_str.toLowerCase())
)
@@ -50,12 +50,12 @@
<div class="flex items-center justify-center px-4 bg-surface-300-600-token border-r border-surface-500/20">
<Search size={18} class="opacity-50" />
</div>
<input
<input
class="bg-transparent border-0 ring-0 focus:ring-0 p-3 grow placeholder:opacity-50"
type="search"
bind:value={qry_str}
placeholder="Search by name, email, or ID..."
onkeydown={(e) => e.key === 'Enter' && handle_search()}
type="search"
bind:value={qry_str}
placeholder="Search by name, email, or ID..."
onkeydown={(e) => e.key === 'Enter' && handle_search()}
/>
<button class="preset-filled-primary font-bold px-10 py-3 hover:brightness-110 transition-all border-l border-surface-500/20 flex items-center justify-center min-w-[100px]" onclick={handle_search} disabled={loading}>
{#if loading}

View File

@@ -9,13 +9,13 @@ import type { RequestHandler } from './$types';
*/
export const GET: RequestHandler = async ({ url, fetch }) => {
const fqdn = url.host;
const protocol = public_env.PUBLIC_AE_API_PROTOCOL || 'https';
const server = public_env.PUBLIC_AE_API_SERVER || 'api.oneskyit.com';
const port = public_env.PUBLIC_AE_API_PORT || '443';
const path = public_env.PUBLIC_AE_API_PATH || '';
const api_base_url = `${protocol}://${server}${port === '443' || port === '80' ? '' : ':' + port}${path}`;
const api_cfg = {
base_url: api_base_url,
headers: {
@@ -32,8 +32,8 @@ export const GET: RequestHandler = async ({ url, fetch }) => {
const search_query = {
and: [{ field: 'fqdn', op: 'eq', value: fqdn }]
};
const result_li = await api.search_ae_obj_v3({
const result_li = await api.search_ae_obj({
api_cfg,
obj_type: 'site_domain',
search_query,

View File

@@ -66,7 +66,7 @@ test.describe('Badge Data Integrity & Field Mapping', () => {
});
}
// Badge search — IMPORTANT: search_ae_obj_v3 uses FLAT path /v3/crud/event_badge/search
// Badge search — IMPORTANT: search_ae_obj uses FLAT path /v3/crud/event_badge/search
// NOT nested /v3/crud/event/{id}/event_badge/search — see api_post__crud_search.ts
if (url.includes('/v3/crud/event_badge/search') && method === 'POST') {
return route.fulfill({
@@ -112,7 +112,7 @@ test.describe('Badge Data Integrity & Field Mapping', () => {
}
// Badge template list — uses FLAT path /v3/crud/event_badge_template/?for_obj_id=...
// NOT nested /v3/crud/event/{id}/event_badge_template/ — see get_ae_obj_li_v3()
// NOT nested /v3/crud/event/{id}/event_badge_template/ — see get_ae_obj_li()
if (url.includes('/v3/crud/event_badge_template/') && url.includes('for_obj_id') && method === 'GET') {
return route.fulfill({
status: 200,