feat: Migrate ESLint to flat config and resolve initial linting errors

Migrated the ESLint configuration to the new flat config format ()
and addressed several initial linting errors.

Key changes include:
- Updated ESLint configuration to treat  as warnings instead of errors.
- Fixed  errors in  by declaring  and .
- Corrected  error in  by using  instead of an out-of-scope .
- Resolved  error in  by replacing the undefined  directive with the  component.
- Addressed  errors in  by replacing  with  and  with .
- Fixed  errors in  by importing necessary modules (, , ) and adding missing props (, , , , ).
This commit is contained in:
Scott Idem
2025-11-17 18:46:54 -05:00
parent b99e85f1db
commit 7e1eaba3bc
374 changed files with 95654 additions and 93952 deletions

View File

@@ -1,7 +1,5 @@
{ {
"prettier.documentSelectors": [ "prettier.documentSelectors": ["**/*.svelte"],
"**/*.svelte"
],
"tailwindCSS.classAttributes": [ "tailwindCSS.classAttributes": [
"class", "class",
"accent", "accent",

View File

@@ -3,111 +3,140 @@
This document outlines the overall architecture and key technologies used in the Aether SvelteKit frontend project. This document outlines the overall architecture and key technologies used in the Aether SvelteKit frontend project.
## 1. Project Overview ## 1. Project Overview
The Aether project is a Svelte and SvelteKit based application, utilizing Tailwind CSS and Skeleton for styling and UI elements. It serves as the frontend UI/UX for the Aether system, which interacts with a Python FastAPI backend. The Aether project is a Svelte and SvelteKit based application, utilizing Tailwind CSS and Skeleton for styling and UI elements. It serves as the frontend UI/UX for the Aether system, which interacts with a Python FastAPI backend.
## 2. Core Technologies ## 2. Core Technologies
* **Frontend Framework:** Svelte 5 and SvelteKit v2
* **Routing:** SvelteKit's file-system based routing. - **Frontend Framework:** Svelte 5 and SvelteKit v2
* **Styling:** Tailwind CSS 3.x (with plans to upgrade to 4.x when ShadCN is ready) - **Routing:** SvelteKit's file-system based routing.
* **UI Component Libraries:** - **Styling:** Tailwind CSS 3.x (with plans to upgrade to 4.x when ShadCN is ready)
* Skeleton (Design System, Tailwind Components, Functional Components - with plans to upgrade to v3) - **UI Component Libraries:**
* Flowbite (Tailwind Components) - Skeleton (Design System, Tailwind Components, Functional Components - with plans to upgrade to v3)
* **Note:** ShadCN is currently used but is planned for removal. - Flowbite (Tailwind Components)
* **Text/Code Editors:** - **Note:** ShadCN is currently used but is planned for removal.
* CodeMirror 6.x (primary text and code editor, planned for rich text editing) - **Text/Code Editors:**
* Edra (TipTap based Rich Text Editor) - CodeMirror 6.x (primary text and code editor, planned for rich text editing)
* **Note:** ShadEditor TipTap is present but marked for removal, with CodeMirror being the preferred solution for all text editing needs. - Edra (TipTap based Rich Text Editor)
* **Icons:** Lucide Icons (SVG Icons) - **Note:** ShadEditor TipTap is present but marked for removal, with CodeMirror being the preferred solution for all text editing needs.
* **Markdown Parsing:** `marked` library - **Icons:** Lucide Icons (SVG Icons)
* **State Management:** Svelte stores, potentially with `liveQuery` from Dexie for reactive IndexedDB interactions. - **Markdown Parsing:** `marked` library
- **State Management:** Svelte stores, potentially with `liveQuery` from Dexie for reactive IndexedDB interactions.
## 3. Module Structure ## 3. Module Structure
The Aether project is organized into several modules, categorized as Core, Extended, and Custom. The Aether project is organized into several modules, categorized as Core, Extended, and Custom.
### 3.1. Official Modules ### 3.1. Official Modules
#### Core Modules #### Core Modules
These are foundational modules essential for the application's basic functionality. These are foundational modules essential for the application's basic functionality.
* **Accounts:** Minimal implementation.
* **Files:** Manages hosted files. - **Accounts:** Minimal implementation.
* **People:** Minimal implementation for person records. - **Files:** Manages hosted files.
* **Sites:** Minimal implementation for site configurations. - **People:** Minimal implementation for person records.
* **Users:** Minimal implementation for user management. - **Sites:** Minimal implementation for site configurations.
- **Users:** Minimal implementation for user management.
#### Extended Modules #### Extended Modules
These modules provide additional features and functionalities. These modules provide additional features and functionalities.
* **Archives:** Minimal implementation.
* **Events:** Includes features for Badges and Presentation Management. - **Archives:** Minimal implementation.
* **Posts:** Minimal implementation. - **Events:** Includes features for Badges and Presentation Management.
* **Journals:** Manages journal entries. - **Posts:** Minimal implementation.
- **Journals:** Manages journal entries.
#### Custom Modules #### Custom Modules
These modules are tailored for specific client needs. These modules are tailored for specific client needs.
* **IDAA:** Includes Archives, Bulletin Board (BB), and Recovery Meetings functionalities.
- **IDAA:** Includes Archives, Bulletin Board (BB), and Recovery Meetings functionalities.
## 4. Data Storage Mechanisms ## 4. Data Storage Mechanisms
### 4.1. Local Storage ### 4.1. Local Storage
Used for client-side persistence of various application states and configurations. Used for client-side persistence of various application states and configurations.
* `api`: API-related settings.
* `app`: Global application settings. - `api`: API-related settings.
* `core`: Settings and data specific to core modules. - `app`: Global application settings.
* `<module>`: Settings and data specific to extended modules. - `core`: Settings and data specific to core modules.
* `<custom>`: Settings and data specific to custom modules. - `<module>`: Settings and data specific to extended modules.
- `<custom>`: Settings and data specific to custom modules.
### 4.2. IndexedDB (Dexie.js) ### 4.2. IndexedDB (Dexie.js)
Used for more structured client-side data storage, often for caching and offline capabilities. Used for more structured client-side data storage, often for caching and offline capabilities.
* `ae_core_db`: Core database instance.
* `<module>`: Module-specific database instances. - `ae_core_db`: Core database instance.
* `<custom>`: Custom module-specific database instances (none currently defined). - `<module>`: Module-specific database instances.
- `<custom>`: Custom module-specific database instances (none currently defined).
## 5. Data Sorting ## 5. Data Sorting
Standardized sorting orders are applied across various data lists. Standardized sorting orders are applied across various data lists.
* **Default/General:** `group > priority > sort > updated_on/created_on`
* **Specific (e.g., Events):** `type > start_date/time > code or name` - **Default/General:** `group > priority > sort > updated_on/created_on`
- **Specific (e.g., Events):** `type > start_date/time > code or name`
## 6. Object Properties and Fields ## 6. Object Properties and Fields
A set of standardized field names and types are used across Aether objects. A set of standardized field names and types are used across Aether objects.
### 6.1. Core Standard Fields ### 6.1. Core Standard Fields
These fields are expected to be present in most Aether objects. These fields are expected to be present in most Aether objects.
* `id`: Primary key for an object (internal use, often a UUID).
* `id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters). - `id`: Primary key for an object (internal use, often a UUID).
* `<object_type>_id_random`: Specific random ID for an object (e.g., `person_id_random`). - `id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters).
* `code`: Short, unique identifier. - `<object_type>_id_random`: Specific random ID for an object (e.g., `person_id_random`).
* `name`: Display name. - `code`: Short, unique identifier.
* `enable`: Boolean for active/inactive status. - `name`: Display name.
* `hide`: Boolean for visibility. - `enable`: Boolean for active/inactive status.
* `priority`: Numeric value for ordering. - `hide`: Boolean for visibility.
* `sort`: Numeric value for ordering. - `priority`: Numeric value for ordering.
* `group`: Categorization string. - `sort`: Numeric value for ordering.
* `notes`: General notes/comments. - `group`: Categorization string.
* `created_on`: Timestamp of creation. - `notes`: General notes/comments.
* `updated_on`: Timestamp of last update. - `created_on`: Timestamp of creation.
- `updated_on`: Timestamp of last update.
### 6.2. Special Use Fields ### 6.2. Special Use Fields
Fields with specific purposes or conditional usage. Fields with specific purposes or conditional usage.
* `for_type`: Indicates the type of object this object is linked to.
* `for_id`: The ID of the object this object is linked to. - `for_type`: Indicates the type of object this object is linked to.
* `archive_on`: Timestamp for archiving. - `for_id`: The ID of the object this object is linked to.
* `passcode`: Password or access code. - `archive_on`: Timestamp for archiving.
* `external_id`: ID from an external system. - `passcode`: Password or access code.
- `external_id`: ID from an external system.
### 6.3. Configuration and JSON Fields ### 6.3. Configuration and JSON Fields
Fields designed to store JSON data. Fields designed to store JSON data.
* `cfg_json`: Configuration data in JSON format.
* `data_json`: General data in JSON format. - `cfg_json`: Configuration data in JSON format.
* `linked_li_json`: List of linked items in JSON format. - `data_json`: General data in JSON format.
- `linked_li_json`: List of linked items in JSON format.
### 6.4. Special Generated Fields (Client-side) ### 6.4. Special Generated Fields (Client-side)
Fields generated on the client-side, primarily for sorting or UI logic. Fields generated on the client-side, primarily for sorting or UI logic.
* `tmp_sort_1`
* `tmp_sort_2` - `tmp_sort_1`
* `tmp_sort_3` - `tmp_sort_2`
- `tmp_sort_3`
### 6.5. Future Standard Fields ### 6.5. Future Standard Fields
A list of potential future standard fields, often prefixed with `obj_`. These are currently conceptual and not yet fully integrated. A list of potential future standard fields, often prefixed with `obj_`. These are currently conceptual and not yet fully integrated.
* `obj_id`, `obj_ext_uid`, `obj_ext_id`, `obj_import_id`, `obj_code`, `obj_account_id`, `obj_passcode`, `obj_type`, `obj_type_ver_id`, `obj_name`, `obj_summary`, `obj_outline`, `obj_description`, `obj_enable`, `obj_enable_on`, `obj_archive_on`, `obj_hide`, `obj_priority`, `obj_sort`, `obj_group`, `obj_cfg_json`, `obj_notes`, `obj_created_on`, `obj_updated_on`.
- `obj_id`, `obj_ext_uid`, `obj_ext_id`, `obj_import_id`, `obj_code`, `obj_account_id`, `obj_passcode`, `obj_type`, `obj_type_ver_id`, `obj_name`, `obj_summary`, `obj_outline`, `obj_description`, `obj_enable`, `obj_enable_on`, `obj_archive_on`, `obj_hide`, `obj_priority`, `obj_sort`, `obj_group`, `obj_cfg_json`, `obj_notes`, `obj_created_on`, `obj_updated_on`.
## 7. IndexedDB LiveQuery Usage ## 7. IndexedDB LiveQuery Usage
* `lq__xyz_obj`: Used for general read-only access to liveQuery results.
* `lqw__xyz_obj`: Used for forms and binding values, representing a writable snapshot of liveQuery results. - `lq__xyz_obj`: Used for general read-only access to liveQuery results.
* **Note:** Care must be taken when binding to `lqw__xyz_obj` to manage updates and potential conflicts with the underlying liveQuery. - `lqw__xyz_obj`: Used for forms and binding values, representing a writable snapshot of liveQuery results.
- **Note:** Care must be taken when binding to `lqw__xyz_obj` to manage updates and potential conflicts with the underlying liveQuery.

View File

@@ -5,128 +5,144 @@ This document details the various UI components used throughout the Aether Svelt
## 1. Aether Components (UI/UX) ## 1. Aether Components (UI/UX)
### 1.1. System Components ### 1.1. System Components
These components are part of the core application shell and provide global functionalities. These components are part of the core application shell and provide global functionalities.
* **`header`**: Application-wide header.
* **`main/module`s**: Main content area for modules. - **`header`**: Application-wide header.
* **`footer`**: Application-wide footer. - **`main/module`s**: Main content area for modules.
* **`app`**: Provides global application functionalities such as: - **`footer`**: Application-wide footer.
* Refresh application state. - **`app`**: Provides global application functionalities such as:
* Clear IndexedDB. - Refresh application state.
* Clear local storage (settings). - Clear IndexedDB.
* Toggle iframe visibility (also updates URL parameter). - Clear local storage (settings).
* Copy current URL. - Toggle iframe visibility (also updates URL parameter).
* Generate and display QR codes. - Copy current URL.
* **`menu`**: Various menus for different purposes: - Generate and display QR codes.
* **`mode`**: Edit mode toggle, more options (all or details). - **`menu`**: Various menus for different purposes:
* **`access_type`**: Passcode input, clear access. - **`mode`**: Edit mode toggle, more options (all or details).
* **`user`**: Sign in/out, reset password, email link, change username and email. - **`access_type`**: Passcode input, clear access.
* **`theme`**: Mode (light/dark), name (theme list). - **`user`**: Sign in/out, reset password, email link, change username and email.
* **`debug`**: Developer-facing tools: - **`theme`**: Mode (light/dark), name (theme list).
* Toggle debug mode (also updates URL parameter). - **`debug`**: Developer-facing tools:
* Show core and module storages. - Toggle debug mode (also updates URL parameter).
* Manually set initial timestamp. - Show core and module storages.
* **`scroll_to`**: Navigation controls for scrolling: - Manually set initial timestamp.
* Scroll to top of the page. - **`scroll_to`**: Navigation controls for scrolling:
* Scroll page up. - Scroll to top of the page.
* Scroll page down. - Scroll page up.
* Scroll to bottom of the page. - Scroll page down.
- Scroll to bottom of the page.
### 1.2. Core Components ### 1.2. Core Components
These are reusable components that provide common functionalities across different modules. These are reusable components that provide common functionalities across different modules.
* **`copy_btn`**: A button to copy content to the clipboard.
* Properties: `clipboard`, `bind:value`, `btn_text`, `btn_html`. - **`copy_btn`**: A button to copy content to the clipboard.
* **`txt_editor`**: A basic text area editor. - Properties: `clipboard`, `bind:value`, `btn_text`, `btn_html`.
* **`md_editor`**: Markdown editor. - **`txt_editor`**: A basic text area editor.
* Uses CodeMirror (planned for rich text editing). - **`md_editor`**: Markdown editor.
* **Note:** ShadEditor TipTap is present but marked for removal. ShadCN components are also being phased out in favor of CodeMirror for text editing. - Uses CodeMirror (planned for rich text editing).
* **`html_editor`**: HTML editor. - **Note:** ShadEditor TipTap is present but marked for removal. ShadCN components are also being phased out in favor of CodeMirror for text editing.
* **`media_player`**: Component for playing media files. - **`html_editor`**: HTML editor.
* Properties: `hosted_file`, `archive_content`, `media_player`. - **`media_player`**: Component for playing media files.
* Bindings: `bind:host_id`, `bind:media_type`. - Properties: `hosted_file`, `archive_content`, `media_player`.
* Status: `stopped`, `paused`, `playing`. - Bindings: `bind:host_id`, `bind:media_type`.
* **`hosted_file_li`**: Manages a list of hosted files, making them available for selection. - Status: `stopped`, `paused`, `playing`.
* **`hosted_file_link_to`**: Lists links per object, with bindings to add/remove links. - **`hosted_file_li`**: Manages a list of hosted files, making them available for selection.
* **`upload_to_host`**: Component for uploading files to the host. - **`hosted_file_link_to`**: Lists links per object, with bindings to add/remove links.
* Handles multiple files. - **`upload_to_host`**: Component for uploading files to the host.
* Properties: `link_type`, `link_id`, `inner fragment` (label html). - Handles multiple files.
* Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. - Properties: `link_type`, `link_id`, `inner fragment` (label html).
* Status: `started`, `uploading`, `finished`. - Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`.
* **`upload_file_tbl`**: Table for uploaded files, includes checks for duplicate file hashes and removal from the list. - Status: `started`, `uploading`, `finished`.
* **`download_from_host`**: Component for downloading files from the host. - **`upload_file_tbl`**: Table for uploaded files, includes checks for duplicate file hashes and removal from the list.
* Bindings: `bind:host_file_id`, `bind:filename`, `bind:file_ext`. - **`download_from_host`**: Component for downloading files from the host.
* Properties: `btn inner fragment`. - Bindings: `bind:host_file_id`, `bind:filename`, `bind:file_ext`.
* Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. - Properties: `btn inner fragment`.
* Status: `started`, `downloading`, `finished`. - Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`.
* **`data_store`**: Component for interacting with data stores. - Status: `started`, `downloading`, `finished`.
* **`ae_crud`**: Generic CRUD (Create, Read, Update, Delete) component. - **`data_store`**: Component for interacting with data stores.
* **Note:** Needs simplification. - **`ae_crud`**: Generic CRUD (Create, Read, Update, Delete) component.
* Properties: `obj`, `prop`, `current_value`. - **Note:** Needs simplification.
* Bindings: `bind:value`, `bind:trigger`, `inner fragment`. - Properties: `obj`, `prop`, `current_value`.
* **`ae_obj_prop_val`**: A wrapper for a function to manage object property values. - Bindings: `bind:value`, `bind:trigger`, `inner fragment`.
* Bindings: `bind:obj_type`, `bind:obj_id`, `bind:obj_prop`, `bind:obj_value`, `bind:obj_new_value`, `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. - **`ae_obj_prop_val`**: A wrapper for a function to manage object property values.
* Status: `status`, `result`. - Bindings: `bind:obj_type`, `bind:obj_id`, `bind:obj_prop`, `bind:obj_value`, `bind:obj_new_value`, `bind:trigger`, `bind:show_spinner`, `bind:show_percent`.
* **`sql_qry`**: Component for executing SQL queries. - Status: `status`, `result`.
* **`obj_tbl`**: Object SQL results table or similar. - **`sql_qry`**: Component for executing SQL queries.
* **`qr_scanner`**: Component for scanning QR codes. - **`obj_tbl`**: Object SQL results table or similar.
* **`websocket`**: Component for WebSocket communication. - **`qr_scanner`**: Component for scanning QR codes.
- **`websocket`**: Component for WebSocket communication.
### 1.3. Main / Module Components ### 1.3. Main / Module Components
These are components specific to main application sections or individual modules. These are components specific to main application sections or individual modules.
* **`menu`**:
* **`options`**: Various settings, show/hide content and options, limit, sorting options. - **`menu`**:
* **`actions`**: Various actions, sign in/out, email. - **`options`**: Various settings, show/hide content and options, limit, sorting options.
- **`actions`**: Various actions, sign in/out, email.
### 1.4. Object Menu ### 1.4. Object Menu
A standardized menu for interacting with objects. A standardized menu for interacting with objects.
* **Properties Displayed:** `id`, `name`, `group`, `priority`, `sort`, `alert`, `hide`, `enable`, `note`.
* **Future Properties:** `ext_id`, `ext_sys_id`, `code` (not yet ready). - **Properties Displayed:** `id`, `name`, `group`, `priority`, `sort`, `alert`, `hide`, `enable`, `note`.
* **Actions:** `create`, `view`, `edit`, `update`, `hide`, `disable`, `delete`, `alert` (message), `archive` (not yet ready). - **Future Properties:** `ext_id`, `ext_sys_id`, `code` (not yet ready).
* **Future Actions:** `copy`, `import`. - **Actions:** `create`, `view`, `edit`, `update`, `hide`, `disable`, `delete`, `alert` (message), `archive` (not yet ready).
* **Sort Options:** - **Future Actions:** `copy`, `import`.
* `[default]`: `group > priority > sort (ASC/DESC) > alert > name` - **Sort Options:**
* `[sort_updated]`: `group > priority > sort (ASC/DESC) > alert > updated_on > created_on` - `[default]`: `group > priority > sort (ASC/DESC) > alert > name`
* `[priority_updated]`: `group > priority > updated_on (ASC/DESC) > created_on` - `[sort_updated]`: `group > priority > sort (ASC/DESC) > alert > updated_on > created_on`
* `[priority_name]`: `group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on` - `[priority_updated]`: `group > priority > updated_on (ASC/DESC) > created_on`
* `[name]`: `priority > name (ASC/DESC) > sort > alert > updated_on > created_on` - `[priority_name]`: `group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on`
* `[created_on]`: `priority > created_on (ASC/DESC)` - `[name]`: `priority > name (ASC/DESC) > sort > alert > updated_on > created_on`
* `[updated_on]`: `priority > updated_on (ASC/DESC) > created_on` - `[created_on]`: `priority > created_on (ASC/DESC)`
- `[updated_on]`: `priority > updated_on (ASC/DESC) > created_on`
## 2. Pop-ups ## 2. Pop-ups
Standardized structure for various types of pop-up elements. Standardized structure for various types of pop-up elements.
* **`modal_header`**:
* `title` - **`modal_header`**:
* `close` button - `title`
* **`modal_main`**: Main content area of the modal. - `close` button
* **`modal_meta`**: Meta-information section. - **`modal_main`**: Main content area of the modal.
* **`modal_footer`**: - **`modal_meta`**: Meta-information section.
* `close` button - **`modal_footer`**:
* **`Pop-up Modal (blocking)`**: A modal that blocks interaction with the rest of the page. - `close` button
* `modal position` - **`Pop-up Modal (blocking)`**: A modal that blocks interaction with the rest of the page.
* **`Pop-up Modal Inline`**: A modal that appears inline with content. - `modal position`
* `inline`, `inline-block`, `block` display options. - **`Pop-up Modal Inline`**: A modal that appears inline with content.
* **`Pop-up Dialog`**: A dialog box. - `inline`, `inline-block`, `block` display options.
* `dialog position` - **`Pop-up Dialog`**: A dialog box.
- `dialog position`
## 3. Containers ## 3. Containers
Generic container types used for layout and grouping. Generic container types used for layout and grouping.
### 3.1. Navigation ### 3.1. Navigation
* `link`
* `download` - `link`
- `download`
### 3.2. Forms ### 3.2. Forms
* `save` button/action
* `clear value` action - `save` button/action
* `set null value` action - `clear value` action
- `set null value` action
### 3.3. Other Containers ### 3.3. Other Containers
* `help`: Blue themed container.
* `info`: Blue themed container. - `help`: Blue themed container.
* `alert`: Yellow themed container. - `info`: Blue themed container.
* `warning`: Orange themed container. - `alert`: Yellow themed container.
* `error`: Red themed container. - `warning`: Orange themed container.
* `message`: Green themed container. - `error`: Red themed container.
- `message`: Green themed container.
## 4. CSS Styling for UI Elements ## 4. CSS Styling for UI Elements
* **Warning/Hide Buttons:** `variant-soft-warning hover:variant-filled-warning`
* **Error/Delete/Disable Buttons:** `variant-soft-error hover:variant-filled-error` - **Warning/Hide Buttons:** `variant-soft-warning hover:variant-filled-warning`
* **Submenu:** `flex flex-row items-center justify-center gap-1` - **Error/Delete/Disable Buttons:** `variant-soft-error hover:variant-filled-error`
- **Submenu:** `flex flex-row items-center justify-center gap-1`

View File

@@ -5,68 +5,86 @@ This document outlines the key data structures and their properties used within
## 1. Object Properties and Fields ## 1. Object Properties and Fields
### 1.1. Core Standard Fields ### 1.1. Core Standard Fields
These fields are expected to be present in most Aether objects, providing a consistent base structure. These fields are expected to be present in most Aether objects, providing a consistent base structure.
* `id`: Primary key for an object (internal use, often a UUID).
* `id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters). - `id`: Primary key for an object (internal use, often a UUID).
* `<object_type>_id_random`: Specific random ID for an object (e.g., `person_id_random`). - `id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters).
* `code`: Short, unique identifier. - `<object_type>_id_random`: Specific random ID for an object (e.g., `person_id_random`).
* `name`: Display name. - `code`: Short, unique identifier.
* `enable`: Boolean for active/inactive status. - `name`: Display name.
* `hide`: Boolean for visibility. - `enable`: Boolean for active/inactive status.
* `priority`: Numeric value for ordering. - `hide`: Boolean for visibility.
* `sort`: Numeric value for ordering. - `priority`: Numeric value for ordering.
* `group`: Categorization string. - `sort`: Numeric value for ordering.
* `notes`: General notes/comments. - `group`: Categorization string.
* `created_on`: Timestamp of creation. - `notes`: General notes/comments.
* `updated_on`: Timestamp of last update. - `created_on`: Timestamp of creation.
- `updated_on`: Timestamp of last update.
### 1.2. Special Use Fields ### 1.2. Special Use Fields
Fields with specific purposes or conditional usage across different object types. Fields with specific purposes or conditional usage across different object types.
* `for_type`: Indicates the type of object this object is linked to (e.g., 'account', 'event').
* `for_id`: The ID of the object this object is linked to. - `for_type`: Indicates the type of object this object is linked to (e.g., 'account', 'event').
* `archive_on`: Timestamp indicating when an object was archived. - `for_id`: The ID of the object this object is linked to.
* `passcode`: A password or access code associated with an object. - `archive_on`: Timestamp indicating when an object was archived.
* `external_id`: An identifier from an external system. - `passcode`: A password or access code associated with an object.
- `external_id`: An identifier from an external system.
### 1.3. Configuration and JSON Fields ### 1.3. Configuration and JSON Fields
Fields designed to store structured data in JSON format. Fields designed to store structured data in JSON format.
* `cfg_json`: Configuration data for an object, stored as a JSON string.
* `data_json`: General purpose data for an object, stored as a JSON string. - `cfg_json`: Configuration data for an object, stored as a JSON string.
* `linked_li_json`: A list of linked items, stored as a JSON string. - `data_json`: General purpose data for an object, stored as a JSON string.
- `linked_li_json`: A list of linked items, stored as a JSON string.
### 1.4. Special Generated Fields (Client-side) ### 1.4. Special Generated Fields (Client-side)
These fields are generated on the client-side, primarily for facilitating UI logic, such as sorting. They are not typically stored in the backend database. These fields are generated on the client-side, primarily for facilitating UI logic, such as sorting. They are not typically stored in the backend database.
* `tmp_sort_1`: Temporary sort field 1.
* `tmp_sort_2`: Temporary sort field 2. - `tmp_sort_1`: Temporary sort field 1.
* `tmp_sort_3`: Temporary sort field 3. - `tmp_sort_2`: Temporary sort field 2.
- `tmp_sort_3`: Temporary sort field 3.
### 1.5. Future Standard Fields ### 1.5. Future Standard Fields
A list of potential future standard fields, often prefixed with `obj_`. These are conceptual and represent planned expansions to the data model. A list of potential future standard fields, often prefixed with `obj_`. These are conceptual and represent planned expansions to the data model.
* `obj_id`, `obj_ext_uid`, `obj_ext_id`, `obj_import_id`, `obj_code`, `obj_account_id`, `obj_passcode`, `obj_type`, `obj_type_ver_id`, `obj_name`, `obj_summary`, `obj_outline`, `obj_description`, `obj_enable`, `obj_enable_on`, `obj_archive_on`, `obj_hide`, `obj_priority`, `obj_sort`, `obj_group`, `obj_cfg_json`, `obj_notes`, `obj_created_on`, `obj_updated_on`.
- `obj_id`, `obj_ext_uid`, `obj_ext_id`, `obj_import_id`, `obj_code`, `obj_account_id`, `obj_passcode`, `obj_type`, `obj_type_ver_id`, `obj_name`, `obj_summary`, `obj_outline`, `obj_description`, `obj_enable`, `obj_enable_on`, `obj_archive_on`, `obj_hide`, `obj_priority`, `obj_sort`, `obj_group`, `obj_cfg_json`, `obj_notes`, `obj_created_on`, `obj_updated_on`.
## 2. Data Sorting ## 2. Data Sorting
Standardized sorting orders are applied across various data lists to ensure consistent presentation. Standardized sorting orders are applied across various data lists to ensure consistent presentation.
* **Default/General Sorting:** `group > priority > sort > updated_on/created_on`
* **Specific Sorting (e.g., for time-based events):** `type > start_date/time > code or name` - **Default/General Sorting:** `group > priority > sort > updated_on/created_on`
- **Specific Sorting (e.g., for time-based events):** `type > start_date/time > code or name`
## 3. Data Storage Mechanisms ## 3. Data Storage Mechanisms
### 3.1. Local Storage ### 3.1. Local Storage
Used for client-side persistence of various application states and configurations. Used for client-side persistence of various application states and configurations.
* `api`: Stores API-related settings and tokens.
* `app`: Stores global application settings and preferences. - `api`: Stores API-related settings and tokens.
* `core`: Stores settings and data specific to core modules. - `app`: Stores global application settings and preferences.
* `<module>`: Stores settings and data specific to extended modules (e.g., `journals`, `events`). - `core`: Stores settings and data specific to core modules.
* `<custom>`: Stores settings and data specific to custom modules (e.g., `idaa`). - `<module>`: Stores settings and data specific to extended modules (e.g., `journals`, `events`).
- `<custom>`: Stores settings and data specific to custom modules (e.g., `idaa`).
### 3.2. IndexedDB (Dexie.js) ### 3.2. IndexedDB (Dexie.js)
Used for more structured client-side data storage, often for caching, offline capabilities, and larger datasets. Used for more structured client-side data storage, often for caching, offline capabilities, and larger datasets.
* `ae_core_db`: The primary Dexie database instance for core application data.
* `<module>`: Module-specific database instances (e.g., `db_journals` for journal data). - `ae_core_db`: The primary Dexie database instance for core application data.
* `<custom>`: Custom module-specific database instances (none currently defined, but reserved for future use). - `<module>`: Module-specific database instances (e.g., `db_journals` for journal data).
- `<custom>`: Custom module-specific database instances (none currently defined, but reserved for future use).
### 3.3. IndexedDB LiveQuery Usage ### 3.3. IndexedDB LiveQuery Usage
Dexie's `liveQuery` is used to provide reactive data streams from IndexedDB. Dexie's `liveQuery` is used to provide reactive data streams from IndexedDB.
* `lq__xyz_obj`: Represents a read-only liveQuery result for a single object.
* `lqw__xyz_obj`: Represents a writable liveQuery result, typically used for forms and data binding. - `lq__xyz_obj`: Represents a read-only liveQuery result for a single object.
* **Note:** When using `lqw__xyz_obj`, developers must carefully manage updates to avoid conflicts with the underlying liveQuery and ensure data integrity. - `lqw__xyz_obj`: Represents a writable liveQuery result, typically used for forms and data binding.
- **Note:** When using `lqw__xyz_obj`, developers must carefully manage updates to avoid conflicts with the underlying liveQuery and ensure data integrity.

View File

@@ -3,31 +3,35 @@
This project is a Svelte and SvelteKit based application, part of the Aether (AE) system. It uses Tailwind CSS and Skeleton for styling and some elements. This is the frontend UI/UX. The backend API uses Python FastAPI. This project is a Svelte and SvelteKit based application, part of the Aether (AE) system. It uses Tailwind CSS and Skeleton for styling and some elements. This is the frontend UI/UX. The backend API uses Python FastAPI.
Core Aether modules Core Aether modules
* accounts - client account, not user account
* hosted_files - accounts - client account, not user account
* people - hosted_files
* users - people
* sites and site_domains - users
- sites and site_domains
Additional Aether modules Additional Aether modules
* events
* presentation management - import the program data (events, session, presentations, presenters, event files, locations/rooms, devices) - events
* launcher - Technically this is used with presentation management. It is part of the native app that uses Electron. One of the libraries is for functions that only work when the site is opened in an Electron app. For example the regular browser can not move files around on the local computer or run local commands. - presentation management - import the program data (events, session, presentations, presenters, event files, locations/rooms, devices)
* badge printing - launcher - Technically this is used with presentation management. It is part of the native app that uses Electron. One of the libraries is for functions that only work when the site is opened in an Electron app. For example the regular browser can not move files around on the local computer or run local commands.
* lead retrieval - attendee tracking; QR codes - badge printing
* journals - journal, documentation, notes, diary, blog, etc - lead retrieval - attendee tracking; QR codes
* idaa - One of my clients - journals - journal, documentation, notes, diary, blog, etc
- idaa - One of my clients
## Documentation ## Documentation
* TODO.md
* Svelte - Introducing runes - https://svelte.dev/blog/runes - TODO.md
* Svelte - Breaking changes in runes mode - https://svelte.dev/docs/svelte/v5-migration-guide#Breaking-changes-in-runes-mode - Svelte - Introducing runes - https://svelte.dev/blog/runes
* Dexie.js - Getting Started - https://dexie.org/docs/Tutorial/Getting-started - Svelte - Breaking changes in runes mode - https://svelte.dev/docs/svelte/v5-migration-guide#Breaking-changes-in-runes-mode
* Dexie.js - API Quick Reference - https://dexie.org/docs/API-Reference#quick-reference - Dexie.js - Getting Started - https://dexie.org/docs/Tutorial/Getting-started
- Dexie.js - API Quick Reference - https://dexie.org/docs/API-Reference#quick-reference
## Ignored Directories ## Ignored Directories
The following directories are ignored for various operations (e.g., search, file listing) to focus on relevant source code: The following directories are ignored for various operations (e.g., search, file listing) to focus on relevant source code:
- `build` - `build`
- `node_modules` - `node_modules`
- `tests` - `tests`
@@ -44,16 +48,16 @@ The refactoring strategy involved creating a local, non-exported `_process_gener
**Key aspects of the refactoring:** **Key aspects of the refactoring:**
* **In-file Generic Helper (`_process_generic_props`):** This function handles common data transformations: - **In-file Generic Helper (`_process_generic_props`):** This function handles common data transformations:
* **`*_random` ID Aliasing:** It automatically iterates over object keys and creates a non-suffixed alias for any key ending in `_random` (e.g., `person_id_random` becomes `person_id`). This is crucial for client-side logic that expects standard ID fields. - **`*_random` ID Aliasing:** It automatically iterates over object keys and creates a non-suffixed alias for any key ending in `_random` (e.g., `person_id_random` becomes `person_id`). This is crucial for client-side logic that expects standard ID fields.
* **`tmp_sort` Field Generation:** It creates a set of basic `tmp_sort` fields for client-side sorting. - **`tmp_sort` Field Generation:** It creates a set of basic `tmp_sort` fields for client-side sorting.
* **`specific_processor` Callback:** Module-specific logic is handled by a `specific_processor` callback function passed to the `_process_generic_props` helper. This allows for: - **`specific_processor` Callback:** Module-specific logic is handled by a `specific_processor` callback function passed to the `_process_generic_props` helper. This allows for:
* **Unique `tmp_sort` Logic:** Modules can override the default `tmp_sort` fields with their own specific sorting requirements. - **Unique `tmp_sort` Logic:** Modules can override the default `tmp_sort` fields with their own specific sorting requirements.
* **Content Processing:** Asynchronous operations like Markdown parsing (using `marked.parse`) are handled within the `specific_processor` for the relevant modules (e.g., `ae_journals__journal_entry.ts`). - **Content Processing:** Asynchronous operations like Markdown parsing (using `marked.parse`) are handled within the `specific_processor` for the relevant modules (e.g., `ae_journals__journal_entry.ts`).
* **Other Special Cases:** Any other module-specific data transformations are handled in this callback. - **Other Special Cases:** Any other module-specific data transformations are handled in this callback.
* **`core__crud_generic.ts` Cleanup:** The generic CRUD functions in `src/lib/ae_core/core__crud_generic.ts` were simplified: - **`core__crud_generic.ts` Cleanup:** The generic CRUD functions in `src/lib/ae_core/core__crud_generic.ts` were simplified:
* The `process_ae_obj__props` function in this file was deprecated. - The `process_ae_obj__props` function in this file was deprecated.
* All calls to `process_ae_obj__props` and `db_save_ae_obj_li__ae_obj` were removed from the generic CRUD functions (`load_ae_obj_id`, `load_ae_obj_li`, etc.). - All calls to `process_ae_obj__props` and `db_save_ae_obj_li__ae_obj` were removed from the generic CRUD functions (`load_ae_obj_id`, `load_ae_obj_li`, etc.).
* These functions are now responsible only for API interaction, delegating all data processing and caching to the module-specific functions that call them. This enforces a cleaner separation of concerns. - These functions are now responsible only for API interaction, delegating all data processing and caching to the module-specific functions that call them. This enforces a cleaner separation of concerns.

View File

@@ -1,83 +1,93 @@
# Aether Project Naming Conventions # Aether Project Naming Conventions
## 1. General Principles ## 1. General Principles
* **Clarity:** Names should clearly convey their purpose and meaning.
* **Consistency:** Adhere strictly to these guidelines across the entire codebase. - **Clarity:** Names should clearly convey their purpose and meaning.
* **Readability:** Prioritize names that are easy to read and understand. - **Consistency:** Adhere strictly to these guidelines across the entire codebase.
* **Conciseness:** Avoid unnecessary verbosity, but not at the expense of clarity. - **Readability:** Prioritize names that are easy to read and understand.
- **Conciseness:** Avoid unnecessary verbosity, but not at the expense of clarity.
## 2. File Naming ## 2. File Naming
* **Logic/Service Files:** `ae_<module>__<concept>.ts` (e.g., `ae_core__account.ts`, `ae_events__event.ts`)
* **Database Definition Files:** `db_<module>.ts` (e.g., `db_core.ts`, `db_journals.ts`) - **Logic/Service Files:** `ae_<module>__<concept>.ts` (e.g., `ae_core__account.ts`, `ae_events__event.ts`)
* **Svelte Store Files:** `ae_<module>_stores.ts` (e.g., `ae_core_stores.ts`, `ae_journals_stores.ts`) - **Database Definition Files:** `db_<module>.ts` (e.g., `db_core.ts`, `db_journals.ts`)
* **Svelte Components:** - **Svelte Store Files:** `ae_<module>_stores.ts` (e.g., `ae_core_stores.ts`, `ae_journals_stores.ts`)
* **Module-specific components:** `ae_comp__<module>__<component_name>.svelte` (e.g., `ae_comp__events__event_card.svelte`) - **Svelte Components:**
* **Generic/reusable components:** `element_<component_name>.svelte` (e.g., `element_input_file.svelte`, `element_qr_scanner_v2.svelte`) - **Module-specific components:** `ae_comp__<module>__<component_name>.svelte` (e.g., `ae_comp__events__event_card.svelte`)
* **SvelteKit Routes:** Follow SvelteKit's standard routing conventions (e.g., `+page.svelte`, `+layout.svelte`, `[id]/+page.svelte`). - **Generic/reusable components:** `element_<component_name>.svelte` (e.g., `element_input_file.svelte`, `element_qr_scanner_v2.svelte`)
* **CSS Files:** `ae-<module>-<purpose>.css` (e.g., `ae-c-idaa-light.css`, `ae-osit-default.css`) - **SvelteKit Routes:** Follow SvelteKit's standard routing conventions (e.g., `+page.svelte`, `+layout.svelte`, `[id]/+page.svelte`).
- **CSS Files:** `ae-<module>-<purpose>.css` (e.g., `ae-c-idaa-light.css`, `ae-osit-default.css`)
## 3. Function and Variable Naming ## 3. Function and Variable Naming
* **Style:** Strictly `snake_case` for all function and variable names.
* **Deprecated:** `camelCase` should be refactored to `snake_case`. - **Style:** Strictly `snake_case` for all function and variable names.
* **Prefixes:** - **Deprecated:** `camelCase` should be refactored to `snake_case`.
* `load_ae_obj_id__<object_type>`: For loading a single Aether object by ID. - **Prefixes:**
* `load_ae_obj_li__<object_type>`: For loading a list of Aether objects. - `load_ae_obj_id__<object_type>`: For loading a single Aether object by ID.
* `create_ae_obj__<object_type>`: For creating an Aether object. - `load_ae_obj_li__<object_type>`: For loading a list of Aether objects.
* `update_ae_obj__<object_type>`: For updating an Aether object. - `create_ae_obj__<object_type>`: For creating an Aether object.
* `delete_ae_obj_id__<object_type>`: For deleting an Aether object by ID. - `update_ae_obj__<object_type>`: For updating an Aether object.
* `db_save_ae_obj_li__<object_type>`: For saving a list of Aether objects to IndexedDB. - `delete_ae_obj_id__<object_type>`: For deleting an Aether object by ID.
* `db_update_ae_obj_id__<object_type>`: For updating an Aether object in IndexedDB. - `db_save_ae_obj_li__<object_type>`: For saving a list of Aether objects to IndexedDB.
* `process_ae_obj__<object_type>_props`: For module-specific data transformation functions. - `db_update_ae_obj_id__<object_type>`: For updating an Aether object in IndexedDB.
* **Deprecated:** Ambiguous `handle_` prefixes should be replaced with more descriptive `snake_case` names (e.g., `handle_submit_form` -> `submit_form`). - `process_ae_obj__<object_type>_props`: For module-specific data transformation functions.
- **Deprecated:** Ambiguous `handle_` prefixes should be replaced with more descriptive `snake_case` names (e.g., `handle_submit_form` -> `submit_form`).
## 4. Object and Property Naming ## 4. Object and Property Naming
* **Singularity:** Use singular nouns for objects and properties (e.g., `example.id`, not `examples.id`).
* **IDs:** - **Singularity:** Use singular nouns for objects and properties (e.g., `example.id`, not `examples.id`).
* `id`: Primary key for an object (internal use, often a UUID). - **IDs:**
* `<object_type>_id`: Specific ID for an object (e.g., `person_id`). - `id`: Primary key for an object (internal use, often a UUID).
* `<object_type>_id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters). - `<object_type>_id`: Specific ID for an object (e.g., `person_id`).
* `account_id`, `site_id`, `user_id`, etc.: Foreign keys. - `<object_type>_id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters).
* **Common Properties:** - `account_id`, `site_id`, `user_id`, etc.: Foreign keys.
* `code`: Short, unique identifier. - **Common Properties:**
* `name`: Display name. - `code`: Short, unique identifier.
* `description`: Longer text description. - `name`: Display name.
* `enable`: Boolean for active/inactive status. - `description`: Longer text description.
* `hide`: Boolean for visibility. - `enable`: Boolean for active/inactive status.
* `priority`: Numeric value for ordering. - `hide`: Boolean for visibility.
* `sort`: Numeric value for ordering. - `priority`: Numeric value for ordering.
* `group`: Categorization string. - `sort`: Numeric value for ordering.
* `notes`: General notes/comments. - `group`: Categorization string.
* `created_on`: Timestamp of creation. - `notes`: General notes/comments.
* `updated_on`: Timestamp of last update. - `created_on`: Timestamp of creation.
* **Special Use Properties:** `for_type`, `for_id`, `archive_on`, `passcode`, `external_id`. - `updated_on`: Timestamp of last update.
* **Config/JSON Properties:** `cfg_json`, `data_json`, `linked_li_json`. - **Special Use Properties:** `for_type`, `for_id`, `archive_on`, `passcode`, `external_id`.
* **Special Generated Fields (Client-side):** `tmp_sort_1`, `tmp_sort_2`, `tmp_sort_3` (for client-side sorting). - **Config/JSON Properties:** `cfg_json`, `data_json`, `linked_li_json`.
- **Special Generated Fields (Client-side):** `tmp_sort_1`, `tmp_sort_2`, `tmp_sort_3` (for client-side sorting).
## 5. List Suffixes ## 5. List Suffixes
* **Simple Arrays:** Use `_li` suffix for simple, unordered arrays (e.g., `user_li`, `hosted_file_id_li`).
* **Key-Value Maps/Objects:** Use `_kv` suffix for key-value objects/maps (e.g., `user_kv`, `hosted_file_obj_kv`). - **Simple Arrays:** Use `_li` suffix for simple, unordered arrays (e.g., `user_li`, `hosted_file_id_li`).
- **Key-Value Maps/Objects:** Use `_kv` suffix for key-value objects/maps (e.g., `user_kv`, `hosted_file_obj_kv`).
## 6. Interface and Type Naming ## 6. Interface and Type Naming
* **Style:** Use `PascalCase` for interface and type names (e.g., `Account`, `HostedFile`, `GenericCrudArgs`).
- **Style:** Use `PascalCase` for interface and type names (e.g., `Account`, `HostedFile`, `GenericCrudArgs`).
## 7. Constants ## 7. Constants
* **Style:** Use `SCREAMING_SNAKE_CASE` for constants (e.g., `MAX_RETRIES`, `DEFAULT_TIMEOUT`).
- **Style:** Use `SCREAMING_SNAKE_CASE` for constants (e.g., `MAX_RETRIES`, `DEFAULT_TIMEOUT`).
## 8. CSS Classes and IDs ## 8. CSS Classes and IDs
* **Style:** Use `kebab-case` for CSS classes and IDs (e.g., `my-component-class`, `main-header-id`).
- **Style:** Use `kebab-case` for CSS classes and IDs (e.g., `my-component-class`, `main-header-id`).
## 9. Data Sorting ## 9. Data Sorting
* **Standard Order:** `group > priority > sort > updated_on/created_on`
* **Specific Order:** `type > start_date/time > code or name` - **Standard Order:** `group > priority > sort > updated_on/created_on`
- **Specific Order:** `type > start_date/time > code or name`
## 10. Local Storage and IndexedDB Keys ## 10. Local Storage and IndexedDB Keys
* **Local Storage:**
* `api` - **Local Storage:**
* `app` (global) - `api`
* `core` (core modules) - `app` (global)
* `<module>` (extended modules) - `core` (core modules)
* `<custom>` (custom modules) - `<module>` (extended modules)
* **IndexedDB:** - `<custom>` (custom modules)
* `ae_core_db` - **IndexedDB:**
* `<module>` - `ae_core_db`
* `<custom>` - `<module>`
- `<custom>`

View File

@@ -1,120 +1,137 @@
# AE UI Components, Layout, and Style Standards (HTML/CSS) # AE UI Components, Layout, and Style Standards (HTML/CSS)
## Aether Components ## Aether Components
### System Components ### System Components
* [header]
* [main/module]s - [header]
* [footer] - [main/module]s
* [app] refresh, clear IDB, clear local storage (settings), iframe toggle (also updates URL param), copy URL, generate and show QR - [footer]
* [menu][mode] edit, more (all or details) - [app] refresh, clear IDB, clear local storage (settings), iframe toggle (also updates URL param), copy URL, generate and show QR
* [menu][access_type] passcode input, clear - [menu][mode] edit, more (all or details)
* [menu][user] sign in/out, reset password, email link, change username and email - [menu][access_type] passcode input, clear
* [menu][theme] mode (light/dark), name (theme list) - [menu][user] sign in/out, reset password, email link, change username and email
* [debug] toggle (also updates URL param), show core and module storages, manually set init timestamp - [menu][theme] mode (light/dark), name (theme list)
* [scroll_to] top, page up, page down, bottom - [debug] toggle (also updates URL param), show core and module storages, manually set init timestamp
- [scroll_to] top, page up, page down, bottom
### Core Components ### Core Components
* [copy_btn] clipboard, bind:value, btn_text, btn_html
* [txt_editor] textarea - [copy_btn] clipboard, bind:value, btn_text, btn_html
* [md_editor] CodeMirror, ShadEditor TipTap (need to remove) - [txt_editor] textarea
* [html_editor] - [md_editor] CodeMirror, ShadEditor TipTap (need to remove)
* [media_player] - [html_editor]
* hosted_file archive_content media_player, - [media_player]
* bind:host_id, - hosted_file archive_content media_player,
* bind:media_type - bind:host_id,
* status - stopped, paused, playing - bind:media_type
* [hosted_file_li] manage_hosted_file_li, make available for selection - status - stopped, paused, playing
* [hosted_file_link_to] list links per object, bind:add link, bind:remove link - [hosted_file_li] manage_hosted_file_li, make available for selection
* [upload_to_host] - input_hosted_file; needs to handle multiple files - [hosted_file_link_to] list links per object, bind:add link, bind:remove link
* link_type, - [upload_to_host] - input_hosted_file; needs to handle multiple files
* link_id, - link_type,
* inner fragment - label html - link_id,
* bind:trigger - inner fragment - label html
* bind:show_spinner - bind:trigger
* bind:show_percent - bind:show_spinner
* status - bind:show_percent
* result - started, uploading, finished - status
* [upload_file_tbl] input_hosted_file_tbl, check for dup file hash, remove from list - result - started, uploading, finished
* [download_from_host] - [upload_file_tbl] input_hosted_file_tbl, check for dup file hash, remove from list
* bind:host_file_id - [download_from_host]
* bind:filename - bind:host_file_id
* bind:file_ext - bind:filename
* btn inner fragment - bind:file_ext
* bind:trigger - btn inner fragment
* bind:show_spinner - bind:trigger
* bind:show_percent - bind:show_spinner
* status - bind:show_percent
* result - started, downloading, finished - status
* [data_store] - result - started, downloading, finished
* [ae_crud] need to simplify! obj, prop, current_value, bind:value, bind:trigger, inner fragment - [data_store]
* [ae_obj_prop_val] - essentially a wrapper for the function - [ae_crud] need to simplify! obj, prop, current_value, bind:value, bind:trigger, inner fragment
* bind:obj_type - [ae_obj_prop_val] - essentially a wrapper for the function
* bind:obj_id - bind:obj_type
* bind:obj_prop - bind:obj_id
* bind:obj_value - bind:obj_prop
* bind:obj_new_value - bind:obj_value
* bind:trigger - bind:obj_new_value
* bind:show_spinner - bind:trigger
* bind:show_percent - bind:show_spinner
* status - bind:show_percent
* result - status
* [sql_qry] - result
* [obj_tbl] obj sql results tbl or similar - [sql_qry]
* [qr_scanner] - [obj_tbl] obj sql results tbl or similar
* [websocket] - [qr_scanner]
- [websocket]
### Main / Module Components ### Main / Module Components
* [menu][options] various settings, show/hide content and options, limit, sorting options, etc
* [menu][actions] various actions, sign in/out, email - [menu][options] various settings, show/hide content and options, limit, sorting options, etc
- [menu][actions] various actions, sign in/out, email
### Object Menu ### Object Menu
* properties: id, name, group, priority, sort, alert, hide, enable, note
* future properties: ext_id (not ready yet), ext_sys_id (not ready yet), code (not ready yet) - properties: id, name, group, priority, sort, alert, hide, enable, note
* actions: create, view, edit, update, hide, disable, delete, alert (message), archive (not ready yet) - future properties: ext_id (not ready yet), ext_sys_id (not ready yet), code (not ready yet)
* future actions: copy, import - actions: create, view, edit, update, hide, disable, delete, alert (message), archive (not ready yet)
* sort options: - future actions: copy, import
* [default] group > priority > sort (ASC/DESC) > alert > name - sort options:
* [sort_updated] group > priority > sort (ASC/DESC) > alert > updated_on > created_on - [default] group > priority > sort (ASC/DESC) > alert > name
* [priority_updated] group > priority > updated_on (ASC/DESC) > created_on - [sort_updated] group > priority > sort (ASC/DESC) > alert > updated_on > created_on
* [priority_name] group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on - [priority_updated] group > priority > updated_on (ASC/DESC) > created_on
* [name] priority > name (ASC/DESC) > sort > alert > updated_on > created_on - [priority_name] group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on
* [created_on] priority > created_on (ASC/DESC) - [name] priority > name (ASC/DESC) > sort > alert > updated_on > created_on
* [updated_on] priority > updated_on (ASC/DESC) > created_on - [created_on] priority > created_on (ASC/DESC)
- [updated_on] priority > updated_on (ASC/DESC) > created_on
### Pop-ups: ### Pop-ups:
* modal_header
* title - modal_header
* close - title
* modal_main - close
* modal_meta - modal_main
* modal_footer - modal_meta
* close - modal_footer
- close
#### Pop-up Modal (blocking) #### Pop-up Modal (blocking)
* modal position
- modal position
#### Pop-up Modal Inline #### Pop-up Modal Inline
* inline, inline-block, block
- inline, inline-block, block
#### Pop-up Dialog #### Pop-up Dialog
* dialog position
- dialog position
## Containers ## Containers
### Navigation ### Navigation
* link
* download - link
- download
### Forms ### Forms
* save
* clear value - save
* set null value - clear value
- set null value
### Other Containers ### Other Containers
* help - blue
* info - blue - help - blue
* alert - yellow - info - blue
* warning - orange - alert - yellow
* error - red - warning - orange
* message - green - error - red
- message - green
--- ---
## Need to organize: ## Need to organize:
* lu: id, account_id, for_obj_id, code, name, description, group, sort, priority, enable, perm_level
- lu: id, account_id, for_obj_id, code, name, description, group, sort, priority, enable, perm_level

View File

@@ -1,13 +1,17 @@
# One Sky IT's Aether App - UI and UX Guidelines and Rules # One Sky IT's Aether App - UI and UX Guidelines and Rules
## General ## General
### Events ### Events
#### layout header #### layout header
#### layout footer #### layout footer
### Journals ### Journals
#### buttons #### buttons
##### alert ##### alert
##### info ##### info
@@ -15,52 +19,62 @@
##### priority, flag ##### priority, flag
##### warning, hide ##### warning, hide
```css ```css
variant-soft-warning hover:variant-filled-warning variant-soft-warning hover:variant-filled-warning
``` ```
##### error, delete, disable ##### error, delete, disable
```css ```css
variant-soft-error hover:variant-filled-error variant-soft-error hover:variant-filled-error
``` ```
#### new root layout header #### new root layout header
#### submenu #### submenu
```css ```css
flex flex-row items-center justify-center gap-1 flex flex-row items-center justify-center gap-1
``` ```
#### new layout footer
#### new layout footer
## Svelte 5 and SvelteKit v2 (framework and routing) ## Svelte 5 and SvelteKit v2 (framework and routing)
## Tailwind 3.x CSS (styles) ## Tailwind 3.x CSS (styles)
Waiting to upgrade to 4.x when ShadCN is ready. ShadCN is still being worked on as of late March 2025.
* https://ui.shadcn.com/docs/tailwind-v4
Waiting to upgrade to 4.x when ShadCN is ready. ShadCN is still being worked on as of late March 2025.
- https://ui.shadcn.com/docs/tailwind-v4
## CodeMirror 6.x (text and code editor) ## CodeMirror 6.x (text and code editor)
* https://codemirror.net
- https://codemirror.net
## ShadCN (Tailwind Components) ## ShadCN (Tailwind Components)
* https://ui.shadcn.com/docs
* https://github.com/shadcn-ui/ui
- https://ui.shadcn.com/docs
- https://github.com/shadcn-ui/ui
## Skeleton (Design System, Tailwind Components, Functional Components) ## Skeleton (Design System, Tailwind Components, Functional Components)
Waiting to upgrade to Skeleton v3. Mostly because of the Tailwind 4.x upgrade needed for ShadCN. Waiting to upgrade to Skeleton v3. Mostly because of the Tailwind 4.x upgrade needed for ShadCN.
* https://www.skeleton.dev/docs/get-started/migrate-from-v2
- https://www.skeleton.dev/docs/get-started/migrate-from-v2
## Flowbite (Tailwind Components) ## Flowbite (Tailwind Components)
## Lucide Icons (SVG Icons) ## Lucide Icons (SVG Icons)
* https://lucide.dev/icons/
- https://lucide.dev/icons/
## Markdown ## Markdown
Using marked for Markdown parsing.
* https://marked.js.org/
Using marked for Markdown parsing.
- https://marked.js.org/
## Edra (TipTap based Rich Text Editor) ## Edra (TipTap based Rich Text Editor)
* https://edra.tsuzat.com/
- https://edra.tsuzat.com/

View File

@@ -1,68 +1,86 @@
# AE Svelte and SvelteKit Technical Standards # AE Svelte and SvelteKit Technical Standards
## Official Modules ## Official Modules
### Core ### Core
* Accounts - Minimal
* Files - Accounts - Minimal
* People - Minimal - Files
* Sites - Minimal - People - Minimal
* Users - Minimal - Sites - Minimal
- Users - Minimal
### Extended ### Extended
Archives - Minimal, Events - Badges, Events - Presentation Management, Posts - Minimal, Journals Archives - Minimal, Events - Badges, Events - Presentation Management, Posts - Minimal, Journals
### Custom ### Custom
IDAA - Archives, IDAA - BB, IDAA - Recovery Meetings IDAA - Archives, IDAA - BB, IDAA - Recovery Meetings
--- ---
## localStorage: ## localStorage:
* api
* app - global - api
* core - core modules - app - global
* [module] - extended modules - core - core modules
* [custom] - custom modules - [module] - extended modules
- [custom] - custom modules
--- ---
## Indexed DB ## Indexed DB
* ae_core_db
* [module] - ae_core_db
* [custom] - custom modules: none currently - [module]
- [custom] - custom modules: none currently
--- ---
## Data Sorting ## Data Sorting
* group > priority > sort > updated/created on
* type > start date/time > code or name - group > priority > sort > updated/created on
- type > start date/time > code or name
--- ---
## Objects ## Objects
### Function - Obj Prop Update ### Function - Obj Prop Update
* obj_type
* obj_id - obj_type
* obj_prop - obj_id
* obj_value - obj_prop
- obj_value
### Core ### Core
### Extended ### Extended
### Custom ### Custom
--- ---
## Object Properties or Fields ## Object Properties or Fields
### Core ### Core
Expected standard field names: id, id_random, [obj-type]_id_random, code, name, enable, hide, priority, sort, group, notes, created_on, updated_on
Expected standard field names: id, id_random, [obj-type]\_id_random, code, name, enable, hide, priority, sort, group, notes, created_on, updated_on
Special use field names: for_type, for_id, archive_on, passcode, external_id Special use field names: for_type, for_id, archive_on, passcode, external_id
### Configs and Fields with JSON ### Configs and Fields with JSON
* cfg_json
* data_json - cfg_json
* linked_li_json - data_json
- linked_li_json
### Special Generated Fields ### Special Generated Fields
tmp_sort_1, tmp_sort_2, tmp_sort_1, tmp_sort_2,
### Future standard fields!!! ### Future standard fields!!!
obj_id?: null|string; obj_id?: null|string;
obj_ext_uid?: null|string; // Probably not needed for journals obj_ext_uid?: null|string; // Probably not needed for journals
obj_ext_id?: null|string; // Probably not needed for journals obj_ext_id?: null|string; // Probably not needed for journals
@@ -89,22 +107,22 @@ obj_created_on?: Date;
obj_updated_on?: null|Date; obj_updated_on?: null|Date;
## Dixie IDB liveQuery with Select Objects (slct) and Lists of Objects (slct_x_li) ## Dixie IDB liveQuery with Select Objects (slct) and Lists of Objects (slct_x_li)
Use this method below to create a read/write snapshot of the current liveQuery results. This allows you to use it as part of a form and binding values. It might make since to call this something like "lqw__x_obj" and "lqw__x_obj_li". lqw = liveQuery writable
lq__xyz_obj - Use for general read only Use this method below to create a read/write snapshot of the current liveQuery results. This allows you to use it as part of a form and binding values. It might make since to call this something like "lqw**x_obj" and "lqw**x_obj_li". lqw = liveQuery writable
lqw__xyz_obj - Use for forms and binding values. What happens if the actual LQ obj is updated after the bind?
lq**xyz_obj - Use for general read only
lqw**xyz_obj - Use for forms and binding values. What happens if the actual LQ obj is updated after the bind?
$slct or $lqw ? $slct or $lqw ?
Sort of related.... more permission/security though: Create a new table that will be attached to every v\_ view in the DB. This new table would be a field permission list. It could work similar to the data_store table and related view. This seems like a good idea????? 2025-08-11
Sort of related.... more permission/security though: Create a new table that will be attached to every v_ view in the DB. This new table would be a field permission list. It could work similar to the data_store table and related view. This seems like a good idea????? 2025-08-11
```ts ```ts
let lq__post_obj = $derived(liveQuery(async () => { let lq__post_obj = $derived(
liveQuery(async () => {
if (log_lvl) { if (log_lvl) {
console.log(`lq__post_obj: post_id = ${$idaa_slct?.post_id}`); console.log(`lq__post_obj: post_id = ${$idaa_slct?.post_id}`);
} }
let results = await db_posts.post let results = await db_posts.post.get($idaa_slct.post_id ?? ''); // null or undefined does not reset things like '' does
.get($idaa_slct.post_id ?? ''); // null or undefined does not reset things like '' does
// Check if results are different than the current $idaa_slct.post_obj // Check if results are different than the current $idaa_slct.post_obj
if ($idaa_slct.post_obj && results) { if ($idaa_slct.post_obj && results) {
@@ -121,9 +139,11 @@ let lq__post_obj = $derived(liveQuery(async () => {
} }
return results; return results;
})); })
);
let lq__post_comment_obj_li = $derived(liveQuery(async () => { let lq__post_comment_obj_li = $derived(
liveQuery(async () => {
let results = await db_posts.comment let results = await db_posts.comment
.where('post_id') .where('post_id')
.equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does .equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does
@@ -131,7 +151,10 @@ let lq__post_comment_obj_li = $derived(liveQuery(async () => {
.sortBy('updated_on'); .sortBy('updated_on');
// .sortBy('title'); // .sortBy('title');
if ($idaa_slct.post_comment_obj_li && JSON.stringify($idaa_slct.post_comment_obj_li) !== JSON.stringify(results)) { if (
$idaa_slct.post_comment_obj_li &&
JSON.stringify($idaa_slct.post_comment_obj_li) !== JSON.stringify(results)
) {
$idaa_slct.post_comment_obj_li = [...results]; $idaa_slct.post_comment_obj_li = [...results];
if (log_lvl) { if (log_lvl) {
console.log(`$idaa_slct.post_comment_obj_li = `, $idaa_slct.post_comment_obj_li); console.log(`$idaa_slct.post_comment_obj_li = `, $idaa_slct.post_comment_obj_li);
@@ -143,5 +166,6 @@ let lq__post_comment_obj_li = $derived(liveQuery(async () => {
} }
return results; return results;
})); })
);
``` ```

View File

@@ -2,38 +2,46 @@
This uses SvelteKit version 2.x with Svelte version 5.x, TailwindCSS 4.1, and Skelton. This uses SvelteKit version 2.x with Svelte version 5.x, TailwindCSS 4.1, and Skelton.
# Current Modules # Current Modules
## AE Events - Speakers (/events_speakers) ## AE Events - Speakers (/events_speakers)
### Components ### Components
* +page.svelte - The main page for the Events - Speakers module
* 10_edit_modal__event_presenter_obj.svelte - The modal for editing a presenter - +page.svelte - The main page for the Events - Speakers module
* 10_list__event_presenter_obj.svelte - The list of presenters/speakers - 10_edit_modal\_\_event_presenter_obj.svelte - The modal for editing a presenter
* 10_view_modal__event_presenter_obj.svelte - The modal for viewing a presenter - 10_list\_\_event_presenter_obj.svelte - The list of presenters/speakers
- 10_view_modal\_\_event_presenter_obj.svelte - The modal for viewing a presenter
### Path [slug] ### Path [slug]
* +page.svelte - The main page for the presenter ID [slug]
- +page.svelte - The main page for the presenter ID [slug]
## AE Sponsorships (/sponsorships) ## AE Sponsorships (/sponsorships)
* +page.svelte - The main page for the Sponsorships module
* 10_edit_modal__sponsorship_obj.svelte - The modal for editing a sponsorship
* 10_list__sponsorship_obj.svelte - The list of sponsorships
* 10_view_modal__sponsorship_obj.svelte - The modal for viewing a sponsorship
### Path [slug]
* +page.svelte - The main page for the sponsorship ID [slug]
- +page.svelte - The main page for the Sponsorships module
- 10_edit_modal\_\_sponsorship_obj.svelte - The modal for editing a sponsorship
- 10_list\_\_sponsorship_obj.svelte - The list of sponsorships
- 10_view_modal\_\_sponsorship_obj.svelte - The modal for viewing a sponsorship
### Path [slug]
- +page.svelte - The main page for the sponsorship ID [slug]
# Future Modules # Future Modules
## AE Events - Badges (/events_badges) ## AE Events - Badges (/events_badges)
* +page.svelte - The main page for the Events - Badges module
* 10_list__event_badge_obj.svelte - The list of badges - +page.svelte - The main page for the Events - Badges module
* 10_view_modal__event_badge_obj.svelte - The modal for viewing a badge - 10_list\_\_event_badge_obj.svelte - The list of badges
- 10_view_modal\_\_event_badge_obj.svelte - The modal for viewing a badge
## AE Events - Exhibit Leads (/events_exhibit_leads) ## AE Events - Exhibit Leads (/events_exhibit_leads)
## AE Events - Presentation Management (/events_pres_mgmt) ## AE Events - Presentation Management (/events_pres_mgmt)
# How to build and deploy SvelteKit: # How to build and deploy SvelteKit:
Copy the contents of the "build" directory to ./npm_deploy/build/ Copy the contents of the "build" directory to ./npm_deploy/build/
```bash ```bash
@@ -41,6 +49,7 @@ npm run build
``` ```
If this is just a quick build update then only the build directory needs to be copied (rsync). If this is just a quick build update then only the build directory needs to be copied (rsync).
```bash ```bash
rsync -vhrz --exclude 'node_modules' ~/OSIT_dev/ae_app_svelte_tailwind_skeleton/build/ ~/OSIT_dev/ae_env_node_app/npm_deploy/build/ --delete rsync -vhrz --exclude 'node_modules' ~/OSIT_dev/ae_app_svelte_tailwind_skeleton/build/ ~/OSIT_dev/ae_env_node_app/npm_deploy/build/ --delete
@@ -50,6 +59,7 @@ rsync -vhrz ~/OSIT_dev/ae_env_node_app/npm_deploy/build/ scott@linode.oneskyit.c
If this includes package updates (not development) we need to copy the new package.json. Manually copy the new package.json file to ./npm_deploy/. This also needs to be copied to the server. Copy the package.json even though not really used. If this includes package updates (not development) we need to copy the new package.json. Manually copy the new package.json file to ./npm_deploy/. This also needs to be copied to the server. Copy the package.json even though not really used.
Run the --omit dev to clear out the node_modules directory. Copy the root node_modules directory to ./npm_deploy/build/node_modules/ after running te omit dev command. Run the --omit dev to clear out the node_modules directory. Copy the root node_modules directory to ./npm_deploy/build/node_modules/ after running te omit dev command.
```bash ```bash
npm ci --omit dev npm ci --omit dev
@@ -63,10 +73,10 @@ npm install
Everything should be ready to run on the development server and production server. Everything should be ready to run on the development server and production server.
# Rebuild the node_modules directory and manually install extra Svelte packages # Rebuild the node_modules directory and manually install extra Svelte packages
Run the npm update to fix the node_modules directory and package.json Run the npm update to fix the node_modules directory and package.json
```bash ```bash
npm list npm list
npm outdated npm outdated
@@ -77,6 +87,7 @@ npm list
Other installs?: Other installs?:
Are both still needed? I know at least one of these is. 2024-07-23 Are both still needed? I know at least one of these is. 2024-07-23
```bash ```bash
npm install --save-dev svelte-highlight npm install --save-dev svelte-highlight
npm install --save-dev typescript-svelte-plugin npm install --save-dev typescript-svelte-plugin
@@ -96,13 +107,15 @@ npm install flowbite flowbite-svelte tailwind-merge @popperjs/core
I am slowly switching from Font-Awesome to Lucide I am slowly switching from Font-Awesome to Lucide
## Tiptap Editor ## Tiptap Editor
* Eventually use Edra? https://edra.tsuzat.com/
* Best Rich Text Editor, made for Svelte Developers with Tiptap - Eventually use Edra? https://edra.tsuzat.com/
* ShadEditor is "evolving" to be Edra. - Best Rich Text Editor, made for Svelte Developers with Tiptap
* ShadCN is still stuck on Tailwind 3. Waiting to upgrade to Tailwind 4.x. Tailwind 4.x was released in late January 2025. ShadCN is still being worked on as of late March 2025. - ShadEditor is "evolving" to be Edra.
* [https://github.com/huntabyte/shadcn-svelte/issues/1643](https://github.com/huntabyte/shadcn-svelte/issues/1643) - ShadCN is still stuck on Tailwind 3. Waiting to upgrade to Tailwind 4.x. Tailwind 4.x was released in late January 2025. ShadCN is still being worked on as of late March 2025.
- [https://github.com/huntabyte/shadcn-svelte/issues/1643](https://github.com/huntabyte/shadcn-svelte/issues/1643)
Need to install ShadCN and Lucide for the Tiptap editor. Need to install ShadCN and Lucide for the Tiptap editor.
```bash ```bash
npm install shadcn-svelte npm install shadcn-svelte
npm install lucide-svelte npm install lucide-svelte
@@ -110,6 +123,7 @@ npm install mode-watcher
``` ```
Now we initialize the ShadCN and ShadEditor packages. Follow the command line instructions. Now we initialize the ShadCN and ShadEditor packages. Follow the command line instructions.
```bash ```bash
npx shadcn-svelte@next init npx shadcn-svelte@next init
npx shadcn-svelte@next add dropdown-menu button tooltip input popover separator npx shadcn-svelte@next add dropdown-menu button tooltip input popover separator
@@ -117,6 +131,7 @@ npx shadeditor init
``` ```
More packages related to the Tiptap editor??? More packages related to the Tiptap editor???
```bash ```bash
npm install @tiptap/extension-link @tiptap/extension-bullet-list @tiptap/extension-history @tiptap/extension-typography @tiptap/extension-underline npm install @tiptap/extension-link @tiptap/extension-bullet-list @tiptap/extension-history @tiptap/extension-typography @tiptap/extension-underline
``` ```
@@ -124,23 +139,31 @@ npm install @tiptap/extension-link @tiptap/extension-bullet-list @tiptap/extensi
## Build ## Build
## Environment file ## Environment file
### ".env" ### ".env"
This is the default used if others are not found when when "npm run dev" or "npm run build" is run. This is the default used if others are not found when when "npm run dev" or "npm run build" is run.
### ".env.local" ### ".env.local"
This is used when "npm run dev" is run. This is not used in the production build. This is used when "npm run dev" is run. This is not used in the production build.
### ".env.production" ### ".env.production"
This is used when "npm run build" is run. This is not used in the development build. This is used when "npm run build" is run. This is not used in the development build.
### ".env:prod" ### ".env:prod"
This is modified to allow for a staging environment and production environment built. This is modified to allow for a staging environment and production environment built.
### ".env:staging" ### ".env:staging"
This is modified to allow for a staging environment and production environment built. This is modified to allow for a staging environment and production environment built.
### Example Important Values when running in dev: ### Example Important Values when running in dev:
Note: Environment values need to be updated when our home IP address changes. Be sure to check the Aether Container Environment and Aether Node App (SvelteKit) Environment files for the correct IP address. The Node Docker environment needs to be updated here and in the .env file that Docker will read. This needs to be improved later... Note: Environment values need to be updated when our home IP address changes. Be sure to check the Aether Container Environment and Aether Node App (SvelteKit) Environment files for the correct IP address. The Node Docker environment needs to be updated here and in the .env file that Docker will read. This needs to be improved later...
```bash ```bash
DOCKER_AE_API_DEV_SERVER_EXTRA_HOST=dev-api.oneskyit.com:108.48.200.147 DOCKER_AE_API_DEV_SERVER_EXTRA_HOST=dev-api.oneskyit.com:108.48.200.147
@@ -150,7 +173,6 @@ PUBLIC_AE_API_SERVER=api.oneskyit.com
PUBLIC_AE_API_BAK_SERVER=bak-api.oneskyit.com PUBLIC_AE_API_BAK_SERVER=bak-api.oneskyit.com
``` ```
# create-svelte # create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

View File

@@ -8,11 +8,11 @@ Svelte 5 introduces "runes" as a new way to manage reactivity. This is a major c
### Key Breaking Changes ### Key Breaking Changes
* **`let` is no longer reactive:** In Svelte 4, any `let` variable declared in the top-level scope of a component was automatically reactive. In Svelte 5, you must explicitly declare reactive state using the `$state` rune. - **`let` is no longer reactive:** In Svelte 4, any `let` variable declared in the top-level scope of a component was automatically reactive. In Svelte 5, you must explicitly declare reactive state using the `$state` rune.
* **`$:` is replaced by `$derived` and `$effect`:** The `$` label is no longer used for reactive statements. Instead, you should use the `$derived` rune for computed values and the `$effect` rune for side effects. - **`$:` is replaced by `$derived` and `$effect`:** The `$` label is no longer used for reactive statements. Instead, you should use the `$derived` rune for computed values and the `$effect` rune for side effects.
* **`export let` is replaced by `$props`:** Component props are now declared using the `$props` rune, which provides a more flexible and explicit way to define component APIs. - **`export let` is replaced by `$props`:** Component props are now declared using the `$props` rune, which provides a more flexible and explicit way to define component APIs.
* **Event handling:** The `on:` directive is replaced by event attributes (e.g., `onclick`). Component events are now handled using callback props instead of `createEventDispatcher`. - **Event handling:** The `on:` directive is replaced by event attributes (e.g., `onclick`). Component events are now handled using callback props instead of `createEventDispatcher`.
* **Slots are replaced by snippets:** The `<slot>` element is replaced by the `{#snippet ...}` block, which provides a more powerful and flexible way to pass content to components. - **Slots are replaced by snippets:** The `<slot>` element is replaced by the `{#snippet ...}` block, which provides a more powerful and flexible way to pass content to components.
For a complete list of breaking changes, refer to the [Svelte 5 migration guide](https://svelte.dev/docs/svelte/v5-migration-guide). For a complete list of breaking changes, refer to the [Svelte 5 migration guide](https://svelte.dev/docs/svelte/v5-migration-guide).
@@ -22,24 +22,24 @@ Dexie.js is a lightweight, minimalistic wrapper for IndexedDB that makes it easi
### Key Classes and Methods ### Key Classes and Methods
* **`Dexie`:** The main class for creating and managing IndexedDB databases. - **`Dexie`:** The main class for creating and managing IndexedDB databases.
* `new Dexie(databaseName)`: Creates a new database instance. - `new Dexie(databaseName)`: Creates a new database instance.
* `version(versionNumber).stores({ ... })`: Defines the database schema. - `version(versionNumber).stores({ ... })`: Defines the database schema.
* **`Table`:** Represents an object store (table) in the database. - **`Table`:** Represents an object store (table) in the database.
* `add(item)`: Adds a new item to the table. - `add(item)`: Adds a new item to the table.
* `put(item)`: Adds or updates an item in the table. - `put(item)`: Adds or updates an item in the table.
* `update(key, changes)`: Updates an existing item. - `update(key, changes)`: Updates an existing item.
* `delete(key)`: Deletes an item by its primary key. - `delete(key)`: Deletes an item by its primary key.
* `get(key)`: Retrieves an item by its primary key. - `get(key)`: Retrieves an item by its primary key.
* `where(index)`: Starts a query using an index. - `where(index)`: Starts a query using an index.
* `toArray()`: Retrieves all items from the table as an array. - `toArray()`: Retrieves all items from the table as an array.
* **`Collection`:** Represents a collection of items resulting from a query. - **`Collection`:** Represents a collection of items resulting from a query.
* `toArray()`: Retrieves all items in the collection as an array. - `toArray()`: Retrieves all items in the collection as an array.
* `first()`: Retrieves the first item in the collection. - `first()`: Retrieves the first item in the collection.
* `last()`: Retrieves the last item in the collection. - `last()`: Retrieves the last item in the collection.
* `each(callback)`: Iterates over each item in the collection. - `each(callback)`: Iterates over each item in the collection.
* `modify(changes)`: Updates all items in the collection. - `modify(changes)`: Updates all items in the collection.
* `delete()`: Deletes all items in the collection. - `delete()`: Deletes all items in the collection.
For a complete list of API methods, refer to the [Dexie.js API Reference](https://dexie.org/docs/API-Reference). For a complete list of API methods, refer to the [Dexie.js API Reference](https://dexie.org/docs/API-Reference).
@@ -66,7 +66,7 @@ export function createLiveQueryStore<T>(query: () => T | Promise<T>) {
return readable<T | undefined>(undefined, (set) => { return readable<T | undefined>(undefined, (set) => {
const subscription = liveQuery(query).subscribe({ const subscription = liveQuery(query).subscribe({
next: (result) => set(result), next: (result) => set(result),
error: (error) => console.error(error), error: (error) => console.error(error)
}); });
return () => subscription.unsubscribe(); return () => subscription.unsubscribe();
}); });
@@ -84,11 +84,9 @@ export function createLiveQueryStore<T>(query: () => T | Promise<T>) {
</script> </script>
<ul> <ul>
{#if $friends} {#if $friends} {#each $friends as friend}
{#each $friends as friend}
<li>{friend.name}</li> <li>{friend.name}</li>
{/each} {/each} {/if}
{/if}
</ul> </ul>
``` ```

48
TODO.md
View File

@@ -4,17 +4,30 @@ This is a list of tasks to be completed before the next event/show/conference.
--- ---
## Recent Accomplishments
- [x] **Refactoring:** Standardized data processing in `events`, `archives`, `posts`, and `sponsorships` modules using a new generic pattern.
- [x] **Bug Fix:** Corrected data fetching logic for session-related presentations and files that were not displaying correctly due to `id` vs `id_random` issues.
- [x] **Core:** Defined `Account`, `Site`, and `Site_Domain` interfaces in new files under `src/lib/ae_core/`.
- [x] **Journals:** Improve the empty state message in `src/routes/journals/+page.svelte`.
- [x] **Journals:** Add a loading indicator to the main journals page.
- [x] **IDAA:** Add a loading indicator to the archives page (`src/routes/idaa/(idaa)/archives/+page.svelte`).
- [x] **Events:** Add pagination to the main event list in `src/routes/events/+page.svelte`.
---
## Big Picture Goals ## Big Picture Goals
* Able to cache data and mostly work offline. - Able to cache data and mostly work offline.
* The new Events Launcher must be able to work offline and query the API for changes to data. - The new Events Launcher must be able to work offline and query the API for changes to data.
* The new Events Launcher must be able to run inside an Electron app and have access to local files and commands. This includes loading a special library that only works in Electron. - The new Events Launcher must be able to run inside an Electron app and have access to local files and commands. This includes loading a special library that only works in Electron.
--- ---
## Codebase Standardization ## Codebase Standardization
### 1. Naming Conventions ### 1. Naming Conventions
- [ ] **Goal:** Enforce a single, consistent naming standard across the entire codebase. - [ ] **Goal:** Enforce a single, consistent naming standard across the entire codebase.
- [ ] **Files:** - [ ] **Files:**
- Logic: `ae_<module>__<concept>.ts` - Logic: `ae_<module>__<concept>.ts`
@@ -35,6 +48,7 @@ This is a list of tasks to be completed before the next event/show/conference.
- **Update 2025-11-13:** `ae_core_functions.ts` has been temporarily restored to resolve a critical issue. The refactoring of `process_ae_obj__*_props()` functions will now proceed module by module, ensuring stability at each step. - **Update 2025-11-13:** `ae_core_functions.ts` has been temporarily restored to resolve a critical issue. The refactoring of `process_ae_obj__*_props()` functions will now proceed module by module, ensuring stability at each step.
### 2. Component Standardization ### 2. Component Standardization
- [ ] **CodeMirror Migration:** Plan and execute the replacement of the `shad-editor` and potentially other text editors (like Tiptap) with `CodeMirror` to standardize rich text editing. - [ ] **CodeMirror Migration:** Plan and execute the replacement of the `shad-editor` and potentially other text editors (like Tiptap) with `CodeMirror` to standardize rich text editing.
- [ ] **Component Review:** Audit third-party components to understand their conventions and isolate them from internal standards. - [ ] **Component Review:** Audit third-party components to understand their conventions and isolate them from internal standards.
@@ -42,11 +56,7 @@ This is a list of tasks to be completed before the next event/show/conference.
## Priority Tasks (Easy & Quick) ## Priority Tasks (Easy & Quick)
- [x] **Core:** Define `Account`, `Site`, and `Site_Domain` interfaces in new files under `src/lib/ae_core/`. - [ ] **Formatting:** Run `npm run format` to fix code style issues across the project.
- [x] **Journals:** Improve the empty state message in `src/routes/journals/+page.svelte`.
- [x] **Journals:** Add a loading indicator to the main journals page.
- [x] **IDAA:** Add a loading indicator to the archives page (`src/routes/idaa/(idaa)/archives/+page.svelte`).
- [x] **Events:** Add pagination to the main event list in `src/routes/events/+page.svelte`.
--- ---
@@ -80,9 +90,11 @@ These functions are frequently used and critical to the application's data flow.
## Core Module Improvements ## Core Module Improvements
### 1. Core Module Dashboard ### 1. Core Module Dashboard
- [ ] Create a central dashboard at `/core` to provide an overview and links to all core data management pages. - [ ] Create a central dashboard at `/core` to provide an overview and links to all core data management pages.
### 2. Account Management ### 2. Account Management
- [ ] **Route:** Create a new route at `/core/accounts`. - [ ] **Route:** Create a new route at `/core/accounts`.
- [ ] **Data:** Define the `Account` interface in a new file `src/lib/ae_core/core__account.ts`. - [ ] **Data:** Define the `Account` interface in a new file `src/lib/ae_core/core__account.ts`.
- [ ] **API:** Implement functions in `core__account.ts` for CRUD operations on accounts. - [ ] **API:** Implement functions in `core__account.ts` for CRUD operations on accounts.
@@ -91,6 +103,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Create a `[account_id]` dynamic route to view and edit account details. - [ ] Create a `[account_id]` dynamic route to view and edit account details.
### 3. Site & Domain Management ### 3. Site & Domain Management
- [ ] **Route:** Create a new route at `/core/sites`. - [ ] **Route:** Create a new route at `/core/sites`.
- [ ] **Data:** Define `Site` and `Site_Domain` interfaces in a new file `src/lib/ae_core/core__site.ts`. - [ ] **Data:** Define `Site` and `Site_Domain` interfaces in a new file `src/lib/ae_core/core__site.ts`.
- [ ] **API:** Implement functions in `core__site.ts` for CRUD operations on sites and domains. - [ ] **API:** Implement functions in `core__site.ts` for CRUD operations on sites and domains.
@@ -99,12 +112,14 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Create a `[site_id]` dynamic route to view and edit site details and manage associated domains. - [ ] Create a `[site_id]` dynamic route to view and edit site details and manage associated domains.
### 4. Person Management ### 4. Person Management
- [ ] **Enhance:** Improve the existing person management components under `/core/person`. - [ ] **Enhance:** Improve the existing person management components under `/core/person`.
- [ ] **UI:** - [ ] **UI:**
- [ ] Create a dedicated page for creating new person records. - [ ] Create a dedicated page for creating new person records.
- [ ] Add search and filtering capabilities to the person list. - [ ] Add search and filtering capabilities to the person list.
### 5. User Management ### 5. User Management
- [ ] **Route:** Create a new route at `/core/users`. - [ ] **Route:** Create a new route at `/core/users`.
- [ ] **UI:** - [ ] **UI:**
- [ ] Create a `+page.svelte` to list all users. - [ ] Create a `+page.svelte` to list all users.
@@ -112,6 +127,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Implement a component to link users to person records. - [ ] Implement a component to link users to person records.
### 6. Hosted File Management ### 6. Hosted File Management
- [ ] **Route:** Create a new route at `/core/hosted_files`. - [ ] **Route:** Create a new route at `/core/hosted_files`.
- [ ] **UI:** - [ ] **UI:**
- [ ] Create a `+page.svelte` to list all hosted files with filters (e.g., by file type, uploader). - [ ] Create a `+page.svelte` to list all hosted files with filters (e.g., by file type, uploader).
@@ -119,6 +135,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Add functionality to upload new files and associate them with other objects (e.g., a person, a journal entry). - [ ] Add functionality to upload new files and associate them with other objects (e.g., a person, a journal entry).
### 7. Shared Lookup Lists ### 7. Shared Lookup Lists
- [ ] **Route:** Create a new route at `/core/lookups`. - [ ] **Route:** Create a new route at `/core/lookups`.
- [ ] **UI:** - [ ] **UI:**
- [ ] Create a simple UI to view and manage the shared lookup lists (e.g., `countries`, `time_zones`). - [ ] Create a simple UI to view and manage the shared lookup lists (e.g., `countries`, `time_zones`).
@@ -128,6 +145,7 @@ These functions are frequently used and critical to the application's data flow.
## Journals Module Improvements ## Journals Module Improvements
### Code Cleanup & Refactoring ### Code Cleanup & Refactoring
- [ ] **Consolidate Data Functions:** Refactor `ae_journals__journal.ts` and `ae_journals__journal_entry.ts` to reduce code duplication, especially in data loading and processing functions. - [ ] **Consolidate Data Functions:** Refactor `ae_journals__journal.ts` and `ae_journals__journal_entry.ts` to reduce code duplication, especially in data loading and processing functions.
- [ ] **Remove Dead Code:** Clean up commented-out code blocks and unused variables across the module. - [ ] **Remove Dead Code:** Clean up commented-out code blocks and unused variables across the module.
- [ ] **Logging:** Implement a more structured logging solution to replace the widespread use of `console.log`. - [ ] **Logging:** Implement a more structured logging solution to replace the widespread use of `console.log`.
@@ -135,6 +153,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] **Type Safety:** Replace `any` types with more specific interfaces, particularly in function parameters and API responses. - [ ] **Type Safety:** Replace `any` types with more specific interfaces, particularly in function parameters and API responses.
### Features & Enhancements ### Features & Enhancements
- [ ] **Offline Support:** Improve offline capabilities by pre-fetching and caching more data. Review the current Dexie implementation for optimizations. - [ ] **Offline Support:** Improve offline capabilities by pre-fetching and caching more data. Review the current Dexie implementation for optimizations.
- [ ] **Search & Filtering:** Enhance the UI with more advanced search and filtering options for journals and entries (e.g., by date range, content, tags). - [ ] **Search & Filtering:** Enhance the UI with more advanced search and filtering options for journals and entries (e.g., by date range, content, tags).
- [ ] **User Experience (UX):** - [ ] **User Experience (UX):**
@@ -145,6 +164,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] **Templates:** Fully implement and document the "templates" feature for creating new journals and entries. - [ ] **Templates:** Fully implement and document the "templates" feature for creating new journals and entries.
### Bug Fixes & Potential Issues ### Bug Fixes & Potential Issues
- [ ] **Reactivity:** Investigate potential reactivity issues between Svelte stores and Dexie's `liveQuery`. - [ ] **Reactivity:** Investigate potential reactivity issues between Svelte stores and Dexie's `liveQuery`.
- [ ] **Data Sync:** Add logic to handle data synchronization conflicts between the local database and the server. - [ ] **Data Sync:** Add logic to handle data synchronization conflicts between the local database and the server.
- [ ] **Performance:** Profile the application with a large number of journals and entries to identify and address any performance bottlenecks. - [ ] **Performance:** Profile the application with a large number of journals and entries to identify and address any performance bottlenecks.
@@ -154,10 +174,12 @@ These functions are frequently used and critical to the application's data flow.
## IDAA Modules Improvements ## IDAA Modules Improvements
### General ### General
- [ ] **Component Refactoring:** Audit the `ae_idaa_comp__` components and refactor them to be more generic and reusable where possible. - [ ] **Component Refactoring:** Audit the `ae_idaa_comp__` components and refactor them to be more generic and reusable where possible.
- [ ] **State Management:** Simplify state management by reducing the number of stores and triggers, and relying more on derived state and component props. - [ ] **State Management:** Simplify state management by reducing the number of stores and triggers, and relying more on derived state and component props.
### Archives Module (`/idaa/archives`) ### Archives Module (`/idaa/archives`)
- [ ] **UI/UX:** - [ ] **UI/UX:**
- [ ] Add a loading indicator while archives are being fetched. - [ ] Add a loading indicator while archives are being fetched.
- [ ] Implement a more engaging "empty state" when no archives are available. - [ ] Implement a more engaging "empty state" when no archives are available.
@@ -165,6 +187,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Implement pagination or infinite scrolling for the archive list. - [ ] Implement pagination or infinite scrolling for the archive list.
### Bulletin Board Module (`/idaa/bb`) ### Bulletin Board Module (`/idaa/bb`)
- [ ] **UI/UX:** - [ ] **UI/UX:**
- [ ] Improve the UI for creating and editing posts and comments. - [ ] Improve the UI for creating and editing posts and comments.
- [ ] Add a rich text editor for a better writing experience. - [ ] Add a rich text editor for a better writing experience.
@@ -172,6 +195,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Implement user-specific features, such as editing their own posts and comments. - [ ] Implement user-specific features, such as editing their own posts and comments.
### Recovery Meetings Module (`/idaa/recovery_meetings`) ### Recovery Meetings Module (`/idaa/recovery_meetings`)
- [ ] **Refactoring:** - [ ] **Refactoring:**
- [ ] Simplify the search and filtering logic. The current implementation with `setInterval` is complex and could be replaced with a more modern approach using debouncing or reactive statements. - [ ] Simplify the search and filtering logic. The current implementation with `setInterval` is complex and could be replaced with a more modern approach using debouncing or reactive statements.
- [ ] **UI/UX:** - [ ] **UI/UX:**
@@ -185,11 +209,13 @@ These functions are frequently used and critical to the application's data flow.
## Aether Events Module Improvements ## Aether Events Module Improvements
### General ### General
- [ ] **Dashboard:** Create a central dashboard for each event at `/events/[event_id]` that provides an overview of the event and links to all the management pages. - [ ] **Dashboard:** Create a central dashboard for each event at `/events/[event_id]` that provides an overview of the event and links to all the management pages.
- [ ] **Component Refactoring:** The module has a large number of `ae_comp__` components. Audit and refactor them to be more modular and reusable. - [ ] **Component Refactoring:** The module has a large number of `ae_comp__` components. Audit and refactor them to be more modular and reusable.
- [ ] **UI/UX Consistency:** Ensure a consistent look and feel across all the different event management pages. - [ ] **UI/UX Consistency:** Ensure a consistent look and feel across all the different event management pages.
### Core Event Management ### Core Event Management
- [ ] **Event List (`/events`):** - [ ] **Event List (`/events`):**
- [ ] Add search and filtering capabilities to the main event list. - [ ] Add search and filtering capabilities to the main event list.
- [ ] Implement pagination for the event list. - [ ] Implement pagination for the event list.
@@ -197,6 +223,7 @@ These functions are frequently used and critical to the application's data flow.
- [ ] Create a dedicated page or modal for creating and editing events. - [ ] Create a dedicated page or modal for creating and editing events.
### Sub-modules (`/events/[event_id]/...`) ### Sub-modules (`/events/[event_id]/...`)
- [ ] **Sessions, Presentations, Presenters, etc.:** - [ ] **Sessions, Presentations, Presenters, etc.:**
- [ ] For each sub-module (sessions, presentations, etc.), implement a consistent set of features: - [ ] For each sub-module (sessions, presentations, etc.), implement a consistent set of features:
- [ ] List view with search and filtering. - [ ] List view with search and filtering.
@@ -206,14 +233,15 @@ These functions are frequently used and critical to the application's data flow.
- [ ] **File Management:** - [ ] **File Management:**
- [ ] Improve the file upload component (`ae_comp__event_files_upload.svelte`) with features like drag-and-drop and progress bars. - [ ] Improve the file upload component (`ae_comp__event_files_upload.svelte`) with features like drag-and-drop and progress bars.
- [ ] Enhance the file list view with more details and actions. - [ ] Enhance the file list view with more details and actions.
- [ ] **Launcher (`/events/[event_id]/launcher`): - [ ] \*\*Launcher (`/events/[event_id]/launcher`):
- [ ] Add documentation to explain the purpose and usage of the launcher. - [ ] Add documentation to explain the purpose and usage of the launcher.
- [ ] Improve the UI to make it more intuitive for users. - [ ] Improve the UI to make it more intuitive for users.
- [ ] **Badges (`/events/[event_id]/badges`): - [ ] \*\*Badges (`/events/[event_id]/badges`):
- [ ] Enhance the badge printing interface with more customization options. - [ ] Enhance the badge printing interface with more customization options.
- [ ] Add a preview of the badge before printing. - [ ] Add a preview of the badge before printing.
### Performance ### Performance
- [ ] **Live Queries:** Review the use of `liveQuery` throughout the module and optimize for performance, especially on pages with a large amount of data. - [ ] **Live Queries:** Review the use of `liveQuery` throughout the module and optimize for performance, especially on pages with a large amount of data.
- [ ] **Data Loading:** Implement more efficient data loading strategies to avoid fetching unnecessary data. - [ ] **Data Loading:** Implement more efficient data loading strategies to avoid fetching unnecessary data.

View File

@@ -5,9 +5,7 @@
} }
], ],
"settings": { "settings": {
"cSpell.words": [ "cSpell.words": ["filelist"],
"filelist"
],
"git.autofetch": true, "git.autofetch": true,
"editor.defaultFormatter": "svelte.svelte-vscode" "editor.defaultFormatter": "svelte.svelte-vscode"
} }

71
eslint.config.cjs Normal file
View File

@@ -0,0 +1,71 @@
const { defineConfig, globalIgnores } = require('eslint/config');
const tsParser = require('@typescript-eslint/parser');
const typescriptEslint = require('@typescript-eslint/eslint-plugin');
const globals = require('globals');
const parser = require('svelte-eslint-parser');
const js = require('@eslint/js');
const { FlatCompat } = require('@eslint/eslintrc');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
module.exports = defineConfig([
{
extends: compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
),
languageOptions: {
parser: tsParser,
sourceType: 'module',
ecmaVersion: 2020,
parserOptions: {
extraFileExtensions: ['.svelte']
},
globals: {
...globals.browser,
...globals.node
}
},
plugins: {
'@typescript-eslint': typescriptEslint
},
rules: {
'@typescript-eslint/no-unused-vars': 'warn'
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parser: parser,
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
},
globalIgnores([
'**/.DS_Store',
'**/node_modules',
'build',
'.svelte-kit',
'package',
'**/.env',
'**/.env.*',
'!**/.env.example',
'**/pnpm-lock.yaml',
'**/package-lock.json',
'**/yarn.lock'
])
]);

35
package-lock.json generated
View File

@@ -41,6 +41,8 @@
"svelte-persisted-store": "^0.12.0" "svelte-persisted-store": "^0.12.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.1",
"@playwright/test": "^1.28.1", "@playwright/test": "^1.28.1",
"@skeletonlabs/skeleton": "^3.1.3", "@skeletonlabs/skeleton": "^3.1.3",
"@skeletonlabs/skeleton-svelte": "^1.2.3", "@skeletonlabs/skeleton-svelte": "^1.2.3",
@@ -84,6 +86,7 @@
"eslint-config-prettier": "^10.0.0", "eslint-config-prettier": "^10.0.0",
"eslint-plugin-svelte": "^3.0.0", "eslint-plugin-svelte": "^3.0.0",
"flowbite": "^3.0.0", "flowbite": "^3.0.0",
"globals": "^16.5.0",
"highlight.js": "^11.10.0", "highlight.js": "^11.10.0",
"lowlight": "^3.2.0", "lowlight": "^3.2.0",
"mode-watcher": "^1.0.0", "mode-watcher": "^1.0.0",
@@ -1129,6 +1132,19 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"node_modules/@eslint/eslintrc/node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@eslint/eslintrc/node_modules/ignore": { "node_modules/@eslint/eslintrc/node_modules/ignore": {
"version": "5.3.2", "version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@@ -5197,19 +5213,6 @@
} }
} }
}, },
"node_modules/eslint-plugin-svelte/node_modules/globals": {
"version": "16.5.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz",
"integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint-scope": { "node_modules/eslint-scope": {
"version": "8.4.0", "version": "8.4.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
@@ -5753,9 +5756,9 @@
} }
}, },
"node_modules/globals": { "node_modules/globals": {
"version": "14.0.0", "version": "16.5.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {

View File

@@ -19,6 +19,8 @@
"test:unit": "vitest" "test:unit": "vitest"
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.1",
"@playwright/test": "^1.28.1", "@playwright/test": "^1.28.1",
"@skeletonlabs/skeleton": "^3.1.3", "@skeletonlabs/skeleton": "^3.1.3",
"@skeletonlabs/skeleton-svelte": "^1.2.3", "@skeletonlabs/skeleton-svelte": "^1.2.3",
@@ -62,6 +64,7 @@
"eslint-config-prettier": "^10.0.0", "eslint-config-prettier": "^10.0.0",
"eslint-plugin-svelte": "^3.0.0", "eslint-plugin-svelte": "^3.0.0",
"flowbite": "^3.0.0", "flowbite": "^3.0.0",
"globals": "^16.5.0",
"highlight.js": "^11.10.0", "highlight.js": "^11.10.0",
"lowlight": "^3.2.0", "lowlight": "^3.2.0",
"mode-watcher": "^1.0.0", "mode-watcher": "^1.0.0",
@@ -85,7 +88,9 @@
"vitest": "^3.0.0" "vitest": "^3.0.0"
}, },
"vitest": { "vitest": {
"exclude": ["tests"] "exclude": [
"tests"
]
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {

View File

@@ -3,7 +3,7 @@ import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
webServer: { webServer: {
command: 'npm run build && npm run preview', command: 'npm run build && npm run preview',
port: 4173, port: 4173
// url: 'http://scott.localhost:5173', // url: 'http://scott.localhost:5173',
// reuseExistingServer: true, // reuseExistingServer: true,
// stderr: 'pipe', // stderr: 'pipe',
@@ -14,8 +14,8 @@ const config: PlaywrightTestConfig = {
reporter: 'list', reporter: 'list',
use: { use: {
// Collect trace when retrying the failed test. // Collect trace when retrying the failed test.
trace: 'on-first-retry', trace: 'on-first-retry'
}, }
// grep: /@node_modules/, // grep: /@node_modules/,
// grepInverse: /@node_modules/, // grepInverse: /@node_modules/,
}; };

View File

@@ -48,10 +48,6 @@
--color-primary-contrast-light: var(--color-primary-50); --color-primary-contrast-light: var(--color-primary-50);
--color-primary-contrast-500: var(--color-primary-contrast-light); --color-primary-contrast-500: var(--color-primary-contrast-light);
--color-primary-contrast-600: var(--color-primary-contrast-light); --color-primary-contrast-600: var(--color-primary-contrast-light);
--color-primary-contrast-700: var(--color-primary-contrast-light); --color-primary-contrast-700: var(--color-primary-contrast-light);
@@ -72,11 +68,6 @@
--color-secondary-contrast-light: var(--color-secondary-50); --color-secondary-contrast-light: var(--color-secondary-50);
--color-secondary-contrast-600: var(--color-secondary-contrast-light); --color-secondary-contrast-600: var(--color-secondary-contrast-light);
--color-secondary-contrast-700: var(--color-secondary-contrast-light); --color-secondary-contrast-700: var(--color-secondary-contrast-light);
--color-secondary-contrast-800: var(--color-secondary-contrast-light); --color-secondary-contrast-800: var(--color-secondary-contrast-light);
@@ -96,13 +87,6 @@
--color-tertiary-contrast-light: var(--color-tertiary-50); --color-tertiary-contrast-light: var(--color-tertiary-50);
--color-tertiary-contrast-800: var(--color-tertiary-contrast-light); --color-tertiary-contrast-800: var(--color-tertiary-contrast-light);
--color-tertiary-contrast-900: var(--color-tertiary-contrast-light); --color-tertiary-contrast-900: var(--color-tertiary-contrast-light);
--color-tertiary-contrast-950: var(--color-tertiary-contrast-light); --color-tertiary-contrast-950: var(--color-tertiary-contrast-light);
@@ -120,13 +104,6 @@
--color-success-contrast-light: var(--color-success-50); --color-success-contrast-light: var(--color-success-50);
--color-success-contrast-800: var(--color-success-contrast-light); --color-success-contrast-800: var(--color-success-contrast-light);
--color-success-contrast-900: var(--color-success-contrast-light); --color-success-contrast-900: var(--color-success-contrast-light);
--color-success-contrast-950: var(--color-success-contrast-light); --color-success-contrast-950: var(--color-success-contrast-light);
@@ -144,13 +121,6 @@
--color-warning-contrast-light: var(--color-warning-50); --color-warning-contrast-light: var(--color-warning-50);
--color-warning-contrast-800: var(--color-warning-contrast-light); --color-warning-contrast-800: var(--color-warning-contrast-light);
--color-warning-contrast-900: var(--color-warning-contrast-light); --color-warning-contrast-900: var(--color-warning-contrast-light);
--color-warning-contrast-950: var(--color-warning-contrast-light); --color-warning-contrast-950: var(--color-warning-contrast-light);
@@ -168,9 +138,6 @@
--color-error-contrast-light: var(--color-error-50); --color-error-contrast-light: var(--color-error-50);
--color-error-contrast-400: var(--color-error-contrast-light); --color-error-contrast-400: var(--color-error-contrast-light);
--color-error-contrast-500: var(--color-error-contrast-light); --color-error-contrast-500: var(--color-error-contrast-light);
--color-error-contrast-600: var(--color-error-contrast-light); --color-error-contrast-600: var(--color-error-contrast-light);
@@ -192,12 +159,6 @@
--color-surface-contrast-light: var(--color-surface-50); --color-surface-contrast-light: var(--color-surface-50);
--color-surface-contrast-700: var(--color-surface-contrast-light); --color-surface-contrast-700: var(--color-surface-contrast-light);
--color-surface-contrast-800: var(--color-surface-contrast-light); --color-surface-contrast-800: var(--color-surface-contrast-light);
--color-surface-contrast-900: var(--color-surface-contrast-light); --color-surface-contrast-900: var(--color-surface-contrast-light);

View File

@@ -1,7 +1,7 @@
@import 'tailwindcss'; @import 'tailwindcss';
@import "@skeletonlabs/skeleton"; @import '@skeletonlabs/skeleton';
@import "@skeletonlabs/skeleton/optional/presets"; @import '@skeletonlabs/skeleton/optional/presets';
/* Register Preset Themes */ /* Register Preset Themes */
/* @import '@skeletonlabs/skeleton/themes/{theme-name}'; */ /* @import '@skeletonlabs/skeleton/themes/{theme-name}'; */
@@ -23,18 +23,15 @@
@source '../node_modules/@skeletonlabs/skeleton-svelte/dist'; @source '../node_modules/@skeletonlabs/skeleton-svelte/dist';
/* Add your theme import for your theme: "osit-custom-theme" here */ /* Add your theme import for your theme: "osit-custom-theme" here */
/* @plugin '@tailwindcss/forms'; */ /* @plugin '@tailwindcss/forms'; */
/* @plugin '@tailwindcss/typography'; */ /* @plugin '@tailwindcss/typography'; */
/* @import "tailwindcss/theme.css" layer(theme); */ /* @import "tailwindcss/theme.css" layer(theme); */
/* @import "tailwindcss/preflight"; */ /* @import "tailwindcss/preflight"; */
@import "tailwindcss/utilities.css" layer(utilities); @import 'tailwindcss/utilities.css' layer(utilities);
/*@tailwind utilities;*/ /*@tailwind utilities;*/
/* Register a Custom Themes */ /* Register a Custom Themes */
/* Make sure to resolve the relative path. */ /* Make sure to resolve the relative path. */
/* Note the .css extension is optional. */ /* Note the .css extension is optional. */
@@ -45,7 +42,6 @@
/* https://www.skeleton.dev/docs/guides/cookbook/light-switch */ /* https://www.skeleton.dev/docs/guides/cookbook/light-switch */
/* @custom-variant dark (&:where([data-mode="dark"], [data-mode="dark"] *)); */ /* @custom-variant dark (&:where([data-mode="dark"], [data-mode="dark"] *)); */
@layer base { @layer base {
:root { :root {
--background: 0 0% 100%; --background: 0 0% 100%;
@@ -119,9 +115,6 @@
} }
} }
/* There are no more Tailwind layers. */ /* There are no more Tailwind layers. */
html, html,
@@ -346,7 +339,6 @@ html.trusted_access #appShell {
@apply border text-cyan-950 dark:text-cyan-50 bg-cyan-50 dark:bg-cyan-950 border-cyan-200 dark:border-cyan-800 transition-all; @apply border text-cyan-950 dark:text-cyan-50 bg-cyan-50 dark:bg-cyan-950 border-cyan-200 dark:border-cyan-800 transition-all;
} }
/* Containers customized for Aether using Skeleton Tailwind preset classes */ /* Containers customized for Aether using Skeleton Tailwind preset classes */
.ae_container_system_menu { .ae_container_system_menu {
@apply container; @apply container;
@@ -389,8 +381,7 @@ html.trusted_access #appShell {
border rounded-md border-gray-200 dark:border-gray-800 hover:bg-gray-100 dark:hover:bg-gray-900 transition-all duration-700 hover:duration-300; border rounded-md border-gray-200 dark:border-gray-800 hover:bg-gray-100 dark:hover:bg-gray-900 transition-all duration-700 hover:duration-300;
} }
.ae_container_module_options { .ae_container_module_options {
@apply @apply text-cyan-950 dark:text-cyan-50
text-cyan-950 dark:text-cyan-50
bg-cyan-50 dark:bg-cyan-950 hover:bg-cyan-100 dark:hover:bg-cyan-900 bg-cyan-50 dark:bg-cyan-950 hover:bg-cyan-100 dark:hover:bg-cyan-900
border border-cyan-200 dark:border-cyan-800 hover:border-cyan-400 dark:hover:border-cyan-600 border border-cyan-200 dark:border-cyan-800 hover:border-cyan-400 dark:hover:border-cyan-600
rounded-md rounded-md
@@ -400,8 +391,7 @@ html.trusted_access #appShell {
transition-all; transition-all;
} }
.ae_container_module_help { .ae_container_module_help {
@apply @apply text-yellow-950 dark:text-yellow-50
text-yellow-950 dark:text-yellow-50
bg-yellow-50 dark:bg-yellow-950 hover:bg-yellow-100 dark:hover:bg-yellow-900 bg-yellow-50 dark:bg-yellow-950 hover:bg-yellow-100 dark:hover:bg-yellow-900
border border-yellow-200 dark:border-yellow-800 hover:border-yellow-400 dark:hover:border-yellow-600 border border-yellow-200 dark:border-yellow-800 hover:border-yellow-400 dark:hover:border-yellow-600
rounded-md rounded-md
@@ -434,8 +424,7 @@ html.trusted_access #appShell {
@apply container; @apply container;
} }
.ae_container_help { .ae_container_help {
@apply @apply text-yellow-950 dark:text-yellow-50
text-yellow-950 dark:text-yellow-50
bg-yellow-50 dark:bg-yellow-950 hover:bg-yellow-100 dark:hover:bg-yellow-900 bg-yellow-50 dark:bg-yellow-950 hover:bg-yellow-100 dark:hover:bg-yellow-900
border border-yellow-200 dark:border-yellow-800 hover:border-yellow-400 dark:hover:border-yellow-600 border border-yellow-200 dark:border-yellow-800 hover:border-yellow-400 dark:hover:border-yellow-600
rounded-md rounded-md
@@ -445,8 +434,7 @@ html.trusted_access #appShell {
/* bg-yellow-100 border border-yellow-400 p-2 rounded-md max-w-xl */ /* bg-yellow-100 border border-yellow-400 p-2 rounded-md max-w-xl */
} }
.ae_container_info { .ae_container_info {
@apply @apply text-cyan-950 dark:text-cyan-50
text-cyan-950 dark:text-cyan-50
bg-cyan-50 dark:bg-cyan-950 hover:bg-cyan-100 dark:hover:bg-cyan-900 bg-cyan-50 dark:bg-cyan-950 hover:bg-cyan-100 dark:hover:bg-cyan-900
border border-cyan-200 dark:border-cyan-800 hover:border-cyan-400 dark:hover:border-cyan-600 border border-cyan-200 dark:border-cyan-800 hover:border-cyan-400 dark:hover:border-cyan-600
rounded-md rounded-md
@@ -477,7 +465,6 @@ html.trusted_access #appShell {
@apply container; @apply container;
} }
/* Standard Aether object properties: /* Standard Aether object properties:
* - id * - id
* - name * - name
@@ -489,29 +476,24 @@ html.trusted_access #appShell {
* - notes * - notes
*/ */
.card-footer { .card-footer {
border-top: 1px solid hsla(0, 0%, 0%, 0.5); border-top: 1px solid hsla(0, 0%, 0%, 0.5);
margin-top: 1em; margin-top: 1em;
padding-top: 1em; padding-top: 1em;
opacity: .5; opacity: 0.5;
} }
/* Tailwind: This "fixes" Tailwind's default group button styles that do not seem to allow hiding buttons. */ /* Tailwind: This "fixes" Tailwind's default group button styles that do not seem to allow hiding buttons. */
.btn-group a.hidden, .btn-group button.hidden { .btn-group a.hidden,
.btn-group button.hidden {
display: none; display: none;
} }
.ae_d_none { .ae_d_none {
display: none; display: none;
} }
/* Allow content to scroll horizontal if too wide */ /* Allow content to scroll horizontal if too wide */
.ae_h_scrollfix { .ae_h_scrollfix {
max-width: 100%; max-width: 100%;
@@ -524,7 +506,6 @@ html.trusted_access #appShell {
overflow-y: auto; overflow-y: auto;
max-height: 96vh; max-height: 96vh;
/* max-height: 99%; */ /* max-height: 99%; */
} }
.ae_debug { .ae_debug {
@@ -536,12 +517,11 @@ html.trusted_access #appShell {
} }
.ae_debug:hover { .ae_debug:hover {
/* A darker pink outline */ /* A darker pink outline */
outline-color: hsla(0, 100%, 50%, 0.50); outline-color: hsla(0, 100%, 50%, 0.5);
/* A light pink background color */ /* A light pink background color */
background-color: hsla(0, 100%, 50%, 0.40); background-color: hsla(0, 100%, 50%, 0.4);
} }
/* Deal with being in an iframe */ /* Deal with being in an iframe */
#appShell #shell-header.iframe { #appShell #shell-header.iframe {
display: none; display: none;
@@ -551,7 +531,8 @@ html.trusted_access #appShell {
display: none; display: none;
} }
.iframe .module_header, .iframe .module_footer{ .iframe .module_header,
.iframe .module_footer {
display: none; display: none;
} }
@@ -577,7 +558,7 @@ main {
main > section { main > section {
background: none; background: none;
background-color: hsla(0, 0%, 100%, 0.92); background-color: hsla(0, 0%, 100%, 0.92);
padding: .5em; padding: 0.5em;
} }
/* @media (min-width: 640px) { /* @media (min-width: 640px) {
@@ -612,7 +593,6 @@ pre.pre_wrap {
overflow-x: auto; overflow-x: auto;
} }
input.required { input.required {
/* border-right: solid medium var(--color-warning-500); */ /* border-right: solid medium var(--color-warning-500); */
/* color: var(--color-warning-500); */ /* color: var(--color-warning-500); */
@@ -648,7 +628,7 @@ input:required {
position: relative; position: relative;
/* top: 0em; */ /* top: 0em; */
left: .25em; left: 0.25em;
} }
/* Make the group a flex row by default */ /* Make the group a flex row by default */
@@ -686,18 +666,15 @@ div.btn-group button:last-child {
} */ } */
.ae_obj_prop .label { .ae_obj_prop .label {
} }
.ae_obj_prop .value { .ae_obj_prop .value {
font-weight: bold; font-weight: bold;
} }
.ae_md_hide { .ae_md_hide {
/* outline: medium dashed green; */ /* outline: medium dashed green; */
/* display: none; */ /* display: none; */
} }
@media (max-width: 767px) { @media (max-width: 767px) {
@@ -713,9 +690,6 @@ div.btn-group button:last-child {
} }
} }
/* Use the div.ae_quick_modal_container to block background clicks when using the section.ae_quick_popover. */ /* Use the div.ae_quick_modal_container to block background clicks when using the section.ae_quick_popover. */
div.ae_quick_modal_container { div.ae_quick_modal_container {
position: fixed; position: fixed;
@@ -724,7 +698,7 @@ div.ae_quick_modal_container {
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 100; z-index: 100;
background-color: hsla(0, 0%, 0%, .5); background-color: hsla(0, 0%, 0%, 0.5);
} }
/* The section.ae_quick_popover should be above the rest of the content and centered on the page. */ /* The section.ae_quick_popover should be above the rest of the content and centered on the page. */
@@ -734,10 +708,10 @@ section.ae_quick_popover {
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 100; z-index: 100;
background-color: hsla(0, 0%, 100%, .95); background-color: hsla(0, 0%, 100%, 0.95);
padding: 1rem; padding: 1rem;
border-radius: .5rem; border-radius: 0.5rem;
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5); box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5);
min-height: 98%; min-height: 98%;
min-width: 98%; min-width: 98%;
@@ -749,10 +723,10 @@ section.ae_quick_popover_small {
left: 50%; left: 50%;
transform: translate(-50%, 0%); transform: translate(-50%, 0%);
z-index: 100; z-index: 100;
background-color: hsla(0, 0%, 100%, .95); background-color: hsla(0, 0%, 100%, 0.95);
padding: 1rem; padding: 1rem;
border-radius: .5rem; border-radius: 0.5rem;
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5); box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5);
min-height: 24rem; min-height: 24rem;
max-height: 95%; max-height: 95%;
@@ -760,7 +734,6 @@ section.ae_quick_popover_small {
max-width: 95%; max-width: 95%;
} }
.fade_50 { .fade_50 {
opacity: 0.5; opacity: 0.5;
} }
@@ -768,7 +741,6 @@ section.ae_quick_popover_small {
opacity: 1; opacity: 1;
} }
.auth_view_only { .auth_view_only {
display: none; display: none;
} }
@@ -776,8 +748,6 @@ section.ae_quick_popover_small {
display: initial; display: initial;
} }
img.qr_code { img.qr_code {
/* outline: solid thin hsla(30, 100%, 50%, .1); */ /* outline: solid thin hsla(30, 100%, 50%, .1); */
/* width: 1.50in; */ /* width: 1.50in; */
@@ -793,24 +763,28 @@ img.qr_code:focus {
/* width: 2.50in; */ /* width: 2.50in; */
} }
.dim { .dim {
opacity: 0.5; opacity: 0.5;
color: hsla(0, 0%, 50%, .95); color: hsla(0, 0%, 50%, 0.95);
} }
.dim_warning { .dim_warning {
opacity: 0.5; opacity: 0.5;
/* color: hsla(0, 100%, 50%, .95); */ /* color: hsla(0, 100%, 50%, .95); */
/* background should be hash marks */ /* background should be hash marks */
background-image: repeating-linear-gradient(-45deg, hsla(0, 100%, 50%, .25), hsla(0, 100%, 50%, .25) 10px, transparent 10px, transparent 20px); background-image: repeating-linear-gradient(
-45deg,
hsla(0, 100%, 50%, 0.25),
hsla(0, 100%, 50%, 0.25) 10px,
transparent 10px,
transparent 20px
);
} }
.alert { .alert {
/* background-color: hsla(0, 100%, 50%, .1); */ /* background-color: hsla(0, 100%, 50%, .1); */
outline: dashed thin hsla(0, 100%, 50%, .5); outline: dashed thin hsla(0, 100%, 50%, 0.5);
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.sk_header.hide_sm { .sk_header.hide_sm {
display: none; display: none;
@@ -837,7 +811,7 @@ img.qr_code:focus {
/* We need to reset many of the styles for the reset_css class. */ /* We need to reset many of the styles for the reset_css class. */
.reset_css p { .reset_css p {
margin: .75em 0; margin: 0.75em 0;
} }
.reset_css ol { .reset_css ol {
list-style-type: decimal; list-style-type: decimal;
@@ -854,11 +828,10 @@ img.qr_code:focus {
text-decoration: underline; text-decoration: underline;
} }
.reset_css a:hover { .reset_css a:hover {
color: hsla(210, 100%, 50%, .75); color: hsla(210, 100%, 50%, 0.75);
text-decoration: none; text-decoration: none;
} }
/* .ae_btn.btn-danger, /* .ae_btn.btn-danger,
.ae_btn.btn-info, .ae_btn.btn-info,
.ae_btn.btn-warning { .ae_btn.btn-warning {
@@ -886,8 +859,6 @@ img.qr_code:focus {
border-radius: 60px; border-radius: 60px;
/* border-color: hsla(0, 0%, 50%, .5); */ /* border-color: hsla(0, 0%, 50%, .5); */
/* border-color: hsla(0, 0%, 0%, .15); */ /* border-color: hsla(0, 0%, 0%, .15); */
} }
.iframe .novi_m0 { .iframe .novi_m0 {
@@ -928,19 +899,15 @@ img.qr_code:focus {
background-color: hsla(0, 0%, 20%, 1); background-color: hsla(0, 0%, 20%, 1);
} }
.iframe .novi_bg_light { .iframe .novi_bg_light {
background-color: hsla(0, 0%, 0%, .15); background-color: hsla(0, 0%, 0%, 0.15);
color: hsla(0, 0%, 20%, 1); color: hsla(0, 0%, 20%, 1);
} }
.iframe .novi_bg_dark { .iframe .novi_bg_dark {
background-color: hsla(0, 0%, 0%, .25); background-color: hsla(0, 0%, 0%, 0.25);
color: hsla(0, 0%, 95%, 1); color: hsla(0, 0%, 95%, 1);
} }
.iframe .novi_margin_sm { .iframe .novi_margin_sm {
/* margin: 0.5em; */ /* margin: 0.5em; */
} }
@@ -962,15 +929,13 @@ img.qr_code:focus {
.iframe button.ae_smaller, .iframe button.ae_smaller,
.iframe .btn.ae_smaller, .iframe .btn.ae_smaller,
.iframe button.novi_smaller, .iframe button.novi_smaller,
.iframe .btn.novi_smaller .iframe .btn.novi_smaller {
{
font-size: 0.8rem; font-size: 0.8rem;
} }
.iframe button.ae_smallest, .iframe button.ae_smallest,
.iframe .btn.ae_smallest, .iframe .btn.ae_smallest,
.iframe button.novi_smallest, .iframe button.novi_smallest,
.iframe .btn.novi_smallest .iframe .btn.novi_smallest {
{
font-size: 0.65rem; font-size: 0.65rem;
} }

View File

@@ -1,20 +1,35 @@
<!DOCTYPE html> <!doctype html>
<html lang="en" class="light" data-theme=""> <html lang="en" class="light" data-theme="">
<head> <head>
<meta charset="utf-8" > <meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" > <link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="manifest" href="%sveltekit.assets%/manifest.json"> <link rel="manifest" href="%sveltekit.assets%/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" > <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="preconnect" href="https://fonts.gstatic.com" />
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> <link
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap"
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet"> rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" > <link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<!-- <link href="app.css" rel="stylesheet"> --> <!-- <link href="app.css" rel="stylesheet"> -->
@@ -23,8 +38,6 @@
<!-- h-full w-full overflow-auto --> <!-- h-full w-full overflow-auto -->
<!-- overflow-x-scroll --> <!-- overflow-x-scroll -->
<body data-sveltekit-preload-data="hover" class="h-full w-full"> <body data-sveltekit-preload-data="hover" class="h-full w-full">
<div style="display: contents" class="">%sveltekit.body%</div> <div style="display: contents" class="">%sveltekit.body%</div>
</body> </body>
</html> </html>

View File

@@ -1,546 +0,0 @@
@import "tailwindcss/preflight";
@tailwind utilities;
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 224 71.4% 4.1%;
--muted: 220 14.3% 95.9%;
--muted-foreground: 220 8.9% 46.1%;
--popover: 0 0% 100%;
--popover-foreground: 224 71.4% 4.1%;
--card: 0 0% 100%;
--card-foreground: 224 71.4% 4.1%;
--border: 220 13% 91%;
--input: 220 13% 91%;
--primary: 220.9 39.3% 11%;
--primary-foreground: 210 20% 98%;
--secondary: 220 14.3% 95.9%;
--secondary-foreground: 220.9 39.3% 11%;
--accent: 220 14.3% 95.9%;
--accent-foreground: 220.9 39.3% 11%;
--destructive: 0 72.2% 50.6%;
--destructive-foreground: 210 20% 98%;
--ring: 224 71.4% 4.1%;
--radius: 0.5rem;
--sidebar-background: 0 0% 98%;
--sidebar-foreground: 240 5.3% 26.1%;
--sidebar-primary: 240 5.9% 10%;
--sidebar-primary-foreground: 0 0% 98%;
--sidebar-accent: 240 4.8% 95.9%;
--sidebar-accent-foreground: 240 5.9% 10%;
--sidebar-border: 220 13% 91%;
--sidebar-ring: 217.2 91.2% 59.8%;
}
.dark {
--background: 224 71.4% 4.1%;
--foreground: 210 20% 98%;
--muted: 215 27.9% 16.9%;
--muted-foreground: 217.9 10.6% 64.9%;
--popover: 224 71.4% 4.1%;
--popover-foreground: 210 20% 98%;
--card: 224 71.4% 4.1%;
--card-foreground: 210 20% 98%;
--border: 215 27.9% 16.9%;
--input: 215 27.9% 16.9%;
--primary: 210 20% 98%;
--primary-foreground: 220.9 39.3% 11%;
--secondary: 215 27.9% 16.9%;
--secondary-foreground: 210 20% 98%;
--accent: 215 27.9% 16.9%;
--accent-foreground: 210 20% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 20% 98%;
--ring: 216 12.2% 83.9%;
--sidebar-background: 240 5.9% 10%;
--sidebar-foreground: 240 4.8% 95.9%;
--sidebar-primary: 224.3 76.3% 48%;
--sidebar-primary-foreground: 0 0% 100%;
--sidebar-accent: 240 3.7% 15.9%;
--sidebar-accent-foreground: 240 4.8% 95.9%;
--sidebar-border: 240 3.7% 15.9%;
--sidebar-ring: 217.2 91.2% 59.8%;
}
}
@layer base {
* {
border-color: hsl(var(--border));
}
body {
background-color: hsl(var(--background));
color: hsl(var(--foreground));
}
}
/* There are no more Tailwind layers. */
html,
body {
@apply h-full overflow-hidden;
/* font-family: 'Liberation Sans', sans-serif; */
/* font-family: 'Noto Sans', sans-serif; */
}
html.super_access #appShell {
background-color: hsla(0, 100%, 50%, 0.5);
}
html.manager_access #appShell {
background-color: hsla(0, 50%, 75%, 0.5);
}
html.administrator_access #appShell {
background-color: hsla(40, 50%, 85%, 0.25);
}
html.trusted_access #appShell {
background-color: hsla(20, 50%, 85%, 0.25);
}
/* default theme */
/* @font-face {
font-family: 'Liberation Sans', sans-serif;
font-family: 'Noto Sans', sans-serif;
src: url('/fonts/liberation/LiberationSans-Regular.ttf');
src: url('/fonts/noto/NotoSans-Regular.ttf');
font-display: swap;
} */
/* modern theme */
@font-face {
font-family: 'Quicksand';
src: url('/fonts/Quicksand.ttf');
font-display: swap;
}
/* :root [data-theme='modern'] { */
/* --theme-rounded-base: 20px;
--theme-rounded-container: 4px; */
/* --theme-font-family-base: 'Liberation Sans', sans-serif; */
/* --theme-font-family-heading: 'Liberation Sans', sans-serif; */
/* } */
.card-footer {
border-top: 1px solid hsla(0, 0%, 0%, 0.5);
margin-top: 1em;
padding-top: 1em;
opacity: .5;
}
/* Tailwind: This "fixes" Tailwind's default group button styles that do not seem to allow hiding buttons. */
.btn-group a.hidden, .btn-group button.hidden {
display: none;
}
.ae_d_none {
display: none;
}
/* Allow content to scroll horizontal if too wide */
.ae_h_scrollfix {
max-width: 100%;
overflow-x: auto;
}
/* These helps with the Skeleton Tailwind modal utility. */
.ae_modal_scrollfix {
/* Allow modal content to scroll if it's too long */
overflow-y: auto;
max-height: 96vh;
/* max-height: 99%; */
}
.ae_debug {
/* A darker pink outline */
outline: thin dashed;
outline-color: hsla(0, 100%, 50%, 0.15);
/* A light pink background color */
background-color: hsla(0, 100%, 50%, 0.15);
}
.ae_debug:hover {
/* A darker pink outline */
outline-color: hsla(0, 100%, 50%, 0.50);
/* A light pink background color */
background-color: hsla(0, 100%, 50%, 0.40);
}
/* Deal with being in an iframe */
#appShell #shell-header.iframe {
display: none;
}
#appShell #shell-footer.iframe {
display: none;
}
/* Remove the background from the body in all cases */
/* body[data-theme] { */
/* background: none; */
/* background-image: none; */
/* } */
/* Remove the background from the body if using iframes */
/* body[data-theme]:has(#page.iframe) { */
/* background: none; */
/* background-image: none; */
/* background-image: url('https://static.oneskyit.com/c/CHOW/images/CHOW_2024_yellow_background.png'); */
/* background-size: cover; */
/* } */
main {
/* background: none;
background-color: hsla(0, 0%, 100%, 0.92); */
}
main>section {
background: none;
background-color: hsla(0, 0%, 100%, 0.92);
padding: .5em;
}
/* @media (min-width: 640px) {
main>div, main>section {
padding: 0;
max-width: 100%;
}
} */
/* @media (min-width: 768px) {
main>div, main>section {
padding: 0;
max-width: 100%;
}
} */
.ae_sponsorships {
/* background: none; */
/* background-color: hsla(0, 0%, 100%, 0.92); */
/* background-image: url('https://static.oneskyit.com/c/CHOW/images/CHOW_2024_yellow_background.png'); */
/* background-size: cover; */
}
pre.pre_wrap {
white-space: pre-wrap;
word-break: normal;
word-wrap: normal;
border: none;
max-width: 100%;
overflow-x: auto;
}
input.required {
/* border-right: solid medium var(--color-warning-500); */
/* color: var(--color-warning-500); */
}
input:required {
/* background-color: var(--alert-color-lightest); */
/* border: solid 2px red; */
/* outline: dashed thin var(--alert-color-lighter); */
/* border-right: solid medium var(--alert-color-mid); */
/* border-right: solid medium var(--warning-color-mid); */
/* border-right: solid medium var(--error-color-mid); */
}
/* input:required:hover {
background-color: var(--alert-color-lighter);
border-right: solid thick var(--alert-color-darker);
} */
/* input:required::before {
display: block;
content: '*';
color: var(--warning-color-darker);
top: 5px;
left: 5px;
} */
.input_required::after {
content: '*';
color: rgb(var(--color-error-500) / 0.9);
position: relative;
/* top: 0em; */
left: .25em;
}
/* Make the group a flex row by default */
/* div.btn-group { */
/* display: flex; */
/* gap: 0; */
/* flex-direction: row; */
/* justify-content: space-around; */
/* align-items: center; */
/* margin: 0;
padding: 0; */
/* } */
/* Make all button elements except for the the first button element not rounded on the left. */
/* Make all button elements except for the fhe last button element not rounded on the right. */
/* These helps with the Skeleton (Tailwind?) button group element. */
.btn-group button {
border-radius: 0;
border: none;
}
/* .md:btn-group button,
.lg:btn-group button {
border-radius: 0;
border: none;
} */
/* div.btn-group button:first-child {
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem;
}
div.btn-group button:last-child {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
} */
.ae_obj_prop .label {
}
.ae_obj_prop .value {
font-weight: bold;
}
.ae_md_hide {
/* outline: medium dashed green; */
/* display: none; */
}
@media (max-width: 767px) {
.ae_md_hide {
/* outline: medium dashed red; */
display: none;
}
}
@media (min-width: 768px) {
.ae_lg_hide {
/* outline: medium dashed blue; */
display: none;
}
}
/* Use the div.ae_quick_modal_container to block background clicks when using the section.ae_quick_popover. */
div.ae_quick_modal_container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
background-color: hsla(0, 0%, 0%, .5);
}
/* The section.ae_quick_popover should be above the rest of the content and centered on the page. */
section.ae_quick_popover {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 100;
background-color: hsla(0, 0%, 100%, .95);
padding: 1rem;
border-radius: .5rem;
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5);
min-height: 98%;
min-width: 98%;
}
section.ae_quick_popover_small {
position: fixed;
top: 1em;
left: 50%;
transform: translate(-50%, 0%);
z-index: 100;
background-color: hsla(0, 0%, 100%, .95);
padding: 1rem;
border-radius: .5rem;
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5);
min-height: 24rem;
max-height: 95%;
min-width: 50%;
max-width: 95%;
}
.fade_50 {
opacity: 0.5;
}
.fade_50:hover {
opacity: 1;
}
.auth_view_only {
display: none;
}
.ae_root--auth_access .auth_view_only {
display: initial;
}
img.qr_code {
/* outline: solid thin hsla(30, 100%, 50%, .1); */
/* width: 1.50in; */
}
img.qr_code:hover {
/* outline: solid thin green; */
/* width: 2.50in; */
}
img.qr_code:focus {
/* outline: solid thin red; */
/* width: 2.50in; */
}
.dim {
opacity: 0.5;
color: hsla(0, 0%, 50%, .95);
}
.dim_warning {
opacity: 0.5;
/* color: hsla(0, 100%, 50%, .95); */
/* background should be hash marks */
background-image: repeating-linear-gradient(-45deg, hsla(0, 100%, 50%, .25), hsla(0, 100%, 50%, .25) 10px, transparent 10px, transparent 20px);
}
@media (max-width: 767px) {
.sk_header.hide_sm {
display: none;
}
.sk_header.show_sm {
display: initial;
}
.sk_header.show_md {
display: none;
}
}
@media (min-width: 768px) {
.sk_header.hide_md {
display: none;
}
.sk_header.show_md {
display: initial;
}
.sk_header.show_sm {
display: none;
}
}
/* We need to reset many of the styles for the reset_css class. */
.reset_css p {
margin: .75em 0;
}
.reset_css ol {
list-style-type: decimal;
}
.reset_css ul {
list-style-type: disc;
}
.reset_css li {
margin-left: 1.5em;
}
/* Reset anchor tags to the default color and underline. */
.reset_css a {
color: hsla(210, 100%, 50%, 1);
text-decoration: underline;
}
.reset_css a:hover {
color: hsla(210, 100%, 50%, .75);
text-decoration: none;
}
/* .ae_btn.btn-danger,
.ae_btn.btn-info,
.ae_btn.btn-warning {
border-radius: 60px;
} */
/* .ae_margin_xs {
margin: 0.25em;
}
.ae_margin_sm {
margin: 0.5em;
}
.ae_margin_md {
margin: 0.75em;
}
.ae_margin_lg {
margin: 1em;
}
.ae_margin_lg {
margin: 1.25em;
} */
/* BEGIN: Overrides and fixes specific to Novi and IDAA */
.iframe .novi_btn {
border-radius: 60px;
border-color: hsla(0, 0%, 50%, .5);
}
.iframe .novi_margin_sm {
/* margin: 0.5em; */
}
.iframe .novi_text_wrap {
/* white-space: normal; */
white-space: pre-wrap;
word-break: break-word;
}
/* END: Overrides and fixes specific to Novi and IDAA */
.iframe button.ae_normal,
.iframe .btn.ae_normal {
/* font: normal 1em sans-serif; */
font-size: 1rem;
}
.iframe button.ae_smaller,
.iframe .btn.ae_smaller,
.iframe button.novi_smaller,
.iframe .btn.novi_smaller
{
font-size: 0.8rem;
}
.iframe button.ae_smallest,
.iframe .btn.ae_smallest,
.iframe button.novi_smallest,
.iframe .btn.novi_smallest
{
font-size: 0.65rem;
}

View File

@@ -1,8 +1,7 @@
// import axios from 'axios'; // import axios from 'axios';
// Updated 2024-05-23 // Updated 2024-05-23
export let delete_object = async function delete_object( export const delete_object = async function delete_object({
{
api_cfg = null, api_cfg = null,
endpoint = '', endpoint = '',
params = {}, params = {},
@@ -11,15 +10,14 @@ export let delete_object = async function delete_object(
log_lvl = 0, log_lvl = 0,
retry_count = 5 // Number of retry attempts retry_count = 5 // Number of retry attempts
}: { }: {
api_cfg: any, api_cfg: any;
endpoint: string, endpoint: string;
params?: any, params?: any;
data?: any, data?: any;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number, log_lvl?: number;
retry_count?: number retry_count?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_object() *** Endpoint: ${endpoint}`); console.log(`*** delete_object() *** Endpoint: ${endpoint}`);
console.log('Params:', params); console.log('Params:', params);
@@ -35,12 +33,12 @@ export let delete_object = async function delete_object(
// Construct the URL with query parameters // Construct the URL with query parameters
const url = new URL(endpoint, api_cfg['base_url']); const url = new URL(endpoint, api_cfg['base_url']);
Object.keys(params).forEach(key => url.searchParams.append(key, params[key])); Object.keys(params).forEach((key) => url.searchParams.append(key, params[key]));
// Clean the headers // Clean the headers
let headers_cleaned: Record<string, string> = {}; const headers_cleaned: Record<string, string> = {};
for (const prop in api_cfg['headers']) { for (const prop in api_cfg['headers']) {
let prop_cleaned = prop.replaceAll('_', '-'); const prop_cleaned = prop.replaceAll('_', '-');
headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; headers_cleaned[prop_cleaned] = api_cfg['headers'][prop];
} }
@@ -101,7 +99,6 @@ export let delete_object = async function delete_object(
} }
} }
// https://stackoverflow.com/questions/51069552/axios-delete-request-with-body-and-headers // https://stackoverflow.com/questions/51069552/axios-delete-request-with-body-and-headers
// let axios_api = axios.create({ // let axios_api = axios.create({
@@ -130,4 +127,4 @@ export let delete_object = async function delete_object(
// console.log(response_data); // console.log(response_data);
// } // }
// return response_data; // return response_data;
} };

View File

@@ -2,8 +2,7 @@ import type { key_val } from '$lib/stores/ae_stores';
import { get_object } from './api_get_object'; import { get_object } from './api_get_object';
// Updated 2023-12-01 // Updated 2023-12-01
export async function get_ae_obj_id_crud( export async function get_ae_obj_id_crud({
{
api_cfg, api_cfg,
no_account_id = false, no_account_id = false,
obj_type, obj_type,
@@ -24,27 +23,26 @@ export async function get_ae_obj_id_crud(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
no_account_id?: boolean, no_account_id?: boolean;
obj_type: string, obj_type: string;
obj_id: string, obj_id: string;
use_alt_table?: boolean, use_alt_table?: boolean;
use_alt_base?: boolean, use_alt_base?: boolean;
inc?: any, inc?: any;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
data?: any, data?: any;
// key: string, // key: string,
// jwt?: string, // jwt?: string,
headers?: any, headers?: any;
params?: key_val, params?: key_val;
timeout?: number, timeout?: number;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log('*** get_ae_obj_id_crud() ***'); console.log('*** get_ae_obj_id_crud() ***');
} }
@@ -155,15 +153,14 @@ export async function get_ae_obj_id_crud(
// headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes // headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes
} }
let object_obj_get_promise = await get_object({ const object_obj_get_promise = await get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
headers: headers, headers: headers,
params: params, params: params,
timeout: timeout, timeout: timeout,
log_lvl: log_lvl log_lvl: log_lvl
}) }).catch(function (error: any) {
.catch(function (error: any) {
console.log('API GET CRUD object ID request failed.', error); console.log('API GET CRUD object ID request failed.', error);
}); });

View File

@@ -3,8 +3,7 @@ import { get_object } from './api_get_object';
// The lookup "obj_type" should broken out into a separate function. - 2024-08-07 // The lookup "obj_type" should broken out into a separate function. - 2024-08-07
// Updated 2023-11-15 // Updated 2023-11-15
export async function get_ae_obj_li_for_obj_id_crud( export async function get_ae_obj_li_for_obj_id_crud({
{
api_cfg, api_cfg,
obj_type, obj_type,
for_obj_type, for_obj_type,
@@ -26,28 +25,27 @@ export async function get_ae_obj_li_for_obj_id_crud(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
obj_type: string, obj_type: string;
for_obj_type: null|string, for_obj_type: null | string;
for_obj_id?: string, for_obj_id?: string;
use_alt_table?: boolean, use_alt_table?: boolean;
use_alt_base?: boolean, use_alt_base?: boolean;
// inc?: key_val // inc?: key_val
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
order_by_li?: any, order_by_li?: any;
limit?: number, limit?: number;
offset?: number, offset?: number;
// key: string, // key: string,
// jwt?: string, // jwt?: string,
headers?: any, headers?: any;
params_json?: any, params_json?: any;
// json_obj?: any, // json_obj?: any,
params?: key_val, params?: key_val;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** get_ae_obj_li_for_obj_id_crud() *** [${obj_type}]`); console.log(`*** get_ae_obj_li_for_obj_id_crud() *** [${obj_type}]`);
} }
@@ -155,12 +153,12 @@ export async function get_ae_obj_li_for_obj_id_crud(
/* Need to deal with inc params here */ /* Need to deal with inc params here */
let allowed_enabled_list = ['all', 'enabled', 'not_enabled'] const allowed_enabled_list = ['all', 'enabled', 'not_enabled'];
if (allowed_enabled_list.includes(enabled)) { if (allowed_enabled_list.includes(enabled)) {
params['enabled'] = enabled; params['enabled'] = enabled;
} }
let allowed_hidden_list = ['all', 'hidden', 'not_hidden']; const allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
if (allowed_hidden_list.includes(hidden)) { if (allowed_hidden_list.includes(hidden)) {
params['hidden'] = hidden; params['hidden'] = hidden;
} }
@@ -192,7 +190,9 @@ export async function get_ae_obj_li_for_obj_id_crud(
// NOTE: "jp" stands for "JSON Params" // NOTE: "jp" stands for "JSON Params"
params['jp'] = encodeURIComponent(JSON.stringify(params_json)); params['jp'] = encodeURIComponent(JSON.stringify(params_json));
if (params['jp'].length > 2083) { if (params['jp'].length > 2083) {
console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['jp'].length} [THIS DOES NOT EXIST YET]`); console.log(
`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['jp'].length} [THIS DOES NOT EXIST YET]`
);
return false; return false;
} }
} }
@@ -212,7 +212,7 @@ export async function get_ae_obj_li_for_obj_id_crud(
console.log('Params:', params); console.log('Params:', params);
} }
let object_li_get_promise = await get_object({ const object_li_get_promise = await get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
headers: headers, headers: headers,

View File

@@ -1,13 +1,12 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
export let temp_get_blob_percent_completed = 0; export let temp_get_blob_percent_completed = 0;
export let get_blob_percent_completed = temp_get_blob_percent_completed; export const get_blob_percent_completed = temp_get_blob_percent_completed;
export let temp_get_object_percent_completed = 0; export const temp_get_object_percent_completed = 0;
export let get_object_percent_completed = temp_get_object_percent_completed; export const get_object_percent_completed = temp_get_object_percent_completed;
export let get_object = async function get_object( export const get_object = async function get_object({
{
api_cfg = null, api_cfg = null,
endpoint = '', endpoint = '',
headers = {}, headers = {},
@@ -24,22 +23,21 @@ export let get_object = async function get_object(
log_lvl = 0, log_lvl = 0,
retry_count = 5 // Number of retry attempts retry_count = 5 // Number of retry attempts
}: { }: {
api_cfg: any, api_cfg: any;
endpoint: string, endpoint: string;
headers?: any, headers?: any;
params?: any, params?: any;
data?: any, data?: any;
timeout?: number, timeout?: number;
return_meta?: boolean, return_meta?: boolean;
return_blob?: boolean, return_blob?: boolean;
filename?: null | string, filename?: null | string;
auto_download?: boolean, auto_download?: boolean;
as_list?: boolean, as_list?: boolean;
task_id?: string, task_id?: string;
log_lvl?: number, log_lvl?: number;
retry_count?: number retry_count?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`); console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`);
console.log('Params:', params); console.log('Params:', params);
@@ -54,20 +52,23 @@ export let get_object = async function get_object(
} }
const url = new URL(endpoint, api_cfg['base_url']); const url = new URL(endpoint, api_cfg['base_url']);
Object.keys(params).forEach(key => url.searchParams.append(key, params[key])); Object.keys(params).forEach((key) => url.searchParams.append(key, params[key]));
const controller = new AbortController(); const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeout); const timeoutId = setTimeout(() => controller.abort(), timeout);
// Remove a header parameter if it is set to null // Remove a header parameter if it is set to null
if (api_cfg['headers'].hasOwnProperty('x-no-account-id') && api_cfg['headers']['x-no-account-id'] === null) { if (
api_cfg['headers'].hasOwnProperty('x-no-account-id') &&
api_cfg['headers']['x-no-account-id'] === null
) {
delete api_cfg['headers']['x-no-account-id']; delete api_cfg['headers']['x-no-account-id'];
} }
// Clean the headers // Clean the headers
let headers_cleaned: key_val = {}; const headers_cleaned: key_val = {};
for (const prop in headers) { for (const prop in headers) {
let prop_cleaned = prop.replaceAll('_', '-'); const prop_cleaned = prop.replaceAll('_', '-');
if (typeof headers[prop] != 'string') { if (typeof headers[prop] != 'string') {
headers[prop] = JSON.stringify(headers[prop]); headers[prop] = JSON.stringify(headers[prop]);
} }
@@ -104,22 +105,32 @@ export let get_object = async function get_object(
for (let attempt = 1; attempt <= retry_count; attempt++) { for (let attempt = 1; attempt <= retry_count; attempt++) {
try { try {
const response = await fetch_method(url.toString(), fetchOptions) const response = await fetch_method(url.toString(), fetchOptions).catch(function (
.catch(function (error: any) { error: any
console.log('API GET Object *fetch* request was aborted or failed in an unexpected way.', error); ) {
console.log(
'API GET Object *fetch* request was aborted or failed in an unexpected way.',
error
);
}); });
clearTimeout(timeoutId); clearTimeout(timeoutId);
if (!response) { if (!response) {
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('API GET Object: Something went wrong with *fetch* request. Returning false? Throwing an error!'); console.log(
'API GET Object: Something went wrong with *fetch* request. Returning false? Throwing an error!'
);
} }
throw new Error(`HTTP fetch request was aborted or failed in an unexpected way! URL = ${url.toString()}`); // This will allow it to retry throw new Error(
`HTTP fetch request was aborted or failed in an unexpected way! URL = ${url.toString()}`
); // This will allow it to retry
// return false; // This will stop the retries // return false; // This will stop the retries
} }
if (log_lvl) { if (log_lvl) {
console.log(`Response: status=${response.status} statusText=${response.statusText} url=${response.url} attempt=${attempt}`); console.log(
`Response: status=${response.status} statusText=${response.statusText} url=${response.url} attempt=${attempt}`
);
} }
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('Response:', response); console.log('Response:', response);
@@ -159,14 +170,24 @@ export let get_object = async function get_object(
const percent_completed = Math.round((receivedLength * 100) / contentLength); const percent_completed = Math.round((receivedLength * 100) / contentLength);
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('GET Blob Progress:', percent_completed, 'Total:', contentLength, 'Loaded:', receivedLength, 'Percent Completed', percent_completed); console.log(
'GET Blob Progress:',
percent_completed,
'Total:',
contentLength,
'Loaded:',
receivedLength,
'Percent Completed',
percent_completed
);
} }
temp_get_blob_percent_completed = percent_completed; temp_get_blob_percent_completed = percent_completed;
try { try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_blob', type: 'api_download_blob',
status: 'downloading', status: 'downloading',
task_id: task_id, task_id: task_id,
@@ -175,7 +196,9 @@ export let get_object = async function get_object(
size_total: contentLength, size_total: contentLength,
size_loaded: receivedLength, size_loaded: receivedLength,
percent_completed: percent_completed percent_completed: percent_completed
}, '*'); },
'*'
);
} }
} catch (e) { } catch (e) {
console.error('Error posting message:', e); console.error('Error posting message:', e);

View File

@@ -4,15 +4,14 @@ import type { key_val } from '$lib/stores/ae_stores';
export let temp_get_blob_percent_completed = 0; export let temp_get_blob_percent_completed = 0;
// export let get_blob_percent_completed = readable(temp_get_blob_percent_completed); // export let get_blob_percent_completed = readable(temp_get_blob_percent_completed);
export let get_blob_percent_completed = temp_get_blob_percent_completed; export const get_blob_percent_completed = temp_get_blob_percent_completed;
export let temp_get_object_percent_completed = 0; export let temp_get_object_percent_completed = 0;
// export let get_object_percent_completed = readable(temp_get_object_percent_completed); // export let get_object_percent_completed = readable(temp_get_object_percent_completed);
export let get_object_percent_completed = temp_get_object_percent_completed; export const get_object_percent_completed = temp_get_object_percent_completed;
// Updated 2024-05-23 // Updated 2024-05-23
export let get_object = async function get_object( export const get_object = async function get_object({
{
api_cfg = null, api_cfg = null,
endpoint = '', endpoint = '',
headers = {}, headers = {},
@@ -28,21 +27,20 @@ export let get_object = async function get_object(
task_id = crypto.randomUUID(), task_id = crypto.randomUUID(),
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
endpoint: string, endpoint: string;
headers?: any, headers?: any;
params?: any, params?: any;
data?: any, data?: any;
timeout?: number, timeout?: number;
return_meta?: boolean, return_meta?: boolean;
return_blob?: boolean, return_blob?: boolean;
filename?: null|string, filename?: null | string;
auto_download?: boolean, auto_download?: boolean;
as_list?: boolean, as_list?: boolean;
task_id?: string, task_id?: string;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`); console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`);
console.log('Params:', params); console.log('Params:', params);
@@ -52,7 +50,9 @@ export let get_object = async function get_object(
console.log('API Config:', api_cfg); console.log('API Config:', api_cfg);
} }
if (log_lvl > 2) { if (log_lvl > 2) {
console.log(`Return Meta: ${return_meta}; Return Blob: ${return_blob}; Filename: ${filename}; Auto Download: ${auto_download}`); console.log(
`Return Meta: ${return_meta}; Return Blob: ${return_blob}; Filename: ${filename}; Auto Download: ${auto_download}`
);
} }
} }
@@ -61,9 +61,9 @@ export let get_object = async function get_object(
return false; return false;
} }
let axios_api = axios.create({ const axios_api = axios.create({
baseURL: api_cfg['base_url'], baseURL: api_cfg['base_url'],
timeout: timeout, // in milliseconds; 60000 = 60 seconds timeout: timeout // in milliseconds; 60000 = 60 seconds
/* other custom settings */ /* other custom settings */
}); });
axios_api.defaults.headers = api_cfg['headers']; axios_api.defaults.headers = api_cfg['headers'];
@@ -73,10 +73,10 @@ export let get_object = async function get_object(
} }
// console.log('Clean the headers. No _underscores_!') // console.log('Clean the headers. No _underscores_!')
let headers_cleaned: key_val = {}; const headers_cleaned: key_val = {};
for (const prop in headers) { for (const prop in headers) {
// No underscores allowed in the header parameters! // No underscores allowed in the header parameters!
let prop_cleaned = prop.replaceAll('_', '-'); const prop_cleaned = prop.replaceAll('_', '-');
// The value must be a string for the header! // The value must be a string for the header!
if (typeof headers[prop] != 'string') { if (typeof headers[prop] != 'string') {
@@ -108,17 +108,23 @@ export let get_object = async function get_object(
// Handle the case where there is no Blob expected to be returned. Mainly JSON and text data. // Handle the case where there is no Blob expected to be returned. Mainly JSON and text data.
if (!return_blob) { if (!return_blob) {
let response_data_promise = await axios_api.get( const response_data_promise = await axios_api
endpoint, .get(endpoint, {
{
headers: headers, headers: headers,
params: params, params: params,
onDownloadProgress: (progressEvent) => { onDownloadProgress: (progressEvent) => {
let percent_completed = Math.round( const percent_completed = Math.round((progressEvent.loaded * 100) / progressEvent.total);
(progressEvent.loaded * 100) / progressEvent.total
);
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('GET Data Progress:', progressEvent.progress, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed); console.log(
'GET Data Progress:',
progressEvent.progress,
'Total:',
progressEvent.total,
'Loaded:',
progressEvent.loaded,
'Percent Completed',
percent_completed
);
} }
temp_get_object_percent_completed = percent_completed; temp_get_object_percent_completed = percent_completed;
@@ -127,7 +133,8 @@ export let get_object = async function get_object(
try { try {
// Check if window is defined. This is to prevent errors in SvelteKit. // Check if window is defined. This is to prevent errors in SvelteKit.
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_data', type: 'api_download_data',
status: 'downloading', status: 'downloading',
task_id: task_id, task_id: task_id,
@@ -135,7 +142,7 @@ export let get_object = async function get_object(
filename: filename, filename: filename,
size_total: progressEvent.total, size_total: progressEvent.total,
size_loaded: progressEvent.loaded, size_loaded: progressEvent.loaded,
percent_completed: percent_completed, percent_completed: percent_completed
}, },
'*' '*'
); );
@@ -144,11 +151,12 @@ export let get_object = async function get_object(
console.log('Error posting message to window:', error); console.log('Error posting message to window:', error);
} }
} }
} })
)
.then(function (response) { .then(function (response) {
if (log_lvl) { if (log_lvl) {
console.log(`GET Response: status=${response.status} statusText=${response.statusText} baseURL=${response.config.baseURL} url=${response.config.url} method=${response.config.method} headers=${response.config.headers} params=${JSON.stringify(response.config.params)}`); console.log(
`GET Response: status=${response.status} statusText=${response.statusText} baseURL=${response.config.baseURL} url=${response.config.url} method=${response.config.method} headers=${response.config.headers} params=${JSON.stringify(response.config.params)}`
);
} }
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('GET Response:', response); console.log('GET Response:', response);
@@ -157,7 +165,8 @@ export let get_object = async function get_object(
// Post file download message // Post file download message
try { try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_data', type: 'api_download_data',
status: 'complete', status: 'complete',
task_id: task_id, task_id: task_id,
@@ -165,7 +174,7 @@ export let get_object = async function get_object(
filename: filename, filename: filename,
size_total: 0, size_total: 0,
size_loaded: 0, size_loaded: 0,
percent_completed: 100, percent_completed: 100
}, },
'*' '*'
); );
@@ -176,13 +185,15 @@ export let get_object = async function get_object(
if (!Array.isArray(response.data['data']) && as_list) { if (!Array.isArray(response.data['data']) && as_list) {
if (log_lvl) { if (log_lvl) {
console.log('Data result is a dictionary/object, not an array/list. Forcing return as an array/list'); console.log(
'Data result is a dictionary/object, not an array/list. Forcing return as an array/list'
);
} }
let return_data = []; const return_data = [];
return_data.push(response.data['data']); return_data.push(response.data['data']);
return return_data; return return_data;
} else if (response.data['data']) { } else if (response.data['data']) {
let return_data = response.data['data']; const return_data = response.data['data'];
if (log_lvl) { if (log_lvl) {
if (Array.isArray(return_data)) { if (Array.isArray(return_data)) {
console.log(`Data result is an array/list. Array length: ${return_data.length}`); console.log(`Data result is an array/list. Array length: ${return_data.length}`);
@@ -192,12 +203,16 @@ export let get_object = async function get_object(
} }
return return_data; return return_data;
} else { } else {
let return_data = response.data; const return_data = response.data;
if (log_lvl) { if (log_lvl) {
if (Array.isArray(return_data)) { if (Array.isArray(return_data)) {
console.log(`Not a standard response from Aether's API. Data result is an array/list. Array length: ${return_data.length}`); console.log(
`Not a standard response from Aether's API. Data result is an array/list. Array length: ${return_data.length}`
);
} else { } else {
console.log(`Not a standard response from Aether's API. Data result is a dictionary/object, not an array/list.`); console.log(
`Not a standard response from Aether's API. Data result is a dictionary/object, not an array/list.`
);
} }
} }
return return_data; return return_data;
@@ -219,7 +234,8 @@ export let get_object = async function get_object(
// Post file download message // Post file download message
try { try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_data', type: 'api_download_data',
status: 'complete', status: 'complete',
task_id: task_id, task_id: task_id,
@@ -227,7 +243,7 @@ export let get_object = async function get_object(
filename: filename, filename: filename,
size_total: 0, size_total: 0,
size_loaded: 0, size_loaded: 0,
percent_completed: 0, percent_completed: 0
}, },
'*' '*'
); );
@@ -301,26 +317,32 @@ export let get_object = async function get_object(
// Handle the case where a Blob is expected to be returned. // Handle the case where a Blob is expected to be returned.
} else { } else {
// console.log('Expecting a Blob to be returned...'); // console.log('Expecting a Blob to be returned...');
let response_data_promise = await axios_api.get( const response_data_promise = await axios_api
endpoint, .get(endpoint, {
{
params: params, params: params,
responseType: 'blob', responseType: 'blob',
onDownloadProgress: (progressEvent) => { onDownloadProgress: (progressEvent) => {
let percent_completed = Math.round( const percent_completed = Math.round((progressEvent.loaded * 100) / progressEvent.total);
(progressEvent.loaded * 100) / progressEvent.total console.log(
'GET Blob Progress:',
progressEvent.progress,
'Total:',
progressEvent.total,
'Loaded:',
progressEvent.loaded,
'Percent Completed',
percent_completed
); );
console.log('GET Blob Progress:', progressEvent.progress, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed);
temp_get_blob_percent_completed = percent_completed; temp_get_blob_percent_completed = percent_completed;
// WARNING: This needs to be tied to an object type and ID. This is a temporary solution. // WARNING: This needs to be tied to an object type and ID. This is a temporary solution.
try { try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_blob', type: 'api_download_blob',
status: 'downloading', status: 'downloading',
task_id: task_id, task_id: task_id,
@@ -328,7 +350,7 @@ export let get_object = async function get_object(
filename: filename, filename: filename,
size_total: progressEvent.total, size_total: progressEvent.total,
size_loaded: progressEvent.loaded, size_loaded: progressEvent.loaded,
percent_completed: percent_completed, percent_completed: percent_completed
}, },
'*' '*'
); );
@@ -337,11 +359,12 @@ export let get_object = async function get_object(
console.log('Error posting message to window:', error); console.log('Error posting message to window:', error);
} }
} }
} })
)
.then(function (response) { .then(function (response) {
if (log_lvl) { if (log_lvl) {
console.log(`GET (blob) Response: status=${response.status} statusText=${response.statusText} baseURL=${response.config.baseURL} url=${response.config.url} method=${response.config.method} headers=${response.config.headers} params=${response.config.params}`); console.log(
`GET (blob) Response: status=${response.status} statusText=${response.statusText} baseURL=${response.config.baseURL} url=${response.config.url} method=${response.config.method} headers=${response.config.headers} params=${response.config.params}`
);
} }
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('GET (blob) Response:', response); console.log('GET (blob) Response:', response);
@@ -360,7 +383,8 @@ export let get_object = async function get_object(
// WARNING: This needs to be tied to an object type and ID. This is a temporary solution. // WARNING: This needs to be tied to an object type and ID. This is a temporary solution.
try { try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_blob', type: 'api_download_blob',
status: 'complete', status: 'complete',
task_id: task_id, task_id: task_id,
@@ -368,7 +392,7 @@ export let get_object = async function get_object(
filename: filename, filename: filename,
size_total: 0, size_total: 0,
size_loaded: 0, size_loaded: 0,
percent_completed: 100, percent_completed: 100
}, },
'*' '*'
); );
@@ -408,7 +432,8 @@ export let get_object = async function get_object(
// Post file download message // Post file download message
try { try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.postMessage({ window.postMessage(
{
type: 'api_download_blob', type: 'api_download_blob',
status: 'complete', status: 'complete',
task_id: task_id, task_id: task_id,
@@ -416,7 +441,7 @@ export let get_object = async function get_object(
filename: filename, filename: filename,
size_total: 0, size_total: 0,
size_loaded: 0, size_loaded: 0,
percent_completed: 0, percent_completed: 0
}, },
'*' '*'
); );
@@ -484,8 +509,7 @@ export let get_object = async function get_object(
Promise.reject(new Error('fail')).then(resolved, rejected); Promise.reject(new Error('fail')).then(resolved, rejected);
} }
} }
} };
function resolved(result: any) { function resolved(result: any) {
console.log('Resolved'); console.log('Resolved');

View File

@@ -1,8 +1,7 @@
// import axios from 'axios'; // import axios from 'axios';
// Updated 2024-05-23 // Updated 2024-05-23
export let patch_object = async function patch_object( export const patch_object = async function patch_object({
{
api_cfg = null, api_cfg = null,
endpoint = '', endpoint = '',
params = {}, params = {},
@@ -11,15 +10,14 @@ export let patch_object = async function patch_object(
log_lvl = 0, log_lvl = 0,
retry_count = 5 // Number of retry attempts retry_count = 5 // Number of retry attempts
}: { }: {
api_cfg: any, api_cfg: any;
endpoint: string, endpoint: string;
params?: any, params?: any;
data?: any, data?: any;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number, log_lvl?: number;
retry_count?: number retry_count?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** patch_object() *** Endpoint: ${endpoint}`); console.log(`*** patch_object() *** Endpoint: ${endpoint}`);
console.log('Params:', params); console.log('Params:', params);
@@ -35,12 +33,12 @@ export let patch_object = async function patch_object(
// Construct the URL with query parameters // Construct the URL with query parameters
const url = new URL(endpoint, api_cfg['base_url']); const url = new URL(endpoint, api_cfg['base_url']);
Object.keys(params).forEach(key => url.searchParams.append(key, params[key])); Object.keys(params).forEach((key) => url.searchParams.append(key, params[key]));
// Clean the headers // Clean the headers
let headers_cleaned: Record<string, string> = {}; const headers_cleaned: Record<string, string> = {};
for (const prop in api_cfg['headers']) { for (const prop in api_cfg['headers']) {
let prop_cleaned = prop.replaceAll('_', '-'); const prop_cleaned = prop.replaceAll('_', '-');
headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; headers_cleaned[prop_cleaned] = api_cfg['headers'][prop];
} }
@@ -101,8 +99,6 @@ export let patch_object = async function patch_object(
} }
} }
// let axios_api = axios.create({ // let axios_api = axios.create({
// baseURL: api_cfg['base_url'], // baseURL: api_cfg['base_url'],
// /* other custom settings */ // /* other custom settings */
@@ -145,5 +141,4 @@ export let patch_object = async function patch_object(
// } // }
// } // }
// return response_data; // return response_data;
} };

View File

@@ -1,13 +1,12 @@
// import axios from 'axios'; // import axios from 'axios';
export let temp_post_blob_percent_completed = 0; export const temp_post_blob_percent_completed = 0;
export let post_blob_percent_completed = temp_post_blob_percent_completed; export const post_blob_percent_completed = temp_post_blob_percent_completed;
export let temp_post_object_percent_completed = 0; export const temp_post_object_percent_completed = 0;
export let post_object_percent_completed = temp_post_object_percent_completed; export const post_object_percent_completed = temp_post_object_percent_completed;
// Updated 2024-05-23 // Updated 2024-05-23
export let post_object = async function post_object( export const post_object = async function post_object({
{
api_cfg = null, api_cfg = null,
endpoint = '', endpoint = '',
params = {}, params = {},
@@ -22,21 +21,19 @@ export let post_object = async function post_object(
log_lvl = 0, log_lvl = 0,
retry_count = 5 retry_count = 5
}: { }: {
api_cfg: any, api_cfg: any;
endpoint: string, endpoint: string;
params?: any, params?: any;
data?: any, data?: any;
form_data?: any, form_data?: any;
return_meta?: boolean, return_meta?: boolean;
return_blob?: boolean, return_blob?: boolean;
filename?: string, filename?: string;
auto_download?: boolean, auto_download?: boolean;
task_id?: string, task_id?: string;
log_lvl?: number, log_lvl?: number;
retry_count?: number retry_count?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** post_object() *** Endpoint: ${endpoint} Task ID: ${task_id}`); console.log(`*** post_object() *** Endpoint: ${endpoint} Task ID: ${task_id}`);
console.log('Params:', params); console.log('Params:', params);
@@ -66,15 +63,15 @@ export let post_object = async function post_object(
// Construct the URL with query parameters // Construct the URL with query parameters
const url = new URL(endpoint, api_cfg['base_url']); const url = new URL(endpoint, api_cfg['base_url']);
if (params) { if (params) {
Object.keys(params).forEach(key => url.searchParams.append(key, params[key])); Object.keys(params).forEach((key) => url.searchParams.append(key, params[key]));
} }
// console.log('HERE!! API POST 2'); // console.log('HERE!! API POST 2');
// Clean the headers // Clean the headers
let headers_cleaned: Record<string, string> = {}; const headers_cleaned: Record<string, string> = {};
for (const prop in api_cfg['headers']) { for (const prop in api_cfg['headers']) {
let prop_cleaned = prop.replaceAll('_', '-'); const prop_cleaned = prop.replaceAll('_', '-');
headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; headers_cleaned[prop_cleaned] = api_cfg['headers'][prop];
} }
@@ -133,7 +130,8 @@ export let post_object = async function post_object(
// Post a message to the window indicating the upload is complete // Post a message to the window indicating the upload is complete
try { try {
window.postMessage({ window.postMessage(
{
type: 'api_post_json_form', type: 'api_post_json_form',
status: 'complete', status: 'complete',
task_id: task_id, task_id: task_id,
@@ -143,7 +141,9 @@ export let post_object = async function post_object(
percent_completed: 100, percent_completed: 100,
progress: 100, progress: 100,
rate: 0 rate: 0
}, '*'); },
'*'
);
} catch (error) { } catch (error) {
console.error('Error posting message to window:', error); console.error('Error posting message to window:', error);
} }
@@ -182,8 +182,6 @@ export let post_object = async function post_object(
} }
} }
// let axios_api = axios.create({ // let axios_api = axios.create({
// baseURL: api_cfg['base_url'], // baseURL: api_cfg['base_url'],
// /* other custom settings */ // /* other custom settings */
@@ -200,7 +198,6 @@ export let post_object = async function post_object(
// axios_api.defaults.headers['content-type'] = 'application/json'; // axios_api.defaults.headers['content-type'] = 'application/json';
// } // }
// if (!return_blob) { // if (!return_blob) {
// let response_data = await axios_api.post( // let response_data = await axios_api.post(
// endpoint, // endpoint,
@@ -343,8 +340,7 @@ export let post_object = async function post_object(
// Promise.reject(new Error('fail')).then(resolved, rejected); // Promise.reject(new Error('fail')).then(resolved, rejected);
// } // }
// } // }
} };
// function resolved(result: any) { // function resolved(result: any) {
// console.log('Resolved'); // console.log('Resolved');

View File

@@ -1,17 +1,15 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_archives } from "$lib/ae_archives/db_archives"; import { db_archives } from '$lib/ae_archives/db_archives';
import { load_ae_obj_li__archive_content } from "$lib/ae_archives/ae_archives__archive_content"; import { load_ae_obj_li__archive_content } from '$lib/ae_archives/ae_archives__archive_content';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2024-09-25 // Updated 2024-09-25
export async function load_ae_obj_id__archive( export async function load_ae_obj_id__archive({
{
api_cfg, api_cfg,
archive_id, archive_id,
inc_content_li = false, inc_content_li = false,
@@ -23,23 +21,23 @@ export async function load_ae_obj_id__archive(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_id: string, archive_id: string;
inc_content_li?: boolean, inc_content_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`); console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`);
} }
ae_promises.load__archive_obj = await api.get_ae_obj_id_crud({ ae_promises.load__archive_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive', obj_type: 'archive',
obj_id: archive_id, obj_id: archive_id,
@@ -52,9 +50,9 @@ export async function load_ae_obj_id__archive(
if (archive_obj_get_result) { if (archive_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_props({ const processed_obj_li = await process_ae_obj__archive_props({
obj_li: [archive_obj_get_result], obj_li: [archive_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -68,7 +66,7 @@ export async function load_ae_obj_id__archive(
table_name: 'archive', table_name: 'archive',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -99,7 +97,7 @@ export async function load_ae_obj_id__archive(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the content list for the archive now`); console.log(`Need to load the content list for the archive now`);
} }
let load_archive_content_obj_li = load_ae_obj_li__archive_content({ const load_archive_content_obj_li = load_ae_obj_li__archive_content({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'archive', for_obj_type: 'archive',
for_obj_id: archive_id, for_obj_id: archive_id,
@@ -110,8 +108,7 @@ export async function load_ae_obj_id__archive(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((archive_content_obj_li) => {
.then((archive_content_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`archive_content_obj_li = `, archive_content_obj_li); console.log(`archive_content_obj_li = `, archive_content_obj_li);
} }
@@ -127,10 +124,8 @@ export async function load_ae_obj_id__archive(
return ae_promises.load__archive_obj; return ae_promises.load__archive_obj;
} }
// Updated 2024-11-20 // Updated 2024-11-20
export async function load_ae_obj_li__archive( export async function load_ae_obj_li__archive({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -139,34 +134,42 @@ export async function load_ae_obj_li__archive(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_content_li?: boolean, inc_content_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__archive_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive', obj_type: 'archive',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -187,9 +190,9 @@ export async function load_ae_obj_li__archive(
if (archive_obj_li_get_result) { if (archive_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_props({ const processed_obj_li = await process_ae_obj__archive_props({
obj_li: archive_obj_li_get_result, obj_li: archive_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -203,7 +206,7 @@ export async function load_ae_obj_li__archive(
table_name: 'archive', table_name: 'archive',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -230,10 +233,10 @@ export async function load_ae_obj_li__archive(
console.log(`Need to load the content list for each archive now`); console.log(`Need to load the content list for each archive now`);
} }
for (let i = 0; i < ae_promises.load__archive_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__archive_obj_li.length; i++) {
let archive_obj = ae_promises.load__archive_obj_li[i]; const archive_obj = ae_promises.load__archive_obj_li[i];
let archive_id = archive_obj.archive_id_random; const archive_id = archive_obj.archive_id_random;
let load_archive_content_obj_li = load_ae_obj_li__archive_content({ const load_archive_content_obj_li = load_ae_obj_li__archive_content({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'archive', for_obj_type: 'archive',
for_obj_id: archive_id, for_obj_id: archive_id,
@@ -244,8 +247,7 @@ export async function load_ae_obj_li__archive(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((archive_content_obj_li) => {
.then((archive_content_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`archive_content_obj_li = `, archive_content_obj_li); console.log(`archive_content_obj_li = `, archive_content_obj_li);
} }
@@ -266,10 +268,8 @@ export async function load_ae_obj_li__archive(
return ae_promises.load__archive_obj_li; return ae_promises.load__archive_obj_li;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function create_ae_obj__archive( export async function create_ae_obj__archive({
{
api_cfg, api_cfg,
account_id, account_id,
data_kv, data_kv,
@@ -277,14 +277,13 @@ export async function create_ae_obj__archive(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__archive() *** account_id=${account_id}`); console.log(`*** create_ae_obj__archive() *** account_id=${account_id}`);
} }
@@ -294,7 +293,8 @@ export async function create_ae_obj__archive(
return false; return false;
} }
ae_promises.create__archive = await api.create_ae_obj_crud({ ae_promises.create__archive = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive', obj_type: 'archive',
fields: { fields: {
@@ -310,9 +310,9 @@ export async function create_ae_obj__archive(
if (archive_obj_create_result) { if (archive_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_props({ const processed_obj_li = await process_ae_obj__archive_props({
obj_li: [archive_obj_create_result], obj_li: [archive_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -326,7 +326,7 @@ export async function create_ae_obj__archive(
table_name: 'archive', table_name: 'archive',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -353,10 +353,8 @@ export async function create_ae_obj__archive(
return ae_promises.create__archive; return ae_promises.create__archive;
} }
// Updated 2024-11-08 // Updated 2024-11-08
export async function delete_ae_obj_id__archive( export async function delete_ae_obj_id__archive({
{
api_cfg, api_cfg,
archive_id, archive_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -364,19 +362,19 @@ export async function delete_ae_obj_id__archive(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_id: string, archive_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__archive() *** archive_id=${archive_id}`); console.log(`*** delete_ae_obj_id__archive() *** archive_id=${archive_id}`);
} }
ae_promises.delete__archive_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__archive_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive', obj_type: 'archive',
obj_id: archive_id, obj_id: archive_id,
@@ -404,10 +402,8 @@ export async function delete_ae_obj_id__archive(
return ae_promises.delete__archive_obj; return ae_promises.delete__archive_obj;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function update_ae_obj__archive( export async function update_ae_obj__archive({
{
api_cfg, api_cfg,
archive_id, archive_id,
data_kv, data_kv,
@@ -415,14 +411,13 @@ export async function update_ae_obj__archive(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_id: string, archive_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__archive() *** archive_id=${archive_id}`, data_kv); console.log(`*** update_ae_obj__archive() *** archive_id=${archive_id}`, data_kv);
} }
@@ -443,9 +438,9 @@ export async function update_ae_obj__archive(
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_props({ const processed_obj_li = await process_ae_obj__archive_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -459,7 +454,7 @@ export async function update_ae_obj__archive(
table_name: 'archive', table_name: 'archive',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -478,11 +473,9 @@ export async function update_ae_obj__archive(
} }
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2024-09-25 // Updated 2024-09-25
export async function qry__archive( export async function qry__archive({
{
api_cfg, api_cfg,
archive_id, archive_id,
qry_str, qry_str,
@@ -496,20 +489,19 @@ export async function qry__archive(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_id: any, archive_id: any;
qry_str?: string, qry_str?: string;
qry_files?: null|boolean, qry_files?: null | boolean;
qry_start_datetime?: null|string, // Greater than this datetime qry_start_datetime?: null | string; // Greater than this datetime
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** qry__archive() *** archive_id=${archive_id} qry_str=${qry_str}`); console.log(`*** qry__archive() *** archive_id=${archive_id} qry_str=${qry_str}`);
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -517,7 +509,7 @@ export async function qry__archive(
// let limit: number = (params.qry__limit ?? 25); // 99 // let limit: number = (params.qry__limit ?? 25); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (qry_str && qry_str.length > 2) { // if (qry_str && qry_str.length > 2) {
// params_json['ft_qry'] = {}; // params_json['ft_qry'] = {};
@@ -527,39 +519,44 @@ export async function qry__archive(
params_json['qry'] = []; params_json['qry'] = [];
if (qry_files === true) { if (qry_files === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: '>',
operator: ">",
value: 0 value: 0
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} else if (qry_files === false) { } else if (qry_files === false) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: 'IS',
operator: "IS",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_start_datetime) { if (qry_start_datetime) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'start_datetime',
field: "start_datetime", operator: '>',
operator: ">",
value: qry_start_datetime value: qry_start_datetime
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; const order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
};
ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__archive_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive', obj_type: 'archive',
for_obj_type: 'event', for_obj_type: 'event',
@@ -580,9 +577,9 @@ export async function qry__archive(
if (archive_obj_li_get_result) { if (archive_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_props({ const processed_obj_li = await process_ae_obj__archive_props({
obj_li: archive_obj_li_get_result, obj_li: archive_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -596,7 +593,7 @@ export async function qry__archive(
table_name: 'archive', table_name: 'archive',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -614,7 +611,6 @@ export async function qry__archive(
return ae_promises.load__archive_obj_li; return ae_promises.load__archive_obj_li;
} }
// // Updated 2024-09-25 // // Updated 2024-09-25
// export async function search__archive( // export async function search__archive(
// { // {
@@ -751,10 +747,6 @@ export async function qry__archive(
// return ae_promises.load__archive_obj_li; // return ae_promises.load__archive_obj_li;
// } // }
// Updated 2025-06-04 // Updated 2025-06-04
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -792,7 +784,7 @@ export const properties_to_save = [
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
// 'tmp_sort_a', // 'tmp_sort_a',
// 'tmp_sort_b', // 'tmp_sort_b',
@@ -804,7 +796,6 @@ export const properties_to_save = [
// 'archive_content_li', // 'archive_content_li',
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -873,7 +864,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-06-04 // Updated 2025-06-04
export async function process_ae_obj__archive_props({ export async function process_ae_obj__archive_props({
obj_li, obj_li,

View File

@@ -1,18 +1,15 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_archives } from "$lib/ae_archives/db_archives"; import { db_archives } from '$lib/ae_archives/db_archives';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// TESTING NOTE: I changed these to all use async and await. Not sure if this helps or hurts things. Mainly this is related to the Dexie DB changes. 2024-11-08 // TESTING NOTE: I changed these to all use async and await. Not sure if this helps or hurts things. Mainly this is related to the Dexie DB changes. 2024-11-08
// Updated 2024-09-25 // Updated 2024-09-25
export async function load_ae_obj_id__archive_content( export async function load_ae_obj_id__archive_content({
{
api_cfg, api_cfg,
archive_content_id, archive_content_id,
// enabled = 'enabled', // enabled = 'enabled',
@@ -23,22 +20,24 @@ export async function load_ae_obj_id__archive_content(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_content_id: string, archive_content_id: string;
// enabled?: "enabled" | "all" | "not_enabled" | undefined, // enabled?: "enabled" | "all" | "not_enabled" | undefined,
// hidden?: "hidden" | "all" | "not_hidden" | undefined, // hidden?: "hidden" | "all" | "not_hidden" | undefined,
// limit?: number, // limit?: number,
// offset?: number, // offset?: number,
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`); console.log(
`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`
);
} }
ae_promises.load__archive_content_obj = await api.get_ae_obj_id_crud({ ae_promises.load__archive_content_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive_content', obj_type: 'archive_content',
obj_id: archive_content_id, obj_id: archive_content_id,
@@ -51,9 +50,9 @@ export async function load_ae_obj_id__archive_content(
if (archive_content_obj_get_result) { if (archive_content_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_content_props({ const processed_obj_li = await process_ae_obj__archive_content_props({
obj_li: [archive_content_obj_get_result], obj_li: [archive_content_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -67,7 +66,7 @@ export async function load_ae_obj_id__archive_content(
table_name: 'content', table_name: 'content',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -93,10 +92,8 @@ export async function load_ae_obj_id__archive_content(
return ae_promises.load__archive_content_obj; return ae_promises.load__archive_content_obj;
} }
// Updated 2024-11-20 // Updated 2024-11-20
export async function load_ae_obj_li__archive_content( export async function load_ae_obj_li__archive_content({
{
api_cfg, api_cfg,
for_obj_type = 'archive', for_obj_type = 'archive',
for_obj_id, for_obj_id,
@@ -104,33 +101,42 @@ export async function load_ae_obj_li__archive_content(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'original_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
original_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console('params_json:', params_json); // console('params_json:', params_json);
ae_promises.load__archive_content_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__archive_content_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive_content', obj_type: 'archive_content',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -151,9 +157,9 @@ export async function load_ae_obj_li__archive_content(
if (archive_content_obj_li_get_result) { if (archive_content_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_content_props({ const processed_obj_li = await process_ae_obj__archive_content_props({
obj_li: archive_content_obj_li_get_result, obj_li: archive_content_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -167,7 +173,7 @@ export async function load_ae_obj_li__archive_content(
table_name: 'content', table_name: 'content',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -187,16 +193,17 @@ export async function load_ae_obj_li__archive_content(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__archive_content_obj_li:', ae_promises.load__archive_content_obj_li); console.log(
'ae_promises.load__archive_content_obj_li:',
ae_promises.load__archive_content_obj_li
);
} }
return ae_promises.load__archive_content_obj_li; return ae_promises.load__archive_content_obj_li;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function create_ae_obj__archive_content( export async function create_ae_obj__archive_content({
{
api_cfg, api_cfg,
archive_id, archive_id,
data_kv, data_kv,
@@ -204,14 +211,13 @@ export async function create_ae_obj__archive_content(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_id: string, archive_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`); console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`);
} }
@@ -221,7 +227,8 @@ export async function create_ae_obj__archive_content(
return false; return false;
} }
ae_promises.create__archive_content = await api.create_ae_obj_crud({ ae_promises.create__archive_content = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive_content', obj_type: 'archive_content',
fields: { fields: {
@@ -237,9 +244,9 @@ export async function create_ae_obj__archive_content(
if (archive_content_obj_create_result) { if (archive_content_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_content_props({ const processed_obj_li = await process_ae_obj__archive_content_props({
obj_li: [archive_content_obj_create_result], obj_li: [archive_content_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -253,7 +260,7 @@ export async function create_ae_obj__archive_content(
table_name: 'content', table_name: 'content',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -280,10 +287,8 @@ export async function create_ae_obj__archive_content(
return ae_promises.create__archive_content; return ae_promises.create__archive_content;
} }
// Updated 2024-11-08 // Updated 2024-11-08
export async function delete_ae_obj_id__archive_content( export async function delete_ae_obj_id__archive_content({
{
api_cfg, api_cfg,
archive_content_id, archive_content_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -291,19 +296,21 @@ export async function delete_ae_obj_id__archive_content(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_content_id: string, archive_content_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`); console.log(
`*** delete_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`
);
} }
ae_promises.delete__archive_content_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__archive_content_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'archive_content', obj_type: 'archive_content',
obj_id: archive_content_id, obj_id: archive_content_id,
@@ -318,23 +325,26 @@ export async function delete_ae_obj_id__archive_content(
.finally(function () { .finally(function () {
if (try_cache) { if (try_cache) {
if (log_lvl) { if (log_lvl) {
console.log(`Attempting to remove IDB entry for archive_content_id=${archive_content_id}`); console.log(
`Attempting to remove IDB entry for archive_content_id=${archive_content_id}`
);
} }
db_archives.content.delete(archive_content_id); // Delete from the DB no matter what. db_archives.content.delete(archive_content_id); // Delete from the DB no matter what.
} }
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.delete__archive_content_obj:', ae_promises.delete__archive_content_obj); console.log(
'ae_promises.delete__archive_content_obj:',
ae_promises.delete__archive_content_obj
);
} }
return ae_promises.delete__archive_content_obj; return ae_promises.delete__archive_content_obj;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function update_ae_obj__archive_content( export async function update_ae_obj__archive_content({
{
api_cfg, api_cfg,
archive_content_id, archive_content_id,
data_kv, data_kv,
@@ -342,16 +352,18 @@ export async function update_ae_obj__archive_content(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
archive_content_id: string, archive_content_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__archive_content() *** archive_content_id=${archive_content_id}`, data_kv); console.log(
`*** update_ae_obj__archive_content() *** archive_content_id=${archive_content_id}`,
data_kv
);
} }
// Perform the API update // Perform the API update
@@ -363,16 +375,16 @@ export async function update_ae_obj__archive_content(
key: api_cfg.api_crud_super_key, key: api_cfg.api_crud_super_key,
params: params, params: params,
return_obj: true, return_obj: true,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
// Handle the result // Handle the result
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__archive_content_props({ const processed_obj_li = await process_ae_obj__archive_content_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -386,7 +398,7 @@ export async function update_ae_obj__archive_content(
table_name: 'content', table_name: 'content',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -405,10 +417,6 @@ export async function update_ae_obj__archive_content(
} }
} }
// Updated 2025-06-04 // Updated 2025-06-04
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -469,7 +477,6 @@ export const properties_to_save = [
'hash_sha256' 'hash_sha256'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -538,7 +545,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-06-04 // Updated 2025-06-04
export async function process_ae_obj__archive_content_props({ export async function process_ae_obj__archive_content_props({
obj_li, obj_li,
@@ -557,9 +563,11 @@ export async function process_ae_obj__archive_content_props({
obj.sort?.toString().padStart(3, '0') ?? '' obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.original_datetime ?? ''}`; }_${obj.original_datetime ?? ''}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.original_datetime ?? ''}_${ obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.original_datetime ?? ''}_${
obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}`; obj.priority ? '1' : '0'
}_${obj.sort?.toString().padStart(3, '0') ?? ''}`;
obj.tmp_sort_3 = `${obj.original_datetime ?? ''}_${obj.group ?? ''}_${ obj.tmp_sort_3 = `${obj.original_datetime ?? ''}_${obj.group ?? ''}_${
obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}`; obj.priority ? '1' : '0'
}_${obj.sort?.toString().padStart(3, '0') ?? ''}`;
obj.hash_sha256 = obj.hosted_file_hash_sha256; obj.hash_sha256 = obj.hosted_file_hash_sha256;

View File

@@ -5,34 +5,28 @@ import {
load_ae_obj_li__archive, load_ae_obj_li__archive,
create_ae_obj__archive, create_ae_obj__archive,
delete_ae_obj_id__archive, delete_ae_obj_id__archive,
update_ae_obj__archive, update_ae_obj__archive
} from '$lib/ae_archives/ae_archives__archive';
} from "$lib/ae_archives/ae_archives__archive";
import { import {
load_ae_obj_id__archive_content, load_ae_obj_id__archive_content,
load_ae_obj_li__archive_content, load_ae_obj_li__archive_content,
create_ae_obj__archive_content, create_ae_obj__archive_content,
delete_ae_obj_id__archive_content, delete_ae_obj_id__archive_content,
update_ae_obj__archive_content, update_ae_obj__archive_content
} from '$lib/ae_archives/ae_archives__archive_content';
} from "$lib/ae_archives/ae_archives__archive_content"; const export_obj = {
let export_obj = {
load_ae_obj_id__archive: load_ae_obj_id__archive, load_ae_obj_id__archive: load_ae_obj_id__archive,
load_ae_obj_li__archive: load_ae_obj_li__archive, load_ae_obj_li__archive: load_ae_obj_li__archive,
create_ae_obj__archive: create_ae_obj__archive, create_ae_obj__archive: create_ae_obj__archive,
delete_ae_obj_id__archive: delete_ae_obj_id__archive, delete_ae_obj_id__archive: delete_ae_obj_id__archive,
update_ae_obj__archive: update_ae_obj__archive, update_ae_obj__archive: update_ae_obj__archive,
load_ae_obj_id__archive_content: load_ae_obj_id__archive_content, load_ae_obj_id__archive_content: load_ae_obj_id__archive_content,
load_ae_obj_li__archive_content: load_ae_obj_li__archive_content, load_ae_obj_li__archive_content: load_ae_obj_li__archive_content,
create_ae_obj__archive_content: create_ae_obj__archive_content, create_ae_obj__archive_content: create_ae_obj__archive_content,
delete_ae_obj_id__archive_content: delete_ae_obj_id__archive_content, delete_ae_obj_id__archive_content: delete_ae_obj_id__archive_content,
update_ae_obj__archive_content: update_ae_obj__archive_content, update_ae_obj__archive_content: update_ae_obj__archive_content
}; };
export let archives_func = export_obj; export const archives_func = export_obj;

View File

@@ -46,7 +46,7 @@ export interface Archive {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -108,7 +108,7 @@ export interface Archive_Content {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -126,7 +126,6 @@ export interface Archive_Content {
hash_sha256?: null | string; hash_sha256?: null | string;
} }
// Updated 2024-09-25 // Updated 2024-09-25
export class MySubClassedDexie extends Dexie { export class MySubClassedDexie extends Dexie {
// We just tell the typing system this is the case // We just tell the typing system this is the case
@@ -153,7 +152,7 @@ export class MySubClassedDexie extends Dexie {
original_datetime, original_timezone, original_location, original_datetime, original_timezone, original_location,
[group+original_datetime], [group+original_datetime],
tmp_sort_1, tmp_sort_2, tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]`, enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]`
}); });
// file_path, // file_path,

View File

@@ -10,19 +10,24 @@ import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/stores/ae_stores'; import {
ae_snip,
ae_loc,
ae_sess,
ae_api,
ae_trig,
slct,
slct_trigger
} from '$lib/stores/ae_stores';
// Exports // Exports
// export let input_name = 'file_list'; // export let input_name = 'file_list';
// export let multiple: boolean = true; // export let multiple: boolean = true;
// export let required: boolean = true; // export let required: boolean = true;
// export let input_class_li: string[] = ['file_drop_area']; // export let input_class_li: string[] = ['file_drop_area'];
interface Props { interface Props {
log_lvl?: number; log_lvl?: number;
// Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc // Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc
@@ -55,7 +60,6 @@ let {
video_clip_file_kv = $bindable({}) video_clip_file_kv = $bindable({})
}: Props = $props(); }: Props = $props();
// Local Variables // Local Variables
let task_id = link_to_id; let task_id = link_to_id;
// let input_file_list: any = null; // let input_file_list: any = null;
@@ -75,10 +79,9 @@ let ae_promises: key_val = $state({});
// let download_clip_filename: string; // let download_clip_filename: string;
$ae_sess.files.obj = { $ae_sess.files.obj = {
obj: null, obj: null
}; };
// *** Functions and Logic // *** Functions and Logic
function handle_clip_video(event) { function handle_clip_video(event) {
console.log('*** handle_clip_video() ***'); console.log('*** handle_clip_video() ***');
@@ -113,12 +116,13 @@ function handle_clip_video(event) {
start_time: event.target.start_time.value, start_time: event.target.start_time.value,
end_time: event.target.end_time.value, end_time: event.target.end_time.value,
reencode: event.target.reencode.value, reencode: event.target.reencode.value,
scale_down: event.target.scale_down.value, scale_down: event.target.scale_down.value
}; };
ae_promises[hosted_file_id] = {}; ae_promises[hosted_file_id] = {};
// .convert__hosted_file_obj // .convert__hosted_file_obj
ae_promises[hosted_file_id] = api.get_object({ ae_promises[hosted_file_id] = api
.get_object({
api_cfg: $ae_api, api_cfg: $ae_api,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -156,21 +160,14 @@ function handle_clip_video(event) {
return true; return true;
}); });
} }
</script> </script>
<section class="{class_li_default} {class_li}">
<section
class="{class_li_default} {class_li}"
>
<!-- <h3 class="h3">{hosted_file_obj_li.length}&times; files uploaded</h3> <!-- <h3 class="h3">{hosted_file_obj_li.length}&times; files uploaded</h3>
{#each hosted_file_obj_li as hosted_file_obj, i} --> {#each hosted_file_obj_li as hosted_file_obj, i} -->
<h3 <h3 class="h3">
class="h3"
>
{Object.entries(hosted_file_obj_kv).length}× files uploaded {Object.entries(hosted_file_obj_kv).length}× files uploaded
</h3> </h3>
@@ -186,14 +183,20 @@ function handle_clip_video(event) {
type="button" type="button"
onclick={() => { onclick={() => {
// This (uploaded_file_kv) is referenced by other AE components. Currently it is only used with the manage hosted file list and clip video components. // This (uploaded_file_kv) is referenced by other AE components. Currently it is only used with the manage hosted file list and clip video components.
console.log(`Removed hosted file ID: ${hosted_file_id}`, $ae_loc.files.uploaded_file_kv); console.log(
`Removed hosted file ID: ${hosted_file_id}`,
$ae_loc.files.uploaded_file_kv
);
// delete $ae_sess.files.uploaded_file_kv[hosted_file_id]; // delete $ae_sess.files.uploaded_file_kv[hosted_file_id];
delete $ae_loc.files.uploaded_file_kv[hosted_file_id]; delete $ae_loc.files.uploaded_file_kv[hosted_file_id];
$ae_loc.files.uploaded_file_kv = { ...$ae_loc.files.uploaded_file_kv }; $ae_loc.files.uploaded_file_kv = { ...$ae_loc.files.uploaded_file_kv };
delete hosted_file_obj_kv[hosted_file_id]; delete hosted_file_obj_kv[hosted_file_id];
hosted_file_obj_kv = { ...hosted_file_obj_kv }; hosted_file_obj_kv = { ...hosted_file_obj_kv };
// delete $ae_loc.files.uploaded_file_kv[hosted_file_obj.hosted_file_id]; // delete $ae_loc.files.uploaded_file_kv[hosted_file_obj.hosted_file_id];
console.log(`Removed hosted file ID: ${hosted_file_obj.hosted_file_id}`, $ae_loc.files.uploaded_file_kv); console.log(
`Removed hosted file ID: ${hosted_file_obj.hosted_file_id}`,
$ae_loc.files.uploaded_file_kv
);
}} }}
class="btn btn-sm preset-tonal-warning hover:preset-filled-warning-500" class="btn btn-sm preset-tonal-warning hover:preset-filled-warning-500"
title={`Remove this file from list of videos:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`} title={`Remove this file from list of videos:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`}
@@ -236,65 +239,85 @@ function handle_clip_video(event) {
</span> </span>
{/if} {/if}
{:then} {:then}
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.file_extension)}"></span> <span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.file_extension)}"
></span>
{/await} {/await}
<span class="grow"> <span class="grow">
{ae_util.shorten_filename({ filename: hosted_file_obj?.filename, max_length: 30 })} {ae_util.shorten_filename({ filename: hosted_file_obj?.filename, max_length: 30 })}
</span> </span>
</button> </button>
<span>{ae_util.shorten_filename({filename: hosted_file_obj?.filename, max_length: 30})}</span> <span
>{ae_util.shorten_filename({ filename: hosted_file_obj?.filename, max_length: 30 })}</span
>
<span> <span>
<span class="text-sm font-bold"> <span class="text-sm font-bold"> File ID: </span>
File ID: {hosted_file_obj.hosted_file_id_random}</span
</span> >
{hosted_file_obj.hosted_file_id_random}</span>
<span> <span>
<span class="text-sm font-bold"> <span class="text-sm font-bold"> Type: </span>
Type: {hosted_file_obj.extension}</span
</span> >
{hosted_file_obj.extension}</span>
<!-- <span>{hosted_file_obj.filename}</span> --> <!-- <span>{hosted_file_obj.filename}</span> -->
</div> </div>
<form <form onsubmit={preventDefault(handle_clip_video)} class="{class_li_default} {class_li}">
onsubmit={preventDefault(handle_clip_video)}
class="{class_li_default} {class_li}"
>
<!-- {$ae_sess?.files[hosted_file_obj?.hosted_file_id_random ?? 'obj'].submit_status ?? 'not set'} --> <!-- {$ae_sess?.files[hosted_file_obj?.hosted_file_id_random ?? 'obj'].submit_status ?? 'not set'} -->
<input type="hidden" name="hosted_file_id" value="{hosted_file_obj.hosted_file_id_random}" /> <input type="hidden" name="hosted_file_id" value={hosted_file_obj.hosted_file_id_random} />
<div class="flex flex-row gap-1 justify-center items-center w-full"> <div class="flex flex-row gap-1 justify-center items-center w-full">
<span class="text-xs font-bold w-32">New Filename:</span> <span class="text-xs font-bold w-32">New Filename:</span>
<input type="text" class="input w-full text-sm" name="new_filename" value={hosted_file_obj.filename} /> <input
type="text"
class="input w-full text-sm"
name="new_filename"
value={hosted_file_obj.filename}
/>
</div> </div>
<div class="max-w-(--breakpoint-sm) flex flex-row gap-1 justify-center items-center w-full"> <div class="max-w-(--breakpoint-sm) flex flex-row gap-1 justify-center items-center w-full">
<label class="label w-48" <label
class="label w-48"
title="The start time of the clip. This is the time in the video where the clip will start. You may need to subtract a few seconds to get the exact start time." title="The start time of the clip. This is the time in the video where the clip will start. You may need to subtract a few seconds to get the exact start time."
> >
<span class="text-xs font-bold">Start time (HH:MM:SS)</span> <span class="text-xs font-bold">Start time (HH:MM:SS)</span>
<input type="text" name="start_time" <input
value={($ae_loc.files.processed_file_kv && $ae_loc.files.processed_file_kv[hosted_file_id] && $ae_loc.files.processed_file_kv[hosted_file_id].start_time) ? $ae_loc.files.processed_file_kv[hosted_file_id].start_time : '00:00:00'} type="text"
placeholder="HH:MM:SS (00:01:30)" class="input w-32" /> name="start_time"
value={$ae_loc.files.processed_file_kv &&
$ae_loc.files.processed_file_kv[hosted_file_id] &&
$ae_loc.files.processed_file_kv[hosted_file_id].start_time
? $ae_loc.files.processed_file_kv[hosted_file_id].start_time
: '00:00:00'}
placeholder="HH:MM:SS (00:01:30)"
class="input w-32"
/>
</label> </label>
<label class="label w-48" <label
class="label w-48"
title="The end time of the clip. This is the time in the video where the clip will end. You may need to add a few seconds to get the exact end time." title="The end time of the clip. This is the time in the video where the clip will end. You may need to add a few seconds to get the exact end time."
> >
<span class="text-xs font-bold">End time (HH:MM:SS)</span> <span class="text-xs font-bold">End time (HH:MM:SS)</span>
<input type="text" name="end_time" <input
value={($ae_loc.files.processed_file_kv && $ae_loc.files.processed_file_kv[hosted_file_id] && $ae_loc.files.processed_file_kv[hosted_file_id].end_time) ? $ae_loc.files.processed_file_kv[hosted_file_id].end_time : '00:45:59'} type="text"
placeholder="HH:MM:SS (01:05:25)" class="input w-32" /> name="end_time"
value={$ae_loc.files.processed_file_kv &&
$ae_loc.files.processed_file_kv[hosted_file_id] &&
$ae_loc.files.processed_file_kv[hosted_file_id].end_time
? $ae_loc.files.processed_file_kv[hosted_file_id].end_time
: '00:45:59'}
placeholder="HH:MM:SS (01:05:25)"
class="input w-32"
/>
</label> </label>
<span class="flex flex-col gap-1 items-center justify-center" <span
class="flex flex-col gap-1 items-center justify-center"
title="Re-encode the video file? This does cause some minor quality loss. Re-encoding is useful if the audio or video seems to be chopped off at the beginning or end of the clip. It can also help with partially corrupted files." title="Re-encode the video file? This does cause some minor quality loss. Re-encoding is useful if the audio or video seems to be chopped off at the beginning or end of the clip. It can also help with partially corrupted files."
> >
<span class="text-xs font-bold"> <span class="text-xs font-bold"> Re-encode? </span>
Re-encode?
</span>
<label class="inline-block"> <label class="inline-block">
<input type="radio" name="reencode" value="true" class="radio" checked /> <input type="radio" name="reencode" value="true" class="radio" checked />
True True
@@ -305,12 +328,11 @@ function handle_clip_video(event) {
</label> </label>
</span> </span>
<span class="flex flex-col gap-1 items-center justify-center" <span
class="flex flex-col gap-1 items-center justify-center"
title="Scale the video file down to 1920x1080? This does cause some minor quality loss. Re-encoding is useful if the audio or video seems to be chopped off at the beginning or end of the clip. It can also help with partially corrupted files." title="Scale the video file down to 1920x1080? This does cause some minor quality loss. Re-encoding is useful if the audio or video seems to be chopped off at the beginning or end of the clip. It can also help with partially corrupted files."
> >
<span class="text-xs font-bold"> <span class="text-xs font-bold"> Scale down? </span>
Scale down?
</span>
<label class="inline-block"> <label class="inline-block">
<input type="radio" name="scale_down" value="true" class="radio" checked /> <input type="radio" name="scale_down" value="true" class="radio" checked />
True True
@@ -344,7 +366,6 @@ function handle_clip_video(event) {
<!-- <span class="fas fa-cut m-1"></span> <!-- <span class="fas fa-cut m-1"></span>
Clip Video --> Clip Video -->
</button> </button>
</form> </form>
{#await ae_promises[hosted_file_id]} {#await ae_promises[hosted_file_id]}
@@ -357,7 +378,6 @@ function handle_clip_video(event) {
<!-- <p>Fill out the form and select the video file to clip.</p> --> <!-- <p>Fill out the form and select the video file to clip.</p> -->
{/if} {/if}
{/await} {/await}
</div> </div>
{/each} {/each}
@@ -373,5 +393,4 @@ function handle_clip_video(event) {
<p>Fill out the form and select the video file to clip.</p> <p>Fill out the form and select the video file to clip.</p>
{/if} {/if}
{/await} --> {/await} -->
</section> </section>

View File

@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
// Imports // Imports
// Import components and elements // Import components and elements
@@ -8,7 +7,15 @@ import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/stores/ae_stores'; import {
ae_snip,
ae_loc,
ae_sess,
ae_api,
ae_trig,
slct,
slct_trigger
} from '$lib/stores/ae_stores';
// Exports // Exports
@@ -35,13 +42,10 @@ let {
}: Props = $props(); }: Props = $props();
let ae_promises: key_val = $state({}); let ae_promises: key_val = $state({});
</script> </script>
<h3 class="h3">{Object.entries($ae_loc.files).length}× files clipped</h3> <h3 class="h3">{Object.entries($ae_loc.files).length}× files clipped</h3>
<div class="{class_li_default} {class_li} "> <div class="{class_li_default} {class_li} ">
{#each Object.entries(video_clip_file_kv) as [hosted_file_id, hosted_file_obj]} {#each Object.entries(video_clip_file_kv) as [hosted_file_id, hosted_file_obj]}
<button <button
type="button" type="button"
@@ -61,7 +65,6 @@ let ae_promises: key_val = $state({});
class="novi_btn btn btn-sm lg:btn-md preset-tonal-primary hover:preset-filled-primary-500 min-w-72 lg:min-w-96" class="novi_btn btn btn-sm lg:btn-md preset-tonal-primary hover:preset-filled-primary-500 min-w-72 lg:min-w-96"
title={`Download this file:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`} title={`Download this file:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`}
> >
{#await ae_promises[hosted_file_id]} {#await ae_promises[hosted_file_id]}
<span class="fas fa-spinner fa-spin mx-1"></span> <span class="fas fa-spinner fa-spin mx-1"></span>
<span class=""> <span class="">
@@ -82,7 +85,6 @@ let ae_promises: key_val = $state({});
<span class="shrink"> <span class="shrink">
{ae_util.format_bytes(hosted_file_obj?.size)} {ae_util.format_bytes(hosted_file_obj?.size)}
</span> </span>
</button> </button>
{/each} {/each}
</div> </div>

View File

@@ -9,7 +9,15 @@ import Element_input_files_tbl from '$lib/elements/element_input_files_tbl.svelt
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/stores/ae_stores'; import {
ae_snip,
ae_loc,
ae_sess,
ae_api,
ae_trig,
slct,
slct_trigger
} from '$lib/stores/ae_stores';
// Exports // Exports
// Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc // Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc
@@ -19,9 +27,11 @@ export let link_to_id: string;
export let input_name = 'file_list'; export let input_name = 'file_list';
export let multiple: boolean = true; export let multiple: boolean = true;
export let required: boolean = true; export let required: boolean = true;
export let accept: string = 'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh'; export let accept: string =
'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh';
export let class_li_default: string = 'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1'; export let class_li_default: string =
'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1';
export let class_li: string = ''; export let class_li: string = '';
export let input_class_li: string[] = ['file_drop_area']; export let input_class_li: string[] = ['file_drop_area'];
export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', '', 'text-sm']; export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', '', 'text-sm'];
@@ -32,7 +42,6 @@ export let submit_status: null|string = null;
export let hosted_file_id_li: string[] = []; export let hosted_file_id_li: string[] = [];
export let hosted_file_obj_li: any[] = []; export let hosted_file_obj_li: any[] = [];
// Local Variables // Local Variables
let task_id = link_to_id; let task_id = link_to_id;
let input_file_list: any = null; let input_file_list: any = null;
@@ -45,7 +54,7 @@ let form_kv: key_val = {
start_time: null, start_time: null,
end_time: null, end_time: null,
reencode: null, reencode: null,
video_file: null, video_file: null
}; };
let download_clip_src: string; let download_clip_src: string;
let download_clip_filename: string; let download_clip_filename: string;
@@ -68,10 +77,9 @@ async function handle_submit_form_files(event) {
start_time: event.target.start_time.value, start_time: event.target.start_time.value,
end_time: event.target.end_time.value, end_time: event.target.end_time.value,
reencode: event.target.reencode.value, reencode: event.target.reencode.value,
video_file: event.target.file_list.files[0], video_file: event.target.file_list.files[0]
}; };
// const form_data = new FormData(); // const form_data = new FormData();
// form_data.append('start_time', event.target.start_time.value); // form_data.append('start_time', event.target.start_time.value);
@@ -96,7 +104,6 @@ async function handle_submit_form_files(event) {
// params = null; // params = null;
if (event.target[input_element_id].files.length > 0) { if (event.target[input_element_id].files.length > 0) {
task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead? task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead?
@@ -135,7 +142,6 @@ async function handle_submit_form_files(event) {
upload_complete = true; upload_complete = true;
} }
async function handle_input_upload_files(input_upload_files, form_kv, task_id) { async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
console.log('*** handle_input_upload_files() ***'); console.log('*** handle_input_upload_files() ***');
console.log(input_upload_files); console.log(input_upload_files);
@@ -179,7 +185,8 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
// Uncomment and the post_promise is not seen by the "await" below // Uncomment and the post_promise is not seen by the "await" below
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data}); // post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
// Uncomment so that the post_promise is not seen by the "await" below // Uncomment so that the post_promise is not seen by the "await" below
ae_promises.upload__hosted_file_obj = api.post_object({ ae_promises.upload__hosted_file_obj = api
.post_object({
api_cfg: $ae_api, api_cfg: $ae_api,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -188,7 +195,7 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
filename: 'clipped_video_test.mp4', filename: 'clipped_video_test.mp4',
auto_download: false, auto_download: false,
task_id: task_id, task_id: task_id,
log_lvl: log_lvl, log_lvl: log_lvl
// retry_count: 1, // retry_count: 1,
}) })
.then(async function (result) { .then(async function (result) {
@@ -203,7 +210,6 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
return true; return true;
// // WARNING!!!! ONLY ONE FILE IS EXPECTED TO BE UPLOADED AT A TIME!!! // // WARNING!!!! ONLY ONE FILE IS EXPECTED TO BE UPLOADED AT A TIME!!!
// // NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item. // // NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item.
// let x = 0; // let x = 0;
@@ -259,21 +265,39 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
return hosted_file_result; return hosted_file_result;
} }
</script> </script>
<div> <div>
<!-- class:hidden={!$ae_loc.trusted_access} --> <!-- class:hidden={!$ae_loc.trusted_access} -->
<form <form on:submit|preventDefault={handle_submit_form_files} class="{class_li_default} {class_li}">
on:submit|preventDefault={handle_submit_form_files} <label class="label"
class="{class_li_default} {class_li}" >Start time (HH:MM:SS) <input
type="text"
name="start_time"
value="00:00:00"
placeholder="HH:MM:SS (00:01:30)"
class="input w-32"
/></label
>
<label class="label"
>End time (HH:MM:SS) <input
type="text"
name="end_time"
value="00:01:15"
placeholder="HH:MM:SS (01:05:25)"
class="input w-32"
/></label
> >
<label class="label">Start time (HH:MM:SS) <input type="text" name="start_time" value="00:00:00" placeholder="HH:MM:SS (00:01:30)" class="input w-32" /></label> <label class="label"
<label class="label">End time (HH:MM:SS) <input type="text" name="end_time" value="00:01:15" placeholder="HH:MM:SS (01:05:25)" class="input w-32" /></label> >Re-encode (true or false) <input
type="text"
<label class="label">Re-encode (true or false) <input type="text" name="reencode" value="false" placeholder="true" class="input w-32" /></label> name="reencode"
value="false"
placeholder="true"
class="input w-32"
/></label
>
{#await ae_promises.upload__hosted_file_obj} {#await ae_promises.upload__hosted_file_obj}
<div class="text-lg flex flex-row gap-1 items-center justify-center"> <div class="text-lg flex flex-row gap-1 items-center justify-center">
@@ -301,7 +325,7 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
<!-- (drag and drop) --> <!-- (drag and drop) -->
</div> </div>
<span class="text-sm text-gray-600 dark:text-gray-400 italic"> <span class="text-sm text-gray-600 dark:text-gray-400 italic">
<strong>Video files only</strong><br> <strong>Video files only</strong><br />
(mp4 or mkv) (mp4 or mkv)
</span> </span>
</slot> </slot>
@@ -315,22 +339,24 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
{required} {required}
{accept} {accept}
name={input_name} name={input_name}
class="svelte_input_file_element file-dropzone-input block w-full text-lg text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-hidden dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 {input_class_li.join(' ')}" class="svelte_input_file_element file-dropzone-input block w-full text-lg text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-hidden dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 {input_class_li.join(
' '
)}"
class:hidden={$ae_sess.files.disable_submit__hosted_file_obj} class:hidden={$ae_sess.files.disable_submit__hosted_file_obj}
/> />
<Element_input_files_tbl <Element_input_files_tbl
bind:input_file_list={input_file_list} bind:input_file_list
bind:file_list_status={$ae_sess.files.status__file_list} bind:file_list_status={$ae_sess.files.status__file_list}
bind:processed_file_list={$ae_sess.files.processed_file_list} bind:processed_file_list={$ae_sess.files.processed_file_list}
table_class_li={table_class_li} {table_class_li}
/> />
<button <button
type="submit" type="submit"
class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500 hover:preset-tonal-success border border-success-500 w-54" class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500 hover:preset-tonal-success border border-success-500 w-54"
disabled={$ae_sess.files.disable_submit__hosted_file_obj || $ae_sess.files.status__file_list != 'ready'} disabled={$ae_sess.files.disable_submit__hosted_file_obj ||
$ae_sess.files.status__file_list != 'ready'}
> >
{#await ae_promises.upload__hosted_file_obj} {#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin m-1"></span> <span class="fas fa-spinner fa-spin m-1"></span>
@@ -342,9 +368,7 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
</span> </span>
{:then} {:then}
<span class="fas fa-upload m-1"></span> <span class="fas fa-upload m-1"></span>
<span class="text-sm"> <span class="text-sm"> Upload? </span>
Upload?
</span>
<!-- <span class="fas fa-save m-1"></span> --> <!-- <span class="fas fa-save m-1"></span> -->
<span class="grow font-bold"> <span class="grow font-bold">
{#if $ae_sess.files.processed_file_list?.length > 0} {#if $ae_sess.files.processed_file_list?.length > 0}
@@ -353,11 +377,11 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
{file_obj.filename} {file_obj.filename}
</span> </span>
{/each} --> {/each} -->
{$ae_sess.files.processed_file_list.length == 1 ? `${$ae_sess.files.processed_file_list.length} file` : `${$ae_sess.files.processed_file_list.length} files`} {$ae_sess.files.processed_file_list.length == 1
? `${$ae_sess.files.processed_file_list.length} file`
: `${$ae_sess.files.processed_file_list.length} files`}
{:else} {:else}
<span class="text-xs"> <span class="text-xs"> No files selected </span>
No files selected
</span>
{/if} {/if}
<!-- Files --> <!-- Files -->
</span> </span>
@@ -365,7 +389,6 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
</button> </button>
</form> </form>
<hr /> <hr />
{#await ae_promises.upload__hosted_file_obj} {#await ae_promises.upload__hosted_file_obj}
@@ -373,10 +396,13 @@ async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
<p class="highlight">Converting... This may take a few minutes.</p> <p class="highlight">Converting... This may take a few minutes.</p>
{:then} {:then}
{#if ae_promises.upload__hosted_file_obj} {#if ae_promises.upload__hosted_file_obj}
<a href={download_clip_src} download={download_clip_filename} class="ae_btn btn_lg btn_primary"><span class="fas fa-download"></span> Ready to Download</a> <a
href={download_clip_src}
download={download_clip_filename}
class="ae_btn btn_lg btn_primary"><span class="fas fa-download"></span> Ready to Download</a
>
{:else} {:else}
<p>Fill out the form and select the video file to clip.</p> <p>Fill out the form and select the video file to clip.</p>
{/if} {/if}
{/await} {/await}
</div> </div>

View File

@@ -26,7 +26,15 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/stores/ae_stores'; import {
ae_snip,
ae_loc,
ae_sess,
ae_api,
ae_trig,
slct,
slct_trigger
} from '$lib/stores/ae_stores';
interface Props { interface Props {
log_lvl?: number; log_lvl?: number;
@@ -59,30 +67,32 @@ let {
}: Props = $props(); }: Props = $props();
if (log_lvl) { if (log_lvl) {
console.log(`ae_comp__hosted_files_download_button.svelte hosted_file_id=${hosted_file_id}`, hosted_file_obj); console.log(
`ae_comp__hosted_files_download_button.svelte hosted_file_id=${hosted_file_id}`,
hosted_file_obj
);
} }
let ae_promises: key_val = $state({}); let ae_promises: key_val = $state({});
$effect(() => { $effect(() => {
if ($ae_sess?.api_download_kv[hosted_file_obj?.hosted_file_id_random]?.percent_completed) { if ($ae_sess?.api_download_kv[hosted_file_obj?.hosted_file_id_random]?.percent_completed) {
download_percent = $ae_sess.api_download_kv[hosted_file_obj?.hosted_file_id_random].percent_completed; download_percent =
$ae_sess.api_download_kv[hosted_file_obj?.hosted_file_id_random].percent_completed;
} }
}); });
</script> </script>
{#if hosted_file_id && hosted_file_obj} {#if hosted_file_id && hosted_file_obj}
<button <button
type="button" type="button"
disabled={!$ae_loc.trusted_access} disabled={!$ae_loc.trusted_access}
class="{classes ?? 'btn'}" class={classes ?? 'btn'}
onclick={() => { onclick={() => {
download_complete = false; download_complete = false;
download_status_msg = 'Downloading...'; download_status_msg = 'Downloading...';
ae_promises[hosted_file_obj.hosted_file_id_random] = api.download_hosted_file({ ae_promises[hosted_file_obj.hosted_file_id_random] = api
.download_hosted_file({
api_cfg: $ae_api, api_cfg: $ae_api,
hosted_file_id: hosted_file_obj.hosted_file_id_random, hosted_file_id: hosted_file_obj.hosted_file_id_random,
return_file: true, return_file: true,
@@ -107,7 +117,6 @@ $effect(() => {
return result; return result;
}); });
}} }}
title={`Download this file:\n${filename ?? hosted_file_obj?.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}...\nHosted ID: ${hosted_file_obj?.hosted_file_id_random}\n Linked to: ${linked_to_type} ID: ${linked_to_id}`} title={`Download this file:\n${filename ?? hosted_file_obj?.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}...\nHosted ID: ${hosted_file_obj?.hosted_file_id_random}\n Linked to: ${linked_to_type} ID: ${linked_to_id}`}
> >
{#await ae_promises[hosted_file_obj.hosted_file_id_random]} {#await ae_promises[hosted_file_obj.hosted_file_id_random]}
@@ -121,7 +130,6 @@ $effect(() => {
</span> </span>
{:then} {:then}
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.extension)}"></span> <span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.extension)}"></span>
{/await} {/await}
{#if download_complete === null} {#if download_complete === null}
@@ -131,22 +139,15 @@ $effect(() => {
{/if} {/if}
<span class="grow"> <span class="grow">
{ae_util.shorten_filename({filename: filename ?? hosted_file_obj?.filename, max_length: max_length})} {ae_util.shorten_filename({
filename: filename ?? hosted_file_obj?.filename,
max_length: max_length
})}
</span> </span>
</button> </button>
{:else} {:else}
<button type="button" disabled class={classes ?? 'btn'} title="No file selected">
<button
type="button"
disabled
class="{classes ?? 'btn'}"
title="No file selected"
>
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.extension)}"></span> <span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.extension)}"></span>
<span class="grow"> <span class="grow"> No file info </span>
No file info
</span>
</button> </button>
{/if} {/if}

View File

@@ -9,7 +9,15 @@ import Element_input_files_tbl from '$lib/elements/element_input_files_tbl.svelt
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/stores/ae_stores'; import {
ae_snip,
ae_loc,
ae_sess,
ae_api,
ae_trig,
slct,
slct_trigger
} from '$lib/stores/ae_stores';
// Exports // Exports
// Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc // Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc
@@ -19,9 +27,11 @@ export let link_to_id: string;
export let input_name = 'file_list'; export let input_name = 'file_list';
export let multiple: boolean = true; export let multiple: boolean = true;
export let required: boolean = true; export let required: boolean = true;
export let accept: string = 'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh'; export let accept: string =
'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh';
export let class_li_default: string = 'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1'; export let class_li_default: string =
'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1';
export let class_li: string = ''; export let class_li: string = '';
export let input_class_li: string[] = ['file_drop_area']; export let input_class_li: string[] = ['file_drop_area'];
export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', '', 'text-sm']; export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', '', 'text-sm'];
@@ -33,7 +43,6 @@ export let hosted_file_id_li: string[] = [];
export let hosted_file_obj_li: any[] = []; export let hosted_file_obj_li: any[] = [];
export let hosted_file_obj_kv: key_val = {}; export let hosted_file_obj_kv: key_val = {};
// Local Variables // Local Variables
let task_id = link_to_id; let task_id = link_to_id;
let input_file_list: any = null; let input_file_list: any = null;
@@ -62,7 +71,12 @@ async function handle_submit_form_files(event: SubmitEvent) {
let hosted_file_results; let hosted_file_results;
const target = event.target as HTMLFormElement; const target = event.target as HTMLFormElement;
if (target && target[input_element_id] && (target[input_element_id] as HTMLInputElement)?.files && (target[input_element_id] as HTMLInputElement).files.length > 0) { if (
target &&
target[input_element_id] &&
(target[input_element_id] as HTMLInputElement)?.files &&
(target[input_element_id] as HTMLInputElement).files.length > 0
) {
task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead? task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead?
// Loop through each file and upload them individually in event.target[input_element_id].files // Loop through each file and upload them individually in event.target[input_element_id].files
@@ -104,16 +118,13 @@ async function handle_submit_form_files(event: SubmitEvent) {
upload_complete = true; upload_complete = true;
} }
async function handle_input_upload_files({
async function handle_input_upload_files(
{
input_upload_files, input_upload_files,
task_id task_id
}: { }: {
input_upload_files: any[], input_upload_files: any[];
task_id: string task_id: string;
} }) {
) {
console.log('*** handle_input_upload_files() ***'); console.log('*** handle_input_upload_files() ***');
const form_data = new FormData(); const form_data = new FormData();
@@ -144,13 +155,14 @@ async function handle_input_upload_files(
// Uncomment and the post_promise is not seen by the "await" below // Uncomment and the post_promise is not seen by the "await" below
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data}); // post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
// Uncomment so that the post_promise is not seen by the "await" below // Uncomment so that the post_promise is not seen by the "await" below
ae_promises.upload__hosted_file_obj = api.post_object({ ae_promises.upload__hosted_file_obj = api
.post_object({
api_cfg: $ae_api, api_cfg: $ae_api,
endpoint: endpoint, endpoint: endpoint,
// params: params, // params: params,
form_data: form_data, form_data: form_data,
task_id: task_id, task_id: task_id,
log_lvl: log_lvl, log_lvl: log_lvl
// retry_count: 1, // retry_count: 1,
}) })
.then(async function (result) { .then(async function (result) {
@@ -219,16 +231,10 @@ async function handle_input_upload_files(
return hosted_file_result; return hosted_file_result;
} }
</script> </script>
<!-- class:hidden={!$ae_loc.trusted_access} --> <!-- class:hidden={!$ae_loc.trusted_access} -->
<form <form on:submit|preventDefault={handle_submit_form_files} class="{class_li_default} {class_li}">
on:submit|preventDefault={handle_submit_form_files}
class="{class_li_default} {class_li}"
>
{#await ae_promises.upload__hosted_file_obj} {#await ae_promises.upload__hosted_file_obj}
<div class="text-lg flex flex-row gap-1 items-center justify-center"> <div class="text-lg flex flex-row gap-1 items-center justify-center">
<span class="fas fa-spinner fa-spin m-1"></span> <span class="fas fa-spinner fa-spin m-1"></span>
@@ -255,7 +261,7 @@ async function handle_input_upload_files(
<!-- (drag and drop) --> <!-- (drag and drop) -->
</div> </div>
<span class="text-sm text-gray-600 dark:text-gray-400 italic"> <span class="text-sm text-gray-600 dark:text-gray-400 italic">
<strong>Presentation related files only</strong><br> <strong>Presentation related files only</strong><br />
(PowerPoint, Keynote, PDF, mp4, Word Doc, Excel, txt, etc) (PowerPoint, Keynote, PDF, mp4, Word Doc, Excel, txt, etc)
</span> </span>
</slot> </slot>
@@ -284,17 +290,17 @@ async function handle_input_upload_files(
/> />
<Element_input_files_tbl <Element_input_files_tbl
bind:input_file_list={input_file_list} bind:input_file_list
bind:file_list_status={$ae_sess.files.status__file_list} bind:file_list_status={$ae_sess.files.status__file_list}
bind:processed_file_list={$ae_sess.files.processed_file_list} bind:processed_file_list={$ae_sess.files.processed_file_list}
table_class_li={table_class_li} {table_class_li}
/> />
<button <button
type="submit" type="submit"
class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500 hover:preset-tonal-success border border-success-500 w-54" class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500 hover:preset-tonal-success border border-success-500 w-54"
disabled={$ae_sess.files.disable_submit__hosted_file_obj || $ae_sess.files.status__file_list != 'ready'} disabled={$ae_sess.files.disable_submit__hosted_file_obj ||
$ae_sess.files.status__file_list != 'ready'}
> >
{#await ae_promises.upload__hosted_file_obj} {#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin m-1"></span> <span class="fas fa-spinner fa-spin m-1"></span>
@@ -306,9 +312,7 @@ async function handle_input_upload_files(
</span> </span>
{:then} {:then}
<span class="fas fa-upload m-1"></span> <span class="fas fa-upload m-1"></span>
<span class="text-sm"> <span class="text-sm"> Upload? </span>
Upload?
</span>
<!-- <span class="fas fa-save m-1"></span> --> <!-- <span class="fas fa-save m-1"></span> -->
<span class="grow font-bold"> <span class="grow font-bold">
{#if $ae_sess.files.processed_file_list?.length > 0} {#if $ae_sess.files.processed_file_list?.length > 0}
@@ -317,11 +321,11 @@ async function handle_input_upload_files(
{file_obj.filename} {file_obj.filename}
</span> </span>
{/each} --> {/each} -->
{$ae_sess.files.processed_file_list.length == 1 ? `${$ae_sess.files.processed_file_list.length} file` : `${$ae_sess.files.processed_file_list.length} files`} {$ae_sess.files.processed_file_list.length == 1
? `${$ae_sess.files.processed_file_list.length} file`
: `${$ae_sess.files.processed_file_list.length} files`}
{:else} {:else}
<span class="text-xs"> <span class="text-xs"> No files selected </span>
No files selected
</span>
{/if} {/if}
<!-- Files --> <!-- Files -->
</span> </span>

View File

@@ -6,52 +6,41 @@ import {
load_ae_obj_id__activity_log, load_ae_obj_id__activity_log,
load_ae_obj_li__activity_log, load_ae_obj_li__activity_log,
create_ae_obj__activity_log, create_ae_obj__activity_log,
update_ae_obj__activity_log, update_ae_obj__activity_log
// db_save_ae_obj_li__activity_log // db_save_ae_obj_li__activity_log
} from "$lib/ae_core/core__activity_log"; } from '$lib/ae_core/core__activity_log';
import { import {
load_ae_obj_id__person, load_ae_obj_id__person,
load_ae_obj_li__person, load_ae_obj_li__person,
create_ae_obj__person, create_ae_obj__person,
delete_ae_obj_id__person, delete_ae_obj_id__person,
update_ae_obj__person, update_ae_obj__person
// db_save_ae_obj_li__person // db_save_ae_obj_li__person
} from "$lib/ae_core/core__person"; } from '$lib/ae_core/core__person';
import { import {
auth_ae_obj__username_password, auth_ae_obj__username_password,
auth_ae_obj__user_id_user_auth_key, auth_ae_obj__user_id_user_auth_key,
send_email_auth_ae_obj__user_id, send_email_auth_ae_obj__user_id,
qry_ae_obj_li__user_email, qry_ae_obj_li__user_email,
auth_ae_obj__user_id_change_password, auth_ae_obj__user_id_change_password
// handle_load_ae_obj_id__user, // handle_load_ae_obj_id__user,
// handle_load_ae_obj_li__user, // handle_load_ae_obj_li__user,
// handle_create_ae_obj__user, // handle_create_ae_obj__user,
// handle_update_ae_obj__user, // handle_update_ae_obj__user,
// handle_db_save_ae_obj_li__user // handle_db_save_ae_obj_li__user
} from "$lib/ae_core/core__user"; } from '$lib/ae_core/core__user';
import { import { generate_qr_code, js_generate_qr_code } from '$lib/ae_core/core__qr_code';
generate_qr_code,
js_generate_qr_code,
} from "$lib/ae_core/core__qr_code";
import { import { check_hosted_file_obj_w_hash } from '$lib/ae_core/core__check_hosted_file_obj_w_hash';
check_hosted_file_obj_w_hash
} from "$lib/ae_core/core__check_hosted_file_obj_w_hash";
import { import { load_ae_obj_li__time_zone } from '$lib/ae_core/core__time_zones';
load_ae_obj_li__time_zone
} from "$lib/ae_core/core__time_zones";
import { import { load_ae_obj_li__country } from '$lib/ae_core/core__countries';
load_ae_obj_li__country
} from "$lib/ae_core/core__countries";
import { import { load_ae_obj_li__country_subdivision } from '$lib/ae_core/core__country_subdivisions';
load_ae_obj_li__country_subdivision
} from "$lib/ae_core/core__country_subdivisions";
import { import {
load_ae_obj_id__hosted_file, load_ae_obj_id__hosted_file,
@@ -59,40 +48,33 @@ import {
delete_ae_obj_id__hosted_file, delete_ae_obj_id__hosted_file,
db_save_ae_obj_li__hosted_file, db_save_ae_obj_li__hosted_file,
db_update_ae_obj_id__hosted_file db_update_ae_obj_id__hosted_file
} from "$lib/ae_core/core__hosted_files"; } from '$lib/ae_core/core__hosted_files';
// This has more generic general purpose functions that can eventually replace the custom ones per object type. // This has more generic general purpose functions that can eventually replace the custom ones per object type.
import { import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
db_save_ae_obj_li__ae_obj,
} from "$lib/ae_core/core__idb_dexie";
import { import { add_url_params, clean_headers } from '$lib/ae_core/core__api_helpers';
add_url_params,
clean_headers,
} from "$lib/ae_core/core__api_helpers";
let ae_promises: key_val = {}; // Promise<any>;
const ae_promises: key_val = {}; // Promise<any>;
// Updated 2024-03-29 // Updated 2024-03-29
async function handle_load_ae_obj_id__site_domain( async function handle_load_ae_obj_id__site_domain({
{
api_cfg, api_cfg,
fqdn, fqdn,
try_cache = false, try_cache = false,
timeout = 7000, timeout = 7000,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
fqdn: string, fqdn: string;
try_cache?: boolean, try_cache?: boolean;
timeout?: number, timeout?: number;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** handle_load_ae_obj_id__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}`); console.log(
`*** handle_load_ae_obj_id__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}`
);
} }
let no_account_id = false; let no_account_id = false;
@@ -102,10 +84,11 @@ async function handle_load_ae_obj_id__site_domain(
} }
no_account_id = true; no_account_id = true;
let params = {}; const params = {};
// ae_sess.hub.site_domain_id_qry_status = 'loading'; // ae_sess.hub.site_domain_id_qry_status = 'loading';
ae_promises.load__site_domain_obj = api.get_ae_obj_id_crud({ ae_promises.load__site_domain_obj = api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
no_account_id: no_account_id, no_account_id: no_account_id,
obj_type: 'site_domain', obj_type: 'site_domain',
@@ -137,10 +120,8 @@ async function handle_load_ae_obj_id__site_domain(
return ae_promises.load__site_domain_obj; return ae_promises.load__site_domain_obj;
} }
// Updated 2024-03-29 // Updated 2024-03-29
async function handle_load_ae_obj_code__data_store( async function handle_load_ae_obj_code__data_store({
{
api_cfg, api_cfg,
code, code,
data_type = 'text', data_type = 'text',
@@ -151,17 +132,16 @@ async function handle_load_ae_obj_code__data_store(
timeout = 9000, timeout = 9000,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
code: string, code: string;
data_type?: string, data_type?: string;
for_type?: string|null, for_type?: string | null;
for_id?: string|null, for_id?: string | null;
try_cache?: boolean, try_cache?: boolean;
save_idb?: boolean, save_idb?: boolean;
timeout?: number, timeout?: number;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** handle_get_data_store_obj_w_code() *** code=${code}`); console.log(`*** handle_get_data_store_obj_w_code() *** code=${code}`);
} }
@@ -176,7 +156,8 @@ async function handle_load_ae_obj_code__data_store(
return false; return false;
} }
ae_promises.load__data_store_obj = api.get_data_store_obj_w_code({ ae_promises.load__data_store_obj = api
.get_data_store_obj_w_code({
api_cfg: api_cfg, api_cfg: api_cfg,
data_store_code: code, data_store_code: code,
data_type: data_type, data_type: data_type,
@@ -196,8 +177,7 @@ async function handle_load_ae_obj_code__data_store(
} }
// let ae_ds_tmp: key_val = {}; // let ae_ds_tmp: key_val = {};
let ds_code_obj = const ds_code_obj = {
{
id: null, id: null,
account_id: null, account_id: null,
code: code, code: code,
@@ -214,7 +194,7 @@ async function handle_load_ae_obj_code__data_store(
text: null, text: null,
updated_on: null, updated_on: null,
chk_account_id: api_cfg.account_id, chk_account_id: api_cfg.account_id,
loaded_on: new Date().toISOString(), loaded_on: new Date().toISOString()
}; };
let val_json: key_val; let val_json: key_val;
let val_html: key_val; let val_html: key_val;
@@ -264,18 +244,19 @@ async function handle_load_ae_obj_code__data_store(
if (save_idb) { if (save_idb) {
if (browser) { if (browser) {
let key_prefix = 'ae_ds__'; const key_prefix = 'ae_ds__';
if (log_lvl) { if (log_lvl) {
console.log(`*ae_func* localStorage key: ${code}, value:`, get_ds_result); console.log(`*ae_func* localStorage key: ${code}, value:`, get_ds_result);
} }
localStorage.setItem(`${key_prefix}${code}`, JSON.stringify(get_ds_result)); localStorage.setItem(`${key_prefix}${code}`, JSON.stringify(get_ds_result));
} else { } else {
if (log_lvl) { if (log_lvl) {
console.log('*ae_func* No browser! Can not use localStorage to save data store object.'); console.log(
'*ae_func* No browser! Can not use localStorage to save data store object.'
);
} }
} }
} }
} else { } else {
console.log('*ae_func* No results returned.'); console.log('*ae_func* No results returned.');
return_this = null; return_this = null;
@@ -289,10 +270,8 @@ async function handle_load_ae_obj_code__data_store(
return ae_promises.load__data_store_obj; return ae_promises.load__data_store_obj;
} }
// Updated 2024-03-27 // Updated 2024-03-27
async function handle_update_ae_obj_id_crud( async function handle_update_ae_obj_id_crud({
{
api_cfg, api_cfg,
object_type, object_type,
object_id, object_id,
@@ -303,20 +282,20 @@ async function handle_update_ae_obj_id_crud(
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
object_type: string, object_type: string;
object_id: string, object_id: string;
object_reload?: boolean, object_reload?: boolean;
field_name: string, field_name: string;
new_field_value: any, new_field_value: any;
params: any|key_val, params: any | key_val;
try_cache: boolean, try_cache: boolean;
log_lvl: number log_lvl: number;
}) { }) {
let patch_result: any = null; let patch_result: any = null;
ae_promises.api_update__ae_obj = api.update_ae_obj_id_crud({ ae_promises.api_update__ae_obj = api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: object_type, obj_type: object_type,
obj_id: object_id, obj_id: object_id,
@@ -336,7 +315,9 @@ async function handle_update_ae_obj_id_crud(
console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}`); console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}`);
patch_result = 'PATCH complete'; patch_result = 'PATCH complete';
} else { } else {
console.log(`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`); console.log(
`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`
);
patch_result = 'PATCH failed'; patch_result = 'PATCH failed';
return false; return false;
} }
@@ -352,7 +333,6 @@ async function handle_update_ae_obj_id_crud(
}); });
return ae_promises.api_update__ae_obj; return ae_promises.api_update__ae_obj;
} }
// Core - Already imported above // Core - Already imported above
@@ -360,28 +340,27 @@ async function handle_update_ae_obj_id_crud(
// import { load_ae_obj_id__user } from "$lib/ae_core/core__user"; // import { load_ae_obj_id__user } from "$lib/ae_core/core__user";
// Additional Modules // Additional Modules
import { load_ae_obj_id__archive } from "$lib/ae_archives/ae_archives__archive"; import { load_ae_obj_id__archive } from '$lib/ae_archives/ae_archives__archive';
import { load_ae_obj_id__archive_content } from "$lib/ae_archives/ae_archives__archive_content"; import { load_ae_obj_id__archive_content } from '$lib/ae_archives/ae_archives__archive_content';
import { load_ae_obj_id__event } from "$lib/ae_events/ae_events__event"; import { load_ae_obj_id__event } from '$lib/ae_events/ae_events__event';
// import { load_ae_obj_id__event_badge } from "$lib/ae_events/ae_events__event_badge"; // import { load_ae_obj_id__event_badge } from "$lib/ae_events/ae_events__event_badge";
import { load_ae_obj_id__event_device } from "$lib/ae_events/ae_events__event_device"; import { load_ae_obj_id__event_device } from '$lib/ae_events/ae_events__event_device';
// import { load_ae_obj_id__event_exhibit } from "$lib/ae_events/ae_events__event_exhibit"; // import { load_ae_obj_id__event_exhibit } from "$lib/ae_events/ae_events__event_exhibit";
import { load_ae_obj_id__event_file } from "$lib/ae_events/ae_events__event_file"; import { load_ae_obj_id__event_file } from '$lib/ae_events/ae_events__event_file';
import { load_ae_obj_id__event_location } from "$lib/ae_events/ae_events__event_location"; import { load_ae_obj_id__event_location } from '$lib/ae_events/ae_events__event_location';
import { load_ae_obj_id__event_presentation } from "$lib/ae_events/ae_events__event_presentation"; import { load_ae_obj_id__event_presentation } from '$lib/ae_events/ae_events__event_presentation';
import { load_ae_obj_id__event_presenter } from "$lib/ae_events/ae_events__event_presenter"; import { load_ae_obj_id__event_presenter } from '$lib/ae_events/ae_events__event_presenter';
import { load_ae_obj_id__event_session } from "$lib/ae_events/ae_events__event_session"; import { load_ae_obj_id__event_session } from '$lib/ae_events/ae_events__event_session';
import { load_ae_obj_id__journal } from "$lib/ae_journals/ae_journals__journal"; import { load_ae_obj_id__journal } from '$lib/ae_journals/ae_journals__journal';
import { load_ae_obj_id__journal_entry } from "$lib/ae_journals/ae_journals__journal_entry"; import { load_ae_obj_id__journal_entry } from '$lib/ae_journals/ae_journals__journal_entry';
import { load_ae_obj_id__post } from "$lib/ae_posts/ae_posts__post"; import { load_ae_obj_id__post } from '$lib/ae_posts/ae_posts__post';
import { load_ae_obj_id__post_comment } from "$lib/ae_posts/ae_posts__post_comment"; import { load_ae_obj_id__post_comment } from '$lib/ae_posts/ae_posts__post_comment';
// Updated 2025-09-30 // Updated 2025-09-30
async function update_ae_obj_id_crud_v2( async function update_ae_obj_id_crud_v2({
{
api_cfg, api_cfg,
object_type, object_type,
object_id, object_id,
@@ -392,22 +371,26 @@ async function update_ae_obj_id_crud_v2(
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
object_type: string, object_type: string;
object_id: string, object_id: string;
object_reload?: boolean, object_reload?: boolean;
field_name: string, field_name: string;
new_field_value: any, new_field_value: any;
params?: any|key_val, params?: any | key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj_id_crud_v2() *** object_type=${object_type}, object_id=${object_id}, object_reload=${object_reload}, field_name=${field_name}, new_field_value=`, new_field_value); console.log(
`*** update_ae_obj_id_crud_v2() *** object_type=${object_type}, object_id=${object_id}, object_reload=${object_reload}, field_name=${field_name}, new_field_value=`,
new_field_value
);
} }
let patch_result: any = null; let patch_result: any = null;
ae_promises.api_update__ae_obj = await api.update_ae_obj_id_crud({ ae_promises.api_update__ae_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: object_type, obj_type: object_type,
obj_id: object_id, obj_id: object_id,
@@ -433,7 +416,7 @@ async function update_ae_obj_id_crud_v2(
} }
// Reload the object to get the latest data. There is a special case for each type. // Reload the object to get the latest data. There is a special case for each type.
if (object_type == 'person') { if (object_type == 'person') {
let load_person_obj = load_ae_obj_id__person({ const load_person_obj = load_ae_obj_id__person({
api_cfg: api_cfg, api_cfg: api_cfg,
person_id: object_id, person_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -450,7 +433,7 @@ async function update_ae_obj_id_crud_v2(
// } // }
if (object_type == 'archive') { if (object_type == 'archive') {
let load_archive_obj = load_ae_obj_id__archive({ const load_archive_obj = load_ae_obj_id__archive({
api_cfg: api_cfg, api_cfg: api_cfg,
archive_id: object_id, archive_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -458,7 +441,7 @@ async function update_ae_obj_id_crud_v2(
return load_archive_obj; return load_archive_obj;
} }
if (object_type == 'archive_content') { if (object_type == 'archive_content') {
let load_archive_content_obj = load_ae_obj_id__archive_content({ const load_archive_content_obj = load_ae_obj_id__archive_content({
api_cfg: api_cfg, api_cfg: api_cfg,
archive_content_id: object_id, archive_content_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -467,7 +450,7 @@ async function update_ae_obj_id_crud_v2(
} }
if (object_type == 'journal') { if (object_type == 'journal') {
let load_journal_obj = load_ae_obj_id__journal({ const load_journal_obj = load_ae_obj_id__journal({
api_cfg: api_cfg, api_cfg: api_cfg,
journal_id: object_id, journal_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -475,7 +458,7 @@ async function update_ae_obj_id_crud_v2(
return load_journal_obj; return load_journal_obj;
} }
if (object_type == 'journal_entry') { if (object_type == 'journal_entry') {
let load_journal_entry_obj = load_ae_obj_id__journal_entry({ const load_journal_entry_obj = load_ae_obj_id__journal_entry({
api_cfg: api_cfg, api_cfg: api_cfg,
journal_entry_id: object_id, journal_entry_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -484,7 +467,7 @@ async function update_ae_obj_id_crud_v2(
} }
if (object_type == 'event') { if (object_type == 'event') {
let load_event_obj = load_ae_obj_id__event({ const load_event_obj = load_ae_obj_id__event({
api_cfg: api_cfg, api_cfg: api_cfg,
event_id: object_id, event_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -492,7 +475,7 @@ async function update_ae_obj_id_crud_v2(
return load_event_obj; return load_event_obj;
} }
if (object_type == 'event_device') { if (object_type == 'event_device') {
let load_event_device_obj = load_ae_obj_id__event_device({ const load_event_device_obj = load_ae_obj_id__event_device({
api_cfg: api_cfg, api_cfg: api_cfg,
event_device_id: object_id, event_device_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -500,7 +483,7 @@ async function update_ae_obj_id_crud_v2(
return load_event_device_obj; return load_event_device_obj;
} }
if (object_type == 'event_file') { if (object_type == 'event_file') {
let load_event_file_obj = load_ae_obj_id__event_file({ const load_event_file_obj = load_ae_obj_id__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
event_file_id: object_id, event_file_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -508,7 +491,7 @@ async function update_ae_obj_id_crud_v2(
return load_event_file_obj; return load_event_file_obj;
} }
if (object_type == 'event_location') { if (object_type == 'event_location') {
let load_event_location_obj = load_ae_obj_id__event_location({ const load_event_location_obj = load_ae_obj_id__event_location({
api_cfg: api_cfg, api_cfg: api_cfg,
event_location_id: object_id, event_location_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -516,7 +499,7 @@ async function update_ae_obj_id_crud_v2(
return load_event_location_obj; return load_event_location_obj;
} }
if (object_type == 'event_presentation') { if (object_type == 'event_presentation') {
let load_event_presentation_obj = load_ae_obj_id__event_presentation({ const load_event_presentation_obj = load_ae_obj_id__event_presentation({
api_cfg: api_cfg, api_cfg: api_cfg,
event_presentation_id: object_id, event_presentation_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -524,7 +507,7 @@ async function update_ae_obj_id_crud_v2(
return load_event_presentation_obj; return load_event_presentation_obj;
} }
if (object_type == 'event_presenter') { if (object_type == 'event_presenter') {
let load_event_presenter_obj = load_ae_obj_id__event_presenter({ const load_event_presenter_obj = load_ae_obj_id__event_presenter({
api_cfg: api_cfg, api_cfg: api_cfg,
event_presenter_id: object_id, event_presenter_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -532,7 +515,7 @@ async function update_ae_obj_id_crud_v2(
return load_event_presenter_obj; return load_event_presenter_obj;
} }
if (object_type == 'event_session') { if (object_type == 'event_session') {
let load_event_session_obj = load_ae_obj_id__event_session({ const load_event_session_obj = load_ae_obj_id__event_session({
api_cfg: api_cfg, api_cfg: api_cfg,
event_session_id: object_id, event_session_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -541,7 +524,7 @@ async function update_ae_obj_id_crud_v2(
} }
if (object_type == 'post') { if (object_type == 'post') {
let load_post_obj = load_ae_obj_id__post({ const load_post_obj = load_ae_obj_id__post({
api_cfg: api_cfg, api_cfg: api_cfg,
post_id: object_id, post_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
@@ -549,20 +532,18 @@ async function update_ae_obj_id_crud_v2(
return load_post_obj; return load_post_obj;
} }
if (object_type == 'post_comment') { if (object_type == 'post_comment') {
let load_post_comment_obj = load_ae_obj_id__post_comment({ const load_post_comment_obj = load_ae_obj_id__post_comment({
api_cfg: api_cfg, api_cfg: api_cfg,
post_comment_id: object_id, post_comment_id: object_id,
log_lvl: log_lvl log_lvl: log_lvl
}); });
return load_post_comment_obj; return load_post_comment_obj;
} }
} }
} else { } else {
console.log(`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`); console.log(
`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`
);
patch_result = 'PATCH failed'; patch_result = 'PATCH failed';
return false; return false;
} }
@@ -578,12 +559,9 @@ async function update_ae_obj_id_crud_v2(
}); });
return ae_promises.api_update__ae_obj; return ae_promises.api_update__ae_obj;
} }
async function handle_download_export__obj_type({
async function handle_download_export__obj_type(
{
api_cfg, api_cfg,
get_obj_type, // The type of object to return: event_badge, event_presenter, sponsorship, etc. get_obj_type, // The type of object to return: event_badge, event_presenter, sponsorship, etc.
for_obj_type, // Usually for an account, event, event_exhibit, or sponsorship_cfg for_obj_type, // Usually for an account, event, event_exhibit, or sponsorship_cfg
@@ -597,23 +575,22 @@ async function handle_download_export__obj_type(
params = {}, // key value object is expected params = {}, // key value object is expected
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
get_obj_type: string, get_obj_type: string;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
exp_alt?: null|string, exp_alt?: null | string;
file_type?: string, file_type?: string;
return_file?: boolean, return_file?: boolean;
filename?: string, filename?: string;
auto_download?: boolean, auto_download?: boolean;
limit?: number, limit?: number;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** ae_core_functions.js: handle_download_export__obj_type() ***'); console.log('*** ae_core_functions.js: handle_download_export__obj_type() ***');
let task_id = for_obj_id; const task_id = for_obj_id;
const endpoint = `/v2/crud/${get_obj_type}/list`; const endpoint = `/v2/crud/${get_obj_type}/list`;
params['for_obj_type'] = for_obj_type; params['for_obj_type'] = for_obj_type;
@@ -632,7 +609,7 @@ async function handle_download_export__obj_type(
// let clean_filename = filename.replace(/[^a-z0-9]/gi, '_'); // let clean_filename = filename.replace(/[^a-z0-9]/gi, '_');
// let clean_filename = filename.replace(/[^a-z0-9\[\]-]/gi, '_'); // let clean_filename = filename.replace(/[^a-z0-9\[\]-]/gi, '_');
let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_'); const clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_');
// let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-\._ ]/gi, '_'); // let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-\._ ]/gi, '_');
if (limit >= 0) { if (limit >= 0) {
@@ -655,8 +632,7 @@ async function handle_download_export__obj_type(
return ae_promises.download__export_file; return ae_promises.download__export_file;
} }
const export_obj = {
let export_obj = {
check_hosted_file_obj_w_hash: check_hosted_file_obj_w_hash, check_hosted_file_obj_w_hash: check_hosted_file_obj_w_hash,
load_ae_obj_li__time_zone: load_ae_obj_li__time_zone, load_ae_obj_li__time_zone: load_ae_obj_li__time_zone,
@@ -699,6 +675,6 @@ let export_obj = {
update_ae_obj_id_crud_v2: update_ae_obj_id_crud_v2, update_ae_obj_id_crud_v2: update_ae_obj_id_crud_v2,
handle_download_export__obj_type: handle_download_export__obj_type, handle_download_export__obj_type: handle_download_export__obj_type,
generate_qr_code: generate_qr_code, generate_qr_code: generate_qr_code,
js_generate_qr_code: js_generate_qr_code, js_generate_qr_code: js_generate_qr_code
}; };
export let core_func = export_obj; export const core_func = export_obj;

View File

@@ -14,7 +14,7 @@ export interface Account {
enable_to?: null | Date; enable_to?: null | Date;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;

View File

@@ -1,30 +1,28 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
let ae_promises: key_val = {}; const ae_promises: key_val = {};
// Updated 2024-10-23 // Updated 2024-10-23
export async function load_ae_obj_id__activity_log( export async function load_ae_obj_id__activity_log({
{
api_cfg, api_cfg,
activity_log_id, activity_log_id,
// inc_other_li = false, // inc_other_li = false,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
activity_log_id: string, activity_log_id: string;
// inc_other_li?: boolean, // inc_other_li?: boolean,
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** load_ae_obj_id__activity_log() *** activity_log_id=${activity_log_id}`); console.log(`*** load_ae_obj_id__activity_log() *** activity_log_id=${activity_log_id}`);
let params = {}; const params = {};
ae_promises.load__activity_log_obj = await api.get_ae_obj_id_crud({ ae_promises.load__activity_log_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'activity_log', obj_type: 'activity_log',
obj_id: activity_log_id, // NOTE: This is the FQDN, not normally the ID. obj_id: activity_log_id, // NOTE: This is the FQDN, not normally the ID.
@@ -59,41 +57,47 @@ export async function load_ae_obj_id__activity_log(
return ae_promises.load__activity_log_obj; return ae_promises.load__activity_log_obj;
} }
// Updated 2024-10-23 // Updated 2024-10-23
export async function load_ae_obj_li__activity_log( export async function load_ae_obj_li__activity_log({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
// inc_other_li = false, // inc_other_li = false,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
// inc_other_li?: boolean, // inc_other_li?: boolean,
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) { console.log(
console.log(`*** load_ae_obj_li__activity_log() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); `*** load_ae_obj_li__activity_log() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 99); // 99 const limit: number = params.qry__limit ?? 99; // 99
let offset: number = (params.qry__offset ?? 0); // 0 const offset: number = params.qry__offset ?? 0; // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ ae_promises.load__activity_log_obj_li = await api
.get_ae_obj_li_for_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'activity_log', obj_type: 'activity_log',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -133,26 +137,24 @@ export async function load_ae_obj_li__activity_log(
return ae_promises.load__activity_log_obj_li; return ae_promises.load__activity_log_obj_li;
} }
// Updated 2024-10-23 // Updated 2024-10-23
export async function create_ae_obj__activity_log( export async function create_ae_obj__activity_log({
{
api_cfg, api_cfg,
account_id, account_id,
data_kv, data_kv,
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** create_ae_obj__activity_log() *** account_id=${account_id}`); console.log(`*** create_ae_obj__activity_log() *** account_id=${account_id}`);
ae_promises.create__activity_log = await api.create_ae_obj_crud({ ae_promises.create__activity_log = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'activity_log', obj_type: 'activity_log',
fields: { fields: {
@@ -179,8 +181,7 @@ export async function create_ae_obj__activity_log(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__activity_log:', ae_promises.create__activity_log); console.log('ae_promises.create__activity_log:', ae_promises.create__activity_log);
@@ -188,10 +189,8 @@ export async function create_ae_obj__activity_log(
return ae_promises.create__activity_log; return ae_promises.create__activity_log;
} }
// Updated 2024-10-23 // Updated 2024-10-23
export async function update_ae_obj__activity_log( export async function update_ae_obj__activity_log({
{
api_cfg, api_cfg,
activity_log_id, activity_log_id,
data_kv, data_kv,
@@ -199,18 +198,21 @@ export async function update_ae_obj__activity_log(
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
activity_log_id: string, activity_log_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__activity_log() *** activity_log_id=${activity_log_id}`, data_kv); console.log(
`*** update_ae_obj__activity_log() *** activity_log_id=${activity_log_id}`,
data_kv
);
} }
ae_promises.update__activity_log_obj = await api.update_ae_obj_id_crud({ ae_promises.update__activity_log_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'activity_log', obj_type: 'activity_log',
obj_id: activity_log_id, obj_id: activity_log_id,
@@ -235,8 +237,7 @@ export async function update_ae_obj__activity_log(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__activity_log_obj:', ae_promises.update__activity_log_obj); console.log('ae_promises.update__activity_log_obj:', ae_promises.update__activity_log_obj);
@@ -244,11 +245,9 @@ export async function update_ae_obj__activity_log(
return ae_promises.update__activity_log_obj; return ae_promises.update__activity_log_obj;
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2024-10-23 // Updated 2024-10-23
export async function qry__activity_log( export async function qry__activity_log({
{
api_cfg, api_cfg,
activity_log_id, activity_log_id,
qry_str, qry_str,
@@ -262,20 +261,19 @@ export async function qry__activity_log(
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
activity_log_id: any, activity_log_id: any;
qry_str?: string, qry_str?: string;
qry_files?: null|boolean, qry_files?: null | boolean;
qry_start_datetime?: null|string, // Greater than this datetime qry_start_datetime?: null | string; // Greater than this datetime
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** qry__activity_log() *** activity_log_id=${activity_log_id} qry_str=${qry_str}`); console.log(`*** qry__activity_log() *** activity_log_id=${activity_log_id} qry_str=${qry_str}`);
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -283,7 +281,7 @@ export async function qry__activity_log(
// let limit: number = (params.qry__limit ?? 25); // 99 // let limit: number = (params.qry__limit ?? 25); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (qry_str && qry_str.length > 2) { // if (qry_str && qry_str.length > 2) {
// params_json['ft_qry'] = {}; // params_json['ft_qry'] = {};
@@ -293,39 +291,44 @@ export async function qry__activity_log(
params_json['qry'] = []; params_json['qry'] = [];
if (qry_files === true) { if (qry_files === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: '>',
operator: ">",
value: 0 value: 0
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} else if (qry_files === false) { } else if (qry_files === false) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: 'IS',
operator: "IS",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_start_datetime) { if (qry_start_datetime) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'start_datetime',
field: "start_datetime", operator: '>',
operator: ">",
value: qry_start_datetime value: qry_start_datetime
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
let order_by_li: { [key: string]: "ASC" | "DESC" }[] = [{'priority': 'DESC'}, {'sort': 'DESC'}, {'start_datetime': 'ASC'}, {'name': 'ASC'}, {'updated_on': 'DESC'}, {'created_on': 'DESC'}]; const order_by_li: { [key: string]: 'ASC' | 'DESC' }[] = [
{ priority: 'DESC' },
{ sort: 'DESC' },
{ start_datetime: 'ASC' },
{ name: 'ASC' },
{ updated_on: 'DESC' },
{ created_on: 'DESC' }
];
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__activity_log_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'activity_log', obj_type: 'activity_log',
for_obj_type: 'account', for_obj_type: 'account',

View File

@@ -1,27 +1,24 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
// Updated 2025-01-28 // Updated 2025-01-28
export function add_url_params( export function add_url_params({
{
base_url = '', base_url = '',
endpoint, endpoint,
params, params,
log_lvl = 0 log_lvl = 0
}: { }: {
base_url?: string, base_url?: string;
endpoint: string, endpoint: string;
params: key_val, params: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** add_url_params() *** base_url=${base_url} endpoint=${endpoint}`, params); console.log(`*** add_url_params() *** base_url=${base_url} endpoint=${endpoint}`, params);
} }
const url_obj = new URL(endpoint, base_url); const url_obj = new URL(endpoint, base_url);
Object.keys(params).forEach(key => url_obj.searchParams.append(key, params[key])); Object.keys(params).forEach((key) => url_obj.searchParams.append(key, params[key]));
if (log_lvl) { if (log_lvl) {
console.log('New URL:', url_obj.toString()); console.log('New URL:', url_obj.toString());
@@ -31,25 +28,16 @@ export function add_url_params(
// return 'test'; // return 'test';
} }
// This is used to clean the header property names. Not underscores allowed in the header names. // This is used to clean the header property names. Not underscores allowed in the header names.
// Updated 2025-01-28 // Updated 2025-01-28
export function clean_headers( export function clean_headers({ headers, log_lvl = 0 }: { headers: any; log_lvl?: number }) {
{
headers,
log_lvl = 0
}: {
headers: any,
log_lvl?: number
}
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** clean_headers() ***`, headers); console.log(`*** clean_headers() ***`, headers);
} }
let headers_cleaned: key_val = {}; const headers_cleaned: key_val = {};
for (const prop in headers) { for (const prop in headers) {
let prop_cleaned = prop.replaceAll('_', '-'); const prop_cleaned = prop.replaceAll('_', '-');
if (typeof headers[prop] != 'string') { if (typeof headers[prop] != 'string') {
headers[prop] = JSON.stringify(headers[prop]); headers[prop] = JSON.stringify(headers[prop]);
} }

View File

@@ -1,10 +1,8 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
// Updated 2024-10-02 // Updated 2024-10-02
export async function check_hosted_file_obj_w_hash( export async function check_hosted_file_obj_w_hash({
{
api_cfg, api_cfg,
hosted_file_hash, hosted_file_hash,
check_for_local = true, // Forces a check on the host server for the file. check_for_local = true, // Forces a check on the host server for the file.
@@ -12,21 +10,20 @@ export async function check_hosted_file_obj_w_hash(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
hosted_file_hash: string, hosted_file_hash: string;
check_for_local?: boolean, check_for_local?: boolean;
params?: key_val, params?: key_val;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** stores_event_api.js: check_hosted_file_obj_w_hash() ***'); console.log('*** stores_event_api.js: check_hosted_file_obj_w_hash() ***');
const endpoint = `/hosted_file/hash/${hosted_file_hash}`; const endpoint = `/hosted_file/hash/${hosted_file_hash}`;
if (check_for_local) { if (check_for_local) {
params['check_for_local'] = true; params['check_for_local'] = true;
} }
let check_hosted_file_obj_w_hash_get_promise = await api.get_object({ const check_hosted_file_obj_w_hash_get_promise = await api.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,

View File

@@ -1,46 +1,44 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2024-10-14 // Updated 2024-10-14
export async function load_ae_obj_li__country( export async function load_ae_obj_li__country({
{
api_cfg, api_cfg,
// account_id, // account_id,
enabled = 'enabled', enabled = 'enabled',
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 299, limit = 299,
offset = 0, offset = 0,
order_by_li = {'sort': 'DESC', 'english_short_name': 'ASC', 'alpha_2_code': 'ASC'}, order_by_li = { sort: 'DESC', english_short_name: 'ASC', alpha_2_code: 'ASC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
// account_id: string, // account_id: string,
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__country() ***`); console.log(`*** load_ae_obj_li__country() ***`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__country_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__country_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'lu', obj_type: 'lu',
for_obj_type: 'country', for_obj_type: 'country',

View File

@@ -1,46 +1,44 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2024-10-14 // Updated 2024-10-14
export async function load_ae_obj_li__country_subdivision( export async function load_ae_obj_li__country_subdivision({
{
api_cfg, api_cfg,
// account_id, // account_id,
enabled = 'enabled', enabled = 'enabled',
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 399, limit = 399,
offset = 0, offset = 0,
order_by_li = {'sort': 'DESC', 'name': 'ASC', 'code': 'ASC'}, order_by_li = { sort: 'DESC', name: 'ASC', code: 'ASC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
// account_id: string, // account_id: string,
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__country_subdivision() ***`); console.log(`*** load_ae_obj_li__country_subdivision() ***`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__country_subdivision_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__country_subdivision_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'lu', obj_type: 'lu',
for_obj_type: 'country_subdivision', for_obj_type: 'country_subdivision',
@@ -68,6 +66,9 @@ export async function load_ae_obj_li__country_subdivision(
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}); });
console.log('ae_promises.load__country_subdivision_li:', ae_promises.load__country_subdivision_li); console.log(
'ae_promises.load__country_subdivision_li:',
ae_promises.load__country_subdivision_li
);
return ae_promises.load__country_subdivision_li; return ae_promises.load__country_subdivision_li;
} }

View File

@@ -3,7 +3,7 @@ import { marked } from 'marked';
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
// Define generic CRUD args // Define generic CRUD args
export interface GenericCrudArgs { export interface GenericCrudArgs {
@@ -25,7 +25,6 @@ export interface GenericCrudArgs {
inc_site_domain_li?: boolean; inc_site_domain_li?: boolean;
inc_user_li?: boolean; inc_user_li?: boolean;
// Flags to include related other object models // Flags to include related other object models
inc_archive_li?: boolean; inc_archive_li?: boolean;
inc_archive_entry_li?: boolean; inc_archive_entry_li?: boolean;
@@ -50,16 +49,14 @@ export interface GenericCrudArgs {
} }
// Generic function: Load single object by ID // Generic function: Load single object by ID
export async function load_ae_obj_id( export async function load_ae_obj_id(args: GenericCrudArgs): Promise<any> {
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, obj_id, log_lvl = 0 } = args; const { api_cfg, obj_type, obj_id, log_lvl = 0 } = args;
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`); console.log(`*** load_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`);
} }
let result = await api.get_ae_obj_id_crud({ const result = await api.get_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type, obj_type,
obj_id, obj_id,
@@ -71,9 +68,7 @@ export async function load_ae_obj_id(
} }
// Generic function: Load list of objects // Generic function: Load list of objects
export async function load_ae_obj_li( export async function load_ae_obj_li(args: GenericCrudArgs): Promise<any> {
args: GenericCrudArgs
): Promise<any> {
const { const {
api_cfg, api_cfg,
obj_type, obj_type,
@@ -91,12 +86,14 @@ export async function load_ae_obj_li(
} = args; } = args;
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li() *** obj_type=${obj_type} for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li() *** obj_type=${obj_type} for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
let result = await api.get_ae_obj_li_for_obj_id_crud_v2({ const result = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg, api_cfg,
obj_type, obj_type,
for_obj_type, for_obj_type,
@@ -115,16 +112,14 @@ export async function load_ae_obj_li(
} }
// Generic function: Create object // Generic function: Create object
export async function create_ae_obj( export async function create_ae_obj(args: GenericCrudArgs): Promise<any> {
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, data_kv, log_lvl = 0 } = args; const { api_cfg, obj_type, data_kv, log_lvl = 0 } = args;
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj() *** obj_type=${obj_type}`, data_kv); console.log(`*** create_ae_obj() *** obj_type=${obj_type}`, data_kv);
} }
let result = await api.create_ae_obj_crud({ const result = await api.create_ae_obj_crud({
api_cfg, api_cfg,
obj_type, obj_type,
fields: data_kv, fields: data_kv,
@@ -138,16 +133,14 @@ export async function create_ae_obj(
} }
// Generic function: Update object // Generic function: Update object
export async function update_ae_obj( export async function update_ae_obj(args: GenericCrudArgs): Promise<any> {
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, obj_id, data_kv, log_lvl = 0 } = args; const { api_cfg, obj_type, obj_id, data_kv, log_lvl = 0 } = args;
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj() *** obj_type=${obj_type} obj_id=${obj_id}`, data_kv); console.log(`*** update_ae_obj() *** obj_type=${obj_type} obj_id=${obj_id}`, data_kv);
} }
let result = await api.update_ae_obj_id_crud({ const result = await api.update_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type, obj_type,
obj_id, obj_id,
@@ -162,16 +155,14 @@ export async function update_ae_obj(
} }
// Generic function: Delete object // Generic function: Delete object
export async function delete_ae_obj_id( export async function delete_ae_obj_id(args: GenericCrudArgs): Promise<any> {
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, obj_id, method = 'delete', log_lvl = 0 } = args; const { api_cfg, obj_type, obj_id, method = 'delete', log_lvl = 0 } = args;
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`); console.log(`*** delete_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`);
} }
let result = await api.delete_ae_obj_id_crud({ const result = await api.delete_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type, obj_type,
obj_id, obj_id,
@@ -184,34 +175,23 @@ export async function delete_ae_obj_id(
return result; return result;
} }
// Additional Modules that might be needed for reloads // Additional Modules that might be needed for reloads
import { load_ae_obj_id__archive } from "$lib/ae_archives/ae_archives__archive"; import { load_ae_obj_id__archive } from '$lib/ae_archives/ae_archives__archive';
import { load_ae_obj_id__archive_content } from "$lib/ae_archives/ae_archives__archive_content"; import { load_ae_obj_id__archive_content } from '$lib/ae_archives/ae_archives__archive_content';
import { load_ae_obj_id__event } from "$lib/ae_events/ae_events__event"; import { load_ae_obj_id__event } from '$lib/ae_events/ae_events__event';
import { load_ae_obj_id__event_device } from "$lib/ae_events/ae_events__event_device"; import { load_ae_obj_id__event_device } from '$lib/ae_events/ae_events__event_device';
import { load_ae_obj_id__event_file } from "$lib/ae_events/ae_events__event_file"; import { load_ae_obj_id__event_file } from '$lib/ae_events/ae_events__event_file';
import { load_ae_obj_id__event_location } from "$lib/ae_events/ae_events__event_location"; import { load_ae_obj_id__event_location } from '$lib/ae_events/ae_events__event_location';
import { load_ae_obj_id__event_presentation } from "$lib/ae_events/ae_events__event_presentation"; import { load_ae_obj_id__event_presentation } from '$lib/ae_events/ae_events__event_presentation';
import { load_ae_obj_id__event_presenter } from "$lib/ae_events/ae_events__event_presenter"; import { load_ae_obj_id__event_presenter } from '$lib/ae_events/ae_events__event_presenter';
import { load_ae_obj_id__event_session } from "$lib/ae_events/ae_events__event_session"; import { load_ae_obj_id__event_session } from '$lib/ae_events/ae_events__event_session';
import { load_ae_obj_id__journal } from "$lib/ae_journals/ae_journals__journal"; import { load_ae_obj_id__journal } from '$lib/ae_journals/ae_journals__journal';
import { load_ae_obj_id__journal_entry } from "$lib/ae_journals/ae_journals__journal_entry"; import { load_ae_obj_id__journal_entry } from '$lib/ae_journals/ae_journals__journal_entry';
import { load_ae_obj_id__post } from "$lib/ae_posts/ae_posts__post"; import { load_ae_obj_id__post } from '$lib/ae_posts/ae_posts__post';
import { load_ae_obj_id__post_comment } from "$lib/ae_posts/ae_posts__post_comment"; import { load_ae_obj_id__post_comment } from '$lib/ae_posts/ae_posts__post_comment';
import { load_ae_obj_id__person } from "$lib/ae_core/core__person"; import { load_ae_obj_id__person } from '$lib/ae_core/core__person';
export async function update_ae_obj_id_crud_v2({
export async function update_ae_obj_id_crud_v2(
{
api_cfg, api_cfg,
object_type, object_type,
object_id, object_id,
@@ -220,16 +200,19 @@ export async function update_ae_obj_id_crud_v2(
new_field_value, new_field_value,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
object_type: string, object_type: string;
object_id: string, object_id: string;
object_reload?: boolean, object_reload?: boolean;
field_name: string, field_name: string;
new_field_value: any, new_field_value: any;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj_id_crud_v2() *** object_type=${object_type}, object_id=${object_id}, object_reload=${object_reload}, field_name=${field_name}, new_field_value=`, new_field_value); console.log(
`*** update_ae_obj_id_crud_v2() *** object_type=${object_type}, object_id=${object_id}, object_reload=${object_reload}, field_name=${field_name}, new_field_value=`,
new_field_value
);
} }
try { try {
@@ -244,7 +227,9 @@ export async function update_ae_obj_id_crud_v2(
}); });
if (!results) { if (!results) {
console.log(`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`); console.log(
`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`
);
return false; return false;
} }
@@ -267,7 +252,7 @@ export async function update_ae_obj_id_crud_v2(
event_presenter: load_ae_obj_id__event_presenter, event_presenter: load_ae_obj_id__event_presenter,
event_session: load_ae_obj_id__event_session, event_session: load_ae_obj_id__event_session,
post: load_ae_obj_id__post, post: load_ae_obj_id__post,
post_comment: load_ae_obj_id__post_comment, post_comment: load_ae_obj_id__post_comment
}; };
const reload_fn = reload_fns[object_type]; const reload_fn = reload_fns[object_type];
@@ -278,16 +263,13 @@ export async function update_ae_obj_id_crud_v2(
} }
return true; return true;
} catch (error) { } catch (error) {
console.log('Something went wrong patching the record.', error); console.log('Something went wrong patching the record.', error);
return false; return false;
} }
} }
export async function download_export_li({
export async function download_export_li(
{
api_cfg, api_cfg,
get_obj_type, get_obj_type,
for_obj_type, for_obj_type,
@@ -301,20 +283,19 @@ export async function download_export_li(
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
get_obj_type: string, get_obj_type: string;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
exp_alt?: null|string, exp_alt?: null | string;
file_type?: string, file_type?: string;
return_file?: boolean, return_file?: boolean;
filename?: string, filename?: string;
auto_download?: boolean, auto_download?: boolean;
limit?: number, limit?: number;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) console.log('*** download_export_li() ***'); if (log_lvl) console.log('*** download_export_li() ***');
const endpoint = `/v2/crud/${get_obj_type}/list`; const endpoint = `/v2/crud/${get_obj_type}/list`;

View File

@@ -33,8 +33,7 @@ export interface Data_Store {
* @param log_lvl - The logging level. * @param log_lvl - The logging level.
* @returns The data from the data store (e.g., text content or JSON object). * @returns The data from the data store (e.g., text content or JSON object).
*/ */
export async function load_ae_obj_by_code__data_store( export async function load_ae_obj_by_code__data_store({
{
api_cfg, api_cfg,
code, code,
data_type = 'text', data_type = 'text',
@@ -42,14 +41,13 @@ export async function load_ae_obj_by_code__data_store(
timeout = 9000, timeout = 9000,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
code: string, code: string;
data_type?: string, data_type?: string;
save_idb?: boolean, save_idb?: boolean;
timeout?: number, timeout?: number;
log_lvl?: number log_lvl?: number;
} }): Promise<any> {
): Promise<any> {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_by_code__data_store() *** code=${code}`); console.log(`*** load_ae_obj_by_code__data_store() *** code=${code}`);
} }
@@ -107,7 +105,6 @@ export async function load_ae_obj_by_code__data_store(
} }
return return_this; return return_this;
} catch (error) { } catch (error) {
console.log('*ae_func* No results returned or failed.', error); console.log('*ae_func* No results returned or failed.', error);
return null; return null;

View File

@@ -1,32 +1,30 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2024-06-14 // Updated 2024-06-14
export async function load_ae_obj_id__hosted_file( export async function load_ae_obj_id__hosted_file({
{
api_cfg, api_cfg,
hosted_file_id, hosted_file_id,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
hosted_file_id: string, hosted_file_id: string;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`); console.log(`*** load_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`);
} }
let params = {}; const params = {};
ae_promises.load__hosted_file_obj = await api.get_ae_obj_id_crud({ ae_promises.load__hosted_file_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'hosted_file', obj_type: 'hosted_file',
obj_id: hosted_file_id, // NOTE: This is the FQDN, not normally the ID. obj_id: hosted_file_id, // NOTE: This is the FQDN, not normally the ID.
@@ -38,7 +36,10 @@ export async function load_ae_obj_id__hosted_file(
.then(function (hosted_file_obj_get_result) { .then(function (hosted_file_obj_get_result) {
if (hosted_file_obj_get_result) { if (hosted_file_obj_get_result) {
// This is expecting a list // This is expecting a list
db_save_ae_obj_li__hosted_file({obj_type: 'hosted_file', obj_li: [hosted_file_obj_get_result]}); db_save_ae_obj_li__hosted_file({
obj_type: 'hosted_file',
obj_li: [hosted_file_obj_get_result]
});
return hosted_file_obj_get_result; return hosted_file_obj_get_result;
} else { } else {
console.log('No results returned.'); console.log('No results returned.');
@@ -52,10 +53,8 @@ export async function load_ae_obj_id__hosted_file(
return ae_promises.load__hosted_file_obj; return ae_promises.load__hosted_file_obj;
} }
// Updated 2024-07-03 // Updated 2024-07-03
export async function load_ae_obj_li__hosted_file( export async function load_ae_obj_li__hosted_file({
{
api_cfg, api_cfg,
for_obj_type, for_obj_type,
for_obj_id, for_obj_id,
@@ -63,30 +62,44 @@ export async function load_ae_obj_li__hosted_file(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__hosted_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__hosted_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// Check if for_obj_type is in the list of valid Aether object types: // Check if for_obj_type is in the list of valid Aether object types:
let valid_for_obj_types = ['account', 'archive', 'archive_content', 'event', 'event_session', 'event_presentation', 'event_presenter', 'event_location', 'journal', 'journal_entry', 'post', 'post_comment']; const valid_for_obj_types = [
'account',
'archive',
'archive_content',
'event',
'event_session',
'event_presentation',
'event_presenter',
'event_location',
'journal',
'journal_entry',
'post',
'post_comment'
];
if (!valid_for_obj_types.includes(for_obj_type)) { if (!valid_for_obj_types.includes(for_obj_type)) {
console.log(`Invalid for_obj_type: ${for_obj_type}`); console.log(`Invalid for_obj_type: ${for_obj_type}`);
return []; return [];
@@ -97,11 +110,12 @@ export async function load_ae_obj_li__hosted_file(
// let limit: number = (params.qry__limit ?? 99); // 99 // let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__hosted_file_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__hosted_file_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'hosted_file', obj_type: 'hosted_file',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -143,10 +157,8 @@ export async function load_ae_obj_li__hosted_file(
return ae_promises.load__hosted_file_obj_li; return ae_promises.load__hosted_file_obj_li;
} }
// Updated 2024-11-07 // Updated 2024-11-07
export async function delete_ae_obj_id__hosted_file( export async function delete_ae_obj_id__hosted_file({
{
api_cfg, api_cfg,
hosted_file_id, hosted_file_id,
link_to_type, // Ideally this should be required... link_to_type, // Ideally this should be required...
@@ -157,17 +169,16 @@ export async function delete_ae_obj_id__hosted_file(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
hosted_file_id: string, hosted_file_id: string;
link_to_type: string, link_to_type: string;
link_to_id: string, link_to_id: string;
rm_orphan?: boolean, rm_orphan?: boolean;
fake_delete?: boolean, fake_delete?: boolean;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`); console.log(`*** delete_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`);
} }
@@ -187,7 +198,8 @@ export async function delete_ae_obj_id__hosted_file(
return ae_promises.delete__hosted_file_obj; return ae_promises.delete__hosted_file_obj;
} }
ae_promises.delete__hosted_file_obj = await api.delete_object({ ae_promises.delete__hosted_file_obj = await api
.delete_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -219,21 +231,17 @@ export async function delete_ae_obj_id__hosted_file(
return ae_promises.delete__hosted_file_obj; return ae_promises.delete__hosted_file_obj;
} }
// This function will loop through the hosted_file_obj_li and save each one to the DB. // This function will loop through the hosted_file_obj_li and save each one to the DB.
// Updated 2025-01-07 // Updated 2025-01-07
export function db_save_ae_obj_li__hosted_file( export function db_save_ae_obj_li__hosted_file({
{
obj_type, obj_type,
obj_li, obj_li,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_type: string, obj_type: string;
obj_li: any, obj_li: any;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** db_save_ae_obj_li__hosted_file() ***`); console.log(`*** db_save_ae_obj_li__hosted_file() ***`);
} }
@@ -274,11 +282,11 @@ export function db_save_ae_obj_li__hosted_file(
updated_on: obj.updated_on, updated_on: obj.updated_on,
filename_no_ext: obj.filename_no_ext, filename_no_ext: obj.filename_no_ext,
filename_w_ext: obj.filename_w_ext, filename_w_ext: obj.filename_w_ext
}); });
// console.log(`Put obj with ID: ${obj.hosted_file_id_random} or ${id_random}`); // console.log(`Put obj with ID: ${obj.hosted_file_id_random} or ${id_random}`);
} catch (error) { } catch (error) {
let status = `Failed to put ${obj.hosted_file_id_random}: ${error}`; const status = `Failed to put ${obj.hosted_file_id_random}: ${error}`;
console.log(status); console.log(status);
} }
@@ -291,21 +299,18 @@ export function db_save_ae_obj_li__hosted_file(
return false; return false;
} }
// Updated 2025-01-07 // Updated 2025-01-07
export function db_update_ae_obj_id__hosted_file( export function db_update_ae_obj_id__hosted_file({
{
obj_type, obj_type,
obj_id, obj_id,
data_kv, data_kv,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_type: string, obj_type: string;
obj_id: string, obj_id: string;
data_kv: key_val, data_kv: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** db_update_ae_obj_id__hosted_file() ***`); console.log(`*** db_update_ae_obj_id__hosted_file() ***`);
} }
@@ -315,8 +320,7 @@ export function db_update_ae_obj_id__hosted_file(
try { try {
// db_core.file.update(obj_id, data_kv); // db_core.file.update(obj_id, data_kv);
db_core.file.update(obj_id, db_core.file.update(obj_id, {
{
// for_type: data_kv.for_type, // for_type: data_kv.for_type,
// for_id: data_kv.for_id_id_random, // for_id: data_kv.for_id_id_random,
// for_id_random: data_kv.for_id_random, // for_id_random: data_kv.for_id_random,
@@ -336,16 +340,15 @@ export function db_update_ae_obj_id__hosted_file(
// updated_on: data_kv.updated_on, // updated_on: data_kv.updated_on,
filename_no_ext: data_kv.filename_no_ext, filename_no_ext: data_kv.filename_no_ext,
filename_w_ext: data_kv.filename_w_ext, filename_w_ext: data_kv.filename_w_ext
// hosted_file_content_type: data_kv.hosted_file_content_type, // hosted_file_content_type: data_kv.hosted_file_content_type,
// file_size: data_kv.file_size, // file_size: data_kv.file_size,
// hosted_file_size: data_kv.hosted_file_size, // hosted_file_size: data_kv.hosted_file_size,
} });
);
console.log(`Update obj with ID: ${obj_id}`); console.log(`Update obj with ID: ${obj_id}`);
} catch (error) { } catch (error) {
let status = `Failed to update ${obj_id}: ${error}`; const status = `Failed to update ${obj_id}: ${error}`;
console.log(status); console.log(status);
} }

View File

@@ -7,7 +7,11 @@ import type { Dexie, Table } from 'dexie';
* @param log_lvl The logging level. * @param log_lvl The logging level.
* @returns The found ID, or undefined if no ID could be found. * @returns The found ID, or undefined if no ID could be found.
*/ */
function find_object_id(obj: any, table_name: string, log_lvl: number): string | number | undefined { function find_object_id(
obj: any,
table_name: string,
log_lvl: number
): string | number | undefined {
const potential_keys = ['id', `${table_name}_id`, `${table_name}_id_random`]; const potential_keys = ['id', `${table_name}_id`, `${table_name}_id_random`];
for (const key of potential_keys) { for (const key of potential_keys) {

View File

@@ -1,33 +1,31 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-06-10 // Updated 2025-06-10
export async function load_ae_obj_id__person( export async function load_ae_obj_id__person({
{
api_cfg, api_cfg,
person_id, person_id,
params = {}, params = {},
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
person_id: string, person_id: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__person() *** person_id=${person_id}`); console.log(`*** load_ae_obj_id__person() *** person_id=${person_id}`);
} }
ae_promises.load__person_obj = await api.get_ae_obj_id_crud({ ae_promises.load__person_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'person', obj_type: 'person',
obj_id: person_id, obj_id: person_id,
@@ -40,9 +38,9 @@ export async function load_ae_obj_id__person(
if (person_obj_get_result) { if (person_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__person_props({ const processed_obj_li = await process_ae_obj__person_props({
obj_li: [person_obj_get_result], obj_li: [person_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -56,7 +54,7 @@ export async function load_ae_obj_id__person(
table_name: 'person', table_name: 'person',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -86,10 +84,8 @@ export async function load_ae_obj_id__person(
return ae_promises.load__person_obj; return ae_promises.load__person_obj;
} }
// Updated 2025-06-10 // Updated 2025-06-10
export async function load_ae_obj_li__person( export async function load_ae_obj_li__person({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -99,46 +95,51 @@ export async function load_ae_obj_li__person(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = [{'family_name': 'ASC'}, {'given_name': 'ASC'}, {'updated_on': 'DESC'}, {'created_on': 'DESC'}], order_by_li = [
{ family_name: 'ASC' },
{ given_name: 'ASC' },
{ updated_on: 'DESC' },
{ created_on: 'DESC' }
],
// params_json = {}, // params_json = {},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
qry_email?: string|null, qry_email?: string | null;
qry_user_id?: string|null, qry_user_id?: string | null;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: { [key: string]: "ASC" | "DESC" }[] | null, order_by_li?: { [key: string]: 'ASC' | 'DESC' }[] | null;
// params_json?: null|key_val, // params_json?: null|key_val,
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__person() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id} enabled=${enabled} hidden=${hidden} limit=${limit} offset=${offset}`); console.log(
`*** load_ae_obj_li__person() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id} enabled=${enabled} hidden=${hidden} limit=${limit} offset=${offset}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
if (qry_user_id) { if (qry_user_id) {
// params_json['and_qry'] = {}; // params_json['and_qry'] = {};
// params_json['and_qry']['user_id_random'] = qry_user_id; // params_json['and_qry']['user_id_random'] = qry_user_id;
params_json['qry'] = [] params_json['qry'] = [];
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'user_id_random',
field: "user_id_random", operator: '=',
operator: "=",
value: qry_user_id value: qry_user_id
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
@@ -148,7 +149,8 @@ export async function load_ae_obj_li__person(
console.log('params_json:', params_json); console.log('params_json:', params_json);
} }
ae_promises.load__person_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__person_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'person', obj_type: 'person',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -169,9 +171,9 @@ export async function load_ae_obj_li__person(
if (person_obj_li_get_result) { if (person_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__person_props({ const processed_obj_li = await process_ae_obj__person_props({
obj_li: person_obj_li_get_result, obj_li: person_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -185,7 +187,7 @@ export async function load_ae_obj_li__person(
table_name: 'person', table_name: 'person',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -210,10 +212,8 @@ export async function load_ae_obj_li__person(
return ae_promises.load__person_obj_li; return ae_promises.load__person_obj_li;
} }
// Updated 2025-06-10 // Updated 2025-06-10
export async function create_ae_obj__person( export async function create_ae_obj__person({
{
api_cfg, api_cfg,
user_id, user_id,
data_kv, data_kv,
@@ -221,19 +221,19 @@ export async function create_ae_obj__person(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
user_id?: string, user_id?: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__person() *** user_id=${user_id}`); console.log(`*** create_ae_obj__person() *** user_id=${user_id}`);
} }
ae_promises.create__person = await api.create_ae_obj_crud({ ae_promises.create__person = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'person', obj_type: 'person',
fields: { fields: {
@@ -249,9 +249,9 @@ export async function create_ae_obj__person(
if (person_obj_create_result) { if (person_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__person_props({ const processed_obj_li = await process_ae_obj__person_props({
obj_li: [person_obj_create_result], obj_li: [person_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -265,7 +265,7 @@ export async function create_ae_obj__person(
table_name: 'person', table_name: 'person',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -286,8 +286,7 @@ export async function create_ae_obj__person(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__person:', ae_promises.create__person); console.log('ae_promises.create__person:', ae_promises.create__person);
@@ -295,10 +294,8 @@ export async function create_ae_obj__person(
return ae_promises.create__person; return ae_promises.create__person;
} }
// Updated 2025-05-10 // Updated 2025-05-10
export async function delete_ae_obj_id__person( export async function delete_ae_obj_id__person({
{
api_cfg, api_cfg,
person_id, person_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -306,19 +303,19 @@ export async function delete_ae_obj_id__person(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
person_id: string, person_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__person() *** person_id=${person_id}`); console.log(`*** delete_ae_obj_id__person() *** person_id=${person_id}`);
} }
ae_promises.delete__person_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__person_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'person', obj_type: 'person',
obj_id: person_id, obj_id: person_id,
@@ -346,10 +343,8 @@ export async function delete_ae_obj_id__person(
return ae_promises.delete__person_obj; return ae_promises.delete__person_obj;
} }
// Updated 2025-06-10 // Updated 2025-06-10
export async function update_ae_obj__person( export async function update_ae_obj__person({
{
api_cfg, api_cfg,
person_id, person_id,
data_kv, data_kv,
@@ -357,14 +352,13 @@ export async function update_ae_obj__person(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
person_id: string, person_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__person() *** person_id=${person_id}`, data_kv); console.log(`*** update_ae_obj__person() *** person_id=${person_id}`, data_kv);
} }
@@ -387,9 +381,9 @@ export async function update_ae_obj__person(
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__person_props({ const processed_obj_li = await process_ae_obj__person_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -403,7 +397,7 @@ export async function update_ae_obj__person(
table_name: 'person', table_name: 'person',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -422,19 +416,16 @@ export async function update_ae_obj__person(
} }
} }
// Updated 2024-06-10 // Updated 2024-06-10
export function db_save_ae_obj_li__person( export function db_save_ae_obj_li__person({
{
obj_type, obj_type,
obj_li, obj_li,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_type: string, obj_type: string;
obj_li: any, obj_li: any;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** db_save_ae_obj_li__person() ***`); console.log(`*** db_save_ae_obj_li__person() ***`);
} }
@@ -445,7 +436,7 @@ export function db_save_ae_obj_li__person(
console.log(`ae_obj ${obj_type}:`, obj); console.log(`ae_obj ${obj_type}:`, obj);
} }
let obj_record = { const obj_record = {
id: obj.person_id_random, id: obj.person_id_random,
// id_random: obj.person_id_random, // id_random: obj.person_id_random,
person_id: obj.person_id_random, person_id: obj.person_id_random,
@@ -509,7 +500,7 @@ export function db_save_ae_obj_li__person(
user_super: obj.user_super, user_super: obj.user_super,
user_manager: obj.user_manager, user_manager: obj.user_manager,
user_administrator: obj.user_administrator, user_administrator: obj.user_administrator,
user_public: obj.user_public, user_public: obj.user_public
}; };
let id_random = null; let id_random = null;
@@ -546,10 +537,8 @@ export function db_save_ae_obj_li__person(
} }
} }
// Updated 2025-06-10 // Updated 2025-06-10
let properties_to_save = [ const properties_to_save = [
'id', 'id',
'person_id', 'person_id',
// 'person_id_random', // 'person_id_random',
@@ -646,10 +635,9 @@ let properties_to_save = [
'address_id', 'address_id',
// 'address_id_random', // 'address_id_random',
'address_city', 'address_city',
'address_country_alpha_2_code', // contact_address_country_alpha_2_code 'address_country_alpha_2_code' // contact_address_country_alpha_2_code
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -718,7 +706,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-06-10 // Updated 2025-06-10
export async function process_ae_obj__person_props({ export async function process_ae_obj__person_props({
obj_li, obj_li,

View File

@@ -1,16 +1,15 @@
import QRCode from 'qrcode' import QRCode from 'qrcode';
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {}; const ae_promises: key_val = {};
// I recently made significant updates to this with the help of Copilot. I think it is correct. // I recently made significant updates to this with the help of Copilot. I think it is correct.
// Updated 2025-10-03 // Updated 2025-10-03
export async function generate_qr_code( export async function generate_qr_code({
{
api_cfg, api_cfg,
account_id, account_id,
qr_type, // mecard, obj, str, vcard qr_type, // mecard, obj, str, vcard
@@ -23,32 +22,31 @@ export async function generate_qr_code(
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
qr_type: string, qr_type: string;
qr_id: string, qr_id: string;
qr_data?: any, qr_data?: any;
obj_type?: string, obj_type?: string;
obj_id?: string, obj_id?: string;
str?: string, str?: string;
return_blob?: boolean, return_blob?: boolean;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** generate_qr_code() *** qr_id=${qr_id}`); console.log(`*** generate_qr_code() *** qr_id=${qr_id}`);
} }
let endpoint = `/qr/${account_id}/${qr_id}`; const endpoint = `/qr/${account_id}/${qr_id}`;
if (log_lvl) { if (log_lvl) {
console.log('Endpoint', endpoint); console.log('Endpoint', endpoint);
} }
let params: key_val = { const params: key_val = {
'regen': true, // Regenerate the file even if nothing has changed. regen: true, // Regenerate the file even if nothing has changed.
'return_file': return_blob, return_file: return_blob,
'qr_type': qr_type, // mecard, obj, vcard qr_type: qr_type, // mecard, obj, vcard
'qr_send': return_blob qr_send: return_blob
}; };
if (qr_type == 'vcard') { if (qr_type == 'vcard') {
@@ -58,11 +56,17 @@ export async function generate_qr_code(
params['n'] = `${qr_data.family_name};${qr_data.given_name}`; params['n'] = `${qr_data.family_name};${qr_data.given_name}`;
} }
params['fn'] = qr_data.full_name_override; params['fn'] = qr_data.full_name_override;
if (qr_data.affiliations) { params['org'] = qr_data.affiliations; } if (qr_data.affiliations) {
params['org'] = qr_data.affiliations;
}
params['email'] = qr_data.email; params['email'] = qr_data.email;
if (qr_data.phone) { params['tel'] = qr_data.phone; } if (qr_data.phone) {
params['tel'] = qr_data.phone;
}
params['adr'] = qr_data.location_override; params['adr'] = qr_data.location_override;
if (qr_data.address_line_1) { params['adr_str'] = qr_data.address_line_1; } if (qr_data.address_line_1) {
params['adr_str'] = qr_data.address_line_1;
}
params['adr_loc'] = qr_data.city; params['adr_loc'] = qr_data.city;
params['adr_reg'] = qr_data.state_province; params['adr_reg'] = qr_data.state_province;
params['adr_postal'] = qr_data.postal_code; params['adr_postal'] = qr_data.postal_code;
@@ -78,7 +82,7 @@ export async function generate_qr_code(
console.log('Params', params); console.log('Params', params);
} }
let filename = null; const filename = null;
// Await the API call // Await the API call
ae_promises.generate_qr_code = await api.get_object({ ae_promises.generate_qr_code = await api.get_object({
@@ -97,7 +101,7 @@ export async function generate_qr_code(
// If return_blob is true, ensure we return an object URL for use in <img src=...> // If return_blob is true, ensure we return an object URL for use in <img src=...>
if (return_blob) { if (return_blob) {
let data = ae_promises.generate_qr_code.data ?? ae_promises.generate_qr_code; const data = ae_promises.generate_qr_code.data ?? ae_promises.generate_qr_code;
// If already a Blob, use it directly // If already a Blob, use it directly
if (data instanceof Blob) { if (data instanceof Blob) {
@@ -112,26 +116,26 @@ export async function generate_qr_code(
// If it's an ArrayBuffer or Uint8Array, convert to Blob // If it's an ArrayBuffer or Uint8Array, convert to Blob
if (data instanceof ArrayBuffer || data instanceof Uint8Array) { if (data instanceof ArrayBuffer || data instanceof Uint8Array) {
const blob = new Blob([data], { type: "image/png" }); const blob = new Blob([data], { type: 'image/png' });
return URL.createObjectURL(blob); return URL.createObjectURL(blob);
} }
// If it's a base64 string, return as data URL // If it's a base64 string, return as data URL
if (typeof data === "string" && data.startsWith("data:image")) { if (typeof data === 'string' && data.startsWith('data:image')) {
return data; return data;
} }
// If it's a raw string (base64), convert to data URL // If it's a raw string (base64), convert to data URL
if (typeof data === "string") { if (typeof data === 'string') {
return `data:image/png;base64,${data}`; return `data:image/png;base64,${data}`;
} }
// Fallback: try to create a Blob from whatever is left // Fallback: try to create a Blob from whatever is left
try { try {
const blob = new Blob([data], { type: "image/png" }); const blob = new Blob([data], { type: 'image/png' });
return URL.createObjectURL(blob); return URL.createObjectURL(blob);
} catch (e) { } catch (e) {
if (log_lvl) console.error("Could not create QR code image blob:", e, data); if (log_lvl) console.error('Could not create QR code image blob:', e, data);
return null; return null;
} }
} }
@@ -140,7 +144,6 @@ export async function generate_qr_code(
return ae_promises.generate_qr_code; return ae_promises.generate_qr_code;
} }
// Updated 2025-10-09 // Updated 2025-10-09
/** /**
* Generates a QR code image as a Base64 data URL based on provided parameters. * Generates a QR code image as a Base64 data URL based on provided parameters.
@@ -157,9 +160,25 @@ export async function generate_qr_code(
*/ */
export async function js_generate_qr_code(qr_type, params = {}) { export async function js_generate_qr_code(qr_type, params = {}) {
const { const {
n = '', fn = '', org = '', url = '', email = '', tel = '', n = '',
adr_poa = '', adr_ext = '', adr_str = '', adr_loc = '', adr_reg = '', adr_postal = '', adr_country = '', fn = '',
obj_type, obj_id, key, val, js, str org = '',
url = '',
email = '',
tel = '',
adr_poa = '',
adr_ext = '',
adr_str = '',
adr_loc = '',
adr_reg = '',
adr_postal = '',
adr_country = '',
obj_type,
obj_id,
key,
val,
js,
str
} = params; } = params;
console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params); console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params);
@@ -179,8 +198,12 @@ export async function js_generate_qr_code(qr_type, params = {}) {
// Format: BEGIN:VCARD...END:VCARD // Format: BEGIN:VCARD...END:VCARD
qr_data = `BEGIN:VCARD\nVERSION:3.0\nN:${n}\nFN:${fn}\nORG:${org}\nEMAIL:${email}\n`; qr_data = `BEGIN:VCARD\nVERSION:3.0\nN:${n}\nFN:${fn}\nORG:${org}\nEMAIL:${email}\n`;
if (url) { qr_data += `URL:${url}\n`; } if (url) {
if (tel) { qr_data += `TEL:${tel}\n`; } qr_data += `URL:${url}\n`;
}
if (tel) {
qr_data += `TEL:${tel}\n`;
}
if (adr_loc) { if (adr_loc) {
// ADR format: TYPE=postal:Po box;Ext;Street;Locality;Region;Postal code;Country // ADR format: TYPE=postal:Po box;Ext;Street;Locality;Region;Postal code;Country
qr_data += `ADR:${adr_poa};${adr_ext};${adr_str};${adr_loc};${adr_reg};${adr_postal};${adr_country}\n`; qr_data += `ADR:${adr_poa};${adr_ext};${adr_str};${adr_loc};${adr_reg};${adr_postal};${adr_country}\n`;
@@ -229,7 +252,7 @@ export async function js_generate_qr_code(qr_type, params = {}) {
errorCorrectionLevel: 'M', errorCorrectionLevel: 'M',
margin: 1, // Corresponds to border margin: 1, // Corresponds to border
scale: 10, // Corresponds to box_size scale: 10, // Corresponds to box_size
type: 'image/png', type: 'image/png'
}); });
console.log('Generated QR code data URL:', data_url); console.log('Generated QR code data URL:', data_url);
return data_url; return data_url;

View File

@@ -41,7 +41,7 @@ export interface Site {
enable_to?: null | Date; enable_to?: null | Date;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;

View File

@@ -11,7 +11,7 @@ export interface Site_Domain {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -30,21 +30,21 @@ export interface Site_Domain {
* @param log_lvl - The logging level. * @param log_lvl - The logging level.
* @returns The site domain object or null if not found. * @returns The site domain object or null if not found.
*/ */
export async function load_ae_obj_by_fqdn__site_domain( export async function load_ae_obj_by_fqdn__site_domain({
{
api_cfg, api_cfg,
fqdn, fqdn,
timeout = 7000, timeout = 7000,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
fqdn: string, fqdn: string;
timeout?: number, timeout?: number;
log_lvl?: number log_lvl?: number;
} }): Promise<any> {
): Promise<any> {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_by_fqdn__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}`); console.log(
`*** load_ae_obj_by_fqdn__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}`
);
} }
const params = {}; const params = {};
@@ -73,4 +73,3 @@ export interface Site_Domain {
return null; return null;
} }
} }

View File

@@ -1,14 +1,12 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2024-10-14 // Updated 2024-10-14
export async function load_ae_obj_li__time_zone( export async function load_ae_obj_li__time_zone({
{
api_cfg, api_cfg,
// account_id, // account_id,
enabled = 'enabled', enabled = 'enabled',
@@ -16,32 +14,32 @@ export async function load_ae_obj_li__time_zone(
limit = 99, limit = 99,
offset = 0, offset = 0,
// order_by_li = {'priority': 'DESC', 'group': 'ASC', 'sort': 'DESC', 'name': 'ASC'}, // order_by_li = {'priority': 'DESC', 'group': 'ASC', 'sort': 'DESC', 'name': 'ASC'},
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC'}, order_by_li = { priority: 'DESC', sort: 'DESC', name: 'ASC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
// account_id: string, // account_id: string,
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__time_zone() ***`); console.log(`*** load_ae_obj_li__time_zone() ***`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__time_zone_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__time_zone_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'lu', obj_type: 'lu',
for_obj_type: 'time_zone', for_obj_type: 'time_zone',

View File

@@ -1,14 +1,12 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_core } from "$lib/ae_core/db_core"; import { db_core } from '$lib/ae_core/db_core';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-04-04 // Updated 2025-04-04
export async function auth_ae_obj__username_password( export async function auth_ae_obj__username_password({
{
api_cfg, api_cfg,
account_id, account_id,
null_account_id = false, null_account_id = false,
@@ -18,21 +16,22 @@ export async function auth_ae_obj__username_password(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
null_account_id?: boolean, null_account_id?: boolean;
username: string, username: string;
password: string, password: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** auth_ae_obj__username_password() *** account_id=${account_id} username=${username} password=${password}`); console.log(
`*** auth_ae_obj__username_password() *** account_id=${account_id} username=${username} password=${password}`
);
} }
let endpoint = '/user/authenticate'; const endpoint = '/user/authenticate';
if (null_account_id) { if (null_account_id) {
params['null_account_id'] = true; params['null_account_id'] = true;
@@ -43,7 +42,8 @@ export async function auth_ae_obj__username_password(
console.log(`auth_ae_obj__username_password() - params:`, params); console.log(`auth_ae_obj__username_password() - params:`, params);
} }
ae_promises.auth__username_password = await api.get_object({ ae_promises.auth__username_password = await api
.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -70,18 +70,14 @@ export async function auth_ae_obj__username_password(
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.auth__username_password:', ae_promises.auth__username_password); console.log('ae_promises.auth__username_password:', ae_promises.auth__username_password);
} }
return ae_promises.auth__username_password; return ae_promises.auth__username_password;
} }
// Updated 2025-04-04 // Updated 2025-04-04
export async function auth_ae_obj__user_id_user_auth_key( export async function auth_ae_obj__user_id_user_auth_key({
{
api_cfg, api_cfg,
account_id, account_id,
user_id, user_id,
@@ -90,20 +86,21 @@ export async function auth_ae_obj__user_id_user_auth_key(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
user_id: string, user_id: string;
user_auth_key: string, user_auth_key: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** auth_ae_obj__user_id_user_auth_key() *** account_id=${account_id} user_id=${user_id}`); console.log(
`*** auth_ae_obj__user_id_user_auth_key() *** account_id=${account_id} user_id=${user_id}`
);
} }
let endpoint = '/user/authenticate'; const endpoint = '/user/authenticate';
params['user_id'] = user_id; // Required params['user_id'] = user_id; // Required
params['auth_key'] = user_auth_key; // Required params['auth_key'] = user_auth_key; // Required
@@ -111,7 +108,8 @@ export async function auth_ae_obj__user_id_user_auth_key(
console.log(`auth_ae_obj__user_id_user_auth_key() - params:`, params); console.log(`auth_ae_obj__user_id_user_auth_key() - params:`, params);
} }
ae_promises.auth__user_id_user_key = await api.get_object({ ae_promises.auth__user_id_user_key = await api
.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -135,11 +133,9 @@ export async function auth_ae_obj__user_id_user_auth_key(
return ae_promises.auth__user_id_user_key; return ae_promises.auth__user_id_user_key;
} }
// Send an email to the user with a new one time use authentication key. The new key must be generated and returned first. // Send an email to the user with a new one time use authentication key. The new key must be generated and returned first.
// Updated 2025-04-08 // Updated 2025-04-08
export async function send_email_auth_ae_obj__user_id( export async function send_email_auth_ae_obj__user_id({
{
api_cfg, api_cfg,
account_id, account_id,
user_id, user_id,
@@ -149,28 +145,29 @@ export async function send_email_auth_ae_obj__user_id(
// try_cache = true, // try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
user_id: string, user_id: string;
base_url?: string, base_url?: string;
key_param_name?: string, key_param_name?: string;
params?: key_val, params?: key_val;
// try_cache?: boolean, // try_cache?: boolean,
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** send_email_auth_ae_obj__user_id() *** account_id=${account_id} user_id=${user_id}`); console.log(
`*** send_email_auth_ae_obj__user_id() *** account_id=${account_id} user_id=${user_id}`
);
} }
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(api_cfg); console.log(api_cfg);
} }
let email_auth_key_endpoint = `user/${user_id}/email_auth_key_url`; const email_auth_key_endpoint = `user/${user_id}/email_auth_key_url`;
params = { params = {
'root_url': base_url, root_url: base_url,
'key_param_name': key_param_name key_param_name: key_param_name
} };
ae_promises.auth_key__send_email = await api.get_object({ ae_promises.auth_key__send_email = await api.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: email_auth_key_endpoint, endpoint: email_auth_key_endpoint,
@@ -224,8 +221,7 @@ export async function send_email_auth_ae_obj__user_id(
// Look up user based on email address provided // Look up user based on email address provided
// Updated 2025-04-08 // Updated 2025-04-08
export async function qry_ae_obj_li__user_email( export async function qry_ae_obj_li__user_email({
{
api_cfg, api_cfg,
account_id, account_id,
null_account_id = false, null_account_id = false,
@@ -234,20 +230,19 @@ export async function qry_ae_obj_li__user_email(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
null_account_id?: boolean, null_account_id?: boolean;
email: string, email: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** qry_ae_obj_li__user_email() *** account_id=${account_id} email=${email}`); console.log(`*** qry_ae_obj_li__user_email() *** account_id=${account_id} email=${email}`);
} }
let endpoint = '/user/lookup_email'; const endpoint = '/user/lookup_email';
params['email'] = email; // Required params['email'] = email; // Required
params['null_account_id'] = null_account_id || false; params['null_account_id'] = null_account_id || false;
@@ -255,7 +250,8 @@ export async function qry_ae_obj_li__user_email(
console.log(`qry_ae_obj_li__user_email() - params:`, params); console.log(`qry_ae_obj_li__user_email() - params:`, params);
} }
ae_promises.qry__user_email = await api.get_object({ ae_promises.qry__user_email = await api
.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -279,14 +275,12 @@ export async function qry_ae_obj_li__user_email(
return ae_promises.qry__user_email; return ae_promises.qry__user_email;
} }
// Change user password // Change user password
// endpoint: PATCH /user/{user_id}/change_password // endpoint: PATCH /user/{user_id}/change_password
// params: // params:
// data_kv: password (the new password) // data_kv: password (the new password)
// Updated 2025-04-11 // Updated 2025-04-11
export async function auth_ae_obj__user_id_change_password( export async function auth_ae_obj__user_id_change_password({
{
api_cfg, api_cfg,
account_id, account_id,
user_id, user_id,
@@ -294,26 +288,28 @@ export async function auth_ae_obj__user_id_change_password(
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
user_id: string, user_id: string;
password: string, password: string;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** auth_ae_obj__user_id_change_password() *** account_id=${account_id} user_id=${user_id}`); console.log(
`*** auth_ae_obj__user_id_change_password() *** account_id=${account_id} user_id=${user_id}`
);
} }
let endpoint = `/user/${user_id}/change_password`; const endpoint = `/user/${user_id}/change_password`;
params['user_id'] = user_id; // Required params['user_id'] = user_id; // Required
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(`auth_ae_obj__user_id_change_password() - params:`, params); console.log(`auth_ae_obj__user_id_change_password() - params:`, params);
} }
ae_promises.change_password__user_id = await api.patch_object({ ae_promises.change_password__user_id = await api
.patch_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,

View File

@@ -25,7 +25,7 @@ export interface File {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -37,7 +37,6 @@ export interface File {
filename_w_ext: string; filename_w_ext: string;
} }
// Updated 2024-07-17 // Updated 2024-07-17
export interface Person { export interface Person {
id: string; id: string;
@@ -88,7 +87,7 @@ export interface Person {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -133,7 +132,6 @@ export interface Person {
address_country_alpha_2_code?: null | string; // ISO 3166-1 alpha-2 country code address_country_alpha_2_code?: null | string; // ISO 3166-1 alpha-2 country code
} }
// Updated 2025-01-07 // Updated 2025-01-07
export class MySubClassedDexie extends Dexie { export class MySubClassedDexie extends Dexie {
file!: Table<File>; file!: Table<File>;
@@ -162,7 +160,7 @@ export class MySubClassedDexie extends Dexie {
given_name, family_name, given_name, family_name,
full_name, affiliations, email, full_name, affiliations, email,
agree, agree,
enable, hide, priority, sort, group, created_on, updated_on`, enable, hide, priority, sort, group, created_on, updated_on`
}); });
} }
} }

View File

@@ -9,12 +9,10 @@ import { load_ae_obj_li__event_location } from './ae_events__event_location';
import { load_ae_obj_li__event_session } from './ae_events__event_session'; import { load_ae_obj_li__event_session } from './ae_events__event_session';
import { load_ae_obj_li__event_badge_template } from '$lib/ae_events/ae_events__event_badge_template'; import { load_ae_obj_li__event_badge_template } from '$lib/ae_events/ae_events__event_badge_template';
let ae_promises: key_val = {}; const ae_promises: key_val = {};
// Updated 2025-05-22 // Updated 2025-05-22
export async function load_ae_obj_id__event( export async function load_ae_obj_id__event({
{
api_cfg, api_cfg,
event_id, event_id,
inc_device_li = false, inc_device_li = false,
@@ -28,27 +26,27 @@ export async function load_ae_obj_id__event(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
inc_device_li?: boolean, inc_device_li?: boolean;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_location_li?: boolean, inc_location_li?: boolean;
inc_presentation_li?: boolean, inc_presentation_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
inc_session_li?: boolean, inc_session_li?: boolean;
inc_badge_li?: boolean, inc_badge_li?: boolean;
inc_template_li?: boolean, inc_template_li?: boolean;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event() *** event_id=${event_id}`); console.log(`*** load_ae_obj_id__event() *** event_id=${event_id}`);
} }
let params = {}; const params = {};
ae_promises.load__event_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event', obj_type: 'event',
obj_id: event_id, obj_id: event_id,
@@ -61,9 +59,9 @@ export async function load_ae_obj_id__event(
if (event_obj_get_result) { if (event_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_props({ const processed_obj_li = await process_ae_obj__event_props({
obj_li: [event_obj_get_result], obj_li: [event_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -77,7 +75,7 @@ export async function load_ae_obj_id__event(
table_name: 'event', table_name: 'event',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -102,7 +100,7 @@ export async function load_ae_obj_id__event(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the device list for the event now`); console.log(`Need to load the device list for the event now`);
} }
let load_event_device_obj_li = load_ae_obj_li__event_device({ const load_event_device_obj_li = load_ae_obj_li__event_device({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event', for_obj_type: 'event',
for_obj_id: event_id, for_obj_id: event_id,
@@ -116,7 +114,6 @@ export async function load_ae_obj_id__event(
return event_device_obj_li; return event_device_obj_li;
}); });
if (log_lvl) { if (log_lvl) {
console.log(`load_event_device_obj_li = `, load_event_device_obj_li); console.log(`load_event_device_obj_li = `, load_event_device_obj_li);
} }
@@ -128,7 +125,7 @@ export async function load_ae_obj_id__event(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the location list for the event now`); console.log(`Need to load the location list for the event now`);
} }
let load_event_location_obj_li = load_ae_obj_li__event_location({ const load_event_location_obj_li = load_ae_obj_li__event_location({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event', for_obj_type: 'event',
for_obj_id: event_id, for_obj_id: event_id,
@@ -153,7 +150,7 @@ export async function load_ae_obj_id__event(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the session list for the event now`); console.log(`Need to load the session list for the event now`);
} }
let load_event_session_obj_li = load_ae_obj_li__event_session({ const load_event_session_obj_li = load_ae_obj_li__event_session({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event', for_obj_type: 'event',
for_obj_id: event_id, for_obj_id: event_id,
@@ -180,7 +177,7 @@ export async function load_ae_obj_id__event(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the badge template list for the event now`); console.log(`Need to load the badge template list for the event now`);
} }
let load_event_badge_template_obj_li = load_ae_obj_li__event_badge_template({ const load_event_badge_template_obj_li = load_ae_obj_li__event_badge_template({
api_cfg: api_cfg, api_cfg: api_cfg,
// for_obj_type: 'event', // for_obj_type: 'event',
// for_obj_id: event_id, // for_obj_id: event_id,
@@ -204,10 +201,8 @@ export async function load_ae_obj_id__event(
return ae_promises.load__event_obj; return ae_promises.load__event_obj;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function load_ae_obj_li__event( export async function load_ae_obj_li__event({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -223,36 +218,37 @@ export async function load_ae_obj_li__event(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { start_datetime: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' },
params_json = null, params_json = null,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
qry_conference?: null|boolean, qry_conference?: null | boolean;
qry_str?: null|string, qry_str?: null | string;
inc_device_li?: boolean, inc_device_li?: boolean;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_location_li?: boolean, inc_location_li?: boolean;
inc_presentation_li?: boolean, inc_presentation_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
inc_session_li?: boolean, inc_session_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params_json?: null|key_val, params_json?: null | key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id} qry_conference=${qry_conference}`); console.log(
`*** load_ae_obj_li__event() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id} qry_conference=${qry_conference}`
);
} }
// There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01 // There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01
@@ -290,7 +286,8 @@ export async function load_ae_obj_li__event(
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__event_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event', obj_type: 'event',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -310,9 +307,9 @@ export async function load_ae_obj_li__event(
if (event_obj_li_get_result) { if (event_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_props({ const processed_obj_li = await process_ae_obj__event_props({
obj_li: event_obj_li_get_result, obj_li: event_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -326,7 +323,7 @@ export async function load_ae_obj_li__event(
table_name: 'event', table_name: 'event',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -351,18 +348,17 @@ export async function load_ae_obj_li__event(
console.log(`Need to load the device list for each event now`); console.log(`Need to load the device list for each event now`);
} }
for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) {
let event_obj = ae_promises.load__event_obj_li[i]; const event_obj = ae_promises.load__event_obj_li[i];
let event_id = event_obj.event_id_random; const event_id = event_obj.event_id_random;
let load_event_device_obj_li = load_ae_obj_li__event_device({ const load_event_device_obj_li = load_ae_obj_li__event_device({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event', for_obj_type: 'event',
for_obj_id: event_id, for_obj_id: event_id,
params: { qry__enabled: 'enabled', qry__limit: 49 }, params: { qry__enabled: 'enabled', qry__limit: 49 },
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_device_obj_li) => {
.then((event_device_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_device_obj_li = `, event_device_obj_li); console.log(`event_device_obj_li = `, event_device_obj_li);
} }
@@ -386,10 +382,10 @@ export async function load_ae_obj_li__event(
console.log(`Need to load the location list for each event now`); console.log(`Need to load the location list for each event now`);
} }
for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) {
let event_obj = ae_promises.load__event_obj_li[i]; const event_obj = ae_promises.load__event_obj_li[i];
let event_id = event_obj.event_id_random; const event_id = event_obj.event_id_random;
let load_event_location_obj_li = load_ae_obj_li__event_location({ const load_event_location_obj_li = load_ae_obj_li__event_location({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event', for_obj_type: 'event',
for_obj_id: event_id, for_obj_id: event_id,
@@ -397,8 +393,7 @@ export async function load_ae_obj_li__event(
limit: 19, limit: 19,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_location_obj_li) => {
.then((event_location_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_location_obj_li = `, event_location_obj_li); console.log(`event_location_obj_li = `, event_location_obj_li);
} }
@@ -422,10 +417,10 @@ export async function load_ae_obj_li__event(
console.log(`Need to load the session list for each event now`); console.log(`Need to load the session list for each event now`);
} }
for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_obj_li.length; i++) {
let event_obj = ae_promises.load__event_obj_li[i]; const event_obj = ae_promises.load__event_obj_li[i];
let event_id = event_obj.event_id_random; const event_id = event_obj.event_id_random;
let load_event_session_obj_li = load_ae_obj_li__event_session({ const load_event_session_obj_li = load_ae_obj_li__event_session({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event', for_obj_type: 'event',
for_obj_id: event_id, for_obj_id: event_id,
@@ -437,8 +432,7 @@ export async function load_ae_obj_li__event(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_session_obj_li) => {
.then((event_session_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_session_obj_li = `, event_session_obj_li); console.log(`event_session_obj_li = `, event_session_obj_li);
} }
@@ -459,12 +453,9 @@ export async function load_ae_obj_li__event(
return ae_promises.load__event_obj_li; return ae_promises.load__event_obj_li;
} }
// The qry_ae_obj_li__event() is essentially a wrapper for the load_ae_obj_li__event() function. This should process the query strings and related before calling the load_ae_obj_li__event() function. // The qry_ae_obj_li__event() is essentially a wrapper for the load_ae_obj_li__event() function. This should process the query strings and related before calling the load_ae_obj_li__event() function.
// Updated 2024-10-01 // Updated 2024-10-01
export async function qry_ae_obj_li__event( export async function qry_ae_obj_li__event({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -482,40 +473,41 @@ export async function qry_ae_obj_li__event(
hidden = 'not_hidden', // all, hidden, not_hidden hidden = 'not_hidden', // all, hidden, not_hidden
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { start_datetime: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
qry_conference?: null|boolean, qry_conference?: null | boolean;
qry_physical?: null|boolean, qry_physical?: null | boolean;
qry_virtual?: null|boolean, qry_virtual?: null | boolean;
qry_type?: null|string, qry_type?: null | string;
qry_str?: null|string, qry_str?: null | string;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_location_li?: boolean, inc_location_li?: boolean;
inc_presentation_li?: boolean, inc_presentation_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
inc_session_li?: boolean, inc_session_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** qry_ae_obj_li__event() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** qry_ae_obj_li__event() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// Build the params_json object. This needs to be documented better! -2024-10-01 // Build the params_json object. This needs to be documented better! -2024-10-01
let params_json: key_val = {}; const params_json: key_val = {};
params_json['and_qry'] = {}; params_json['and_qry'] = {};
@@ -578,10 +570,8 @@ export async function qry_ae_obj_li__event(
return ae_promises.qry__event_obj_li; return ae_promises.qry__event_obj_li;
} }
// Updated 2025-07-11 // Updated 2025-07-11
export async function create_ae_obj__event( export async function create_ae_obj__event({
{
api_cfg, api_cfg,
account_id, account_id,
data_kv, data_kv,
@@ -589,14 +579,13 @@ export async function create_ae_obj__event(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event() *** account_id=${account_id}`); console.log(`*** create_ae_obj__event() *** account_id=${account_id}`);
} }
@@ -606,7 +595,8 @@ export async function create_ae_obj__event(
return false; return false;
} }
ae_promises.create__event = await api.create_ae_obj_crud({ ae_promises.create__event = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event', obj_type: 'event',
fields: { fields: {
@@ -622,9 +612,9 @@ export async function create_ae_obj__event(
if (event_obj_create_result) { if (event_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_props({ const processed_obj_li = await process_ae_obj__event_props({
obj_li: [event_obj_create_result], obj_li: [event_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -638,7 +628,7 @@ export async function create_ae_obj__event(
table_name: 'event', table_name: 'event',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -652,8 +642,7 @@ export async function create_ae_obj__event(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event:', ae_promises.create__event); console.log('ae_promises.create__event:', ae_promises.create__event);
@@ -661,10 +650,8 @@ export async function create_ae_obj__event(
return ae_promises.create__event; return ae_promises.create__event;
} }
// Updated 2024-11-08 // Updated 2024-11-08
export async function delete_ae_obj_id__event( export async function delete_ae_obj_id__event({
{
api_cfg, api_cfg,
event_id, event_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -672,19 +659,19 @@ export async function delete_ae_obj_id__event(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event() *** event_id=${event_id}`); console.log(`*** delete_ae_obj_id__event() *** event_id=${event_id}`);
} }
ae_promises.delete__event_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event', obj_type: 'event',
obj_id: event_id, obj_id: event_id,
@@ -712,10 +699,8 @@ export async function delete_ae_obj_id__event(
return ae_promises.delete__event_obj; return ae_promises.delete__event_obj;
} }
// Updated 2024-09-25 // Updated 2024-09-25
export async function update_ae_obj__event( export async function update_ae_obj__event({
{
api_cfg, api_cfg,
event_id, event_id,
data_kv, data_kv,
@@ -723,19 +708,19 @@ export async function update_ae_obj__event(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event() *** event_id=${event_id}`, data_kv); console.log(`*** update_ae_obj__event() *** event_id=${event_id}`, data_kv);
} }
// ae_promises.update__event_obj = 'test'; // ae_promises.update__event_obj = 'test';
ae_promises.update__event_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event', obj_type: 'event',
obj_id: event_id, obj_id: event_id,
@@ -749,9 +734,9 @@ export async function update_ae_obj__event(
if (event_obj_update_result) { if (event_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_props({ const processed_obj_li = await process_ae_obj__event_props({
obj_li: [event_obj_update_result], obj_li: [event_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -765,7 +750,7 @@ export async function update_ae_obj__event(
table_name: 'event', table_name: 'event',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -779,8 +764,7 @@ export async function update_ae_obj__event(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_obj:', ae_promises.update__event_obj); console.log('ae_promises.update__event_obj:', ae_promises.update__event_obj);
@@ -788,33 +772,30 @@ export async function update_ae_obj__event(
return ae_promises.update__event_obj; return ae_promises.update__event_obj;
} }
// This function will loop through the event_obj_li and save each one to the DB. // This function will loop through the event_obj_li and save each one to the DB.
// Updated 2025-05-09 // Updated 2025-05-09
export async function db_save_ae_obj_li__event( export async function db_save_ae_obj_li__event({
{
obj_type, obj_type,
obj_li, obj_li,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_type: string, obj_type: string;
obj_li: any, obj_li: any;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event() *** obj_type=${obj_type}`, obj_li); console.log(`*** db_save_ae_obj_li__event() *** obj_type=${obj_type}`, obj_li);
} }
if (obj_li && obj_li.length) { if (obj_li && obj_li.length) {
let obj_li_id: string[] = []; const obj_li_id: string[] = [];
for (const obj of obj_li) { for (const obj of obj_li) {
if (log_lvl) { if (log_lvl) {
console.log(`Processing ae_obj ${obj_type}:`, obj); console.log(`Processing ae_obj ${obj_type}:`, obj);
} }
let obj_record = { const obj_record = {
id: obj.event_id_random, id: obj.event_id_random,
event_id: obj.event_id_random, event_id: obj.event_id_random,
event_id_random: obj.event_id_random, event_id_random: obj.event_id_random,
@@ -896,7 +877,7 @@ export async function db_save_ae_obj_li__event(
file_count: obj.file_count, file_count: obj.file_count,
file_count_all: obj.file_count_all, file_count_all: obj.file_count_all,
internal_use_count: obj.internal_use_count, internal_use_count: obj.internal_use_count,
event_file_id_li_json: obj.event_file_id_li_json, event_file_id_li_json: obj.event_file_id_li_json
}; };
let id_random = null; let id_random = null;
@@ -935,32 +916,37 @@ export async function db_save_ae_obj_li__event(
} }
} }
// This function will process the event config, specifically for presentation management. // This function will process the event config, specifically for presentation management.
export function sync_config__event_pres_mgmt( export function sync_config__event_pres_mgmt({
{
pres_mgmt_cfg_remote, // This is the remote config that will be compared. pres_mgmt_cfg_remote, // This is the remote config that will be compared.
pres_mgmt_cfg_local, // This is the local config that will be updated. pres_mgmt_cfg_local, // This is the local config that will be updated.
log_lvl = 0 log_lvl = 0
}: { }: {
pres_mgmt_cfg_remote: key_val, pres_mgmt_cfg_remote: key_val;
pres_mgmt_cfg_local: key_val, pres_mgmt_cfg_local: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
log_lvl = 1; log_lvl = 1;
if (log_lvl) { if (log_lvl) {
console.log(`*** sync_config__event_pres_mgmt() *** pres_mgmt_cfg_remote:`, pres_mgmt_cfg_remote); console.log(
`*** sync_config__event_pres_mgmt() *** pres_mgmt_cfg_remote:`,
pres_mgmt_cfg_remote
);
} }
// Deal with things that can not be overridden first: // Deal with things that can not be overridden first:
// Labels: // Labels:
pres_mgmt_cfg_local.label__person_external_id = pres_mgmt_cfg_remote?.label__person_external_id ?? 'External ID'; pres_mgmt_cfg_local.label__person_external_id =
pres_mgmt_cfg_local.label__presenter_external_id = pres_mgmt_cfg_remote?.label__presenter_external_id ?? 'External ID'; pres_mgmt_cfg_remote?.label__person_external_id ?? 'External ID';
pres_mgmt_cfg_local.label__presenter_external_id =
pres_mgmt_cfg_remote?.label__presenter_external_id ?? 'External ID';
pres_mgmt_cfg_local.label__session_poc_type = pres_mgmt_cfg_remote?.label__session_poc_type ?? 'poc'; pres_mgmt_cfg_local.label__session_poc_type =
pres_mgmt_cfg_local.label__session_poc_name = pres_mgmt_cfg_remote?.label__session_poc_name_short ?? 'POC'; pres_mgmt_cfg_remote?.label__session_poc_type ?? 'poc';
pres_mgmt_cfg_local.label__session_poc_name = pres_mgmt_cfg_remote?.label__session_poc_name ?? 'Point of Contact'; pres_mgmt_cfg_local.label__session_poc_name =
pres_mgmt_cfg_remote?.label__session_poc_name_short ?? 'POC';
pres_mgmt_cfg_local.label__session_poc_name =
pres_mgmt_cfg_remote?.label__session_poc_name ?? 'Point of Contact';
// Hide content: // Hide content:
@@ -972,14 +958,18 @@ export function sync_config__event_pres_mgmt(
// pres_mgmt_cfg_local.limit__options = pres_mgmt_cfg_remote?.limit__options ?? false; // pres_mgmt_cfg_local.limit__options = pres_mgmt_cfg_remote?.limit__options ?? false;
// Required fields or options (agreements): // Required fields or options (agreements):
pres_mgmt_cfg_local.require__presenter_agree = pres_mgmt_cfg_remote?.require__presenter_agree ?? false; // In use pres_mgmt_cfg_local.require__presenter_agree =
pres_mgmt_cfg_local.require__session_agree = pres_mgmt_cfg_remote?.require__session_agree ?? false; // New and in progress pres_mgmt_cfg_remote?.require__presenter_agree ?? false; // In use
pres_mgmt_cfg_local.require__session_agree =
pres_mgmt_cfg_remote?.require__session_agree ?? false; // New and in progress
// Show content: // Show content:
// pres_mgmt_cfg_local.show__navigation = pres_mgmt_cfg_remote?.show__navigation ?? false; // pres_mgmt_cfg_local.show__navigation = pres_mgmt_cfg_remote?.show__navigation ?? false;
pres_mgmt_cfg_local.show__copy_access_link = pres_mgmt_cfg_remote?.show__copy_access_link ?? false; pres_mgmt_cfg_local.show__copy_access_link =
pres_mgmt_cfg_local.show__email_access_link = pres_mgmt_cfg_remote?.show__email_access_link ?? false; pres_mgmt_cfg_remote?.show__copy_access_link ?? false;
pres_mgmt_cfg_local.show__email_access_link =
pres_mgmt_cfg_remote?.show__email_access_link ?? false;
pres_mgmt_cfg_local.file_purpose_option_kv = pres_mgmt_cfg_remote?.file_purpose_option_kv ?? null; pres_mgmt_cfg_local.file_purpose_option_kv = pres_mgmt_cfg_remote?.file_purpose_option_kv ?? null;
@@ -993,7 +983,9 @@ export function sync_config__event_pres_mgmt(
pres_mgmt_cfg_local.sync_local_config = true; pres_mgmt_cfg_local.sync_local_config = true;
} else { } else {
// Do not override the preference for syncing the local config with the remote config. // Do not override the preference for syncing the local config with the remote config.
console.log(`The config is not locked. Currently set to sync? ${pres_mgmt_cfg_local.sync_local_config}`); console.log(
`The config is not locked. Currently set to sync? ${pres_mgmt_cfg_local.sync_local_config}`
);
// Check if the sync_local_config is undefined versus just false. // Check if the sync_local_config is undefined versus just false.
// if (pres_mgmt_cfg_local?.sync_local_config) { // if (pres_mgmt_cfg_local?.sync_local_config) {
@@ -1010,22 +1002,31 @@ export function sync_config__event_pres_mgmt(
// Hide content: // Hide content:
pres_mgmt_cfg_local.hide__location_code = pres_mgmt_cfg_remote?.hide__location_code ?? false; pres_mgmt_cfg_local.hide__location_code = pres_mgmt_cfg_remote?.hide__location_code ?? false;
pres_mgmt_cfg_local.hide__presentation_code = pres_mgmt_cfg_remote?.hide__presentation_code ?? false; pres_mgmt_cfg_local.hide__presentation_code =
pres_mgmt_cfg_local.hide__presentation_datetime = pres_mgmt_cfg_remote?.hide__presentation_datetime ?? false; pres_mgmt_cfg_remote?.hide__presentation_code ?? false;
pres_mgmt_cfg_local.show_content__presentation_description = pres_mgmt_cfg_remote?.show_content__presentation_description ?? false; pres_mgmt_cfg_local.hide__presentation_datetime =
pres_mgmt_cfg_remote?.hide__presentation_datetime ?? false;
pres_mgmt_cfg_local.show_content__presentation_description =
pres_mgmt_cfg_remote?.show_content__presentation_description ?? false;
pres_mgmt_cfg_local.hide__presenter_code = pres_mgmt_cfg_remote?.hide__presenter_code ?? false; pres_mgmt_cfg_local.hide__presenter_code = pres_mgmt_cfg_remote?.hide__presenter_code ?? false;
pres_mgmt_cfg_local.hide__presenter_biography = pres_mgmt_cfg_remote?.hide__presenter_biography ?? false; pres_mgmt_cfg_local.hide__presenter_biography =
pres_mgmt_cfg_remote?.hide__presenter_biography ?? false;
pres_mgmt_cfg_local.hide__session_code = pres_mgmt_cfg_remote?.hide__session_code ?? false; pres_mgmt_cfg_local.hide__session_code = pres_mgmt_cfg_remote?.hide__session_code ?? false;
pres_mgmt_cfg_local.hide__session_description = pres_mgmt_cfg_remote?.hide__session_description ?? false; pres_mgmt_cfg_local.hide__session_description =
pres_mgmt_cfg_local.hide__session_location = pres_mgmt_cfg_remote?.hide__session_location ?? false; pres_mgmt_cfg_remote?.hide__session_description ?? false;
pres_mgmt_cfg_local.hide__session_location =
pres_mgmt_cfg_remote?.hide__session_location ?? false;
pres_mgmt_cfg_local.hide__session_msg = pres_mgmt_cfg_remote?.hide__session_msg ?? false; pres_mgmt_cfg_local.hide__session_msg = pres_mgmt_cfg_remote?.hide__session_msg ?? false;
// pres_mgmt_cfg_local.hide__session_li_poc_field = pres_mgmt_cfg_remote?.hide__session_li_poc_field ?? false; // This should still allow the POC name to be shown. // pres_mgmt_cfg_local.hide__session_li_poc_field = pres_mgmt_cfg_remote?.hide__session_li_poc_field ?? false; // This should still allow the POC name to be shown.
pres_mgmt_cfg_local.hide__session_poc_profile = pres_mgmt_cfg_remote?.hide__session_poc_profile ?? false; // This should still allow the POC name to be shown. pres_mgmt_cfg_local.hide__session_poc_profile =
pres_mgmt_cfg_local.hide__session_poc_biography = pres_mgmt_cfg_remote?.hide__session_poc_biography ?? false; // New and in progress pres_mgmt_cfg_remote?.hide__session_poc_profile ?? false; // This should still allow the POC name to be shown.
pres_mgmt_cfg_local.hide__session_poc_profile_pic = pres_mgmt_cfg_remote?.hide__session_poc_profile_pic ?? false; // New and in progress pres_mgmt_cfg_local.hide__session_poc_biography =
pres_mgmt_cfg_remote?.hide__session_poc_biography ?? false; // New and in progress
pres_mgmt_cfg_local.hide__session_poc_profile_pic =
pres_mgmt_cfg_remote?.hide__session_poc_profile_pic ?? false; // New and in progress
// pres_mgmt_cfg_local.show__copy_access_link = pres_mgmt_cfg_remote?.show__copy_access_link ?? false; // pres_mgmt_cfg_local.show__copy_access_link = pres_mgmt_cfg_remote?.show__copy_access_link ?? false;
// pres_mgmt_cfg_local.show__email_access_link = pres_mgmt_cfg_remote?.show__email_access_link ?? false; // pres_mgmt_cfg_local.show__email_access_link = pres_mgmt_cfg_remote?.show__email_access_link ?? false;
@@ -1033,7 +1034,8 @@ export function sync_config__event_pres_mgmt(
// pres_mgmt_cfg_local.show__launcher_link_legacy = pres_mgmt_cfg_remote?.show__launcher_link_legacy ?? false; // pres_mgmt_cfg_local.show__launcher_link_legacy = pres_mgmt_cfg_remote?.show__launcher_link_legacy ?? false;
pres_mgmt_cfg_local.hide_launcher_link = pres_mgmt_cfg_remote?.hide_launcher_link ?? false; pres_mgmt_cfg_local.hide_launcher_link = pres_mgmt_cfg_remote?.hide_launcher_link ?? false;
pres_mgmt_cfg_local.hide_launcher_link_legacy = pres_mgmt_cfg_remote?.hide_launcher_link_legacy ?? false; pres_mgmt_cfg_local.hide_launcher_link_legacy =
pres_mgmt_cfg_remote?.hide_launcher_link_legacy ?? false;
} }
if (log_lvl) { if (log_lvl) {
@@ -1042,7 +1044,6 @@ export function sync_config__event_pres_mgmt(
return pres_mgmt_cfg_local; return pres_mgmt_cfg_local;
} }
// Updated 2025-05-09 // Updated 2025-05-09
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -1133,7 +1134,7 @@ export const properties_to_save = [
'file_count', 'file_count',
'file_count_all', 'file_count_all',
'internal_use_count', 'internal_use_count',
'event_file_id_li_json', 'event_file_id_li_json'
// 'event_session_count', // 'event_session_count',
// 'event_presenter_count', // 'event_presenter_count',
// 'event_file_count', // 'event_file_count',
@@ -1143,7 +1144,6 @@ export const properties_to_save = [
// 'event_other_li', // 'event_other_li',
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -1212,7 +1212,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-11-13 // Updated 2025-11-13
export async function process_ae_obj__event_props({ export async function process_ae_obj__event_props({
obj_li, obj_li,
@@ -1234,4 +1233,3 @@ export async function process_ae_obj__event_props({
} }
}); });
} }

View File

@@ -1,13 +1,12 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
import { load_ae_obj_id__event_badge_template } from "$lib/ae_events/ae_events__event_badge_template"; import { load_ae_obj_id__event_badge_template } from '$lib/ae_events/ae_events__event_badge_template';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-10-06 // Updated 2025-10-06
export async function load_ae_obj_id__event_badge({ export async function load_ae_obj_id__event_badge({
@@ -17,17 +16,18 @@ export async function load_ae_obj_id__event_badge({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_badge_id: string, event_badge_id: string;
inc_template?: boolean, inc_template?: boolean;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`); console.log(`*** load_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`);
} }
let params = {}; const params = {};
ae_promises.load__event_badge_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_badge_obj = await api
.get_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type: 'event_badge', obj_type: 'event_badge',
obj_id: event_badge_id, obj_id: event_badge_id,
@@ -39,7 +39,7 @@ export async function load_ae_obj_id__event_badge({
.then(async function (badge_obj_get_result) { .then(async function (badge_obj_get_result) {
if (badge_obj_get_result) { if (badge_obj_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_props({ const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: [badge_obj_get_result], obj_li: [badge_obj_get_result],
log_lvl log_lvl
}); });
@@ -48,7 +48,7 @@ export async function load_ae_obj_id__event_badge({
table_name: 'badge', table_name: 'badge',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return badge_obj_get_result; return badge_obj_get_result;
@@ -66,12 +66,11 @@ export async function load_ae_obj_id__event_badge({
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the template for the badge now`); console.log(`Need to load the template for the badge now`);
} }
let load_event_badge_template_obj = load_ae_obj_id__event_badge_template({ const load_event_badge_template_obj = load_ae_obj_id__event_badge_template({
api_cfg: api_cfg, api_cfg: api_cfg,
event_badge_template_id: ae_promises.load__event_badge_obj?.event_badge_template_id_random, event_badge_template_id: ae_promises.load__event_badge_obj?.event_badge_template_id_random,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_badge_template_obj_li) => {
.then((event_badge_template_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_badge_template_obj_li = `, event_badge_template_obj_li); console.log(`event_badge_template_obj_li = `, event_badge_template_obj_li);
} }
@@ -87,7 +86,6 @@ export async function load_ae_obj_id__event_badge({
return ae_promises.load__event_badge_obj; return ae_promises.load__event_badge_obj;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export async function load_ae_obj_li__event_badge({ export async function load_ae_obj_li__event_badge({
api_cfg, api_cfg,
@@ -97,29 +95,30 @@ export async function load_ae_obj_li__event_badge({
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
inc_template?: boolean, inc_template?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_badge() *** event_id=${event_id}`); console.log(`*** load_ae_obj_li__event_badge() *** event_id=${event_id}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// ae_promises.load__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_badge_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_badge', obj_type: 'event_badge',
for_obj_type: 'event', for_obj_type: 'event',
@@ -138,7 +137,7 @@ export async function load_ae_obj_li__event_badge({
.then(async function (badge_obj_li_get_result) { .then(async function (badge_obj_li_get_result) {
if (badge_obj_li_get_result) { if (badge_obj_li_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_props({ const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: badge_obj_li_get_result, obj_li: badge_obj_li_get_result,
log_lvl log_lvl
}); });
@@ -147,7 +146,7 @@ export async function load_ae_obj_li__event_badge({
table_name: 'badge', table_name: 'badge',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return badge_obj_li_get_result; return badge_obj_li_get_result;
@@ -159,17 +158,16 @@ export async function load_ae_obj_li__event_badge({
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}); });
if (inc_template) { if (inc_template) {
// Load the template for each badge // Load the template for each badge
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the template for each badge now`); console.log(`Need to load the template for each badge now`);
} }
for (let badge_obj of ae_promises.load__event_badge_obj_li) { for (const badge_obj of ae_promises.load__event_badge_obj_li) {
if (log_lvl) { if (log_lvl) {
console.log(`Loading template for badge_obj: `, badge_obj); console.log(`Loading template for badge_obj: `, badge_obj);
} }
let load_event_badge_template_obj = await load_ae_obj_id__event_badge_template({ const load_event_badge_template_obj = await load_ae_obj_id__event_badge_template({
api_cfg: api_cfg, api_cfg: api_cfg,
event_badge_template_id: badge_obj?.event_badge_template_id_random, event_badge_template_id: badge_obj?.event_badge_template_id_random,
log_lvl: log_lvl log_lvl: log_lvl
@@ -178,14 +176,12 @@ export async function load_ae_obj_li__event_badge({
console.log(`event_badge_template_obj = `, load_event_badge_template_obj); console.log(`event_badge_template_obj = `, load_event_badge_template_obj);
} }
badge_obj.event_badge_template = load_event_badge_template_obj; badge_obj.event_badge_template = load_event_badge_template_obj;
} }
} }
return ae_promises.load__event_badge_obj_li; return ae_promises.load__event_badge_obj_li;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export async function create_ae_obj__event_badge({ export async function create_ae_obj__event_badge({
api_cfg, api_cfg,
@@ -195,17 +191,18 @@ export async function create_ae_obj__event_badge({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`); console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`);
} }
ae_promises.create__event_badge = await api.create_ae_obj_crud({ ae_promises.create__event_badge = await api
.create_ae_obj_crud({
api_cfg, api_cfg,
obj_type: 'event_badge', obj_type: 'event_badge',
fields: { fields: {
@@ -220,7 +217,7 @@ export async function create_ae_obj__event_badge({
.then(async function (event_badge_obj_create_result) { .then(async function (event_badge_obj_create_result) {
if (event_badge_obj_create_result) { if (event_badge_obj_create_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_props({ const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: [event_badge_obj_create_result], obj_li: [event_badge_obj_create_result],
log_lvl log_lvl
}); });
@@ -229,7 +226,7 @@ export async function create_ae_obj__event_badge({
table_name: 'badge', table_name: 'badge',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return event_badge_obj_create_result; return event_badge_obj_create_result;
@@ -243,7 +240,6 @@ export async function create_ae_obj__event_badge({
return ae_promises.create__event_badge; return ae_promises.create__event_badge;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export async function delete_ae_obj_id__event_badge({ export async function delete_ae_obj_id__event_badge({
api_cfg, api_cfg,
@@ -253,17 +249,18 @@ export async function delete_ae_obj_id__event_badge({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_badge_id: string, event_badge_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`); console.log(`*** delete_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`);
} }
ae_promises.delete__event_badge_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_badge_obj = await api
.delete_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type: 'event_badge', obj_type: 'event_badge',
obj_id: event_badge_id, obj_id: event_badge_id,
@@ -286,7 +283,6 @@ export async function delete_ae_obj_id__event_badge({
return ae_promises.delete__event_badge_obj; return ae_promises.delete__event_badge_obj;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export async function update_ae_obj__event_badge({ export async function update_ae_obj__event_badge({
api_cfg, api_cfg,
@@ -296,17 +292,18 @@ export async function update_ae_obj__event_badge({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_badge_id: string, event_badge_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_badge() *** event_badge_id=${event_badge_id}`); console.log(`*** update_ae_obj__event_badge() *** event_badge_id=${event_badge_id}`);
} }
ae_promises.update__event_badge_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_badge_obj = await api
.update_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type: 'event_badge', obj_type: 'event_badge',
obj_id: event_badge_id, obj_id: event_badge_id,
@@ -319,7 +316,7 @@ export async function update_ae_obj__event_badge({
.then(async function (event_badge_obj_update_result) { .then(async function (event_badge_obj_update_result) {
if (event_badge_obj_update_result) { if (event_badge_obj_update_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_props({ const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: [event_badge_obj_update_result], obj_li: [event_badge_obj_update_result],
log_lvl log_lvl
}); });
@@ -328,7 +325,7 @@ export async function update_ae_obj__event_badge({
table_name: 'badge', table_name: 'badge',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return event_badge_obj_update_result; return event_badge_obj_update_result;
@@ -342,7 +339,6 @@ export async function update_ae_obj__event_badge({
return ae_promises.update__event_badge_obj; return ae_promises.update__event_badge_obj;
} }
// Is this needed? // Is this needed?
// Updated 2025-10-06 // Updated 2025-10-06
export async function qry__event_badge({ export async function qry__event_badge({
@@ -353,29 +349,29 @@ export async function qry__event_badge({
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
qry_str?: null|string, qry_str?: null | string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** qry__event_badge() *** event_id=${event_id}`); console.log(`*** qry__event_badge() *** event_id=${event_id}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
if (qry_str) { if (qry_str) {
params_json['ft_qry'] = { 'default_qry_str': qry_str }; params_json['ft_qry'] = { default_qry_str: qry_str };
} }
ae_promises.qry__event_badge_obj_li = await load_ae_obj_li__event_badge({ ae_promises.qry__event_badge_obj_li = await load_ae_obj_li__event_badge({
api_cfg, api_cfg,
@@ -392,7 +388,6 @@ export async function qry__event_badge({
return ae_promises.qry__event_badge_obj_li; return ae_promises.qry__event_badge_obj_li;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export async function search__event_badge({ export async function search__event_badge({
api_cfg, api_cfg,
@@ -405,25 +400,33 @@ export async function search__event_badge({
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 25, limit = 25,
offset = 0, offset = 0,
order_by_li = {'print_count': 'ASC', 'priority': 'DESC', 'sort': 'DESC', 'given_name': 'ASC', 'family_name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
print_count: 'ASC',
priority: 'DESC',
sort: 'DESC',
given_name: 'ASC',
family_name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
type_code?: null|string, type_code?: null | string;
external_event_id?: null|string, external_event_id?: null | string;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_badge() *** event_id=${event_id}`); console.log(`*** search__event_badge() *** event_id=${event_id}`);
@@ -434,10 +437,9 @@ export async function search__event_badge({
return false; // Returning false instead of [] because no search was performed. return false; // Returning false instead of [] because no search was performed.
} }
const params_json: key_val = {};
let params_json: key_val = {};
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
params_json['ft_qry'] = { 'default_qry_str': fulltext_search_qry_str }; params_json['ft_qry'] = { default_qry_str: fulltext_search_qry_str };
// 'location_address_json_ext': fulltext_search_qry_str, // JSON extracted text DB field // 'location_address_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
// 'contact_li_json_ext': fulltext_search_qry_str, // JSON extracted text DB field // 'contact_li_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
} }
@@ -455,19 +457,21 @@ export async function search__event_badge({
// like_search_qry_str_new = `%${like_search_qry_str_new}%`; // like_search_qry_str_new = `%${like_search_qry_str_new}%`;
// console.log('like_search_qry_str_new:', like_search_qry_str_new); // console.log('like_search_qry_str_new:', like_search_qry_str_new);
params_json['and_like'] = { 'default_qry_str': like_search_qry_str }; params_json['and_like'] = { default_qry_str: like_search_qry_str };
} }
params_json['and_qry'] = {}; params_json['and_qry'] = {};
if (external_event_id) { if (external_event_id) {
params_json['and_qry']['external_event_id'] = external_event_id; params_json['and_qry']['external_event_id'] = external_event_id;
} }
if (type_code) { // This is the event_badge.badge_type_code. There is also a member_type_code and registration_type_code that could be referenced in the future. if (type_code) {
// This is the event_badge.badge_type_code. There is also a member_type_code and registration_type_code that could be referenced in the future.
params_json['and_qry']['badge_type_code'] = type_code; params_json['and_qry']['badge_type_code'] = type_code;
} }
// ae_promises.search__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.search__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.search__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.search__event_badge_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg, api_cfg,
obj_type: 'event_badge', obj_type: 'event_badge',
for_obj_type: 'event', for_obj_type: 'event',
@@ -486,7 +490,7 @@ export async function search__event_badge({
.then(async function (badge_obj_li_get_result) { .then(async function (badge_obj_li_get_result) {
if (badge_obj_li_get_result) { if (badge_obj_li_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_props({ const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: badge_obj_li_get_result, obj_li: badge_obj_li_get_result,
log_lvl log_lvl
}); });
@@ -495,7 +499,7 @@ export async function search__event_badge({
table_name: 'badge', table_name: 'badge',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return badge_obj_li_get_result; return badge_obj_li_get_result;
@@ -509,10 +513,6 @@ export async function search__event_badge({
return ae_promises.search__event_badge_obj_li; return ae_promises.search__event_badge_obj_li;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -594,10 +594,9 @@ export const properties_to_save = [
'person_professional_title', 'person_professional_title',
'person_affiliations', 'person_affiliations',
'person_primary_email', 'person_primary_email',
'person_passcode', 'person_passcode'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -666,7 +665,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export async function process_ae_obj__event_badge_props({ export async function process_ae_obj__event_badge_props({
obj_li, obj_li,

View File

@@ -1,10 +1,9 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// --- PROPERTIES TO SAVE --- // --- PROPERTIES TO SAVE ---
export const properties_to_save = [ export const properties_to_save = [
@@ -65,7 +64,6 @@ export const properties_to_save = [
'style_filename', 'style_filename',
// 'style_href', // 'style_href',
// 'default', // 'default',
'enable', 'enable',
'hide', 'hide',
@@ -78,10 +76,9 @@ export const properties_to_save = [
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -150,7 +147,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// --- PROCESS FUNCTION --- // --- PROCESS FUNCTION ---
export async function process_ae_obj__event_badge_template_props({ export async function process_ae_obj__event_badge_template_props({
obj_li, obj_li,
@@ -177,10 +173,6 @@ export async function process_ae_obj__event_badge_template_props({
}); });
} }
// --- CRUD FUNCTIONS --- // --- CRUD FUNCTIONS ---
export async function load_ae_obj_id__event_badge_template({ export async function load_ae_obj_id__event_badge_template({
api_cfg, api_cfg,
@@ -188,16 +180,19 @@ export async function load_ae_obj_id__event_badge_template({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_badge_template_id: string, event_badge_template_id: string;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_badge_template() *** event_badge_template_id=${event_badge_template_id}`); console.log(
`*** load_ae_obj_id__event_badge_template() *** event_badge_template_id=${event_badge_template_id}`
);
} }
let params = {}; const params = {};
ae_promises.load__event_badge_template_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_badge_template_obj = await api
.get_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type: 'event_badge_template', obj_type: 'event_badge_template',
obj_id: event_badge_template_id, obj_id: event_badge_template_id,
@@ -209,7 +204,7 @@ export async function load_ae_obj_id__event_badge_template({
.then(async function (obj_get_result) { .then(async function (obj_get_result) {
if (obj_get_result) { if (obj_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_template_props({ const processed_obj_li = await process_ae_obj__event_badge_template_props({
obj_li: [obj_get_result], obj_li: [obj_get_result],
log_lvl log_lvl
}); });
@@ -218,7 +213,7 @@ export async function load_ae_obj_id__event_badge_template({
table_name: 'badge_template', table_name: 'badge_template',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return obj_get_result; return obj_get_result;
@@ -240,28 +235,29 @@ export async function load_ae_obj_li__event_badge_template({
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_badge_template() *** event_id=${event_id}`); console.log(`*** load_ae_obj_li__event_badge_template() *** event_id=${event_id}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// ae_promises.load__event_badge_template_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_badge_template_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_badge_template_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_badge_template_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg, api_cfg,
obj_type: 'event_badge_template', obj_type: 'event_badge_template',
for_obj_type: 'event', for_obj_type: 'event',
@@ -280,7 +276,7 @@ export async function load_ae_obj_li__event_badge_template({
.then(async function (obj_li_get_result) { .then(async function (obj_li_get_result) {
if (obj_li_get_result) { if (obj_li_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_template_props({ const processed_obj_li = await process_ae_obj__event_badge_template_props({
obj_li: obj_li_get_result, obj_li: obj_li_get_result,
log_lvl log_lvl
}); });
@@ -289,7 +285,7 @@ export async function load_ae_obj_li__event_badge_template({
table_name: 'badge_template', table_name: 'badge_template',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return obj_li_get_result; return obj_li_get_result;
@@ -311,17 +307,18 @@ export async function create_ae_obj__event_badge_template({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_badge_template() *** event_id=${event_id}`); console.log(`*** create_ae_obj__event_badge_template() *** event_id=${event_id}`);
} }
ae_promises.create__event_badge_template = await api.create_ae_obj_crud({ ae_promises.create__event_badge_template = await api
.create_ae_obj_crud({
api_cfg, api_cfg,
obj_type: 'event_badge_template', obj_type: 'event_badge_template',
fields: { fields: {
@@ -336,7 +333,7 @@ export async function create_ae_obj__event_badge_template({
.then(async function (obj_create_result) { .then(async function (obj_create_result) {
if (obj_create_result) { if (obj_create_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_template_props({ const processed_obj_li = await process_ae_obj__event_badge_template_props({
obj_li: [obj_create_result], obj_li: [obj_create_result],
log_lvl log_lvl
}); });
@@ -345,7 +342,7 @@ export async function create_ae_obj__event_badge_template({
table_name: 'badge_template', table_name: 'badge_template',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return obj_create_result; return obj_create_result;
@@ -367,17 +364,20 @@ export async function delete_ae_obj_id__event_badge_template({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_badge_template_id: string, event_badge_template_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_badge_template() *** event_badge_template_id=${event_badge_template_id}`); console.log(
`*** delete_ae_obj_id__event_badge_template() *** event_badge_template_id=${event_badge_template_id}`
);
} }
ae_promises.delete__event_badge_template_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_badge_template_obj = await api
.delete_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type: 'event_badge_template', obj_type: 'event_badge_template',
obj_id: event_badge_template_id, obj_id: event_badge_template_id,
@@ -392,7 +392,9 @@ export async function delete_ae_obj_id__event_badge_template({
.finally(function () { .finally(function () {
if (try_cache) { if (try_cache) {
if (log_lvl) { if (log_lvl) {
console.log(`Attempting to remove IDB entry for event_badge_template_id=${event_badge_template_id}`); console.log(
`Attempting to remove IDB entry for event_badge_template_id=${event_badge_template_id}`
);
} }
db_events.badge_template.delete(event_badge_template_id); db_events.badge_template.delete(event_badge_template_id);
} }
@@ -408,17 +410,20 @@ export async function update_ae_obj__event_badge_template({
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_badge_template_id: string, event_badge_template_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_badge_template() *** event_badge_template_id=${event_badge_template_id}`); console.log(
`*** update_ae_obj__event_badge_template() *** event_badge_template_id=${event_badge_template_id}`
);
} }
ae_promises.update__event_badge_template_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_badge_template_obj = await api
.update_ae_obj_id_crud({
api_cfg, api_cfg,
obj_type: 'event_badge_template', obj_type: 'event_badge_template',
obj_id: event_badge_template_id, obj_id: event_badge_template_id,
@@ -431,7 +436,7 @@ export async function update_ae_obj__event_badge_template({
.then(async function (obj_update_result) { .then(async function (obj_update_result) {
if (obj_update_result) { if (obj_update_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_template_props({ const processed_obj_li = await process_ae_obj__event_badge_template_props({
obj_li: [obj_update_result], obj_li: [obj_update_result],
log_lvl log_lvl
}); });
@@ -440,7 +445,7 @@ export async function update_ae_obj__event_badge_template({
table_name: 'badge_template', table_name: 'badge_template',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return obj_update_result; return obj_update_result;
@@ -464,37 +469,44 @@ export async function search__event_badge_template({
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 25, limit = 25,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_badge_template() *** event_id=${event_id}`); console.log(`*** search__event_badge_template() *** event_id=${event_id}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
params_json['ft_qry'] = { 'default_qry_str': fulltext_search_qry_str }; params_json['ft_qry'] = { default_qry_str: fulltext_search_qry_str };
} }
if (like_search_qry_str && like_search_qry_str.length > 2) { if (like_search_qry_str && like_search_qry_str.length > 2) {
params_json['and_like'] = { 'default_qry_str': like_search_qry_str }; params_json['and_like'] = { default_qry_str: like_search_qry_str };
} }
params_json['and_qry'] = {}; params_json['and_qry'] = {};
// ae_promises.search__event_badge_template_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.search__event_badge_template_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_badge_template_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_badge_template_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg, api_cfg,
obj_type: 'event_badge_template', obj_type: 'event_badge_template',
for_obj_type: 'event', for_obj_type: 'event',
@@ -513,7 +525,7 @@ export async function search__event_badge_template({
.then(async function (obj_li_get_result) { .then(async function (obj_li_get_result) {
if (obj_li_get_result) { if (obj_li_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_badge_template_props({ const processed_obj_li = await process_ae_obj__event_badge_template_props({
obj_li: obj_li_get_result, obj_li: obj_li_get_result,
log_lvl log_lvl
}); });
@@ -522,7 +534,7 @@ export async function search__event_badge_template({
table_name: 'badge_template', table_name: 'badge_template',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
} }
return obj_li_get_result; return obj_li_get_result;

View File

@@ -1,37 +1,35 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
import { load_ae_obj_id__event_location } from './ae_events__event_location'; import { load_ae_obj_id__event_location } from './ae_events__event_location';
let ae_promises: key_val = {}; const ae_promises: key_val = {};
// Updated 2025-05-23 // Updated 2025-05-23
export async function load_ae_obj_id__event_device( export async function load_ae_obj_id__event_device({
{
api_cfg, api_cfg,
event_device_id, event_device_id,
inc_location_id = false, inc_location_id = false,
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_device_id: string, event_device_id: string;
inc_location_id?: boolean, inc_location_id?: boolean;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_device() *** event_device_id=${event_device_id}`); console.log(`*** load_ae_obj_id__event_device() *** event_device_id=${event_device_id}`);
} }
let params = {}; const params = {};
ae_promises.load__event_device_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_device_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_device', obj_type: 'event_device',
obj_id: event_device_id, // NOTE: This is the FQDN, not normally the ID. obj_id: event_device_id, // NOTE: This is the FQDN, not normally the ID.
@@ -43,7 +41,7 @@ export async function load_ae_obj_id__event_device(
.then(async function (event_device_obj_get_result) { .then(async function (event_device_obj_get_result) {
if (event_device_obj_get_result) { if (event_device_obj_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_device_props({ const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: [event_device_obj_get_result], obj_li: [event_device_obj_get_result],
log_lvl log_lvl
}); });
@@ -56,7 +54,7 @@ export async function load_ae_obj_id__event_device(
table_name: 'device', table_name: 'device',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -87,7 +85,7 @@ export async function load_ae_obj_id__event_device(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the location id for the device now`); console.log(`Need to load the location id for the device now`);
} }
let load_event_location_obj_id = load_ae_obj_id__event_location({ const load_event_location_obj_id = load_ae_obj_id__event_location({
api_cfg: api_cfg, api_cfg: api_cfg,
event_location_id: ae_promises.load__event_device_obj.event_location_id, event_location_id: ae_promises.load__event_device_obj.event_location_id,
try_cache: try_cache, try_cache: try_cache,
@@ -103,10 +101,8 @@ export async function load_ae_obj_id__event_device(
return ae_promises.load__event_device_obj; return ae_promises.load__event_device_obj;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function load_ae_obj_li__event_device( export async function load_ae_obj_li__event_device({
{
api_cfg, api_cfg,
for_obj_type, for_obj_type,
for_obj_id, for_obj_id,
@@ -115,27 +111,35 @@ export async function load_ae_obj_li__event_device(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'code': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
code: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_location_id?: boolean, inc_location_id?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, // 99 limit?: number; // 99
offset?: number, // 0 offset?: number; // 0
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_device() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__event_device() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -143,11 +147,12 @@ export async function load_ae_obj_li__event_device(
// let limit: number = (params.qry__limit ?? 99); // 99 // let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_device_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_device', obj_type: 'event_device',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -168,9 +173,9 @@ export async function load_ae_obj_li__event_device(
if (event_device_obj_li_get_result) { if (event_device_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_device_props({ const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: event_device_obj_li_get_result, obj_li: event_device_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -184,7 +189,7 @@ export async function load_ae_obj_li__event_device(
table_name: 'device', table_name: 'device',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -214,15 +219,14 @@ export async function load_ae_obj_li__event_device(
console.log(`Need to load the location list for each device now`); console.log(`Need to load the location list for each device now`);
} }
for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) {
let event_device_obj = ae_promises.load__event_device_obj_li[i]; const event_device_obj = ae_promises.load__event_device_obj_li[i];
let load_event_location_obj_li = load_ae_obj_id__event_location({ const load_event_location_obj_li = load_ae_obj_id__event_location({
api_cfg: api_cfg, api_cfg: api_cfg,
event_location_id: event_device_obj.event_location_id, event_location_id: event_device_obj.event_location_id,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_location_obj_li) => {
.then((event_location_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_location_obj_li = `, event_location_obj_li); console.log(`event_location_obj_li = `, event_location_obj_li);
} }
@@ -238,10 +242,8 @@ export async function load_ae_obj_li__event_device(
return ae_promises.load__event_device_obj_li; return ae_promises.load__event_device_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function create_ae_obj__event_device( export async function create_ae_obj__event_device({
{
api_cfg, api_cfg,
event_id, event_id,
data_kv, data_kv,
@@ -249,19 +251,19 @@ export async function create_ae_obj__event_device(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_device() *** event_id=${event_id}`); console.log(`*** create_ae_obj__event_device() *** event_id=${event_id}`);
} }
ae_promises.create__event_device = await api.create_ae_obj_crud({ ae_promises.create__event_device = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_device', obj_type: 'event_device',
fields: { fields: {
@@ -277,9 +279,9 @@ export async function create_ae_obj__event_device(
if (event_device_obj_create_result) { if (event_device_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_device_props({ const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: [event_device_obj_create_result], obj_li: [event_device_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -293,7 +295,7 @@ export async function create_ae_obj__event_device(
table_name: 'device', table_name: 'device',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -313,8 +315,7 @@ export async function create_ae_obj__event_device(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event_device:', ae_promises.create__event_device); console.log('ae_promises.create__event_device:', ae_promises.create__event_device);
@@ -322,10 +323,8 @@ export async function create_ae_obj__event_device(
return ae_promises.create__event_device; return ae_promises.create__event_device;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function delete_ae_obj_id__event_device( export async function delete_ae_obj_id__event_device({
{
api_cfg, api_cfg,
event_device_id, event_device_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -333,19 +332,19 @@ export async function delete_ae_obj_id__event_device(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_device_id: string, event_device_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_device() *** event_device_id=${event_device_id}`); console.log(`*** delete_ae_obj_id__event_device() *** event_device_id=${event_device_id}`);
} }
ae_promises.delete__event_device_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_device_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_device', obj_type: 'event_device',
obj_id: event_device_id, obj_id: event_device_id,
@@ -373,10 +372,8 @@ export async function delete_ae_obj_id__event_device(
return ae_promises.delete__event_device_obj; return ae_promises.delete__event_device_obj;
} }
// Updated 2024-10-16 // Updated 2024-10-16
export async function update_ae_obj__event_device( export async function update_ae_obj__event_device({
{
api_cfg, api_cfg,
event_device_id, event_device_id,
data_kv, data_kv,
@@ -384,18 +381,21 @@ export async function update_ae_obj__event_device(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_device_id: string, event_device_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_device() *** event_device_id=${event_device_id}`, data_kv); console.log(
`*** update_ae_obj__event_device() *** event_device_id=${event_device_id}`,
data_kv
);
} }
ae_promises.update__event_device_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_device_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_device', obj_type: 'event_device',
obj_id: event_device_id, obj_id: event_device_id,
@@ -409,9 +409,9 @@ export async function update_ae_obj__event_device(
if (event_device_obj_update_result) { if (event_device_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_device_props({ const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: [event_device_obj_update_result], obj_li: [event_device_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -425,7 +425,7 @@ export async function update_ae_obj__event_device(
table_name: 'device', table_name: 'device',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -443,8 +443,7 @@ export async function update_ae_obj__event_device(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_device_obj:', ae_promises.update__event_device_obj); console.log('ae_promises.update__event_device_obj:', ae_promises.update__event_device_obj);
@@ -452,11 +451,9 @@ export async function update_ae_obj__event_device(
return ae_promises.update__event_device_obj; return ae_promises.update__event_device_obj;
} }
// Not yet used or tested fully! // Not yet used or tested fully!
// Updated 2025-05-23 // Updated 2025-05-23
export async function search__event_device( export async function search__event_device({
{
api_cfg, api_cfg,
event_id, event_id,
fulltext_search_qry_str, fulltext_search_qry_str,
@@ -468,28 +465,27 @@ export async function search__event_device(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
ft_presenter_search_qry_str?: null|string, ft_presenter_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
like_presentation_search_qry_str?: null|string, like_presentation_search_qry_str?: null | string;
like_presenter_search_qry_str?: null|string, like_presenter_search_qry_str?: null | string;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_device() *** event_id=${event_id}`); console.log(`*** search__event_device() *** event_id=${event_id}`);
} }
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 25); // 99 const limit: number = params.qry__limit ?? 25; // 99
let offset: number = (params.qry__offset ?? 0); // 0 const offset: number = params.qry__offset ?? 0; // 0
let params_json: key_val = {}; const params_json: key_val = {};
if (!fulltext_search_qry_str && !like_search_qry_str) { if (!fulltext_search_qry_str && !like_search_qry_str) {
console.log('No search string provided!!!'); console.log('No search string provided!!!');
@@ -538,10 +534,18 @@ export async function search__event_device(
// params_json['and_qry']['device_type_code'] = device_type_code; // params_json['and_qry']['device_type_code'] = device_type_code;
// } // }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; const order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
};
// ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_device_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_device', obj_type: 'event_device',
for_obj_type: 'event', for_obj_type: 'event',
@@ -561,9 +565,9 @@ export async function search__event_device(
if (event_device_obj_li_get_result) { if (event_device_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_device_props({ const processed_obj_li = await process_ae_obj__event_device_props({
obj_li: event_device_obj_li_get_result, obj_li: event_device_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -577,7 +581,7 @@ export async function search__event_device(
table_name: 'device', table_name: 'device',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -591,8 +595,7 @@ export async function search__event_device(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li); console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li);
@@ -600,10 +603,6 @@ export async function search__event_device(
return ae_promises.load__event_device_obj_li; return ae_promises.load__event_device_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -671,10 +670,9 @@ export const properties_to_save = [
// From SQL view // From SQL view
'event_name', 'event_name',
'event_location_code', 'event_location_code',
'event_location_name', 'event_location_name'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -743,7 +741,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function process_ae_obj__event_device_props({ export async function process_ae_obj__event_device_props({
obj_li, obj_li,

View File

@@ -1,33 +1,31 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-07-21 // Updated 2025-07-21
export async function load_ae_obj_id__event_file( export async function load_ae_obj_id__event_file({
{
api_cfg, api_cfg,
event_file_id, event_file_id,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_file_id: string, event_file_id: string;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_file() *** event_file_id=${event_file_id}`); console.log(`*** load_ae_obj_id__event_file() *** event_file_id=${event_file_id}`);
} }
let params = {}; const params = {};
ae_promises.load__event_file_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_file_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_file', obj_type: 'event_file',
obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID. obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID.
@@ -40,9 +38,9 @@ export async function load_ae_obj_id__event_file(
if (event_file_obj_get_result) { if (event_file_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_file_props({ const processed_obj_li = await process_ae_obj__event_file_props({
obj_li: [event_file_obj_get_result], obj_li: [event_file_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -56,7 +54,7 @@ export async function load_ae_obj_id__event_file(
table_name: 'file', table_name: 'file',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -78,10 +76,8 @@ export async function load_ae_obj_id__event_file(
return ae_promises.load__event_file_obj; return ae_promises.load__event_file_obj;
} }
// Updated 2025-07-21 // Updated 2025-07-21
export async function load_ae_obj_li__event_file( export async function load_ae_obj_li__event_file({
{
api_cfg, api_cfg,
for_obj_type, for_obj_type,
for_obj_id, for_obj_id,
@@ -89,40 +85,50 @@ export async function load_ae_obj_li__event_file(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, // 99 limit?: number; // 99
offset?: number, // 0 offset?: number; // 0
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__event_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// Check if for_obj_type is in the list of valid Aether object types: // Check if for_obj_type is in the list of valid Aether object types:
let valid_for_obj_types = ['event', 'event_session', 'event_presentation', 'event_presenter', 'event_location', 'event_badge', 'event_device']; const valid_for_obj_types = [
'event',
'event_session',
'event_presentation',
'event_presenter',
'event_location',
'event_badge',
'event_device'
];
if (!valid_for_obj_types.includes(for_obj_type)) { if (!valid_for_obj_types.includes(for_obj_type)) {
console.log(`Invalid for_obj_type: ${for_obj_type}`); console.log(`Invalid for_obj_type: ${for_obj_type}`);
return []; return [];
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
ae_promises.load__event_file_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_file_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_file', obj_type: 'event_file',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -143,9 +149,9 @@ export async function load_ae_obj_li__event_file(
if (event_file_obj_li_get_result) { if (event_file_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_file_props({ const processed_obj_li = await process_ae_obj__event_file_props({
obj_li: event_file_obj_li_get_result, obj_li: event_file_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -159,7 +165,7 @@ export async function load_ae_obj_li__event_file(
table_name: 'file', table_name: 'file',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -183,11 +189,9 @@ export async function load_ae_obj_li__event_file(
return ae_promises.load__event_file_obj_li; return ae_promises.load__event_file_obj_li;
} }
// Updated 2025-07-21 // Updated 2025-07-21
// This may need to be reviewed again??? // This may need to be reviewed again???
export async function create_event_file_obj_from_hosted_file_async( export async function create_event_file_obj_from_hosted_file_async({
{
api_cfg, api_cfg,
hosted_file_id, hosted_file_id,
params = {}, params = {},
@@ -197,19 +201,19 @@ export async function create_event_file_obj_from_hosted_file_async(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
hosted_file_id: string, hosted_file_id: string;
params?: key_val, params?: key_val;
data?: key_val, data?: key_val;
return_obj?: boolean, return_obj?: boolean;
inc_hosted_file?: boolean, inc_hosted_file?: boolean;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_event_file_obj_from_hosted_file_async() *** hosted_file_id=${hosted_file_id}`); console.log(
`*** create_event_file_obj_from_hosted_file_async() *** hosted_file_id=${hosted_file_id}`
);
} }
if (!hosted_file_id) { if (!hosted_file_id) {
@@ -217,14 +221,15 @@ export async function create_event_file_obj_from_hosted_file_async(
return false; return false;
} }
let endpoint = `/event/file/from_hosted_file/${hosted_file_id}`; const endpoint = `/event/file/from_hosted_file/${hosted_file_id}`;
if (return_obj) { if (return_obj) {
params['return_obj'] = true; params['return_obj'] = true;
} }
if (inc_hosted_file) { if (inc_hosted_file) {
params['inc_hosted_file'] = true; params['inc_hosted_file'] = true;
} }
let event_file_obj_post_promise = await api.post_object({ const event_file_obj_post_promise = await api
.post_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -250,26 +255,22 @@ export async function create_event_file_obj_from_hosted_file_async(
} else { } else {
return event_file_obj_post_promise.event_file_id_random; return event_file_obj_post_promise.event_file_id_random;
} }
} }
// Updated 2025-07-21 // Updated 2025-07-21
export async function delete_ae_obj_id__event_file( export async function delete_ae_obj_id__event_file({
{
api_cfg, api_cfg,
event_file_id, event_file_id,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_file_id: string, event_file_id: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_file() *** event_file_id=${event_file_id}`); console.log(`*** delete_ae_obj_id__event_file() *** event_file_id=${event_file_id}`);
} }
@@ -279,7 +280,8 @@ export async function delete_ae_obj_id__event_file(
params['delete_hosted_file'] = true; // This does not actually delete the hosted file from the server. params['delete_hosted_file'] = true; // This does not actually delete the hosted file from the server.
params['rm_orphan'] = true; // This is what actually allows the hosted file to be deleted from the server. params['rm_orphan'] = true; // This is what actually allows the hosted file to be deleted from the server.
ae_promises.delete__event_file_obj = await api.delete_object({ ae_promises.delete__event_file_obj = await api
.delete_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -302,10 +304,8 @@ export async function delete_ae_obj_id__event_file(
return ae_promises.delete__event_file_obj; return ae_promises.delete__event_file_obj;
} }
// Updated 2025-07-21 // Updated 2025-07-21
export async function update_ae_obj__event_file( export async function update_ae_obj__event_file({
{
api_cfg, api_cfg,
event_file_id, event_file_id,
data_kv, data_kv,
@@ -313,14 +313,13 @@ export async function update_ae_obj__event_file(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_file_id: string, event_file_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_file() *** event_file_id=${event_file_id}`); console.log(`*** update_ae_obj__event_file() *** event_file_id=${event_file_id}`);
} }
@@ -335,14 +334,14 @@ export async function update_ae_obj__event_file(
params: params, params: params,
return_obj: true, return_obj: true,
log_lvl: log_lvl log_lvl: log_lvl
}) });
// Handle the result // Handle the result
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_file_props({ const processed_obj_li = await process_ae_obj__event_file_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -356,7 +355,7 @@ export async function update_ae_obj__event_file(
table_name: 'file', table_name: 'file',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -375,11 +374,9 @@ export async function update_ae_obj__event_file(
} }
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2025-07-21 // Updated 2025-07-21
export async function qry__event_file( export async function qry__event_file({
{
api_cfg, api_cfg,
event_id, event_id,
qry_created_on = null, // Example greater than: '2024-10-24' qry_created_on = null, // Example greater than: '2024-10-24'
@@ -389,40 +386,46 @@ export async function qry__event_file(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC', 'filename': 'ASC', 'extension': 'ASC', 'hosted_file_size': 'ASC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
created_on: 'DESC',
updated_on: 'DESC',
filename: 'ASC',
extension: 'ASC',
hosted_file_size: 'ASC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
qry_created_on?: null|string, qry_created_on?: null | string;
qry_min_file_size?: null|number, qry_min_file_size?: null | number;
qry_file_purpose?: null|string, qry_file_purpose?: null | string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** qry__event_file() *** event_id=${event_id}`); console.log(`*** qry__event_file() *** event_id=${event_id}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
params_json['qry'] = []; params_json['qry'] = [];
if (qry_created_on) { if (qry_created_on) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'created_on',
field: "created_on", operator: '>',
operator: ">",
value: qry_created_on value: qry_created_on
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
@@ -430,22 +433,20 @@ export async function qry__event_file(
if (qry_min_file_size) { if (qry_min_file_size) {
// console.log('qry_min_file_size:', qry_min_file_size); // console.log('qry_min_file_size:', qry_min_file_size);
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'hosted_file_size',
field: "hosted_file_size", operator: '>',
operator: ">",
value: qry_min_file_size value: qry_min_file_size
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_file_purpose) { if (qry_file_purpose) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_purpose',
field: "file_purpose", operator: '=',
operator: "=",
value: qry_file_purpose value: qry_file_purpose
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
@@ -459,7 +460,8 @@ export async function qry__event_file(
console.log('params_json:', params_json); console.log('params_json:', params_json);
} }
ae_promises.load__event_file_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_file_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_file', obj_type: 'event_file',
for_obj_type: 'event', for_obj_type: 'event',
@@ -482,9 +484,8 @@ export async function qry__event_file(
// Process the results first // Process the results first
process_ae_obj__event_file_props({ process_ae_obj__event_file_props({
obj_li: event_file_obj_li_get_result, obj_li: event_file_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}) }).then(async function (processed_obj_li) {
.then(async function (processed_obj_li) {
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
} }
@@ -497,7 +498,7 @@ export async function qry__event_file(
table_name: 'file', table_name: 'file',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -518,10 +519,8 @@ export async function qry__event_file(
return ae_promises.load__event_file_obj_li; return ae_promises.load__event_file_obj_li;
} }
// Updated 2025-07-21 // Updated 2025-07-21
export async function search__event_file( export async function search__event_file({
{
api_cfg, api_cfg,
event_id, event_id,
created_on = null, created_on = null,
@@ -531,36 +530,43 @@ export async function search__event_file(
like_search_qry_str = null, like_search_qry_str = null,
like_presentation_search_qry_str = null, like_presentation_search_qry_str = null,
like_file_search_qry_str = null, like_file_search_qry_str = null,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC', 'filename': 'ASC', 'extension': 'ASC', 'hosted_file_size': 'ASC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
created_on: 'DESC',
updated_on: 'DESC',
filename: 'ASC',
extension: 'ASC',
hosted_file_size: 'ASC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
created_on?: null|string, created_on?: null | string;
min_file_size?: null|number, min_file_size?: null | number;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
ft_file_search_qry_str?: null|string, ft_file_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
like_presentation_search_qry_str?: null|string, like_presentation_search_qry_str?: null | string;
like_file_search_qry_str?: null|string, like_file_search_qry_str?: null | string;
order_by_li?: key_val, order_by_li?: key_val;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_file() *** event_id=${event_id}`); console.log(`*** search__event_file() *** event_id=${event_id}`);
} }
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 25); // 99 const limit: number = params.qry__limit ?? 25; // 99
let offset: number = (params.qry__offset ?? 0); // 0 const offset: number = params.qry__offset ?? 0; // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (!fulltext_search_qry_str && !like_search_qry_str) { // if (!fulltext_search_qry_str && !like_search_qry_str) {
// console.log('No search string provided!!!'); // console.log('No search string provided!!!');
@@ -610,10 +616,11 @@ export async function search__event_file(
// } // }
if (min_file_size) { if (min_file_size) {
params_json['and_qry'] = {'hosted_file_size': {'>': min_file_size}}; params_json['and_qry'] = { hosted_file_size: { '>': min_file_size } };
} }
ae_promises.load__event_file_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ ae_promises.load__event_file_obj_li = await api
.get_ae_obj_li_for_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_file', obj_type: 'event_file',
for_obj_type: 'event', for_obj_type: 'event',
@@ -633,9 +640,9 @@ export async function search__event_file(
if (event_file_obj_li_get_result) { if (event_file_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_file_props({ const processed_obj_li = await process_ae_obj__event_file_props({
obj_li: event_file_obj_li_get_result, obj_li: event_file_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -649,7 +656,7 @@ export async function search__event_file(
table_name: 'file', table_name: 'file',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -665,8 +672,7 @@ export async function search__event_file(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li);
@@ -674,12 +680,6 @@ export async function search__event_file(
return ae_promises.load__event_file_obj_li; return ae_promises.load__event_file_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -751,10 +751,9 @@ export const properties_to_save = [
'event_presenter_given_name', 'event_presenter_given_name',
'event_presenter_family_name', 'event_presenter_family_name',
'event_presenter_full_name', 'event_presenter_full_name',
'event_presenter_email', 'event_presenter_email'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -823,7 +822,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function process_ae_obj__event_file_props({ export async function process_ae_obj__event_file_props({
obj_li, obj_li,

View File

@@ -1,19 +1,17 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
import { load_ae_obj_li__event_device } from "$lib/ae_events/ae_events__event_device"; import { load_ae_obj_li__event_device } from '$lib/ae_events/ae_events__event_device';
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file"; import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file';
import { load_ae_obj_li__event_session } from './ae_events__event_session'; import { load_ae_obj_li__event_session } from './ae_events__event_session';
let ae_promises: key_val = {}; const ae_promises: key_val = {};
// Updated 2025-05-23 // Updated 2025-05-23
export async function load_ae_obj_id__event_location( export async function load_ae_obj_id__event_location({
{
api_cfg, api_cfg,
event_location_id, event_location_id,
inc_file_li = false, inc_file_li = false,
@@ -21,21 +19,21 @@ export async function load_ae_obj_id__event_location(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_location_id: string, event_location_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_session_li?: boolean, inc_session_li?: boolean;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_location() *** event_location_id=${event_location_id}`); console.log(`*** load_ae_obj_id__event_location() *** event_location_id=${event_location_id}`);
} }
let params = {}; const params = {};
ae_promises.load__event_location_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_location_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_location', obj_type: 'event_location',
obj_id: event_location_id, // NOTE: This is the FQDN, not normally the ID. obj_id: event_location_id, // NOTE: This is the FQDN, not normally the ID.
@@ -47,7 +45,7 @@ export async function load_ae_obj_id__event_location(
.then(async function (event_location_obj_get_result) { .then(async function (event_location_obj_get_result) {
if (event_location_obj_get_result) { if (event_location_obj_get_result) {
if (try_cache) { if (try_cache) {
let processed_obj_li = await process_ae_obj__event_location_props({ const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: [event_location_obj_get_result], obj_li: [event_location_obj_get_result],
log_lvl log_lvl
}); });
@@ -60,7 +58,7 @@ export async function load_ae_obj_id__event_location(
table_name: 'location', table_name: 'location',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save, properties_to_save,
log_lvl, log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -96,7 +94,7 @@ export async function load_ae_obj_id__event_location(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the file list for the location now`); console.log(`Need to load the file list for the location now`);
} }
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_location', for_obj_type: 'event_location',
for_obj_id: event_location_id, for_obj_id: event_location_id,
@@ -104,8 +102,7 @@ export async function load_ae_obj_id__event_location(
limit: 15, limit: 15,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -123,7 +120,7 @@ export async function load_ae_obj_id__event_location(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the session list for the location now`); console.log(`Need to load the session list for the location now`);
} }
let load_event_session_obj_li = load_ae_obj_li__event_session({ const load_event_session_obj_li = load_ae_obj_li__event_session({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_location', for_obj_type: 'event_location',
for_obj_id: event_location_id, for_obj_id: event_location_id,
@@ -142,10 +139,8 @@ export async function load_ae_obj_id__event_location(
return ae_promises.load__event_location_obj; return ae_promises.load__event_location_obj;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function load_ae_obj_li__event_location( export async function load_ae_obj_li__event_location({
{
api_cfg, api_cfg,
for_obj_type, for_obj_type,
for_obj_id, for_obj_id,
@@ -156,37 +151,46 @@ export async function load_ae_obj_li__event_location(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 29, limit = 29,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'code': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
code: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_device_li?: boolean, inc_device_li?: boolean;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_session_li?: boolean, inc_session_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, // 99 limit?: number; // 99
offset?: number, // 0 offset?: number; // 0
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_location() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__event_location() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
// ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_location_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_location', obj_type: 'event_location',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -206,9 +210,9 @@ export async function load_ae_obj_li__event_location(
if (event_location_obj_li_get_result) { if (event_location_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_location_props({ const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: event_location_obj_li_get_result, obj_li: event_location_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -222,7 +226,7 @@ export async function load_ae_obj_li__event_location(
table_name: 'location', table_name: 'location',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -243,7 +247,10 @@ export async function load_ae_obj_li__event_location(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_location_obj_li:', ae_promises.load__event_location_obj_li); console.log(
'ae_promises.load__event_location_obj_li:',
ae_promises.load__event_location_obj_li
);
} }
if (inc_device_li) { if (inc_device_li) {
@@ -252,18 +259,17 @@ export async function load_ae_obj_li__event_location(
console.log(`Need to load the device list for each location now`); console.log(`Need to load the device list for each location now`);
} }
for (let i = 0; i < ae_promises.load__event_location_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_location_obj_li.length; i++) {
let event_location_obj = ae_promises.load__event_location_obj_li[i]; const event_location_obj = ae_promises.load__event_location_obj_li[i];
let event_location_id = event_location_obj.event_location_id_random; const event_location_id = event_location_obj.event_location_id_random;
let load_event_device_obj_li = load_ae_obj_li__event_device({ const load_event_device_obj_li = load_ae_obj_li__event_device({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_location', for_obj_type: 'event_location',
for_obj_id: event_location_id, for_obj_id: event_location_id,
params: { qry__enabled: enabled, qry__limit: limit }, params: { qry__enabled: enabled, qry__limit: limit },
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_device_obj_li) => {
.then((event_device_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_device_obj_li = `, event_device_obj_li); console.log(`event_device_obj_li = `, event_device_obj_li);
} }
@@ -282,10 +288,10 @@ export async function load_ae_obj_li__event_location(
console.log(`Need to load the file list for each location now`); console.log(`Need to load the file list for each location now`);
} }
for (let i = 0; i < ae_promises.load__event_location_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_location_obj_li.length; i++) {
let event_location_obj = ae_promises.load__event_location_obj_li[i]; const event_location_obj = ae_promises.load__event_location_obj_li[i];
let event_location_id = event_location_obj.event_location_id_random; const event_location_id = event_location_obj.event_location_id_random;
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_location', for_obj_type: 'event_location',
for_obj_id: event_location_id, for_obj_id: event_location_id,
@@ -293,8 +299,7 @@ export async function load_ae_obj_li__event_location(
limit: limit, limit: limit,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -313,10 +318,10 @@ export async function load_ae_obj_li__event_location(
console.log(`Need to load the session list for each location now`); console.log(`Need to load the session list for each location now`);
} }
for (let i = 0; i < ae_promises.load__event_location_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_location_obj_li.length; i++) {
let event_location_obj = ae_promises.load__event_location_obj_li[i]; const event_location_obj = ae_promises.load__event_location_obj_li[i];
let event_location_id = event_location_obj.event_location_id_random; const event_location_id = event_location_obj.event_location_id_random;
let load_event_session_obj_li = load_ae_obj_li__event_session({ const load_event_session_obj_li = load_ae_obj_li__event_session({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_location', for_obj_type: 'event_location',
for_obj_id: event_location_id, for_obj_id: event_location_id,
@@ -324,8 +329,7 @@ export async function load_ae_obj_li__event_location(
limit: limit, limit: limit,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_session_obj_li) => {
.then((event_session_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_session_obj_li = `, event_session_obj_li); console.log(`event_session_obj_li = `, event_session_obj_li);
} }
@@ -341,10 +345,8 @@ export async function load_ae_obj_li__event_location(
return ae_promises.load__event_location_obj_li; return ae_promises.load__event_location_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function create_ae_obj__event_location( export async function create_ae_obj__event_location({
{
api_cfg, api_cfg,
event_id, event_id,
data_kv, data_kv,
@@ -352,19 +354,19 @@ export async function create_ae_obj__event_location(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_location() *** event_id=${event_id}`); console.log(`*** create_ae_obj__event_location() *** event_id=${event_id}`);
} }
ae_promises.create__event_location = await api.create_ae_obj_crud({ ae_promises.create__event_location = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_location', obj_type: 'event_location',
fields: { fields: {
@@ -380,9 +382,9 @@ export async function create_ae_obj__event_location(
if (event_location_obj_create_result) { if (event_location_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_location_props({ const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: [event_location_obj_create_result], obj_li: [event_location_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -396,7 +398,7 @@ export async function create_ae_obj__event_location(
table_name: 'location', table_name: 'location',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -416,8 +418,7 @@ export async function create_ae_obj__event_location(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event_location:', ae_promises.create__event_location); console.log('ae_promises.create__event_location:', ae_promises.create__event_location);
@@ -425,10 +426,8 @@ export async function create_ae_obj__event_location(
return ae_promises.create__event_location; return ae_promises.create__event_location;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function delete_ae_obj_id__event_location( export async function delete_ae_obj_id__event_location({
{
api_cfg, api_cfg,
event_location_id, event_location_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -436,19 +435,21 @@ export async function delete_ae_obj_id__event_location(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_location_id: string, event_location_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_location() *** event_location_id=${event_location_id}`); console.log(
`*** delete_ae_obj_id__event_location() *** event_location_id=${event_location_id}`
);
} }
ae_promises.delete__event_location_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_location_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_location', obj_type: 'event_location',
obj_id: event_location_id, obj_id: event_location_id,
@@ -476,10 +477,8 @@ export async function delete_ae_obj_id__event_location(
return ae_promises.delete__event_location_obj; return ae_promises.delete__event_location_obj;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function update_ae_obj__event_location( export async function update_ae_obj__event_location({
{
api_cfg, api_cfg,
event_location_id, event_location_id,
data_kv, data_kv,
@@ -487,18 +486,21 @@ export async function update_ae_obj__event_location(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_location_id: string, event_location_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_location() *** event_location_id=${event_location_id}`, data_kv); console.log(
`*** update_ae_obj__event_location() *** event_location_id=${event_location_id}`,
data_kv
);
} }
ae_promises.update__event_location_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_location_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_location', obj_type: 'event_location',
obj_id: event_location_id, obj_id: event_location_id,
@@ -512,9 +514,9 @@ export async function update_ae_obj__event_location(
if (event_location_obj_update_result) { if (event_location_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_location_props({ const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: [event_location_obj_update_result], obj_li: [event_location_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -528,7 +530,7 @@ export async function update_ae_obj__event_location(
table_name: 'location', table_name: 'location',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -546,8 +548,7 @@ export async function update_ae_obj__event_location(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_location_obj:', ae_promises.update__event_location_obj); console.log('ae_promises.update__event_location_obj:', ae_promises.update__event_location_obj);
@@ -555,10 +556,8 @@ export async function update_ae_obj__event_location(
return ae_promises.update__event_location_obj; return ae_promises.update__event_location_obj;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function search__event_location( export async function search__event_location({
{
api_cfg, api_cfg,
event_id, event_id,
fulltext_search_qry_str, fulltext_search_qry_str,
@@ -570,28 +569,27 @@ export async function search__event_location(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
ft_presenter_search_qry_str?: null|string, ft_presenter_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
like_presentation_search_qry_str?: null|string, like_presentation_search_qry_str?: null | string;
like_presenter_search_qry_str?: null|string, like_presenter_search_qry_str?: null | string;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_location() *** event_id=${event_id}`); console.log(`*** search__event_location() *** event_id=${event_id}`);
} }
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 25); // 99 const limit: number = params.qry__limit ?? 25; // 99
let offset: number = (params.qry__offset ?? 0); // 0 const offset: number = params.qry__offset ?? 0; // 0
let params_json: key_val = {}; const params_json: key_val = {};
if (!fulltext_search_qry_str && !like_search_qry_str) { if (!fulltext_search_qry_str && !like_search_qry_str) {
console.log('No search string provided!!!'); console.log('No search string provided!!!');
@@ -640,10 +638,18 @@ export async function search__event_location(
// params_json['and_qry']['location_type_code'] = location_type_code; // params_json['and_qry']['location_type_code'] = location_type_code;
// } // }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; const order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
};
// ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_location_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_location', obj_type: 'event_location',
for_obj_type: 'event', for_obj_type: 'event',
@@ -663,9 +669,9 @@ export async function search__event_location(
if (event_location_obj_li_get_result) { if (event_location_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_location_props({ const processed_obj_li = await process_ae_obj__event_location_props({
obj_li: event_location_obj_li_get_result, obj_li: event_location_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -679,7 +685,7 @@ export async function search__event_location(
table_name: 'location', table_name: 'location',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -693,19 +699,17 @@ export async function search__event_location(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_location_obj_li:', ae_promises.load__event_location_obj_li); console.log(
'ae_promises.load__event_location_obj_li:',
ae_promises.load__event_location_obj_li
);
} }
return ae_promises.load__event_location_obj_li; return ae_promises.load__event_location_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -753,10 +757,9 @@ export const properties_to_save = [
'internal_use_count', 'internal_use_count',
'event_file_id_li_json', 'event_file_id_li_json',
'event_name', 'event_name'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -825,7 +828,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function process_ae_obj__event_location_props({ export async function process_ae_obj__event_location_props({
obj_li, obj_li,

View File

@@ -1,18 +1,16 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file"; import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file';
import { load_ae_obj_li__event_presenter } from "$lib/ae_events/ae_events__event_presenter"; import { load_ae_obj_li__event_presenter } from '$lib/ae_events/ae_events__event_presenter';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-05-22 // Updated 2025-05-22
export async function load_ae_obj_id__event_presentation( export async function load_ae_obj_id__event_presentation({
{
api_cfg, api_cfg,
event_presentation_id, event_presentation_id,
inc_file_li = false, inc_file_li = false,
@@ -24,25 +22,27 @@ export async function load_ae_obj_id__event_presentation(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_presentation_id: string, event_presentation_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`); console.log(
`*** load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`
);
} }
let params = {}; const params = {};
ae_promises.load__event_presentation_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_presentation_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presentation', obj_type: 'event_presentation',
obj_id: event_presentation_id, // NOTE: This is the FQDN, not normally the ID. obj_id: event_presentation_id, // NOTE: This is the FQDN, not normally the ID.
@@ -55,9 +55,9 @@ export async function load_ae_obj_id__event_presentation(
if (event_presentation_obj_get_result) { if (event_presentation_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presentation_props({ const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: [event_presentation_obj_get_result], obj_li: [event_presentation_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -71,7 +71,7 @@ export async function load_ae_obj_id__event_presentation(
table_name: 'presentation', table_name: 'presentation',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -95,7 +95,10 @@ export async function load_ae_obj_id__event_presentation(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_presentation_obj:', ae_promises.load__event_presentation_obj); console.log(
'ae_promises.load__event_presentation_obj:',
ae_promises.load__event_presentation_obj
);
} }
if (ae_promises?.load__event_presentation_obj === null) { if (ae_promises?.load__event_presentation_obj === null) {
@@ -108,7 +111,7 @@ export async function load_ae_obj_id__event_presentation(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the file list for the presentation now.`); console.log(`Need to load the file list for the presentation now.`);
} }
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_presentation', for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id, for_obj_id: event_presentation_id,
@@ -116,8 +119,7 @@ export async function load_ae_obj_id__event_presentation(
limit: 25, limit: 25,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -135,7 +137,7 @@ export async function load_ae_obj_id__event_presentation(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the presenter list for the presentation now.`); console.log(`Need to load the presenter list for the presentation now.`);
} }
let load_event_presenter_obj_li = load_ae_obj_li__event_presenter({ const load_event_presenter_obj_li = load_ae_obj_li__event_presenter({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_presentation', for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id, for_obj_id: event_presentation_id,
@@ -148,8 +150,7 @@ export async function load_ae_obj_id__event_presentation(
// params: params, // params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_presenter_obj_li) => {
.then((event_presenter_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_presenter_obj_li = `, event_presenter_obj_li); console.log(`event_presenter_obj_li = `, event_presenter_obj_li);
} }
@@ -165,10 +166,8 @@ export async function load_ae_obj_id__event_presentation(
return ae_promises.load__event_presentation_obj; return ae_promises.load__event_presentation_obj;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function load_ae_obj_li__event_presentation( export async function load_ae_obj_li__event_presentation({
{
api_cfg, api_cfg,
for_obj_type = 'event_session', for_obj_type = 'event_session',
for_obj_id, for_obj_id,
@@ -178,28 +177,36 @@ export async function load_ae_obj_li__event_presentation(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_presentation() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__event_presentation() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -207,12 +214,13 @@ export async function load_ae_obj_li__event_presentation(
// let limit: number = (params.qry__limit ?? 99); // 99 // let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console('params_json:', params_json); // console('params_json:', params_json);
// ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_presentation_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presentation', obj_type: 'event_presentation',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -232,9 +240,9 @@ export async function load_ae_obj_li__event_presentation(
if (event_presentation_obj_li_get_result) { if (event_presentation_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presentation_props({ const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: event_presentation_obj_li_get_result, obj_li: event_presentation_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -248,7 +256,7 @@ export async function load_ae_obj_li__event_presentation(
table_name: 'presentation', table_name: 'presentation',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -268,7 +276,10 @@ export async function load_ae_obj_li__event_presentation(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_presentation_obj_li:', ae_promises.load__event_presentation_obj_li); console.log(
'ae_promises.load__event_presentation_obj_li:',
ae_promises.load__event_presentation_obj_li
);
} }
if (inc_file_li) { if (inc_file_li) {
@@ -277,10 +288,10 @@ export async function load_ae_obj_li__event_presentation(
console.log(`Need to load the file list for each presentation now.`); console.log(`Need to load the file list for each presentation now.`);
} }
for (let i = 0; i < ae_promises.load__event_presentation_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_presentation_obj_li.length; i++) {
let event_presentation_obj = ae_promises.load__event_presentation_obj_li[i]; const event_presentation_obj = ae_promises.load__event_presentation_obj_li[i];
let event_presentation_id = event_presentation_obj.event_presentation_id_random; const event_presentation_id = event_presentation_obj.event_presentation_id_random;
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_presentation', for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id, for_obj_id: event_presentation_id,
@@ -288,8 +299,7 @@ export async function load_ae_obj_li__event_presentation(
limit: limit, limit: limit,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -309,10 +319,10 @@ export async function load_ae_obj_li__event_presentation(
console.log(`Need to load the presenter list for each presentation now.`); console.log(`Need to load the presenter list for each presentation now.`);
} }
for (let i = 0; i < ae_promises.load__event_presentation_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_presentation_obj_li.length; i++) {
let event_presentation_obj = ae_promises.load__event_presentation_obj_li[i]; const event_presentation_obj = ae_promises.load__event_presentation_obj_li[i];
let event_presentation_id = event_presentation_obj.event_presentation_id_random; const event_presentation_id = event_presentation_obj.event_presentation_id_random;
let load_event_presenter_obj_li = load_ae_obj_li__event_presenter({ const load_event_presenter_obj_li = load_ae_obj_li__event_presenter({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_presentation', for_obj_type: 'event_presentation',
for_obj_id: event_presentation_id, for_obj_id: event_presentation_id,
@@ -325,8 +335,7 @@ export async function load_ae_obj_li__event_presentation(
// params: {}, // params: {},
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_presenter_obj_li) => {
.then((event_presenter_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_presenter_obj_li = `, event_presenter_obj_li); console.log(`event_presenter_obj_li = `, event_presenter_obj_li);
} }
@@ -343,10 +352,8 @@ export async function load_ae_obj_li__event_presentation(
return ae_promises.load__event_presentation_obj_li; return ae_promises.load__event_presentation_obj_li;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function create_ae_obj__event_presentation( export async function create_ae_obj__event_presentation({
{
api_cfg, api_cfg,
event_id, event_id,
event_session_id, event_session_id,
@@ -355,20 +362,22 @@ export async function create_ae_obj__event_presentation(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
event_session_id: string, event_session_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_presentation() *** event_id=${event_id} event_session_id=${event_session_id}`); console.log(
`*** create_ae_obj__event_presentation() *** event_id=${event_id} event_session_id=${event_session_id}`
);
} }
ae_promises.create__event_presentation = await api.create_ae_obj_crud({ ae_promises.create__event_presentation = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presentation', obj_type: 'event_presentation',
fields: { fields: {
@@ -385,9 +394,9 @@ export async function create_ae_obj__event_presentation(
if (event_presentation_obj_create_result) { if (event_presentation_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presentation_props({ const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: [event_presentation_obj_create_result], obj_li: [event_presentation_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -401,7 +410,7 @@ export async function create_ae_obj__event_presentation(
table_name: 'presentation', table_name: 'presentation',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -421,8 +430,7 @@ export async function create_ae_obj__event_presentation(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event_presentation:', ae_promises.create__event_presentation); console.log('ae_promises.create__event_presentation:', ae_promises.create__event_presentation);
@@ -430,10 +438,8 @@ export async function create_ae_obj__event_presentation(
return ae_promises.create__event_presentation; return ae_promises.create__event_presentation;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function delete_ae_obj_id__event_presentation( export async function delete_ae_obj_id__event_presentation({
{
api_cfg, api_cfg,
event_presentation_id, event_presentation_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -441,19 +447,21 @@ export async function delete_ae_obj_id__event_presentation(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_presentation_id: string, event_presentation_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`); console.log(
`*** delete_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`
);
} }
ae_promises.delete__event_presentation_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_presentation_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presentation', obj_type: 'event_presentation',
obj_id: event_presentation_id, obj_id: event_presentation_id,
@@ -468,23 +476,26 @@ export async function delete_ae_obj_id__event_presentation(
.finally(function () { .finally(function () {
if (try_cache) { if (try_cache) {
if (log_lvl) { if (log_lvl) {
console.log(`Attempting to remove IDB entry for event_presentation_id=${event_presentation_id}`); console.log(
`Attempting to remove IDB entry for event_presentation_id=${event_presentation_id}`
);
} }
db_events.presentation.delete(event_presentation_id); db_events.presentation.delete(event_presentation_id);
} }
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.delete__event_presentation_obj:', ae_promises.delete__event_presentation_obj); console.log(
'ae_promises.delete__event_presentation_obj:',
ae_promises.delete__event_presentation_obj
);
} }
return ae_promises.delete__event_presentation_obj; return ae_promises.delete__event_presentation_obj;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function update_ae_obj__event_presentation( export async function update_ae_obj__event_presentation({
{
api_cfg, api_cfg,
event_presentation_id, event_presentation_id,
data_kv, data_kv,
@@ -492,18 +503,21 @@ export async function update_ae_obj__event_presentation(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_presentation_id: string, event_presentation_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_presentation() *** event_presentation_id=${event_presentation_id}`, data_kv); console.log(
`*** update_ae_obj__event_presentation() *** event_presentation_id=${event_presentation_id}`,
data_kv
);
} }
ae_promises.update__event_presentation_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_presentation_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presentation', obj_type: 'event_presentation',
obj_id: event_presentation_id, obj_id: event_presentation_id,
@@ -517,9 +531,9 @@ export async function update_ae_obj__event_presentation(
if (event_presentation_obj_update_result) { if (event_presentation_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presentation_props({ const processed_obj_li = await process_ae_obj__event_presentation_props({
obj_li: [event_presentation_obj_update_result], obj_li: [event_presentation_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -533,7 +547,7 @@ export async function update_ae_obj__event_presentation(
table_name: 'presentation', table_name: 'presentation',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -553,19 +567,17 @@ export async function update_ae_obj__event_presentation(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_presentation_obj:', ae_promises.update__event_presentation_obj); console.log(
'ae_promises.update__event_presentation_obj:',
ae_promises.update__event_presentation_obj
);
} }
return ae_promises.update__event_presentation_obj; return ae_promises.update__event_presentation_obj;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -617,12 +629,11 @@ export const properties_to_save = [
// From SQL view // From SQL view
'event_session_code', 'event_session_code',
'event_session_name', 'event_session_name'
// Add more fields here if your DB save logic uses them // Add more fields here if your DB save logic uses them
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -691,7 +702,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function process_ae_obj__event_presentation_props({ export async function process_ae_obj__event_presentation_props({
obj_li, obj_li,

View File

@@ -1,17 +1,15 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file"; import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2024-10-08 // Updated 2024-10-08
export async function load_ae_obj_id__event_presenter( export async function load_ae_obj_id__event_presenter({
{
api_cfg, api_cfg,
event_presenter_id, event_presenter_id,
inc_file_li = false, inc_file_li = false,
@@ -22,24 +20,26 @@ export async function load_ae_obj_id__event_presenter(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_presenter_id: string, event_presenter_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`); console.log(
`*** load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`
);
} }
let params = {}; const params = {};
ae_promises.load__event_presenter_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_presenter_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presenter', obj_type: 'event_presenter',
obj_id: event_presenter_id, // NOTE: This is the FQDN, not normally the ID. obj_id: event_presenter_id, // NOTE: This is the FQDN, not normally the ID.
@@ -52,9 +52,9 @@ export async function load_ae_obj_id__event_presenter(
if (event_presenter_obj_get_result) { if (event_presenter_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presenter_props({ const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: [event_presenter_obj_get_result], obj_li: [event_presenter_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -68,7 +68,7 @@ export async function load_ae_obj_id__event_presenter(
table_name: 'presenter', table_name: 'presenter',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -95,7 +95,7 @@ export async function load_ae_obj_id__event_presenter(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the file list for the presenter now.`); console.log(`Need to load the file list for the presenter now.`);
} }
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_presenter', for_obj_type: 'event_presenter',
for_obj_id: event_presenter_id, for_obj_id: event_presenter_id,
@@ -103,8 +103,7 @@ export async function load_ae_obj_id__event_presenter(
limit: limit, limit: limit,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -120,10 +119,8 @@ export async function load_ae_obj_id__event_presenter(
return ae_promises.load__event_presenter_obj; return ae_promises.load__event_presenter_obj;
} }
// Updated 2024-10-08 // Updated 2024-10-08
export async function load_ae_obj_li__event_presenter( export async function load_ae_obj_li__event_presenter({
{
api_cfg, api_cfg,
for_obj_type, for_obj_type,
for_obj_id, for_obj_id,
@@ -132,27 +129,35 @@ export async function load_ae_obj_li__event_presenter(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 19, limit = 19,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'given_name': 'ASC', 'family_name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
given_name: 'ASC',
family_name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_presenter() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__event_presenter() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -160,12 +165,13 @@ export async function load_ae_obj_li__event_presenter(
// let limit: number = (params.qry__limit ?? 99); // 99 // let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
// ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_presenter_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presenter', obj_type: 'event_presenter',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -185,9 +191,9 @@ export async function load_ae_obj_li__event_presenter(
if (event_presenter_obj_li_get_result) { if (event_presenter_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presenter_props({ const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: event_presenter_obj_li_get_result, obj_li: event_presenter_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -201,7 +207,7 @@ export async function load_ae_obj_li__event_presenter(
table_name: 'presenter', table_name: 'presenter',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -222,7 +228,10 @@ export async function load_ae_obj_li__event_presenter(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_presenter_obj_li:', ae_promises.load__event_presenter_obj_li); console.log(
'ae_promises.load__event_presenter_obj_li:',
ae_promises.load__event_presenter_obj_li
);
} }
if (inc_file_li) { if (inc_file_li) {
@@ -231,10 +240,10 @@ export async function load_ae_obj_li__event_presenter(
console.log(`Need to load the file list for each presenter now.`); console.log(`Need to load the file list for each presenter now.`);
} }
for (let i = 0; i < ae_promises.load__event_presenter_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_presenter_obj_li.length; i++) {
let event_presenter_obj = ae_promises.load__event_presenter_obj_li[i]; const event_presenter_obj = ae_promises.load__event_presenter_obj_li[i];
let event_presenter_id = event_presenter_obj.event_presenter_id_random; const event_presenter_id = event_presenter_obj.event_presenter_id_random;
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_presenter', for_obj_type: 'event_presenter',
for_obj_id: event_presenter_id, for_obj_id: event_presenter_id,
@@ -242,8 +251,7 @@ export async function load_ae_obj_li__event_presenter(
limit: limit, limit: limit,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -260,10 +268,8 @@ export async function load_ae_obj_li__event_presenter(
return ae_promises.load__event_presenter_obj_li; return ae_promises.load__event_presenter_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function create_ae_obj__event_presenter( export async function create_ae_obj__event_presenter({
{
api_cfg, api_cfg,
event_id, event_id,
event_session_id, event_session_id,
@@ -273,21 +279,23 @@ export async function create_ae_obj__event_presenter(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
event_session_id: string, event_session_id: string;
event_presentation_id: string, event_presentation_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_presenter() *** event_id=${event_id} event_session_id=${event_session_id} event_presentation_id=${event_presentation_id}`); console.log(
`*** create_ae_obj__event_presenter() *** event_id=${event_id} event_session_id=${event_session_id} event_presentation_id=${event_presentation_id}`
);
} }
ae_promises.create__event_presenter = await api.create_ae_obj_crud({ ae_promises.create__event_presenter = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presenter', obj_type: 'event_presenter',
fields: { fields: {
@@ -305,9 +313,9 @@ export async function create_ae_obj__event_presenter(
if (event_presenter_obj_create_result) { if (event_presenter_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presenter_props({ const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: [event_presenter_obj_create_result], obj_li: [event_presenter_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -321,7 +329,7 @@ export async function create_ae_obj__event_presenter(
table_name: 'presenter', table_name: 'presenter',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -340,8 +348,7 @@ export async function create_ae_obj__event_presenter(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event_presenter:', ae_promises.create__event_presenter); console.log('ae_promises.create__event_presenter:', ae_promises.create__event_presenter);
@@ -349,10 +356,8 @@ export async function create_ae_obj__event_presenter(
return ae_promises.create__event_presenter; return ae_promises.create__event_presenter;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function delete_ae_obj_id__event_presenter( export async function delete_ae_obj_id__event_presenter({
{
api_cfg, api_cfg,
event_presenter_id, event_presenter_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -360,19 +365,21 @@ export async function delete_ae_obj_id__event_presenter(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_presenter_id: string, event_presenter_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`); console.log(
`*** delete_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`
);
} }
ae_promises.delete__event_presenter_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_presenter_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presenter', obj_type: 'event_presenter',
obj_id: event_presenter_id, obj_id: event_presenter_id,
@@ -387,23 +394,26 @@ export async function delete_ae_obj_id__event_presenter(
.finally(function () { .finally(function () {
if (try_cache) { if (try_cache) {
if (log_lvl) { if (log_lvl) {
console.log(`Attempting to remove IDB entry for event_presenter_id=${event_presenter_id}`); console.log(
`Attempting to remove IDB entry for event_presenter_id=${event_presenter_id}`
);
} }
db_events.presenter.delete(event_presenter_id); db_events.presenter.delete(event_presenter_id);
} }
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.delete__event_presenter_obj:', ae_promises.delete__event_presenter_obj); console.log(
'ae_promises.delete__event_presenter_obj:',
ae_promises.delete__event_presenter_obj
);
} }
return ae_promises.delete__event_presenter_obj; return ae_promises.delete__event_presenter_obj;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function update_ae_obj__event_presenter( export async function update_ae_obj__event_presenter({
{
api_cfg, api_cfg,
event_presenter_id, event_presenter_id,
data_kv, data_kv,
@@ -411,19 +421,22 @@ export async function update_ae_obj__event_presenter(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_presenter_id: string, event_presenter_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_presenter() *** event_presenter_id=${event_presenter_id}`, data_kv); console.log(
`*** update_ae_obj__event_presenter() *** event_presenter_id=${event_presenter_id}`,
data_kv
);
} }
ae_promises.update__event_presenter_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_presenter_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presenter', obj_type: 'event_presenter',
obj_id: event_presenter_id, obj_id: event_presenter_id,
@@ -437,9 +450,9 @@ export async function update_ae_obj__event_presenter(
if (event_presenter_obj_update_result) { if (event_presenter_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presenter_props({ const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: [event_presenter_obj_update_result], obj_li: [event_presenter_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -453,7 +466,7 @@ export async function update_ae_obj__event_presenter(
table_name: 'presenter', table_name: 'presenter',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -472,19 +485,19 @@ export async function update_ae_obj__event_presenter(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_presenter_obj:', ae_promises.update__event_presenter_obj); console.log(
'ae_promises.update__event_presenter_obj:',
ae_promises.update__event_presenter_obj
);
} }
return ae_promises.update__event_presenter_obj; return ae_promises.update__event_presenter_obj;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function search__event_presenter( export async function search__event_presenter({
{
api_cfg, api_cfg,
event_id, event_id,
agree = null, agree = null,
@@ -498,30 +511,37 @@ export async function search__event_presenter(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'given_name': 'ASC', 'family_name': 'ASC', 'email': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
given_name: 'ASC',
family_name: 'ASC',
email: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
agree?: null|boolean, agree?: null | boolean;
biography?: null|boolean, biography?: null | boolean;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
ft_presenter_search_qry_str?: null|string, ft_presenter_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
like_presentation_search_qry_str?: null|string, like_presentation_search_qry_str?: null | string;
like_presenter_search_qry_str?: null|string, like_presenter_search_qry_str?: null | string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_presenter() *** event_id=${event_id}`); console.log(`*** search__event_presenter() *** event_id=${event_id}`);
} }
@@ -531,7 +551,7 @@ export async function search__event_presenter(
// let limit: number = (params.qry__limit ?? 25); // 99 // let limit: number = (params.qry__limit ?? 25); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (!fulltext_search_qry_str && !like_search_qry_str) { // if (!fulltext_search_qry_str && !like_search_qry_str) {
// console.log('No search string provided!!!'); // console.log('No search string provided!!!');
@@ -591,7 +611,8 @@ export async function search__event_presenter(
} }
// ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_presenter_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_presenter_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_presenter', obj_type: 'event_presenter',
for_obj_type: 'event', for_obj_type: 'event',
@@ -611,9 +632,9 @@ export async function search__event_presenter(
if (event_presenter_obj_li_get_result) { if (event_presenter_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_presenter_props({ const processed_obj_li = await process_ae_obj__event_presenter_props({
obj_li: event_presenter_obj_li_get_result, obj_li: event_presenter_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -627,7 +648,7 @@ export async function search__event_presenter(
table_name: 'presenter', table_name: 'presenter',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -641,22 +662,19 @@ export async function search__event_presenter(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_presenter_obj_li:', ae_promises.load__event_presenter_obj_li); console.log(
'ae_promises.load__event_presenter_obj_li:',
ae_promises.load__event_presenter_obj_li
);
} }
return ae_promises.load__event_presenter_obj_li; return ae_promises.load__event_presenter_obj_li;
} }
// Updated 2024-08-07 // Updated 2024-08-07
export async function email_sign_in__event_presenter ( export async function email_sign_in__event_presenter({
{
api_cfg, api_cfg,
to_email, to_email,
to_name, to_name,
@@ -671,30 +689,33 @@ export async function email_sign_in__event_presenter (
presentation_name, presentation_name,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
to_email: string, to_email: string;
to_name: string, to_name: string;
base_url: string, base_url: string;
person_id: string, person_id: string;
person_passcode: string, person_passcode: string;
event_id: string, event_id: string;
event_session_id: string, event_session_id: string;
event_presentation_id: string, event_presentation_id: string;
event_presenter_id: string, event_presenter_id: string;
session_name: string, session_name: string;
presentation_name: string, presentation_name: string;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** email_sign_in__event_presenter() *** to_email=${to_email} to_name=${to_name} person_id=${person_id} person_passcode=${person_passcode} presentation_id=${event_presentation_id} presenter_id=${event_presenter_id}`); console.log(
`*** email_sign_in__event_presenter() *** to_email=${to_email} to_name=${to_name} person_id=${person_id} person_passcode=${person_passcode} presentation_id=${event_presentation_id} presenter_id=${event_presenter_id}`
);
} }
let subject = `LCI Congress 2025 - Pres Mgmt Hub Sign In Link for ${session_name} (ID: ${event_session_id})`; const subject = `LCI Congress 2025 - Pres Mgmt Hub Sign In Link for ${session_name} (ID: ${event_session_id})`;
let sign_in_url = encodeURI(`${base_url}/events/${event_id}/session/${event_session_id}?person_id=${person_id}&person_pass=${person_passcode}&presentation_id=${event_presentation_id}&presenter_id=${event_presenter_id}`) const sign_in_url = encodeURI(
`${base_url}/events/${event_id}/session/${event_session_id}?person_id=${person_id}&person_pass=${person_passcode}&presentation_id=${event_presentation_id}&presenter_id=${event_presenter_id}`
);
let body_html = ` const body_html = `
<div>${to_name}, <div>${to_name},
<p>Your link to sign into the presentation management hub for LCI Congress 2025 is below. If you did not request this, please delete and ignore this email. If you need to make any changes or updates to your submission, you may use this link again later.</p> <p>Your link to sign into the presentation management hub for LCI Congress 2025 is below. If you did not request this, please delete and ignore this email. If you need to make any changes or updates to your submission, you may use this link again later.</p>
</div> </div>
@@ -717,11 +738,10 @@ export async function email_sign_in__event_presenter (
from_name: 'LCI 2025 Pres Mgmt Hub', from_name: 'LCI 2025 Pres Mgmt Hub',
to_email: to_email, to_email: to_email,
subject: subject, subject: subject,
body_html: body_html, body_html: body_html
}); });
} }
// Updated 2025-05-23 // Updated 2025-05-23
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -808,10 +828,9 @@ export const properties_to_save = [
'person_professional_title', 'person_professional_title',
'person_affiliations', 'person_affiliations',
'person_primary_email', 'person_primary_email',
'person_passcode', 'person_passcode'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -880,7 +899,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-23 // Updated 2025-05-23
export async function process_ae_obj__event_presenter_props({ export async function process_ae_obj__event_presenter_props({
obj_li, obj_li,

View File

@@ -1,18 +1,16 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file"; import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file';
import { load_ae_obj_li__event_presentation } from "$lib/ae_events/ae_events__event_presentation"; import { load_ae_obj_li__event_presentation } from '$lib/ae_events/ae_events__event_presentation';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-05-22 // Updated 2025-05-22
export async function load_ae_obj_id__event_session( export async function load_ae_obj_id__event_session({
{
api_cfg, api_cfg,
event_session_id, event_session_id,
inc_file_li = false, inc_file_li = false,
@@ -26,28 +24,28 @@ export async function load_ae_obj_id__event_session(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_session_id: string, event_session_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_all_file_li?: boolean, inc_all_file_li?: boolean;
inc_presentation_li?: boolean, inc_presentation_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__event_session() *** event_session_id=${event_session_id}`); console.log(`*** load_ae_obj_id__event_session() *** event_session_id=${event_session_id}`);
} }
let params = {}; const params = {};
// $events_sess.badges.status_load__event_session_obj = 'loading'; // $events_sess.badges.status_load__event_session_obj = 'loading';
ae_promises.load__event_session_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_session_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
obj_id: event_session_id, // NOTE: This is the FQDN, not normally the ID. obj_id: event_session_id, // NOTE: This is the FQDN, not normally the ID.
@@ -60,9 +58,9 @@ export async function load_ae_obj_id__event_session(
if (event_session_obj_get_result) { if (event_session_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_session_props({ const processed_obj_li = await process_ae_obj__event_session_props({
obj_li: [event_session_obj_get_result], obj_li: [event_session_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -76,7 +74,7 @@ export async function load_ae_obj_id__event_session(
table_name: 'session', table_name: 'session',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -112,7 +110,7 @@ export async function load_ae_obj_id__event_session(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the file list for the session now`); console.log(`Need to load the file list for the session now`);
} }
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_session', for_obj_type: 'event_session',
for_obj_id: event_session_id, for_obj_id: event_session_id,
@@ -120,8 +118,7 @@ export async function load_ae_obj_id__event_session(
limit: 15, limit: 15,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -140,7 +137,7 @@ export async function load_ae_obj_id__event_session(
console.log(`Need to load the presentation list for the session now`); console.log(`Need to load the presentation list for the session now`);
} }
// NOTE: The files will only be included if inc_all_file_li is true. 2025-09-17 // NOTE: The files will only be included if inc_all_file_li is true. 2025-09-17
let load_event_presentation_obj_li = load_ae_obj_li__event_presentation({ const load_event_presentation_obj_li = load_ae_obj_li__event_presentation({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_session', for_obj_type: 'event_session',
for_obj_id: event_session_id, for_obj_id: event_session_id,
@@ -153,8 +150,7 @@ export async function load_ae_obj_id__event_session(
params: {}, params: {},
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_presentation_obj_li) => {
.then((event_presentation_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_presentation_obj_li = `, event_presentation_obj_li); console.log(`event_presentation_obj_li = `, event_presentation_obj_li);
} }
@@ -170,10 +166,8 @@ export async function load_ae_obj_id__event_session(
return ae_promises.load__event_session_obj; return ae_promises.load__event_session_obj;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function load_ae_obj_li__event_session( export async function load_ae_obj_li__event_session({
{
api_cfg, api_cfg,
for_obj_type, for_obj_type,
for_obj_id, for_obj_id,
@@ -185,30 +179,38 @@ export async function load_ae_obj_li__event_session(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 149, limit = 149,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_file_li?: boolean, inc_file_li?: boolean;
inc_all_file_li?: boolean, inc_all_file_li?: boolean;
inc_presentation_li?: boolean, inc_presentation_li?: boolean;
inc_presenter_li?: boolean, inc_presenter_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, // 99 limit?: number; // 99
offset?: number, // 0 offset?: number; // 0
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__event_session() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__event_session() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -216,12 +218,13 @@ export async function load_ae_obj_li__event_session(
// let limit: number = (params.qry__limit ?? 99); // 99 // let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console.log('params_json:', params_json); // console.log('params_json:', params_json);
// ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_session_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -241,9 +244,9 @@ export async function load_ae_obj_li__event_session(
if (event_session_obj_li_get_result) { if (event_session_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_session_props({ const processed_obj_li = await process_ae_obj__event_session_props({
obj_li: event_session_obj_li_get_result, obj_li: event_session_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -257,7 +260,7 @@ export async function load_ae_obj_li__event_session(
table_name: 'session', table_name: 'session',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -287,10 +290,10 @@ export async function load_ae_obj_li__event_session(
console.log(`Need to load the file list for each session now`); console.log(`Need to load the file list for each session now`);
} }
for (let i = 0; i < ae_promises.load__event_session_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_session_obj_li.length; i++) {
let event_session_obj = ae_promises.load__event_session_obj_li[i]; const event_session_obj = ae_promises.load__event_session_obj_li[i];
let event_session_id = event_session_obj.event_session_id_random; const event_session_id = event_session_obj.event_session_id_random;
let load_event_file_obj_li = load_ae_obj_li__event_file({ const load_event_file_obj_li = load_ae_obj_li__event_file({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_session', for_obj_type: 'event_session',
for_obj_id: event_session_id, for_obj_id: event_session_id,
@@ -298,8 +301,7 @@ export async function load_ae_obj_li__event_session(
limit: limit, limit: limit,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_file_obj_li) => {
.then((event_file_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_file_obj_li = `, event_file_obj_li); console.log(`event_file_obj_li = `, event_file_obj_li);
} }
@@ -318,11 +320,11 @@ export async function load_ae_obj_li__event_session(
console.log(`Need to load the presentation list for each session now`); console.log(`Need to load the presentation list for each session now`);
} }
for (let i = 0; i < ae_promises.load__event_session_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__event_session_obj_li.length; i++) {
let event_session_obj = ae_promises.load__event_session_obj_li[i]; const event_session_obj = ae_promises.load__event_session_obj_li[i];
let event_session_id = event_session_obj.event_session_id_random; const event_session_id = event_session_obj.event_session_id_random;
// NOTE: The files will only be included if inc_all_file_li is true. 2025-09-17 // NOTE: The files will only be included if inc_all_file_li is true. 2025-09-17
let load_event_presentation_obj_li = load_ae_obj_li__event_presentation({ const load_event_presentation_obj_li = load_ae_obj_li__event_presentation({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'event_session', for_obj_type: 'event_session',
for_obj_id: event_session_id, for_obj_id: event_session_id,
@@ -335,8 +337,7 @@ export async function load_ae_obj_li__event_session(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((event_presentation_obj_li) => {
.then((event_presentation_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`event_presentation_obj_li = `, event_presentation_obj_li); console.log(`event_presentation_obj_li = `, event_presentation_obj_li);
} }
@@ -362,10 +363,8 @@ export async function load_ae_obj_li__event_session(
return ae_promises.load__event_session_obj_li; return ae_promises.load__event_session_obj_li;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function create_ae_obj__event_session( export async function create_ae_obj__event_session({
{
api_cfg, api_cfg,
event_id, event_id,
data_kv, data_kv,
@@ -373,19 +372,19 @@ export async function create_ae_obj__event_session(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: string, event_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__event_session() *** event_id=${event_id}`); console.log(`*** create_ae_obj__event_session() *** event_id=${event_id}`);
} }
ae_promises.create__event_session = await api.create_ae_obj_crud({ ae_promises.create__event_session = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
fields: { fields: {
@@ -401,9 +400,9 @@ export async function create_ae_obj__event_session(
if (event_session_obj_create_result) { if (event_session_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_session_props({ const processed_obj_li = await process_ae_obj__event_session_props({
obj_li: [event_session_obj_create_result], obj_li: [event_session_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -417,7 +416,7 @@ export async function create_ae_obj__event_session(
table_name: 'session', table_name: 'session',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -437,8 +436,7 @@ export async function create_ae_obj__event_session(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event_session:', ae_promises.create__event_session); console.log('ae_promises.create__event_session:', ae_promises.create__event_session);
@@ -446,10 +444,8 @@ export async function create_ae_obj__event_session(
return ae_promises.create__event_session; return ae_promises.create__event_session;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function delete_ae_obj_id__event_session( export async function delete_ae_obj_id__event_session({
{
api_cfg, api_cfg,
event_session_id, event_session_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -457,19 +453,19 @@ export async function delete_ae_obj_id__event_session(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_session_id: string, event_session_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_session() *** event_session_id=${event_session_id}`); console.log(`*** delete_ae_obj_id__event_session() *** event_session_id=${event_session_id}`);
} }
ae_promises.delete__event_session_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__event_session_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
obj_id: event_session_id, obj_id: event_session_id,
@@ -497,10 +493,8 @@ export async function delete_ae_obj_id__event_session(
return ae_promises.delete__event_session_obj; return ae_promises.delete__event_session_obj;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function update_ae_obj__event_session( export async function update_ae_obj__event_session({
{
api_cfg, api_cfg,
event_session_id, event_session_id,
data_kv, data_kv,
@@ -508,19 +502,22 @@ export async function update_ae_obj__event_session(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_session_id: string, event_session_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__event_session() *** event_session_id=${event_session_id}`, data_kv); console.log(
`*** update_ae_obj__event_session() *** event_session_id=${event_session_id}`,
data_kv
);
} }
// ae_promises.update__event_session_obj = 'test'; // ae_promises.update__event_session_obj = 'test';
ae_promises.update__event_session_obj = await api.update_ae_obj_id_crud({ ae_promises.update__event_session_obj = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
obj_id: event_session_id, obj_id: event_session_id,
@@ -534,9 +531,9 @@ export async function update_ae_obj__event_session(
if (event_session_obj_update_result) { if (event_session_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_session_props({ const processed_obj_li = await process_ae_obj__event_session_props({
obj_li: [event_session_obj_update_result], obj_li: [event_session_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -550,7 +547,7 @@ export async function update_ae_obj__event_session(
table_name: 'session', table_name: 'session',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -568,8 +565,7 @@ export async function update_ae_obj__event_session(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_session_obj:', ae_promises.update__event_session_obj); console.log('ae_promises.update__event_session_obj:', ae_promises.update__event_session_obj);
@@ -577,11 +573,9 @@ export async function update_ae_obj__event_session(
return ae_promises.update__event_session_obj; return ae_promises.update__event_session_obj;
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2025-07-21 // Updated 2025-07-21
export async function qry__event_session( export async function qry__event_session({
{
api_cfg, api_cfg,
event_id, event_id,
qry_str, qry_str,
@@ -593,73 +587,75 @@ export async function qry__event_session(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
qry_str?: string, qry_str?: string;
qry_files?: null|boolean, qry_files?: null | boolean;
qry_start_datetime?: null|string, // Greater than this datetime qry_start_datetime?: null | string; // Greater than this datetime
qry_poc_agree?: null|boolean, qry_poc_agree?: null | boolean;
qry_poc_kv_json?: null|boolean, // Key value pairs for the point of contact qry_poc_kv_json?: null | boolean; // Key value pairs for the point of contact
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** qry__event_session() *** event_id=${event_id} qry_str=${qry_str}`); console.log(`*** qry__event_session() *** event_id=${event_id} qry_str=${qry_str}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
params_json['qry'] = []; params_json['qry'] = [];
if (qry_files === true) { if (qry_files === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: '>',
operator: ">",
value: 0 value: 0
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} else if (qry_files === false) { } else if (qry_files === false) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: 'IS',
operator: "IS",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_start_datetime) { if (qry_start_datetime) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'start_datetime',
field: "start_datetime", operator: '>',
operator: ">",
value: qry_start_datetime value: qry_start_datetime
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_poc_agree === true) { if (qry_poc_agree === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'poc_agree',
field: "poc_agree", operator: '=',
operator: "=",
value: true value: true
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
@@ -672,38 +668,35 @@ export async function qry__event_session(
// value: null // value: null
// }; // };
// params_json['qry'].push(qry_param); // params_json['qry'].push(qry_param);
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'poc_agree',
field: "poc_agree", operator: '=',
operator: "=",
value: false value: false
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_poc_kv_json === true) { if (qry_poc_kv_json === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'poc_kv_json',
field: "poc_kv_json", operator: 'IS NOT',
operator: "IS NOT",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} else if (qry_poc_kv_json === false) { } else if (qry_poc_kv_json === false) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'poc_kv_json',
field: "poc_kv_json", operator: 'IS',
operator: "IS",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_session_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
for_obj_type: 'event', for_obj_type: 'event',
@@ -724,9 +717,9 @@ export async function qry__event_session(
if (event_session_obj_li_get_result) { if (event_session_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_session_props({ const processed_obj_li = await process_ae_obj__event_session_props({
obj_li: event_session_obj_li_get_result, obj_li: event_session_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -740,7 +733,7 @@ export async function qry__event_session(
table_name: 'presenter', table_name: 'presenter',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -763,10 +756,8 @@ export async function qry__event_session(
return ae_promises.load__event_session_obj_li; return ae_promises.load__event_session_obj_li;
} }
// Updated 2025-05-22 // Updated 2025-05-22
export async function search__event_session( export async function search__event_session({
{
api_cfg, api_cfg,
event_id, event_id,
poc_agree = null, poc_agree = null,
@@ -782,34 +773,42 @@ export async function search__event_session(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 49, limit = 49,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
poc_agree?: null|boolean, poc_agree?: null | boolean;
fulltext_search_qry_str?: null|string, fulltext_search_qry_str?: null | string;
ft_presenter_search_qry_str?: null|string, ft_presenter_search_qry_str?: null | string;
like_search_qry_str?: null|string, like_search_qry_str?: null | string;
like_presentation_search_qry_str?: null|string, like_presentation_search_qry_str?: null | string;
like_presenter_search_qry_str?: null|string, like_presenter_search_qry_str?: null | string;
like_poc_name_qry_str?: null|string, like_poc_name_qry_str?: null | string;
file_count?: boolean, file_count?: boolean;
location_name?: null|string, location_name?: null | string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** search__event_session() *** event_id=${event_id} like_search_qry_str=${like_search_qry_str} location_name=${location_name}`); console.log(
`*** search__event_session() *** event_id=${event_id} like_search_qry_str=${like_search_qry_str} location_name=${location_name}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -817,7 +816,7 @@ export async function search__event_session(
// let limit: number = (params.qry__limit ?? 25); // 99 // let limit: number = (params.qry__limit ?? 25); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (!fulltext_search_qry_str && !like_search_qry_str) { // if (!fulltext_search_qry_str && !like_search_qry_str) {
// console.log('No search string provided!!!'); // console.log('No search string provided!!!');
@@ -847,7 +846,12 @@ export async function search__event_session(
// } // }
// Use the AND (OR LIKE) query // Use the AND (OR LIKE) query
if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str || like_poc_name_qry_str) { if (
like_search_qry_str ||
like_presentation_search_qry_str ||
like_presenter_search_qry_str ||
like_poc_name_qry_str
) {
params_json['or_like'] = {}; params_json['or_like'] = {};
if (like_search_qry_str && like_search_qry_str.length > 2) { if (like_search_qry_str && like_search_qry_str.length > 2) {
params_json['or_like']['default_qry_str'] = like_search_qry_str; params_json['or_like']['default_qry_str'] = like_search_qry_str;
@@ -881,7 +885,8 @@ export async function search__event_session(
// let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; // let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
// ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ // ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__event_session_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_session', obj_type: 'event_session',
for_obj_type: 'event', for_obj_type: 'event',
@@ -901,9 +906,9 @@ export async function search__event_session(
if (event_session_obj_li_get_result) { if (event_session_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__event_session_props({ const processed_obj_li = await process_ae_obj__event_session_props({
obj_li: event_session_obj_li_get_result, obj_li: event_session_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -917,7 +922,7 @@ export async function search__event_session(
table_name: 'session', table_name: 'session',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -936,8 +941,7 @@ export async function search__event_session(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_session_obj_li:', ae_promises.load__event_session_obj_li); console.log('ae_promises.load__event_session_obj_li:', ae_promises.load__event_session_obj_li);
@@ -945,33 +949,30 @@ export async function search__event_session(
return ae_promises.load__event_session_obj_li; return ae_promises.load__event_session_obj_li;
} }
// This function will loop through the event_session_obj_li and save each one to the DB. // This function will loop through the event_session_obj_li and save each one to the DB.
// Updated 2025-05-09 // Updated 2025-05-09
export async function db_save_ae_obj_li__event_session( export async function db_save_ae_obj_li__event_session({
{
obj_type, obj_type,
obj_li, obj_li,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_type: string, obj_type: string;
obj_li: any, obj_li: any;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event_session() *** obj_type=${obj_type}`, obj_li); console.log(`*** db_save_ae_obj_li__event_session() *** obj_type=${obj_type}`, obj_li);
} }
if (obj_li && obj_li.length) { if (obj_li && obj_li.length) {
let obj_li_id: string[] = []; const obj_li_id: string[] = [];
for (const obj of obj_li) { for (const obj of obj_li) {
if (log_lvl) { if (log_lvl) {
console.log(`Processing ae_obj ${obj_type}:`, obj); console.log(`Processing ae_obj ${obj_type}:`, obj);
} }
let obj_record = { const obj_record = {
id: obj.event_session_id_random, id: obj.event_session_id_random,
event_session_id: obj.event_session_id_random, event_session_id: obj.event_session_id_random,
event_session_id_random: obj.event_session_id_random, event_session_id_random: obj.event_session_id_random,
@@ -1040,7 +1041,7 @@ export async function db_save_ae_obj_li__event_session(
// A key value list of the presentations // A key value list of the presentations
event_presentation_kv: obj.event_presentation_kv, event_presentation_kv: obj.event_presentation_kv,
event_presentation_li: obj.event_presentation_li, event_presentation_li: obj.event_presentation_li
}; };
let id_random = null; let id_random = null;
@@ -1085,11 +1086,9 @@ export async function db_save_ae_obj_li__event_session(
} }
} }
// This is intended for the Point of Contact (POC) for the session. // This is intended for the Point of Contact (POC) for the session.
// Updated 2024-07-01 // Updated 2024-07-01
export async function email_sign_in__event_session ( export async function email_sign_in__event_session({
{
api_cfg, api_cfg,
to_email, to_email,
to_name, to_name,
@@ -1098,26 +1097,29 @@ export async function email_sign_in__event_session (
person_passcode, person_passcode,
event_id, event_id,
event_session_id, event_session_id,
session_name, session_name
}: { }: {
api_cfg: any, api_cfg: any;
to_email: string, to_email: string;
to_name: string, to_name: string;
base_url: string, base_url: string;
person_id: string, person_id: string;
person_passcode: string, person_passcode: string;
event_id: string, event_id: string;
event_session_id: string, event_session_id: string;
session_name: string, session_name: string;
} }) {
) { console.log(
console.log(`*** email_sign_in__event_session() *** to_email=${to_email} to_name=${to_name} person_id=${person_id} person_passcode=${person_passcode} session_id=${event_session_id}`); `*** email_sign_in__event_session() *** to_email=${to_email} to_name=${to_name} person_id=${person_id} person_passcode=${person_passcode} session_id=${event_session_id}`
);
let subject = `LCI Congress 2025 - Pres Mgmt Hub Sign In Link for ${session_name} (ID: ${event_session_id})`; const subject = `LCI Congress 2025 - Pres Mgmt Hub Sign In Link for ${session_name} (ID: ${event_session_id})`;
let sign_in_url = encodeURI(`${base_url}/events/${event_id}/session/${event_session_id}?person_id=${person_id}&person_pass=${person_passcode}&session_id=${event_session_id}`) const sign_in_url = encodeURI(
`${base_url}/events/${event_id}/session/${event_session_id}?person_id=${person_id}&person_pass=${person_passcode}&session_id=${event_session_id}`
);
let body_html = ` const body_html = `
<div>${to_name}, <div>${to_name},
<p>Your link to sign into the presentation management hub as a session Champion for LCI Congress 2025 is below. If you did not request this, please delete and ignore this email. If you need to make any changes or updates to your submission, you may use this link again later.</p> <p>Your link to sign into the presentation management hub as a session Champion for LCI Congress 2025 is below. If you did not request this, please delete and ignore this email. If you need to make any changes or updates to your submission, you may use this link again later.</p>
</div> </div>
@@ -1138,11 +1140,10 @@ export async function email_sign_in__event_session (
from_name: 'LCI 2025 Pres Mgmt Hub', from_name: 'LCI 2025 Pres Mgmt Hub',
to_email: to_email, to_email: to_email,
subject: subject, subject: subject,
body_html: body_html, body_html: body_html
}); });
} }
// Updated 2025-05-09 // Updated 2025-05-09
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -1219,10 +1220,9 @@ export const properties_to_save = [
// A key value list of the presentations // A key value list of the presentations
'event_presentation_kv', 'event_presentation_kv',
'event_presentation_li', 'event_presentation_li'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -1291,7 +1291,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-09 // Updated 2025-05-09
export async function process_ae_obj__event_session_props({ export async function process_ae_obj__event_session_props({
obj_li, obj_li,

View File

@@ -1,7 +1,7 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_events } from "$lib/ae_events/db_events"; import { db_events } from '$lib/ae_events/db_events';
// --- PROPERTIES TO SAVE --- // --- PROPERTIES TO SAVE ---
export const properties_to_save_exhibit_tracking = [ export const properties_to_save_exhibit_tracking = [
@@ -40,10 +40,9 @@ export const properties_to_save_exhibit_tracking = [
'updated_on', 'updated_on',
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
]; ];
// --- PROCESS FUNCTION --- // --- PROCESS FUNCTION ---
export async function process_ae_obj__exhibit_tracking_props({ export async function process_ae_obj__exhibit_tracking_props({
obj_li, obj_li,
@@ -70,7 +69,6 @@ export async function process_ae_obj__exhibit_tracking_props({
}); });
} }
// --- PROPERTIES TO SAVE --- // --- PROPERTIES TO SAVE ---
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -98,10 +96,9 @@ export const properties_to_save = [
'updated_on', 'updated_on',
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -170,7 +167,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// --- PROCESS FUNCTION --- // --- PROCESS FUNCTION ---
export async function process_ae_obj__exhibit_props({ export async function process_ae_obj__exhibit_props({
obj_li, obj_li,
@@ -197,27 +193,25 @@ export async function process_ae_obj__exhibit_props({
}); });
} }
// Updated 2024-03 // Updated 2024-03
export async function load_ae_obj_id__exhibit( export async function load_ae_obj_id__exhibit({
{
api_cfg, api_cfg,
exhibit_id, exhibit_id,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
exhibit_id: string, exhibit_id: string;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** load_ae_obj_id__exhibit() *** exhibit_id=${exhibit_id}`); console.log(`*** load_ae_obj_id__exhibit() *** exhibit_id=${exhibit_id}`);
let params = {}; const params = {};
// $events_sess.exhibits.status_load__exhibit_obj = 'loading'; // $events_sess.exhibits.status_load__exhibit_obj = 'loading';
ae_promises.load__exhibit_obj = await api.get_ae_obj_id_crud({ ae_promises.load__exhibit_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_exhibit', obj_type: 'event_exhibit',
obj_id: exhibit_id, // NOTE: This is the FQDN, not normally the ID. obj_id: exhibit_id, // NOTE: This is the FQDN, not normally the ID.
@@ -230,9 +224,9 @@ export async function load_ae_obj_id__exhibit(
if (exhibit_obj_get_result) { if (exhibit_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__exhibit_props({ const processed_obj_li = await process_ae_obj__exhibit_props({
obj_li: [exhibit_obj_get_result], obj_li: [exhibit_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -246,7 +240,7 @@ export async function load_ae_obj_id__exhibit(
table_name: 'exhibit', table_name: 'exhibit',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -265,36 +259,33 @@ export async function load_ae_obj_id__exhibit(
return ae_promises.load__exhibit_obj; return ae_promises.load__exhibit_obj;
} }
// Updated 2024-03-06 // Updated 2024-03-06
export async function load_ae_obj_li__exhibit( export async function load_ae_obj_li__exhibit({
{
api_cfg, api_cfg,
event_id, event_id,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
event_id: any, event_id: any;
params: any, params: any;
try_cache?: boolean try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** load_ae_obj_li__exhibit() *** event_id=${event_id}`); console.log(`*** load_ae_obj_li__exhibit() *** event_id=${event_id}`);
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 99); // 99 const limit: number = params.qry__limit ?? 99; // 99
let offset: number = (params.qry__offset ?? 0); // 0 const offset: number = params.qry__offset ?? 0; // 0
let params_json: key_val = {}; const params_json: key_val = {};
// params_json['and_qry'] = {}; // params_json['and_qry'] = {};
// params_json['and_qry']['license_max'] = 10; // params_json['and_qry']['license_max'] = 10;
params_json['and_in_li'] = { params_json['and_in_li'] = {
license_max : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], license_max: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
}; };
// if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { // if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
@@ -309,7 +300,8 @@ export async function load_ae_obj_li__exhibit(
// console.log(params_json); // console.log(params_json);
// $events_sess.exhibits.status_qry__search = 'loading'; // $events_sess.exhibits.status_qry__search = 'loading';
ae_promises.load__event_exhibit_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ ae_promises.load__event_exhibit_obj_li = await api
.get_ae_obj_li_for_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_exhibit', obj_type: 'event_exhibit',
for_obj_type: 'event', for_obj_type: 'event',
@@ -318,7 +310,7 @@ export async function load_ae_obj_li__exhibit(
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config. use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
enabled: enabled, enabled: enabled,
hidden: hidden, hidden: hidden,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li: { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'}, // order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
limit: limit, limit: limit,
offset: offset, offset: offset,
@@ -332,9 +324,9 @@ export async function load_ae_obj_li__exhibit(
if (exhibit_obj_li_get_result) { if (exhibit_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__exhibit_props({ const processed_obj_li = await process_ae_obj__exhibit_props({
obj_li: exhibit_obj_li_get_result, obj_li: exhibit_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -348,7 +340,7 @@ export async function load_ae_obj_li__exhibit(
table_name: 'exhibit', table_name: 'exhibit',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -365,7 +357,6 @@ export async function load_ae_obj_li__exhibit(
}) })
.finally(function () { .finally(function () {
// $events_sess.exhibits.status_qry__search = 'done'; // $events_sess.exhibits.status_qry__search = 'done';
// console.log('Badge list:', exhibit_obj_li_get_result); // console.log('Badge list:', exhibit_obj_li_get_result);
// return exhibit_obj_li_get_result; // return exhibit_obj_li_get_result;
}); });
@@ -376,26 +367,26 @@ export async function load_ae_obj_li__exhibit(
return ae_promises.load__event_exhibit_obj_li; return ae_promises.load__event_exhibit_obj_li;
} }
export async function load_ae_obj_id__exhibit_tracking({
export async function load_ae_obj_id__exhibit_tracking(
{
api_cfg, api_cfg,
exhibit_tracking_id, exhibit_tracking_id,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
exhibit_tracking_id: string, exhibit_tracking_id: string;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) { console.log(
console.log(`*** load_ae_obj_id__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}`); `*** load_ae_obj_id__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}`
);
let params = {}; const params = {};
// $events_sess.exhibits.status_load__exhibit_tracking_obj = 'loading'; // $events_sess.exhibits.status_load__exhibit_tracking_obj = 'loading';
ae_promises.load__event_exhibit_tracking_obj = await api.get_ae_obj_id_crud({ ae_promises.load__event_exhibit_tracking_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_exhibit_tracking', obj_type: 'event_exhibit_tracking',
obj_id: exhibit_tracking_id, // NOTE: This is the FQDN, not normally the ID. obj_id: exhibit_tracking_id, // NOTE: This is the FQDN, not normally the ID.
@@ -408,9 +399,9 @@ export async function load_ae_obj_id__exhibit_tracking(
if (exhibit_tracking_obj_get_result) { if (exhibit_tracking_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__exhibit_tracking_props({ const processed_obj_li = await process_ae_obj__exhibit_tracking_props({
obj_li: [exhibit_tracking_obj_get_result], obj_li: [exhibit_tracking_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -424,7 +415,7 @@ export async function load_ae_obj_id__exhibit_tracking(
table_name: 'exhibit_tracking', table_name: 'exhibit_tracking',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_exhibit_tracking, properties_to_save: properties_to_save_exhibit_tracking,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -443,33 +434,31 @@ export async function load_ae_obj_id__exhibit_tracking(
return ae_promises.load__event_exhibit_tracking_obj; return ae_promises.load__event_exhibit_tracking_obj;
} }
// Updated 2024-03-19 // Updated 2024-03-19
export async function load_ae_obj_li__exhibit_tracking( export async function load_ae_obj_li__exhibit_tracking({
{
api_cfg, api_cfg,
exhibit_id, exhibit_id,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
exhibit_id: any, exhibit_id: any;
params: any, params: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** load_ae_obj_li__exhibit_tracking() *** exhibit_id=${exhibit_id}`); console.log(`*** load_ae_obj_li__exhibit_tracking() *** exhibit_id=${exhibit_id}`);
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden const hidden: string = params.qry__hidden ?? 'all'; // all, hidden, not_hidden
let limit: number = (params.qry__limit ?? 99); // 99 const limit: number = params.qry__limit ?? 99; // 99
let offset: number = (params.qry__offset ?? 0); // 0 const offset: number = params.qry__offset ?? 0; // 0
let params_json: key_val = {}; const params_json: key_val = {};
ae_promises.load__event_exhibit_tracking_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ ae_promises.load__event_exhibit_tracking_obj_li = await api
.get_ae_obj_li_for_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_exhibit_tracking', obj_type: 'event_exhibit_tracking',
for_obj_type: 'event_exhibit', for_obj_type: 'event_exhibit',
@@ -478,7 +467,7 @@ export async function load_ae_obj_li__exhibit_tracking(
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config. use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
enabled: enabled, enabled: enabled,
hidden: hidden, hidden: hidden,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li: { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
limit: limit, limit: limit,
offset: offset, offset: offset,
params_json: params_json, params_json: params_json,
@@ -491,9 +480,9 @@ export async function load_ae_obj_li__exhibit_tracking(
if (exhibit_tracking_obj_li_get_result) { if (exhibit_tracking_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__exhibit_tracking_props({ const processed_obj_li = await process_ae_obj__exhibit_tracking_props({
obj_li: exhibit_tracking_obj_li_get_result, obj_li: exhibit_tracking_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -507,7 +496,7 @@ export async function load_ae_obj_li__exhibit_tracking(
table_name: 'exhibit_tracking', table_name: 'exhibit_tracking',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_exhibit_tracking, properties_to_save: properties_to_save_exhibit_tracking,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -528,15 +517,16 @@ export async function load_ae_obj_li__exhibit_tracking(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.load__event_exhibit_tracking_obj_li:', ae_promises.load__event_exhibit_tracking_obj_li); console.log(
'ae_promises.load__event_exhibit_tracking_obj_li:',
ae_promises.load__event_exhibit_tracking_obj_li
);
} }
return ae_promises.load__event_exhibit_tracking_obj_li; return ae_promises.load__event_exhibit_tracking_obj_li;
} }
// Updated 2024-03-22 // Updated 2024-03-22
export async function create_ae_obj__exhibit_tracking( export async function create_ae_obj__exhibit_tracking({
{
api_cfg, api_cfg,
exhibit_id, exhibit_id,
event_badge_id, event_badge_id,
@@ -544,26 +534,28 @@ export async function create_ae_obj__exhibit_tracking(
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
exhibit_id: string, exhibit_id: string;
event_badge_id: string, event_badge_id: string;
external_person_id: string, external_person_id: string;
params: key_val, params: key_val;
log_lvl: number log_lvl: number;
} }) {
) { console.log(
console.log(`*** handle_create_ae_obj__exhibit_tracking() *** exhibit_id=${exhibit_id}, event_badge_id=${event_badge_id}`); `*** handle_create_ae_obj__exhibit_tracking() *** exhibit_id=${exhibit_id}, event_badge_id=${event_badge_id}`
);
let params_json: key_val = {}; const params_json: key_val = {};
// $events_sess.exhibits.status_create__exhibit_tracking = 'loading'; // $events_sess.exhibits.status_create__exhibit_tracking = 'loading';
ae_promises.create__event_exhibit_tracking = await api.create_ae_obj_crud({ ae_promises.create__event_exhibit_tracking = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_exhibit_tracking', obj_type: 'event_exhibit_tracking',
fields: { fields: {
event_exhibit_id_random: exhibit_id, event_exhibit_id_random: exhibit_id,
event_badge_id_random: event_badge_id, event_badge_id_random: event_badge_id,
external_person_id: external_person_id, external_person_id: external_person_id
}, },
key: api_cfg.api_crud_super_key, key: api_cfg.api_crud_super_key,
params: params, params: params,
@@ -576,9 +568,9 @@ export async function create_ae_obj__exhibit_tracking(
if (exhibit_tracking_obj_create_result) { if (exhibit_tracking_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__exhibit_tracking_props({ const processed_obj_li = await process_ae_obj__exhibit_tracking_props({
obj_li: [exhibit_tracking_obj_create_result], obj_li: [exhibit_tracking_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -592,7 +584,7 @@ export async function create_ae_obj__exhibit_tracking(
table_name: 'exhibit_tracking', table_name: 'exhibit_tracking',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_exhibit_tracking, properties_to_save: properties_to_save_exhibit_tracking,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -613,31 +605,34 @@ export async function create_ae_obj__exhibit_tracking(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__event_exhibit_tracking:', ae_promises.create__event_exhibit_tracking); console.log(
'ae_promises.create__event_exhibit_tracking:',
ae_promises.create__event_exhibit_tracking
);
} }
return ae_promises.create__event_exhibit_tracking; return ae_promises.create__event_exhibit_tracking;
} }
// Updated 2024-03-28 // Updated 2024-03-28
export async function update_ae_obj__exhibit_tracking( export async function update_ae_obj__exhibit_tracking({
{
api_cfg, api_cfg,
exhibit_tracking_id, exhibit_tracking_id,
data, data,
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
exhibit_tracking_id: string, exhibit_tracking_id: string;
data: any, data: any;
params: key_val, params: key_val;
log_lvl: number log_lvl: number;
} }) {
) { console.log(
console.log(`*** handle_update_ae_obj__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}`); `*** handle_update_ae_obj__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}`
);
ae_promises.update__event_exhibit_tracking = await api.update_ae_obj_id_crud({ ae_promises.update__event_exhibit_tracking = await api
.update_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'event_exhibit_tracking', obj_type: 'event_exhibit_tracking',
obj_id: exhibit_tracking_id, obj_id: exhibit_tracking_id,
@@ -651,9 +646,9 @@ export async function update_ae_obj__exhibit_tracking(
if (exhibit_tracking_obj_update_result) { if (exhibit_tracking_obj_update_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__exhibit_tracking_props({ const processed_obj_li = await process_ae_obj__exhibit_tracking_props({
obj_li: [exhibit_tracking_obj_update_result], obj_li: [exhibit_tracking_obj_update_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -667,7 +662,7 @@ export async function update_ae_obj__exhibit_tracking(
table_name: 'exhibit_tracking', table_name: 'exhibit_tracking',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_exhibit_tracking, properties_to_save: properties_to_save_exhibit_tracking,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -681,18 +676,18 @@ export async function update_ae_obj__exhibit_tracking(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.update__event_exhibit_tracking:', ae_promises.update__event_exhibit_tracking); console.log(
'ae_promises.update__event_exhibit_tracking:',
ae_promises.update__event_exhibit_tracking
);
} }
return ae_promises.update__event_exhibit_tracking; return ae_promises.update__event_exhibit_tracking;
} }
export async function download_export__event_exhibit_tracking({
export async function download_export__event_exhibit_tracking(
{
api_cfg, api_cfg,
exhibit_id, exhibit_id,
file_type = 'CSV', // 'CSV' or 'Excel' file_type = 'CSV', // 'CSV' or 'Excel'
@@ -702,16 +697,15 @@ export async function download_export__event_exhibit_tracking(
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
exhibit_id: string, exhibit_id: string;
file_type?: string, file_type?: string;
return_file?: boolean, return_file?: boolean;
filename?: string, filename?: string;
auto_download?: boolean, auto_download?: boolean;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** ae_events_functions.js: get_event_exhibit_tracking_export() ***'); console.log('*** ae_events_functions.js: get_event_exhibit_tracking_export() ***');
const endpoint = `/event/exhibit/${exhibit_id}/tracking/export`; const endpoint = `/event/exhibit/${exhibit_id}/tracking/export`;
@@ -731,13 +725,10 @@ export async function download_export__event_exhibit_tracking(
}); });
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.download__event_exhibit_tracking_export_file:', ae_promises.download__event_exhibit_tracking_export_file); console.log(
'ae_promises.download__event_exhibit_tracking_export_file:',
ae_promises.download__event_exhibit_tracking_export_file
);
} }
return ae_promises.download__event_exhibit_tracking_export_file; return ae_promises.download__event_exhibit_tracking_export_file;
} }

View File

@@ -49,7 +49,7 @@ export interface Event {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -97,7 +97,6 @@ export interface Event {
event_file_id_li_json?: null | string; event_file_id_li_json?: null | string;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export interface Badge { export interface Badge {
id: number; id: number;
@@ -166,7 +165,7 @@ export interface Badge {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -189,7 +188,6 @@ export interface Badge {
person_passcode?: null | string; person_passcode?: null | string;
} }
// Updated 2025-10-06 // Updated 2025-10-06
export interface Badge_template { export interface Badge_template {
id: number; id: number;
@@ -237,7 +235,7 @@ export interface Badge_template {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -301,7 +299,7 @@ export interface Device {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -318,7 +316,6 @@ export interface Device {
event_location_name?: string; event_location_name?: string;
} }
export interface Exhibit { export interface Exhibit {
id?: number; id?: number;
id_random: string; id_random: string;
@@ -332,7 +329,7 @@ export interface Exhibit {
name: string; name: string;
// tagline: null|string; // tagline: null|string;
description: null | string; description: null | string;
staff_passcode: null staff_passcode: null;
data_json: null | string; data_json: null | string;
leads_api_access: null | boolean; leads_api_access: null | boolean;
@@ -345,7 +342,7 @@ export interface Exhibit {
enable: null | boolean; enable: null | boolean;
hide: null | boolean; hide: null | boolean;
priority: null|boolean priority: null | boolean;
sort: null | number; sort: null | number;
group: null | string; group: null | string;
notes: null | string; notes: null | string;
@@ -357,11 +354,10 @@ export interface Exhibit {
// tmp_sort_2?: null|string; // tmp_sort_2?: null|string;
} }
export interface Exhibit_tracking { export interface Exhibit_tracking {
id?: number; id?: number;
id_random: string; id_random: string;
event_exhibit_tracking_id: string event_exhibit_tracking_id: string;
event_exhibit_tracking_id_random: string; event_exhibit_tracking_id_random: string;
event_exhibit_id: string; event_exhibit_id: string;
@@ -403,7 +399,7 @@ export interface Exhibit_tracking {
enable: null | boolean; enable: null | boolean;
hide: null | boolean; hide: null | boolean;
priority: null|boolean priority: null | boolean;
sort: null | number; sort: null | number;
group: null | string; group: null | string;
notes: null | string; notes: null | string;
@@ -415,7 +411,6 @@ export interface Exhibit_tracking {
// tmp_sort_2?: null|string; // tmp_sort_2?: null|string;
} }
export interface File { export interface File {
id: string; id: string;
id_random: string; id_random: string;
@@ -452,7 +447,7 @@ export interface File {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -488,7 +483,6 @@ export interface File {
event_presenter_email?: null | string; event_presenter_email?: null | string;
} }
// Updated 2024-06-25 // Updated 2024-06-25
export interface Location { export interface Location {
id: string; id: string;
@@ -518,7 +512,7 @@ export interface Location {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -543,7 +537,6 @@ export interface Location {
event_file_kv?: null | key_val; event_file_kv?: null | key_val;
} }
// Updated 2024-06-10 // Updated 2024-06-10
export interface Presentation { export interface Presentation {
id: string; id: string;
@@ -603,7 +596,6 @@ export interface Presentation {
event_presenter_li?: null | Array<any>; event_presenter_li?: null | Array<any>;
} }
// Updated 2024-06-10 // Updated 2024-06-10
export interface Presenter { export interface Presenter {
id: string; id: string;
@@ -657,7 +649,7 @@ export interface Presenter {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -695,13 +687,10 @@ export interface Presenter {
event_file_kv?: null | key_val; event_file_kv?: null | key_val;
} }
export interface Registration { export interface Registration {
// Nothing here yet // Nothing here yet
} }
// Updated 2024-06-19 // Updated 2024-06-19
export interface Session { export interface Session {
id: string; id: string;
@@ -749,7 +738,7 @@ export interface Session {
enable: null | boolean; enable: null | boolean;
hide: null | boolean; hide: null | boolean;
priority: null|boolean priority: null | boolean;
sort: null | number; sort: null | number;
group: null | string; group: null | string;
notes: null | string; notes: null | string;
@@ -785,7 +774,6 @@ export interface Session {
event_file_li?: null | [any]; event_file_li?: null | [any];
} }
// Updated 2024-10-16 // Updated 2024-10-16
export class MySubClassedDexie extends Dexie { export class MySubClassedDexie extends Dexie {
// 'badge' is added by dexie when declaring the stores() // 'badge' is added by dexie when declaring the stores()
@@ -921,7 +909,7 @@ export class MySubClassedDexie extends Dexie {
ux_mode, ux_mode,
alert, alert,
tmp_sort_1, tmp_sort_2, tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, created_on, updated_on`, enable, hide, priority, sort, group, created_on, updated_on`
}); });
} }
} }

View File

@@ -1,10 +1,10 @@
// This file is used to export all the functions that are used for Aether Events related functions. // This file is used to export all the functions that are used for Aether Events related functions.
// Import all the functions from this library: // Import all the functions from this library:
import * as event from "$lib/ae_events/ae_events__event"; import * as event from '$lib/ae_events/ae_events__event';
import * as event_device from "$lib/ae_events/ae_events__event_device"; import * as event_device from '$lib/ae_events/ae_events__event_device';
import * as event_file from "$lib/ae_events/ae_events__event_file"; import * as event_file from '$lib/ae_events/ae_events__event_file';
import { import {
load_ae_obj_id__exhibit, load_ae_obj_id__exhibit,
@@ -13,24 +13,23 @@ import {
load_ae_obj_li__exhibit_tracking, load_ae_obj_li__exhibit_tracking,
create_ae_obj__exhibit_tracking, create_ae_obj__exhibit_tracking,
update_ae_obj__exhibit_tracking, update_ae_obj__exhibit_tracking,
download_export__event_exhibit_tracking, download_export__event_exhibit_tracking
// db_save_ae_obj_li__exhibitor, // db_save_ae_obj_li__exhibitor,
} from "$lib/ae_events/ae_events__exhibit"; } from '$lib/ae_events/ae_events__exhibit';
import * as event_location from "$lib/ae_events/ae_events__event_location"; import * as event_location from '$lib/ae_events/ae_events__event_location';
import * as event_session from "$lib/ae_events/ae_events__event_session"; import * as event_session from '$lib/ae_events/ae_events__event_session';
import * as event_presentation from "$lib/ae_events/ae_events__event_presentation"; import * as event_presentation from '$lib/ae_events/ae_events__event_presentation';
import * as event_presenter from "$lib/ae_events/ae_events__event_presenter"; import * as event_presenter from '$lib/ae_events/ae_events__event_presenter';
import * as event_badge from "$lib/ae_events/ae_events__event_badge"; import * as event_badge from '$lib/ae_events/ae_events__event_badge';
import * as event_badge_template from "$lib/ae_events/ae_events__event_badge_template"; import * as event_badge_template from '$lib/ae_events/ae_events__event_badge_template';
const export_obj = {
let export_obj = {
// Events // Events
load_ae_obj_id__event: event.load_ae_obj_id__event, load_ae_obj_id__event: event.load_ae_obj_id__event,
load_ae_obj_li__event: event.load_ae_obj_li__event, load_ae_obj_li__event: event.load_ae_obj_li__event,
@@ -58,7 +57,8 @@ let export_obj = {
load_ae_obj_id__event_badge_template: event_badge_template.load_ae_obj_id__event_badge_template, load_ae_obj_id__event_badge_template: event_badge_template.load_ae_obj_id__event_badge_template,
load_ae_obj_li__event_badge_template: event_badge_template.load_ae_obj_li__event_badge_template, load_ae_obj_li__event_badge_template: event_badge_template.load_ae_obj_li__event_badge_template,
create_ae_obj__event_badge_template: event_badge_template.create_ae_obj__event_badge_template, create_ae_obj__event_badge_template: event_badge_template.create_ae_obj__event_badge_template,
delete_ae_obj_id__event_badge_template: event_badge_template.delete_ae_obj_id__event_badge_template, delete_ae_obj_id__event_badge_template:
event_badge_template.delete_ae_obj_id__event_badge_template,
update_ae_obj__event_badge_template: event_badge_template.update_ae_obj__event_badge_template, update_ae_obj__event_badge_template: event_badge_template.update_ae_obj__event_badge_template,
search__event_badge_template: event_badge_template.search__event_badge_template, search__event_badge_template: event_badge_template.search__event_badge_template,
@@ -83,7 +83,8 @@ let export_obj = {
// Event Files // Event Files
load_ae_obj_id__event_file: event_file.load_ae_obj_id__event_file, load_ae_obj_id__event_file: event_file.load_ae_obj_id__event_file,
load_ae_obj_li__event_file: event_file.load_ae_obj_li__event_file, load_ae_obj_li__event_file: event_file.load_ae_obj_li__event_file,
create_event_file_obj_from_hosted_file_async: event_file.create_event_file_obj_from_hosted_file_async, create_event_file_obj_from_hosted_file_async:
event_file.create_event_file_obj_from_hosted_file_async,
delete_ae_obj_id__event_file: event_file.delete_ae_obj_id__event_file, delete_ae_obj_id__event_file: event_file.delete_ae_obj_id__event_file,
update_ae_obj__event_file: event_file.update_ae_obj__event_file, update_ae_obj__event_file: event_file.update_ae_obj__event_file,
qry__event_file: event_file.qry__event_file, qry__event_file: event_file.qry__event_file,
@@ -125,7 +126,6 @@ let export_obj = {
update_ae_obj__event_presenter: event_presenter.update_ae_obj__event_presenter, update_ae_obj__event_presenter: event_presenter.update_ae_obj__event_presenter,
search__event_presenter: event_presenter.search__event_presenter, search__event_presenter: event_presenter.search__event_presenter,
// db_save_ae_obj_li__event_presenter: event_presenter.db_save_ae_obj_li__event_presenter, // db_save_ae_obj_li__event_presenter: event_presenter.db_save_ae_obj_li__event_presenter,
email_sign_in__event_presenter: event_presenter.email_sign_in__event_presenter, email_sign_in__event_presenter: event_presenter.email_sign_in__event_presenter
}; };
export let events_func = export_obj; export const events_func = export_obj;

View File

@@ -3,17 +3,15 @@ import { marked } from 'marked';
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_journals } from "$lib/ae_journals/db_journals"; import { db_journals } from '$lib/ae_journals/db_journals';
import { load_ae_obj_li__journal_entry } from "$lib/ae_journals/ae_journals__journal_entry"; import { load_ae_obj_li__journal_entry } from '$lib/ae_journals/ae_journals__journal_entry';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-03-15 // Updated 2025-03-15
export async function load_ae_obj_id__journal( export async function load_ae_obj_id__journal({
{
api_cfg, api_cfg,
journal_id, journal_id,
inc_entry_li = false, inc_entry_li = false,
@@ -21,29 +19,35 @@ export async function load_ae_obj_id__journal(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_id: string, journal_id: string;
inc_entry_li?: boolean, inc_entry_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, // Order by fields for the journal entries order_by_li?: key_val; // Order by fields for the journal entries
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__journal() *** journal_id=${journal_id}`); console.log(`*** load_ae_obj_id__journal() *** journal_id=${journal_id}`);
} }
ae_promises.load__journal_obj = await api.get_ae_obj_id_crud({ ae_promises.load__journal_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal', obj_type: 'journal',
obj_id: journal_id, obj_id: journal_id,
@@ -56,9 +60,9 @@ export async function load_ae_obj_id__journal(
if (journal_obj_get_result) { if (journal_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_props({ const processed_obj_li = await process_ae_obj__journal_props({
obj_li: [journal_obj_get_result], obj_li: [journal_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -72,7 +76,7 @@ export async function load_ae_obj_id__journal(
table_name: 'journal', table_name: 'journal',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -108,7 +112,7 @@ export async function load_ae_obj_id__journal(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the entry list for the journal now`); console.log(`Need to load the entry list for the journal now`);
} }
let load_journal_entry_obj_li = load_ae_obj_li__journal_entry({ const load_journal_entry_obj_li = load_ae_obj_li__journal_entry({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'journal', for_obj_type: 'journal',
for_obj_id: journal_id, for_obj_id: journal_id,
@@ -120,8 +124,7 @@ export async function load_ae_obj_id__journal(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((journal_entry_obj_li) => {
.then((journal_entry_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`journal_entry_obj_li = `, journal_entry_obj_li); console.log(`journal_entry_obj_li = `, journal_entry_obj_li);
} }
@@ -137,10 +140,8 @@ export async function load_ae_obj_id__journal(
return ae_promises.load__journal_obj; return ae_promises.load__journal_obj;
} }
// Updated 2025-03-15 // Updated 2025-03-15
export async function load_ae_obj_li__journal( export async function load_ae_obj_li__journal({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -150,38 +151,44 @@ export async function load_ae_obj_li__journal(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
qry_person_id?: string|null, qry_person_id?: string | null;
inc_entry_li?: boolean, inc_entry_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__journal() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__journal() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
if (qry_person_id) { if (qry_person_id) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'person_id_random',
field: "person_id_random", operator: '=',
operator: "=",
value: qry_person_id value: qry_person_id
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
@@ -191,7 +198,8 @@ export async function load_ae_obj_li__journal(
console.log('params_json:', params_json); console.log('params_json:', params_json);
} }
ae_promises.load__journal_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__journal_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal', obj_type: 'journal',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -212,9 +220,9 @@ export async function load_ae_obj_li__journal(
if (journal_obj_li_get_result) { if (journal_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_props({ const processed_obj_li = await process_ae_obj__journal_props({
obj_li: journal_obj_li_get_result, obj_li: journal_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -228,7 +236,7 @@ export async function load_ae_obj_li__journal(
table_name: 'journal', table_name: 'journal',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -256,10 +264,10 @@ export async function load_ae_obj_li__journal(
console.log(`Need to load the entry list for each journal now`); console.log(`Need to load the entry list for each journal now`);
} }
for (let i = 0; i < ae_promises.load__journal_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__journal_obj_li.length; i++) {
let journal_obj = ae_promises.load__journal_obj_li[i]; const journal_obj = ae_promises.load__journal_obj_li[i];
let journal_id = journal_obj.journal_id_random; const journal_id = journal_obj.journal_id_random;
let load_journal_entry_obj_li = load_ae_obj_li__journal_entry({ const load_journal_entry_obj_li = load_ae_obj_li__journal_entry({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'journal', for_obj_type: 'journal',
for_obj_id: journal_id, for_obj_id: journal_id,
@@ -271,8 +279,7 @@ export async function load_ae_obj_li__journal(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((journal_entry_obj_li) => {
.then((journal_entry_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`journal_entry_obj_li = `, journal_entry_obj_li); console.log(`journal_entry_obj_li = `, journal_entry_obj_li);
} }
@@ -289,10 +296,8 @@ export async function load_ae_obj_li__journal(
return ae_promises.load__journal_obj_li; return ae_promises.load__journal_obj_li;
} }
// Updated 2025-03-24 // Updated 2025-03-24
export async function create_ae_obj__journal( export async function create_ae_obj__journal({
{
api_cfg, api_cfg,
account_id, account_id,
data_kv, data_kv,
@@ -300,14 +305,13 @@ export async function create_ae_obj__journal(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__journal() *** account_id=${account_id}`); console.log(`*** create_ae_obj__journal() *** account_id=${account_id}`);
} }
@@ -317,7 +321,8 @@ export async function create_ae_obj__journal(
return false; return false;
} }
ae_promises.create__journal = await api.create_ae_obj_crud({ ae_promises.create__journal = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal', obj_type: 'journal',
fields: { fields: {
@@ -333,9 +338,9 @@ export async function create_ae_obj__journal(
if (journal_obj_create_result) { if (journal_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_props({ const processed_obj_li = await process_ae_obj__journal_props({
obj_li: [journal_obj_create_result], obj_li: [journal_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -349,7 +354,7 @@ export async function create_ae_obj__journal(
table_name: 'journal', table_name: 'journal',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -370,8 +375,7 @@ export async function create_ae_obj__journal(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__journal:', ae_promises.create__journal); console.log('ae_promises.create__journal:', ae_promises.create__journal);
@@ -379,10 +383,8 @@ export async function create_ae_obj__journal(
return ae_promises.create__journal; return ae_promises.create__journal;
} }
// Updated 2025-03-15 // Updated 2025-03-15
export async function delete_ae_obj_id__journal( export async function delete_ae_obj_id__journal({
{
api_cfg, api_cfg,
journal_id, journal_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -390,19 +392,19 @@ export async function delete_ae_obj_id__journal(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_id: string, journal_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__journal() *** journal_id=${journal_id}`); console.log(`*** delete_ae_obj_id__journal() *** journal_id=${journal_id}`);
} }
ae_promises.delete__journal_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__journal_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal', obj_type: 'journal',
obj_id: journal_id, obj_id: journal_id,
@@ -430,7 +432,6 @@ export async function delete_ae_obj_id__journal(
return ae_promises.delete__journal_obj; return ae_promises.delete__journal_obj;
} }
// Updated 2025-05-09 // Updated 2025-05-09
export async function update_ae_obj__journal({ export async function update_ae_obj__journal({
api_cfg, api_cfg,
@@ -438,7 +439,7 @@ export async function update_ae_obj__journal({
data_kv, data_kv,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0, log_lvl = 0
}: { }: {
api_cfg: any; api_cfg: any;
journal_id: string; journal_id: string;
@@ -462,16 +463,16 @@ export async function update_ae_obj__journal({
key: api_cfg.api_crud_super_key, key: api_cfg.api_crud_super_key,
params: params, params: params,
return_obj: true, return_obj: true,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
// Handle the result // Handle the result
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_props({ const processed_obj_li = await process_ae_obj__journal_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -485,7 +486,7 @@ export async function update_ae_obj__journal({
table_name: 'journal', table_name: 'journal',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -504,11 +505,9 @@ export async function update_ae_obj__journal({
} }
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2025-03-15 // Updated 2025-03-15
export async function qry__journal( export async function qry__journal({
{
api_cfg, api_cfg,
journal_id, journal_id,
qry_str, qry_str,
@@ -522,22 +521,23 @@ export async function qry__journal(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_id: any, journal_id: any;
qry_str?: string, qry_str?: string;
qry_files?: null|boolean, qry_files?: null | boolean;
qry_start_datetime?: null|string, // Greater than this datetime qry_start_datetime?: null | string; // Greater than this datetime
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** qry__journal() *** journal_id=${journal_id} enabled=${enabled} hidden=${hidden} limit=${limit} offset=${offset}`); console.log(
`*** qry__journal() *** journal_id=${journal_id} enabled=${enabled} hidden=${hidden} limit=${limit} offset=${offset}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -545,7 +545,7 @@ export async function qry__journal(
// let limit: number = (params.qry__limit ?? 25); // 99 // let limit: number = (params.qry__limit ?? 25); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (qry_str && qry_str.length > 2) { // if (qry_str && qry_str.length > 2) {
// params_json['ft_qry'] = {}; // params_json['ft_qry'] = {};
@@ -555,39 +555,44 @@ export async function qry__journal(
params_json['qry'] = []; params_json['qry'] = [];
if (qry_files === true) { if (qry_files === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: '>',
operator: ">",
value: 0 value: 0
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} else if (qry_files === false) { } else if (qry_files === false) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: 'IS',
operator: "IS",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_start_datetime) { if (qry_start_datetime) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'start_datetime',
field: "start_datetime", operator: '>',
operator: ">",
value: qry_start_datetime value: qry_start_datetime
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; const order_by_li = {
priority: 'DESC',
sort: 'DESC',
start_datetime: 'ASC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
};
ae_promises.load__journal_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__journal_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal', obj_type: 'journal',
for_obj_type: 'account', for_obj_type: 'account',
@@ -608,9 +613,9 @@ export async function qry__journal(
if (journal_obj_li_get_result) { if (journal_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_props({ const processed_obj_li = await process_ae_obj__journal_props({
obj_li: journal_obj_li_get_result, obj_li: journal_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -624,7 +629,7 @@ export async function qry__journal(
table_name: 'journal', table_name: 'journal',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -647,7 +652,6 @@ export async function qry__journal(
return ae_promises.load__journal_obj_li; return ae_promises.load__journal_obj_li;
} }
// This function will loop through the journal_obj_li and save each one to the DB. // This function will loop through the journal_obj_li and save each one to the DB.
// Removed 2025-06-04 // Removed 2025-06-04
// export async function db_save_ae_obj_li__journal( // export async function db_save_ae_obj_li__journal(
@@ -798,10 +802,8 @@ export async function qry__journal(
// } // }
// } // }
// Updated 2025-05-09 // Updated 2025-05-09
let properties_to_save = [ const properties_to_save = [
'id', 'id',
'journal_id', 'journal_id',
@@ -872,14 +874,13 @@ let properties_to_save = [
'combined_passcode', 'combined_passcode',
// From SQL view // From SQL view
'journal_entry_count', 'journal_entry_count'
// A key value list of the others // A key value list of the others
// journal_other_kv // journal_other_kv
// journal_other_li // journal_other_li
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.

View File

@@ -3,34 +3,31 @@ import { marked } from 'marked';
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_journals } from "$lib/ae_journals/db_journals"; import { db_journals } from '$lib/ae_journals/db_journals';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-03-15 // Updated 2025-03-15
export async function load_ae_obj_id__journal_entry( export async function load_ae_obj_id__journal_entry({
{
api_cfg, api_cfg,
journal_entry_id, journal_entry_id,
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_entry_id: string, journal_entry_id: string;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`); console.log(`*** load_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`);
} }
let params = {}; const params = {};
ae_promises.load__journal_entry_obj = await api.get_ae_obj_id_crud({ ae_promises.load__journal_entry_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal_entry', obj_type: 'journal_entry',
obj_id: journal_entry_id, // NOTE: This is the FQDN, not normally the ID. obj_id: journal_entry_id, // NOTE: This is the FQDN, not normally the ID.
@@ -43,9 +40,9 @@ export async function load_ae_obj_id__journal_entry(
if (journal_entry_obj_get_result) { if (journal_entry_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_entry_props({ const processed_obj_li = await process_ae_obj__journal_entry_props({
obj_li: [journal_entry_obj_get_result], obj_li: [journal_entry_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -59,7 +56,7 @@ export async function load_ae_obj_id__journal_entry(
table_name: 'journal_entry', table_name: 'journal_entry',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -85,10 +82,8 @@ export async function load_ae_obj_id__journal_entry(
return ae_promises.load__journal_entry_obj; return ae_promises.load__journal_entry_obj;
} }
// Updated 2025-03-15 // Updated 2025-03-15
export async function load_ae_obj_li__journal_entry( export async function load_ae_obj_li__journal_entry({
{
api_cfg, api_cfg,
for_obj_type = 'journal', for_obj_type = 'journal',
for_obj_id, for_obj_id,
@@ -96,26 +91,33 @@ export async function load_ae_obj_li__journal_entry(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__journal_entry() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__journal_entry() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -123,11 +125,12 @@ export async function load_ae_obj_li__journal_entry(
// let limit: number = (params.qry__limit ?? 99); // 99 // let limit: number = (params.qry__limit ?? 99); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// console('params_json:', params_json); // console('params_json:', params_json);
ae_promises.load__journal_entry_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__journal_entry_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal_entry', obj_type: 'journal_entry',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -148,9 +151,9 @@ export async function load_ae_obj_li__journal_entry(
if (journal_entry_obj_li_get_result) { if (journal_entry_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_entry_props({ const processed_obj_li = await process_ae_obj__journal_entry_props({
obj_li: journal_entry_obj_li_get_result, obj_li: journal_entry_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -164,7 +167,7 @@ export async function load_ae_obj_li__journal_entry(
table_name: 'journal_entry', table_name: 'journal_entry',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -192,10 +195,8 @@ export async function load_ae_obj_li__journal_entry(
return ae_promises.load__journal_entry_obj_li; return ae_promises.load__journal_entry_obj_li;
} }
// Updated 2025-03-15 // Updated 2025-03-15
export async function create_ae_obj__journal_entry( export async function create_ae_obj__journal_entry({
{
api_cfg, api_cfg,
journal_id, journal_id,
data_kv, data_kv,
@@ -203,14 +204,13 @@ export async function create_ae_obj__journal_entry(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_id: string, journal_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`); console.log(`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`);
} }
@@ -220,7 +220,8 @@ export async function create_ae_obj__journal_entry(
return false; return false;
} }
ae_promises.create__journal_entry = await api.create_ae_obj_crud({ ae_promises.create__journal_entry = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal_entry', obj_type: 'journal_entry',
fields: { fields: {
@@ -236,9 +237,9 @@ export async function create_ae_obj__journal_entry(
if (journal_entry_obj_create_result) { if (journal_entry_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_entry_props({ const processed_obj_li = await process_ae_obj__journal_entry_props({
obj_li: [journal_entry_obj_create_result], obj_li: [journal_entry_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -252,7 +253,7 @@ export async function create_ae_obj__journal_entry(
table_name: 'journal_entry', table_name: 'journal_entry',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -280,10 +281,8 @@ export async function create_ae_obj__journal_entry(
return ae_promises.create__journal_entry; return ae_promises.create__journal_entry;
} }
// Updated 2025-03-15 // Updated 2025-03-15
export async function delete_ae_obj_id__journal_entry( export async function delete_ae_obj_id__journal_entry({
{
api_cfg, api_cfg,
journal_entry_id, journal_entry_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -291,19 +290,19 @@ export async function delete_ae_obj_id__journal_entry(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_entry_id: string, journal_entry_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`); console.log(`*** delete_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`);
} }
ae_promises.delete__journal_entry_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__journal_entry_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal_entry', obj_type: 'journal_entry',
obj_id: journal_entry_id, obj_id: journal_entry_id,
@@ -331,14 +330,9 @@ export async function delete_ae_obj_id__journal_entry(
return ae_promises.delete__journal_entry_obj; return ae_promises.delete__journal_entry_obj;
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2025-06-04 // Updated 2025-06-04
export async function qry__journal_entry( export async function qry__journal_entry({
{
api_cfg, api_cfg,
journal_id, journal_id,
qry_str = null, // Example: 'name:contains:"test"' qry_str = null, // Example: 'name:contains:"test"'
@@ -349,33 +343,40 @@ export async function qry__journal_entry(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 50, limit = 50,
offset = 0, offset = 0,
order_by_li = {'group': 'DESC', 'priority': 'DESC', 'sort': 'DESC', 'alert': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
group: 'DESC',
priority: 'DESC',
sort: 'DESC',
alert: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
journal_id: any, journal_id: any;
qry_str?: null|string, qry_str?: null | string;
qry_created_on?: null|string, qry_created_on?: null | string;
qry_alert?: null|string, qry_alert?: null | string;
qry_priority?: null|number, qry_priority?: null | number;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
log_lvl = 1; log_lvl = 1;
if (log_lvl) { if (log_lvl) {
console.log(`*** qry__journal_entry() *** journal_id=${journal_id}`); console.log(`*** qry__journal_entry() *** journal_id=${journal_id}`);
} }
let params_json: key_val = {}; const params_json: key_val = {};
params_json['qry'] = []; params_json['qry'] = [];
@@ -388,22 +389,20 @@ export async function qry__journal_entry(
// operator: "LIKE", // operator: "LIKE",
// value: qry_str // value: qry_str
// }; // };
let qry_param = const qry_param = {
{ type: '',
type: "", field: 'default_qry_str', // default is really just the standard FT string in the DB
field: "default_qry_str", // default is really just the standard FT string in the DB operator: 'MATCH',
operator: "MATCH",
value: qry_str value: qry_str
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_created_on) { if (qry_created_on) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'created_on',
field: "created_on", operator: '>',
operator: ">",
value: qry_created_on value: qry_created_on
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
@@ -411,17 +410,17 @@ export async function qry__journal_entry(
if (qry_priority) { if (qry_priority) {
console.log('qry_priority:', qry_priority); console.log('qry_priority:', qry_priority);
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'priority',
field: "priority", operator: '=',
operator: "=",
value: qry_priority value: qry_priority
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
ae_promises.load__journal_entry_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__journal_entry_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'journal_entry', obj_type: 'journal_entry',
for_obj_type: 'journal', for_obj_type: 'journal',
@@ -458,11 +457,6 @@ export async function qry__journal_entry(
return ae_promises.load__journal_entry_obj_li; return ae_promises.load__journal_entry_obj_li;
} }
// Updated 2025-03-15 // Updated 2025-03-15
// export async function update_ae_obj__journal_entry( // export async function update_ae_obj__journal_entry(
// { // {
@@ -527,27 +521,28 @@ export async function qry__journal_entry(
// return await ae_promises.update__journal_entry_obj; // return await ae_promises.update__journal_entry_obj;
// } // }
// Updated 2025-05-09 // Updated 2025-05-09
export async function update_ae_obj__journal_entry( export async function update_ae_obj__journal_entry({
{
api_cfg, api_cfg,
journal_entry_id, journal_entry_id,
data_kv, data_kv,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0, log_lvl = 0
}: { }: {
api_cfg: any; api_cfg: any;
journal_entry_id: string; journal_entry_id: string;
data_kv: key_val; data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number; log_lvl?: number;
}) { }) {
// log_lvl = 1; // log_lvl = 1;
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__journal_entry() *** journal_entry_id=${journal_entry_id}`, data_kv); console.log(
`*** update_ae_obj__journal_entry() *** journal_entry_id=${journal_entry_id}`,
data_kv
);
} }
// Perform the API update // Perform the API update
@@ -559,16 +554,16 @@ export async function update_ae_obj__journal_entry(
key: api_cfg.api_crud_super_key, key: api_cfg.api_crud_super_key,
params: params, params: params,
return_obj: true, return_obj: true,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
// Handle the result // Handle the result
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__journal_entry_props({ const processed_obj_li = await process_ae_obj__journal_entry_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -582,7 +577,7 @@ export async function update_ae_obj__journal_entry(
table_name: 'journal_entry', table_name: 'journal_entry',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -601,20 +596,17 @@ export async function update_ae_obj__journal_entry(
} }
} }
// This function will loop through the journal_entry_obj_li and save each one to the DB. // This function will loop through the journal_entry_obj_li and save each one to the DB.
// Updated 2025-05-09 // Updated 2025-05-09
export async function db_save_ae_obj_li__journal_entry( export async function db_save_ae_obj_li__journal_entry({
{
obj_type, obj_type,
obj_li, obj_li,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_type: string, obj_type: string;
obj_li: any, obj_li: any;
log_lvl?: number log_lvl?: number;
} }) {
) {
// log_lvl = 1; // log_lvl = 1;
if (log_lvl) { if (log_lvl) {
console.log(`*** db_save_ae_obj_li__journal_entry() *** obj_type=${obj_type}`, obj_li); console.log(`*** db_save_ae_obj_li__journal_entry() *** obj_type=${obj_type}`, obj_li);
@@ -622,7 +614,7 @@ export async function db_save_ae_obj_li__journal_entry(
if (obj_li && obj_li.length) { if (obj_li && obj_li.length) {
// let obj_li_id = obj_li.map((obj: any) => obj.journal_entry_id_random); // let obj_li_id = obj_li.map((obj: any) => obj.journal_entry_id_random);
let obj_li_id: string[] = []; const obj_li_id: string[] = [];
for (const obj of obj_li) { for (const obj of obj_li) {
// obj_li.forEach(async function (obj: any) { // obj_li.forEach(async function (obj: any) {
@@ -642,8 +634,8 @@ export async function db_save_ae_obj_li__journal_entry(
content_cleaned = null; content_cleaned = null;
content_md_html = null; content_md_html = null;
} else { } else {
content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,""); content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, '');
content_md_html = await marked.parse(content_cleaned ?? '') ?? null; content_md_html = (await marked.parse(content_cleaned ?? '')) ?? null;
} }
let history = obj.history ?? ''; let history = obj.history ?? '';
@@ -656,11 +648,11 @@ export async function db_save_ae_obj_li__journal_entry(
history_cleaned = null; history_cleaned = null;
history_md_html = null; history_md_html = null;
} else { } else {
history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,""); history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, '');
history_md_html = await marked.parse(history_cleaned ?? '') ?? null; history_md_html = (await marked.parse(history_cleaned ?? '')) ?? null;
} }
let obj_record = { const obj_record = {
id: obj.journal_entry_id_random, id: obj.journal_entry_id_random,
journal_entry_id: obj.journal_entry_id_random, journal_entry_id: obj.journal_entry_id_random,
@@ -764,7 +756,7 @@ export async function db_save_ae_obj_li__journal_entry(
// From SQL view // From SQL view
journal_code: obj.journal_code, journal_code: obj.journal_code,
journal_name: obj.journal_name, journal_name: obj.journal_name
// A key value list of the others // A key value list of the others
// journal_other_kv: obj.journal_other_kv, // journal_other_kv: obj.journal_other_kv,
@@ -812,9 +804,8 @@ export async function db_save_ae_obj_li__journal_entry(
} }
} }
// Updated 2025-05-09 // Updated 2025-05-09
let properties_to_save = [ const properties_to_save = [
'id', 'id',
'journal_entry_id', 'journal_entry_id',
@@ -886,14 +877,13 @@ let properties_to_save = [
// From SQL view // From SQL view
'journal_code', 'journal_code',
'journal_name', 'journal_name'
// A key value list of the others // A key value list of the others
// 'journal_other_kv', // 'journal_other_kv',
// 'journal_other_li', // 'journal_other_li',
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -962,7 +952,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-05-09 // Updated 2025-05-09
export async function process_ae_obj__journal_entry_props({ export async function process_ae_obj__journal_entry_props({
obj_li, obj_li,

View File

@@ -1,10 +1,9 @@
// This file is used to export all the functions that are used for Aether Journals related functions. // This file is used to export all the functions that are used for Aether Journals related functions.
import * as journal from "$lib/ae_journals/ae_journals__journal"; import * as journal from '$lib/ae_journals/ae_journals__journal';
import * as journal_entry from "$lib/ae_journals/ae_journals__journal_entry"; import * as journal_entry from '$lib/ae_journals/ae_journals__journal_entry';
const export_obj = {
let export_obj = {
load_ae_obj_id__journal: journal.load_ae_obj_id__journal, load_ae_obj_id__journal: journal.load_ae_obj_id__journal,
load_ae_obj_li__journal: journal.load_ae_obj_li__journal, load_ae_obj_li__journal: journal.load_ae_obj_li__journal,
create_ae_obj__journal: journal.create_ae_obj__journal, create_ae_obj__journal: journal.create_ae_obj__journal,
@@ -16,7 +15,7 @@ let export_obj = {
create_ae_obj__journal_entry: journal_entry.create_ae_obj__journal_entry, create_ae_obj__journal_entry: journal_entry.create_ae_obj__journal_entry,
delete_ae_obj_id__journal_entry: journal_entry.delete_ae_obj_id__journal_entry, delete_ae_obj_id__journal_entry: journal_entry.delete_ae_obj_id__journal_entry,
update_ae_obj__journal_entry: journal_entry.update_ae_obj__journal_entry, update_ae_obj__journal_entry: journal_entry.update_ae_obj__journal_entry,
qry__journal_entry: journal_entry.qry__journal_entry, qry__journal_entry: journal_entry.qry__journal_entry
// db_save_ae_obj_li__journal_entry: journal_entry.db_save_ae_obj_li__journal_entry, // db_save_ae_obj_li__journal_entry: journal_entry.db_save_ae_obj_li__journal_entry,
}; };
export let journals_func = export_obj; export const journals_func = export_obj;

View File

@@ -5,11 +5,10 @@ import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
/* *** BEGIN *** Initialize journals_local_data_struct */ /* *** BEGIN *** Initialize journals_local_data_struct */
// This is for longer term or sticky app data. This should be stored to *local* storage. // This is for longer term or sticky app data. This should be stored to *local* storage.
// Updated 2025-03-20 // Updated 2025-03-20
let journals_local_data_struct: key_val = { const journals_local_data_struct: key_val = {
ver: '2024-08-20_19', ver: '2024-08-20_19',
// Shared // Shared
name: 'Aether - Journals (SvelteKit 2.x Svelte 5.x)', name: 'Aether - Journals (SvelteKit 2.x Svelte 5.x)',
@@ -39,7 +38,8 @@ let journals_local_data_struct: key_val = {
llm__api_base_url: 'https://ai.dgrzone.com/api', llm__api_base_url: 'https://ai.dgrzone.com/api',
llm__api_model: 'dgrzone-deepseek-8b-quick', llm__api_model: 'dgrzone-deepseek-8b-quick',
llm__api_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhYjI2MzdlLThiMjktNGM2Zi05MzVhLWFkYjU1MDkwMGU5MCJ9.VObfR91GrX3j1vHbHZqGsOWEyrL981cbSWWjaXfYbUQ', llm__api_token:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhYjI2MzdlLThiMjktNGM2Zi05MzVhLWFkYjU1MDkwMGU5MCJ9.VObfR91GrX3j1vHbHZqGsOWEyrL981cbSWWjaXfYbUQ',
llm__api_dangerous_browser: false, // This allows for use of localhost. llm__api_dangerous_browser: false, // This allows for use of localhost.
llm__stream: false, // Whether to use streaming or not. Not all APIs support this. llm__stream: false, // Whether to use streaming or not. Not all APIs support this.
llm__timeout_ms: 60000, // 60 seconds llm__timeout_ms: 60000, // 60 seconds
@@ -67,12 +67,13 @@ let journals_local_data_struct: key_val = {
{ code: 'professional', name: 'Professional' }, { code: 'professional', name: 'Professional' },
{ code: 'tracking', name: 'Tracking' }, { code: 'tracking', name: 'Tracking' },
{ code: 'other', name: 'Other' }, { code: 'other', name: 'Other' },
{ code: 'test', name: 'Test' }, { code: 'test', name: 'Test' }
// { code: 'notepad', name: 'Notepad' }, // { code: 'notepad', name: 'Notepad' },
], ]
}, },
entry: { entry: {
llm__system_prompt: 'Summarize the following journal entry content in a concise manner, focusing on key points and insights.', llm__system_prompt:
'Summarize the following journal entry content in a concise manner, focusing on key points and insights.',
llm__max_tokens: 512, llm__max_tokens: 512,
llm__temperature: 0.7, llm__temperature: 0.7,
llm__top_p: 1.0, llm__top_p: 1.0,
@@ -81,21 +82,22 @@ let journals_local_data_struct: key_val = {
llm__presence_penalty: 0.0, llm__presence_penalty: 0.0,
edit: false, edit: false,
edit_kv: {}, edit_kv: {}
}, }
}; };
// console.log(`AE Stores - App Journals Local Storage Data:`, journals_local_data_struct); // console.log(`AE Stores - App Journals Local Storage Data:`, journals_local_data_struct);
// This works and uses *local* storage: // This works and uses *local* storage:
export let journals_loc: Writable<key_val> = persisted('ae_journals_loc', journals_local_data_struct); export const journals_loc: Writable<key_val> = persisted(
'ae_journals_loc',
journals_local_data_struct
);
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc)); // console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
/* *** BEGIN *** Initialize journals_session_data_struct */ /* *** BEGIN *** Initialize journals_session_data_struct */
// Temporary app data. This is lost if the page is refreshed or using different tabs/windows. This should be stored to *session* storage. // Temporary app data. This is lost if the page is refreshed or using different tabs/windows. This should be stored to *session* storage.
// Updated 2025-03-20 // Updated 2025-03-20
let journals_session_data_struct: key_val = { const journals_session_data_struct: key_val = {
ver: '2024-08-20_19', ver: '2024-08-20_19',
log_lvl: 1, log_lvl: 1,
@@ -122,7 +124,7 @@ let journals_session_data_struct: key_val = {
new_journal_name: '', new_journal_name: '',
new_journal_type_code: '', new_journal_type_code: '',
tmp_obj: {}, tmp_obj: {}
}, },
entry: { entry: {
show__ai_summary: false, show__ai_summary: false,
@@ -131,56 +133,53 @@ let journals_session_data_struct: key_val = {
edit: false, edit: false,
edit_kv: {}, edit_kv: {},
tmp_obj: {}, tmp_obj: {}
}, },
journal_kv: { journal_kv: {
// journal_id: {}, // journal_id: {},
}, }
}; };
// console.log(`AE Stores - App Journals Session Storage Data:`, journals_session_data_struct); // console.log(`AE Stores - App Journals Session Storage Data:`, journals_session_data_struct);
export let journals_sess = writable(journals_session_data_struct); export const journals_sess = writable(journals_session_data_struct);
/* *** BEGIN *** Initialize journals_slct and journals_trig */ /* *** BEGIN *** Initialize journals_slct and journals_trig */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different journals, badges, exhibits, etc. */ /* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different journals, badges, exhibits, etc. */
// Intended for temporary session storage. // Intended for temporary session storage.
// Updated 2024-08-20 // Updated 2024-08-20
let journals_slct_obj_template: key_val = { const journals_slct_obj_template: key_val = {
// Top level // Top level
'journal_id': null, journal_id: null,
'journal_obj': {}, journal_obj: {},
'journal_obj_li': [], journal_obj_li: [],
'tmp_journal_obj': {}, // Temporary object for new journal tmp_journal_obj: {}, // Temporary object for new journal
'tmp_journal_entry_obj': {}, // Temporary object for new journal entry tmp_journal_entry_obj: {}, // Temporary object for new journal entry
'lq__journal_obj': {}, // Testing passing a LiveQuery object around... lq__journal_obj: {} // Testing passing a LiveQuery object around...
}; };
// console.log(`AE Stores - Selected Journals Objects:`, journals_slct_obj_template); // console.log(`AE Stores - Selected Journals Objects:`, journals_slct_obj_template);
// This works, and uses *session* (not local) storage: // This works, and uses *session* (not local) storage:
export let journals_slct = writable(journals_slct_obj_template); export const journals_slct = writable(journals_slct_obj_template);
/* *** BEGIN *** Initialize journals_trig */ /* *** BEGIN *** Initialize journals_trig */
// Intended for temporary session storage. // Intended for temporary session storage.
// Updated 2025-03-16 // Updated 2025-03-16
let journals_trig_template: key_val = { const journals_trig_template: key_val = {
journal_id: false, journal_id: false,
journal_entry_li: false, journal_entry_li: false
}; };
export let journals_trig: any = writable(journals_trig_template); export const journals_trig: any = writable(journals_trig_template);
// console.log(`AE Journals Stores - Journals Trigger:`, journals_trig); // console.log(`AE Journals Stores - Journals Trigger:`, journals_trig);
/* *** BEGIN *** Initialize journals_prom */ /* *** BEGIN *** Initialize journals_prom */
// Intended for temporary session storage. // Intended for temporary session storage.
// Updated 2025-03-16 // Updated 2025-03-16
let journals_prom_template: key_val = { const journals_prom_template: key_val = {
journal_id: false, journal_id: false,
journal_entry_li: false,}; journal_entry_li: false
export let journals_prom: any = writable(journals_prom_template); };
export const journals_prom: any = writable(journals_prom_template);
// console.log(`AE Journals Stores - Journals Trigger:`, journals_prom); // console.log(`AE Journals Stores - Journals Trigger:`, journals_prom);

View File

@@ -9,7 +9,6 @@ import type { key_val } from '$lib/stores/ae_stores';
// LLM = Large Language Model (AI) // LLM = Large Language Model (AI)
// Updated 2025-03-15 // Updated 2025-03-15
export interface Journal { export interface Journal {
id: string; // actually "id_random" id: string; // actually "id_random"
journal_id: string; journal_id: string;
@@ -66,7 +65,7 @@ export interface Journal {
passcode_read?: null | string; // For LLM (AI) generated summary...??? passcode_read?: null | string; // For LLM (AI) generated summary...???
passcode_read_expire?: null | Date; passcode_read_expire?: null | Date;
passcode_write?: null | string; passcode_write?: null | string;
passcode_write_expire?: null|Date passcode_write_expire?: null | Date;
passcode?: null | string; // For Journal Entry encryption password passcode?: null | string; // For Journal Entry encryption password
passcode_timeout?: null | number; // Timeout in seconds passcode_timeout?: null | number; // Timeout in seconds
@@ -79,7 +78,7 @@ export interface Journal {
hide?: null | boolean; hide?: null | boolean;
archive?: null | boolean; // Archive the journal archive?: null | boolean; // Archive the journal
archive_on?: null | Date; archive_on?: null | Date;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -333,11 +332,11 @@ export interface Journal_Entry {
passcode_read?: null | string; // For LLM (AI) generated summary...??? passcode_read?: null | string; // For LLM (AI) generated summary...???
passcode_read_expire?: null | Date; passcode_read_expire?: null | Date;
passcode_write?: null | string; passcode_write?: null | string;
passcode_write_expire?: null|Date passcode_write_expire?: null | Date;
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -504,7 +503,6 @@ export const journal_entry_field_li = [
'obj_updated_on' 'obj_updated_on'
]; ];
// Updated 2024-06-10 // Updated 2024-06-10
export class MySubClassedDexie extends Dexie { export class MySubClassedDexie extends Dexie {
// We just tell the typing system this is the case // We just tell the typing system this is the case
@@ -535,7 +533,7 @@ export class MySubClassedDexie extends Dexie {
start_datetime, end_datetime, start_datetime, end_datetime,
timezone, timezone,
tmp_sort_1, tmp_sort_2, tmp_sort_3, tmp_sort_1, tmp_sort_2, tmp_sort_3,
enable, hide, priority, sort, group, created_on, updated_on`, enable, hide, priority, sort, group, created_on, updated_on`
}); });
} }
} }

View File

@@ -1,18 +1,16 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_posts } from "$lib/ae_posts/db_posts"; import { db_posts } from '$lib/ae_posts/db_posts';
import { load_ae_obj_li__post_comment } from "$lib/ae_posts/ae_posts__post_comment"; import { load_ae_obj_li__post_comment } from '$lib/ae_posts/ae_posts__post_comment';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-06-23 // Updated 2025-06-23
export async function load_ae_obj_id__post( export async function load_ae_obj_id__post({
{
api_cfg, api_cfg,
post_id, post_id,
enabled = 'enabled', enabled = 'enabled',
@@ -24,23 +22,23 @@ export async function load_ae_obj_id__post(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_id: string, post_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
inc_comment_li?: boolean, inc_comment_li?: boolean;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__post() *** post_id=${post_id}`); console.log(`*** load_ae_obj_id__post() *** post_id=${post_id}`);
} }
ae_promises.load__post_obj = await api.get_ae_obj_id_crud({ ae_promises.load__post_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post', obj_type: 'post',
obj_id: post_id, obj_id: post_id,
@@ -53,9 +51,9 @@ export async function load_ae_obj_id__post(
if (post_obj_get_result) { if (post_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_props({ const processed_obj_li = await process_ae_obj__post_props({
obj_li: [post_obj_get_result], obj_li: [post_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -69,7 +67,7 @@ export async function load_ae_obj_id__post(
table_name: 'post', table_name: 'post',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -105,7 +103,7 @@ export async function load_ae_obj_id__post(
if (log_lvl) { if (log_lvl) {
console.log(`Need to load the comment list for the post now`); console.log(`Need to load the comment list for the post now`);
} }
let load_post_comment_obj_li = load_ae_obj_li__post_comment({ const load_post_comment_obj_li = load_ae_obj_li__post_comment({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'post', for_obj_type: 'post',
for_obj_id: post_id, for_obj_id: post_id,
@@ -116,8 +114,7 @@ export async function load_ae_obj_id__post(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((post_comment_obj_li) => {
.then((post_comment_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`post_comment_obj_li = `, post_comment_obj_li); console.log(`post_comment_obj_li = `, post_comment_obj_li);
} }
@@ -133,10 +130,8 @@ export async function load_ae_obj_id__post(
return ae_promises.load__post_obj; return ae_promises.load__post_obj;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function load_ae_obj_li__post( export async function load_ae_obj_li__post({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -146,30 +141,37 @@ export async function load_ae_obj_li__post(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
updated_on: 'DESC',
created_on: 'DESC',
title: 'ASC'
},
params = {}, params = {},
params_json = null, params_json = null,
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
qry_archive_on?: boolean|null|string, qry_archive_on?: boolean | null | string;
inc_comment_li?: boolean, inc_comment_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params_json?: null|key_val, params_json?: null | key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__post() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__post() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
// There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01 // There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01
@@ -190,7 +192,6 @@ export async function load_ae_obj_li__post(
// params_json['qry'].push(qry_param); // params_json['qry'].push(qry_param);
} }
// if (qry_archive_on) { // if (qry_archive_on) {
// if (!params_json['and_qry']) { // if (!params_json['and_qry']) {
// params_json['and_qry'] = {}; // params_json['and_qry'] = {};
@@ -212,9 +213,8 @@ export async function load_ae_obj_li__post(
console.log('params_json:', params_json); console.log('params_json:', params_json);
} }
ae_promises.load__post_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
ae_promises.load__post_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post', obj_type: 'post',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -235,9 +235,9 @@ export async function load_ae_obj_li__post(
if (post_obj_li_get_result) { if (post_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_props({ const processed_obj_li = await process_ae_obj__post_props({
obj_li: post_obj_li_get_result, obj_li: post_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -251,7 +251,7 @@ export async function load_ae_obj_li__post(
table_name: 'post', table_name: 'post',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -282,10 +282,10 @@ export async function load_ae_obj_li__post(
console.log(`Need to load the comment list for each post now`); console.log(`Need to load the comment list for each post now`);
} }
for (let i = 0; i < ae_promises.load__post_obj_li.length; i++) { for (let i = 0; i < ae_promises.load__post_obj_li.length; i++) {
let post_obj = ae_promises.load__post_obj_li[i]; const post_obj = ae_promises.load__post_obj_li[i];
let post_id = post_obj.post_id_random; const post_id = post_obj.post_id_random;
let load_post_comment_obj_li = load_ae_obj_li__post_comment({ const load_post_comment_obj_li = load_ae_obj_li__post_comment({
api_cfg: api_cfg, api_cfg: api_cfg,
for_obj_type: 'post', for_obj_type: 'post',
for_obj_id: post_id, for_obj_id: post_id,
@@ -296,8 +296,7 @@ export async function load_ae_obj_li__post(
params: params, params: params,
try_cache: try_cache, try_cache: try_cache,
log_lvl: log_lvl log_lvl: log_lvl
}) }).then((post_comment_obj_li) => {
.then((post_comment_obj_li) => {
if (log_lvl) { if (log_lvl) {
console.log(`post_comment_obj_li = `, post_comment_obj_li); console.log(`post_comment_obj_li = `, post_comment_obj_li);
} }
@@ -314,10 +313,8 @@ export async function load_ae_obj_li__post(
return ae_promises.load__post_obj_li; return ae_promises.load__post_obj_li;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function create_ae_obj__post( export async function create_ae_obj__post({
{
api_cfg, api_cfg,
account_id, account_id,
data_kv, data_kv,
@@ -325,14 +322,13 @@ export async function create_ae_obj__post(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__post() *** account_id=${account_id}`); console.log(`*** create_ae_obj__post() *** account_id=${account_id}`);
} }
@@ -342,7 +338,8 @@ export async function create_ae_obj__post(
return false; return false;
} }
ae_promises.create__post = await api.create_ae_obj_crud({ ae_promises.create__post = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post', obj_type: 'post',
fields: { fields: {
@@ -358,9 +355,9 @@ export async function create_ae_obj__post(
if (post_obj_create_result) { if (post_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_props({ const processed_obj_li = await process_ae_obj__post_props({
obj_li: [post_obj_create_result], obj_li: [post_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -374,7 +371,7 @@ export async function create_ae_obj__post(
table_name: 'post', table_name: 'post',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -395,8 +392,7 @@ export async function create_ae_obj__post(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__post:', ae_promises.create__post); console.log('ae_promises.create__post:', ae_promises.create__post);
@@ -404,10 +400,8 @@ export async function create_ae_obj__post(
return ae_promises.create__post; return ae_promises.create__post;
} }
// Updated 2024-11-08 // Updated 2024-11-08
export async function delete_ae_obj_id__post( export async function delete_ae_obj_id__post({
{
api_cfg, api_cfg,
post_id, post_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -415,19 +409,19 @@ export async function delete_ae_obj_id__post(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_id: string, post_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__post() *** post_id=${post_id}`); console.log(`*** delete_ae_obj_id__post() *** post_id=${post_id}`);
} }
ae_promises.delete__post_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__post_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post', obj_type: 'post',
obj_id: post_id, obj_id: post_id,
@@ -455,10 +449,8 @@ export async function delete_ae_obj_id__post(
return ae_promises.delete__post_obj; return ae_promises.delete__post_obj;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function update_ae_obj__post( export async function update_ae_obj__post({
{
api_cfg, api_cfg,
post_id, post_id,
data_kv, data_kv,
@@ -466,14 +458,13 @@ export async function update_ae_obj__post(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_id: string, post_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__post() *** post_id=${post_id}`, data_kv); console.log(`*** update_ae_obj__post() *** post_id=${post_id}`, data_kv);
} }
@@ -487,16 +478,16 @@ export async function update_ae_obj__post(
key: api_cfg.api_crud_super_key, key: api_cfg.api_crud_super_key,
params: params, params: params,
return_obj: true, return_obj: true,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
// Handle the result // Handle the result
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_props({ const processed_obj_li = await process_ae_obj__post_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -510,7 +501,7 @@ export async function update_ae_obj__post(
table_name: 'post', table_name: 'post',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -529,11 +520,9 @@ export async function update_ae_obj__post(
} }
} }
// This new function is using CRUD v2. This should allow for more flexibility in the queries. // This new function is using CRUD v2. This should allow for more flexibility in the queries.
// Updated 2024-09-25 // Updated 2024-09-25
export async function qry__post( export async function qry__post({
{
api_cfg, api_cfg,
account_id, account_id,
qry_str, qry_str,
@@ -547,20 +536,19 @@ export async function qry__post(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: any, account_id: any;
qry_str?: string, qry_str?: string;
qry_files?: null|boolean, qry_files?: null | boolean;
qry_start_datetime?: null|string, // Greater than this datetime qry_start_datetime?: null | string; // Greater than this datetime
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number, limit?: number;
offset?: number, offset?: number;
params?: any, params?: any;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log(`*** qry__post() *** account_id=${account_id} qry_str=${qry_str}`); console.log(`*** qry__post() *** account_id=${account_id} qry_str=${qry_str}`);
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -568,7 +556,7 @@ export async function qry__post(
// let limit: number = (params.qry__limit ?? 25); // 99 // let limit: number = (params.qry__limit ?? 25); // 99
// let offset: number = (params.qry__offset ?? 0); // 0 // let offset: number = (params.qry__offset ?? 0); // 0
let params_json: key_val = {}; const params_json: key_val = {};
// if (qry_str && qry_str.length > 2) { // if (qry_str && qry_str.length > 2) {
// params_json['ft_qry'] = {}; // params_json['ft_qry'] = {};
@@ -578,39 +566,43 @@ export async function qry__post(
params_json['qry'] = []; params_json['qry'] = [];
if (qry_files === true) { if (qry_files === true) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: '>',
operator: ">",
value: 0 value: 0
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} else if (qry_files === false) { } else if (qry_files === false) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'file_count_all',
field: "file_count_all", operator: 'IS',
operator: "IS",
value: null value: null
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
if (qry_start_datetime) { if (qry_start_datetime) {
let qry_param = const qry_param = {
{ type: 'AND',
type: "AND", field: 'start_datetime',
field: "start_datetime", operator: '>',
operator: ">",
value: qry_start_datetime value: qry_start_datetime
}; };
params_json['qry'].push(qry_param); params_json['qry'].push(qry_param);
} }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'}; const order_by_li = {
priority: 'DESC',
sort: 'DESC',
updated_on: 'DESC',
created_on: 'DESC',
title: 'ASC'
};
ae_promises.load__post_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__post_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post', obj_type: 'post',
for_obj_type: 'account', for_obj_type: 'account',
@@ -631,9 +623,9 @@ export async function qry__post(
if (post_obj_li_get_result) { if (post_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_props({ const processed_obj_li = await process_ae_obj__post_props({
obj_li: post_obj_li_get_result, obj_li: post_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -647,7 +639,7 @@ export async function qry__post(
table_name: 'post', table_name: 'post',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -665,7 +657,6 @@ export async function qry__post(
return ae_promises.load__post_obj_li; return ae_promises.load__post_obj_li;
} }
// Updated 2024-09-25 // Updated 2024-09-25
// export async function search__post( // export async function search__post(
// { // {
@@ -802,10 +793,6 @@ export async function qry__post(
// return ae_promises.load__post_obj_li; // return ae_promises.load__post_obj_li;
// } // }
// Updated 2025-06-04 // Updated 2025-06-04
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -854,14 +841,13 @@ export const properties_to_save = [
// 'tmp_sort_b', // 'tmp_sort_b',
// From SQL view // From SQL view
'post_comment_count', 'post_comment_count'
// A key value list of the comments // A key value list of the comments
// 'post_comment_kv', // 'post_comment_kv',
// 'post_comment_li', // 'post_comment_li',
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -930,7 +916,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-06-04 // Updated 2025-06-04
export async function process_ae_obj__post_props({ export async function process_ae_obj__post_props({
obj_li, obj_li,

View File

@@ -1,16 +1,14 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie"; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_posts } from "$lib/ae_posts/db_posts"; import { db_posts } from '$lib/ae_posts/db_posts';
let ae_promises: key_val = {};
const ae_promises: key_val = {};
// Updated 2025-06-23 // Updated 2025-06-23
export async function load_ae_obj_id__post_comment( export async function load_ae_obj_id__post_comment({
{
api_cfg, api_cfg,
post_comment_id, post_comment_id,
enabled = 'enabled', enabled = 'enabled',
@@ -21,22 +19,22 @@ export async function load_ae_obj_id__post_comment(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_comment_id: string, post_comment_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`); console.log(`*** load_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`);
} }
ae_promises.load__post_comment_obj = await api.get_ae_obj_id_crud({ ae_promises.load__post_comment_obj = await api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post_comment', obj_type: 'post_comment',
obj_id: post_comment_id, obj_id: post_comment_id,
@@ -49,9 +47,9 @@ export async function load_ae_obj_id__post_comment(
if (post_comment_obj_get_result) { if (post_comment_obj_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_comment_props({ const processed_obj_li = await process_ae_obj__post_comment_props({
obj_li: [post_comment_obj_get_result], obj_li: [post_comment_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -65,7 +63,7 @@ export async function load_ae_obj_id__post_comment(
table_name: 'comment', table_name: 'comment',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -92,10 +90,8 @@ export async function load_ae_obj_id__post_comment(
return ae_promises.load__post_comment_obj; return ae_promises.load__post_comment_obj;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function load_ae_obj_li__post_comment( export async function load_ae_obj_li__post_comment({
{
api_cfg, api_cfg,
for_obj_type = 'post', for_obj_type = 'post',
for_obj_id, for_obj_id,
@@ -103,35 +99,43 @@ export async function load_ae_obj_li__post_comment(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
updated_on: 'DESC',
created_on: 'DESC',
title: 'ASC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__post_comment() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__post_comment() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
if (log_lvl) { if (log_lvl) {
console.log('params_json:', params_json); console.log('params_json:', params_json);
} }
ae_promises.load__post_comment_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__post_comment_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post_comment', obj_type: 'post_comment',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -152,9 +156,9 @@ export async function load_ae_obj_li__post_comment(
if (post_comment_obj_li_get_result) { if (post_comment_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_comment_props({ const processed_obj_li = await process_ae_obj__post_comment_props({
obj_li: post_comment_obj_li_get_result, obj_li: post_comment_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -168,7 +172,7 @@ export async function load_ae_obj_li__post_comment(
table_name: 'comment', table_name: 'comment',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -196,10 +200,8 @@ export async function load_ae_obj_li__post_comment(
return ae_promises.load__post_comment_obj_li; return ae_promises.load__post_comment_obj_li;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function create_ae_obj__post_comment( export async function create_ae_obj__post_comment({
{
api_cfg, api_cfg,
post_id, post_id,
data_kv, data_kv,
@@ -207,14 +209,13 @@ export async function create_ae_obj__post_comment(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_id: string, post_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj__post_comment() *** post_id=${post_id}`); console.log(`*** create_ae_obj__post_comment() *** post_id=${post_id}`);
} }
@@ -224,7 +225,8 @@ export async function create_ae_obj__post_comment(
return false; return false;
} }
ae_promises.create__post_comment = await api.create_ae_obj_crud({ ae_promises.create__post_comment = await api
.create_ae_obj_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post_comment', obj_type: 'post_comment',
fields: { fields: {
@@ -240,9 +242,9 @@ export async function create_ae_obj__post_comment(
if (post_comment_obj_create_result) { if (post_comment_obj_create_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_comment_props({ const processed_obj_li = await process_ae_obj__post_comment_props({
obj_li: [post_comment_obj_create_result], obj_li: [post_comment_obj_create_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -256,7 +258,7 @@ export async function create_ae_obj__post_comment(
table_name: 'comment', table_name: 'comment',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -277,8 +279,7 @@ export async function create_ae_obj__post_comment(
.catch(function (error: any) { .catch(function (error: any) {
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}) })
.finally(function () { .finally(function () {});
});
if (log_lvl) { if (log_lvl) {
console.log('ae_promises.create__post_comment:', ae_promises.create__post_comment); console.log('ae_promises.create__post_comment:', ae_promises.create__post_comment);
@@ -286,10 +287,8 @@ export async function create_ae_obj__post_comment(
return ae_promises.create__post_comment; return ae_promises.create__post_comment;
} }
// Updated 2024-11-08 // Updated 2024-11-08
export async function delete_ae_obj_id__post_comment( export async function delete_ae_obj_id__post_comment({
{
api_cfg, api_cfg,
post_comment_id, post_comment_id,
method = 'delete', // 'delete', 'disable', 'hide' method = 'delete', // 'delete', 'disable', 'hide'
@@ -297,19 +296,19 @@ export async function delete_ae_obj_id__post_comment(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_comment_id: string, post_comment_id: string;
method?: string, method?: string;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`); console.log(`*** delete_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`);
} }
ae_promises.delete__post_comment_obj = await api.delete_ae_obj_id_crud({ ae_promises.delete__post_comment_obj = await api
.delete_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'post_comment', obj_type: 'post_comment',
obj_id: post_comment_id, obj_id: post_comment_id,
@@ -337,10 +336,8 @@ export async function delete_ae_obj_id__post_comment(
return ae_promises.delete__post_comment_obj; return ae_promises.delete__post_comment_obj;
} }
// Updated 2025-06-23 // Updated 2025-06-23
export async function update_ae_obj__post_comment( export async function update_ae_obj__post_comment({
{
api_cfg, api_cfg,
post_comment_id, post_comment_id,
data_kv, data_kv,
@@ -348,16 +345,18 @@ export async function update_ae_obj__post_comment(
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
post_comment_id: string, post_comment_id: string;
data_kv: key_val, data_kv: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** update_ae_obj__post_comment() *** post_comment_id=${post_comment_id}`, data_kv); console.log(
`*** update_ae_obj__post_comment() *** post_comment_id=${post_comment_id}`,
data_kv
);
} }
// Perform the API update // Perform the API update
@@ -369,16 +368,16 @@ export async function update_ae_obj__post_comment(
key: api_cfg.api_crud_super_key, key: api_cfg.api_crud_super_key,
params: params, params: params,
return_obj: true, return_obj: true,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
// Handle the result // Handle the result
if (result) { if (result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__post_comment_props({ const processed_obj_li = await process_ae_obj__post_comment_props({
obj_li: [result], obj_li: [result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -392,7 +391,7 @@ export async function update_ae_obj__post_comment(
table_name: 'comment', table_name: 'comment',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save, properties_to_save: properties_to_save,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -411,10 +410,6 @@ export async function update_ae_obj__post_comment(
} }
} }
// Updated 2025-06-04 // Updated 2025-06-04
export const properties_to_save = [ export const properties_to_save = [
'id', 'id',
@@ -449,14 +444,13 @@ export const properties_to_save = [
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
// 'tmp_sort_a', // 'tmp_sort_a',
// 'tmp_sort_b', // 'tmp_sort_b',
// From SQL view // From SQL view
]; ];
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -525,7 +519,6 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2025-06-04 // Updated 2025-06-04
export async function process_ae_obj__post_comment_props({ export async function process_ae_obj__post_comment_props({
obj_li, obj_li,

View File

@@ -5,34 +5,28 @@ import {
load_ae_obj_li__post, load_ae_obj_li__post,
create_ae_obj__post, create_ae_obj__post,
delete_ae_obj_id__post, delete_ae_obj_id__post,
update_ae_obj__post, update_ae_obj__post
} from '$lib/ae_posts/ae_posts__post';
} from "$lib/ae_posts/ae_posts__post";
import { import {
load_ae_obj_id__post_comment, load_ae_obj_id__post_comment,
load_ae_obj_li__post_comment, load_ae_obj_li__post_comment,
create_ae_obj__post_comment, create_ae_obj__post_comment,
delete_ae_obj_id__post_comment, delete_ae_obj_id__post_comment,
update_ae_obj__post_comment, update_ae_obj__post_comment
} from '$lib/ae_posts/ae_posts__post_comment';
} from "$lib/ae_posts/ae_posts__post_comment"; const export_obj = {
let export_obj = {
load_ae_obj_id__post: load_ae_obj_id__post, load_ae_obj_id__post: load_ae_obj_id__post,
load_ae_obj_li__post: load_ae_obj_li__post, load_ae_obj_li__post: load_ae_obj_li__post,
create_ae_obj__post: create_ae_obj__post, create_ae_obj__post: create_ae_obj__post,
delete_ae_obj_id__post: delete_ae_obj_id__post, delete_ae_obj_id__post: delete_ae_obj_id__post,
update_ae_obj__post: update_ae_obj__post, update_ae_obj__post: update_ae_obj__post,
load_ae_obj_id__post_comment: load_ae_obj_id__post_comment, load_ae_obj_id__post_comment: load_ae_obj_id__post_comment,
load_ae_obj_li__post_comment: load_ae_obj_li__post_comment, load_ae_obj_li__post_comment: load_ae_obj_li__post_comment,
create_ae_obj__post_comment: create_ae_obj__post_comment, create_ae_obj__post_comment: create_ae_obj__post_comment,
delete_ae_obj_id__post_comment: delete_ae_obj_id__post_comment, delete_ae_obj_id__post_comment: delete_ae_obj_id__post_comment,
update_ae_obj__post_comment: update_ae_obj__post_comment, update_ae_obj__post_comment: update_ae_obj__post_comment
}; };
export let posts_func = export_obj; export const posts_func = export_obj;

View File

@@ -43,7 +43,7 @@ export interface Post {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -63,7 +63,6 @@ export interface Post {
upload_complete?: boolean; upload_complete?: boolean;
} }
// Updated 2024-11-13 // Updated 2024-11-13
export interface Post_Comment { export interface Post_Comment {
id: string; id: string;
@@ -91,7 +90,7 @@ export interface Post_Comment {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -105,7 +104,6 @@ export interface Post_Comment {
// Additional fields for convenience (database views) // Additional fields for convenience (database views)
} }
// Updated 2024-09-25 // Updated 2024-09-25
export class MySubClassedDexie extends Dexie { export class MySubClassedDexie extends Dexie {
// We just tell the typing system this is the case // We just tell the typing system this is the case
@@ -133,7 +131,7 @@ export class MySubClassedDexie extends Dexie {
title, title,
full_name, email, full_name, email,
tmp_sort_1, tmp_sort_2, tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on]`, enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on]`
}); });
} }
} }

View File

@@ -1,7 +1,7 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
import { db_sponsorships } from "$lib/ae_sponsorships/db_sponsorships"; import { db_sponsorships } from '$lib/ae_sponsorships/db_sponsorships';
// import { liveQuery } from "dexie"; // import { liveQuery } from "dexie";
// import { db_core } from "$lib/db_core"; // import { db_core } from "$lib/db_core";
@@ -27,10 +27,9 @@ export const properties_to_save_sponsorship_cfg = [
'updated_on', 'updated_on',
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
]; ];
// --- PROCESS FUNCTION --- // --- PROCESS FUNCTION ---
export async function process_ae_obj__sponsorship_cfg_props({ export async function process_ae_obj__sponsorship_cfg_props({
obj_li, obj_li,
@@ -57,7 +56,6 @@ export async function process_ae_obj__sponsorship_cfg_props({
}); });
} }
// --- PROPERTIES TO SAVE --- // --- PROPERTIES TO SAVE ---
export const properties_to_save_sponsorship = [ export const properties_to_save_sponsorship = [
'id', 'id',
@@ -95,10 +93,9 @@ export const properties_to_save_sponsorship = [
'updated_on', 'updated_on',
// Generated fields for sorting locally only // Generated fields for sorting locally only
'tmp_sort_1', 'tmp_sort_1',
'tmp_sort_2', 'tmp_sort_2'
]; ];
// --- PROCESS FUNCTION --- // --- PROCESS FUNCTION ---
export async function process_ae_obj__sponsorship_props({ export async function process_ae_obj__sponsorship_props({
obj_li, obj_li,
@@ -125,7 +122,6 @@ export async function process_ae_obj__sponsorship_props({
}); });
} }
/** /**
* NON-EXPORTED LOCAL HELPER * NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations. * Processes a list of Aether objects by applying common and specific transformations.
@@ -194,28 +190,28 @@ async function _process_generic_props<T extends Record<string, any>>({
return processed_obj_li; return processed_obj_li;
} }
// Updated 2024-03-29 // Updated 2024-03-29
async function load_ae_obj_id__sponsorship_cfg( async function load_ae_obj_id__sponsorship_cfg({
{
api_cfg, api_cfg,
sponsorship_cfg_id, sponsorship_cfg_id,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
sponsorship_cfg_id: string, sponsorship_cfg_id: string;
try_cache: boolean, try_cache: boolean;
log_lvl: number log_lvl: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`); console.log(
`*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`
);
} }
let params = {}; const params = {};
ae_promises.load__sponsorship_cfg_obj = api.get_ae_obj_id_crud({ ae_promises.load__sponsorship_cfg_obj = api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'sponsorship_cfg', obj_type: 'sponsorship_cfg',
obj_id: sponsorship_cfg_id, obj_id: sponsorship_cfg_id,
@@ -229,13 +225,16 @@ async function load_ae_obj_id__sponsorship_cfg(
if (log_lvl) { if (log_lvl) {
console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}`); console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}`);
} else if (log_lvl > 1) { } else if (log_lvl > 1) {
console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}:`, sponsorship_cfg_obj_get_result); console.log(
`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}:`,
sponsorship_cfg_obj_get_result
);
} }
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__sponsorship_cfg_props({ const processed_obj_li = await process_ae_obj__sponsorship_cfg_props({
obj_li: [sponsorship_cfg_obj_get_result], obj_li: [sponsorship_cfg_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -249,7 +248,7 @@ async function load_ae_obj_id__sponsorship_cfg(
table_name: 'cfg', table_name: 'cfg',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_sponsorship_cfg, properties_to_save: properties_to_save_sponsorship_cfg,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -272,28 +271,26 @@ async function load_ae_obj_id__sponsorship_cfg(
return ae_promises.load__sponsorship_cfg_obj; return ae_promises.load__sponsorship_cfg_obj;
} }
// Updated 2024-03-29 // Updated 2024-03-29
async function load_ae_obj_id__sponsorship( async function load_ae_obj_id__sponsorship({
{
api_cfg, api_cfg,
sponsorship_id, sponsorship_id,
try_cache = false, try_cache = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
sponsorship_id: string, sponsorship_id: string;
try_cache: boolean, try_cache: boolean;
log_lvl: number log_lvl: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`); console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
} }
let params = {}; const params = {};
ae_promises.load__sponsorship_obj = api.get_ae_obj_id_crud({ ae_promises.load__sponsorship_obj = api
.get_ae_obj_id_crud({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'sponsorship', obj_type: 'sponsorship',
obj_id: sponsorship_id, obj_id: sponsorship_id,
@@ -307,13 +304,16 @@ async function load_ae_obj_id__sponsorship(
if (log_lvl) { if (log_lvl) {
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`); console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`);
} else if (log_lvl > 1) { } else if (log_lvl > 1) {
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`, sponsorship_obj_get_result); console.log(
`*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`,
sponsorship_obj_get_result
);
} }
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__sponsorship_props({ const processed_obj_li = await process_ae_obj__sponsorship_props({
obj_li: [sponsorship_obj_get_result], obj_li: [sponsorship_obj_get_result],
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -327,7 +327,7 @@ async function load_ae_obj_id__sponsorship(
table_name: 'sponsorship', table_name: 'sponsorship',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_sponsorship, properties_to_save: properties_to_save_sponsorship,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -351,8 +351,7 @@ async function load_ae_obj_id__sponsorship(
} }
// Updated 2025-01-15 // Updated 2025-01-15
async function load_ae_obj_li__sponsorship( async function load_ae_obj_li__sponsorship({
{
api_cfg, api_cfg,
for_obj_type = 'account', for_obj_type = 'account',
for_obj_id, for_obj_id,
@@ -360,32 +359,40 @@ async function load_ae_obj_li__sponsorship(
hidden = 'not_hidden', hidden = 'not_hidden',
limit = 99, limit = 99,
offset = 0, offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, order_by_li = {
priority: 'DESC',
sort: 'DESC',
name: 'ASC',
updated_on: 'DESC',
created_on: 'DESC'
},
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
for_obj_type: string, for_obj_type: string;
for_obj_id: string, for_obj_id: string;
inc_content_li?: boolean, inc_content_li?: boolean;
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number, limit?: number;
offset?: number, offset?: number;
order_by_li?: key_val, order_by_li?: key_val;
params?: key_val, params?: key_val;
try_cache?: boolean, try_cache?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** load_ae_obj_li__sponsorship() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); console.log(
`*** load_ae_obj_li__sponsorship() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
);
} }
let params_json: key_val = {}; const params_json: key_val = {};
ae_promises.load__sponsorship_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({ ae_promises.load__sponsorship_obj_li = await api
.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg, api_cfg: api_cfg,
obj_type: 'sponsorship', obj_type: 'sponsorship',
for_obj_type: for_obj_type, for_obj_type: for_obj_type,
@@ -406,9 +413,9 @@ async function load_ae_obj_li__sponsorship(
if (sponsorship_obj_li_get_result) { if (sponsorship_obj_li_get_result) {
if (try_cache) { if (try_cache) {
// Process the results first // Process the results first
let processed_obj_li = await process_ae_obj__sponsorship_props({ const processed_obj_li = await process_ae_obj__sponsorship_props({
obj_li: sponsorship_obj_li_get_result, obj_li: sponsorship_obj_li_get_result,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('Processed object list:', processed_obj_li); console.log('Processed object list:', processed_obj_li);
@@ -422,7 +429,7 @@ async function load_ae_obj_li__sponsorship(
table_name: 'sponsorship', table_name: 'sponsorship',
obj_li: processed_obj_li, obj_li: processed_obj_li,
properties_to_save: properties_to_save_sponsorship, properties_to_save: properties_to_save_sponsorship,
log_lvl: log_lvl, log_lvl: log_lvl
}); });
if (log_lvl) { if (log_lvl) {
console.log('DB save completed.'); console.log('DB save completed.');
@@ -441,10 +448,7 @@ async function load_ae_obj_li__sponsorship(
return ae_promises.load__sponsorship_obj_li; return ae_promises.load__sponsorship_obj_li;
} }
export async function download_export__sponsorship({
export async function download_export__sponsorship(
{
api_cfg, api_cfg,
account_id, account_id,
file_type = 'CSV', // 'CSV' or 'Excel' file_type = 'CSV', // 'CSV' or 'Excel'
@@ -454,16 +458,15 @@ export async function download_export__sponsorship(
params = {}, // key value object is expected params = {}, // key value object is expected
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
account_id: string, account_id: string;
file_type?: string, file_type?: string;
return_file?: boolean, return_file?: boolean;
filename?: string, filename?: string;
auto_download?: boolean, auto_download?: boolean;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** stores_event_api.js: get_sponsorship_export() ***'); console.log('*** stores_event_api.js: get_sponsorship_export() ***');
const endpoint = `/v2/crud/sponsorship/list`; const endpoint = `/v2/crud/sponsorship/list`;
@@ -485,19 +488,17 @@ ae_promises.download__sponsorship_export_file = await api.get_object({
log_lvl: log_lvl log_lvl: log_lvl
}); });
console.log('ae_promises.download__sponsorship_export_file:', ae_promises.download__sponsorship_export_file); console.log(
'ae_promises.download__sponsorship_export_file:',
ae_promises.download__sponsorship_export_file
);
return ae_promises.download__sponsorship_export_file; return ae_promises.download__sponsorship_export_file;
} }
const export_obj = {
let export_obj = {
load_ae_obj_id__sponsorship_cfg: load_ae_obj_id__sponsorship_cfg, load_ae_obj_id__sponsorship_cfg: load_ae_obj_id__sponsorship_cfg,
load_ae_obj_id__sponsorship: load_ae_obj_id__sponsorship, load_ae_obj_id__sponsorship: load_ae_obj_id__sponsorship,
load_ae_obj_li__sponsorship: load_ae_obj_li__sponsorship, load_ae_obj_li__sponsorship: load_ae_obj_li__sponsorship,
download_export__sponsorship: download_export__sponsorship, download_export__sponsorship: download_export__sponsorship
}; };
export let spons_func = export_obj; export const spons_func = export_obj;

View File

@@ -59,7 +59,7 @@ export interface Sponsorship {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -73,7 +73,6 @@ export interface Sponsorship {
// Additional fields for convenience (database views) // Additional fields for convenience (database views)
} }
// Updated 2025-01-15 // Updated 2025-01-15
export interface Sponsorship_Cfg { export interface Sponsorship_Cfg {
id: string; id: string;
@@ -95,7 +94,7 @@ export interface Sponsorship_Cfg {
enable: null | boolean; enable: null | boolean;
hide?: null | boolean; hide?: null | boolean;
priority?: null|boolean priority?: null | boolean;
sort?: null | number; sort?: null | number;
group?: null | string; group?: null | string;
notes?: null | string; notes?: null | string;
@@ -105,7 +104,6 @@ export interface Sponsorship_Cfg {
// Additional fields for convenience (database views) // Additional fields for convenience (database views)
} }
// Updated 2024-09-25 // Updated 2024-09-25
export class MySubClassedDexie extends Dexie { export class MySubClassedDexie extends Dexie {
// We just tell the typing system this is the case // We just tell the typing system this is the case
@@ -127,7 +125,7 @@ export class MySubClassedDexie extends Dexie {
cfg: ` cfg: `
id, sponsorship_cfg_id, id, sponsorship_cfg_id,
account_id, account_id,
for_type, for_id`, for_type, for_id`
}); });
} }
} }

View File

@@ -1,5 +1,11 @@
// Import external files first. Eventually this will be broken up in to smaller files. // Import external files first. Eventually this will be broken up in to smaller files.
import { clean_filename, format_bytes, guess_file_name, guess_file_extension, get_file_hash } from './ae_utils__files'; import {
clean_filename,
format_bytes,
guess_file_name,
guess_file_extension,
get_file_hash
} from './ae_utils__files';
import { get_obj_li_w_match_prop } from './ae_utils__get_obj_li_w_match_prop'; import { get_obj_li_w_match_prop } from './ae_utils__get_obj_li_w_match_prop';
import { file_extension_icon } from './ae_utils__file_extension_icon'; import { file_extension_icon } from './ae_utils__file_extension_icon';
import { process_permission_checks } from './ae_utils__perm_checks'; import { process_permission_checks } from './ae_utils__perm_checks';
@@ -10,8 +16,13 @@ import { to_title_case } from './ae_utils__to_title_case';
import { process_data_string } from './ae_utils__process_data_string'; import { process_data_string } from './ae_utils__process_data_string';
import { set_obj_prop_display_name } from './ae_utils__set_obj_prop_display_name'; import { set_obj_prop_display_name } from './ae_utils__set_obj_prop_display_name';
import { return_obj_type_path } from './ae_utils__return_obj_type_path'; import { return_obj_type_path } from './ae_utils__return_obj_type_path';
import { combine_iv_and_base64, encrypt_content, encrypt_wrapper, decrypt_content, decrypt_wrapper } from './ae_utils__crypto'; import {
combine_iv_and_base64,
encrypt_content,
encrypt_wrapper,
decrypt_content,
decrypt_wrapper
} from './ae_utils__crypto';
export type key_str = { export type key_str = {
[key: string]: string; [key: string]: string;
@@ -21,13 +32,11 @@ export type key_val = {
[key: string]: any; [key: string]: any;
}; };
/* This utility function will add commas to a number. */ /* This utility function will add commas to a number. */
function number_w_commas(x) { function number_w_commas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
} }
// This function will update the URL and send a message to the parent window (iframe). // This function will update the URL and send a message to the parent window (iframe).
// The name should be something like "example_id". // The name should be something like "example_id".
// Svelte specific: // Svelte specific:
@@ -35,12 +44,10 @@ function number_w_commas(x) {
// Updated 2024-03-02 // Updated 2024-03-02
// import { pushState, replaceState } from '$app/navigation'; // import { pushState, replaceState } from '$app/navigation';
function handle_url_and_message(name: string, value: null | string) { function handle_url_and_message(name: string, value: null | string) {
console.log(`*** handle_url_and_message() *** name=${name} value=${value}`); console.log(`*** handle_url_and_message() *** name=${name} value=${value}`);
let location = window.location.href; const location = window.location.href;
// console.log('location:', location); // console.log('location:', location);
const url = new URL(location); const url = new URL(location);
// console.log('url:', url); // console.log('url:', url);
@@ -54,8 +61,8 @@ function handle_url_and_message(name: string, value: null|string) {
// pushState(url.search, {}); // pushState(url.search, {});
// replaceState(url.href, {}); // replaceState(url.href, {});
let message = {name: value}; const message = { name: value };
window.parent.postMessage(message, "*"); window.parent.postMessage(message, '*');
} else { } else {
url.searchParams.delete(name); url.searchParams.delete(name);
history.pushState({}, '', url); history.pushState({}, '', url);
@@ -65,18 +72,34 @@ function handle_url_and_message(name: string, value: null|string) {
// pushState(url.href, {}); // pushState(url.href, {});
// replaceState(url.href, {}); // replaceState(url.href, {});
let message = {name: null}; const message = { name: null };
window.parent.postMessage(message, "*"); window.parent.postMessage(message, '*');
} }
// console.log('Message sent to parent (iframe):', message); // console.log('Message sent to parent (iframe):', message);
} }
function create_a_element({
function create_a_element({account_id, base_url, hosted_file_id, filename=null, extension=null, text="Download", class_li='text-blue-500'}) { account_id,
base_url,
hosted_file_id,
filename = null,
extension = null,
text = 'Download',
class_li = 'text-blue-500'
}) {
return `<a href="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}">${text}</a>`; return `<a href="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}">${text}</a>`;
} }
function create_img_element({account_id, base_url, hosted_file_id, filename=null, extension=null, class_li='max-w-64', style="", inc_link=false}) { function create_img_element({
account_id,
base_url,
hosted_file_id,
filename = null,
extension = null,
class_li = 'max-w-64',
style = '',
inc_link = false
}) {
let img_html = ''; let img_html = '';
if (filename) { if (filename) {
img_html = `<img src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}" style="${style}" />`; img_html = `<img src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}" style="${style}" />`;
@@ -85,14 +108,28 @@ function create_img_element({account_id, base_url, hosted_file_id, filename=null
} }
if (inc_link) { if (inc_link) {
let a_html = create_a_element({account_id: account_id, base_url: base_url, hosted_file_id: hosted_file_id, filename: filename, extension: extension}); const a_html = create_a_element({
account_id: account_id,
base_url: base_url,
hosted_file_id: hosted_file_id,
filename: filename,
extension: extension
});
img_html = `<div class="ae_img ae_a">${img_html}${a_html}</div>`; img_html = `<div class="ae_img ae_a">${img_html}${a_html}</div>`;
} }
return img_html; return img_html;
} }
function create_video_element({account_id, base_url, hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) { function create_video_element({
account_id,
base_url,
hosted_file_id,
filename = null,
extension = null,
class_li = 'max-w-64',
inc_link = false
}) {
let video_html = ''; let video_html = '';
if (filename) { if (filename) {
video_html = `<video src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" controls class="${class_li}"></video>`; video_html = `<video src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" controls class="${class_li}"></video>`;
@@ -101,14 +138,19 @@ function create_video_element({account_id, base_url, hosted_file_id, filename=nu
} }
if (inc_link) { if (inc_link) {
let a_html = create_a_element({account_id: account_id, base_url: base_url, hosted_file_id: hosted_file_id, filename: filename, extension: extension}); const a_html = create_a_element({
account_id: account_id,
base_url: base_url,
hosted_file_id: hosted_file_id,
filename: filename,
extension: extension
});
video_html = `<div class="ae_video ae_a">${video_html}${a_html}</div>`; video_html = `<div class="ae_video ae_a">${video_html}${a_html}</div>`;
} }
return video_html; return video_html;
} }
// // Clear the quick access type // // Clear the quick access type
// function clear_access_type() { // function clear_access_type() {
// // NOTE: I think it makes since to reset this to anonymous even if logged in as an admin or similar. // // NOTE: I think it makes since to reset this to anonymous even if logged in as an admin or similar.
@@ -127,35 +169,31 @@ function create_video_element({account_id, base_url, hosted_file_id, filename=nu
// return true; // return true;
// } // }
// This function will take a long string (sentences or paragraphs) of text and return an estimated number of words. // This function will take a long string (sentences or paragraphs) of text and return an estimated number of words.
function count_words(text: string) { function count_words(text: string) {
if (!text || text.length < 1) { if (!text || text.length < 1) {
return false; return false;
} }
let count = text.trim().split(/\s+/).length; const count = text.trim().split(/\s+/).length;
return count; return count;
} }
// Updated 2024-06-19 // Updated 2024-06-19
// This function behaves weirdly. It needs to be reviewed and updated. // This function behaves weirdly. It needs to be reviewed and updated.
export let shorten_string = function shorten_string( export const shorten_string = function shorten_string({
{
string, string,
max_length = 45, max_length = 45,
begin_length = 15, begin_length = 15,
end_length = 5, end_length = 5,
wildcard_length = 3 wildcard_length = 3
}: { }: {
string: undefined|string, string: undefined | string;
max_length?: number, max_length?: number;
begin_length?: number, begin_length?: number;
end_length?: number, end_length?: number;
wildcard_length?: number wildcard_length?: number;
} }) {
) {
// console.log('*** shorten_filename() ***'); // console.log('*** shorten_filename() ***');
if (!string || typeof string != 'string') { if (!string || typeof string != 'string') {
@@ -168,11 +206,11 @@ export let shorten_string = function shorten_string(
// 20 part 1 characters, 5 part 2 characters, 20 part 3 characters // 20 part 1 characters, 5 part 2 characters, 20 part 3 characters
// let length = string.length; // let length = string.length;
let char_over = string.length-max_length; const char_over = string.length - max_length;
let new_string = null; let new_string = null;
let wildcards = char_over; let wildcards = char_over;
if (char_over > 0) { if (char_over > 0) {
let part1 = string.slice(0, begin_length); const part1 = string.slice(0, begin_length);
let part2 = ''; let part2 = '';
if (char_over > 5) { if (char_over > 5) {
@@ -186,33 +224,30 @@ export let shorten_string = function shorten_string(
part2 = '.'.repeat(wildcards); part2 = '.'.repeat(wildcards);
} }
let part3 = string.slice(end_length*-1); const part3 = string.slice(end_length * -1);
new_string = part1 + part2 + part3; new_string = part1 + part2 + part3;
} else { } else {
new_string = string; new_string = string;
} }
return new_string; return new_string;
} };
// Updated 2024-06-19 // Updated 2024-06-19
// This function should return a shorted version of a filename if over the max length. It should always contain at least the first character of the original filename and the complete extension. // This function should return a shorted version of a filename if over the max length. It should always contain at least the first character of the original filename and the complete extension.
// Example 1: The Original Long File Name.pdf -> The Orig....pdf // Example 1: The Original Long File Name.pdf -> The Orig....pdf
// Example 2: The Original Long File Name.html -> The Ori....html // Example 2: The Original Long File Name.html -> The Ori....html
function shorten_filename( function shorten_filename({
{
filename, filename,
max_length = 20, max_length = 20,
slice_end_at = 15, slice_end_at = 15,
max_end_length = 5 max_end_length = 5
}: { }: {
filename: string, filename: string;
max_length?: number, max_length?: number;
slice_end_at?: number, slice_end_at?: number;
max_end_length?: number max_end_length?: number;
} }) {
) {
// console.log('*** shorten_filename() ***'); // console.log('*** shorten_filename() ***');
if (typeof filename !== 'string' || filename.length <= max_length) { if (typeof filename !== 'string' || filename.length <= max_length) {
@@ -220,27 +255,26 @@ function shorten_filename(
} }
let new_filename = null; let new_filename = null;
let char_over = filename.length - max_length; const char_over = filename.length - max_length;
let wildcards = char_over - 4; // The number of characters over the max length let wildcards = char_over - 4; // The number of characters over the max length
if (wildcards < 1) { if (wildcards < 1) {
return filename; // No point in changing the filename? return filename; // No point in changing the filename?
} }
let part_1 = filename.slice(0, slice_end_at); const part_1 = filename.slice(0, slice_end_at);
if (wildcards > 3) { if (wildcards > 3) {
wildcards = 3; wildcards = 3;
} else { } else {
} }
let part_2 = '.'.repeat(wildcards); const part_2 = '.'.repeat(wildcards);
let part_3 = filename.slice(max_end_length*-1); const part_3 = filename.slice(max_end_length * -1);
new_filename = part_1 + part_2 + part_3; new_filename = part_1 + part_2 + part_3;
return new_filename; return new_filename;
} }
export const ae_util = {
export let ae_util = {
is_datetime_recent: is_datetime_recent, is_datetime_recent: is_datetime_recent,
process_permission_checks: process_permission_checks, process_permission_checks: process_permission_checks,
iso_datetime_formatter: iso_datetime_formatter, iso_datetime_formatter: iso_datetime_formatter,
@@ -268,5 +302,5 @@ export let ae_util = {
encrypt_content: encrypt_content, encrypt_content: encrypt_content,
encrypt_wrapper: encrypt_wrapper, encrypt_wrapper: encrypt_wrapper,
decrypt_content: decrypt_content, decrypt_content: decrypt_content,
decrypt_wrapper: decrypt_wrapper, decrypt_wrapper: decrypt_wrapper
}; };

View File

@@ -1,4 +1,4 @@
let log_lvl = 0; // 0 = no logging, 1 = some logging, 2 = all logging const log_lvl = 0; // 0 = no logging, 1 = some logging, 2 = all logging
// Updated 2025-05-08 // Updated 2025-05-08
async function generate_iv() { async function generate_iv() {
@@ -8,23 +8,26 @@ async function generate_iv() {
} }
// Updated 2025-05-08 // Updated 2025-05-08
export let encrypt_content = async function encrypt_content( export const encrypt_content = async function encrypt_content(content: string, keyData: string) {
content: string,
keyData: string
) {
const iv = await generate_iv(); const iv = await generate_iv();
const keyBytes = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(keyData)); const keyBytes = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(keyData));
const key = await crypto.subtle.importKey('raw', keyBytes, { name: 'AES-CBC' }, false, ['encrypt']); const key = await crypto.subtle.importKey('raw', keyBytes, { name: 'AES-CBC' }, false, [
const encodedContent = await crypto.subtle.encrypt({ name: 'AES-CBC', iv }, key, new TextEncoder().encode(content)); 'encrypt'
]);
const encodedContent = await crypto.subtle.encrypt(
{ name: 'AES-CBC', iv },
key,
new TextEncoder().encode(content)
);
const base64 = btoa(String.fromCharCode(...new Uint8Array(encodedContent))); const base64 = btoa(String.fromCharCode(...new Uint8Array(encodedContent)));
if (log_lvl) { if (log_lvl) {
console.log(`IV: ${iv}; Encrypted:`, base64); console.log(`IV: ${iv}; Encrypted:`, base64);
} }
return { base64, iv }; return { base64, iv };
} };
// Updated 2025-05-08 // Updated 2025-05-08
export let combine_iv_and_base64 = function combine_iv_and_base64( export const combine_iv_and_base64 = function combine_iv_and_base64(
base64: string, base64: string,
iv: Uint8Array iv: Uint8Array
) { ) {
@@ -33,7 +36,12 @@ export let combine_iv_and_base64 = function combine_iv_and_base64(
} }
// Combine the IV and encrypted content // Combine the IV and encrypted content
const combined = Array.from(iv).map(byte => byte.toString(16).padStart(2, '0')).join('') + ':' + base64; const combined =
Array.from(iv)
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('') +
':' +
base64;
if (log_lvl) { if (log_lvl) {
console.log('Combined IV and Base64:', combined); console.log('Combined IV and Base64:', combined);
} }
@@ -41,13 +49,10 @@ export let combine_iv_and_base64 = function combine_iv_and_base64(
// const combined = `${ivBase64}:${base64}`; // const combined = `${ivBase64}:${base64}`;
// console.log('Combined IV and Base64 v2:', combined); // console.log('Combined IV and Base64 v2:', combined);
return combined; return combined;
} };
// Updated 2025-05-08 // Updated 2025-05-08
export let encrypt_wrapper = async function encrypt_wrapper( export const encrypt_wrapper = async function encrypt_wrapper(content: string, keyData: string) {
content: string,
keyData: string
) {
if (!content) { if (!content) {
console.error('No content provided. Returning empty string.'); console.error('No content provided. Returning empty string.');
return ''; return '';
@@ -59,46 +64,47 @@ export let encrypt_wrapper = async function encrypt_wrapper(
const { base64, iv } = await encrypt_content(content, keyData); const { base64, iv } = await encrypt_content(content, keyData);
const combined = combine_iv_and_base64(base64, iv); const combined = combine_iv_and_base64(base64, iv);
return combined; return combined;
} };
// This does not handle errors (invalid key/password) well. // This does not handle errors (invalid key/password) well.
// Updated 2025-05-08 // Updated 2025-05-08
export let decrypt_content = async function decrypt_content( export const decrypt_content = async function decrypt_content(
base64Content: string, base64Content: string,
iv: Uint8Array, iv: Uint8Array,
keyData: string keyData: string
) { ) {
const keyBytes = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(keyData)); const keyBytes = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(keyData));
const key = await crypto.subtle.importKey('raw', keyBytes, { name: 'AES-CBC' }, false, ['decrypt']); const key = await crypto.subtle.importKey('raw', keyBytes, { name: 'AES-CBC' }, false, [
const encryptedContent = Uint8Array.from(atob(base64Content), c => c.charCodeAt(0)); 'decrypt'
const decryptedContent = await crypto.subtle.decrypt({ name: 'AES-CBC', iv }, key, encryptedContent); ]);
const encryptedContent = Uint8Array.from(atob(base64Content), (c) => c.charCodeAt(0));
const decryptedContent = await crypto.subtle.decrypt(
{ name: 'AES-CBC', iv },
key,
encryptedContent
);
const decodedContent = new TextDecoder().decode(decryptedContent); const decodedContent = new TextDecoder().decode(decryptedContent);
// console.log('Decrypted Content:', decodedContent); // console.log('Decrypted Content:', decodedContent);
return decodedContent; return decodedContent;
} };
// Updated 2025-05-08 // Updated 2025-05-08
export let split_iv_and_base64 = function split_iv_and_base64( export const split_iv_and_base64 = function split_iv_and_base64(combined: string) {
combined: string
) {
if (!combined) { if (!combined) {
console.error('No combined string provided. Returning empty object.'); console.error('No combined string provided. Returning empty object.');
return { iv: new Uint8Array(), base64: '' }; return { iv: new Uint8Array(), base64: '' };
} }
let [iv_hex, encrypted_base64_string] = combined.split(':'); const [iv_hex, encrypted_base64_string] = combined.split(':');
let base64 = encrypted_base64_string const base64 = encrypted_base64_string;
let iv = new Uint8Array(iv_hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16))); const iv = new Uint8Array(iv_hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
if (log_lvl) { if (log_lvl) {
console.log(`IV: ${iv}; Encrypted:`, base64); console.log(`IV: ${iv}; Encrypted:`, base64);
} }
return { iv, base64 }; return { iv, base64 };
} };
// Updated 2025-05-15 // Updated 2025-05-15
export let decrypt_wrapper = async function decrypt_wrapper( export const decrypt_wrapper = async function decrypt_wrapper(combined: string, keyData: string) {
combined: string,
keyData: string
) {
if (!combined) { if (!combined) {
console.error('No combined string provided. Returning empty string.'); console.error('No combined string provided. Returning empty string.');
return false; return false;
@@ -118,4 +124,4 @@ export let decrypt_wrapper = async function decrypt_wrapper(
return false; return false;
} }
return decrypted; return decrypted;
} };

View File

@@ -1,6 +1,6 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
export let iso_datetime_formatter = function iso_datetime_formatter( export const iso_datetime_formatter = function iso_datetime_formatter(
raw_datetime: null | string | Date = null, raw_datetime: null | string | Date = null,
named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds
time_24_hours: boolean = false time_24_hours: boolean = false
@@ -173,4 +173,4 @@ export let iso_datetime_formatter = function iso_datetime_formatter(
// datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss'); // datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss');
} }
return datetime_string; return datetime_string;
} };

View File

@@ -11,8 +11,7 @@ type key_val = {
* REMINDER: An unchecked checkbox will not be sent in the form data. This is a browser thing. * REMINDER: An unchecked checkbox will not be sent in the form data. This is a browser thing.
* Updated 2023-12-22 * Updated 2023-12-22
*/ */
export let extract_prefixed_form_data = function extract_prefixed_form_data( export const extract_prefixed_form_data = function extract_prefixed_form_data({
{
prefix = null, prefix = null,
form_data = {}, form_data = {},
rm_empty_id = true, rm_empty_id = true,
@@ -21,21 +20,24 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data(
bool_tf_str = false, bool_tf_str = false,
log_lvl = 0 log_lvl = 0
}: { }: {
prefix: string|null, prefix: string | null;
form_data: any, form_data: any;
rm_empty_id?: boolean, rm_empty_id?: boolean;
rm_empty?: boolean, rm_empty?: boolean;
trim_values?: boolean, trim_values?: boolean;
bool_tf_str?: boolean, bool_tf_str?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log('*** extract_prefixed_form_data() ***'); console.log('*** extract_prefixed_form_data() ***');
if (prefix) { if (prefix) {
console.log(`Looking for prefixed fields: ${prefix}; Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`); console.log(
`Looking for prefixed fields: ${prefix}; Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`
);
} else { } else {
console.log(`No prefix set. Looking at all fields. Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`); console.log(
`No prefix set. Looking at all fields. Removing emptry ID fields: ${rm_empty_id}; Removing empty fields: ${rm_empty}; Trim string values: ${trim_values}; Convert true/false string values to boolean: ${bool_tf_str}`
);
} }
} }
if (log_lvl > 1) { if (log_lvl > 1) {
@@ -44,8 +46,8 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data(
} }
// const data_obj: any = {}; // future TS // const data_obj: any = {}; // future TS
let data_obj: key_val = {}; const data_obj: key_val = {};
for (let field of form_data) { for (const field of form_data) {
let [obj_prop_name, obj_prop_value] = field; let [obj_prop_name, obj_prop_value] = field;
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(`${obj_prop_name}: ${obj_prop_value} type=${typeof obj_prop_value}`); console.log(`${obj_prop_name}: ${obj_prop_value} type=${typeof obj_prop_value}`);
@@ -76,7 +78,8 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data(
} }
} }
if (prefix && obj_prop_name.startsWith(prefix)) { // Prefix set if (prefix && obj_prop_name.startsWith(prefix)) {
// Prefix set
// if (obj_prop_name.startsWith(prefix)) { // if (obj_prop_name.startsWith(prefix)) {
obj_prop_name = obj_prop_name.replace(prefix, ''); obj_prop_name = obj_prop_name.replace(prefix, '');
if (log_lvl) { if (log_lvl) {
@@ -96,11 +99,13 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data(
} }
data_obj[obj_prop_name] = obj_prop_value; data_obj[obj_prop_name] = obj_prop_value;
} }
} else if (prefix && !obj_prop_name.startsWith(prefix)) { // Prefix set } else if (prefix && !obj_prop_name.startsWith(prefix)) {
// Prefix set
if (log_lvl > 1) { if (log_lvl > 1) {
console.log('Did not start with prefix. Ignoring'); console.log('Did not start with prefix. Ignoring');
} }
} else { // No prefix set } else {
// No prefix set
if (log_lvl) { if (log_lvl) {
console.log(`Checking: ${obj_prop_name} value=${obj_prop_value}`); console.log(`Checking: ${obj_prop_name} value=${obj_prop_value}`);
} }
@@ -118,11 +123,10 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data(
} }
data_obj[obj_prop_name] = obj_prop_value; data_obj[obj_prop_name] = obj_prop_value;
} }
} }
} }
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(data_obj); console.log(data_obj);
} }
return data_obj; return data_obj;
} };

View File

@@ -1,45 +1,44 @@
import type { key_str } from "./ae_utils"; import type { key_str } from './ae_utils';
// Updated 2024-06-19 // Updated 2024-06-19
export function file_extension_icon( export function file_extension_icon(extension: string) {
extension: string) {
// console.log('*** file_extension_icon() ***'); // console.log('*** file_extension_icon() ***');
let file_icons: key_str = { const file_icons: key_str = {
'file': 'file', file: 'file',
'3gp': 'file-video', '3gp': 'file-video',
'7z': 'file-archive', '7z': 'file-archive',
'aac': 'file-audio', aac: 'file-audio',
'ac3': 'file-audio', ac3: 'file-audio',
'aif': 'file-audio', aif: 'file-audio',
'aiff': 'file-audio', aiff: 'file-audio',
'avi': 'file-video', avi: 'file-video',
'bmp': 'file-image', bmp: 'file-image',
'csv': 'file-csv', csv: 'file-csv',
'doc': 'file-word', doc: 'file-word',
'docx': 'file-word', docx: 'file-word',
'eps': 'file-image', eps: 'file-image',
'flac': 'file-audio', flac: 'file-audio',
'gif': 'file-image', gif: 'file-image',
'htm': 'file-code', htm: 'file-code',
'html': 'file-code', html: 'file-code',
'jpeg': 'file-image', jpeg: 'file-image',
'jpg': 'file-image', jpg: 'file-image',
'key': 'file-powerpoint', key: 'file-powerpoint',
'mkv': 'file-video', mkv: 'file-video',
'mov': 'file-video', mov: 'file-video',
'mp3': 'file-audio', mp3: 'file-audio',
'mp4': 'file-video', mp4: 'file-video',
'odp': 'file-powerpoint', odp: 'file-powerpoint',
'pdf': 'file-pdf', pdf: 'file-pdf',
'png': 'file-image', png: 'file-image',
'ppt': 'file-powerpoint', ppt: 'file-powerpoint',
'pptx': 'file-powerpoint', pptx: 'file-powerpoint',
'txt': 'file-alt', txt: 'file-alt',
'wav': 'file-audio', wav: 'file-audio',
'webp': 'file-image', webp: 'file-image',
'xls': 'file-excel', xls: 'file-excel',
'xlsx': 'file-excel', xlsx: 'file-excel',
'zip': 'file-archive' zip: 'file-archive'
}; };
if (file_icons[extension]) { if (file_icons[extension]) {

View File

@@ -2,22 +2,22 @@
// Use a defined list of unacceptable characters to remove from a filename. // Use a defined list of unacceptable characters to remove from a filename.
// Updated 2024-10-18 // Updated 2024-10-18
export let clean_filename = function clean_filename(filename: any|string, unacceptable_chars: RegExp = /[ <>:"/\\|?*]/g, replacement_char: string = '_') { export const clean_filename = function clean_filename(
filename: any | string,
unacceptable_chars: RegExp = /[ <>:"/\\|?*]/g,
replacement_char: string = '_'
) {
// console.log('*** clean_filename() ***'); // console.log('*** clean_filename() ***');
if (!filename) { if (!filename) {
return ''; return '';
} }
let cleaned_filename = filename.replace(unacceptable_chars, replacement_char); const cleaned_filename = filename.replace(unacceptable_chars, replacement_char);
// console.log(cleaned_filename); // console.log(cleaned_filename);
return cleaned_filename; return cleaned_filename;
} };
export const format_bytes = function format_bytes(bytes: number, decimals: number = 2) {
export let format_bytes = function format_bytes(
bytes: number,
decimals: number = 2
) {
if (bytes === 0) return '0 Bytes'; if (bytes === 0) return '0 Bytes';
const k = 1024; const k = 1024;
@@ -27,27 +27,26 @@ export let format_bytes = function format_bytes(
const i = Math.floor(Math.log(bytes) / Math.log(k)); const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
} };
// Updated 2024-08-12 // Updated 2024-08-12
export let guess_file_name = function guess_file_name(filename_string: string) { export const guess_file_name = function guess_file_name(filename_string: string) {
// console.log('*** guess_file_name() ***'); // console.log('*** guess_file_name() ***');
if (!filename_string) { if (!filename_string) {
return ''; return '';
} }
if (filename_string.includes('.')) { if (filename_string.includes('.')) {
let file_name = filename_string.substring(0, filename_string.lastIndexOf('.')); const file_name = filename_string.substring(0, filename_string.lastIndexOf('.'));
// console.log(file_name); // console.log(file_name);
return file_name; return file_name;
} else { } else {
return filename_string; return filename_string;
} }
} };
// Updated 2024-08-12 // Updated 2024-08-12
export let guess_file_extension = function guess_file_extension(filename_string: string) { export const guess_file_extension = function guess_file_extension(filename_string: string) {
// console.log('*** guess_file_extension() ***'); // console.log('*** guess_file_extension() ***');
if (!filename_string) { if (!filename_string) {
return ''; return '';
@@ -57,30 +56,31 @@ export let guess_file_extension = function guess_file_extension(filename_string:
return ''; return '';
} }
let file_extension = filename_string.substring(filename_string.lastIndexOf('.') + 1, filename_string.length) || filename_string; const file_extension =
filename_string.substring(filename_string.lastIndexOf('.') + 1, filename_string.length) ||
filename_string;
// console.log(file_extension); // console.log(file_extension);
return file_extension; return file_extension;
} };
// Updated 2024-08-12 // Updated 2024-08-12
export let get_file_hash = async function get_file_hash(file) { export const get_file_hash = async function get_file_hash(file) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let file_reader = new FileReader(); const file_reader = new FileReader();
file_reader.onload = async function () { file_reader.onload = async function () {
if (file_reader.result.byteLength !== file.size) { if (file_reader.result.byteLength !== file.size) {
console.log('File was not read completely'); console.log('File was not read completely');
reject("Error reading the file"); reject('Error reading the file');
} }
const hash_buffer = await crypto.subtle.digest('SHA-256', file_reader.result); const hash_buffer = await crypto.subtle.digest('SHA-256', file_reader.result);
const hash_array = Array.from(new Uint8Array(hash_buffer)); const hash_array = Array.from(new Uint8Array(hash_buffer));
const hash_hex = hash_array.map(b => b.toString(16).padStart(2, '0')).join(''); const hash_hex = hash_array.map((b) => b.toString(16).padStart(2, '0')).join('');
resolve(hash_hex); resolve(hash_hex);
}; };
file_reader.readAsArrayBuffer(file); file_reader.readAsArrayBuffer(file);
}); });
} };

View File

@@ -1,19 +1,16 @@
/* Returns a list of objects that have a matching property value. */ /* Returns a list of objects that have a matching property value. */
// Updated 2023-06-28 // Updated 2023-06-28
export let get_obj_li_w_match_prop = function get_obj_li_w_match_prop( export const get_obj_li_w_match_prop = function get_obj_li_w_match_prop({
{
obj_li, obj_li,
property, property,
value, value,
log_lvl = 0 log_lvl = 0
}: { }: {
obj_li: any[], obj_li: any[];
property: string, property: string;
value: any, value: any;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log('Search Object List:', obj_li); console.log('Search Object List:', obj_li);
console.log(`Property: ${property}`); console.log(`Property: ${property}`);
@@ -43,4 +40,4 @@ export let get_obj_li_w_match_prop = function get_obj_li_w_match_prop(
console.log('Matching Object List:', matching_obj_li); console.log('Matching Object List:', matching_obj_li);
} }
return matching_obj_li; return matching_obj_li;
} };

View File

@@ -1,27 +1,26 @@
// Function to check if the file (or anything) timestamp was created within the last X minutes // Function to check if the file (or anything) timestamp was created within the last X minutes
export let is_datetime_recent = function is_datetime_recent( export const is_datetime_recent = function is_datetime_recent({
{
datetime, datetime,
minutes, minutes,
log_lvl = 0 log_lvl = 0
}: { }: {
datetime: string, datetime: string;
minutes: number, minutes: number;
log_lvl?: number log_lvl?: number;
}) { }) {
if (log_lvl) { if (log_lvl) {
console.log(`*** is_datetime_recent() *** datetime=${datetime} minutes=${minutes}`); console.log(`*** is_datetime_recent() *** datetime=${datetime} minutes=${minutes}`);
} }
let now: any = new Date(); const now: any = new Date();
let then: any = new Date(datetime); const then: any = new Date(datetime);
let diff = now - then; const diff = now - then;
let diff_minutes = Math.floor(diff / 60000); const diff_minutes = Math.floor(diff / 60000);
if (diff_minutes < minutes) { if (diff_minutes < minutes) {
return true; return true;
} else { } else {
return false; return false;
} }
} };

View File

@@ -3,9 +3,9 @@ type key_val = {
}; };
// NOTE: I know there is a better more efficient way to do this, but I don't have time for that right now. // NOTE: I know there is a better more efficient way to do this, but I don't have time for that right now.
export let process_permission_checks = function process_permission_checks(access_type: string) { export const process_permission_checks = function process_permission_checks(access_type: string) {
// let access_checks = { 'access_type': null, 'super_check': null }; // let access_checks = { 'access_type': null, 'super_check': null };
let access_checks: key_val = {}; const access_checks: key_val = {};
if (access_type == 'super') { if (access_type == 'super') {
access_checks.allow_access = true; access_checks.allow_access = true;
@@ -196,4 +196,4 @@ export let process_permission_checks = function process_permission_checks(access
} }
return access_checks; return access_checks;
} };

View File

@@ -1,4 +1,4 @@
import type { key_val } from "./ae_utils"; import type { key_val } from './ae_utils';
/* This utility function processes specific data string. /* This utility function processes specific data string.
* MECARD * MECARD
@@ -17,8 +17,7 @@ import type { key_val } from "./ae_utils";
*/ */
// Updated 2022-02-11 // Updated 2022-02-11
export const process_data_string = function process_data_string(data_string: string) {
export let process_data_string = function process_data_string(data_string: string) {
console.log('*** process_data_string() ***'); console.log('*** process_data_string() ***');
// console.log(data_string); // console.log(data_string);
if (!data_string || data_string.length < 1) { if (!data_string || data_string.length < 1) {
@@ -26,42 +25,42 @@ export let process_data_string = function process_data_string(data_string: strin
return false; return false;
} }
let obj: key_val = {}; const obj: key_val = {};
let colon_index = data_string.indexOf(':'); const colon_index = data_string.indexOf(':');
if (colon_index) { if (colon_index) {
let data_string_type = data_string.slice(0, colon_index); const data_string_type = data_string.slice(0, colon_index);
console.log(data_string_type); console.log(data_string_type);
obj['qr_type'] = data_string_type; obj['qr_type'] = data_string_type;
if (data_string_type == 'MECARD') { if (data_string_type == 'MECARD') {
let mecard_str = data_string.slice(colon_index + 1); const mecard_str = data_string.slice(colon_index + 1);
console.log(mecard_str); console.log(mecard_str);
obj['str'] = mecard_str; obj['str'] = mecard_str;
} else if (data_string_type == 'OBJ') { } else if (data_string_type == 'OBJ') {
let key_value_str = data_string.slice(colon_index + 1); const key_value_str = data_string.slice(colon_index + 1);
console.log(key_value_str); console.log(key_value_str);
let key_value_array = key_value_str.split(','); const key_value_array = key_value_str.split(',');
// console.log(key_value_array); // console.log(key_value_array);
let ot_colon_index = key_value_array[0].indexOf(':'); const ot_colon_index = key_value_array[0].indexOf(':');
let obj_type = key_value_array[0].slice(ot_colon_index + 1); const obj_type = key_value_array[0].slice(ot_colon_index + 1);
// console.log(obj_type); // console.log(obj_type);
let oi_colon_index = key_value_array[1].indexOf(':'); const oi_colon_index = key_value_array[1].indexOf(':');
let obj_id = key_value_array[1].slice(oi_colon_index + 1); const obj_id = key_value_array[1].slice(oi_colon_index + 1);
// console.log(obj_id); // console.log(obj_id);
obj['type'] = obj_type; obj['type'] = obj_type;
obj['id'] = obj_id; obj['id'] = obj_id;
} else if (data_string_type == 'JSON') { } else if (data_string_type == 'JSON') {
let partial_json_str = data_string.slice(colon_index + 1); const partial_json_str = data_string.slice(colon_index + 1);
console.log(partial_json_str); console.log(partial_json_str);
let json_str = `{${partial_json_str}}`; const json_str = `{${partial_json_str}}`;
console.log(json_str); console.log(json_str);
obj['json'] = JSON.parse(json_str); obj['json'] = JSON.parse(json_str);
} else if (data_string_type == 'STR') { } else if (data_string_type == 'STR') {
let str = data_string.slice(colon_index + 1); const str = data_string.slice(colon_index + 1);
console.log(str); console.log(str);
obj['str'] = str; obj['str'] = str;
@@ -72,7 +71,7 @@ export let process_data_string = function process_data_string(data_string: strin
obj['url'] = data_string; obj['url'] = data_string;
} else { } else {
console.log('The unknown data string type was found. Returning the string part.'); console.log('The unknown data string type was found. Returning the string part.');
let unknown_str = data_string.slice(colon_index + 1); const unknown_str = data_string.slice(colon_index + 1);
console.log(unknown_str); console.log(unknown_str);
obj['str'] = unknown_str; obj['str'] = unknown_str;

View File

@@ -3,9 +3,32 @@ export function return_obj_type_path({ obj_type = null, obj_type_prop_name = nul
let obj_type_path = null; let obj_type_path = null;
let known_obj_type_li = ['account', 'address', 'archive', 'archive_content', 'contact', 'event_badge', 'event_exhibit', 'event_file', 'event_location', 'event_person', 'event_presentation', 'event_presenter', 'event_registration', 'event_session', 'event', 'hosted_file', 'order_line', 'order', 'person', 'post', 'post_comment', 'user']; const known_obj_type_li = [
'account',
'address',
'archive',
'archive_content',
'contact',
'event_badge',
'event_exhibit',
'event_file',
'event_location',
'event_person',
'event_presentation',
'event_presenter',
'event_registration',
'event_session',
'event',
'hosted_file',
'order_line',
'order',
'person',
'post',
'post_comment',
'user'
];
let known_obj_type_li_dict = [ const known_obj_type_li_dict = [
{ name: 'account', display: 'Account', path: 'account' }, { name: 'account', display: 'Account', path: 'account' },
{ name: 'archive', display: 'Archive', path: 'archive' }, { name: 'archive', display: 'Archive', path: 'archive' },
{ name: 'address', display: 'Address', path: 'address' }, { name: 'address', display: 'Address', path: 'address' },
@@ -33,13 +56,12 @@ export function return_obj_type_path({ obj_type = null, obj_type_prop_name = nul
{ name: 'person', display: 'Person', path: 'person' }, { name: 'person', display: 'Person', path: 'person' },
{ name: 'post', display: 'Archive', path: 'post' }, { name: 'post', display: 'Archive', path: 'post' },
{ name: 'post_comment', display: 'Archive Content', path: 'post/comment' }, { name: 'post_comment', display: 'Archive Content', path: 'post/comment' },
{ name: 'user', display: 'User', path: 'user' }, { name: 'user', display: 'User', path: 'user' }
]; ];
if (obj_type) { if (obj_type) {
// Need to loop through known for safety? // Need to loop through known for safety?
obj_type_path = obj_type_prop_name.replaceAll('_', '/'); obj_type_path = obj_type_prop_name.replaceAll('_', '/');
} else if (obj_type_prop_name) { } else if (obj_type_prop_name) {
let found_obj_type_name = null; let found_obj_type_name = null;
let found_obj_type_path = null; let found_obj_type_path = null;
@@ -56,7 +78,6 @@ export function return_obj_type_path({ obj_type = null, obj_type_prop_name = nul
break; break;
} }
} }
} else { } else {
console.log('Missing required parameters'); console.log('Missing required parameters');
return false; return false;

View File

@@ -1,17 +1,43 @@
import { to_title_case } from "./ae_utils__to_title_case"; import { to_title_case } from './ae_utils__to_title_case';
// Updated 2023-08-18 // Updated 2023-08-18
export function set_obj_prop_display_name({ prop_name, obj_type = null, prefix_w_obj_type = true, prefix_all_w_obj_type = false, replace_underscores = true, title_case = true, override = null }) { export function set_obj_prop_display_name({
prop_name,
obj_type = null,
prefix_w_obj_type = true,
prefix_all_w_obj_type = false,
replace_underscores = true,
title_case = true,
override = null
}) {
console.log('*** set_obj_prop_display_name() ***'); console.log('*** set_obj_prop_display_name() ***');
if (override) { if (override) {
return override; return override;
} }
let known_obj_type_li = ['account', 'address', 'contact', 'event_badge', 'event_exhibit', 'event_file', 'event_location', 'event_person', 'event_presentation', 'event_presenter', 'event_registration', 'event_session', 'event', 'hosted_file', 'order_line', 'order', 'person', 'user']; const known_obj_type_li = [
'account',
'address',
'contact',
'event_badge',
'event_exhibit',
'event_file',
'event_location',
'event_person',
'event_presentation',
'event_presenter',
'event_registration',
'event_session',
'event',
'hosted_file',
'order_line',
'order',
'person',
'user'
];
const known_obj_type_li_dict = [
let known_obj_type_li_dict = [
{ name: 'account', display: 'Account' }, { name: 'account', display: 'Account' },
{ name: 'address', display: 'Address' }, { name: 'address', display: 'Address' },
{ name: 'contact', display: 'Contact' }, { name: 'contact', display: 'Contact' },
@@ -29,7 +55,7 @@ export function set_obj_prop_display_name({ prop_name, obj_type = null, prefix_w
{ name: 'order_line', display: 'Order Line' }, { name: 'order_line', display: 'Order Line' },
{ name: 'order', display: 'Order' }, { name: 'order', display: 'Order' },
{ name: 'person', display: 'Person' }, { name: 'person', display: 'Person' },
{ name: 'user', display: 'User' }, { name: 'user', display: 'User' }
]; ];
let prop_display_name = prop_name; let prop_display_name = prop_name;

View File

@@ -1,12 +1,13 @@
/* Adapted from: To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */ /* Adapted from: To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */
// eslint-disable-next-line no-extend-native
export function to_title_case(text_string) { export function to_title_case(text_string) {
// console.log('*** to_title_case() ***'); // console.log('*** to_title_case() ***');
let smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i; const smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i;
let alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/; const alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/;
let wordSeparators = /([ :–—-])/; const wordSeparators = /([ :–—-])/;
return text_string.split(wordSeparators) return text_string
.split(wordSeparators)
.map(function (current, index, array) { .map(function (current, index, array) {
if ( if (
/* Check for small words */ /* Check for small words */
@@ -18,8 +19,8 @@ export function to_title_case(text_string) {
array[index - 3] !== ':' && array[index - 3] !== ':' &&
array[index + 1] !== ':' && array[index + 1] !== ':' &&
/* Ignore small words that start a hyphenated phrase */ /* Ignore small words that start a hyphenated phrase */
(array[index + 1] !== '-' || (array[index + 1] !== '-' || (array[index - 1] === '-' && array[index + 1] === '-'))
(array[index - 1] === '-' && array[index + 1] === '-'))) { ) {
return current.toLowerCase(); return current.toLowerCase();
} }

View File

@@ -4,22 +4,18 @@
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { delete_object } from '$lib/ae_api/api_delete_object'; // Exported at the end of this file import { delete_object } from '$lib/ae_api/api_delete_object'; // Exported at the end of this file
import { get_object } from '$lib/ae_api/api_get_object'; // Exported at the end of this file import { get_object } from '$lib/ae_api/api_get_object'; // Exported at the end of this file
import { patch_object } from '$lib/ae_api/api_patch_object'; // Exported at the end of this file import { patch_object } from '$lib/ae_api/api_patch_object'; // Exported at the end of this file
import { post_object } from '$lib/ae_api/api_post_object'; // Exported at the end of this file 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_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_id';
import { get_ae_obj_li_for_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_li_v1'; import { get_ae_obj_li_for_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_li_v1';
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/ae_api/api_get__crud_obj_li_v2'; import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/ae_api/api_get__crud_obj_li_v2';
// This new function has not been tested yet!!! // This new function has not been tested yet!!!
// Updated 2024-08-07 // Updated 2024-08-07
export let get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu( export const get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu({
{
api_cfg, api_cfg,
// obj_type, // obj_type,
for_lu_type, for_lu_type,
@@ -41,28 +37,27 @@ export let get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu(
return_meta = false, return_meta = false,
log_lvl = 1 log_lvl = 1
}: { }: {
api_cfg: any, api_cfg: any;
// obj_type: string, // obj_type: string,
for_lu_type: string, for_lu_type: string;
// for_lu_id?: string, // for_lu_id?: string,
// use_alt_table?: boolean, // use_alt_table?: boolean,
// use_alt_base?: boolean, // use_alt_base?: boolean,
// inc?: key_val // inc?: key_val
enabled?: "enabled" | "all" | "not_enabled" | undefined, enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: "hidden" | "all" | "not_hidden" | undefined, hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
order_by_li?: any, order_by_li?: any;
limit?: number, limit?: number;
offset?: number, offset?: number;
// key: string, // key: string,
// jwt?: string, // jwt?: string,
headers?: any, headers?: any;
params_json?: any, params_json?: any;
// json_obj?: any, // json_obj?: any,
params?: key_val, params?: key_val;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** get_ae_obj_li_for_lu() *** for_lu_type=${for_lu_type}`); console.log(`*** get_ae_obj_li_for_lu() *** for_lu_type=${for_lu_type}`);
} }
@@ -86,12 +81,12 @@ export let get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu(
headers['order_by_li'] = order_by_li; headers['order_by_li'] = order_by_li;
} }
let allowed_enabled_list = ['all', 'enabled', 'not_enabled'] const allowed_enabled_list = ['all', 'enabled', 'not_enabled'];
if (allowed_enabled_list.includes(enabled)) { if (allowed_enabled_list.includes(enabled)) {
params['enabled'] = enabled; params['enabled'] = enabled;
} }
let allowed_hidden_list = ['all', 'hidden', 'not_hidden']; const allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
if (allowed_hidden_list.includes(hidden)) { if (allowed_hidden_list.includes(hidden)) {
params['hidden'] = hidden; params['hidden'] = hidden;
} }
@@ -104,7 +99,7 @@ export let get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu(
params['offset'] = offset; params['offset'] = offset;
} }
let object_li_get_promise = await api.get_object({ const object_li_get_promise = await api.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
headers: headers, headers: headers,
@@ -118,12 +113,10 @@ export let get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu(
} }
return object_li_get_promise; return object_li_get_promise;
} };
// Updated 2023-07-24 // Updated 2023-07-24
export let create_ae_obj_crud = async function create_ae_obj_crud( export const create_ae_obj_crud = async function create_ae_obj_crud({
{
api_cfg, api_cfg,
obj_type, obj_type,
field_name = null, field_name = null,
@@ -139,22 +132,21 @@ export let create_ae_obj_crud = async function create_ae_obj_crud(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
obj_type: string, obj_type: string;
field_name?: null|string, field_name?: null | string;
field_value?: any, field_value?: any;
fields?: key_val, fields?: key_val;
key: string, key: string;
jwt?: null|string, jwt?: null | string;
headers?: key_val, headers?: key_val;
params?: key_val, params?: key_val;
data?: key_val, data?: key_val;
return_obj?: boolean, return_obj?: boolean;
obj_v_name?: string, obj_v_name?: string;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** create_ae_obj_crud() *** obj_type=${obj_type}`); console.log(`*** create_ae_obj_crud() *** obj_type=${obj_type}`);
} }
@@ -292,19 +284,23 @@ export let create_ae_obj_crud = async function create_ae_obj_crud(
console.log('Params:', params); console.log('Params:', params);
} }
let object_obj_post_promise = await post_object({api_cfg: api_cfg, endpoint: endpoint, params: params, data: data, log_lvl: log_lvl}); const object_obj_post_promise = await post_object({
api_cfg: api_cfg,
endpoint: endpoint,
params: params,
data: data,
log_lvl: log_lvl
});
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(object_obj_post_promise); console.log(object_obj_post_promise);
} }
return object_obj_post_promise; return object_obj_post_promise;
} };
// Updated 2023-06-28 // Updated 2023-06-28
export let update_ae_obj_id_crud = async function update_ae_obj_id_crud( export const update_ae_obj_id_crud = async function update_ae_obj_id_crud({
{
api_cfg, api_cfg,
obj_type, obj_type,
obj_id, obj_id,
@@ -321,23 +317,22 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
obj_type: string, obj_type: string;
obj_id: string, obj_id: string;
field_name?: string, field_name?: string;
field_value?: any, field_value?: any;
fields?: key_val, fields?: key_val;
key: string, key: string;
jwt?: null|string, jwt?: null | string;
headers?: key_val, headers?: key_val;
params?: key_val, params?: key_val;
data?: null|key_val, data?: null | key_val;
return_obj?: boolean, return_obj?: boolean;
obj_v_name?: string, obj_v_name?: string;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log('*** update_ae_obj_id_crud() ***'); console.log('*** update_ae_obj_id_crud() ***');
} }
@@ -505,19 +500,23 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
console.log('Params:', params); console.log('Params:', params);
} }
let object_obj_patch_promise = await patch_object({api_cfg: api_cfg, endpoint: endpoint, params: params, data: data, log_lvl: log_lvl}); const object_obj_patch_promise = await patch_object({
api_cfg: api_cfg,
endpoint: endpoint,
params: params,
data: data,
log_lvl: log_lvl
});
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(object_obj_patch_promise); console.log(object_obj_patch_promise);
} }
return object_obj_patch_promise; return object_obj_patch_promise;
} };
// Updated 2023-11-14 // Updated 2023-11-14
export let delete_ae_obj_id_crud = async function delete_ae_obj_id_crud( export const delete_ae_obj_id_crud = async function delete_ae_obj_id_crud({
{
api_cfg, api_cfg,
obj_type, obj_type,
obj_id, obj_id,
@@ -530,19 +529,18 @@ export let delete_ae_obj_id_crud = async function delete_ae_obj_id_crud(
return_meta = false, return_meta = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
obj_type: string, obj_type: string;
obj_id: string, obj_id: string;
key: string, key: string;
jwt?: null|string, jwt?: null | string;
headers?: any, headers?: any;
params?: any, params?: any;
data?: any, data?: any;
method?: string, method?: string;
return_meta?: boolean, return_meta?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log(`*** delete_ae_obj_id_crud() *** obj_type: ${obj_type} obj_id: ${obj_id}`); console.log(`*** delete_ae_obj_id_crud() *** obj_type: ${obj_type} obj_id: ${obj_id}`);
} }
@@ -626,7 +624,8 @@ export let delete_ae_obj_id_crud = async function delete_ae_obj_id_crud(
console.log('Endpoint:', endpoint); console.log('Endpoint:', endpoint);
} }
if (method) { // NOTE: method options: 'delete', 'disable', 'hide' if (method) {
// NOTE: method options: 'delete', 'disable', 'hide'
params['method'] = method; params['method'] = method;
} }
@@ -634,21 +633,25 @@ export let delete_ae_obj_id_crud = async function delete_ae_obj_id_crud(
console.log('Params:', params); console.log('Params:', params);
} }
let object_obj_delete_promise = await delete_object({api_cfg: api_cfg, endpoint: endpoint, params: params, data: data, log_lvl: log_lvl}); const object_obj_delete_promise = await delete_object({
api_cfg: api_cfg,
endpoint: endpoint,
params: params,
data: data,
log_lvl: log_lvl
});
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(object_obj_delete_promise); console.log(object_obj_delete_promise);
} }
return object_obj_delete_promise; return object_obj_delete_promise;
} };
/* BEGIN: Hosted File Related */ /* BEGIN: Hosted File Related */
// Updated 2023-08-17 // Updated 2023-08-17
export let download_hosted_file = async function download_hosted_file( export const download_hosted_file = async function download_hosted_file({
{
api_cfg, api_cfg,
hosted_file_id, hosted_file_id,
return_file = true, return_file = true,
@@ -657,18 +660,17 @@ export let download_hosted_file = async function download_hosted_file(
params = {}, params = {},
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
hosted_file_id: string, hosted_file_id: string;
return_file?: boolean, return_file?: boolean;
filename?: string, filename?: string;
auto_download?: boolean, auto_download?: boolean;
params?: key_val, params?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** stores_hosted_api.js: download_hosted_file() ***'); console.log('*** stores_hosted_api.js: download_hosted_file() ***');
let task_id = hosted_file_id; const task_id = hosted_file_id;
const endpoint = `/hosted_file/${hosted_file_id}/download`; const endpoint = `/hosted_file/${hosted_file_id}/download`;
if (filename) { if (filename) {
@@ -676,7 +678,7 @@ export let download_hosted_file = async function download_hosted_file(
} }
params['return_file'] = true; params['return_file'] = true;
let hosted_file_download_get_promise = await api.get_object({ const hosted_file_download_get_promise = await api.get_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -688,12 +690,10 @@ export let download_hosted_file = async function download_hosted_file(
}); });
// console.log(hosted_file_download_get_promise); // console.log(hosted_file_download_get_promise);
return hosted_file_download_get_promise; return hosted_file_download_get_promise;
} };
// Updated 2023-12-15 // Updated 2023-12-15
export let delete_hosted_file = async function delete_hosted_file( export const delete_hosted_file = async function delete_hosted_file({
{
api_cfg, api_cfg,
hosted_file_id, hosted_file_id,
link_to_type, link_to_type,
@@ -703,16 +703,15 @@ export let delete_hosted_file = async function delete_hosted_file(
data = {}, data = {},
log_lvl = 1 log_lvl = 1
}: { }: {
api_cfg: any, api_cfg: any;
hosted_file_id: string, hosted_file_id: string;
link_to_type?: string, link_to_type?: string;
link_to_id?: string, link_to_id?: string;
rm_orphan?: boolean, rm_orphan?: boolean;
params?: key_val, params?: key_val;
data?: key_val, data?: key_val;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** stores_hosted_api.js: delete_hosted_file() ***'); console.log('*** stores_hosted_api.js: delete_hosted_file() ***');
const endpoint = `/hosted_file/${hosted_file_id}`; const endpoint = `/hosted_file/${hosted_file_id}`;
@@ -726,17 +725,22 @@ export let delete_hosted_file = async function delete_hosted_file(
params['rm_orphan'] = rm_orphan; params['rm_orphan'] = rm_orphan;
} }
let hosted_file_obj_delete_promise = await api.delete_object({api_cfg: api_cfg, endpoint: endpoint, params: params, data: data, log_lvl: log_lvl}); const hosted_file_obj_delete_promise = await api.delete_object({
api_cfg: api_cfg,
endpoint: endpoint,
params: params,
data: data,
log_lvl: log_lvl
});
// console.log(hosted_file_obj_delete_promise); // console.log(hosted_file_obj_delete_promise);
return hosted_file_obj_delete_promise; return hosted_file_obj_delete_promise;
} };
/* END: Hosted File Related */ /* END: Hosted File Related */
/* BEGIN: Data Store Related */ /* BEGIN: Data Store Related */
// Updated 2023-06-29 // Updated 2023-06-29
export let get_data_store_obj_w_code = async function get_data_store_obj_w_code({ export const get_data_store_obj_w_code = async function get_data_store_obj_w_code({
api_cfg, api_cfg,
data_store_code, data_store_code,
data_type = 'text', data_type = 'text',
@@ -745,15 +749,14 @@ export let get_data_store_obj_w_code = async function get_data_store_obj_w_code(
timeout = 25000, timeout = 25000,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
data_store_code: string, data_store_code: string;
data_type?: string, data_type?: string;
headers?: key_val, headers?: key_val;
params?: key_val, params?: key_val;
timeout?: number, timeout?: number;
log_lvl?: number log_lvl?: number;
} }) {
) {
if (log_lvl) { if (log_lvl) {
console.log('*** get_data_store_obj_w_code() ***'); console.log('*** get_data_store_obj_w_code() ***');
} }
@@ -761,20 +764,34 @@ export let get_data_store_obj_w_code = async function get_data_store_obj_w_code(
// let get_item_result = window.localStorage.getItem(code); // let get_item_result = window.localStorage.getItem(code);
const endpoint = `/data_store/code/${data_store_code}`; const endpoint = `/data_store/code/${data_store_code}`;
let data_store_obj_get_promise = await api.get_object({api_cfg: api_cfg, endpoint: endpoint, headers: headers, params: params, timeout: timeout, log_lvl: log_lvl}); let data_store_obj_get_promise = await api.get_object({
api_cfg: api_cfg,
endpoint: endpoint,
headers: headers,
params: params,
timeout: timeout,
log_lvl: log_lvl
});
if (data_store_obj_get_promise === false) { if (data_store_obj_get_promise === false) {
console.log('Data Store - RUN AGAIN WITH BACKUP'); console.log('Data Store - RUN AGAIN WITH BACKUP');
let original_api_base_url = api_cfg['base_url']; const original_api_base_url = api_cfg['base_url'];
let temp_api = api_cfg; const temp_api = api_cfg;
temp_api['base_url'] = temp_api['base_url_bak'] temp_api['base_url'] = temp_api['base_url_bak'];
data_store_obj_get_promise = await api.get_object({api_cfg: temp_api, endpoint: endpoint, headers: headers, params: params, timeout: timeout, log_lvl: log_lvl}); data_store_obj_get_promise = await api.get_object({
api_cfg: temp_api,
endpoint: endpoint,
headers: headers,
params: params,
timeout: timeout,
log_lvl: log_lvl
});
temp_api['base_url'] = original_api_base_url; temp_api['base_url'] = original_api_base_url;
} }
let data_store_obj = data_store_obj_get_promise; const data_store_obj = data_store_obj_get_promise;
if (data_type == 'text') { if (data_type == 'text') {
// console.log(data_store_obj.text); // console.log(data_store_obj.text);
@@ -790,15 +807,13 @@ export let get_data_store_obj_w_code = async function get_data_store_obj_w_code(
console.log('Response Data:', data_store_obj); console.log('Response Data:', data_store_obj);
} }
return data_store_obj; return data_store_obj;
} };
/* END: Data Store Related */ /* END: Data Store Related */
/* BEGIN: Utility: Email Related */ /* BEGIN: Utility: Email Related */
// Updated 2023-06-29 // Updated 2023-06-29
export let send_email = async function send_email( export const send_email = async function send_email({
{
api_cfg, api_cfg,
from_email, from_email,
from_name = '', from_name = '',
@@ -819,30 +834,29 @@ export let send_email = async function send_email(
test = false, test = false,
log_lvl = 0 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any;
from_email: string, from_email: string;
from_name?: string, from_name?: string;
to_email: string, to_email: string;
to_name?: string, to_name?: string;
cc_email?: null|string, cc_email?: null | string;
cc_name?: null|string, cc_name?: null | string;
bcc_email?: null|string, bcc_email?: null | string;
bcc_name?: null|string, bcc_name?: null | string;
subject: string, subject: string;
body_html: string, body_html: string;
body_text?: null|string, body_text?: null | string;
// headers?: key_val, // headers?: key_val,
params?: key_val, params?: key_val;
data?: key_val, data?: key_val;
return_obj?: boolean, return_obj?: boolean;
return_meta?: boolean, return_meta?: boolean;
test?: boolean, test?: boolean;
log_lvl?: number log_lvl?: number;
} }) {
) {
console.log('*** send_email() ***'); console.log('*** send_email() ***');
let endpoint = `/util/email/send`; const endpoint = `/util/email/send`;
data['from_email'] = from_email; // Required data['from_email'] = from_email; // Required
data['from_name'] = from_name; data['from_name'] = from_name;
@@ -873,7 +887,7 @@ export let send_email = async function send_email(
params['test'] = true; params['test'] = true;
} }
let send_email_post_promise = await api.post_object({ const send_email_post_promise = await api.post_object({
api_cfg: api_cfg, api_cfg: api_cfg,
endpoint: endpoint, endpoint: endpoint,
params: params, params: params,
@@ -890,12 +904,11 @@ export let send_email = async function send_email(
} else { } else {
return send_email_post_promise.event_abstract_id_random; return send_email_post_promise.event_abstract_id_random;
} }
} };
/* END: Utility: Email Related */ /* END: Utility: Email Related */
const obj = {
let obj = {
delete_object: delete_object, delete_object: delete_object,
get_object: get_object, get_object: get_object,
patch_object: patch_object, patch_object: patch_object,
@@ -909,7 +922,7 @@ let obj = {
download_hosted_file: download_hosted_file, download_hosted_file: download_hosted_file,
delete_hosted_file: delete_hosted_file, delete_hosted_file: delete_hosted_file,
get_data_store_obj_w_code: get_data_store_obj_w_code, get_data_store_obj_w_code: get_data_store_obj_w_code,
send_email: send_email, send_email: send_email
} };
export let api = obj; export const api = obj;
// module.exports = api; // module.exports = api;

View File

@@ -20,8 +20,6 @@ if (typeof window !== 'undefined') {
</script> </script>
<svelte:head> <svelte:head>
<script <script async src="https://www.googletagmanager.com/gtag/js?id={site_google_tracking_id}">
async
src="https://www.googletagmanager.com/gtag/js?id={site_google_tracking_id}">
</script> </script>
</svelte:head> </svelte:head>

View File

@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
// *** Import Svelte specific // *** Import Svelte specific
import { onDestroy, onMount, tick } from 'svelte'; import { onDestroy, onMount, tick } from 'svelte';
import { afterNavigate } from '$app/navigation'; import { afterNavigate } from '$app/navigation';
@@ -7,8 +6,12 @@ import { afterNavigate } from '$app/navigation';
// *** Import other supporting libraries // *** Import other supporting libraries
// import { liveQuery } from "dexie"; // import { liveQuery } from "dexie";
import { import {
ShieldEllipsis, ShieldMinus, ShieldPlus, ShieldUser, ShieldEllipsis,
User, UserCheck ShieldMinus,
ShieldPlus,
ShieldUser,
User,
UserCheck
} from '@lucide/svelte'; } from '@lucide/svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
@@ -37,10 +40,9 @@ let {
focus_input = $bindable(false), focus_input = $bindable(false),
expand = $bindable(false), expand = $bindable(false),
show_passcode_input = $bindable(false), show_passcode_input = $bindable(false),
trigger_clear_access = $bindable(null), trigger_clear_access = $bindable(null)
}: Props = $props(); }: Props = $props();
let entered_passcode: null | string = $state(null); let entered_passcode: null | string = $state(null);
let checked_passcode: null | string = $state(null); let checked_passcode: null | string = $state(null);
// let password_checked: boolean = $state(false); // let password_checked: boolean = $state(false);
@@ -53,7 +55,6 @@ let trigger: null|string|boolean = $state(null);
// const dispatch = createEventDispatcher(); // const dispatch = createEventDispatcher();
// WARNING: There is a bug (I think) around here related to the entered_passcode not being cleared. There seems to be something different about how Svelte handles state in this component compared to the others. This might be related to the `$effect` or `$derived` usage. Maybe there are conflicting things trying to update the $ae_loc store at the same time. // WARNING: There is a bug (I think) around here related to the entered_passcode not being cleared. There seems to be something different about how Svelte handles state in this component compared to the others. This might be related to the `$effect` or `$derived` usage. Maybe there are conflicting things trying to update the $ae_loc store at the same time.
onMount(() => { onMount(() => {
log_lvl = 2; log_lvl = 2;
@@ -81,7 +82,6 @@ onDestroy(() => {
trigger = null; trigger = null;
}); });
// afterNavigate(() => { // afterNavigate(() => {
// /** @type {HTMLElement | null} */ // /** @type {HTMLElement | null} */
// const to_focus = document.getElementById('access_passcode_input'); // const to_focus = document.getElementById('access_passcode_input');
@@ -150,41 +150,57 @@ $effect(async () => {
} }
}); });
function handle_check_access_type_passcode() { function handle_check_access_type_passcode() {
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(`*** handle_check_access_type_passcode() *** passcode list:`, $ae_loc.site_access_code_kv); console.log(
`*** handle_check_access_type_passcode() *** passcode list:`,
$ae_loc.site_access_code_kv
);
} }
// Reminder: super > manager > administrator > trusted > public > authenticated > anonymous // Reminder: super > manager > administrator > trusted > public > authenticated > anonymous
if (entered_passcode && entered_passcode.length >= 5) { if (entered_passcode && entered_passcode.length >= 5) {
if (
if ($ae_loc.site_access_code_kv.super.length >= 8 && $ae_loc.site_access_code_kv.super == entered_passcode) { $ae_loc.site_access_code_kv.super.length >= 8 &&
$ae_loc.site_access_code_kv.super == entered_passcode
) {
console.log('Super passcode matched'); console.log('Super passcode matched');
window.localStorage.setItem('access_type', 'super'); window.localStorage.setItem('access_type', 'super');
$ae_loc.access_type = 'super'; $ae_loc.access_type = 'super';
} else if ($ae_loc.site_access_code_kv.manager.length >= 5 && $ae_loc.site_access_code_kv.manager == entered_passcode) { } else if (
$ae_loc.site_access_code_kv.manager.length >= 5 &&
$ae_loc.site_access_code_kv.manager == entered_passcode
) {
console.log('Manager passcode matched'); console.log('Manager passcode matched');
window.localStorage.setItem('access_type', 'manager'); window.localStorage.setItem('access_type', 'manager');
$ae_loc.access_type = 'manager'; $ae_loc.access_type = 'manager';
} else if ($ae_loc.site_access_code_kv.administrator.length >= 5 && $ae_loc.site_access_code_kv.administrator == entered_passcode) { } else if (
$ae_loc.site_access_code_kv.administrator.length >= 5 &&
$ae_loc.site_access_code_kv.administrator == entered_passcode
) {
console.log('Administrator passcode matched'); console.log('Administrator passcode matched');
window.localStorage.setItem('access_type', 'administrator'); window.localStorage.setItem('access_type', 'administrator');
$ae_loc.access_type = 'administrator'; $ae_loc.access_type = 'administrator';
} else if ($ae_loc.site_access_code_kv.trusted.length >= 5 && $ae_loc.site_access_code_kv.trusted == entered_passcode) { } else if (
$ae_loc.site_access_code_kv.trusted.length >= 5 &&
$ae_loc.site_access_code_kv.trusted == entered_passcode
) {
console.log('Trusted passcode matched'); console.log('Trusted passcode matched');
window.localStorage.setItem('access_type', 'trusted'); window.localStorage.setItem('access_type', 'trusted');
$ae_loc.access_type = 'trusted'; $ae_loc.access_type = 'trusted';
} else if ($ae_loc.site_access_code_kv.public.length >= 5 && $ae_loc.site_access_code_kv.public == entered_passcode) { } else if (
$ae_loc.site_access_code_kv.public.length >= 5 &&
$ae_loc.site_access_code_kv.public == entered_passcode
) {
console.log('Public passcode matched'); console.log('Public passcode matched');
window.localStorage.setItem('access_type', 'public'); window.localStorage.setItem('access_type', 'public');
@@ -222,7 +238,6 @@ function handle_check_access_type_passcode() {
entered_passcode = ''; entered_passcode = '';
trigger = 'process_permission_check'; trigger = 'process_permission_check';
$ae_loc.app_cfg.show_element__menu = false; $ae_loc.app_cfg.show_element__menu = false;
$ae_loc.app_cfg.show_element__menu_btn = true; $ae_loc.app_cfg.show_element__menu_btn = true;
@@ -274,10 +289,8 @@ function handle_clear_access() {
return true; return true;
} }
</script> </script>
<section <section
id="AE-Quick-Access-Type" id="AE-Quick-Access-Type"
class=" class="
@@ -299,14 +312,9 @@ function handle_clear_access() {
" "
class:hidden={hide} class:hidden={hide}
> >
<!-- class:hidden={!$ae_sess.show__sign_in_out__fields} --> <!-- class:hidden={!$ae_sess.show__sign_in_out__fields} -->
<header <header class="ae_header hidden">
class="ae_header hidden" <h2 class="text-sm text-center font-semibold">Passcode Sign In</h2>
>
<h2 class="text-sm text-center font-semibold">
Passcode Sign In
</h2>
</header> </header>
<!-- Show list of authorized sessions and presentations for a user --> <!-- Show list of authorized sessions and presentations for a user -->
@@ -323,7 +331,6 @@ function handle_clear_access() {
{/if} {/if}
{/if} --> {/if} -->
<div class="transition-all"> <div class="transition-all">
{#if $ae_loc.trusted_access && $ae_loc.edit_mode} {#if $ae_loc.trusted_access && $ae_loc.edit_mode}
{#if $ae_loc.manager_access} {#if $ae_loc.manager_access}
@@ -345,9 +352,7 @@ function handle_clear_access() {
title="Syncing the local configuration with the remote configuration." title="Syncing the local configuration with the remote configuration."
> >
<span class="fas fa-sync m-1"></span> <span class="fas fa-sync m-1"></span>
<span class="hidden"> <span class="hidden"> Sync </span>
Sync
</span>
</button> </button>
{:else} {:else}
<button <button
@@ -367,9 +372,7 @@ function handle_clear_access() {
title="Currently not syncing with the remote server. Re-sync the local configuration with the remote configuration?" title="Currently not syncing with the remote server. Re-sync the local configuration with the remote configuration?"
> >
<span class="fas fa-unlink m-1"></span> <span class="fas fa-unlink m-1"></span>
<span class="hidden"> <span class="hidden"> Re-sync? </span>
Re-sync?
</span>
</button> </button>
{/if} {/if}
{/if} {/if}
@@ -408,7 +411,6 @@ function handle_clear_access() {
</div> </div>
<div class="flex flex-row flex-wrap gap-1 items-end justify-end w-full transition-all"> <div class="flex flex-row flex-wrap gap-1 items-end justify-end w-full transition-all">
{#if $ae_loc?.access_type && $ae_loc?.access_type == 'anonymous' && 1 == 3} {#if $ae_loc?.access_type && $ae_loc?.access_type == 'anonymous' && 1 == 3}
<span> <span>
<button <button
@@ -424,7 +426,7 @@ function handle_clear_access() {
<span class="lock_icon">Locked</span> <span class="lock_icon">Locked</span>
<span class="fas fa-unlock mx-1 unlock_icon hidden"></span> <span class="fas fa-unlock mx-1 unlock_icon hidden"></span>
{#if (show_passcode_input)} {#if show_passcode_input}
<span class="unlock_text">Cancel</span> <span class="unlock_text">Cancel</span>
{:else} {:else}
<span class="unlock_text">Access?</span> <span class="unlock_text">Access?</span>
@@ -433,15 +435,12 @@ function handle_clear_access() {
</span> </span>
{/if} {/if}
{#if ($ae_loc?.access_type && $ae_loc?.access_type != 'anonymous')} {#if $ae_loc?.access_type && $ae_loc?.access_type != 'anonymous'}
<span class="flex flex-row gap-1 items-center justify-center"> <span class="flex flex-row gap-1 items-center justify-center">
<!-- <span class="fas fa-unlock mx-1"></span> --> <!-- <span class="fas fa-unlock mx-1"></span> -->
<ShieldPlus class="inline-block" /> <ShieldPlus class="inline-block" />
<span <span class="*:hover:inline" title={`Current access type/level: ${$ae_loc.access_type}`}>
class="*:hover:inline"
title={`Current access type/level: ${$ae_loc.access_type}`}
>
{#if $ae_loc.access_type == 'super'} {#if $ae_loc.access_type == 'super'}
<span class="fas fa-hat-wizard m-1"></span> <span class="fas fa-hat-wizard m-1"></span>
<span class="hidden">Super</span> <span class="hidden">Super</span>
@@ -483,7 +482,7 @@ function handle_clear_access() {
<ShieldEllipsis class="inline-block" /> <ShieldEllipsis class="inline-block" />
Passcode? Passcode?
</button> </button>
{:else if (!show_passcode_input)} {:else if !show_passcode_input}
<button <button
type="button" type="button"
onclick={() => { onclick={() => {
@@ -503,7 +502,7 @@ function handle_clear_access() {
</span> </span>
{/if} {/if}
{#if (show_passcode_input)} {#if show_passcode_input}
<span class="flex flex-row gap-1 items-center justify-between w-full"> <span class="flex flex-row gap-1 items-center justify-between w-full">
<span> <span>
<ShieldEllipsis class="inline-block text-gray-500" /> <ShieldEllipsis class="inline-block text-gray-500" />
@@ -523,11 +522,9 @@ function handle_clear_access() {
<!-- <div class="current_text transition-all">{$ae_loc.access_type}</div> --> <!-- <div class="current_text transition-all">{$ae_loc.access_type}</div> -->
</span> </span>
{/if} {/if}
</div> </div>
</section> </section>
<style lang="scss"> <style lang="scss">
/* BEGIN: AE's Svelte Quick Access Type component */ /* BEGIN: AE's Svelte Quick Access Type component */
/* /*

View File

@@ -1,8 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Settings } from '@lucide/svelte';
import {
Settings
} from '@lucide/svelte';
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores'; import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores';
@@ -25,14 +22,13 @@ interface Props {
let { let {
log_lvl = $bindable(0), log_lvl = $bindable(0),
hide = $bindable(false), hide = $bindable(false),
expand = $bindable(false), expand = $bindable(false)
// set_theme_mode = null, // set_theme_mode = null,
// set_theme_name = null // set_theme_name = null
}: Props = $props(); }: Props = $props();
// const dispatch = createEventDispatcher(); // const dispatch = createEventDispatcher();
// onMount(() => { // onMount(() => {
// // console.log('** Element Mounted: ** Element App Config'); // // console.log('** Element Mounted: ** Element App Config');
// if (set_theme_mode) { // if (set_theme_mode) {
@@ -82,10 +78,8 @@ let {
// $ae_loc = {...$ae_loc, ...access_checks_results}; // $ae_loc = {...$ae_loc, ...access_checks_results};
// } // }
function handle_something() { function handle_something() {
// console.log('*** handle_something() ***'); // console.log('*** handle_something() ***');
} }
function handle_clear_storage(item: null | string) { function handle_clear_storage(item: null | string) {
@@ -106,7 +100,6 @@ function handle_clear_storage(item: null|string) {
// } // }
</script> </script>
<!-- transition duration-500 delay-1000 hover:duration-500 hover:delay-1000 hover:transition-all --> <!-- transition duration-500 delay-1000 hover:duration-500 hover:delay-1000 hover:transition-all -->
<section <section
id="AE-App-Cfg" id="AE-App-Cfg"
@@ -129,24 +122,15 @@ function handle_clear_storage(item: null|string) {
" "
class:hidden={hide} class:hidden={hide}
> >
<header class:hidden={!expand} class="ae_header w-full">
<header <h2 class="text-sm text-center font-semibold">Config</h2>
class:hidden={!expand}
class="ae_header w-full"
>
<h2 class="text-sm text-center font-semibold">
Config
</h2>
</header> </header>
<div <div
class="ae_cfg_content text-xs space-y-4 my-4" class="ae_cfg_content text-xs space-y-4 my-4"
class:hidden={!expand} class:hidden={!expand}
data-sveltekit-preload-data="false" data-sveltekit-preload-data="false"
> >
<section class="space-y-2"> <section class="space-y-2">
<div> <div>
<h2 class="strong">Access Type:</h2> <h2 class="strong">Access Type:</h2>
@@ -183,33 +167,20 @@ function handle_clear_storage(item: null|string) {
</section> </section>
<!-- END: Access Type --> <!-- END: Access Type -->
<section class="space-y-2"> <section class="space-y-2">
<h2 class="strong">Utilities:</h2> <h2 class="strong">Utilities:</h2>
<a <a class="btn btn-sm preset-tonal-secondary" href="/hosted_files">
class="btn btn-sm preset-tonal-secondary"
href="/hosted_files"
>
<span class="fas fa-code mx-1"></span> <span class="fas fa-code mx-1"></span>
Util: Convert Videos Util: Convert Videos
</a> </a>
{#if $ae_loc.iframe} {#if $ae_loc.iframe}
<a <a class="btn btn-sm preset-tonal-secondary" href="/?iframe=false">
class="btn btn-sm preset-tonal-secondary"
href="/?iframe=false"
>
<span class="fas fa-code mx-1"></span> <span class="fas fa-code mx-1"></span>
Exit iframe Mode Exit iframe Mode
</a> </a>
{:else} {:else}
<a <a class="btn btn-sm preset-tonal-secondary" href="/?iframe=true">
class="btn btn-sm preset-tonal-secondary"
href="/?iframe=true"
>
<span class="fas fa-code mx-1"></span> <span class="fas fa-code mx-1"></span>
Use iframe Mode Use iframe Mode
</a> </a>
@@ -225,8 +196,7 @@ function handle_clear_storage(item: null|string) {
}} }}
> >
<span class="fas fa-sync mx-1"></span> <span class="fas fa-sync mx-1"></span>
Reload Reload &
&
<span class="fas fa-trash mx-1"></span> <span class="fas fa-trash mx-1"></span>
Clear Cache Clear Cache
</button> </button>
@@ -254,18 +224,13 @@ function handle_clear_storage(item: null|string) {
Clear Storage & DB Clear Storage & DB
</button> </button>
</div> </div>
</section> </section>
<!-- END: Utilities --> <!-- END: Utilities -->
</div> </div>
<!-- class:justify-between={expand} <!-- class:justify-between={expand}
class:justify-end={!expand} --> class:justify-end={!expand} -->
<div <div class="flex flex-row gap-2 items-center justify-between w-full">
class="flex flex-row gap-2 items-center justify-between w-full"
>
<!-- {#if !expand} --> <!-- {#if !expand} -->
<span> <span>
{#if $ae_loc.access_type && $ae_loc.access_type != 'anonymous'} {#if $ae_loc.access_type && $ae_loc.access_type != 'anonymous'}
@@ -326,12 +291,9 @@ class:justify-end={!expand} -->
</span> </span>
</button> </button>
</div> </div>
</section> </section>
<style lang="postcss"> <style lang="postcss">
.ae_cfg_btn .cfg_text { .ae_cfg_btn .cfg_text {
/* display: none; */ /* display: none; */
} }

View File

@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
interface Props { interface Props {
children?: import('svelte').Snippet; children?: import('svelte').Snippet;
log_lvl?: number; log_lvl?: number;
@@ -23,7 +22,7 @@ let {
btn_class = 'btn btn-sm preset-tonal-warning text-warning-500 m-1', btn_class = 'btn btn-sm preset-tonal-warning text-warning-500 m-1',
hide_icon = false, hide_icon = false,
hide_text = false, hide_text = false,
icon_name = 'copy', // copy, check, link icon_name = 'copy' // copy, check, link
}: Props = $props(); }: Props = $props();
// *** Import Svelte specific // *** Import Svelte specific
@@ -37,7 +36,7 @@ import {
Copy, Copy,
// Eye, EyeOff, // Eye, EyeOff,
// Key, // Key,
Link, Link
// LogIn, LogOut, LockKeyhole, // LogIn, LogOut, LockKeyhole,
// Mail, MailCheck, // Mail, MailCheck,
// Menu, // Menu,
@@ -69,7 +68,6 @@ if (log_lvl) {
// }); // });
</script> </script>
<button <button
type="button" type="button"
data-button data-button
@@ -97,22 +95,13 @@ if (log_lvl) {
> >
<!-- {@render btn_text} --> <!-- {@render btn_text} -->
{#if icon_name === 'link'} {#if icon_name === 'link'}
<Link <Link class="mx-1 {hide_icon ? 'hidden' : 'inline-block'}" size="1.2em" />
class="mx-1 {hide_icon ? 'hidden' : 'inline-block' }"
size="1.2em"
/>
{:else if icon_name === 'check'} {:else if icon_name === 'check'}
<CircleCheck <CircleCheck class="mx-1 {hide_icon ? 'hidden' : 'inline-block'}" size="1.2em" />
class="mx-1 {hide_icon ? 'hidden' : 'inline-block' }"
size="1.2em"
/>
{:else} {:else}
<Copy <Copy class="mx-1 {hide_icon ? 'hidden' : 'inline-block'}" size="1.2em" />
class="mx-1 {hide_icon ? 'hidden' : 'inline-block' }"
size="1.2em"
/>
{/if} {/if}
<span class="{hide_text ? 'hidden' : 'inline-block' }"> <span class={hide_text ? 'hidden' : 'inline-block'}>
{btn_text} {btn_text}
</span> </span>
{@render children?.()} {@render children?.()}

View File

@@ -6,16 +6,22 @@ import { browser } from '$app/environment';
import { onMount, onDestroy } from 'svelte'; import { onMount, onDestroy } from 'svelte';
import { import {
EditorView, keymap, highlightSpecialChars, drawSelection, EditorView,
highlightActiveLine, dropCursor, rectangularSelection, keymap,
highlightSpecialChars,
drawSelection,
highlightActiveLine,
dropCursor,
rectangularSelection,
crosshairCursor, crosshairCursor,
gutter, GutterMarker, highlightActiveLineGutter, lineNumbers, gutter,
placeholder as placeholderExt, GutterMarker,
} from "@codemirror/view" highlightActiveLineGutter,
lineNumbers,
placeholder as placeholderExt
} from '@codemirror/view';
import { EditorState, RangeSet, StateEffect, type Extension, Text } from '@codemirror/state'; import { EditorState, RangeSet, StateEffect, type Extension, Text } from '@codemirror/state';
import { import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
defaultKeymap, history, historyKeymap, indentWithTab,
} from "@codemirror/commands"
import { indentUnit } from '@codemirror/language'; import { indentUnit } from '@codemirror/language';
import { languages } from '@codemirror/language-data'; import { languages } from '@codemirror/language-data';
// import { // import {
@@ -42,9 +48,7 @@ import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
// import { javascript } from '@codemirror/lang-javascript'; // import { javascript } from '@codemirror/lang-javascript';
// import { json } from '@codemirror/lang-json'; // import { json } from '@codemirror/lang-json';
// import { html } from '@codemirror/lang-html'; // import { html } from '@codemirror/lang-html';
import { oneDark } from "@codemirror/theme-one-dark"; import { oneDark } from '@codemirror/theme-one-dark';
// Props // Props
export let content: string = 'test test test test'; export let content: string = 'test test test test';
@@ -65,7 +69,7 @@ export let show_line_numbers: boolean = false;
export let wrap_lines: boolean = true; export let wrap_lines: boolean = true;
export let use_tab: boolean = true; export let use_tab: boolean = true;
export let tab_size: number = 4; export let tab_size: number = 4;
let classes = ""; let classes = '';
export { classes as class }; export { classes as class };
let editor_element: HTMLDivElement; let editor_element: HTMLDivElement;
@@ -104,28 +108,33 @@ if (readonly) {
// extensions.push(EditorState.readOnly.of(false)); // extensions.push(EditorState.readOnly.of(false));
} }
if (placeholder) { extensions.push(placeholderExt(placeholder)); } if (placeholder) {
extensions.push(placeholderExt(placeholder));
}
if (show_line_numbers) { if (show_line_numbers) {
// extensions.push(lineNumbers({ class: "line-numbers" })); // extensions.push(lineNumbers({ class: "line-numbers" }));
} else { } else {
// extensions.push(gutter({ class: "hidden-gutter" })); // extensions.push(gutter({ class: "hidden-gutter" }));
// extensions.push(lineNumbers(false)); // extensions.push(lineNumbers(false));
// extensions.push(gutter(false)); // extensions.push(gutter(false));
// extensions.pop(); // extensions.pop();
// extensions.slice(extensions.indexOf(lineNumbers), 1); // extensions.slice(extensions.indexOf(lineNumbers), 1);
} }
if (wrap_lines) { extensions.push(EditorView.lineWrapping); } if (wrap_lines) {
extensions.push(EditorView.lineWrapping);
if (use_tab) { extensions.push(keymap.of([indentWithTab])); } }
if (tab_size) { extensions.push(indentUnit.of(" ".repeat(tab_size))); }
if (use_tab) {
extensions.push(keymap.of([indentWithTab]));
}
if (tab_size) {
extensions.push(indentUnit.of(' '.repeat(tab_size)));
}
// Enable spell check // Enable spell check
extensions.push(EditorView.contentAttributes.of({ spellcheck: "true" })); extensions.push(EditorView.contentAttributes.of({ spellcheck: 'true' }));
// let languages = [ // let languages = [
// { name: 'CSS', mode: 'css' }, // { name: 'CSS', mode: 'css' },
@@ -187,13 +196,12 @@ $: editor_extensions = [
// }; // };
// editorView.setSize(dimensions.width, dimensions.height); // editorView.setSize(dimensions.width, dimensions.height);
// Initialize CodeMirror on mount // Initialize CodeMirror on mount
onMount(() => { onMount(() => {
editorView = new EditorView({ editorView = new EditorView({
state: EditorState.create({ state: EditorState.create({
doc: content, doc: content,
extensions: editor_extensions, extensions: editor_extensions
}), }),
parent: editor_element, // document.body parent: editor_element, // document.body
dispatch: (transaction) => { dispatch: (transaction) => {
@@ -220,12 +228,15 @@ $: if (editorView && editorView.state.doc.toString() !== content) {
extensions: editor_extensions extensions: editor_extensions
}) })
); );
}; }
</script> </script>
{#if browser} {#if browser}
<!-- flex flex-col flex-wrap items-center justify-center --> <!-- flex flex-col flex-wrap items-center justify-center -->
<div bind:this={editor_element} class="codemirror-wrapper h-100 max-h-full w-100 max-w-6xl {classes}"></div> <div
bind:this={editor_element}
class="codemirror-wrapper h-100 max-h-full w-100 max-w-6xl {classes}"
></div>
{:else} {:else}
<div class="scm-waiting {classes}"> <div class="scm-waiting {classes}">
<div class="scm-waiting__loading scm-loading"> <div class="scm-waiting__loading scm-loading">
@@ -290,5 +301,4 @@ $: if (editorView && editorView.state.doc.toString() !== content) {
background-color: var(--cm-gutter-background); background-color: var(--cm-gutter-background);
color: var(--cm-gutter-text); color: var(--cm-gutter-text);
} */ } */
</style> </style>

View File

@@ -2,19 +2,12 @@
// *** Import Svelte specific // *** Import Svelte specific
// *** Import other supporting libraries // *** Import other supporting libraries
import { import { Bug, CircleX, Info, ToggleLeft, ToggleRight, X } from '@lucide/svelte';
Bug,
CircleX, Info,
ToggleLeft, ToggleRight,
X
} from '@lucide/svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
// import { ae_util } from '$lib/ae_utils/ae_utils'; // import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores'; import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores';
// *** Setup Svelte properties // *** Setup Svelte properties
interface Props { interface Props {
log_lvl?: number; log_lvl?: number;
@@ -25,13 +18,10 @@ interface Props {
let { let {
log_lvl = $bindable(0), log_lvl = $bindable(0),
hide = $bindable(false), hide = $bindable(false),
expand = $bindable(false), expand = $bindable(false)
}: Props = $props(); }: Props = $props();
</script> </script>
<!-- App Debug Menu --> <!-- App Debug Menu -->
<!-- opacity-25 <!-- opacity-25
hover:opacity-100 --> hover:opacity-100 -->
@@ -72,7 +62,6 @@ hover:opacity-100 -->
class:hover:border-transparent={!expand} class:hover:border-transparent={!expand}
class:hover:bg-transparent={!expand} class:hover:bg-transparent={!expand}
> >
<div <div
class:hidden={!expand} class:hidden={!expand}
class:border-red-200={expand} class:border-red-200={expand}
@@ -90,7 +79,6 @@ hover:opacity-100 -->
relative relative
" "
> >
<!-- flex flex-col items-center justify-center max-h-full outline --> <!-- flex flex-col items-center justify-center max-h-full outline -->
<div> <div>
<!-- <span class="fas fa-bug mx-1"></span> --> <!-- <span class="fas fa-bug mx-1"></span> -->
@@ -101,7 +89,6 @@ hover:opacity-100 -->
<pre class="text-xs"> <pre class="text-xs">
{JSON.stringify($ae_loc, null, 2)} {JSON.stringify($ae_loc, null, 2)}
</pre> </pre>
</div> </div>
<span class="absolute top-0 right-0 flex flex-row gap-1 items-center justify-center"> <span class="absolute top-0 right-0 flex flex-row gap-1 items-center justify-center">
@@ -123,21 +110,16 @@ hover:opacity-100 -->
<!-- <span class="fas fa-toggle-on mx-1"></span> --> <!-- <span class="fas fa-toggle-on mx-1"></span> -->
<ToggleRight strokeWidth="2.5" color="green" class="inline-block mx-1" /> <ToggleRight strokeWidth="2.5" color="green" class="inline-block mx-1" />
<span>Debug</span> <span>Debug</span>
<span class="hidden"> <span class="hidden"> Mode On </span>
Mode On
</span>
{:else} {:else}
<!-- <span class="fas fa-toggle-off mx-1"></span> --> <!-- <span class="fas fa-toggle-off mx-1"></span> -->
<ToggleLeft strokeWidth="1" color="gray" class="inline-block mx-1" /> <ToggleLeft strokeWidth="1" color="gray" class="inline-block mx-1" />
<span>Debug?</span> <span>Debug?</span>
<span class="hidden"> <span class="hidden"> Mode Off </span>
Mode Off
</span>
{/if} {/if}
<!-- <span class="fas fa-toggle-on mx-1"></span> --> <!-- <span class="fas fa-toggle-on mx-1"></span> -->
<!-- <ToggleRight class="inline-block mx-1" /> --> <!-- <ToggleRight class="inline-block mx-1" /> -->
<!-- <X class="inline-block mx-1" /> --> <!-- <X class="inline-block mx-1" /> -->
</button> </button>
<button <button
@@ -148,7 +130,6 @@ hover:opacity-100 -->
} }
expand = false; expand = false;
$ae_sess.debug_menu.hide_quick_info = false; $ae_sess.debug_menu.hide_quick_info = false;
}} }}
title="Show Quick Info" title="Show Quick Info"
class=" class="
@@ -181,11 +162,8 @@ hover:opacity-100 -->
<!-- <span class="fas fa-toggle-on mx-1"></span> --> <!-- <span class="fas fa-toggle-on mx-1"></span> -->
<!-- <ToggleRight class="inline-block mx-1" /> --> <!-- <ToggleRight class="inline-block mx-1" /> -->
<CircleX class="inline-block mx-1" /> <CircleX class="inline-block mx-1" />
<span class="hidden"> <span class="hidden"> Close </span>
Close
</span>
<span>Debug</span> <span>Debug</span>
</button> </button>
</span> </span>
@@ -215,5 +193,4 @@ hover:opacity-100 -->
<!-- fixed bottom-0 left-0 --> <!-- fixed bottom-0 left-0 -->
&pi; &pi;
</button> </button>
</section> </section>

View File

@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
interface Props { interface Props {
log_lvl?: number; log_lvl?: number;
additional_kv?: key_val; additional_kv?: key_val;
@@ -33,7 +32,7 @@ let {
btn_title = 'Technical support help', btn_title = 'Technical support help',
btn_class = '', btn_class = '',
show_btn_class = '', show_btn_class = '',
hide_icon = false, hide_icon = false
}: Props = $props(); }: Props = $props();
// *** Import Svelte specific // *** Import Svelte specific
@@ -43,7 +42,8 @@ import { goto } from '$app/navigation';
import { import {
// ArrowBigRight, // ArrowBigRight,
BadgeQuestionMark, BadgeQuestionMark,
ChevronDown, ChevronRight, ChevronDown,
ChevronRight,
// CircleX, // CircleX,
// Copy, // Copy,
// Eye, EyeOff, // Eye, EyeOff,
@@ -52,14 +52,25 @@ import {
// LogIn, LogOut, LockKeyhole, // LogIn, LogOut, LockKeyhole,
// Mail, MailCheck, // Mail, MailCheck,
// Menu, // Menu,
RefreshCw, RefreshCcw, RefreshCcwDot, RefreshCw,
RefreshCcw,
RefreshCcwDot,
// ShieldEllipsis, ShieldMinus, ShieldPlus, ShieldUser, // ShieldEllipsis, ShieldMinus, ShieldPlus, ShieldUser,
SquareX, SquareX
// User, UserCheck // User, UserCheck
} from '@lucide/svelte'; } from '@lucide/svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger, type key_val } from '$lib/stores/ae_stores'; import {
ae_snip,
ae_loc,
ae_sess,
ae_api,
ae_trig,
slct,
slct_trigger,
type key_val
} from '$lib/stores/ae_stores';
import { User } from 'lucide-svelte'; import { User } from 'lucide-svelte';
import { api } from '$lib/api/api'; import { api } from '$lib/api/api';
@@ -77,7 +88,6 @@ function preventDefault<T extends Event>(fn: (event: T) => void) {
}; };
} }
function send_help_tech_email() { function send_help_tech_email() {
if (log_lvl) { if (log_lvl) {
console.log(`*** send_help_tech_email() ***`); console.log(`*** send_help_tech_email() ***`);
@@ -125,16 +135,13 @@ function send_help_tech_email() {
to_name: 'IT Tech', to_name: 'IT Tech',
// to_name: $idaa_slct.post_obj.full_name ?? 'IDAA BB Poster', // to_name: $idaa_slct.post_obj.full_name ?? 'IDAA BB Poster',
subject: subject, subject: subject,
body_html: body_html, body_html: body_html
}); });
help_tech_text = ''; // Clear the text area after sending help_tech_text = ''; // Clear the text area after sending
} }
</script> </script>
<!-- class:bg-radial-[at_55%_50%]={$ae_sess.show_help_tech} <!-- class:bg-radial-[at_55%_50%]={$ae_sess.show_help_tech}
class:from-blue-400={$ae_sess.show_help_tech} class:from-blue-400={$ae_sess.show_help_tech}
class:to-transparent={$ae_sess.show_help_tech} class:to-transparent={$ae_sess.show_help_tech}
@@ -161,10 +168,7 @@ class:to-90%={$ae_sess.show_help_tech} -->
class:hover:dark:shadow-blue-800={$ae_sess.show_help_tech} class:hover:dark:shadow-blue-800={$ae_sess.show_help_tech}
class:bg-blue-100={$ae_sess.show_help_tech} class:bg-blue-100={$ae_sess.show_help_tech}
class:dark:bg-blue-900={$ae_sess.show_help_tech} class:dark:bg-blue-900={$ae_sess.show_help_tech}
> >
{#if $ae_sess.show_help_tech} {#if $ae_sess.show_help_tech}
<div <div
class=" class="
@@ -247,7 +251,6 @@ class:to-90%={$ae_sess.show_help_tech} -->
alert('Notification sent to the IT team.'); alert('Notification sent to the IT team.');
})} })}
> >
<textarea <textarea
class=" class="
form-control form-control
@@ -288,7 +291,6 @@ class:to-90%={$ae_sess.show_help_tech} -->
Send Notification Send Notification
{/if} {/if}
</button> </button>
</form> </form>
<div <div
@@ -296,7 +298,8 @@ class:to-90%={$ae_sess.show_help_tech} -->
text-sm text-gray-700 dark:text-gray-300 text-center italic text-sm text-gray-700 dark:text-gray-300 text-center italic
" "
> >
This is intended for technical issues only. Please contact your organization's staff if you have a question about your membership, recorded content, meetings, or posts. This is intended for technical issues only. Please contact your organization's staff if you
have a question about your membership, recorded content, meetings, or posts.
</div> </div>
<div <div
@@ -352,42 +355,95 @@ class:to-90%={$ae_sess.show_help_tech} -->
class="list-disc list-inside text-sm text-gray-800 dark:text-gray-200" class="list-disc list-inside text-sm text-gray-800 dark:text-gray-200"
class:hidden={hide_additional_info} class:hidden={hide_additional_info}
> >
<li><span class="text-sm text-gray-500 dark:text-gray-400">Datetime =</span> {new Date().toISOString()}</li> <li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">URL =</span> {window.location.href}</li> <span class="text-sm text-gray-500 dark:text-gray-400">Datetime =</span>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Browser =</span> {navigator.userAgent}</li> {new Date().toISOString()}
<li><span class="text-sm text-gray-500 dark:text-gray-400">Viewport Size =</span> {window.innerWidth} x {window.innerHeight}</li> </li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Screen Resolution =</span> {window.screen.width} x {window.screen.height}</li> <li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Dark mode =</span> {window?.matchMedia?.('(prefers-color-scheme:dark)')?.matches ?? false}</li> <span class="text-sm text-gray-500 dark:text-gray-400">URL =</span>
<li><span class="text-sm text-gray-500 dark:text-gray-400">In iframe =</span> {$ae_loc?.iframe}</li> {window.location.href}
<li><span class="text-sm text-gray-500 dark:text-gray-400">Theme Mode =</span> {$ae_loc?.theme_mode}</li> </li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Theme Name =</span> {$ae_loc?.theme_name}</li> <li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Account ID =</span> {$slct.account_id}</li> <span class="text-sm text-gray-500 dark:text-gray-400">Browser =</span>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Access Type =</span> {$ae_loc?.access_type}</li> {navigator.userAgent}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Viewport Size =</span>
{window.innerWidth} x {window.innerHeight}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Screen Resolution =</span>
{window.screen.width} x {window.screen.height}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Dark mode =</span>
{window?.matchMedia?.('(prefers-color-scheme:dark)')?.matches ?? false}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">In iframe =</span>
{$ae_loc?.iframe}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Theme Mode =</span>
{$ae_loc?.theme_mode}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Theme Name =</span>
{$ae_loc?.theme_name}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Account ID =</span>
{$slct.account_id}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">Access Type =</span>
{$ae_loc?.access_type}
</li>
{#if $ae_loc?.person_id} {#if $ae_loc?.person_id}
<li><span class="text-sm text-gray-500 dark:text-gray-400">person_id =</span> {$ae_loc?.person_id}</li> <li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">full_name =</span> {$ae_loc?.full_name}</li> <span class="text-sm text-gray-500 dark:text-gray-400">person_id =</span>
{$ae_loc?.person_id}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">full_name =</span>
{$ae_loc?.full_name}
</li>
{/if} {/if}
{#if $ae_loc?.user_id} {#if $ae_loc?.user_id}
<li><span class="text-sm text-gray-500 dark:text-gray-400">user_id =</span> {$ae_loc?.user_id}</li> <li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">username =</span> {$ae_loc?.username}</li> <span class="text-sm text-gray-500 dark:text-gray-400">user_id =</span>
<li><span class="text-sm text-gray-500 dark:text-gray-400">email =</span> {$ae_loc?.email}</li> {$ae_loc?.user_id}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">username =</span>
{$ae_loc?.username}
</li>
<li>
<span class="text-sm text-gray-500 dark:text-gray-400">email =</span>
{$ae_loc?.email}
</li>
{/if} {/if}
<li><span class="text-sm text-gray-500 dark:text-gray-400">API Base URL =</span> {$ae_api.base_url}</li> <li>
<span class="text-sm text-gray-500 dark:text-gray-400">API Base URL =</span>
{$ae_api.base_url}
</li>
{#if additional_kv && Object.keys(additional_kv).length > 0} {#if additional_kv && Object.keys(additional_kv).length > 0}
<h2 class="text-base font-semibold text-gray-800">Component Info:</h2> <h2 class="text-base font-semibold text-gray-800">Component Info:</h2>
<ul class="list-disc list-inside text-gray-800 text-sm"> <ul class="list-disc list-inside text-gray-800 text-sm">
{#each Object.entries(additional_kv) as [key, value]} {#each Object.entries(additional_kv) as [key, value]}
<li><span class="text-sm text-gray-500 dark:text-gray-400">{key} =</span> {value ?? '-- not set --'}</li> <li>
<span class="text-sm text-gray-500 dark:text-gray-400">{key} =</span>
{value ?? '-- not set --'}
</li>
{/each} {/each}
</ul> </ul>
{/if} {/if}
</ul> </ul>
<div class="text-sm text-gray-700 dark:text-gray-300 text-center italic"> <div class="text-sm text-gray-700 dark:text-gray-300 text-center italic">
This information will be included in the help request to assist technical support in diagnosing the issue. This information will be included in the help request to assist technical support in
diagnosing the issue.
</div> </div>
</div> </div>
<div <div
@@ -402,11 +458,17 @@ class:to-90%={$ae_sess.show_help_tech} -->
onclick={() => { onclick={() => {
if ($ae_loc.edit_mode) { if ($ae_loc.edit_mode) {
// Confirm before clearing // Confirm before clearing
if (!confirm("Are you sure you want to clear IndexedDB databases, localStorage, and sessionStorage? This will also reload the page.")) { if (
!confirm(
'Are you sure you want to clear IndexedDB databases, localStorage, and sessionStorage? This will also reload the page.'
)
) {
return; return;
} }
console.log("Clearing IndexedDB, localStorage, sessionStorage, and reloading the page..."); console.log(
'Clearing IndexedDB, localStorage, sessionStorage, and reloading the page...'
);
// Clear Indexed DB // Clear Indexed DB
indexedDB.deleteDatabase('ae_archives_db'); // Archives module indexedDB.deleteDatabase('ae_archives_db'); // Archives module
@@ -426,11 +488,17 @@ class:to-90%={$ae_sess.show_help_tech} -->
// window.location.reload(true); // window.location.reload(true);
} else { } else {
// Confirm before clearing // Confirm before clearing
if (!confirm("Are you sure you want to clear IndexedDB databases and some caches? This will also reload the page.")) { if (
!confirm(
'Are you sure you want to clear IndexedDB databases and some caches? This will also reload the page.'
)
) {
return; return;
} }
console.log("Clearing IndexedDB, localStorage, sessionStorage, and reloading the page..."); console.log(
'Clearing IndexedDB, localStorage, sessionStorage, and reloading the page...'
);
// Clear Indexed DB // Clear Indexed DB
indexedDB.deleteDatabase('ae_archives_db'); // Archives module indexedDB.deleteDatabase('ae_archives_db'); // Archives module
@@ -486,11 +554,7 @@ class:to-90%={$ae_sess.show_help_tech} -->
</button> </button>
</div> </div>
</div> </div>
{:else} {:else}
<button <button
type="button" type="button"
onclick={() => ($ae_sess.show_help_tech = true)} onclick={() => ($ae_sess.show_help_tech = true)}
@@ -512,14 +576,5 @@ class:to-90%={$ae_sess.show_help_tech} -->
{btn_text} {btn_text}
</span> </span>
</button> </button>
{/if} {/if}
</div> </div>

View File

@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
// *** Import Svelte specific // *** Import Svelte specific
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { goto, invalidateAll } from '$app/navigation'; import { goto, invalidateAll } from '$app/navigation';
@@ -8,12 +7,18 @@ import { Modal } from 'flowbite-svelte';
// *** Import other supporting libraries // *** Import other supporting libraries
import { import {
CircleX, CircleX,
Eye, EyeOff, Eye,
EyeOff,
Key, Key,
LogIn, LogOut, LockKeyhole, LogIn,
Mail, MailCheck, LogOut,
LockKeyhole,
Mail,
MailCheck,
ShieldUser, ShieldUser,
User, UserCheck, UserLock User,
UserCheck,
UserLock
} from '@lucide/svelte'; } from '@lucide/svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
@@ -29,12 +34,7 @@ interface Props {
hidden: null | boolean; hidden: null | boolean;
} }
let { let { log_lvl = $bindable(0), data = null, hidden = $bindable(true) }: Props = $props();
log_lvl = $bindable(0),
data = null,
hidden = $bindable(true),
}: Props = $props();
let url_user_id = data.url.searchParams.get('user_id'); let url_user_id = data.url.searchParams.get('user_id');
let url_user_key = data.url.searchParams.get('user_key'); // Reminder that "key" is the site's auth key. let url_user_key = data.url.searchParams.get('user_key'); // Reminder that "key" is the site's auth key.
@@ -57,14 +57,12 @@ $effect(() => {
} }
}); });
let user_email = $state('scott.idem@gmail.com'); // Used for quick lookup of user by email address let user_email = $state('scott.idem@gmail.com'); // Used for quick lookup of user by email address
let new_password = $state('test12345'); let new_password = $state('test12345');
let confirm_password = $state('test12345'); let confirm_password = $state('test12345');
let is_changing_password = $state(false); let is_changing_password = $state(false);
let show_password_text = $state('password'); // password or text let show_password_text = $state('password'); // password or text
function sign_in() { function sign_in() {
$ae_loc.person_id = person_id; // Set the person_id in the ae_loc store $ae_loc.person_id = person_id; // Set the person_id in the ae_loc store
$ae_loc.person = person_obj; // Store the full person object for reference $ae_loc.person = person_obj; // Store the full person object for reference
@@ -112,7 +110,6 @@ function sign_in() {
goto(new_url, { replaceState: true, invalidateAll: true }); goto(new_url, { replaceState: true, invalidateAll: true });
} }
function sign_out() { function sign_out() {
// Clear the session information // Clear the session information
$ae_loc.person_id = null; $ae_loc.person_id = null;
@@ -166,7 +163,6 @@ function sign_out() {
console.log('Signed out successfully.'); console.log('Signed out successfully.');
} }
if (browser) { if (browser) {
if (url_user_id) { if (url_user_id) {
// Pre-fill the auth__entered_user_id if passed in via the URL. // Pre-fill the auth__entered_user_id if passed in via the URL.
@@ -186,8 +182,6 @@ if (browser) {
} }
} }
// Use core_func.send_email_auth_ae_obj__user_id // Use core_func.send_email_auth_ae_obj__user_id
function handle_send_auth_email({ user_id }: { user_id: string }) { function handle_send_auth_email({ user_id }: { user_id: string }) {
console.log('handle_send_auth_email()'); console.log('handle_send_auth_email()');
@@ -203,7 +197,6 @@ function handle_send_auth_email({user_id}: {user_id: string}) {
base_url: $ae_loc.base_url, base_url: $ae_loc.base_url,
log_lvl: 2 log_lvl: 2
}); });
} }
// Use core_func.qry_ae_obj_li__user_email // Use core_func.qry_ae_obj_li__user_email
@@ -211,13 +204,15 @@ function handle_lookup_user_email({email}: {email: string}) {
console.log('handle_lookup_user_email()'); console.log('handle_lookup_user_email()');
// If a user is returned then send the new auth key email // If a user is returned then send the new auth key email
ae_promises.load__user_obj_li = core_func.qry_ae_obj_li__user_email({ ae_promises.load__user_obj_li = core_func
.qry_ae_obj_li__user_email({
api_cfg: $ae_api, api_cfg: $ae_api,
account_id: $slct.account_id, account_id: $slct.account_id,
null_account_id: false, null_account_id: false,
email: email, email: email,
log_lvl: 1 log_lvl: 1
}).then((user_response) => { })
.then((user_response) => {
if (user_response?.user_id_random) { if (user_response?.user_id_random) {
console.log(`User found for email:`, user_response); console.log(`User found for email:`, user_response);
handle_send_auth_email({ handle_send_auth_email({
@@ -234,7 +229,6 @@ function handle_lookup_user_email({email}: {email: string}) {
}); });
} }
async function handle_change_password() { async function handle_change_password() {
if (!new_password) { if (!new_password) {
alert('Password cannot be empty.'); alert('Password cannot be empty.');
@@ -335,10 +329,8 @@ async function handle_change_password() {
alert('Failed to change password. Check password length.'); alert('Failed to change password. Check password length.');
} }
} }
</script> </script>
<!-- It is important to keep in mind that a Person can only fully sign in if they have a linked User record. --> <!-- It is important to keep in mind that a Person can only fully sign in if they have a linked User record. -->
<!-- *:hover:inline --> <!-- *:hover:inline -->
<section <section
@@ -360,14 +352,9 @@ async function handle_change_password() {
duration-300 delay-150 hover:delay-1000 hover:ease-out duration-300 delay-150 hover:delay-1000 hover:ease-out
transition-all transition-all
" "
class:hidden={hidden} class:hidden
>
<header
class:hidden={!$ae_sess.show__sign_in_out__fields}
class="ae_header w-full "
> >
<header class:hidden={!$ae_sess.show__sign_in_out__fields} class="ae_header w-full">
<h2 class="text-sm text-center font-semibold"> <h2 class="text-sm text-center font-semibold">
{#if $ae_loc?.person_id && $ae_loc?.user_id} {#if $ae_loc?.person_id && $ae_loc?.user_id}
<!-- <button <!-- <button
@@ -389,7 +376,6 @@ async function handle_change_password() {
{:else} {:else}
<!-- <LogIn class="mx-1" /> --> <!-- <LogIn class="mx-1" /> -->
User Sign In User Sign In
{/if} {/if}
</h2> </h2>
</header> </header>
@@ -399,7 +385,6 @@ async function handle_change_password() {
class="flex flex-col gap-1 transition-all w-full" class="flex flex-col gap-1 transition-all w-full"
> >
{#if !$ae_loc?.person_id && !$ae_loc?.user_id} {#if !$ae_loc?.person_id && !$ae_loc?.user_id}
<!-- Form for user look up based on email address --> <!-- Form for user look up based on email address -->
<form <form
class=" class="
@@ -424,8 +409,8 @@ async function handle_change_password() {
class="input max-w-48" class="input max-w-48"
placeholder="Email Address" placeholder="Email Address"
value={$ae_sess.auth__entered_email ?? ''} value={$ae_sess.auth__entered_email ?? ''}
oninput={(e) => $ae_sess.auth__entered_email = e.target.value} oninput={(e) => ($ae_sess.auth__entered_email = e.target.value)}
> />
<button <button
type="submit" type="submit"
class="btn btn-sm preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500" class="btn btn-sm preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500"
@@ -451,28 +436,33 @@ async function handle_change_password() {
// WARNING: Logging in as a global user does not work yet. The API needs to be updated. Currently it returns multiple user records from the v_user view if there is more than one person record linked to the user ID. // WARNING: Logging in as a global user does not work yet. The API needs to be updated. Currently it returns multiple user records from the v_user view if there is more than one person record linked to the user ID.
if ($ae_sess.auth__entered_user_id && $ae_sess.auth__entered_user_key) { if ($ae_sess.auth__entered_user_id && $ae_sess.auth__entered_user_key) {
// Try to use the user ID and user auth key passed in the URL params for authentication // Try to use the user ID and user auth key passed in the URL params for authentication
alert('Attempting to authenticate with User ID and Auth Key.'); alert('Attempting to authenticate with User ID and Auth Key.');
ae_promises['user'] = await core_func.auth_ae_obj__user_id_user_auth_key({ ae_promises['user'] = await core_func
.auth_ae_obj__user_id_user_auth_key({
api_cfg: $ae_api, api_cfg: $ae_api,
account_id: $ae_loc.account_id, account_id: $ae_loc.account_id,
// null_account_id: false, // Set to true to allow to authenticate as global user (Super or Manager) // null_account_id: false, // Set to true to allow to authenticate as global user (Super or Manager)
user_id: $ae_sess.auth__entered_user_id, user_id: $ae_sess.auth__entered_user_id,
user_auth_key: $ae_sess.auth__entered_user_key, user_auth_key: $ae_sess.auth__entered_user_key,
log_lvl: 2, log_lvl: 2
}).then((user_response) => { })
.then((user_response) => {
// console.log(`HERE:`, user_response); // console.log(`HERE:`, user_response);
if (user_response.user_id_random) { if (user_response.user_id_random) {
console.log(`Successfully authenticated in with User ID and User Auth Key: ${user_response.username}`, user_response); console.log(
`Successfully authenticated in with User ID and User Auth Key: ${user_response.username}`,
user_response
);
user_obj = user_response; // Store the user object for later use user_obj = user_response; // Store the user object for later use
user_id = user_obj.user_id_random; // Use the user_id_random for further API calls user_id = user_obj.user_id_random; // Use the user_id_random for further API calls
// person_id = user_obj.person_id_random; // person_id = user_obj.person_id_random;
} else { } else {
alert('Failed to authenticate: ' + user_response.error); alert('Failed to authenticate: ' + user_response.error);
} }
}).then((response) => { })
.then((response) => {
if (!user_id) { if (!user_id) {
// If we didn't get a user_id, return early // If we didn't get a user_id, return early
console.error('No user_id obtained from auth_ae_obj__username_password'); console.error('No user_id obtained from auth_ae_obj__username_password');
@@ -494,17 +484,22 @@ async function handle_change_password() {
// } // }
// WARNING: This function returns a list. We only want the first one. There should be no more than 1 record returned. // WARNING: This function returns a list. We only want the first one. There should be no more than 1 record returned.
ae_promises['person'] = core_func.load_ae_obj_li__person({ ae_promises['person'] = core_func
.load_ae_obj_li__person({
api_cfg: $ae_api, api_cfg: $ae_api,
for_obj_type: 'account', for_obj_type: 'account',
for_obj_id: $ae_loc.account_id, for_obj_id: $ae_loc.account_id,
qry_user_id: user_id, // The user_id_random from the above authentication qry_user_id: user_id, // The user_id_random from the above authentication
// params_json: params_json, // params_json: params_json,
// params: params, // params: params,
log_lvl: 1, log_lvl: 1
}).then((person_response) => { })
.then((person_response) => {
if (person_response[0].person_id_random) { if (person_response[0].person_id_random) {
console.log(`Successfully loaded person for user_id_random (${user_id}):`, person_response[0]); console.log(
`Successfully loaded person for user_id_random (${user_id}):`,
person_response[0]
);
person_obj = person_response[0]; person_obj = person_response[0];
person_id = person_obj.person_id_random; person_id = person_obj.person_id_random;
@@ -512,7 +507,8 @@ async function handle_change_password() {
} else { } else {
alert('Failed to load person information: ' + person_response.error); alert('Failed to load person information: ' + person_response.error);
} }
}).then(() => { })
.then(() => {
// Once all promises are resolved, we can check if we have both user_id and person_id // Once all promises are resolved, we can check if we have both user_id and person_id
if (user_id && person_id) { if (user_id && person_id) {
// Set the session information // Set the session information
@@ -527,34 +523,39 @@ async function handle_change_password() {
`); `);
// window.location.reload(); // Reload to get the new session // window.location.reload(); // Reload to get the new session
} else { } else {
console.error('Failed to authenticate and load data: missing user_id or person_id'); console.error(
'Failed to authenticate and load data: missing user_id or person_id'
);
} }
}); });
}); });
// console.log('DONE???', ae_promises); // console.log('DONE???', ae_promises);
} else if ($ae_sess.auth__entered_username && $ae_sess.auth__entered_password) { } else if ($ae_sess.auth__entered_username && $ae_sess.auth__entered_password) {
// Try to use the username/password for authentication // Try to use the username/password for authentication
// alert('Attempting to authenticate with Username and Password.'); // alert('Attempting to authenticate with Username and Password.');
ae_promises['user'] = await core_func.auth_ae_obj__username_password({ ae_promises['user'] = await core_func
.auth_ae_obj__username_password({
api_cfg: $ae_api, api_cfg: $ae_api,
account_id: $ae_loc.account_id, account_id: $ae_loc.account_id,
// null_account_id: false, // Set to true to allow to authenticate as global user (Super or Manager) // null_account_id: false, // Set to true to allow to authenticate as global user (Super or Manager)
username: $ae_sess.auth__entered_username, username: $ae_sess.auth__entered_username,
password: $ae_sess.auth__entered_password, password: $ae_sess.auth__entered_password,
log_lvl: 1, log_lvl: 1
}).then((user_response) => { })
.then((user_response) => {
if (user_response.user_id_random) { if (user_response.user_id_random) {
console.log(`Successfully authenticated in with Username (${user_response.username}) and Password:`, user_response); console.log(
`Successfully authenticated in with Username (${user_response.username}) and Password:`,
user_response
);
user_obj = user_response; // Store the user object for later use user_obj = user_response; // Store the user object for later use
user_id = user_obj.user_id_random; // Use the user_id_random for further API calls user_id = user_obj.user_id_random; // Use the user_id_random for further API calls
// person_id = user_obj.person_id_random; // person_id = user_obj.person_id_random;
} else { } else {
alert('Failed to authenticate: ' + user_response.error); alert('Failed to authenticate: ' + user_response.error);
} }
}).then((response) => { })
.then((response) => {
if (!user_id) { if (!user_id) {
// If we didn't get a user_id, return early // If we didn't get a user_id, return early
console.error('No user_id obtained from auth_ae_obj__username_password'); console.error('No user_id obtained from auth_ae_obj__username_password');
@@ -576,17 +577,22 @@ async function handle_change_password() {
// } // }
// WARNING: This function returns a list. We only want the first one. There should be no more than 1 record returned. // WARNING: This function returns a list. We only want the first one. There should be no more than 1 record returned.
ae_promises['person'] = core_func.load_ae_obj_li__person({ ae_promises['person'] = core_func
.load_ae_obj_li__person({
api_cfg: $ae_api, api_cfg: $ae_api,
for_obj_type: 'account', for_obj_type: 'account',
for_obj_id: $ae_loc.account_id, for_obj_id: $ae_loc.account_id,
qry_user_id: user_id, // The user_id_random from the above authentication qry_user_id: user_id, // The user_id_random from the above authentication
// params_json: params_json, // params_json: params_json,
// params: params, // params: params,
log_lvl: 1, log_lvl: 1
}).then((person_response) => { })
.then((person_response) => {
if (person_response[0].person_id_random) { if (person_response[0].person_id_random) {
console.log(`Successfully loaded person for user_id_random (${user_id}):`, person_response[0]); console.log(
`Successfully loaded person for user_id_random (${user_id}):`,
person_response[0]
);
person_obj = person_response[0]; person_obj = person_response[0];
person_id = person_obj.person_id_random; person_id = person_obj.person_id_random;
@@ -594,7 +600,8 @@ async function handle_change_password() {
} else { } else {
alert('Failed to load person information: ' + person_response.error); alert('Failed to load person information: ' + person_response.error);
} }
}).then(() => { })
.then(() => {
// Once all promises are resolved, we can check if we have both user_id and person_id // Once all promises are resolved, we can check if we have both user_id and person_id
if (user_id && person_id) { if (user_id && person_id) {
// Set the session information // Set the session information
@@ -609,54 +616,50 @@ async function handle_change_password() {
`); `);
// window.location.reload(); // Reload to get the new session // window.location.reload(); // Reload to get the new session
} else { } else {
console.error('Failed to authenticate and load data: missing user_id or person_id'); console.error(
'Failed to authenticate and load data: missing user_id or person_id'
);
} }
}); });
}); });
// console.log('DONE???', ae_promises); // console.log('DONE???', ae_promises);
} else { } else {
alert('Please enter either a User ID and Auth Key or Username and Password.'); alert('Please enter either a User ID and Auth Key or Username and Password.');
return false; // Prevent form submission if no credentials are provided return false; // Prevent form submission if no credentials are provided
} }
}} }}
> >
{#if $ae_sess.auth__entered_user_id} {#if $ae_sess.auth__entered_user_id}
<input <input
type="text" type="text"
class="input max-w-36" class="input max-w-36"
placeholder="User ID" placeholder="User ID"
value={$ae_sess.auth__entered_user_id ?? ''} value={$ae_sess.auth__entered_user_id ?? ''}
oninput={(e) => $ae_sess.auth__entered_user_id = e.target.value} oninput={(e) => ($ae_sess.auth__entered_user_id = e.target.value)}
> />
<input <input
type="text" type="text"
class="input max-w-36" class="input max-w-36"
placeholder="Auth Key" placeholder="Auth Key"
value={$ae_sess.auth__entered_user_key ?? ''} value={$ae_sess.auth__entered_user_key ?? ''}
oninput={(e) => $ae_sess.auth__entered_user_key = e.target.value} oninput={(e) => ($ae_sess.auth__entered_user_key = e.target.value)}
> />
{:else} {:else}
<input <input
type="text" type="text"
class="input max-w-48" class="input max-w-48"
placeholder="Username" placeholder="Username"
value={$ae_sess.auth__entered_username ?? ''} value={$ae_sess.auth__entered_username ?? ''}
oninput={(e) => $ae_sess.auth__entered_username = e.target.value} oninput={(e) => ($ae_sess.auth__entered_username = e.target.value)}
> />
<input <input
type="password" type="password"
class="input max-w-48" class="input max-w-48"
placeholder="Password" placeholder="Password"
value={$ae_sess.auth__entered_password ?? ''} value={$ae_sess.auth__entered_password ?? ''}
oninput={(e) => $ae_sess.auth__entered_password = e.target.value} oninput={(e) => ($ae_sess.auth__entered_password = e.target.value)}
> />
{/if} {/if}
<button <button
@@ -674,9 +677,7 @@ async function handle_change_password() {
Sign In Sign In
</button> </button>
</form> </form>
{:else} {:else}
<div class="flex flex-col gap-1 items-center justify-center"> <div class="flex flex-col gap-1 items-center justify-center">
<span class="text-sm text-gray-500"> <span class="text-sm text-gray-500">
{$ae_loc?.user?.username ?? '-- not set --'} {$ae_loc?.user?.username ?? '-- not set --'}
@@ -693,9 +694,7 @@ async function handle_change_password() {
}} }}
> >
<LockKeyhole class="mx-1" /> <LockKeyhole class="mx-1" />
<span class="hidden sm:inline"> <span class="hidden sm:inline"> Change Password </span>
Change Password
</span>
</button> </button>
{/if} {/if}
@@ -711,20 +710,13 @@ async function handle_change_password() {
}} }}
> >
<LogOut class="mx-1" /> <LogOut class="mx-1" />
<span class="hidden sm:inline"> <span class="hidden sm:inline"> Sign Out </span>
Sign Out
</span>
</button> </button>
</div> </div>
{/if} {/if}
</span> </span>
<div class="flex flex-row gap-1 items-center justify-between w-full transition-all">
<div
class="flex flex-row gap-1 items-center justify-between w-full transition-all"
>
<span> <span>
{#if $ae_loc?.person_id && $ae_loc?.user_id} {#if $ae_loc?.person_id && $ae_loc?.user_id}
<span class="fas fa-user mx-1 text-gray-500"></span> <span class="fas fa-user mx-1 text-gray-500"></span>
@@ -752,7 +744,6 @@ async function handle_change_password() {
}} }}
> >
{#if $ae_loc?.person_id && $ae_loc?.user_id} {#if $ae_loc?.person_id && $ae_loc?.user_id}
{#if $ae_sess.show__sign_in_out__fields} {#if $ae_sess.show__sign_in_out__fields}
<CircleX class="m-1" /> <CircleX class="m-1" />
<span <span
@@ -768,10 +759,7 @@ async function handle_change_password() {
<User class="mx-1 inline-block text-gray-500" /> <User class="mx-1 inline-block text-gray-500" />
{$ae_loc?.person?.full_name_override ?? $ae_loc?.person?.full_name} {$ae_loc?.person?.full_name_override ?? $ae_loc?.person?.full_name}
{/if} {/if}
{:else if $ae_sess.show__sign_in_out__fields}
{:else}
{#if $ae_sess.show__sign_in_out__fields}
<CircleX class="mx-1" /> <CircleX class="mx-1" />
<span <span
class=" class="
@@ -796,11 +784,8 @@ async function handle_change_password() {
User Sign-In User Sign-In
</span> </span>
{/if} {/if}
{/if}
</button> </button>
</div> </div>
</section> </section>
<!-- Change Password Modal --> <!-- Change Password Modal -->
@@ -828,7 +813,7 @@ async function handle_change_password() {
Your User ID: {$ae_loc?.user_id ?? '-- not set --'} Your User ID: {$ae_loc?.user_id ?? '-- not set --'}
</span> </span>
</div> </div>
{#if ($ae_loc?.manager_access)} {#if $ae_loc?.manager_access}
<div class="flex flex-row flex-wrap gap-2"> <div class="flex flex-row flex-wrap gap-2">
<input <input
type="text" type="text"
@@ -852,7 +837,6 @@ async function handle_change_password() {
placeholder="New Password" placeholder="New Password"
bind:value={new_password} bind:value={new_password}
class="input input-bordered w-48 max-w-full required:border-red-500" class="input input-bordered w-48 max-w-full required:border-red-500"
/> />
<input <input
required required
@@ -895,7 +879,9 @@ async function handle_change_password() {
<div> <div>
<span class="text-sm text-warning-800 dark:text-gray-200"> <span class="text-sm text-warning-800 dark:text-gray-200">
Password must be at <strong>least 10 characters</strong> long. It is recommend that you use a pass phrase (multiple words as your password) or a complex password (uppercase letter, lowercase letters, numbers, and special characters). Password must be at <strong>least 10 characters</strong> long. It is recommend that you use
a pass phrase (multiple words as your password) or a complex password (uppercase letter,
lowercase letters, numbers, and special characters).
</span> </span>
</div> </div>
</div> </div>
@@ -923,6 +909,5 @@ async function handle_change_password() {
</Modal> </Modal>
{/if} {/if}
<style lang="scss"> <style lang="scss">
</style> </style>

Some files were not shown because too many files have changed in this diff Show More