diff --git a/GEMINI.md b/GEMINI.md index ebbec303..29caac85 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -1,94 +1,139 @@ -# Aether (AE) SvelteKit Application +# Gemini Agent Context: Aether (AE) SvelteKit Application -This project is the frontend UI/UX for the Aether (AE) system, built with Svelte 5 (SvelteKit), Tailwind CSS, and Skeleton. It interfaces with a Python FastAPI backend. +> **Template Version:** 1.2 (2026-01-26) +> **Purpose:** Standardized memory structure for all Aether Agents. +> **Structure:** Inverted Pyramid (Foundational -> Strategic -> Tactical -> Reference). -## 🎯 Core Mandates (Safety & Efficiency) -- **Fast is slow. Slow is fast.** Deliberate, careful progress is better than rushed, error-prone actions. -- **Fail fast.** If a change breaks the system, revert immediately to the last known working version before attempting a new fix. -- **Commit early and often.** Working changes MUST be committed before starting major new modifications. Always test before committing. -- **Verify.** Perform syntax checks and basic compile verification before finalizing any code change. -- **Trust but verify.** Always verify tool outputs, assumptions, and system state before proceeding. +## 1. πŸ’Ύ Long Term Memory (System & Facts) +*This section contains the "Universal Truths" that rarely change. It grounds the agent in the user's reality.* -## πŸ—οΈ Architecture & Standards +### πŸ€– Agent Identity & Role +- **Agent Name:** mcp_agent (SvelteKit Frontend) +- **Primary Role:** Frontend UI/UX Development & Svelte 5 Migration. +- **Scope:** `aether_app_sveltekit/`, Svelte components, Dexie stores, and V3 API integration. -### Reactivity & Stores -- **Svelte 5 Runes:** Use `$state`, `$derived`, and `$effect` for component-level reactivity. -- **Dexie LiveQuery:** Results from `liveQuery` are observables. You **MUST** use the `$` prefix (e.g., `$lq__obj`) in templates and logic to subscribe to the live data. Failure to do so will result in accessing the observable object instead of its data. -- **Persistence:** Use `svelte-persisted-store` for data that must survive page refreshes (e.g., `ae_loc`, `journals_loc`). -- **Initialization:** Always initialize reactive state (`$state`) outside of `$props()` destructuring. Use `untrack` inside `$effect` when synchronizing props to local state to prevent infinite loops. +### πŸ‘€ User Profile +- **User:** Scott Idem (`scott`) +- **Organizations:** + - **One Sky IT (OSIT):** Professional/Business context. + - **Danger Zone (DgrZone):** Personal/Home context. + - **Aether Platform (AE):** Scott's (One Sky IT) platform developed for OSIT. +- **Preferences:** + - **Editor:** `vim` (Terminal), VS Code (GUI). + - **Communication:** Direct, concise, professional CLI tone. + - **Safety:** "Recycle Bin" (`~/tmp/gemini_trash`) instead of `rm`. Explain destructive actions first. +- **Hardware/OS:** + - **Host:** Linux System + - **OS:** Linux -### ID Convention (Triple-ID Pattern) -- **Standard:** Use `id`, `[obj_type]_id`, and `[obj_type]_id_random` consistently. -- **Primary Key:** Always use `_id_random` (string) for routing, data fetching, and local storage. -- **Local Storage:** Alias `id_random` to both `id` (PK) and `[obj_type]_id` when saving to Dexie. +### πŸ—οΈ Aether Architecture (V3) +- **Concept:** Unified AI-driven platform for business/personal management. +- **Frontend:** SvelteKit + Tailwind 4 + Skeleton UI + Dexie.js (Local-first). +- **Backend:** FastAPI + Pydantic V1 + SQLAlchemy + MariaDB (Remote). +- **Orchestration:** Docker Compose (via `aether-ops` extension). +- **Core Principle:** "Agent Bridge" - Distributed agents coordinating via file-based messaging. -### API V3 Implementation -- **Robustness:** Use the standardized primary helpers (`get`, `post`, `patch`, `delete`) in `src/lib/ae_api/`. -- **SSR Parity:** Helpers support custom `fetch` injection for SvelteKit server-side execution. -- **Bootstrap Paradox:** Use the unauthenticated bypass (`x-no-account-id: "Nothing to See Here"`) for site/domain lookups. -- **Envelopes:** Helpers automatically handle the `{data: ...}` envelope returned by the backend. +#### 🎨 Frontend Standards +- **Reactivity & Stores:** + - **Svelte 5 Runes:** Use `$state`, `$derived`, and `$effect` for component-level reactivity. + - **Dexie LiveQuery:** Results from `liveQuery` are observables. You **MUST** use the `$` prefix (e.g., `$lq__obj`) in templates and logic to subscribe to the live data. + - **Persistence:** Use `svelte-persisted-store` for data that must survive page refreshes (e.g., `ae_loc`, `journals_loc`). + - **Initialization:** Always initialize reactive state (`$state`) outside of `$props()` destructuring. Use `untrack` inside `$effect` when synchronizing props to local state. +- **ID Convention (Triple-ID Pattern):** + - **Standard:** Use `id`, `[obj_type]_id`, and `[obj_type]_id_random` consistently. + - **Primary Key:** Always use `_id_random` (string) for routing, data fetching, and local storage. + - **Local Storage:** Alias `id_random` to both `id` (PK) and `[obj_type]_id` when saving to Dexie. +- **API V3 Implementation:** + - **Robustness:** Use standardized primary helpers (`get`, `post`, `patch`, `delete`) in `src/lib/ae_api/`. + - **SSR Parity:** Helpers support custom `fetch` injection for SvelteKit server-side execution. + - **Bootstrap Paradox:** Use unauthenticated bypass (`x-no-account-id: "Nothing to See Here"`) for site/domain lookups. + - **Envelopes:** Helpers automatically handle the `{data: ...}` envelope returned by the backend. +- **Data Pattern:** + 1. **Fetch:** API Function calls the V3 endpoint. + 2. **Process:** Dedicated `process_ae_obj__*_props` handles data shaping and computed fields. + 3. **Cache:** Save cleaned data to IndexedDB via `db_save_ae_obj_li__ae_obj`. -### Data Pattern -1. **Fetch:** API Function calls the V3 endpoint. -2. **Process:** Dedicated `process_ae_obj__*_props` function handles data shaping, parent ID injection, and computed fields. -3. **Cache:** Save cleaned data to IndexedDB via `db_save_ae_obj_li__ae_obj`. +### πŸ“œ Core Protocols +- **RAR Protocol:** Request -> Ack -> Result (for inter-agent tasks). +- **Bite-Sized Data:** Avoid monolithic files (>1MB). Split data into atomic chunks (e.g., `objects/*.json`). +- **Fail Fast & Transparently:** Revert immediately if a change breaks the system. API returns 500 on hard errors. +- **V3 CRUD Paradigm:** JSON metadata via `/v3/crud/`, binary actions via `/v3/action/`. +- **Project Mandates:** + - **Fast is slow. Slow is fast.** Deliberate, careful progress. + - **Commit early and often.** Test before committing. + - **Trust but verify.** Verify tool outputs and assumptions. + +### πŸ›‘οΈ Security & Secrets Guardrails +- **Secrets:** NEVER read or display content from `.env` files unless explicitly debugging configuration logic. +- **Logging:** Do not include MariaDB passwords, API keys, or personal tokens in `ae_log_work` or commit messages. +- **PII:** Scrub personally identifiable information if sharing logs or data across the bridge. + +### πŸ§ͺ Verification & Quality +- **Pre-Flight:** Verify `git status` before modification. +- **Compile Check:** Perform syntax checks and basic compile verification before finalizing any code change. +- **Tooling:** + - `verify_api_integrity`: Headless verification of the FastAPI stack. + - `schema_sync`: Syncs Pydantic models to TypeScript interfaces in `src/lib/types/ae_types.ts`. + - `ae_obj_info`: Metadata lookup for Aether objects. + +### πŸ“ Git & Coordination +- **Atomic Commits:** Stage related changes; avoid "megacommit" bloat. +- **Intent-Based Messages:** Focus on "Why" and "Strategic Intent". +- **UE-AE-01 Vision:** Unified agent with total system awareness across MariaDB, FastAPI, SvelteKit, and Nginx. --- -## πŸ› οΈ Tooling & Orchestration +## 2. πŸ—“οΈ Near Term Memory (Strategic Context) +*This section tracks active projects (1-2 weeks scope). It answers "Why are we doing this?"* -### Aether Ops (MCP Extension) -- **`verify_api_integrity`**: Headless verification of the FastAPI stack. -- **`schema_sync`**: Syncs Pydantic models to TypeScript interfaces in `src/lib/types/ae_types.ts`. -- **`ae_obj_info`**: Metadata lookup for Aether objects. -- **UE-AE-01 Vision:** Moving towards a unified agent with total system awareness across MariaDB, FastAPI, SvelteKit, and Nginx. +### πŸ“© In-Flight RAR Requests +*Track active inter-agent tasks here to ensure follow-up.* +- [ ] **[Recipient Agent]**: [Description of request] (Sent: [YYYY-MM-DD]) + +### 🎯 Strategic Goals (Current Sprint) +- **Primary:** Performance Sprint & Journals Standardization. +- **Secondary:** V3 API Migration and System Health Stability. + +### 🚧 Active Workstreams +- **[Hydration Optimization]:** Implemented SWR pattern and non-blocking layouts to eliminate "white page" delays. +- **[Service Worker]:** Re-enabled registration and implemented robust asset caching. +- **[Native Bridge]:** Phase 5 AppleScript handlers for macOS (PowerPoint/Keynote). +- **[Telemetry]:** Modern dashboard in Launcher Config with visual CPU/RAM gauges. +- **[Journals Module]:** Standardized naming (`ae_comp__*`), normalized props to snake_case, and unified icons. + +### 🧠 Recent Learnings & Decisions +- **SWR Pattern:** Crucial for eliminating page load delays in Sites, Events, and Journals. +- **Quiet Logs:** Silenced noisy `AbortError` and `NetworkError` in background fetches to reduce noise. +- **Details Toggle:** Optimized Event Session list by deferring expensive sub-components. +- **CodeMirror Fix:** Resolved line-wrapping issues in editors. --- -## πŸ“‚ Modules Overview +## 3. 🧠 Short Term Memory (Session Context) +*This section is the "Scratchpad" for the current interaction. It is cleared or summarized often.* -### Core Modules -- **Identity:** `accounts`, `people`, `users`. -- **Infrastructure:** `sites`, `site_domains`. -- **Storage:** `hosted_files`. - -### Feature Modules -- **Events:** Presentation management, Badge printing, QR tracking. -- **Journals:** Documentation, notes, and AI-assisted summarization. -- **IDAA:** Client-specific logistics and video conferencing (Jitsi). +- **Status:** Idle / Task Complete. +- **Last Action:** Logged work for v1.2 template standardization across the ecosystem. +- **Current Blocker:** None. +- **Immediate Next Step:** Await next user instruction. --- -## πŸ“ Development History (Consolidated) +## 4. πŸ“‚ Reference: Directory & Whitelist +*Low-density reference data. Keep at the bottom to avoid cluttering the prompt's "hot zone".* -### Launcher Phase 5 & Performance Sprint (2026-01-26) -- **Hydration Optimization:** Implemented Stale-While-Revalidate (SWR) pattern and non-blocking layouts across Sites, Events, and Journals to eliminate "white page" delays. -- **Service Worker:** Re-enabled automatic registration and implemented robust asset caching using SvelteKit metadata. -- **Native Bridge:** Implemented Phase 5 AppleScript handlers for PowerPoint and Keynote on macOS. -- **Telemetry:** Built a modern dashboard in Launcher Config with visual CPU/RAM gauges and animated sync status. -- **API Hardening:** Silenced noisy `AbortError` and `NetworkError` logs in background fetches. +### πŸ›‘οΈ File Whitelist +- `~/tmp`, `~/Downloads`, `~/temp`, `~/agents_sync` -### Launcher Phase 4 & Hardening (2026-01-26) -- **Heartbeat Engine:** Implemented V3-compliant heartbeat and room refresh cycles. -- **UI Integration:** Migrated heartbeat/sync status from "Secret Monitor" to formal **Launcher Config Drawer**. -... ---- +### πŸ—ΊοΈ Standard Directory Map +- **`src/lib/ae_api/`**: API V3 standard helpers. +- **`src/lib/ae_journals/`**: Journals feature module. +- **`src/lib/types/ae_types.ts`**: Unified TypeScript interfaces. -## 🧠 Session Context (2026-01-26) -- **Status:** Performance Sprint & Journals Standardization Complete. -- **Recent Actions:** - - Eliminated page load delays via SWR and non-blocking background refreshes. - - Standardized Journals module: renamed all components to `ae_comp__*`, normalized props to snake_case, and unified icons under `lucide-svelte`. - - Fixed line-wrapping issues in both plain and CodeMirror editors. - - Optimized Event Session list rendering with a "Details" toggle to defer expensive sub-components. - - Hardened Service Worker and suppressed aborted fetch logs. - - Finalized Native Launcher Phase 5 automation and Telemetry UI. -- **Pending Tasks:** - - [ ] Refactor `get_device_config` to be non-blocking in root layout. - - [ ] Audit IDAA pages for reported issues. - - [ ] Restore Exhibit Search functionality. - - [ ] Build standalone Payload Validation tool. +### πŸ“¦ Modules Overview +- **Core:** Identity (`accounts`, `people`, `users`), Infrastructure (`sites`, `site_domains`), Storage (`hosted_files`). +- **Feature:** Events (Badge printing, QR), Journals (Notes, AI), IDAA (Logistics, Jitsi). -## πŸ”— Resources +### πŸ”— Resources - **Reference Stubs:** `agents_sync/technical/references/` (Svelte 5, Dexie, FastAPI). -- **Official Docs:** [Svelte Runes](https://svelte.dev/blog/runes) | [Dexie Quick Ref](https://dexie.org/docs/API-Reference#quick-reference) +- **Official Docs:** [Svelte Runes](https://svelte.dev/blog/runes) | [Dexie Quick Ref](https://dexie.org/docs/API-Reference#quick-reference) \ No newline at end of file diff --git a/TODO.md b/TODO.md index 7db70222..fb7828e3 100644 --- a/TODO.md +++ b/TODO.md @@ -41,6 +41,7 @@ This is a list of tasks to be completed before the next event/show/conference. ## πŸ› οΈ DX & Tooling (MCP) - [x] **V3 API Parameter Hardening:** Updated `search_ae_obj_v3` for URL serialization. (Completed 2026-01-21) - [x] **Fetch Noise Reduction:** Silenced AbortErrors in API helpers at log_lvl 0. (Completed 2026-01-26) +- [x] **GEMINI Context Standardization:** Deployed v1.2 Inverted Pyramid template with Agent Identity and RAR tracking across ecosystem. (Completed 2026-01-26) - [ ] **Payload Validation:** Create dry-run tool for Pydantic model checking. --- diff --git a/src/lib/ae_events/ae_events__event.ts b/src/lib/ae_events/ae_events__event.ts index 01c80cab..a6172924 100644 --- a/src/lib/ae_events/ae_events__event.ts +++ b/src/lib/ae_events/ae_events__event.ts @@ -14,7 +14,7 @@ import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file const ae_promises: key_val = {}; -// Updated 2026-01-26 (Stale-While-Revalidate Optimization) +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_id__event({ api_cfg, event_id, @@ -42,12 +42,10 @@ export async function load_ae_obj_id__event({ console.log(`*** load_ae_obj_id__event() *** event_id=${event_id} (SWR Optimization)`); } - let cached_event: any = null; - // 1. FAST PATH: Return cached data immediately if (try_cache) { try { - cached_event = await db_events.event.get(event_id); + const cached_event = await db_events.event.get(event_id); if (cached_event) { if (log_lvl) console.log('EVENT LOAD: Cache hit. Returning stale data immediately.'); @@ -91,7 +89,7 @@ async function _refresh_event_v3_background({ } try { - const event_obj_get_result = await api.get_ae_obj_v3({ + const result = await api.get_ae_obj_v3({ api_cfg: api_cfg, obj_type: 'event', obj_id: event_id, @@ -99,22 +97,24 @@ async function _refresh_event_v3_background({ log_lvl: log_lvl }); - if (event_obj_get_result) { + if (result) { + let processed_obj = result; if (try_cache) { - const processed_obj_li = await process_ae_obj__event_props({ - obj_li: [event_obj_get_result], + const processed = await process_ae_obj__event_props({ + obj_li: [result], log_lvl: log_lvl }); + processed_obj = processed[0]; await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'event', - obj_li: processed_obj_li, + obj_li: processed, properties_to_save: properties_to_save, log_lvl: log_lvl }); } - return await _handle_nested_loads(event_obj_get_result, { + return await _handle_nested_loads(processed_obj, { api_cfg, inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_template_li, log_lvl }); } @@ -128,7 +128,8 @@ async function _refresh_event_v3_background({ * Shared logic for loading nested child collections */ async function _handle_nested_loads(event_obj: any, { api_cfg, inc_device_li, inc_file_li, inc_location_li, inc_session_li, inc_template_li, log_lvl }: any) { - const current_event_id = event_obj.event_id_random || event_obj.event_id || event_obj.id; + // String-Only ID Vision: the '_id' field IS the string ID + const current_event_id = event_obj.id || event_obj.event_id; // Use Promise.all for concurrent nested loads to further reduce delay const tasks = []; @@ -180,7 +181,7 @@ async function _handle_nested_loads(event_obj: any, { api_cfg, inc_device_li, in return event_obj; } -// Updated 2026-01-06 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_li__event({ api_cfg, for_obj_type = 'account', @@ -224,20 +225,17 @@ export async function load_ae_obj_li__event({ let promise; if (qry_conference !== null) { - // V3 Search now permits 'conference' field. const search_query: any = { and: [{ field: 'conference', op: 'eq', value: qry_conference }] }; - // Fix for "Integer Trap": Inject account context directly into search body and remove from URL params if (for_obj_id) { - search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id }); + search_query.and.push({ field: `${for_obj_type}_id`, op: 'eq', value: for_obj_id }); } promise = api.search_ae_obj_v3({ api_cfg, obj_type: 'event', - // Headers for Auth context headers: { 'x-account-id': for_obj_id }, search_query, enabled, @@ -265,29 +263,25 @@ export async function load_ae_obj_li__event({ } try { - const event_obj_li_get_result = await promise; - if (event_obj_li_get_result) { - let filtered_results = event_obj_li_get_result; - - // Optional: Keep local filter as a fallback safety - if (qry_conference !== null) { - filtered_results = event_obj_li_get_result.filter((ev: any) => ev.conference === qry_conference); - } + const result_li = await promise; + if (result_li) { + let processed_results = result_li; if (try_cache) { - const processed_obj_li = await process_ae_obj__event_props({ - obj_li: filtered_results, + const processed = await process_ae_obj__event_props({ + obj_li: result_li, log_lvl: log_lvl }); + processed_results = processed; await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'event', - obj_li: processed_obj_li, + obj_li: processed, properties_to_save: properties_to_save, log_lvl: log_lvl }); } - ae_promises.load__event_obj_li = filtered_results; + ae_promises.load__event_obj_li = processed_results; } else { console.log('No results returned from API.'); if (try_cache) { @@ -313,7 +307,7 @@ export async function load_ae_obj_li__event({ if (inc_session_li && ae_promises.load__event_obj_li) { for (const event_obj of ae_promises.load__event_obj_li) { - const current_event_id = event_obj.event_id || event_obj.id; + const current_event_id = event_obj.id || event_obj.event_id; event_obj.event_session_obj_li = await load_ae_obj_li__event_session({ api_cfg, for_obj_type: 'event', @@ -346,28 +340,33 @@ export async function create_ae_obj__event({ api_cfg, obj_type: 'event', fields: { - account_id_random: account_id, + account_id, ...data_kv }, params, log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_props({ + if (result) { + const processed = await process_ae_obj__event_props({ obj_li: [result], log_lvl: log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'event', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'event', + obj_li: processed, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-06 @@ -427,21 +426,26 @@ export async function update_ae_obj__event({ log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_props({ + if (result) { + const processed = await process_ae_obj__event_props({ obj_li: [result], log_lvl: log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'event', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'event', + obj_li: processed, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-21 @@ -498,9 +502,8 @@ export async function search__event({ search_query.and.push({ field: 'default_qry_str', op: 'like', value: `%${qry_str.trim()}%` }); params['lk_qry'] = { 'default_qry_str': qry_str.trim() }; - // Use raw field name to bypass backend mapping conflicts if (for_obj_id) { - search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id }); + search_query.and.push({ field: `${for_obj_type}_id`, op: 'eq', value: for_obj_id }); } if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 }); @@ -754,10 +757,8 @@ export async function qry_ae_obj_li__event_v2({ export const properties_to_save = [ 'id', 'event_id', - 'event_id_random', 'code', 'account_id', - 'account_id_random', 'conference', 'type', 'name', @@ -880,11 +881,8 @@ export async function process_ae_obj__event_props({ obj.code = obj.event_code; } // Ensure ID consistency for components relying on specific ID fields - if (!obj.event_id_random && obj.id_random) { - obj.event_id_random = obj.id_random; - } - if (obj.event_id_random && !obj.id) { - obj.id = obj.event_id_random; + if (obj.id && !obj.event_id) { + obj.event_id = obj.id; } return obj; } diff --git a/src/lib/ae_events/ae_events__event_device.ts b/src/lib/ae_events/ae_events__event_device.ts index 23782c28..80b4372b 100644 --- a/src/lib/ae_events/ae_events__event_device.ts +++ b/src/lib/ae_events/ae_events__event_device.ts @@ -9,7 +9,7 @@ import { load_ae_obj_id__event_location } from './ae_events__event_location'; const ae_promises: key_val = {}; -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_id__event_device({ api_cfg, event_device_id, @@ -28,31 +28,31 @@ export async function load_ae_obj_id__event_device({ } try { - ae_promises.load__event_device_obj = await api.get_ae_obj_v3({ + const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_device', obj_id: event_device_id, log_lvl }); - if (ae_promises.load__event_device_obj) { + if (result) { + const processed = await process_ae_obj__event_device_props({ + obj_li: [result], + log_lvl + }); + ae_promises.load__event_device_obj = processed[0]; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: [ae_promises.load__event_device_obj], - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'device', - obj_li: processed_obj_li, + obj_li: [ae_promises.load__event_device_obj], properties_to_save, log_lvl }); } - } else { - if (try_cache) { - ae_promises.load__event_device_obj = await db_events.device.get(event_device_id); - } + } else if (try_cache) { + ae_promises.load__event_device_obj = await db_events.device.get(event_device_id); } } catch (error: any) { console.log('V3 Request failed.', error); @@ -78,7 +78,7 @@ export async function load_ae_obj_id__event_device({ return ae_promises.load__event_device_obj; } -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_li__event_device({ api_cfg, for_obj_type = 'event', @@ -114,7 +114,7 @@ export async function load_ae_obj_li__event_device({ } try { - ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_v3({ + const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_device', for_obj_type, @@ -127,16 +127,18 @@ export async function load_ae_obj_li__event_device({ log_lvl }); - if (ae_promises.load__event_device_obj_li) { + if (result_li) { + const processed = await process_ae_obj__event_device_props({ + obj_li: result_li, + log_lvl + }); + ae_promises.load__event_device_obj_li = processed; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: ae_promises.load__event_device_obj_li, - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'device', - obj_li: processed_obj_li, + obj_li: ae_promises.load__event_device_obj_li, properties_to_save, log_lvl }); @@ -193,27 +195,32 @@ export async function create_ae_obj__event_device({ api_cfg, obj_type: 'event_device', fields: { - event_id_random: event_id, + event_id, ...data_kv }, log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_device_props({ + if (result) { + const processed = await process_ae_obj__event_device_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -275,21 +282,26 @@ export async function update_ae_obj__event_device({ log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_device_props({ + if (result) { + const processed = await process_ae_obj__event_device_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -327,7 +339,7 @@ export async function search__event_device({ const search_query: any = { q: qry_str, - and: [{ field: 'event_id_random', op: 'eq', value: event_id }] + and: [{ field: 'event_id', op: 'eq', value: event_id }] }; // Logical filters @@ -347,21 +359,25 @@ export async function search__event_device({ log_lvl }); - if (result_li && try_cache) { - const processed_obj_li = await process_ae_obj__event_device_props({ + if (result_li) { + const processed = await process_ae_obj__event_device_props({ obj_li: result_li, log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: processed, + properties_to_save, + log_lvl + }); + } + return processed; } - return result_li || []; + return []; } export const properties_to_save = [ @@ -443,6 +459,7 @@ async function _process_generic_props>({ (processed_obj as any)[newKey] = processed_obj[key]; } } + // String-Only ID Vision: Map [obj_type]_id_random to 'id' const randomIdKey = `${obj_type}_id_random`; if (processed_obj[randomIdKey]) { (processed_obj as any).id = processed_obj[randomIdKey]; diff --git a/src/lib/ae_events/ae_events__event_location.ts b/src/lib/ae_events/ae_events__event_location.ts index cd23e0e0..1eb7cbd6 100644 --- a/src/lib/ae_events/ae_events__event_location.ts +++ b/src/lib/ae_events/ae_events__event_location.ts @@ -9,7 +9,7 @@ import { load_ae_obj_li__event_session } from '$lib/ae_events/ae_events__event_s const ae_promises: key_val = {}; -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_id__event_location({ api_cfg, event_location_id, @@ -34,7 +34,7 @@ export async function load_ae_obj_id__event_location({ } try { - ae_promises.load__event_location_obj = await api.get_ae_obj_v3({ + const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_location', obj_id: event_location_id, @@ -42,16 +42,18 @@ export async function load_ae_obj_id__event_location({ log_lvl }); - if (ae_promises.load__event_location_obj) { + if (result) { + const processed = await process_ae_obj__event_location_props({ + obj_li: [result], + log_lvl + }); + ae_promises.load__event_location_obj = processed[0]; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: [ae_promises.load__event_location_obj], - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'location', - obj_li: processed_obj_li, + obj_li: [ae_promises.load__event_location_obj], properties_to_save, log_lvl }); @@ -73,7 +75,7 @@ export async function load_ae_obj_id__event_location({ return await _handle_nested_loads(ae_promises.load__event_location_obj, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl }); } -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_li__event_location({ api_cfg, for_obj_type = 'event', @@ -113,7 +115,7 @@ export async function load_ae_obj_li__event_location({ } try { - ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_v3({ + const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_location', for_obj_type, @@ -126,16 +128,18 @@ export async function load_ae_obj_li__event_location({ log_lvl }); - if (ae_promises.load__event_location_obj_li) { + if (result_li) { + const processed = await process_ae_obj__event_location_props({ + obj_li: result_li, + log_lvl + }); + ae_promises.load__event_location_obj_li = processed; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: ae_promises.load__event_location_obj_li, - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'location', - obj_li: processed_obj_li, + obj_li: ae_promises.load__event_location_obj_li, properties_to_save, log_lvl }); @@ -167,7 +171,8 @@ export async function load_ae_obj_li__event_location({ * Handle nested data loads for a single location object. */ async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl }: any) { - const current_location_id = location_obj.event_location_id_random || location_obj.event_location_id || location_obj.id; + // String-Only ID Vision: the '_id' field IS the string ID + const current_location_id = location_obj.id || location_obj.event_location_id; if (inc_file_li) { location_obj.event_file_li = await load_ae_obj_li__event_file({ @@ -221,27 +226,32 @@ export async function create_ae_obj__event_location({ api_cfg, obj_type: 'event_location', fields: { - event_id_random: event_id, + event_id, ...data_kv }, log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_location_props({ + if (result) { + const processed = await process_ae_obj__event_location_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -303,21 +313,26 @@ export async function update_ae_obj__event_location({ log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_location_props({ + if (result) { + const processed = await process_ae_obj__event_location_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -355,7 +370,7 @@ export async function search__event_location({ const search_query: any = { q: qry_str, - and: [{ field: 'event_id_random', op: 'eq', value: event_id }] + and: [{ field: 'event_id', op: 'eq', value: event_id }] }; if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: true }); @@ -374,21 +389,25 @@ export async function search__event_location({ log_lvl }); - if (result_li && try_cache) { - const processed_obj_li = await process_ae_obj__event_location_props({ + if (result_li) { + const processed = await process_ae_obj__event_location_props({ obj_li: result_li, log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: processed, + properties_to_save, + log_lvl + }); + } + return processed; } - return result_li || []; + return []; } export const properties_to_save = [ @@ -441,6 +460,7 @@ async function _process_generic_props>({ (processed_obj as any)[newKey] = processed_obj[key]; } } + // String-Only ID Vision: Map [obj_type]_id_random to 'id' const randomIdKey = `${obj_type}_id_random`; if (processed_obj[randomIdKey]) { (processed_obj as any).id = processed_obj[randomIdKey]; diff --git a/src/lib/ae_events/ae_events__event_presentation.ts b/src/lib/ae_events/ae_events__event_presentation.ts index e8d9e38e..7aab9f07 100644 --- a/src/lib/ae_events/ae_events__event_presentation.ts +++ b/src/lib/ae_events/ae_events__event_presentation.ts @@ -10,7 +10,7 @@ import { load_ae_obj_li__event_presenter } from '$lib/ae_events/ae_events__event const ae_promises: key_val = {}; -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_id__event_presentation({ api_cfg, event_presentation_id, @@ -37,11 +37,11 @@ export async function load_ae_obj_id__event_presentation({ log_lvl?: number; }): Promise { if (log_lvl) { - console.log(`*** load_ae_obj_id__event_presentation() *** [V3] id=${event_presentation_id}`); + console.log(`*** load_ae_obj_id__event_presentation() *** id=${event_presentation_id}`); } try { - ae_promises.load__event_presentation_obj = await api.get_ae_obj_v3({ + const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_presentation', obj_id: event_presentation_id, @@ -49,16 +49,18 @@ export async function load_ae_obj_id__event_presentation({ log_lvl }); - if (ae_promises.load__event_presentation_obj) { + if (result) { + const processed = await process_ae_obj__event_presentation_props({ + obj_li: [result], + log_lvl + }); + ae_promises.load__event_presentation_obj = processed[0]; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_presentation_props({ - obj_li: [ae_promises.load__event_presentation_obj], - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presentation', - obj_li: processed_obj_li, + obj_li: [ae_promises.load__event_presentation_obj], properties_to_save, log_lvl }); @@ -84,7 +86,8 @@ export async function load_ae_obj_id__event_presentation({ * Helper to handle nested collection loads for a presentation */ async function _handle_nested_loads(presentation_obj: any, { api_cfg, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }: any) { - const current_presentation_id = presentation_obj.event_presentation_id_random || presentation_obj.event_presentation_id || presentation_obj.id; + // String-Only ID Vision: the '_id' field IS the string ID + const current_presentation_id = presentation_obj.id || presentation_obj.event_presentation_id; if (inc_file_li) { presentation_obj.event_file_li = await load_ae_obj_li__event_file({ @@ -116,7 +119,7 @@ async function _handle_nested_loads(presentation_obj: any, { api_cfg, inc_file_l return presentation_obj; } -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_li__event_presentation({ api_cfg, for_obj_type = 'event_session', @@ -151,11 +154,11 @@ export async function load_ae_obj_li__event_presentation({ log_lvl?: number; }): Promise { if (log_lvl) { - console.log(`*** load_ae_obj_li__event_presentation() *** [V3] for=${for_obj_type}:${for_obj_id}`); + console.log(`*** load_ae_obj_li__event_presentation() *** for=${for_obj_type}:${for_obj_id}`); } try { - ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_v3({ + const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_presentation', for_obj_type, @@ -168,16 +171,18 @@ export async function load_ae_obj_li__event_presentation({ log_lvl }); - if (ae_promises.load__event_presentation_obj_li) { + if (result_li) { + const processed = await process_ae_obj__event_presentation_props({ + obj_li: result_li, + log_lvl + }); + ae_promises.load__event_presentation_obj_li = processed; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_presentation_props({ - obj_li: ae_promises.load__event_presentation_obj_li, - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presentation', - obj_li: processed_obj_li, + obj_li: ae_promises.load__event_presentation_obj_li, properties_to_save, log_lvl }); @@ -224,35 +229,40 @@ export async function create_ae_obj__event_presentation({ log_lvl?: number; }): Promise { if (log_lvl) { - console.log(`*** create_ae_obj__event_presentation() *** [V3] session=${event_session_id}`); + console.log(`*** create_ae_obj__event_presentation() *** session=${event_session_id}`); } const result = await api.create_ae_obj_v3({ api_cfg, obj_type: 'event_presentation', fields: { - event_id_random: event_id, - event_session_id_random: event_session_id, + event_id, + event_session_id, ...data_kv }, log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_presentation_props({ + if (result) { + const processed = await process_ae_obj__event_presentation_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -270,7 +280,7 @@ export async function delete_ae_obj_id__event_presentation({ log_lvl?: number; }) { if (log_lvl) { - console.log(`*** delete_ae_obj_id__event_presentation() *** [V3] id=${event_presentation_id}`); + console.log(`*** delete_ae_obj_id__event_presentation() *** id=${event_presentation_id}`); } const result = await api.delete_ae_obj_v3({ @@ -303,7 +313,7 @@ export async function update_ae_obj__event_presentation({ log_lvl?: number; }): Promise { if (log_lvl) { - console.log(`*** update_ae_obj__event_presentation() *** [V3] id=${event_presentation_id}`); + console.log(`*** update_ae_obj__event_presentation() *** id=${event_presentation_id}`); } const result = await api.update_ae_obj_v3({ @@ -314,21 +324,26 @@ export async function update_ae_obj__event_presentation({ log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_presentation_props({ + if (result) { + const processed = await process_ae_obj__event_presentation_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-21 to Restore Full Aether Search Logic @@ -362,12 +377,12 @@ export async function search__event_presentation({ log_lvl?: number; }): Promise { if (log_lvl) { - console.log(`*** search__event_presentation() *** [V3] event_id=${event_id} ft=${fulltext_search_qry_str}`); + console.log(`*** search__event_presentation() *** event_id=${event_id} ft=${fulltext_search_qry_str}`); } const search_query: any = { q: '', - and: [{ field: 'event_id_random', op: 'eq', value: event_id }] + and: [{ field: 'event_id', op: 'eq', value: event_id }] }; const params: key_val = {}; @@ -399,21 +414,25 @@ export async function search__event_presentation({ log_lvl }); - if (result_li && try_cache) { - const processed_obj_li = await process_ae_obj__event_presentation_props({ + if (result_li) { + const processed = await process_ae_obj__event_presentation_props({ obj_li: result_li, log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: processed, + properties_to_save, + log_lvl + }); + } + return processed; } - return result_li || []; + return []; } export const properties_to_save = [ @@ -477,6 +496,7 @@ async function _process_generic_props>({ (processed_obj as any)[newKey] = processed_obj[key]; } } + // String-Only ID Vision: Map [obj_type]_id_random to 'id' const randomIdKey = `${obj_type}_id_random`; if (processed_obj[randomIdKey]) { (processed_obj as any).id = processed_obj[randomIdKey]; diff --git a/src/lib/ae_events/ae_events__event_presenter.ts b/src/lib/ae_events/ae_events__event_presenter.ts index 9ed5559c..6258e110 100644 --- a/src/lib/ae_events/ae_events__event_presenter.ts +++ b/src/lib/ae_events/ae_events__event_presenter.ts @@ -9,7 +9,7 @@ import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file const ae_promises: key_val = {}; -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_id__event_presenter({ api_cfg, event_presenter_id, @@ -30,7 +30,7 @@ export async function load_ae_obj_id__event_presenter({ } try { - ae_promises.load__event_presenter_obj = await api.get_ae_obj_v3({ + const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_presenter', obj_id: event_presenter_id, @@ -38,16 +38,18 @@ export async function load_ae_obj_id__event_presenter({ log_lvl }); - if (ae_promises.load__event_presenter_obj) { + if (result) { + const processed = await process_ae_obj__event_presenter_props({ + obj_li: [result], + log_lvl + }); + ae_promises.load__event_presenter_obj = processed[0]; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: [ae_promises.load__event_presenter_obj], - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presenter', - obj_li: processed_obj_li, + obj_li: [ae_promises.load__event_presenter_obj], properties_to_save, log_lvl }); @@ -79,7 +81,7 @@ export async function load_ae_obj_id__event_presenter({ return ae_promises.load__event_presenter_obj; } -// Updated 2026-01-20 to V3 +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_li__event_presenter({ api_cfg, for_obj_type = 'event_presentation', @@ -115,7 +117,7 @@ export async function load_ae_obj_li__event_presenter({ } try { - ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_v3({ + const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_presenter', for_obj_type, @@ -128,16 +130,18 @@ export async function load_ae_obj_li__event_presenter({ log_lvl }); - if (ae_promises.load__event_presenter_obj_li) { + if (result_li) { + const processed = await process_ae_obj__event_presenter_props({ + obj_li: result_li, + log_lvl + }); + ae_promises.load__event_presenter_obj_li = processed; + if (try_cache) { - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: ae_promises.load__event_presenter_obj_li, - log_lvl - }); await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presenter', - obj_li: processed_obj_li, + obj_li: ae_promises.load__event_presenter_obj_li, properties_to_save, log_lvl }); @@ -158,7 +162,7 @@ export async function load_ae_obj_li__event_presenter({ if (inc_file_li && ae_promises.load__event_presenter_obj_li) { for (const presenter of ae_promises.load__event_presenter_obj_li) { - const current_presenter_id = presenter.event_presenter_id_random || presenter.event_presenter_id || presenter.id; + const current_presenter_id = presenter.id || presenter.event_presenter_id; presenter.event_file_li = await load_ae_obj_li__event_file({ api_cfg, for_obj_type: 'event_presenter', @@ -200,29 +204,34 @@ export async function create_ae_obj__event_presenter({ api_cfg, obj_type: 'event_presenter', fields: { - event_id_random: event_id, - event_session_id_random: event_session_id, - event_presentation_id_random: event_presentation_id, + event_id, + event_session_id, + event_presentation_id, ...data_kv }, log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_presenter_props({ + if (result) { + const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -284,21 +293,26 @@ export async function update_ae_obj__event_presenter({ log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_presenter_props({ + if (result) { + const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-21 to Restore Full Aether Search Logic @@ -341,7 +355,7 @@ export async function search__event_presenter({ const search_query: any = { q: '', - and: [{ field: 'event_id_random', op: 'eq', value: event_id }] + and: [{ field: 'event_id', op: 'eq', value: event_id }] }; const params: key_val = {}; @@ -376,21 +390,25 @@ export async function search__event_presenter({ log_lvl }); - if (result_li && try_cache) { - const processed_obj_li = await process_ae_obj__event_presenter_props({ + if (result_li) { + const processed = await process_ae_obj__event_presenter_props({ obj_li: result_li, log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed, + properties_to_save, + log_lvl + }); + } + return processed; } - return result_li || []; + return []; } /** @@ -528,6 +546,7 @@ async function _process_generic_props>({ (processed_obj as any)[newKey] = processed_obj[key]; } } + // String-Only ID Vision: Map [obj_type]_id_random to 'id' const randomIdKey = `${obj_type}_id_random`; if (processed_obj[randomIdKey]) { (processed_obj as any).id = processed_obj[randomIdKey]; diff --git a/src/lib/ae_events/ae_events__event_session.ts b/src/lib/ae_events/ae_events__event_session.ts index e46f6e18..4089bd39 100644 --- a/src/lib/ae_events/ae_events__event_session.ts +++ b/src/lib/ae_events/ae_events__event_session.ts @@ -10,7 +10,7 @@ import { load_ae_obj_li__event_presentation } from '$lib/ae_events/ae_events__ev const ae_promises: key_val = {}; -// Updated 2026-01-26 (SWR Optimization) +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_id__event_session({ api_cfg, event_session_id, @@ -76,11 +76,13 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view, try { const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_session', obj_id: event_session_id, view, log_lvl }); if (result) { + let processed_obj = result; if (try_cache) { const processed = await process_ae_obj__event_session_props({ obj_li: [result], log_lvl }); + processed_obj = processed[0]; await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl }); } - return await _handle_nested_loads(result, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }); + return await _handle_nested_loads(processed_obj, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }); } } catch (e) {} return null; @@ -90,7 +92,8 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view, * Helper to handle nested collection loads for a session */ async function _handle_nested_loads(session_obj: any, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }: any) { - const current_session_id = session_obj.event_session_id_random || session_obj.event_session_id || session_obj.id; + // String-Only ID Vision: the '_id' field IS the string ID + const current_session_id = session_obj.id || session_obj.event_session_id; const tasks = []; if (inc_file_li) { @@ -111,7 +114,7 @@ async function _handle_nested_loads(session_obj: any, { api_cfg, inc_file_li, in return session_obj; } -// Updated 2026-01-26 (SWR Optimization) +// Updated 2026-01-27 to V3 String-Only ID Standard export async function load_ae_obj_li__event_session({ api_cfg, for_obj_type = 'event', @@ -183,14 +186,15 @@ async function _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_i try { const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_session', for_obj_type, for_obj_id, enabled, hidden, limit, offset, order_by_li, log_lvl }); if (result_li) { + let processed_li = result_li; if (try_cache) { - const processed = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl }); - await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl }); + processed_li = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl }); + await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed_li, properties_to_save, log_lvl }); } - for (const s of result_li) { + for (const s of processed_li) { await _handle_nested_loads(s, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }); } - return result_li; + return processed_li; } } catch (e) {} return []; @@ -218,27 +222,32 @@ export async function create_ae_obj__event_session({ api_cfg, obj_type: 'event_session', fields: { - event_id_random: event_id, + event_id, ...data_kv }, log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_session_props({ + if (result) { + const processed = await process_ae_obj__event_session_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-20 to V3 @@ -300,21 +309,26 @@ export async function update_ae_obj__event_session({ log_lvl }); - if (result && try_cache) { - const processed_obj_li = await process_ae_obj__event_session_props({ + if (result) { + const processed = await process_ae_obj__event_session_props({ obj_li: [result], log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + const processed_obj = processed[0]; + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: [processed_obj], + properties_to_save, + log_lvl + }); + } + return processed_obj; } - return result; + return null; } // Updated 2026-01-21 to Restore Full Aether Search logic @@ -363,7 +377,7 @@ export async function search__event_session({ const search_query: any = { q: '', - and: [{ field: 'event_id_random', op: 'eq', value: event_id }] + and: [{ field: 'event_id', op: 'eq', value: event_id }] }; const params: key_val = {}; @@ -413,21 +427,25 @@ export async function search__event_session({ log_lvl }); - if (result_li && try_cache) { - const processed_obj_li = await process_ae_obj__event_session_props({ + if (result_li) { + const processed = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); + + if (try_cache) { + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: processed, + properties_to_save, + log_lvl + }); + } + return processed; } - return result_li || []; + return []; } export const qry__event_session = search__event_session; @@ -553,6 +571,7 @@ async function _process_generic_props>({ (processed_obj as any)[newKey] = processed_obj[key]; } } + // String-Only ID Vision: Map [obj_type]_id_random to 'id' const randomIdKey = `${obj_type}_id_random`; if (processed_obj[randomIdKey]) { (processed_obj as any).id = processed_obj[randomIdKey]; diff --git a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte index e6aa958f..8289ee13 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte @@ -17,7 +17,7 @@ let sync_results: Record = $state({}); let sync_stats = $state({ total: 0, cached: 0, missing: 0 }); let last_heartbeat: string | null = $state(null); - + // Loop Timings (Visible in UI) let loop_info = $state({ event: 90000, @@ -43,12 +43,12 @@ if (info) { $ae_loc.home_directory = info.home_directory; $ae_loc.tmp_directory = info.tmp_directory; - + // Also sync into native_device for redundancy if (!$ae_loc.native_device) $ae_loc.native_device = {}; $ae_loc.native_device.home_directory = info.home_directory; $ae_loc.native_device.tmp_directory = info.tmp_directory; - + if (log_lvl) console.log('Sync: Native OS metadata hydrated.', { home: info.home_directory }); } } catch (err) { @@ -57,7 +57,7 @@ } const dev = $ae_loc.native_device || {}; - + // Load timings from device config loop_info.event = dev.check_event_loop_period || 90000; loop_info.device = dev.check_event_device_loop_period || 60000; @@ -104,7 +104,7 @@ const all_for_ids = [...session_ids, ...presentation_ids, ...presenter_ids, $events_slct.event_id]; const files = await db_events.file.where('for_id').anyOf(all_for_ids).toArray(); - + sync_stats.total = files.length; let cached_count = 0; let missing_count = 0; @@ -113,8 +113,8 @@ if (!file_obj.hash_sha256) continue; if (sync_results[file_obj.event_file_id] === 'success') { cached_count++; continue; } - const exists = await native.check_hash_file_cache({ - cache_root, + const exists = await native.check_hash_file_cache({ + cache_root, hash: file_obj.hash_sha256, hash_prefix_length: prefix_len }); @@ -163,8 +163,8 @@ */ async function run_device_heartbeat() { const dev = $ae_loc.native_device; - const device_id = dev?.event_device_id_random || dev?.id_random || dev?.event_device_id || dev?.id; - + const device_id = dev?.event_device_id || dev?.id_random || dev?.event_device_id_random || dev?.id; + if (!device_id) { if (log_lvl) console.warn('Sync: Heartbeat skipped, no device_id found in $ae_loc.native_device.'); $events_sess.launcher.heartbeat_info.status = 'error'; @@ -248,11 +248,11 @@ NATIVE SYNC MONITOR - +
Room Status: {sync_stats.cached} / {sync_stats.total} Files - + Prefix Len: {$ae_loc.native_device?.hash_prefix_length || 2} chars @@ -284,7 +284,7 @@ {/if} {#if currently_syncing} - {:else} -
+{/if} \ No newline at end of file diff --git a/src/routes/events/[event_id]/event_page_menu.svelte b/src/routes/events/[event_id]/event_page_menu.svelte index d705593b..282bc481 100644 --- a/src/routes/events/[event_id]/event_page_menu.svelte +++ b/src/routes/events/[event_id]/event_page_menu.svelte @@ -178,7 +178,7 @@ .update_ae_obj_id_crud_v2({ api_cfg: $ae_api, object_type: 'event', - object_id: $lq__event_obj?.event_id_random, + object_id: $lq__event_obj?.event_id, object_reload: true, field_name: 'alert', new_field_value: new_alert_value, diff --git a/src/routes/events/ae_comp__event_session_obj_li.svelte b/src/routes/events/ae_comp__event_session_obj_li.svelte index b9f880e6..d91e9fc0 100644 --- a/src/routes/events/ae_comp__event_session_obj_li.svelte +++ b/src/routes/events/ae_comp__event_session_obj_li.svelte @@ -142,7 +142,7 @@ {#if session_obj?.alert && $ae_loc.trusted_access} {/if} @@ -191,7 +191,7 @@ {#if (show__session_presentations || show__session_files) && $ae_loc.manager_access} -