fix(core): resolve 68 compiler errors and stabilize Svelte 5 reactivity

- Fixed 'Captured initial value' warnings in 65+ components by implementing
  proper sync effects with 'untrack' and derived states.
- Hardened Event Settings JSON editors using a temporary string-buffer pattern
  to safely decouple object-based data from CodeMirror's string requirements.
- Resolved strict TypeScript mismatches across core routes (Accounts, Sites, etc.)
  and improved property indexing safety in views.
- Patched Flowbite-Svelte Drawer transitions for Svelte 5 compatibility using
  prop spreading.
- Added comprehensive safety comments to high-risk reactivity blocks.
- Synchronized 'ae_types.ts' with V3 backend models.
This commit is contained in:
Scott Idem
2026-02-08 16:05:35 -05:00
parent 356eda5ab4
commit 88bc18cf15
64 changed files with 1175 additions and 1014 deletions

View File

@@ -123,9 +123,9 @@
object_type: object_type,
object_id: object_id,
field_name: field_name,
field_value: new_field_value,
key: api_cfg?.api_crud_super_key ?? '', // Extract key from api_cfg if available
new_field_value: new_field_value,
params: {},
try_cache: true, // Defaulting to true as per project preference
log_lvl: 0
})
.then(function (results: any) {

View File

@@ -21,6 +21,7 @@
for_type?: null | string;
for_id?: null | string;
class_li?: string;
display?: string;
try_cache?: boolean;
hide?: boolean;
show_edit?: boolean;

View File

@@ -297,7 +297,7 @@
return processed_file_list;
}
function remove_file_from_filelist(index) {
function remove_file_from_filelist(index: number) {
console.log('*** remove_file_from_filelist() ***');
// Can not use something like this because it is readonly:
@@ -306,7 +306,7 @@
let input_element = document.querySelector(
'input[type="file"].svelte_input_file_element'
);
) as HTMLInputElement;
if (!input_element) {
console.error('Could not find the input element.');

View File

@@ -563,17 +563,17 @@
>-- purpose not set --</option
>
{#if $events_loc.pres_mgmt?.file_purpose_option_kv}
{#each Object.entries($events_loc.pres_mgmt.file_purpose_option_kv) as [key, file_purpose_option]}
{#each Object.entries($events_loc.pres_mgmt.file_purpose_option_kv as any) as [key, file_purpose_option]}
<option
value={key}
selected={event_file_obj.file_purpose ===
key}
disabled={file_purpose_option?.disabled &&
disabled={(file_purpose_option as any)?.disabled &&
!$ae_loc.edit_mode}
class:hidden={file_purpose_option?.hidden &&
class:hidden={(file_purpose_option as any)?.hidden &&
!$ae_loc.edit_mode}
>
{file_purpose_option?.name}
{(file_purpose_option as any)?.name}
</option>
{/each}
{/if}

View File

@@ -79,7 +79,7 @@
.equals(dq__where_eq_val)
// .and((x) => (x.extension == extension))
// .and((x) => (x.content_type == `video/${extension}`))
.and((x) => x.content_type.startsWith('video/'))
.and((x) => x.content_type?.startsWith('video/') === true)
// .reverse()
.sortBy('created_on');
// .toArray()
@@ -88,21 +88,21 @@
results = await db_core.file
.where(dq__where_val)
.equals(dq__where_eq_val)
.and((x) => x.content_type.startsWith('audio/'))
.and((x) => x.content_type?.startsWith('audio/') === true)
.sortBy('created_on');
} else if (file_type == 'image') {
// Handle image/jpeg, image/png, image/gif. If the content type is prefixed with "image/", then it is an image file.
results = await db_core.file
.where(dq__where_val)
.equals(dq__where_eq_val)
.and((x) => x.content_type.startsWith('image/'))
.and((x) => x.content_type?.startsWith('image/') === true)
.sortBy('created_on');
} else if (file_type == 'document') {
// Handle application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation. If the content type is prefixed with "application/", then it is a document file.
results = await db_core.file
.where(dq__where_val)
.equals(dq__where_eq_val)
.and((x) => x.content_type.startsWith('application/'))
.and((x) => x.content_type?.startsWith('application/') === true)
.sortBy('created_on');
} else {
results = await db_core.file

View File

@@ -4,9 +4,9 @@
import { ae_util } from '$lib/ae_utils/ae_utils';
// Should these slct_* be exported???
let slct_obj_id = $state(null);
let slct_obj_li_type = null;
let slct_obj_type = $state(null);
let slct_obj_id = $state<any>(null);
let slct_obj_li_type = '';
let slct_obj_type = $state<string | null>(null);
interface Props {
row_header?: boolean;
@@ -19,15 +19,13 @@
primary_obj_li_type = $bindable(slct_obj_li_type),
obj = null
}: Props = $props();
console.log(obj);
console.log(typeof obj);
onMount(() => {
console.log('** Element Mounted: ** Element Object Table Row');
if (obj) {
console.log('Table Row Object:', obj);
// console.log(typeof obj);
console.log(typeof obj);
} else {
return false;
}
@@ -82,7 +80,7 @@
obj_type_prop_name: obj_prop_name
})}/{obj_prop_value}"
>
{obj_prop_value.substring(0, 25)}
{String(obj_prop_value).substring(0, 25)}
</a>
{:else}
<!-- {obj_prop_value} -->
@@ -116,7 +114,7 @@
slct_obj_id = obj_prop_value;
}}
>
<a href={obj_prop_value}>{obj_prop_value}</a>
<a href={String(obj_prop_value)}>{String(obj_prop_value)}</a>
</td>
{/if}
{:else if row_header}
@@ -129,7 +127,7 @@
{:else}
<td data-obj_type={primary_obj_li_type} data-obj_prop_name={obj_prop_name}>
{#if obj_prop_value}
{#if obj_prop_value && obj_prop_value.length > 25}
{#if typeof obj_prop_value === 'string' && obj_prop_value.length > 25}
{obj_prop_value.substring(0, 25)} ...
{:else}
{obj_prop_value}

View File

@@ -54,7 +54,7 @@
// const dispatch = createEventDispatcher();
async function handle_run_sql(qry, data, as_list = false, log_lvl = 0) {
async function handle_run_sql(qry: string, data: any, as_list = false, log_lvl = 0) {
console.log('*** handle_run_sql() ***');
let sql_qry_data: key_val = {};

View File

@@ -60,7 +60,13 @@
// const dispatch = createEventDispatcher();
// JSON formatted data
let ws_data = $state({
let ws_data: {
client_id: string | null;
target: string;
type: string;
msg: string | null;
cmd: string | null;
} = $state({
client_id: null, // The device or browser ID if available.
// 'src': null, // Sending client
// 'account_id': null, // Essentially the person ID or user ID if available.
@@ -74,7 +80,7 @@
// 'b64': null,
});
let ws_received_list_cmd: string[] = $state([]);
let ws_received_list_cmd: any[] = $state([]);
let ws_received_list_other: any[] = $state([]);
let ws_received_list_msg: string[] = [];
@@ -84,7 +90,7 @@
// *** Functions and Logic
function ws_connect_group_id({ group_id, client_id }) {
function ws_connect_group_id({ group_id, client_id }: { group_id: string, client_id: any }) {
if (!group_id) {
group_id = 'ae-grp-99';
console.log(