From 0c4185f74ce04419860942276ac592ac3285b6a0 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 24 Jun 2024 14:42:14 -0400 Subject: [PATCH] General code clean up --- src/lib/ae_core_functions.ts | 6 +++--- src/lib/ae_events__event.ts | 16 ++++++++++++---- src/lib/ae_events__event_badge.ts | 4 ++-- src/lib/ae_events__event_file.ts | 10 +++++----- src/lib/ae_events__event_presentation.ts | 6 +++--- src/lib/ae_events__event_presenter.ts | 8 ++++---- src/lib/ae_events__event_session.ts | 6 +++--- src/lib/ae_events__exhibit.ts | 16 ++++++++-------- src/lib/ae_events_functions.ts | 6 +++++- src/lib/ae_sponsorships_functions.ts | 4 ++-- src/lib/ae_utils.ts | 4 ++-- src/lib/api.ts | 6 +++--- src/lib/api_2024-05-23.js | 2 +- src/lib/api_get_object.ts | 2 +- src/lib/api_patch_object.ts | 2 +- src/lib/api_post_object.ts | 2 +- 16 files changed, 56 insertions(+), 44 deletions(-) diff --git a/src/lib/ae_core_functions.ts b/src/lib/ae_core_functions.ts index cbbd4b31..7f083306 100644 --- a/src/lib/ae_core_functions.ts +++ b/src/lib/ae_core_functions.ts @@ -20,7 +20,7 @@ async function handle_load_ae_obj_id__site_domain( try_cache=false, timeout=7000, log_lvl=0 - } : { + }: { api_cfg: any, fqdn: string, try_cache: boolean, @@ -236,7 +236,7 @@ async function handle_load_ae_obj_li__person( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, account_id: string, params?: key_val, @@ -366,7 +366,7 @@ async function handle_download_export__obj_type( limit=5000, params={}, // key value object is expected log_lvl=0 - } : { + }: { api_cfg: any, get_obj_type: string, for_obj_type: string, diff --git a/src/lib/ae_events__event.ts b/src/lib/ae_events__event.ts index 39306985..93d42d21 100644 --- a/src/lib/ae_events__event.ts +++ b/src/lib/ae_events__event.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__event( event_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, event_id: string, try_cache?: boolean, @@ -58,7 +58,7 @@ export async function handle_load_ae_obj_li__event( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, account_id: string, params?: key_val, @@ -114,11 +114,19 @@ export async function handle_load_ae_obj_li__event( // This function will loop through the event_obj_li and save each one to the DB. -export function handle_db_save_ae_obj_li__event({obj_type, obj_li}) { +export function handle_db_save_ae_obj_li__event( + { + obj_type, + obj_li + }: { + obj_type: string, + obj_li: any + } + ) { console.log(`*** handle_db_save_ae_obj_li__event() ***`); if (obj_li && obj_li.length) { - obj_li.forEach(async function (obj) { + obj_li.forEach(async function (obj: any) { // console.log(`ae_obj ${obj_type}:`, obj); try { diff --git a/src/lib/ae_events__event_badge.ts b/src/lib/ae_events__event_badge.ts index 14439db3..f5366e83 100644 --- a/src/lib/ae_events__event_badge.ts +++ b/src/lib/ae_events__event_badge.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__badge( badge_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, badge_id: string, try_cache?: boolean, @@ -271,7 +271,7 @@ export function handle_db_save_ae_obj_li__badge( { obj_type, obj_li - } : { + }: { obj_type: string, obj_li: any } diff --git a/src/lib/ae_events__event_file.ts b/src/lib/ae_events__event_file.ts index 114fe267..43e76461 100644 --- a/src/lib/ae_events__event_file.ts +++ b/src/lib/ae_events__event_file.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__event_file( event_file_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, event_file_id: string, try_cache?: boolean, @@ -59,7 +59,7 @@ export async function handle_load_ae_obj_li__event_file( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, event_session_id: string, params?: key_val, @@ -119,7 +119,7 @@ export async function handle_delete_ae_obj_id__event_file( event_file_id, params={}, log_lvl=0 - } : { + }: { api_cfg: any, event_file_id: string, params?: key_val, @@ -158,7 +158,7 @@ export async function create_event_file_obj_from_hosted_file_async( inc_hosted_file=false, return_meta=false, log_lvl=0 - } : { + }: { api_cfg: any, hosted_file_id: string, params?: key_val, @@ -214,7 +214,7 @@ export function handle_db_save_ae_obj_li__event_file( { obj_type, obj_li - } : { + }: { obj_type: string, obj_li: any } diff --git a/src/lib/ae_events__event_presentation.ts b/src/lib/ae_events__event_presentation.ts index f0e22eea..ae5e71fb 100644 --- a/src/lib/ae_events__event_presentation.ts +++ b/src/lib/ae_events__event_presentation.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__event_presentation( event_presentation_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, event_presentation_id: string, try_cache?: boolean, @@ -59,7 +59,7 @@ export async function handle_load_ae_obj_li__event_presentation( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, event_session_id: string, params?: key_val, @@ -117,7 +117,7 @@ export function handle_db_save_ae_obj_li__event_presentation( { obj_type, obj_li - } : { + }: { obj_type: string, obj_li: any } diff --git a/src/lib/ae_events__event_presenter.ts b/src/lib/ae_events__event_presenter.ts index 3afec637..28e98e28 100644 --- a/src/lib/ae_events__event_presenter.ts +++ b/src/lib/ae_events__event_presenter.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__event_presenter( event_presenter_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, event_presenter_id: string, try_cache?: boolean, @@ -59,7 +59,7 @@ export async function handle_load_ae_obj_li__event_presenter( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, event_presentation_id: string, params?: key_val, @@ -119,7 +119,7 @@ export async function handle_update_ae_obj__event_presenter( data, params={}, log_lvl=0 - } : { + }: { api_cfg: any, event_presenter_id: string, data: any, @@ -163,7 +163,7 @@ export function handle_db_save_ae_obj_li__event_presenter( { obj_type, obj_li - } : { + }: { obj_type: string, obj_li: any } diff --git a/src/lib/ae_events__event_session.ts b/src/lib/ae_events__event_session.ts index 5c949eca..32ccf174 100644 --- a/src/lib/ae_events__event_session.ts +++ b/src/lib/ae_events__event_session.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__event_session( event_session_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, event_session_id: string, try_cache?: boolean, @@ -60,7 +60,7 @@ export async function handle_load_ae_obj_li__event_session( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, event_id: string, params?: key_val, @@ -235,7 +235,7 @@ export function handle_db_save_ae_obj_li__event_session( { obj_type, obj_li - } : { + }: { obj_type: string, obj_li: any } diff --git a/src/lib/ae_events__exhibit.ts b/src/lib/ae_events__exhibit.ts index 679ed74b..b5c1988f 100644 --- a/src/lib/ae_events__exhibit.ts +++ b/src/lib/ae_events__exhibit.ts @@ -13,7 +13,7 @@ export async function handle_load_ae_obj_id__exhibit( exhibit_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, exhibit_id: string, try_cache?: boolean, @@ -60,7 +60,7 @@ export async function handle_load_ae_obj_li__exhibit( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, event_id: any, params: any, @@ -199,7 +199,7 @@ export async function handle_load_ae_obj_id__exhibit_tracking( exhibit_tracking_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, exhibit_tracking_id: string, try_cache?: boolean, @@ -246,7 +246,7 @@ export async function handle_load_ae_obj_li__exhibit_tracking( params={}, try_cache=true, log_lvl=0 - } : { + }: { api_cfg: any, exhibit_id: any, params: any, @@ -313,7 +313,7 @@ export async function handle_create_ae_obj__exhibit_tracking( external_person_id, params={}, log_lvl=0 - } : { + }: { api_cfg: any, exhibit_id: string, event_badge_id: string, @@ -373,7 +373,7 @@ export async function handle_update_ae_obj__exhibit_tracking( data, params={}, log_lvl=0 - } : { + }: { api_cfg: any, exhibit_tracking_id: string, data: any, @@ -422,7 +422,7 @@ export async function handle_download_export__event_exhibit_tracking( auto_download=false, params={}, log_lvl=0 - } : { + }: { api_cfg: any, exhibit_id: string, file_type?: string, @@ -513,7 +513,7 @@ export function handle_db_save_ae_obj_li__exhibitor_tracking( { obj_type, obj_li - } : { + }: { obj_type: string, obj_li: any } diff --git a/src/lib/ae_events_functions.ts b/src/lib/ae_events_functions.ts index f8017434..9e5ab430 100644 --- a/src/lib/ae_events_functions.ts +++ b/src/lib/ae_events_functions.ts @@ -1,6 +1,10 @@ // This file is used to export all the functions that are used for Aether Events related functions. -import { handle_load_ae_obj_id__event, handle_load_ae_obj_li__event, handle_db_save_ae_obj_li__event } from "$lib/ae_events__event"; +import { + handle_load_ae_obj_id__event, + handle_load_ae_obj_li__event, + handle_db_save_ae_obj_li__event +} from "$lib/ae_events__event"; import { handle_load_ae_obj_id__event_file, diff --git a/src/lib/ae_sponsorships_functions.ts b/src/lib/ae_sponsorships_functions.ts index 507166ad..3998b3a0 100644 --- a/src/lib/ae_sponsorships_functions.ts +++ b/src/lib/ae_sponsorships_functions.ts @@ -19,7 +19,7 @@ async function handle_load_ae_obj_id__sponsorship_cfg( sponsorship_cfg_id, try_cache=false, log_lvl=0 - } : { + }: { api_cfg: any, sponsorship_cfg_id: string, try_cache: boolean, @@ -76,7 +76,7 @@ async function handle_download_export__sponsorship( auto_download=false, params={}, // key value object is expected log_lvl=0 - } : { + }: { api_cfg: any, account_id: string, file_type?: string, diff --git a/src/lib/ae_utils.ts b/src/lib/ae_utils.ts index 2812e4a3..9d95c595 100644 --- a/src/lib/ae_utils.ts +++ b/src/lib/ae_utils.ts @@ -669,7 +669,7 @@ export let shorten_string = function shorten_string( begin_length=15, end_length=5, wildcard_length=3 - } : { + }: { string: string, max_length?: number, begin_length?: number, @@ -726,7 +726,7 @@ function shorten_filename( max_length=20, slice_end_at=15, max_end_length=5 - } : { + }: { filename: string, max_length?: number, slice_end_at?: number, diff --git a/src/lib/api.ts b/src/lib/api.ts index 40acc79a..61e35675 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -31,7 +31,7 @@ export let get_ae_obj_id_crud = async function get_ae_obj_id_crud( timeout=25000, return_meta=false, log_lvl=0 - } : { + }: { api_cfg: any, no_account_id?: boolean, obj_type: string, @@ -203,7 +203,7 @@ export let get_ae_obj_li_for_obj_id_crud = async function get_ae_obj_li_for_obj_ params={}, return_meta=false, log_lvl=1 - } : { + }: { api_cfg: any, obj_type: string, for_obj_type: string, @@ -567,7 +567,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud( obj_v_name='', return_meta=false, log_lvl=0 - } : { + }: { api_cfg: any, obj_type: string, obj_id: string, diff --git a/src/lib/api_2024-05-23.js b/src/lib/api_2024-05-23.js index 64c3ee17..74d6350d 100644 --- a/src/lib/api_2024-05-23.js +++ b/src/lib/api_2024-05-23.js @@ -75,7 +75,7 @@ export let get_object = async function get_object( // The task_id value should be a random string that is unique to the task. This is used to identify the task in the message event. task_id='get_object_x', log_lvl=0 - // } : { + // }: { // api_cfg: any, // endpoint: string, // headers?: any, diff --git a/src/lib/api_get_object.ts b/src/lib/api_get_object.ts index a91616bc..0f6d6099 100644 --- a/src/lib/api_get_object.ts +++ b/src/lib/api_get_object.ts @@ -27,7 +27,7 @@ export let get_object = async function get_object( // The task_id value should be a random string that is unique to the task. This is used to identify the task in the message event. task_id=crypto.randomUUID(), log_lvl=0 - } : { + }: { api_cfg: any, endpoint: string, headers?: any, diff --git a/src/lib/api_patch_object.ts b/src/lib/api_patch_object.ts index dabd27a4..3a8814ad 100644 --- a/src/lib/api_patch_object.ts +++ b/src/lib/api_patch_object.ts @@ -9,7 +9,7 @@ export let patch_object = async function patch_object( data={}, return_meta=false, log_lvl=0 - } : { + }: { api_cfg: any, endpoint: string, params?: any, diff --git a/src/lib/api_post_object.ts b/src/lib/api_post_object.ts index ab9ea44a..284265fa 100644 --- a/src/lib/api_post_object.ts +++ b/src/lib/api_post_object.ts @@ -20,7 +20,7 @@ export let post_object = async function post_object( // The task_id value should be a random string that is unique to the task. This is used to identify the task in the message event. task_id=crypto.randomUUID(), log_lvl=0 - } : { + }: { api_cfg: any, endpoint: string, params?: any,