From 0987cd6ad91f8f6b43657494c6f719a862a517ce Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 18 Nov 2025 18:40:50 -0500 Subject: [PATCH] style: Apply Prettier formatting with 4-space indentation Applied consistent code formatting across the project using Prettier, now configured to use 4-space indentation instead of tabs. --- .eslintrc.cjs | 56 +- .prettierrc | 14 +- .vscode/settings.json | 234 +- ARCHITECTURE.md | 16 +- COMPONENTS.md | 102 +- DATA_STRUCTURES.md | 2 +- GEMINI.md | 24 +- NAMING_CONVENTIONS.md | 70 +- OLD_README_guidelines_ui_ux.md | 82 +- OLD_README_guidelines_v2.md | 86 +- README.md | 4 +- SVELTE_DEXIE_GUIDE.md | 56 +- TODO.md | 256 +- ...pp_svelte_tailwind_skeleton.code-workspace | 20 +- components.json | 30 +- eslint.config.js | 56 +- jsconfig.json | 10 +- package.json | 200 +- playwright.config.ts | 34 +- src/ae-c-idaa-light.css | 292 +- src/ae-c-lci.css | 406 +- src/ae-osit-default.css | 406 +- src/aeclci_v1.css | 406 +- src/app.css | 550 +- src/app.d.ts | 8 +- src/app.html | 68 +- src/index.test.ts | 6 +- src/lib/ae_api/api_delete_object.ts | 210 +- src/lib/ae_api/api_get__crud_obj_id.ts | 308 +- src/lib/ae_api/api_get__crud_obj_li_v1.ts | 406 +- src/lib/ae_api/api_get__crud_obj_li_v2.ts | 282 +- src/lib/ae_api/api_get_object.ts | 408 +- src/lib/ae_api/api_get_object_v1.ts | 934 +-- src/lib/ae_api/api_patch_object.ts | 234 +- src/lib/ae_api/api_post_object.ts | 590 +- src/lib/ae_archives/ae_archives__archive.ts | 1265 ++-- .../ae_archives__archive_content.ts | 944 +-- src/lib/ae_archives/ae_archives_functions.ts | 40 +- src/lib/ae_archives/db_archives.ts | 194 +- .../ae_comp__hosted_files_clip_video.svelte | 697 +-- ...ae_comp__hosted_files_clip_video_li.svelte | 149 +- ...ae_comp__hosted_files_clip_video_v1.svelte | 671 +-- ..._comp__hosted_files_download_button.svelte | 279 +- .../ae_comp__hosted_files_upload.svelte | 536 +- src/lib/ae_core/ae_core_functions.ts | 1099 ++-- src/lib/ae_core/core__account.ts | 36 +- src/lib/ae_core/core__activity_log.ts | 622 +- src/lib/ae_core/core__api_helpers.ts | 76 +- .../core__check_hosted_file_obj_w_hash.ts | 50 +- src/lib/ae_core/core__countries.ts | 110 +- src/lib/ae_core/core__country_subdivisions.ts | 116 +- src/lib/ae_core/core__crud_generic.ts | 488 +- src/lib/ae_core/core__data_store.ts | 160 +- src/lib/ae_core/core__hosted_files.ts | 584 +- src/lib/ae_core/core__idb_dexie.ts | 155 +- src/lib/ae_core/core__person.ts | 1206 ++-- src/lib/ae_core/core__qr_code.ts | 410 +- src/lib/ae_core/core__site.ts | 78 +- src/lib/ae_core/core__site_domain.ts | 104 +- src/lib/ae_core/core__time_zones.ts | 112 +- src/lib/ae_core/core__user.ts | 540 +- src/lib/ae_core/db_core.ts | 212 +- src/lib/ae_events/ae_events__event.ts | 2070 +++---- src/lib/ae_events/ae_events__event_badge.ts | 1171 ++-- .../ae_events__event_badge_template.ts | 934 +-- src/lib/ae_events/ae_events__event_device.ts | 1303 +++-- src/lib/ae_events/ae_events__event_file.ts | 1432 ++--- .../ae_events/ae_events__event_location.ts | 1453 ++--- .../ae_events__event_presentation.ts | 1231 ++-- .../ae_events/ae_events__event_presenter.ts | 1543 ++--- src/lib/ae_events/ae_events__event_session.ts | 2226 +++---- src/lib/ae_events/ae_events__exhibit.ts | 1245 ++-- src/lib/ae_events/db_events.ts | 1208 ++-- src/lib/ae_events_functions.ts | 192 +- src/lib/ae_journals/ae_journals__journal.ts | 1392 ++--- .../ae_journals/ae_journals__journal_entry.ts | 1573 ++--- src/lib/ae_journals/ae_journals_functions.ts | 26 +- src/lib/ae_journals/ae_journals_stores.ts | 222 +- src/lib/ae_journals/db_journals.ts | 852 +-- src/lib/ae_posts/ae_posts__post.ts | 1358 ++--- src/lib/ae_posts/ae_posts__post_comment.ts | 905 +-- src/lib/ae_posts/ae_posts_functions.ts | 40 +- src/lib/ae_posts/db_posts.ts | 162 +- .../ae_sponsorships_functions.ts | 831 +-- src/lib/ae_sponsorships/db_sponsorships.ts | 158 +- src/lib/ae_utils/ae_utils.ts | 390 +- src/lib/ae_utils/ae_utils__crypto.ts | 188 +- src/lib/ae_utils/ae_utils__datetime_format.ts | 316 +- .../ae_utils__extract_prefixed_form_data.ts | 222 +- .../ae_utils/ae_utils__file_extension_icon.ts | 88 +- src/lib/ae_utils/ae_utils__files.ts | 106 +- .../ae_utils__get_obj_li_w_match_prop.ts | 68 +- .../ae_utils/ae_utils__is_datetime_recent.ts | 36 +- src/lib/ae_utils/ae_utils__perm_checks.ts | 354 +- .../ae_utils/ae_utils__process_data_string.ts | 116 +- .../ae_utils__return_obj_type_path.ts | 158 +- .../ae_utils__set_obj_prop_display_name.ts | 210 +- src/lib/ae_utils/ae_utils__to_title_case.ts | 71 +- src/lib/api/api.ts | 1564 ++--- src/lib/app_components/analytics.svelte | 36 +- .../app_components/e_app_access_type.svelte | 831 +-- src/lib/app_components/e_app_cfg.svelte | 452 +- src/lib/app_components/e_app_clipboard.svelte | 192 +- .../app_components/e_app_codemirror_v5.svelte | 286 +- .../app_components/e_app_debug_menu.svelte | 224 +- src/lib/app_components/e_app_help_tech.svelte | 823 +-- .../app_components/e_app_sign_in_out.svelte | 1540 ++--- src/lib/app_components/e_app_sys_menu.svelte | 745 +-- src/lib/app_components/e_app_theme.svelte | 318 +- src/lib/components/ui/button/button.svelte | 116 +- src/lib/components/ui/button/index.js | 8 +- src/lib/components/ui/button/index.ts | 24 +- .../dropdown-menu-checkbox-item.svelte | 66 +- .../dropdown-menu-content.svelte | 40 +- .../dropdown-menu-group-heading.svelte | 26 +- .../dropdown-menu/dropdown-menu-item.svelte | 34 +- .../dropdown-menu/dropdown-menu-label.svelte | 32 +- .../dropdown-menu-radio-item.svelte | 46 +- .../dropdown-menu-separator.svelte | 20 +- .../dropdown-menu-shortcut.svelte | 26 +- .../dropdown-menu-sub-content.svelte | 26 +- .../dropdown-menu-sub-trigger.svelte | 42 +- src/lib/components/ui/dropdown-menu/index.js | 60 +- src/lib/components/ui/dropdown-menu/index.ts | 60 +- src/lib/components/ui/input/index.js | 6 +- src/lib/components/ui/input/index.ts | 6 +- src/lib/components/ui/input/input.svelte | 32 +- src/lib/components/ui/popover/index.js | 18 +- src/lib/components/ui/popover/index.ts | 18 +- .../ui/popover/popover-content.svelte | 44 +- src/lib/components/ui/separator/index.js | 6 +- src/lib/components/ui/separator/index.ts | 6 +- .../components/ui/separator/separator.svelte | 32 +- src/lib/components/ui/tooltip/index.js | 18 +- src/lib/components/ui/tooltip/index.ts | 18 +- .../ui/tooltip/tooltip-content.svelte | 30 +- src/lib/electron/README.md | 16 +- src/lib/electron/electron_native.js | 2226 +++---- src/lib/electron/electron_relay.js | 292 +- src/lib/element_qr_scanner_v2.svelte | 1004 ++-- src/lib/elements/codemirror_modules.ts | 288 +- src/lib/elements/element_ae_crud.svelte | 733 +-- src/lib/elements/element_ae_crud_v2.svelte | 849 +-- .../elements/element_codemirror_editor.svelte | 274 +- .../element_codemirror_editor_wrapper.svelte | 30 +- src/lib/elements/element_data_store.svelte | 1377 ++--- src/lib/elements/element_data_store_v2.svelte | 1451 ++--- src/lib/elements/element_input_file.svelte | 718 +-- .../elements/element_input_files_tbl.svelte | 687 +-- src/lib/elements/element_input_v2.svelte | 1259 ++-- .../element_manage_event_file_li.svelte | 1283 ++-- .../element_manage_event_file_li_all.svelte | 114 +- ...element_manage_event_file_li_direct.svelte | 130 +- .../element_manage_hosted_file_li.svelte | 452 +- .../element_manage_hosted_file_li_all.svelte | 244 +- src/lib/elements/element_obj_tbl_row.svelte | 258 +- src/lib/elements/element_sql_qry.svelte | 232 +- src/lib/elements/element_tiptap_editor.scss | 188 +- src/lib/elements/element_websocket_v2.svelte | 927 +-- src/lib/stores/ae_events_stores.ts | 950 +-- src/lib/stores/ae_idaa_stores.ts | 253 +- src/lib/stores/ae_stores.ts | 656 +-- src/lib/utils/ae_string_snippets.ts | 20 +- src/lib/utils/utils.ts | 2 +- src/parent_iframe.html | 216 +- src/routes/+layout.svelte | 2237 +++---- src/routes/+layout.ts | 472 +- src/routes/+page.svelte | 221 +- src/routes/admin/+layout.svelte | 186 +- src/routes/admin/+page.svelte | 238 +- src/routes/core/+layout.svelte | 108 +- src/routes/core/+page.svelte | 400 +- src/routes/core/README.md | 4 +- .../core/ae_comp__person_obj_tbl.svelte | 262 +- src/routes/core/not_used+layout.ts | 42 +- .../core/person/[person_id]/+page.svelte | 314 +- src/routes/core/person/[person_id]/+page.ts | 56 +- src/routes/core/person_view.svelte | 1285 ++-- src/routes/events/+layout.svelte | 456 +- src/routes/events/+layout.ts | 32 +- src/routes/events/+page.svelte | 305 +- src/routes/events/+page.ts | 100 +- .../[event_id]/(badges)/badges/+layout.svelte | 141 +- .../[event_id]/(badges)/badges/+page.svelte | 192 +- .../(badges)/badges/[badge_id]/+page.svelte | 180 +- .../[badge_id]/ae_comp__badge_obj_view.svelte | 1903 +++--- .../badges/[badge_id]/print/+page.svelte | 2 +- .../badges/[badge_id]/review/+page.svelte | 2 +- .../badges/ae_comp__badge_obj_li.svelte | 224 +- .../badges/ae_comp__badge_search.svelte | 1062 ++-- .../(badges)/badges/stats/+page.svelte | 2 +- .../(launcher)/launcher/+layout.svelte | 2588 ++++---- .../[event_id]/(launcher)/launcher/+layout.ts | 188 +- .../launcher/[event_location_id]/+page.svelte | 396 +- .../launcher/[event_location_id]/+page.ts | 152 +- .../[event_id]/(launcher)/launcher_cfg.svelte | 1262 ++-- .../(launcher)/launcher_file_cont.svelte | 1258 ++-- .../(launcher)/launcher_menu.svelte | 416 +- .../(launcher)/launcher_presenter_view.svelte | 189 +- .../launcher_presenter_view_posters.svelte | 171 +- .../(launcher)/launcher_session_view.svelte | 889 +-- .../(launcher)/menu_location_list.svelte | 318 +- .../(launcher)/menu_session_list.svelte | 539 +- .../[event_id]/(leads)/leads/+layout.svelte | 4 +- .../[event_id]/(leads)/leads/+page.svelte | 52 +- .../(leads)/leads/[lead_id]/+page.svelte | 2 +- .../leads/exhibit/[exhibit_id]/+page.svelte | 2 +- src/routes/events/[event_id]/+layout.svelte | 98 +- src/routes/events/[event_id]/+layout.ts | 108 +- src/routes/events/[event_id]/+page.svelte | 1167 ++-- src/routes/events/[event_id]/+page.ts | 110 +- .../ae_comp__event_device_obj_li.svelte | 953 +-- ...e_comp__event_device_obj_li_wrapper.svelte | 110 +- .../events/[event_id]/event_page_menu.svelte | 1165 ++-- .../location/[event_location_id]/+page.svelte | 549 +- .../location/[event_location_id]/+page.ts | 189 +- .../location_page_menu.svelte | 993 ++-- .../[event_location_id]/location_view.svelte | 778 +-- .../events/[event_id]/locations/+page.svelte | 230 +- .../ae_comp__event_location_obj_li.svelte | 611 +- .../locations/locations_page_menu.svelte | 427 +- .../presenter/[presenter_id]/+page.svelte | 775 +-- .../presenter/[presenter_id]/+page.ts | 96 +- ...ae_comp__event_presenter_form_agree.svelte | 755 +-- .../[presenter_id]/presenter_page_menu.svelte | 927 +-- .../[presenter_id]/presenter_view.svelte | 2680 ++++----- .../ae_comp__event_presenter_obj_li.svelte | 598 +- ...omp__event_presenter_obj_li_wrapper.svelte | 106 +- .../ae_comp__event_presenter_obj_tbl.svelte | 752 +-- ...mp__event_presenter_obj_tbl_wrapper.svelte | 230 +- .../events/[event_id]/reports/+page.svelte | 1355 ++--- .../reports/event_reports_page_menu.svelte | 679 +-- .../[event_id]/reports/reports_files.svelte | 978 ++-- .../reports/reports_presenters.svelte | 726 +-- .../reports/reports_sessions.svelte | 784 +-- .../session/[session_id]/+page.svelte | 746 +-- .../[event_id]/session/[session_id]/+page.ts | 204 +- ..._comp__event_session_poc_form_agree.svelte | 742 +-- .../ae_comp__event_session_poc_profile.svelte | 367 +- .../[session_id]/session_page_menu.svelte | 978 ++-- .../session/[session_id]/session_view.svelte | 1745 +++--- .../ae_comp__event_session_alert.svelte | 486 +- .../events/[event_id]/sign_in_out.svelte | 444 +- .../events/ae_comp__event_file_obj_tbl.svelte | 1143 ++-- ...ae_comp__event_file_obj_tbl_wrapper.svelte | 246 +- .../events/ae_comp__event_files_upload.svelte | 586 +- .../ae_comp__event_presentation_obj_li.svelte | 850 +-- .../ae_comp__event_session_obj_li.svelte | 1150 ++-- ..._comp__event_session_obj_li_wrapper.svelte | 142 +- .../ae_comp__event_session_obj_tbl.svelte | 223 +- ...comp__event_session_obj_tbl_wrapper.svelte | 236 +- .../events/ae_comp__events_menu_nav.svelte | 170 +- .../events/ae_comp__events_menu_opts.svelte | 1287 ++-- src/routes/events_badges/+layout.svelte | 218 +- src/routes/events_badges/+layout.ts | 78 +- src/routes/events_badges/+page.svelte | 72 +- src/routes/events_badges/+page.ts | 6 +- src/routes/events_badges/review/+layout.ts | 48 +- src/routes/events_badges/review/+page.svelte | 1400 ++--- src/routes/events_badges/stats/+page.svelte | 1414 ++--- src/routes/events_leads/+layout.svelte | 68 +- src/routes/events_leads/+layout.ts | 58 +- src/routes/events_leads/+page.svelte | 474 +- src/routes/events_leads/+page.ts | 74 +- src/routes/events_leads/README.md | 16 +- .../events_leads/exhibit/[slug]/+page.svelte | 2127 +++---- .../events_leads/exhibit/[slug]/+page.ts | 78 +- .../exhibit/[slug]/leads_add_scan.svelte | 1755 +++--- .../exhibit/[slug]/leads_list.svelte | 891 +-- .../exhibit/[slug]/leads_manage.svelte | 1190 ++-- .../exhibit/[slug]/leads_payment.svelte | 502 +- .../exhibit/[slug]/leads_view_lead.svelte | 1399 ++--- src/routes/hosted_files/+layout.svelte | 102 +- src/routes/hosted_files/+layout.ts | 86 +- src/routes/hosted_files/+page.svelte | 156 +- .../hosted_files/video_util/+page.svelte | 370 +- .../video_util/hold_video_util.svelte | 314 +- src/routes/idaa/(idaa)/+layout.svelte | 422 +- .../idaa/(idaa)/archives/+layout.svelte | 60 +- src/routes/idaa/(idaa)/archives/+layout.ts | 84 +- src/routes/idaa/(idaa)/archives/+page.svelte | 272 +- .../(idaa)/archives/[archive_id]/+page.svelte | 750 +-- .../(idaa)/archives/[archive_id]/+page.ts | 83 +- ...a_comp__archive_content_obj_id_edit.svelte | 1778 +++--- ...e_idaa_comp__archive_content_obj_li.svelte | 610 +- .../ae_idaa_comp__archive_obj_id_edit.svelte | 1198 ++-- .../ae_idaa_comp__archive_obj_id_view.svelte | 402 +- .../ae_idaa_comp__modal_media_player.svelte | 142 +- .../archives/[archive_id]/not_used+layout.ts | 2 +- .../ae_idaa_comp__archive_obj_li.svelte | 198 +- .../ae_idaa_comp__media_player.svelte | 253 +- src/routes/idaa/(idaa)/bb/+layout.svelte | 154 +- src/routes/idaa/(idaa)/bb/+layout.ts | 96 +- src/routes/idaa/(idaa)/bb/+page.svelte | 358 +- src/routes/idaa/(idaa)/bb/+page.ts | 60 +- .../idaa/(idaa)/bb/[post_id]/+page.svelte | 465 +- src/routes/idaa/(idaa)/bb/[post_id]/+page.ts | 74 +- ...idaa_comp__post_comment_obj_id_edit.svelte | 1490 ++--- .../bb/ae_idaa_comp__post_obj_id_edit.svelte | 2071 +++---- .../bb/ae_idaa_comp__post_obj_id_view.svelte | 666 ++- .../bb/ae_idaa_comp__post_obj_li.svelte | 318 +- .../bb/ae_idaa_comp__post_options.svelte | 394 +- src/routes/idaa/(idaa)/hold_app.pcss | 530 +- .../(idaa)/recovery_meetings/+layout.svelte | 150 +- .../idaa/(idaa)/recovery_meetings/+layout.ts | 82 +- .../(idaa)/recovery_meetings/+page.svelte | 818 +-- .../recovery_meetings/[event_id]/+page.svelte | 410 +- .../recovery_meetings/[event_id]/+page.ts | 72 +- .../ae_idaa_comp__event_obj_id_edit.svelte | 4791 +++++++-------- .../ae_idaa_comp__event_obj_id_view.svelte | 912 +-- .../ae_idaa_comp__event_obj_li.svelte | 945 +-- .../ae_idaa_comp__event_obj_li_wrapper.svelte | 220 +- .../ae_idaa_comp__event_obj_qry.svelte | 1168 ++-- src/routes/idaa/+layout.svelte | 618 +- src/routes/journals/+layout.svelte | 570 +- src/routes/journals/+layout.ts | 42 +- src/routes/journals/+page.svelte | 475 +- src/routes/journals/+page.ts | 94 +- .../journals/[journal_id]/+layout.svelte | 610 +- src/routes/journals/[journal_id]/+layout.ts | 136 +- src/routes/journals/[journal_id]/+page.svelte | 586 +- src/routes/journals/[journal_id]/+page.ts | 130 +- .../entry/[journal_entry_id]/+page.svelte | 502 +- .../entry/[journal_entry_id]/+page.ts | 114 +- .../ae_comp__journal_entry_obj_file_li.svelte | 575 +- .../ae_comp__journal_entry_obj_id_view.svelte | 5190 +++++++++-------- .../ae_comp__journal_entry_obj_li.svelte | 1437 ++--- .../ae_comp__journal_entry_obj_qry.svelte | 372 +- .../ae_comp__journal_obj_id_edit.svelte | 2289 ++++---- .../ae_comp__journal_obj_id_view.svelte | 508 +- .../journals/ae_comp__journal_obj_li.svelte | 222 +- .../journals/ae_comp__obj_core_props.svelte | 673 +-- .../journals/modal_journals_config.svelte | 676 +-- src/routes/testing/+page.svelte | 261 +- static/idaa_novi_iframe_archives.html | 202 +- static/idaa_novi_iframe_bulletin_board.html | 228 +- static/idaa_novi_iframe_jitsi_meeting.html | 237 +- .../idaa_novi_iframe_recovery_meetings.html | 250 +- static/jitsi_iframe_api.html | 218 +- static/manifest.json | 178 +- svelte.config.js | 58 +- test-results/.last-run.json | 4 +- tests/example.test.ts | 16 +- tsconfig.json | 48 +- vite.config.ts | 8 +- vitest.config.ts | 8 +- 346 files changed, 86645 insertions(+), 84459 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 0b757582..8b6d78d3 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,31 +1,31 @@ /** @type { import("eslint").Linter.Config } */ module.exports = { - root: true, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:svelte/recommended', - 'prettier' - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020, - extraFileExtensions: ['.svelte'] - }, - env: { - browser: true, - es2017: true, - node: true - }, - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser' - } - } - ] + root: true, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:svelte/recommended', + 'prettier' + ], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020, + extraFileExtensions: ['.svelte'] + }, + env: { + browser: true, + es2017: true, + node: true + }, + overrides: [ + { + files: ['*.svelte'], + parser: 'svelte-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser' + } + } + ] }; diff --git a/.prettierrc b/.prettierrc index f98a0aa8..ca372a3f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,9 @@ { - "useTabs": false, - "tabWidth": 4, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100, - "plugins": ["prettier-plugin-svelte"], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] + "useTabs": false, + "tabWidth": 4, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 019958ab..ba495aa2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,119 +1,119 @@ { - "prettier.documentSelectors": ["**/*.svelte"], - "tailwindCSS.classAttributes": [ - "class", - "accent", - "active", - "animIndeterminate", - "aspectRatio", - "background", - "badge", - "bgBackdrop", - "bgDark", - "bgDrawer", - "bgLight", - "blur", - "border", - "button", - "buttonAction", - "buttonBack", - "buttonClasses", - "buttonComplete", - "buttonDismiss", - "buttonNeutral", - "buttonNext", - "buttonPositive", - "buttonTextCancel", - "buttonTextConfirm", - "buttonTextFirst", - "buttonTextLast", - "buttonTextNext", - "buttonTextPrevious", - "buttonTextSubmit", - "caretClosed", - "caretOpen", - "chips", - "color", - "controlSeparator", - "controlVariant", - "cursor", - "display", - "element", - "fill", - "fillDark", - "fillLight", - "flex", - "flexDirection", - "gap", - "gridColumns", - "height", - "hover", - "inactive", - "indent", - "justify", - "meter", - "padding", - "position", - "regionAnchor", - "regionBackdrop", - "regionBody", - "regionCaption", - "regionCaret", - "regionCell", - "regionChildren", - "regionChipList", - "regionChipWrapper", - "regionCone", - "regionContent", - "regionControl", - "regionDefault", - "regionDrawer", - "regionFoot", - "regionFootCell", - "regionFooter", - "regionHead", - "regionHeadCell", - "regionHeader", - "regionIcon", - "regionInput", - "regionInterface", - "regionInterfaceText", - "regionLabel", - "regionLead", - "regionLegend", - "regionList", - "regionListItem", - "regionNavigation", - "regionPage", - "regionPanel", - "regionRowHeadline", - "regionRowMain", - "regionSummary", - "regionSymbol", - "regionTab", - "regionTrail", - "ring", - "rounded", - "select", - "shadow", - "slotDefault", - "slotFooter", - "slotHeader", - "slotLead", - "slotMessage", - "slotMeta", - "slotPageContent", - "slotPageFooter", - "slotPageHeader", - "slotSidebarLeft", - "slotSidebarRight", - "slotTrail", - "spacing", - "text", - "track", - "transition", - "width", - "zIndex" - ], - "explorer.fileNesting.enabled": false + "prettier.documentSelectors": ["**/*.svelte"], + "tailwindCSS.classAttributes": [ + "class", + "accent", + "active", + "animIndeterminate", + "aspectRatio", + "background", + "badge", + "bgBackdrop", + "bgDark", + "bgDrawer", + "bgLight", + "blur", + "border", + "button", + "buttonAction", + "buttonBack", + "buttonClasses", + "buttonComplete", + "buttonDismiss", + "buttonNeutral", + "buttonNext", + "buttonPositive", + "buttonTextCancel", + "buttonTextConfirm", + "buttonTextFirst", + "buttonTextLast", + "buttonTextNext", + "buttonTextPrevious", + "buttonTextSubmit", + "caretClosed", + "caretOpen", + "chips", + "color", + "controlSeparator", + "controlVariant", + "cursor", + "display", + "element", + "fill", + "fillDark", + "fillLight", + "flex", + "flexDirection", + "gap", + "gridColumns", + "height", + "hover", + "inactive", + "indent", + "justify", + "meter", + "padding", + "position", + "regionAnchor", + "regionBackdrop", + "regionBody", + "regionCaption", + "regionCaret", + "regionCell", + "regionChildren", + "regionChipList", + "regionChipWrapper", + "regionCone", + "regionContent", + "regionControl", + "regionDefault", + "regionDrawer", + "regionFoot", + "regionFootCell", + "regionFooter", + "regionHead", + "regionHeadCell", + "regionHeader", + "regionIcon", + "regionInput", + "regionInterface", + "regionInterfaceText", + "regionLabel", + "regionLead", + "regionLegend", + "regionList", + "regionListItem", + "regionNavigation", + "regionPage", + "regionPanel", + "regionRowHeadline", + "regionRowMain", + "regionSummary", + "regionSymbol", + "regionTab", + "regionTrail", + "ring", + "rounded", + "select", + "shadow", + "slotDefault", + "slotFooter", + "slotHeader", + "slotLead", + "slotMessage", + "slotMeta", + "slotPageContent", + "slotPageFooter", + "slotPageHeader", + "slotSidebarLeft", + "slotSidebarRight", + "slotTrail", + "spacing", + "text", + "track", + "transition", + "width", + "zIndex" + ], + "explorer.fileNesting.enabled": false } diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 82804732..136e3b86 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -9,16 +9,16 @@ The Aether project is a Svelte and SvelteKit based application, utilizing Tailwi ## 2. Core Technologies - **Frontend Framework:** Svelte 5 and SvelteKit v2 - - **Routing:** SvelteKit's file-system based routing. + - **Routing:** SvelteKit's file-system based routing. - **Styling:** Tailwind CSS 3.x (with plans to upgrade to 4.x when ShadCN is ready) - **UI Component Libraries:** - - Skeleton (Design System, Tailwind Components, Functional Components - with plans to upgrade to v3) - - Flowbite (Tailwind Components) - - **Note:** ShadCN is currently used but is planned for removal. + - Skeleton (Design System, Tailwind Components, Functional Components - with plans to upgrade to v3) + - Flowbite (Tailwind Components) + - **Note:** ShadCN is currently used but is planned for removal. - **Text/Code Editors:** - - CodeMirror 6.x (primary text and code editor, planned for rich text editing) - - Edra (TipTap based Rich Text Editor) - - **Note:** ShadEditor TipTap is present but marked for removal, with CodeMirror being the preferred solution for all text editing needs. + - CodeMirror 6.x (primary text and code editor, planned for rich text editing) + - Edra (TipTap based Rich Text Editor) + - **Note:** ShadEditor TipTap is present but marked for removal, with CodeMirror being the preferred solution for all text editing needs. - **Icons:** Lucide Icons (SVG Icons) - **Markdown Parsing:** `marked` library - **State Management:** Svelte stores, potentially with `liveQuery` from Dexie for reactive IndexedDB interactions. @@ -139,4 +139,4 @@ A list of potential future standard fields, often prefixed with `obj_`. These ar - `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. - - **Note:** Care must be taken when binding to `lqw__xyz_obj` to manage updates and potential conflicts with the underlying liveQuery. + - **Note:** Care must be taken when binding to `lqw__xyz_obj` to manage updates and potential conflicts with the underlying liveQuery. diff --git a/COMPONENTS.md b/COMPONENTS.md index 4bc2f67c..f82e41fe 100644 --- a/COMPONENTS.md +++ b/COMPONENTS.md @@ -12,63 +12,63 @@ These components are part of the core application shell and provide global funct - **`main/module`s**: Main content area for modules. - **`footer`**: Application-wide footer. - **`app`**: Provides global application functionalities such as: - - Refresh application state. - - Clear IndexedDB. - - Clear local storage (settings). - - Toggle iframe visibility (also updates URL parameter). - - Copy current URL. - - Generate and display QR codes. + - Refresh application state. + - Clear IndexedDB. + - Clear local storage (settings). + - Toggle iframe visibility (also updates URL parameter). + - Copy current URL. + - Generate and display QR codes. - **`menu`**: Various menus for different purposes: - - **`mode`**: Edit mode toggle, more options (all or details). - - **`access_type`**: Passcode input, clear access. - - **`user`**: Sign in/out, reset password, email link, change username and email. - - **`theme`**: Mode (light/dark), name (theme list). + - **`mode`**: Edit mode toggle, more options (all or details). + - **`access_type`**: Passcode input, clear access. + - **`user`**: Sign in/out, reset password, email link, change username and email. + - **`theme`**: Mode (light/dark), name (theme list). - **`debug`**: Developer-facing tools: - - Toggle debug mode (also updates URL parameter). - - Show core and module storages. - - Manually set initial timestamp. + - Toggle debug mode (also updates URL parameter). + - Show core and module storages. + - Manually set initial timestamp. - **`scroll_to`**: Navigation controls for scrolling: - - Scroll to top of the page. - - Scroll page up. - - Scroll page down. - - Scroll to bottom of the page. + - Scroll to top of the page. + - Scroll page up. + - Scroll page down. + - Scroll to bottom of the page. ### 1.2. Core Components 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`. + - Properties: `clipboard`, `bind:value`, `btn_text`, `btn_html`. - **`txt_editor`**: A basic text area editor. - **`md_editor`**: Markdown editor. - - Uses CodeMirror (planned for rich text editing). - - **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). + - **Note:** ShadEditor TipTap is present but marked for removal. ShadCN components are also being phased out in favor of CodeMirror for text editing. - **`html_editor`**: HTML editor. - **`media_player`**: Component for playing media files. - - Properties: `hosted_file`, `archive_content`, `media_player`. - - Bindings: `bind:host_id`, `bind:media_type`. - - Status: `stopped`, `paused`, `playing`. + - Properties: `hosted_file`, `archive_content`, `media_player`. + - Bindings: `bind:host_id`, `bind:media_type`. + - Status: `stopped`, `paused`, `playing`. - **`hosted_file_li`**: Manages a list of hosted files, making them available for selection. - **`hosted_file_link_to`**: Lists links per object, with bindings to add/remove links. - **`upload_to_host`**: Component for uploading files to the host. - - Handles multiple files. - - Properties: `link_type`, `link_id`, `inner fragment` (label html). - - Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. - - Status: `started`, `uploading`, `finished`. + - Handles multiple files. + - Properties: `link_type`, `link_id`, `inner fragment` (label html). + - Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. + - Status: `started`, `uploading`, `finished`. - **`upload_file_tbl`**: Table for uploaded files, includes checks for duplicate file hashes and removal from the list. - **`download_from_host`**: Component for downloading files from the host. - - Bindings: `bind:host_file_id`, `bind:filename`, `bind:file_ext`. - - Properties: `btn inner fragment`. - - Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. - - Status: `started`, `downloading`, `finished`. + - Bindings: `bind:host_file_id`, `bind:filename`, `bind:file_ext`. + - Properties: `btn inner fragment`. + - Bindings: `bind:trigger`, `bind:show_spinner`, `bind:show_percent`. + - Status: `started`, `downloading`, `finished`. - **`data_store`**: Component for interacting with data stores. - **`ae_crud`**: Generic CRUD (Create, Read, Update, Delete) component. - - **Note:** Needs simplification. - - Properties: `obj`, `prop`, `current_value`. - - Bindings: `bind:value`, `bind:trigger`, `inner fragment`. + - **Note:** Needs simplification. + - Properties: `obj`, `prop`, `current_value`. + - Bindings: `bind:value`, `bind:trigger`, `inner fragment`. - **`ae_obj_prop_val`**: A wrapper for a function to manage object property values. - - 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`. - - 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`. + - Status: `status`, `result`. - **`sql_qry`**: Component for executing SQL queries. - **`obj_tbl`**: Object SQL results table or similar. - **`qr_scanner`**: Component for scanning QR codes. @@ -79,8 +79,8 @@ These are reusable components that provide common functionalities across differe These are components specific to main application sections or individual modules. - **`menu`**: - - **`options`**: Various settings, show/hide content and options, limit, sorting options. - - **`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 @@ -91,31 +91,31 @@ A standardized menu for interacting with objects. - **Actions:** `create`, `view`, `edit`, `update`, `hide`, `disable`, `delete`, `alert` (message), `archive` (not yet ready). - **Future Actions:** `copy`, `import`. - **Sort Options:** - - `[default]`: `group > priority > sort (ASC/DESC) > alert > name` - - `[sort_updated]`: `group > priority > sort (ASC/DESC) > alert > updated_on > created_on` - - `[priority_updated]`: `group > priority > updated_on (ASC/DESC) > created_on` - - `[priority_name]`: `group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on` - - `[name]`: `priority > name (ASC/DESC) > sort > alert > updated_on > created_on` - - `[created_on]`: `priority > created_on (ASC/DESC)` - - `[updated_on]`: `priority > updated_on (ASC/DESC) > created_on` + - `[default]`: `group > priority > sort (ASC/DESC) > alert > name` + - `[sort_updated]`: `group > priority > sort (ASC/DESC) > alert > updated_on > created_on` + - `[priority_updated]`: `group > priority > updated_on (ASC/DESC) > created_on` + - `[priority_name]`: `group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on` + - `[name]`: `priority > name (ASC/DESC) > sort > alert > updated_on > created_on` + - `[created_on]`: `priority > created_on (ASC/DESC)` + - `[updated_on]`: `priority > updated_on (ASC/DESC) > created_on` ## 2. Pop-ups Standardized structure for various types of pop-up elements. - **`modal_header`**: - - `title` - - `close` button + - `title` + - `close` button - **`modal_main`**: Main content area of the modal. - **`modal_meta`**: Meta-information section. - **`modal_footer`**: - - `close` button + - `close` button - **`Pop-up Modal (blocking)`**: A modal that blocks interaction with the rest of the page. - - `modal position` + - `modal position` - **`Pop-up Modal Inline`**: A modal that appears inline with content. - - `inline`, `inline-block`, `block` display options. + - `inline`, `inline-block`, `block` display options. - **`Pop-up Dialog`**: A dialog box. - - `dialog position` + - `dialog position` ## 3. Containers diff --git a/DATA_STRUCTURES.md b/DATA_STRUCTURES.md index 34c3165a..58121fba 100644 --- a/DATA_STRUCTURES.md +++ b/DATA_STRUCTURES.md @@ -87,4 +87,4 @@ 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. - - **Note:** When using `lqw__xyz_obj`, developers must carefully manage updates to avoid conflicts with the underlying liveQuery and ensure data integrity. + - **Note:** When using `lqw__xyz_obj`, developers must carefully manage updates to avoid conflicts with the underlying liveQuery and ensure data integrity. diff --git a/GEMINI.md b/GEMINI.md index a75c2c2d..a17475ee 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -13,10 +13,10 @@ Core Aether modules Additional Aether modules - events - - presentation management - import the program data (events, session, presentations, presenters, event files, locations/rooms, devices) - - 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. - - badge printing - - lead retrieval - attendee tracking; QR codes + - presentation management - import the program data (events, session, presentations, presenters, event files, locations/rooms, devices) + - 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. + - badge printing + - lead retrieval - attendee tracking; QR codes - journals - journal, documentation, notes, diary, blog, etc - idaa - One of my clients @@ -49,18 +49,18 @@ The refactoring strategy involved creating a local, non-exported `_process_gener **Key aspects of the refactoring:** - **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. - - **`tmp_sort` Field Generation:** It creates a set of basic `tmp_sort` fields for client-side sorting. + - **`*_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. - **`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. - - **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. + - **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`). + - **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: - - 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.). - - 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. + - 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.). + - 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. ### Tiptap to CodeMirror Migration (2025-11-17) diff --git a/NAMING_CONVENTIONS.md b/NAMING_CONVENTIONS.md index 1ee2abda..99262e75 100644 --- a/NAMING_CONVENTIONS.md +++ b/NAMING_CONVENTIONS.md @@ -13,46 +13,46 @@ - **Database Definition Files:** `db_.ts` (e.g., `db_core.ts`, `db_journals.ts`) - **Svelte Store Files:** `ae__stores.ts` (e.g., `ae_core_stores.ts`, `ae_journals_stores.ts`) - **Svelte Components:** - - **Module-specific components:** `ae_comp____.svelte` (e.g., `ae_comp__events__event_card.svelte`) - - **Generic/reusable components:** `element_.svelte` (e.g., `element_input_file.svelte`, `element_qr_scanner_v2.svelte`) + - **Module-specific components:** `ae_comp____.svelte` (e.g., `ae_comp__events__event_card.svelte`) + - **Generic/reusable components:** `element_.svelte` (e.g., `element_input_file.svelte`, `element_qr_scanner_v2.svelte`) - **SvelteKit Routes:** Follow SvelteKit's standard routing conventions (e.g., `+page.svelte`, `+layout.svelte`, `[id]/+page.svelte`). - **CSS Files:** `ae--.css` (e.g., `ae-c-idaa-light.css`, `ae-osit-default.css`) ## 3. Function and Variable Naming - **Style:** Strictly `snake_case` for all function and variable names. - - **Deprecated:** `camelCase` should be refactored to `snake_case`. + - **Deprecated:** `camelCase` should be refactored to `snake_case`. - **Prefixes:** - - `load_ae_obj_id__`: For loading a single Aether object by ID. - - `load_ae_obj_li__`: For loading a list of Aether objects. - - `create_ae_obj__`: For creating an Aether object. - - `update_ae_obj__`: For updating an Aether object. - - `delete_ae_obj_id__`: For deleting an Aether object by ID. - - `db_save_ae_obj_li__`: For saving a list of Aether objects to IndexedDB. - - `db_update_ae_obj_id__`: For updating an Aether object in IndexedDB. - - `process_ae_obj___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`). + - `load_ae_obj_id__`: For loading a single Aether object by ID. + - `load_ae_obj_li__`: For loading a list of Aether objects. + - `create_ae_obj__`: For creating an Aether object. + - `update_ae_obj__`: For updating an Aether object. + - `delete_ae_obj_id__`: For deleting an Aether object by ID. + - `db_save_ae_obj_li__`: For saving a list of Aether objects to IndexedDB. + - `db_update_ae_obj_id__`: For updating an Aether object in IndexedDB. + - `process_ae_obj___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 - **Singularity:** Use singular nouns for objects and properties (e.g., `example.id`, not `examples.id`). - **IDs:** - - `id`: Primary key for an object (internal use, often a UUID). - - `_id`: Specific ID for an object (e.g., `person_id`). - - `_id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters). - - `account_id`, `site_id`, `user_id`, etc.: Foreign keys. + - `id`: Primary key for an object (internal use, often a UUID). + - `_id`: Specific ID for an object (e.g., `person_id`). + - `_id_random`: Randomly generated ID for an object (often used for external exposure or URL parameters). + - `account_id`, `site_id`, `user_id`, etc.: Foreign keys. - **Common Properties:** - - `code`: Short, unique identifier. - - `name`: Display name. - - `description`: Longer text description. - - `enable`: Boolean for active/inactive status. - - `hide`: Boolean for visibility. - - `priority`: Numeric value for ordering. - - `sort`: Numeric value for ordering. - - `group`: Categorization string. - - `notes`: General notes/comments. - - `created_on`: Timestamp of creation. - - `updated_on`: Timestamp of last update. + - `code`: Short, unique identifier. + - `name`: Display name. + - `description`: Longer text description. + - `enable`: Boolean for active/inactive status. + - `hide`: Boolean for visibility. + - `priority`: Numeric value for ordering. + - `sort`: Numeric value for ordering. + - `group`: Categorization string. + - `notes`: General notes/comments. + - `created_on`: Timestamp of creation. + - `updated_on`: Timestamp of last update. - **Special Use Properties:** `for_type`, `for_id`, `archive_on`, `passcode`, `external_id`. - **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). @@ -82,12 +82,12 @@ ## 10. Local Storage and IndexedDB Keys - **Local Storage:** - - `api` - - `app` (global) - - `core` (core modules) - - `` (extended modules) - - `` (custom modules) + - `api` + - `app` (global) + - `core` (core modules) + - `` (extended modules) + - `` (custom modules) - **IndexedDB:** - - `ae_core_db` - - `` - - `` + - `ae_core_db` + - `` + - `` diff --git a/OLD_README_guidelines_ui_ux.md b/OLD_README_guidelines_ui_ux.md index 61470890..650e3a3e 100644 --- a/OLD_README_guidelines_ui_ux.md +++ b/OLD_README_guidelines_ui_ux.md @@ -22,45 +22,45 @@ - [md_editor] CodeMirror, ShadEditor TipTap (need to remove) - [html_editor] - [media_player] - - hosted_file archive_content media_player, - - bind:host_id, - - bind:media_type - - status - stopped, paused, playing + - hosted_file archive_content media_player, + - bind:host_id, + - bind:media_type + - status - stopped, paused, playing - [hosted_file_li] manage_hosted_file_li, make available for selection - [hosted_file_link_to] list links per object, bind:add link, bind:remove link - [upload_to_host] - input_hosted_file; needs to handle multiple files - - link_type, - - link_id, - - inner fragment - label html - - bind:trigger - - bind:show_spinner - - bind:show_percent - - status - - result - started, uploading, finished + - link_type, + - link_id, + - inner fragment - label html + - bind:trigger + - bind:show_spinner + - bind:show_percent + - status + - result - started, uploading, finished - [upload_file_tbl] input_hosted_file_tbl, check for dup file hash, remove from list - [download_from_host] - - bind:host_file_id - - bind:filename - - bind:file_ext - - btn inner fragment - - bind:trigger - - bind:show_spinner - - bind:show_percent - - status - - result - started, downloading, finished + - bind:host_file_id + - bind:filename + - bind:file_ext + - btn inner fragment + - bind:trigger + - bind:show_spinner + - bind:show_percent + - status + - result - started, downloading, finished - [data_store] - [ae_crud] need to simplify! obj, prop, current_value, bind:value, bind:trigger, inner fragment - [ae_obj_prop_val] - essentially a wrapper for the function - - bind:obj_type - - bind:obj_id - - bind:obj_prop - - bind:obj_value - - bind:obj_new_value - - bind:trigger - - bind:show_spinner - - bind:show_percent - - status - - result + - bind:obj_type + - bind:obj_id + - bind:obj_prop + - bind:obj_value + - bind:obj_new_value + - bind:trigger + - bind:show_spinner + - bind:show_percent + - status + - result - [sql_qry] - [obj_tbl] obj sql results tbl or similar - [qr_scanner] @@ -78,23 +78,23 @@ - actions: create, view, edit, update, hide, disable, delete, alert (message), archive (not ready yet) - future actions: copy, import - sort options: - - [default] group > priority > sort (ASC/DESC) > alert > name - - [sort_updated] group > priority > sort (ASC/DESC) > alert > updated_on > created_on - - [priority_updated] group > priority > updated_on (ASC/DESC) > created_on - - [priority_name] group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on - - [name] priority > name (ASC/DESC) > sort > alert > updated_on > created_on - - [created_on] priority > created_on (ASC/DESC) - - [updated_on] priority > updated_on (ASC/DESC) > created_on + - [default] group > priority > sort (ASC/DESC) > alert > name + - [sort_updated] group > priority > sort (ASC/DESC) > alert > updated_on > created_on + - [priority_updated] group > priority > updated_on (ASC/DESC) > created_on + - [priority_name] group > priority > name (ASC/DESC) > sort > alert > updated_on > created_on + - [name] priority > name (ASC/DESC) > sort > alert > updated_on > created_on + - [created_on] priority > created_on (ASC/DESC) + - [updated_on] priority > updated_on (ASC/DESC) > created_on ### Pop-ups: - modal_header - - title - - close + - title + - close - modal_main - modal_meta - modal_footer - - close + - close #### Pop-up Modal (blocking) diff --git a/OLD_README_guidelines_v2.md b/OLD_README_guidelines_v2.md index ad854e47..e167724e 100644 --- a/OLD_README_guidelines_v2.md +++ b/OLD_README_guidelines_v2.md @@ -118,54 +118,56 @@ Sort of related.... more permission/security though: Create a new table that wil ```ts let lq__post_obj = $derived( - liveQuery(async () => { - if (log_lvl) { - console.log(`lq__post_obj: post_id = ${$idaa_slct?.post_id}`); - } - let results = await db_posts.post.get($idaa_slct.post_id ?? ''); // null or undefined does not reset things like '' does + liveQuery(async () => { + if (log_lvl) { + console.log(`lq__post_obj: post_id = ${$idaa_slct?.post_id}`); + } + let results = await db_posts.post.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 - if ($idaa_slct.post_obj && results) { - if (JSON.stringify($idaa_slct.post_obj) !== JSON.stringify(results)) { - $idaa_slct.post_obj = { ...results }; - if (log_lvl) { - console.log(`$idaa_slct.post_obj = `, $idaa_slct.post_obj); - } - } else { - if (log_lvl) { - console.log(`Post object has not changed for post_id: ${$idaa_slct.post_id}`); - } - } - } + // Check if results are different than the current $idaa_slct.post_obj + if ($idaa_slct.post_obj && results) { + if (JSON.stringify($idaa_slct.post_obj) !== JSON.stringify(results)) { + $idaa_slct.post_obj = { ...results }; + if (log_lvl) { + console.log(`$idaa_slct.post_obj = `, $idaa_slct.post_obj); + } + } else { + if (log_lvl) { + console.log(`Post object has not changed for post_id: ${$idaa_slct.post_id}`); + } + } + } - return results; - }) + return results; + }) ); let lq__post_comment_obj_li = $derived( - liveQuery(async () => { - let results = await db_posts.comment - .where('post_id') - .equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does - .reverse() - .sortBy('updated_on'); - // .sortBy('title'); + liveQuery(async () => { + let results = await db_posts.comment + .where('post_id') + .equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does + .reverse() + .sortBy('updated_on'); + // .sortBy('title'); - 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]; - if (log_lvl) { - console.log(`$idaa_slct.post_comment_obj_li = `, $idaa_slct.post_comment_obj_li); - } - } else { - if (log_lvl) { - console.log(`Post comment object list has not changed for post_id: ${$idaa_slct.post_id}`); - } - } + 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]; + if (log_lvl) { + console.log(`$idaa_slct.post_comment_obj_li = `, $idaa_slct.post_comment_obj_li); + } + } else { + if (log_lvl) { + console.log( + `Post comment object list has not changed for post_id: ${$idaa_slct.post_id}` + ); + } + } - return results; - }) + return results; + }) ); ``` diff --git a/README.md b/README.md index 9152a35b..0439fb34 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ I am slowly switching from Font-Awesome to Lucide ## Tiptap Editor - Eventually use Edra? https://edra.tsuzat.com/ - - Best Rich Text Editor, made for Svelte Developers with Tiptap - - ShadEditor is "evolving" to be Edra. + - Best Rich Text Editor, made for Svelte Developers with Tiptap + - ShadEditor is "evolving" to be Edra. - 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) diff --git a/SVELTE_DEXIE_GUIDE.md b/SVELTE_DEXIE_GUIDE.md index 0ed74f2c..d423ed1d 100644 --- a/SVELTE_DEXIE_GUIDE.md +++ b/SVELTE_DEXIE_GUIDE.md @@ -23,23 +23,23 @@ Dexie.js is a lightweight, minimalistic wrapper for IndexedDB that makes it easi ### Key Classes and Methods - **`Dexie`:** The main class for creating and managing IndexedDB databases. - - `new Dexie(databaseName)`: Creates a new database instance. - - `version(versionNumber).stores({ ... })`: Defines the database schema. + - `new Dexie(databaseName)`: Creates a new database instance. + - `version(versionNumber).stores({ ... })`: Defines the database schema. - **`Table`:** Represents an object store (table) in the database. - - `add(item)`: Adds a new item to the table. - - `put(item)`: Adds or updates an item in the table. - - `update(key, changes)`: Updates an existing item. - - `delete(key)`: Deletes an item by its primary key. - - `get(key)`: Retrieves an item by its primary key. - - `where(index)`: Starts a query using an index. - - `toArray()`: Retrieves all items from the table as an array. + - `add(item)`: Adds a new item to the table. + - `put(item)`: Adds or updates an item in the table. + - `update(key, changes)`: Updates an existing item. + - `delete(key)`: Deletes an item by its primary key. + - `get(key)`: Retrieves an item by its primary key. + - `where(index)`: Starts a query using an index. + - `toArray()`: Retrieves all items from the table as an array. - **`Collection`:** Represents a collection of items resulting from a query. - - `toArray()`: Retrieves all items in the collection as an array. - - `first()`: Retrieves the first item in the collection. - - `last()`: Retrieves the last item in the collection. - - `each(callback)`: Iterates over each item in the collection. - - `modify(changes)`: Updates all items in the collection. - - `delete()`: Deletes all items in the collection. + - `toArray()`: Retrieves all items in the collection as an array. + - `first()`: Retrieves the first item in the collection. + - `last()`: Retrieves the last item in the collection. + - `each(callback)`: Iterates over each item in the collection. + - `modify(changes)`: Updates 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). @@ -63,13 +63,13 @@ import { readable } from 'svelte/store'; import { db } from './db'; // Your Dexie database instance export function createLiveQueryStore(query: () => T | Promise) { - return readable(undefined, (set) => { - const subscription = liveQuery(query).subscribe({ - next: (result) => set(result), - error: (error) => console.error(error) - }); - return () => subscription.unsubscribe(); - }); + return readable(undefined, (set) => { + const subscription = liveQuery(query).subscribe({ + next: (result) => set(result), + error: (error) => console.error(error) + }); + return () => subscription.unsubscribe(); + }); } ``` @@ -77,16 +77,16 @@ export function createLiveQueryStore(query: () => T | Promise) { ```html
    - {#if $friends} {#each $friends as friend} -
  • {friend.name}
  • - {/each} {/if} + {#if $friends} {#each $friends as friend} +
  • {friend.name}
  • + {/each} {/if}
``` diff --git a/TODO.md b/TODO.md index b089804c..2d3fb554 100644 --- a/TODO.md +++ b/TODO.md @@ -30,22 +30,22 @@ This is a list of tasks to be completed before the next event/show/conference. - [ ] **Goal:** Enforce a single, consistent naming standard across the entire codebase. - [ ] **Files:** - - Logic: `ae___.ts` - - DB Definitions: `db_.ts` - - Svelte Stores: `ae__stores.ts` - - Consolidate helper files (e.g., `ae_core_functions.ts`) into the above files. + - Logic: `ae___.ts` + - DB Definitions: `db_.ts` + - Svelte Stores: `ae__stores.ts` + - Consolidate helper files (e.g., `ae_core_functions.ts`) into the above files. - [ ] **Functions & Variables:** - - [x] Enforce `snake_case` for all function and variable names. - - [x] Deprecate and remove `camelCase`. - - [x] Deprecate and refactor ambiguous `handle_` prefixes. + - [x] Enforce `snake_case` for all function and variable names. + - [x] Deprecate and remove `camelCase`. + - [x] Deprecate and refactor ambiguous `handle_` prefixes. - [ ] **Object & Property Naming:** - - Use singular nouns for objects and properties (e.g., `example.id`, not `examples.id`). + - Use singular nouns for objects and properties (e.g., `example.id`, not `examples.id`). - [ ] **List Suffixes:** - - Use `_li` for simple, unordered arrays. - - Use `_kv` for key-value objects/maps. + - Use `_li` for simple, unordered arrays. + - Use `_kv` for key-value objects/maps. - [ ] **Process:** - - Refactor one module at a time to ensure internal consistency before moving to the next. Start with `ae_core`. - - **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. + - Refactor one module at a time to ensure internal consistency before moving to the next. Start with `ae_core`. + - **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 @@ -65,21 +65,21 @@ This is a list of tasks to be completed before the next event/show/conference. These functions are frequently used and critical to the application's data flow. Reviewing and cleaning them up will significantly improve the codebase. 1. **`get_ae_obj_li_for_obj_id_crud_v2()`** (from `src/lib/ae_api/api_get__crud_obj_li_v2.ts`) - - **Why:** This is the main function for fetching lists of data from the backend, used extensively across all modules. - - **Cleanup:** Review parameters and return types for consistency, improve error handling, and add more detailed logging for debugging. + - **Why:** This is the main function for fetching lists of data from the backend, used extensively across all modules. + - **Cleanup:** Review parameters and return types for consistency, improve error handling, and add more detailed logging for debugging. 2. **`db_save_ae_obj_li__ae_obj()`** (from `src/lib/ae_core/core__idb_dexie.ts`) - - **Why:** This function is the single point of entry for saving data to the local Dexie database, critical for performance and reliability. - - **Cleanup:** Optimize for bulk operations, add robust error handling and logging, and ensure correct handling of updates to existing objects. + - **Why:** This function is the single point of entry for saving data to the local Dexie database, critical for performance and reliability. + - **Cleanup:** Optimize for bulk operations, add robust error handling and logging, and ensure correct handling of updates to existing objects. 3. **The `process_ae_obj__*_props()` family of functions** (e.g., `process_ae_obj__journal_props()` from `src/lib/ae_journals/ae_journals__journal.ts`) - - **Why:** These functions transform API data for the frontend and are a common source of bugs and inconsistencies. - - **Cleanup:** Standardize their structure across all modules, ensure they are pure functions, and add unit tests for correctness. - - **Update 2025-11-13 (Temporary Rollback):** The previous refactoring of these functions has been temporarily rolled back due to an `InternalError`. `ae_core_functions.ts` has been restored. The new plan is to refactor these functions module by module, ensuring stability at each step. The generic CRUD functions in `core__crud_generic.ts` were simplified to remove data processing and caching, delegating those responsibilities to the module-specific functions. The deprecated `process_ae_obj__props` function in that file was left in place but is no longer used by the generic CRUD functions. + - **Why:** These functions transform API data for the frontend and are a common source of bugs and inconsistencies. + - **Cleanup:** Standardize their structure across all modules, ensure they are pure functions, and add unit tests for correctness. + - **Update 2025-11-13 (Temporary Rollback):** The previous refactoring of these functions has been temporarily rolled back due to an `InternalError`. `ae_core_functions.ts` has been restored. The new plan is to refactor these functions module by module, ensuring stability at each step. The generic CRUD functions in `core__crud_generic.ts` were simplified to remove data processing and caching, delegating those responsibilities to the module-specific functions. The deprecated `process_ae_obj__props` function in that file was left in place but is no longer used by the generic CRUD functions. 4. **Usage of `liveQuery` from Dexie** - - **Why:** `liveQuery` is powerful for reactive UIs, but current usage suggests complexity and potential issues. - - **Cleanup:** Review `liveQuery` usage throughout the application, simplify queries, and investigate reactivity issues. Consider wrapping `liveQuery` in a custom Svelte store for a more predictable interface. + - **Why:** `liveQuery` is powerful for reactive UIs, but current usage suggests complexity and potential issues. + - **Cleanup:** Review `liveQuery` usage throughout the application, simplify queries, and investigate reactivity issues. Consider wrapping `liveQuery` in a custom Svelte store for a more predictable interface. --- @@ -99,8 +99,8 @@ These functions are frequently used and critical to the application's data flow. - [ ] **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. - [ ] **UI:** - - [ ] Create a `+page.svelte` to list all accounts. - - [ ] Create a `[account_id]` dynamic route to view and edit account details. + - [ ] Create a `+page.svelte` to list all accounts. + - [ ] Create a `[account_id]` dynamic route to view and edit account details. ### 3. Site & Domain Management @@ -108,37 +108,37 @@ These functions are frequently used and critical to the application's data flow. - [ ] **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. - [ ] **UI:** - - [ ] Create a `+page.svelte` to list all sites. - - [ ] Create a `[site_id]` dynamic route to view and edit site details and manage associated domains. + - [ ] Create a `+page.svelte` to list all sites. + - [ ] Create a `[site_id]` dynamic route to view and edit site details and manage associated domains. ### 4. Person Management - [ ] **Enhance:** Improve the existing person management components under `/core/person`. - [ ] **UI:** - - [ ] Create a dedicated page for creating new person records. - - [ ] Add search and filtering capabilities to the person list. + - [ ] Create a dedicated page for creating new person records. + - [ ] Add search and filtering capabilities to the person list. ### 5. User Management - [ ] **Route:** Create a new route at `/core/users`. - [ ] **UI:** - - [ ] Create a `+page.svelte` to list all users. - - [ ] Create a `[user_id]` dynamic route to view and edit user details, including permissions. - - [ ] Implement a component to link users to person records. + - [ ] Create a `+page.svelte` to list all users. + - [ ] Create a `[user_id]` dynamic route to view and edit user details, including permissions. + - [ ] Implement a component to link users to person records. ### 6. Hosted File Management - [ ] **Route:** Create a new route at `/core/hosted_files`. - [ ] **UI:** - - [ ] Create a `+page.svelte` to list all hosted files with filters (e.g., by file type, uploader). - - [ ] Implement a file viewer for common file types. - - [ ] Add functionality to upload new files and associate them with other objects (e.g., a person, a journal entry). + - [ ] Create a `+page.svelte` to list all hosted files with filters (e.g., by file type, uploader). + - [ ] Implement a file viewer for common file types. + - [ ] Add functionality to upload new files and associate them with other objects (e.g., a person, a journal entry). ### 7. Shared Lookup Lists - [ ] **Route:** Create a new route at `/core/lookups`. - [ ] **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`). --- @@ -157,9 +157,9 @@ These functions are frequently used and critical to the application's data flow. - [ ] **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). - [ ] **User Experience (UX):** - - Implement better loading indicators and skeleton loaders. - - Provide clearer empty state messages (e.g., "No journals found, create one!"). - - Improve error handling and provide more informative error messages to the user. + - Implement better loading indicators and skeleton loaders. + - Provide clearer empty state messages (e.g., "No journals found, create one!"). + - Improve error handling and provide more informative error messages to the user. - [ ] **Encryption:** Review and enhance the encryption implementation for journal entries to ensure it is secure and user-friendly. - [ ] **Templates:** Fully implement and document the "templates" feature for creating new journals and entries. @@ -181,28 +181,28 @@ These functions are frequently used and critical to the application's data flow. ### Archives Module (`/idaa/archives`) - [ ] **UI/UX:** - - [ ] Add a loading indicator while archives are being fetched. - - [ ] Implement a more engaging "empty state" when no archives are available. + - [ ] Add a loading indicator while archives are being fetched. + - [ ] Implement a more engaging "empty state" when no archives are available. - [ ] **Performance:** - - [ ] Implement pagination or infinite scrolling for the archive list. + - [ ] Implement pagination or infinite scrolling for the archive list. ### Bulletin Board Module (`/idaa/bb`) - [ ] **UI/UX:** - - [ ] Improve the UI for creating and editing posts and comments. - - [x] Add a rich text editor for a better writing experience. + - [ ] Improve the UI for creating and editing posts and comments. + - [x] Add a rich text editor for a better writing experience. - [ ] **Features:** - - [ ] 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`) - [ ] **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:** - - [ ] Make the search and filtering interface more intuitive and responsive. - - [ ] Provide instant feedback to the user as they type in the search box. + - [ ] Make the search and filtering interface more intuitive and responsive. + - [ ] Provide instant feedback to the user as they type in the search box. - [ ] **Performance:** - - [ ] Optimize the search query to be faster and more efficient. + - [ ] Optimize the search query to be faster and more efficient. --- @@ -217,28 +217,28 @@ These functions are frequently used and critical to the application's data flow. ### Core Event Management - [ ] **Event List (`/events`):** - - [ ] Add search and filtering capabilities to the main event list. - - [ ] Implement pagination for the event list. + - [ ] Add search and filtering capabilities to the main event list. + - [ ] Implement pagination for the event list. - [ ] **Event Creation/Editing:** - - [ ] 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]/...`) - [ ] **Sessions, Presentations, Presenters, etc.:** - - [ ] For each sub-module (sessions, presentations, etc.), implement a consistent set of features: - - [ ] List view with search and filtering. - - [ ] Detail view. - - [ ] Create and edit forms. - - [ ] Delete functionality with confirmation. + - [ ] For each sub-module (sessions, presentations, etc.), implement a consistent set of features: + - [ ] List view with search and filtering. + - [ ] Detail view. + - [ ] Create and edit forms. + - [ ] Delete functionality with confirmation. - [ ] **File Management:** - - [ ] 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. + - [ ] 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. - [ ] \*\*Launcher (`/events/[event_id]/launcher`): - - [ ] Add documentation to explain the purpose and usage of the launcher. - - [ ] Improve the UI to make it more intuitive for users. + - [ ] Add documentation to explain the purpose and usage of the launcher. + - [ ] Improve the UI to make it more intuitive for users. - [ ] \*\*Badges (`/events/[event_id]/badges`): - - [ ] Enhance the badge printing interface with more customization options. - - [ ] Add a preview of the badge before printing. + - [ ] Enhance the badge printing interface with more customization options. + - [ ] Add a preview of the badge before printing. ### Performance @@ -250,14 +250,14 @@ These functions are frequently used and critical to the application's data flow. ## UI/UX Consistency - [ ] **Broad UI/UX Review:** Conduct a comprehensive review of UI elements across the application to ensure consistency. This includes, but is not limited to: - - Buttons (style, placement, wording) - - Lists (style, actions) - - Links vs. Buttons (correct semantic usage) - - Menus (style, options) - - Debug components and other developer-facing UI. - - **Wording:** Standardize the text used in common UI elements (e.g., "Save", "Cancel", "Delete", "Add New"). - - **Scope:** This should be done on a per-module basis to ensure local consistency, with a goal of achieving global consistency where possible. - - **Note on IDAA:** The `idaa` modules are semi-custom for a client and may have their own specific UI/UX requirements. Their consistency should be evaluated separately, keeping the client's needs in mind. + - Buttons (style, placement, wording) + - Lists (style, actions) + - Links vs. Buttons (correct semantic usage) + - Menus (style, options) + - Debug components and other developer-facing UI. + - **Wording:** Standardize the text used in common UI elements (e.g., "Save", "Cancel", "Delete", "Add New"). + - **Scope:** This should be done on a per-module basis to ensure local consistency, with a goal of achieving global consistency where possible. + - **Note on IDAA:** The `idaa` modules are semi-custom for a client and may have their own specific UI/UX requirements. Their consistency should be evaluated separately, keeping the client's needs in mind. --- @@ -280,81 +280,81 @@ These are just quick notes, thoughts, ideas, and reminders for myself. ### Events modules and main landing pages - **Presentation Management** - - Manage - - Session Search - - View Session - - View Presenter - - Locations List - - View Location - - Devices List - - View Device - - Reports + - Manage + - Session Search + - View Session + - View Presenter + - Locations List + - View Location + - Devices List + - View Device + - Reports - **Launcher** (desktop first; tablet second; mobile last) - - Manage - Various admin and configuration options - - Menu Section - Event; Location; Sessions; Show/Hide - - Content Section - Shows session specific files; Shows session specific presentations; presentation specific presenters are shown per presentation; presenter specific files are shown per presenter - - Header Section - Event Name; Location Name; Current Time; Offline/Online Status; Sync Status - - Footer Section - Other status indicators; sync button + - Manage - Various admin and configuration options + - Menu Section - Event; Location; Sessions; Show/Hide + - Content Section - Shows session specific files; Shows session specific presentations; presentation specific presenters are shown per presentation; presenter specific files are shown per presenter + - Header Section - Event Name; Location Name; Current Time; Offline/Online Status; Sync Status + - Footer Section - Other status indicators; sync button - **Badge Printing** - - Manage - - Print Badges - - View Badge (show full preview before printing) - - Review Badge (attendee confirms key info before printing; agree/disagree to terms; agree/disagree to lead retrieval and tracking) - - Manually add Badge - - Reports + - Manage + - Print Badges + - View Badge (show full preview before printing) + - Review Badge (attendee confirms key info before printing; agree/disagree to terms; agree/disagree to lead retrieval and tracking) + - Manually add Badge + - Reports - **Lead Retrieval** - - Manage - - View Leads - - Add Lead (Scan or Manual Entry) - - License Management and Payment (Stripe) + - Manage + - View Leads + - Add Lead (Scan or Manual Entry) + - License Management and Payment (Stripe) - **Admin or Manage or Configure Event** ### New Directory Structure? - src/lib/ - Shared libraries and components - src/routes/core/ - Core Aether management module - - sub-directories for: - - accounts - - account (by ID) - - sites - - site (by ID) - - site_domains - - site_domain (by ID) - - people - - person (by ID) - - users - - user (by ID) - - hosted_files - - hosted_file (by ID or partial hash match???) - - lookups - - (countries) - - (state_provinces) - - (time_zones) + - sub-directories for: + - accounts + - account (by ID) + - sites + - site (by ID) + - site_domains + - site_domain (by ID) + - people + - person (by ID) + - users + - user (by ID) + - hosted_files + - hosted_file (by ID or partial hash match???) + - lookups + - (countries) + - (state_provinces) + - (time_zones) - src/routes/events/ - Events main landing page and event management - src/routes/events/[event_id]/(presentations)/ - Event presentation management module - - sub-directories for: - - sessions - - session (by ID or code) - - presentations - - presenters - - presenter (by ID or code???) - - event_files - - locations - - location (by ID or code) - - devices - - device (by ID or code) - - reports - - report (by name of report) + - sub-directories for: + - sessions + - session (by ID or code) + - presentations + - presenters + - presenter (by ID or code???) + - event_files + - locations + - location (by ID or code) + - devices + - device (by ID or code) + - reports + - report (by name of report) - src/routes/events/[event_id]/(launcher)/ - Event launcher module - src/routes/events/[event_id]/(badges)/ - Event badge printing module - src/routes/events/[event_id]/(leads)/ - Event lead retrieval module - - src/routes/events/[event_id]/+page.svelte - Event main dashboard - - [event_id]/exhibit/[exhibit_id]/ - Exhibitor specific lead retrieval pages + - src/routes/events/[event_id]/+page.svelte - Event main dashboard + - [event_id]/exhibit/[exhibit_id]/ - Exhibitor specific lead retrieval pages - src/routes/journals/ - Journals module - src/routes/idaa/ - IDAA custom modules - - (archives)/ - Archives module - - (bb)/ - Bulletin Board module - - (recovery_meetings)/ - Recovery Meetings module + - (archives)/ - Archives module + - (bb)/ - Bulletin Board module + - (recovery_meetings)/ - Recovery Meetings module - src/lib/ae_core/ - Core Aether logic and data models - src/lib/ae_events/ - Events module logic and data models - src/lib/ae_journals/ - Journals module logic and data models diff --git a/ae_app_svelte_tailwind_skeleton.code-workspace b/ae_app_svelte_tailwind_skeleton.code-workspace index 74cd3988..a68019cf 100644 --- a/ae_app_svelte_tailwind_skeleton.code-workspace +++ b/ae_app_svelte_tailwind_skeleton.code-workspace @@ -1,12 +1,12 @@ { - "folders": [ - { - "path": "." - } - ], - "settings": { - "cSpell.words": ["filelist"], - "git.autofetch": true, - "editor.defaultFormatter": "svelte.svelte-vscode" - } + "folders": [ + { + "path": "." + } + ], + "settings": { + "cSpell.words": ["filelist"], + "git.autofetch": true, + "editor.defaultFormatter": "svelte.svelte-vscode" + } } diff --git a/components.json b/components.json index 1a085b9b..a40a0832 100644 --- a/components.json +++ b/components.json @@ -1,17 +1,17 @@ { - "$schema": "https://next.shadcn-svelte.com/schema.json", - "style": "default", - "tailwind": { - "config": "tailwind.config.ts", - "css": "src/app.css", - "baseColor": "gray" - }, - "aliases": { - "components": "$lib/components", - "utils": "$lib/utils", - "ui": "$lib/components/ui", - "hooks": "$lib/hooks" - }, - "typescript": true, - "registry": "https://next.shadcn-svelte.com/registry" + "$schema": "https://next.shadcn-svelte.com/schema.json", + "style": "default", + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/app.css", + "baseColor": "gray" + }, + "aliases": { + "components": "$lib/components", + "utils": "$lib/utils", + "ui": "$lib/components/ui", + "hooks": "$lib/hooks" + }, + "typescript": true, + "registry": "https://next.shadcn-svelte.com/registry" } diff --git a/eslint.config.js b/eslint.config.js index e9920ca8..85b2252e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -7,32 +7,32 @@ import prettier from 'eslint-config-prettier'; import globals from 'globals'; export default tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.recommended, - svelte.configs['flat/recommended'], - prettier, - { - languageOptions: { - globals: { - ...globals.browser, - ...globals.node - } - } - }, - { - files: ['**/*.svelte'], - languageOptions: { - parserOptions: { - parser: tseslint.parser - } - } - }, - { - ignores: ['build/', '.svelte-kit/', 'node_modules/'] - }, - { - rules: { - '@typescript-eslint/no-unused-vars': 'warn' - } - } + eslint.configs.recommended, + ...tseslint.configs.recommended, + svelte.configs['flat/recommended'], + prettier, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + files: ['**/*.svelte'], + languageOptions: { + parserOptions: { + parser: tseslint.parser + } + } + }, + { + ignores: ['build/', '.svelte-kit/', 'node_modules/'] + }, + { + rules: { + '@typescript-eslint/no-unused-vars': 'warn' + } + } ); diff --git a/jsconfig.json b/jsconfig.json index b3606c19..1a3cd22b 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,7 +1,7 @@ { - "compilerOptions": { - "paths": { - "$lib/*": ["./src/lib/*"] - } - } + "compilerOptions": { + "paths": { + "$lib/*": ["./src/lib/*"] + } + } } diff --git a/package.json b/package.json index 5117e052..e43703d1 100644 --- a/package.json +++ b/package.json @@ -1,102 +1,102 @@ { - "name": "osit-aether-app-svelte", - "version": "3.11.18", - "description": "One Sky IT's Aether App created with Svelte, SvelteKit, Tailwind CSS, Lucide, Font Awesome, and Skeleton UI. -Scott Idem", - "homepage": "https://oneskyit.com/", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "build:prod": "cp .env.prod .env.production && vite build", - "build:staging": "cp .env.staging .env.production && vite build", - "preview": "vite preview", - "test": "npm run test:integration && npm run test:unit", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --check . && eslint .", - "format": "prettier --write .", - "test:integration": "playwright test", - "test:unit": "vitest" - }, - "devDependencies": { - "@eslint/js": "^9.39.1", - "@playwright/test": "^1.28.1", - "@skeletonlabs/skeleton": "^3.1.3", - "@skeletonlabs/skeleton-svelte": "^1.2.3", - "@sveltejs/adapter-auto": "^6.0.0", - "@sveltejs/adapter-node": "^5.0.0", - "@sveltejs/adapter-static": "^3.0.1", - "@sveltejs/kit": "^2.5.0", - "@sveltejs/vite-plugin-svelte": "^5.0.0", - "@tailwindcss/forms": "^0.5.7", - "@tailwindcss/typography": "^0.5.10", - "@types/eslint": "^9.0.0", - "@types/node": "^24.0.0", - "@types/qrcode": "^1.5.5", - "@typescript-eslint/eslint-plugin": "^8.0.0", - "@typescript-eslint/parser": "^8.0.0", - "bits-ui": "^2.0.0", - "clsx": "^2.1.1", - "eslint": "^9.0.0", - "eslint-config-prettier": "^10.0.0", - "eslint-plugin-svelte": "^3.0.0", - "flowbite": "^3.0.0", - "globals": "^16.5.0", - "highlight.js": "^11.10.0", - "lowlight": "^3.2.0", - "mode-watcher": "^1.0.0", - "prettier": "^3.1.1", - "prettier-plugin-svelte": "^3.1.2", - "sass-embedded": "^1.81.0", - "svelte": "^5.0.0", - "svelte-awesome-color-picker": "^4.0.0", - "svelte-check": "^4.0.0", - "svelte-highlight": "^7.8.4", - "svelte-idle": "^3.0.1", - "tailwind-merge": "^3.0.0", - "tailwind-variants": "^2.1.0", - "tailwindcss": "^4.1.10", - "tailwindcss-animate": "^1.0.7", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "typescript-svelte-plugin": "^0.3.50", - "vite": "^6.0.0", - "vitest": "^3.0.0" - }, - "vitest": { - "exclude": [ - "tests" - ] - }, - "type": "module", - "dependencies": { - "@codemirror/basic-setup": "^0.20.0", - "@codemirror/commands": "^6.8.1", - "@codemirror/gutter": "^0.19.9", - "@codemirror/lang-css": "^6.3.1", - "@codemirror/lang-html": "^6.4.9", - "@codemirror/lang-javascript": "^6.2.3", - "@codemirror/lang-json": "^6.0.1", - "@codemirror/lang-markdown": "^6.3.2", - "@codemirror/language": "^6.11.0", - "@codemirror/language-data": "^6.5.1", - "@codemirror/theme-one-dark": "^6.1.2", - "@codemirror/view": "^6.36.8", - "@floating-ui/dom": "^1.6.0", - "@lucide/svelte": "0.*.0", - "@popperjs/core": "^2.11.0", - "@tailwindcss/vite": "^4.1.10", - "axios": "^1.7.0", - "dayjs": "^1.11.10", - "dexie": "^4.0.0", - "flowbite-svelte": "^1.7.0", - "html5-qrcode": "^2.3.8", - "lucide-svelte": "0.*.0", - "marked": "^16.0.0", - "openai": "^5.20.1", - "qrcode": "^1.5.4", - "shadcn-svelte": "^1.0.0", - "svelte-persisted-store": "^0.12.0", - "typescript-eslint": "^8.47.0" - } + "name": "osit-aether-app-svelte", + "version": "3.11.18", + "description": "One Sky IT's Aether App created with Svelte, SvelteKit, Tailwind CSS, Lucide, Font Awesome, and Skeleton UI. -Scott Idem", + "homepage": "https://oneskyit.com/", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "build:prod": "cp .env.prod .env.production && vite build", + "build:staging": "cp .env.staging .env.production && vite build", + "preview": "vite preview", + "test": "npm run test:integration && npm run test:unit", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --check . && eslint .", + "format": "prettier --write .", + "test:integration": "playwright test", + "test:unit": "vitest" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@playwright/test": "^1.28.1", + "@skeletonlabs/skeleton": "^3.1.3", + "@skeletonlabs/skeleton-svelte": "^1.2.3", + "@sveltejs/adapter-auto": "^6.0.0", + "@sveltejs/adapter-node": "^5.0.0", + "@sveltejs/adapter-static": "^3.0.1", + "@sveltejs/kit": "^2.5.0", + "@sveltejs/vite-plugin-svelte": "^5.0.0", + "@tailwindcss/forms": "^0.5.7", + "@tailwindcss/typography": "^0.5.10", + "@types/eslint": "^9.0.0", + "@types/node": "^24.0.0", + "@types/qrcode": "^1.5.5", + "@typescript-eslint/eslint-plugin": "^8.0.0", + "@typescript-eslint/parser": "^8.0.0", + "bits-ui": "^2.0.0", + "clsx": "^2.1.1", + "eslint": "^9.0.0", + "eslint-config-prettier": "^10.0.0", + "eslint-plugin-svelte": "^3.0.0", + "flowbite": "^3.0.0", + "globals": "^16.5.0", + "highlight.js": "^11.10.0", + "lowlight": "^3.2.0", + "mode-watcher": "^1.0.0", + "prettier": "^3.1.1", + "prettier-plugin-svelte": "^3.1.2", + "sass-embedded": "^1.81.0", + "svelte": "^5.0.0", + "svelte-awesome-color-picker": "^4.0.0", + "svelte-check": "^4.0.0", + "svelte-highlight": "^7.8.4", + "svelte-idle": "^3.0.1", + "tailwind-merge": "^3.0.0", + "tailwind-variants": "^2.1.0", + "tailwindcss": "^4.1.10", + "tailwindcss-animate": "^1.0.7", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "typescript-svelte-plugin": "^0.3.50", + "vite": "^6.0.0", + "vitest": "^3.0.0" + }, + "vitest": { + "exclude": [ + "tests" + ] + }, + "type": "module", + "dependencies": { + "@codemirror/basic-setup": "^0.20.0", + "@codemirror/commands": "^6.8.1", + "@codemirror/gutter": "^0.19.9", + "@codemirror/lang-css": "^6.3.1", + "@codemirror/lang-html": "^6.4.9", + "@codemirror/lang-javascript": "^6.2.3", + "@codemirror/lang-json": "^6.0.1", + "@codemirror/lang-markdown": "^6.3.2", + "@codemirror/language": "^6.11.0", + "@codemirror/language-data": "^6.5.1", + "@codemirror/theme-one-dark": "^6.1.2", + "@codemirror/view": "^6.36.8", + "@floating-ui/dom": "^1.6.0", + "@lucide/svelte": "0.*.0", + "@popperjs/core": "^2.11.0", + "@tailwindcss/vite": "^4.1.10", + "axios": "^1.7.0", + "dayjs": "^1.11.10", + "dexie": "^4.0.0", + "flowbite-svelte": "^1.7.0", + "html5-qrcode": "^2.3.8", + "lucide-svelte": "0.*.0", + "marked": "^16.0.0", + "openai": "^5.20.1", + "qrcode": "^1.5.4", + "shadcn-svelte": "^1.0.0", + "svelte-persisted-store": "^0.12.0", + "typescript-eslint": "^8.47.0" + } } diff --git a/playwright.config.ts b/playwright.config.ts index 0942826d..2af01043 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,23 +1,23 @@ import type { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { - webServer: { - command: 'npm run build && npm run preview', - port: 4173 - // url: 'http://scott.localhost:5173', - // reuseExistingServer: true, - // stderr: 'pipe', - // stdout: 'pipe', - }, - testDir: 'tests', - testMatch: /(.+\.)?(test|spec)\.[jt]s/, - reporter: 'list', - use: { - // Collect trace when retrying the failed test. - trace: 'on-first-retry' - } - // grep: /@node_modules/, - // grepInverse: /@node_modules/, + webServer: { + command: 'npm run build && npm run preview', + port: 4173 + // url: 'http://scott.localhost:5173', + // reuseExistingServer: true, + // stderr: 'pipe', + // stdout: 'pipe', + }, + testDir: 'tests', + testMatch: /(.+\.)?(test|spec)\.[jt]s/, + reporter: 'list', + use: { + // Collect trace when retrying the failed test. + trace: 'on-first-retry' + } + // grep: /@node_modules/, + // grepInverse: /@node_modules/, }; export default config; diff --git a/src/ae-c-idaa-light.css b/src/ae-c-idaa-light.css index 2bc5b5d5..7ec6012e 100644 --- a/src/ae-c-idaa-light.css +++ b/src/ae-c-idaa-light.css @@ -1,166 +1,166 @@ [data-theme='AE_c_IDAA_light'] { - --text-scaling: 1.067; - --base-font-color: var(--color-surface-950); + --text-scaling: 1.067; + --base-font-color: var(--color-surface-950); - --base-font-family: system-ui, sans-serif; - --base-font-size: inherit; - --base-line-height: inherit; - --base-font-weight: normal; - --base-font-style: normal; - --base-letter-spacing: 0em; - --heading-font-color: inherit; + --base-font-family: system-ui, sans-serif; + --base-font-size: inherit; + --base-line-height: inherit; + --base-font-weight: normal; + --base-font-style: normal; + --base-letter-spacing: 0em; + --heading-font-color: inherit; - --heading-font-family: inherit; - --heading-font-weight: bold; - --heading-font-style: normal; - --heading-letter-spacing: inherit; - --anchor-font-color: var(--color-primary-600); + --heading-font-family: inherit; + --heading-font-weight: bold; + --heading-font-style: normal; + --heading-letter-spacing: inherit; + --anchor-font-color: var(--color-primary-600); - --anchor-font-family: inherit; - --anchor-font-size: inherit; - --anchor-line-height: inherit; - --anchor-font-weight: inherit; - --anchor-font-style: inherit; - --anchor-letter-spacing: inherit; - --anchor-text-decoration: none; - --anchor-text-decoration-hover: underline; - --anchor-text-decoration-active: none; - --anchor-text-decoration-focus: none; - --spacing: 0.25rem; - --radius-base: 0.375rem; - --radius-container: 0.75rem; - --default-border-width: 1px; - --default-divide-width: 1px; - --default-ring-width: 1px; - --body-background-color: var(--color-surface-50); + --anchor-font-family: inherit; + --anchor-font-size: inherit; + --anchor-line-height: inherit; + --anchor-font-weight: inherit; + --anchor-font-style: inherit; + --anchor-letter-spacing: inherit; + --anchor-text-decoration: none; + --anchor-text-decoration-hover: underline; + --anchor-text-decoration-active: none; + --anchor-text-decoration-focus: none; + --spacing: 0.25rem; + --radius-base: 0.375rem; + --radius-container: 0.75rem; + --default-border-width: 1px; + --default-divide-width: 1px; + --default-ring-width: 1px; + --body-background-color: var(--color-surface-50); - --color-primary-50: oklch(85.73% 0.07 251.8deg); - --color-primary-100: oklch(78.5% 0.09 252.03deg); - --color-primary-200: oklch(71.06% 0.1 253.6deg); - --color-primary-300: oklch(63.76% 0.12 253.85deg); - --color-primary-400: oklch(56.32% 0.14 255.25deg); - --color-primary-500: oklch(49.23% 0.15 256.36deg); - --color-primary-600: oklch(43.11% 0.14 258.86deg); - --color-primary-700: oklch(36.85% 0.14 261.54deg); - --color-primary-800: oklch(30.41% 0.13 263.99deg); - --color-primary-900: oklch(23.91% 0.12 265.91deg); - --color-primary-950: oklch(16.96% 0.12 264.05deg); + --color-primary-50: oklch(85.73% 0.07 251.8deg); + --color-primary-100: oklch(78.5% 0.09 252.03deg); + --color-primary-200: oklch(71.06% 0.1 253.6deg); + --color-primary-300: oklch(63.76% 0.12 253.85deg); + --color-primary-400: oklch(56.32% 0.14 255.25deg); + --color-primary-500: oklch(49.23% 0.15 256.36deg); + --color-primary-600: oklch(43.11% 0.14 258.86deg); + --color-primary-700: oklch(36.85% 0.14 261.54deg); + --color-primary-800: oklch(30.41% 0.13 263.99deg); + --color-primary-900: oklch(23.91% 0.12 265.91deg); + --color-primary-950: oklch(16.96% 0.12 264.05deg); - --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-600: var(--color-primary-contrast-light); - --color-primary-contrast-700: var(--color-primary-contrast-light); - --color-primary-contrast-800: var(--color-primary-contrast-light); - --color-primary-contrast-900: var(--color-primary-contrast-light); - --color-primary-contrast-950: var(--color-primary-contrast-light); - --color-secondary-50: oklch(96.26% 0.06 196.24deg); - --color-secondary-100: oklch(89.14% 0.07 220.79deg); - --color-secondary-200: oklch(82.13% 0.08 234.87deg); - --color-secondary-300: oklch(75.03% 0.11 245.33deg); - --color-secondary-400: oklch(68.15% 0.14 250.72deg); - --color-secondary-500: oklch(61.37% 0.16 255.34deg); - --color-secondary-600: oklch(55.1% 0.16 256.81deg); - --color-secondary-700: oklch(48.64% 0.15 258.4deg); - --color-secondary-800: oklch(41.84% 0.15 260.39deg); - --color-secondary-900: oklch(35.05% 0.14 262.03deg); - --color-secondary-950: oklch(28.12% 0.14 262.47deg); + --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); + --color-primary-contrast-900: var(--color-primary-contrast-light); + --color-primary-contrast-950: var(--color-primary-contrast-light); + --color-secondary-50: oklch(96.26% 0.06 196.24deg); + --color-secondary-100: oklch(89.14% 0.07 220.79deg); + --color-secondary-200: oklch(82.13% 0.08 234.87deg); + --color-secondary-300: oklch(75.03% 0.11 245.33deg); + --color-secondary-400: oklch(68.15% 0.14 250.72deg); + --color-secondary-500: oklch(61.37% 0.16 255.34deg); + --color-secondary-600: oklch(55.1% 0.16 256.81deg); + --color-secondary-700: oklch(48.64% 0.15 258.4deg); + --color-secondary-800: oklch(41.84% 0.15 260.39deg); + --color-secondary-900: oklch(35.05% 0.14 262.03deg); + --color-secondary-950: oklch(28.12% 0.14 262.47deg); - --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-700: var(--color-secondary-contrast-light); - --color-secondary-contrast-800: var(--color-secondary-contrast-light); - --color-secondary-contrast-900: var(--color-secondary-contrast-light); - --color-secondary-contrast-950: var(--color-secondary-contrast-light); - --color-tertiary-50: oklch(100% 0 none); - --color-tertiary-100: oklch(96.07% 0.01 251.15deg); - --color-tertiary-200: oklch(91.88% 0.03 252.69deg); - --color-tertiary-300: oklch(87.99% 0.05 253.24deg); - --color-tertiary-400: oklch(83.81% 0.06 253.57deg); - --color-tertiary-500: oklch(79.93% 0.08 253.32deg); - --color-tertiary-600: oklch(72.53% 0.08 251.75deg); - --color-tertiary-700: oklch(64.93% 0.08 249.75deg); - --color-tertiary-800: oklch(57.14% 0.09 247.99deg); - --color-tertiary-900: oklch(49.18% 0.09 246.55deg); - --color-tertiary-950: oklch(41.1% 0.09 246.54deg); + --color-secondary-contrast-600: 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-900: var(--color-secondary-contrast-light); + --color-secondary-contrast-950: var(--color-secondary-contrast-light); + --color-tertiary-50: oklch(100% 0 none); + --color-tertiary-100: oklch(96.07% 0.01 251.15deg); + --color-tertiary-200: oklch(91.88% 0.03 252.69deg); + --color-tertiary-300: oklch(87.99% 0.05 253.24deg); + --color-tertiary-400: oklch(83.81% 0.06 253.57deg); + --color-tertiary-500: oklch(79.93% 0.08 253.32deg); + --color-tertiary-600: oklch(72.53% 0.08 251.75deg); + --color-tertiary-700: oklch(64.93% 0.08 249.75deg); + --color-tertiary-800: oklch(57.14% 0.09 247.99deg); + --color-tertiary-900: oklch(49.18% 0.09 246.55deg); + --color-tertiary-950: oklch(41.1% 0.09 246.54deg); - --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-900: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-950: var(--color-tertiary-contrast-light); - --color-success-50: oklch(95.82% 0.06 184.52deg); - --color-success-100: oklch(91.55% 0.08 172.29deg); - --color-success-200: oklch(87.44% 0.11 165.22deg); - --color-success-300: oklch(83.26% 0.13 161.2deg); - --color-success-400: oklch(79.56% 0.16 157.13deg); - --color-success-500: oklch(76.12% 0.18 153.61deg); - --color-success-600: oklch(69.31% 0.17 151.81deg); - --color-success-700: oklch(62.07% 0.16 149.95deg); - --color-success-800: oklch(54.9% 0.15 147.65deg); - --color-success-900: oklch(47.26% 0.14 145.54deg); - --color-success-950: oklch(39.64% 0.13 143.79deg); + --color-tertiary-contrast-800: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-900: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-950: var(--color-tertiary-contrast-light); + --color-success-50: oklch(95.82% 0.06 184.52deg); + --color-success-100: oklch(91.55% 0.08 172.29deg); + --color-success-200: oklch(87.44% 0.11 165.22deg); + --color-success-300: oklch(83.26% 0.13 161.2deg); + --color-success-400: oklch(79.56% 0.16 157.13deg); + --color-success-500: oklch(76.12% 0.18 153.61deg); + --color-success-600: oklch(69.31% 0.17 151.81deg); + --color-success-700: oklch(62.07% 0.16 149.95deg); + --color-success-800: oklch(54.9% 0.15 147.65deg); + --color-success-900: oklch(47.26% 0.14 145.54deg); + --color-success-950: oklch(39.64% 0.13 143.79deg); - --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-900: var(--color-success-contrast-light); - --color-success-contrast-950: var(--color-success-contrast-light); - --color-warning-50: oklch(98.26% 0.1 108.02deg); - --color-warning-100: oklch(95.84% 0.12 104.66deg); - --color-warning-200: oklch(93.48% 0.13 102.21deg); - --color-warning-300: oklch(91.49% 0.15 100.17deg); - --color-warning-400: oklch(89.28% 0.16 98.19deg); - --color-warning-500: oklch(87.14% 0.17 96.01deg); - --color-warning-600: oklch(79.88% 0.16 96.31deg); - --color-warning-700: oklch(72.35% 0.14 95.62deg); - --color-warning-800: oklch(64.73% 0.13 95.92deg); - --color-warning-900: oklch(56.77% 0.11 94.87deg); - --color-warning-950: oklch(48.63% 0.1 95.22deg); + --color-success-contrast-800: var(--color-success-contrast-light); + --color-success-contrast-900: var(--color-success-contrast-light); + --color-success-contrast-950: var(--color-success-contrast-light); + --color-warning-50: oklch(98.26% 0.1 108.02deg); + --color-warning-100: oklch(95.84% 0.12 104.66deg); + --color-warning-200: oklch(93.48% 0.13 102.21deg); + --color-warning-300: oklch(91.49% 0.15 100.17deg); + --color-warning-400: oklch(89.28% 0.16 98.19deg); + --color-warning-500: oklch(87.14% 0.17 96.01deg); + --color-warning-600: oklch(79.88% 0.16 96.31deg); + --color-warning-700: oklch(72.35% 0.14 95.62deg); + --color-warning-800: oklch(64.73% 0.13 95.92deg); + --color-warning-900: oklch(56.77% 0.11 94.87deg); + --color-warning-950: oklch(48.63% 0.1 95.22deg); - --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-900: var(--color-warning-contrast-light); - --color-warning-contrast-950: var(--color-warning-contrast-light); - --color-error-50: oklch(81.88% 0.1 38.14deg); - --color-error-100: oklch(75.88% 0.13 31.15deg); - --color-error-200: oklch(70.29% 0.16 27.32deg); - --color-error-300: oklch(65.15% 0.19 25.65deg); - --color-error-400: oklch(60.98% 0.21 25.56deg); - --color-error-500: oklch(57.86% 0.22 26.62deg); - --color-error-600: oklch(52.52% 0.2 26.86deg); - --color-error-700: oklch(46.81% 0.18 27.02deg); - --color-error-800: oklch(41.15% 0.16 27.63deg); - --color-error-900: oklch(35.01% 0.14 27.9deg); - --color-error-950: oklch(28.69% 0.12 29.23deg); + --color-warning-contrast-800: var(--color-warning-contrast-light); + --color-warning-contrast-900: var(--color-warning-contrast-light); + --color-warning-contrast-950: var(--color-warning-contrast-light); + --color-error-50: oklch(81.88% 0.1 38.14deg); + --color-error-100: oklch(75.88% 0.13 31.15deg); + --color-error-200: oklch(70.29% 0.16 27.32deg); + --color-error-300: oklch(65.15% 0.19 25.65deg); + --color-error-400: oklch(60.98% 0.21 25.56deg); + --color-error-500: oklch(57.86% 0.22 26.62deg); + --color-error-600: oklch(52.52% 0.2 26.86deg); + --color-error-700: oklch(46.81% 0.18 27.02deg); + --color-error-800: oklch(41.15% 0.16 27.63deg); + --color-error-900: oklch(35.01% 0.14 27.9deg); + --color-error-950: oklch(28.69% 0.12 29.23deg); - --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-500: var(--color-error-contrast-light); - --color-error-contrast-600: var(--color-error-contrast-light); - --color-error-contrast-700: var(--color-error-contrast-light); - --color-error-contrast-800: var(--color-error-contrast-light); - --color-error-contrast-900: var(--color-error-contrast-light); - --color-error-contrast-950: var(--color-error-contrast-light); - --color-surface-50: oklch(100% 0 none); - --color-surface-100: oklch(93.98% 0 105.57deg); - --color-surface-200: oklch(87.66% 0 67.88deg); - --color-surface-300: oklch(81.35% 0 106.1deg); - --color-surface-400: oklch(74.79% 0 84.45deg); - --color-surface-500: oklch(68.29% 0 91.36deg); - --color-surface-600: oklch(60.99% 0 91.38deg); - --color-surface-700: oklch(53.5% 0 84.49deg); - --color-surface-800: oklch(46.03% 0 91.43deg); - --color-surface-900: oklch(37.94% 0 84.52deg); - --color-surface-950: oklch(29.34% 0 84.54deg); + --color-error-contrast-400: 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-700: var(--color-error-contrast-light); + --color-error-contrast-800: var(--color-error-contrast-light); + --color-error-contrast-900: var(--color-error-contrast-light); + --color-error-contrast-950: var(--color-error-contrast-light); + --color-surface-50: oklch(100% 0 none); + --color-surface-100: oklch(93.98% 0 105.57deg); + --color-surface-200: oklch(87.66% 0 67.88deg); + --color-surface-300: oklch(81.35% 0 106.1deg); + --color-surface-400: oklch(74.79% 0 84.45deg); + --color-surface-500: oklch(68.29% 0 91.36deg); + --color-surface-600: oklch(60.99% 0 91.38deg); + --color-surface-700: oklch(53.5% 0 84.49deg); + --color-surface-800: oklch(46.03% 0 91.43deg); + --color-surface-900: oklch(37.94% 0 84.52deg); + --color-surface-950: oklch(29.34% 0 84.54deg); - --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-800: var(--color-surface-contrast-light); - --color-surface-contrast-900: var(--color-surface-contrast-light); - --color-surface-contrast-950: 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-900: var(--color-surface-contrast-light); + --color-surface-contrast-950: var(--color-surface-contrast-light); } diff --git a/src/ae-c-lci.css b/src/ae-c-lci.css index 8a6ff3f5..29527059 100644 --- a/src/ae-c-lci.css +++ b/src/ae-c-lci.css @@ -1,205 +1,205 @@ [data-theme='AE_c_LCI'] { - --text-scaling: 1.067; - --base-font-color: var(--color-surface-950); - --base-font-color-dark: var(--color-surface-50); - --base-font-family: system-ui, sans-serif; - --base-font-size: inherit; - --base-line-height: inherit; - --base-font-weight: normal; - --base-font-style: normal; - --base-letter-spacing: 0em; - --heading-font-color: inherit; - --heading-font-color-dark: inherit; - --heading-font-family: inherit; - --heading-font-weight: bold; - --heading-font-style: normal; - --heading-letter-spacing: inherit; - --anchor-font-color: var(--color-primary-500); - --anchor-font-color-dark: var(--color-primary-500); - --anchor-font-family: inherit; - --anchor-font-size: inherit; - --anchor-line-height: inherit; - --anchor-font-weight: inherit; - --anchor-font-style: inherit; - --anchor-letter-spacing: inherit; - --anchor-text-decoration: none; - --anchor-text-decoration-hover: underline; - --anchor-text-decoration-active: none; - --anchor-text-decoration-focus: none; - --spacing: 0.25rem; - --radius-base: 0.375rem; - --radius-container: 0.75rem; - --default-border-width: 1px; - --default-divide-width: 1px; - --default-ring-width: 1px; - --body-background-color: var(--color-surface-50); - --body-background-color-dark: var(--color-surface-950); - --color-primary-50: oklch(85.1% 0.07 265.19deg); - --color-primary-100: oklch(77.89% 0.08 264.31deg); - --color-primary-200: oklch(70.32% 0.08 264.44deg); - --color-primary-300: oklch(62.86% 0.09 263.87deg); - --color-primary-400: oklch(54.96% 0.1 263.8deg); - --color-primary-500: oklch(47.12% 0.11 262.88deg); - --color-primary-600: oklch(40.9% 0.1 264.73deg); - --color-primary-700: oklch(34.53% 0.1 267.34deg); - --color-primary-800: oklch(28.16% 0.09 268.81deg); - --color-primary-900: oklch(21.29% 0.09 271.12deg); - --color-primary-950: oklch(12.88% 0.09 264.05deg); - --color-primary-contrast-dark: var(--color-primary-950); - --color-primary-contrast-light: var(--color-primary-50); - --color-primary-contrast-50: var(--color-primary-contrast-dark); - --color-primary-contrast-100: var(--color-primary-contrast-dark); - --color-primary-contrast-200: var(--color-primary-contrast-dark); - --color-primary-contrast-300: var(--color-primary-contrast-dark); - --color-primary-contrast-400: var(--color-primary-contrast-dark); - --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); - --color-primary-contrast-900: var(--color-primary-contrast-light); - --color-primary-contrast-950: var(--color-primary-contrast-light); - --color-secondary-50: oklch(96.14% 0.06 196.21deg); - --color-secondary-100: oklch(89.81% 0.07 212.45deg); - --color-secondary-200: oklch(83.71% 0.08 223.06deg); - --color-secondary-300: oklch(77.42% 0.1 231.73deg); - --color-secondary-400: oklch(71.44% 0.12 237.59deg); - --color-secondary-500: oklch(65.39% 0.14 243.22deg); - --color-secondary-600: oklch(58.93% 0.13 245.07deg); - --color-secondary-700: oklch(52.09% 0.12 248.03deg); - --color-secondary-800: oklch(45.27% 0.12 250.54deg); - --color-secondary-900: oklch(38.01% 0.11 254.24deg); - --color-secondary-950: oklch(30.67% 0.11 256.73deg); - --color-secondary-contrast-dark: var(--color-secondary-950); - --color-secondary-contrast-light: var(--color-secondary-50); - --color-secondary-contrast-50: var(--color-secondary-contrast-dark); - --color-secondary-contrast-100: var(--color-secondary-contrast-dark); - --color-secondary-contrast-200: var(--color-secondary-contrast-dark); - --color-secondary-contrast-300: var(--color-secondary-contrast-dark); - --color-secondary-contrast-400: var(--color-secondary-contrast-dark); - --color-secondary-contrast-500: var(--color-secondary-contrast-dark); - --color-secondary-contrast-600: var(--color-secondary-contrast-dark); - --color-secondary-contrast-700: var(--color-secondary-contrast-light); - --color-secondary-contrast-800: var(--color-secondary-contrast-light); - --color-secondary-contrast-900: var(--color-secondary-contrast-light); - --color-secondary-contrast-950: var(--color-secondary-contrast-light); - --color-tertiary-50: oklch(87.75% 0.12 326.52deg); - --color-tertiary-100: oklch(80.92% 0.13 323.93deg); - --color-tertiary-200: oklch(73.87% 0.14 321.55deg); - --color-tertiary-300: oklch(66.9% 0.15 319.41deg); - --color-tertiary-400: oklch(59.72% 0.16 317.25deg); - --color-tertiary-500: oklch(52.73% 0.17 315.13deg); - --color-tertiary-600: oklch(46.6% 0.16 314.18deg); - --color-tertiary-700: oklch(40.43% 0.14 312.8deg); - --color-tertiary-800: oklch(33.85% 0.13 309.88deg); - --color-tertiary-900: oklch(27.23% 0.12 306.83deg); - --color-tertiary-950: oklch(19.83% 0.1 302.7deg); - --color-tertiary-contrast-dark: var(--color-tertiary-950); - --color-tertiary-contrast-light: var(--color-tertiary-50); - --color-tertiary-contrast-50: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-100: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-200: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-300: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-400: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-500: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-600: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-700: 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-950: var(--color-tertiary-contrast-light); - --color-success-50: oklch(95.23% 0.07 195.99deg); - --color-success-100: oklch(90.22% 0.09 189.46deg); - --color-success-200: oklch(85.11% 0.1 186.03deg); - --color-success-300: oklch(80.35% 0.12 181.75deg); - --color-success-400: oklch(75.55% 0.12 178.92deg); - --color-success-500: oklch(71.19% 0.13 174.73deg); - --color-success-600: oklch(64.29% 0.12 173.65deg); - --color-success-700: oklch(57.46% 0.11 171.75deg); - --color-success-800: oklch(50.18% 0.1 170.68deg); - --color-success-900: oklch(42.87% 0.09 167.65deg); - --color-success-950: oklch(34.91% 0.07 164.42deg); - --color-success-contrast-dark: var(--color-success-950); - --color-success-contrast-light: var(--color-success-50); - --color-success-contrast-50: var(--color-success-contrast-dark); - --color-success-contrast-100: var(--color-success-contrast-dark); - --color-success-contrast-200: var(--color-success-contrast-dark); - --color-success-contrast-300: var(--color-success-contrast-dark); - --color-success-contrast-400: var(--color-success-contrast-dark); - --color-success-contrast-500: var(--color-success-contrast-dark); - --color-success-contrast-600: var(--color-success-contrast-dark); - --color-success-contrast-700: 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-950: var(--color-success-contrast-light); - --color-warning-50: oklch(95.67% 0.05 84.56deg); - --color-warning-100: oklch(92.83% 0.06 82.16deg); - --color-warning-200: oklch(90.12% 0.08 80.33deg); - --color-warning-300: oklch(87.59% 0.1 80.01deg); - --color-warning-400: oklch(85.03% 0.12 78.35deg); - --color-warning-500: oklch(82.46% 0.14 76.71deg); - --color-warning-600: oklch(76.34% 0.13 72.25deg); - --color-warning-700: oklch(70.34% 0.13 68.09deg); - --color-warning-800: oklch(63.99% 0.13 63.18deg); - --color-warning-900: oklch(57.91% 0.13 57.97deg); - --color-warning-950: oklch(51.69% 0.13 51.44deg); - --color-warning-contrast-dark: var(--color-warning-950); - --color-warning-contrast-light: var(--color-warning-50); - --color-warning-contrast-50: var(--color-warning-contrast-dark); - --color-warning-contrast-100: var(--color-warning-contrast-dark); - --color-warning-contrast-200: var(--color-warning-contrast-dark); - --color-warning-contrast-300: var(--color-warning-contrast-dark); - --color-warning-contrast-400: var(--color-warning-contrast-dark); - --color-warning-contrast-500: var(--color-warning-contrast-dark); - --color-warning-contrast-600: var(--color-warning-contrast-light); - --color-warning-contrast-700: 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-950: var(--color-warning-contrast-light); - --color-error-50: oklch(84.29% 0.09 46.91deg); - --color-error-100: oklch(78.63% 0.12 39.19deg); - --color-error-200: oklch(72.92% 0.14 34.35deg); - --color-error-300: oklch(67.88% 0.17 31.48deg); - --color-error-400: oklch(63.09% 0.19 30.02deg); - --color-error-500: oklch(59.32% 0.21 29.47deg); - --color-error-600: oklch(53.56% 0.19 29.25deg); - --color-error-700: oklch(47.75% 0.17 29.2deg); - --color-error-800: oklch(41.51% 0.15 28.7deg); - --color-error-900: oklch(35.35% 0.14 28.7deg); - --color-error-950: oklch(28.69% 0.12 29.23deg); - --color-error-contrast-dark: var(--color-error-950); - --color-error-contrast-light: var(--color-error-50); - --color-error-contrast-50: var(--color-error-contrast-dark); - --color-error-contrast-100: var(--color-error-contrast-dark); - --color-error-contrast-200: var(--color-error-contrast-dark); - --color-error-contrast-300: var(--color-error-contrast-dark); - --color-error-contrast-400: var(--color-error-contrast-dark); - --color-error-contrast-500: var(--color-error-contrast-light); - --color-error-contrast-600: var(--color-error-contrast-light); - --color-error-contrast-700: var(--color-error-contrast-light); - --color-error-contrast-800: var(--color-error-contrast-light); - --color-error-contrast-900: var(--color-error-contrast-light); - --color-error-contrast-950: var(--color-error-contrast-light); - --color-surface-50: oklch(100% 0 none); - --color-surface-100: oklch(97.02% 0 none); - --color-surface-200: oklch(94.01% 0 none); - --color-surface-300: oklch(91.12% 0 196.34deg); - --color-surface-400: oklch(88.07% 0 196.37deg); - --color-surface-500: oklch(84.99% 0 196.4deg); - --color-surface-600: oklch(77.78% 0 196.47deg); - --color-surface-700: oklch(70.09% 0 196.54deg); - --color-surface-800: oklch(62.51% 0 196.61deg); - --color-surface-900: oklch(54.34% 0 196.68deg); - --color-surface-950: oklch(46.22% 0 196.73deg); - --color-surface-contrast-dark: var(--color-surface-950); - --color-surface-contrast-light: var(--color-surface-50); - --color-surface-contrast-50: var(--color-surface-contrast-dark); - --color-surface-contrast-100: var(--color-surface-contrast-dark); - --color-surface-contrast-200: var(--color-surface-contrast-dark); - --color-surface-contrast-300: var(--color-surface-contrast-dark); - --color-surface-contrast-400: var(--color-surface-contrast-dark); - --color-surface-contrast-500: var(--color-surface-contrast-dark); - --color-surface-contrast-600: var(--color-surface-contrast-dark); - --color-surface-contrast-700: var(--color-surface-contrast-dark); - --color-surface-contrast-800: var(--color-surface-contrast-dark); - --color-surface-contrast-900: var(--color-surface-contrast-light); - --color-surface-contrast-950: var(--color-surface-contrast-light); + --text-scaling: 1.067; + --base-font-color: var(--color-surface-950); + --base-font-color-dark: var(--color-surface-50); + --base-font-family: system-ui, sans-serif; + --base-font-size: inherit; + --base-line-height: inherit; + --base-font-weight: normal; + --base-font-style: normal; + --base-letter-spacing: 0em; + --heading-font-color: inherit; + --heading-font-color-dark: inherit; + --heading-font-family: inherit; + --heading-font-weight: bold; + --heading-font-style: normal; + --heading-letter-spacing: inherit; + --anchor-font-color: var(--color-primary-500); + --anchor-font-color-dark: var(--color-primary-500); + --anchor-font-family: inherit; + --anchor-font-size: inherit; + --anchor-line-height: inherit; + --anchor-font-weight: inherit; + --anchor-font-style: inherit; + --anchor-letter-spacing: inherit; + --anchor-text-decoration: none; + --anchor-text-decoration-hover: underline; + --anchor-text-decoration-active: none; + --anchor-text-decoration-focus: none; + --spacing: 0.25rem; + --radius-base: 0.375rem; + --radius-container: 0.75rem; + --default-border-width: 1px; + --default-divide-width: 1px; + --default-ring-width: 1px; + --body-background-color: var(--color-surface-50); + --body-background-color-dark: var(--color-surface-950); + --color-primary-50: oklch(85.1% 0.07 265.19deg); + --color-primary-100: oklch(77.89% 0.08 264.31deg); + --color-primary-200: oklch(70.32% 0.08 264.44deg); + --color-primary-300: oklch(62.86% 0.09 263.87deg); + --color-primary-400: oklch(54.96% 0.1 263.8deg); + --color-primary-500: oklch(47.12% 0.11 262.88deg); + --color-primary-600: oklch(40.9% 0.1 264.73deg); + --color-primary-700: oklch(34.53% 0.1 267.34deg); + --color-primary-800: oklch(28.16% 0.09 268.81deg); + --color-primary-900: oklch(21.29% 0.09 271.12deg); + --color-primary-950: oklch(12.88% 0.09 264.05deg); + --color-primary-contrast-dark: var(--color-primary-950); + --color-primary-contrast-light: var(--color-primary-50); + --color-primary-contrast-50: var(--color-primary-contrast-dark); + --color-primary-contrast-100: var(--color-primary-contrast-dark); + --color-primary-contrast-200: var(--color-primary-contrast-dark); + --color-primary-contrast-300: var(--color-primary-contrast-dark); + --color-primary-contrast-400: var(--color-primary-contrast-dark); + --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); + --color-primary-contrast-900: var(--color-primary-contrast-light); + --color-primary-contrast-950: var(--color-primary-contrast-light); + --color-secondary-50: oklch(96.14% 0.06 196.21deg); + --color-secondary-100: oklch(89.81% 0.07 212.45deg); + --color-secondary-200: oklch(83.71% 0.08 223.06deg); + --color-secondary-300: oklch(77.42% 0.1 231.73deg); + --color-secondary-400: oklch(71.44% 0.12 237.59deg); + --color-secondary-500: oklch(65.39% 0.14 243.22deg); + --color-secondary-600: oklch(58.93% 0.13 245.07deg); + --color-secondary-700: oklch(52.09% 0.12 248.03deg); + --color-secondary-800: oklch(45.27% 0.12 250.54deg); + --color-secondary-900: oklch(38.01% 0.11 254.24deg); + --color-secondary-950: oklch(30.67% 0.11 256.73deg); + --color-secondary-contrast-dark: var(--color-secondary-950); + --color-secondary-contrast-light: var(--color-secondary-50); + --color-secondary-contrast-50: var(--color-secondary-contrast-dark); + --color-secondary-contrast-100: var(--color-secondary-contrast-dark); + --color-secondary-contrast-200: var(--color-secondary-contrast-dark); + --color-secondary-contrast-300: var(--color-secondary-contrast-dark); + --color-secondary-contrast-400: var(--color-secondary-contrast-dark); + --color-secondary-contrast-500: var(--color-secondary-contrast-dark); + --color-secondary-contrast-600: var(--color-secondary-contrast-dark); + --color-secondary-contrast-700: var(--color-secondary-contrast-light); + --color-secondary-contrast-800: var(--color-secondary-contrast-light); + --color-secondary-contrast-900: var(--color-secondary-contrast-light); + --color-secondary-contrast-950: var(--color-secondary-contrast-light); + --color-tertiary-50: oklch(87.75% 0.12 326.52deg); + --color-tertiary-100: oklch(80.92% 0.13 323.93deg); + --color-tertiary-200: oklch(73.87% 0.14 321.55deg); + --color-tertiary-300: oklch(66.9% 0.15 319.41deg); + --color-tertiary-400: oklch(59.72% 0.16 317.25deg); + --color-tertiary-500: oklch(52.73% 0.17 315.13deg); + --color-tertiary-600: oklch(46.6% 0.16 314.18deg); + --color-tertiary-700: oklch(40.43% 0.14 312.8deg); + --color-tertiary-800: oklch(33.85% 0.13 309.88deg); + --color-tertiary-900: oklch(27.23% 0.12 306.83deg); + --color-tertiary-950: oklch(19.83% 0.1 302.7deg); + --color-tertiary-contrast-dark: var(--color-tertiary-950); + --color-tertiary-contrast-light: var(--color-tertiary-50); + --color-tertiary-contrast-50: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-100: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-200: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-300: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-400: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-500: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-600: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-700: 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-950: var(--color-tertiary-contrast-light); + --color-success-50: oklch(95.23% 0.07 195.99deg); + --color-success-100: oklch(90.22% 0.09 189.46deg); + --color-success-200: oklch(85.11% 0.1 186.03deg); + --color-success-300: oklch(80.35% 0.12 181.75deg); + --color-success-400: oklch(75.55% 0.12 178.92deg); + --color-success-500: oklch(71.19% 0.13 174.73deg); + --color-success-600: oklch(64.29% 0.12 173.65deg); + --color-success-700: oklch(57.46% 0.11 171.75deg); + --color-success-800: oklch(50.18% 0.1 170.68deg); + --color-success-900: oklch(42.87% 0.09 167.65deg); + --color-success-950: oklch(34.91% 0.07 164.42deg); + --color-success-contrast-dark: var(--color-success-950); + --color-success-contrast-light: var(--color-success-50); + --color-success-contrast-50: var(--color-success-contrast-dark); + --color-success-contrast-100: var(--color-success-contrast-dark); + --color-success-contrast-200: var(--color-success-contrast-dark); + --color-success-contrast-300: var(--color-success-contrast-dark); + --color-success-contrast-400: var(--color-success-contrast-dark); + --color-success-contrast-500: var(--color-success-contrast-dark); + --color-success-contrast-600: var(--color-success-contrast-dark); + --color-success-contrast-700: 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-950: var(--color-success-contrast-light); + --color-warning-50: oklch(95.67% 0.05 84.56deg); + --color-warning-100: oklch(92.83% 0.06 82.16deg); + --color-warning-200: oklch(90.12% 0.08 80.33deg); + --color-warning-300: oklch(87.59% 0.1 80.01deg); + --color-warning-400: oklch(85.03% 0.12 78.35deg); + --color-warning-500: oklch(82.46% 0.14 76.71deg); + --color-warning-600: oklch(76.34% 0.13 72.25deg); + --color-warning-700: oklch(70.34% 0.13 68.09deg); + --color-warning-800: oklch(63.99% 0.13 63.18deg); + --color-warning-900: oklch(57.91% 0.13 57.97deg); + --color-warning-950: oklch(51.69% 0.13 51.44deg); + --color-warning-contrast-dark: var(--color-warning-950); + --color-warning-contrast-light: var(--color-warning-50); + --color-warning-contrast-50: var(--color-warning-contrast-dark); + --color-warning-contrast-100: var(--color-warning-contrast-dark); + --color-warning-contrast-200: var(--color-warning-contrast-dark); + --color-warning-contrast-300: var(--color-warning-contrast-dark); + --color-warning-contrast-400: var(--color-warning-contrast-dark); + --color-warning-contrast-500: var(--color-warning-contrast-dark); + --color-warning-contrast-600: var(--color-warning-contrast-light); + --color-warning-contrast-700: 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-950: var(--color-warning-contrast-light); + --color-error-50: oklch(84.29% 0.09 46.91deg); + --color-error-100: oklch(78.63% 0.12 39.19deg); + --color-error-200: oklch(72.92% 0.14 34.35deg); + --color-error-300: oklch(67.88% 0.17 31.48deg); + --color-error-400: oklch(63.09% 0.19 30.02deg); + --color-error-500: oklch(59.32% 0.21 29.47deg); + --color-error-600: oklch(53.56% 0.19 29.25deg); + --color-error-700: oklch(47.75% 0.17 29.2deg); + --color-error-800: oklch(41.51% 0.15 28.7deg); + --color-error-900: oklch(35.35% 0.14 28.7deg); + --color-error-950: oklch(28.69% 0.12 29.23deg); + --color-error-contrast-dark: var(--color-error-950); + --color-error-contrast-light: var(--color-error-50); + --color-error-contrast-50: var(--color-error-contrast-dark); + --color-error-contrast-100: var(--color-error-contrast-dark); + --color-error-contrast-200: var(--color-error-contrast-dark); + --color-error-contrast-300: var(--color-error-contrast-dark); + --color-error-contrast-400: var(--color-error-contrast-dark); + --color-error-contrast-500: var(--color-error-contrast-light); + --color-error-contrast-600: var(--color-error-contrast-light); + --color-error-contrast-700: var(--color-error-contrast-light); + --color-error-contrast-800: var(--color-error-contrast-light); + --color-error-contrast-900: var(--color-error-contrast-light); + --color-error-contrast-950: var(--color-error-contrast-light); + --color-surface-50: oklch(100% 0 none); + --color-surface-100: oklch(97.02% 0 none); + --color-surface-200: oklch(94.01% 0 none); + --color-surface-300: oklch(91.12% 0 196.34deg); + --color-surface-400: oklch(88.07% 0 196.37deg); + --color-surface-500: oklch(84.99% 0 196.4deg); + --color-surface-600: oklch(77.78% 0 196.47deg); + --color-surface-700: oklch(70.09% 0 196.54deg); + --color-surface-800: oklch(62.51% 0 196.61deg); + --color-surface-900: oklch(54.34% 0 196.68deg); + --color-surface-950: oklch(46.22% 0 196.73deg); + --color-surface-contrast-dark: var(--color-surface-950); + --color-surface-contrast-light: var(--color-surface-50); + --color-surface-contrast-50: var(--color-surface-contrast-dark); + --color-surface-contrast-100: var(--color-surface-contrast-dark); + --color-surface-contrast-200: var(--color-surface-contrast-dark); + --color-surface-contrast-300: var(--color-surface-contrast-dark); + --color-surface-contrast-400: var(--color-surface-contrast-dark); + --color-surface-contrast-500: var(--color-surface-contrast-dark); + --color-surface-contrast-600: var(--color-surface-contrast-dark); + --color-surface-contrast-700: var(--color-surface-contrast-dark); + --color-surface-contrast-800: var(--color-surface-contrast-dark); + --color-surface-contrast-900: var(--color-surface-contrast-light); + --color-surface-contrast-950: var(--color-surface-contrast-light); } diff --git a/src/ae-osit-default.css b/src/ae-osit-default.css index 2001656c..0b0bf6ca 100644 --- a/src/ae-osit-default.css +++ b/src/ae-osit-default.css @@ -1,205 +1,205 @@ [data-theme='AE_OSIT_default'] { - --text-scaling: 1.067; - --base-font-color: var(--color-surface-950); - --base-font-color-dark: var(--color-surface-50); - --base-font-family: system-ui, sans-serif; - --base-font-size: inherit; - --base-line-height: inherit; - --base-font-weight: normal; - --base-font-style: normal; - --base-letter-spacing: 0em; - --heading-font-color: inherit; - --heading-font-color-dark: inherit; - --heading-font-family: inherit; - --heading-font-weight: bold; - --heading-font-style: normal; - --heading-letter-spacing: inherit; - --anchor-font-color: var(--color-primary-600); - --anchor-font-color-dark: var(--color-primary-400); - --anchor-font-family: inherit; - --anchor-font-size: inherit; - --anchor-line-height: inherit; - --anchor-font-weight: inherit; - --anchor-font-style: inherit; - --anchor-letter-spacing: inherit; - --anchor-text-decoration: none; - --anchor-text-decoration-hover: underline; - --anchor-text-decoration-active: none; - --anchor-text-decoration-focus: none; - --spacing: 0.25rem; - --radius-base: 0.375rem; - --radius-container: 0.75rem; - --default-border-width: 1px; - --default-divide-width: 1px; - --default-ring-width: 1px; - --body-background-color: var(--color-surface-50); - --body-background-color-dark: var(--color-surface-950); - --color-primary-50: oklch(85.73% 0.07 251.8deg); - --color-primary-100: oklch(78.5% 0.09 252.03deg); - --color-primary-200: oklch(71.06% 0.1 253.6deg); - --color-primary-300: oklch(63.76% 0.12 253.85deg); - --color-primary-400: oklch(56.32% 0.14 255.25deg); - --color-primary-500: oklch(49.23% 0.15 256.36deg); - --color-primary-600: oklch(43.11% 0.14 258.86deg); - --color-primary-700: oklch(36.85% 0.14 261.54deg); - --color-primary-800: oklch(30.41% 0.13 263.99deg); - --color-primary-900: oklch(23.91% 0.12 265.91deg); - --color-primary-950: oklch(16.96% 0.12 264.05deg); - --color-primary-contrast-dark: var(--color-primary-950); - --color-primary-contrast-light: var(--color-primary-50); - --color-primary-contrast-50: var(--color-primary-contrast-dark); - --color-primary-contrast-100: var(--color-primary-contrast-dark); - --color-primary-contrast-200: var(--color-primary-contrast-dark); - --color-primary-contrast-300: var(--color-primary-contrast-dark); - --color-primary-contrast-400: var(--color-primary-contrast-dark); - --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); - --color-primary-contrast-900: var(--color-primary-contrast-light); - --color-primary-contrast-950: var(--color-primary-contrast-light); - --color-secondary-50: oklch(96.26% 0.06 196.24deg); - --color-secondary-100: oklch(89.14% 0.07 220.79deg); - --color-secondary-200: oklch(82.13% 0.08 234.87deg); - --color-secondary-300: oklch(75.03% 0.11 245.33deg); - --color-secondary-400: oklch(68.15% 0.14 250.72deg); - --color-secondary-500: oklch(61.37% 0.16 255.34deg); - --color-secondary-600: oklch(55.1% 0.16 256.81deg); - --color-secondary-700: oklch(48.64% 0.15 258.4deg); - --color-secondary-800: oklch(41.84% 0.15 260.39deg); - --color-secondary-900: oklch(35.05% 0.14 262.03deg); - --color-secondary-950: oklch(28.12% 0.14 262.47deg); - --color-secondary-contrast-dark: var(--color-secondary-950); - --color-secondary-contrast-light: var(--color-secondary-50); - --color-secondary-contrast-50: var(--color-secondary-contrast-dark); - --color-secondary-contrast-100: var(--color-secondary-contrast-dark); - --color-secondary-contrast-200: var(--color-secondary-contrast-dark); - --color-secondary-contrast-300: var(--color-secondary-contrast-dark); - --color-secondary-contrast-400: var(--color-secondary-contrast-dark); - --color-secondary-contrast-500: var(--color-secondary-contrast-dark); - --color-secondary-contrast-600: 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-900: var(--color-secondary-contrast-light); - --color-secondary-contrast-950: var(--color-secondary-contrast-light); - --color-tertiary-50: oklch(100% 0 none); - --color-tertiary-100: oklch(96.07% 0.01 251.15deg); - --color-tertiary-200: oklch(91.88% 0.03 252.69deg); - --color-tertiary-300: oklch(87.99% 0.05 253.24deg); - --color-tertiary-400: oklch(83.81% 0.06 253.57deg); - --color-tertiary-500: oklch(79.93% 0.08 253.32deg); - --color-tertiary-600: oklch(72.53% 0.08 251.75deg); - --color-tertiary-700: oklch(64.93% 0.08 249.75deg); - --color-tertiary-800: oklch(57.14% 0.09 247.99deg); - --color-tertiary-900: oklch(49.18% 0.09 246.55deg); - --color-tertiary-950: oklch(41.1% 0.09 246.54deg); - --color-tertiary-contrast-dark: var(--color-tertiary-950); - --color-tertiary-contrast-light: var(--color-tertiary-50); - --color-tertiary-contrast-50: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-100: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-200: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-300: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-400: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-500: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-600: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-700: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-800: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-900: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-950: var(--color-tertiary-contrast-light); - --color-success-50: oklch(95.82% 0.06 184.52deg); - --color-success-100: oklch(91.55% 0.08 172.29deg); - --color-success-200: oklch(87.44% 0.11 165.22deg); - --color-success-300: oklch(83.26% 0.13 161.2deg); - --color-success-400: oklch(79.56% 0.16 157.13deg); - --color-success-500: oklch(76.12% 0.18 153.61deg); - --color-success-600: oklch(69.31% 0.17 151.81deg); - --color-success-700: oklch(62.07% 0.16 149.95deg); - --color-success-800: oklch(54.9% 0.15 147.65deg); - --color-success-900: oklch(47.26% 0.14 145.54deg); - --color-success-950: oklch(39.64% 0.13 143.79deg); - --color-success-contrast-dark: var(--color-success-950); - --color-success-contrast-light: var(--color-success-50); - --color-success-contrast-50: var(--color-success-contrast-dark); - --color-success-contrast-100: var(--color-success-contrast-dark); - --color-success-contrast-200: var(--color-success-contrast-dark); - --color-success-contrast-300: var(--color-success-contrast-dark); - --color-success-contrast-400: var(--color-success-contrast-dark); - --color-success-contrast-500: var(--color-success-contrast-dark); - --color-success-contrast-600: var(--color-success-contrast-dark); - --color-success-contrast-700: var(--color-success-contrast-dark); - --color-success-contrast-800: var(--color-success-contrast-light); - --color-success-contrast-900: var(--color-success-contrast-light); - --color-success-contrast-950: var(--color-success-contrast-light); - --color-warning-50: oklch(98.26% 0.1 108.02deg); - --color-warning-100: oklch(95.84% 0.12 104.66deg); - --color-warning-200: oklch(93.48% 0.13 102.21deg); - --color-warning-300: oklch(91.49% 0.15 100.17deg); - --color-warning-400: oklch(89.28% 0.16 98.19deg); - --color-warning-500: oklch(87.14% 0.17 96.01deg); - --color-warning-600: oklch(79.88% 0.16 96.31deg); - --color-warning-700: oklch(72.35% 0.14 95.62deg); - --color-warning-800: oklch(64.73% 0.13 95.92deg); - --color-warning-900: oklch(56.77% 0.11 94.87deg); - --color-warning-950: oklch(48.63% 0.1 95.22deg); - --color-warning-contrast-dark: var(--color-warning-950); - --color-warning-contrast-light: var(--color-warning-50); - --color-warning-contrast-50: var(--color-warning-contrast-dark); - --color-warning-contrast-100: var(--color-warning-contrast-dark); - --color-warning-contrast-200: var(--color-warning-contrast-dark); - --color-warning-contrast-300: var(--color-warning-contrast-dark); - --color-warning-contrast-400: var(--color-warning-contrast-dark); - --color-warning-contrast-500: var(--color-warning-contrast-dark); - --color-warning-contrast-600: var(--color-warning-contrast-dark); - --color-warning-contrast-700: var(--color-warning-contrast-dark); - --color-warning-contrast-800: var(--color-warning-contrast-light); - --color-warning-contrast-900: var(--color-warning-contrast-light); - --color-warning-contrast-950: var(--color-warning-contrast-light); - --color-error-50: oklch(81.88% 0.1 38.14deg); - --color-error-100: oklch(75.88% 0.13 31.15deg); - --color-error-200: oklch(70.29% 0.16 27.32deg); - --color-error-300: oklch(65.15% 0.19 25.65deg); - --color-error-400: oklch(60.98% 0.21 25.56deg); - --color-error-500: oklch(57.86% 0.22 26.62deg); - --color-error-600: oklch(52.52% 0.2 26.86deg); - --color-error-700: oklch(46.81% 0.18 27.02deg); - --color-error-800: oklch(41.15% 0.16 27.63deg); - --color-error-900: oklch(35.01% 0.14 27.9deg); - --color-error-950: oklch(28.69% 0.12 29.23deg); - --color-error-contrast-dark: var(--color-error-950); - --color-error-contrast-light: var(--color-error-50); - --color-error-contrast-50: var(--color-error-contrast-dark); - --color-error-contrast-100: var(--color-error-contrast-dark); - --color-error-contrast-200: var(--color-error-contrast-dark); - --color-error-contrast-300: var(--color-error-contrast-dark); - --color-error-contrast-400: 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-700: var(--color-error-contrast-light); - --color-error-contrast-800: var(--color-error-contrast-light); - --color-error-contrast-900: var(--color-error-contrast-light); - --color-error-contrast-950: var(--color-error-contrast-light); - --color-surface-50: oklch(100% 0 none); - --color-surface-100: oklch(93.98% 0 105.57deg); - --color-surface-200: oklch(87.66% 0 67.88deg); - --color-surface-300: oklch(81.35% 0 106.1deg); - --color-surface-400: oklch(74.79% 0 84.45deg); - --color-surface-500: oklch(68.29% 0 91.36deg); - --color-surface-600: oklch(60.99% 0 91.38deg); - --color-surface-700: oklch(53.5% 0 84.49deg); - --color-surface-800: oklch(46.03% 0 91.43deg); - --color-surface-900: oklch(37.94% 0 84.52deg); - --color-surface-950: oklch(29.34% 0 84.54deg); - --color-surface-contrast-dark: var(--color-surface-950); - --color-surface-contrast-light: var(--color-surface-50); - --color-surface-contrast-50: var(--color-surface-contrast-dark); - --color-surface-contrast-100: var(--color-surface-contrast-dark); - --color-surface-contrast-200: var(--color-surface-contrast-dark); - --color-surface-contrast-300: var(--color-surface-contrast-dark); - --color-surface-contrast-400: var(--color-surface-contrast-dark); - --color-surface-contrast-500: var(--color-surface-contrast-dark); - --color-surface-contrast-600: var(--color-surface-contrast-dark); - --color-surface-contrast-700: 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-950: var(--color-surface-contrast-light); + --text-scaling: 1.067; + --base-font-color: var(--color-surface-950); + --base-font-color-dark: var(--color-surface-50); + --base-font-family: system-ui, sans-serif; + --base-font-size: inherit; + --base-line-height: inherit; + --base-font-weight: normal; + --base-font-style: normal; + --base-letter-spacing: 0em; + --heading-font-color: inherit; + --heading-font-color-dark: inherit; + --heading-font-family: inherit; + --heading-font-weight: bold; + --heading-font-style: normal; + --heading-letter-spacing: inherit; + --anchor-font-color: var(--color-primary-600); + --anchor-font-color-dark: var(--color-primary-400); + --anchor-font-family: inherit; + --anchor-font-size: inherit; + --anchor-line-height: inherit; + --anchor-font-weight: inherit; + --anchor-font-style: inherit; + --anchor-letter-spacing: inherit; + --anchor-text-decoration: none; + --anchor-text-decoration-hover: underline; + --anchor-text-decoration-active: none; + --anchor-text-decoration-focus: none; + --spacing: 0.25rem; + --radius-base: 0.375rem; + --radius-container: 0.75rem; + --default-border-width: 1px; + --default-divide-width: 1px; + --default-ring-width: 1px; + --body-background-color: var(--color-surface-50); + --body-background-color-dark: var(--color-surface-950); + --color-primary-50: oklch(85.73% 0.07 251.8deg); + --color-primary-100: oklch(78.5% 0.09 252.03deg); + --color-primary-200: oklch(71.06% 0.1 253.6deg); + --color-primary-300: oklch(63.76% 0.12 253.85deg); + --color-primary-400: oklch(56.32% 0.14 255.25deg); + --color-primary-500: oklch(49.23% 0.15 256.36deg); + --color-primary-600: oklch(43.11% 0.14 258.86deg); + --color-primary-700: oklch(36.85% 0.14 261.54deg); + --color-primary-800: oklch(30.41% 0.13 263.99deg); + --color-primary-900: oklch(23.91% 0.12 265.91deg); + --color-primary-950: oklch(16.96% 0.12 264.05deg); + --color-primary-contrast-dark: var(--color-primary-950); + --color-primary-contrast-light: var(--color-primary-50); + --color-primary-contrast-50: var(--color-primary-contrast-dark); + --color-primary-contrast-100: var(--color-primary-contrast-dark); + --color-primary-contrast-200: var(--color-primary-contrast-dark); + --color-primary-contrast-300: var(--color-primary-contrast-dark); + --color-primary-contrast-400: var(--color-primary-contrast-dark); + --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); + --color-primary-contrast-900: var(--color-primary-contrast-light); + --color-primary-contrast-950: var(--color-primary-contrast-light); + --color-secondary-50: oklch(96.26% 0.06 196.24deg); + --color-secondary-100: oklch(89.14% 0.07 220.79deg); + --color-secondary-200: oklch(82.13% 0.08 234.87deg); + --color-secondary-300: oklch(75.03% 0.11 245.33deg); + --color-secondary-400: oklch(68.15% 0.14 250.72deg); + --color-secondary-500: oklch(61.37% 0.16 255.34deg); + --color-secondary-600: oklch(55.1% 0.16 256.81deg); + --color-secondary-700: oklch(48.64% 0.15 258.4deg); + --color-secondary-800: oklch(41.84% 0.15 260.39deg); + --color-secondary-900: oklch(35.05% 0.14 262.03deg); + --color-secondary-950: oklch(28.12% 0.14 262.47deg); + --color-secondary-contrast-dark: var(--color-secondary-950); + --color-secondary-contrast-light: var(--color-secondary-50); + --color-secondary-contrast-50: var(--color-secondary-contrast-dark); + --color-secondary-contrast-100: var(--color-secondary-contrast-dark); + --color-secondary-contrast-200: var(--color-secondary-contrast-dark); + --color-secondary-contrast-300: var(--color-secondary-contrast-dark); + --color-secondary-contrast-400: var(--color-secondary-contrast-dark); + --color-secondary-contrast-500: var(--color-secondary-contrast-dark); + --color-secondary-contrast-600: 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-900: var(--color-secondary-contrast-light); + --color-secondary-contrast-950: var(--color-secondary-contrast-light); + --color-tertiary-50: oklch(100% 0 none); + --color-tertiary-100: oklch(96.07% 0.01 251.15deg); + --color-tertiary-200: oklch(91.88% 0.03 252.69deg); + --color-tertiary-300: oklch(87.99% 0.05 253.24deg); + --color-tertiary-400: oklch(83.81% 0.06 253.57deg); + --color-tertiary-500: oklch(79.93% 0.08 253.32deg); + --color-tertiary-600: oklch(72.53% 0.08 251.75deg); + --color-tertiary-700: oklch(64.93% 0.08 249.75deg); + --color-tertiary-800: oklch(57.14% 0.09 247.99deg); + --color-tertiary-900: oklch(49.18% 0.09 246.55deg); + --color-tertiary-950: oklch(41.1% 0.09 246.54deg); + --color-tertiary-contrast-dark: var(--color-tertiary-950); + --color-tertiary-contrast-light: var(--color-tertiary-50); + --color-tertiary-contrast-50: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-100: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-200: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-300: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-400: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-500: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-600: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-700: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-800: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-900: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-950: var(--color-tertiary-contrast-light); + --color-success-50: oklch(95.82% 0.06 184.52deg); + --color-success-100: oklch(91.55% 0.08 172.29deg); + --color-success-200: oklch(87.44% 0.11 165.22deg); + --color-success-300: oklch(83.26% 0.13 161.2deg); + --color-success-400: oklch(79.56% 0.16 157.13deg); + --color-success-500: oklch(76.12% 0.18 153.61deg); + --color-success-600: oklch(69.31% 0.17 151.81deg); + --color-success-700: oklch(62.07% 0.16 149.95deg); + --color-success-800: oklch(54.9% 0.15 147.65deg); + --color-success-900: oklch(47.26% 0.14 145.54deg); + --color-success-950: oklch(39.64% 0.13 143.79deg); + --color-success-contrast-dark: var(--color-success-950); + --color-success-contrast-light: var(--color-success-50); + --color-success-contrast-50: var(--color-success-contrast-dark); + --color-success-contrast-100: var(--color-success-contrast-dark); + --color-success-contrast-200: var(--color-success-contrast-dark); + --color-success-contrast-300: var(--color-success-contrast-dark); + --color-success-contrast-400: var(--color-success-contrast-dark); + --color-success-contrast-500: var(--color-success-contrast-dark); + --color-success-contrast-600: var(--color-success-contrast-dark); + --color-success-contrast-700: var(--color-success-contrast-dark); + --color-success-contrast-800: var(--color-success-contrast-light); + --color-success-contrast-900: var(--color-success-contrast-light); + --color-success-contrast-950: var(--color-success-contrast-light); + --color-warning-50: oklch(98.26% 0.1 108.02deg); + --color-warning-100: oklch(95.84% 0.12 104.66deg); + --color-warning-200: oklch(93.48% 0.13 102.21deg); + --color-warning-300: oklch(91.49% 0.15 100.17deg); + --color-warning-400: oklch(89.28% 0.16 98.19deg); + --color-warning-500: oklch(87.14% 0.17 96.01deg); + --color-warning-600: oklch(79.88% 0.16 96.31deg); + --color-warning-700: oklch(72.35% 0.14 95.62deg); + --color-warning-800: oklch(64.73% 0.13 95.92deg); + --color-warning-900: oklch(56.77% 0.11 94.87deg); + --color-warning-950: oklch(48.63% 0.1 95.22deg); + --color-warning-contrast-dark: var(--color-warning-950); + --color-warning-contrast-light: var(--color-warning-50); + --color-warning-contrast-50: var(--color-warning-contrast-dark); + --color-warning-contrast-100: var(--color-warning-contrast-dark); + --color-warning-contrast-200: var(--color-warning-contrast-dark); + --color-warning-contrast-300: var(--color-warning-contrast-dark); + --color-warning-contrast-400: var(--color-warning-contrast-dark); + --color-warning-contrast-500: var(--color-warning-contrast-dark); + --color-warning-contrast-600: var(--color-warning-contrast-dark); + --color-warning-contrast-700: var(--color-warning-contrast-dark); + --color-warning-contrast-800: var(--color-warning-contrast-light); + --color-warning-contrast-900: var(--color-warning-contrast-light); + --color-warning-contrast-950: var(--color-warning-contrast-light); + --color-error-50: oklch(81.88% 0.1 38.14deg); + --color-error-100: oklch(75.88% 0.13 31.15deg); + --color-error-200: oklch(70.29% 0.16 27.32deg); + --color-error-300: oklch(65.15% 0.19 25.65deg); + --color-error-400: oklch(60.98% 0.21 25.56deg); + --color-error-500: oklch(57.86% 0.22 26.62deg); + --color-error-600: oklch(52.52% 0.2 26.86deg); + --color-error-700: oklch(46.81% 0.18 27.02deg); + --color-error-800: oklch(41.15% 0.16 27.63deg); + --color-error-900: oklch(35.01% 0.14 27.9deg); + --color-error-950: oklch(28.69% 0.12 29.23deg); + --color-error-contrast-dark: var(--color-error-950); + --color-error-contrast-light: var(--color-error-50); + --color-error-contrast-50: var(--color-error-contrast-dark); + --color-error-contrast-100: var(--color-error-contrast-dark); + --color-error-contrast-200: var(--color-error-contrast-dark); + --color-error-contrast-300: var(--color-error-contrast-dark); + --color-error-contrast-400: 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-700: var(--color-error-contrast-light); + --color-error-contrast-800: var(--color-error-contrast-light); + --color-error-contrast-900: var(--color-error-contrast-light); + --color-error-contrast-950: var(--color-error-contrast-light); + --color-surface-50: oklch(100% 0 none); + --color-surface-100: oklch(93.98% 0 105.57deg); + --color-surface-200: oklch(87.66% 0 67.88deg); + --color-surface-300: oklch(81.35% 0 106.1deg); + --color-surface-400: oklch(74.79% 0 84.45deg); + --color-surface-500: oklch(68.29% 0 91.36deg); + --color-surface-600: oklch(60.99% 0 91.38deg); + --color-surface-700: oklch(53.5% 0 84.49deg); + --color-surface-800: oklch(46.03% 0 91.43deg); + --color-surface-900: oklch(37.94% 0 84.52deg); + --color-surface-950: oklch(29.34% 0 84.54deg); + --color-surface-contrast-dark: var(--color-surface-950); + --color-surface-contrast-light: var(--color-surface-50); + --color-surface-contrast-50: var(--color-surface-contrast-dark); + --color-surface-contrast-100: var(--color-surface-contrast-dark); + --color-surface-contrast-200: var(--color-surface-contrast-dark); + --color-surface-contrast-300: var(--color-surface-contrast-dark); + --color-surface-contrast-400: var(--color-surface-contrast-dark); + --color-surface-contrast-500: var(--color-surface-contrast-dark); + --color-surface-contrast-600: var(--color-surface-contrast-dark); + --color-surface-contrast-700: 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-950: var(--color-surface-contrast-light); } diff --git a/src/aeclci_v1.css b/src/aeclci_v1.css index ac608b21..316d8d38 100644 --- a/src/aeclci_v1.css +++ b/src/aeclci_v1.css @@ -1,205 +1,205 @@ [data-theme='aeclci'] { - --text-scaling: 1.067; - --base-font-color: var(--color-surface-950); - --base-font-color-dark: var(--color-surface-50); - --base-font-family: system-ui, sans-serif; - --base-font-size: inherit; - --base-line-height: inherit; - --base-font-weight: normal; - --base-font-style: normal; - --base-letter-spacing: 0em; - --heading-font-color: inherit; - --heading-font-color-dark: inherit; - --heading-font-family: inherit; - --heading-font-weight: bold; - --heading-font-style: normal; - --heading-letter-spacing: inherit; - --anchor-font-color: var(--color-primary-500); - --anchor-font-color-dark: var(--color-primary-500); - --anchor-font-family: inherit; - --anchor-font-size: inherit; - --anchor-line-height: inherit; - --anchor-font-weight: inherit; - --anchor-font-style: inherit; - --anchor-letter-spacing: inherit; - --anchor-text-decoration: none; - --anchor-text-decoration-hover: underline; - --anchor-text-decoration-active: none; - --anchor-text-decoration-focus: none; - --spacing: 0.25rem; - --radius-base: 0.375rem; - --radius-container: 0.75rem; - --default-border-width: 1px; - --default-divide-width: 1px; - --default-ring-width: 1px; - --body-background-color: var(--color-surface-50); - --body-background-color-dark: var(--color-surface-950); - --color-primary-50: oklch(85.1% 0.07 265.19deg); - --color-primary-100: oklch(77.89% 0.08 264.31deg); - --color-primary-200: oklch(70.32% 0.08 264.44deg); - --color-primary-300: oklch(62.86% 0.09 263.87deg); - --color-primary-400: oklch(54.96% 0.1 263.8deg); - --color-primary-500: oklch(47.12% 0.11 262.88deg); - --color-primary-600: oklch(40.9% 0.1 264.73deg); - --color-primary-700: oklch(34.53% 0.1 267.34deg); - --color-primary-800: oklch(28.16% 0.09 268.81deg); - --color-primary-900: oklch(21.29% 0.09 271.12deg); - --color-primary-950: oklch(12.88% 0.09 264.05deg); - --color-primary-contrast-dark: var(--color-primary-950); - --color-primary-contrast-light: var(--color-primary-50); - --color-primary-contrast-50: var(--color-primary-contrast-dark); - --color-primary-contrast-100: var(--color-primary-contrast-dark); - --color-primary-contrast-200: var(--color-primary-contrast-dark); - --color-primary-contrast-300: var(--color-primary-contrast-dark); - --color-primary-contrast-400: var(--color-primary-contrast-dark); - --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); - --color-primary-contrast-900: var(--color-primary-contrast-light); - --color-primary-contrast-950: var(--color-primary-contrast-light); - --color-secondary-50: oklch(73.24% 0.12 278.78deg); - --color-secondary-100: oklch(65.76% 0.12 276.12deg); - --color-secondary-200: oklch(58.15% 0.12 273.33deg); - --color-secondary-300: oklch(50.59% 0.12 270.28deg); - --color-secondary-400: oklch(42.65% 0.12 267.23deg); - --color-secondary-500: oklch(34.53% 0.12 264.22deg); - --color-secondary-600: oklch(30.3% 0.11 264.59deg); - --color-secondary-700: oklch(25.96% 0.09 265.69deg); - --color-secondary-800: oklch(21.25% 0.08 267.5deg); - --color-secondary-900: oklch(16.42% 0.06 269.55deg); - --color-secondary-950: oklch(8.85% 0.06 264.05deg); - --color-secondary-contrast-dark: var(--color-secondary-950); - --color-secondary-contrast-light: var(--color-secondary-50); - --color-secondary-contrast-50: var(--color-secondary-contrast-dark); - --color-secondary-contrast-100: var(--color-secondary-contrast-dark); - --color-secondary-contrast-200: var(--color-secondary-contrast-dark); - --color-secondary-contrast-300: var(--color-secondary-contrast-light); - --color-secondary-contrast-400: var(--color-secondary-contrast-light); - --color-secondary-contrast-500: 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-800: var(--color-secondary-contrast-light); - --color-secondary-contrast-900: var(--color-secondary-contrast-light); - --color-secondary-contrast-950: var(--color-secondary-contrast-light); - --color-tertiary-50: oklch(87.75% 0.12 326.52deg); - --color-tertiary-100: oklch(80.92% 0.13 323.93deg); - --color-tertiary-200: oklch(73.87% 0.14 321.55deg); - --color-tertiary-300: oklch(66.9% 0.15 319.41deg); - --color-tertiary-400: oklch(59.72% 0.16 317.25deg); - --color-tertiary-500: oklch(52.73% 0.17 315.13deg); - --color-tertiary-600: oklch(46.6% 0.16 314.18deg); - --color-tertiary-700: oklch(40.43% 0.14 312.8deg); - --color-tertiary-800: oklch(33.85% 0.13 309.88deg); - --color-tertiary-900: oklch(27.23% 0.12 306.83deg); - --color-tertiary-950: oklch(19.83% 0.1 302.7deg); - --color-tertiary-contrast-dark: var(--color-tertiary-950); - --color-tertiary-contrast-light: var(--color-tertiary-50); - --color-tertiary-contrast-50: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-100: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-200: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-300: var(--color-tertiary-contrast-dark); - --color-tertiary-contrast-400: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-500: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-600: var(--color-tertiary-contrast-light); - --color-tertiary-contrast-700: 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-950: var(--color-tertiary-contrast-light); - --color-success-50: oklch(95.23% 0.07 195.99deg); - --color-success-100: oklch(90.22% 0.09 189.46deg); - --color-success-200: oklch(85.11% 0.1 186.03deg); - --color-success-300: oklch(80.35% 0.12 181.75deg); - --color-success-400: oklch(75.55% 0.12 178.92deg); - --color-success-500: oklch(71.19% 0.13 174.73deg); - --color-success-600: oklch(64.29% 0.12 173.65deg); - --color-success-700: oklch(57.46% 0.11 171.75deg); - --color-success-800: oklch(50.18% 0.1 170.68deg); - --color-success-900: oklch(42.87% 0.09 167.65deg); - --color-success-950: oklch(34.91% 0.07 164.42deg); - --color-success-contrast-dark: var(--color-success-950); - --color-success-contrast-light: var(--color-success-50); - --color-success-contrast-50: var(--color-success-contrast-dark); - --color-success-contrast-100: var(--color-success-contrast-dark); - --color-success-contrast-200: var(--color-success-contrast-dark); - --color-success-contrast-300: var(--color-success-contrast-dark); - --color-success-contrast-400: var(--color-success-contrast-dark); - --color-success-contrast-500: var(--color-success-contrast-dark); - --color-success-contrast-600: var(--color-success-contrast-dark); - --color-success-contrast-700: 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-950: var(--color-success-contrast-light); - --color-warning-50: oklch(95.67% 0.05 84.56deg); - --color-warning-100: oklch(92.83% 0.06 82.16deg); - --color-warning-200: oklch(90.12% 0.08 80.33deg); - --color-warning-300: oklch(87.59% 0.1 80.01deg); - --color-warning-400: oklch(85.03% 0.12 78.35deg); - --color-warning-500: oklch(82.46% 0.14 76.71deg); - --color-warning-600: oklch(76.34% 0.13 72.25deg); - --color-warning-700: oklch(70.34% 0.13 68.09deg); - --color-warning-800: oklch(63.99% 0.13 63.18deg); - --color-warning-900: oklch(57.91% 0.13 57.97deg); - --color-warning-950: oklch(51.69% 0.13 51.44deg); - --color-warning-contrast-dark: var(--color-warning-950); - --color-warning-contrast-light: var(--color-warning-50); - --color-warning-contrast-50: var(--color-warning-contrast-dark); - --color-warning-contrast-100: var(--color-warning-contrast-dark); - --color-warning-contrast-200: var(--color-warning-contrast-dark); - --color-warning-contrast-300: var(--color-warning-contrast-dark); - --color-warning-contrast-400: var(--color-warning-contrast-dark); - --color-warning-contrast-500: var(--color-warning-contrast-dark); - --color-warning-contrast-600: var(--color-warning-contrast-light); - --color-warning-contrast-700: 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-950: var(--color-warning-contrast-light); - --color-error-50: oklch(84.29% 0.09 46.91deg); - --color-error-100: oklch(78.63% 0.12 39.19deg); - --color-error-200: oklch(72.92% 0.14 34.35deg); - --color-error-300: oklch(67.88% 0.17 31.48deg); - --color-error-400: oklch(63.09% 0.19 30.02deg); - --color-error-500: oklch(59.32% 0.21 29.47deg); - --color-error-600: oklch(53.56% 0.19 29.25deg); - --color-error-700: oklch(47.75% 0.17 29.2deg); - --color-error-800: oklch(41.51% 0.15 28.7deg); - --color-error-900: oklch(35.35% 0.14 28.7deg); - --color-error-950: oklch(28.69% 0.12 29.23deg); - --color-error-contrast-dark: var(--color-error-950); - --color-error-contrast-light: var(--color-error-50); - --color-error-contrast-50: var(--color-error-contrast-dark); - --color-error-contrast-100: var(--color-error-contrast-dark); - --color-error-contrast-200: var(--color-error-contrast-dark); - --color-error-contrast-300: var(--color-error-contrast-dark); - --color-error-contrast-400: var(--color-error-contrast-dark); - --color-error-contrast-500: var(--color-error-contrast-light); - --color-error-contrast-600: var(--color-error-contrast-light); - --color-error-contrast-700: var(--color-error-contrast-light); - --color-error-contrast-800: var(--color-error-contrast-light); - --color-error-contrast-900: var(--color-error-contrast-light); - --color-error-contrast-950: var(--color-error-contrast-light); - --color-surface-50: oklch(100% 0 none); - --color-surface-100: oklch(97.02% 0 none); - --color-surface-200: oklch(94.01% 0 none); - --color-surface-300: oklch(91.12% 0 196.34deg); - --color-surface-400: oklch(88.07% 0 196.37deg); - --color-surface-500: oklch(84.99% 0 196.4deg); - --color-surface-600: oklch(77.78% 0 196.47deg); - --color-surface-700: oklch(70.09% 0 196.54deg); - --color-surface-800: oklch(62.51% 0 196.61deg); - --color-surface-900: oklch(54.34% 0 196.68deg); - --color-surface-950: oklch(46.22% 0 196.73deg); - --color-surface-contrast-dark: var(--color-surface-950); - --color-surface-contrast-light: var(--color-surface-50); - --color-surface-contrast-50: var(--color-surface-contrast-dark); - --color-surface-contrast-100: var(--color-surface-contrast-dark); - --color-surface-contrast-200: var(--color-surface-contrast-dark); - --color-surface-contrast-300: var(--color-surface-contrast-dark); - --color-surface-contrast-400: var(--color-surface-contrast-dark); - --color-surface-contrast-500: var(--color-surface-contrast-dark); - --color-surface-contrast-600: var(--color-surface-contrast-dark); - --color-surface-contrast-700: var(--color-surface-contrast-dark); - --color-surface-contrast-800: var(--color-surface-contrast-dark); - --color-surface-contrast-900: var(--color-surface-contrast-light); - --color-surface-contrast-950: var(--color-surface-contrast-light); + --text-scaling: 1.067; + --base-font-color: var(--color-surface-950); + --base-font-color-dark: var(--color-surface-50); + --base-font-family: system-ui, sans-serif; + --base-font-size: inherit; + --base-line-height: inherit; + --base-font-weight: normal; + --base-font-style: normal; + --base-letter-spacing: 0em; + --heading-font-color: inherit; + --heading-font-color-dark: inherit; + --heading-font-family: inherit; + --heading-font-weight: bold; + --heading-font-style: normal; + --heading-letter-spacing: inherit; + --anchor-font-color: var(--color-primary-500); + --anchor-font-color-dark: var(--color-primary-500); + --anchor-font-family: inherit; + --anchor-font-size: inherit; + --anchor-line-height: inherit; + --anchor-font-weight: inherit; + --anchor-font-style: inherit; + --anchor-letter-spacing: inherit; + --anchor-text-decoration: none; + --anchor-text-decoration-hover: underline; + --anchor-text-decoration-active: none; + --anchor-text-decoration-focus: none; + --spacing: 0.25rem; + --radius-base: 0.375rem; + --radius-container: 0.75rem; + --default-border-width: 1px; + --default-divide-width: 1px; + --default-ring-width: 1px; + --body-background-color: var(--color-surface-50); + --body-background-color-dark: var(--color-surface-950); + --color-primary-50: oklch(85.1% 0.07 265.19deg); + --color-primary-100: oklch(77.89% 0.08 264.31deg); + --color-primary-200: oklch(70.32% 0.08 264.44deg); + --color-primary-300: oklch(62.86% 0.09 263.87deg); + --color-primary-400: oklch(54.96% 0.1 263.8deg); + --color-primary-500: oklch(47.12% 0.11 262.88deg); + --color-primary-600: oklch(40.9% 0.1 264.73deg); + --color-primary-700: oklch(34.53% 0.1 267.34deg); + --color-primary-800: oklch(28.16% 0.09 268.81deg); + --color-primary-900: oklch(21.29% 0.09 271.12deg); + --color-primary-950: oklch(12.88% 0.09 264.05deg); + --color-primary-contrast-dark: var(--color-primary-950); + --color-primary-contrast-light: var(--color-primary-50); + --color-primary-contrast-50: var(--color-primary-contrast-dark); + --color-primary-contrast-100: var(--color-primary-contrast-dark); + --color-primary-contrast-200: var(--color-primary-contrast-dark); + --color-primary-contrast-300: var(--color-primary-contrast-dark); + --color-primary-contrast-400: var(--color-primary-contrast-dark); + --color-primary-contrast-500: 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-800: var(--color-primary-contrast-light); + --color-primary-contrast-900: var(--color-primary-contrast-light); + --color-primary-contrast-950: var(--color-primary-contrast-light); + --color-secondary-50: oklch(73.24% 0.12 278.78deg); + --color-secondary-100: oklch(65.76% 0.12 276.12deg); + --color-secondary-200: oklch(58.15% 0.12 273.33deg); + --color-secondary-300: oklch(50.59% 0.12 270.28deg); + --color-secondary-400: oklch(42.65% 0.12 267.23deg); + --color-secondary-500: oklch(34.53% 0.12 264.22deg); + --color-secondary-600: oklch(30.3% 0.11 264.59deg); + --color-secondary-700: oklch(25.96% 0.09 265.69deg); + --color-secondary-800: oklch(21.25% 0.08 267.5deg); + --color-secondary-900: oklch(16.42% 0.06 269.55deg); + --color-secondary-950: oklch(8.85% 0.06 264.05deg); + --color-secondary-contrast-dark: var(--color-secondary-950); + --color-secondary-contrast-light: var(--color-secondary-50); + --color-secondary-contrast-50: var(--color-secondary-contrast-dark); + --color-secondary-contrast-100: var(--color-secondary-contrast-dark); + --color-secondary-contrast-200: var(--color-secondary-contrast-dark); + --color-secondary-contrast-300: var(--color-secondary-contrast-light); + --color-secondary-contrast-400: var(--color-secondary-contrast-light); + --color-secondary-contrast-500: 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-800: var(--color-secondary-contrast-light); + --color-secondary-contrast-900: var(--color-secondary-contrast-light); + --color-secondary-contrast-950: var(--color-secondary-contrast-light); + --color-tertiary-50: oklch(87.75% 0.12 326.52deg); + --color-tertiary-100: oklch(80.92% 0.13 323.93deg); + --color-tertiary-200: oklch(73.87% 0.14 321.55deg); + --color-tertiary-300: oklch(66.9% 0.15 319.41deg); + --color-tertiary-400: oklch(59.72% 0.16 317.25deg); + --color-tertiary-500: oklch(52.73% 0.17 315.13deg); + --color-tertiary-600: oklch(46.6% 0.16 314.18deg); + --color-tertiary-700: oklch(40.43% 0.14 312.8deg); + --color-tertiary-800: oklch(33.85% 0.13 309.88deg); + --color-tertiary-900: oklch(27.23% 0.12 306.83deg); + --color-tertiary-950: oklch(19.83% 0.1 302.7deg); + --color-tertiary-contrast-dark: var(--color-tertiary-950); + --color-tertiary-contrast-light: var(--color-tertiary-50); + --color-tertiary-contrast-50: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-100: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-200: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-300: var(--color-tertiary-contrast-dark); + --color-tertiary-contrast-400: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-500: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-600: var(--color-tertiary-contrast-light); + --color-tertiary-contrast-700: 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-950: var(--color-tertiary-contrast-light); + --color-success-50: oklch(95.23% 0.07 195.99deg); + --color-success-100: oklch(90.22% 0.09 189.46deg); + --color-success-200: oklch(85.11% 0.1 186.03deg); + --color-success-300: oklch(80.35% 0.12 181.75deg); + --color-success-400: oklch(75.55% 0.12 178.92deg); + --color-success-500: oklch(71.19% 0.13 174.73deg); + --color-success-600: oklch(64.29% 0.12 173.65deg); + --color-success-700: oklch(57.46% 0.11 171.75deg); + --color-success-800: oklch(50.18% 0.1 170.68deg); + --color-success-900: oklch(42.87% 0.09 167.65deg); + --color-success-950: oklch(34.91% 0.07 164.42deg); + --color-success-contrast-dark: var(--color-success-950); + --color-success-contrast-light: var(--color-success-50); + --color-success-contrast-50: var(--color-success-contrast-dark); + --color-success-contrast-100: var(--color-success-contrast-dark); + --color-success-contrast-200: var(--color-success-contrast-dark); + --color-success-contrast-300: var(--color-success-contrast-dark); + --color-success-contrast-400: var(--color-success-contrast-dark); + --color-success-contrast-500: var(--color-success-contrast-dark); + --color-success-contrast-600: var(--color-success-contrast-dark); + --color-success-contrast-700: 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-950: var(--color-success-contrast-light); + --color-warning-50: oklch(95.67% 0.05 84.56deg); + --color-warning-100: oklch(92.83% 0.06 82.16deg); + --color-warning-200: oklch(90.12% 0.08 80.33deg); + --color-warning-300: oklch(87.59% 0.1 80.01deg); + --color-warning-400: oklch(85.03% 0.12 78.35deg); + --color-warning-500: oklch(82.46% 0.14 76.71deg); + --color-warning-600: oklch(76.34% 0.13 72.25deg); + --color-warning-700: oklch(70.34% 0.13 68.09deg); + --color-warning-800: oklch(63.99% 0.13 63.18deg); + --color-warning-900: oklch(57.91% 0.13 57.97deg); + --color-warning-950: oklch(51.69% 0.13 51.44deg); + --color-warning-contrast-dark: var(--color-warning-950); + --color-warning-contrast-light: var(--color-warning-50); + --color-warning-contrast-50: var(--color-warning-contrast-dark); + --color-warning-contrast-100: var(--color-warning-contrast-dark); + --color-warning-contrast-200: var(--color-warning-contrast-dark); + --color-warning-contrast-300: var(--color-warning-contrast-dark); + --color-warning-contrast-400: var(--color-warning-contrast-dark); + --color-warning-contrast-500: var(--color-warning-contrast-dark); + --color-warning-contrast-600: var(--color-warning-contrast-light); + --color-warning-contrast-700: 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-950: var(--color-warning-contrast-light); + --color-error-50: oklch(84.29% 0.09 46.91deg); + --color-error-100: oklch(78.63% 0.12 39.19deg); + --color-error-200: oklch(72.92% 0.14 34.35deg); + --color-error-300: oklch(67.88% 0.17 31.48deg); + --color-error-400: oklch(63.09% 0.19 30.02deg); + --color-error-500: oklch(59.32% 0.21 29.47deg); + --color-error-600: oklch(53.56% 0.19 29.25deg); + --color-error-700: oklch(47.75% 0.17 29.2deg); + --color-error-800: oklch(41.51% 0.15 28.7deg); + --color-error-900: oklch(35.35% 0.14 28.7deg); + --color-error-950: oklch(28.69% 0.12 29.23deg); + --color-error-contrast-dark: var(--color-error-950); + --color-error-contrast-light: var(--color-error-50); + --color-error-contrast-50: var(--color-error-contrast-dark); + --color-error-contrast-100: var(--color-error-contrast-dark); + --color-error-contrast-200: var(--color-error-contrast-dark); + --color-error-contrast-300: var(--color-error-contrast-dark); + --color-error-contrast-400: var(--color-error-contrast-dark); + --color-error-contrast-500: var(--color-error-contrast-light); + --color-error-contrast-600: var(--color-error-contrast-light); + --color-error-contrast-700: var(--color-error-contrast-light); + --color-error-contrast-800: var(--color-error-contrast-light); + --color-error-contrast-900: var(--color-error-contrast-light); + --color-error-contrast-950: var(--color-error-contrast-light); + --color-surface-50: oklch(100% 0 none); + --color-surface-100: oklch(97.02% 0 none); + --color-surface-200: oklch(94.01% 0 none); + --color-surface-300: oklch(91.12% 0 196.34deg); + --color-surface-400: oklch(88.07% 0 196.37deg); + --color-surface-500: oklch(84.99% 0 196.4deg); + --color-surface-600: oklch(77.78% 0 196.47deg); + --color-surface-700: oklch(70.09% 0 196.54deg); + --color-surface-800: oklch(62.51% 0 196.61deg); + --color-surface-900: oklch(54.34% 0 196.68deg); + --color-surface-950: oklch(46.22% 0 196.73deg); + --color-surface-contrast-dark: var(--color-surface-950); + --color-surface-contrast-light: var(--color-surface-50); + --color-surface-contrast-50: var(--color-surface-contrast-dark); + --color-surface-contrast-100: var(--color-surface-contrast-dark); + --color-surface-contrast-200: var(--color-surface-contrast-dark); + --color-surface-contrast-300: var(--color-surface-contrast-dark); + --color-surface-contrast-400: var(--color-surface-contrast-dark); + --color-surface-contrast-500: var(--color-surface-contrast-dark); + --color-surface-contrast-600: var(--color-surface-contrast-dark); + --color-surface-contrast-700: var(--color-surface-contrast-dark); + --color-surface-contrast-800: var(--color-surface-contrast-dark); + --color-surface-contrast-900: var(--color-surface-contrast-light); + --color-surface-contrast-950: var(--color-surface-contrast-light); } diff --git a/src/app.css b/src/app.css index 106d71a4..ebd92cfb 100644 --- a/src/app.css +++ b/src/app.css @@ -43,38 +43,38 @@ /* @custom-variant dark (&:where([data-mode="dark"], [data-mode="dark"] *)); */ @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%; - } + :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 { + /* .dark { --background: 224 71.4% 4.1%; --foreground: 210 20% 98%; --muted: 215 27.9% 16.9%; @@ -106,37 +106,37 @@ } @layer base { - * { - border-color: hsl(var(--border)); - } - body { - background-color: hsl(var(--background)); - color: hsl(var(--foreground)); - } + * { + 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; + @apply h-full overflow-hidden; - /* font-family: 'Liberation Sans', sans-serif; */ - /* font-family: 'Noto Sans', sans-serif; */ + /* font-family: 'Liberation Sans', sans-serif; */ + /* font-family: 'Noto Sans', sans-serif; */ } html.super_access #appShell { - background-color: hsla(0, 100%, 50%, 0.5); + background-color: hsla(0, 100%, 50%, 0.5); } html.manager_access #appShell { - background-color: hsla(0, 50%, 75%, 0.5); + background-color: hsla(0, 50%, 75%, 0.5); } html.administrator_access #appShell { - background-color: hsla(40, 50%, 85%, 0.25); + background-color: hsla(40, 50%, 85%, 0.25); } html.trusted_access #appShell { - background-color: hsla(20, 50%, 85%, 0.25); + background-color: hsla(20, 50%, 85%, 0.25); } /* default theme */ @@ -150,9 +150,9 @@ html.trusted_access #appShell { /* modern theme */ @font-face { - font-family: 'Quicksand'; - src: url('/fonts/Quicksand.ttf'); - font-display: swap; + font-family: 'Quicksand'; + src: url('/fonts/Quicksand.ttf'); + font-display: swap; } /* :root [data-theme='modern'] { */ @@ -274,114 +274,114 @@ html.trusted_access #appShell { /* Buttons default to the tonal presets */ /* Buttons based on Skeleton Tailwind preset classes */ .ae_btn_neutral { - @apply preset-tonal hover:preset-outlined border transition-all; + @apply preset-tonal hover:preset-outlined border transition-all; } .ae_btn_primary { - @apply preset-tonal-primary border border-primary-500 transition-all; + @apply preset-tonal-primary border border-primary-500 transition-all; } .ae_btn_secondary { - @apply preset-tonal-secondary border border-secondary-500 transition-all; - /* hover:preset-filled-secondary-500 */ + @apply preset-tonal-secondary border border-secondary-500 transition-all; + /* hover:preset-filled-secondary-500 */ } .ae_btn_tertiary { - @apply preset-tonal-tertiary border border-tertiary-500 transition-all; + @apply preset-tonal-tertiary border border-tertiary-500 transition-all; } .ae_btn_success { - @apply preset-tonal-success border border-success-500 transition-all; + @apply preset-tonal-success border border-success-500 transition-all; } .ae_btn_warning { - @apply preset-tonal-warning border border-warning-500 text-warning-950-50 transition-all; + @apply preset-tonal-warning border border-warning-500 text-warning-950-50 transition-all; } .ae_btn_error { - @apply preset-tonal-error border border-error-500 transition-all; + @apply preset-tonal-error border border-error-500 transition-all; } .ae_btn_surface { - @apply preset-tonal-surface border border-surface-500 transition-all; + @apply preset-tonal-surface border border-surface-500 transition-all; } /* Buttons customized for Aether using Skeleton Tailwind preset classes */ .ae_btn_info { - @apply border text-cyan-950 dark:text-cyan-50 bg-cyan-50 dark:bg-cyan-950 border-cyan-100 dark:border-cyan-900 hover:bg-cyan-200 hover:dark:bg-cyan-800 transition-all; + @apply border text-cyan-950 dark:text-cyan-50 bg-cyan-50 dark:bg-cyan-950 border-cyan-100 dark:border-cyan-900 hover:bg-cyan-200 hover:dark:bg-cyan-800 transition-all; } /* Buttons are for filled and outlined presets */ .ae_btn_secondary_filled { - @apply preset-filled-secondary-200-800 border border-secondary-500 transition-all; - /* hover:preset-filled-secondary-500 */ + @apply preset-filled-secondary-200-800 border border-secondary-500 transition-all; + /* hover:preset-filled-secondary-500 */ } .ae_btn_secondary_outlined { - @apply preset-outlined-secondary-200-800 hover:preset-filled-secondary-400-600 text-secondary-950-50 transition-all; + @apply preset-outlined-secondary-200-800 hover:preset-filled-secondary-400-600 text-secondary-950-50 transition-all; } .ae_btn_success_filled { - @apply preset-filled-success-200-800 border border-success-500 transition-all; + @apply preset-filled-success-200-800 border border-success-500 transition-all; } .ae_btn_success_outlined { - @apply preset-outlined-success-200-800 hover:preset-filled-success-400-600 text-success-950-50 transition-all; + @apply preset-outlined-success-200-800 hover:preset-filled-success-400-600 text-success-950-50 transition-all; } .ae_btn_warning_filled { - @apply preset-filled-warning-200-800 border border-warning-500 transition-all; + @apply preset-filled-warning-200-800 border border-warning-500 transition-all; } .ae_btn_warning_outlined { - @apply preset-outlined-warning-200-800 hover:preset-filled-warning-400-600 text-warning-950-50 transition-all; + @apply preset-outlined-warning-200-800 hover:preset-filled-warning-400-600 text-warning-950-50 transition-all; } .ae_btn_surface_filled { - @apply preset-filled-surface-200-800 border border-surface-500 transition-all; + @apply preset-filled-surface-200-800 border border-surface-500 transition-all; } .ae_btn_surface_outlined { - @apply preset-outlined-surface-200-800 hover:preset-filled-surface-400-600 text-surface-950-50 transition-all; + @apply preset-outlined-surface-200-800 hover:preset-filled-surface-400-600 text-surface-950-50 transition-all; } .ae_btn_error_outlined { - @apply preset-outlined-error-200-800 hover:preset-filled-error-400-600 text-error-950-50 transition-all; + @apply preset-outlined-error-200-800 hover:preset-filled-error-400-600 text-error-950-50 transition-all; } .ae_btn_info_filled { - @apply border text-cyan-950 dark:text-cyan-50 bg-cyan-200 dark:bg-cyan-800 border-cyan-200 dark:border-cyan-800 transition-all; + @apply border text-cyan-950 dark:text-cyan-50 bg-cyan-200 dark:bg-cyan-800 border-cyan-200 dark:border-cyan-800 transition-all; } .ae_btn_info_outlined { - @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 */ .ae_container_system_menu { - @apply container; + @apply container; } .ae_container_system_options { - @apply container; + @apply container; } .ae_container_system_help { - @apply container; + @apply container; } .ae_container_module { - @apply container; - /* @apply container mx-auto max-w-7xl px-4 sm:px-6 lg:px-8; */ + @apply container; + /* @apply container mx-auto max-w-7xl px-4 sm:px-6 lg:px-8; */ } /* .ae_container_module_main { @apply container; } */ .ae_module_header { - /* LCI request 3a5997 */ - /* bg-gray-300 */ - @apply preset-tonal-surface rounded-md flex flex-col md:flex-row flex-wrap gap-0.25 items-center justify-between w-full max-w-7xl p-1 px-2; + /* LCI request 3a5997 */ + /* bg-gray-300 */ + @apply preset-tonal-surface rounded-md flex flex-col md:flex-row flex-wrap gap-0.25 items-center justify-between w-full max-w-7xl p-1 px-2; } [data-theme='AE_c_LCI'] .ae_module_header { - /* LCI request 3a5997 */ - /* bg-gray-300 */ - @apply preset-tonal-primary; + /* LCI request 3a5997 */ + /* bg-gray-300 */ + @apply preset-tonal-primary; } [data-theme='AE_c_LCI'] .ae_obj__event_presenter { - @apply preset-filled-success-500; - /* --color-success-500; */ + @apply preset-filled-success-500; + /* --color-success-500; */ } .ae_container_module_content { - @apply container; + @apply container; } .ae_container_module_menu { - @apply w-full max-w-7xl flex flex-col items-center justify-center gap-1 p-1 + @apply w-full max-w-7xl flex flex-col items-center justify-center gap-1 p-1 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 { - @apply text-cyan-950 dark:text-cyan-50 + @apply text-cyan-950 dark:text-cyan-50 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 rounded-md @@ -391,50 +391,50 @@ html.trusted_access #appShell { transition-all; } .ae_container_module_help { - @apply text-yellow-950 dark:text-yellow-50 + @apply text-yellow-950 dark:text-yellow-50 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 rounded-md w-lg max-w-full p-2 transition-all; - /* 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_actions { - @apply container preset-tonal-success border border-success-500 rounded-md flex flex-row items-center my-2 p-2; + @apply container preset-tonal-success border border-success-500 rounded-md flex flex-row items-center my-2 p-2; } .ae_container_results { - @apply container; + @apply container; } .ae_container_content { - @apply container; + @apply container; } .ae_container_content_header { - @apply container; + @apply container; } .ae_container_content_content { - @apply container; + @apply container; } .ae_container_content_footer { - @apply container; + @apply container; } .ae_container_alert { - @apply container; + @apply container; } .ae_container_help { - @apply text-yellow-950 dark:text-yellow-50 + @apply text-yellow-950 dark:text-yellow-50 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 rounded-md max-w-full p-2 transition-all; - /* 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 { - @apply text-cyan-950 dark:text-cyan-50 + @apply text-cyan-950 dark:text-cyan-50 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 rounded-md @@ -443,26 +443,26 @@ html.trusted_access #appShell { transition-all; } .ae_container_msg { - @apply container; + @apply container; } .ae_container_warning { - @apply container; + @apply container; } .ae_container_tag { - @apply container; + @apply container; } .ae_container_modal { - @apply container mx-auto max-w-7xl px-4 sm:px-6 lg:px-8; + @apply container mx-auto max-w-7xl px-4 sm:px-6 lg:px-8; } .ae_container_modal_header { - @apply container; + @apply container; } .ae_container_modal_content { - @apply container; + @apply container; } .ae_container_modal_footer { - @apply container; + @apply container; } /* Standard Aether object properties: @@ -477,63 +477,63 @@ html.trusted_access #appShell { */ .card-footer { - border-top: 1px solid hsla(0, 0%, 0%, 0.5); - margin-top: 1em; - padding-top: 1em; + border-top: 1px solid hsla(0, 0%, 0%, 0.5); + margin-top: 1em; + padding-top: 1em; - opacity: 0.5; + opacity: 0.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; + display: none; } .ae_d_none { - display: none; + display: none; } /* Allow content to scroll horizontal if too wide */ .ae_h_scrollfix { - max-width: 100%; - overflow-x: auto; + 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%; */ + /* 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); + /* 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.5); - /* A light pink background color */ - background-color: hsla(0, 100%, 50%, 0.4); + /* A darker pink outline */ + outline-color: hsla(0, 100%, 50%, 0.5); + /* A light pink background color */ + background-color: hsla(0, 100%, 50%, 0.4); } /* Deal with being in an iframe */ #appShell #shell-header.iframe { - display: none; + display: none; } #appShell #shell-footer.iframe { - display: none; + display: none; } .iframe .module_header, .iframe .module_footer { - display: none; + display: none; } /* Remove the background from the body in all cases */ @@ -551,14 +551,14 @@ html.trusted_access #appShell { /* } */ main { - /* background: none; + /* background: none; background-color: hsla(0, 0%, 100%, 0.92); */ } main > section { - background: none; - background-color: hsla(0, 0%, 100%, 0.92); - padding: 0.5em; + background: none; + background-color: hsla(0, 0%, 100%, 0.92); + padding: 0.5em; } /* @media (min-width: 640px) { @@ -576,36 +576,36 @@ main > section { } */ .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; */ + /* 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; + white-space: pre-wrap; + word-break: normal; + word-wrap: normal; - border: none; + border: none; - max-width: 100%; - overflow-x: auto; + max-width: 100%; + overflow-x: auto; } input.required { - /* border-right: solid medium var(--color-warning-500); */ - /* color: var(--color-warning-500); */ + /* 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); */ + /* 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); */ + /* 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); @@ -623,12 +623,12 @@ input:required { } */ .input_required::after { - content: '*'; - color: rgb(var(--color-error-500) / 0.9); + content: '*'; + color: rgb(var(--color-error-500) / 0.9); - position: relative; - /* top: 0em; */ - left: 0.25em; + position: relative; + /* top: 0em; */ + left: 0.25em; } /* Make the group a flex row by default */ @@ -646,8 +646,8 @@ input:required { /* 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; + border-radius: 0; + border: none; } /* .md:btn-group button, @@ -669,167 +669,167 @@ div.btn-group button:last-child { } .ae_obj_prop .value { - font-weight: bold; + font-weight: bold; } .ae_md_hide { - /* outline: medium dashed green; */ - /* display: none; */ + /* outline: medium dashed green; */ + /* display: none; */ } @media (max-width: 767px) { - .ae_md_hide { - /* outline: medium dashed red; */ - display: none; - } + .ae_md_hide { + /* outline: medium dashed red; */ + display: none; + } } @media (min-width: 768px) { - .ae_lg_hide { - /* outline: medium dashed blue; */ - display: none; - } + .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%, 0.5); + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 100; + 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. */ section.ae_quick_popover { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - z-index: 100; - background-color: hsla(0, 0%, 100%, 0.95); - padding: 1rem; - border-radius: 0.5rem; - box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5); + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 100; + background-color: hsla(0, 0%, 100%, 0.95); + padding: 1rem; + border-radius: 0.5rem; + box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5); - min-height: 98%; - min-width: 98%; + 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%, 0.95); - padding: 1rem; - border-radius: 0.5rem; - box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5); + position: fixed; + top: 1em; + left: 50%; + transform: translate(-50%, 0%); + z-index: 100; + background-color: hsla(0, 0%, 100%, 0.95); + padding: 1rem; + border-radius: 0.5rem; + box-shadow: 0 0 1rem hsla(0, 0%, 0%, 0.5); - min-height: 24rem; - max-height: 95%; - min-width: 50%; - max-width: 95%; + min-height: 24rem; + max-height: 95%; + min-width: 50%; + max-width: 95%; } .fade_50 { - opacity: 0.5; + opacity: 0.5; } .fade_50:hover { - opacity: 1; + opacity: 1; } .auth_view_only { - display: none; + display: none; } .ae_root--auth_access .auth_view_only { - display: initial; + display: initial; } img.qr_code { - /* outline: solid thin hsla(30, 100%, 50%, .1); */ - /* width: 1.50in; */ + /* outline: solid thin hsla(30, 100%, 50%, .1); */ + /* width: 1.50in; */ } img.qr_code:hover { - /* outline: solid thin green; */ - /* width: 2.50in; */ + /* outline: solid thin green; */ + /* width: 2.50in; */ } img.qr_code:focus { - /* outline: solid thin red; */ - /* width: 2.50in; */ + /* outline: solid thin red; */ + /* width: 2.50in; */ } .dim { - opacity: 0.5; - color: hsla(0, 0%, 50%, 0.95); + opacity: 0.5; + color: hsla(0, 0%, 50%, 0.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%, 0.25), - hsla(0, 100%, 50%, 0.25) 10px, - transparent 10px, - transparent 20px - ); + opacity: 0.5; + /* color: hsla(0, 100%, 50%, .95); */ + /* background should be hash marks */ + background-image: repeating-linear-gradient( + -45deg, + hsla(0, 100%, 50%, 0.25), + hsla(0, 100%, 50%, 0.25) 10px, + transparent 10px, + transparent 20px + ); } .alert { - /* background-color: hsla(0, 100%, 50%, .1); */ - outline: dashed thin hsla(0, 100%, 50%, 0.5); + /* background-color: hsla(0, 100%, 50%, .1); */ + outline: dashed thin hsla(0, 100%, 50%, 0.5); } @media (max-width: 767px) { - .sk_header.hide_sm { - display: none; - } - .sk_header.show_sm { - display: initial; - } - .sk_header.show_md { - display: none; - } + .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; - } + .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: 0.75em 0; + margin: 0.75em 0; } .reset_css ol { - list-style-type: decimal; + list-style-type: decimal; } .reset_css ul { - list-style-type: disc; + list-style-type: disc; } .reset_css li { - margin-left: 1.5em; + 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; + color: hsla(210, 100%, 50%, 1); + text-decoration: underline; } .reset_css a:hover { - color: hsla(210, 100%, 50%, 0.75); - text-decoration: none; + color: hsla(210, 100%, 50%, 0.75); + text-decoration: none; } /* .ae_btn.btn-danger, @@ -856,86 +856,86 @@ img.qr_code:focus { /* BEGIN: Overrides and fixes specific to Novi and IDAA */ .iframe .novi_btn { - border-radius: 60px; - /* border-color: hsla(0, 0%, 50%, .5); */ - /* border-color: hsla(0, 0%, 0%, .15); */ + border-radius: 60px; + /* border-color: hsla(0, 0%, 50%, .5); */ + /* border-color: hsla(0, 0%, 0%, .15); */ } .iframe .novi_m0 { - margin: 0; + margin: 0; } .iframe .novi_p0 { - padding: 0; + padding: 0; } .iframe .dark .novi_label { - color: white; + color: white; } .iframe .dark .novi_black { - color: black; + color: black; } .iframe .dark .novi_white { - color: white; + color: white; } .iframe .dark .novi_bg_black { - background-color: black; + background-color: black; } .iframe .dark .novi_bg_white { - background-color: white; + background-color: white; } .iframe .dark .novi_bg_gray { - background-color: hsla(0, 0%, 50%, 1); + background-color: hsla(0, 0%, 50%, 1); } .iframe .dark .novi_bg_light_gray { - background-color: hsla(0, 0%, 95%, 1); + background-color: hsla(0, 0%, 95%, 1); } .iframe .dark .novi_bg_dark_gray { - background-color: hsla(0, 0%, 20%, 1); + background-color: hsla(0, 0%, 20%, 1); } .iframe .novi_bg_light { - background-color: hsla(0, 0%, 0%, 0.15); - color: hsla(0, 0%, 20%, 1); + background-color: hsla(0, 0%, 0%, 0.15); + color: hsla(0, 0%, 20%, 1); } .iframe .novi_bg_dark { - background-color: hsla(0, 0%, 0%, 0.25); - color: hsla(0, 0%, 95%, 1); + background-color: hsla(0, 0%, 0%, 0.25); + color: hsla(0, 0%, 95%, 1); } .iframe .novi_margin_sm { - /* margin: 0.5em; */ + /* margin: 0.5em; */ } .iframe .novi_text_wrap { - /* white-space: normal; */ - white-space: pre-wrap; - word-break: break-word; + /* 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; + /* 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; + font-size: 0.8rem; } .iframe button.ae_smallest, .iframe .btn.ae_smallest, .iframe button.novi_smallest, .iframe .btn.novi_smallest { - font-size: 0.65rem; + font-size: 0.65rem; } diff --git a/src/app.d.ts b/src/app.d.ts index 8f4d6389..58c4532e 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -2,8 +2,8 @@ // for information about these interfaces // and what to do when importing types declare namespace App { - // interface Locals {} - // interface PageData {} - // interface Error {} - // interface Platform {} + // interface Locals {} + // interface PageData {} + // interface Error {} + // interface Platform {} } diff --git a/src/app.html b/src/app.html index 2ffb48ec..eaf610b4 100644 --- a/src/app.html +++ b/src/app.html @@ -1,43 +1,43 @@ - - + + - - + + - + - - - - - + + + + + - + - + - %sveltekit.head% - - - - -
%sveltekit.body%
- + %sveltekit.head% + + + + +
%sveltekit.body%
+ diff --git a/src/index.test.ts b/src/index.test.ts index e07cbbd7..701fbe0a 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect } from 'vitest'; describe('sum test', () => { - it('adds 1 + 2 to equal 3', () => { - expect(1 + 2).toBe(3); - }); + it('adds 1 + 2 to equal 3', () => { + expect(1 + 2).toBe(3); + }); }); diff --git a/src/lib/ae_api/api_delete_object.ts b/src/lib/ae_api/api_delete_object.ts index b5d6f3d2..7b8fa554 100644 --- a/src/lib/ae_api/api_delete_object.ts +++ b/src/lib/ae_api/api_delete_object.ts @@ -2,129 +2,129 @@ // Updated 2024-05-23 export const delete_object = async function delete_object({ - api_cfg = null, - endpoint = '', - params = {}, - data = {}, - return_meta = false, - log_lvl = 0, - retry_count = 5 // Number of retry attempts + api_cfg = null, + endpoint = '', + params = {}, + data = {}, + return_meta = false, + log_lvl = 0, + retry_count = 5 // Number of retry attempts }: { - api_cfg: any; - endpoint: string; - params?: any; - data?: any; - return_meta?: boolean; - log_lvl?: number; - retry_count?: number; + api_cfg: any; + endpoint: string; + params?: any; + data?: any; + return_meta?: boolean; + log_lvl?: number; + retry_count?: number; }) { - if (log_lvl) { - console.log(`*** delete_object() *** Endpoint: ${endpoint}`); - console.log('Params:', params); - if (log_lvl > 1) { - console.log('Data:', data); - } - } + if (log_lvl) { + console.log(`*** delete_object() *** Endpoint: ${endpoint}`); + console.log('Params:', params); + if (log_lvl > 1) { + console.log('Data:', data); + } + } - if (!api_cfg) { - console.error('No API Config was provided. Returning false.'); - return false; - } + if (!api_cfg) { + console.error('No API Config was provided. Returning false.'); + return false; + } - // Construct the URL with query parameters - const url = new URL(endpoint, api_cfg['base_url']); - Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); + // Construct the URL with query parameters + const url = new URL(endpoint, api_cfg['base_url']); + Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); - // Clean the headers - const headers_cleaned: Record = {}; - for (const prop in api_cfg['headers']) { - const prop_cleaned = prop.replaceAll('_', '-'); - headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; - } + // Clean the headers + const headers_cleaned: Record = {}; + for (const prop in api_cfg['headers']) { + const prop_cleaned = prop.replaceAll('_', '-'); + headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; + } - if (log_lvl > 1) { - console.log('Cleaned Headers:', headers_cleaned); - } + if (log_lvl > 1) { + console.log('Cleaned Headers:', headers_cleaned); + } - const fetchOptions: RequestInit = { - method: 'DELETE', - headers: { - ...headers_cleaned, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }; + const fetchOptions: RequestInit = { + method: 'DELETE', + headers: { + ...headers_cleaned, + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }; - if (log_lvl > 1) { - console.log('Fetch Options:', fetchOptions); - } + if (log_lvl > 1) { + console.log('Fetch Options:', fetchOptions); + } - for (let attempt = 1; attempt <= retry_count; attempt++) { - try { - const response = await fetch(url.toString(), fetchOptions); + for (let attempt = 1; attempt <= retry_count; attempt++) { + try { + const response = await fetch(url.toString(), fetchOptions); - if (log_lvl) { - console.log(`Response: status=${response.status} attempt=${attempt}`); - } + if (log_lvl) { + console.log(`Response: status=${response.status} attempt=${attempt}`); + } - if (!response.ok) { - if (response.status === 404) { - console.warn('404 Not Found. Returning null.'); - return null; // Returning null since there were no results - } - throw new Error(`HTTP error! status: ${response.status}`); - } + if (!response.ok) { + if (response.status === 404) { + console.warn('404 Not Found. Returning null.'); + return null; // Returning null since there were no results + } + throw new Error(`HTTP error! status: ${response.status}`); + } - const json = await response.json(); + const json = await response.json(); - if (log_lvl > 1) { - console.log('Response JSON:', json); - } + if (log_lvl > 1) { + console.log('Response JSON:', json); + } - // Return the response data or metadata - return return_meta ? json : json.data; - } catch (error) { - console.error(`API DELETE error on attempt ${attempt}:`, error); + // Return the response data or metadata + return return_meta ? json : json.data; + } catch (error) { + console.error(`API DELETE error on attempt ${attempt}:`, error); - // If this is the last attempt, return false - if (attempt === retry_count) { - console.error('Max retry attempts reached. Returning false.'); - return false; - } + // If this is the last attempt, return false + if (attempt === retry_count) { + console.error('Max retry attempts reached. Returning false.'); + return false; + } - // Log retry information - if (log_lvl) { - console.log(`Retrying... (${attempt}/${retry_count})`); - } - } - } + // Log retry information + if (log_lvl) { + console.log(`Retrying... (${attempt}/${retry_count})`); + } + } + } - // 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({ - // baseURL: api_cfg['base_url'], - // // timeout: 2000, - // /* other custom settings */ - // }); - // axios_api.defaults.headers = api_cfg['headers']; + // let axios_api = axios.create({ + // baseURL: api_cfg['base_url'], + // // timeout: 2000, + // /* other custom settings */ + // }); + // axios_api.defaults.headers = api_cfg['headers']; - // //OLD: axios_api.delete(endpoint, { 'data': data }) - // let response_data = await axios_api.delete(endpoint, { params: params, 'data': data }) - // .then(function (response) { - // console.log(response.data); - // return response.data; - // }) - // .catch(function (error: any) { - // if (error.response && error.response.status === 404) { - // return null; // Returning null since there were no results - // } - // console.log(error); - // return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. - // // return error; - // }); + // //OLD: axios_api.delete(endpoint, { 'data': data }) + // let response_data = await axios_api.delete(endpoint, { params: params, 'data': data }) + // .then(function (response) { + // console.log(response.data); + // return response.data; + // }) + // .catch(function (error: any) { + // if (error.response && error.response.status === 404) { + // return null; // Returning null since there were no results + // } + // console.log(error); + // return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. + // // return error; + // }); - // if (log_lvl > 1) { - // console.log(response_data); - // } - // return response_data; + // if (log_lvl > 1) { + // console.log(response_data); + // } + // return response_data; }; diff --git a/src/lib/ae_api/api_get__crud_obj_id.ts b/src/lib/ae_api/api_get__crud_obj_id.ts index 3ad74174..b36cde55 100644 --- a/src/lib/ae_api/api_get__crud_obj_id.ts +++ b/src/lib/ae_api/api_get__crud_obj_id.ts @@ -3,170 +3,170 @@ import { get_object } from './api_get_object'; // Updated 2023-12-01 export async function get_ae_obj_id_crud({ - api_cfg, - no_account_id = false, - obj_type, - obj_id, - use_alt_table = false, - use_alt_base = false, - inc = {}, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 999999, - offset = 0, - data = {}, - // key, - // jwt = null, - headers = {}, - params = {}, - timeout = 25000, - return_meta = false, - log_lvl = 0 + api_cfg, + no_account_id = false, + obj_type, + obj_id, + use_alt_table = false, + use_alt_base = false, + inc = {}, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 999999, + offset = 0, + data = {}, + // key, + // jwt = null, + headers = {}, + params = {}, + timeout = 25000, + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - no_account_id?: boolean; - obj_type: string; - obj_id: string; - use_alt_table?: boolean; - use_alt_base?: boolean; - inc?: any; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - data?: any; - // key: string, - // jwt?: string, - headers?: any; - params?: key_val; - timeout?: number; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + no_account_id?: boolean; + obj_type: string; + obj_id: string; + use_alt_table?: boolean; + use_alt_base?: boolean; + inc?: any; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + data?: any; + // key: string, + // jwt?: string, + headers?: any; + params?: key_val; + timeout?: number; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log('*** get_ae_obj_id_crud() ***'); - } + if (log_lvl) { + console.log('*** get_ae_obj_id_crud() ***'); + } - // data = {}; - // data['super_key'] = key; - // data['jwt'] = jwt; - // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST + // data = {}; + // data['super_key'] = key; + // data['jwt'] = jwt; + // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST - let endpoint = ''; - if (obj_type == 'account') { - endpoint = `/crud/account/${obj_id}`; - } else if (obj_type == 'address') { - endpoint = `/crud/address/${obj_id}`; - } else if (obj_type == 'archive') { - endpoint = `/crud/archive/${obj_id}`; - } else if (obj_type == 'archive_content') { - endpoint = `/crud/archive/content/${obj_id}`; - } else if (obj_type == 'contact') { - endpoint = `/crud/contact/${obj_id}`; - } else if (obj_type == 'data_store') { - endpoint = `/crud/data_store/${obj_id}`; - } else if (obj_type == 'event') { - endpoint = `/crud/event/${obj_id}`; - } else if (obj_type == 'event_abstract') { - endpoint = `/crud/event/abstract/${obj_id}`; - } else if (obj_type == 'event_badge') { - endpoint = `/crud/event/badge/${obj_id}`; - } else if (obj_type == 'event_device') { - endpoint = `/crud/event/device/${obj_id}`; - } else if (obj_type == 'event_exhibit') { - endpoint = `/crud/event/exhibit/${obj_id}`; - } else if (obj_type == 'event_exhibit_tracking') { - endpoint = `/crud/event/exhibit/tracking/${obj_id}`; - } else if (obj_type == 'event_file') { - endpoint = `/crud/event/file/${obj_id}`; - } else if (obj_type == 'event_location') { - endpoint = `/crud/event/location/${obj_id}`; - } else if (obj_type == 'event_person') { - endpoint = `/crud/event/person/${obj_id}`; - } else if (obj_type == 'event_presentation') { - endpoint = `/crud/event/presentation/${obj_id}`; - } else if (obj_type == 'event_presenter') { - endpoint = `/crud/event/presenter/${obj_id}`; - } else if (obj_type == 'event_session') { - endpoint = `/crud/event/session/${obj_id}`; - } else if (obj_type == 'event_track') { - endpoint = `/crud/event/track/${obj_id}`; - } else if (obj_type == 'grant') { - endpoint = `/crud/grant/${obj_id}`; - } else if (obj_type == 'hosted_file') { - endpoint = `/crud/hosted_file/${obj_id}`; - } else if (obj_type == 'journal') { - endpoint = `/crud/journal/${obj_id}`; - } else if (obj_type == 'journal_entry') { - endpoint = `/crud/journal/entry/${obj_id}`; - } else if (obj_type == 'order') { - endpoint = `/crud/order/${obj_id}`; - } else if (obj_type == 'order_line') { - endpoint = `/crud/order/line/${obj_id}`; - } else if (obj_type == 'page') { - endpoint = `/crud/page/${obj_id}`; - } else if (obj_type == 'person') { - endpoint = `/crud/person/${obj_id}`; - } else if (obj_type == 'post') { - endpoint = `/crud/post/${obj_id}`; - } else if (obj_type == 'post_comment') { - endpoint = `/crud/post/comment/${obj_id}`; - } else if (obj_type == 'site') { - endpoint = `/crud/site/${obj_id}`; - } else if (obj_type == 'site_domain') { - endpoint = `/crud/site/domain/${obj_id}`; - } else if (obj_type == 'sponsorship_cfg') { - endpoint = `/crud/sponsorship/cfg/${obj_id}`; - } else if (obj_type == 'sponsorship') { - endpoint = `/crud/sponsorship/${obj_id}`; - // } else if (obj_type == 'user') { - // endpoint = `/crud/user/${obj_id}`; - } else { - console.log(`Unknown object type: ${obj_type}`); - return false; - } - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + let endpoint = ''; + if (obj_type == 'account') { + endpoint = `/crud/account/${obj_id}`; + } else if (obj_type == 'address') { + endpoint = `/crud/address/${obj_id}`; + } else if (obj_type == 'archive') { + endpoint = `/crud/archive/${obj_id}`; + } else if (obj_type == 'archive_content') { + endpoint = `/crud/archive/content/${obj_id}`; + } else if (obj_type == 'contact') { + endpoint = `/crud/contact/${obj_id}`; + } else if (obj_type == 'data_store') { + endpoint = `/crud/data_store/${obj_id}`; + } else if (obj_type == 'event') { + endpoint = `/crud/event/${obj_id}`; + } else if (obj_type == 'event_abstract') { + endpoint = `/crud/event/abstract/${obj_id}`; + } else if (obj_type == 'event_badge') { + endpoint = `/crud/event/badge/${obj_id}`; + } else if (obj_type == 'event_device') { + endpoint = `/crud/event/device/${obj_id}`; + } else if (obj_type == 'event_exhibit') { + endpoint = `/crud/event/exhibit/${obj_id}`; + } else if (obj_type == 'event_exhibit_tracking') { + endpoint = `/crud/event/exhibit/tracking/${obj_id}`; + } else if (obj_type == 'event_file') { + endpoint = `/crud/event/file/${obj_id}`; + } else if (obj_type == 'event_location') { + endpoint = `/crud/event/location/${obj_id}`; + } else if (obj_type == 'event_person') { + endpoint = `/crud/event/person/${obj_id}`; + } else if (obj_type == 'event_presentation') { + endpoint = `/crud/event/presentation/${obj_id}`; + } else if (obj_type == 'event_presenter') { + endpoint = `/crud/event/presenter/${obj_id}`; + } else if (obj_type == 'event_session') { + endpoint = `/crud/event/session/${obj_id}`; + } else if (obj_type == 'event_track') { + endpoint = `/crud/event/track/${obj_id}`; + } else if (obj_type == 'grant') { + endpoint = `/crud/grant/${obj_id}`; + } else if (obj_type == 'hosted_file') { + endpoint = `/crud/hosted_file/${obj_id}`; + } else if (obj_type == 'journal') { + endpoint = `/crud/journal/${obj_id}`; + } else if (obj_type == 'journal_entry') { + endpoint = `/crud/journal/entry/${obj_id}`; + } else if (obj_type == 'order') { + endpoint = `/crud/order/${obj_id}`; + } else if (obj_type == 'order_line') { + endpoint = `/crud/order/line/${obj_id}`; + } else if (obj_type == 'page') { + endpoint = `/crud/page/${obj_id}`; + } else if (obj_type == 'person') { + endpoint = `/crud/person/${obj_id}`; + } else if (obj_type == 'post') { + endpoint = `/crud/post/${obj_id}`; + } else if (obj_type == 'post_comment') { + endpoint = `/crud/post/comment/${obj_id}`; + } else if (obj_type == 'site') { + endpoint = `/crud/site/${obj_id}`; + } else if (obj_type == 'site_domain') { + endpoint = `/crud/site/domain/${obj_id}`; + } else if (obj_type == 'sponsorship_cfg') { + endpoint = `/crud/sponsorship/cfg/${obj_id}`; + } else if (obj_type == 'sponsorship') { + endpoint = `/crud/sponsorship/${obj_id}`; + // } else if (obj_type == 'user') { + // endpoint = `/crud/user/${obj_id}`; + } else { + console.log(`Unknown object type: ${obj_type}`); + return false; + } + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - params['use_alt_table'] = use_alt_table; - params['use_alt_base'] = use_alt_base; + params['use_alt_table'] = use_alt_table; + params['use_alt_base'] = use_alt_base; - if (log_lvl) { - console.log('Params:', params); - } + if (log_lvl) { + console.log('Params:', params); + } - if (no_account_id) { - headers['x-no-account-id'] = 'Nothing to See Here'; - delete headers['x-account-id']; - delete api_cfg['headers']['x-account-id']; - // headers['x-account-id'] = null; - // headers['x-account-id'] = '_XY7DXtc9Mxx'; - // params['x_no_account_id_token'] = 'Nothing to See Here'; + if (no_account_id) { + headers['x-no-account-id'] = 'Nothing to See Here'; + delete headers['x-account-id']; + delete api_cfg['headers']['x-account-id']; + // headers['x-account-id'] = null; + // headers['x-account-id'] = '_XY7DXtc9Mxx'; + // params['x_no_account_id_token'] = 'Nothing to See Here'; - // Remove the x-account-id header - // if (headers['x-account-id']) { - // delete headers['x-account-id']; - // } + // Remove the x-account-id header + // if (headers['x-account-id']) { + // delete headers['x-account-id']; + // } - // headers['x-account-id'] = null; - // headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes - } + // headers['x-account-id'] = null; + // headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes + } - const object_obj_get_promise = await get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - headers: headers, - params: params, - timeout: timeout, - log_lvl: log_lvl - }).catch(function (error: any) { - console.log('API GET CRUD object ID request failed.', error); - }); + const object_obj_get_promise = await get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + headers: headers, + params: params, + timeout: timeout, + log_lvl: log_lvl + }).catch(function (error: any) { + console.log('API GET CRUD object ID request failed.', error); + }); - if (log_lvl > 1) { - console.log('GET Object result =', object_obj_get_promise); - } + if (log_lvl > 1) { + console.log('GET Object result =', object_obj_get_promise); + } - return object_obj_get_promise; + return object_obj_get_promise; } diff --git a/src/lib/ae_api/api_get__crud_obj_li_v1.ts b/src/lib/ae_api/api_get__crud_obj_li_v1.ts index 29acb609..0fa044c4 100644 --- a/src/lib/ae_api/api_get__crud_obj_li_v1.ts +++ b/src/lib/ae_api/api_get__crud_obj_li_v1.ts @@ -4,226 +4,226 @@ import { get_object } from './api_get_object'; // The lookup "obj_type" should broken out into a separate function. - 2024-08-07 // Updated 2023-11-15 export async function get_ae_obj_li_for_obj_id_crud({ - api_cfg, - obj_type, - for_obj_type, - for_obj_id, // NOTE: Changed 2023-12-06 to no longer required - use_alt_table = false, - use_alt_base = false, - // inc = {}, - enabled = 'enabled', - hidden = 'not_hidden', - order_by_li = null, - limit = 999999, - offset = 0, - // key, - // jwt = null, - headers = {}, - params_json = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } } - // json_obj = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. - params = {}, - return_meta = false, - log_lvl = 0 + api_cfg, + obj_type, + for_obj_type, + for_obj_id, // NOTE: Changed 2023-12-06 to no longer required + use_alt_table = false, + use_alt_base = false, + // inc = {}, + enabled = 'enabled', + hidden = 'not_hidden', + order_by_li = null, + limit = 999999, + offset = 0, + // key, + // jwt = null, + headers = {}, + params_json = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } } + // json_obj = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. + params = {}, + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - obj_type: string; - for_obj_type: null | string; - for_obj_id?: string; - use_alt_table?: boolean; - use_alt_base?: boolean; - // inc?: key_val - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - order_by_li?: any; - limit?: number; - offset?: number; - // key: string, - // jwt?: string, - headers?: any; - params_json?: any; - // json_obj?: any, - params?: key_val; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + obj_type: string; + for_obj_type: null | string; + for_obj_id?: string; + use_alt_table?: boolean; + use_alt_base?: boolean; + // inc?: key_val + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + order_by_li?: any; + limit?: number; + offset?: number; + // key: string, + // jwt?: string, + headers?: any; + params_json?: any; + // json_obj?: any, + params?: key_val; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** get_ae_obj_li_for_obj_id_crud() *** [${obj_type}]`); - } + if (log_lvl) { + console.log(`*** get_ae_obj_li_for_obj_id_crud() *** [${obj_type}]`); + } - // data = {}; - // data['super_key'] = key; - // data['jwt'] = jwt; - // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST + // data = {}; + // data['super_key'] = key; + // data['jwt'] = jwt; + // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST - // const endpoint = `/crud/${obj_type}/list`; + // const endpoint = `/crud/${obj_type}/list`; - let endpoint = ''; - if (obj_type == 'account') { - endpoint = `/crud/account/list`; - } else if (obj_type == 'address') { - endpoint = `/crud/address/list`; - } else if (obj_type == 'archive') { - endpoint = `/crud/archive/list`; - } else if (obj_type == 'archive_content') { - endpoint = `/crud/archive/content/list`; - } else if (obj_type == 'contact') { - endpoint = `/crud/contact/list`; - } else if (obj_type == 'data_store') { - endpoint = `/crud/data_store/list`; - } else if (obj_type == 'event') { - endpoint = `/crud/event/list`; - } else if (obj_type == 'event_abstract') { - endpoint = `/crud/event/abstract/list`; - } else if (obj_type == 'event_badge') { - endpoint = `/crud/event/badge/list`; - } else if (obj_type == 'event_device') { - endpoint = `/crud/event/device/list`; - } else if (obj_type == 'event_exhibit') { - endpoint = `/crud/event/exhibit/list`; - } else if (obj_type == 'event_exhibit_tracking') { - endpoint = `/crud/event/exhibit/tracking/list`; - } else if (obj_type == 'event_file') { - endpoint = `/crud/event/file/list`; - } else if (obj_type == 'event_location') { - endpoint = `/crud/event/location/list`; - } else if (obj_type == 'event_person') { - endpoint = `/crud/event/person/list`; - } else if (obj_type == 'event_presentation') { - endpoint = `/crud/event/presentation/list`; - } else if (obj_type == 'event_presenter') { - endpoint = `/crud/event/presenter/list`; - } else if (obj_type == 'event_session') { - endpoint = `/crud/event/session/list`; - } else if (obj_type == 'event_track') { - endpoint = `/crud/event/track/list`; - } else if (obj_type == 'grant') { - endpoint = `/crud/grant/list`; - } else if (obj_type == 'hosted_file') { - endpoint = `/crud/hosted_file/list`; - } else if (obj_type == 'journal') { - endpoint = `/crud/journal/list`; - } else if (obj_type == 'journal_entry') { - endpoint = `/crud/journal/entry/list`; - } else if (obj_type == 'order') { - endpoint = `/crud/order/list`; - } else if (obj_type == 'order_line') { - endpoint = `/crud/order/line/list`; - } else if (obj_type == 'page') { - endpoint = `/crud/page/list`; - } else if (obj_type == 'person') { - endpoint = `/crud/person/list`; - } else if (obj_type == 'post') { - endpoint = `/crud/post/list`; - } else if (obj_type == 'post_comment') { - endpoint = `/crud/post/comment/list`; - } else if (obj_type == 'site') { - endpoint = `/crud/site/list`; - } else if (obj_type == 'sponsorship_cfg') { - endpoint = `/crud/sponsorship/cfg/list`; - } else if (obj_type == 'sponsorship') { - endpoint = `/crud/sponsorship/list`; - // } else if (obj_type == 'user') { - // endpoint = `/crud/user/list`; - } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') { - endpoint = `/crud/lu/country_subdivision/list`; - for_obj_type = null; - } else if (obj_type == 'lu' && for_obj_type == 'country') { - endpoint = `/crud/lu/country/list`; - for_obj_type = null; - } else if (obj_type == 'lu' && for_obj_type == 'time_zone') { - endpoint = `/crud/lu/time_zone/list`; - for_obj_type = null; - } else { - console.log(`Unknown object type: ${obj_type}`); - return false; - } - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + let endpoint = ''; + if (obj_type == 'account') { + endpoint = `/crud/account/list`; + } else if (obj_type == 'address') { + endpoint = `/crud/address/list`; + } else if (obj_type == 'archive') { + endpoint = `/crud/archive/list`; + } else if (obj_type == 'archive_content') { + endpoint = `/crud/archive/content/list`; + } else if (obj_type == 'contact') { + endpoint = `/crud/contact/list`; + } else if (obj_type == 'data_store') { + endpoint = `/crud/data_store/list`; + } else if (obj_type == 'event') { + endpoint = `/crud/event/list`; + } else if (obj_type == 'event_abstract') { + endpoint = `/crud/event/abstract/list`; + } else if (obj_type == 'event_badge') { + endpoint = `/crud/event/badge/list`; + } else if (obj_type == 'event_device') { + endpoint = `/crud/event/device/list`; + } else if (obj_type == 'event_exhibit') { + endpoint = `/crud/event/exhibit/list`; + } else if (obj_type == 'event_exhibit_tracking') { + endpoint = `/crud/event/exhibit/tracking/list`; + } else if (obj_type == 'event_file') { + endpoint = `/crud/event/file/list`; + } else if (obj_type == 'event_location') { + endpoint = `/crud/event/location/list`; + } else if (obj_type == 'event_person') { + endpoint = `/crud/event/person/list`; + } else if (obj_type == 'event_presentation') { + endpoint = `/crud/event/presentation/list`; + } else if (obj_type == 'event_presenter') { + endpoint = `/crud/event/presenter/list`; + } else if (obj_type == 'event_session') { + endpoint = `/crud/event/session/list`; + } else if (obj_type == 'event_track') { + endpoint = `/crud/event/track/list`; + } else if (obj_type == 'grant') { + endpoint = `/crud/grant/list`; + } else if (obj_type == 'hosted_file') { + endpoint = `/crud/hosted_file/list`; + } else if (obj_type == 'journal') { + endpoint = `/crud/journal/list`; + } else if (obj_type == 'journal_entry') { + endpoint = `/crud/journal/entry/list`; + } else if (obj_type == 'order') { + endpoint = `/crud/order/list`; + } else if (obj_type == 'order_line') { + endpoint = `/crud/order/line/list`; + } else if (obj_type == 'page') { + endpoint = `/crud/page/list`; + } else if (obj_type == 'person') { + endpoint = `/crud/person/list`; + } else if (obj_type == 'post') { + endpoint = `/crud/post/list`; + } else if (obj_type == 'post_comment') { + endpoint = `/crud/post/comment/list`; + } else if (obj_type == 'site') { + endpoint = `/crud/site/list`; + } else if (obj_type == 'sponsorship_cfg') { + endpoint = `/crud/sponsorship/cfg/list`; + } else if (obj_type == 'sponsorship') { + endpoint = `/crud/sponsorship/list`; + // } else if (obj_type == 'user') { + // endpoint = `/crud/user/list`; + } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') { + endpoint = `/crud/lu/country_subdivision/list`; + for_obj_type = null; + } else if (obj_type == 'lu' && for_obj_type == 'country') { + endpoint = `/crud/lu/country/list`; + for_obj_type = null; + } else if (obj_type == 'lu' && for_obj_type == 'time_zone') { + endpoint = `/crud/lu/time_zone/list`; + for_obj_type = null; + } else { + console.log(`Unknown object type: ${obj_type}`); + return false; + } + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - if (for_obj_type) { - params['for_obj_type'] = for_obj_type; - } - if (for_obj_id) { - params['for_obj_id'] = for_obj_id; - } + if (for_obj_type) { + params['for_obj_type'] = for_obj_type; + } + if (for_obj_id) { + params['for_obj_id'] = for_obj_id; + } - params['use_alt_table'] = use_alt_table; - params['use_alt_base'] = use_alt_base; + params['use_alt_table'] = use_alt_table; + params['use_alt_base'] = use_alt_base; - /* Need to deal with inc params here */ + /* Need to deal with inc params here */ - const allowed_enabled_list = ['all', 'enabled', 'not_enabled']; - if (allowed_enabled_list.includes(enabled)) { - params['enabled'] = enabled; - } + const allowed_enabled_list = ['all', 'enabled', 'not_enabled']; + if (allowed_enabled_list.includes(enabled)) { + params['enabled'] = enabled; + } - const allowed_hidden_list = ['all', 'hidden', 'not_hidden']; - if (allowed_hidden_list.includes(hidden)) { - params['hidden'] = hidden; - } + const allowed_hidden_list = ['all', 'hidden', 'not_hidden']; + if (allowed_hidden_list.includes(hidden)) { + params['hidden'] = hidden; + } - // NOTE: The order_by_li variable is in the "headers" because if is a the URL GET params do not handle multiple values very well. Maybe base64 encore in the future or something? Reminder that GET requests should not have a body (no JSON). - // NOTE: The order_by_li should be a key value pair of the property/DB field to sort and how to sort (ASC or DESC) - if (order_by_li) { - if (log_lvl) { - console.log('Order By:', order_by_li); - } - headers['order_by_li'] = order_by_li; - } + // NOTE: The order_by_li variable is in the "headers" because if is a the URL GET params do not handle multiple values very well. Maybe base64 encore in the future or something? Reminder that GET requests should not have a body (no JSON). + // NOTE: The order_by_li should be a key value pair of the property/DB field to sort and how to sort (ASC or DESC) + if (order_by_li) { + if (log_lvl) { + console.log('Order By:', order_by_li); + } + headers['order_by_li'] = order_by_li; + } - if (limit >= 0) { - params['limit'] = limit; - } + if (limit >= 0) { + params['limit'] = limit; + } - if (offset >= 0) { - params['offset'] = offset; - } + if (offset >= 0) { + params['offset'] = offset; + } - if (params_json) { - // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. - // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge). - if (log_lvl) { - console.log('JSON Object:', params_json); - console.log(JSON.stringify(params_json)); - } - // NOTE: "jp" stands for "JSON Params" - params['jp'] = encodeURIComponent(JSON.stringify(params_json)); - 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]` - ); - return false; - } - } + if (params_json) { + // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. + // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge). + if (log_lvl) { + console.log('JSON Object:', params_json); + console.log(JSON.stringify(params_json)); + } + // NOTE: "jp" stands for "JSON Params" + params['jp'] = encodeURIComponent(JSON.stringify(params_json)); + 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]` + ); + return false; + } + } - // if (json_obj) { - // // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. - // // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge). - // console.log('JSON Object:', json_obj); - // params['json_str'] = encodeURIComponent(JSON.stringify(json_obj)); - // if (params['json_str'].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['json_str'].length} [THIS DOES NOT EXIST YET]`); - // return false; - // } - // } + // if (json_obj) { + // // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. + // // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge). + // console.log('JSON Object:', json_obj); + // params['json_str'] = encodeURIComponent(JSON.stringify(json_obj)); + // if (params['json_str'].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['json_str'].length} [THIS DOES NOT EXIST YET]`); + // return false; + // } + // } - if (log_lvl) { - console.log('Params:', params); - } + if (log_lvl) { + console.log('Params:', params); + } - const object_li_get_promise = await get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - headers: headers, - params: params, - return_meta: return_meta, - log_lvl: log_lvl - }); + const object_li_get_promise = await get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + headers: headers, + params: params, + return_meta: return_meta, + log_lvl: log_lvl + }); - if (log_lvl > 1) { - console.log(object_li_get_promise); - } + if (log_lvl > 1) { + console.log(object_li_get_promise); + } - return object_li_get_promise; + return object_li_get_promise; } diff --git a/src/lib/ae_api/api_get__crud_obj_li_v2.ts b/src/lib/ae_api/api_get__crud_obj_li_v2.ts index 5319c723..8657523a 100644 --- a/src/lib/ae_api/api_get__crud_obj_li_v2.ts +++ b/src/lib/ae_api/api_get__crud_obj_li_v2.ts @@ -3,172 +3,172 @@ import { get_object } from './api_get_object'; // Refactored 2025-11-13 to use a lookup map for endpoints. const objTypeToEndpointMap: Record = { - account: '/crud/account/list', - address: '/crud/address/list', - archive: '/crud/archive/list', - archive_content: '/crud/archive/content/list', - contact: '/crud/contact/list', - data_store: '/crud/data_store/list', - event: '/crud/event/list', - event_abstract: '/crud/event/abstract/list', - event_badge: '/crud/event/badge/list', - event_badge_template: '/crud/event/badge/template/list', - event_device: '/crud/event/device/list', - event_exhibit: '/crud/event/exhibit/list', - event_exhibit_tracking: '/crud/event/exhibit/tracking/list', - event_file: '/crud/event/file/list', - event_location: '/crud/event/location/list', - event_person: '/crud/event/person/list', - event_presentation: '/crud/event/presentation/list', - event_presenter: '/crud/event/presenter/list', - event_session: '/crud/event/session/list', - event_track: '/crud/event/track/list', - grant: '/crud/grant/list', - hosted_file: '/crud/hosted_file/list', - journal: '/crud/journal/list', - journal_entry: '/crud/journal/entry/list', - order: '/crud/order/list', - order_line: '/crud/order/line/list', - page: '/crud/page/list', - person: '/crud/person/list', - post: '/crud/post/list', - post_comment: '/crud/post/comment/list', - site: '/crud/site/list', - sponsorship_cfg: '/crud/sponsorship/cfg/list', - sponsorship: '/crud/sponsorship/list', - // user: '/crud/user/list', - 'lu-country_subdivision': '/crud/lu/country_subdivision/list', - 'lu-country': '/crud/lu/country/list', - 'lu-time_zone': '/crud/lu/time_zone/list' + account: '/crud/account/list', + address: '/crud/address/list', + archive: '/crud/archive/list', + archive_content: '/crud/archive/content/list', + contact: '/crud/contact/list', + data_store: '/crud/data_store/list', + event: '/crud/event/list', + event_abstract: '/crud/event/abstract/list', + event_badge: '/crud/event/badge/list', + event_badge_template: '/crud/event/badge/template/list', + event_device: '/crud/event/device/list', + event_exhibit: '/crud/event/exhibit/list', + event_exhibit_tracking: '/crud/event/exhibit/tracking/list', + event_file: '/crud/event/file/list', + event_location: '/crud/event/location/list', + event_person: '/crud/event/person/list', + event_presentation: '/crud/event/presentation/list', + event_presenter: '/crud/event/presenter/list', + event_session: '/crud/event/session/list', + event_track: '/crud/event/track/list', + grant: '/crud/grant/list', + hosted_file: '/crud/hosted_file/list', + journal: '/crud/journal/list', + journal_entry: '/crud/journal/entry/list', + order: '/crud/order/list', + order_line: '/crud/order/line/list', + page: '/crud/page/list', + person: '/crud/person/list', + post: '/crud/post/list', + post_comment: '/crud/post/comment/list', + site: '/crud/site/list', + sponsorship_cfg: '/crud/sponsorship/cfg/list', + sponsorship: '/crud/sponsorship/list', + // user: '/crud/user/list', + 'lu-country_subdivision': '/crud/lu/country_subdivision/list', + 'lu-country': '/crud/lu/country/list', + 'lu-time_zone': '/crud/lu/time_zone/list' }; function getEndpointForObjType(obj_type: string, for_obj_type?: string): string { - if (obj_type === 'lu' && for_obj_type) { - const key = `lu-${for_obj_type}`; - const endpoint = objTypeToEndpointMap[key]; - if (endpoint) return endpoint; - } + if (obj_type === 'lu' && for_obj_type) { + const key = `lu-${for_obj_type}`; + const endpoint = objTypeToEndpointMap[key]; + if (endpoint) return endpoint; + } - const endpoint = objTypeToEndpointMap[obj_type]; - if (endpoint) return endpoint; + const endpoint = objTypeToEndpointMap[obj_type]; + if (endpoint) return endpoint; - throw new Error(`Unknown object type: ${obj_type}`); + throw new Error(`Unknown object type: ${obj_type}`); } type OrderBy = { [key: string]: 'ASC' | 'DESC' }; interface GetAeObjLiForObjIdCrudV2Params { - api_cfg: any; // Consider defining a specific type for api_cfg - obj_type: string; - for_obj_type: string; - for_obj_id?: string; - use_alt_tbl?: boolean | string; - use_alt_mdl?: boolean | string; - use_alt_exp?: boolean | string; - inc?: key_val; - enabled?: 'all' | 'enabled' | 'not_enabled'; - hidden?: 'all' | 'hidden' | 'not_hidden'; - order_by_li?: OrderBy[] | null; - limit?: number; - offset?: number; - headers?: Record; - params_json?: any; - params?: key_val; - log_lvl?: number; + api_cfg: any; // Consider defining a specific type for api_cfg + obj_type: string; + for_obj_type: string; + for_obj_id?: string; + use_alt_tbl?: boolean | string; + use_alt_mdl?: boolean | string; + use_alt_exp?: boolean | string; + inc?: key_val; + enabled?: 'all' | 'enabled' | 'not_enabled'; + hidden?: 'all' | 'hidden' | 'not_hidden'; + order_by_li?: OrderBy[] | null; + limit?: number; + offset?: number; + headers?: Record; + params_json?: any; + params?: key_val; + log_lvl?: number; } export async function get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg, - obj_type, - for_obj_type, - for_obj_id, - use_alt_tbl = false, - use_alt_mdl = false, - use_alt_exp = false, - enabled = 'enabled', - hidden = 'not_hidden', - order_by_li = null, - limit = 999999, - offset = 0, - headers = {}, - params_json = null, - params = {}, - log_lvl = 0 + api_cfg, + obj_type, + for_obj_type, + for_obj_id, + use_alt_tbl = false, + use_alt_mdl = false, + use_alt_exp = false, + enabled = 'enabled', + hidden = 'not_hidden', + order_by_li = null, + limit = 999999, + offset = 0, + headers = {}, + params_json = null, + params = {}, + log_lvl = 0 }: GetAeObjLiForObjIdCrudV2Params) { - if (log_lvl) { - console.log('*** get_ae_obj_li_for_obj_id_crud_v2() ***'); - } + if (log_lvl) { + console.log('*** get_ae_obj_li_for_obj_id_crud_v2() ***'); + } - try { - const endpoint = `/v2${getEndpointForObjType(obj_type, for_obj_type)}`; - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + try { + const endpoint = `/v2${getEndpointForObjType(obj_type, for_obj_type)}`; + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - // We need to remove a few parameters from the params object that are not allowed. - delete params['qry__enabled']; - delete params['qry__hidden']; - delete params['qry__limit']; - delete params['qry__offset']; + // We need to remove a few parameters from the params object that are not allowed. + delete params['qry__enabled']; + delete params['qry__hidden']; + delete params['qry__limit']; + delete params['qry__offset']; - if (for_obj_type) params['for_obj_type'] = for_obj_type; - if (for_obj_id) params['for_obj_id'] = for_obj_id; + if (for_obj_type) params['for_obj_type'] = for_obj_type; + if (for_obj_id) params['for_obj_id'] = for_obj_id; - if (use_alt_tbl === true) params['tbl_alt'] = 'alt'; - if (use_alt_mdl === true) params['mdl_alt'] = 'alt'; - if (use_alt_exp === true) params['exp_alt'] = 'alt'; + if (use_alt_tbl === true) params['tbl_alt'] = 'alt'; + if (use_alt_mdl === true) params['mdl_alt'] = 'alt'; + if (use_alt_exp === true) params['exp_alt'] = 'alt'; - const allowed_enabled_list = ['all', 'enabled', 'not_enabled']; - if (allowed_enabled_list.includes(enabled)) { - params['enabled'] = enabled; - } + const allowed_enabled_list = ['all', 'enabled', 'not_enabled']; + if (allowed_enabled_list.includes(enabled)) { + params['enabled'] = enabled; + } - const allowed_hidden_list = ['all', 'hidden', 'not_hidden']; - if (allowed_hidden_list.includes(hidden)) { - params['hidden'] = hidden; - } + const allowed_hidden_list = ['all', 'hidden', 'not_hidden']; + if (allowed_hidden_list.includes(hidden)) { + params['hidden'] = hidden; + } - // NOTE: The order_by_li variable is in the "headers" because URL GET params do not handle complex objects very well. - if (order_by_li) { - headers['order_by_li'] = JSON.stringify(order_by_li); - } + // NOTE: The order_by_li variable is in the "headers" because URL GET params do not handle complex objects very well. + if (order_by_li) { + headers['order_by_li'] = JSON.stringify(order_by_li); + } - if (limit > 0) params['limit'] = limit; - if (offset > 0) params['offset'] = offset; + if (limit > 0) params['limit'] = limit; + if (offset > 0) params['offset'] = offset; - if (params_json) { - // NOTE: "jp" stands for "JSON Params". This is a JSON object that needs to be safely converted to a string for the params. - // Max characters for a GET request is ~2000. This is a limitation of the browser. - const json_params_str = encodeURIComponent(JSON.stringify(params_json)); - if (json_params_str.length > 2083) { - // Using console.error instead of throwing an error to avoid crashing the app for a known limitation. - console.error( - `The JSON object is too large to be used as a GET parameter. Max length is 2083 characters. Length = ${json_params_str.length}` - ); - return false; - } - params['jp'] = json_params_str; - } + if (params_json) { + // NOTE: "jp" stands for "JSON Params". This is a JSON object that needs to be safely converted to a string for the params. + // Max characters for a GET request is ~2000. This is a limitation of the browser. + const json_params_str = encodeURIComponent(JSON.stringify(params_json)); + if (json_params_str.length > 2083) { + // Using console.error instead of throwing an error to avoid crashing the app for a known limitation. + console.error( + `The JSON object is too large to be used as a GET parameter. Max length is 2083 characters. Length = ${json_params_str.length}` + ); + return false; + } + params['jp'] = json_params_str; + } - if (log_lvl) { - console.log('Params:', params); - } + if (log_lvl) { + console.log('Params:', params); + } - const object_li_get_promise = await get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - headers: headers, - params: params, - log_lvl: log_lvl - }); + const object_li_get_promise = await get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + headers: headers, + params: params, + log_lvl: log_lvl + }); - if (log_lvl > 1) { - console.log(object_li_get_promise); - } + if (log_lvl > 1) { + console.log(object_li_get_promise); + } - return object_li_get_promise; - } catch (error) { - console.error('Error in get_ae_obj_li_for_obj_id_crud_v2:', error); - return false; // Or handle the error as appropriate - } + return object_li_get_promise; + } catch (error) { + console.error('Error in get_ae_obj_li_for_obj_id_crud_v2:', error); + return false; // Or handle the error as appropriate + } } diff --git a/src/lib/ae_api/api_get_object.ts b/src/lib/ae_api/api_get_object.ts index 2b7c799c..f7045b88 100644 --- a/src/lib/ae_api/api_get_object.ts +++ b/src/lib/ae_api/api_get_object.ts @@ -7,230 +7,230 @@ export const temp_get_object_percent_completed = 0; export const get_object_percent_completed = temp_get_object_percent_completed; export const get_object = async function get_object({ - api_cfg = null, - endpoint = '', - headers = {}, - params = {}, - data = {}, - timeout = 60000, - return_meta = false, - return_blob = false, - filename = '', - auto_download = false, - as_list = false, // Is this still really needed? - // 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, - retry_count = 5 // Number of retry attempts + api_cfg = null, + endpoint = '', + headers = {}, + params = {}, + data = {}, + timeout = 60000, + return_meta = false, + return_blob = false, + filename = '', + auto_download = false, + as_list = false, // Is this still really needed? + // 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, + retry_count = 5 // Number of retry attempts }: { - api_cfg: any; - endpoint: string; - headers?: any; - params?: any; - data?: any; - timeout?: number; - return_meta?: boolean; - return_blob?: boolean; - filename?: null | string; - auto_download?: boolean; - as_list?: boolean; - task_id?: string; - log_lvl?: number; - retry_count?: number; + api_cfg: any; + endpoint: string; + headers?: any; + params?: any; + data?: any; + timeout?: number; + return_meta?: boolean; + return_blob?: boolean; + filename?: null | string; + auto_download?: boolean; + as_list?: boolean; + task_id?: string; + log_lvl?: number; + retry_count?: number; }) { - if (log_lvl) { - console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`); - console.log('Params:', params); - if (log_lvl > 1) { - console.log('Data:', data); - } - } + if (log_lvl) { + console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`); + console.log('Params:', params); + if (log_lvl > 1) { + console.log('Data:', data); + } + } - if (!api_cfg) { - console.log('No API Config was provided. Returning false.'); - return false; - } + if (!api_cfg) { + console.log('No API Config was provided. Returning false.'); + return false; + } - const url = new URL(endpoint, api_cfg['base_url']); - Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); + const url = new URL(endpoint, api_cfg['base_url']); + Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), timeout); + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), timeout); - // 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 - ) { - delete api_cfg['headers']['x-no-account-id']; - } + // 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 + ) { + delete api_cfg['headers']['x-no-account-id']; + } - // Clean the headers - const headers_cleaned: key_val = {}; - for (const prop in headers) { - const prop_cleaned = prop.replaceAll('_', '-'); - if (typeof headers[prop] != 'string') { - headers[prop] = JSON.stringify(headers[prop]); - } - headers_cleaned[prop_cleaned] = headers[prop]; - if (log_lvl > 1) { - console.log(`${prop_cleaned}: ${headers_cleaned[prop_cleaned]}`); - } - } - headers = headers_cleaned; - if (log_lvl > 1) { - console.log('All headers cleaned:', headers); - } + // Clean the headers + const headers_cleaned: key_val = {}; + for (const prop in headers) { + const prop_cleaned = prop.replaceAll('_', '-'); + if (typeof headers[prop] != 'string') { + headers[prop] = JSON.stringify(headers[prop]); + } + headers_cleaned[prop_cleaned] = headers[prop]; + if (log_lvl > 1) { + console.log(`${prop_cleaned}: ${headers_cleaned[prop_cleaned]}`); + } + } + headers = headers_cleaned; + if (log_lvl > 1) { + console.log('All headers cleaned:', headers); + } - const fetchOptions: RequestInit = { - method: 'GET', - headers: { - ...api_cfg['headers'], - ...headers - }, - signal: controller.signal - }; + const fetchOptions: RequestInit = { + method: 'GET', + headers: { + ...api_cfg['headers'], + ...headers + }, + signal: controller.signal + }; - if (log_lvl > 1) { - console.log('Fetch options:', fetchOptions); - } + if (log_lvl > 1) { + console.log('Fetch options:', fetchOptions); + } - let fetch_method: any = fetch; - if (api_cfg.fetch) { - if (log_lvl > 1) { - console.log('Using custom fetch function from api_cfg!!!'); - } - fetch_method = api_cfg.fetch; - } + let fetch_method: any = fetch; + if (api_cfg.fetch) { + if (log_lvl > 1) { + console.log('Using custom fetch function from api_cfg!!!'); + } + fetch_method = api_cfg.fetch; + } - for (let attempt = 1; attempt <= retry_count; attempt++) { - try { - const response = await fetch_method(url.toString(), fetchOptions).catch(function ( - error: any - ) { - console.log( - 'API GET Object *fetch* request was aborted or failed in an unexpected way.', - error - ); - }); - clearTimeout(timeoutId); + for (let attempt = 1; attempt <= retry_count; attempt++) { + try { + const response = await fetch_method(url.toString(), fetchOptions).catch(function ( + error: any + ) { + console.log( + 'API GET Object *fetch* request was aborted or failed in an unexpected way.', + error + ); + }); + clearTimeout(timeoutId); - if (!response) { - if (log_lvl > 1) { - 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 - // return false; // This will stop the retries - } + if (!response) { + if (log_lvl > 1) { + 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 + // return false; // This will stop the retries + } - if (log_lvl) { - console.log( - `Response: status=${response.status} statusText=${response.statusText} url=${response.url} attempt=${attempt}` - ); - } - if (log_lvl > 1) { - console.log('Response:', response); - } + if (log_lvl) { + console.log( + `Response: status=${response.status} statusText=${response.statusText} url=${response.url} attempt=${attempt}` + ); + } + if (log_lvl > 1) { + console.log('Response:', response); + } - if (!response.ok) { - if (response.status === 404) { - if (log_lvl) { - console.log('The response was a 404 not found "error". Returning null.'); - } - return null; - } - console.log('The response was not ok. Throwing an error!'); - throw new Error(`HTTP error! status: ${response.status}`); - } + if (!response.ok) { + if (response.status === 404) { + if (log_lvl) { + console.log('The response was a 404 not found "error". Returning null.'); + } + return null; + } + console.log('The response was not ok. Throwing an error!'); + throw new Error(`HTTP error! status: ${response.status}`); + } - if (!return_blob) { - const json = await response.json(); - if (log_lvl > 1) { - console.log('Response JSON:', json); - } - if (!Array.isArray(json.data) && as_list) { - return [json.data]; - } - return json.data || json; - } else { - const reader = response.body?.getReader(); - const contentLength = +response.headers.get('Content-Length')!; - let receivedLength = 0; - const chunks = []; + if (!return_blob) { + const json = await response.json(); + if (log_lvl > 1) { + console.log('Response JSON:', json); + } + if (!Array.isArray(json.data) && as_list) { + return [json.data]; + } + return json.data || json; + } else { + const reader = response.body?.getReader(); + const contentLength = +response.headers.get('Content-Length')!; + let receivedLength = 0; + const chunks = []; - while (true) { - const { done, value } = await reader!.read(); - if (done) break; - chunks.push(value); - receivedLength += value.length; + while (true) { + const { done, value } = await reader!.read(); + if (done) break; + chunks.push(value); + receivedLength += value.length; - const percent_completed = Math.round((receivedLength * 100) / contentLength); - if (log_lvl > 1) { - console.log( - 'GET Blob Progress:', - percent_completed, - 'Total:', - contentLength, - 'Loaded:', - receivedLength, - 'Percent Completed', - percent_completed - ); - } + const percent_completed = Math.round((receivedLength * 100) / contentLength); + if (log_lvl > 1) { + 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 { - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_blob', - status: 'downloading', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: contentLength, - size_loaded: receivedLength, - percent_completed: percent_completed - }, - '*' - ); - } - } catch (e) { - console.error('Error posting message:', e); - } - } + try { + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_blob', + status: 'downloading', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: contentLength, + size_loaded: receivedLength, + percent_completed: percent_completed + }, + '*' + ); + } + } catch (e) { + console.error('Error posting message:', e); + } + } - const blob = new Blob(chunks); - if (auto_download) { - const downloadUrl = window.URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = downloadUrl; - link.setAttribute('download', filename || 'download'); - document.body.appendChild(link); - link.click(); - link.remove(); - return true; - } else { - return blob; - } - } - } catch (error) { - console.log(`API GET object request *fetch* error on attempt ${attempt}:`, error); + const blob = new Blob(chunks); + if (auto_download) { + const downloadUrl = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = downloadUrl; + link.setAttribute('download', filename || 'download'); + document.body.appendChild(link); + link.click(); + link.remove(); + return true; + } else { + return blob; + } + } + } catch (error) { + console.log(`API GET object request *fetch* error on attempt ${attempt}:`, error); - if (attempt === retry_count) { - console.log('Max retry attempts reached. Returning false.'); - return false; - } + if (attempt === retry_count) { + console.log('Max retry attempts reached. Returning false.'); + return false; + } - // Log retry information - if (log_lvl) { - console.log(`Retrying... (${attempt}/${retry_count})`); - } - } - } + // Log retry information + if (log_lvl) { + console.log(`Retrying... (${attempt}/${retry_count})`); + } + } + } }; diff --git a/src/lib/ae_api/api_get_object_v1.ts b/src/lib/ae_api/api_get_object_v1.ts index 5dd5e705..68786b7f 100644 --- a/src/lib/ae_api/api_get_object_v1.ts +++ b/src/lib/ae_api/api_get_object_v1.ts @@ -12,509 +12,515 @@ export const get_object_percent_completed = temp_get_object_percent_completed; // Updated 2024-05-23 export const get_object = async function get_object({ - api_cfg = null, - endpoint = '', - headers = {}, - params = {}, - data = {}, - timeout = 60000, - return_meta = false, - return_blob = false, - filename = '', - auto_download = false, - as_list = false, - // 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 = null, + endpoint = '', + headers = {}, + params = {}, + data = {}, + timeout = 60000, + return_meta = false, + return_blob = false, + filename = '', + auto_download = false, + as_list = false, + // 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; - params?: any; - data?: any; - timeout?: number; - return_meta?: boolean; - return_blob?: boolean; - filename?: null | string; - auto_download?: boolean; - as_list?: boolean; - task_id?: string; - log_lvl?: number; + api_cfg: any; + endpoint: string; + headers?: any; + params?: any; + data?: any; + timeout?: number; + return_meta?: boolean; + return_blob?: boolean; + filename?: null | string; + auto_download?: boolean; + as_list?: boolean; + task_id?: string; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`); - console.log('Params:', params); - if (log_lvl > 1) { - console.log('Data:', data); - console.log(`Base URL: ${api_cfg['base_url']}; Timeout: ${timeout}`); - console.log('API Config:', api_cfg); - } - if (log_lvl > 2) { - console.log( - `Return Meta: ${return_meta}; Return Blob: ${return_blob}; Filename: ${filename}; Auto Download: ${auto_download}` - ); - } - } + if (log_lvl) { + console.log(`*** get_object() *** Endpoint: ${endpoint} AE Task ID: ${task_id}`); + console.log('Params:', params); + if (log_lvl > 1) { + console.log('Data:', data); + console.log(`Base URL: ${api_cfg['base_url']}; Timeout: ${timeout}`); + console.log('API Config:', api_cfg); + } + if (log_lvl > 2) { + console.log( + `Return Meta: ${return_meta}; Return Blob: ${return_blob}; Filename: ${filename}; Auto Download: ${auto_download}` + ); + } + } - if (!api_cfg) { - console.log('No API Config was provided. Returning false.'); - return false; - } + if (!api_cfg) { + console.log('No API Config was provided. Returning false.'); + return false; + } - const axios_api = axios.create({ - baseURL: api_cfg['base_url'], - timeout: timeout // in milliseconds; 60000 = 60 seconds - /* other custom settings */ - }); - axios_api.defaults.headers = api_cfg['headers']; - if (log_lvl) { - console.log('axios_api.defaults.headers:', axios_api.defaults.headers); - console.log('Additional headers:', headers); - } + const axios_api = axios.create({ + baseURL: api_cfg['base_url'], + timeout: timeout // in milliseconds; 60000 = 60 seconds + /* other custom settings */ + }); + axios_api.defaults.headers = api_cfg['headers']; + if (log_lvl) { + console.log('axios_api.defaults.headers:', axios_api.defaults.headers); + console.log('Additional headers:', headers); + } - // console.log('Clean the headers. No _underscores_!') - const headers_cleaned: key_val = {}; - for (const prop in headers) { - // No underscores allowed in the header parameters! - const prop_cleaned = prop.replaceAll('_', '-'); + // console.log('Clean the headers. No _underscores_!') + const headers_cleaned: key_val = {}; + for (const prop in headers) { + // No underscores allowed in the header parameters! + const prop_cleaned = prop.replaceAll('_', '-'); - // The value must be a string for the header! - if (typeof headers[prop] != 'string') { - headers[prop] = JSON.stringify(headers[prop]); - } + // The value must be a string for the header! + if (typeof headers[prop] != 'string') { + headers[prop] = JSON.stringify(headers[prop]); + } - headers_cleaned[prop_cleaned] = headers[prop]; + headers_cleaned[prop_cleaned] = headers[prop]; - if (log_lvl) { - console.log(`${prop_cleaned}: ${headers_cleaned[prop_cleaned]}`); - } - } - headers = headers_cleaned; - if (log_lvl) { - console.log('All headers cleaned:', headers); - } + if (log_lvl) { + console.log(`${prop_cleaned}: ${headers_cleaned[prop_cleaned]}`); + } + } + headers = headers_cleaned; + if (log_lvl) { + console.log('All headers cleaned:', headers); + } - if (log_lvl) { - console.log('URL params:'); - } - for (const prop in params) { - if (log_lvl > 1) { - console.log(`URL param: ${prop}: ${params[prop]}`); - } - if (params[prop] === null) { - params[prop] = 'null'; - } - } + if (log_lvl) { + console.log('URL params:'); + } + for (const prop in params) { + if (log_lvl > 1) { + console.log(`URL param: ${prop}: ${params[prop]}`); + } + if (params[prop] === null) { + params[prop] = 'null'; + } + } - // Handle the case where there is no Blob expected to be returned. Mainly JSON and text data. - if (!return_blob) { - const response_data_promise = await axios_api - .get(endpoint, { - headers: headers, - params: params, - onDownloadProgress: (progressEvent) => { - const percent_completed = Math.round((progressEvent.loaded * 100) / progressEvent.total); - if (log_lvl > 1) { - console.log( - 'GET Data Progress:', - progressEvent.progress, - 'Total:', - progressEvent.total, - 'Loaded:', - progressEvent.loaded, - 'Percent Completed', - percent_completed - ); - } + // Handle the case where there is no Blob expected to be returned. Mainly JSON and text data. + if (!return_blob) { + const response_data_promise = await axios_api + .get(endpoint, { + headers: headers, + params: params, + onDownloadProgress: (progressEvent) => { + const percent_completed = Math.round( + (progressEvent.loaded * 100) / progressEvent.total + ); + if (log_lvl > 1) { + 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; - // WARNING: This needs to be tied to an object type and ID. This is a temporary solution. - try { - // Check if window is defined. This is to prevent errors in SvelteKit. - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_data', - status: 'downloading', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: progressEvent.total, - size_loaded: progressEvent.loaded, - percent_completed: percent_completed - }, - '*' - ); - } - } catch (error) { - console.log('Error posting message to window:', error); - } - } - }) - .then(function (response) { - 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)}` - ); - } - if (log_lvl > 1) { - console.log('GET Response:', response); - } + // WARNING: This needs to be tied to an object type and ID. This is a temporary solution. + try { + // Check if window is defined. This is to prevent errors in SvelteKit. + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_data', + status: 'downloading', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: progressEvent.total, + size_loaded: progressEvent.loaded, + percent_completed: percent_completed + }, + '*' + ); + } + } catch (error) { + console.log('Error posting message to window:', error); + } + } + }) + .then(function (response) { + 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)}` + ); + } + if (log_lvl > 1) { + console.log('GET Response:', response); + } - // Post file download message - try { - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_data', - status: 'complete', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: 0, - size_loaded: 0, - percent_completed: 100 - }, - '*' - ); - } - } catch (error) { - console.log('Error posting message to window:', error); - } + // Post file download message + try { + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_data', + status: 'complete', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: 0, + size_loaded: 0, + percent_completed: 100 + }, + '*' + ); + } + } catch (error) { + console.log('Error posting message to window:', error); + } - if (!Array.isArray(response.data['data']) && as_list) { - if (log_lvl) { - console.log( - 'Data result is a dictionary/object, not an array/list. Forcing return as an array/list' - ); - } - const return_data = []; - return_data.push(response.data['data']); - return return_data; - } else if (response.data['data']) { - const return_data = response.data['data']; - if (log_lvl) { - if (Array.isArray(return_data)) { - console.log(`Data result is an array/list. Array length: ${return_data.length}`); - } else { - console.log(`Data result is a dictionary/object, not an array/list.`); - } - } - return return_data; - } else { - const return_data = response.data; - if (log_lvl) { - 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}` - ); - } else { - console.log( - `Not a standard response from Aether's API. Data result is a dictionary/object, not an array/list.` - ); - } - } - return return_data; - } - }) - .catch(function (error: any) { - // Handle the common and expected 404 "error" first - if (error.response && error.response.status === 404) { - if (log_lvl) { - console.log('The response was a 404 not found "error". Returning null.'); - } - if (log_lvl > 1) { - console.log(error.response); - } - if (log_lvl > 2) { - console.log(error); - } + if (!Array.isArray(response.data['data']) && as_list) { + if (log_lvl) { + console.log( + 'Data result is a dictionary/object, not an array/list. Forcing return as an array/list' + ); + } + const return_data = []; + return_data.push(response.data['data']); + return return_data; + } else if (response.data['data']) { + const return_data = response.data['data']; + if (log_lvl) { + if (Array.isArray(return_data)) { + console.log( + `Data result is an array/list. Array length: ${return_data.length}` + ); + } else { + console.log(`Data result is a dictionary/object, not an array/list.`); + } + } + return return_data; + } else { + const return_data = response.data; + if (log_lvl) { + 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}` + ); + } else { + console.log( + `Not a standard response from Aether's API. Data result is a dictionary/object, not an array/list.` + ); + } + } + return return_data; + } + }) + .catch(function (error: any) { + // Handle the common and expected 404 "error" first + if (error.response && error.response.status === 404) { + if (log_lvl) { + console.log('The response was a 404 not found "error". Returning null.'); + } + if (log_lvl > 1) { + console.log(error.response); + } + if (log_lvl > 2) { + console.log(error); + } - // Post file download message - try { - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_data', - status: 'complete', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: 0, - size_loaded: 0, - percent_completed: 0 - }, - '*' - ); - } - } catch (error) { - console.log('Error posting message to window:', error); - } - return null; // Returning null since there were no results - } + // Post file download message + try { + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_data', + status: 'complete', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: 0, + size_loaded: 0, + percent_completed: 0 + }, + '*' + ); + } + } catch (error) { + console.log('Error posting message to window:', error); + } + return null; // Returning null since there were no results + } - if (log_lvl) { - console.log(`Base URL: ${api_cfg['base_url']} | Endpoint: ${endpoint}`); - console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion??? + if (log_lvl) { + console.log(`Base URL: ${api_cfg['base_url']} | Endpoint: ${endpoint}`); + console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion??? - if (error.response) { - // The request was made and the server responded with a status code that falls out of the range of 2xx - console.log('Error Response Data', error.response.data); - console.log('Error Response Status', error.response.status); - console.log('Error Response Headers', error.response.headers); - } else if (error.request) { - // The request was made but no response was received `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js - if (log_lvl > 1) { - console.log('Error Request', error.request); - } - } else { - // Something happened in setting up the request that triggered an Error - console.log('Error Message', error.message); - } - } - if (log_lvl > 2) { - console.log('Error:', error); - console.log(error.config); - } + if (error.response) { + // The request was made and the server responded with a status code that falls out of the range of 2xx + console.log('Error Response Data', error.response.data); + console.log('Error Response Status', error.response.status); + console.log('Error Response Headers', error.response.headers); + } else if (error.request) { + // The request was made but no response was received `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js + if (log_lvl > 1) { + console.log('Error Request', error.request); + } + } else { + // Something happened in setting up the request that triggered an Error + console.log('Error Message', error.message); + } + } + if (log_lvl > 2) { + console.log('Error:', error); + console.log(error.config); + } - if (error.code === 'ECONNABORTED') { - // Timeout Error (You can implement retry here where suitable) - console.log('Timeout Error: ', error.message); - } - if (log_lvl) { - console.log('The response was an error. Returning false.'); - } + if (error.code === 'ECONNABORTED') { + // Timeout Error (You can implement retry here where suitable) + console.log('Timeout Error: ', error.message); + } + if (log_lvl) { + console.log('The response was an error. Returning false.'); + } - return false; // Returning false since something may have gone wrong. This includes timeouts. Also more in line with what the API returns. - // return error; - }); + return false; // Returning false since something may have gone wrong. This includes timeouts. Also more in line with what the API returns. + // return error; + }); - if (log_lvl > 1) { - // console.log(`Response Data: ${response_data_promise}`); - console.log(`Response Data:`, response_data_promise); - // console.log(response_data_promise); - } - if (response_data_promise) { - // The most common and expected response. - // console.log('Returning result. This is generally expected.'); - return response_data_promise; - } else if (response_data_promise === null) { - // Less common, but expected response if no results were returned. - if (log_lvl) { - console.log('Returning null. This is expected if no results were found. (404)'); - } - return response_data_promise; - } else if (response_data_promise === false) { - // Not common, but expected response if the request to the API had an issue. - console.log('Returning false. There may have been an issue with this request.'); - return response_data_promise; - } else { - // This generally should not happen. It likely means the query was bad or an API issue. - console.log('Returning (JSON/text) unknown. This should not happen in most cases.'); - Promise.reject(new Error('fail')).then(resolved, rejected); - } + if (log_lvl > 1) { + // console.log(`Response Data: ${response_data_promise}`); + console.log(`Response Data:`, response_data_promise); + // console.log(response_data_promise); + } + if (response_data_promise) { + // The most common and expected response. + // console.log('Returning result. This is generally expected.'); + return response_data_promise; + } else if (response_data_promise === null) { + // Less common, but expected response if no results were returned. + if (log_lvl) { + console.log('Returning null. This is expected if no results were found. (404)'); + } + return response_data_promise; + } else if (response_data_promise === false) { + // Not common, but expected response if the request to the API had an issue. + console.log('Returning false. There may have been an issue with this request.'); + return response_data_promise; + } else { + // This generally should not happen. It likely means the query was bad or an API issue. + console.log('Returning (JSON/text) unknown. This should not happen in most cases.'); + Promise.reject(new Error('fail')).then(resolved, rejected); + } - // Handle the case where a Blob is expected to be returned. - } else { - // console.log('Expecting a Blob to be returned...'); + // Handle the case where a Blob is expected to be returned. + } else { + // console.log('Expecting a Blob to be returned...'); - const response_data_promise = await axios_api - .get(endpoint, { - params: params, - responseType: 'blob', - onDownloadProgress: (progressEvent) => { - const percent_completed = Math.round((progressEvent.loaded * 100) / progressEvent.total); - console.log( - 'GET Blob Progress:', - progressEvent.progress, - 'Total:', - progressEvent.total, - 'Loaded:', - progressEvent.loaded, - 'Percent Completed', - percent_completed - ); + const response_data_promise = await axios_api + .get(endpoint, { + params: params, + responseType: 'blob', + onDownloadProgress: (progressEvent) => { + const percent_completed = Math.round( + (progressEvent.loaded * 100) / progressEvent.total + ); + 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. - try { - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_blob', - status: 'downloading', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: progressEvent.total, - size_loaded: progressEvent.loaded, - percent_completed: percent_completed - }, - '*' - ); - } - } catch (error) { - console.log('Error posting message to window:', error); - } - } - }) - .then(function (response) { - 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}` - ); - } - if (log_lvl > 1) { - console.log('GET (blob) Response:', response); - } + // WARNING: This needs to be tied to an object type and ID. This is a temporary solution. + try { + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_blob', + status: 'downloading', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: progressEvent.total, + size_loaded: progressEvent.loaded, + percent_completed: percent_completed + }, + '*' + ); + } + } catch (error) { + console.log('Error posting message to window:', error); + } + } + }) + .then(function (response) { + 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}` + ); + } + if (log_lvl > 1) { + console.log('GET (blob) Response:', response); + } - const { data, headers } = response; + const { data, headers } = response; - // Careful if this download filename needs to be changed to a different file extension. The browser/client may not know how to handle it. - if (filename) { - } else if (headers['content-disposition']) { - filename = headers['content-disposition'].replace(/\w+;filename=(.*)/, '$1'); - } else { - filename = 'unknown_file.ext'; - } + // Careful if this download filename needs to be changed to a different file extension. The browser/client may not know how to handle it. + if (filename) { + } else if (headers['content-disposition']) { + filename = headers['content-disposition'].replace(/\w+;filename=(.*)/, '$1'); + } else { + filename = 'unknown_file.ext'; + } - // WARNING: This needs to be tied to an object type and ID. This is a temporary solution. - try { - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_blob', - status: 'complete', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: 0, - size_loaded: 0, - percent_completed: 100 - }, - '*' - ); - } - } catch (error) { - console.log('Error posting message to window:', error); - } + // WARNING: This needs to be tied to an object type and ID. This is a temporary solution. + try { + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_blob', + status: 'complete', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: 0, + size_loaded: 0, + percent_completed: 100 + }, + '*' + ); + } + } catch (error) { + console.log('Error posting message to window:', error); + } - if (auto_download) { - if (log_lvl) { - console.log(`Auto Download: ${filename}`); - } - const url = window.URL.createObjectURL(new Blob([response.data])); - const link = document.createElement('a'); - link.href = url; - link.setAttribute('download', filename); - document.body.appendChild(link); - link.click(); - return true; - } else { - return response; - } - }) - .catch(function (error: any) { - // Handle the common and expected 404 "error" first - if (error.response && error.response.status === 404) { - if (log_lvl) { - console.log('The response was a 404 not found "error". Returning null.'); - } - if (log_lvl > 1) { - console.log(error.response); - } - if (log_lvl > 2) { - console.log(error); - } + if (auto_download) { + if (log_lvl) { + console.log(`Auto Download: ${filename}`); + } + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', filename); + document.body.appendChild(link); + link.click(); + return true; + } else { + return response; + } + }) + .catch(function (error: any) { + // Handle the common and expected 404 "error" first + if (error.response && error.response.status === 404) { + if (log_lvl) { + console.log('The response was a 404 not found "error". Returning null.'); + } + if (log_lvl > 1) { + console.log(error.response); + } + if (log_lvl > 2) { + console.log(error); + } - // Post file download message - try { - if (typeof window !== 'undefined') { - window.postMessage( - { - type: 'api_download_blob', - status: 'complete', - task_id: task_id, - endpoint: endpoint, - filename: filename, - size_total: 0, - size_loaded: 0, - percent_completed: 0 - }, - '*' - ); - } - } catch (error) { - console.log('Error posting message to window:', error); - } - return null; // Returning null since there were no results - } + // Post file download message + try { + if (typeof window !== 'undefined') { + window.postMessage( + { + type: 'api_download_blob', + status: 'complete', + task_id: task_id, + endpoint: endpoint, + filename: filename, + size_total: 0, + size_loaded: 0, + percent_completed: 0 + }, + '*' + ); + } + } catch (error) { + console.log('Error posting message to window:', error); + } + return null; // Returning null since there were no results + } - if (log_lvl) { - console.log(`Base URL: ${api_cfg['base_url']} | Endpoint: ${endpoint}`); - console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion??? + if (log_lvl) { + console.log(`Base URL: ${api_cfg['base_url']} | Endpoint: ${endpoint}`); + console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion??? - if (error.response) { - // The request was made and the server responded with a status code that falls out of the range of 2xx - console.log('Error Response Data', error.response.data); - console.log('Error Response Status', error.response.status); - console.log('Error Response Headers', error.response.headers); - } else if (error.request) { - // The request was made but no response was received `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js - if (log_lvl > 1) { - console.log('Error Request', error.request); - } - } else { - // Something happened in setting up the request that triggered an Error - console.log('Error Message', error.message); - } - } + if (error.response) { + // The request was made and the server responded with a status code that falls out of the range of 2xx + console.log('Error Response Data', error.response.data); + console.log('Error Response Status', error.response.status); + console.log('Error Response Headers', error.response.headers); + } else if (error.request) { + // The request was made but no response was received `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js + if (log_lvl > 1) { + console.log('Error Request', error.request); + } + } else { + // Something happened in setting up the request that triggered an Error + console.log('Error Message', error.message); + } + } - if (error.code === 'ECONNABORTED') { - // Timeout Error (You can implement retry here where suitable) - console.log('Timeout Error: ', error.message); - } + if (error.code === 'ECONNABORTED') { + // Timeout Error (You can implement retry here where suitable) + console.log('Timeout Error: ', error.message); + } - if (log_lvl) { - console.log('The response was an error. Returning false.'); - } + if (log_lvl) { + console.log('The response was an error. Returning false.'); + } - return false; // Returning false since something may have gone wrong. This includes timeouts. Also more in line with what the API returns. - // return error; - }); + return false; // Returning false since something may have gone wrong. This includes timeouts. Also more in line with what the API returns. + // return error; + }); - if (response_data_promise) { - // The most common and expected response. - // console.log('Returning result. This is generally expected.'); - // let test_blob = new Blob([response_data_promise.data]); - // console.log(test_blob); - // return test_blob; - // console.log(response_data_promise.blob()); - return response_data_promise; - } else if (response_data_promise === null) { - // Less common, but expected response if no results were returned. - if (log_lvl) { - console.log('Returning null. This is expected if no results were found. (404)'); - } - return response_data_promise; - } else if (response_data_promise === false) { - // Not common, but expected response if the request to the API had an issue. - console.log('Returning false. There may have been an issue with this request.'); - return response_data_promise; - } else { - // This generally should not happen. It likely means the query was bad or an API issue. - console.log('Returning (blob) unknown. This should not happen in most cases.'); - Promise.reject(new Error('fail')).then(resolved, rejected); - } - } + if (response_data_promise) { + // The most common and expected response. + // console.log('Returning result. This is generally expected.'); + // let test_blob = new Blob([response_data_promise.data]); + // console.log(test_blob); + // return test_blob; + // console.log(response_data_promise.blob()); + return response_data_promise; + } else if (response_data_promise === null) { + // Less common, but expected response if no results were returned. + if (log_lvl) { + console.log('Returning null. This is expected if no results were found. (404)'); + } + return response_data_promise; + } else if (response_data_promise === false) { + // Not common, but expected response if the request to the API had an issue. + console.log('Returning false. There may have been an issue with this request.'); + return response_data_promise; + } else { + // This generally should not happen. It likely means the query was bad or an API issue. + console.log('Returning (blob) unknown. This should not happen in most cases.'); + Promise.reject(new Error('fail')).then(resolved, rejected); + } + } }; function resolved(result: any) { - console.log('Resolved'); + console.log('Resolved'); } function rejected(result: any) { - console.error(result); + console.error(result); } diff --git a/src/lib/ae_api/api_patch_object.ts b/src/lib/ae_api/api_patch_object.ts index 17789fcb..30f9ed9d 100644 --- a/src/lib/ae_api/api_patch_object.ts +++ b/src/lib/ae_api/api_patch_object.ts @@ -2,143 +2,143 @@ // Updated 2024-05-23 export const patch_object = async function patch_object({ - api_cfg = null, - endpoint = '', - params = {}, - data = {}, - return_meta = false, - log_lvl = 0, - retry_count = 5 // Number of retry attempts + api_cfg = null, + endpoint = '', + params = {}, + data = {}, + return_meta = false, + log_lvl = 0, + retry_count = 5 // Number of retry attempts }: { - api_cfg: any; - endpoint: string; - params?: any; - data?: any; - return_meta?: boolean; - log_lvl?: number; - retry_count?: number; + api_cfg: any; + endpoint: string; + params?: any; + data?: any; + return_meta?: boolean; + log_lvl?: number; + retry_count?: number; }) { - if (log_lvl) { - console.log(`*** patch_object() *** Endpoint: ${endpoint}`); - console.log('Params:', params); - if (log_lvl > 1) { - console.log('Data:', data); - } - } + if (log_lvl) { + console.log(`*** patch_object() *** Endpoint: ${endpoint}`); + console.log('Params:', params); + if (log_lvl > 1) { + console.log('Data:', data); + } + } - if (!api_cfg) { - console.error('No API Config was provided. Returning false.'); - return false; - } + if (!api_cfg) { + console.error('No API Config was provided. Returning false.'); + return false; + } - // Construct the URL with query parameters - const url = new URL(endpoint, api_cfg['base_url']); - Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); + // Construct the URL with query parameters + const url = new URL(endpoint, api_cfg['base_url']); + Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); - // Clean the headers - const headers_cleaned: Record = {}; - for (const prop in api_cfg['headers']) { - const prop_cleaned = prop.replaceAll('_', '-'); - headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; - } + // Clean the headers + const headers_cleaned: Record = {}; + for (const prop in api_cfg['headers']) { + const prop_cleaned = prop.replaceAll('_', '-'); + headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; + } - if (log_lvl > 1) { - console.log('Cleaned Headers:', headers_cleaned); - } + if (log_lvl > 1) { + console.log('Cleaned Headers:', headers_cleaned); + } - const fetchOptions: RequestInit = { - method: 'PATCH', - headers: { - ...headers_cleaned, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }; + const fetchOptions: RequestInit = { + method: 'PATCH', + headers: { + ...headers_cleaned, + 'Content-Type': 'application/json' + }, + body: JSON.stringify(data) + }; - if (log_lvl > 1) { - console.log('Fetch Options:', fetchOptions); - } + if (log_lvl > 1) { + console.log('Fetch Options:', fetchOptions); + } - for (let attempt = 1; attempt <= retry_count; attempt++) { - try { - const response = await fetch(url.toString(), fetchOptions); + for (let attempt = 1; attempt <= retry_count; attempt++) { + try { + const response = await fetch(url.toString(), fetchOptions); - if (log_lvl) { - console.log(`Response: status=${response.status} attempt=${attempt}`); - } + if (log_lvl) { + console.log(`Response: status=${response.status} attempt=${attempt}`); + } - if (!response.ok) { - if (response.status === 404) { - console.warn('404 Not Found. Returning null.'); - return null; // Returning null since there were no results - } - throw new Error(`HTTP error! status: ${response.status}`); - } + if (!response.ok) { + if (response.status === 404) { + console.warn('404 Not Found. Returning null.'); + return null; // Returning null since there were no results + } + throw new Error(`HTTP error! status: ${response.status}`); + } - const json = await response.json(); + const json = await response.json(); - if (log_lvl > 1) { - console.log('Response JSON:', json); - } + if (log_lvl > 1) { + console.log('Response JSON:', json); + } - // Return the response data or metadata - return return_meta ? json : json.data; - } catch (error) { - console.error(`API PATCH error on attempt ${attempt}:`, error); + // Return the response data or metadata + return return_meta ? json : json.data; + } catch (error) { + console.error(`API PATCH error on attempt ${attempt}:`, error); - // If this is the last attempt, return false - if (attempt === retry_count) { - console.error('Max retry attempts reached. Returning false.'); - return false; - } + // If this is the last attempt, return false + if (attempt === retry_count) { + console.error('Max retry attempts reached. Returning false.'); + return false; + } - // Log retry information - if (log_lvl) { - console.log(`Retrying... (${attempt}/${retry_count})`); - } - } - } + // Log retry information + if (log_lvl) { + console.log(`Retrying... (${attempt}/${retry_count})`); + } + } + } - // let axios_api = axios.create({ - // baseURL: api_cfg['base_url'], - // /* other custom settings */ - // }); - // axios_api.defaults.headers = api_cfg['headers']; + // let axios_api = axios.create({ + // baseURL: api_cfg['base_url'], + // /* other custom settings */ + // }); + // axios_api.defaults.headers = api_cfg['headers']; - // for (let attempt = 1; attempt <= retry_count; attempt++) { - // try { - // const response = await axios_api.patch(endpoint, data, { params: params }); - // if (log_lvl) { - // console.log(`Response: status=${response.status} attempt=${attempt}`); - // } - // if (log_lvl > 1) { - // console.log('Response Data:', response.data); - // } + // for (let attempt = 1; attempt <= retry_count; attempt++) { + // try { + // const response = await axios_api.patch(endpoint, data, { params: params }); + // if (log_lvl) { + // console.log(`Response: status=${response.status} attempt=${attempt}`); + // } + // if (log_lvl > 1) { + // console.log('Response Data:', response.data); + // } - // // Return the response data - // return response.data['data']; - // } catch (error) { - // if (log_lvl) { - // console.error(`Error on attempt ${attempt}:`, error); - // } + // // Return the response data + // return response.data['data']; + // } catch (error) { + // if (log_lvl) { + // console.error(`Error on attempt ${attempt}:`, error); + // } - // // Handle specific errors (e.g., 404) - // if (error.response && error.response.status === 404) { - // console.warn('404 Not Found. Returning null.'); - // return null; // Returning null since there were no results - // } + // // Handle specific errors (e.g., 404) + // if (error.response && error.response.status === 404) { + // console.warn('404 Not Found. Returning null.'); + // return null; // Returning null since there were no results + // } - // // If this is the last attempt, return false - // if (attempt === retry_count) { - // console.error('Max retry attempts reached. Returning false.'); - // return false; - // } + // // If this is the last attempt, return false + // if (attempt === retry_count) { + // console.error('Max retry attempts reached. Returning false.'); + // return false; + // } - // // Log retry information - // if (log_lvl) { - // console.log(`Retrying... (${attempt}/${retry_count})`); - // } - // } - // } - // return response_data; + // // Log retry information + // if (log_lvl) { + // console.log(`Retrying... (${attempt}/${retry_count})`); + // } + // } + // } + // return response_data; }; diff --git a/src/lib/ae_api/api_post_object.ts b/src/lib/ae_api/api_post_object.ts index 9911fdef..900c4a4a 100644 --- a/src/lib/ae_api/api_post_object.ts +++ b/src/lib/ae_api/api_post_object.ts @@ -7,339 +7,339 @@ export const post_object_percent_completed = temp_post_object_percent_completed; // Updated 2024-05-23 export const post_object = async function post_object({ - api_cfg = null, - endpoint = '', - params = {}, - data = {}, - form_data = null, - return_meta = false, - return_blob = false, - filename = '', - auto_download = false, - // 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, - retry_count = 5 + api_cfg = null, + endpoint = '', + params = {}, + data = {}, + form_data = null, + return_meta = false, + return_blob = false, + filename = '', + auto_download = false, + // 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, + retry_count = 5 }: { - api_cfg: any; - endpoint: string; - params?: any; - data?: any; - form_data?: any; - return_meta?: boolean; - return_blob?: boolean; - filename?: string; - auto_download?: boolean; - task_id?: string; - log_lvl?: number; - retry_count?: number; + api_cfg: any; + endpoint: string; + params?: any; + data?: any; + form_data?: any; + return_meta?: boolean; + return_blob?: boolean; + filename?: string; + auto_download?: boolean; + task_id?: string; + log_lvl?: number; + retry_count?: number; }) { - if (log_lvl) { - console.log(`*** post_object() *** Endpoint: ${endpoint} Task ID: ${task_id}`); - console.log('Params:', params); - if (log_lvl > 1) { - console.log('Data:', data); - console.log(typeof data); - console.log(`Base URL: ${api_cfg['base_url']}`); - console.log('API Config:', api_cfg); - } - if (log_lvl > 2) { - console.log(`Return Meta: ${return_meta}`); - console.log(`Return Blob: ${return_blob}`); - console.log(`Filename: ${filename}`); - console.log(`Auto Download: ${auto_download}`); - } - } + if (log_lvl) { + console.log(`*** post_object() *** Endpoint: ${endpoint} Task ID: ${task_id}`); + console.log('Params:', params); + if (log_lvl > 1) { + console.log('Data:', data); + console.log(typeof data); + console.log(`Base URL: ${api_cfg['base_url']}`); + console.log('API Config:', api_cfg); + } + if (log_lvl > 2) { + console.log(`Return Meta: ${return_meta}`); + console.log(`Return Blob: ${return_blob}`); + console.log(`Filename: ${filename}`); + console.log(`Auto Download: ${auto_download}`); + } + } - // console.log('HERE!! API POST 0'); + // console.log('HERE!! API POST 0'); - if (!api_cfg) { - console.error('No API Config was provided. Returning false.'); - return false; - } + if (!api_cfg) { + console.error('No API Config was provided. Returning false.'); + return false; + } - // console.log('HERE!! API POST 1'); + // console.log('HERE!! API POST 1'); - // Construct the URL with query parameters - const url = new URL(endpoint, api_cfg['base_url']); - if (params) { - Object.keys(params).forEach((key) => url.searchParams.append(key, params[key])); - } + // Construct the URL with query parameters + const url = new URL(endpoint, api_cfg['base_url']); + if (params) { + 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 - const headers_cleaned: Record = {}; - for (const prop in api_cfg['headers']) { - const prop_cleaned = prop.replaceAll('_', '-'); - headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; - } + // Clean the headers + const headers_cleaned: Record = {}; + for (const prop in api_cfg['headers']) { + const prop_cleaned = prop.replaceAll('_', '-'); + headers_cleaned[prop_cleaned] = api_cfg['headers'][prop]; + } - // console.log('HERE!! API POST 3'); + // console.log('HERE!! API POST 3'); - if (form_data) { - // headers_cleaned['Content-Type'] = 'multipart/form-data'; - delete headers_cleaned['Content-Type']; - delete headers_cleaned['content-type']; // Just in case - delete headers_cleaned['Content-type']; // Just in case - console.log('Form Data:', form_data); - } else { - headers_cleaned['Content-Type'] = 'application/json'; - } + if (form_data) { + // headers_cleaned['Content-Type'] = 'multipart/form-data'; + delete headers_cleaned['Content-Type']; + delete headers_cleaned['content-type']; // Just in case + delete headers_cleaned['Content-type']; // Just in case + console.log('Form Data:', form_data); + } else { + headers_cleaned['Content-Type'] = 'application/json'; + } - if (log_lvl > 1) { - console.log('Cleaned Headers:', headers_cleaned); - } + if (log_lvl > 1) { + console.log('Cleaned Headers:', headers_cleaned); + } - // console.log('HERE!! API POST 4'); + // console.log('HERE!! API POST 4'); - for (let attempt = 1; attempt <= retry_count; attempt++) { - try { - const controller = new AbortController(); - const fetchOptions: RequestInit = { - method: 'POST', - headers: headers_cleaned, - body: form_data ? form_data : JSON.stringify(data), - signal: controller.signal - }; + for (let attempt = 1; attempt <= retry_count; attempt++) { + try { + const controller = new AbortController(); + const fetchOptions: RequestInit = { + method: 'POST', + headers: headers_cleaned, + body: form_data ? form_data : JSON.stringify(data), + signal: controller.signal + }; - if (log_lvl > 1) { - console.log('Fetch Options:', fetchOptions); - } + if (log_lvl > 1) { + console.log('Fetch Options:', fetchOptions); + } - const response = await fetch(url.toString(), fetchOptions); + const response = await fetch(url.toString(), fetchOptions); - if (log_lvl) { - console.log(`Response: status=${response.status} attempt=${attempt}`); - } + if (log_lvl) { + console.log(`Response: status=${response.status} attempt=${attempt}`); + } - if (!response.ok) { - if (response.status === 404) { - console.warn('404 Not Found. Returning null.'); - return null; // Returning null since there were no results - } - throw new Error(`HTTP error! status: ${response.status}`); - } + if (!response.ok) { + if (response.status === 404) { + console.warn('404 Not Found. Returning null.'); + return null; // Returning null since there were no results + } + throw new Error(`HTTP error! status: ${response.status}`); + } - if (!return_blob) { - const json = await response.json(); + if (!return_blob) { + const json = await response.json(); - if (log_lvl > 1) { - console.log('Response JSON:', json); - } + if (log_lvl > 1) { + console.log('Response JSON:', json); + } - // Post a message to the window indicating the upload is complete - try { - window.postMessage( - { - type: 'api_post_json_form', - status: 'complete', - task_id: task_id, - endpoint: endpoint, - size_total: 0, - size_loaded: 0, - percent_completed: 100, - progress: 100, - rate: 0 - }, - '*' - ); - } catch (error) { - console.error('Error posting message to window:', error); - } + // Post a message to the window indicating the upload is complete + try { + window.postMessage( + { + type: 'api_post_json_form', + status: 'complete', + task_id: task_id, + endpoint: endpoint, + size_total: 0, + size_loaded: 0, + percent_completed: 100, + progress: 100, + rate: 0 + }, + '*' + ); + } catch (error) { + console.error('Error posting message to window:', error); + } - // Return the response data or metadata - return return_meta ? json : json.data; - } else { - const blob = await response.blob(); + // Return the response data or metadata + return return_meta ? json : json.data; + } else { + const blob = await response.blob(); - if (auto_download) { - const downloadUrl = window.URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = downloadUrl; - link.setAttribute('download', filename || 'download'); - document.body.appendChild(link); - link.click(); - link.remove(); - return true; - } else { - return blob; - } - } - } catch (error) { - console.error(`API POST error on attempt ${attempt}:`, error); + if (auto_download) { + const downloadUrl = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = downloadUrl; + link.setAttribute('download', filename || 'download'); + document.body.appendChild(link); + link.click(); + link.remove(); + return true; + } else { + return blob; + } + } + } catch (error) { + console.error(`API POST error on attempt ${attempt}:`, error); - // If this is the last attempt, return false - if (attempt === retry_count) { - console.error('Max retry attempts reached. Returning false.'); - return false; - } + // If this is the last attempt, return false + if (attempt === retry_count) { + console.error('Max retry attempts reached. Returning false.'); + return false; + } - // Log retry information - if (log_lvl) { - console.log(`Retrying... (${attempt}/${retry_count})`); - } - } - } + // Log retry information + if (log_lvl) { + console.log(`Retrying... (${attempt}/${retry_count})`); + } + } + } - // let axios_api = axios.create({ - // baseURL: api_cfg['base_url'], - // /* other custom settings */ - // }); - // axios_api.defaults.headers = api_cfg['headers']; - // console.log('Axios API', axios_api); - // // console.log('Axios API POST', axios_api.post); + // let axios_api = axios.create({ + // baseURL: api_cfg['base_url'], + // /* other custom settings */ + // }); + // axios_api.defaults.headers = api_cfg['headers']; + // console.log('Axios API', axios_api); + // // console.log('Axios API POST', axios_api.post); - // // if (typeof data == 'FormData') { - // if (form_data) { - // axios_api.defaults.headers['content-type'] = 'multipart/form-data'; - // data = form_data; - // } else { - // axios_api.defaults.headers['content-type'] = 'application/json'; - // } + // // if (typeof data == 'FormData') { + // if (form_data) { + // axios_api.defaults.headers['content-type'] = 'multipart/form-data'; + // data = form_data; + // } else { + // axios_api.defaults.headers['content-type'] = 'application/json'; + // } - // if (!return_blob) { - // let response_data = await axios_api.post( - // endpoint, - // data, - // { - // params: params, - // onUploadProgress: (progressEvent) => { - // let percent_completed = Math.round( - // (progressEvent.loaded * 100) / progressEvent.total - // ); - // console.log('POST Progress:', progressEvent.progress, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed); + // if (!return_blob) { + // let response_data = await axios_api.post( + // endpoint, + // data, + // { + // params: params, + // onUploadProgress: (progressEvent) => { + // let percent_completed = Math.round( + // (progressEvent.loaded * 100) / progressEvent.total + // ); + // console.log('POST Progress:', progressEvent.progress, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed); - // temp_post_object_percent_completed = percent_completed; + // temp_post_object_percent_completed = percent_completed; - // try { - // window.postMessage({ - // type: 'api_post_json_form', - // status: 'uploading', - // task_id: task_id, - // endpoint: endpoint, - // size_total: progressEvent.total, - // size_loaded: progressEvent.loaded, - // percent_completed: percent_completed, - // progress: progressEvent.progress, - // rate: progressEvent.rate, - // }, - // '*' - // ); - // } catch (error) { - // console.log('Error posting message to window:', error); - // } - // } - // } - // ) - // .then(function (response) { - // console.log('POST Response Data:', response.data); - // try { - // window.postMessage({ - // type: 'api_post_json_form', - // status: 'complete', - // task_id: task_id, - // endpoint: endpoint, - // size_total: 0, - // size_loaded: 0, - // percent_completed: 100, - // progress: 100, - // rate: 0, - // }, - // '*' - // ); - // } catch (error) { - // console.log('Error posting message to window:', error); - // } + // try { + // window.postMessage({ + // type: 'api_post_json_form', + // status: 'uploading', + // task_id: task_id, + // endpoint: endpoint, + // size_total: progressEvent.total, + // size_loaded: progressEvent.loaded, + // percent_completed: percent_completed, + // progress: progressEvent.progress, + // rate: progressEvent.rate, + // }, + // '*' + // ); + // } catch (error) { + // console.log('Error posting message to window:', error); + // } + // } + // } + // ) + // .then(function (response) { + // console.log('POST Response Data:', response.data); + // try { + // window.postMessage({ + // type: 'api_post_json_form', + // status: 'complete', + // task_id: task_id, + // endpoint: endpoint, + // size_total: 0, + // size_loaded: 0, + // percent_completed: 100, + // progress: 100, + // rate: 0, + // }, + // '*' + // ); + // } catch (error) { + // console.log('Error posting message to window:', error); + // } - // if (response.data['data'].result === null) { - // // This should mean that the request was successful, but a result of None/null was returned from Aether API. - // // console.log('Returning null after POST'); - // return null; - // } else { - // // This should mean that the request was successful, and a result with data was returned from Aether API. - // // console.log('Returning data after POST'); - // return response.data['data']; - // } - // //return response.data; - // }) - // .catch(function (error: any) { - // if (error.response && error.response.status === 404) { - // return null; // Returning null since there were no results - // } - // console.log(error); - // return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. - // // return error; - // }); + // if (response.data['data'].result === null) { + // // This should mean that the request was successful, but a result of None/null was returned from Aether API. + // // console.log('Returning null after POST'); + // return null; + // } else { + // // This should mean that the request was successful, and a result with data was returned from Aether API. + // // console.log('Returning data after POST'); + // return response.data['data']; + // } + // //return response.data; + // }) + // .catch(function (error: any) { + // if (error.response && error.response.status === 404) { + // return null; // Returning null since there were no results + // } + // console.log(error); + // return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. + // // return error; + // }); - // if (log_lvl > 1) { - // console.log('Response Data:', response_data); - // } - // axios_api.defaults.headers['content-type'] = 'application/json'; - // return response_data; + // if (log_lvl > 1) { + // console.log('Response Data:', response_data); + // } + // axios_api.defaults.headers['content-type'] = 'application/json'; + // return response_data; - // } else { - // // console.log('Expecting a Blob to be returned...'); + // } else { + // // console.log('Expecting a Blob to be returned...'); - // let response_data_promise = await axios_api.post( - // endpoint, - // data, - // { - // params: params, - // responseType: 'blob', - // onDownloadProgress: (progressEvent) => { - // let percent_completed = Math.round( - // (progressEvent.loaded * 100) / progressEvent.total - // ); - // console.log('POST Blob Progress:', progressEvent.progress, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed); + // let response_data_promise = await axios_api.post( + // endpoint, + // data, + // { + // params: params, + // responseType: 'blob', + // onDownloadProgress: (progressEvent) => { + // let percent_completed = Math.round( + // (progressEvent.loaded * 100) / progressEvent.total + // ); + // console.log('POST Blob Progress:', progressEvent.progress, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed); - // temp_post_blob_percent_completed = percent_completed; - // } - // } - // ) - // .then(function (response) { - // if (log_lvl) { - // console.log(response); - // } + // temp_post_blob_percent_completed = percent_completed; + // } + // } + // ) + // .then(function (response) { + // if (log_lvl) { + // console.log(response); + // } - // const { data, headers } = response - // console.log(headers); + // const { data, headers } = response + // console.log(headers); - // if (filename) { - // } else if (headers['content-disposition']) { - // filename = headers['content-disposition'].replace(/\w+;filename=(.*)/, '$1'); - // } else { - // filename = 'unknown_file.ext'; - // } + // if (filename) { + // } else if (headers['content-disposition']) { + // filename = headers['content-disposition'].replace(/\w+;filename=(.*)/, '$1'); + // } else { + // filename = 'unknown_file.ext'; + // } - // if (auto_download) { - // const url = window.URL.createObjectURL(new Blob([response.data])); - // const link = document.createElement('a'); - // link.href = url; - // // link.setAttribute('download', 'event_exhibit_tracking_export.xlsx'); //or any other extension - // link.setAttribute('download', filename); //or any other extension - // document.body.appendChild(link); - // link.click(); - // return true; - // } else { - // return response; - // } - // }); + // if (auto_download) { + // const url = window.URL.createObjectURL(new Blob([response.data])); + // const link = document.createElement('a'); + // link.href = url; + // // link.setAttribute('download', 'event_exhibit_tracking_export.xlsx'); //or any other extension + // link.setAttribute('download', filename); //or any other extension + // document.body.appendChild(link); + // link.click(); + // return true; + // } else { + // return response; + // } + // }); - // if (response_data_promise) { - // // The most common and expected response. - // // console.log('Returning result. This is generally expected.'); - // // let test_blob = new Blob([response_data_promise.data]); - // // console.log(test_blob); - // // return test_blob; - // // console.log(response_data_promise.blob()); - // return response_data_promise; - // } else { - // // This generally should not happen. It likely means the query was bad or an API issue. - // console.log('Returning unknown. This should not happen in most cases.'); - // Promise.reject(new Error('fail')).then(resolved, rejected); - // } - // } + // if (response_data_promise) { + // // The most common and expected response. + // // console.log('Returning result. This is generally expected.'); + // // let test_blob = new Blob([response_data_promise.data]); + // // console.log(test_blob); + // // return test_blob; + // // console.log(response_data_promise.blob()); + // return response_data_promise; + // } else { + // // This generally should not happen. It likely means the query was bad or an API issue. + // console.log('Returning unknown. This should not happen in most cases.'); + // Promise.reject(new Error('fail')).then(resolved, rejected); + // } + // } }; // function resolved(result: any) { diff --git a/src/lib/ae_archives/ae_archives__archive.ts b/src/lib/ae_archives/ae_archives__archive.ts index e710c09b..2369217b 100644 --- a/src/lib/ae_archives/ae_archives__archive.ts +++ b/src/lib/ae_archives/ae_archives__archive.ts @@ -10,605 +10,606 @@ const ae_promises: key_val = {}; // Updated 2024-09-25 export async function load_ae_obj_id__archive({ - api_cfg, - archive_id, - inc_content_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_id, + inc_content_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_id: string; - inc_content_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_id: string; + inc_content_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`); + } - ae_promises.load__archive_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'archive', - obj_id: archive_id, - use_alt_table: true, - use_alt_base: false, - params: params, - log_lvl: log_lvl - }) - .then(async function (archive_obj_get_result) { - if (archive_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_props({ - obj_li: [archive_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'archive', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__archive_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'archive', + obj_id: archive_id, + use_alt_table: true, + use_alt_base: false, + params: params, + log_lvl: log_lvl + }) + .then(async function (archive_obj_get_result) { + if (archive_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_props({ + obj_li: [archive_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'archive', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__archive({ - // obj_type: 'archive', - // obj_li: [archive_obj_get_result] - // }); - } - return archive_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__archive({ + // obj_type: 'archive', + // obj_li: [archive_obj_get_result] + // }); + } + return archive_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__archive_obj:', ae_promises.load__archive_obj); - } + if (log_lvl) { + console.log('ae_promises.load__archive_obj:', ae_promises.load__archive_obj); + } - if (inc_content_li) { - // Load the contents for the archive - if (log_lvl) { - console.log(`Need to load the content list for the archive now`); - } - const load_archive_content_obj_li = load_ae_obj_li__archive_content({ - api_cfg: api_cfg, - for_obj_type: 'archive', - for_obj_id: archive_id, - enabled: enabled, // all, disabled, enabled - hidden: hidden, // all, hidden, not_hidden - limit: limit, // Limit for the comments - offset: offset, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((archive_content_obj_li) => { - if (log_lvl) { - console.log(`archive_content_obj_li = `, archive_content_obj_li); - } - return archive_content_obj_li; - }); + if (inc_content_li) { + // Load the contents for the archive + if (log_lvl) { + console.log(`Need to load the content list for the archive now`); + } + const load_archive_content_obj_li = load_ae_obj_li__archive_content({ + api_cfg: api_cfg, + for_obj_type: 'archive', + for_obj_id: archive_id, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // Limit for the comments + offset: offset, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((archive_content_obj_li) => { + if (log_lvl) { + console.log(`archive_content_obj_li = `, archive_content_obj_li); + } + return archive_content_obj_li; + }); - if (log_lvl) { - console.log(`archive_content_obj_li = `, load_archive_content_obj_li); - } - ae_promises.load__archive_obj.archive_content_li = load_archive_content_obj_li; - } + if (log_lvl) { + console.log(`archive_content_obj_li = `, load_archive_content_obj_li); + } + ae_promises.load__archive_obj.archive_content_li = load_archive_content_obj_li; + } - return ae_promises.load__archive_obj; + return ae_promises.load__archive_obj; } // Updated 2024-11-20 export async function load_ae_obj_li__archive({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - inc_content_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + inc_content_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_content_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_content_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'archive', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (archive_obj_li_get_result) { - if (archive_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_props({ - obj_li: archive_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'archive', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__archive_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'archive', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (archive_obj_li_get_result) { + if (archive_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_props({ + obj_li: archive_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'archive', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__archive({ - // obj_type: 'archive', - // obj_li: archive_obj_li_get_result - // }); - } - return archive_obj_li_get_result; - } else { - return []; - } - }); + // db_save_ae_obj_li__archive({ + // obj_type: 'archive', + // obj_li: archive_obj_li_get_result + // }); + } + return archive_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__archive_obj_li:', ae_promises.load__archive_obj_li); - } + if (log_lvl) { + console.log('ae_promises.load__archive_obj_li:', ae_promises.load__archive_obj_li); + } - if (inc_content_li) { - // Load the contents for the archives - if (log_lvl) { - 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++) { - const archive_obj = ae_promises.load__archive_obj_li[i]; - const archive_id = archive_obj.archive_id_random; + if (inc_content_li) { + // Load the contents for the archives + if (log_lvl) { + 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++) { + const archive_obj = ae_promises.load__archive_obj_li[i]; + const archive_id = archive_obj.archive_id_random; - const load_archive_content_obj_li = load_ae_obj_li__archive_content({ - api_cfg: api_cfg, - for_obj_type: 'archive', - for_obj_id: archive_id, - enabled: enabled, // all, disabled, enabled - hidden: hidden, // all, hidden, not_hidden - limit: limit, // Limit for the comments - offset: offset, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((archive_content_obj_li) => { - if (log_lvl) { - console.log(`archive_content_obj_li = `, archive_content_obj_li); - } + const load_archive_content_obj_li = load_ae_obj_li__archive_content({ + api_cfg: api_cfg, + for_obj_type: 'archive', + for_obj_id: archive_id, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // Limit for the comments + offset: offset, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((archive_content_obj_li) => { + if (log_lvl) { + console.log(`archive_content_obj_li = `, archive_content_obj_li); + } - return archive_content_obj_li; - }); + return archive_content_obj_li; + }); - if (log_lvl) { - console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li); - } + if (log_lvl) { + console.log(`load_archive_content_obj_li = `, load_archive_content_obj_li); + } - if (load_archive_content_obj_li) { - ae_promises.load__archive_obj_li[i].archive_content_obj_li = load_archive_content_obj_li; - } - } - } + if (load_archive_content_obj_li) { + ae_promises.load__archive_obj_li[i].archive_content_obj_li = + load_archive_content_obj_li; + } + } + } - return ae_promises.load__archive_obj_li; + return ae_promises.load__archive_obj_li; } // Updated 2025-06-23 export async function create_ae_obj__archive({ - api_cfg, - account_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__archive() *** account_id=${account_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__archive() *** account_id=${account_id}`); + } - if (!account_id) { - console.log(`ERROR: Archives - Archive - account_id required to create`); - return false; - } + if (!account_id) { + console.log(`ERROR: Archives - Archive - account_id required to create`); + return false; + } - ae_promises.create__archive = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'archive', - fields: { - account_id_random: account_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (archive_obj_create_result) { - if (archive_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_props({ - obj_li: [archive_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'archive', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__archive = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'archive', + fields: { + account_id_random: account_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (archive_obj_create_result) { + if (archive_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_props({ + obj_li: [archive_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'archive', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__archive( - // { - // obj_type: 'archive', - // obj_li: [archive_obj_create_result] - // }); - } - return archive_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__archive( + // { + // obj_type: 'archive', + // obj_li: [archive_obj_create_result] + // }); + } + return archive_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.create__archive:', ae_promises.create__archive); - } - return ae_promises.create__archive; + if (log_lvl) { + console.log('ae_promises.create__archive:', ae_promises.create__archive); + } + return ae_promises.create__archive; } // Updated 2024-11-08 export async function delete_ae_obj_id__archive({ - api_cfg, - archive_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__archive() *** archive_id=${archive_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__archive() *** archive_id=${archive_id}`); + } - ae_promises.delete__archive_obj = await api - .delete_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'archive', - obj_id: archive_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for archive_id=${archive_id}`); - } - db_archives.content.delete(archive_id); // Delete from the DB no matter what. - } - }); + ae_promises.delete__archive_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'archive', + obj_id: archive_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log(`Attempting to remove IDB entry for archive_id=${archive_id}`); + } + db_archives.content.delete(archive_id); // Delete from the DB no matter what. + } + }); - if (log_lvl) { - console.log('ae_promises.delete__archive_obj:', ae_promises.delete__archive_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__archive_obj:', ae_promises.delete__archive_obj); + } - return ae_promises.delete__archive_obj; + return ae_promises.delete__archive_obj; } // Updated 2025-06-23 export async function update_ae_obj__archive({ - api_cfg, - archive_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** update_ae_obj__archive() *** archive_id=${archive_id}`, data_kv); - } + if (log_lvl) { + console.log(`*** update_ae_obj__archive() *** archive_id=${archive_id}`, data_kv); + } - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'archive', - obj_id: archive_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'archive', + obj_id: archive_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'archive', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'archive', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__archive({ - // obj_type: 'archive', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update archive.'); - return null; - } + // await db_save_ae_obj_li__archive({ + // obj_type: 'archive', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update archive.'); + return null; + } } // This new function is using CRUD v2. This should allow for more flexibility in the queries. // Updated 2024-09-25 export async function qry__archive({ - api_cfg, - archive_id, - qry_str, - qry_files, - qry_start_datetime, // Example greater than: '2024-10-24' - enabled = 'enabled', - hidden = 'not_hidden', - limit = 50, - offset = 0, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_id, + qry_str, + qry_files, + qry_start_datetime, // Example greater than: '2024-10-24' + enabled = 'enabled', + hidden = 'not_hidden', + limit = 50, + offset = 0, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_id: any; - qry_str?: string; - qry_files?: null | boolean; - qry_start_datetime?: null | string; // Greater than this datetime - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_id: any; + qry_str?: string; + qry_files?: null | boolean; + qry_start_datetime?: null | string; // Greater than this datetime + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + params?: any; + try_cache?: boolean; + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 25); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 25); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (qry_str && qry_str.length > 2) { - // params_json['ft_qry'] = {}; - // params_json['ft_qry']['default_qry_str'] = qry_str; - // } + // if (qry_str && qry_str.length > 2) { + // params_json['ft_qry'] = {}; + // params_json['ft_qry']['default_qry_str'] = qry_str; + // } - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_files === true) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: '>', - value: 0 - }; - params_json['qry'].push(qry_param); - } else if (qry_files === false) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: 'IS', - value: null - }; - params_json['qry'].push(qry_param); - } + if (qry_files === true) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: '>', + value: 0 + }; + params_json['qry'].push(qry_param); + } else if (qry_files === false) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: 'IS', + value: null + }; + params_json['qry'].push(qry_param); + } - if (qry_start_datetime) { - const qry_param = { - type: 'AND', - field: 'start_datetime', - operator: '>', - value: qry_start_datetime - }; - params_json['qry'].push(qry_param); - } + if (qry_start_datetime) { + const qry_param = { + type: 'AND', + field: 'start_datetime', + operator: '>', + value: qry_start_datetime + }; + params_json['qry'].push(qry_param); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'archive', - for_obj_type: 'event', - for_obj_id: archive_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for archive searching - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (archive_obj_li_get_result) { - if (archive_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_props({ - obj_li: archive_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'archive', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return archive_obj_li_get_result; - } else { - return []; - } - }); + ae_promises.load__archive_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'archive', + for_obj_type: 'event', + for_obj_id: archive_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for archive searching + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (archive_obj_li_get_result) { + if (archive_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_props({ + obj_li: archive_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'archive', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return archive_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__archive_obj_li:', ae_promises.load__archive_obj_li); - } - return ae_promises.load__archive_obj_li; + if (log_lvl) { + console.log('ae_promises.load__archive_obj_li:', ae_promises.load__archive_obj_li); + } + return ae_promises.load__archive_obj_li; } // // Updated 2024-09-25 @@ -749,51 +750,51 @@ export async function qry__archive({ // Updated 2025-06-04 export const properties_to_save = [ - 'id', - 'archive_id', - // 'archive_id_random', + 'id', + 'archive_id', + // 'archive_id_random', - 'code', + 'code', - 'account_id', - // 'account_id_random', + 'account_id', + // 'account_id_random', - 'name', - 'description', + 'name', + 'description', - 'original_datetime', - 'original_timezone', - 'original_location', + 'original_datetime', + 'original_timezone', + 'original_location', - 'original_url', - 'original_url_text', + 'original_url', + 'original_url_text', - 'sort_by', - 'sort_by_desc', + 'sort_by', + 'sort_by_desc', - 'cfg_json', + 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - // 'archive_content_count', + // From SQL view + // 'archive_content_count', - // A key value list of the contents - // 'archive_content_kv', - // 'archive_content_li', + // A key value list of the contents + // 'archive_content_kv', + // 'archive_content_li', ]; /** @@ -801,91 +802,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-06-04 export async function process_ae_obj__archive_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'archive', - log_lvl, - specific_processor: (obj) => { - // Archive-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'archive', + log_lvl, + specific_processor: (obj) => { + // Archive-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_archives/ae_archives__archive_content.ts b/src/lib/ae_archives/ae_archives__archive_content.ts index 7833120d..cad29de4 100644 --- a/src/lib/ae_archives/ae_archives__archive_content.ts +++ b/src/lib/ae_archives/ae_archives__archive_content.ts @@ -10,471 +10,471 @@ const ae_promises: key_val = {}; // Updated 2024-09-25 export async function load_ae_obj_id__archive_content({ - api_cfg, - archive_content_id, - // enabled = 'enabled', - // hidden = 'not_hidden', - // limit = 99, - // offset = 0, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_content_id, + // enabled = 'enabled', + // hidden = 'not_hidden', + // limit = 99, + // offset = 0, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_content_id: string; - // enabled?: "enabled" | "all" | "not_enabled" | undefined, - // hidden?: "hidden" | "all" | "not_hidden" | undefined, - // limit?: number, - // offset?: number, - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_content_id: string; + // enabled?: "enabled" | "all" | "not_enabled" | undefined, + // hidden?: "hidden" | "all" | "not_hidden" | undefined, + // limit?: number, + // offset?: number, + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}` - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'archive_content', - obj_id: archive_content_id, - use_alt_table: false, - use_alt_base: false, - params: params, - log_lvl: log_lvl - }) - .then(async function (archive_content_obj_get_result) { - if (archive_content_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_content_props({ - obj_li: [archive_content_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'content', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__archive_content_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'archive_content', + obj_id: archive_content_id, + use_alt_table: false, + use_alt_base: false, + params: params, + log_lvl: log_lvl + }) + .then(async function (archive_content_obj_get_result) { + if (archive_content_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_content_props({ + obj_li: [archive_content_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'content', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // await db_save_ae_obj_li__archive_content({ - // obj_type: 'archive_content', - // obj_li: [archive_content_obj_get_result] + // // This is expecting a list + // await db_save_ae_obj_li__archive_content({ + // obj_type: 'archive_content', + // obj_li: [archive_content_obj_get_result] - // }); - } - return archive_content_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // }); + } + return archive_content_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__archive_content_obj; + return ae_promises.load__archive_content_obj; } // Updated 2024-11-20 export async function load_ae_obj_li__archive_content({ - api_cfg, - for_obj_type = 'archive', - for_obj_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - original_datetime: 'ASC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'archive', + for_obj_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + original_datetime: 'ASC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'archive_content', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (archive_content_obj_li_get_result) { - if (archive_content_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_content_props({ - obj_li: archive_content_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'content', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__archive_content_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'archive_content', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (archive_content_obj_li_get_result) { + if (archive_content_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_content_props({ + obj_li: archive_content_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'content', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__archive_content({ - // obj_type: 'archive_content', obj_li: archive_content_obj_li_get_result - // }); - } - return archive_content_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // await db_save_ae_obj_li__archive_content({ + // obj_type: 'archive_content', obj_li: archive_content_obj_li_get_result + // }); + } + return archive_content_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log( - 'ae_promises.load__archive_content_obj_li:', - ae_promises.load__archive_content_obj_li - ); - } + if (log_lvl) { + 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 export async function create_ae_obj__archive_content({ - api_cfg, - archive_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`); + } - if (!archive_id) { - console.log(`ERROR: Archives - Content - archive_id required to create`); - return false; - } + if (!archive_id) { + console.log(`ERROR: Archives - Content - archive_id required to create`); + return false; + } - ae_promises.create__archive_content = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'archive_content', - fields: { - archive_id_random: archive_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (archive_content_obj_create_result) { - if (archive_content_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_content_props({ - obj_li: [archive_content_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'content', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__archive_content = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'archive_content', + fields: { + archive_id_random: archive_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (archive_content_obj_create_result) { + if (archive_content_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_content_props({ + obj_li: [archive_content_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'content', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__archive_content( - // { - // obj_type: 'archive_content', - // obj_li: [archive_content_obj_create_result] - // }); - } - return archive_content_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // await db_save_ae_obj_li__archive_content( + // { + // obj_type: 'archive_content', + // obj_li: [archive_content_obj_create_result] + // }); + } + return archive_content_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.create__archive_content:', ae_promises.create__archive_content); - } - return ae_promises.create__archive_content; + if (log_lvl) { + console.log('ae_promises.create__archive_content:', ae_promises.create__archive_content); + } + return ae_promises.create__archive_content; } // Updated 2024-11-08 export async function delete_ae_obj_id__archive_content({ - api_cfg, - archive_content_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_content_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_content_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_content_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** delete_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}` - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'archive_content', - obj_id: archive_content_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - 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. - } - }); + ae_promises.delete__archive_content_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'archive_content', + obj_id: archive_content_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + 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. + } + }); - if (log_lvl) { - console.log( - 'ae_promises.delete__archive_content_obj:', - ae_promises.delete__archive_content_obj - ); - } + if (log_lvl) { + 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 export async function update_ae_obj__archive_content({ - api_cfg, - archive_content_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + archive_content_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - archive_content_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + archive_content_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** update_ae_obj__archive_content() *** archive_content_id=${archive_content_id}`, - data_kv - ); - } + if (log_lvl) { + console.log( + `*** update_ae_obj__archive_content() *** archive_content_id=${archive_content_id}`, + data_kv + ); + } - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'archive_content', - obj_id: archive_content_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'archive_content', + obj_id: archive_content_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__archive_content_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_archives, - table_name: 'content', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__archive_content_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_archives, + table_name: 'content', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__archive_content({ - // obj_type: 'archive_content', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update archive content.'); - return null; - } + // await db_save_ae_obj_li__archive_content({ + // obj_type: 'archive_content', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update archive content.'); + return null; + } } // Updated 2025-06-04 export const properties_to_save = [ - 'id', - 'archive_content_id', - // 'archive_content_id_random', + 'id', + 'archive_content_id', + // 'archive_content_id_random', - 'archive_id', - // 'archive_id_random', + 'archive_id', + // 'archive_id_random', - 'archive_content_type', + 'archive_content_type', - 'name', - 'description', + 'name', + 'description', - 'content_html', - 'content_json', + 'content_html', + 'content_json', - 'url', - 'url_text', + 'url', + 'url_text', - 'hosted_file_id', - 'hosted_file_id_random', + 'hosted_file_id', + 'hosted_file_id_random', - 'file_path', + 'file_path', - 'filename', - 'file_extension', + 'filename', + 'file_extension', - 'original_datetime', - 'original_timezone', - 'original_location', - 'original_url', - 'original_url_text', + 'original_datetime', + 'original_timezone', + 'original_location', + 'original_url', + 'original_url_text', - 'enable_for_public', + 'enable_for_public', - 'cfg_json', + 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'archive_code', - 'archive_name', + // From SQL view + 'archive_code', + 'archive_name', - 'hash_sha256' + 'hash_sha256' ]; /** @@ -482,96 +482,96 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-06-04 export async function process_ae_obj__archive_content_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'archive_content', - log_lvl, - specific_processor: (obj) => { - // Archive content-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.original_datetime ?? ''}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.original_datetime ?? ''}_${ - obj.priority ? '1' : '0' - }_${obj.sort?.toString().padStart(3, '0') ?? ''}`; - obj.tmp_sort_3 = `${obj.original_datetime ?? ''}_${obj.group ?? ''}_${ - obj.priority ? '1' : '0' - }_${obj.sort?.toString().padStart(3, '0') ?? ''}`; + return _process_generic_props({ + obj_li, + obj_type: 'archive_content', + log_lvl, + specific_processor: (obj) => { + // Archive content-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.original_datetime ?? ''}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.original_datetime ?? ''}_${ + obj.priority ? '1' : '0' + }_${obj.sort?.toString().padStart(3, '0') ?? ''}`; + obj.tmp_sort_3 = `${obj.original_datetime ?? ''}_${obj.group ?? ''}_${ + 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; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_archives/ae_archives_functions.ts b/src/lib/ae_archives/ae_archives_functions.ts index cc963426..b472088c 100644 --- a/src/lib/ae_archives/ae_archives_functions.ts +++ b/src/lib/ae_archives/ae_archives_functions.ts @@ -1,32 +1,32 @@ // This file is used to export all the functions that are used for Aether Posts related functions. import { - load_ae_obj_id__archive, - load_ae_obj_li__archive, - create_ae_obj__archive, - delete_ae_obj_id__archive, - update_ae_obj__archive + load_ae_obj_id__archive, + load_ae_obj_li__archive, + create_ae_obj__archive, + delete_ae_obj_id__archive, + update_ae_obj__archive } from '$lib/ae_archives/ae_archives__archive'; import { - load_ae_obj_id__archive_content, - load_ae_obj_li__archive_content, - create_ae_obj__archive_content, - delete_ae_obj_id__archive_content, - update_ae_obj__archive_content + load_ae_obj_id__archive_content, + load_ae_obj_li__archive_content, + create_ae_obj__archive_content, + delete_ae_obj_id__archive_content, + update_ae_obj__archive_content } from '$lib/ae_archives/ae_archives__archive_content'; const export_obj = { - load_ae_obj_id__archive: load_ae_obj_id__archive, - 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, + load_ae_obj_id__archive: load_ae_obj_id__archive, + 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, - 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 + 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 }; export const archives_func = export_obj; diff --git a/src/lib/ae_archives/db_archives.ts b/src/lib/ae_archives/db_archives.ts index e324c77a..f6b9037f 100644 --- a/src/lib/ae_archives/db_archives.ts +++ b/src/lib/ae_archives/db_archives.ts @@ -7,135 +7,135 @@ import type { key_val } from '$lib/stores/ae_stores'; // Updated 2024-09-25 export interface Archive { - id: string; - // id_random: string; - archive_id: string; - // archive_id_random: string; + id: string; + // id_random: string; + archive_id: string; + // archive_id_random: string; - code?: null | string; + code?: null | string; - account_id: string; - // account_id_random: string; + account_id: string; + // account_id_random: string; - // archive_type: string; + // archive_type: string; - // type: string; - name: string; - // summary?: null|string; - description?: null | string; + // type: string; + name: string; + // summary?: null|string; + description?: null | string; - content_html?: null | string; - content_json?: null | string; - content_url?: null | string; - content_url_text?: null | string; + content_html?: null | string; + content_json?: null | string; + content_url?: null | string; + content_url_text?: null | string; - original_datetime?: Date; - original_timezone?: null | string; - original_location?: null | string; + original_datetime?: Date; + original_timezone?: null | string; + original_location?: null | string; - original_url?: null | string; - original_url_text?: null | string; + original_url?: null | string; + original_url_text?: null | string; - // meta_data?: null|string; - // access_key?: null|string; /// Rename this to "passcode" if used later + // meta_data?: null|string; + // access_key?: null|string; /// Rename this to "passcode" if used later - sort_by?: null | string; - sort_by_desc?: null | string; + sort_by?: null | string; + sort_by_desc?: null | string; - cfg_json?: null | key_val; + cfg_json?: null | key_val; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - // archive_content_count?: number; - // archive_content_kv?: null|key_val; - // archive_content_li?: null|[]; + // Additional fields for convenience (database views) + // archive_content_count?: number; + // archive_content_kv?: null|key_val; + // archive_content_li?: null|[]; } // Updated 2024-09-25 export interface Archive_Content { - id: string; - // id_random: string; - archive_content_id: string; - // archive_content_id_random: string; + id: string; + // id_random: string; + archive_content_id: string; + // archive_content_id_random: string; - archive_id: string; - // archive_id_random: string; + archive_id: string; + // archive_id_random: string; - archive_content_type: string; + archive_content_type: string; - name: string; - description?: null | string; + name: string; + description?: null | string; - content_html?: null | string; - content_json?: null | string; + content_html?: null | string; + content_json?: null | string; - // linked_li_json?: null|string; // For future use? linked content list instead of one content item + // linked_li_json?: null|string; // For future use? linked content list instead of one content item - url?: null | string; - url_text?: null | string; + url?: null | string; + url_text?: null | string; - hosted_file_id?: string; + hosted_file_id?: string; - file_path?: null | string; + file_path?: null | string; - filename?: null | string; - file_extension?: null | string; + filename?: null | string; + file_extension?: null | string; - original_datetime?: Date; - original_timezone?: null | string; - original_location?: null | string; - original_url?: null | string; - original_url_text?: null | string; + original_datetime?: Date; + original_timezone?: null | string; + original_location?: null | string; + original_url?: null | string; + original_url_text?: null | string; - // meta_data?: null|string; - // access_key?: null|string; /// Rename this to "passcode" if used later + // meta_data?: null|string; + // access_key?: null|string; /// Rename this to "passcode" if used later - enable_for_public?: boolean; + enable_for_public?: boolean; - cfg_json?: null | key_val; + cfg_json?: null | key_val; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - archive_code?: null | string; - archive_name?: null | string; + // Additional fields for convenience (database views) + archive_code?: null | string; + archive_name?: null | string; - hash_sha256?: null | string; + hash_sha256?: null | string; } // Updated 2024-09-25 export class MySubClassedDexie extends Dexie { - // We just tell the typing system this is the case - archive!: Table; - content!: Table; + // We just tell the typing system this is the case + archive!: Table; + content!: Table; - constructor() { - super('ae_archives_db'); - this.version(1).stores({ - archive: ` + constructor() { + super('ae_archives_db'); + this.version(1).stores({ + archive: ` id, archive_id, code, account_id, @@ -143,7 +143,7 @@ export class MySubClassedDexie extends Dexie { original_datetime, original_timezone, original_location, tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on`, - content: ` + content: ` id, archive_content_id, archive_id, archive_content_type, @@ -153,13 +153,13 @@ export class MySubClassedDexie extends Dexie { [group+original_datetime], tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]` - }); + }); - // file_path, - // filename, file_extension, - // original_datetime, original_timezone, original_location, original_url, original_url_text, - // enable_for_public, - } + // file_path, + // filename, file_extension, + // original_datetime, original_timezone, original_location, original_url, original_url_text, + // enable_for_public, + } } export const db_archives = new MySubClassedDexie(); diff --git a/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte b/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte index ef295827..b39e4605 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte @@ -1,387 +1,418 @@
- -

- {Object.entries(hosted_file_obj_kv).length}× files uploaded -

+

+ {Object.entries(hosted_file_obj_kv).length}× files uploaded +

- {#each Object.entries(hosted_file_obj_kv) as [hosted_file_id, hosted_file_obj]} -
- -
- - +
+ + - - - {ae_util.shorten_filename({ filename: hosted_file_obj?.filename, max_length: 30 })} - - File ID: - {hosted_file_obj.hosted_file_id_random} - - Type: - {hosted_file_obj.extension} - -
+ + {ae_util.shorten_filename({ + filename: hosted_file_obj?.filename, + max_length: 30 + })} + + + {ae_util.shorten_filename({ + filename: hosted_file_obj?.filename, + max_length: 30 + })} + + File ID: + {hosted_file_obj.hosted_file_id_random} + + Type: + {hosted_file_obj.extension} + +
-
- + + - + -
- New Filename: - -
+
+ New Filename: + +
-
- +
+ - + - - Re-encode? - - - + + Re-encode? + + + - - Scale down? - - - -
+ + Scale down? + + + +
- -
+ + - {#await ae_promises[hosted_file_id]} - - Processing... This may take a few minutes. - {:then} - {#if ae_promises[hosted_file_id]} - Ready to download below! - {:else} - - {/if} - {/await} -
- {/each} + {#await ae_promises[hosted_file_id]} + + Processing... This may take a few minutes. + {:then} + {#if ae_promises[hosted_file_id]} + Ready to download below! + {:else} + + {/if} + {/await} + + {/each} - -
- - + + + + - + - {#await ae_promises.upload__hosted_file_obj} -
- - - Uploading - {#if $ae_sess.api_upload_kv[task_id]} - {$ae_sess.api_upload_kv[task_id].percent_completed}% - {/if} - -
- {/await} + {#await ae_promises.upload__hosted_file_obj} +
+ + + Uploading + {#if $ae_sess.api_upload_kv[task_id]} + {$ae_sess.api_upload_kv[task_id].percent_completed}% + {/if} + +
+ {/await} - + - + - + - - + {$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} + No files selected + {/if} + + + {/await} + + -
+
- {#await ae_promises.upload__hosted_file_obj} - -

Converting... This may take a few minutes.

- {:then} - {#if ae_promises.upload__hosted_file_obj} - Ready to Download - {:else} -

Fill out the form and select the video file to clip.

- {/if} - {/await} + {#await ae_promises.upload__hosted_file_obj} + +

Converting... This may take a few minutes.

+ {:then} + {#if ae_promises.upload__hosted_file_obj} + Ready to Download + {:else} +

Fill out the form and select the video file to clip.

+ {/if} + {/await} diff --git a/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte b/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte index 4e79c016..fce2907d 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_download_button.svelte @@ -1,153 +1,156 @@ {#if hosted_file_id && hosted_file_obj} - + + {ae_util.shorten_filename({ + filename: filename ?? hosted_file_obj?.filename, + max_length: max_length + })} + + {:else} - + {/if} diff --git a/src/lib/ae_core/ae_comp__hosted_files_upload.svelte b/src/lib/ae_core/ae_comp__hosted_files_upload.svelte index 053f482c..2864928d 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_upload.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_upload.svelte @@ -1,281 +1,281 @@
- {#await ae_promises.upload__hosted_file_obj} -
- - - Uploading - {#if $ae_sess.api_upload_kv[task_id]} - {$ae_sess.api_upload_kv[task_id].percent_completed}% - {/if} - -
- {/await} + {#await ae_promises.upload__hosted_file_obj} +
+ + + Uploading + {#if $ae_sess.api_upload_kv[task_id]} + {$ae_sess.api_upload_kv[task_id].percent_completed}% + {/if} + +
+ {/await} - + - + class:hidden={$ae_sess.files.disable_submit__hosted_file_obj} + /> - + - + {$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} + No files selected + {/if} + + + {/await} + diff --git a/src/lib/ae_core/ae_core_functions.ts b/src/lib/ae_core/ae_core_functions.ts index 1585f0b0..eb3763b3 100644 --- a/src/lib/ae_core/ae_core_functions.ts +++ b/src/lib/ae_core/ae_core_functions.ts @@ -3,33 +3,33 @@ import type { key_val } from '$lib/stores/ae_stores'; import { api } from '$lib/api/api'; import { - load_ae_obj_id__activity_log, - load_ae_obj_li__activity_log, - create_ae_obj__activity_log, - update_ae_obj__activity_log - // db_save_ae_obj_li__activity_log + load_ae_obj_id__activity_log, + load_ae_obj_li__activity_log, + create_ae_obj__activity_log, + update_ae_obj__activity_log + // db_save_ae_obj_li__activity_log } from '$lib/ae_core/core__activity_log'; import { - load_ae_obj_id__person, - load_ae_obj_li__person, - create_ae_obj__person, - delete_ae_obj_id__person, - update_ae_obj__person - // db_save_ae_obj_li__person + load_ae_obj_id__person, + load_ae_obj_li__person, + create_ae_obj__person, + delete_ae_obj_id__person, + update_ae_obj__person + // db_save_ae_obj_li__person } from '$lib/ae_core/core__person'; import { - auth_ae_obj__username_password, - auth_ae_obj__user_id_user_auth_key, - send_email_auth_ae_obj__user_id, - qry_ae_obj_li__user_email, - auth_ae_obj__user_id_change_password - // handle_load_ae_obj_id__user, - // handle_load_ae_obj_li__user, - // handle_create_ae_obj__user, - // handle_update_ae_obj__user, - // handle_db_save_ae_obj_li__user + auth_ae_obj__username_password, + auth_ae_obj__user_id_user_auth_key, + send_email_auth_ae_obj__user_id, + qry_ae_obj_li__user_email, + auth_ae_obj__user_id_change_password + // handle_load_ae_obj_id__user, + // handle_load_ae_obj_li__user, + // handle_create_ae_obj__user, + // handle_update_ae_obj__user, + // handle_db_save_ae_obj_li__user } from '$lib/ae_core/core__user'; import { generate_qr_code, js_generate_qr_code } from '$lib/ae_core/core__qr_code'; @@ -43,11 +43,11 @@ import { load_ae_obj_li__country } from '$lib/ae_core/core__countries'; import { load_ae_obj_li__country_subdivision } from '$lib/ae_core/core__country_subdivisions'; import { - load_ae_obj_id__hosted_file, - load_ae_obj_li__hosted_file, - delete_ae_obj_id__hosted_file, - db_save_ae_obj_li__hosted_file, - db_update_ae_obj_id__hosted_file + load_ae_obj_id__hosted_file, + load_ae_obj_li__hosted_file, + delete_ae_obj_id__hosted_file, + db_save_ae_obj_li__hosted_file, + db_update_ae_obj_id__hosted_file } from '$lib/ae_core/core__hosted_files'; // This has more generic general purpose functions that can eventually replace the custom ones per object type. @@ -59,280 +59,285 @@ const ae_promises: key_val = {}; // Promise; // Updated 2024-03-29 async function load_ae_obj_id__site_domain({ - api_cfg, - fqdn, - try_cache = false, - timeout = 7000, - log_lvl = 0 + api_cfg, + fqdn, + try_cache = false, + timeout = 7000, + log_lvl = 0 }: { - api_cfg: any; - fqdn: string; - try_cache?: boolean; - timeout?: number; - log_lvl?: number; + api_cfg: any; + fqdn: string; + try_cache?: boolean; + timeout?: number; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_id__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_id__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}` + ); + } - let no_account_id = false; - if (!api_cfg.account_id) { - no_account_id = true; - // api_cfg.headers['x_account_id'] = 'nothing here'; - } - no_account_id = true; + let no_account_id = false; + if (!api_cfg.account_id) { + no_account_id = true; + // api_cfg.headers['x_account_id'] = 'nothing here'; + } + no_account_id = true; - const params = {}; + const params = {}; - // ae_sess.hub.site_domain_id_qry_status = 'loading'; - ae_promises.load__site_domain_obj = api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - no_account_id: no_account_id, - obj_type: 'site_domain', - obj_id: fqdn, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value (v_site_domain_fqdn_id) instead of the table_name value in the API config. - use_alt_base: true, // NOTE: This will use the base_name_alt value (Site_Domain_FQDN_ID_Base) instead of the base_name value in the API config. - params: params, - timeout: timeout, - log_lvl: log_lvl - }) - .then(function (site_domain_obj_get_result) { - if (site_domain_obj_get_result) { - // slct.site_domain_obj = site_domain_obj_get_result; - // console.log(`site_domain object:`, get(slct).site_domain_obj); + // ae_sess.hub.site_domain_id_qry_status = 'loading'; + ae_promises.load__site_domain_obj = api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + no_account_id: no_account_id, + obj_type: 'site_domain', + obj_id: fqdn, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value (v_site_domain_fqdn_id) instead of the table_name value in the API config. + use_alt_base: true, // NOTE: This will use the base_name_alt value (Site_Domain_FQDN_ID_Base) instead of the base_name value in the API config. + params: params, + timeout: timeout, + log_lvl: log_lvl + }) + .then(function (site_domain_obj_get_result) { + if (site_domain_obj_get_result) { + // slct.site_domain_obj = site_domain_obj_get_result; + // console.log(`site_domain object:`, get(slct).site_domain_obj); - // ae_loc.account_id = $slct.site_domain_obj.account_id_random; - // ae_loc.site_id = $slct.site_domain_obj.site_id_random; - // ae_loc.site_domain_id = $slct.site_domain_obj.site_domain_id_random; - return site_domain_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // ae_loc.account_id = $slct.site_domain_obj.account_id_random; + // ae_loc.site_id = $slct.site_domain_obj.site_id_random; + // ae_loc.site_domain_id = $slct.site_domain_obj.site_domain_id_random; + return site_domain_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__site_domain_obj; + return ae_promises.load__site_domain_obj; } // Updated 2024-03-29 async function load_ae_obj_code__data_store({ - api_cfg, - code, - data_type = 'text', - for_type = null, - for_id = null, - try_cache = true, - save_idb = false, - timeout = 9000, - log_lvl = 0 + api_cfg, + code, + data_type = 'text', + for_type = null, + for_id = null, + try_cache = true, + save_idb = false, + timeout = 9000, + log_lvl = 0 }: { - api_cfg: any; - code: string; - data_type?: string; - for_type?: string | null; - for_id?: string | null; - try_cache?: boolean; - save_idb?: boolean; - timeout?: number; - log_lvl?: number; + api_cfg: any; + code: string; + data_type?: string; + for_type?: string | null; + for_id?: string | null; + try_cache?: boolean; + save_idb?: boolean; + timeout?: number; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_code__data_store() *** code=${code}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_code__data_store() *** code=${code}`); + } - if (!code) { - console.log(`*ae_func* No code provided!`); - return false; - } + if (!code) { + console.log(`*ae_func* No code provided!`); + return false; + } - if (!api_cfg.account_id) { - console.log(`*ae_func* No account_id found in API config!`); - return false; - } + if (!api_cfg.account_id) { + console.log(`*ae_func* No account_id found in API config!`); + return false; + } - ae_promises.load__data_store_obj = api - .get_data_store_obj_w_code({ - api_cfg: api_cfg, - data_store_code: code, - data_type: data_type, - timeout: timeout, - log_lvl: log_lvl - }) - .then(function (get_ds_result) { - let return_this = null; - if (get_ds_result) { - if (log_lvl) { - console.log(`*ae_func* Got a result for code ${code}`); - } + ae_promises.load__data_store_obj = api + .get_data_store_obj_w_code({ + api_cfg: api_cfg, + data_store_code: code, + data_type: data_type, + timeout: timeout, + log_lvl: log_lvl + }) + .then(function (get_ds_result) { + let return_this = null; + if (get_ds_result) { + if (log_lvl) { + console.log(`*ae_func* Got a result for code ${code}`); + } - if (!get_ds_result.data_store_id_random) { - console.log('*ae_func* Something went wrong? No data store ID found.'); - return false; - } + if (!get_ds_result.data_store_id_random) { + console.log('*ae_func* Something went wrong? No data store ID found.'); + return false; + } - // let ae_ds_tmp: key_val = {}; - const ds_code_obj = { - id: null, - account_id: null, - code: code, - name: null, - type: data_type, - for_type: null, // for_type - for_id: null, // for_id - access_read: null, // 'super', 'administrator', 'trusted', 'anonymous' - access_write: null, // 'super', 'administrator', 'trusted', 'anonymous' - access_delete: null, // 'super', 'administrator', 'trusted', 'anonymous' - html: null, - json: null, - md: null, - text: null, - updated_on: null, - chk_account_id: api_cfg.account_id, - loaded_on: new Date().toISOString() - }; - let val_json: key_val; - let val_html: key_val; - let val_md: key_val; - let val_sql: key_val; - let val_text: string; + // let ae_ds_tmp: key_val = {}; + const ds_code_obj = { + id: null, + account_id: null, + code: code, + name: null, + type: data_type, + for_type: null, // for_type + for_id: null, // for_id + access_read: null, // 'super', 'administrator', 'trusted', 'anonymous' + access_write: null, // 'super', 'administrator', 'trusted', 'anonymous' + access_delete: null, // 'super', 'administrator', 'trusted', 'anonymous' + html: null, + json: null, + md: null, + text: null, + updated_on: null, + chk_account_id: api_cfg.account_id, + loaded_on: new Date().toISOString() + }; + let val_json: key_val; + let val_html: key_val; + let val_md: key_val; + let val_sql: key_val; + let val_text: string; - // Set the loaded_on datetime to the current time for reference later. This will be used to determine if the data store is stale. - // ds_code_obj.loaded_on = new Date().toISOString(); - // Set the chk_account_id as a backup check to make sure the data store belongs to the account for the current site. This should not be needed, but here we are... - // ds_code_obj.chk_account_id = api_cfg.account_id; + // Set the loaded_on datetime to the current time for reference later. This will be used to determine if the data store is stale. + // ds_code_obj.loaded_on = new Date().toISOString(); + // Set the chk_account_id as a backup check to make sure the data store belongs to the account for the current site. This should not be needed, but here we are... + // ds_code_obj.chk_account_id = api_cfg.account_id; - ds_code_obj.id = get_ds_result.data_store_id_random; - ds_code_obj.account_id = get_ds_result.account_id_random; - ds_code_obj.code = get_ds_result.code; // This will overwrite whatever was passed in. - ds_code_obj.name = get_ds_result.name; - ds_code_obj.type = get_ds_result.type; // This will overwrite whatever was passed in. - if (data_type == 'html') { - ds_code_obj.html = get_ds_result.text; - val_html = get_ds_result.text; - return_this = get_ds_result.html; - } else if (data_type == 'json') { - ds_code_obj.json = get_ds_result.json; - val_json = get_ds_result.json; - return_this = get_ds_result.json; - } else if (data_type == 'md') { - ds_code_obj.text = get_ds_result.text; - val_md = get_ds_result.text; - return_this = get_ds_result.text; - } else if (data_type == 'sql') { - ds_code_obj.text = get_ds_result.text; - val_sql = get_ds_result.text; - return_this = get_ds_result.text; - } else { - ds_code_obj.text = get_ds_result.text; - val_text = get_ds_result.text; - return_this = get_ds_result.text; - } + ds_code_obj.id = get_ds_result.data_store_id_random; + ds_code_obj.account_id = get_ds_result.account_id_random; + ds_code_obj.code = get_ds_result.code; // This will overwrite whatever was passed in. + ds_code_obj.name = get_ds_result.name; + ds_code_obj.type = get_ds_result.type; // This will overwrite whatever was passed in. + if (data_type == 'html') { + ds_code_obj.html = get_ds_result.text; + val_html = get_ds_result.text; + return_this = get_ds_result.html; + } else if (data_type == 'json') { + ds_code_obj.json = get_ds_result.json; + val_json = get_ds_result.json; + return_this = get_ds_result.json; + } else if (data_type == 'md') { + ds_code_obj.text = get_ds_result.text; + val_md = get_ds_result.text; + return_this = get_ds_result.text; + } else if (data_type == 'sql') { + ds_code_obj.text = get_ds_result.text; + val_sql = get_ds_result.text; + return_this = get_ds_result.text; + } else { + ds_code_obj.text = get_ds_result.text; + val_text = get_ds_result.text; + return_this = get_ds_result.text; + } - // if (data_type == 'text') { - // // console.log(get_ds_result.text); - // return_this = get_ds_result.text; - // } else if (data_type == 'json') { - // // console.log(get_ds_result.json); - // return_this = get_ds_result.json; - // } + // if (data_type == 'text') { + // // console.log(get_ds_result.text); + // return_this = get_ds_result.text; + // } else if (data_type == 'json') { + // // console.log(get_ds_result.json); + // return_this = get_ds_result.json; + // } - if (save_idb) { - if (browser) { - const key_prefix = 'ae_ds__'; - if (log_lvl) { - console.log(`*ae_func* localStorage key: ${code}, value:`, get_ds_result); - } - localStorage.setItem(`${key_prefix}${code}`, JSON.stringify(get_ds_result)); - } else { - if (log_lvl) { - console.log( - '*ae_func* No browser! Can not use localStorage to save data store object.' - ); - } - } - } - } else { - console.log('*ae_func* No results returned.'); - return_this = null; - } - return return_this; - }) - .catch(function (error: any) { - console.log('*ae_func* No results returned or failed.', error); - }); + if (save_idb) { + if (browser) { + const key_prefix = 'ae_ds__'; + if (log_lvl) { + console.log( + `*ae_func* localStorage key: ${code}, value:`, + get_ds_result + ); + } + localStorage.setItem(`${key_prefix}${code}`, JSON.stringify(get_ds_result)); + } else { + if (log_lvl) { + console.log( + '*ae_func* No browser! Can not use localStorage to save data store object.' + ); + } + } + } + } else { + console.log('*ae_func* No results returned.'); + return_this = null; + } + return return_this; + }) + .catch(function (error: any) { + console.log('*ae_func* No results returned or failed.', error); + }); - return ae_promises.load__data_store_obj; + return ae_promises.load__data_store_obj; } // Updated 2024-03-27 async function update_ae_obj_id_crud({ - api_cfg, - object_type, - object_id, - object_reload = false, - field_name, - new_field_value, - params = {}, - try_cache = false, - log_lvl = 0 + api_cfg, + object_type, + object_id, + object_reload = false, + field_name, + new_field_value, + params = {}, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - object_type: string; - object_id: string; - object_reload?: boolean; - field_name: string; - new_field_value: any; - params: any | key_val; - try_cache: boolean; - log_lvl: number; + api_cfg: any; + object_type: string; + object_id: string; + object_reload?: boolean; + field_name: string; + new_field_value: any; + params: any | key_val; + try_cache: boolean; + 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({ - api_cfg: api_cfg, - obj_type: object_type, - obj_id: object_id, - field_name: field_name, - field_value: new_field_value, - // fields: data, - key: api_cfg.api_crud_super_key, - // jwt: null, - // params: params, - // data: patch_data, - log_lvl: log_lvl - }) - .then(function (results) { - console.log('PATCH Promise', results); + ae_promises.api_update__ae_obj = api + .update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: object_type, + obj_id: object_id, + field_name: field_name, + field_value: new_field_value, + // fields: data, + key: api_cfg.api_crud_super_key, + // jwt: null, + // params: params, + // data: patch_data, + log_lvl: log_lvl + }) + .then(function (results) { + console.log('PATCH Promise', results); - if (results) { - console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}`); - patch_result = 'PATCH complete'; - } else { - 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'; - return false; - } - return true; - }) - .catch(function (error: any) { - console.log('Something went wrong patching the record.'); - console.log(error); - return false; - }) - .finally(function () { - console.log('PATCH Promise finally'); - }); + if (results) { + console.log( + `Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}` + ); + patch_result = 'PATCH complete'; + } else { + 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'; + return false; + } + return true; + }) + .catch(function (error: any) { + console.log('Something went wrong patching the record.'); + console.log(error); + return false; + }) + .finally(function () { + console.log('PATCH Promise finally'); + }); - return ae_promises.api_update__ae_obj; + return ae_promises.api_update__ae_obj; } // Core - Already imported above @@ -361,320 +366,322 @@ import { load_ae_obj_id__post_comment } from '$lib/ae_posts/ae_posts__post_comme // Updated 2025-09-30 async function update_ae_obj_id_crud_v2({ - api_cfg, - object_type, - object_id, - object_reload = false, - field_name, - new_field_value, - params = {}, - try_cache = false, - log_lvl = 0 + api_cfg, + object_type, + object_id, + object_reload = false, + field_name, + new_field_value, + params = {}, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - object_type: string; - object_id: string; - object_reload?: boolean; - field_name: string; - new_field_value: any; - params?: any | key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + object_type: string; + object_id: string; + object_reload?: boolean; + field_name: string; + new_field_value: any; + params?: any | key_val; + try_cache?: boolean; + log_lvl?: number; }) { - 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 - ); - } - let patch_result: any = null; + 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 + ); + } + let patch_result: any = null; - ae_promises.api_update__ae_obj = await api - .update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: object_type, - obj_id: object_id, - field_name: field_name, - field_value: new_field_value, - // fields: data, - key: api_cfg.api_crud_super_key, - // jwt: null, - // params: params, - // data: patch_data, - log_lvl: log_lvl - }) - .then(function (results) { - console.log('PATCH Promise', results); + ae_promises.api_update__ae_obj = await api + .update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: object_type, + obj_id: object_id, + field_name: field_name, + field_value: new_field_value, + // fields: data, + key: api_cfg.api_crud_super_key, + // jwt: null, + // params: params, + // data: patch_data, + log_lvl: log_lvl + }) + .then(function (results) { + console.log('PATCH Promise', results); - if (results) { - console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}`); - patch_result = 'PATCH complete'; + if (results) { + console.log( + `Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}` + ); + patch_result = 'PATCH complete'; - if (object_reload) { - if (log_lvl) { - console.log(`Reloading the object after patching...`); - } - // Reload the object to get the latest data. There is a special case for each type. - if (object_type == 'person') { - const load_person_obj = load_ae_obj_id__person({ - api_cfg: api_cfg, - person_id: object_id, - log_lvl: log_lvl - }); - return load_person_obj; - } - // if (object_type == 'user') { - // let load_user_obj = load_ae_obj_id__user({ - // api_cfg: api_cfg, - // user_id: object_id, - // log_lvl: log_lvl - // }); - // return load_user_obj; - // } + if (object_reload) { + if (log_lvl) { + console.log(`Reloading the object after patching...`); + } + // Reload the object to get the latest data. There is a special case for each type. + if (object_type == 'person') { + const load_person_obj = load_ae_obj_id__person({ + api_cfg: api_cfg, + person_id: object_id, + log_lvl: log_lvl + }); + return load_person_obj; + } + // if (object_type == 'user') { + // let load_user_obj = load_ae_obj_id__user({ + // api_cfg: api_cfg, + // user_id: object_id, + // log_lvl: log_lvl + // }); + // return load_user_obj; + // } - if (object_type == 'archive') { - const load_archive_obj = load_ae_obj_id__archive({ - api_cfg: api_cfg, - archive_id: object_id, - log_lvl: log_lvl - }); - return load_archive_obj; - } - if (object_type == 'archive_content') { - const load_archive_content_obj = load_ae_obj_id__archive_content({ - api_cfg: api_cfg, - archive_content_id: object_id, - log_lvl: log_lvl - }); - return load_archive_content_obj; - } + if (object_type == 'archive') { + const load_archive_obj = load_ae_obj_id__archive({ + api_cfg: api_cfg, + archive_id: object_id, + log_lvl: log_lvl + }); + return load_archive_obj; + } + if (object_type == 'archive_content') { + const load_archive_content_obj = load_ae_obj_id__archive_content({ + api_cfg: api_cfg, + archive_content_id: object_id, + log_lvl: log_lvl + }); + return load_archive_content_obj; + } - if (object_type == 'journal') { - const load_journal_obj = load_ae_obj_id__journal({ - api_cfg: api_cfg, - journal_id: object_id, - log_lvl: log_lvl - }); - return load_journal_obj; - } - if (object_type == 'journal_entry') { - const load_journal_entry_obj = load_ae_obj_id__journal_entry({ - api_cfg: api_cfg, - journal_entry_id: object_id, - log_lvl: log_lvl - }); - return load_journal_entry_obj; - } + if (object_type == 'journal') { + const load_journal_obj = load_ae_obj_id__journal({ + api_cfg: api_cfg, + journal_id: object_id, + log_lvl: log_lvl + }); + return load_journal_obj; + } + if (object_type == 'journal_entry') { + const load_journal_entry_obj = load_ae_obj_id__journal_entry({ + api_cfg: api_cfg, + journal_entry_id: object_id, + log_lvl: log_lvl + }); + return load_journal_entry_obj; + } - if (object_type == 'event') { - const load_event_obj = load_ae_obj_id__event({ - api_cfg: api_cfg, - event_id: object_id, - log_lvl: log_lvl - }); - return load_event_obj; - } - if (object_type == 'event_device') { - const load_event_device_obj = load_ae_obj_id__event_device({ - api_cfg: api_cfg, - event_device_id: object_id, - log_lvl: log_lvl - }); - return load_event_device_obj; - } - if (object_type == 'event_file') { - const load_event_file_obj = load_ae_obj_id__event_file({ - api_cfg: api_cfg, - event_file_id: object_id, - log_lvl: log_lvl - }); - return load_event_file_obj; - } - if (object_type == 'event_location') { - const load_event_location_obj = load_ae_obj_id__event_location({ - api_cfg: api_cfg, - event_location_id: object_id, - log_lvl: log_lvl - }); - return load_event_location_obj; - } - if (object_type == 'event_presentation') { - const load_event_presentation_obj = load_ae_obj_id__event_presentation({ - api_cfg: api_cfg, - event_presentation_id: object_id, - log_lvl: log_lvl - }); - return load_event_presentation_obj; - } - if (object_type == 'event_presenter') { - const load_event_presenter_obj = load_ae_obj_id__event_presenter({ - api_cfg: api_cfg, - event_presenter_id: object_id, - log_lvl: log_lvl - }); - return load_event_presenter_obj; - } - if (object_type == 'event_session') { - const load_event_session_obj = load_ae_obj_id__event_session({ - api_cfg: api_cfg, - event_session_id: object_id, - log_lvl: log_lvl - }); - return load_event_session_obj; - } + if (object_type == 'event') { + const load_event_obj = load_ae_obj_id__event({ + api_cfg: api_cfg, + event_id: object_id, + log_lvl: log_lvl + }); + return load_event_obj; + } + if (object_type == 'event_device') { + const load_event_device_obj = load_ae_obj_id__event_device({ + api_cfg: api_cfg, + event_device_id: object_id, + log_lvl: log_lvl + }); + return load_event_device_obj; + } + if (object_type == 'event_file') { + const load_event_file_obj = load_ae_obj_id__event_file({ + api_cfg: api_cfg, + event_file_id: object_id, + log_lvl: log_lvl + }); + return load_event_file_obj; + } + if (object_type == 'event_location') { + const load_event_location_obj = load_ae_obj_id__event_location({ + api_cfg: api_cfg, + event_location_id: object_id, + log_lvl: log_lvl + }); + return load_event_location_obj; + } + if (object_type == 'event_presentation') { + const load_event_presentation_obj = load_ae_obj_id__event_presentation({ + api_cfg: api_cfg, + event_presentation_id: object_id, + log_lvl: log_lvl + }); + return load_event_presentation_obj; + } + if (object_type == 'event_presenter') { + const load_event_presenter_obj = load_ae_obj_id__event_presenter({ + api_cfg: api_cfg, + event_presenter_id: object_id, + log_lvl: log_lvl + }); + return load_event_presenter_obj; + } + if (object_type == 'event_session') { + const load_event_session_obj = load_ae_obj_id__event_session({ + api_cfg: api_cfg, + event_session_id: object_id, + log_lvl: log_lvl + }); + return load_event_session_obj; + } - if (object_type == 'post') { - const load_post_obj = load_ae_obj_id__post({ - api_cfg: api_cfg, - post_id: object_id, - log_lvl: log_lvl - }); - return load_post_obj; - } - if (object_type == 'post_comment') { - const load_post_comment_obj = load_ae_obj_id__post_comment({ - api_cfg: api_cfg, - post_comment_id: object_id, - log_lvl: log_lvl - }); - return load_post_comment_obj; - } - } - } else { - 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'; - return false; - } - return true; - }) - .catch(function (error: any) { - console.log('Something went wrong patching the record.'); - console.log(error); - return false; - }) - .finally(function () { - console.log('PATCH Promise finally'); - }); + if (object_type == 'post') { + const load_post_obj = load_ae_obj_id__post({ + api_cfg: api_cfg, + post_id: object_id, + log_lvl: log_lvl + }); + return load_post_obj; + } + if (object_type == 'post_comment') { + const load_post_comment_obj = load_ae_obj_id__post_comment({ + api_cfg: api_cfg, + post_comment_id: object_id, + log_lvl: log_lvl + }); + return load_post_comment_obj; + } + } + } else { + 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'; + return false; + } + return true; + }) + .catch(function (error: any) { + console.log('Something went wrong patching the record.'); + console.log(error); + return false; + }) + .finally(function () { + console.log('PATCH Promise finally'); + }); - return ae_promises.api_update__ae_obj; + return ae_promises.api_update__ae_obj; } async function download_export__obj_type({ - api_cfg, - 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_id, // The ID of the object - exp_alt = null, // Export name (idaa, other, not 'default') - file_type = 'CSV', // 'CSV' or 'Excel' - return_file = true, - filename = 'no_filename.csv', - auto_download = false, - limit = 5000, - params = {}, // key value object is expected - log_lvl = 0 + api_cfg, + 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_id, // The ID of the object + exp_alt = null, // Export name (idaa, other, not 'default') + file_type = 'CSV', // 'CSV' or 'Excel' + return_file = true, + filename = 'no_filename.csv', + auto_download = false, + limit = 5000, + params = {}, // key value object is expected + log_lvl = 0 }: { - api_cfg: any; - get_obj_type: string; - for_obj_type: string; - for_obj_id: string; - exp_alt?: null | string; - file_type?: string; - return_file?: boolean; - filename?: string; - auto_download?: boolean; - limit?: number; - params?: key_val; - log_lvl?: number; + api_cfg: any; + get_obj_type: string; + for_obj_type: string; + for_obj_id: string; + exp_alt?: null | string; + file_type?: string; + return_file?: boolean; + filename?: string; + auto_download?: boolean; + limit?: number; + params?: key_val; + log_lvl?: number; }) { - console.log('*** ae_core_functions.js: download_export__obj_type() ***'); + console.log('*** ae_core_functions.js: download_export__obj_type() ***'); - const task_id = for_obj_id; + const task_id = for_obj_id; - const endpoint = `/v2/crud/${get_obj_type}/list`; - params['for_obj_type'] = for_obj_type; - params['for_obj_id'] = for_obj_id; + const endpoint = `/v2/crud/${get_obj_type}/list`; + params['for_obj_type'] = for_obj_type; + params['for_obj_id'] = for_obj_id; - if (file_type == 'CSV' || file_type == 'Excel') { - params['file_type'] = file_type; - } - params['return_file'] = true; + if (file_type == 'CSV' || file_type == 'Excel') { + params['file_type'] = file_type; + } + params['return_file'] = true; - params['mdl_alt'] = 'out'; + params['mdl_alt'] = 'out'; - if (exp_alt) { - params['exp_alt'] = exp_alt; - } + if (exp_alt) { + params['exp_alt'] = exp_alt; + } - // let clean_filename = filename.replace(/[^a-z0-9]/gi, '_'); - // let clean_filename = filename.replace(/[^a-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-z0-9]/gi, '_'); + // let clean_filename = filename.replace(/[^a-z0-9\[\]-]/gi, '_'); + const clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_'); + // let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-\._ ]/gi, '_'); - if (limit >= 0) { - params['limit'] = limit; - } + if (limit >= 0) { + params['limit'] = limit; + } - ae_promises.download__export_file = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - timeout: 90000, // Seems to timeout sometimes with the default of 60 seconds - return_blob: return_file, - filename: clean_filename, - auto_download: auto_download, - task_id: task_id, - log_lvl: log_lvl - }); + ae_promises.download__export_file = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + timeout: 90000, // Seems to timeout sometimes with the default of 60 seconds + return_blob: return_file, + filename: clean_filename, + auto_download: auto_download, + task_id: task_id, + log_lvl: log_lvl + }); - console.log('ae_promises.download__export_file:', ae_promises.download__export_file); - return ae_promises.download__export_file; + console.log('ae_promises.download__export_file:', ae_promises.download__export_file); + return ae_promises.download__export_file; } const 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, - load_ae_obj_li__country: load_ae_obj_li__country, - load_ae_obj_li__country_subdivision: load_ae_obj_li__country_subdivision, + load_ae_obj_li__country: load_ae_obj_li__country, + load_ae_obj_li__country_subdivision: load_ae_obj_li__country_subdivision, - load_ae_obj_id__hosted_file: load_ae_obj_id__hosted_file, - load_ae_obj_li__hosted_file: load_ae_obj_li__hosted_file, - 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, + load_ae_obj_id__hosted_file: load_ae_obj_id__hosted_file, + load_ae_obj_li__hosted_file: load_ae_obj_li__hosted_file, + 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, - db_save_ae_obj_li__ae_obj: db_save_ae_obj_li__ae_obj, + db_save_ae_obj_li__ae_obj: db_save_ae_obj_li__ae_obj, - add_url_params: add_url_params, - clean_headers: clean_headers, + add_url_params: add_url_params, + clean_headers: clean_headers, - load_ae_obj_id__site_domain: load_ae_obj_id__site_domain, - load_ae_obj_code__data_store: load_ae_obj_code__data_store, + load_ae_obj_id__site_domain: load_ae_obj_id__site_domain, + load_ae_obj_code__data_store: load_ae_obj_code__data_store, - 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, + 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, - 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, + 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, - 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, + 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, - update_ae_obj_id_crud: update_ae_obj_id_crud, - update_ae_obj_id_crud_v2: update_ae_obj_id_crud_v2, - download_export__obj_type: download_export__obj_type, - generate_qr_code: generate_qr_code, - js_generate_qr_code: js_generate_qr_code + update_ae_obj_id_crud: update_ae_obj_id_crud, + update_ae_obj_id_crud_v2: update_ae_obj_id_crud_v2, + download_export__obj_type: download_export__obj_type, + generate_qr_code: generate_qr_code, + js_generate_qr_code: js_generate_qr_code }; export const core_func = export_obj; diff --git a/src/lib/ae_core/core__account.ts b/src/lib/ae_core/core__account.ts index 6ac0cff7..eddb2324 100644 --- a/src/lib/ae_core/core__account.ts +++ b/src/lib/ae_core/core__account.ts @@ -1,23 +1,23 @@ export interface Account { - id: string; - // id_random: string; - account_id: string; - account_id_random: string; + id: string; + // id_random: string; + account_id: string; + account_id_random: string; - code?: string; - name: string; - short_name?: null | string; - description?: null | string; + code?: string; + name: string; + short_name?: null | string; + description?: null | string; - enable: null | boolean; - enable_from?: null | Date; - enable_to?: null | Date; + enable: null | boolean; + enable_from?: null | Date; + enable_to?: null | Date; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; } diff --git a/src/lib/ae_core/core__activity_log.ts b/src/lib/ae_core/core__activity_log.ts index 8a6df108..faf77d58 100644 --- a/src/lib/ae_core/core__activity_log.ts +++ b/src/lib/ae_core/core__activity_log.ts @@ -5,360 +5,368 @@ const ae_promises: key_val = {}; // Updated 2024-10-23 export async function load_ae_obj_id__activity_log({ - api_cfg, - activity_log_id, - // inc_other_li = false, - try_cache = false, - log_lvl = 0 + api_cfg, + activity_log_id, + // inc_other_li = false, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - activity_log_id: string; - // inc_other_li?: boolean, - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + activity_log_id: string; + // inc_other_li?: boolean, + try_cache?: boolean; + 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}`); - const params = {}; + const params = {}; - ae_promises.load__activity_log_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'activity_log', - obj_id: activity_log_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(function (activity_log_obj_get_result) { - if (activity_log_obj_get_result) { - // if (try_cache) { - // // This is expecting a list - // db_save_ae_obj_li__activity_log({ - // obj_type: 'activity_log', - // obj_li: [activity_log_obj_get_result] - // }); - // } - return activity_log_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__activity_log_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'activity_log', + obj_id: activity_log_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(function (activity_log_obj_get_result) { + if (activity_log_obj_get_result) { + // if (try_cache) { + // // This is expecting a list + // db_save_ae_obj_li__activity_log({ + // obj_type: 'activity_log', + // obj_li: [activity_log_obj_get_result] + // }); + // } + return activity_log_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__activity_log_obj:', ae_promises.load__activity_log_obj); - } + if (log_lvl) { + console.log('ae_promises.load__activity_log_obj:', ae_promises.load__activity_log_obj); + } - return ae_promises.load__activity_log_obj; + return ae_promises.load__activity_log_obj; } // Updated 2024-10-23 export async function load_ae_obj_li__activity_log({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - // inc_other_li = false, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = false, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + // inc_other_li = false, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - // inc_other_li?: boolean, - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + // inc_other_li?: boolean, + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - console.log( - `*** load_ae_obj_li__activity_log() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); + console.log( + `*** load_ae_obj_li__activity_log() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); - const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled - const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden - const limit: number = params.qry__limit ?? 99; // 99 - const offset: number = params.qry__offset ?? 0; // 0 + const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled + const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden + const limit: number = params.qry__limit ?? 99; // 99 + const offset: number = params.qry__offset ?? 0; // 0 - const 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({ - api_cfg: api_cfg, - obj_type: 'activity_log', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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 - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (activity_log_obj_li_get_result) { - if (activity_log_obj_li_get_result) { - // if (try_cache) { - // db_save_ae_obj_li__activity_log({ - // obj_type: 'activity_log', - // obj_li: activity_log_obj_li_get_result - // }); - // } - return activity_log_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__activity_log_obj_li = await api + .get_ae_obj_li_for_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'activity_log', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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 + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (activity_log_obj_li_get_result) { + if (activity_log_obj_li_get_result) { + // if (try_cache) { + // db_save_ae_obj_li__activity_log({ + // obj_type: 'activity_log', + // obj_li: activity_log_obj_li_get_result + // }); + // } + return activity_log_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__activity_log_obj_li:', ae_promises.load__activity_log_obj_li); - } + if (log_lvl) { + console.log( + 'ae_promises.load__activity_log_obj_li:', + ae_promises.load__activity_log_obj_li + ); + } - return ae_promises.load__activity_log_obj_li; + return ae_promises.load__activity_log_obj_li; } // Updated 2024-10-23 export async function create_ae_obj__activity_log({ - api_cfg, - account_id, - data_kv, - params = {}, - log_lvl = 0 + api_cfg, + account_id, + data_kv, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - data_kv: key_val; - params?: key_val; - log_lvl?: number; + api_cfg: any; + account_id: string; + data_kv: key_val; + params?: key_val; + 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({ - api_cfg: api_cfg, - obj_type: 'activity_log', - fields: { - account_id_random: account_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(function (activity_log_obj_create_result) { - if (activity_log_obj_create_result) { - // db_save_ae_obj_li__activity_log( - // { - // obj_type: 'activity_log', - // obj_li: [activity_log_obj_create_result] - // }); - return activity_log_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + ae_promises.create__activity_log = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'activity_log', + fields: { + account_id_random: account_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(function (activity_log_obj_create_result) { + if (activity_log_obj_create_result) { + // db_save_ae_obj_li__activity_log( + // { + // obj_type: 'activity_log', + // obj_li: [activity_log_obj_create_result] + // }); + return activity_log_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__activity_log:', ae_promises.create__activity_log); - } - return ae_promises.create__activity_log; + if (log_lvl) { + console.log('ae_promises.create__activity_log:', ae_promises.create__activity_log); + } + return ae_promises.create__activity_log; } // Updated 2024-10-23 export async function update_ae_obj__activity_log({ - api_cfg, - activity_log_id, - data_kv, - params = {}, - try_cache = false, - log_lvl = 0 + api_cfg, + activity_log_id, + data_kv, + params = {}, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - activity_log_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + activity_log_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg: api_cfg, - obj_type: 'activity_log', - obj_id: activity_log_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(function (activity_log_obj_update_result) { - if (activity_log_obj_update_result) { - // if (try_cache) { - // db_save_ae_obj_li__activity_log({ - // obj_type: 'activity_log', obj_li: [activity_log_obj_update_result] - // }); - // } - return activity_log_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + if (log_lvl) { + 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({ + api_cfg: api_cfg, + obj_type: 'activity_log', + obj_id: activity_log_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(function (activity_log_obj_update_result) { + if (activity_log_obj_update_result) { + // if (try_cache) { + // db_save_ae_obj_li__activity_log({ + // obj_type: 'activity_log', obj_li: [activity_log_obj_update_result] + // }); + // } + return activity_log_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.update__activity_log_obj:', ae_promises.update__activity_log_obj); - } - return ae_promises.update__activity_log_obj; + if (log_lvl) { + console.log('ae_promises.update__activity_log_obj:', 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. // Updated 2024-10-23 export async function qry__activity_log({ - api_cfg, - activity_log_id, - qry_str, - qry_files, - qry_start_datetime, // Example greater than: '2024-10-24' - enabled = 'enabled', - hidden = 'not_hidden', - limit = 50, - offset = 0, - params = {}, - try_cache = false, - log_lvl = 0 + api_cfg, + activity_log_id, + qry_str, + qry_files, + qry_start_datetime, // Example greater than: '2024-10-24' + enabled = 'enabled', + hidden = 'not_hidden', + limit = 50, + offset = 0, + params = {}, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - activity_log_id: any; - qry_str?: string; - qry_files?: null | boolean; - qry_start_datetime?: null | string; // Greater than this datetime - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + activity_log_id: any; + qry_str?: string; + qry_files?: null | boolean; + qry_start_datetime?: null | string; // Greater than this datetime + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + params?: any; + try_cache?: boolean; + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 25); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 25); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (qry_str && qry_str.length > 2) { - // params_json['ft_qry'] = {}; - // params_json['ft_qry']['default_qry_str'] = qry_str; - // } + // if (qry_str && qry_str.length > 2) { + // params_json['ft_qry'] = {}; + // params_json['ft_qry']['default_qry_str'] = qry_str; + // } - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_files === true) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: '>', - value: 0 - }; - params_json['qry'].push(qry_param); - } else if (qry_files === false) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: 'IS', - value: null - }; - params_json['qry'].push(qry_param); - } + if (qry_files === true) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: '>', + value: 0 + }; + params_json['qry'].push(qry_param); + } else if (qry_files === false) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: 'IS', + value: null + }; + params_json['qry'].push(qry_param); + } - if (qry_start_datetime) { - const qry_param = { - type: 'AND', - field: 'start_datetime', - operator: '>', - value: qry_start_datetime - }; - params_json['qry'].push(qry_param); - } + if (qry_start_datetime) { + const qry_param = { + type: 'AND', + field: 'start_datetime', + operator: '>', + value: qry_start_datetime + }; + params_json['qry'].push(qry_param); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'activity_log', - for_obj_type: 'account', - for_obj_id: activity_log_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for activity_log searching - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (activity_log_obj_li_get_result) { - if (activity_log_obj_li_get_result) { - // db_save_ae_obj_li__activity_log({ - // obj_type: 'activity_log', - // obj_li: activity_log_obj_li_get_result - // }); - return activity_log_obj_li_get_result; - } else { - return []; - } - }); + ae_promises.load__activity_log_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'activity_log', + for_obj_type: 'account', + for_obj_id: activity_log_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for activity_log searching + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (activity_log_obj_li_get_result) { + if (activity_log_obj_li_get_result) { + // db_save_ae_obj_li__activity_log({ + // obj_type: 'activity_log', + // obj_li: activity_log_obj_li_get_result + // }); + return activity_log_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__activity_log_obj_li:', ae_promises.load__activity_log_obj_li); - } - return ae_promises.load__activity_log_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__activity_log_obj_li:', + ae_promises.load__activity_log_obj_li + ); + } + return ae_promises.load__activity_log_obj_li; } diff --git a/src/lib/ae_core/core__api_helpers.ts b/src/lib/ae_core/core__api_helpers.ts index 59c9a550..0c90b306 100644 --- a/src/lib/ae_core/core__api_helpers.ts +++ b/src/lib/ae_core/core__api_helpers.ts @@ -2,56 +2,56 @@ import type { key_val } from '$lib/stores/ae_stores'; // Updated 2025-01-28 export function add_url_params({ - base_url = '', - endpoint, - params, - log_lvl = 0 + base_url = '', + endpoint, + params, + log_lvl = 0 }: { - base_url?: string; - endpoint: string; - params: key_val; - log_lvl?: number; + base_url?: string; + endpoint: string; + params: key_val; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** add_url_params() *** base_url=${base_url} endpoint=${endpoint}`, params); - } + if (log_lvl) { + 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) { - console.log('New URL:', url_obj.toString()); - } + if (log_lvl) { + console.log('New URL:', url_obj.toString()); + } - return url_obj.toString(); - // return 'test'; + return url_obj.toString(); + // return 'test'; } // This is used to clean the header property names. Not underscores allowed in the header names. // Updated 2025-01-28 export function clean_headers({ headers, log_lvl = 0 }: { headers: any; log_lvl?: number }) { - if (log_lvl) { - console.log(`*** clean_headers() ***`, headers); - } + if (log_lvl) { + console.log(`*** clean_headers() ***`, headers); + } - const headers_cleaned: key_val = {}; - for (const prop in headers) { - const prop_cleaned = prop.replaceAll('_', '-'); - if (typeof headers[prop] != 'string') { - headers[prop] = JSON.stringify(headers[prop]); - } - headers_cleaned[prop_cleaned] = headers[prop]; - if (log_lvl > 1) { - console.log(`${prop_cleaned}: ${headers_cleaned[prop_cleaned]}`); - } - } + const headers_cleaned: key_val = {}; + for (const prop in headers) { + const prop_cleaned = prop.replaceAll('_', '-'); + if (typeof headers[prop] != 'string') { + headers[prop] = JSON.stringify(headers[prop]); + } + headers_cleaned[prop_cleaned] = headers[prop]; + if (log_lvl > 1) { + console.log(`${prop_cleaned}: ${headers_cleaned[prop_cleaned]}`); + } + } - // Object.keys(headers).forEach(key => { - // if (headers[key]) { - // headers_cleaned[key] = headers[key]; - // } - // }); + // Object.keys(headers).forEach(key => { + // if (headers[key]) { + // headers_cleaned[key] = headers[key]; + // } + // }); - return headers_cleaned; + return headers_cleaned; } diff --git a/src/lib/ae_core/core__check_hosted_file_obj_w_hash.ts b/src/lib/ae_core/core__check_hosted_file_obj_w_hash.ts index f43d8de3..5d324211 100644 --- a/src/lib/ae_core/core__check_hosted_file_obj_w_hash.ts +++ b/src/lib/ae_core/core__check_hosted_file_obj_w_hash.ts @@ -3,32 +3,32 @@ import { api } from '$lib/api/api'; // Updated 2024-10-02 export async function check_hosted_file_obj_w_hash({ - api_cfg, - hosted_file_hash, - check_for_local = true, // Forces a check on the host server for the file. - params = {}, - return_meta = false, - log_lvl = 0 + api_cfg, + hosted_file_hash, + check_for_local = true, // Forces a check on the host server for the file. + params = {}, + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - hosted_file_hash: string; - check_for_local?: boolean; - params?: key_val; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + hosted_file_hash: string; + check_for_local?: boolean; + params?: key_val; + return_meta?: boolean; + 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}`; - if (check_for_local) { - params['check_for_local'] = true; - } - const check_hosted_file_obj_w_hash_get_promise = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - return_meta: return_meta, - log_lvl: log_lvl - }); - return check_hosted_file_obj_w_hash_get_promise; + const endpoint = `/hosted_file/hash/${hosted_file_hash}`; + if (check_for_local) { + params['check_for_local'] = true; + } + const check_hosted_file_obj_w_hash_get_promise = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + return_meta: return_meta, + log_lvl: log_lvl + }); + return check_hosted_file_obj_w_hash_get_promise; } diff --git a/src/lib/ae_core/core__countries.ts b/src/lib/ae_core/core__countries.ts index 4c694b19..1fa376da 100644 --- a/src/lib/ae_core/core__countries.ts +++ b/src/lib/ae_core/core__countries.ts @@ -7,65 +7,65 @@ const ae_promises: key_val = {}; // Updated 2024-10-14 export async function load_ae_obj_li__country({ - api_cfg, - // account_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 299, - offset = 0, - order_by_li = { sort: 'DESC', english_short_name: 'ASC', alpha_2_code: 'ASC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + // account_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 299, + offset = 0, + order_by_li = { sort: 'DESC', english_short_name: 'ASC', alpha_2_code: 'ASC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - // account_id: string, - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + // account_id: string, + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_li__country() ***`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_li__country() ***`); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'lu', - for_obj_type: 'country', - // for_obj_id: account_id, - use_alt_tbl: false, - use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (country_li_get_result) { - if (country_li_get_result) { - // handle_db_save_ae_obj_li__country({obj_type: 'country', obj_li: country_li_get_result}); - return country_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__country_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'lu', + for_obj_type: 'country', + // for_obj_id: account_id, + use_alt_tbl: false, + use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (country_li_get_result) { + if (country_li_get_result) { + // handle_db_save_ae_obj_li__country({obj_type: 'country', obj_li: country_li_get_result}); + return country_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - console.log('ae_promises.load__country_li:', ae_promises.load__country_li); - return ae_promises.load__country_li; + console.log('ae_promises.load__country_li:', ae_promises.load__country_li); + return ae_promises.load__country_li; } diff --git a/src/lib/ae_core/core__country_subdivisions.ts b/src/lib/ae_core/core__country_subdivisions.ts index d92f2927..07da3f2c 100644 --- a/src/lib/ae_core/core__country_subdivisions.ts +++ b/src/lib/ae_core/core__country_subdivisions.ts @@ -7,68 +7,68 @@ const ae_promises: key_val = {}; // Updated 2024-10-14 export async function load_ae_obj_li__country_subdivision({ - api_cfg, - // account_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 399, - offset = 0, - order_by_li = { sort: 'DESC', name: 'ASC', code: 'ASC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + // account_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 399, + offset = 0, + order_by_li = { sort: 'DESC', name: 'ASC', code: 'ASC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - // account_id: string, - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + // account_id: string, + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_li__country_subdivision() ***`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_li__country_subdivision() ***`); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'lu', - for_obj_type: 'country_subdivision', - // for_obj_id: account_id, - use_alt_tbl: false, - use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (country_subdivision_li_get_result) { - if (country_subdivision_li_get_result) { - // handle_db_save_ae_obj_li__country_subdivision({obj_type: 'country_subdivision', obj_li: country_subdivision_li_get_result}); - return country_subdivision_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__country_subdivision_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'lu', + for_obj_type: 'country_subdivision', + // for_obj_id: account_id, + use_alt_tbl: false, + use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (country_subdivision_li_get_result) { + if (country_subdivision_li_get_result) { + // handle_db_save_ae_obj_li__country_subdivision({obj_type: 'country_subdivision', obj_li: country_subdivision_li_get_result}); + return country_subdivision_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - console.log( - 'ae_promises.load__country_subdivision_li:', - ae_promises.load__country_subdivision_li - ); - return 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; } diff --git a/src/lib/ae_core/core__crud_generic.ts b/src/lib/ae_core/core__crud_generic.ts index e94a166d..533dceab 100644 --- a/src/lib/ae_core/core__crud_generic.ts +++ b/src/lib/ae_core/core__crud_generic.ts @@ -7,172 +7,172 @@ import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie'; // Define generic CRUD args export interface GenericCrudArgs { - api_cfg: any; - obj_type: string; - obj_id?: string; - for_obj_type?: string; - for_obj_id?: string; + api_cfg: any; + obj_type: string; + obj_id?: string; + for_obj_type?: string; + for_obj_id?: string; - db_instance?: any; // Optional DB instance for caching - db_field_li?: string[]; // Optional list of fields to save in DB + db_instance?: any; // Optional DB instance for caching + db_field_li?: string[]; // Optional list of fields to save in DB - // Flags to include related core object models - inc_account_li?: boolean; - inc_address_li?: boolean; - inc_contact_li?: boolean; - inc_person_li?: boolean; - inc_site_li?: boolean; - inc_site_domain_li?: boolean; - inc_user_li?: boolean; + // Flags to include related core object models + inc_account_li?: boolean; + inc_address_li?: boolean; + inc_contact_li?: boolean; + inc_person_li?: boolean; + inc_site_li?: boolean; + inc_site_domain_li?: boolean; + inc_user_li?: boolean; - // Flags to include related other object models - inc_archive_li?: boolean; - inc_archive_entry_li?: boolean; - inc_event_li?: boolean; - inc_event_session_li?: boolean; - inc_post_li?: boolean; - inc_post_comment_li?: boolean; - inc_journal_li?: boolean; - inc_journal_entry_li?: boolean; + // Flags to include related other object models + inc_archive_li?: boolean; + inc_archive_entry_li?: boolean; + inc_event_li?: boolean; + inc_event_session_li?: boolean; + inc_post_li?: boolean; + inc_post_comment_li?: boolean; + inc_journal_li?: boolean; + inc_journal_entry_li?: boolean; - inc_obj_type_li?: string[]; // Optional list of object types to include + inc_obj_type_li?: string[]; // Optional list of object types to include - data_kv?: key_val; - enabled?: 'enabled' | 'disabled' | 'all'; - hidden?: 'not_hidden' | 'hidden' | 'all'; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + data_kv?: key_val; + enabled?: 'enabled' | 'disabled' | 'all'; + hidden?: 'not_hidden' | 'hidden' | 'all'; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; } // Generic function: Load single object by ID export async function load_ae_obj_id(args: GenericCrudArgs): Promise { - 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) { - console.log(`*** load_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`); + } - const result = await api.get_ae_obj_id_crud({ - api_cfg, - obj_type, - obj_id, - params: {}, - log_lvl - }); + const result = await api.get_ae_obj_id_crud({ + api_cfg, + obj_type, + obj_id, + params: {}, + log_lvl + }); - return result; + return result; } // Generic function: Load list of objects export async function load_ae_obj_li(args: GenericCrudArgs): Promise { - const { - api_cfg, - obj_type, - for_obj_type = '', - for_obj_id, - inc_obj_type_li, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = {}, - params = {}, - try_cache = true, - log_lvl = 0 - } = args; + const { + api_cfg, + obj_type, + for_obj_type = '', + for_obj_id, + inc_obj_type_li, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = {}, + params = {}, + try_cache = true, + log_lvl = 0 + } = args; - 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}` - ); - } + 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}` + ); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - const result = await api.get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg, - obj_type, - for_obj_type, - for_obj_id, - enabled, - hidden, - order_by_li, - limit, - offset, - params_json: {}, - params, - log_lvl - }); + const result = await api.get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg, + obj_type, + for_obj_type, + for_obj_id, + enabled, + hidden, + order_by_li, + limit, + offset, + params_json: {}, + params, + log_lvl + }); - return result; + return result; } // Generic function: Create object export async function create_ae_obj(args: GenericCrudArgs): Promise { - 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) { - console.log(`*** create_ae_obj() *** obj_type=${obj_type}`, data_kv); - } + if (log_lvl) { + console.log(`*** create_ae_obj() *** obj_type=${obj_type}`, data_kv); + } - const result = await api.create_ae_obj_crud({ - api_cfg, - obj_type, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: {}, - return_obj: true, - log_lvl - }); + const result = await api.create_ae_obj_crud({ + api_cfg, + obj_type, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: {}, + return_obj: true, + log_lvl + }); - return result; + return result; } // Generic function: Update object export async function update_ae_obj(args: GenericCrudArgs): Promise { - 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) { - console.log(`*** update_ae_obj() *** obj_type=${obj_type} obj_id=${obj_id}`, data_kv); - } + if (log_lvl) { + console.log(`*** update_ae_obj() *** obj_type=${obj_type} obj_id=${obj_id}`, data_kv); + } - const result = await api.update_ae_obj_id_crud({ - api_cfg, - obj_type, - obj_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: {}, - return_obj: true, - log_lvl - }); + const result = await api.update_ae_obj_id_crud({ + api_cfg, + obj_type, + obj_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: {}, + return_obj: true, + log_lvl + }); - return result; + return result; } // Generic function: Delete object export async function delete_ae_obj_id(args: GenericCrudArgs): Promise { - 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) { - console.log(`*** delete_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`); + } - const result = await api.delete_ae_obj_id_crud({ - api_cfg, - obj_type, - obj_id, - key: api_cfg.api_crud_super_key, - params: {}, - method, - log_lvl - }); + const result = await api.delete_ae_obj_id_crud({ + api_cfg, + obj_type, + obj_id, + key: api_cfg.api_crud_super_key, + params: {}, + method, + log_lvl + }); - return result; + return result; } // Additional Modules that might be needed for reloads @@ -192,144 +192,144 @@ import { load_ae_obj_id__post_comment } from '$lib/ae_posts/ae_posts__post_comme import { load_ae_obj_id__person } from '$lib/ae_core/core__person'; export async function update_ae_obj_id_crud_v2({ - api_cfg, - object_type, - object_id, - object_reload = false, - field_name, - new_field_value, - log_lvl = 0 + api_cfg, + object_type, + object_id, + object_reload = false, + field_name, + new_field_value, + log_lvl = 0 }: { - api_cfg: any; - object_type: string; - object_id: string; - object_reload?: boolean; - field_name: string; - new_field_value: any; - log_lvl?: number; + api_cfg: any; + object_type: string; + object_id: string; + object_reload?: boolean; + field_name: string; + new_field_value: any; + log_lvl?: number; }) { - 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 - ); - } + 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 + ); + } - try { - const results = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: object_type, - obj_id: object_id, - field_name: field_name, - field_value: new_field_value, - key: api_cfg.api_crud_super_key, - log_lvl: log_lvl - }); + try { + const results = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: object_type, + obj_id: object_id, + field_name: field_name, + field_value: new_field_value, + key: api_cfg.api_crud_super_key, + log_lvl: log_lvl + }); - if (!results) { - console.log( - `Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}` - ); - return false; - } + if (!results) { + console.log( + `Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}` + ); + return false; + } - 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}`); - if (object_reload) { - if (log_lvl) console.log(`Reloading the object after patching...`); + if (object_reload) { + if (log_lvl) console.log(`Reloading the object after patching...`); - const reload_fns: { [key: string]: (args: any) => Promise } = { - person: load_ae_obj_id__person, - archive: load_ae_obj_id__archive, - archive_content: load_ae_obj_id__archive_content, - journal: load_ae_obj_id__journal, - journal_entry: load_ae_obj_id__journal_entry, - event: load_ae_obj_id__event, - event_device: load_ae_obj_id__event_device, - event_file: load_ae_obj_id__event_file, - event_location: load_ae_obj_id__event_location, - event_presentation: load_ae_obj_id__event_presentation, - event_presenter: load_ae_obj_id__event_presenter, - event_session: load_ae_obj_id__event_session, - post: load_ae_obj_id__post, - post_comment: load_ae_obj_id__post_comment - }; + const reload_fns: { [key: string]: (args: any) => Promise } = { + person: load_ae_obj_id__person, + archive: load_ae_obj_id__archive, + archive_content: load_ae_obj_id__archive_content, + journal: load_ae_obj_id__journal, + journal_entry: load_ae_obj_id__journal_entry, + event: load_ae_obj_id__event, + event_device: load_ae_obj_id__event_device, + event_file: load_ae_obj_id__event_file, + event_location: load_ae_obj_id__event_location, + event_presentation: load_ae_obj_id__event_presentation, + event_presenter: load_ae_obj_id__event_presenter, + event_session: load_ae_obj_id__event_session, + post: load_ae_obj_id__post, + post_comment: load_ae_obj_id__post_comment + }; - const reload_fn = reload_fns[object_type]; - if (reload_fn) { - const id_key = `${object_type}_id`; - return await reload_fn({ api_cfg, [id_key]: object_id, log_lvl }); - } - } + const reload_fn = reload_fns[object_type]; + if (reload_fn) { + const id_key = `${object_type}_id`; + return await reload_fn({ api_cfg, [id_key]: object_id, log_lvl }); + } + } - return true; - } catch (error) { - console.log('Something went wrong patching the record.', error); - return false; - } + return true; + } catch (error) { + console.log('Something went wrong patching the record.', error); + return false; + } } export async function download_export_li({ - api_cfg, - get_obj_type, - for_obj_type, - for_obj_id, - exp_alt = null, - file_type = 'CSV', - return_file = true, - filename = 'no_filename.csv', - auto_download = false, - limit = 5000, - params = {}, - log_lvl = 0 + api_cfg, + get_obj_type, + for_obj_type, + for_obj_id, + exp_alt = null, + file_type = 'CSV', + return_file = true, + filename = 'no_filename.csv', + auto_download = false, + limit = 5000, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - get_obj_type: string; - for_obj_type: string; - for_obj_id: string; - exp_alt?: null | string; - file_type?: string; - return_file?: boolean; - filename?: string; - auto_download?: boolean; - limit?: number; - params?: key_val; - log_lvl?: number; + api_cfg: any; + get_obj_type: string; + for_obj_type: string; + for_obj_id: string; + exp_alt?: null | string; + file_type?: string; + return_file?: boolean; + filename?: string; + auto_download?: boolean; + limit?: number; + params?: key_val; + 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`; - params['for_obj_type'] = for_obj_type; - params['for_obj_id'] = for_obj_id; + const endpoint = `/v2/crud/${get_obj_type}/list`; + params['for_obj_type'] = for_obj_type; + params['for_obj_id'] = for_obj_id; - if (file_type === 'CSV' || file_type === 'Excel') { - params['file_type'] = file_type; - } - params['return_file'] = true; - params['mdl_alt'] = 'out'; + if (file_type === 'CSV' || file_type === 'Excel') { + params['file_type'] = file_type; + } + params['return_file'] = true; + params['mdl_alt'] = 'out'; - if (exp_alt) { - params['exp_alt'] = exp_alt; - } + if (exp_alt) { + params['exp_alt'] = exp_alt; + } - const clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_'); + const clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_'); - if (limit >= 0) { - params['limit'] = limit; - } + if (limit >= 0) { + params['limit'] = limit; + } - const download_result = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - timeout: 90000, - return_blob: return_file, - filename: clean_filename, - auto_download: auto_download, - task_id: for_obj_id, - log_lvl: log_lvl - }); + const download_result = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + timeout: 90000, + return_blob: return_file, + filename: clean_filename, + auto_download: auto_download, + task_id: for_obj_id, + log_lvl: log_lvl + }); - if (log_lvl) console.log('download_result:', download_result); - return download_result; + if (log_lvl) console.log('download_result:', download_result); + return download_result; } diff --git a/src/lib/ae_core/core__data_store.ts b/src/lib/ae_core/core__data_store.ts index a28eaea6..98ce93a5 100644 --- a/src/lib/ae_core/core__data_store.ts +++ b/src/lib/ae_core/core__data_store.ts @@ -3,23 +3,23 @@ import type { key_val } from '$lib/stores/ae_stores'; import { api } from '$lib/api/api'; export interface Data_Store { - id: string; - account_id: string; - code: string; - name: string; - type: string; - for_type?: string | null; - for_id?: string | null; - access_read?: string | null; - access_write?: string | null; - access_delete?: string | null; - html?: string | null; - json?: key_val | null; - md?: string | null; - text?: string | null; - updated_on?: string | null; - chk_account_id?: string; - loaded_on?: string; + id: string; + account_id: string; + code: string; + name: string; + type: string; + for_type?: string | null; + for_id?: string | null; + access_read?: string | null; + access_write?: string | null; + access_delete?: string | null; + html?: string | null; + json?: key_val | null; + md?: string | null; + text?: string | null; + updated_on?: string | null; + chk_account_id?: string; + loaded_on?: string; } /** @@ -34,79 +34,79 @@ export interface Data_Store { * @returns The data from the data store (e.g., text content or JSON object). */ export async function load_ae_obj_by_code__data_store({ - api_cfg, - code, - data_type = 'text', - save_idb = false, - timeout = 9000, - log_lvl = 0 + api_cfg, + code, + data_type = 'text', + save_idb = false, + timeout = 9000, + log_lvl = 0 }: { - api_cfg: any; - code: string; - data_type?: string; - save_idb?: boolean; - timeout?: number; - log_lvl?: number; + api_cfg: any; + code: string; + data_type?: string; + save_idb?: boolean; + timeout?: number; + log_lvl?: number; }): Promise { - if (log_lvl) { - console.log(`*** load_ae_obj_by_code__data_store() *** code=${code}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_by_code__data_store() *** code=${code}`); + } - if (!code) { - console.log(`*ae_func* No code provided!`); - return null; - } + if (!code) { + console.log(`*ae_func* No code provided!`); + return null; + } - if (!api_cfg.account_id) { - console.log(`*ae_func* No account_id found in API config!`); - return null; - } + if (!api_cfg.account_id) { + console.log(`*ae_func* No account_id found in API config!`); + return null; + } - try { - const get_ds_result = await api.get_data_store_obj_w_code({ - api_cfg: api_cfg, - data_store_code: code, - data_type: data_type, - timeout: timeout, - log_lvl: log_lvl - }); + try { + const get_ds_result = await api.get_data_store_obj_w_code({ + api_cfg: api_cfg, + data_store_code: code, + data_type: data_type, + timeout: timeout, + log_lvl: log_lvl + }); - if (!get_ds_result) { - console.log('*ae_func* No results returned.'); - return null; - } + if (!get_ds_result) { + console.log('*ae_func* No results returned.'); + return null; + } - if (log_lvl) { - console.log(`*ae_func* Got a result for code ${code}`); - } + if (log_lvl) { + console.log(`*ae_func* Got a result for code ${code}`); + } - if (!get_ds_result.data_store_id_random) { - console.log('*ae_func* Something went wrong? No data store ID found.'); - return null; - } + if (!get_ds_result.data_store_id_random) { + console.log('*ae_func* Something went wrong? No data store ID found.'); + return null; + } - let return_this: any = null; + let return_this: any = null; - // Simplified data extraction - if (data_type === 'html') { - return_this = get_ds_result.html; - } else if (data_type === 'json') { - return_this = get_ds_result.json; - } else { - return_this = get_ds_result.text; - } + // Simplified data extraction + if (data_type === 'html') { + return_this = get_ds_result.html; + } else if (data_type === 'json') { + return_this = get_ds_result.json; + } else { + return_this = get_ds_result.text; + } - if (save_idb && browser) { - const key_prefix = 'ae_ds__'; - if (log_lvl) { - console.log(`*ae_func* localStorage key: ${code}, value:`, get_ds_result); - } - localStorage.setItem(`${key_prefix}${code}`, JSON.stringify(get_ds_result)); - } + if (save_idb && browser) { + const key_prefix = 'ae_ds__'; + if (log_lvl) { + console.log(`*ae_func* localStorage key: ${code}, value:`, get_ds_result); + } + localStorage.setItem(`${key_prefix}${code}`, JSON.stringify(get_ds_result)); + } - return return_this; - } catch (error) { - console.log('*ae_func* No results returned or failed.', error); - return null; - } + return return_this; + } catch (error) { + console.log('*ae_func* No results returned or failed.', error); + return null; + } } diff --git a/src/lib/ae_core/core__hosted_files.ts b/src/lib/ae_core/core__hosted_files.ts index 128705dd..035d38fa 100644 --- a/src/lib/ae_core/core__hosted_files.ts +++ b/src/lib/ae_core/core__hosted_files.ts @@ -7,354 +7,356 @@ const ae_promises: key_val = {}; // Updated 2024-06-14 export async function load_ae_obj_id__hosted_file({ - api_cfg, - hosted_file_id, - try_cache = false, - log_lvl = 0 + api_cfg, + hosted_file_id, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - hosted_file_id: string; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + hosted_file_id: string; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`); + } - const params = {}; + const params = {}; - ae_promises.load__hosted_file_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'hosted_file', - obj_id: hosted_file_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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 - params: params, - log_lvl: log_lvl - }) - .then(function (hosted_file_obj_get_result) { - if (hosted_file_obj_get_result) { - // This is expecting a list - db_save_ae_obj_li__hosted_file({ - obj_type: 'hosted_file', - obj_li: [hosted_file_obj_get_result] - }); - return hosted_file_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__hosted_file_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'hosted_file', + obj_id: hosted_file_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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 + params: params, + log_lvl: log_lvl + }) + .then(function (hosted_file_obj_get_result) { + if (hosted_file_obj_get_result) { + // This is expecting a list + db_save_ae_obj_li__hosted_file({ + obj_type: 'hosted_file', + obj_li: [hosted_file_obj_get_result] + }); + return hosted_file_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__hosted_file_obj; + return ae_promises.load__hosted_file_obj; } // Updated 2024-07-03 export async function load_ae_obj_li__hosted_file({ - api_cfg, - for_obj_type, - for_obj_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type, + for_obj_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__hosted_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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: - 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)) { - console.log(`Invalid for_obj_type: ${for_obj_type}`); - return []; - } + // Check if for_obj_type is in the list of valid Aether object types: + 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)) { + console.log(`Invalid for_obj_type: ${for_obj_type}`); + return []; + } - // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled - // let hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 99); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const 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({ - api_cfg: api_cfg, - obj_type: 'hosted_file', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (hosted_file_obj_li_get_result) { - if (hosted_file_obj_li_get_result) { - if (try_cache) { - db_save_ae_obj_li__hosted_file({ - obj_type: 'hosted_file', - obj_li: hosted_file_obj_li_get_result, - log_lvl: log_lvl - }); - } - return hosted_file_obj_li_get_result; - } else { - console.log('No results returned.'); - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__hosted_file_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'hosted_file', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (hosted_file_obj_li_get_result) { + if (hosted_file_obj_li_get_result) { + if (try_cache) { + db_save_ae_obj_li__hosted_file({ + obj_type: 'hosted_file', + obj_li: hosted_file_obj_li_get_result, + log_lvl: log_lvl + }); + } + return hosted_file_obj_li_get_result; + } else { + console.log('No results returned.'); + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__hosted_file_obj_li:', ae_promises.load__hosted_file_obj_li); - } - return ae_promises.load__hosted_file_obj_li; + if (log_lvl) { + console.log('ae_promises.load__hosted_file_obj_li:', ae_promises.load__hosted_file_obj_li); + } + return ae_promises.load__hosted_file_obj_li; } // Updated 2024-11-07 export async function delete_ae_obj_id__hosted_file({ - api_cfg, - hosted_file_id, - link_to_type, // Ideally this should be required... - link_to_id, // Ideally this should be required... - rm_orphan = false, - fake_delete = false, // Fake the delete result to "true" - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + hosted_file_id, + link_to_type, // Ideally this should be required... + link_to_id, // Ideally this should be required... + rm_orphan = false, + fake_delete = false, // Fake the delete result to "true" + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - hosted_file_id: string; - link_to_type: string; - link_to_id: string; - rm_orphan?: boolean; - fake_delete?: boolean; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + hosted_file_id: string; + link_to_type: string; + link_to_id: string; + rm_orphan?: boolean; + fake_delete?: boolean; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`); + } - const endpoint = `/hosted_file/${hosted_file_id}`; + const endpoint = `/hosted_file/${hosted_file_id}`; - params['link_to_type'] = link_to_type; - params['link_to_id'] = link_to_id; - params['rm_orphan'] = rm_orphan; // This is what actually allows the hosted file to be deleted from the server. - if (log_lvl) { - console.log(`delete_ae_obj_id__hosted_file() params=`, params); - } + params['link_to_type'] = link_to_type; + params['link_to_id'] = link_to_id; + params['rm_orphan'] = rm_orphan; // This is what actually allows the hosted file to be deleted from the server. + if (log_lvl) { + console.log(`delete_ae_obj_id__hosted_file() params=`, params); + } - if (fake_delete) { - console.log(`*** FAKE DELETE!!! ***`); - ae_promises.delete__hosted_file_obj = true; - return ae_promises.delete__hosted_file_obj; - } + if (fake_delete) { + console.log(`*** FAKE DELETE!!! ***`); + ae_promises.delete__hosted_file_obj = true; + return ae_promises.delete__hosted_file_obj; + } - ae_promises.delete__hosted_file_obj = await api - .delete_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - // return_meta: return_meta, - log_lvl: log_lvl - }) - .then(function (hosted_file_obj_li_get_result) { - if (hosted_file_obj_li_get_result) { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for hosted_file_id=${hosted_file_id}`); - } - db_core.file.delete(hosted_file_id); // Delete from the DB no matter what. - } - return hosted_file_obj_li_get_result; - } else { - console.log('No results returned.'); - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.delete__hosted_file_obj = await api + .delete_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + // return_meta: return_meta, + log_lvl: log_lvl + }) + .then(function (hosted_file_obj_li_get_result) { + if (hosted_file_obj_li_get_result) { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for hosted_file_id=${hosted_file_id}` + ); + } + db_core.file.delete(hosted_file_id); // Delete from the DB no matter what. + } + return hosted_file_obj_li_get_result; + } else { + console.log('No results returned.'); + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.delete__hosted_file_obj:', ae_promises.delete__hosted_file_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__hosted_file_obj:', ae_promises.delete__hosted_file_obj); + } - 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. // Updated 2025-01-07 export function db_save_ae_obj_li__hosted_file({ - obj_type, - obj_li, - log_lvl = 0 + obj_type, + obj_li, + log_lvl = 0 }: { - obj_type: string; - obj_li: any; - log_lvl?: number; + obj_type: string; + obj_li: any; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** db_save_ae_obj_li__hosted_file() ***`); - } + if (log_lvl) { + console.log(`*** db_save_ae_obj_li__hosted_file() ***`); + } - if (obj_li && obj_li.length) { - obj_li.forEach(async function (obj: any) { - if (log_lvl) { - console.log(`ae_obj ${obj_type}:`, obj); - } + if (obj_li && obj_li.length) { + obj_li.forEach(async function (obj: any) { + if (log_lvl) { + console.log(`ae_obj ${obj_type}:`, obj); + } - try { - const id_random = await db_core.file.put({ - id: obj.hosted_file_id_random, - id_random: obj.hosted_file_id_random, - hosted_file_id: obj.hosted_file_id_random, - hosted_file_id_random: obj.hosted_file_id_random, + try { + const id_random = await db_core.file.put({ + id: obj.hosted_file_id_random, + id_random: obj.hosted_file_id_random, + hosted_file_id: obj.hosted_file_id_random, + hosted_file_id_random: obj.hosted_file_id_random, - hash_sha256: obj.hash_sha256, // Renamed with alias in FastAPI model + hash_sha256: obj.hash_sha256, // Renamed with alias in FastAPI model - for_type: obj.for_type, - for_id: obj.for_id_id_random, - for_id_random: obj.for_id_random, + for_type: obj.for_type, + for_id: obj.for_id_id_random, + for_id_random: obj.for_id_random, - account_id: obj.account_id_random, + account_id: obj.account_id_random, - filename: obj.filename, - extension: obj.extension, - content_type: obj.content_type, - size: obj.size, + filename: obj.filename, + extension: obj.extension, + content_type: obj.content_type, + size: obj.size, - enable: obj.enable, - hide: obj.hide, - // priority: obj.priority, - // sort: obj.sort, - group: obj.group, - notes: obj.notes, - created_on: obj.created_on, - updated_on: obj.updated_on, + enable: obj.enable, + hide: obj.hide, + // priority: obj.priority, + // sort: obj.sort, + group: obj.group, + notes: obj.notes, + created_on: obj.created_on, + updated_on: obj.updated_on, - filename_no_ext: obj.filename_no_ext, - filename_w_ext: obj.filename_w_ext - }); - // console.log(`Put obj with ID: ${obj.hosted_file_id_random} or ${id_random}`); - } catch (error) { - const status = `Failed to put ${obj.hosted_file_id_random}: ${error}`; - console.log(status); - } + filename_no_ext: obj.filename_no_ext, + filename_w_ext: obj.filename_w_ext + }); + // console.log(`Put obj with ID: ${obj.hosted_file_id_random} or ${id_random}`); + } catch (error) { + const status = `Failed to put ${obj.hosted_file_id_random}: ${error}`; + console.log(status); + } - // const id_random = await db_core.file.put(obj); - // console.log(`Put obj with ID: ${obj.hosted_file_id_random}`); - }); + // const id_random = await db_core.file.put(obj); + // console.log(`Put obj with ID: ${obj.hosted_file_id_random}`); + }); - return true; - } - return false; + return true; + } + return false; } // Updated 2025-01-07 export function db_update_ae_obj_id__hosted_file({ - obj_type, - obj_id, - data_kv, - log_lvl = 0 + obj_type, + obj_id, + data_kv, + log_lvl = 0 }: { - obj_type: string; - obj_id: string; - data_kv: key_val; - log_lvl?: number; + obj_type: string; + obj_id: string; + data_kv: key_val; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** db_update_ae_obj_id__hosted_file() ***`); - } + if (log_lvl) { + console.log(`*** db_update_ae_obj_id__hosted_file() ***`); + } - if (obj_id) { - console.log(`ae_obj ${obj_type}:`, obj_id); + if (obj_id) { + console.log(`ae_obj ${obj_type}:`, obj_id); - try { - // db_core.file.update(obj_id, data_kv); - db_core.file.update(obj_id, { - // for_type: data_kv.for_type, - // for_id: data_kv.for_id_id_random, - // for_id_random: data_kv.for_id_random, + try { + // db_core.file.update(obj_id, data_kv); + db_core.file.update(obj_id, { + // for_type: data_kv.for_type, + // for_id: data_kv.for_id_id_random, + // for_id_random: data_kv.for_id_random, - filename: data_kv.filename, - extension: data_kv.extension, - content_type: data_kv.content_type, - size: data_kv.size, + filename: data_kv.filename, + extension: data_kv.extension, + content_type: data_kv.content_type, + size: data_kv.size, - // enable: data_kv.enable, - // hide: data_kv.hide, - // priority: data_kv.priority, - // sort: data_kv.sort, - // group: data_kv.group, - // notes: data_kv.notes, - // created_on: data_kv.created_on, - // updated_on: data_kv.updated_on, + // enable: data_kv.enable, + // hide: data_kv.hide, + // priority: data_kv.priority, + // sort: data_kv.sort, + // group: data_kv.group, + // notes: data_kv.notes, + // created_on: data_kv.created_on, + // updated_on: data_kv.updated_on, - filename_no_ext: data_kv.filename_no_ext, - filename_w_ext: data_kv.filename_w_ext - // hosted_file_content_type: data_kv.hosted_file_content_type, - // file_size: data_kv.file_size, - // hosted_file_size: data_kv.hosted_file_size, - }); + filename_no_ext: data_kv.filename_no_ext, + filename_w_ext: data_kv.filename_w_ext + // hosted_file_content_type: data_kv.hosted_file_content_type, + // file_size: data_kv.file_size, + // hosted_file_size: data_kv.hosted_file_size, + }); - console.log(`Update obj with ID: ${obj_id}`); - } catch (error) { - const status = `Failed to update ${obj_id}: ${error}`; - console.log(status); - } + console.log(`Update obj with ID: ${obj_id}`); + } catch (error) { + const status = `Failed to update ${obj_id}: ${error}`; + console.log(status); + } - // const id_random = await db_core.file.put(obj); - // console.log(`Put obj with ID: ${data_kv.hosted_file_id_random}`); - return true; - } - return false; + // const id_random = await db_core.file.put(obj); + // console.log(`Put obj with ID: ${data_kv.hosted_file_id_random}`); + return true; + } + return false; } diff --git a/src/lib/ae_core/core__idb_dexie.ts b/src/lib/ae_core/core__idb_dexie.ts index 3d39f72e..82e3e797 100644 --- a/src/lib/ae_core/core__idb_dexie.ts +++ b/src/lib/ae_core/core__idb_dexie.ts @@ -8,26 +8,29 @@ import type { Dexie, Table } from 'dexie'; * @returns The found ID, or undefined if no ID could be found. */ function find_object_id( - obj: any, - table_name: string, - log_lvl: number + 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) { - if (obj[key]) { - if (key !== 'id' && log_lvl > 0) { - console.warn( - `Found legacy ID key "${key}" for table "${table_name}". Consider standardizing to "id".`, - obj - ); - } - return obj[key]; - } - } + for (const key of potential_keys) { + if (obj[key]) { + if (key !== 'id' && log_lvl > 0) { + console.warn( + `Found legacy ID key "${key}" for table "${table_name}". Consider standardizing to "id".`, + obj + ); + } + return obj[key]; + } + } - console.error(`Object is missing a valid ID for table "${table_name}". It will be skipped.`, obj); - return undefined; + console.error( + `Object is missing a valid ID for table "${table_name}". It will be skipped.`, + obj + ); + return undefined; } /** @@ -46,74 +49,74 @@ function find_object_id( * @since 2025-11-13 */ export async function db_save_ae_obj_li__ae_obj>({ - db_instance, - table_name, - obj_li, - properties_to_save, - log_lvl = 0 + db_instance, + table_name, + obj_li, + properties_to_save, + log_lvl = 0 }: { - db_instance: Dexie; - table_name: string; - obj_li: T[]; - properties_to_save: (keyof T)[]; - log_lvl?: number; + db_instance: Dexie; + table_name: string; + obj_li: T[]; + properties_to_save: (keyof T)[]; + log_lvl?: number; }) { - if (log_lvl > 0) { - console.log( - `*** db_save_ae_obj_li__ae_obj: Attempting to save ${obj_li.length} objects to table "${table_name}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** db_save_ae_obj_li__ae_obj: Attempting to save ${obj_li.length} objects to table "${table_name}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to save.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to save.'); + return []; + } - const db_table: Table = db_instance.table(table_name); - if (!db_table) { - const error_msg = `Table not found in Dexie instance: ${table_name}`; - console.error(error_msg); - throw new Error(error_msg); - } + const db_table: Table = db_instance.table(table_name); + if (!db_table) { + const error_msg = `Table not found in Dexie instance: ${table_name}`; + console.error(error_msg); + throw new Error(error_msg); + } - const data_to_save = obj_li - .map((obj) => { - const record: Partial = {}; + const data_to_save = obj_li + .map((obj) => { + const record: Partial = {}; - // Extract only the specified properties to save. - for (const prop of properties_to_save) { - record[prop] = obj[prop]; - } + // Extract only the specified properties to save. + for (const prop of properties_to_save) { + record[prop] = obj[prop]; + } - // Ensure the primary key is included, attempting to find it from various legacy keys. - const id = find_object_id(obj, table_name, log_lvl); + // Ensure the primary key is included, attempting to find it from various legacy keys. + const id = find_object_id(obj, table_name, log_lvl); - if (id === undefined) { - return null; // Skip objects without a valid ID. - } + if (id === undefined) { + return null; // Skip objects without a valid ID. + } - (record as any).id = id; - return record; - }) - .filter(Boolean) as T[]; + (record as any).id = id; + return record; + }) + .filter(Boolean) as T[]; - if (data_to_save.length === 0) { - if (log_lvl > 0) { - console.warn('All objects were skipped, likely due to missing IDs.'); - } - return []; - } + if (data_to_save.length === 0) { + if (log_lvl > 0) { + console.warn('All objects were skipped, likely due to missing IDs.'); + } + return []; + } - try { - // bulkPut efficiently handles both inserts and updates. - const keys = await db_table.bulkPut(data_to_save); - if (log_lvl > 0) { - console.log(`Successfully saved ${keys.length} objects to "${table_name}".`); - } - return keys; - } catch (error) { - console.error(`Failed to save objects to "${table_name}":`, error); - // Re-throw the error to let the caller handle it. - throw error; - } + try { + // bulkPut efficiently handles both inserts and updates. + const keys = await db_table.bulkPut(data_to_save); + if (log_lvl > 0) { + console.log(`Successfully saved ${keys.length} objects to "${table_name}".`); + } + return keys; + } catch (error) { + console.error(`Failed to save objects to "${table_name}":`, error); + // Re-throw the error to let the caller handle it. + throw error; + } } diff --git a/src/lib/ae_core/core__person.ts b/src/lib/ae_core/core__person.ts index fe334ff7..e4c9b567 100644 --- a/src/lib/ae_core/core__person.ts +++ b/src/lib/ae_core/core__person.ts @@ -8,634 +8,634 @@ const ae_promises: key_val = {}; // Updated 2025-06-10 export async function load_ae_obj_id__person({ - api_cfg, - person_id, - params = {}, - try_cache = false, - log_lvl = 0 + api_cfg, + person_id, + params = {}, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - person_id: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + person_id: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__person() *** person_id=${person_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__person() *** person_id=${person_id}`); + } - ae_promises.load__person_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'person', - obj_id: person_id, - use_alt_table: false, - use_alt_base: false, - params: params, - log_lvl: log_lvl - }) - .then(async function (person_obj_get_result) { - if (person_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__person_props({ - obj_li: [person_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_core, - table_name: 'person', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__person_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'person', + obj_id: person_id, + use_alt_table: false, + use_alt_base: false, + params: params, + log_lvl: log_lvl + }) + .then(async function (person_obj_get_result) { + if (person_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__person_props({ + obj_li: [person_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_core, + table_name: 'person', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__person({ - // obj_type: 'person', - // obj_li: [person_obj_get_result], - // log_lvl: log_lvl - // }); - } - return person_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__person({ + // obj_type: 'person', + // obj_li: [person_obj_get_result], + // log_lvl: log_lvl + // }); + } + return person_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__person_obj:', ae_promises.load__person_obj); - } + if (log_lvl) { + console.log('ae_promises.load__person_obj:', ae_promises.load__person_obj); + } - return ae_promises.load__person_obj; + return ae_promises.load__person_obj; } // Updated 2025-06-10 export async function load_ae_obj_li__person({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - qry_email = null, - qry_user_id = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = [ - { family_name: 'ASC' }, - { given_name: 'ASC' }, - { updated_on: 'DESC' }, - { created_on: 'DESC' } - ], - // params_json = {}, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + qry_email = null, + qry_user_id = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = [ + { family_name: 'ASC' }, + { given_name: 'ASC' }, + { updated_on: 'DESC' }, + { created_on: 'DESC' } + ], + // params_json = {}, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - qry_email?: string | null; - qry_user_id?: string | null; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - order_by_li?: { [key: string]: 'ASC' | 'DESC' }[] | null; - // params_json?: null|key_val, - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + qry_email?: string | null; + qry_user_id?: string | null; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + order_by_li?: { [key: string]: 'ASC' | 'DESC' }[] | null; + // params_json?: null|key_val, + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - 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}` - ); - } + 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}` + ); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - // console.log('params_json:', params_json); - if (qry_user_id) { - // params_json['and_qry'] = {}; - // params_json['and_qry']['user_id_random'] = qry_user_id; + // console.log('params_json:', params_json); + if (qry_user_id) { + // params_json['and_qry'] = {}; + // params_json['and_qry']['user_id_random'] = qry_user_id; - params_json['qry'] = []; + params_json['qry'] = []; - const qry_param = { - type: 'AND', - field: 'user_id_random', - operator: '=', - value: qry_user_id - }; - params_json['qry'].push(qry_param); - } + const qry_param = { + type: 'AND', + field: 'user_id_random', + operator: '=', + value: qry_user_id + }; + params_json['qry'].push(qry_param); + } - if (log_lvl) { - console.log('params_json:', params_json); - } + if (log_lvl) { + console.log('params_json:', params_json); + } - ae_promises.load__person_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'person', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (person_obj_li_get_result) { - if (person_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__person_props({ - obj_li: person_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_core, - table_name: 'person', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__person_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'person', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (person_obj_li_get_result) { + if (person_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__person_props({ + obj_li: person_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_core, + table_name: 'person', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__person({ - // obj_type: 'person', - // obj_li: person_obj_li_get_result, - // log_lvl: log_lvl - // }); - } - return person_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__person({ + // obj_type: 'person', + // obj_li: person_obj_li_get_result, + // log_lvl: log_lvl + // }); + } + return person_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - console.log('ae_promises.load__person_obj_li:', ae_promises.load__person_obj_li); - return ae_promises.load__person_obj_li; + console.log('ae_promises.load__person_obj_li:', ae_promises.load__person_obj_li); + return ae_promises.load__person_obj_li; } // Updated 2025-06-10 export async function create_ae_obj__person({ - api_cfg, - user_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + user_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - user_id?: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + user_id?: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__person() *** user_id=${user_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__person() *** user_id=${user_id}`); + } - ae_promises.create__person = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'person', - fields: { - user_id_random: user_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (person_obj_create_result) { - if (person_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__person_props({ - obj_li: [person_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_core, - table_name: 'person', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__person = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'person', + fields: { + user_id_random: user_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (person_obj_create_result) { + if (person_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__person_props({ + obj_li: [person_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_core, + table_name: 'person', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__person( - // { - // obj_type: 'person', - // obj_li: [person_obj_create_result], - // log_lvl: log_lvl - // }); - } - return person_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__person( + // { + // obj_type: 'person', + // obj_li: [person_obj_create_result], + // log_lvl: log_lvl + // }); + } + return person_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__person:', ae_promises.create__person); - } - return ae_promises.create__person; + if (log_lvl) { + console.log('ae_promises.create__person:', ae_promises.create__person); + } + return ae_promises.create__person; } // Updated 2025-05-10 export async function delete_ae_obj_id__person({ - api_cfg, - person_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + person_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - person_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + person_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__person() *** person_id=${person_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__person() *** person_id=${person_id}`); + } - ae_promises.delete__person_obj = await api - .delete_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'person', - obj_id: person_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(async function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for person_id=${person_id}`); - } - await db_core.person.delete(person_id); - } - }); + ae_promises.delete__person_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'person', + obj_id: person_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(async function () { + if (try_cache) { + if (log_lvl) { + console.log(`Attempting to remove IDB entry for person_id=${person_id}`); + } + await db_core.person.delete(person_id); + } + }); - if (log_lvl) { - console.log('ae_promises.delete__person_obj:', ae_promises.delete__person_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__person_obj:', ae_promises.delete__person_obj); + } - return ae_promises.delete__person_obj; + return ae_promises.delete__person_obj; } // Updated 2025-06-10 export async function update_ae_obj__person({ - api_cfg, - person_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + person_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - person_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + person_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** update_ae_obj__person() *** person_id=${person_id}`, data_kv); - } + if (log_lvl) { + console.log(`*** update_ae_obj__person() *** person_id=${person_id}`, data_kv); + } - // log_lvl = 1; + // log_lvl = 1; - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'person', - obj_id: person_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'person', + obj_id: person_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__person_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_core, - table_name: 'person', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__person_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_core, + table_name: 'person', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__person({ - // obj_type: 'person', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update person.'); - return null; - } + // await db_save_ae_obj_li__person({ + // obj_type: 'person', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update person.'); + return null; + } } // Updated 2024-06-10 export function db_save_ae_obj_li__person({ - obj_type, - obj_li, - log_lvl = 0 + obj_type, + obj_li, + log_lvl = 0 }: { - obj_type: string; - obj_li: any; - log_lvl?: number; + obj_type: string; + obj_li: any; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** db_save_ae_obj_li__person() ***`); - } + if (log_lvl) { + console.log(`*** db_save_ae_obj_li__person() ***`); + } - if (obj_li && obj_li.length) { - obj_li.forEach(async function (obj: any) { - if (log_lvl) { - console.log(`ae_obj ${obj_type}:`, obj); - } + if (obj_li && obj_li.length) { + obj_li.forEach(async function (obj: any) { + if (log_lvl) { + console.log(`ae_obj ${obj_type}:`, obj); + } - const obj_record = { - id: obj.person_id_random, - // id_random: obj.person_id_random, - person_id: obj.person_id_random, - person_id_random: obj.person_id_random, + const obj_record = { + id: obj.person_id_random, + // id_random: obj.person_id_random, + person_id: obj.person_id_random, + person_id_random: obj.person_id_random, - external_id: obj.external_id, - external_sys_id: obj.external_sys_id, - code: obj.code, + external_id: obj.external_id, + external_sys_id: obj.external_sys_id, + code: obj.code, - account_id: obj.account_id_random, - account_id_random: obj.account_id_random, + account_id: obj.account_id_random, + account_id_random: obj.account_id_random, - person_profile_id: obj.person_profile_id_random, - person_profile_id_random: obj.person_profile_id_random, // The new table person_profile will be used soon... + person_profile_id: obj.person_profile_id_random, + person_profile_id_random: obj.person_profile_id_random, // The new table person_profile will be used soon... - user_id: obj.user_id_random, - user_id_random: obj.user_id_random, + user_id: obj.user_id_random, + user_id_random: obj.user_id_random, - pronouns: obj.pronouns, - informal_name: obj.informal_name, - title_names: obj.title_names, - given_name: obj.given_name, - middle_name: obj.middle_name, - family_name: obj.family_name, - designations: obj.designations, + pronouns: obj.pronouns, + informal_name: obj.informal_name, + title_names: obj.title_names, + given_name: obj.given_name, + middle_name: obj.middle_name, + family_name: obj.family_name, + designations: obj.designations, - professional_title: obj.professional_title, + professional_title: obj.professional_title, - full_name: obj.full_name, - full_name_override: obj.full_name_override, // was display_name and display_name_override + full_name: obj.full_name, + full_name_override: obj.full_name_override, // was display_name and display_name_override - affiliations: obj.affiliations, + affiliations: obj.affiliations, - primary_email: obj.primary_email, + primary_email: obj.primary_email, - biography: obj.biography, + biography: obj.biography, - agree: obj.agree, - comments: obj.comments, + agree: obj.agree, + comments: obj.comments, - allow_auth_key: obj.allow_auth_key, // For sign in without password - // auth_key: obj.auth_key, - passcode: obj.passcode, + allow_auth_key: obj.allow_auth_key, // For sign in without password + // auth_key: obj.auth_key, + passcode: obj.passcode, - data_json: obj.data_json, + data_json: obj.data_json, - enable: obj.enable, - hide: obj.hide, - priority: obj.priority, - sort: obj.sort, - group: obj.group, - notes: obj.notes, - created_on: obj.created_on, - updated_on: obj.updated_on, + enable: obj.enable, + hide: obj.hide, + priority: obj.priority, + sort: obj.sort, + group: obj.group, + notes: obj.notes, + created_on: obj.created_on, + updated_on: obj.updated_on, - // From SQL view - username: obj.username, - user_name: obj.user_name, - user_email: obj.user_email, - user_allow_auth_key: obj.user_allow_auth_key, // For sign in without password - user_super: obj.user_super, - user_manager: obj.user_manager, - user_administrator: obj.user_administrator, - user_public: obj.user_public - }; + // From SQL view + username: obj.username, + user_name: obj.user_name, + user_email: obj.user_email, + user_allow_auth_key: obj.user_allow_auth_key, // For sign in without password + user_super: obj.user_super, + user_manager: obj.user_manager, + user_administrator: obj.user_administrator, + user_public: obj.user_public + }; - let id_random = null; + let id_random = null; - try { - id_random = await db_core.person.update(obj_record.id, obj_record); - } catch (error) { - console.log(`Error: Failed to update ${obj_record.id}: ${error}`); - } - if (!id_random) { - if (log_lvl) { - console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); - } - try { - id_random = await db_core.person.put(obj_record); - } catch (error) { - console.log(`Error: Failed to put ${obj.person_id_random}: ${error}`); - } - } else { - if (log_lvl) { - console.log(`Updated record with ID: ${obj_record.id}`); - } - } - if (!id_random) { - console.log(`Failed to save record with ID: ${obj_record.id}`); - } else { - if (log_lvl) { - console.log(`Saved record with ID: ${obj_record.id}`); - } - } - }); + try { + id_random = await db_core.person.update(obj_record.id, obj_record); + } catch (error) { + console.log(`Error: Failed to update ${obj_record.id}: ${error}`); + } + if (!id_random) { + if (log_lvl) { + console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); + } + try { + id_random = await db_core.person.put(obj_record); + } catch (error) { + console.log(`Error: Failed to put ${obj.person_id_random}: ${error}`); + } + } else { + if (log_lvl) { + console.log(`Updated record with ID: ${obj_record.id}`); + } + } + if (!id_random) { + console.log(`Failed to save record with ID: ${obj_record.id}`); + } else { + if (log_lvl) { + console.log(`Saved record with ID: ${obj_record.id}`); + } + } + }); - return true; - } + return true; + } } // Updated 2025-06-10 const properties_to_save = [ - 'id', - 'person_id', - // 'person_id_random', + 'id', + 'person_id', + // 'person_id_random', - 'external_id', - 'external_sys_id', - 'code', + 'external_id', + 'external_sys_id', + 'code', - 'account_id', - // 'account_id_random', + 'account_id', + // 'account_id_random', - 'person_profile_id', - // 'person_profile_id_random', // The new table person_profile will be used soon... + 'person_profile_id', + // 'person_profile_id_random', // The new table person_profile will be used soon... - 'user_id', - // 'user_id_random', + 'user_id', + // 'user_id_random', - 'pronouns', - 'informal_name', - 'title_names', - 'given_name', - 'middle_name', - 'family_name', - 'designations', + 'pronouns', + 'informal_name', + 'title_names', + 'given_name', + 'middle_name', + 'family_name', + 'designations', - 'professional_title', + 'professional_title', - 'full_name', - 'full_name_override', // was display_name and display_name_override + 'full_name', + 'full_name_override', // was display_name and display_name_override - 'affiliations', - 'primary_email', - 'biography', - 'agree', - 'comments', + 'affiliations', + 'primary_email', + 'biography', + 'agree', + 'comments', - 'allow_auth_key', // For sign in without password - // 'auth_key', // Should this be saved locally? - 'passcode', + 'allow_auth_key', // For sign in without password + // 'auth_key', // Should this be saved locally? + 'passcode', - // 'passcode_timeout', - // 'passcode_read', // For LLM (AI) generated summary...??? - // 'passcode_read_expire', - // 'passcode_write', - // 'passcode_write_expire', - // 'private_passcode', + // 'passcode_timeout', + // 'passcode_read', // For LLM (AI) generated summary...??? + // 'passcode_read_expire', + // 'passcode_write', + // 'passcode_write_expire', + // 'private_passcode', - // 'alert', - // 'alert_msg', + // 'alert', + // 'alert_msg', - 'data_json', + 'data_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - 'tmp_sort_3', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + 'tmp_sort_3', - // From SQL view - 'username', - // 'user_username', // Same as username - 'user_name', - 'user_email', - 'user_allow_auth_key', // For sign in without password - 'user_super', - 'user_manager', - 'user_administrator', - 'user_public', + // From SQL view + 'username', + // 'user_username', // Same as username + 'user_name', + 'user_email', + 'user_allow_auth_key', // For sign in without password + 'user_super', + 'user_manager', + 'user_administrator', + 'user_public', - 'organization_id', - // 'organization_id_random', - 'organization_name', + 'organization_id', + // 'organization_id_random', + 'organization_name', - 'contact_id', - // 'contact_id_random', - 'contact_name', - 'contact_email', - 'contact_cc_email', - 'contact_phone_mobile', - 'contact_phone_home', - 'contact_phone_office', - 'contact_phone_land', - 'contact_phone_fax', - 'contact_phone_other', + 'contact_id', + // 'contact_id_random', + 'contact_name', + 'contact_email', + 'contact_cc_email', + 'contact_phone_mobile', + 'contact_phone_home', + 'contact_phone_office', + 'contact_phone_land', + 'contact_phone_fax', + 'contact_phone_other', - 'address_id', - // 'address_id_random', - 'address_city', - 'address_country_alpha_2_code' // contact_address_country_alpha_2_code + 'address_id', + // 'address_id_random', + 'address_city', + 'address_country_alpha_2_code' // contact_address_country_alpha_2_code ]; /** @@ -643,94 +643,94 @@ const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const new_key = key.slice(0, -7); // Remove '_random' suffix - (processed_obj as any)[new_key] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const random_id_key = `${obj_type}_id_random`; - if (processed_obj[random_id_key]) { - (processed_obj as any).id = processed_obj[random_id_key]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const new_key = key.slice(0, -7); // Remove '_random' suffix + (processed_obj as any)[new_key] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const random_id_key = `${obj_type}_id_random`; + if (processed_obj[random_id_key]) { + (processed_obj as any).id = processed_obj[random_id_key]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-06-10 export async function process_ae_obj__person_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'person', - log_lvl, - specific_processor: (obj) => { - // Person-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${ - obj.sort ?? '0' - }_${obj.updated_on}_${obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${ - obj.sort ?? '0' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_3 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${ - obj.sort ?? '0' - }_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'person', + log_lvl, + specific_processor: (obj) => { + // Person-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${ + obj.sort ?? '0' + }_${obj.updated_on}_${obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${ + obj.sort ?? '0' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_3 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${ + obj.sort ?? '0' + }_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_core/core__qr_code.ts b/src/lib/ae_core/core__qr_code.ts index 9a6131a7..0a200770 100644 --- a/src/lib/ae_core/core__qr_code.ts +++ b/src/lib/ae_core/core__qr_code.ts @@ -10,138 +10,138 @@ const ae_promises: key_val = {}; // I recently made significant updates to this with the help of Copilot. I think it is correct. // Updated 2025-10-03 export async function generate_qr_code({ - api_cfg, - account_id, - qr_type, // mecard, obj, str, vcard - qr_id, // This is essentially the filename it can be found at /qr/{account_id}/{qr_id} - qr_data, // vcard fields: - obj_type, - obj_id, - str, // For encoding a string (like a URL) into a QR code. - return_blob = true, // blob or url? - try_cache = false, - log_lvl = 0 + api_cfg, + account_id, + qr_type, // mecard, obj, str, vcard + qr_id, // This is essentially the filename it can be found at /qr/{account_id}/{qr_id} + qr_data, // vcard fields: + obj_type, + obj_id, + str, // For encoding a string (like a URL) into a QR code. + return_blob = true, // blob or url? + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - qr_type: string; - qr_id: string; - qr_data?: any; - obj_type?: string; - obj_id?: string; - str?: string; - return_blob?: boolean; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + qr_type: string; + qr_id: string; + qr_data?: any; + obj_type?: string; + obj_id?: string; + str?: string; + return_blob?: boolean; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** generate_qr_code() *** qr_id=${qr_id}`); - } + if (log_lvl) { + console.log(`*** generate_qr_code() *** qr_id=${qr_id}`); + } - const endpoint = `/qr/${account_id}/${qr_id}`; - if (log_lvl) { - console.log('Endpoint', endpoint); - } - const params: key_val = { - regen: true, // Regenerate the file even if nothing has changed. - return_file: return_blob, - qr_type: qr_type, // mecard, obj, vcard - qr_send: return_blob - }; + const endpoint = `/qr/${account_id}/${qr_id}`; + if (log_lvl) { + console.log('Endpoint', endpoint); + } + const params: key_val = { + regen: true, // Regenerate the file even if nothing has changed. + return_file: return_blob, + qr_type: qr_type, // mecard, obj, vcard + qr_send: return_blob + }; - if (qr_type == 'vcard') { - if (qr_data.informal_name) { - params['n'] = `${qr_data.family_name};${qr_data.given_name};${qr_data.informal_name}`; - } else { - params['n'] = `${qr_data.family_name};${qr_data.given_name}`; - } - params['fn'] = qr_data.full_name_override; - if (qr_data.affiliations) { - params['org'] = qr_data.affiliations; - } - params['email'] = qr_data.email; - if (qr_data.phone) { - params['tel'] = qr_data.phone; - } - params['adr'] = qr_data.location_override; - if (qr_data.address_line_1) { - params['adr_str'] = qr_data.address_line_1; - } - params['adr_loc'] = qr_data.city; - params['adr_reg'] = qr_data.state_province; - params['adr_postal'] = qr_data.postal_code; - params['adr_country'] = qr_data.country; - } else if (qr_type == 'obj') { - params['obj_type'] = obj_type; - params['obj_id'] = obj_id; - } else if (qr_type == 'str') { - params['str'] = str; - } + if (qr_type == 'vcard') { + if (qr_data.informal_name) { + params['n'] = `${qr_data.family_name};${qr_data.given_name};${qr_data.informal_name}`; + } else { + params['n'] = `${qr_data.family_name};${qr_data.given_name}`; + } + params['fn'] = qr_data.full_name_override; + if (qr_data.affiliations) { + params['org'] = qr_data.affiliations; + } + params['email'] = qr_data.email; + if (qr_data.phone) { + params['tel'] = qr_data.phone; + } + params['adr'] = qr_data.location_override; + if (qr_data.address_line_1) { + params['adr_str'] = qr_data.address_line_1; + } + params['adr_loc'] = qr_data.city; + params['adr_reg'] = qr_data.state_province; + params['adr_postal'] = qr_data.postal_code; + params['adr_country'] = qr_data.country; + } else if (qr_type == 'obj') { + params['obj_type'] = obj_type; + params['obj_id'] = obj_id; + } else if (qr_type == 'str') { + params['str'] = str; + } - if (log_lvl) { - console.log('Params', params); - } + if (log_lvl) { + console.log('Params', params); + } - const filename = null; + const filename = null; - // Await the API call - ae_promises.generate_qr_code = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - return_blob: return_blob, - filename: filename, - auto_download: false, - log_lvl: log_lvl - }); + // Await the API call + ae_promises.generate_qr_code = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + return_blob: return_blob, + filename: filename, + auto_download: false, + log_lvl: log_lvl + }); - if (log_lvl) { - console.log('QR code API response:', ae_promises.generate_qr_code); - } + if (log_lvl) { + console.log('QR code API response:', ae_promises.generate_qr_code); + } - // If return_blob is true, ensure we return an object URL for use in - if (return_blob) { - const data = ae_promises.generate_qr_code.data ?? ae_promises.generate_qr_code; + // If return_blob is true, ensure we return an object URL for use in + if (return_blob) { + const data = ae_promises.generate_qr_code.data ?? ae_promises.generate_qr_code; - // If already a Blob, use it directly - if (data instanceof Blob) { - return URL.createObjectURL(data); - } + // If already a Blob, use it directly + if (data instanceof Blob) { + return URL.createObjectURL(data); + } - // If it's a Response (from fetch), convert to Blob - if (data instanceof Response) { - const blob = await data.blob(); - return URL.createObjectURL(blob); - } + // If it's a Response (from fetch), convert to Blob + if (data instanceof Response) { + const blob = await data.blob(); + return URL.createObjectURL(blob); + } - // If it's an ArrayBuffer or Uint8Array, convert to Blob - if (data instanceof ArrayBuffer || data instanceof Uint8Array) { - const blob = new Blob([data], { type: 'image/png' }); - return URL.createObjectURL(blob); - } + // If it's an ArrayBuffer or Uint8Array, convert to Blob + if (data instanceof ArrayBuffer || data instanceof Uint8Array) { + const blob = new Blob([data], { type: 'image/png' }); + return URL.createObjectURL(blob); + } - // If it's a base64 string, return as data URL - if (typeof data === 'string' && data.startsWith('data:image')) { - return data; - } + // If it's a base64 string, return as data URL + if (typeof data === 'string' && data.startsWith('data:image')) { + return data; + } - // If it's a raw string (base64), convert to data URL - if (typeof data === 'string') { - return `data:image/png;base64,${data}`; - } + // If it's a raw string (base64), convert to data URL + if (typeof data === 'string') { + return `data:image/png;base64,${data}`; + } - // Fallback: try to create a Blob from whatever is left - try { - const blob = new Blob([data], { type: 'image/png' }); - return URL.createObjectURL(blob); - } catch (e) { - if (log_lvl) console.error('Could not create QR code image blob:', e, data); - return null; - } - } + // Fallback: try to create a Blob from whatever is left + try { + const blob = new Blob([data], { type: 'image/png' }); + return URL.createObjectURL(blob); + } catch (e) { + if (log_lvl) console.error('Could not create QR code image blob:', e, data); + return null; + } + } - // If not returning a blob, return the raw API response - return ae_promises.generate_qr_code; + // If not returning a blob, return the raw API response + return ae_promises.generate_qr_code; } // Updated 2025-10-09 @@ -159,105 +159,105 @@ export async function generate_qr_code({ * @throws {Error} If the qr_type is unknown or data is missing. */ export async function js_generate_qr_code(qr_type, params = {}) { - const { - n = '', - fn = '', - 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; + const { + n = '', + fn = '', + 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; - console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params); + console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params); - let qr_data = null; + let qr_data = null; - // --- 1. Replicate Data Formatting Logic --- - switch (qr_type) { - case 'mecard': - // Format: MECARD:N:name;EMAIL:email;ADR:address;; - // Note: The original Python code had adr, but we'll use n and email as a minimum. - qr_data = `MECARD:N:${n};EMAIL:${email};;`; - // You can enhance this with other MeCard fields if needed. - break; + // --- 1. Replicate Data Formatting Logic --- + switch (qr_type) { + case 'mecard': + // Format: MECARD:N:name;EMAIL:email;ADR:address;; + // Note: The original Python code had adr, but we'll use n and email as a minimum. + qr_data = `MECARD:N:${n};EMAIL:${email};;`; + // You can enhance this with other MeCard fields if needed. + break; - case 'vcard': - // Format: BEGIN:VCARD...END:VCARD - qr_data = `BEGIN:VCARD\nVERSION:3.0\nN:${n}\nFN:${fn}\nORG:${org}\nEMAIL:${email}\n`; + case 'vcard': + // Format: BEGIN:VCARD...END:VCARD + qr_data = `BEGIN:VCARD\nVERSION:3.0\nN:${n}\nFN:${fn}\nORG:${org}\nEMAIL:${email}\n`; - if (url) { - qr_data += `URL:${url}\n`; - } - if (tel) { - qr_data += `TEL:${tel}\n`; - } - if (adr_loc) { - // 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`; - } - qrData += 'END:VCARD'; - break; + if (url) { + qr_data += `URL:${url}\n`; + } + if (tel) { + qr_data += `TEL:${tel}\n`; + } + if (adr_loc) { + // 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`; + } + qrData += 'END:VCARD'; + break; - case 'obj': - // Custom format: OBJ:ot:obj_type,oi:obj_id - if (!obj_type || !obj_id) throw new Error('Missing obj_type or obj_id for type "obj".'); - qr_data = `OBJ:ot:${obj_type},oi:${obj_id}`; - break; + case 'obj': + // Custom format: OBJ:ot:obj_type,oi:obj_id + if (!obj_type || !obj_id) throw new Error('Missing obj_type or obj_id for type "obj".'); + qr_data = `OBJ:ot:${obj_type},oi:${obj_id}`; + break; - case 'kv': - // Custom format: KV:k:"key",v:"val" - if (!key || !val) throw new Error('Missing key or val for type "kv".'); - qr_data = `KV:k:"${key}",v:"${val}"`; - break; + case 'kv': + // Custom format: KV:k:"key",v:"val" + if (!key || !val) throw new Error('Missing key or val for type "kv".'); + qr_data = `KV:k:"${key}",v:"${val}"`; + break; - case 'js': - // Assumes 'js' is a stringified JSON object - if (!js) throw new Error('Missing js string for type "js".'); - qr_data = `JS:${js}`; - break; + case 'js': + // Assumes 'js' is a stringified JSON object + if (!js) throw new Error('Missing js string for type "js".'); + qr_data = `JS:${js}`; + break; - case 'str': - // Raw string data - if (!str) throw new Error('Missing raw string data for type "str".'); - qr_data = str; - break; + case 'str': + // Raw string data + if (!str) throw new Error('Missing raw string data for type "str".'); + qr_data = str; + break; - default: - throw new Error(`Unknown QR type: ${qr_type}`); - } + default: + throw new Error(`Unknown QR type: ${qr_type}`); + } - if (!qr_data) { - throw new Error('Failed to create QR code data string.'); - } + if (!qr_data) { + throw new Error('Failed to create QR code data string.'); + } - // --- 2. Generate QR Code Image --- - try { - // Options match the Python 'qrcode' library defaults closely: - // error_correction = qrcode.constants.ERROR_CORRECT_M - // box_size = 10, border = 1 - const data_url = await QRCode.toDataURL(qr_data, { - errorCorrectionLevel: 'M', - margin: 1, // Corresponds to border - scale: 10, // Corresponds to box_size - type: 'image/png' - }); - console.log('Generated QR code data URL:', data_url); - return data_url; - } catch (error) { - console.error('Error generating QR code:', error); - throw new Error('Could not generate QR code image.'); - } + // --- 2. Generate QR Code Image --- + try { + // Options match the Python 'qrcode' library defaults closely: + // error_correction = qrcode.constants.ERROR_CORRECT_M + // box_size = 10, border = 1 + const data_url = await QRCode.toDataURL(qr_data, { + errorCorrectionLevel: 'M', + margin: 1, // Corresponds to border + scale: 10, // Corresponds to box_size + type: 'image/png' + }); + console.log('Generated QR code data URL:', data_url); + return data_url; + } catch (error) { + console.error('Error generating QR code:', error); + throw new Error('Could not generate QR code image.'); + } } diff --git a/src/lib/ae_core/core__site.ts b/src/lib/ae_core/core__site.ts index b1502676..133bd9b6 100644 --- a/src/lib/ae_core/core__site.ts +++ b/src/lib/ae_core/core__site.ts @@ -1,50 +1,50 @@ export interface Site { - id: string; - // id_random: string; - site_id: string; - site_id_random?: string; + id: string; + // id_random: string; + site_id: string; + site_id_random?: string; - code?: string; + code?: string; - account_id: string; - account_id_random?: string; + account_id: string; + account_id_random?: string; - name: string; - description?: null | string; + name: string; + description?: null | string; - restrict_access?: null | boolean; - access_key?: null | string; - access_code_kv_json?: null | string; + restrict_access?: null | boolean; + access_key?: null | string; + access_code_kv_json?: null | string; - logo_path?: null | string; - logo_bg_color?: null | string; // Not really used currently. - // background_image_path?: null|string; // Legacy field - // background_bg_color?: null|string; // Legacy field - title?: null | string; + logo_path?: null | string; + logo_bg_color?: null | string; // Not really used currently. + // background_image_path?: null|string; // Legacy field + // background_bg_color?: null|string; // Legacy field + title?: null | string; - // header_html?: null|string; // Legacy field - // header_css?: null|string; // Legacy field - // header_image_path?: null|string; // Legacy field - // header_image_bg_color?: null|string; // Legacy field - // body_html?: null|string; // Legacy field - tagline?: null | string; - // site_header_h1?: null|string; // Legacy field - // site_header_h2?: null|string; // Legacy field - style_href?: null | string; // Legacy field - // script_src?: null|string; // Legacy field - google_tracking_id?: null | string; + // header_html?: null|string; // Legacy field + // header_css?: null|string; // Legacy field + // header_image_path?: null|string; // Legacy field + // header_image_bg_color?: null|string; // Legacy field + // body_html?: null|string; // Legacy field + tagline?: null | string; + // site_header_h1?: null|string; // Legacy field + // site_header_h2?: null|string; // Legacy field + style_href?: null | string; // Legacy field + // script_src?: null|string; // Legacy field + google_tracking_id?: null | string; - cfg_json?: null | string; // key value config json + cfg_json?: null | string; // key value config json - enable: null | boolean; - enable_from?: null | Date; - enable_to?: null | Date; + enable: null | boolean; + enable_from?: null | Date; + enable_to?: null | Date; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; } diff --git a/src/lib/ae_core/core__site_domain.ts b/src/lib/ae_core/core__site_domain.ts index fc5129da..680df1cd 100644 --- a/src/lib/ae_core/core__site_domain.ts +++ b/src/lib/ae_core/core__site_domain.ts @@ -1,22 +1,22 @@ export interface Site_Domain { - id: string; - // id_random: string; - site_id: string; - site_id_random?: string; + id: string; + // id_random: string; + site_id: string; + site_id_random?: string; - fqdn: string; - access_key?: null | string; - required_referrer?: null | string; - valid_for?: null | number; // In hours + fqdn: string; + access_key?: null | string; + required_referrer?: null | string; + valid_for?: null | number; // In hours - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; } import { api } from '$lib/api/api'; @@ -31,45 +31,45 @@ import { api } from '$lib/api/api'; * @returns The site domain object or null if not found. */ export async function load_ae_obj_by_fqdn__site_domain({ - api_cfg, - fqdn, - timeout = 7000, - log_lvl = 0 + api_cfg, + fqdn, + timeout = 7000, + log_lvl = 0 }: { - api_cfg: any; - fqdn: string; - timeout?: number; - log_lvl?: number; + api_cfg: any; + fqdn: string; + timeout?: number; + log_lvl?: number; }): Promise { - if (log_lvl) { - console.log( - `*** load_ae_obj_by_fqdn__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_by_fqdn__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}` + ); + } - const params = {}; + const params = {}; - try { - const site_domain_obj = await api.get_ae_obj_id_crud({ - api_cfg: api_cfg, - no_account_id: true, // This seems to be a special case for this endpoint - obj_type: 'site_domain', - obj_id: fqdn, // NOTE: This is the FQDN, not the ID. - use_alt_table: true, - use_alt_base: true, - params: params, - timeout: timeout, - log_lvl: log_lvl - }); + try { + const site_domain_obj = await api.get_ae_obj_id_crud({ + api_cfg: api_cfg, + no_account_id: true, // This seems to be a special case for this endpoint + obj_type: 'site_domain', + obj_id: fqdn, // NOTE: This is the FQDN, not the ID. + use_alt_table: true, + use_alt_base: true, + params: params, + timeout: timeout, + log_lvl: log_lvl + }); - if (site_domain_obj) { - return site_domain_obj; - } else { - console.log('No results returned.'); - return null; - } - } catch (error) { - console.log('No results returned or failed.', error); - return null; - } + if (site_domain_obj) { + return site_domain_obj; + } else { + console.log('No results returned.'); + return null; + } + } catch (error) { + console.log('No results returned or failed.', error); + return null; + } } diff --git a/src/lib/ae_core/core__time_zones.ts b/src/lib/ae_core/core__time_zones.ts index aa163bf9..06384263 100644 --- a/src/lib/ae_core/core__time_zones.ts +++ b/src/lib/ae_core/core__time_zones.ts @@ -7,66 +7,66 @@ const ae_promises: key_val = {}; // Updated 2024-10-14 export async function load_ae_obj_li__time_zone({ - api_cfg, - // account_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - // order_by_li = {'priority': 'DESC', 'group': 'ASC', 'sort': 'DESC', 'name': 'ASC'}, - order_by_li = { priority: 'DESC', sort: 'DESC', name: 'ASC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + // account_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + // order_by_li = {'priority': 'DESC', 'group': 'ASC', 'sort': 'DESC', 'name': 'ASC'}, + order_by_li = { priority: 'DESC', sort: 'DESC', name: 'ASC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - // account_id: string, - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + // account_id: string, + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_li__time_zone() ***`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_li__time_zone() ***`); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'lu', - for_obj_type: 'time_zone', - // for_obj_id: account_id, - use_alt_tbl: true, // NOTE: Using this with the time zones to use the view named "v_lu_time_zone_cust" - use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (time_zone_li_get_result) { - if (time_zone_li_get_result) { - // handle_db_save_ae_obj_li__time_zone({obj_type: 'time_zone', obj_li: time_zone_li_get_result}); - return time_zone_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__time_zone_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'lu', + for_obj_type: 'time_zone', + // for_obj_id: account_id, + use_alt_tbl: true, // NOTE: Using this with the time zones to use the view named "v_lu_time_zone_cust" + use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (time_zone_li_get_result) { + if (time_zone_li_get_result) { + // handle_db_save_ae_obj_li__time_zone({obj_type: 'time_zone', obj_li: time_zone_li_get_result}); + return time_zone_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - console.log('ae_promises.load__time_zone_li:', ae_promises.load__time_zone_li); - return ae_promises.load__time_zone_li; + console.log('ae_promises.load__time_zone_li:', ae_promises.load__time_zone_li); + return ae_promises.load__time_zone_li; } diff --git a/src/lib/ae_core/core__user.ts b/src/lib/ae_core/core__user.ts index c1fd67ea..071d8743 100644 --- a/src/lib/ae_core/core__user.ts +++ b/src/lib/ae_core/core__user.ts @@ -7,272 +7,272 @@ const ae_promises: key_val = {}; // Updated 2025-04-04 export async function auth_ae_obj__username_password({ - api_cfg, - account_id, - null_account_id = false, - username, - password, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + null_account_id = false, + username, + password, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - null_account_id?: boolean; - username: string; - password: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + null_account_id?: boolean; + username: string; + password: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** auth_ae_obj__username_password() *** account_id=${account_id} username=${username} password=${password}` - ); - } + if (log_lvl) { + console.log( + `*** auth_ae_obj__username_password() *** account_id=${account_id} username=${username} password=${password}` + ); + } - const endpoint = '/user/authenticate'; + const endpoint = '/user/authenticate'; - if (null_account_id) { - params['null_account_id'] = true; - } - params['username'] = username; // Required - params['password'] = password; // Required - if (log_lvl > 1) { - console.log(`auth_ae_obj__username_password() - params:`, params); - } + if (null_account_id) { + params['null_account_id'] = true; + } + params['username'] = username; // Required + params['password'] = password; // Required + if (log_lvl > 1) { + console.log(`auth_ae_obj__username_password() - params:`, params); + } - ae_promises.auth__username_password = await api - .get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - // data: {}, - log_lvl: log_lvl - }) - .then(async function (user_obj_get_result) { - if (user_obj_get_result) { - // if (try_cache) { - // // This is expecting a list - // db_save_ae_obj_li__user({ - // obj_type: 'user', - // obj_li: [user_obj_get_result], - // log_lvl: log_lvl - // }); - // } - return user_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.auth__username_password = await api + .get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + // data: {}, + log_lvl: log_lvl + }) + .then(async function (user_obj_get_result) { + if (user_obj_get_result) { + // if (try_cache) { + // // This is expecting a list + // db_save_ae_obj_li__user({ + // obj_type: 'user', + // obj_li: [user_obj_get_result], + // log_lvl: log_lvl + // }); + // } + return user_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.auth__username_password:', ae_promises.auth__username_password); - } - return ae_promises.auth__username_password; + if (log_lvl) { + console.log('ae_promises.auth__username_password:', ae_promises.auth__username_password); + } + return ae_promises.auth__username_password; } // Updated 2025-04-04 export async function auth_ae_obj__user_id_user_auth_key({ - api_cfg, - account_id, - user_id, - user_auth_key, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + user_id, + user_auth_key, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - user_id: string; - user_auth_key: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + user_id: string; + user_auth_key: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** auth_ae_obj__user_id_user_auth_key() *** account_id=${account_id} user_id=${user_id}` - ); - } + if (log_lvl) { + console.log( + `*** auth_ae_obj__user_id_user_auth_key() *** account_id=${account_id} user_id=${user_id}` + ); + } - const endpoint = '/user/authenticate'; + const endpoint = '/user/authenticate'; - params['user_id'] = user_id; // Required - params['auth_key'] = user_auth_key; // Required - if (log_lvl > 1) { - console.log(`auth_ae_obj__user_id_user_auth_key() - params:`, params); - } + params['user_id'] = user_id; // Required + params['auth_key'] = user_auth_key; // Required + if (log_lvl > 1) { + console.log(`auth_ae_obj__user_id_user_auth_key() - params:`, params); + } - ae_promises.auth__user_id_user_key = await api - .get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - log_lvl: log_lvl - }) - .then(async function (user_obj_get_result) { - if (user_obj_get_result) { - return user_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.auth__user_id_user_key = await api + .get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + log_lvl: log_lvl + }) + .then(async function (user_obj_get_result) { + if (user_obj_get_result) { + return user_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.auth__user_id_user_key:', ae_promises.auth__user_id_user_key); - } - return ae_promises.auth__user_id_user_key; + if (log_lvl) { + console.log('ae_promises.auth__user_id_user_key:', 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. // Updated 2025-04-08 export async function send_email_auth_ae_obj__user_id({ - api_cfg, - account_id, - user_id, - base_url, - key_param_name = 'user_key', // API defaults to 'auth_key' - params = {}, - // try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + user_id, + base_url, + key_param_name = 'user_key', // API defaults to 'auth_key' + params = {}, + // try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - user_id: string; - base_url?: string; - key_param_name?: string; - params?: key_val; - // try_cache?: boolean, - log_lvl?: number; + api_cfg: any; + account_id: string; + user_id: string; + base_url?: string; + key_param_name?: string; + params?: key_val; + // try_cache?: boolean, + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** send_email_auth_ae_obj__user_id() *** account_id=${account_id} user_id=${user_id}` - ); - } - if (log_lvl > 1) { - console.log(api_cfg); - } + if (log_lvl) { + console.log( + `*** send_email_auth_ae_obj__user_id() *** account_id=${account_id} user_id=${user_id}` + ); + } + if (log_lvl > 1) { + console.log(api_cfg); + } - const email_auth_key_endpoint = `user/${user_id}/email_auth_key_url`; - params = { - root_url: base_url, - key_param_name: key_param_name - }; - ae_promises.auth_key__send_email = await api.get_object({ - api_cfg: api_cfg, - endpoint: email_auth_key_endpoint, - params: params, - log_lvl: log_lvl - }); + const email_auth_key_endpoint = `user/${user_id}/email_auth_key_url`; + params = { + root_url: base_url, + key_param_name: key_param_name + }; + ae_promises.auth_key__send_email = await api.get_object({ + api_cfg: api_cfg, + endpoint: email_auth_key_endpoint, + params: params, + log_lvl: log_lvl + }); - return ae_promises.auth_key__send_email; + return ae_promises.auth_key__send_email; - // let endpoint = `/user/${user_id}/new_auth_key`; + // let endpoint = `/user/${user_id}/new_auth_key`; - // // params['user_id'] = user_id; // Required - // if (log_lvl > 1) { - // console.log(`send_email_auth_ae_obj__user_id() - params:`, params); - // } + // // params['user_id'] = user_id; // Required + // if (log_lvl > 1) { + // console.log(`send_email_auth_ae_obj__user_id() - params:`, params); + // } - // ae_promises.auth_key__gen_auth_key = await api.get_object({ - // api_cfg: api_cfg, - // endpoint: endpoint, - // params: params, - // log_lvl: log_lvl - // }) - // .then(async function (email_send_result) { - // if (email_send_result) { - // let email_auth_key_endpoint = `user/${user_id}/email_auth_key_url`; - // params = { - // 'root_url': 'https://test.oneskyit.com' - // } - // ae_promises.auth_key__send_email = await api.get_object({ - // api_cfg: api_cfg, - // endpoint: email_auth_key_endpoint, - // params: params, - // log_lvl: log_lvl - // }) + // ae_promises.auth_key__gen_auth_key = await api.get_object({ + // api_cfg: api_cfg, + // endpoint: endpoint, + // params: params, + // log_lvl: log_lvl + // }) + // .then(async function (email_send_result) { + // if (email_send_result) { + // let email_auth_key_endpoint = `user/${user_id}/email_auth_key_url`; + // params = { + // 'root_url': 'https://test.oneskyit.com' + // } + // ae_promises.auth_key__send_email = await api.get_object({ + // api_cfg: api_cfg, + // endpoint: email_auth_key_endpoint, + // params: params, + // log_lvl: log_lvl + // }) - // return email_send_result; - // } else { - // console.log('No results returned.'); - // return null; - // } - // }) - // .catch(function (error: any) { - // console.log('No results returned or failed.', error); - // }); + // return email_send_result; + // } else { + // console.log('No results returned.'); + // return null; + // } + // }) + // .catch(function (error: any) { + // console.log('No results returned or failed.', error); + // }); - // if (log_lvl) { - // console.log('ae_promises.send_email_auth__user_id:', ae_promises.send_email_auth__user_id); - // } - // return ae_promises.send_email_auth__user_id; + // if (log_lvl) { + // console.log('ae_promises.send_email_auth__user_id:', ae_promises.send_email_auth__user_id); + // } + // return ae_promises.send_email_auth__user_id; } // Look up user based on email address provided // Updated 2025-04-08 export async function qry_ae_obj_li__user_email({ - api_cfg, - account_id, - null_account_id = false, - email, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + null_account_id = false, + email, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - null_account_id?: boolean; - email: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + null_account_id?: boolean; + email: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** qry_ae_obj_li__user_email() *** account_id=${account_id} email=${email}`); - } + if (log_lvl) { + console.log(`*** qry_ae_obj_li__user_email() *** account_id=${account_id} email=${email}`); + } - const endpoint = '/user/lookup_email'; + const endpoint = '/user/lookup_email'; - params['email'] = email; // Required - params['null_account_id'] = null_account_id || false; - if (log_lvl > 1) { - console.log(`qry_ae_obj_li__user_email() - params:`, params); - } + params['email'] = email; // Required + params['null_account_id'] = null_account_id || false; + if (log_lvl > 1) { + console.log(`qry_ae_obj_li__user_email() - params:`, params); + } - ae_promises.qry__user_email = await api - .get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - log_lvl: log_lvl - }) - .then(async function (user_obj_get_result) { - if (user_obj_get_result) { - return user_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.qry__user_email = await api + .get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + log_lvl: log_lvl + }) + .then(async function (user_obj_get_result) { + if (user_obj_get_result) { + return user_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.qry__user_email:', ae_promises.qry__user_email); - } - return ae_promises.qry__user_email; + if (log_lvl) { + console.log('ae_promises.qry__user_email:', ae_promises.qry__user_email); + } + return ae_promises.qry__user_email; } // Change user password @@ -281,55 +281,55 @@ export async function qry_ae_obj_li__user_email({ // data_kv: password (the new password) // Updated 2025-04-11 export async function auth_ae_obj__user_id_change_password({ - api_cfg, - account_id, - user_id, - password, - params = {}, - log_lvl = 0 + api_cfg, + account_id, + user_id, + password, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - user_id: string; - password: string; - params?: key_val; - log_lvl?: number; + api_cfg: any; + account_id: string; + user_id: string; + password: string; + params?: key_val; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** auth_ae_obj__user_id_change_password() *** account_id=${account_id} user_id=${user_id}` - ); - } + if (log_lvl) { + console.log( + `*** auth_ae_obj__user_id_change_password() *** account_id=${account_id} user_id=${user_id}` + ); + } - const endpoint = `/user/${user_id}/change_password`; + const endpoint = `/user/${user_id}/change_password`; - params['user_id'] = user_id; // Required - if (log_lvl > 1) { - console.log(`auth_ae_obj__user_id_change_password() - params:`, params); - } + params['user_id'] = user_id; // Required + if (log_lvl > 1) { + console.log(`auth_ae_obj__user_id_change_password() - params:`, params); + } - ae_promises.change_password__user_id = await api - .patch_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - data: { password: password }, - log_lvl: log_lvl - }) - .then(async function (change_password_result) { - if (change_password_result) { - return change_password_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.change_password__user_id = await api + .patch_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + data: { password: password }, + log_lvl: log_lvl + }) + .then(async function (change_password_result) { + if (change_password_result) { + return change_password_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.change_password__user_id:', ae_promises.change_password__user_id); - } - return ae_promises.change_password__user_id; + if (log_lvl) { + console.log('ae_promises.change_password__user_id:', ae_promises.change_password__user_id); + } + return ae_promises.change_password__user_id; } diff --git a/src/lib/ae_core/db_core.ts b/src/lib/ae_core/db_core.ts index dab96de9..29dc795a 100644 --- a/src/lib/ae_core/db_core.ts +++ b/src/lib/ae_core/db_core.ts @@ -5,143 +5,143 @@ import Dexie, { type Table } from 'dexie'; // Updated 2025-01-07 export interface File { - id: string; - id_random: string; - hosted_file_id: string; - hosted_file_id_random: string; + id: string; + id_random: string; + hosted_file_id: string; + hosted_file_id_random: string; - hash_sha256: string; + hash_sha256: string; - for_type?: string; - for_id?: string; - for_id_random?: string; + for_type?: string; + for_id?: string; + for_id_random?: string; - account_id: string; + account_id: string; - filename: string; - extension: string; - content_type: string; - size: number; // In bytes + filename: string; + extension: string; + content_type: string; + size: number; // In bytes - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Additional fields for convenience (database views) - filename_no_ext: string; - filename_w_ext: string; + // Additional fields for convenience (database views) + filename_no_ext: string; + filename_w_ext: string; } // Updated 2024-07-17 export interface Person { - id: string; - // id_random: string; - person_id: string; - person_id_random: string; + id: string; + // id_random: string; + person_id: string; + person_id_random: string; - external_id?: string; // This may be semi-random or unique only withing the account. - external_sys_id?: string; // Generated by an external system. Ideally this should be something like a UUID. It may be the same as the external_id if nothing given. - code?: string; // Not currently used. + external_id?: string; // This may be semi-random or unique only withing the account. + external_sys_id?: string; // Generated by an external system. Ideally this should be something like a UUID. It may be the same as the external_id if nothing given. + code?: string; // Not currently used. - account_id?: string; // Technically this is not required for global users. - account_id_random?: string; // Technically this is not required for global users. + account_id?: string; // Technically this is not required for global users. + account_id_random?: string; // Technically this is not required for global users. - person_profile_id?: null | string; - person_profile_id_random?: null | string; // The new table person_profile will be used soon... + person_profile_id?: null | string; + person_profile_id_random?: null | string; // The new table person_profile will be used soon... - user_id?: string; - user_id_random?: string; + user_id?: string; + user_id_random?: string; - pronouns?: null | string; - informal_name?: null | string; - title_names?: null | string; - given_name: string; - middle_name?: null | string; - family_name: null | string; - designations?: null | string; + pronouns?: null | string; + informal_name?: null | string; + title_names?: null | string; + given_name: string; + middle_name?: null | string; + family_name: null | string; + designations?: null | string; - professional_title?: null | string; + professional_title?: null | string; - full_name?: string; - full_name_override?: null | string; // was called display_name + full_name?: string; + full_name_override?: null | string; // was called display_name - affiliations?: null | string; + affiliations?: null | string; - primary_email?: string; + primary_email?: string; - biography?: null | string; + biography?: null | string; - agree?: null | boolean; - comments?: null | string; + agree?: null | boolean; + comments?: null | string; - allow_auth_key?: null | boolean; // For sign in without password - auth_key?: null | string; // Should this be saved locally? - passcode?: null | string; + allow_auth_key?: null | boolean; // For sign in without password + auth_key?: null | string; // Should this be saved locally? + passcode?: null | string; - data_json?: null | string; + data_json?: null | string; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; - tmp_sort_3?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; + tmp_sort_3?: null | string; - // Additional fields for convenience (database views) - username?: string; // Same as user_username - // user_username?: null|string; // Same as username - user_name?: null | string; - user_email?: null | string; - user_allow_auth_key?: null | boolean; // For sign in without password - user_super?: boolean; - user_manager?: boolean; - user_administrator?: boolean; - user_public?: boolean; + // Additional fields for convenience (database views) + username?: string; // Same as user_username + // user_username?: null|string; // Same as username + user_name?: null | string; + user_email?: null | string; + user_allow_auth_key?: null | boolean; // For sign in without password + user_super?: boolean; + user_manager?: boolean; + user_administrator?: boolean; + user_public?: boolean; - organization_id?: null | string; // The organization this person belongs to, if any. - organization_id_random?: null | string; // The random ID of the organization this person belongs to, if any. - organization_name?: null | string; + organization_id?: null | string; // The organization this person belongs to, if any. + organization_id_random?: null | string; // The random ID of the organization this person belongs to, if any. + organization_name?: null | string; - contact_id?: null | string; // The contact ID of the person, if any. - contact_id_random?: null | string; // The random ID of the contact, if any. - contact_name?: null | string; - contact_email?: null | string; - contact_cc_email?: null | string; - contact_phone_mobile?: null | string; - contact_phone_home?: null | string; - contact_phone_office?: null | string; - contact_phone_landline?: null | string; - contact_phone_fax?: null | string; - contact_phone_other?: null | string; + contact_id?: null | string; // The contact ID of the person, if any. + contact_id_random?: null | string; // The random ID of the contact, if any. + contact_name?: null | string; + contact_email?: null | string; + contact_cc_email?: null | string; + contact_phone_mobile?: null | string; + contact_phone_home?: null | string; + contact_phone_office?: null | string; + contact_phone_landline?: null | string; + contact_phone_fax?: null | string; + contact_phone_other?: null | string; - address_id?: null | string; // The address ID of the person, if any. - address_id_random?: null | string; // The random ID of the address, if any. - address_city?: null | string; - address_country_alpha_2_code?: null | string; // ISO 3166-1 alpha-2 country code + address_id?: null | string; // The address ID of the person, if any. + address_id_random?: null | string; // The random ID of the address, if any. + address_city?: null | string; + address_country_alpha_2_code?: null | string; // ISO 3166-1 alpha-2 country code } // Updated 2025-01-07 export class MySubClassedDexie extends Dexie { - file!: Table; - person!: Table; - // user!: Table; + file!: Table; + person!: Table; + // user!: Table; - constructor() { - super('ae_core_db'); - this.version(1).stores({ - file: ` + constructor() { + super('ae_core_db'); + this.version(1).stores({ + file: ` id, id_random, hosted_file_id, hosted_file_id_random, hash_sha256, account_id, @@ -150,7 +150,7 @@ export class MySubClassedDexie extends Dexie { content_type, size, enable, hide, priority, sort, group, created_on, updated_on`, - person: ` + person: ` id, person_id, person_id_random, external_id, code, account_id, user_id, @@ -161,8 +161,8 @@ export class MySubClassedDexie extends Dexie { full_name, affiliations, email, agree, enable, hide, priority, sort, group, created_on, updated_on` - }); - } + }); + } } export const db_core = new MySubClassedDexie(); diff --git a/src/lib/ae_events/ae_events__event.ts b/src/lib/ae_events/ae_events__event.ts index b08f9162..13810e9c 100644 --- a/src/lib/ae_events/ae_events__event.ts +++ b/src/lib/ae_events/ae_events__event.ts @@ -13,1135 +13,1139 @@ const ae_promises: key_val = {}; // Updated 2025-05-22 export async function load_ae_obj_id__event({ - api_cfg, - event_id, - inc_device_li = false, - inc_file_li = false, - inc_location_li = false, - inc_presentation_li = false, - inc_presenter_li = false, - inc_session_li = false, - inc_badge_li = false, - inc_template_li = false, // badge templates - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + inc_device_li = false, + inc_file_li = false, + inc_location_li = false, + inc_presentation_li = false, + inc_presenter_li = false, + inc_session_li = false, + inc_badge_li = false, + inc_template_li = false, // badge templates + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - inc_device_li?: boolean; - inc_file_li?: boolean; - inc_location_li?: boolean; - inc_presentation_li?: boolean; - inc_presenter_li?: boolean; - inc_session_li?: boolean; - inc_badge_li?: boolean; - inc_template_li?: boolean; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + inc_device_li?: boolean; + inc_file_li?: boolean; + inc_location_li?: boolean; + inc_presentation_li?: boolean; + inc_presenter_li?: boolean; + inc_session_li?: boolean; + inc_badge_li?: boolean; + inc_template_li?: boolean; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__event() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__event() *** event_id=${event_id}`); + } - const params = {}; + const params = {}; - ae_promises.load__event_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event', - obj_id: event_id, - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (event_obj_get_result) { - if (event_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_props({ - obj_li: [event_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'event', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__event_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event', + obj_id: event_id, + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (event_obj_get_result) { + if (event_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_props({ + obj_li: [event_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'event', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_obj:', ae_promises.load__event_obj); - } + if (log_lvl) { + console.log('ae_promises.load__event_obj:', ae_promises.load__event_obj); + } - if (inc_device_li) { - // Load the devices for the event - if (log_lvl) { - console.log(`Need to load the device list for the event now`); - } - const load_event_device_obj_li = load_ae_obj_li__event_device({ - api_cfg: api_cfg, - for_obj_type: 'event', - for_obj_id: event_id, - params: { qry__enabled: 'enabled', qry__limit: 49 }, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_device_obj_li) => { - if (log_lvl) { - console.log(`event_device_obj_li = `, event_device_obj_li); - } - return event_device_obj_li; - }); + if (inc_device_li) { + // Load the devices for the event + if (log_lvl) { + console.log(`Need to load the device list for the event now`); + } + const load_event_device_obj_li = load_ae_obj_li__event_device({ + api_cfg: api_cfg, + for_obj_type: 'event', + for_obj_id: event_id, + params: { qry__enabled: 'enabled', qry__limit: 49 }, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_device_obj_li) => { + if (log_lvl) { + console.log(`event_device_obj_li = `, event_device_obj_li); + } + return event_device_obj_li; + }); - if (log_lvl) { - console.log(`load_event_device_obj_li = `, load_event_device_obj_li); - } - ae_promises.load__event_obj.event_device_obj_li = load_event_device_obj_li; - } + if (log_lvl) { + console.log(`load_event_device_obj_li = `, load_event_device_obj_li); + } + ae_promises.load__event_obj.event_device_obj_li = load_event_device_obj_li; + } - if (inc_location_li) { - // Load the locations for the event - if (log_lvl) { - console.log(`Need to load the location list for the event now`); - } - const load_event_location_obj_li = load_ae_obj_li__event_location({ - api_cfg: api_cfg, - for_obj_type: 'event', - for_obj_id: event_id, - enabled: 'enabled', - limit: 19, - log_lvl: log_lvl - }).then((event_location_obj_li) => { - if (log_lvl) { - console.log(`event_location_obj_li = `, event_location_obj_li); - } - return event_location_obj_li; - }); + if (inc_location_li) { + // Load the locations for the event + if (log_lvl) { + console.log(`Need to load the location list for the event now`); + } + const load_event_location_obj_li = load_ae_obj_li__event_location({ + api_cfg: api_cfg, + for_obj_type: 'event', + for_obj_id: event_id, + enabled: 'enabled', + limit: 19, + log_lvl: log_lvl + }).then((event_location_obj_li) => { + if (log_lvl) { + console.log(`event_location_obj_li = `, event_location_obj_li); + } + return event_location_obj_li; + }); - if (log_lvl) { - console.log(`load_event_location_obj_li = `, load_event_location_obj_li); - } - ae_promises.load__event_obj.event_location_obj_li = load_event_location_obj_li; - } + if (log_lvl) { + console.log(`load_event_location_obj_li = `, load_event_location_obj_li); + } + ae_promises.load__event_obj.event_location_obj_li = load_event_location_obj_li; + } - if (inc_session_li) { - // Load the sessions for the events - if (log_lvl) { - console.log(`Need to load the session list for the event now`); - } - const load_event_session_obj_li = load_ae_obj_li__event_session({ - api_cfg: api_cfg, - for_obj_type: 'event', - for_obj_id: event_id, - enabled: 'enabled', - limit: 249, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_session_obj_li) => { - if (log_lvl) { - console.log(`event_session_obj_li = `, event_session_obj_li); - } - return event_session_obj_li; - }); + if (inc_session_li) { + // Load the sessions for the events + if (log_lvl) { + console.log(`Need to load the session list for the event now`); + } + const load_event_session_obj_li = load_ae_obj_li__event_session({ + api_cfg: api_cfg, + for_obj_type: 'event', + for_obj_id: event_id, + enabled: 'enabled', + limit: 249, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_session_obj_li) => { + if (log_lvl) { + console.log(`event_session_obj_li = `, event_session_obj_li); + } + return event_session_obj_li; + }); - if (log_lvl) { - console.log(`load_event_session_obj_li = `, load_event_session_obj_li); - } - ae_promises.load__event_obj.event_session_obj_li = load_event_session_obj_li; - } + if (log_lvl) { + console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + } + ae_promises.load__event_obj.event_session_obj_li = load_event_session_obj_li; + } - if (inc_template_li) { - // Load the badge templates for the event - log_lvl = 2; - if (log_lvl) { - console.log(`Need to load the badge template list for the event now`); - } - const load_event_badge_template_obj_li = load_ae_obj_li__event_badge_template({ - api_cfg: api_cfg, - // for_obj_type: 'event', - // for_obj_id: event_id, - event_id: event_id, - enabled: 'enabled', - limit: 19, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_badge_template_obj_li) => { - if (log_lvl) { - console.log(`event_badge_template_obj_li = `, event_badge_template_obj_li); - } - return event_badge_template_obj_li; - }); - if (log_lvl) { - console.log(`load_event_badge_template_obj_li = `, load_event_badge_template_obj_li); - } - ae_promises.load__event_obj.event_badge_template_obj_li = load_event_badge_template_obj_li; - } + if (inc_template_li) { + // Load the badge templates for the event + log_lvl = 2; + if (log_lvl) { + console.log(`Need to load the badge template list for the event now`); + } + const load_event_badge_template_obj_li = load_ae_obj_li__event_badge_template({ + api_cfg: api_cfg, + // for_obj_type: 'event', + // for_obj_id: event_id, + event_id: event_id, + enabled: 'enabled', + limit: 19, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_badge_template_obj_li) => { + if (log_lvl) { + console.log(`event_badge_template_obj_li = `, event_badge_template_obj_li); + } + return event_badge_template_obj_li; + }); + if (log_lvl) { + console.log(`load_event_badge_template_obj_li = `, load_event_badge_template_obj_li); + } + ae_promises.load__event_obj.event_badge_template_obj_li = load_event_badge_template_obj_li; + } - return ae_promises.load__event_obj; + return ae_promises.load__event_obj; } // Updated 2025-05-22 export async function load_ae_obj_li__event({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - qry_conference = true, - qry_str = null, - inc_device_li = false, - inc_file_li = false, - inc_location_li = false, - inc_presentation_li = false, - inc_presenter_li = false, - inc_session_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { start_datetime: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' }, - params_json = null, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + qry_conference = true, + qry_str = null, + inc_device_li = false, + inc_file_li = false, + inc_location_li = false, + inc_presentation_li = false, + inc_presenter_li = false, + inc_session_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { start_datetime: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' }, + params_json = null, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - qry_conference?: null | boolean; - qry_str?: null | string; - inc_device_li?: boolean; - inc_file_li?: boolean; - inc_location_li?: boolean; - inc_presentation_li?: boolean; - inc_presenter_li?: boolean; - inc_session_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params_json?: null | key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + qry_conference?: null | boolean; + qry_str?: null | string; + inc_device_li?: boolean; + inc_file_li?: boolean; + inc_location_li?: boolean; + inc_presentation_li?: boolean; + inc_presenter_li?: boolean; + inc_session_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params_json?: null | key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - 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}` - ); - } + 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}` + ); + } - // 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 - if (!params_json) { - params_json = {}; - } + // 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 + if (!params_json) { + params_json = {}; + } - if (qry_conference) { - if (!params_json['and_qry']) { - params_json['and_qry'] = {}; - } + if (qry_conference) { + if (!params_json['and_qry']) { + params_json['and_qry'] = {}; + } - params_json['and_qry']['conference'] = qry_conference; - } else if (qry_conference === false) { - if (!params_json['and_qry']) { - params_json['and_qry'] = {}; - } + params_json['and_qry']['conference'] = qry_conference; + } else if (qry_conference === false) { + if (!params_json['and_qry']) { + params_json['and_qry'] = {}; + } - if (log_lvl) { - console.log('qry_conference is false!'); - } - params_json['and_qry']['conference'] = qry_conference; - } + if (log_lvl) { + console.log('qry_conference is false!'); + } + params_json['and_qry']['conference'] = qry_conference; + } - if (qry_str) { - if (!params_json['ft_qry']) { - params_json['ft_qry'] = {}; - } + if (qry_str) { + if (!params_json['ft_qry']) { + params_json['ft_qry'] = {}; + } - params_json['ft_qry'] = {}; - params_json['ft_qry']['default_qry_str'] = qry_str; - params_json['ft_qry']['location_address_json_ext'] = qry_str; - params_json['ft_qry']['contact_li_json_ext'] = qry_str; - } + params_json['ft_qry'] = {}; + params_json['ft_qry']['default_qry_str'] = qry_str; + params_json['ft_qry']['location_address_json_ext'] = qry_str; + params_json['ft_qry']['contact_li_json_ext'] = qry_str; + } - // 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({ - api_cfg: api_cfg, - obj_type: 'event', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_obj_li_get_result) { - if (event_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_props({ - obj_li: event_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'event', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__event_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'event', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. + // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_obj_li_get_result) { + if (event_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_props({ + obj_li: event_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'event', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_obj_li:', ae_promises.load__event_obj_li); - } + if (log_lvl) { + console.log('ae_promises.load__event_obj_li:', ae_promises.load__event_obj_li); + } - if (inc_device_li) { - // Load the devices for the events - if (log_lvl) { - 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++) { - const event_obj = ae_promises.load__event_obj_li[i]; - const event_id = event_obj.event_id_random; + if (inc_device_li) { + // Load the devices for the events + if (log_lvl) { + 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++) { + const event_obj = ae_promises.load__event_obj_li[i]; + const event_id = event_obj.event_id_random; - const load_event_device_obj_li = load_ae_obj_li__event_device({ - api_cfg: api_cfg, - for_obj_type: 'event', - for_obj_id: event_id, - params: { qry__enabled: 'enabled', qry__limit: 49 }, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_device_obj_li) => { - if (log_lvl) { - console.log(`event_device_obj_li = `, event_device_obj_li); - } + const load_event_device_obj_li = load_ae_obj_li__event_device({ + api_cfg: api_cfg, + for_obj_type: 'event', + for_obj_id: event_id, + params: { qry__enabled: 'enabled', qry__limit: 49 }, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_device_obj_li) => { + if (log_lvl) { + console.log(`event_device_obj_li = `, event_device_obj_li); + } - return event_device_obj_li; - }); + return event_device_obj_li; + }); - if (log_lvl) { - console.log(`load_event_device_obj_li = `, load_event_device_obj_li); - } + if (log_lvl) { + console.log(`load_event_device_obj_li = `, load_event_device_obj_li); + } - if (load_event_device_obj_li) { - ae_promises.load__event_obj_li[i].event_device_obj_li = load_event_device_obj_li; - } - } - } + if (load_event_device_obj_li) { + ae_promises.load__event_obj_li[i].event_device_obj_li = load_event_device_obj_li; + } + } + } - if (inc_location_li) { - // Load the locations for the events - if (log_lvl) { - 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++) { - const event_obj = ae_promises.load__event_obj_li[i]; - const event_id = event_obj.event_id_random; + if (inc_location_li) { + // Load the locations for the events + if (log_lvl) { + 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++) { + const event_obj = ae_promises.load__event_obj_li[i]; + const event_id = event_obj.event_id_random; - const load_event_location_obj_li = load_ae_obj_li__event_location({ - api_cfg: api_cfg, - for_obj_type: 'event', - for_obj_id: event_id, - enabled: 'enabled', - limit: 19, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_location_obj_li) => { - if (log_lvl) { - console.log(`event_location_obj_li = `, event_location_obj_li); - } + const load_event_location_obj_li = load_ae_obj_li__event_location({ + api_cfg: api_cfg, + for_obj_type: 'event', + for_obj_id: event_id, + enabled: 'enabled', + limit: 19, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_location_obj_li) => { + if (log_lvl) { + console.log(`event_location_obj_li = `, event_location_obj_li); + } - return event_location_obj_li; - }); + return event_location_obj_li; + }); - if (log_lvl) { - console.log(`load_event_location_obj_li = `, load_event_location_obj_li); - } + if (log_lvl) { + console.log(`load_event_location_obj_li = `, load_event_location_obj_li); + } - if (load_event_location_obj_li) { - ae_promises.load__event_obj_li[i].event_location_obj_li = load_event_location_obj_li; - } - } - } + if (load_event_location_obj_li) { + ae_promises.load__event_obj_li[i].event_location_obj_li = + load_event_location_obj_li; + } + } + } - if (inc_session_li) { - // Load the sessions for the events - if (log_lvl) { - 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++) { - const event_obj = ae_promises.load__event_obj_li[i]; - const event_id = event_obj.event_id_random; + if (inc_session_li) { + // Load the sessions for the events + if (log_lvl) { + 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++) { + const event_obj = ae_promises.load__event_obj_li[i]; + const event_id = event_obj.event_id_random; - const load_event_session_obj_li = load_ae_obj_li__event_session({ - api_cfg: api_cfg, - for_obj_type: 'event', - for_obj_id: event_id, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - order_by_li: order_by_li, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_session_obj_li) => { - if (log_lvl) { - console.log(`event_session_obj_li = `, event_session_obj_li); - } + const load_event_session_obj_li = load_ae_obj_li__event_session({ + api_cfg: api_cfg, + for_obj_type: 'event', + for_obj_id: event_id, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + order_by_li: order_by_li, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_session_obj_li) => { + if (log_lvl) { + console.log(`event_session_obj_li = `, event_session_obj_li); + } - return event_session_obj_li; - }); + return event_session_obj_li; + }); - if (log_lvl) { - console.log(`load_event_session_obj_li = `, load_event_session_obj_li); - } + if (log_lvl) { + console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + } - if (load_event_session_obj_li) { - ae_promises.load__event_obj_li[i].event_session_obj_li = load_event_session_obj_li; - } - } - } + if (load_event_session_obj_li) { + ae_promises.load__event_obj_li[i].event_session_obj_li = load_event_session_obj_li; + } + } + } - 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. // Updated 2024-10-01 export async function qry_ae_obj_li__event({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - qry_conference = true, - qry_physical = null, - qry_virtual = null, - qry_type = null, - qry_str = null, - inc_file_li = false, - inc_location_li = false, - inc_presentation_li = false, - inc_presenter_li = false, - inc_session_li = false, - enabled = 'enabled', // all, disabled, enabled - hidden = 'not_hidden', // all, hidden, not_hidden - limit = 99, - offset = 0, - order_by_li = { start_datetime: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + qry_conference = true, + qry_physical = null, + qry_virtual = null, + qry_type = null, + qry_str = null, + inc_file_li = false, + inc_location_li = false, + inc_presentation_li = false, + inc_presenter_li = false, + inc_session_li = false, + enabled = 'enabled', // all, disabled, enabled + hidden = 'not_hidden', // all, hidden, not_hidden + limit = 99, + offset = 0, + order_by_li = { start_datetime: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - qry_conference?: null | boolean; - qry_physical?: null | boolean; - qry_virtual?: null | boolean; - qry_type?: null | string; - qry_str?: null | string; - inc_file_li?: boolean; - inc_location_li?: boolean; - inc_presentation_li?: boolean; - inc_presenter_li?: boolean; - inc_session_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + qry_conference?: null | boolean; + qry_physical?: null | boolean; + qry_virtual?: null | boolean; + qry_type?: null | string; + qry_str?: null | string; + inc_file_li?: boolean; + inc_location_li?: boolean; + inc_presentation_li?: boolean; + inc_presenter_li?: boolean; + inc_session_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** qry_ae_obj_li__event() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 - const params_json: key_val = {}; + // Build the params_json object. This needs to be documented better! -2024-10-01 + const params_json: key_val = {}; - params_json['and_qry'] = {}; + params_json['and_qry'] = {}; - // This is handled in the actual load_ae_obj_li__event() function. For now...? - // if (qry_conference) { - // params_json['and_qry']['conference'] = qry_conference; - // } else if (qry_conference === false) { - // console.log('qry_conference is false!'); - // params_json['and_qry']['conference'] = qry_conference; - // } + // This is handled in the actual load_ae_obj_li__event() function. For now...? + // if (qry_conference) { + // params_json['and_qry']['conference'] = qry_conference; + // } else if (qry_conference === false) { + // console.log('qry_conference is false!'); + // params_json['and_qry']['conference'] = qry_conference; + // } - if (qry_physical && qry_virtual) { - // Ignore both if both are set to true. - } else if (qry_physical || qry_virtual) { - if (qry_physical) { - params_json['and_qry']['physical'] = qry_physical; - } - if (qry_virtual) { - params_json['and_qry']['virtual'] = qry_virtual; - } - } + if (qry_physical && qry_virtual) { + // Ignore both if both are set to true. + } else if (qry_physical || qry_virtual) { + if (qry_physical) { + params_json['and_qry']['physical'] = qry_physical; + } + if (qry_virtual) { + params_json['and_qry']['virtual'] = qry_virtual; + } + } - if (qry_type) { - params_json['and_qry']['type'] = qry_type; - } + if (qry_type) { + params_json['and_qry']['type'] = qry_type; + } - if (qry_str) { - params_json['ft_qry'] = {}; - params_json['ft_qry']['default_qry_str'] = qry_str; - params_json['ft_qry']['location_address_json_ext'] = qry_str; - params_json['ft_qry']['contact_li_json_ext'] = qry_str; - } + if (qry_str) { + params_json['ft_qry'] = {}; + params_json['ft_qry']['default_qry_str'] = qry_str; + params_json['ft_qry']['location_address_json_ext'] = qry_str; + params_json['ft_qry']['contact_li_json_ext'] = qry_str; + } - if (log_lvl) { - console.log('params_json:', params_json); - } + if (log_lvl) { + console.log('params_json:', params_json); + } - ae_promises.qry__event_obj_li = await load_ae_obj_li__event({ - api_cfg: api_cfg, - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - qry_conference: qry_conference, - qry_str: qry_str, - inc_file_li: inc_file_li, - inc_location_li: inc_location_li, - inc_presentation_li: inc_presentation_li, - inc_presenter_li: inc_presenter_li, - inc_session_li: inc_session_li, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - order_by_li: order_by_li, - params_json: params_json, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }); + ae_promises.qry__event_obj_li = await load_ae_obj_li__event({ + api_cfg: api_cfg, + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + qry_conference: qry_conference, + qry_str: qry_str, + inc_file_li: inc_file_li, + inc_location_li: inc_location_li, + inc_presentation_li: inc_presentation_li, + inc_presenter_li: inc_presenter_li, + inc_session_li: inc_session_li, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + order_by_li: order_by_li, + params_json: params_json, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }); - return ae_promises.qry__event_obj_li; + return ae_promises.qry__event_obj_li; } // Updated 2025-07-11 export async function create_ae_obj__event({ - api_cfg, - account_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__event() *** account_id=${account_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__event() *** account_id=${account_id}`); + } - if (!account_id) { - console.log(`ERROR: Events - Event - account_id required to create`); - return false; - } + if (!account_id) { + console.log(`ERROR: Events - Event - account_id required to create`); + return false; + } - ae_promises.create__event = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'event', - fields: { - account_id_random: account_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_obj_create_result) { - if (event_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_props({ - obj_li: [event_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'event', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + ae_promises.create__event = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event', + fields: { + account_id_random: account_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_obj_create_result) { + if (event_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_props({ + obj_li: [event_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'event', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__event:', ae_promises.create__event); - } - return ae_promises.create__event; + if (log_lvl) { + console.log('ae_promises.create__event:', ae_promises.create__event); + } + return ae_promises.create__event; } // Updated 2024-11-08 export async function delete_ae_obj_id__event({ - api_cfg, - event_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__event() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__event() *** event_id=${event_id}`); + } - ae_promises.delete__event_obj = await api - .delete_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event', - obj_id: event_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for event_id=${event_id}`); - } - db_events.event.delete(event_id); // Delete from the DB no matter what. - } - }); + ae_promises.delete__event_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event', + obj_id: event_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log(`Attempting to remove IDB entry for event_id=${event_id}`); + } + db_events.event.delete(event_id); // Delete from the DB no matter what. + } + }); - if (log_lvl) { - console.log('ae_promises.delete__event_obj:', ae_promises.delete__event_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__event_obj:', ae_promises.delete__event_obj); + } - return ae_promises.delete__event_obj; + return ae_promises.delete__event_obj; } // Updated 2024-09-25 export async function update_ae_obj__event({ - api_cfg, - event_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** update_ae_obj__event() *** event_id=${event_id}`, data_kv); - } - // ae_promises.update__event_obj = 'test'; - ae_promises.update__event_obj = await api - .update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event', - obj_id: event_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_obj_update_result) { - if (event_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_props({ - obj_li: [event_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'event', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + if (log_lvl) { + console.log(`*** update_ae_obj__event() *** event_id=${event_id}`, data_kv); + } + // ae_promises.update__event_obj = 'test'; + ae_promises.update__event_obj = await api + .update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event', + obj_id: event_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_obj_update_result) { + if (event_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_props({ + obj_li: [event_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'event', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.update__event_obj:', ae_promises.update__event_obj); - } - return ae_promises.update__event_obj; + if (log_lvl) { + console.log('ae_promises.update__event_obj:', 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. // Updated 2025-05-09 export async function db_save_ae_obj_li__event({ - obj_type, - obj_li, - log_lvl = 0 + obj_type, + obj_li, + log_lvl = 0 }: { - obj_type: string; - obj_li: any; - log_lvl?: number; + obj_type: string; + obj_li: any; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** db_save_ae_obj_li__event() *** obj_type=${obj_type}`, obj_li); - } + if (log_lvl) { + console.log(`*** db_save_ae_obj_li__event() *** obj_type=${obj_type}`, obj_li); + } - if (obj_li && obj_li.length) { - const obj_li_id: string[] = []; + if (obj_li && obj_li.length) { + const obj_li_id: string[] = []; - for (const obj of obj_li) { - if (log_lvl) { - console.log(`Processing ae_obj ${obj_type}:`, obj); - } + for (const obj of obj_li) { + if (log_lvl) { + console.log(`Processing ae_obj ${obj_type}:`, obj); + } - const obj_record = { - id: obj.event_id_random, - event_id: obj.event_id_random, - event_id_random: obj.event_id_random, + const obj_record = { + id: obj.event_id_random, + event_id: obj.event_id_random, + event_id_random: obj.event_id_random, - code: obj.event_code, + code: obj.event_code, - account_id: obj.account_id_random, - account_id_random: obj.account_id_random, + account_id: obj.account_id_random, + account_id_random: obj.account_id_random, - conference: obj.conference, - type: obj.type, - name: obj.name, - summary: obj.summary, - description: obj.description, + conference: obj.conference, + type: obj.type, + name: obj.name, + summary: obj.summary, + description: obj.description, - start_datetime: obj.start_datetime, - end_datetime: obj.end_datetime, - timezone: obj.timezone, - location_address_json: obj.location_address_json, - location_text: obj.location_text, + start_datetime: obj.start_datetime, + end_datetime: obj.end_datetime, + timezone: obj.timezone, + location_address_json: obj.location_address_json, + location_text: obj.location_text, - attend_json: obj.attend_json, - attend_text: obj.attend_text, + attend_json: obj.attend_json, + attend_text: obj.attend_text, - status: obj.status, // draft, active, inactive, archived, unknown; currently only used with IDAA - // review: obj.review, - // approve: obj.approve, - // ready: obj.ready, - // ready_on: obj.ready_on, - // archive: obj.archive, - // archive_on: obj.archive_on, + status: obj.status, // draft, active, inactive, archived, unknown; currently only used with IDAA + // review: obj.review, + // approve: obj.approve, + // ready: obj.ready, + // ready_on: obj.ready_on, + // archive: obj.archive, + // archive_on: obj.archive_on, - mod_abstracts_json: obj.mod_abstracts_json, - mod_badges_json: obj.mod_badges_json, - mod_exhibits_json: obj.mod_exhibits_json, - mod_meetings_json: obj.mod_meetings_json, - mod_pres_mgmt_json: obj.mod_pres_mgmt_json, - cfg_json: obj.cfg_json, + mod_abstracts_json: obj.mod_abstracts_json, + mod_badges_json: obj.mod_badges_json, + mod_exhibits_json: obj.mod_exhibits_json, + mod_meetings_json: obj.mod_meetings_json, + mod_pres_mgmt_json: obj.mod_pres_mgmt_json, + cfg_json: obj.cfg_json, - enable: obj.enable, - hide: obj.hide, - priority: obj.priority, - sort: obj.sort, - group: obj.group, - notes: obj.notes, - created_on: obj.created_on, - updated_on: obj.updated_on, + enable: obj.enable, + hide: obj.hide, + priority: obj.priority, + sort: obj.sort, + group: obj.group, + notes: obj.notes, + created_on: obj.created_on, + updated_on: obj.updated_on, - // IDAA Recovery Meetings: - // Currently only really used for IDAA - contact_li_json: obj.contact_li_json, - external_person_id: obj.external_person_id, + // IDAA Recovery Meetings: + // Currently only really used for IDAA + contact_li_json: obj.contact_li_json, + external_person_id: obj.external_person_id, - physical: obj.physical, - virtual: obj.virtual, + physical: obj.physical, + virtual: obj.virtual, - recurring: obj.recurring, - recurring_pattern: obj.recurring_pattern, - recurring_start_time: obj.recurring_start_time, - recurring_end_time: obj.recurring_end_time, - recurring_text: obj.recurring_text, + recurring: obj.recurring, + recurring_pattern: obj.recurring_pattern, + recurring_start_time: obj.recurring_start_time, + recurring_end_time: obj.recurring_end_time, + recurring_text: obj.recurring_text, - weekday_sunday: obj.weekday_sunday, - weekday_monday: obj.weekday_monday, - weekday_tuesday: obj.weekday_tuesday, - weekday_wednesday: obj.weekday_wednesday, - weekday_thursday: obj.weekday_thursday, - weekday_friday: obj.weekday_friday, - weekday_saturday: obj.weekday_saturday, + weekday_sunday: obj.weekday_sunday, + weekday_monday: obj.weekday_monday, + weekday_tuesday: obj.weekday_tuesday, + weekday_wednesday: obj.weekday_wednesday, + weekday_thursday: obj.weekday_thursday, + weekday_friday: obj.weekday_friday, + weekday_saturday: obj.weekday_saturday, - attend_url: obj.attend_url, - attend_url_text: obj.attend_url_text, - attend_url_code: obj.attend_url_code, - attend_url_passcode: obj.attend_url_passcode, - attend_phone: obj.attend_phone, - attend_phone_passcode: obj.attend_phone_passcode, + attend_url: obj.attend_url, + attend_url_text: obj.attend_url_text, + attend_url_code: obj.attend_url_code, + attend_url_passcode: obj.attend_url_passcode, + attend_phone: obj.attend_phone, + attend_phone_passcode: obj.attend_phone_passcode, - // From SQL view - file_count: obj.file_count, - file_count_all: obj.file_count_all, - internal_use_count: obj.internal_use_count, - event_file_id_li_json: obj.event_file_id_li_json - }; + // From SQL view + file_count: obj.file_count, + file_count_all: obj.file_count_all, + internal_use_count: obj.internal_use_count, + event_file_id_li_json: obj.event_file_id_li_json + }; - let id_random = null; + let id_random = null; - try { - id_random = await db_events.event.update(obj_record.id, obj_record); - } catch (error) { - console.error(`Error: Failed to update ${obj_record.id}: ${error}`); - } + try { + id_random = await db_events.event.update(obj_record.id, obj_record); + } catch (error) { + console.error(`Error: Failed to update ${obj_record.id}: ${error}`); + } - if (!id_random) { - if (log_lvl) { - console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); - } - try { - id_random = await db_events.event.put(obj_record); - } catch (error) { - console.error(`Error: Failed to put ${obj.event_id_random}: ${error}`); - } - } else { - if (log_lvl) { - console.log(`Updated record with ID: ${obj_record.id}`); - } - } + if (!id_random) { + if (log_lvl) { + console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); + } + try { + id_random = await db_events.event.put(obj_record); + } catch (error) { + console.error(`Error: Failed to put ${obj.event_id_random}: ${error}`); + } + } else { + if (log_lvl) { + console.log(`Updated record with ID: ${obj_record.id}`); + } + } - if (!id_random) { - console.error(`Failed to save record with ID: ${obj_record.id}`); - } else { - if (log_lvl) { - console.log(`Saved record with ID: ${obj_record.id}`); - } - obj_li_id.push(obj_record.id); - } - } - return obj_li_id; - } + if (!id_random) { + console.error(`Failed to save record with ID: ${obj_record.id}`); + } else { + if (log_lvl) { + console.log(`Saved record with ID: ${obj_record.id}`); + } + obj_li_id.push(obj_record.id); + } + } + return obj_li_id; + } } // This function will process the event config, specifically for presentation management. export function sync_config__event_pres_mgmt({ - 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. - log_lvl = 0 + 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. + log_lvl = 0 }: { - pres_mgmt_cfg_remote: key_val; - pres_mgmt_cfg_local: key_val; - log_lvl?: number; + pres_mgmt_cfg_remote: key_val; + pres_mgmt_cfg_local: key_val; + log_lvl?: number; }) { - log_lvl = 1; - if (log_lvl) { - console.log( - `*** sync_config__event_pres_mgmt() *** pres_mgmt_cfg_remote:`, - pres_mgmt_cfg_remote - ); - } + log_lvl = 1; + if (log_lvl) { + console.log( + `*** sync_config__event_pres_mgmt() *** pres_mgmt_cfg_remote:`, + pres_mgmt_cfg_remote + ); + } - // Deal with things that can not be overridden first: - // Labels: - pres_mgmt_cfg_local.label__person_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'; + // Deal with things that can not be overridden first: + // Labels: + pres_mgmt_cfg_local.label__person_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_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'; + pres_mgmt_cfg_local.label__session_poc_type = + 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_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: - pres_mgmt_cfg_local.hide__session_poc = pres_mgmt_cfg_remote?.hide__session_poc ?? false; + pres_mgmt_cfg_local.hide__session_poc = pres_mgmt_cfg_remote?.hide__session_poc ?? false; - // pres_mgmt_cfg_local.hide__report_kv = pres_mgmt_cfg_remote?.hide__report_kv ?? null; + // pres_mgmt_cfg_local.hide__report_kv = pres_mgmt_cfg_remote?.hide__report_kv ?? null; - // pres_mgmt_cfg_local.limit__navigation = pres_mgmt_cfg_remote?.limit__navigation ?? false; - // pres_mgmt_cfg_local.limit__options = pres_mgmt_cfg_remote?.limit__options ?? false; + // pres_mgmt_cfg_local.limit__navigation = pres_mgmt_cfg_remote?.limit__navigation ?? false; + // pres_mgmt_cfg_local.limit__options = pres_mgmt_cfg_remote?.limit__options ?? false; - // 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__session_agree = - pres_mgmt_cfg_remote?.require__session_agree ?? false; // New and in progress + // 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__session_agree = + pres_mgmt_cfg_remote?.require__session_agree ?? false; // New and in progress - // Show content: - // pres_mgmt_cfg_local.show__navigation = pres_mgmt_cfg_remote?.show__navigation ?? false; + // Show content: + // 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__email_access_link = - pres_mgmt_cfg_remote?.show__email_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.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; - // Deal with things that can be overridden: + // Deal with things that can be overridden: - // Locking the config is targeted at the trusted staff level and below. It is more or less ignored at the global manager and super levels. It may be enforced at the staff admin level? - // pres_mgmt_cfg_local.lock_config = pres_mgmt_cfg_remote?.lock_config ? true : false; // This disables the sync local config button and options. - if (pres_mgmt_cfg_local.lock_config) { - console.log(`The config should be locked! Forcing the sync!`); - // This is to forcibly sync the local config with the remote config. - pres_mgmt_cfg_local.sync_local_config = true; - } else { - // 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}` - ); + // Locking the config is targeted at the trusted staff level and below. It is more or less ignored at the global manager and super levels. It may be enforced at the staff admin level? + // pres_mgmt_cfg_local.lock_config = pres_mgmt_cfg_remote?.lock_config ? true : false; // This disables the sync local config button and options. + if (pres_mgmt_cfg_local.lock_config) { + console.log(`The config should be locked! Forcing the sync!`); + // This is to forcibly sync the local config with the remote config. + pres_mgmt_cfg_local.sync_local_config = true; + } else { + // 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}` + ); - // Check if the sync_local_config is undefined versus just false. - // if (pres_mgmt_cfg_local?.sync_local_config) { - // pres_mgmt_cfg_local.sync_local_config = true; - // } else { - // pres_mgmt_cfg_local.sync_local_config = pres_mgmt_cfg_remote?.sync_local_config ?? false; - // } - } + // Check if the sync_local_config is undefined versus just false. + // if (pres_mgmt_cfg_local?.sync_local_config) { + // pres_mgmt_cfg_local.sync_local_config = true; + // } else { + // pres_mgmt_cfg_local.sync_local_config = pres_mgmt_cfg_remote?.sync_local_config ?? false; + // } + } - if (pres_mgmt_cfg_local?.sync_local_config) { - if (log_lvl) { - console.log(`Syncing the local config with the remote config!!!`); - } - // Hide content: - pres_mgmt_cfg_local.hide__location_code = pres_mgmt_cfg_remote?.hide__location_code ?? false; + if (pres_mgmt_cfg_local?.sync_local_config) { + if (log_lvl) { + console.log(`Syncing the local config with the remote config!!!`); + } + // Hide content: + 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_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__presentation_code = + pres_mgmt_cfg_remote?.hide__presentation_code ?? 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_biography = - pres_mgmt_cfg_remote?.hide__presenter_biography ?? 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__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_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_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_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_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_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.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_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__email_access_link = pres_mgmt_cfg_remote?.show__email_access_link ?? false; - // pres_mgmt_cfg_local.show__launcher_link = pres_mgmt_cfg_remote?.show__launcher_link ?? false; - // pres_mgmt_cfg_local.show__launcher_link_legacy = pres_mgmt_cfg_remote?.show__launcher_link_legacy ?? 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__launcher_link = pres_mgmt_cfg_remote?.show__launcher_link ?? 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_legacy = - pres_mgmt_cfg_remote?.hide_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_legacy = + pres_mgmt_cfg_remote?.hide_launcher_link_legacy ?? false; + } - if (log_lvl) { - console.log(`pres_mgmt_cfg_local:`, pres_mgmt_cfg_local); - } - return pres_mgmt_cfg_local; + if (log_lvl) { + console.log(`pres_mgmt_cfg_local:`, pres_mgmt_cfg_local); + } + return pres_mgmt_cfg_local; } // Updated 2025-05-09 export const properties_to_save = [ - 'id', - 'event_id', - 'event_id_random', + 'id', + 'event_id', + 'event_id_random', - 'code', + 'code', - 'account_id', - 'account_id_random', + 'account_id', + 'account_id_random', - 'conference', - 'type', - 'name', - 'summary', - 'description', + 'conference', + 'type', + 'name', + 'summary', + 'description', - 'start_datetime', - 'end_datetime', - 'timezone', + 'start_datetime', + 'end_datetime', + 'timezone', - 'location_address_json', - 'location_text', + 'location_address_json', + 'location_text', - 'attend_json', - 'attend_text', + 'attend_json', + 'attend_text', - 'status', // draft, active, inactive, archived, unknown; currently only used with IDAA - // review - // approve - // ready - // ready_on - // archive - // archive_on + 'status', // draft, active, inactive, archived, unknown; currently only used with IDAA + // review + // approve + // ready + // ready_on + // archive + // archive_on - 'mod_abstracts_json', - 'mod_badges_json', - 'mod_exhibits_json', - 'mod_meetings_json', - 'mod_pres_mgmt_json', - 'cfg_json', + 'mod_abstracts_json', + 'mod_badges_json', + 'mod_exhibits_json', + 'mod_meetings_json', + 'mod_pres_mgmt_json', + 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // IDAA Recovery Meetings: - // Currently only really used for IDAA - 'contact_li_json', - 'external_person_id', + // IDAA Recovery Meetings: + // Currently only really used for IDAA + 'contact_li_json', + 'external_person_id', - 'physical', - 'virtual', + 'physical', + 'virtual', - 'recurring', - 'recurring_pattern', - 'recurring_start_time', - 'recurring_end_time', - 'recurring_text', + 'recurring', + 'recurring_pattern', + 'recurring_start_time', + 'recurring_end_time', + 'recurring_text', - 'weekday_sunday', - 'weekday_monday', - 'weekday_tuesday', - 'weekday_wednesday', - 'weekday_thursday', - 'weekday_friday', - 'weekday_saturday', + 'weekday_sunday', + 'weekday_monday', + 'weekday_tuesday', + 'weekday_wednesday', + 'weekday_thursday', + 'weekday_friday', + 'weekday_saturday', - 'attend_url', - 'attend_url_text', - 'attend_url_code', - 'attend_url_passcode', - 'attend_phone', - 'attend_phone_passcode', + 'attend_url', + 'attend_url_text', + 'attend_url_code', + 'attend_url_passcode', + 'attend_phone', + 'attend_phone_passcode', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'file_count', - 'file_count_all', - 'internal_use_count', - 'event_file_id_li_json' - // 'event_session_count', - // 'event_presenter_count', - // 'event_file_count', + // From SQL view + 'file_count', + 'file_count_all', + 'internal_use_count', + 'event_file_id_li_json' + // 'event_session_count', + // 'event_presenter_count', + // 'event_file_count', - // A key value list of the others - // 'event_other_kv', - // 'event_other_li', + // A key value list of the others + // 'event_other_kv', + // 'event_other_li', ]; /** @@ -1149,87 +1153,87 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-11-13 export async function process_ae_obj__event_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event', - log_lvl, - specific_processor: (obj) => { - // Handle event-specific property aliases - if (obj.event_code) { - obj.code = obj.event_code; - } - return obj; - } - }); + return _process_generic_props({ + obj_li, + obj_type: 'event', + log_lvl, + specific_processor: (obj) => { + // Handle event-specific property aliases + if (obj.event_code) { + obj.code = obj.event_code; + } + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_badge.ts b/src/lib/ae_events/ae_events__event_badge.ts index 763090ec..fac7e4b6 100644 --- a/src/lib/ae_events/ae_events__event_badge.ts +++ b/src/lib/ae_events/ae_events__event_badge.ts @@ -10,591 +10,594 @@ const ae_promises: key_val = {}; // Updated 2025-10-06 export async function load_ae_obj_id__event_badge({ - api_cfg, - event_badge_id, - inc_template = true, - try_cache = true, - log_lvl = 0 + api_cfg, + event_badge_id, + inc_template = true, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_badge_id: string; - inc_template?: boolean; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_badge_id: string; + inc_template?: boolean; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`); - } - const params = {}; - ae_promises.load__event_badge_obj = await api - .get_ae_obj_id_crud({ - api_cfg, - obj_type: 'event_badge', - obj_id: event_badge_id, - use_alt_table: false, - use_alt_base: false, - params, - log_lvl - }) - .then(async function (badge_obj_get_result) { - if (badge_obj_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_props({ - obj_li: [badge_obj_get_result], - log_lvl - }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return badge_obj_get_result; - } else { - if (log_lvl) console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + if (log_lvl) { + console.log(`*** load_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`); + } + const params = {}; + ae_promises.load__event_badge_obj = await api + .get_ae_obj_id_crud({ + api_cfg, + obj_type: 'event_badge', + obj_id: event_badge_id, + use_alt_table: false, + use_alt_base: false, + params, + log_lvl + }) + .then(async function (badge_obj_get_result) { + if (badge_obj_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_props({ + obj_li: [badge_obj_get_result], + log_lvl + }); + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return badge_obj_get_result; + } else { + if (log_lvl) console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (inc_template) { - // Load the templates for the event badge - if (log_lvl) { - console.log(`Need to load the template for the badge now`); - } - const load_event_badge_template_obj = load_ae_obj_id__event_badge_template({ - api_cfg: api_cfg, - event_badge_template_id: ae_promises.load__event_badge_obj?.event_badge_template_id_random, - log_lvl: log_lvl - }).then((event_badge_template_obj_li) => { - if (log_lvl) { - console.log(`event_badge_template_obj_li = `, event_badge_template_obj_li); - } - return event_badge_template_obj_li; - }); + if (inc_template) { + // Load the templates for the event badge + if (log_lvl) { + console.log(`Need to load the template for the badge now`); + } + const load_event_badge_template_obj = load_ae_obj_id__event_badge_template({ + api_cfg: api_cfg, + event_badge_template_id: + ae_promises.load__event_badge_obj?.event_badge_template_id_random, + log_lvl: log_lvl + }).then((event_badge_template_obj_li) => { + if (log_lvl) { + console.log(`event_badge_template_obj_li = `, event_badge_template_obj_li); + } + return event_badge_template_obj_li; + }); - if (log_lvl) { - console.log(`event_badge_template_obj = `, load_event_badge_template_obj); - } - ae_promises.load__event_session_obj.event_badge_template = load_event_badge_template_obj; - } + if (log_lvl) { + console.log(`event_badge_template_obj = `, load_event_badge_template_obj); + } + ae_promises.load__event_session_obj.event_badge_template = load_event_badge_template_obj; + } - return ae_promises.load__event_badge_obj; + return ae_promises.load__event_badge_obj; } // Updated 2025-10-06 export async function load_ae_obj_li__event_badge({ - api_cfg, - event_id, - inc_template = true, // This should probably be false. - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + inc_template = true, // This should probably be false. + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - inc_template?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + inc_template?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_li__event_badge() *** event_id=${event_id}`); - } - 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_badge', - for_obj_type: 'event', - for_obj_id: event_id, - // use_alt_tbl: false, - // use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (badge_obj_li_get_result) { - if (badge_obj_li_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_props({ - obj_li: badge_obj_li_get_result, - log_lvl - }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return badge_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + if (log_lvl) { + console.log(`*** load_ae_obj_li__event_badge() *** event_id=${event_id}`); + } + 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_v2({ + api_cfg: api_cfg, + obj_type: 'event_badge', + for_obj_type: 'event', + for_obj_id: event_id, + // use_alt_tbl: false, + // use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (badge_obj_li_get_result) { + if (badge_obj_li_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_props({ + obj_li: badge_obj_li_get_result, + log_lvl + }); + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return badge_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (inc_template) { - // Load the template for each badge - if (log_lvl) { - console.log(`Need to load the template for each badge now`); - } - for (const badge_obj of ae_promises.load__event_badge_obj_li) { - if (log_lvl) { - console.log(`Loading template for badge_obj: `, badge_obj); - } - const load_event_badge_template_obj = await load_ae_obj_id__event_badge_template({ - api_cfg: api_cfg, - event_badge_template_id: badge_obj?.event_badge_template_id_random, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log(`event_badge_template_obj = `, load_event_badge_template_obj); - } - badge_obj.event_badge_template = load_event_badge_template_obj; - } - } + if (inc_template) { + // Load the template for each badge + if (log_lvl) { + console.log(`Need to load the template for each badge now`); + } + for (const badge_obj of ae_promises.load__event_badge_obj_li) { + if (log_lvl) { + console.log(`Loading template for badge_obj: `, badge_obj); + } + const load_event_badge_template_obj = await load_ae_obj_id__event_badge_template({ + api_cfg: api_cfg, + event_badge_template_id: badge_obj?.event_badge_template_id_random, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log(`event_badge_template_obj = `, 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 export async function create_ae_obj__event_badge({ - api_cfg, - event_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`); - } - ae_promises.create__event_badge = await api - .create_ae_obj_crud({ - api_cfg, - obj_type: 'event_badge', - fields: { - event_id_random: event_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params, - return_obj: true, - log_lvl - }) - .then(async function (event_badge_obj_create_result) { - if (event_badge_obj_create_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_props({ - obj_li: [event_badge_obj_create_result], - log_lvl - }); - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return event_badge_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.create__event_badge; + if (log_lvl) { + console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`); + } + ae_promises.create__event_badge = await api + .create_ae_obj_crud({ + api_cfg, + obj_type: 'event_badge', + fields: { + event_id_random: event_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params, + return_obj: true, + log_lvl + }) + .then(async function (event_badge_obj_create_result) { + if (event_badge_obj_create_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_props({ + obj_li: [event_badge_obj_create_result], + log_lvl + }); + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return event_badge_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.create__event_badge; } // Updated 2025-10-06 export async function delete_ae_obj_id__event_badge({ - api_cfg, - event_badge_id, - method = 'delete', - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_badge_id, + method = 'delete', + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_badge_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_badge_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg, - obj_type: 'event_badge', - obj_id: event_badge_id, - key: api_cfg.api_crud_super_key, - params, - method, - log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for event_badge_id=${event_badge_id}`); - } - db_events.badge.delete(event_badge_id); - } - }); - return ae_promises.delete__event_badge_obj; + if (log_lvl) { + 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({ + api_cfg, + obj_type: 'event_badge', + obj_id: event_badge_id, + key: api_cfg.api_crud_super_key, + params, + method, + log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_badge_id=${event_badge_id}` + ); + } + db_events.badge.delete(event_badge_id); + } + }); + return ae_promises.delete__event_badge_obj; } // Updated 2025-10-06 export async function update_ae_obj__event_badge({ - api_cfg, - event_badge_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_badge_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_badge_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_badge_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg, - obj_type: 'event_badge', - obj_id: event_badge_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params, - return_obj: true, - log_lvl - }) - .then(async function (event_badge_obj_update_result) { - if (event_badge_obj_update_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_props({ - obj_li: [event_badge_obj_update_result], - log_lvl - }); - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return event_badge_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.update__event_badge_obj; + if (log_lvl) { + 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({ + api_cfg, + obj_type: 'event_badge', + obj_id: event_badge_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params, + return_obj: true, + log_lvl + }) + .then(async function (event_badge_obj_update_result) { + if (event_badge_obj_update_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_props({ + obj_li: [event_badge_obj_update_result], + log_lvl + }); + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return event_badge_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.update__event_badge_obj; } // Is this needed? // Updated 2025-10-06 export async function qry__event_badge({ - api_cfg, - event_id, - qry_str = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + qry_str = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - qry_str?: null | string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + qry_str?: null | string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** qry__event_badge() *** event_id=${event_id}`); - } - const params_json: key_val = {}; - if (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({ - api_cfg, - event_id, - enabled, - hidden, - limit, - offset, - order_by_li, - params: { ...params, ...params_json }, - try_cache, - log_lvl - }); - return ae_promises.qry__event_badge_obj_li; + if (log_lvl) { + console.log(`*** qry__event_badge() *** event_id=${event_id}`); + } + const params_json: key_val = {}; + if (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({ + api_cfg, + event_id, + enabled, + hidden, + limit, + offset, + order_by_li, + params: { ...params, ...params_json }, + try_cache, + log_lvl + }); + return ae_promises.qry__event_badge_obj_li; } // Updated 2025-10-06 export async function search__event_badge({ - api_cfg, - event_id, - type_code = null, - fulltext_search_qry_str, - like_search_qry_str = null, - external_event_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 25, - offset = 0, - order_by_li = { - print_count: 'ASC', - priority: 'DESC', - sort: 'DESC', - given_name: 'ASC', - family_name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + type_code = null, + fulltext_search_qry_str, + like_search_qry_str = null, + external_event_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 25, + offset = 0, + order_by_li = { + print_count: 'ASC', + priority: 'DESC', + sort: 'DESC', + given_name: 'ASC', + family_name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - type_code?: null | string; - external_event_id?: null | string; - fulltext_search_qry_str?: null | string; - like_search_qry_str?: null | string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + type_code?: null | string; + external_event_id?: null | string; + fulltext_search_qry_str?: null | string; + like_search_qry_str?: null | string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** search__event_badge() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** search__event_badge() *** event_id=${event_id}`); + } - if (!fulltext_search_qry_str && !like_search_qry_str) { - console.log('No search string provided!!!'); - return false; // Returning false instead of [] because no search was performed. - } + if (!fulltext_search_qry_str && !like_search_qry_str) { + console.log('No search string provided!!!'); + return false; // Returning false instead of [] because no search was performed. + } - const params_json: key_val = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry'] = { default_qry_str: fulltext_search_qry_str }; - // '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 - } - if (like_search_qry_str && like_search_qry_str.length > 2) { - // Old Python version that needs to be in JS - // # Strip (left right) whitespace then commas then semicolons - // query_str = query_str.strip().strip(',').strip(';') - // # Replace commas, semicolons, and then spaces with % - // query_str_like = query_str.replace(',', ' ').replace(';', ' ').replace(' ', '%').replace(' ', '%') - // # data['query_str'] = f'%{query_str}%' - // log.debug(query_str_like) - // data['query_str'] = f'%{query_str_like}%' + const params_json: key_val = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry'] = { default_qry_str: fulltext_search_qry_str }; + // '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 + } + if (like_search_qry_str && like_search_qry_str.length > 2) { + // Old Python version that needs to be in JS + // # Strip (left right) whitespace then commas then semicolons + // query_str = query_str.strip().strip(',').strip(';') + // # Replace commas, semicolons, and then spaces with % + // query_str_like = query_str.replace(',', ' ').replace(';', ' ').replace(' ', '%').replace(' ', '%') + // # data['query_str'] = f'%{query_str}%' + // log.debug(query_str_like) + // data['query_str'] = f'%{query_str_like}%' - // let like_search_qry_str_new = like_search_qry_str.trim().replace(',', ' ').replace(';', ' ').replace(' ', '%').replace(' ', '%'); - // like_search_qry_str_new = `%${like_search_qry_str_new}%`; - // console.log('like_search_qry_str_new:', like_search_qry_str_new); + // let like_search_qry_str_new = like_search_qry_str.trim().replace(',', ' ').replace(';', ' ').replace(' ', '%').replace(' ', '%'); + // 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'] = {}; - if (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. - params_json['and_qry']['badge_type_code'] = type_code; - } + params_json['and_qry'] = {}; + if (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. + 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_v2({ - api_cfg, - obj_type: 'event_badge', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: false, - use_alt_mdl: true, - enabled, - hidden, - order_by_li, - limit, - offset, - params_json, - params, - log_lvl - }) - .then(async function (badge_obj_li_get_result) { - if (badge_obj_li_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_props({ - obj_li: badge_obj_li_get_result, - log_lvl - }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return badge_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.search__event_badge_obj_li; + // 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({ + api_cfg, + obj_type: 'event_badge', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: false, + use_alt_mdl: true, + enabled, + hidden, + order_by_li, + limit, + offset, + params_json, + params, + log_lvl + }) + .then(async function (badge_obj_li_get_result) { + if (badge_obj_li_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_props({ + obj_li: badge_obj_li_get_result, + log_lvl + }); + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return badge_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.search__event_badge_obj_li; } // Updated 2025-10-06 export const properties_to_save = [ - 'id', - 'event_badge_id', - // 'event_badge_id_random', + 'id', + 'event_badge_id', + // 'event_badge_id_random', - 'event_id', - // 'event_id_random', + 'event_id', + // 'event_id_random', - 'event_badge_template_id', - // 'event_badge_template_id_random', + 'event_badge_template_id', + // 'event_badge_template_id_random', - 'pronouns', - 'informal_name', - 'title_names', - 'given_name', - 'middle_name', - 'family_name', - 'designations', + 'pronouns', + 'informal_name', + 'title_names', + 'given_name', + 'middle_name', + 'family_name', + 'designations', - 'professional_title', - 'professional_title_override', + 'professional_title', + 'professional_title_override', - 'full_name', - 'full_name_override', + 'full_name', + 'full_name_override', - 'affiliations', - 'affiliations_override', + 'affiliations', + 'affiliations_override', - 'email', - 'email_override', + 'email', + 'email_override', - 'address_line_1', - 'address_line_2', - 'address_line_3', - 'city', - 'country_subdivision_code', - 'state_province', - 'state_province_abb', - 'postal_code', - 'country_alpha_2_code', - 'country', - 'full_address', - 'location', - 'location_override', + 'address_line_1', + 'address_line_2', + 'address_line_3', + 'city', + 'country_subdivision_code', + 'state_province', + 'state_province_abb', + 'postal_code', + 'country_alpha_2_code', + 'country', + 'full_address', + 'location', + 'location_override', - 'query_str', + 'query_str', - 'badge_type', - 'badge_type_code', - 'badge_type_override', - 'badge_type_code_override', - 'external_event_id', - 'external_id', - 'external_person_id', + 'badge_type', + 'badge_type_code', + 'badge_type_override', + 'badge_type_code_override', + 'external_event_id', + 'external_id', + 'external_person_id', - 'default_qry_string', + 'default_qry_string', - 'alert', + 'alert', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', - 'person_external_id', - 'person_external_sys_id', - 'person_given_name', - 'person_family_name', - 'person_full_name', - 'person_professional_title', - 'person_affiliations', - 'person_primary_email', - 'person_passcode' + 'person_external_id', + 'person_external_sys_id', + 'person_given_name', + 'person_family_name', + 'person_full_name', + 'person_professional_title', + 'person_affiliations', + 'person_primary_email', + 'person_passcode' ]; /** @@ -602,91 +605,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-10-06 export async function process_ae_obj__event_badge_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_badge', - log_lvl, - specific_processor: (obj) => { - // Event badge-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.print_count ?? '0'}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.given_name ?? ''}_${obj.family_name ?? ''}_${obj.updated_on ?? obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_badge', + log_lvl, + specific_processor: (obj) => { + // Event badge-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.print_count ?? '0'}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.given_name ?? ''}_${obj.family_name ?? ''}_${obj.updated_on ?? obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_badge_template.ts b/src/lib/ae_events/ae_events__event_badge_template.ts index 37107117..c0280b45 100644 --- a/src/lib/ae_events/ae_events__event_badge_template.ts +++ b/src/lib/ae_events/ae_events__event_badge_template.ts @@ -7,76 +7,76 @@ const ae_promises: key_val = {}; // --- PROPERTIES TO SAVE --- export const properties_to_save = [ - 'id', - 'event_badge_template_id', - // 'event_badge_template_id_random', + 'id', + 'event_badge_template_id', + // 'event_badge_template_id_random', - 'event_id', - // 'event_id_random', + 'event_id', + // 'event_id_random', - 'name', - 'description', + 'name', + 'description', - // 'template_code', - // 'template_type', - // 'template_json', - // 'template_svg', - // 'template_css', - // 'template_html', + // 'template_code', + // 'template_type', + // 'template_json', + // 'template_svg', + // 'template_css', + // 'template_html', - 'logo_filename', - 'logo_path', + 'logo_filename', + 'logo_path', - 'header_path', - 'secondary_header_path', - 'footer_path', + 'header_path', + 'secondary_header_path', + 'footer_path', - 'header_row_1', - 'header_row_2', + 'header_row_1', + 'header_row_2', - // 'footer_title', - // 'footer_left', - // 'footer_right', - // 'header_background', - // 'footer_background', + // 'footer_title', + // 'footer_left', + // 'footer_right', + // 'header_background', + // 'footer_background', - 'badge_type_list', - 'ticket_list', + 'badge_type_list', + 'ticket_list', - 'ticket_1_text', - 'ticket_2_text', - 'ticket_3_text', - 'ticket_4_text', - 'ticket_5_text', - 'ticket_6_text', - 'ticket_7_text', - 'ticket_8_text', - // 'ticket_9_text', - // 'ticket_10_text', + 'ticket_1_text', + 'ticket_2_text', + 'ticket_3_text', + 'ticket_4_text', + 'ticket_5_text', + 'ticket_6_text', + 'ticket_7_text', + 'ticket_8_text', + // 'ticket_9_text', + // 'ticket_10_text', - 'wireless_ssid', - 'wireless_password', + 'wireless_ssid', + 'wireless_password', - 'show_qr_front', - 'show_qr_back', + 'show_qr_front', + 'show_qr_back', - 'layout', - 'style_filename', - // 'style_href', + 'layout', + 'style_filename', + // 'style_href', - // 'default', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + // 'default', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' ]; /** @@ -84,466 +84,466 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // --- PROCESS FUNCTION --- export async function process_ae_obj__event_badge_template_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_badge_template', - log_lvl, - specific_processor: (obj) => { - // Event badge template-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_badge_template', + log_lvl, + specific_processor: (obj) => { + // Event badge template-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } // --- CRUD FUNCTIONS --- export async function load_ae_obj_id__event_badge_template({ - api_cfg, - event_badge_template_id, - try_cache = true, - log_lvl = 0 + api_cfg, + event_badge_template_id, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_badge_template_id: string; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_badge_template_id: string; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_id__event_badge_template() *** event_badge_template_id=${event_badge_template_id}` - ); - } - const params = {}; - ae_promises.load__event_badge_template_obj = await api - .get_ae_obj_id_crud({ - api_cfg, - obj_type: 'event_badge_template', - obj_id: event_badge_template_id, - use_alt_table: false, - use_alt_base: false, - params, - log_lvl - }) - .then(async function (obj_get_result) { - if (obj_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_template_props({ - obj_li: [obj_get_result], - log_lvl - }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge_template', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return obj_get_result; - } else { - if (log_lvl) console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.load__event_badge_template_obj; + if (log_lvl) { + console.log( + `*** load_ae_obj_id__event_badge_template() *** event_badge_template_id=${event_badge_template_id}` + ); + } + const params = {}; + ae_promises.load__event_badge_template_obj = await api + .get_ae_obj_id_crud({ + api_cfg, + obj_type: 'event_badge_template', + obj_id: event_badge_template_id, + use_alt_table: false, + use_alt_base: false, + params, + log_lvl + }) + .then(async function (obj_get_result) { + if (obj_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_template_props({ + obj_li: [obj_get_result], + log_lvl + }); + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge_template', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return obj_get_result; + } else { + if (log_lvl) console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.load__event_badge_template_obj; } export async function load_ae_obj_li__event_badge_template({ - api_cfg, - event_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_li__event_badge_template() *** event_id=${event_id}`); - } - 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_v2({ - api_cfg, - obj_type: 'event_badge_template', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: false, - use_alt_mdl: false, - enabled, - hidden, - order_by_li, - limit, - offset, - params_json, - params, - log_lvl - }) - .then(async function (obj_li_get_result) { - if (obj_li_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_template_props({ - obj_li: obj_li_get_result, - log_lvl - }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge_template', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.load__event_badge_template_obj_li; + if (log_lvl) { + console.log(`*** load_ae_obj_li__event_badge_template() *** event_id=${event_id}`); + } + 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_v2({ + api_cfg, + obj_type: 'event_badge_template', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: false, + use_alt_mdl: false, + enabled, + hidden, + order_by_li, + limit, + offset, + params_json, + params, + log_lvl + }) + .then(async function (obj_li_get_result) { + if (obj_li_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_template_props({ + obj_li: obj_li_get_result, + log_lvl + }); + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge_template', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.load__event_badge_template_obj_li; } export async function create_ae_obj__event_badge_template({ - api_cfg, - event_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__event_badge_template() *** event_id=${event_id}`); - } - ae_promises.create__event_badge_template = await api - .create_ae_obj_crud({ - api_cfg, - obj_type: 'event_badge_template', - fields: { - event_id_random: event_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params, - return_obj: true, - log_lvl - }) - .then(async function (obj_create_result) { - if (obj_create_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_template_props({ - obj_li: [obj_create_result], - log_lvl - }); - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge_template', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.create__event_badge_template; + if (log_lvl) { + console.log(`*** create_ae_obj__event_badge_template() *** event_id=${event_id}`); + } + ae_promises.create__event_badge_template = await api + .create_ae_obj_crud({ + api_cfg, + obj_type: 'event_badge_template', + fields: { + event_id_random: event_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params, + return_obj: true, + log_lvl + }) + .then(async function (obj_create_result) { + if (obj_create_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_template_props({ + obj_li: [obj_create_result], + log_lvl + }); + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge_template', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.create__event_badge_template; } export async function delete_ae_obj_id__event_badge_template({ - api_cfg, - event_badge_template_id, - method = 'delete', - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_badge_template_id, + method = 'delete', + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_badge_template_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_badge_template_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg, - obj_type: 'event_badge_template', - obj_id: event_badge_template_id, - key: api_cfg.api_crud_super_key, - params, - method, - log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - 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); - } - }); - return ae_promises.delete__event_badge_template_obj; + if (log_lvl) { + 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({ + api_cfg, + obj_type: 'event_badge_template', + obj_id: event_badge_template_id, + key: api_cfg.api_crud_super_key, + params, + method, + log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + 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); + } + }); + return ae_promises.delete__event_badge_template_obj; } export async function update_ae_obj__event_badge_template({ - api_cfg, - event_badge_template_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_badge_template_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_badge_template_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_badge_template_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg, - obj_type: 'event_badge_template', - obj_id: event_badge_template_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params, - return_obj: true, - log_lvl - }) - .then(async function (obj_update_result) { - if (obj_update_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_template_props({ - obj_li: [obj_update_result], - log_lvl - }); - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge_template', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.update__event_badge_template_obj; + if (log_lvl) { + 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({ + api_cfg, + obj_type: 'event_badge_template', + obj_id: event_badge_template_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params, + return_obj: true, + log_lvl + }) + .then(async function (obj_update_result) { + if (obj_update_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_template_props({ + obj_li: [obj_update_result], + log_lvl + }); + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge_template', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.update__event_badge_template_obj; } // --- SEARCH FUNCTION --- export async function search__event_badge_template({ - api_cfg, - event_id, - fulltext_search_qry_str, - like_search_qry_str = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 25, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + fulltext_search_qry_str, + like_search_qry_str = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 25, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - fulltext_search_qry_str?: null | string; - like_search_qry_str?: null | string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + fulltext_search_qry_str?: null | string; + like_search_qry_str?: null | string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** search__event_badge_template() *** event_id=${event_id}`); - } - const params_json: key_val = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry'] = { default_qry_str: fulltext_search_qry_str }; - } - 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_qry'] = {}; - // 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({ - api_cfg, - obj_type: 'event_badge_template', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: false, - use_alt_mdl: false, - enabled, - hidden, - order_by_li, - limit, - offset, - params_json, - params, - log_lvl - }) - .then(async function (obj_li_get_result) { - if (obj_li_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_badge_template_props({ - obj_li: obj_li_get_result, - log_lvl - }); - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'badge_template', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - } - return obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); - return ae_promises.search__event_badge_template_obj_li; + if (log_lvl) { + console.log(`*** search__event_badge_template() *** event_id=${event_id}`); + } + const params_json: key_val = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry'] = { default_qry_str: fulltext_search_qry_str }; + } + 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_qry'] = {}; + // 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({ + api_cfg, + obj_type: 'event_badge_template', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: false, + use_alt_mdl: false, + enabled, + hidden, + order_by_li, + limit, + offset, + params_json, + params, + log_lvl + }) + .then(async function (obj_li_get_result) { + if (obj_li_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_badge_template_props({ + obj_li: obj_li_get_result, + log_lvl + }); + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'badge_template', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + } + return obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); + return ae_promises.search__event_badge_template_obj_li; } diff --git a/src/lib/ae_events/ae_events__event_device.ts b/src/lib/ae_events/ae_events__event_device.ts index 4e9e7c57..e8c3b86a 100644 --- a/src/lib/ae_events/ae_events__event_device.ts +++ b/src/lib/ae_events/ae_events__event_device.ts @@ -10,667 +10,676 @@ const ae_promises: key_val = {}; // Updated 2025-05-23 export async function load_ae_obj_id__event_device({ - api_cfg, - event_device_id, - inc_location_id = false, - try_cache = true, - log_lvl = 0 + api_cfg, + event_device_id, + inc_location_id = false, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_device_id: string; - inc_location_id?: boolean; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_device_id: string; + inc_location_id?: boolean; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__event_device() *** event_device_id=${event_device_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__event_device() *** event_device_id=${event_device_id}`); + } - const params = {}; + const params = {}; - ae_promises.load__event_device_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_device', - obj_id: event_device_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (event_device_obj_get_result) { - if (event_device_obj_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: [event_device_obj_get_result], - log_lvl - }); - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_device_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + obj_id: event_device_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (event_device_obj_get_result) { + if (event_device_obj_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_device_props({ + obj_li: [event_device_obj_get_result], + log_lvl + }); + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__event_device({ - // obj_type: 'event_device', - // obj_li: [event_device_obj_get_result] - // }); - } - return event_device_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__event_device({ + // obj_type: 'event_device', + // obj_li: [event_device_obj_get_result] + // }); + } + return event_device_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_device_obj:', ae_promises.load__event_device_obj); - } + if (log_lvl) { + console.log('ae_promises.load__event_device_obj:', ae_promises.load__event_device_obj); + } - if (inc_location_id) { - // Load the location linked to this device - if (log_lvl) { - console.log(`Need to load the location id for the device now`); - } - const load_event_location_obj_id = load_ae_obj_id__event_location({ - api_cfg: api_cfg, - event_location_id: ae_promises.load__event_device_obj.event_location_id, - try_cache: try_cache, - log_lvl: log_lvl - }); + if (inc_location_id) { + // Load the location linked to this device + if (log_lvl) { + console.log(`Need to load the location id for the device now`); + } + const load_event_location_obj_id = load_ae_obj_id__event_location({ + api_cfg: api_cfg, + event_location_id: ae_promises.load__event_device_obj.event_location_id, + try_cache: try_cache, + log_lvl: log_lvl + }); - if (log_lvl) { - console.log(`load_event_location_obj_id = `, load_event_location_obj_id); - } - ae_promises.load__event_device_obj.event_location_obj = load_event_location_obj_id; - } + if (log_lvl) { + console.log(`load_event_location_obj_id = `, load_event_location_obj_id); + } + ae_promises.load__event_device_obj.event_location_obj = load_event_location_obj_id; + } - return ae_promises.load__event_device_obj; + return ae_promises.load__event_device_obj; } // Updated 2025-05-23 export async function load_ae_obj_li__event_device({ - api_cfg, - for_obj_type, - for_obj_id, - inc_location_id = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - code: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type, + for_obj_id, + inc_location_id = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + code: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_location_id?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; // 99 - offset?: number; // 0 - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_location_id?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; // 99 + offset?: number; // 0 + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__event_device() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 99); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const 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({ - api_cfg: api_cfg, - obj_type: 'event_device', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_device_obj_li_get_result) { - if (event_device_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: event_device_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_device_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'event_device', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_device_obj_li_get_result) { + if (event_device_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_device_props({ + obj_li: event_device_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_device({ - // obj_type: 'event_device', - // obj_li: event_device_obj_li_get_result - // }); - } - return event_device_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__event_device({ + // obj_type: 'event_device', + // obj_li: event_device_obj_li_get_result + // }); + } + return event_device_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li); - } + if (log_lvl) { + console.log( + 'ae_promises.load__event_device_obj_li:', + ae_promises.load__event_device_obj_li + ); + } - if (inc_location_id) { - // Load the location for the devices - if (log_lvl) { - 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++) { - const event_device_obj = ae_promises.load__event_device_obj_li[i]; + if (inc_location_id) { + // Load the location for the devices + if (log_lvl) { + 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++) { + const event_device_obj = ae_promises.load__event_device_obj_li[i]; - const load_event_location_obj_li = load_ae_obj_id__event_location({ - api_cfg: api_cfg, - event_location_id: event_device_obj.event_location_id, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_location_obj_li) => { - if (log_lvl) { - console.log(`event_location_obj_li = `, event_location_obj_li); - } - return event_location_obj_li; - }); + const load_event_location_obj_li = load_ae_obj_id__event_location({ + api_cfg: api_cfg, + event_location_id: event_device_obj.event_location_id, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_location_obj_li) => { + if (log_lvl) { + console.log(`event_location_obj_li = `, event_location_obj_li); + } + return event_location_obj_li; + }); - if (log_lvl) { - console.log(`load_event_location_obj_li = `, load_event_location_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_event_location_obj_li = `, load_event_location_obj_li); + } + } + } - return ae_promises.load__event_device_obj_li; + return ae_promises.load__event_device_obj_li; } // Updated 2025-05-23 export async function create_ae_obj__event_device({ - api_cfg, - event_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__event_device() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__event_device() *** event_id=${event_id}`); + } - ae_promises.create__event_device = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'event_device', - fields: { - event_id_random: event_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_device_obj_create_result) { - if (event_device_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: [event_device_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__event_device = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + fields: { + event_id_random: event_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_device_obj_create_result) { + if (event_device_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_device_props({ + obj_li: [event_device_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_device( - // { - // obj_type: 'event_device', - // obj_li: [event_device_obj_create_result] - // }); - } - return event_device_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_device( + // { + // obj_type: 'event_device', + // obj_li: [event_device_obj_create_result] + // }); + } + return event_device_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__event_device:', ae_promises.create__event_device); - } - return ae_promises.create__event_device; + if (log_lvl) { + console.log('ae_promises.create__event_device:', ae_promises.create__event_device); + } + return ae_promises.create__event_device; } // Updated 2025-05-23 export async function delete_ae_obj_id__event_device({ - api_cfg, - event_device_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_device_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_device_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_device_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__event_device() *** event_device_id=${event_device_id}`); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_device', - obj_id: event_device_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for event_device_id=${event_device_id}`); - } - db_events.device.delete(event_device_id); - } - }); + ae_promises.delete__event_device_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + obj_id: event_device_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_device_id=${event_device_id}` + ); + } + db_events.device.delete(event_device_id); + } + }); - if (log_lvl) { - console.log('ae_promises.delete__event_device_obj:', ae_promises.delete__event_device_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__event_device_obj:', ae_promises.delete__event_device_obj); + } - return ae_promises.delete__event_device_obj; + return ae_promises.delete__event_device_obj; } // Updated 2024-10-16 export async function update_ae_obj__event_device({ - api_cfg, - event_device_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_device_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_device_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_device_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg: api_cfg, - obj_type: 'event_device', - obj_id: event_device_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_device_obj_update_result) { - if (event_device_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: [event_device_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + if (log_lvl) { + 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({ + api_cfg: api_cfg, + obj_type: 'event_device', + obj_id: event_device_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_device_obj_update_result) { + if (event_device_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_device_props({ + obj_li: [event_device_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_device({ - // obj_type: 'event_device', obj_li: [event_device_obj_update_result] - // }); - } - return event_device_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_device({ + // obj_type: 'event_device', obj_li: [event_device_obj_update_result] + // }); + } + return event_device_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.update__event_device_obj:', ae_promises.update__event_device_obj); - } - return ae_promises.update__event_device_obj; + if (log_lvl) { + console.log('ae_promises.update__event_device_obj:', ae_promises.update__event_device_obj); + } + return ae_promises.update__event_device_obj; } // Not yet used or tested fully! // Updated 2025-05-23 export async function search__event_device({ - api_cfg, - event_id, - fulltext_search_qry_str, - ft_presenter_search_qry_str, - like_search_qry_str = null, - like_presentation_search_qry_str = null, - like_presenter_search_qry_str = null, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + fulltext_search_qry_str, + ft_presenter_search_qry_str, + like_search_qry_str = null, + like_presentation_search_qry_str = null, + like_presenter_search_qry_str = null, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - fulltext_search_qry_str?: null | string; - ft_presenter_search_qry_str?: null | string; - like_search_qry_str?: null | string; - like_presentation_search_qry_str?: null | string; - like_presenter_search_qry_str?: null | string; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + fulltext_search_qry_str?: null | string; + ft_presenter_search_qry_str?: null | string; + like_search_qry_str?: null | string; + like_presentation_search_qry_str?: null | string; + like_presenter_search_qry_str?: null | string; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** search__event_device() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** search__event_device() *** event_id=${event_id}`); + } - const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled - const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden - const limit: number = params.qry__limit ?? 25; // 99 - const offset: number = params.qry__offset ?? 0; // 0 + const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled + const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden + const limit: number = params.qry__limit ?? 25; // 99 + const offset: number = params.qry__offset ?? 0; // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - if (!fulltext_search_qry_str && !like_search_qry_str) { - console.log('No search string provided!!!'); - return false; // Returning false instead of [] because no search was performed. - } + if (!fulltext_search_qry_str && !like_search_qry_str) { + console.log('No search string provided!!!'); + return false; // Returning false instead of [] because no search was performed. + } - if (fulltext_search_qry_str || ft_presenter_search_qry_str) { - params_json['ft_qry'] = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; - } + if (fulltext_search_qry_str || ft_presenter_search_qry_str) { + params_json['ft_qry'] = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; + } - if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { - params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; - } - } + if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { + params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; + } + } - // Use the AND (AND LIKE) query - // if (like_search_qry_str || like_presenter_search_qry_str) { - // params_json['and_like'] = {}; - // if (like_search_qry_str && like_search_qry_str.length > 2) { - // params_json['and_like']['default_qry_str'] = like_search_qry_str; - // } - // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - // } - // } + // Use the AND (AND LIKE) query + // if (like_search_qry_str || like_presenter_search_qry_str) { + // params_json['and_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['and_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + // } + // } - // Use the AND (OR LIKE) query - if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { - params_json['or_like'] = {}; - if (like_search_qry_str && like_search_qry_str.length > 2) { - params_json['or_like']['default_qry_str'] = like_search_qry_str; - } - if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { - params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; - } - if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - } - } + // Use the AND (OR LIKE) query + if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { + params_json['or_like'] = {}; + if (like_search_qry_str && like_search_qry_str.length > 2) { + params_json['or_like']['default_qry_str'] = like_search_qry_str; + } + if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { + params_json['or_like']['event_presentation_li_qry_str'] = + like_presentation_search_qry_str; + } + if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + } + } - params_json['and_qry'] = {}; + params_json['and_qry'] = {}; - // if (device_type_code) { - // params_json['and_qry']['device_type_code'] = device_type_code; - // } + // if (device_type_code) { + // params_json['and_qry']['device_type_code'] = device_type_code; + // } - const 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_device', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for device searching - // use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_device_obj_li_get_result) { - if (event_device_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_device_props({ - obj_li: event_device_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'device', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_device_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // 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({ + api_cfg: api_cfg, + obj_type: 'event_device', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for device searching + // use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_device_obj_li_get_result) { + if (event_device_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_device_props({ + obj_li: event_device_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'device', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_device_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li); - } - return ae_promises.load__event_device_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__event_device_obj_li:', + ae_promises.load__event_device_obj_li + ); + } + return ae_promises.load__event_device_obj_li; } // Updated 2025-05-23 export const properties_to_save = [ - 'id', - 'event_device_id', - // 'event_device_id_random', + 'id', + 'event_device_id', + // 'event_device_id_random', - 'event_id', - // 'event_id_random', - 'event_location_id', - // 'event_location_id_random', + 'event_id', + // 'event_id_random', + 'event_location_id', + // 'event_location_id_random', - 'code', - 'name', - 'description', + 'code', + 'name', + 'description', - 'passcode', + 'passcode', - 'local_file_cache_path', - 'host_file_temp_path', - 'recording_path', + 'local_file_cache_path', + 'host_file_temp_path', + 'recording_path', - 'record_audio', - 'record_video', + 'record_audio', + 'record_video', - 'trigger_open_file_id', - 'trigger_open_session_id', - 'trigger_recording_start', - 'trigger_recording_stop', - 'trigger_reset', - 'trigger_show_admin', - 'trigger_show_hidden', + 'trigger_open_file_id', + 'trigger_open_session_id', + 'trigger_recording_start', + 'trigger_recording_stop', + 'trigger_reset', + 'trigger_show_admin', + 'trigger_show_hidden', - 'alert', - 'alert_msg', - 'alert_on', - 'status', - 'status_msg', - 'status_on', - 'record_status', - 'record_status_msg', - 'record_status_on', - 'heartbeat', + 'alert', + 'alert_msg', + 'alert_on', + 'status', + 'status_msg', + 'status_on', + 'record_status', + 'record_status_msg', + 'record_status_on', + 'heartbeat', - 'info_hostname', - 'info_ip_list', + 'info_hostname', + 'info_ip_list', - 'meta_json', - 'other_json', + 'meta_json', + 'other_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'event_name', - 'event_location_code', - 'event_location_name' + // From SQL view + 'event_name', + 'event_location_code', + 'event_location_name' ]; /** @@ -678,96 +687,96 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-23 export async function process_ae_obj__event_device_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_device', - log_lvl, - specific_processor: (obj) => { - // Special handling for heartbeat timestamp - if (obj.heartbeat) { - obj.heartbeat = obj.heartbeat + 'Z'; - } + return _process_generic_props({ + obj_li, + obj_type: 'event_device', + log_lvl, + specific_processor: (obj) => { + // Special handling for heartbeat timestamp + if (obj.heartbeat) { + obj.heartbeat = obj.heartbeat + 'Z'; + } - // Event device-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + // Event device-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_file.ts b/src/lib/ae_events/ae_events__event_file.ts index b7e41f8e..6b3183a7 100644 --- a/src/lib/ae_events/ae_events__event_file.ts +++ b/src/lib/ae_events/ae_events__event_file.ts @@ -8,750 +8,752 @@ const ae_promises: key_val = {}; // Updated 2025-07-21 export async function load_ae_obj_id__event_file({ - api_cfg, - event_file_id, - try_cache = false, - log_lvl = 0 + api_cfg, + event_file_id, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - event_file_id: string; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_file_id: string; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__event_file() *** event_file_id=${event_file_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__event_file() *** event_file_id=${event_file_id}`); + } - const params = {}; + const params = {}; - ae_promises.load__event_file_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_file', - obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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 - params: params, - log_lvl: log_lvl - }) - .then(async function (event_file_obj_get_result) { - if (event_file_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_file_props({ - obj_li: [event_file_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'file', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_file_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_file', + obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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 + params: params, + log_lvl: log_lvl + }) + .then(async function (event_file_obj_get_result) { + if (event_file_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_file_props({ + obj_li: [event_file_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'file', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // This is expecting a list - // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_get_result]}); - } - return event_file_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // This is expecting a list + // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_get_result]}); + } + return event_file_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__event_file_obj; + return ae_promises.load__event_file_obj; } // Updated 2025-07-21 export async function load_ae_obj_li__event_file({ - api_cfg, - for_obj_type, - for_obj_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type, + for_obj_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; // 99 - offset?: number; // 0 - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; // 99 + offset?: number; // 0 + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__event_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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: - 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)) { - console.log(`Invalid for_obj_type: ${for_obj_type}`); - return []; - } + // Check if for_obj_type is in the list of valid Aether object types: + 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)) { + console.log(`Invalid for_obj_type: ${for_obj_type}`); + return []; + } - const 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({ - api_cfg: api_cfg, - obj_type: 'event_file', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_file_obj_li_get_result) { - if (event_file_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_file_props({ - obj_li: event_file_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'file', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_file_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'event_file', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. + use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_file_obj_li_get_result) { + if (event_file_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_file_props({ + obj_li: event_file_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'file', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result}); - } - return event_file_obj_li_get_result; - } else { - console.log('No results returned.'); - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result}); + } + return event_file_obj_li_get_result; + } else { + console.log('No results returned.'); + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); - } - return ae_promises.load__event_file_obj_li; + if (log_lvl) { + console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); + } + return ae_promises.load__event_file_obj_li; } // Updated 2025-07-21 // This may need to be reviewed again??? export async function create_event_file_obj_from_hosted_file_async({ - api_cfg, - hosted_file_id, - params = {}, - data = {}, - return_obj = false, - inc_hosted_file = false, - return_meta = false, - log_lvl = 0 + api_cfg, + hosted_file_id, + params = {}, + data = {}, + return_obj = false, + inc_hosted_file = false, + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - hosted_file_id: string; - params?: key_val; - data?: key_val; - return_obj?: boolean; - inc_hosted_file?: boolean; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + hosted_file_id: string; + params?: key_val; + data?: key_val; + return_obj?: boolean; + inc_hosted_file?: boolean; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** create_event_file_obj_from_hosted_file_async() *** hosted_file_id=${hosted_file_id}` - ); - } + if (log_lvl) { + console.log( + `*** create_event_file_obj_from_hosted_file_async() *** hosted_file_id=${hosted_file_id}` + ); + } - if (!hosted_file_id) { - console.log(`ERROR: Events Launcher - Event File - hosted_file_id required to create`); - return false; - } + if (!hosted_file_id) { + console.log(`ERROR: Events Launcher - Event File - hosted_file_id required to create`); + return false; + } - const endpoint = `/event/file/from_hosted_file/${hosted_file_id}`; - if (return_obj) { - params['return_obj'] = true; - } - if (inc_hosted_file) { - params['inc_hosted_file'] = true; - } - const event_file_obj_post_promise = await api - .post_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - data: data, - // return_obj: return_obj, - return_meta: return_meta, - log_lvl: log_lvl - }) - .then(function (result) { - console.log('POST DONE create_event_file_obj_from_hosted_file'); - console.log(result); - return result; - }) - .catch(function (error: any) { - console.log(error); - return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. - // return error; - }); + const endpoint = `/event/file/from_hosted_file/${hosted_file_id}`; + if (return_obj) { + params['return_obj'] = true; + } + if (inc_hosted_file) { + params['inc_hosted_file'] = true; + } + const event_file_obj_post_promise = await api + .post_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + data: data, + // return_obj: return_obj, + return_meta: return_meta, + log_lvl: log_lvl + }) + .then(function (result) { + console.log('POST DONE create_event_file_obj_from_hosted_file'); + console.log(result); + return result; + }) + .catch(function (error: any) { + console.log(error); + return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. + // return error; + }); - // console.log(event_file_obj_post_promise); - if (return_obj) { - return event_file_obj_post_promise; - } else { - return event_file_obj_post_promise.event_file_id_random; - } + // console.log(event_file_obj_post_promise); + if (return_obj) { + return event_file_obj_post_promise; + } else { + return event_file_obj_post_promise.event_file_id_random; + } } // Updated 2025-07-21 export async function delete_ae_obj_id__event_file({ - api_cfg, - event_file_id, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_file_id, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_file_id: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_file_id: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__event_file() *** event_file_id=${event_file_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__event_file() *** event_file_id=${event_file_id}`); + } - const endpoint = `/event/file/${event_file_id}/v2`; + const endpoint = `/event/file/${event_file_id}/v2`; - 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['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. - ae_promises.delete__event_file_obj = await api - .delete_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - // return_meta: return_meta, - log_lvl: log_lvl - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for event_file_id=${event_file_id}`); - } - db_events.file.delete(event_file_id); // Delete from the DB no matter what. - } - }); + ae_promises.delete__event_file_obj = await api + .delete_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + // return_meta: return_meta, + log_lvl: log_lvl + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_file_id=${event_file_id}` + ); + } + db_events.file.delete(event_file_id); // Delete from the DB no matter what. + } + }); - if (log_lvl) { - console.log('ae_promises.delete__event_file_obj:', ae_promises.delete__event_file_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__event_file_obj:', ae_promises.delete__event_file_obj); + } - return ae_promises.delete__event_file_obj; + return ae_promises.delete__event_file_obj; } // Updated 2025-07-21 export async function update_ae_obj__event_file({ - api_cfg, - event_file_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_file_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_file_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_file_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** update_ae_obj__event_file() *** event_file_id=${event_file_id}`); - } + if (log_lvl) { + console.log(`*** update_ae_obj__event_file() *** event_file_id=${event_file_id}`); + } - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_file', - obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID. - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_file_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'file', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_file', + obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID. + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_file_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'file', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__event_file({ - // obj_type: 'event_file', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update event file.'); - return null; - } + // await db_save_ae_obj_li__event_file({ + // obj_type: 'event_file', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update event file.'); + return null; + } } // This new function is using CRUD v2. This should allow for more flexibility in the queries. // Updated 2025-07-21 export async function qry__event_file({ - api_cfg, - event_id, - qry_created_on = null, // Example greater than: '2024-10-24' - qry_min_file_size = null, - qry_file_purpose = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - created_on: 'DESC', - updated_on: 'DESC', - filename: 'ASC', - extension: 'ASC', - hosted_file_size: 'ASC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + qry_created_on = null, // Example greater than: '2024-10-24' + qry_min_file_size = null, + qry_file_purpose = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + created_on: 'DESC', + updated_on: 'DESC', + filename: 'ASC', + extension: 'ASC', + hosted_file_size: 'ASC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - qry_created_on?: null | string; - qry_min_file_size?: null | number; - qry_file_purpose?: null | string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + qry_created_on?: null | string; + qry_min_file_size?: null | number; + qry_file_purpose?: null | string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** qry__event_file() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** qry__event_file() *** event_id=${event_id}`); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_created_on) { - const qry_param = { - type: 'AND', - field: 'created_on', - operator: '>', - value: qry_created_on - }; - params_json['qry'].push(qry_param); - } + if (qry_created_on) { + const qry_param = { + type: 'AND', + field: 'created_on', + operator: '>', + value: qry_created_on + }; + params_json['qry'].push(qry_param); + } - if (qry_min_file_size) { - // console.log('qry_min_file_size:', qry_min_file_size); - const qry_param = { - type: 'AND', - field: 'hosted_file_size', - operator: '>', - value: qry_min_file_size - }; - params_json['qry'].push(qry_param); - } + if (qry_min_file_size) { + // console.log('qry_min_file_size:', qry_min_file_size); + const qry_param = { + type: 'AND', + field: 'hosted_file_size', + operator: '>', + value: qry_min_file_size + }; + params_json['qry'].push(qry_param); + } - if (qry_file_purpose) { - const qry_param = { - type: 'AND', - field: 'file_purpose', - operator: '=', - value: qry_file_purpose - }; - params_json['qry'].push(qry_param); - } + if (qry_file_purpose) { + const qry_param = { + type: 'AND', + field: 'file_purpose', + operator: '=', + value: qry_file_purpose + }; + params_json['qry'].push(qry_param); + } - // if (!limit || limit <= 0) { - // limit = null; - // } + // if (!limit || limit <= 0) { + // limit = null; + // } - if (log_lvl) { - console.log('params_json:', params_json); - } + if (log_lvl) { + console.log('params_json:', params_json); + } - ae_promises.load__event_file_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'event_file', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for file searching? - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (event_file_obj_li_get_result) { - if (event_file_obj_li_get_result) { - if (try_cache) { - // Process the results first - process_ae_obj__event_file_props({ - obj_li: event_file_obj_li_get_result, - log_lvl: log_lvl - }).then(async function (processed_obj_li) { - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'file', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - }); - } + ae_promises.load__event_file_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'event_file', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for file searching? + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (event_file_obj_li_get_result) { + if (event_file_obj_li_get_result) { + if (try_cache) { + // Process the results first + process_ae_obj__event_file_props({ + obj_li: event_file_obj_li_get_result, + log_lvl: log_lvl + }).then(async function (processed_obj_li) { + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'file', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + }); + } - // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result}); - return event_file_obj_li_get_result; - } else { - return []; - } - }); + // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result}); + return event_file_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); - } - return ae_promises.load__event_file_obj_li; + if (log_lvl) { + console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); + } + return ae_promises.load__event_file_obj_li; } // Updated 2025-07-21 export async function search__event_file({ - api_cfg, - event_id, - created_on = null, - min_file_size = null, - fulltext_search_qry_str, - ft_file_search_qry_str, - like_search_qry_str = null, - like_presentation_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' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + created_on = null, + min_file_size = null, + fulltext_search_qry_str, + ft_file_search_qry_str, + like_search_qry_str = null, + like_presentation_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' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - created_on?: null | string; - min_file_size?: null | number; - fulltext_search_qry_str?: null | string; - ft_file_search_qry_str?: null | string; - like_search_qry_str?: null | string; - like_presentation_search_qry_str?: null | string; - like_file_search_qry_str?: null | string; - order_by_li?: key_val; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + created_on?: null | string; + min_file_size?: null | number; + fulltext_search_qry_str?: null | string; + ft_file_search_qry_str?: null | string; + like_search_qry_str?: null | string; + like_presentation_search_qry_str?: null | string; + like_file_search_qry_str?: null | string; + order_by_li?: key_val; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** search__event_file() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** search__event_file() *** event_id=${event_id}`); + } - const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled - const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden - const limit: number = params.qry__limit ?? 25; // 99 - const offset: number = params.qry__offset ?? 0; // 0 + const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled + const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden + const limit: number = params.qry__limit ?? 25; // 99 + const offset: number = params.qry__offset ?? 0; // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (!fulltext_search_qry_str && !like_search_qry_str) { - // console.log('No search string provided!!!'); - // return false; // Returning false instead of [] because no search was performed. - // } + // if (!fulltext_search_qry_str && !like_search_qry_str) { + // console.log('No search string provided!!!'); + // return false; // Returning false instead of [] because no search was performed. + // } - if (fulltext_search_qry_str || ft_file_search_qry_str) { - params_json['ft_qry'] = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; - } + if (fulltext_search_qry_str || ft_file_search_qry_str) { + params_json['ft_qry'] = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; + } - if (ft_file_search_qry_str && ft_file_search_qry_str.length > 2) { - params_json['ft_qry']['event_file_li_qry_str'] = ft_file_search_qry_str; - } - } + if (ft_file_search_qry_str && ft_file_search_qry_str.length > 2) { + params_json['ft_qry']['event_file_li_qry_str'] = ft_file_search_qry_str; + } + } - // Use the AND (AND LIKE) query - // if (like_search_qry_str || like_file_search_qry_str) { - // params_json['and_like'] = {}; - // if (like_search_qry_str && like_search_qry_str.length > 2) { - // params_json['and_like']['default_qry_str'] = like_search_qry_str; - // } - // if (like_file_search_qry_str && like_file_search_qry_str.length > 2) { - // params_json['and_like']['event_file_li_qry_str'] = like_file_search_qry_str; - // } - // } + // Use the AND (AND LIKE) query + // if (like_search_qry_str || like_file_search_qry_str) { + // params_json['and_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['and_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_file_search_qry_str && like_file_search_qry_str.length > 2) { + // params_json['and_like']['event_file_li_qry_str'] = like_file_search_qry_str; + // } + // } - // Use the AND (OR LIKE) query - // if (like_search_qry_str || like_presentation_search_qry_str || like_file_search_qry_str) { - // params_json['or_like'] = {}; - // if (like_search_qry_str && like_search_qry_str.length > 2) { - // params_json['or_like']['default_qry_str'] = like_search_qry_str; - // } - // if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { - // params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; - // } - // if (like_file_search_qry_str && like_file_search_qry_str.length > 2) { - // params_json['or_like']['event_file_li_qry_str'] = like_file_search_qry_str; - // } - // } + // Use the AND (OR LIKE) query + // if (like_search_qry_str || like_presentation_search_qry_str || like_file_search_qry_str) { + // params_json['or_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['or_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { + // params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; + // } + // if (like_file_search_qry_str && like_file_search_qry_str.length > 2) { + // params_json['or_like']['event_file_li_qry_str'] = like_file_search_qry_str; + // } + // } - // params_json['and_qry'] = {}; + // params_json['and_qry'] = {}; - // if (created_on) { - // params_json['and_qry']['created_on'] = created_on; - // } + // if (created_on) { + // params_json['and_qry']['created_on'] = created_on; + // } - if (min_file_size) { - params_json['and_qry'] = { hosted_file_size: { '>': min_file_size } }; - } + if (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({ - api_cfg: api_cfg, - obj_type: 'event_file', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_table: true, // NOTE: We want to use the alt table for file searching? - use_alt_base: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_file_obj_li_get_result) { - if (event_file_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_file_props({ - obj_li: event_file_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'file', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_file_obj_li = await api + .get_ae_obj_li_for_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_file', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_table: true, // NOTE: We want to use the alt table for file searching? + use_alt_base: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_file_obj_li_get_result) { + if (event_file_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_file_props({ + obj_li: event_file_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'file', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result}); - } - return event_file_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result}); + } + return event_file_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); - } - return ae_promises.load__event_file_obj_li; + if (log_lvl) { + console.log('ae_promises.load__event_file_obj_li:', ae_promises.load__event_file_obj_li); + } + return ae_promises.load__event_file_obj_li; } // Updated 2025-05-23 export const properties_to_save = [ - 'id', - // 'id_random', - 'event_file_id', - // 'event_file_id_random', + 'id', + // 'id_random', + 'event_file_id', + // 'event_file_id_random', - 'hosted_file_id', - // 'hosted_file_id_random', - 'hash_sha256', + 'hosted_file_id', + // 'hosted_file_id_random', + 'hash_sha256', - 'for_type', - 'for_id', - // 'for_id_random', + 'for_type', + 'for_id', + // 'for_id_random', - 'event_id', - // 'event_id_random', - 'event_session_id', - // 'event_session_id_random', - 'event_presentation_id', - // 'event_presentation_id_random', - 'event_presenter_id', - // 'event_presenter_id_random', - 'event_location_id', - // 'event_location_id_random', + 'event_id', + // 'event_id_random', + 'event_session_id', + // 'event_session_id_random', + 'event_presentation_id', + // 'event_presentation_id_random', + 'event_presenter_id', + // 'event_presenter_id_random', + 'event_location_id', + // 'event_location_id_random', - 'filename', - 'extension', + 'filename', + 'extension', - 'open_in_os', + 'open_in_os', - 'lu_file_purpose_id', - 'lu_event_file_purpose_name', - 'file_purpose', + 'lu_file_purpose_id', + 'lu_event_file_purpose_name', + 'file_purpose', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - 'filename_no_ext', - 'filename_w_ext', - 'hosted_file_content_type', - 'file_size', - 'hosted_file_size', + 'filename_no_ext', + 'filename_w_ext', + 'hosted_file_content_type', + 'file_size', + 'hosted_file_size', - 'event_location_code', - 'event_location_name', - 'event_session_code', - 'event_session_type_code', - 'event_session_name', - 'event_session_start_datetime', - 'event_session_end_datetime', - 'event_presentation_code', - 'event_presentation_type_code', - 'event_presentation_name', - 'event_presentation_start_datetime', - 'event_presentation_end_datetime', - 'event_presenter_given_name', - 'event_presenter_family_name', - 'event_presenter_full_name', - 'event_presenter_email' + 'event_location_code', + 'event_location_name', + 'event_session_code', + 'event_session_type_code', + 'event_session_name', + 'event_session_start_datetime', + 'event_session_end_datetime', + 'event_presentation_code', + 'event_presentation_type_code', + 'event_presentation_name', + 'event_presentation_start_datetime', + 'event_presentation_end_datetime', + 'event_presenter_given_name', + 'event_presenter_family_name', + 'event_presenter_full_name', + 'event_presenter_email' ]; /** @@ -759,91 +761,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-23 export async function process_ae_obj__event_file_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_file', - log_lvl, - specific_processor: (obj) => { - // Event file-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_file', + log_lvl, + specific_processor: (obj) => { + // Event file-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_location.ts b/src/lib/ae_events/ae_events__event_location.ts index 0c7e5138..34dc4cd3 100644 --- a/src/lib/ae_events/ae_events__event_location.ts +++ b/src/lib/ae_events/ae_events__event_location.ts @@ -12,752 +12,763 @@ const ae_promises: key_val = {}; // Updated 2025-05-23 export async function load_ae_obj_id__event_location({ - api_cfg, - event_location_id, - inc_file_li = false, - inc_session_li = false, - try_cache = true, - log_lvl = 0 + api_cfg, + event_location_id, + inc_file_li = false, + inc_session_li = false, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_location_id: string; - inc_file_li?: boolean; - inc_session_li?: boolean; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_location_id: string; + inc_file_li?: boolean; + inc_session_li?: boolean; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__event_location() *** event_location_id=${event_location_id}`); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_id__event_location() *** event_location_id=${event_location_id}` + ); + } - const params = {}; + const params = {}; - ae_promises.load__event_location_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_location', - obj_id: event_location_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (event_location_obj_get_result) { - if (event_location_obj_get_result) { - if (try_cache) { - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: [event_location_obj_get_result], - log_lvl - }); - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save, - log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_location_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_location', + obj_id: event_location_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (event_location_obj_get_result) { + if (event_location_obj_get_result) { + if (try_cache) { + const processed_obj_li = await process_ae_obj__event_location_props({ + obj_li: [event_location_obj_get_result], + log_lvl + }); + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: processed_obj_li, + properties_to_save, + log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__event_location({ - // obj_type: 'event_location', - // obj_li: [event_location_obj_get_result] - // }); - } - return event_location_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__event_location({ + // obj_type: 'event_location', + // obj_li: [event_location_obj_get_result] + // }); + } + return event_location_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_location_obj:', ae_promises.load__event_location_obj); - } + if (log_lvl) { + console.log('ae_promises.load__event_location_obj:', ae_promises.load__event_location_obj); + } - if (ae_promises?.load__event_location_obj === null) { - console.log('No results returned.'); - return null; - } + if (ae_promises?.load__event_location_obj === null) { + console.log('No results returned.'); + return null; + } - if (inc_file_li) { - // Load the files for the location - if (log_lvl) { - console.log(`Need to load the file list for the location now`); - } - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_location', - for_obj_id: event_location_id, - enabled: 'all', - limit: 15, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + if (inc_file_li) { + // Load the files for the location + if (log_lvl) { + console.log(`Need to load the file list for the location now`); + } + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_location', + for_obj_id: event_location_id, + enabled: 'all', + limit: 15, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`load_event_file_obj_li = `, load_event_file_obj_li); - } - ae_promises.load__event_location_obj.event_file_li = load_event_file_obj_li; - } + if (log_lvl) { + console.log(`load_event_file_obj_li = `, load_event_file_obj_li); + } + ae_promises.load__event_location_obj.event_file_li = load_event_file_obj_li; + } - if (inc_session_li) { - // Load the sessions for the location - if (log_lvl) { - console.log(`Need to load the session list for the location now`); - } - const load_event_session_obj_li = load_ae_obj_li__event_session({ - api_cfg: api_cfg, - for_obj_type: 'event_location', - for_obj_id: event_location_id, - enabled: 'all', - limit: 15, - try_cache: try_cache, - log_lvl: log_lvl - }); + if (inc_session_li) { + // Load the sessions for the location + if (log_lvl) { + console.log(`Need to load the session list for the location now`); + } + const load_event_session_obj_li = load_ae_obj_li__event_session({ + api_cfg: api_cfg, + for_obj_type: 'event_location', + for_obj_id: event_location_id, + enabled: 'all', + limit: 15, + try_cache: try_cache, + log_lvl: log_lvl + }); - if (log_lvl) { - console.log(`load_event_session_obj_li = `, load_event_session_obj_li); - } - ae_promises.load__event_location_obj.event_session_li = load_event_session_obj_li; - } + if (log_lvl) { + console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + } + ae_promises.load__event_location_obj.event_session_li = load_event_session_obj_li; + } - return ae_promises.load__event_location_obj; + return ae_promises.load__event_location_obj; } // Updated 2025-05-23 export async function load_ae_obj_li__event_location({ - api_cfg, - for_obj_type, - for_obj_id, - inc_device_li = false, - inc_file_li = false, - inc_session_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 29, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - code: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type, + for_obj_id, + inc_device_li = false, + inc_file_li = false, + inc_session_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 29, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + code: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_device_li?: boolean; - inc_file_li?: boolean; - inc_session_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; // 99 - offset?: number; // 0 - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_device_li?: boolean; + inc_file_li?: boolean; + inc_session_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; // 99 + offset?: number; // 0 + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__event_location() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_li__event_location() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); + } - const 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_location', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_location_obj_li_get_result) { - if (event_location_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: event_location_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // 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({ + api_cfg: api_cfg, + obj_type: 'event_location', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. + // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_location_obj_li_get_result) { + if (event_location_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_location_props({ + obj_li: event_location_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_location({ - // obj_type: 'event_location', - // obj_li: event_location_obj_li_get_result - // }); - } - return event_location_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__event_location({ + // obj_type: 'event_location', + // obj_li: event_location_obj_li_get_result + // }); + } + return event_location_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log( - 'ae_promises.load__event_location_obj_li:', - ae_promises.load__event_location_obj_li - ); - } + if (log_lvl) { + console.log( + 'ae_promises.load__event_location_obj_li:', + ae_promises.load__event_location_obj_li + ); + } - if (inc_device_li) { - // Load the devices for the locations - if (log_lvl) { - 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++) { - const event_location_obj = ae_promises.load__event_location_obj_li[i]; - const event_location_id = event_location_obj.event_location_id_random; + if (inc_device_li) { + // Load the devices for the locations + if (log_lvl) { + 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++) { + const event_location_obj = ae_promises.load__event_location_obj_li[i]; + const event_location_id = event_location_obj.event_location_id_random; - const load_event_device_obj_li = load_ae_obj_li__event_device({ - api_cfg: api_cfg, - for_obj_type: 'event_location', - for_obj_id: event_location_id, - params: { qry__enabled: enabled, qry__limit: limit }, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_device_obj_li) => { - if (log_lvl) { - console.log(`event_device_obj_li = `, event_device_obj_li); - } - return event_device_obj_li; - }); + const load_event_device_obj_li = load_ae_obj_li__event_device({ + api_cfg: api_cfg, + for_obj_type: 'event_location', + for_obj_id: event_location_id, + params: { qry__enabled: enabled, qry__limit: limit }, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_device_obj_li) => { + if (log_lvl) { + console.log(`event_device_obj_li = `, event_device_obj_li); + } + return event_device_obj_li; + }); - if (log_lvl) { - console.log(`load_event_device_obj_li = `, load_event_device_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_event_device_obj_li = `, load_event_device_obj_li); + } + } + } - if (inc_file_li) { - // Load the files for the locations - if (log_lvl) { - 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++) { - const event_location_obj = ae_promises.load__event_location_obj_li[i]; - const event_location_id = event_location_obj.event_location_id_random; + if (inc_file_li) { + // Load the files for the locations + if (log_lvl) { + 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++) { + const event_location_obj = ae_promises.load__event_location_obj_li[i]; + const event_location_id = event_location_obj.event_location_id_random; - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_location', - for_obj_id: event_location_id, - enabled: enabled, - limit: limit, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_location', + for_obj_id: event_location_id, + enabled: enabled, + limit: limit, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`load_event_file_obj_li = `, load_event_file_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_event_file_obj_li = `, load_event_file_obj_li); + } + } + } - if (inc_session_li) { - // Load the sessions for the locations - if (log_lvl) { - 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++) { - const event_location_obj = ae_promises.load__event_location_obj_li[i]; - const event_location_id = event_location_obj.event_location_id_random; + if (inc_session_li) { + // Load the sessions for the locations + if (log_lvl) { + 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++) { + const event_location_obj = ae_promises.load__event_location_obj_li[i]; + const event_location_id = event_location_obj.event_location_id_random; - const load_event_session_obj_li = load_ae_obj_li__event_session({ - api_cfg: api_cfg, - for_obj_type: 'event_location', - for_obj_id: event_location_id, - enabled: enabled, - limit: limit, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_session_obj_li) => { - if (log_lvl) { - console.log(`event_session_obj_li = `, event_session_obj_li); - } - return event_session_obj_li; - }); + const load_event_session_obj_li = load_ae_obj_li__event_session({ + api_cfg: api_cfg, + for_obj_type: 'event_location', + for_obj_id: event_location_id, + enabled: enabled, + limit: limit, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_session_obj_li) => { + if (log_lvl) { + console.log(`event_session_obj_li = `, event_session_obj_li); + } + return event_session_obj_li; + }); - if (log_lvl) { - console.log(`load_event_session_obj_li = `, load_event_session_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + } + } + } - return ae_promises.load__event_location_obj_li; + return ae_promises.load__event_location_obj_li; } // Updated 2025-05-23 export async function create_ae_obj__event_location({ - api_cfg, - event_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__event_location() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__event_location() *** event_id=${event_id}`); + } - ae_promises.create__event_location = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'event_location', - fields: { - event_id_random: event_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_location_obj_create_result) { - if (event_location_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: [event_location_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__event_location = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_location', + fields: { + event_id_random: event_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_location_obj_create_result) { + if (event_location_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_location_props({ + obj_li: [event_location_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_location( - // { - // obj_type: 'event_location', - // obj_li: [event_location_obj_create_result] - // }); - } - return event_location_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_location( + // { + // obj_type: 'event_location', + // obj_li: [event_location_obj_create_result] + // }); + } + return event_location_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__event_location:', ae_promises.create__event_location); - } - return ae_promises.create__event_location; + if (log_lvl) { + console.log('ae_promises.create__event_location:', ae_promises.create__event_location); + } + return ae_promises.create__event_location; } // Updated 2025-05-23 export async function delete_ae_obj_id__event_location({ - api_cfg, - event_location_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_location_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_location_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_location_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** delete_ae_obj_id__event_location() *** event_location_id=${event_location_id}` - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_location', - obj_id: event_location_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for event_location_id=${event_location_id}`); - } - db_events.location.delete(event_location_id); - } - }); + ae_promises.delete__event_location_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_location', + obj_id: event_location_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_location_id=${event_location_id}` + ); + } + db_events.location.delete(event_location_id); + } + }); - if (log_lvl) { - console.log('ae_promises.delete__event_location_obj:', ae_promises.delete__event_location_obj); - } + if (log_lvl) { + console.log( + 'ae_promises.delete__event_location_obj:', + ae_promises.delete__event_location_obj + ); + } - return ae_promises.delete__event_location_obj; + return ae_promises.delete__event_location_obj; } // Updated 2025-05-23 export async function update_ae_obj__event_location({ - api_cfg, - event_location_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_location_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_location_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_location_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg: api_cfg, - obj_type: 'event_location', - obj_id: event_location_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_location_obj_update_result) { - if (event_location_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: [event_location_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + if (log_lvl) { + 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({ + api_cfg: api_cfg, + obj_type: 'event_location', + obj_id: event_location_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_location_obj_update_result) { + if (event_location_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_location_props({ + obj_li: [event_location_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_location({ - // obj_type: 'event_location', obj_li: [event_location_obj_update_result] - // }); - } - return event_location_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_location({ + // obj_type: 'event_location', obj_li: [event_location_obj_update_result] + // }); + } + return event_location_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.update__event_location_obj:', ae_promises.update__event_location_obj); - } - return ae_promises.update__event_location_obj; + if (log_lvl) { + console.log( + 'ae_promises.update__event_location_obj:', + ae_promises.update__event_location_obj + ); + } + return ae_promises.update__event_location_obj; } // Updated 2025-05-23 export async function search__event_location({ - api_cfg, - event_id, - fulltext_search_qry_str, - ft_presenter_search_qry_str, - like_search_qry_str = null, - like_presentation_search_qry_str = null, - like_presenter_search_qry_str = null, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + fulltext_search_qry_str, + ft_presenter_search_qry_str, + like_search_qry_str = null, + like_presentation_search_qry_str = null, + like_presenter_search_qry_str = null, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - fulltext_search_qry_str?: null | string; - ft_presenter_search_qry_str?: null | string; - like_search_qry_str?: null | string; - like_presentation_search_qry_str?: null | string; - like_presenter_search_qry_str?: null | string; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + fulltext_search_qry_str?: null | string; + ft_presenter_search_qry_str?: null | string; + like_search_qry_str?: null | string; + like_presentation_search_qry_str?: null | string; + like_presenter_search_qry_str?: null | string; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** search__event_location() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** search__event_location() *** event_id=${event_id}`); + } - const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled - const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden - const limit: number = params.qry__limit ?? 25; // 99 - const offset: number = params.qry__offset ?? 0; // 0 + const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled + const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden + const limit: number = params.qry__limit ?? 25; // 99 + const offset: number = params.qry__offset ?? 0; // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - if (!fulltext_search_qry_str && !like_search_qry_str) { - console.log('No search string provided!!!'); - return false; // Returning false instead of [] because no search was performed. - } + if (!fulltext_search_qry_str && !like_search_qry_str) { + console.log('No search string provided!!!'); + return false; // Returning false instead of [] because no search was performed. + } - if (fulltext_search_qry_str || ft_presenter_search_qry_str) { - params_json['ft_qry'] = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; - } + if (fulltext_search_qry_str || ft_presenter_search_qry_str) { + params_json['ft_qry'] = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; + } - if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { - params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; - } - } + if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { + params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; + } + } - // Use the AND (AND LIKE) query - // if (like_search_qry_str || like_presenter_search_qry_str) { - // params_json['and_like'] = {}; - // if (like_search_qry_str && like_search_qry_str.length > 2) { - // params_json['and_like']['default_qry_str'] = like_search_qry_str; - // } - // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - // } - // } + // Use the AND (AND LIKE) query + // if (like_search_qry_str || like_presenter_search_qry_str) { + // params_json['and_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['and_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + // } + // } - // Use the AND (OR LIKE) query - if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { - params_json['or_like'] = {}; - if (like_search_qry_str && like_search_qry_str.length > 2) { - params_json['or_like']['default_qry_str'] = like_search_qry_str; - } - if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { - params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; - } - if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - } - } + // Use the AND (OR LIKE) query + if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { + params_json['or_like'] = {}; + if (like_search_qry_str && like_search_qry_str.length > 2) { + params_json['or_like']['default_qry_str'] = like_search_qry_str; + } + if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { + params_json['or_like']['event_presentation_li_qry_str'] = + like_presentation_search_qry_str; + } + if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + } + } - params_json['and_qry'] = {}; + params_json['and_qry'] = {}; - // if (location_type_code) { - // params_json['and_qry']['location_type_code'] = location_type_code; - // } + // if (location_type_code) { + // params_json['and_qry']['location_type_code'] = location_type_code; + // } - const 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_location', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for location searching - // use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_location_obj_li_get_result) { - if (event_location_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_location_props({ - obj_li: event_location_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'location', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_location_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // 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({ + api_cfg: api_cfg, + obj_type: 'event_location', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for location searching + // use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_location_obj_li_get_result) { + if (event_location_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_location_props({ + obj_li: event_location_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'location', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_location_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log( - 'ae_promises.load__event_location_obj_li:', - ae_promises.load__event_location_obj_li - ); - } - return ae_promises.load__event_location_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__event_location_obj_li:', + ae_promises.load__event_location_obj_li + ); + } + return ae_promises.load__event_location_obj_li; } // Updated 2025-05-23 export const properties_to_save = [ - 'id', - 'event_location_id', - // 'event_location_id_random', + 'id', + 'event_location_id', + // 'event_location_id_random', - 'external_id', - 'code', + 'external_id', + 'code', - 'type_code', + 'type_code', - 'event_id', - // 'event_id_random', + 'event_id', + // 'event_id_random', - 'name', - 'description', + 'name', + 'description', - 'passcode', + 'passcode', - 'hide_event_launcher', + 'hide_event_launcher', - 'alert', - 'alert_msg', + 'alert', + 'alert_msg', - 'data_json', + 'data_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'file_count', - 'file_count_all', - 'internal_use_count', - 'event_file_id_li_json', + // From SQL view + 'file_count', + 'file_count_all', + 'internal_use_count', + 'event_file_id_li_json', - 'event_name' + 'event_name' ]; /** @@ -765,91 +776,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-23 export async function process_ae_obj__event_location_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_location', - log_lvl, - specific_processor: (obj) => { - // Event location-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_location', + log_lvl, + specific_processor: (obj) => { + // Event location-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_presentation.ts b/src/lib/ae_events/ae_events__event_presentation.ts index 43d1b41e..abbeefff 100644 --- a/src/lib/ae_events/ae_events__event_presentation.ts +++ b/src/lib/ae_events/ae_events__event_presentation.ts @@ -11,627 +11,630 @@ const ae_promises: key_val = {}; // Updated 2025-05-22 export async function load_ae_obj_id__event_presentation({ - api_cfg, - event_presentation_id, - inc_file_li = false, - inc_presenter_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - try_cache = true, - log_lvl = 0 + api_cfg, + event_presentation_id, + inc_file_li = false, + inc_presenter_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_presentation_id: string; - inc_file_li?: boolean; - inc_presenter_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_presentation_id: string; + inc_file_li?: boolean; + inc_presenter_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}` + ); + } - const params = {}; + const params = {}; - ae_promises.load__event_presentation_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_presentation', - obj_id: event_presentation_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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 - params: params, - log_lvl: log_lvl - }) - .then(async function (event_presentation_obj_get_result) { - if (event_presentation_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presentation_props({ - obj_li: [event_presentation_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_presentation_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_presentation', + obj_id: event_presentation_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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 + params: params, + log_lvl: log_lvl + }) + .then(async function (event_presentation_obj_get_result) { + if (event_presentation_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presentation_props({ + obj_li: [event_presentation_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__event_presentation({ - // obj_type: 'event_presentation', - // obj_li: [event_presentation_obj_get_result] + // // This is expecting a list + // db_save_ae_obj_li__event_presentation({ + // obj_type: 'event_presentation', + // obj_li: [event_presentation_obj_get_result] - // }); - } - return event_presentation_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // }); + } + return event_presentation_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log( - 'ae_promises.load__event_presentation_obj:', - ae_promises.load__event_presentation_obj - ); - } + if (log_lvl) { + console.log( + 'ae_promises.load__event_presentation_obj:', + ae_promises.load__event_presentation_obj + ); + } - if (ae_promises?.load__event_presentation_obj === null) { - console.log('No results returned.'); - return null; - } + if (ae_promises?.load__event_presentation_obj === null) { + console.log('No results returned.'); + return null; + } - if (inc_file_li) { - // Load the files for the presentation - if (log_lvl) { - console.log(`Need to load the file list for the presentation now.`); - } - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_presentation', - for_obj_id: event_presentation_id, - enabled: 'all', - limit: 25, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + if (inc_file_li) { + // Load the files for the presentation + if (log_lvl) { + console.log(`Need to load the file list for the presentation now.`); + } + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_presentation', + for_obj_id: event_presentation_id, + enabled: 'all', + limit: 25, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`event_file_obj_li = `, load_event_file_obj_li); - } - ae_promises.load__event_presentation_obj.event_file_li = load_event_file_obj_li; - } + if (log_lvl) { + console.log(`event_file_obj_li = `, load_event_file_obj_li); + } + ae_promises.load__event_presentation_obj.event_file_li = load_event_file_obj_li; + } - if (inc_presenter_li) { - // Load the presenters for the presentation - if (log_lvl) { - console.log(`Need to load the presenter list for the presentation now.`); - } - const load_event_presenter_obj_li = load_ae_obj_li__event_presenter({ - api_cfg: api_cfg, - for_obj_type: 'event_presentation', - for_obj_id: event_presentation_id, - inc_file_li: inc_file_li, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - // order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, - // params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_presenter_obj_li) => { - if (log_lvl) { - console.log(`event_presenter_obj_li = `, event_presenter_obj_li); - } - return event_presenter_obj_li; - }); + if (inc_presenter_li) { + // Load the presenters for the presentation + if (log_lvl) { + console.log(`Need to load the presenter list for the presentation now.`); + } + const load_event_presenter_obj_li = load_ae_obj_li__event_presenter({ + api_cfg: api_cfg, + for_obj_type: 'event_presentation', + for_obj_id: event_presentation_id, + inc_file_li: inc_file_li, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + // order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, + // params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_presenter_obj_li) => { + if (log_lvl) { + console.log(`event_presenter_obj_li = `, event_presenter_obj_li); + } + return event_presenter_obj_li; + }); - if (log_lvl) { - console.log(`event_presenter_obj_li = `, load_event_presenter_obj_li); - } - ae_promises.load__event_presentation_obj.event_presenter_li = load_event_presenter_obj_li; - } + if (log_lvl) { + console.log(`event_presenter_obj_li = `, load_event_presenter_obj_li); + } + ae_promises.load__event_presentation_obj.event_presenter_li = load_event_presenter_obj_li; + } - return ae_promises.load__event_presentation_obj; + return ae_promises.load__event_presentation_obj; } // Updated 2025-05-22 export async function load_ae_obj_li__event_presentation({ - api_cfg, - for_obj_type = 'event_session', - for_obj_id, - inc_file_li = false, - inc_presenter_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - start_datetime: 'ASC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'event_session', + for_obj_id, + inc_file_li = false, + inc_presenter_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + start_datetime: 'ASC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_file_li?: boolean; - inc_presenter_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_file_li?: boolean; + inc_presenter_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__event_presentation() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 99); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_presentation', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_presentation_obj_li_get_result) { - if (event_presentation_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presentation_props({ - obj_li: event_presentation_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // 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({ + api_cfg: api_cfg, + obj_type: 'event_presentation', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. + // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_presentation_obj_li_get_result) { + if (event_presentation_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presentation_props({ + obj_li: event_presentation_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_presentation({ - // obj_type: 'event_presentation', obj_li: event_presentation_obj_li_get_result - // }); - } - return event_presentation_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__event_presentation({ + // obj_type: 'event_presentation', obj_li: event_presentation_obj_li_get_result + // }); + } + return event_presentation_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log( - 'ae_promises.load__event_presentation_obj_li:', - ae_promises.load__event_presentation_obj_li - ); - } + if (log_lvl) { + console.log( + 'ae_promises.load__event_presentation_obj_li:', + ae_promises.load__event_presentation_obj_li + ); + } - if (inc_file_li) { - // Load the files for the presentations - if (log_lvl) { - 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++) { - const event_presentation_obj = ae_promises.load__event_presentation_obj_li[i]; - const event_presentation_id = event_presentation_obj.event_presentation_id_random; + if (inc_file_li) { + // Load the files for the presentations + if (log_lvl) { + 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++) { + const event_presentation_obj = ae_promises.load__event_presentation_obj_li[i]; + const event_presentation_id = event_presentation_obj.event_presentation_id_random; - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_presentation', - for_obj_id: event_presentation_id, - enabled: enabled, - limit: limit, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_presentation', + for_obj_id: event_presentation_id, + enabled: enabled, + limit: limit, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`event_file_obj_li = `, load_event_file_obj_li); - } - // ae_promises.load__event_presentation_obj.event_file_li = load_event_file_obj_li; - } - } + if (log_lvl) { + console.log(`event_file_obj_li = `, load_event_file_obj_li); + } + // ae_promises.load__event_presentation_obj.event_file_li = load_event_file_obj_li; + } + } - if (inc_presenter_li) { - // Load the presenters for the presentations - if (log_lvl) { - 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++) { - const event_presentation_obj = ae_promises.load__event_presentation_obj_li[i]; - const event_presentation_id = event_presentation_obj.event_presentation_id_random; + if (inc_presenter_li) { + // Load the presenters for the presentations + if (log_lvl) { + 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++) { + const event_presentation_obj = ae_promises.load__event_presentation_obj_li[i]; + const event_presentation_id = event_presentation_obj.event_presentation_id_random; - const load_event_presenter_obj_li = load_ae_obj_li__event_presenter({ - api_cfg: api_cfg, - for_obj_type: 'event_presentation', - for_obj_id: event_presentation_id, - inc_file_li: inc_file_li, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - // order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, - // params: {}, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_presenter_obj_li) => { - if (log_lvl) { - console.log(`event_presenter_obj_li = `, event_presenter_obj_li); - } - return event_presenter_obj_li; - }); + const load_event_presenter_obj_li = load_ae_obj_li__event_presenter({ + api_cfg: api_cfg, + for_obj_type: 'event_presentation', + for_obj_id: event_presentation_id, + inc_file_li: inc_file_li, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + // order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'}, + // params: {}, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_presenter_obj_li) => { + if (log_lvl) { + console.log(`event_presenter_obj_li = `, event_presenter_obj_li); + } + return event_presenter_obj_li; + }); - if (log_lvl) { - console.log(`event_presenter_obj_li = `, load_event_presenter_obj_li); - } - // ae_promises.load__event_presentation_obj.event_presenter_li = load_event_presenter_obj_li; - } - } + if (log_lvl) { + console.log(`event_presenter_obj_li = `, load_event_presenter_obj_li); + } + // ae_promises.load__event_presentation_obj.event_presenter_li = load_event_presenter_obj_li; + } + } - return ae_promises.load__event_presentation_obj_li; + return ae_promises.load__event_presentation_obj_li; } // Updated 2025-05-22 export async function create_ae_obj__event_presentation({ - api_cfg, - event_id, - event_session_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + event_session_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - event_session_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + event_session_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** create_ae_obj__event_presentation() *** event_id=${event_id} event_session_id=${event_session_id}` - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_presentation', - fields: { - event_id_random: event_id, - event_session_id_random: event_session_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_presentation_obj_create_result) { - if (event_presentation_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presentation_props({ - obj_li: [event_presentation_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__event_presentation = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_presentation', + fields: { + event_id_random: event_id, + event_session_id_random: event_session_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_presentation_obj_create_result) { + if (event_presentation_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presentation_props({ + obj_li: [event_presentation_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_presentation( - // { - // obj_type: 'event_presentation', - // obj_li: [event_presentation_obj_create_result] - // }); - } - return event_presentation_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_presentation( + // { + // obj_type: 'event_presentation', + // obj_li: [event_presentation_obj_create_result] + // }); + } + return event_presentation_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__event_presentation:', ae_promises.create__event_presentation); - } - return ae_promises.create__event_presentation; + if (log_lvl) { + console.log( + 'ae_promises.create__event_presentation:', + ae_promises.create__event_presentation + ); + } + return ae_promises.create__event_presentation; } // Updated 2025-05-22 export async function delete_ae_obj_id__event_presentation({ - api_cfg, - event_presentation_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_presentation_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_presentation_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_presentation_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** delete_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}` - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_presentation', - obj_id: event_presentation_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log( - `Attempting to remove IDB entry for event_presentation_id=${event_presentation_id}` - ); - } - db_events.presentation.delete(event_presentation_id); - } - }); + ae_promises.delete__event_presentation_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_presentation', + obj_id: event_presentation_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_presentation_id=${event_presentation_id}` + ); + } + db_events.presentation.delete(event_presentation_id); + } + }); - if (log_lvl) { - console.log( - 'ae_promises.delete__event_presentation_obj:', - ae_promises.delete__event_presentation_obj - ); - } + if (log_lvl) { + 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 export async function update_ae_obj__event_presentation({ - api_cfg, - event_presentation_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_presentation_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_presentation_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_presentation_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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({ - api_cfg: api_cfg, - obj_type: 'event_presentation', - obj_id: event_presentation_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_presentation_obj_update_result) { - if (event_presentation_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presentation_props({ - obj_li: [event_presentation_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presentation', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + if (log_lvl) { + 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({ + api_cfg: api_cfg, + obj_type: 'event_presentation', + obj_id: event_presentation_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_presentation_obj_update_result) { + if (event_presentation_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presentation_props({ + obj_li: [event_presentation_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presentation', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_presentation({ - // obj_type: 'event_presentation', - // obj_li: [event_presentation_obj_update_result], - // log_lvl: log_lvl - // }); - } - return event_presentation_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_presentation({ + // obj_type: 'event_presentation', + // obj_li: [event_presentation_obj_update_result], + // log_lvl: log_lvl + // }); + } + return event_presentation_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log( - 'ae_promises.update__event_presentation_obj:', - ae_promises.update__event_presentation_obj - ); - } - return ae_promises.update__event_presentation_obj; + if (log_lvl) { + console.log( + 'ae_promises.update__event_presentation_obj:', + ae_promises.update__event_presentation_obj + ); + } + return ae_promises.update__event_presentation_obj; } // Updated 2025-05-22 export const properties_to_save = [ - 'id', - 'event_presentation_id', - // 'event_presentation_id_random', + 'id', + 'event_presentation_id', + // 'event_presentation_id_random', - 'external_id', - 'code', + 'external_id', + 'code', - 'for_type', - 'for_id', - // 'for_id_random', + 'for_type', + 'for_id', + // 'for_id_random', - 'type_code', + 'type_code', - 'event_id', - // 'event_id_random', - 'event_session_id', - // 'event_session_id_random', - 'event_abstract_id', - // 'event_abstract_id_random', + 'event_id', + // 'event_id_random', + 'event_session_id', + // 'event_session_id_random', + 'event_abstract_id', + // 'event_abstract_id_random', - 'abstract_code', + 'abstract_code', - 'name', - 'description', + 'name', + 'description', - 'start_datetime', - 'end_datetime', + 'start_datetime', + 'end_datetime', - 'passcode', + 'passcode', - 'hide_event_launcher', + 'hide_event_launcher', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'event_session_code', - 'event_session_name' + // From SQL view + 'event_session_code', + '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 ]; /** @@ -639,91 +642,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-22 export async function process_ae_obj__event_presentation_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_presentation', - log_lvl, - specific_processor: (obj) => { - // Event presentation-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_presentation', + log_lvl, + specific_processor: (obj) => { + // Event presentation-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_presenter.ts b/src/lib/ae_events/ae_events__event_presenter.ts index eaab5ee8..9582cfb2 100644 --- a/src/lib/ae_events/ae_events__event_presenter.ts +++ b/src/lib/ae_events/ae_events__event_presenter.ts @@ -10,712 +10,713 @@ const ae_promises: key_val = {}; // Updated 2024-10-08 export async function load_ae_obj_id__event_presenter({ - api_cfg, - event_presenter_id, - inc_file_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 19, - offset = 0, - try_cache = true, - log_lvl = 0 + api_cfg, + event_presenter_id, + inc_file_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 19, + offset = 0, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_presenter_id: string; - inc_file_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_presenter_id: string; + inc_file_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}` + ); + } - const params = {}; + const params = {}; - ae_promises.load__event_presenter_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_presenter', - obj_id: event_presenter_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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 - params: params, - log_lvl: log_lvl - }) - .then(async function (event_presenter_obj_get_result) { - if (event_presenter_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: [event_presenter_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_presenter_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_presenter', + obj_id: event_presenter_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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 + params: params, + log_lvl: log_lvl + }) + .then(async function (event_presenter_obj_get_result) { + if (event_presenter_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presenter_props({ + obj_li: [event_presenter_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__event_presenter({ - // obj_type: 'event_presenter', - // obj_li: [event_presenter_obj_get_result] - // }); - } - return event_presenter_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__event_presenter({ + // obj_type: 'event_presenter', + // obj_li: [event_presenter_obj_get_result] + // }); + } + return event_presenter_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (inc_file_li) { - // Load the files for the presenter - if (log_lvl) { - console.log(`Need to load the file list for the presenter now.`); - } - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_presenter', - for_obj_id: event_presenter_id, - enabled: enabled, - limit: limit, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + if (inc_file_li) { + // Load the files for the presenter + if (log_lvl) { + console.log(`Need to load the file list for the presenter now.`); + } + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_presenter', + for_obj_id: event_presenter_id, + enabled: enabled, + limit: limit, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`event_file_obj_li = `, load_event_file_obj_li); - } - ae_promises.load__event_presenter_obj.event_file_li = load_event_file_obj_li; - } + if (log_lvl) { + console.log(`event_file_obj_li = `, load_event_file_obj_li); + } + ae_promises.load__event_presenter_obj.event_file_li = load_event_file_obj_li; + } - return ae_promises.load__event_presenter_obj; + return ae_promises.load__event_presenter_obj; } // Updated 2024-10-08 export async function load_ae_obj_li__event_presenter({ - api_cfg, - for_obj_type, - for_obj_id, - inc_file_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 19, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - given_name: 'ASC', - family_name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type, + for_obj_id, + inc_file_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 19, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + given_name: 'ASC', + family_name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_file_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_file_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__event_presenter() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 99); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_presenter', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_presenter_obj_li_get_result) { - if (event_presenter_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: event_presenter_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // 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({ + api_cfg: api_cfg, + obj_type: 'event_presenter', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. + // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_presenter_obj_li_get_result) { + if (event_presenter_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presenter_props({ + obj_li: event_presenter_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_presenter({ - // obj_type: 'event_presenter', - // obj_li: event_presenter_obj_li_get_result - // }); - } - return event_presenter_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__event_presenter({ + // obj_type: 'event_presenter', + // obj_li: event_presenter_obj_li_get_result + // }); + } + return event_presenter_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log( - 'ae_promises.load__event_presenter_obj_li:', - ae_promises.load__event_presenter_obj_li - ); - } + if (log_lvl) { + console.log( + 'ae_promises.load__event_presenter_obj_li:', + ae_promises.load__event_presenter_obj_li + ); + } - if (inc_file_li) { - // Load the files for the presenters - if (log_lvl) { - 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++) { - const event_presenter_obj = ae_promises.load__event_presenter_obj_li[i]; - const event_presenter_id = event_presenter_obj.event_presenter_id_random; + if (inc_file_li) { + // Load the files for the presenters + if (log_lvl) { + 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++) { + const event_presenter_obj = ae_promises.load__event_presenter_obj_li[i]; + const event_presenter_id = event_presenter_obj.event_presenter_id_random; - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_presenter', - for_obj_id: event_presenter_id, - enabled: enabled, - limit: limit, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_presenter', + for_obj_id: event_presenter_id, + enabled: enabled, + limit: limit, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`event_file_obj_li = `, load_event_file_obj_li); - } - // ae_promises.load__event_presenter_obj.event_file_li = load_event_file_obj_li; - } - } + if (log_lvl) { + console.log(`event_file_obj_li = `, load_event_file_obj_li); + } + // ae_promises.load__event_presenter_obj.event_file_li = load_event_file_obj_li; + } + } - return ae_promises.load__event_presenter_obj_li; + return ae_promises.load__event_presenter_obj_li; } // Updated 2025-05-23 export async function create_ae_obj__event_presenter({ - api_cfg, - event_id, - event_session_id, - event_presentation_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + event_session_id, + event_presentation_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - event_session_id: string; - event_presentation_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + event_session_id: string; + event_presentation_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - 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}` - ); - } + 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}` + ); + } - ae_promises.create__event_presenter = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'event_presenter', - fields: { - event_id_random: event_id, - event_session_id_random: event_session_id, - event_presentation_id_random: event_presentation_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_presenter_obj_create_result) { - if (event_presenter_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: [event_presenter_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__event_presenter = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_presenter', + fields: { + event_id_random: event_id, + event_session_id_random: event_session_id, + event_presentation_id_random: event_presentation_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_presenter_obj_create_result) { + if (event_presenter_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presenter_props({ + obj_li: [event_presenter_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_presenter( - // { - // obj_type: 'event_presenter', obj_li: [event_presenter_obj_create_result] - // }); - } - return event_presenter_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_presenter( + // { + // obj_type: 'event_presenter', obj_li: [event_presenter_obj_create_result] + // }); + } + return event_presenter_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__event_presenter:', ae_promises.create__event_presenter); - } - return ae_promises.create__event_presenter; + if (log_lvl) { + console.log('ae_promises.create__event_presenter:', ae_promises.create__event_presenter); + } + return ae_promises.create__event_presenter; } // Updated 2025-05-23 export async function delete_ae_obj_id__event_presenter({ - api_cfg, - event_presenter_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_presenter_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_presenter_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_presenter_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** delete_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}` - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_presenter', - obj_id: event_presenter_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log( - `Attempting to remove IDB entry for event_presenter_id=${event_presenter_id}` - ); - } - db_events.presenter.delete(event_presenter_id); - } - }); + ae_promises.delete__event_presenter_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_presenter', + obj_id: event_presenter_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_presenter_id=${event_presenter_id}` + ); + } + db_events.presenter.delete(event_presenter_id); + } + }); - if (log_lvl) { - console.log( - 'ae_promises.delete__event_presenter_obj:', - ae_promises.delete__event_presenter_obj - ); - } + if (log_lvl) { + 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 export async function update_ae_obj__event_presenter({ - api_cfg, - event_presenter_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_presenter_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_presenter_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_presenter_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** update_ae_obj__event_presenter() *** event_presenter_id=${event_presenter_id}`, - data_kv - ); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_presenter', - obj_id: event_presenter_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_presenter_obj_update_result) { - if (event_presenter_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: [event_presenter_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.update__event_presenter_obj = await api + .update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_presenter', + obj_id: event_presenter_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_presenter_obj_update_result) { + if (event_presenter_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presenter_props({ + obj_li: [event_presenter_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_presenter({ - // obj_type: 'event_presenter', - // obj_li: [event_presenter_obj_update_result] - // }); - } - return event_presenter_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_presenter({ + // obj_type: 'event_presenter', + // obj_li: [event_presenter_obj_update_result] + // }); + } + return event_presenter_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log( - 'ae_promises.update__event_presenter_obj:', - ae_promises.update__event_presenter_obj - ); - } - return ae_promises.update__event_presenter_obj; + if (log_lvl) { + console.log( + 'ae_promises.update__event_presenter_obj:', + ae_promises.update__event_presenter_obj + ); + } + return ae_promises.update__event_presenter_obj; } // Updated 2025-05-23 export async function search__event_presenter({ - api_cfg, - event_id, - agree = null, - biography = null, - fulltext_search_qry_str, - ft_presenter_search_qry_str, - like_search_qry_str = null, - like_presentation_search_qry_str = null, - like_presenter_search_qry_str = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - given_name: 'ASC', - family_name: 'ASC', - email: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + agree = null, + biography = null, + fulltext_search_qry_str, + ft_presenter_search_qry_str, + like_search_qry_str = null, + like_presentation_search_qry_str = null, + like_presenter_search_qry_str = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + given_name: 'ASC', + family_name: 'ASC', + email: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - agree?: null | boolean; - biography?: null | boolean; - fulltext_search_qry_str?: null | string; - ft_presenter_search_qry_str?: null | string; - like_search_qry_str?: null | string; - like_presentation_search_qry_str?: null | string; - like_presenter_search_qry_str?: null | string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + agree?: null | boolean; + biography?: null | boolean; + fulltext_search_qry_str?: null | string; + ft_presenter_search_qry_str?: null | string; + like_search_qry_str?: null | string; + like_presentation_search_qry_str?: null | string; + like_presenter_search_qry_str?: null | string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** search__event_presenter() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** search__event_presenter() *** event_id=${event_id}`); + } - // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled - // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 25); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 25); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (!fulltext_search_qry_str && !like_search_qry_str) { - // console.log('No search string provided!!!'); - // return false; // Returning false instead of [] because no search was performed. - // } + // if (!fulltext_search_qry_str && !like_search_qry_str) { + // console.log('No search string provided!!!'); + // return false; // Returning false instead of [] because no search was performed. + // } - if (fulltext_search_qry_str || ft_presenter_search_qry_str) { - params_json['ft_qry'] = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; - } + if (fulltext_search_qry_str || ft_presenter_search_qry_str) { + params_json['ft_qry'] = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; + } - if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { - params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; - } - } + if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { + params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; + } + } - // Use the AND (AND LIKE) query - // if (like_search_qry_str || like_presenter_search_qry_str) { - // params_json['and_like'] = {}; - // if (like_search_qry_str && like_search_qry_str.length > 2) { - // params_json['and_like']['default_qry_str'] = like_search_qry_str; - // } - // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - // } - // } + // Use the AND (AND LIKE) query + // if (like_search_qry_str || like_presenter_search_qry_str) { + // params_json['and_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['and_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + // } + // } - // Use the AND (OR LIKE) query - if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { - params_json['or_like'] = {}; - if (like_search_qry_str && like_search_qry_str.length > 2) { - params_json['or_like']['default_qry_str'] = like_search_qry_str; - } - if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { - params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; - } - if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - } - } + // Use the AND (OR LIKE) query + if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { + params_json['or_like'] = {}; + if (like_search_qry_str && like_search_qry_str.length > 2) { + params_json['or_like']['default_qry_str'] = like_search_qry_str; + } + if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { + params_json['or_like']['event_presentation_li_qry_str'] = + like_presentation_search_qry_str; + } + if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + } + } - params_json['and_qry'] = {}; + params_json['and_qry'] = {}; - if (agree === true || agree === false) { - params_json['and_qry']['agree'] = agree; - // if (!agree) { - // params_json['or_qry']['agree'] = null; - // } - } - // if (agree === null) { - // params_json['and_qry']['agree'] = agree; - // } + if (agree === true || agree === false) { + params_json['and_qry']['agree'] = agree; + // if (!agree) { + // params_json['or_qry']['agree'] = null; + // } + } + // if (agree === null) { + // params_json['and_qry']['agree'] = agree; + // } - if (biography) { - params_json['and_qry']['biography_check'] = biography; - } + if (biography) { + params_json['and_qry']['biography_check'] = biography; + } - // 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({ - api_cfg: api_cfg, - obj_type: 'event_presenter', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for session searching - // use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_presenter_obj_li_get_result) { - if (event_presenter_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_presenter_props({ - obj_li: event_presenter_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return event_presenter_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // 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({ + api_cfg: api_cfg, + obj_type: 'event_presenter', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for session searching + // use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_presenter_obj_li_get_result) { + if (event_presenter_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_presenter_props({ + obj_li: event_presenter_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return event_presenter_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log( - 'ae_promises.load__event_presenter_obj_li:', - ae_promises.load__event_presenter_obj_li - ); - } - return ae_promises.load__event_presenter_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__event_presenter_obj_li:', + ae_promises.load__event_presenter_obj_li + ); + } + return ae_promises.load__event_presenter_obj_li; } // Updated 2024-08-07 export async function email_sign_in__event_presenter({ - api_cfg, - to_email, - to_name, - base_url, - person_id, - person_passcode, - event_id, - event_session_id, - event_presentation_id, - event_presenter_id, - session_name, - presentation_name, - log_lvl = 0 + api_cfg, + to_email, + to_name, + base_url, + person_id, + person_passcode, + event_id, + event_session_id, + event_presentation_id, + event_presenter_id, + session_name, + presentation_name, + log_lvl = 0 }: { - api_cfg: any; - to_email: string; - to_name: string; - base_url: string; - person_id: string; - person_passcode: string; - event_id: string; - event_session_id: string; - event_presentation_id: string; - event_presenter_id: string; - session_name: string; - presentation_name: string; - log_lvl?: number; + api_cfg: any; + to_email: string; + to_name: string; + base_url: string; + person_id: string; + person_passcode: string; + event_id: string; + event_session_id: string; + event_presentation_id: string; + event_presenter_id: string; + session_name: string; + presentation_name: string; + log_lvl?: number; }) { - 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}` - ); - } + 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}` + ); + } - const 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})`; - 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}` - ); + 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}` + ); - const body_html = ` + const body_html = `
${to_name},

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.

@@ -732,103 +733,103 @@ export async function email_sign_in__event_presenter({ Copy and paste link: ${sign_in_url}

`; - api.send_email({ - api_cfg: api_cfg, - from_email: 'noreply+presmgmt@oneskyit.com', - from_name: 'LCI 2025 Pres Mgmt Hub', - to_email: to_email, - subject: subject, - body_html: body_html - }); + api.send_email({ + api_cfg: api_cfg, + from_email: 'noreply+presmgmt@oneskyit.com', + from_name: 'LCI 2025 Pres Mgmt Hub', + to_email: to_email, + subject: subject, + body_html: body_html + }); } // Updated 2025-05-23 export const properties_to_save = [ - 'id', - 'event_presenter_id', - // 'event_presenter_id_random', + 'id', + 'event_presenter_id', + // 'event_presenter_id_random', - 'external_id', - 'code', + 'external_id', + 'code', - // 'for_type', - // 'for_id', - // 'for_id_random', + // 'for_type', + // 'for_id', + // 'for_id_random', - 'event_id', - // 'event_id_random', - 'event_session_id', - // 'event_session_id_random', - 'event_presentation_id', - // 'event_presentation_id_random', - 'event_person_id', - // 'event_person_id_random', - 'person_id', - // 'person_id_random', - 'person_profile_id', - // 'person_profile_id_random', + 'event_id', + // 'event_id_random', + 'event_session_id', + // 'event_session_id_random', + 'event_presentation_id', + // 'event_presentation_id_random', + 'event_person_id', + // 'event_person_id_random', + 'person_id', + // 'person_id_random', + 'person_profile_id', + // 'person_profile_id_random', - 'pronouns', - 'informal_name', - 'title_names', - 'given_name', - 'middle_name', - 'family_name', - 'designations', + 'pronouns', + 'informal_name', + 'title_names', + 'given_name', + 'middle_name', + 'family_name', + 'designations', - 'professional_title', + 'professional_title', - 'full_name', + 'full_name', - 'affiliations', + 'affiliations', - 'email', + 'email', - 'biography', + 'biography', - 'agree', - 'comments', + 'agree', + 'comments', - 'passcode', + 'passcode', - 'hide_event_launcher', + 'hide_event_launcher', - 'data_json', + 'data_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'file_count', + // From SQL view + 'file_count', - 'event_session_code', - 'event_session_name', - 'event_session_start_datetime', - 'event_presentation_code', - 'event_presentation_name', - 'event_presentation_start_datetime', + 'event_session_code', + 'event_session_name', + 'event_session_start_datetime', + 'event_presentation_code', + 'event_presentation_name', + 'event_presentation_start_datetime', - 'person_external_id', - 'person_external_sys_id', - 'person_given_name', - 'person_family_name', - 'person_full_name', - 'person_professional_title', - 'person_affiliations', - 'person_primary_email', - 'person_passcode' + 'person_external_id', + 'person_external_sys_id', + 'person_given_name', + 'person_family_name', + 'person_full_name', + 'person_professional_title', + 'person_affiliations', + 'person_primary_email', + 'person_passcode' ]; /** @@ -836,91 +837,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-23 export async function process_ae_obj__event_presenter_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_presenter', - log_lvl, - specific_processor: (obj) => { - // Event presenter-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_presenter', + log_lvl, + specific_processor: (obj) => { + // Event presenter-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__event_session.ts b/src/lib/ae_events/ae_events__event_session.ts index f7d4f96c..4fca8bd5 100644 --- a/src/lib/ae_events/ae_events__event_session.ts +++ b/src/lib/ae_events/ae_events__event_session.ts @@ -11,1115 +11,1135 @@ const ae_promises: key_val = {}; // Updated 2025-05-22 export async function load_ae_obj_id__event_session({ - api_cfg, - event_session_id, - inc_file_li = false, - inc_all_file_li = false, - inc_presentation_li = false, - inc_presenter_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 149, - offset = 0, - try_cache = true, - log_lvl = 0 + api_cfg, + event_session_id, + inc_file_li = false, + inc_all_file_li = false, + inc_presentation_li = false, + inc_presenter_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 149, + offset = 0, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_session_id: string; - inc_file_li?: boolean; - inc_all_file_li?: boolean; - inc_presentation_li?: boolean; - inc_presenter_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_session_id: string; + inc_file_li?: boolean; + inc_all_file_li?: boolean; + inc_presentation_li?: boolean; + inc_presenter_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__event_session() *** event_session_id=${event_session_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__event_session() *** event_session_id=${event_session_id}`); + } - const params = {}; + const params = {}; - // $events_sess.badges.status_load__event_session_obj = 'loading'; - ae_promises.load__event_session_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_session', - obj_id: event_session_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (event_session_obj_get_result) { - if (event_session_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_session_props({ - obj_li: [event_session_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // $events_sess.badges.status_load__event_session_obj = 'loading'; + ae_promises.load__event_session_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_session', + obj_id: event_session_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (event_session_obj_get_result) { + if (event_session_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_session_props({ + obj_li: [event_session_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', - // obj_li: [event_session_obj_get_result] - // }); - } - return event_session_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__event_session({ + // obj_type: 'event_session', + // obj_li: [event_session_obj_get_result] + // }); + } + return event_session_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_session_obj:', ae_promises?.load__event_session_obj); - } + if (log_lvl) { + console.log('ae_promises.load__event_session_obj:', ae_promises?.load__event_session_obj); + } - if (ae_promises?.load__event_session_obj === null) { - console.log('No results returned.'); - return null; - } + if (ae_promises?.load__event_session_obj === null) { + console.log('No results returned.'); + return null; + } - if (inc_file_li) { - // Load the files for the session - if (log_lvl) { - console.log(`Need to load the file list for the session now`); - } - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_session', - for_obj_id: event_session_id, - enabled: enabled, - limit: 15, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + if (inc_file_li) { + // Load the files for the session + if (log_lvl) { + console.log(`Need to load the file list for the session now`); + } + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_session', + for_obj_id: event_session_id, + enabled: enabled, + limit: 15, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`load_event_file_obj_li = `, load_event_file_obj_li); - } - ae_promises.load__event_session_obj.event_file_li = load_event_file_obj_li; - } + if (log_lvl) { + console.log(`load_event_file_obj_li = `, load_event_file_obj_li); + } + ae_promises.load__event_session_obj.event_file_li = load_event_file_obj_li; + } - if (inc_presentation_li) { - // Load the presentations for the session - if (log_lvl) { - 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 - const load_event_presentation_obj_li = load_ae_obj_li__event_presentation({ - api_cfg: api_cfg, - for_obj_type: 'event_session', - for_obj_id: event_session_id, - inc_file_li: inc_all_file_li, - inc_presenter_li: inc_presenter_li, - enabled: enabled, // all, disabled, enabled - hidden: hidden, // all, hidden, not_hidden - limit: limit, // 25 - offset: offset, // 0 - params: {}, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_presentation_obj_li) => { - if (log_lvl) { - console.log(`event_presentation_obj_li = `, event_presentation_obj_li); - } - return event_presentation_obj_li; - }); + if (inc_presentation_li) { + // Load the presentations for the session + if (log_lvl) { + 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 + const load_event_presentation_obj_li = load_ae_obj_li__event_presentation({ + api_cfg: api_cfg, + for_obj_type: 'event_session', + for_obj_id: event_session_id, + inc_file_li: inc_all_file_li, + inc_presenter_li: inc_presenter_li, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // 25 + offset: offset, // 0 + params: {}, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_presentation_obj_li) => { + if (log_lvl) { + console.log(`event_presentation_obj_li = `, event_presentation_obj_li); + } + return event_presentation_obj_li; + }); - if (log_lvl) { - console.log(`event_presentation_obj_li = `, load_event_presentation_obj_li); - } - ae_promises.load__event_session_obj.event_presentation_li = load_event_presentation_obj_li; - } + if (log_lvl) { + console.log(`event_presentation_obj_li = `, load_event_presentation_obj_li); + } + ae_promises.load__event_session_obj.event_presentation_li = load_event_presentation_obj_li; + } - return ae_promises.load__event_session_obj; + return ae_promises.load__event_session_obj; } // Updated 2025-05-22 export async function load_ae_obj_li__event_session({ - api_cfg, - for_obj_type, - for_obj_id, - inc_file_li = false, - inc_all_file_li = false, - inc_presentation_li = false, - inc_presenter_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 149, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - start_datetime: 'ASC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type, + for_obj_id, + inc_file_li = false, + inc_all_file_li = false, + inc_presentation_li = false, + inc_presenter_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 149, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + start_datetime: 'ASC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_file_li?: boolean; - inc_all_file_li?: boolean; - inc_presentation_li?: boolean; - inc_presenter_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; // 99 - offset?: number; // 0 - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_file_li?: boolean; + inc_all_file_li?: boolean; + inc_presentation_li?: boolean; + inc_presenter_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; // 99 + offset?: number; // 0 + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__event_session() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 99); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_session', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. - // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_session_obj_li_get_result) { - if (event_session_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_session_props({ - obj_li: event_session_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // 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({ + api_cfg: api_cfg, + obj_type: 'event_session', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config. + // use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_session_obj_li_get_result) { + if (event_session_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_session_props({ + obj_li: event_session_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', - // obj_li: event_session_obj_li_get_result - // }); - } - return event_session_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__event_session({ + // obj_type: 'event_session', + // obj_li: event_session_obj_li_get_result + // }); + } + return event_session_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__event_session_obj_li:', ae_promises.load__event_session_obj_li); - } + if (log_lvl) { + console.log( + 'ae_promises.load__event_session_obj_li:', + ae_promises.load__event_session_obj_li + ); + } - if (inc_file_li) { - // Load the files for the sessions - if (log_lvl) { - 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++) { - const event_session_obj = ae_promises.load__event_session_obj_li[i]; - const event_session_id = event_session_obj.event_session_id_random; + if (inc_file_li) { + // Load the files for the sessions + if (log_lvl) { + 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++) { + const event_session_obj = ae_promises.load__event_session_obj_li[i]; + const event_session_id = event_session_obj.event_session_id_random; - const load_event_file_obj_li = load_ae_obj_li__event_file({ - api_cfg: api_cfg, - for_obj_type: 'event_session', - for_obj_id: event_session_id, - enabled: enabled, - limit: limit, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); + const load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_session', + for_obj_id: event_session_id, + enabled: enabled, + limit: limit, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); - if (log_lvl) { - console.log(`load_event_file_obj_li = `, load_event_file_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_event_file_obj_li = `, load_event_file_obj_li); + } + } + } - if (inc_presentation_li) { - // Load the presentations for the sessions - if (log_lvl) { - 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++) { - const event_session_obj = ae_promises.load__event_session_obj_li[i]; - const event_session_id = event_session_obj.event_session_id_random; + if (inc_presentation_li) { + // Load the presentations for the sessions + if (log_lvl) { + 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++) { + const event_session_obj = ae_promises.load__event_session_obj_li[i]; + 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 - const load_event_presentation_obj_li = load_ae_obj_li__event_presentation({ - api_cfg: api_cfg, - for_obj_type: 'event_session', - for_obj_id: event_session_id, - inc_file_li: inc_all_file_li, - inc_presenter_li: inc_presenter_li, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((event_presentation_obj_li) => { - if (log_lvl) { - console.log(`event_presentation_obj_li = `, event_presentation_obj_li); - } - // if (try_cache) { - // console.log(`event_session_obj = `, event_session_obj); - // event_session_obj.event_presentation_li = event_presentation_obj_li; - // // Re-save the session object with the new presentation list - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', - // obj_li: event_session_obj - // }); - // } + // NOTE: The files will only be included if inc_all_file_li is true. 2025-09-17 + const load_event_presentation_obj_li = load_ae_obj_li__event_presentation({ + api_cfg: api_cfg, + for_obj_type: 'event_session', + for_obj_id: event_session_id, + inc_file_li: inc_all_file_li, + inc_presenter_li: inc_presenter_li, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((event_presentation_obj_li) => { + if (log_lvl) { + console.log(`event_presentation_obj_li = `, event_presentation_obj_li); + } + // if (try_cache) { + // console.log(`event_session_obj = `, event_session_obj); + // event_session_obj.event_presentation_li = event_presentation_obj_li; + // // Re-save the session object with the new presentation list + // db_save_ae_obj_li__event_session({ + // obj_type: 'event_session', + // obj_li: event_session_obj + // }); + // } - return event_presentation_obj_li; - }); + return event_presentation_obj_li; + }); - if (log_lvl) { - console.log(`load_event_presentation_obj_li = `, load_event_presentation_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_event_presentation_obj_li = `, load_event_presentation_obj_li); + } + } + } - return ae_promises.load__event_session_obj_li; + return ae_promises.load__event_session_obj_li; } // Updated 2025-05-22 export async function create_ae_obj__event_session({ - api_cfg, - event_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__event_session() *** event_id=${event_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__event_session() *** event_id=${event_id}`); + } - ae_promises.create__event_session = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'event_session', - fields: { - event_id_random: event_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_session_obj_create_result) { - if (event_session_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_session_props({ - obj_li: [event_session_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__event_session = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_session', + fields: { + event_id_random: event_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_session_obj_create_result) { + if (event_session_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_session_props({ + obj_li: [event_session_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_session( - // { - // obj_type: 'event_session', - // obj_li: [event_session_obj_create_result] - // }); - } - return event_session_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_session( + // { + // obj_type: 'event_session', + // obj_li: [event_session_obj_create_result] + // }); + } + return event_session_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__event_session:', ae_promises.create__event_session); - } - return ae_promises.create__event_session; + if (log_lvl) { + console.log('ae_promises.create__event_session:', ae_promises.create__event_session); + } + return ae_promises.create__event_session; } // Updated 2025-05-22 export async function delete_ae_obj_id__event_session({ - api_cfg, - event_session_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_session_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_session_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_session_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__event_session() *** event_session_id=${event_session_id}`); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'event_session', - obj_id: event_session_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for event_session_id=${event_session_id}`); - } - db_events.session.delete(event_session_id); - } - }); + ae_promises.delete__event_session_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_session', + obj_id: event_session_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for event_session_id=${event_session_id}` + ); + } + db_events.session.delete(event_session_id); + } + }); - if (log_lvl) { - console.log('ae_promises.delete__event_session_obj:', ae_promises.delete__event_session_obj); - } + if (log_lvl) { + console.log( + 'ae_promises.delete__event_session_obj:', + ae_promises.delete__event_session_obj + ); + } - return ae_promises.delete__event_session_obj; + return ae_promises.delete__event_session_obj; } // Updated 2025-05-22 export async function update_ae_obj__event_session({ - api_cfg, - event_session_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_session_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_session_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_session_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - 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 = await api - .update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_session', - obj_id: event_session_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (event_session_obj_update_result) { - if (event_session_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_session_props({ - obj_li: [event_session_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + if (log_lvl) { + 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 = await api + .update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_session', + obj_id: event_session_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (event_session_obj_update_result) { + if (event_session_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_session_props({ + obj_li: [event_session_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', obj_li: [event_session_obj_update_result] - // }); - } - return event_session_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_session({ + // obj_type: 'event_session', obj_li: [event_session_obj_update_result] + // }); + } + return event_session_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.update__event_session_obj:', ae_promises.update__event_session_obj); - } - return ae_promises.update__event_session_obj; + if (log_lvl) { + console.log( + 'ae_promises.update__event_session_obj:', + 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. // Updated 2025-07-21 export async function qry__event_session({ - api_cfg, - event_id, - qry_str, - qry_files, - qry_start_datetime, // Example greater than: '2024-10-24' - qry_poc_agree = null, - qry_poc_kv_json, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - start_datetime: 'ASC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + qry_str, + qry_files, + qry_start_datetime, // Example greater than: '2024-10-24' + qry_poc_agree = null, + qry_poc_kv_json, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + start_datetime: 'ASC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - qry_str?: string; - qry_files?: null | boolean; - qry_start_datetime?: null | string; // Greater than this datetime - qry_poc_agree?: null | boolean; - qry_poc_kv_json?: null | boolean; // Key value pairs for the point of contact - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + qry_str?: string; + qry_files?: null | boolean; + qry_start_datetime?: null | string; // Greater than this datetime + qry_poc_agree?: null | boolean; + qry_poc_kv_json?: null | boolean; // Key value pairs for the point of contact + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** qry__event_session() *** event_id=${event_id} qry_str=${qry_str}`); - } + if (log_lvl) { + console.log(`*** qry__event_session() *** event_id=${event_id} qry_str=${qry_str}`); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_files === true) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: '>', - value: 0 - }; - params_json['qry'].push(qry_param); - } else if (qry_files === false) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: 'IS', - value: null - }; - params_json['qry'].push(qry_param); - } + if (qry_files === true) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: '>', + value: 0 + }; + params_json['qry'].push(qry_param); + } else if (qry_files === false) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: 'IS', + value: null + }; + params_json['qry'].push(qry_param); + } - if (qry_start_datetime) { - const qry_param = { - type: 'AND', - field: 'start_datetime', - operator: '>', - value: qry_start_datetime - }; - params_json['qry'].push(qry_param); - } + if (qry_start_datetime) { + const qry_param = { + type: 'AND', + field: 'start_datetime', + operator: '>', + value: qry_start_datetime + }; + params_json['qry'].push(qry_param); + } - if (qry_poc_agree === true) { - const qry_param = { - type: 'AND', - field: 'poc_agree', - operator: '=', - value: true - }; - params_json['qry'].push(qry_param); - } else if (qry_poc_agree === false) { - // let qry_param = - // { - // type: "AND", - // field: "poc_agree", - // operator: "IS", - // value: null - // }; - // params_json['qry'].push(qry_param); - const qry_param = { - type: 'AND', - field: 'poc_agree', - operator: '=', - value: false - }; - params_json['qry'].push(qry_param); - } + if (qry_poc_agree === true) { + const qry_param = { + type: 'AND', + field: 'poc_agree', + operator: '=', + value: true + }; + params_json['qry'].push(qry_param); + } else if (qry_poc_agree === false) { + // let qry_param = + // { + // type: "AND", + // field: "poc_agree", + // operator: "IS", + // value: null + // }; + // params_json['qry'].push(qry_param); + const qry_param = { + type: 'AND', + field: 'poc_agree', + operator: '=', + value: false + }; + params_json['qry'].push(qry_param); + } - if (qry_poc_kv_json === true) { - const qry_param = { - type: 'AND', - field: 'poc_kv_json', - operator: 'IS NOT', - value: null - }; - params_json['qry'].push(qry_param); - } else if (qry_poc_kv_json === false) { - const qry_param = { - type: 'AND', - field: 'poc_kv_json', - operator: 'IS', - value: null - }; - params_json['qry'].push(qry_param); - } + if (qry_poc_kv_json === true) { + const qry_param = { + type: 'AND', + field: 'poc_kv_json', + operator: 'IS NOT', + value: null + }; + params_json['qry'].push(qry_param); + } else if (qry_poc_kv_json === false) { + const qry_param = { + type: 'AND', + field: 'poc_kv_json', + operator: 'IS', + value: null + }; + params_json['qry'].push(qry_param); + } - ae_promises.load__event_session_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'event_session', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for session searching - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_session_obj_li_get_result) { - if (event_session_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_session_props({ - obj_li: event_session_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'presenter', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__event_session_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'event_session', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for session searching + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_session_obj_li_get_result) { + if (event_session_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_session_props({ + obj_li: event_session_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'presenter', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', - // obj_li: event_session_obj_li_get_result - // }); - } - return event_session_obj_li_get_result; - } else { - return []; - } - }); + // db_save_ae_obj_li__event_session({ + // obj_type: 'event_session', + // obj_li: event_session_obj_li_get_result + // }); + } + return event_session_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__event_session_obj_li:', ae_promises.load__event_session_obj_li); - } - return ae_promises.load__event_session_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__event_session_obj_li:', + ae_promises.load__event_session_obj_li + ); + } + return ae_promises.load__event_session_obj_li; } // Updated 2025-05-22 export async function search__event_session({ - api_cfg, - event_id, - poc_agree = null, - fulltext_search_qry_str, - ft_presenter_search_qry_str, - like_search_qry_str = null, - like_presentation_search_qry_str = null, - like_presenter_search_qry_str = null, - like_poc_name_qry_str = null, - file_count = false, // If true then only show those that have a file count - location_name = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 49, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - start_datetime: 'ASC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + poc_agree = null, + fulltext_search_qry_str, + ft_presenter_search_qry_str, + like_search_qry_str = null, + like_presentation_search_qry_str = null, + like_presenter_search_qry_str = null, + like_poc_name_qry_str = null, + file_count = false, // If true then only show those that have a file count + location_name = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 49, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + start_datetime: 'ASC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - poc_agree?: null | boolean; - fulltext_search_qry_str?: null | string; - ft_presenter_search_qry_str?: null | string; - like_search_qry_str?: null | string; - like_presentation_search_qry_str?: null | string; - like_presenter_search_qry_str?: null | string; - like_poc_name_qry_str?: null | string; - file_count?: boolean; - location_name?: null | string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + poc_agree?: null | boolean; + fulltext_search_qry_str?: null | string; + ft_presenter_search_qry_str?: null | string; + like_search_qry_str?: null | string; + like_presentation_search_qry_str?: null | string; + like_presenter_search_qry_str?: null | string; + like_poc_name_qry_str?: null | string; + file_count?: boolean; + location_name?: null | string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** search__event_session() *** event_id=${event_id} like_search_qry_str=${like_search_qry_str} location_name=${location_name}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 25); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 25); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (!fulltext_search_qry_str && !like_search_qry_str) { - // console.log('No search string provided!!!'); - // return false; // Returning false instead of [] because no search was performed. - // } + // if (!fulltext_search_qry_str && !like_search_qry_str) { + // console.log('No search string provided!!!'); + // return false; // Returning false instead of [] because no search was performed. + // } - if (fulltext_search_qry_str || ft_presenter_search_qry_str) { - params_json['ft_qry'] = {}; - if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; - } + if (fulltext_search_qry_str || ft_presenter_search_qry_str) { + params_json['ft_qry'] = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; + } - if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { - params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; - } - } + if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { + params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; + } + } - // Use the AND (AND LIKE) query - // if (like_search_qry_str || like_presenter_search_qry_str) { - // params_json['and_like'] = {}; - // if (like_search_qry_str && like_search_qry_str.length > 2) { - // params_json['and_like']['default_qry_str'] = like_search_qry_str; - // } - // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - // } - // } + // Use the AND (AND LIKE) query + // if (like_search_qry_str || like_presenter_search_qry_str) { + // params_json['and_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['and_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + // } + // } - // 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 - ) { - params_json['or_like'] = {}; - if (like_search_qry_str && like_search_qry_str.length > 2) { - params_json['or_like']['default_qry_str'] = like_search_qry_str; - } - if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { - params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; - } - if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { - params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; - } - if (like_poc_name_qry_str && like_poc_name_qry_str.length > 2) { - params_json['or_like']['poc_person_full_name'] = like_poc_name_qry_str; - } - } + // 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 + ) { + params_json['or_like'] = {}; + if (like_search_qry_str && like_search_qry_str.length > 2) { + params_json['or_like']['default_qry_str'] = like_search_qry_str; + } + if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { + params_json['or_like']['event_presentation_li_qry_str'] = + like_presentation_search_qry_str; + } + if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + } + if (like_poc_name_qry_str && like_poc_name_qry_str.length > 2) { + params_json['or_like']['poc_person_full_name'] = like_poc_name_qry_str; + } + } - params_json['and_qry'] = {}; + params_json['and_qry'] = {}; - if (poc_agree) { - params_json['and_qry']['poc_agree'] = poc_agree; - } + if (poc_agree) { + params_json['and_qry']['poc_agree'] = poc_agree; + } - if (file_count) { - params_json['and_qry']['file_count'] = file_count; - } + if (file_count) { + params_json['and_qry']['file_count'] = file_count; + } - // This should be using a like with surrounded by %'s - if (location_name) { - params_json['and_qry']['event_location_name'] = location_name; - } + // This should be using a like with surrounded by %'s + if (location_name) { + params_json['and_qry']['event_location_name'] = location_name; + } - // 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_v2({ - api_cfg: api_cfg, - obj_type: 'event_session', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for session searching - // use_alt_mdl: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (event_session_obj_li_get_result) { - if (event_session_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__event_session_props({ - obj_li: event_session_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'session', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // 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({ + api_cfg: api_cfg, + obj_type: 'event_session', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for session searching + // use_alt_mdl: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (event_session_obj_li_get_result) { + if (event_session_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__event_session_props({ + obj_li: event_session_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'session', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', - // obj_li: event_session_obj_li_get_result - // }); - } - return event_session_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__event_session({ + // obj_type: 'event_session', + // obj_li: event_session_obj_li_get_result + // }); + } + return event_session_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.load__event_session_obj_li:', ae_promises.load__event_session_obj_li); - } - return ae_promises.load__event_session_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__event_session_obj_li:', + 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. // Updated 2025-05-09 export async function db_save_ae_obj_li__event_session({ - obj_type, - obj_li, - log_lvl = 0 + obj_type, + obj_li, + log_lvl = 0 }: { - obj_type: string; - obj_li: any; - log_lvl?: number; + obj_type: string; + obj_li: any; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** db_save_ae_obj_li__event_session() *** obj_type=${obj_type}`, obj_li); - } + if (log_lvl) { + console.log(`*** db_save_ae_obj_li__event_session() *** obj_type=${obj_type}`, obj_li); + } - if (obj_li && obj_li.length) { - const obj_li_id: string[] = []; + if (obj_li && obj_li.length) { + const obj_li_id: string[] = []; - for (const obj of obj_li) { - if (log_lvl) { - console.log(`Processing ae_obj ${obj_type}:`, obj); - } + for (const obj of obj_li) { + if (log_lvl) { + console.log(`Processing ae_obj ${obj_type}:`, obj); + } - const obj_record = { - id: obj.event_session_id_random, - event_session_id: obj.event_session_id_random, - event_session_id_random: obj.event_session_id_random, + const obj_record = { + id: obj.event_session_id_random, + event_session_id: obj.event_session_id_random, + event_session_id_random: obj.event_session_id_random, - external_id: obj.external_id, - code: obj.code, + external_id: obj.external_id, + code: obj.code, - for_type: obj.for_type, - for_id: obj.for_id_id_random, - for_id_random: obj.for_id_random, + for_type: obj.for_type, + for_id: obj.for_id_id_random, + for_id_random: obj.for_id_random, - type_code: obj.type_code, + type_code: obj.type_code, - event_id: obj.event_id_random, - event_id_random: obj.event_id_random, - event_location_id: obj.event_location_id_random, - event_location_id_random: obj.event_location_id_random, + event_id: obj.event_id_random, + event_id_random: obj.event_id_random, + event_location_id: obj.event_location_id_random, + event_location_id_random: obj.event_location_id_random, - poc_person_id: obj.poc_person_id_random, - poc_person_id_random: obj.poc_person_id_random, - poc_agree: obj.poc_agree, - poc_kv_json: obj.poc_kv_json ?? {}, + poc_person_id: obj.poc_person_id_random, + poc_person_id_random: obj.poc_person_id_random, + poc_agree: obj.poc_agree, + poc_kv_json: obj.poc_kv_json ?? {}, - name: obj.name, - description: obj.description, + name: obj.name, + description: obj.description, - start_datetime: obj.start_datetime, - end_datetime: obj.end_datetime, + start_datetime: obj.start_datetime, + end_datetime: obj.end_datetime, - passcode: obj.passcode, + passcode: obj.passcode, - hide_event_launcher: obj.hide_event_launcher, + hide_event_launcher: obj.hide_event_launcher, - alert: obj.alert, - alert_msg: obj.alert_msg, + alert: obj.alert, + alert_msg: obj.alert_msg, - data_json: obj.data_json, + data_json: obj.data_json, - ux_mode: obj.ux_mode, + ux_mode: obj.ux_mode, - enable: obj.enable, - hide: obj.hide, - priority: obj.priority, - sort: obj.sort, - group: obj.group, - notes: obj.notes, - created_on: obj.created_on, - updated_on: obj.updated_on, + enable: obj.enable, + hide: obj.hide, + priority: obj.priority, + sort: obj.sort, + group: obj.group, + notes: obj.notes, + created_on: obj.created_on, + updated_on: obj.updated_on, - // From SQL view - file_count: obj.file_count, - file_count_all: obj.file_count_all, - internal_use_count: obj.internal_use_count, - event_file_id_li_json: obj.event_file_id_li_json, + // From SQL view + file_count: obj.file_count, + file_count_all: obj.file_count_all, + internal_use_count: obj.internal_use_count, + event_file_id_li_json: obj.event_file_id_li_json, - poc_person_given_name: obj.poc_person_given_name, - poc_person_family_name: obj.poc_person_family_name, - poc_person_full_name: obj.poc_person_full_name, - poc_person_primary_email: obj.poc_person_primary_email, - poc_person_passcode: obj.poc_person_passcode, + poc_person_given_name: obj.poc_person_given_name, + poc_person_family_name: obj.poc_person_family_name, + poc_person_full_name: obj.poc_person_full_name, + poc_person_primary_email: obj.poc_person_primary_email, + poc_person_passcode: obj.poc_person_passcode, - event_name: obj.event_name, + event_name: obj.event_name, - event_location_code: obj.event_location_code, - event_location_name: obj.event_location_name, + event_location_code: obj.event_location_code, + event_location_name: obj.event_location_name, - // A key value list of the presentations - event_presentation_kv: obj.event_presentation_kv, - event_presentation_li: obj.event_presentation_li - }; + // A key value list of the presentations + event_presentation_kv: obj.event_presentation_kv, + event_presentation_li: obj.event_presentation_li + }; - let id_random = null; + let id_random = null; - try { - id_random = await db_events.session.update(obj_record.id, obj_record); - } catch (error) { - console.error(`Error: Failed to update ${obj_record.id}: ${error}`); - } + try { + id_random = await db_events.session.update(obj_record.id, obj_record); + } catch (error) { + console.error(`Error: Failed to update ${obj_record.id}: ${error}`); + } - if (!id_random) { - if (log_lvl) { - console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); - } - try { - id_random = await db_events.session.put(obj_record); - } catch (error) { - console.error(`Error: Failed to put ${obj.event_session_id_random}: ${error}`); - } - } else { - if (log_lvl) { - console.log(`Updated record with ID: ${obj_record.id}`); - } - } + if (!id_random) { + if (log_lvl) { + console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); + } + try { + id_random = await db_events.session.put(obj_record); + } catch (error) { + console.error(`Error: Failed to put ${obj.event_session_id_random}: ${error}`); + } + } else { + if (log_lvl) { + console.log(`Updated record with ID: ${obj_record.id}`); + } + } - if (!id_random) { - console.error(`Failed to save record with ID: ${obj_record.id}`); - } else { - if (log_lvl) { - console.log(`Saved record with ID: ${obj_record.id}`); - } - obj_li_id.push(obj_record.id); - } - } + if (!id_random) { + console.error(`Failed to save record with ID: ${obj_record.id}`); + } else { + if (log_lvl) { + console.log(`Saved record with ID: ${obj_record.id}`); + } + obj_li_id.push(obj_record.id); + } + } - return obj_li_id; - } else { - if (log_lvl) { - console.log('No objects to save.'); - } - return []; - } + return obj_li_id; + } else { + if (log_lvl) { + console.log('No objects to save.'); + } + return []; + } } // This is intended for the Point of Contact (POC) for the session. // Updated 2024-07-01 export async function email_sign_in__event_session({ - api_cfg, - to_email, - to_name, - base_url, - person_id, - person_passcode, - event_id, - event_session_id, - session_name + api_cfg, + to_email, + to_name, + base_url, + person_id, + person_passcode, + event_id, + event_session_id, + session_name }: { - api_cfg: any; - to_email: string; - to_name: string; - base_url: string; - person_id: string; - person_passcode: string; - event_id: string; - event_session_id: string; - session_name: string; + api_cfg: any; + to_email: string; + to_name: string; + base_url: string; + person_id: string; + person_passcode: string; + event_id: string; + event_session_id: string; + session_name: string; }) { - 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}` - ); + 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}` + ); - const 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})`; - 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}` - ); + 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}` + ); - const body_html = ` + const body_html = `
${to_name},

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.

@@ -1134,93 +1154,93 @@ export async function email_sign_in__event_session({ Copy and paste link: ${sign_in_url}

`; - api.send_email({ - api_cfg: api_cfg, - from_email: 'noreply+presmgmt@oneskyit.com', - from_name: 'LCI 2025 Pres Mgmt Hub', - to_email: to_email, - subject: subject, - body_html: body_html - }); + api.send_email({ + api_cfg: api_cfg, + from_email: 'noreply+presmgmt@oneskyit.com', + from_name: 'LCI 2025 Pres Mgmt Hub', + to_email: to_email, + subject: subject, + body_html: body_html + }); } // Updated 2025-05-09 export const properties_to_save = [ - 'id', - 'event_session_id', - // 'event_session_id_random', + 'id', + 'event_session_id', + // 'event_session_id_random', - 'external_id', - 'code', + 'external_id', + 'code', - 'for_type', - 'for_id', - // 'for_id_random', + 'for_type', + 'for_id', + // 'for_id_random', - 'type_code', + 'type_code', - 'event_id', - // 'event_id_random', - 'event_location_id', - // 'event_location_id_random', + 'event_id', + // 'event_id_random', + 'event_location_id', + // 'event_location_id_random', - 'poc_person_id', - // 'poc_person_id_random', - 'poc_agree', - 'poc_kv_json', + 'poc_person_id', + // 'poc_person_id_random', + 'poc_agree', + 'poc_kv_json', - 'name', - 'description', + 'name', + 'description', - 'start_datetime', - 'end_datetime', + 'start_datetime', + 'end_datetime', - 'passcode', + 'passcode', - 'hide_event_launcher', + 'hide_event_launcher', - 'alert', - 'alert_msg', + 'alert', + 'alert_msg', - 'data_json', + 'data_json', - 'ux_mode', + 'ux_mode', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'file_count', - 'file_count_all', - 'internal_use_count', - 'event_file_id_li_json', + // From SQL view + 'file_count', + 'file_count_all', + 'internal_use_count', + 'event_file_id_li_json', - 'poc_person_given_name', - 'poc_person_family_name', - 'poc_person_full_name', - 'poc_person_primary_email', - 'poc_person_passcode', + 'poc_person_given_name', + 'poc_person_family_name', + 'poc_person_full_name', + 'poc_person_primary_email', + 'poc_person_passcode', - 'event_name', + 'event_name', - 'event_location_code', - 'event_location_name', + 'event_location_code', + 'event_location_name', - // A key value list of the presentations - 'event_presentation_kv', - 'event_presentation_li' + // A key value list of the presentations + 'event_presentation_kv', + 'event_presentation_li' ]; /** @@ -1228,91 +1248,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-09 export async function process_ae_obj__event_session_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_session', - log_lvl, - specific_processor: (obj) => { - // Event session-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_session', + log_lvl, + specific_processor: (obj) => { + // Event session-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_events/ae_events__exhibit.ts b/src/lib/ae_events/ae_events__exhibit.ts index ddedd58e..92948e36 100644 --- a/src/lib/ae_events/ae_events__exhibit.ts +++ b/src/lib/ae_events/ae_events__exhibit.ts @@ -5,98 +5,98 @@ import { db_events } from '$lib/ae_events/db_events'; // --- PROPERTIES TO SAVE --- export const properties_to_save_exhibit_tracking = [ - 'id', - 'event_exhibit_tracking_id', - 'event_exhibit_id', - 'event_badge_id', - 'event_person_id', - 'external_person_id', - 'exhibitor_notes', - 'responses_json', - 'data_json', - 'event_exhibit_name', - 'event_badge_title_names', - 'event_badge_given_name', - 'event_badge_family_name', - 'event_badge_designations', - 'event_badge_full_name', - 'event_badge_full_name_override', - 'event_badge_professional_title', - 'event_badge_professional_title_override', - 'event_badge_affiliations', - 'event_badge_affiliations_override', - 'event_badge_email', - 'event_badge_email_override', - 'event_badge_location', - 'event_badge_location_override', - 'event_badge_country', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' + 'id', + 'event_exhibit_tracking_id', + 'event_exhibit_id', + 'event_badge_id', + 'event_person_id', + 'external_person_id', + 'exhibitor_notes', + 'responses_json', + 'data_json', + 'event_exhibit_name', + 'event_badge_title_names', + 'event_badge_given_name', + 'event_badge_family_name', + 'event_badge_designations', + 'event_badge_full_name', + 'event_badge_full_name_override', + 'event_badge_professional_title', + 'event_badge_professional_title_override', + 'event_badge_affiliations', + 'event_badge_affiliations_override', + 'event_badge_email', + 'event_badge_email_override', + 'event_badge_location', + 'event_badge_location_override', + 'event_badge_country', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' ]; // --- PROCESS FUNCTION --- export async function process_ae_obj__exhibit_tracking_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_exhibit_tracking', - log_lvl, - specific_processor: (obj) => { - // Event exhibit tracking-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_exhibit_tracking', + log_lvl, + specific_processor: (obj) => { + // Event exhibit tracking-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } // --- PROPERTIES TO SAVE --- export const properties_to_save = [ - 'id', - 'event_exhibit_id', - 'event_id', - 'code', - 'name', - 'description', - 'staff_passcode', - 'data_json', - 'leads_api_access', - 'leads_custom_questions_json', - 'leads_device_sm_qty', - 'leads_device_lg_qty', - 'license_max', - 'license_li_json', - 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' + 'id', + 'event_exhibit_id', + 'event_id', + 'code', + 'name', + 'description', + 'staff_passcode', + 'data_json', + 'leads_api_access', + 'leads_custom_questions_json', + 'leads_device_sm_qty', + 'leads_device_lg_qty', + 'license_max', + 'license_li_json', + 'cfg_json', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' ]; /** @@ -104,631 +104,634 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // --- PROCESS FUNCTION --- export async function process_ae_obj__exhibit_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'event_exhibit', - log_lvl, - specific_processor: (obj) => { - // Event exhibit-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'event_exhibit', + log_lvl, + specific_processor: (obj) => { + // Event exhibit-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } // Updated 2024-03 export async function load_ae_obj_id__exhibit({ - api_cfg, - exhibit_id, - try_cache = false, - log_lvl = 0 + api_cfg, + exhibit_id, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - exhibit_id: string; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + exhibit_id: string; + try_cache?: boolean; + 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}`); - const params = {}; + const params = {}; - // $events_sess.exhibits.status_load__exhibit_obj = 'loading'; - ae_promises.load__exhibit_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_exhibit', - obj_id: exhibit_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (exhibit_obj_get_result) { - if (exhibit_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__exhibit_props({ - obj_li: [exhibit_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'exhibit', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return exhibit_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // $events_sess.exhibits.status_load__exhibit_obj = 'loading'; + ae_promises.load__exhibit_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_exhibit', + obj_id: exhibit_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (exhibit_obj_get_result) { + if (exhibit_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__exhibit_props({ + obj_li: [exhibit_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'exhibit', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return exhibit_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__exhibit_obj; + return ae_promises.load__exhibit_obj; } // Updated 2024-03-06 export async function load_ae_obj_li__exhibit({ - api_cfg, - event_id, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + event_id, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - event_id: any; - params: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + event_id: any; + params: any; + try_cache?: boolean; + 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}`); - const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled - const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden - const limit: number = params.qry__limit ?? 99; // 99 - const offset: number = params.qry__offset ?? 0; // 0 + const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled + const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden + const limit: number = params.qry__limit ?? 99; // 99 + const offset: number = params.qry__offset ?? 0; // 0 - const params_json: key_val = {}; - // params_json['and_qry'] = {}; - // params_json['and_qry']['license_max'] = 10; + const params_json: key_val = {}; + // params_json['and_qry'] = {}; + // params_json['and_qry']['license_max'] = 10; - params_json['and_in_li'] = { - license_max: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - }; + params_json['and_in_li'] = { + license_max: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + }; - // if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - // params_json['ft_qry'] = { - // 'default_qry_str': fulltext_search_qry_str, - // // '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 - // }; - // } + // if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + // params_json['ft_qry'] = { + // 'default_qry_str': fulltext_search_qry_str, + // // '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 + // }; + // } - // console.log('params_json:', params_json); - // console.log(params_json); + // console.log('params_json:', params_json); + // console.log(params_json); - // $events_sess.exhibits.status_qry__search = 'loading'; - ae_promises.load__event_exhibit_obj_li = await api - .get_ae_obj_li_for_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_exhibit', - for_obj_type: 'event', - for_obj_id: event_id, - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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, - hidden: hidden, - 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'}, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) + // $events_sess.exhibits.status_qry__search = 'loading'; + ae_promises.load__event_exhibit_obj_li = await api + .get_ae_obj_li_for_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_exhibit', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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, + hidden: hidden, + 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'}, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) - .then(async function (exhibit_obj_li_get_result) { - // console.log('Badge list:', exhibit_obj_li_get_result); - if (exhibit_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__exhibit_props({ - obj_li: exhibit_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'exhibit', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return exhibit_obj_li_get_result; - } else { - // $slct.exhibit_obj_li = []; - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - // $events_sess.exhibits.status_qry__search = 'done'; - // console.log('Badge list:', exhibit_obj_li_get_result); - // return exhibit_obj_li_get_result; - }); + .then(async function (exhibit_obj_li_get_result) { + // console.log('Badge list:', exhibit_obj_li_get_result); + if (exhibit_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__exhibit_props({ + obj_li: exhibit_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'exhibit', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return exhibit_obj_li_get_result; + } else { + // $slct.exhibit_obj_li = []; + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + // $events_sess.exhibits.status_qry__search = 'done'; + // console.log('Badge list:', exhibit_obj_li_get_result); + // return exhibit_obj_li_get_result; + }); - if (log_lvl) { - console.log('ae_promises.load__event_exhibit_obj_li:', ae_promises.load__event_exhibit_obj_li); - } - return ae_promises.load__event_exhibit_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__event_exhibit_obj_li:', + ae_promises.load__event_exhibit_obj_li + ); + } + return ae_promises.load__event_exhibit_obj_li; } export async function load_ae_obj_id__exhibit_tracking({ - api_cfg, - exhibit_tracking_id, - try_cache = false, - log_lvl = 0 + api_cfg, + exhibit_tracking_id, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - exhibit_tracking_id: string; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + exhibit_tracking_id: string; + try_cache?: boolean; + log_lvl?: number; }) { - console.log( - `*** load_ae_obj_id__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}` - ); + console.log( + `*** load_ae_obj_id__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}` + ); - const params = {}; + const params = {}; - // $events_sess.exhibits.status_load__exhibit_tracking_obj = 'loading'; - ae_promises.load__event_exhibit_tracking_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'event_exhibit_tracking', - obj_id: exhibit_tracking_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (exhibit_tracking_obj_get_result) { - if (exhibit_tracking_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ - obj_li: [exhibit_tracking_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'exhibit_tracking', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_exhibit_tracking, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return exhibit_tracking_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // $events_sess.exhibits.status_load__exhibit_tracking_obj = 'loading'; + ae_promises.load__event_exhibit_tracking_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_exhibit_tracking', + obj_id: exhibit_tracking_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (exhibit_tracking_obj_get_result) { + if (exhibit_tracking_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ + obj_li: [exhibit_tracking_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'exhibit_tracking', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_exhibit_tracking, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return exhibit_tracking_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__event_exhibit_tracking_obj; + return ae_promises.load__event_exhibit_tracking_obj; } // Updated 2024-03-19 export async function load_ae_obj_li__exhibit_tracking({ - api_cfg, - exhibit_id, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + exhibit_id, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - exhibit_id: any; - params: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + exhibit_id: any; + params: any; + try_cache?: boolean; + 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}`); - const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled - const hidden: string = params.qry__hidden ?? 'all'; // all, hidden, not_hidden - const limit: number = params.qry__limit ?? 99; // 99 - const offset: number = params.qry__offset ?? 0; // 0 + const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled + const hidden: string = params.qry__hidden ?? 'all'; // all, hidden, not_hidden + const limit: number = params.qry__limit ?? 99; // 99 + const offset: number = params.qry__offset ?? 0; // 0 - const 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({ - api_cfg: api_cfg, - obj_type: 'event_exhibit_tracking', - for_obj_type: 'event_exhibit', - for_obj_id: exhibit_id, - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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, - hidden: hidden, - order_by_li: { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) + ae_promises.load__event_exhibit_tracking_obj_li = await api + .get_ae_obj_li_for_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_exhibit_tracking', + for_obj_type: 'event_exhibit', + for_obj_id: exhibit_id, + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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, + hidden: hidden, + order_by_li: { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' }, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) - .then(async function (exhibit_tracking_obj_li_get_result) { - // console.log('Exhibit tracking list:', exhibit_tracking_obj_li_get_result); - if (exhibit_tracking_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ - obj_li: exhibit_tracking_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'exhibit_tracking', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_exhibit_tracking, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return exhibit_tracking_obj_li_get_result; - } else { - // $slct.exhibit_tracking_obj_li = []; - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - // console.log('Exhibit tracking list:', exhibit_tracking_obj_li_get_result); - // return exhibit_tracking_obj_li_get_result; - }); + .then(async function (exhibit_tracking_obj_li_get_result) { + // console.log('Exhibit tracking list:', exhibit_tracking_obj_li_get_result); + if (exhibit_tracking_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ + obj_li: exhibit_tracking_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'exhibit_tracking', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_exhibit_tracking, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return exhibit_tracking_obj_li_get_result; + } else { + // $slct.exhibit_tracking_obj_li = []; + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + // console.log('Exhibit tracking list:', exhibit_tracking_obj_li_get_result); + // return exhibit_tracking_obj_li_get_result; + }); - if (log_lvl) { - 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; + if (log_lvl) { + 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; } // Updated 2024-03-22 export async function create_ae_obj__exhibit_tracking({ - api_cfg, - exhibit_id, - event_badge_id, - external_person_id, - params = {}, - log_lvl = 0 + api_cfg, + exhibit_id, + event_badge_id, + external_person_id, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - exhibit_id: string; - event_badge_id: string; - external_person_id: string; - params: key_val; - log_lvl: number; + api_cfg: any; + exhibit_id: string; + event_badge_id: string; + external_person_id: string; + params: key_val; + log_lvl: number; }) { - console.log( - `*** handle_create_ae_obj__exhibit_tracking() *** exhibit_id=${exhibit_id}, event_badge_id=${event_badge_id}` - ); + console.log( + `*** handle_create_ae_obj__exhibit_tracking() *** exhibit_id=${exhibit_id}, event_badge_id=${event_badge_id}` + ); - const params_json: key_val = {}; + const params_json: key_val = {}; - // $events_sess.exhibits.status_create__exhibit_tracking = 'loading'; - ae_promises.create__event_exhibit_tracking = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'event_exhibit_tracking', - fields: { - event_exhibit_id_random: exhibit_id, - event_badge_id_random: event_badge_id, - external_person_id: external_person_id - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) + // $events_sess.exhibits.status_create__exhibit_tracking = 'loading'; + ae_promises.create__event_exhibit_tracking = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_exhibit_tracking', + fields: { + event_exhibit_id_random: exhibit_id, + event_badge_id_random: event_badge_id, + external_person_id: external_person_id + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) - .then(async function (exhibit_tracking_obj_create_result) { - // console.log('Exhibit tracking create:', exhibit_tracking_obj_create_result); - if (exhibit_tracking_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ - obj_li: [exhibit_tracking_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'exhibit_tracking', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_exhibit_tracking, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return exhibit_tracking_obj_create_result; - } else { - // $slct.exhibit_tracking_obj = []; - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - // console.log('Exhibit tracking create:', exhibit_tracking_obj_create_result); - // return exhibit_tracking_obj_create_result; - }); + .then(async function (exhibit_tracking_obj_create_result) { + // console.log('Exhibit tracking create:', exhibit_tracking_obj_create_result); + if (exhibit_tracking_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ + obj_li: [exhibit_tracking_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'exhibit_tracking', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_exhibit_tracking, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return exhibit_tracking_obj_create_result; + } else { + // $slct.exhibit_tracking_obj = []; + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + // console.log('Exhibit tracking create:', exhibit_tracking_obj_create_result); + // return exhibit_tracking_obj_create_result; + }); - if (log_lvl) { - console.log( - 'ae_promises.create__event_exhibit_tracking:', - ae_promises.create__event_exhibit_tracking - ); - } - return ae_promises.create__event_exhibit_tracking; + if (log_lvl) { + console.log( + 'ae_promises.create__event_exhibit_tracking:', + ae_promises.create__event_exhibit_tracking + ); + } + return ae_promises.create__event_exhibit_tracking; } // Updated 2024-03-28 export async function update_ae_obj__exhibit_tracking({ - api_cfg, - exhibit_tracking_id, - data, - params = {}, - log_lvl = 0 + api_cfg, + exhibit_tracking_id, + data, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - exhibit_tracking_id: string; - data: any; - params: key_val; - log_lvl: number; + api_cfg: any; + exhibit_tracking_id: string; + data: any; + params: key_val; + log_lvl: number; }) { - console.log( - `*** handle_update_ae_obj__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}` - ); + console.log( + `*** 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({ - api_cfg: api_cfg, - obj_type: 'event_exhibit_tracking', - obj_id: exhibit_tracking_id, - fields: data, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (exhibit_tracking_obj_update_result) { - if (exhibit_tracking_obj_update_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ - obj_li: [exhibit_tracking_obj_update_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_events, - table_name: 'exhibit_tracking', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_exhibit_tracking, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return exhibit_tracking_obj_update_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + ae_promises.update__event_exhibit_tracking = await api + .update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_exhibit_tracking', + obj_id: exhibit_tracking_id, + fields: data, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (exhibit_tracking_obj_update_result) { + if (exhibit_tracking_obj_update_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__exhibit_tracking_props({ + obj_li: [exhibit_tracking_obj_update_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_events, + table_name: 'exhibit_tracking', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_exhibit_tracking, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return exhibit_tracking_obj_update_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log( - 'ae_promises.update__event_exhibit_tracking:', - ae_promises.update__event_exhibit_tracking - ); - } - return ae_promises.update__event_exhibit_tracking; + if (log_lvl) { + console.log( + 'ae_promises.update__event_exhibit_tracking:', + ae_promises.update__event_exhibit_tracking + ); + } + return ae_promises.update__event_exhibit_tracking; } export async function download_export__event_exhibit_tracking({ - api_cfg, - exhibit_id, - file_type = 'CSV', // 'CSV' or 'Excel' - return_file = true, - filename = 'no_filename.csv', - auto_download = false, - params = {}, - log_lvl = 0 + api_cfg, + exhibit_id, + file_type = 'CSV', // 'CSV' or 'Excel' + return_file = true, + filename = 'no_filename.csv', + auto_download = false, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - exhibit_id: string; - file_type?: string; - return_file?: boolean; - filename?: string; - auto_download?: boolean; - params?: key_val; - log_lvl?: number; + api_cfg: any; + exhibit_id: string; + file_type?: string; + return_file?: boolean; + filename?: string; + auto_download?: boolean; + params?: key_val; + 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`; - if (file_type == 'CSV' || file_type == 'Excel') { - params['file_type'] = file_type; - } - params['return_file'] = true; + const endpoint = `/event/exhibit/${exhibit_id}/tracking/export`; + if (file_type == 'CSV' || file_type == 'Excel') { + params['file_type'] = file_type; + } + params['return_file'] = true; - ae_promises.download__event_exhibit_tracking_export_file = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - return_blob: true, - filename: filename, - auto_download: auto_download, - log_lvl: log_lvl - }); + ae_promises.download__event_exhibit_tracking_export_file = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + return_blob: true, + filename: filename, + auto_download: auto_download, + log_lvl: log_lvl + }); - if (log_lvl) { - 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; + if (log_lvl) { + 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; } diff --git a/src/lib/ae_events/db_events.ts b/src/lib/ae_events/db_events.ts index 41c17788..4e3a1d60 100644 --- a/src/lib/ae_events/db_events.ts +++ b/src/lib/ae_events/db_events.ts @@ -7,793 +7,793 @@ import type { key_val } from '$lib/stores/ae_stores'; // Updated 2024-10-16 export interface Event { - id: string; - // id_random: string; - event_id: string; - event_id_random: string; + id: string; + // id_random: string; + event_id: string; + event_id_random: string; - code: string; + code: string; - account_id: string; - account_id_random: string; + account_id: string; + account_id_random: string; - conference: boolean; - type: string; - name: string; - summary?: null | string; - description?: null | string; + conference: boolean; + type: string; + name: string; + summary?: null | string; + description?: null | string; - start_datetime?: Date; - end_datetime?: Date; - timezone?: null | string; - location_address_json?: null | string; - location_text?: null | string; + start_datetime?: Date; + end_datetime?: Date; + timezone?: null | string; + location_address_json?: null | string; + location_text?: null | string; - attend_json?: null | string; - attend_text?: null | string; + attend_json?: null | string; + attend_text?: null | string; - status?: null | string; // draft, active, inactive, archived, unknown; currently only used with IDAA - // review?: null|boolean; - // approve?: null|boolean; - // ready?: null|boolean; - // ready_on?: null|Date; - // archive?: null|boolean; - // archive_on?: null|Date; + status?: null | string; // draft, active, inactive, archived, unknown; currently only used with IDAA + // review?: null|boolean; + // approve?: null|boolean; + // ready?: null|boolean; + // ready_on?: null|Date; + // archive?: null|boolean; + // archive_on?: null|Date; - mod_abstracts_json?: null | key_val; - mod_badges_json?: null | key_val; - mod_exhibits_json?: null | key_val; - mod_meetings_json?: null | key_val; - mod_pres_mgmt_json?: null | key_val; - cfg_json?: null | key_val; + mod_abstracts_json?: null | key_val; + mod_badges_json?: null | key_val; + mod_exhibits_json?: null | key_val; + mod_meetings_json?: null | key_val; + mod_pres_mgmt_json?: null | key_val; + cfg_json?: null | key_val; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // IDAA Recovery Meetings: - // Currently only really used for IDAA - contact_li_json?: null | string[]; // full_name, email, phone_mobile, phone_home, phone_office, other_text - // contact_li_json_ext?: null|string; - external_person_id?: null | string; + // IDAA Recovery Meetings: + // Currently only really used for IDAA + contact_li_json?: null | string[]; // full_name, email, phone_mobile, phone_home, phone_office, other_text + // contact_li_json_ext?: null|string; + external_person_id?: null | string; - physical?: null | boolean; - virtual?: null | boolean; + physical?: null | boolean; + virtual?: null | boolean; - recurring?: null | boolean; - recurring_pattern?: null | string; - recurring_start_time?: null | string; - recurring_end_time?: null | string; - recurring_text?: null | string; + recurring?: null | boolean; + recurring_pattern?: null | string; + recurring_start_time?: null | string; + recurring_end_time?: null | string; + recurring_text?: null | string; - weekday_sunday?: null | boolean; - weekday_monday?: null | boolean; - weekday_tuesday?: null | boolean; - weekday_wednesday?: null | boolean; - weekday_thursday?: null | boolean; - weekday_friday?: null | boolean; - weekday_saturday?: null | boolean; + weekday_sunday?: null | boolean; + weekday_monday?: null | boolean; + weekday_tuesday?: null | boolean; + weekday_wednesday?: null | boolean; + weekday_thursday?: null | boolean; + weekday_friday?: null | boolean; + weekday_saturday?: null | boolean; - attend_url?: null | string; - attend_url_text?: null | string; - attend_url_code?: null | string; // Meeting ID, Conference ID, etc. - attend_url_passcode?: null | string; - attend_phone?: null | string; - attend_phone_passcode?: null | string; + attend_url?: null | string; + attend_url_text?: null | string; + attend_url_code?: null | string; // Meeting ID, Conference ID, etc. + attend_url_passcode?: null | string; + attend_phone?: null | string; + attend_phone_passcode?: null | string; - // Additional fields for convenience (database views) - file_count?: null | number; - file_count_all?: null | number; - internal_use_count?: null | number; - event_file_id_li_json?: null | string; + // Additional fields for convenience (database views) + file_count?: null | number; + file_count_all?: null | number; + internal_use_count?: null | number; + event_file_id_li_json?: null | string; } // Updated 2025-10-06 export interface Badge { - id: number; - // id_random: string; - event_badge_id: string; - event_badge_id_random: string; + id: number; + // id_random: string; + event_badge_id: string; + event_badge_id_random: string; - event_id: string; - event_id_random: string; + event_id: string; + event_id_random: string; - event_badge_template_id?: null | string; - event_badge_template_id_random?: null | string; + event_badge_template_id?: null | string; + event_badge_template_id_random?: null | string; - pronouns?: null | string; - informal_name?: null | string; - title_names?: null | string; - given_name: string; - middle_name?: null | string; - family_name?: null | string; - designations?: null | string; + pronouns?: null | string; + informal_name?: null | string; + title_names?: null | string; + given_name: string; + middle_name?: null | string; + family_name?: null | string; + designations?: null | string; - professional_title?: null | string; - professional_title_override?: null | string; + professional_title?: null | string; + professional_title_override?: null | string; - full_name?: string; - full_name_override?: null | string; + full_name?: string; + full_name_override?: null | string; - affiliations?: string; - affiliations_override?: null | string; + affiliations?: string; + affiliations_override?: null | string; - email?: string; - email_override?: null | string; + email?: string; + email_override?: null | string; - address_line_1?: null | string; - address_line_2?: null | string; - address_line_3?: null | string; - city?: null | string; - country_subdivision_code?: null | string; - state_province?: null | string; - state_province_abb?: null | string; - postal_code?: null | string; - country_alpha_2_code?: null | string; - country?: null | string; - full_address?: null | string; - location?: null | string; - location_override?: null | string; + address_line_1?: null | string; + address_line_2?: null | string; + address_line_3?: null | string; + city?: null | string; + country_subdivision_code?: null | string; + state_province?: null | string; + state_province_abb?: null | string; + postal_code?: null | string; + country_alpha_2_code?: null | string; + country?: null | string; + full_address?: null | string; + location?: null | string; + location_override?: null | string; - query_str?: null | string; + query_str?: null | string; - badge_type?: string; - badge_type_code?: string; - badge_type_code_override?: null | string; - badge_type_override?: null | string; + badge_type?: string; + badge_type_code?: string; + badge_type_code_override?: null | string; + badge_type_override?: null | string; - external_event_id?: string; - external_id?: string; - external_person_id?: string; + external_event_id?: string; + external_id?: string; + external_person_id?: string; - // passcode?: null|string; + // passcode?: null|string; - // data_json?: null|string; + // data_json?: null|string; - default_qry_string?: null | string; + default_qry_string?: null | string; - alert?: null | boolean; + alert?: null | boolean; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - person_external_id?: null | string; // This may be semi-random or unique only withing the account. - person_external_sys_id?: null | string; // Generated by an external system. Ideally this should be something like a UUID. It may be the same as the external_id if nothing given. - person_given_name?: string; - person_family_name?: null | string; - person_full_name?: null | string; - person_professional_title?: null | string; - person_affiliations?: null | string; - person_primary_email?: null | string; - person_passcode?: null | string; + // Additional fields for convenience (database views) + person_external_id?: null | string; // This may be semi-random or unique only withing the account. + person_external_sys_id?: null | string; // Generated by an external system. Ideally this should be something like a UUID. It may be the same as the external_id if nothing given. + person_given_name?: string; + person_family_name?: null | string; + person_full_name?: null | string; + person_professional_title?: null | string; + person_affiliations?: null | string; + person_primary_email?: null | string; + person_passcode?: null | string; } // Updated 2025-10-06 export interface Badge_template { - id: number; - // id_random: string; + id: number; + // id_random: string; - event_id: string; - event_id_random: string; + event_id: string; + event_id_random: string; - name: string; - description?: null | string; + name: string; + description?: null | string; - logo_filename?: null | string; - logo_path?: null | string; + logo_filename?: null | string; + logo_path?: null | string; - header_path?: null | string; - secondary_header_path?: null | string; - footer_path?: null | string; + header_path?: null | string; + secondary_header_path?: null | string; + footer_path?: null | string; - header_row_1?: null | string; - header_row_2?: null | string; + header_row_1?: null | string; + header_row_2?: null | string; - badge_type_list?: any; // This is an array of objects with code and name - badge_type_info_kv?: any; // This is a key value list with code as the key and name as the value. Use this for exhibitor, presenter, attendee, staff, vip, etc. - other_info_kv?: any; // This is a key value list with code as the key and name as the value. Use this for other custom fields. + badge_type_list?: any; // This is an array of objects with code and name + badge_type_info_kv?: any; // This is a key value list with code as the key and name as the value. Use this for exhibitor, presenter, attendee, staff, vip, etc. + other_info_kv?: any; // This is a key value list with code as the key and name as the value. Use this for other custom fields. - ticket_list?: any; // This is an array of objects with num, code, and name + ticket_list?: any; // This is an array of objects with num, code, and name - ticket_1_text?: null | string; - ticket_2_text?: null | string; - ticket_3_text?: null | string; - ticket_4_text?: null | string; - ticket_5_text?: null | string; - ticket_6_text?: null | string; - ticket_7_text?: null | string; - ticket_8_text?: null | string; + ticket_1_text?: null | string; + ticket_2_text?: null | string; + ticket_3_text?: null | string; + ticket_4_text?: null | string; + ticket_5_text?: null | string; + ticket_6_text?: null | string; + ticket_7_text?: null | string; + ticket_8_text?: null | string; - wireless_ssid?: null | string; - wireless_password?: null | string; + wireless_ssid?: null | string; + wireless_password?: null | string; - show_qr_front: boolean; - show_qr_back: boolean; + show_qr_front: boolean; + show_qr_back: boolean; - layout?: null | string; - style_filename?: null | string; + layout?: null | string; + style_filename?: null | string; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only + // Generated fields for sorting locally only - // Additional fields for convenience (database views) + // Additional fields for convenience (database views) } // Updated 2024-10-16 export interface Device { - id: number; - // id_random: string; - event_device_id: string; - // event_device_id_random: string; + id: number; + // id_random: string; + event_device_id: string; + // event_device_id_random: string; - event_id: string; - // event_id_random: string; - event_location_id?: string; - // event_location_id_random?: string; + event_id: string; + // event_id_random: string; + event_location_id?: string; + // event_location_id_random?: string; - code?: string; - name: string; - description?: null | string; + code?: string; + name: string; + description?: null | string; - passcode?: null | string; + passcode?: null | string; - local_file_cache_path?: null | string; - host_file_temp_path?: null | string; - recording_path?: null | string; + local_file_cache_path?: null | string; + host_file_temp_path?: null | string; + recording_path?: null | string; - record_audio?: null | boolean; - record_video?: null | boolean; + record_audio?: null | boolean; + record_video?: null | boolean; - trigger_open_file_id?: null | string; - trigger_open_session_id?: null | string; - trigger_recording_start?: null | boolean; - trigger_recording_stop?: null | boolean; - trigger_reset?: null | boolean; - trigger_show_admin?: null | boolean; - trigger_show_hidden?: null | boolean; + trigger_open_file_id?: null | string; + trigger_open_session_id?: null | string; + trigger_recording_start?: null | boolean; + trigger_recording_stop?: null | boolean; + trigger_reset?: null | boolean; + trigger_show_admin?: null | boolean; + trigger_show_hidden?: null | boolean; - alert?: null | boolean; - alert_msg?: null | string; - alert_on?: null | string; - status?: null | string; - status_msg?: null | string; - status_on?: null | Date; - record_status?: null | string; - record_status_msg?: null | string; - record_status_on?: null | Date; - heartbeat?: null | string; + alert?: null | boolean; + alert_msg?: null | string; + alert_on?: null | string; + status?: null | string; + status_msg?: null | string; + status_on?: null | Date; + record_status?: null | string; + record_status_msg?: null | string; + record_status_on?: null | Date; + heartbeat?: null | string; - info_hostname?: null | string; - info_ip_list?: null | string; // Semi-colon separated list of IP addresses + info_hostname?: null | string; + info_ip_list?: null | string; // Semi-colon separated list of IP addresses - meta_json?: null | string; - other_json?: null | string; + meta_json?: null | string; + other_json?: null | string; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - event_name?: string; - event_location_code?: string; - event_location_name?: string; + // Additional fields for convenience (database views) + event_name?: string; + event_location_code?: string; + event_location_name?: string; } export interface Exhibit { - id?: number; - id_random: string; - event_exhibit_id: string; - event_exhibit_id_random: string; + id?: number; + id_random: string; + event_exhibit_id: string; + event_exhibit_id_random: string; - event_id: string; - event_id_random: string; + event_id: string; + event_id_random: string; - code: string; - name: string; - // tagline: null|string; - description: null | string; - staff_passcode: null; - data_json: null | string; + code: string; + name: string; + // tagline: null|string; + description: null | string; + staff_passcode: null; + data_json: null | string; - leads_api_access: null | boolean; - leads_custom_questions_json: null | string; - leads_device_sm_qty: null | number; - leads_device_lg_qty: null | number; - license_max: number; - license_li_json: null | string; - cfg_json: string; + leads_api_access: null | boolean; + leads_custom_questions_json: null | string; + leads_device_sm_qty: null | number; + leads_device_lg_qty: null | number; + license_max: number; + license_li_json: null | string; + cfg_json: string; - enable: null | boolean; - hide: null | boolean; - priority: null | boolean; - sort: null | number; - group: null | string; - notes: null | string; - created_on: Date; - updated_on: null | Date; + enable: null | boolean; + hide: null | boolean; + priority: null | boolean; + sort: null | number; + group: null | string; + notes: null | string; + created_on: Date; + updated_on: null | Date; - // Generated fields for sorting locally only - // tmp_sort_1?: null|string; - // tmp_sort_2?: null|string; + // Generated fields for sorting locally only + // tmp_sort_1?: null|string; + // tmp_sort_2?: null|string; } export interface Exhibit_tracking { - id?: number; - id_random: string; - event_exhibit_tracking_id: string; - event_exhibit_tracking_id_random: string; + id?: number; + id_random: string; + event_exhibit_tracking_id: string; + event_exhibit_tracking_id_random: string; - event_exhibit_id: string; - event_exhibit_id_random: string; - event_badge_id: string; - event_badge_id_random: string; - event_person_id: string; - event_person_id_random: null | string; // Is this needed? + event_exhibit_id: string; + event_exhibit_id_random: string; + event_badge_id: string; + event_badge_id_random: string; + event_person_id: string; + event_person_id_random: null | string; // Is this needed? - external_person_id: null | string; // This is an email address + external_person_id: null | string; // This is an email address - exhibitor_notes: null | string; + exhibitor_notes: null | string; - responses_json: null | string; - data_json: null | string; + responses_json: null | string; + data_json: null | string; - event_exhibit_name: string; // Extra field for convenience + event_exhibit_name: string; // Extra field for convenience - event_badge_title_names: null | string; - event_badge_given_name: string; - event_badge_family_name: null | string; - event_badge_designations: null | string; - event_badge_full_name: string; - event_badge_full_name_override: null | string; + event_badge_title_names: null | string; + event_badge_given_name: string; + event_badge_family_name: null | string; + event_badge_designations: null | string; + event_badge_full_name: string; + event_badge_full_name_override: null | string; - event_badge_professional_title: null | string; - event_badge_professional_title_override: null | string; + event_badge_professional_title: null | string; + event_badge_professional_title_override: null | string; - event_badge_affiliations: null | string; - event_badge_affiliations_override: null | string; + event_badge_affiliations: null | string; + event_badge_affiliations_override: null | string; - event_badge_email: null | string; - event_badge_email_override: null | string; + event_badge_email: null | string; + event_badge_email_override: null | string; - event_badge_location: null | string; - event_badge_location_override: null | string; + event_badge_location: null | string; + event_badge_location_override: null | string; - event_badge_country: null | string; + event_badge_country: null | string; - enable: null | boolean; - hide: null | boolean; - priority: null | boolean; - sort: null | number; - group: null | string; - notes: null | string; - created_on: Date; - updated_on: null | Date; + enable: null | boolean; + hide: null | boolean; + priority: null | boolean; + sort: null | number; + group: null | string; + notes: null | string; + created_on: Date; + updated_on: null | Date; - // Generated fields for sorting locally only - // tmp_sort_1?: null|string; - // tmp_sort_2?: null|string; + // Generated fields for sorting locally only + // tmp_sort_1?: null|string; + // tmp_sort_2?: null|string; } export interface File { - id: string; - id_random: string; - event_file_id: string; - event_file_id_random: string; + id: string; + id_random: string; + event_file_id: string; + event_file_id_random: string; - hosted_file_id: string; - hosted_file_id_random: string; - hash_sha256: string; + hosted_file_id: string; + hosted_file_id_random: string; + hash_sha256: string; - for_type?: string; - for_id?: string; - for_id_random?: string; + for_type?: string; + for_id?: string; + for_id_random?: string; - event_id: string; - event_id_random: string; - event_session_id?: string; - event_session_id_random?: string; - event_presentation_id?: string; - event_presentation_id_random?: string; - event_presenter_id?: string; - event_presenter_id_random?: string; - event_location_id?: string; - event_location_id_random?: string; + event_id: string; + event_id_random: string; + event_session_id?: string; + event_session_id_random?: string; + event_presentation_id?: string; + event_presentation_id_random?: string; + event_presenter_id?: string; + event_presenter_id_random?: string; + event_location_id?: string; + event_location_id_random?: string; - filename: string; - extension: string; + filename: string; + extension: string; - open_in_os?: null | string; // null, empty, 'mac', or 'win' + open_in_os?: null | string; // null, empty, 'mac', or 'win' - lu_file_purpose_id: string; - lu_event_file_purpose_name: string; - file_purpose: string; + lu_file_purpose_id: string; + lu_event_file_purpose_name: string; + file_purpose: string; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - filename_no_ext: string; - filename_w_ext: string; - hosted_file_content_type: string; - file_size: number; // In bytes - hosted_file_size?: number; // In bytes + // Additional fields for convenience (database views) + filename_no_ext: string; + filename_w_ext: string; + hosted_file_content_type: string; + file_size: number; // In bytes + hosted_file_size?: number; // In bytes - event_location_code?: null | string; - event_location_name?: null | string; - event_session_code?: null | string; - event_session_type_code?: null | string; - event_session_name?: string; - event_session_start_datetime?: null | Date; - event_session_end_datetime?: null | Date; - event_presentation_code?: null | string; - event_presentation_type_code?: null | string; - event_presentation_name?: string; - event_presentation_start_datetime?: null | Date; - event_presentation_end_datetime?: null | Date; - event_presenter_given_name?: null | string; - event_presenter_family_name?: null | string; - event_presenter_full_name?: null | string; - event_presenter_email?: null | string; + event_location_code?: null | string; + event_location_name?: null | string; + event_session_code?: null | string; + event_session_type_code?: null | string; + event_session_name?: string; + event_session_start_datetime?: null | Date; + event_session_end_datetime?: null | Date; + event_presentation_code?: null | string; + event_presentation_type_code?: null | string; + event_presentation_name?: string; + event_presentation_start_datetime?: null | Date; + event_presentation_end_datetime?: null | Date; + event_presenter_given_name?: null | string; + event_presenter_family_name?: null | string; + event_presenter_full_name?: null | string; + event_presenter_email?: null | string; } // Updated 2024-06-25 export interface Location { - id: string; - // id_random: string; - event_location_id: string; - event_location_id_random: string; + id: string; + // id_random: string; + event_location_id: string; + event_location_id_random: string; - external_id?: null | string; - code?: null | string; + external_id?: null | string; + code?: null | string; - type_code?: string; + type_code?: string; - event_id: string; - event_id_random: string; + event_id: string; + event_id_random: string; - name: string; - description?: null | string; + name: string; + description?: null | string; - passcode?: null | string; + passcode?: null | string; - hide_event_launcher?: null | boolean; + hide_event_launcher?: null | boolean; - alert?: null | boolean; - alert_msg?: null | string; + alert?: null | boolean; + alert_msg?: null | string; - data_json?: null | string; + data_json?: null | string; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - file_count?: null | number; - file_count_all?: null | number; - internal_use_count?: null | number; - event_file_id_li_json?: null | string; + // Additional fields for convenience (database views) + file_count?: null | number; + file_count_all?: null | number; + internal_use_count?: null | number; + event_file_id_li_json?: null | string; - event_name?: null | string; + event_name?: null | string; - // A key value list of the sessions - event_session_kv?: null | key_val; - // A key value list of the files - event_file_kv?: null | key_val; + // A key value list of the sessions + event_session_kv?: null | key_val; + // A key value list of the files + event_file_kv?: null | key_val; } // Updated 2024-06-10 export interface Presentation { - id: string; - // id_random: string; - event_presentation_id: string; - event_presentation_id_random: string; + id: string; + // id_random: string; + event_presentation_id: string; + event_presentation_id_random: string; - external_id?: null | string; - code?: null | string; + external_id?: null | string; + code?: null | string; - for_type?: string; - for_id?: string; - for_id_random?: string; + for_type?: string; + for_id?: string; + for_id_random?: string; - type_code?: string; + type_code?: string; - event_id: string; - event_id_random: string; - event_session_id: string; - event_session_id_random: string; - event_abstract_id?: null | string; - event_abstract_id_random?: null | string; + event_id: string; + event_id_random: string; + event_session_id: string; + event_session_id_random: string; + event_abstract_id?: null | string; + event_abstract_id_random?: null | string; - abstract_code?: null | string; + abstract_code?: null | string; - name: string; - description?: null | string; + name: string; + description?: null | string; - start_datetime?: null | Date; - end_datetime?: null | Date; + start_datetime?: null | Date; + end_datetime?: null | Date; - passcode?: null | string; + passcode?: null | string; - hide_event_launcher?: null | boolean; + hide_event_launcher?: null | boolean; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - // file_count: null|number; + // Additional fields for convenience (database views) + // file_count: null|number; - event_session_code?: null | string; - event_session_name?: null | string; + event_session_code?: null | string; + event_session_name?: null | string; - // A key value list of the presenters - event_presenter_kv?: null | key_val; - event_presenter_li?: null | Array; + // A key value list of the presenters + event_presenter_kv?: null | key_val; + event_presenter_li?: null | Array; } // Updated 2024-06-10 export interface Presenter { - id: string; - // id_random: string; - event_presenter_id: string; - event_presenter_id_random: string; + id: string; + // id_random: string; + event_presenter_id: string; + event_presenter_id_random: string; - external_id?: string; - code?: string; + external_id?: string; + code?: string; - event_id: string; - event_id_random: string; - event_session_id: string; - event_session_id_random: string; - event_person_id?: null | string; - event_person_id_random?: null | string; - event_presentation_id: string; - event_presentation_id_random: string; - person_id?: null | string; - person_id_random?: null | string; - person_profile_id?: null | string; - person_profile_id_random?: null | string; // The new table person_profile will be used soon... + event_id: string; + event_id_random: string; + event_session_id: string; + event_session_id_random: string; + event_person_id?: null | string; + event_person_id_random?: null | string; + event_presentation_id: string; + event_presentation_id_random: string; + person_id?: null | string; + person_id_random?: null | string; + person_profile_id?: null | string; + person_profile_id_random?: null | string; // The new table person_profile will be used soon... - pronouns?: null | string; - informal_name?: null | string; - title_names?: null | string; - given_name: string; - middle_name?: null | string; - family_name?: null | string; - designations?: null | string; + pronouns?: null | string; + informal_name?: null | string; + title_names?: null | string; + given_name: string; + middle_name?: null | string; + family_name?: null | string; + designations?: null | string; - professional_title?: null | string; + professional_title?: null | string; - full_name?: string; - full_name_override: null | string; + full_name?: string; + full_name_override: null | string; - affiliations?: null | string; + affiliations?: null | string; - email?: string; + email?: string; - biography?: null | string; + biography?: null | string; - agree?: null | boolean; // General catchall for agreement or consent - comments?: null | string; + agree?: null | boolean; // General catchall for agreement or consent + comments?: null | string; - passcode?: null | string; + passcode?: null | string; - hide_event_launcher?: null | boolean; + hide_event_launcher?: null | boolean; - data_json?: null | string; + data_json?: null | string; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on?: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on?: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - file_count?: null | number; - // file_count_all?: null|number; - // internal_use_count?: null|number; - event_file_id_li_json?: null | string; + // Additional fields for convenience (database views) + file_count?: null | number; + // file_count_all?: null|number; + // internal_use_count?: null|number; + event_file_id_li_json?: null | string; - event_session_code?: null | string; - event_session_name?: string; - event_session_start_datetime?: null | Date; - event_presentation_code?: null | string; - event_presentation_name?: string; - event_presentation_start_datetime?: null | Date; + event_session_code?: null | string; + event_session_name?: string; + event_session_start_datetime?: null | Date; + event_presentation_code?: null | string; + event_presentation_name?: string; + event_presentation_start_datetime?: null | Date; - person_external_id?: null | string; // This may be semi-random or unique only withing the account. - person_external_sys_id?: null | string; // Generated by an external system. Ideally this should be something like a UUID. It may be the same as the external_id if nothing given. - person_given_name?: string; - person_family_name?: null | string; - person_full_name?: null | string; - person_professional_title?: null | string; - person_affiliations?: null | string; - person_primary_email?: null | string; - person_passcode?: null | string; + person_external_id?: null | string; // This may be semi-random or unique only withing the account. + person_external_sys_id?: null | string; // Generated by an external system. Ideally this should be something like a UUID. It may be the same as the external_id if nothing given. + person_given_name?: string; + person_family_name?: null | string; + person_full_name?: null | string; + person_professional_title?: null | string; + person_affiliations?: null | string; + person_primary_email?: null | string; + person_passcode?: null | string; - // A key value list of the files - event_file_kv?: null | key_val; + // A key value list of the files + event_file_kv?: null | key_val; } export interface Registration { - // Nothing here yet + // Nothing here yet } // Updated 2024-06-19 export interface Session { - id: string; - // id_random: string; - event_session_id: string; - event_session_id_random: string; + id: string; + // id_random: string; + event_session_id: string; + event_session_id_random: string; - external_id: null | string; - code: null | string; + external_id: null | string; + code: null | string; - for_type: string; - for_id: string; - for_id_random: string; + for_type: string; + for_id: string; + for_id_random: string; - type_code?: string; + type_code?: string; - event_id: string; - event_id_random: string; - event_location_id?: null | string; - event_location_id_random?: null | string; + event_id: string; + event_id_random: string; + event_location_id?: null | string; + event_location_id_random?: null | string; - poc_person_id?: null | string; - poc_person_id_random?: null | string; - poc_agree?: null | boolean; // General catchall for agreement or consent by the POC - poc_kv_json?: null | key_val; // Key value list of the POC by type (examples: 'advocate', 'chair', 'champion', 'moderator', 'organizer') + poc_person_id?: null | string; + poc_person_id_random?: null | string; + poc_agree?: null | boolean; // General catchall for agreement or consent by the POC + poc_kv_json?: null | key_val; // Key value list of the POC by type (examples: 'advocate', 'chair', 'champion', 'moderator', 'organizer') - name: string; - description?: null | string; + name: string; + description?: null | string; - start_datetime?: null | Date; - end_datetime?: null | Date; + start_datetime?: null | Date; + end_datetime?: null | Date; - passcode?: null | string; + passcode?: null | string; - hide_event_launcher?: null | boolean; + hide_event_launcher?: null | boolean; - alert?: null | boolean; - alert_msg?: null | string; + alert?: null | boolean; + alert_msg?: null | string; - data_json?: null | string; + data_json?: null | string; - ux_mode?: null | string; // 'colloquium', 'lecture', 'panel', 'poster', 'symposium', 'workshop' - // colloquium - Specialists present on related topics with questions - // symposium - A discussion, less formal + ux_mode?: null | string; // 'colloquium', 'lecture', 'panel', 'poster', 'symposium', 'workshop' + // colloquium - Specialists present on related topics with questions + // symposium - A discussion, less formal - enable: null | boolean; - hide: null | boolean; - priority: null | boolean; - sort: null | number; - group: null | string; - notes: null | string; - created_on: Date; - updated_on: null | Date; + enable: null | boolean; + hide: null | boolean; + priority: null | boolean; + sort: null | number; + group: null | string; + notes: null | string; + created_on: Date; + updated_on: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - file_count?: null | number; // Only files directly under a session - file_count_all?: null | number; // All files under a session - internal_use_count?: null | number; // Files marked for internal use - event_file_id_li_json?: null | string; + // Additional fields for convenience (database views) + file_count?: null | number; // Only files directly under a session + file_count_all?: null | number; // All files under a session + internal_use_count?: null | number; // Files marked for internal use + event_file_id_li_json?: null | string; - poc_person_given_name?: null | string; - poc_person_family_name?: null | string; - poc_person_full_name?: null | string; - poc_person_primary_email?: null | string; - poc_person_passcode?: null | string; + poc_person_given_name?: null | string; + poc_person_family_name?: null | string; + poc_person_full_name?: null | string; + poc_person_primary_email?: null | string; + poc_person_passcode?: null | string; - event_name?: null | string; + event_name?: null | string; - event_location_code?: null | string; - event_location_name?: null | string; + event_location_code?: null | string; + event_location_name?: null | string; - // A key value list of the presentations - event_presentation_kv?: null | key_val; - event_presentation_li?: null | [any]; - // A key value list of the files - event_file_kv?: null | key_val; - event_file_li?: null | [any]; + // A key value list of the presentations + event_presentation_kv?: null | key_val; + event_presentation_li?: null | [any]; + // A key value list of the files + event_file_kv?: null | key_val; + event_file_li?: null | [any]; } // Updated 2024-10-16 export class MySubClassedDexie extends Dexie { - // 'badge' is added by dexie when declaring the stores() - // We just tell the typing system this is the case - event!: Table; - badge!: Table; - badge_template!: Table; - device!: Table; - exhibit!: Table; - exhibit_tracking!: Table; - file!: Table; - location!: Table; - presentation!: Table; - presenter!: Table; - session!: Table; + // 'badge' is added by dexie when declaring the stores() + // We just tell the typing system this is the case + event!: Table; + badge!: Table; + badge_template!: Table; + device!: Table; + exhibit!: Table; + exhibit_tracking!: Table; + file!: Table; + location!: Table; + presentation!: Table; + presenter!: Table; + session!: Table; - constructor() { - super('ae_events_db'); - this.version(6).stores({ - event: ` + constructor() { + super('ae_events_db'); + this.version(6).stores({ + event: ` id, event_id, event_id_random, code, account_id, account_id_random, @@ -805,8 +805,8 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on`, - // badge: '++id, full_name, email' // Primary key and indexed props - badge: ` + // badge: '++id, full_name, email' // Primary key and indexed props + badge: ` event_badge_id_random, event_badge_id, id, event_id, event_id_random, full_name, full_name_override, email, email_override, @@ -818,10 +818,10 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on`, - badge_template: ` + badge_template: ` id, event_id, event_id_random`, - device: ` + device: ` id, id_random, event_device_id_random, event_device_id, event_id, event_id_random, event_location_id, event_location_id_random, code, name, @@ -830,14 +830,14 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on`, - exhibit: ` + exhibit: ` id, id_random, event_exhibit_id, event_exhibit_id_random, event_id, event_id_random, code, name, description, staff_passcode, data_json, license_max, license_li_json, cfg_json, enable, hide, priority, sort, group, notes, created_on, updated_on, [priority+name]`, - exhibit_tracking: ` + exhibit_tracking: ` id, id_random, event_exhibit_tracking_id, event_exhibit_tracking_id_random, event_exhibit_id, event_exhibit_id_random, event_badge_id, event_badge_id_random, event_person_id, event_person_id_random, @@ -845,7 +845,7 @@ export class MySubClassedDexie extends Dexie { event_badge_full_name, event_badge_email, enable, hide, priority, sort, group, notes, created_on, updated_on`, - file: ` + file: ` id, id_random, event_file_id, event_file_id_random, hosted_file_id, hosted_file_id_random, hash_sha256, @@ -857,7 +857,7 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, created_on, updated_on`, - location: ` + location: ` id, event_location_id, event_location_id_random, external_id, code, event_id, event_id_random, @@ -869,7 +869,7 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, created_on, updated_on`, - presentation: ` + presentation: ` id, event_presentation_id, event_presentation_id_random, external_id, code, for_type, for_id, for_id_random, @@ -881,7 +881,7 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, created_on, updated_on`, - presenter: ` + presenter: ` id, event_presenter_id, event_presenter_id_random, external_id, code, event_id, event_session_id, event_person_id, event_presentation_id, @@ -895,7 +895,7 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, created_on, updated_on`, - session: ` + session: ` id, event_session_id, event_session_id_random, external_id, code, for_type, for_id, for_id_random, @@ -910,8 +910,8 @@ export class MySubClassedDexie extends Dexie { alert, tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, created_on, updated_on` - }); - } + }); + } } export const db_events = new MySubClassedDexie(); diff --git a/src/lib/ae_events_functions.ts b/src/lib/ae_events_functions.ts index 477563fb..ed7ee96e 100644 --- a/src/lib/ae_events_functions.ts +++ b/src/lib/ae_events_functions.ts @@ -7,14 +7,14 @@ 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 { - load_ae_obj_id__exhibit, - load_ae_obj_li__exhibit, - load_ae_obj_id__exhibit_tracking, - load_ae_obj_li__exhibit_tracking, - create_ae_obj__exhibit_tracking, - update_ae_obj__exhibit_tracking, - download_export__event_exhibit_tracking - // db_save_ae_obj_li__exhibitor, + load_ae_obj_id__exhibit, + load_ae_obj_li__exhibit, + load_ae_obj_id__exhibit_tracking, + load_ae_obj_li__exhibit_tracking, + create_ae_obj__exhibit_tracking, + update_ae_obj__exhibit_tracking, + download_export__event_exhibit_tracking + // db_save_ae_obj_li__exhibitor, } from '$lib/ae_events/ae_events__exhibit'; import * as event_location from '$lib/ae_events/ae_events__event_location'; @@ -30,102 +30,102 @@ 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'; const export_obj = { - // Events - load_ae_obj_id__event: event.load_ae_obj_id__event, - load_ae_obj_li__event: event.load_ae_obj_li__event, - qry_ae_obj_li__event: event.qry_ae_obj_li__event, - create_ae_obj__event: event.create_ae_obj__event, - delete_ae_obj_id__event: event.delete_ae_obj_id__event, - update_ae_obj__event: event.update_ae_obj__event, - // db_save_ae_obj_li__event: event.db_save_ae_obj_li__event, - sync_config__event_pres_mgmt: event.sync_config__event_pres_mgmt, + // Events + load_ae_obj_id__event: event.load_ae_obj_id__event, + load_ae_obj_li__event: event.load_ae_obj_li__event, + qry_ae_obj_li__event: event.qry_ae_obj_li__event, + create_ae_obj__event: event.create_ae_obj__event, + delete_ae_obj_id__event: event.delete_ae_obj_id__event, + update_ae_obj__event: event.update_ae_obj__event, + // db_save_ae_obj_li__event: event.db_save_ae_obj_li__event, + sync_config__event_pres_mgmt: event.sync_config__event_pres_mgmt, - // Event Badges - load_ae_obj_id__event_badge: event_badge.load_ae_obj_id__event_badge, - load_ae_obj_li__event_badge: event_badge.load_ae_obj_li__event_badge, - create_ae_obj__event_badge: event_badge.create_ae_obj__event_badge, - delete_ae_obj_id__event_badge: event_badge.delete_ae_obj_id__event_badge, - update_ae_obj__event_badge: event_badge.update_ae_obj__event_badge, - qry__event_badge: event_badge.qry__event_badge, - search__event_badge: event_badge.search__event_badge, - // handle_load_ae_obj_id__badge: event_badge.handle_load_ae_obj_id__badge, - // handle_load_ae_obj_li__badge: event_badge.handle_load_ae_obj_li__badge, - // handle_search__event_badge: event_badge.handle_search__event_badge, - // db_save_ae_obj_li__event_badge: event_badge.db_save_ae_obj_li__event_badge, + // Event Badges + load_ae_obj_id__event_badge: event_badge.load_ae_obj_id__event_badge, + load_ae_obj_li__event_badge: event_badge.load_ae_obj_li__event_badge, + create_ae_obj__event_badge: event_badge.create_ae_obj__event_badge, + delete_ae_obj_id__event_badge: event_badge.delete_ae_obj_id__event_badge, + update_ae_obj__event_badge: event_badge.update_ae_obj__event_badge, + qry__event_badge: event_badge.qry__event_badge, + search__event_badge: event_badge.search__event_badge, + // handle_load_ae_obj_id__badge: event_badge.handle_load_ae_obj_id__badge, + // handle_load_ae_obj_li__badge: event_badge.handle_load_ae_obj_li__badge, + // handle_search__event_badge: event_badge.handle_search__event_badge, + // db_save_ae_obj_li__event_badge: event_badge.db_save_ae_obj_li__event_badge, - // Event Badge Templates - 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, - 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, - 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, + // Event Badge Templates + 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, + 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, + 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, - // Event Devices - load_ae_obj_id__event_device: event_device.load_ae_obj_id__event_device, - load_ae_obj_li__event_device: event_device.load_ae_obj_li__event_device, - create_ae_obj__event_device: event_device.create_ae_obj__event_device, - delete_ae_obj_id__event_device: event_device.delete_ae_obj_id__event_device, - update_ae_obj__event_device: event_device.update_ae_obj__event_device, - // db_save_ae_obj_li__event_device: event_device.db_save_ae_obj_li__event_device, + // Event Devices + load_ae_obj_id__event_device: event_device.load_ae_obj_id__event_device, + load_ae_obj_li__event_device: event_device.load_ae_obj_li__event_device, + create_ae_obj__event_device: event_device.create_ae_obj__event_device, + delete_ae_obj_id__event_device: event_device.delete_ae_obj_id__event_device, + update_ae_obj__event_device: event_device.update_ae_obj__event_device, + // db_save_ae_obj_li__event_device: event_device.db_save_ae_obj_li__event_device, - // Event Exhibits - handle_load_ae_obj_id__exhibit: load_ae_obj_id__exhibit, - handle_load_ae_obj_li__exhibit: load_ae_obj_li__exhibit, - handle_load_ae_obj_id__exhibit_tracking: load_ae_obj_id__exhibit_tracking, - handle_load_ae_obj_li__exhibit_tracking: load_ae_obj_li__exhibit_tracking, - handle_create_ae_obj__exhibit_tracking: create_ae_obj__exhibit_tracking, - handle_update_ae_obj__exhibit_tracking: update_ae_obj__exhibit_tracking, - handle_download_export__event_exhibit_tracking: download_export__event_exhibit_tracking, - // handle_db_save_ae_obj_li__exhibitor: db_save_ae_obj_li__exhibitor, + // Event Exhibits + handle_load_ae_obj_id__exhibit: load_ae_obj_id__exhibit, + handle_load_ae_obj_li__exhibit: load_ae_obj_li__exhibit, + handle_load_ae_obj_id__exhibit_tracking: load_ae_obj_id__exhibit_tracking, + handle_load_ae_obj_li__exhibit_tracking: load_ae_obj_li__exhibit_tracking, + handle_create_ae_obj__exhibit_tracking: create_ae_obj__exhibit_tracking, + handle_update_ae_obj__exhibit_tracking: update_ae_obj__exhibit_tracking, + handle_download_export__event_exhibit_tracking: download_export__event_exhibit_tracking, + // handle_db_save_ae_obj_li__exhibitor: db_save_ae_obj_li__exhibitor, - // Event Files - 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, - 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, - update_ae_obj__event_file: event_file.update_ae_obj__event_file, - qry__event_file: event_file.qry__event_file, - search__event_file: event_file.search__event_file, - // db_save_ae_obj_li__event_file: event_file.db_save_ae_obj_li__event_file, + // Event Files + 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, + 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, + update_ae_obj__event_file: event_file.update_ae_obj__event_file, + qry__event_file: event_file.qry__event_file, + search__event_file: event_file.search__event_file, + // db_save_ae_obj_li__event_file: event_file.db_save_ae_obj_li__event_file, - // Event Locations - load_ae_obj_id__event_location: event_location.load_ae_obj_id__event_location, - load_ae_obj_li__event_location: event_location.load_ae_obj_li__event_location, - create_ae_obj__event_location: event_location.create_ae_obj__event_location, - delete_ae_obj_id__event_location: event_location.delete_ae_obj_id__event_location, - update_ae_obj__event_location: event_location.update_ae_obj__event_location, - // db_save_ae_obj_li__event_location: event_location.db_save_ae_obj_li__event_location, + // Event Locations + load_ae_obj_id__event_location: event_location.load_ae_obj_id__event_location, + load_ae_obj_li__event_location: event_location.load_ae_obj_li__event_location, + create_ae_obj__event_location: event_location.create_ae_obj__event_location, + delete_ae_obj_id__event_location: event_location.delete_ae_obj_id__event_location, + update_ae_obj__event_location: event_location.update_ae_obj__event_location, + // db_save_ae_obj_li__event_location: event_location.db_save_ae_obj_li__event_location, - // Event Sessions - load_ae_obj_id__event_session: event_session.load_ae_obj_id__event_session, - load_ae_obj_li__event_session: event_session.load_ae_obj_li__event_session, - create_ae_obj__event_session: event_session.create_ae_obj__event_session, - delete_ae_obj_id__event_session: event_session.delete_ae_obj_id__event_session, - update_ae_obj__event_session: event_session.update_ae_obj__event_session, - qry__event_session: event_session.qry__event_session, - search__event_session: event_session.search__event_session, - email_sign_in__event_session: event_session.email_sign_in__event_session, - // db_save_ae_obj_li__event_session: event_session.db_save_ae_obj_li__event_session, + // Event Sessions + load_ae_obj_id__event_session: event_session.load_ae_obj_id__event_session, + load_ae_obj_li__event_session: event_session.load_ae_obj_li__event_session, + create_ae_obj__event_session: event_session.create_ae_obj__event_session, + delete_ae_obj_id__event_session: event_session.delete_ae_obj_id__event_session, + update_ae_obj__event_session: event_session.update_ae_obj__event_session, + qry__event_session: event_session.qry__event_session, + search__event_session: event_session.search__event_session, + email_sign_in__event_session: event_session.email_sign_in__event_session, + // db_save_ae_obj_li__event_session: event_session.db_save_ae_obj_li__event_session, - // Event Presentations - load_ae_obj_id__event_presentation: event_presentation.load_ae_obj_id__event_presentation, - load_ae_obj_li__event_presentation: event_presentation.load_ae_obj_li__event_presentation, - create_ae_obj__event_presentation: event_presentation.create_ae_obj__event_presentation, - delete_ae_obj_id__event_presentation: event_presentation.delete_ae_obj_id__event_presentation, - update_ae_obj__event_presentation: event_presentation.update_ae_obj__event_presentation, - // db_save_ae_obj_li__event_presentation: event_presentation.db_save_ae_obj_li__event_presentation, + // Event Presentations + load_ae_obj_id__event_presentation: event_presentation.load_ae_obj_id__event_presentation, + load_ae_obj_li__event_presentation: event_presentation.load_ae_obj_li__event_presentation, + create_ae_obj__event_presentation: event_presentation.create_ae_obj__event_presentation, + delete_ae_obj_id__event_presentation: event_presentation.delete_ae_obj_id__event_presentation, + update_ae_obj__event_presentation: event_presentation.update_ae_obj__event_presentation, + // db_save_ae_obj_li__event_presentation: event_presentation.db_save_ae_obj_li__event_presentation, - // Event Presenters - load_ae_obj_id__event_presenter: event_presenter.load_ae_obj_id__event_presenter, - load_ae_obj_li__event_presenter: event_presenter.load_ae_obj_li__event_presenter, - create_ae_obj__event_presenter: event_presenter.create_ae_obj__event_presenter, - delete_ae_obj_id__event_presenter: event_presenter.delete_ae_obj_id__event_presenter, - update_ae_obj__event_presenter: event_presenter.update_ae_obj__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, - email_sign_in__event_presenter: event_presenter.email_sign_in__event_presenter + // Event Presenters + load_ae_obj_id__event_presenter: event_presenter.load_ae_obj_id__event_presenter, + load_ae_obj_li__event_presenter: event_presenter.load_ae_obj_li__event_presenter, + create_ae_obj__event_presenter: event_presenter.create_ae_obj__event_presenter, + delete_ae_obj_id__event_presenter: event_presenter.delete_ae_obj_id__event_presenter, + update_ae_obj__event_presenter: event_presenter.update_ae_obj__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, + email_sign_in__event_presenter: event_presenter.email_sign_in__event_presenter }; export const events_func = export_obj; diff --git a/src/lib/ae_journals/ae_journals__journal.ts b/src/lib/ae_journals/ae_journals__journal.ts index e2bdee35..af1f9c51 100644 --- a/src/lib/ae_journals/ae_journals__journal.ts +++ b/src/lib/ae_journals/ae_journals__journal.ts @@ -12,644 +12,644 @@ const ae_promises: key_val = {}; // Updated 2025-03-15 export async function load_ae_obj_id__journal({ - api_cfg, - journal_id, - inc_entry_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_id, + inc_entry_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_id: string; - inc_entry_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - order_by_li?: key_val; // Order by fields for the journal entries - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_id: string; + inc_entry_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + order_by_li?: key_val; // Order by fields for the journal entries + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__journal() *** journal_id=${journal_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__journal() *** journal_id=${journal_id}`); + } - ae_promises.load__journal_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'journal', - obj_id: journal_id, - use_alt_table: true, - use_alt_base: false, - params: params, - log_lvl: log_lvl - }) - .then(async function (journal_obj_get_result) { - if (journal_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_props({ - obj_li: [journal_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__journal_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'journal', + obj_id: journal_id, + use_alt_table: true, + use_alt_base: false, + params: params, + log_lvl: log_lvl + }) + .then(async function (journal_obj_get_result) { + if (journal_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_props({ + obj_li: [journal_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__journal({ - // obj_type: 'journal', - // obj_li: [journal_obj_get_result], - // log_lvl: log_lvl - // }); - } - return journal_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__journal({ + // obj_type: 'journal', + // obj_li: [journal_obj_get_result], + // log_lvl: log_lvl + // }); + } + return journal_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__journal_obj:', ae_promises.load__journal_obj); - } - if (!ae_promises.load__journal_obj) { - console.log(`ERROR: Journals - Journal - The journal with ID ${journal_id} was not found.`); - return ae_promises.load__journal_obj; // Return null if the journal was not found - } + if (log_lvl) { + console.log('ae_promises.load__journal_obj:', ae_promises.load__journal_obj); + } + if (!ae_promises.load__journal_obj) { + console.log(`ERROR: Journals - Journal - The journal with ID ${journal_id} was not found.`); + return ae_promises.load__journal_obj; // Return null if the journal was not found + } - if (inc_entry_li) { - // Load the entries for the journal - if (log_lvl) { - console.log(`Need to load the entry list for the journal now`); - } - const load_journal_entry_obj_li = load_ae_obj_li__journal_entry({ - api_cfg: api_cfg, - for_obj_type: 'journal', - for_obj_id: journal_id, - enabled: enabled, // all, disabled, enabled - hidden: hidden, // all, hidden, not_hidden - limit: limit, // Limit for the entries - offset: offset, - order_by_li: order_by_li, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((journal_entry_obj_li) => { - if (log_lvl) { - console.log(`journal_entry_obj_li = `, journal_entry_obj_li); - } - return journal_entry_obj_li; - }); + if (inc_entry_li) { + // Load the entries for the journal + if (log_lvl) { + console.log(`Need to load the entry list for the journal now`); + } + const load_journal_entry_obj_li = load_ae_obj_li__journal_entry({ + api_cfg: api_cfg, + for_obj_type: 'journal', + for_obj_id: journal_id, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // Limit for the entries + offset: offset, + order_by_li: order_by_li, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((journal_entry_obj_li) => { + if (log_lvl) { + console.log(`journal_entry_obj_li = `, journal_entry_obj_li); + } + return journal_entry_obj_li; + }); - if (log_lvl) { - console.log(`journal_entry_obj_li = `, load_journal_entry_obj_li); - } - ae_promises.load__journal_obj.journal_entry_li = load_journal_entry_obj_li; - } + if (log_lvl) { + console.log(`journal_entry_obj_li = `, load_journal_entry_obj_li); + } + ae_promises.load__journal_obj.journal_entry_li = load_journal_entry_obj_li; + } - return ae_promises.load__journal_obj; + return ae_promises.load__journal_obj; } // Updated 2025-03-15 export async function load_ae_obj_li__journal({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - qry_person_id = null, - inc_entry_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + qry_person_id = null, + inc_entry_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - qry_person_id?: string | null; - inc_entry_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + qry_person_id?: string | null; + inc_entry_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__journal() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_li__journal() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - if (qry_person_id) { - const qry_param = { - type: 'AND', - field: 'person_id_random', - operator: '=', - value: qry_person_id - }; - params_json['qry'].push(qry_param); - } + if (qry_person_id) { + const qry_param = { + type: 'AND', + field: 'person_id_random', + operator: '=', + value: qry_person_id + }; + params_json['qry'].push(qry_param); + } - if (log_lvl) { - console.log('params_json:', params_json); - } + if (log_lvl) { + console.log('params_json:', params_json); + } - ae_promises.load__journal_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'journal', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (journal_obj_li_get_result) { - if (journal_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_props({ - obj_li: journal_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__journal_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'journal', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (journal_obj_li_get_result) { + if (journal_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_props({ + obj_li: journal_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__journal({ - // obj_type: 'journal', - // obj_li: journal_obj_li_get_result, - // log_lvl: log_lvl - // }); - } - return journal_obj_li_get_result; - } else { - return []; - } - }); + // db_save_ae_obj_li__journal({ + // obj_type: 'journal', + // obj_li: journal_obj_li_get_result, + // log_lvl: log_lvl + // }); + } + return journal_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__journal_obj_li:', ae_promises.load__journal_obj_li); - } + if (log_lvl) { + console.log('ae_promises.load__journal_obj_li:', ae_promises.load__journal_obj_li); + } - if (inc_entry_li) { - // Load the entries for the journals - if (log_lvl) { - 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++) { - const journal_obj = ae_promises.load__journal_obj_li[i]; - const journal_id = journal_obj.journal_id_random; + if (inc_entry_li) { + // Load the entries for the journals + if (log_lvl) { + 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++) { + const journal_obj = ae_promises.load__journal_obj_li[i]; + const journal_id = journal_obj.journal_id_random; - const load_journal_entry_obj_li = load_ae_obj_li__journal_entry({ - api_cfg: api_cfg, - for_obj_type: 'journal', - for_obj_id: journal_id, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - order_by_li: order_by_li, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((journal_entry_obj_li) => { - if (log_lvl) { - console.log(`journal_entry_obj_li = `, journal_entry_obj_li); - } + const load_journal_entry_obj_li = load_ae_obj_li__journal_entry({ + api_cfg: api_cfg, + for_obj_type: 'journal', + for_obj_id: journal_id, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + order_by_li: order_by_li, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((journal_entry_obj_li) => { + if (log_lvl) { + console.log(`journal_entry_obj_li = `, journal_entry_obj_li); + } - return journal_entry_obj_li; - }); + return journal_entry_obj_li; + }); - if (log_lvl) { - console.log(`load_journal_entry_obj_li = `, load_journal_entry_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_journal_entry_obj_li = `, load_journal_entry_obj_li); + } + } + } - return ae_promises.load__journal_obj_li; + return ae_promises.load__journal_obj_li; } // Updated 2025-03-24 export async function create_ae_obj__journal({ - api_cfg, - account_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__journal() *** account_id=${account_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__journal() *** account_id=${account_id}`); + } - if (!account_id) { - console.log(`ERROR: Journals - Journal - account_id required to create`); - return false; - } + if (!account_id) { + console.log(`ERROR: Journals - Journal - account_id required to create`); + return false; + } - ae_promises.create__journal = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'journal', - fields: { - account_id_random: account_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (journal_obj_create_result) { - if (journal_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_props({ - obj_li: [journal_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__journal = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'journal', + fields: { + account_id_random: account_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (journal_obj_create_result) { + if (journal_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_props({ + obj_li: [journal_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__journal( - // { - // obj_type: 'journal', - // obj_li: [journal_obj_create_result], - // log_lvl: log_lvl - // }); - } - return journal_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__journal( + // { + // obj_type: 'journal', + // obj_li: [journal_obj_create_result], + // log_lvl: log_lvl + // }); + } + return journal_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__journal:', ae_promises.create__journal); - } - return ae_promises.create__journal; + if (log_lvl) { + console.log('ae_promises.create__journal:', ae_promises.create__journal); + } + return ae_promises.create__journal; } // Updated 2025-03-15 export async function delete_ae_obj_id__journal({ - api_cfg, - journal_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__journal() *** journal_id=${journal_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__journal() *** journal_id=${journal_id}`); + } - ae_promises.delete__journal_obj = await api - .delete_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'journal', - obj_id: journal_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(async function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for journal_id=${journal_id}`); - } - await db_journals.journal.delete(journal_id); - } - }); + ae_promises.delete__journal_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'journal', + obj_id: journal_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(async function () { + if (try_cache) { + if (log_lvl) { + console.log(`Attempting to remove IDB entry for journal_id=${journal_id}`); + } + await db_journals.journal.delete(journal_id); + } + }); - if (log_lvl) { - console.log('ae_promises.delete__journal_obj:', ae_promises.delete__journal_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__journal_obj:', ae_promises.delete__journal_obj); + } - return ae_promises.delete__journal_obj; + return ae_promises.delete__journal_obj; } // Updated 2025-05-09 export async function update_ae_obj__journal({ - api_cfg, - journal_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** update_ae_obj__journal() *** journal_id=${journal_id}`, data_kv); - } + if (log_lvl) { + console.log(`*** update_ae_obj__journal() *** journal_id=${journal_id}`, data_kv); + } - // log_lvl = 1; + // log_lvl = 1; - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'journal', - obj_id: journal_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'journal', + obj_id: journal_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__journal({ - // obj_type: 'journal', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update journal.'); - return null; - } + // await db_save_ae_obj_li__journal({ + // obj_type: 'journal', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update journal.'); + return null; + } } // This new function is using CRUD v2. This should allow for more flexibility in the queries. // Updated 2025-03-15 export async function qry__journal({ - api_cfg, - journal_id, - qry_str, - qry_files, - qry_start_datetime, // Example greater than: '2024-10-24' - enabled = 'enabled', - hidden = 'not_hidden', - limit = 50, - offset = 0, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_id, + qry_str, + qry_files, + qry_start_datetime, // Example greater than: '2024-10-24' + enabled = 'enabled', + hidden = 'not_hidden', + limit = 50, + offset = 0, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_id: any; - qry_str?: string; - qry_files?: null | boolean; - qry_start_datetime?: null | string; // Greater than this datetime - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_id: any; + qry_str?: string; + qry_files?: null | boolean; + qry_start_datetime?: null | string; // Greater than this datetime + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** qry__journal() *** journal_id=${journal_id} enabled=${enabled} hidden=${hidden} limit=${limit} offset=${offset}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 25); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 25); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (qry_str && qry_str.length > 2) { - // params_json['ft_qry'] = {}; - // params_json['ft_qry']['default_qry_str'] = qry_str; - // } + // if (qry_str && qry_str.length > 2) { + // params_json['ft_qry'] = {}; + // params_json['ft_qry']['default_qry_str'] = qry_str; + // } - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_files === true) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: '>', - value: 0 - }; - params_json['qry'].push(qry_param); - } else if (qry_files === false) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: 'IS', - value: null - }; - params_json['qry'].push(qry_param); - } + if (qry_files === true) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: '>', + value: 0 + }; + params_json['qry'].push(qry_param); + } else if (qry_files === false) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: 'IS', + value: null + }; + params_json['qry'].push(qry_param); + } - if (qry_start_datetime) { - const qry_param = { - type: 'AND', - field: 'start_datetime', - operator: '>', - value: qry_start_datetime - }; - params_json['qry'].push(qry_param); - } + if (qry_start_datetime) { + const qry_param = { + type: 'AND', + field: 'start_datetime', + operator: '>', + value: qry_start_datetime + }; + params_json['qry'].push(qry_param); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'journal', - for_obj_type: 'account', - for_obj_id: journal_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for journal searching - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (journal_obj_li_get_result) { - if (journal_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_props({ - obj_li: journal_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } + ae_promises.load__journal_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'journal', + for_obj_type: 'account', + for_obj_id: journal_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for journal searching + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (journal_obj_li_get_result) { + if (journal_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_props({ + obj_li: journal_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } - // db_save_ae_obj_li__journal({ - // obj_type: 'journal', - // obj_li: journal_obj_li_get_result - // }); - return journal_obj_li_get_result; - } else { - return []; - } - }); + // db_save_ae_obj_li__journal({ + // obj_type: 'journal', + // obj_li: journal_obj_li_get_result + // }); + return journal_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__journal_obj_li:', ae_promises.load__journal_obj_li); - } - return ae_promises.load__journal_obj_li; + if (log_lvl) { + console.log('ae_promises.load__journal_obj_li:', 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. @@ -804,81 +804,81 @@ export async function qry__journal({ // Updated 2025-05-09 const properties_to_save = [ - 'id', - 'journal_id', + 'id', + 'journal_id', - 'code', + 'code', - 'for_type', - 'for_id', - 'type_code', + 'for_type', + 'for_id', + 'type_code', - 'account_id', - 'person_id', + 'account_id', + 'person_id', - 'name', - 'short_name', - 'summary', - 'outline', + 'name', + 'short_name', + 'summary', + 'outline', - 'description', - 'description_md_html', // Use the markdown parser to generate HTML - 'description_html', - 'description_json', + 'description', + 'description_md_html', // Use the markdown parser to generate HTML + 'description_html', + 'description_json', - // start_datetime: obj.start_datetime, - // end_datetime: obj.end_datetime, - 'timezone', + // start_datetime: obj.start_datetime, + // end_datetime: obj.end_datetime, + 'timezone', - 'alert', - 'alert_msg', + 'alert', + 'alert_msg', - 'sort_by', - 'sort_by_desc', + 'sort_by', + 'sort_by_desc', - 'cfg_json', + 'cfg_json', - // ux_mode: obj.ux_mode, + // ux_mode: obj.ux_mode, - // This only allows for basic access to the data. - 'passcode_read', // For LLM (AI) generated summary...??? - 'passcode_read_expire', - 'passcode_write', - 'passcode_write_expire', + // This only allows for basic access to the data. + 'passcode_read', // For LLM (AI) generated summary...??? + 'passcode_read_expire', + 'passcode_write', + 'passcode_write_expire', - 'passcode', // For Journal Entry encryption password - 'passcode_timeout', + 'passcode', // For Journal Entry encryption password + 'passcode_timeout', - 'private_passcode', // Combine with Journal passcode to encrypt and decrypt Entries + 'private_passcode', // Combine with Journal passcode to encrypt and decrypt Entries - 'auth_key', // For Journal authorization without sign in + 'auth_key', // For Journal authorization without sign in - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - 'tmp_sort_3', - // tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, - // tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + 'tmp_sort_3', + // tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, + // tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, + // 'tmp_sort_a', + // 'tmp_sort_b', - 'combined_passcode', + 'combined_passcode', - // From SQL view - 'journal_entry_count' + // From SQL view + 'journal_entry_count' - // A key value list of the others - // journal_other_kv - // journal_other_li + // A key value list of the others + // journal_other_kv + // journal_other_li ]; /** @@ -886,98 +886,98 @@ const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-11-13 export async function process_ae_obj__journal_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'journal', - log_lvl, - specific_processor: async (obj) => { - const description = obj.description ?? ''; - const description_cleaned: string = description.replace( - /^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, - '' - ); - obj.description_md_html = (await marked.parse(description_cleaned ?? '')) ?? null; + return _process_generic_props({ + obj_li, + obj_type: 'journal', + log_lvl, + specific_processor: async (obj) => { + const description = obj.description ?? ''; + const description_cleaned: string = description.replace( + /^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, + '' + ); + obj.description_md_html = (await marked.parse(description_cleaned ?? '')) ?? null; - obj.cfg_json = obj.cfg_json ?? {}; - obj.data_json = obj.data_json ?? {}; + obj.cfg_json = obj.cfg_json ?? {}; + obj.data_json = obj.data_json ?? {}; - obj.tmp_sort_3 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${ - obj.name - }_${obj.updated_on ?? obj.created_on}`; - obj.combined_passcode = `${obj.passcode ?? ''}:${obj.private_passcode ?? ''}`; + obj.tmp_sort_3 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${ + obj.name + }_${obj.updated_on ?? obj.created_on}`; + obj.combined_passcode = `${obj.passcode ?? ''}:${obj.private_passcode ?? ''}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_journals/ae_journals__journal_entry.ts b/src/lib/ae_journals/ae_journals__journal_entry.ts index 96341a8f..2f8953d7 100644 --- a/src/lib/ae_journals/ae_journals__journal_entry.ts +++ b/src/lib/ae_journals/ae_journals__journal_entry.ts @@ -10,451 +10,464 @@ const ae_promises: key_val = {}; // Updated 2025-03-15 export async function load_ae_obj_id__journal_entry({ - api_cfg, - journal_entry_id, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_entry_id, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_entry_id: string; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_entry_id: string; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`); + } - const params = {}; + const params = {}; - ae_promises.load__journal_entry_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'journal_entry', - obj_id: journal_entry_id, // NOTE: This is the FQDN, not normally the ID. - use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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 - params: params, - log_lvl: log_lvl - }) - .then(async function (journal_entry_obj_get_result) { - if (journal_entry_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_entry_props({ - obj_li: [journal_entry_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal_entry', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__journal_entry_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'journal_entry', + obj_id: journal_entry_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_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 + params: params, + log_lvl: log_lvl + }) + .then(async function (journal_entry_obj_get_result) { + if (journal_entry_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_entry_props({ + obj_li: [journal_entry_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal_entry', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__journal_entry({ - // obj_type: 'journal_entry', - // obj_li: [journal_entry_obj_get_result], - // log_lvl: log_lvl - // }); - } - return journal_entry_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__journal_entry({ + // obj_type: 'journal_entry', + // obj_li: [journal_entry_obj_get_result], + // log_lvl: log_lvl + // }); + } + return journal_entry_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__journal_entry_obj; + return ae_promises.load__journal_entry_obj; } // Updated 2025-03-15 export async function load_ae_obj_li__journal_entry({ - api_cfg, - for_obj_type = 'journal', - for_obj_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'journal', + for_obj_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__journal_entry() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 99); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 99); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const 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({ - api_cfg: api_cfg, - obj_type: 'journal_entry', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (journal_entry_obj_li_get_result) { - if (journal_entry_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_entry_props({ - obj_li: journal_entry_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal_entry', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__journal_entry_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'journal_entry', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (journal_entry_obj_li_get_result) { + if (journal_entry_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_entry_props({ + obj_li: journal_entry_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal_entry', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__journal_entry({ - // obj_type: 'journal_entry', - // obj_li: journal_entry_obj_li_get_result, - // log_lvl: log_lvl - // }); - } - return journal_entry_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // await db_save_ae_obj_li__journal_entry({ + // obj_type: 'journal_entry', + // obj_li: journal_entry_obj_li_get_result, + // log_lvl: log_lvl + // }); + } + return journal_entry_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__journal_entry_obj_li:', ae_promises.load__journal_entry_obj_li); - } + if (log_lvl) { + console.log( + 'ae_promises.load__journal_entry_obj_li:', + ae_promises.load__journal_entry_obj_li + ); + } - return ae_promises.load__journal_entry_obj_li; + return ae_promises.load__journal_entry_obj_li; } // Updated 2025-03-15 export async function create_ae_obj__journal_entry({ - api_cfg, - journal_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`); + } - if (!journal_id) { - console.log(`ERROR: Journals - Entry - journal_id required to create`); - return false; - } + if (!journal_id) { + console.log(`ERROR: Journals - Entry - journal_id required to create`); + return false; + } - ae_promises.create__journal_entry = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'journal_entry', - fields: { - journal_id_random: journal_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (journal_entry_obj_create_result) { - if (journal_entry_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_entry_props({ - obj_li: [journal_entry_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal_entry', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__journal_entry = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'journal_entry', + fields: { + journal_id_random: journal_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (journal_entry_obj_create_result) { + if (journal_entry_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_entry_props({ + obj_li: [journal_entry_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal_entry', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__journal_entry( - // { - // obj_type: 'journal_entry', - // obj_li: [journal_entry_obj_create_result], - // log_lvl: log_lvl - // }); - } - return journal_entry_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // await db_save_ae_obj_li__journal_entry( + // { + // obj_type: 'journal_entry', + // obj_li: [journal_entry_obj_create_result], + // log_lvl: log_lvl + // }); + } + return journal_entry_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.create__journal_entry:', ae_promises.create__journal_entry); - } - return ae_promises.create__journal_entry; + if (log_lvl) { + console.log('ae_promises.create__journal_entry:', ae_promises.create__journal_entry); + } + return ae_promises.create__journal_entry; } // Updated 2025-03-15 export async function delete_ae_obj_id__journal_entry({ - api_cfg, - journal_entry_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_entry_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_entry_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_entry_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'journal_entry', - obj_id: journal_entry_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for journal_entry_id=${journal_entry_id}`); - } - db_journals.journal_entry.delete(journal_entry_id); // Delete from the DB no matter what. - } - }); + ae_promises.delete__journal_entry_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'journal_entry', + obj_id: journal_entry_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for journal_entry_id=${journal_entry_id}` + ); + } + db_journals.journal_entry.delete(journal_entry_id); // Delete from the DB no matter what. + } + }); - if (log_lvl) { - console.log('ae_promises.delete__journal_entry_obj:', ae_promises.delete__journal_entry_obj); - } + if (log_lvl) { + console.log( + 'ae_promises.delete__journal_entry_obj:', + ae_promises.delete__journal_entry_obj + ); + } - 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. // Updated 2025-06-04 export async function qry__journal_entry({ - api_cfg, - journal_id, - qry_str = null, // Example: 'name:contains:"test"' - qry_created_on = null, // Example greater than: '2024-10-24' - qry_alert = null, - qry_priority = null, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 50, - offset = 0, - order_by_li = { - group: 'DESC', - priority: 'DESC', - sort: 'DESC', - alert: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_id, + qry_str = null, // Example: 'name:contains:"test"' + qry_created_on = null, // Example greater than: '2024-10-24' + qry_alert = null, + qry_priority = null, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 50, + offset = 0, + order_by_li = { + group: 'DESC', + priority: 'DESC', + sort: 'DESC', + alert: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_id: any; - qry_str?: null | string; - qry_created_on?: null | string; - qry_alert?: null | string; - qry_priority?: null | number; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_id: any; + qry_str?: null | string; + qry_created_on?: null | string; + qry_alert?: null | string; + qry_priority?: null | number; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: any; + try_cache?: boolean; + log_lvl?: number; }) { - log_lvl = 1; - if (log_lvl) { - console.log(`*** qry__journal_entry() *** journal_id=${journal_id}`); - } + log_lvl = 1; + if (log_lvl) { + console.log(`*** qry__journal_entry() *** journal_id=${journal_id}`); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_str) { - console.log('qry_str:', qry_str); - // let qry_param = - // { - // type: "AND", - // field: "qry_str", - // operator: "LIKE", - // value: qry_str - // }; - const qry_param = { - type: '', - field: 'default_qry_str', // default is really just the standard FT string in the DB - operator: 'MATCH', - value: qry_str - }; - params_json['qry'].push(qry_param); - } + if (qry_str) { + console.log('qry_str:', qry_str); + // let qry_param = + // { + // type: "AND", + // field: "qry_str", + // operator: "LIKE", + // value: qry_str + // }; + const qry_param = { + type: '', + field: 'default_qry_str', // default is really just the standard FT string in the DB + operator: 'MATCH', + value: qry_str + }; + params_json['qry'].push(qry_param); + } - if (qry_created_on) { - const qry_param = { - type: 'AND', - field: 'created_on', - operator: '>', - value: qry_created_on - }; - params_json['qry'].push(qry_param); - } + if (qry_created_on) { + const qry_param = { + type: 'AND', + field: 'created_on', + operator: '>', + value: qry_created_on + }; + params_json['qry'].push(qry_param); + } - if (qry_priority) { - console.log('qry_priority:', qry_priority); - const qry_param = { - type: 'AND', - field: 'priority', - operator: '=', - value: qry_priority - }; - params_json['qry'].push(qry_param); - } + if (qry_priority) { + console.log('qry_priority:', qry_priority); + const qry_param = { + type: 'AND', + field: 'priority', + operator: '=', + value: qry_priority + }; + params_json['qry'].push(qry_param); + } - ae_promises.load__journal_entry_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'journal_entry', - for_obj_type: 'journal', - for_obj_id: journal_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for journal entry searching??? - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(function (journal_entry_obj_li_get_result) { - if (journal_entry_obj_li_get_result) { - if (try_cache) { - db_save_ae_obj_li__journal_entry({ - obj_type: 'journal_entry', - obj_li: journal_entry_obj_li_get_result - }); - } - return journal_entry_obj_li_get_result; - } else { - return []; - } - }); + ae_promises.load__journal_entry_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'journal_entry', + for_obj_type: 'journal', + for_obj_id: journal_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for journal entry searching??? + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (journal_entry_obj_li_get_result) { + if (journal_entry_obj_li_get_result) { + if (try_cache) { + db_save_ae_obj_li__journal_entry({ + obj_type: 'journal_entry', + obj_li: journal_entry_obj_li_get_result + }); + } + return journal_entry_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__journal_entry_obj_li:', ae_promises.load__journal_entry_obj_li); - } - return ae_promises.load__journal_entry_obj_li; + if (log_lvl) { + console.log( + 'ae_promises.load__journal_entry_obj_li:', + ae_promises.load__journal_entry_obj_li + ); + } + return ae_promises.load__journal_entry_obj_li; } // Updated 2025-03-15 @@ -523,365 +536,365 @@ export async function qry__journal_entry({ // Updated 2025-05-09 export async function update_ae_obj__journal_entry({ - api_cfg, - journal_entry_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + journal_entry_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - journal_entry_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + journal_entry_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - // log_lvl = 1; - if (log_lvl) { - console.log( - `*** update_ae_obj__journal_entry() *** journal_entry_id=${journal_entry_id}`, - data_kv - ); - } + // log_lvl = 1; + if (log_lvl) { + console.log( + `*** update_ae_obj__journal_entry() *** journal_entry_id=${journal_entry_id}`, + data_kv + ); + } - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'journal_entry', - obj_id: journal_entry_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'journal_entry', + obj_id: journal_entry_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__journal_entry_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_journals, - table_name: 'journal_entry', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__journal_entry_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_journals, + table_name: 'journal_entry', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__journal_entry({ - // obj_type: 'journal_entry', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update journal entry.'); - return null; - } + // await db_save_ae_obj_li__journal_entry({ + // obj_type: 'journal_entry', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update journal entry.'); + return null; + } } // This function will loop through the journal_entry_obj_li and save each one to the DB. // Updated 2025-05-09 export async function db_save_ae_obj_li__journal_entry({ - obj_type, - obj_li, - log_lvl = 0 + obj_type, + obj_li, + log_lvl = 0 }: { - obj_type: string; - obj_li: any; - log_lvl?: number; + obj_type: string; + obj_li: any; + log_lvl?: number; }) { - // log_lvl = 1; - if (log_lvl) { - console.log(`*** db_save_ae_obj_li__journal_entry() *** obj_type=${obj_type}`, obj_li); - } + // log_lvl = 1; + if (log_lvl) { + console.log(`*** db_save_ae_obj_li__journal_entry() *** obj_type=${obj_type}`, obj_li); + } - if (obj_li && obj_li.length) { - // let obj_li_id = obj_li.map((obj: any) => obj.journal_entry_id_random); - const obj_li_id: string[] = []; + if (obj_li && obj_li.length) { + // let obj_li_id = obj_li.map((obj: any) => obj.journal_entry_id_random); + const obj_li_id: string[] = []; - for (const obj of obj_li) { - // obj_li.forEach(async function (obj: any) { - if (log_lvl) { - console.log(`Processing ae_obj ${obj_type}:`, obj); - } + for (const obj of obj_li) { + // obj_li.forEach(async function (obj: any) { + if (log_lvl) { + console.log(`Processing ae_obj ${obj_type}:`, obj); + } - let content = obj.content ?? ''; - // remove the most common zerowidth characters from the start of the file - let content_cleaned: null | string = null; - let content_md_html: null | string = null; // await marked.parse(content_cleaned ?? '') ?? null; - // let content_md_html_alt: null|string = await marked.parse(content_cleaned ?? '', { gfm: false }) ?? null; + let content = obj.content ?? ''; + // remove the most common zerowidth characters from the start of the file + let content_cleaned: null | string = null; + let content_md_html: null | string = null; // await marked.parse(content_cleaned ?? '') ?? null; + // let content_md_html_alt: null|string = await marked.parse(content_cleaned ?? '', { gfm: false }) ?? null; - if (obj.content_encrypted) { - // In theory "content" should be null if "content_encrypted" has a value. - content = null; // obj.content_encrypted; - content_cleaned = null; - content_md_html = null; - } else { - content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); - content_md_html = (await marked.parse(content_cleaned ?? '')) ?? null; - } + if (obj.content_encrypted) { + // In theory "content" should be null if "content_encrypted" has a value. + content = null; // obj.content_encrypted; + content_cleaned = null; + content_md_html = null; + } else { + content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); + content_md_html = (await marked.parse(content_cleaned ?? '')) ?? null; + } - let history = obj.history ?? ''; - let history_cleaned: null | string = null; - let history_md_html: null | string = null; // await marked.parse(history_cleaned ?? '') ?? null; + let history = obj.history ?? ''; + let history_cleaned: null | string = null; + let history_md_html: null | string = null; // await marked.parse(history_cleaned ?? '') ?? null; - if (obj.history_encrypted) { - // In theory "history" should be null if "history_encrypted" has a value. - history = null; // obj.history_encrypted; - history_cleaned = null; - history_md_html = null; - } else { - history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); - history_md_html = (await marked.parse(history_cleaned ?? '')) ?? null; - } + if (obj.history_encrypted) { + // In theory "history" should be null if "history_encrypted" has a value. + history = null; // obj.history_encrypted; + history_cleaned = null; + history_md_html = null; + } else { + history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); + history_md_html = (await marked.parse(history_cleaned ?? '')) ?? null; + } - const obj_record = { - id: obj.journal_entry_id_random, - journal_entry_id: obj.journal_entry_id_random, + const obj_record = { + id: obj.journal_entry_id_random, + journal_entry_id: obj.journal_entry_id_random, - journal_id: obj.journal_id_random, + journal_id: obj.journal_id_random, - code: obj.code, + code: obj.code, - for_type: obj.for_type, - for_id: obj.for_id, + for_type: obj.for_type, + for_id: obj.for_id, - journal_entry_type: obj.journal_entry_type, + journal_entry_type: obj.journal_entry_type, - person_id: obj.person_id_random, + person_id: obj.person_id_random, - template: obj.template ?? null, // Allow for a template to be used, otherwise null + template: obj.template ?? null, // Allow for a template to be used, otherwise null - activity_code: obj.activity_code, - category_code: obj.category_code, - type_code: obj.type_code, - topic_code: obj.topic_code, - tags: obj.tags, + activity_code: obj.activity_code, + category_code: obj.category_code, + type_code: obj.type_code, + topic_code: obj.topic_code, + tags: obj.tags, - public: obj.public, - private: obj.private, - personal: obj.personal, - professional: obj.professional, + public: obj.public, + private: obj.private, + personal: obj.personal, + professional: obj.professional, - name: obj.name, - short_name: obj.short_name ?? null, - summary: obj.summary, - outline: obj.outline, - // description: obj.description, + name: obj.name, + short_name: obj.short_name ?? null, + summary: obj.summary, + outline: obj.outline, + // description: obj.description, - content: obj.content, - content_md_html: content_md_html, - // content_md_html_alt: content_md_html_alt, - content_html: obj.content_html, - content_json: obj.content_json, - content_encrypted: obj.content_encrypted, + content: obj.content, + content_md_html: content_md_html, + // content_md_html_alt: content_md_html_alt, + content_html: obj.content_html, + content_json: obj.content_json, + content_encrypted: obj.content_encrypted, - history: obj.history, - history_md_html: history_md_html, - history_encrypted: obj.history_encrypted, + history: obj.history, + history_md_html: history_md_html, + history_encrypted: obj.history_encrypted, - passcode_hash: obj.passcode_hash, + passcode_hash: obj.passcode_hash, - // url: obj.url, - // url_text: obj.url_text, + // url: obj.url, + // url_text: obj.url_text, - // hosted_file_id: obj.hosted_file_id_random, + // hosted_file_id: obj.hosted_file_id_random, - // file_path: obj.file_path, + // file_path: obj.file_path, - // filename: obj.filename, - // file_extension: obj.file_extension, + // filename: obj.filename, + // file_extension: obj.file_extension, - // start_datetime: obj.start_datetime, - // end_datetime: obj.end_datetime, - // timezone: obj.timezone, + // start_datetime: obj.start_datetime, + // end_datetime: obj.end_datetime, + // timezone: obj.timezone, - // original_datetime: obj.original_datetime, - // original_timezone: obj.original_timezone, - // original_location: obj.original_location, - // original_url: obj.original_url, - // original_url_text: obj.original_url_text, + // original_datetime: obj.original_datetime, + // original_timezone: obj.original_timezone, + // original_location: obj.original_location, + // original_url: obj.original_url, + // original_url_text: obj.original_url_text, - // enable_for_public: obj.enable_for_public, + // enable_for_public: obj.enable_for_public, - alert: obj.alert, - alert_msg: obj.alert_msg, + alert: obj.alert, + alert_msg: obj.alert_msg, - // cfg_json: obj.cfg_json ?? {}, - data_json: obj.data_json ?? {}, + // cfg_json: obj.cfg_json ?? {}, + data_json: obj.data_json ?? {}, - // This only allows for basic access to the data. - // passcode_read: obj.passcode_read, // For LLM (AI) generated summary...??? - // passcode_read_expire: obj.passcode_read_expire, - // passcode_write: obj.passcode_write, - // passcode_write_expire: obj.passcode_write_expire, + // This only allows for basic access to the data. + // passcode_read: obj.passcode_read, // For LLM (AI) generated summary...??? + // passcode_read_expire: obj.passcode_read_expire, + // passcode_write: obj.passcode_write, + // passcode_write_expire: obj.passcode_write_expire, - enable: obj.enable, - hide: obj.hide, - archive: obj.archive, - archive_on: obj.archive_on, - priority: obj.priority, - sort: obj.sort, - group: obj.group, - notes: obj.notes, - created_on: obj.created_on, - updated_on: obj.updated_on, + enable: obj.enable, + hide: obj.hide, + archive: obj.archive, + archive_on: obj.archive_on, + priority: obj.priority, + sort: obj.sort, + group: obj.group, + notes: obj.notes, + created_on: obj.created_on, + updated_on: obj.updated_on, - // Generated fields for sorting locally only - tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`, - tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`, - // tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, - // tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, + // Generated fields for sorting locally only + tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`, + tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`, + // tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, + // tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, - // Generated fields for sorting locally only - // tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, - // tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, + // Generated fields for sorting locally only + // tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, + // tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, - // From SQL view - journal_code: obj.journal_code, - journal_name: obj.journal_name + // From SQL view + journal_code: obj.journal_code, + journal_name: obj.journal_name - // A key value list of the others - // journal_other_kv: obj.journal_other_kv, - // journal_other_li: obj.journal_other_li, - }; + // A key value list of the others + // journal_other_kv: obj.journal_other_kv, + // journal_other_li: obj.journal_other_li, + }; - let id_random = null; + let id_random = null; - try { - id_random = await db_journals.journal_entry.update(obj_record.id, obj_record); - } catch (error) { - console.log(`Error: Failed to update ${obj_record.id}: ${error}`); - } - if (!id_random) { - if (log_lvl) { - console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); - } - try { - id_random = await db_journals.journal_entry.put(obj_record); - } catch (error) { - console.log(`Error: Failed to put ${obj.journal_entry_id_random}: ${error}`); - } - } else { - if (log_lvl) { - console.log(`Updated record with ID: ${obj_record.id}`); - } - obj_li_id.push(obj_record.id); - } - if (!id_random) { - console.log(`Failed to save record with ID: ${obj_record.id}`); - } else { - if (log_lvl) { - console.log(`Saved record with ID: ${obj_record.id}`); - } - } - // }); - } + try { + id_random = await db_journals.journal_entry.update(obj_record.id, obj_record); + } catch (error) { + console.log(`Error: Failed to update ${obj_record.id}: ${error}`); + } + if (!id_random) { + if (log_lvl) { + console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`); + } + try { + id_random = await db_journals.journal_entry.put(obj_record); + } catch (error) { + console.log(`Error: Failed to put ${obj.journal_entry_id_random}: ${error}`); + } + } else { + if (log_lvl) { + console.log(`Updated record with ID: ${obj_record.id}`); + } + obj_li_id.push(obj_record.id); + } + if (!id_random) { + console.log(`Failed to save record with ID: ${obj_record.id}`); + } else { + if (log_lvl) { + console.log(`Saved record with ID: ${obj_record.id}`); + } + } + // }); + } - return obj_li_id; - } else { - if (log_lvl) { - console.log('No objects to save.'); - } - return []; - } + return obj_li_id; + } else { + if (log_lvl) { + console.log('No objects to save.'); + } + return []; + } } // Updated 2025-05-09 const properties_to_save = [ - 'id', - 'journal_entry_id', + 'id', + 'journal_entry_id', - 'journal_id', + 'journal_id', - 'code', + 'code', - 'for_type', - 'for_id', + 'for_type', + 'for_id', - 'journal_entry_type', + 'journal_entry_type', - 'person_id', + 'person_id', - 'template', // Allow for a template to be used, otherwise null + 'template', // Allow for a template to be used, otherwise null - 'activity_code', - 'category_code', - 'type_code', - 'topic_code', - 'tags', + 'activity_code', + 'category_code', + 'type_code', + 'topic_code', + 'tags', - 'public', - 'private', - 'personal', - 'professional', + 'public', + 'private', + 'personal', + 'professional', - 'name', - 'short_name', - 'summary', - 'outline', - // 'description', + 'name', + 'short_name', + 'summary', + 'outline', + // 'description', - 'content', - 'content_md_html', - 'content_html', - 'content_json', - 'content_encrypted', + 'content', + 'content_md_html', + 'content_html', + 'content_json', + 'content_encrypted', - 'history', - 'history_md_html', - 'history_encrypted', + 'history', + 'history_md_html', + 'history_encrypted', - 'passcode_hash', + 'passcode_hash', - 'alert', - 'alert_msg', + 'alert', + 'alert_msg', - // 'cfg_json', - 'data_json', + // 'cfg_json', + 'data_json', - 'enable', - 'hide', - 'archive', - 'archive_on', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'archive', + 'archive_on', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - 'tmp_sort_3', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + 'tmp_sort_3', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'journal_code', - 'journal_name' + // From SQL view + 'journal_code', + 'journal_name' - // A key value list of the others - // 'journal_other_kv', - // 'journal_other_li', + // A key value list of the others + // 'journal_other_kv', + // 'journal_other_li', ]; /** @@ -889,126 +902,126 @@ const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-05-09 export async function process_ae_obj__journal_entry_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'journal_entry', - log_lvl, - specific_processor: async (obj) => { - // Content processing - let content = obj.content ?? ''; - let content_cleaned: null | string = null; - let content_md_html: null | string = null; + return _process_generic_props({ + obj_li, + obj_type: 'journal_entry', + log_lvl, + specific_processor: async (obj) => { + // Content processing + let content = obj.content ?? ''; + let content_cleaned: null | string = null; + let content_md_html: null | string = null; - if (obj.content_encrypted) { - content = null; - content_cleaned = null; - content_md_html = null; - } else { - content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); - content_md_html = (await marked.parse(content_cleaned ?? '')) ?? null; - } - obj.content = content; - obj.content_md_html = content_md_html; + if (obj.content_encrypted) { + content = null; + content_cleaned = null; + content_md_html = null; + } else { + content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); + content_md_html = (await marked.parse(content_cleaned ?? '')) ?? null; + } + obj.content = content; + obj.content_md_html = content_md_html; - // History processing - let history = obj.history ?? ''; - let history_cleaned: null | string = null; - let history_md_html: null | string = null; + // History processing + let history = obj.history ?? ''; + let history_cleaned: null | string = null; + let history_md_html: null | string = null; - if (obj.history_encrypted) { - history = null; - history_cleaned = null; - history_md_html = null; - } else { - history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); - history_md_html = (await marked.parse(history_cleaned ?? '')) ?? null; - } - obj.history = history; - obj.history_md_html = history_md_html; + if (obj.history_encrypted) { + history = null; + history_cleaned = null; + history_md_html = null; + } else { + history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, ''); + history_md_html = (await marked.parse(history_cleaned ?? '')) ?? null; + } + obj.history = history; + obj.history_md_html = history_md_html; - // Journal entry-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_3 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`; + // Journal entry-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_3 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_journals/ae_journals_functions.ts b/src/lib/ae_journals/ae_journals_functions.ts index f36fb1b0..1c412f88 100644 --- a/src/lib/ae_journals/ae_journals_functions.ts +++ b/src/lib/ae_journals/ae_journals_functions.ts @@ -4,18 +4,18 @@ import * as journal from '$lib/ae_journals/ae_journals__journal'; import * as journal_entry from '$lib/ae_journals/ae_journals__journal_entry'; const export_obj = { - load_ae_obj_id__journal: journal.load_ae_obj_id__journal, - load_ae_obj_li__journal: journal.load_ae_obj_li__journal, - create_ae_obj__journal: journal.create_ae_obj__journal, - delete_ae_obj_id__journal: journal.delete_ae_obj_id__journal, - update_ae_obj__journal: journal.update_ae_obj__journal, - // db_save_ae_obj_li__journal: journal.db_save_ae_obj_li__journal, - load_ae_obj_id__journal_entry: journal_entry.load_ae_obj_id__journal_entry, - load_ae_obj_li__journal_entry: journal_entry.load_ae_obj_li__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, - update_ae_obj__journal_entry: journal_entry.update_ae_obj__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, + load_ae_obj_id__journal: journal.load_ae_obj_id__journal, + load_ae_obj_li__journal: journal.load_ae_obj_li__journal, + create_ae_obj__journal: journal.create_ae_obj__journal, + delete_ae_obj_id__journal: journal.delete_ae_obj_id__journal, + update_ae_obj__journal: journal.update_ae_obj__journal, + // db_save_ae_obj_li__journal: journal.db_save_ae_obj_li__journal, + load_ae_obj_id__journal_entry: journal_entry.load_ae_obj_id__journal_entry, + load_ae_obj_li__journal_entry: journal_entry.load_ae_obj_li__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, + update_ae_obj__journal_entry: journal_entry.update_ae_obj__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, }; export const journals_func = export_obj; diff --git a/src/lib/ae_journals/ae_journals_stores.ts b/src/lib/ae_journals/ae_journals_stores.ts index 09483d2c..f18dc073 100644 --- a/src/lib/ae_journals/ae_journals_stores.ts +++ b/src/lib/ae_journals/ae_journals_stores.ts @@ -9,88 +9,88 @@ import type { key_val } from '$lib/stores/ae_stores'; // This is for longer term or sticky app data. This should be stored to *local* storage. // Updated 2025-03-20 const journals_local_data_struct: key_val = { - ver: '2024-08-20_19', - // Shared - name: 'Aether - Journals (SvelteKit 2.x Svelte 5.x)', - title: `OSIT's Æ Journals`, // Æ + ver: '2024-08-20_19', + // Shared + name: 'Aether - Journals (SvelteKit 2.x Svelte 5.x)', + title: `OSIT's Æ Journals`, // Æ - mode__edit: false, - mode__debug: false, + mode__edit: false, + mode__debug: false, - datetime_format: 'datetime_12_long', - time_format: 'time_12_short', - time_hours: 12, // 12 or 24 + datetime_format: 'datetime_12_long', + time_format: 'time_12_short', + time_hours: 12, // 12 or 24 - qry__enabled: 'enabled', // all, disabled, enabled - qry__hidden: 'not_hidden', // all, hidden, not_hidden - qry__limit: 20, - qry__order_by_li: { - // 'created_on': 'desc', - // 'updated_on': 'desc', - }, - qry__offset: 0, - qry__journal_id: null, + qry__enabled: 'enabled', // all, disabled, enabled + qry__hidden: 'not_hidden', // all, hidden, not_hidden + qry__limit: 20, + qry__order_by_li: { + // 'created_on': 'desc', + // 'updated_on': 'desc', + }, + qry__offset: 0, + qry__journal_id: null, - journal_view_history_li: [], // Appended each time the journal is loaded. - entry_view_history_li: [], // NO LONGER USED: Appended each time the entry is loaded. - entry_view_history_kv: {}, // Keyed by journal_entry_id for quick lookup. - entry_view_history_max: 15, // Maximum number of journal entries to keep in history. + journal_view_history_li: [], // Appended each time the journal is loaded. + entry_view_history_li: [], // NO LONGER USED: Appended each time the entry is loaded. + entry_view_history_kv: {}, // Keyed by journal_entry_id for quick lookup. + entry_view_history_max: 15, // Maximum number of journal entries to keep in history. - llm__api_base_url: 'https://ai.dgrzone.com/api', - llm__api_model: 'dgrzone-deepseek-8b-quick', - llm__api_token: - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhYjI2MzdlLThiMjktNGM2Zi05MzVhLWFkYjU1MDkwMGU5MCJ9.VObfR91GrX3j1vHbHZqGsOWEyrL981cbSWWjaXfYbUQ', - 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__timeout_ms: 60000, // 60 seconds - llm__max_retries: 3, // Number of times to retry a failed LLM API call. - llm__retry_delay_ms: 2000, // 2 seconds between retries. + llm__api_base_url: 'https://ai.dgrzone.com/api', + llm__api_model: 'dgrzone-deepseek-8b-quick', + llm__api_token: + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhYjI2MzdlLThiMjktNGM2Zi05MzVhLWFkYjU1MDkwMGU5MCJ9.VObfR91GrX3j1vHbHZqGsOWEyrL981cbSWWjaXfYbUQ', + 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__timeout_ms: 60000, // 60 seconds + llm__max_retries: 3, // Number of times to retry a failed LLM API call. + llm__retry_delay_ms: 2000, // 2 seconds between retries. - llm__system_prompt: 'You are a helpful assistant that helps people find information.', - llm__max_tokens: 1024, - llm__temperature: 0.7, - llm__top_p: 1.0, - llm__n: 1, - llm__frequency_penalty: 0.0, - llm__presence_penalty: 0.0, + llm__system_prompt: 'You are a helpful assistant that helps people find information.', + llm__max_tokens: 1024, + llm__temperature: 0.7, + llm__top_p: 1.0, + llm__n: 1, + llm__frequency_penalty: 0.0, + llm__presence_penalty: 0.0, - journal: { - edit: false, - edit_kv: {}, + journal: { + edit: false, + edit_kv: {}, - type_code_li: [ - { code: 'diary', name: 'Diary' }, - { code: 'log', name: 'Log' }, - { code: 'journal', name: 'Journal' }, - { code: 'notebook', name: 'Notebook' }, - { code: 'personal', name: 'Personal' }, - { code: 'professional', name: 'Professional' }, - { code: 'tracking', name: 'Tracking' }, - { code: 'other', name: 'Other' }, - { code: 'test', name: 'Test' } - // { code: 'notepad', name: 'Notepad' }, - ] - }, - entry: { - llm__system_prompt: - 'Summarize the following journal entry content in a concise manner, focusing on key points and insights.', - llm__max_tokens: 512, - llm__temperature: 0.7, - llm__top_p: 1.0, - llm__n: 1, - llm__frequency_penalty: 0.0, - llm__presence_penalty: 0.0, + type_code_li: [ + { code: 'diary', name: 'Diary' }, + { code: 'log', name: 'Log' }, + { code: 'journal', name: 'Journal' }, + { code: 'notebook', name: 'Notebook' }, + { code: 'personal', name: 'Personal' }, + { code: 'professional', name: 'Professional' }, + { code: 'tracking', name: 'Tracking' }, + { code: 'other', name: 'Other' }, + { code: 'test', name: 'Test' } + // { code: 'notepad', name: 'Notepad' }, + ] + }, + entry: { + llm__system_prompt: + 'Summarize the following journal entry content in a concise manner, focusing on key points and insights.', + llm__max_tokens: 512, + llm__temperature: 0.7, + llm__top_p: 1.0, + llm__n: 1, + llm__frequency_penalty: 0.0, + llm__presence_penalty: 0.0, - edit: false, - edit_kv: {} - } + edit: false, + edit_kv: {} + } }; // console.log(`AE Stores - App Journals Local Storage Data:`, journals_local_data_struct); // This works and uses *local* storage: export const journals_loc: Writable = persisted( - 'ae_journals_loc', - journals_local_data_struct + 'ae_journals_loc', + journals_local_data_struct ); // console.log(`AE Stores - App Local Storage Data:`, get(ae_loc)); @@ -98,47 +98,47 @@ export const journals_loc: Writable = persisted( // 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 const journals_session_data_struct: key_val = { - ver: '2024-08-20_19', - log_lvl: 1, + ver: '2024-08-20_19', + log_lvl: 1, - // Shared Triggers - trigger: null, - trigger__journal_id: null, - // trigger__journal_li: null, + // Shared Triggers + trigger: null, + trigger__journal_id: null, + // trigger__journal_li: null, - show__modal__journals_config: false, + show__modal__journals_config: false, - show__modal_edit__journal_obj: false, - show__modal_new__journal_obj: false, - show__modal_view__journal_id: null, - show_list__journal_entry_li_group: true, - show__modal_view__journal_entry_id: null, - show__modal_edit__journal_entry_id: null, + show__modal_edit__journal_obj: false, + show__modal_new__journal_obj: false, + show__modal_view__journal_id: null, + show_list__journal_entry_li_group: true, + show__modal_view__journal_entry_id: null, + show__modal_edit__journal_entry_id: null, - show__content__journal_entry_history: false, + show__content__journal_entry_history: false, - journal: { - edit: false, - edit_kv: {}, + journal: { + edit: false, + edit_kv: {}, - new_journal_name: '', - new_journal_type_code: '', + new_journal_name: '', + new_journal_type_code: '', - tmp_obj: {} - }, - entry: { - show__ai_summary: false, - ai_summary: '', - decrypt_kv: {}, // Essentially flag that the entry (content and history) can be decrypted. - edit: false, - edit_kv: {}, + tmp_obj: {} + }, + entry: { + show__ai_summary: false, + ai_summary: '', + decrypt_kv: {}, // Essentially flag that the entry (content and history) can be decrypted. + edit: false, + edit_kv: {}, - tmp_obj: {} - }, + tmp_obj: {} + }, - journal_kv: { - // journal_id: {}, - } + journal_kv: { + // journal_id: {}, + } }; // console.log(`AE Stores - App Journals Session Storage Data:`, journals_session_data_struct); export const journals_sess = writable(journals_session_data_struct); @@ -149,15 +149,15 @@ export const journals_sess = writable(journals_session_data_struct); // Intended for temporary session storage. // Updated 2024-08-20 const journals_slct_obj_template: key_val = { - // Top level - journal_id: null, - journal_obj: {}, - journal_obj_li: [], + // Top level + journal_id: null, + journal_obj: {}, + journal_obj_li: [], - tmp_journal_obj: {}, // Temporary object for new journal - tmp_journal_entry_obj: {}, // Temporary object for new journal entry + tmp_journal_obj: {}, // Temporary object for new journal + 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); @@ -168,8 +168,8 @@ export const journals_slct = writable(journals_slct_obj_template); // Intended for temporary session storage. // Updated 2025-03-16 const journals_trig_template: key_val = { - journal_id: false, - journal_entry_li: false + journal_id: false, + journal_entry_li: false }; export const journals_trig: any = writable(journals_trig_template); // console.log(`AE Journals Stores - Journals Trigger:`, journals_trig); @@ -178,8 +178,8 @@ export const journals_trig: any = writable(journals_trig_template); // Intended for temporary session storage. // Updated 2025-03-16 const journals_prom_template: key_val = { - journal_id: false, - journal_entry_li: false + journal_id: false, + journal_entry_li: false }; export const journals_prom: any = writable(journals_prom_template); // console.log(`AE Journals Stores - Journals Trigger:`, journals_prom); diff --git a/src/lib/ae_journals/db_journals.ts b/src/lib/ae_journals/db_journals.ts index 9eb113e4..effbc213 100644 --- a/src/lib/ae_journals/db_journals.ts +++ b/src/lib/ae_journals/db_journals.ts @@ -10,509 +10,509 @@ import type { key_val } from '$lib/stores/ae_stores'; // Updated 2025-03-15 export interface Journal { - id: string; // actually "id_random" - journal_id: string; + id: string; // actually "id_random" + journal_id: string; - // Essentially this is a change log of journals - snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journals. - previous_id?: null | string; // This is the old or parent journal ID - next_id?: null | string; // This is the new or child journal ID + // Essentially this is a change log of journals + snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journals. + previous_id?: null | string; // This is the old or parent journal ID + next_id?: null | string; // This is the new or child journal ID - external_id?: null | string; - import_id?: null | string; - code?: null | string; + external_id?: null | string; + import_id?: null | string; + code?: null | string; - for_type?: null | string; - for_id?: null | string; + for_type?: null | string; + for_id?: null | string; - // template?: null|boolean; // Is this a template journal? If true, it can be used to create new journals. + // template?: null|boolean; // Is this a template journal? If true, it can be used to create new journals. - type_code?: null | string; + type_code?: null | string; - account_id?: null | string; // Owner account of the journal - person_id?: null | string; // Owner person of the journal - // event_id?: null|string; // Assign to an event??? - // location_id?: null|string; // Assign to a location??? + account_id?: null | string; // Owner account of the journal + person_id?: null | string; // Owner person of the journal + // event_id?: null|string; // Assign to an event??? + // location_id?: null|string; // Assign to a location??? - name: string; // or the title - short_name?: null | string; // Short name for the journal, if any. Used for display purposes. - summary?: null | string; // LLM (AI) generated summary...??? - outline?: null | string; // LLM (AI) generated outline...??? + name: string; // or the title + short_name?: null | string; // Short name for the journal, if any. Used for display purposes. + summary?: null | string; // LLM (AI) generated summary...??? + outline?: null | string; // LLM (AI) generated outline...??? - description?: null | string; - description_md_html?: null | string; // Markdown converted to HTML based on description. Uses marked or similar library for conversion. - description_md_html_alt?: null | string; // Markdown converted to HTML based on description. Uses marked or similar library for conversion. - description_html?: null | string; - description_json?: null | string; + description?: null | string; + description_md_html?: null | string; // Markdown converted to HTML based on description. Uses marked or similar library for conversion. + description_md_html_alt?: null | string; // Markdown converted to HTML based on description. Uses marked or similar library for conversion. + description_html?: null | string; + description_json?: null | string; - start_datetime?: null | Date; - end_datetime?: null | Date; - timezone?: null | string; + start_datetime?: null | Date; + end_datetime?: null | Date; + timezone?: null | string; - alert?: null | boolean; // LLM (AI) generated summary...??? - alert_msg?: null | string; // LLM (AI) generated summary...??? + alert?: null | boolean; // LLM (AI) generated summary...??? + alert_msg?: null | string; // LLM (AI) generated summary...??? - sort_by?: null | string; // This is the sort by field - sort_by_desc?: null | string; // This is the sort by field description + sort_by?: null | string; // This is the sort by field + sort_by_desc?: null | string; // This is the sort by field description - cfg_json?: null | key_val; // This is the configuration JSON for the journal + cfg_json?: null | key_val; // This is the configuration JSON for the journal - data_json?: null | key_val; // We always need to store something extra... + data_json?: null | key_val; // We always need to store something extra... - ux_mode?: null | string; // 'mobile' or 'desktop' + ux_mode?: null | string; // 'mobile' or 'desktop' - // This only allows for basic access to the data. - passcode_read?: null | string; // For LLM (AI) generated summary...??? - passcode_read_expire?: null | Date; - passcode_write?: null | string; - passcode_write_expire?: null | Date; + // This only allows for basic access to the data. + passcode_read?: null | string; // For LLM (AI) generated summary...??? + passcode_read_expire?: null | Date; + passcode_write?: null | string; + passcode_write_expire?: null | Date; - passcode?: null | string; // For Journal Entry encryption password - passcode_timeout?: null | number; // Timeout in seconds + passcode?: null | string; // For Journal Entry encryption password + passcode_timeout?: null | number; // Timeout in seconds - private_passcode?: null | string; // Combine with the Journal passcode for Journal Entry encryption password + private_passcode?: null | string; // Combine with the Journal passcode for Journal Entry encryption password - auth_key?: null | string; // For Journal authorization without sign in + auth_key?: null | string; // For Journal authorization without sign in - enable: null | boolean; - hide?: null | boolean; - archive?: null | boolean; // Archive the journal - archive_on?: null | Date; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + archive?: null | boolean; // Archive the journal + archive_on?: null | Date; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; - tmp_sort_3?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; + tmp_sort_3?: null | string; - combined_passcode?: null | string; // For Journal Entry encryption password + combined_passcode?: null | string; // For Journal Entry encryption password - // Additional fields for convenience (database views) - file_count?: null | number; // Only files directly under a journal - journal_file_id_li_json?: null | string; + // Additional fields for convenience (database views) + file_count?: null | number; // Only files directly under a journal + journal_file_id_li_json?: null | string; - // One person - person__given_name?: null | string; - person__family_name?: null | string; - person__full_name?: null | string; - person__primary_email?: null | string; - person__passcode?: null | string; + // One person + person__given_name?: null | string; + person__family_name?: null | string; + person__full_name?: null | string; + person__primary_email?: null | string; + person__passcode?: null | string; - // JSON formatted key value pairs for multiple people: {id: name, email, etc.} - person__kv_json?: null | string; + // JSON formatted key value pairs for multiple people: {id: name, email, etc.} + person__kv_json?: null | string; - journal_name?: null | string; + journal_name?: null | string; - journal_location_code?: null | string; - journal_location_name?: null | string; + journal_location_code?: null | string; + journal_location_name?: null | string; - journal_entry_count?: null | number; + journal_entry_count?: null | number; - // A key value list of the entries - journal_entry_kv?: null | key_val; - journal_entry_li?: null | []; - // A key value list of the files - journal_file_kv?: null | key_val; - journal_file_li?: null | []; + // A key value list of the entries + journal_entry_kv?: null | key_val; + journal_entry_li?: null | []; + // A key value list of the files + journal_file_kv?: null | key_val; + journal_file_li?: null | []; - // journal_collection_id?: null|string; // For a collection of journals? + // journal_collection_id?: null|string; // For a collection of journals? - // Future standard fields!!! - obj_id?: null | string; - obj_ext_uid?: null | string; // Probably not needed for journals - obj_ext_id?: null | string; // Probably not needed for journals - obj_import_id?: null | string; // Probably not needed for journals - obj_code?: null | string; - obj_account_id?: null | string; - obj_passcode?: null | string; - obj_type?: null | string; // Should always be 'journal' in this case - obj_type_ver_id?: null | string; // The ID from the table for the object type - obj_name?: null | string; - obj_summary?: null | string; // LLM (AI) generated summary...??? - obj_outline?: null | string; // LLM (AI) generated outline...??? - obj_description?: null | string; // Probably not needed for journals - obj_enable?: null | boolean; - obj_enable_on?: null | Date; - obj_archive_on?: null | Date; - obj_hide?: null | boolean; - obj_priority?: null | number; - obj_sort?: null | number; - obj_group?: null | string; - obj_cfg_json?: null | string; - obj_notes?: null | string; - obj_created_on?: Date; - obj_updated_on?: null | Date; + // Future standard fields!!! + obj_id?: null | string; + obj_ext_uid?: null | string; // Probably not needed for journals + obj_ext_id?: null | string; // Probably not needed for journals + obj_import_id?: null | string; // Probably not needed for journals + obj_code?: null | string; + obj_account_id?: null | string; + obj_passcode?: null | string; + obj_type?: null | string; // Should always be 'journal' in this case + obj_type_ver_id?: null | string; // The ID from the table for the object type + obj_name?: null | string; + obj_summary?: null | string; // LLM (AI) generated summary...??? + obj_outline?: null | string; // LLM (AI) generated outline...??? + obj_description?: null | string; // Probably not needed for journals + obj_enable?: null | boolean; + obj_enable_on?: null | Date; + obj_archive_on?: null | Date; + obj_hide?: null | boolean; + obj_priority?: null | number; + obj_sort?: null | number; + obj_group?: null | string; + obj_cfg_json?: null | string; + obj_notes?: null | string; + obj_created_on?: Date; + obj_updated_on?: null | Date; } export const journal_field_li = [ - 'id', - 'journal_id', - 'snapshot_id', - 'previous_id', - 'next_id', - 'external_id', - 'import_id', - 'code', - 'for_type', - 'for_id', - 'type_code', - 'account_id', - 'person_id', - 'name', - 'short_name', - 'summary', - 'outline', - 'description', - 'description_md_html', - 'description_md_html_alt', - 'description_html', - 'description_json', - 'start_datetime', - 'end_datetime', - 'timezone', - 'alert', - 'alert_msg', - 'sort_by', - 'sort_by_desc', - 'cfg_json', - 'data_json', - 'ux_mode', - 'passcode_read', - 'passcode_read_expire', - 'passcode_write', - 'passcode_write_expire', - 'passcode_timeout', - 'private_passcode', - 'auth_key', - 'enable', - 'hide', - 'archive', // Archive the journal - 'archive_on', // Archive date - 'priority', // Priority flag - 'sort', // Sort order - 'group', // Group name - 'notes', // Notes about the journal - 'created_on', // Creation date - 'updated_on', // Last updated date + 'id', + 'journal_id', + 'snapshot_id', + 'previous_id', + 'next_id', + 'external_id', + 'import_id', + 'code', + 'for_type', + 'for_id', + 'type_code', + 'account_id', + 'person_id', + 'name', + 'short_name', + 'summary', + 'outline', + 'description', + 'description_md_html', + 'description_md_html_alt', + 'description_html', + 'description_json', + 'start_datetime', + 'end_datetime', + 'timezone', + 'alert', + 'alert_msg', + 'sort_by', + 'sort_by_desc', + 'cfg_json', + 'data_json', + 'ux_mode', + 'passcode_read', + 'passcode_read_expire', + 'passcode_write', + 'passcode_write_expire', + 'passcode_timeout', + 'private_passcode', + 'auth_key', + 'enable', + 'hide', + 'archive', // Archive the journal + 'archive_on', // Archive date + 'priority', // Priority flag + 'sort', // Sort order + 'group', // Group name + 'notes', // Notes about the journal + 'created_on', // Creation date + 'updated_on', // Last updated date - 'tmp_sort_1', // Temporary sort field 1 - 'tmp_sort_2', // Temporary sort field 2 - 'tmp_sort_3', // Temporary sort field 3 + 'tmp_sort_1', // Temporary sort field 1 + 'tmp_sort_2', // Temporary sort field 2 + 'tmp_sort_3', // Temporary sort field 3 - 'combined_passcode', // For Journal Entry encryption password - 'file_count', // Only files directly under a journal - 'journal_file_id_li_json', // JSON string of file IDs - 'person__given_name', // Person's given name - 'person__family_name', // Person's family name - 'person__full_name', // Person's full name - 'person__primary_email', // Person's primary email - 'person__passcode', // Person's passcode - 'person__kv_json', // JSON formatted key value pairs for multiple people - 'journal_name', // Journal name - 'journal_location_code', // Journal location code - 'journal_location_name', // Journal location name - 'journal_entry_count', // Count of journal entries - 'journal_entry_kv', // Key value list of the entries - 'journal_entry_li', // List of journal entries - 'journal_file_kv', // Key value list of the files - 'journal_file_li', // List of journal files + 'combined_passcode', // For Journal Entry encryption password + 'file_count', // Only files directly under a journal + 'journal_file_id_li_json', // JSON string of file IDs + 'person__given_name', // Person's given name + 'person__family_name', // Person's family name + 'person__full_name', // Person's full name + 'person__primary_email', // Person's primary email + 'person__passcode', // Person's passcode + 'person__kv_json', // JSON formatted key value pairs for multiple people + 'journal_name', // Journal name + 'journal_location_code', // Journal location code + 'journal_location_name', // Journal location name + 'journal_entry_count', // Count of journal entries + 'journal_entry_kv', // Key value list of the entries + 'journal_entry_li', // List of journal entries + 'journal_file_kv', // Key value list of the files + 'journal_file_li', // List of journal files - 'obj_id', // Object ID - 'obj_ext_uid', // External UID - 'obj_ext_id', // External ID - 'obj_import_id', // Import ID - 'obj_code', // Object code - 'obj_account_id', // Object account ID - 'obj_passcode', // Object passcode - 'obj_type', // Object type - 'obj_type_ver_id', // Object type version ID - 'obj_name', // Object name - 'obj_summary', // Object summary - 'obj_outline', // Object outline - 'obj_description', // Object description - 'obj_enable', // Object enable flag - 'obj_enable_on', // Object enable date - 'obj_archive_on', // Object archive date - 'obj_hide', // Object hide flag - 'obj_priority', // Object priority - 'obj_sort', // Object sort order - 'obj_group', // Object group name - 'obj_cfg_json', // Object configuration JSON - 'obj_notes', // Object notes - 'obj_created_on', // Object creation date - 'obj_updated_on' // Object last updated date + 'obj_id', // Object ID + 'obj_ext_uid', // External UID + 'obj_ext_id', // External ID + 'obj_import_id', // Import ID + 'obj_code', // Object code + 'obj_account_id', // Object account ID + 'obj_passcode', // Object passcode + 'obj_type', // Object type + 'obj_type_ver_id', // Object type version ID + 'obj_name', // Object name + 'obj_summary', // Object summary + 'obj_outline', // Object outline + 'obj_description', // Object description + 'obj_enable', // Object enable flag + 'obj_enable_on', // Object enable date + 'obj_archive_on', // Object archive date + 'obj_hide', // Object hide flag + 'obj_priority', // Object priority + 'obj_sort', // Object sort order + 'obj_group', // Object group name + 'obj_cfg_json', // Object configuration JSON + 'obj_notes', // Object notes + 'obj_created_on', // Object creation date + 'obj_updated_on' // Object last updated date ]; // Updated 2025-04-02 export interface Journal_Entry { - id: string; // actually "id_random" - journal_entry_id: string; + id: string; // actually "id_random" + journal_entry_id: string; - journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries. + journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries. - // Essentially this is a change log of journal entries - snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journal entries. - previous_id?: null | string; // This is the old or parent journal ID - next_id?: null | string; // This is the new or child journal ID + // Essentially this is a change log of journal entries + snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journal entries. + previous_id?: null | string; // This is the old or parent journal ID + next_id?: null | string; // This is the new or child journal ID - external_id?: null | string; - import_id?: null | string; - code?: null | string; + external_id?: null | string; + import_id?: null | string; + code?: null | string; - for_type?: null | string; - for_id?: null | string; + for_type?: null | string; + for_id?: null | string; - template?: null | boolean; // Is this a template journal entry? If true, it can be used to create new journal entries. + template?: null | boolean; // Is this a template journal entry? If true, it can be used to create new journal entries. - activity_code?: null | string; - category_code?: null | string; - topic_code?: null | string; - type_code?: null | string; - tags?: null | string; // Comma separated tags + activity_code?: null | string; + category_code?: null | string; + topic_code?: null | string; + type_code?: null | string; + tags?: null | string; // Comma separated tags - journal_entry_type?: null | string; // This is the type of journal entry + journal_entry_type?: null | string; // This is the type of journal entry - account_id?: null | string; // Owner account of the journal - person_id?: null | string; // Owner person of the journal - // event_id?: null|string; // Assign to an event??? - // location_id?: null|string; // Assign to a location??? + account_id?: null | string; // Owner account of the journal + person_id?: null | string; // Owner person of the journal + // event_id?: null|string; // Assign to an event??? + // location_id?: null|string; // Assign to a location??? - public?: null | boolean; - private?: null | boolean; - personal?: null | boolean; - professional?: null | boolean; + public?: null | boolean; + private?: null | boolean; + personal?: null | boolean; + professional?: null | boolean; - name: string; // or the title - short_name?: null | string; // Short name for the journal entry, if any. Used for display purposes. Most likely for the templates list. - summary?: null | string; // LLM (AI) generated summary...??? - outline?: null | string; // LLM (AI) generated outline...??? - // description?: null|string; // This is the description of the journal entry + name: string; // or the title + short_name?: null | string; // Short name for the journal entry, if any. Used for display purposes. Most likely for the templates list. + summary?: null | string; // LLM (AI) generated summary...??? + outline?: null | string; // LLM (AI) generated outline...??? + // description?: null|string; // This is the description of the journal entry - content?: null | string; - content_md_html?: null | string; // Markdown converted to HTML based on content. Uses marked or similar library for conversion. - content_md_html_alt?: null | string; // Markdown converted to HTML based on content. Uses marked or similar library for conversion. - content_html?: null | string; - content_json?: null | string; - content_encrypted?: null | string; // This is the encrypted content of the journal entry + content?: null | string; + content_md_html?: null | string; // Markdown converted to HTML based on content. Uses marked or similar library for conversion. + content_md_html_alt?: null | string; // Markdown converted to HTML based on content. Uses marked or similar library for conversion. + content_html?: null | string; + content_json?: null | string; + content_encrypted?: null | string; // This is the encrypted content of the journal entry - history?: null | string; // This is the history of the journal entry; a log - history_encrypted?: null | string; // This is the encrypted history of the journal entry + history?: null | string; // This is the history of the journal entry; a log + history_encrypted?: null | string; // This is the encrypted history of the journal entry - passcode_hash?: null | string; // This is the passcode hash for the journal entry to look up the passcode + passcode_hash?: null | string; // This is the passcode hash for the journal entry to look up the passcode - start_datetime?: null | Date; - end_datetime?: null | Date; - timezone?: null | string; - seconds?: null | number; // Duration in seconds + start_datetime?: null | Date; + end_datetime?: null | Date; + timezone?: null | string; + seconds?: null | number; // Duration in seconds - location?: null | string; // Location of the journal entry - latitude?: null | number; // Latitude of the journal entry - longitude?: null | number; // Longitude of the journal entry + location?: null | string; // Location of the journal entry + latitude?: null | number; // Latitude of the journal entry + longitude?: null | number; // Longitude of the journal entry - billable?: null | boolean; // Is this billable? - bill_to?: null | string; // Who to bill for this journal entry - bill_rate?: null | number; // Rate to bill for this journal entry - billable_minutes?: null | number; // Billable minutes for this journal entry + billable?: null | boolean; // Is this billable? + bill_to?: null | string; // Who to bill for this journal entry + bill_rate?: null | number; // Rate to bill for this journal entry + billable_minutes?: null | number; // Billable minutes for this journal entry - alert?: null | boolean; // LLM (AI) generated summary...??? - alert_msg?: null | string; // LLM (AI) generated summary...??? + alert?: null | boolean; // LLM (AI) generated summary...??? + alert_msg?: null | string; // LLM (AI) generated summary...??? - parent_id?: null | string; // This is the parent journal entry ID. If deleted, then delete all children journal entries. - related_entry_id_li?: null | key_val; // List of related journal entry IDs + parent_id?: null | string; // This is the parent journal entry ID. If deleted, then delete all children journal entries. + related_entry_id_li?: null | key_val; // List of related journal entry IDs - // cfg_json?: null|key_val; // This is the configuration JSON for the journal entry - data_json?: null | key_val; // We always need to store something extra... + // cfg_json?: null|key_val; // This is the configuration JSON for the journal entry + data_json?: null | key_val; // We always need to store something extra... - // This only allows for basic access to the content. - passcode_read?: null | string; // For LLM (AI) generated summary...??? - passcode_read_expire?: null | Date; - passcode_write?: null | string; - passcode_write_expire?: null | Date; + // This only allows for basic access to the content. + passcode_read?: null | string; // For LLM (AI) generated summary...??? + passcode_read_expire?: null | Date; + passcode_write?: null | string; + passcode_write_expire?: null | Date; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; - tmp_sort_3?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; + tmp_sort_3?: null | string; - // Additional fields for convenience (database views) - file_count?: null | number; // Only files directly under a journal - journal_file_id_li_json?: null | string; + // Additional fields for convenience (database views) + file_count?: null | number; // Only files directly under a journal + journal_file_id_li_json?: null | string; - journal_code?: null | string; // This is the code for the journal entry - journal_name?: null | string; // This is the name for the journal entry + journal_code?: null | string; // This is the code for the journal entry + journal_name?: null | string; // This is the name for the journal entry - // One person - person__given_name?: null | string; - person__family_name?: null | string; - person__full_name?: null | string; - person__primary_email?: null | string; - person__passcode?: null | string; + // One person + person__given_name?: null | string; + person__family_name?: null | string; + person__full_name?: null | string; + person__primary_email?: null | string; + person__passcode?: null | string; - // JSON formatted key value pairs for multiple people: {id: name, email, etc.} - person__kv_json?: null | string; + // JSON formatted key value pairs for multiple people: {id: name, email, etc.} + person__kv_json?: null | string; - // A key value list of the files - journal_file_kv?: null | key_val; - journal_file_li?: null | []; + // A key value list of the files + journal_file_kv?: null | key_val; + journal_file_li?: null | []; - // journal_collection_id?: null|string; // For a collection of journal entries? + // journal_collection_id?: null|string; // For a collection of journal entries? - // Future standard fields!!! - obj_id?: null | string; - obj_ext_uid?: null | string; // Probably not needed for journal entries - obj_ext_id?: null | string; // Probably not needed for journal entries - obj_import_id?: null | string; // Probably not needed for journal entries - obj_code?: null | string; - obj_account_id?: null | string; - obj_passcode?: null | string; - obj_type?: null | string; // Should always be 'journal' in this case - obj_type_ver_id?: null | string; // The ID from the table for the object type - obj_name?: null | string; - obj_summary?: null | string; // LLM (AI) generated summary...??? - obj_outline?: null | string; // LLM (AI) generated outline...??? - obj_description?: null | string; // Probably not needed for journal entries - obj_enable?: null | boolean; - obj_enable_on?: null | Date; - obj_archive_on?: null | Date; - obj_hide?: null | boolean; - obj_priority?: null | number; - obj_sort?: null | number; - obj_group?: null | string; - obj_cfg_json?: null | string; - obj_notes?: null | string; - obj_created_on?: Date; - obj_updated_on?: null | Date; + // Future standard fields!!! + obj_id?: null | string; + obj_ext_uid?: null | string; // Probably not needed for journal entries + obj_ext_id?: null | string; // Probably not needed for journal entries + obj_import_id?: null | string; // Probably not needed for journal entries + obj_code?: null | string; + obj_account_id?: null | string; + obj_passcode?: null | string; + obj_type?: null | string; // Should always be 'journal' in this case + obj_type_ver_id?: null | string; // The ID from the table for the object type + obj_name?: null | string; + obj_summary?: null | string; // LLM (AI) generated summary...??? + obj_outline?: null | string; // LLM (AI) generated outline...??? + obj_description?: null | string; // Probably not needed for journal entries + obj_enable?: null | boolean; + obj_enable_on?: null | Date; + obj_archive_on?: null | Date; + obj_hide?: null | boolean; + obj_priority?: null | number; + obj_sort?: null | number; + obj_group?: null | string; + obj_cfg_json?: null | string; + obj_notes?: null | string; + obj_created_on?: Date; + obj_updated_on?: null | Date; } export const journal_entry_field_li = [ - 'id', - 'journal_entry_id', - 'journal_id', - 'code', - 'for_type', - 'for_id', - 'template', - 'activity_code', - 'category_code', - 'topic_code', - 'type_code', - 'tags', - 'journal_entry_type', - 'account_id', - 'person_id', - 'public', - 'private', - 'personal', - 'professional', - 'name', - 'short_name', - 'summary', - 'outline', - 'content', - 'content_md_html', - 'content_md_html_alt', - 'content_html', - 'content_json', - 'content_encrypted', - 'history', - 'history_encrypted', - 'passcode_hash', - 'start_datetime', - 'end_datetime', - 'timezone', - 'seconds', - 'location', - 'latitude', - 'longitude', - 'billable', - 'bill_to', - 'bill_rate', - 'billable_minutes', - 'alert', - 'alert_msg', - 'parent_id', - 'related_entry_id_li', - 'data_json', - 'passcode_read', - 'passcode_read_expire', - 'passcode_write', - 'passcode_write_expire', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'id', + 'journal_entry_id', + 'journal_id', + 'code', + 'for_type', + 'for_id', + 'template', + 'activity_code', + 'category_code', + 'topic_code', + 'type_code', + 'tags', + 'journal_entry_type', + 'account_id', + 'person_id', + 'public', + 'private', + 'personal', + 'professional', + 'name', + 'short_name', + 'summary', + 'outline', + 'content', + 'content_md_html', + 'content_md_html_alt', + 'content_html', + 'content_json', + 'content_encrypted', + 'history', + 'history_encrypted', + 'passcode_hash', + 'start_datetime', + 'end_datetime', + 'timezone', + 'seconds', + 'location', + 'latitude', + 'longitude', + 'billable', + 'bill_to', + 'bill_rate', + 'billable_minutes', + 'alert', + 'alert_msg', + 'parent_id', + 'related_entry_id_li', + 'data_json', + 'passcode_read', + 'passcode_read_expire', + 'passcode_write', + 'passcode_write_expire', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - 'tmp_sort_1', - 'tmp_sort_2', - 'tmp_sort_3', + 'tmp_sort_1', + 'tmp_sort_2', + 'tmp_sort_3', - 'file_count', - 'journal_file_id_li_json', - 'journal_code', - 'journal_name', - 'person__given_name', - 'person__family_name', - 'person__full_name', - 'person__primary_email', - 'person__passcode', - 'person__kv_json', - 'journal_file_kv', - 'journal_file_li', + 'file_count', + 'journal_file_id_li_json', + 'journal_code', + 'journal_name', + 'person__given_name', + 'person__family_name', + 'person__full_name', + 'person__primary_email', + 'person__passcode', + 'person__kv_json', + 'journal_file_kv', + 'journal_file_li', - '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' ]; // Updated 2024-06-10 export class MySubClassedDexie extends Dexie { - // We just tell the typing system this is the case - journal!: Table; - journal_entry!: Table; + // We just tell the typing system this is the case + journal!: Table; + journal_entry!: Table; - constructor() { - super('ae_journals_db'); - this.version(4).stores({ - journal: ` + constructor() { + super('ae_journals_db'); + this.version(4).stores({ + journal: ` id, journal_id, code, account_id, @@ -523,7 +523,7 @@ export class MySubClassedDexie extends Dexie { timezone, tmp_sort_1, tmp_sort_2, tmp_sort_3, enable, hide, priority, sort, group, created_on, updated_on`, - journal_entry: ` + journal_entry: ` id, journal_entry_id, journal_id, code, @@ -534,8 +534,8 @@ export class MySubClassedDexie extends Dexie { timezone, tmp_sort_1, tmp_sort_2, tmp_sort_3, enable, hide, priority, sort, group, created_on, updated_on` - }); - } + }); + } } export const db_journals = new MySubClassedDexie(); diff --git a/src/lib/ae_posts/ae_posts__post.ts b/src/lib/ae_posts/ae_posts__post.ts index 0b5df996..f2b0f287 100644 --- a/src/lib/ae_posts/ae_posts__post.ts +++ b/src/lib/ae_posts/ae_posts__post.ts @@ -11,650 +11,650 @@ const ae_promises: key_val = {}; // Updated 2025-06-23 export async function load_ae_obj_id__post({ - api_cfg, - post_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - inc_comment_li = false, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + inc_comment_li = false, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - inc_comment_li?: boolean; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + inc_comment_li?: boolean; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__post() *** post_id=${post_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__post() *** post_id=${post_id}`); + } - ae_promises.load__post_obj = await api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'post', - obj_id: post_id, - use_alt_table: true, - use_alt_base: false, - params: params, - log_lvl: log_lvl - }) - .then(async function (post_obj_get_result) { - if (post_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_props({ - obj_li: [post_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'post', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__post_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'post', + obj_id: post_id, + use_alt_table: true, + use_alt_base: false, + params: params, + log_lvl: log_lvl + }) + .then(async function (post_obj_get_result) { + if (post_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_props({ + obj_li: [post_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'post', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__post({ - // obj_type: 'post', - // obj_li: [post_obj_get_result], - // log_lvl: log_lvl - // }); - } - return post_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // // This is expecting a list + // db_save_ae_obj_li__post({ + // obj_type: 'post', + // obj_li: [post_obj_get_result], + // log_lvl: log_lvl + // }); + } + return post_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__post_obj:', ae_promises.load__post_obj); - } - if (!ae_promises.load__post_obj) { - console.log(`ERROR: Posts - Post - The post with ID ${post_id} was not found.`); - return ae_promises.load__post_obj; // Return null if the post was not found - } + if (log_lvl) { + console.log('ae_promises.load__post_obj:', ae_promises.load__post_obj); + } + if (!ae_promises.load__post_obj) { + console.log(`ERROR: Posts - Post - The post with ID ${post_id} was not found.`); + return ae_promises.load__post_obj; // Return null if the post was not found + } - if (inc_comment_li) { - // Load the comments for the post - if (log_lvl) { - console.log(`Need to load the comment list for the post now`); - } - const load_post_comment_obj_li = load_ae_obj_li__post_comment({ - api_cfg: api_cfg, - for_obj_type: 'post', - for_obj_id: post_id, - enabled: enabled, // all, disabled, enabled - hidden: hidden, // all, hidden, not_hidden - limit: limit, // Limit for the comments - offset: offset, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((post_comment_obj_li) => { - if (log_lvl) { - console.log(`post_comment_obj_li = `, post_comment_obj_li); - } - return post_comment_obj_li; - }); + if (inc_comment_li) { + // Load the comments for the post + if (log_lvl) { + console.log(`Need to load the comment list for the post now`); + } + const load_post_comment_obj_li = load_ae_obj_li__post_comment({ + api_cfg: api_cfg, + for_obj_type: 'post', + for_obj_id: post_id, + enabled: enabled, // all, disabled, enabled + hidden: hidden, // all, hidden, not_hidden + limit: limit, // Limit for the comments + offset: offset, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((post_comment_obj_li) => { + if (log_lvl) { + console.log(`post_comment_obj_li = `, post_comment_obj_li); + } + return post_comment_obj_li; + }); - if (log_lvl) { - console.log(`post_comment_obj_li = `, load_post_comment_obj_li); - } - ae_promises.load__post_obj.post_comment_li = load_post_comment_obj_li; - } + if (log_lvl) { + console.log(`post_comment_obj_li = `, load_post_comment_obj_li); + } + ae_promises.load__post_obj.post_comment_li = load_post_comment_obj_li; + } - return ae_promises.load__post_obj; + return ae_promises.load__post_obj; } // Updated 2025-06-23 export async function load_ae_obj_li__post({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - qry_archive_on = null, - inc_comment_li = false, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - updated_on: 'DESC', - created_on: 'DESC', - title: 'ASC' - }, - params = {}, - params_json = null, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + qry_archive_on = null, + inc_comment_li = false, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + updated_on: 'DESC', + created_on: 'DESC', + title: 'ASC' + }, + params = {}, + params_json = null, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - qry_archive_on?: boolean | null | string; - inc_comment_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params_json?: null | key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + qry_archive_on?: boolean | null | string; + inc_comment_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params_json?: null | key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__post() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + 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 - if (!params_json) { - params_json = {}; - } + // 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 + if (!params_json) { + params_json = {}; + } - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_archive_on) { - // let qry_param = - // { - // type: "AND", - // field: "archive_on", - // operator: ">", - // value: qry_archive_on - // }; - // params_json['qry'].push(qry_param); - } + if (qry_archive_on) { + // let qry_param = + // { + // type: "AND", + // field: "archive_on", + // operator: ">", + // value: qry_archive_on + // }; + // params_json['qry'].push(qry_param); + } - // if (qry_archive_on) { - // if (!params_json['and_qry']) { - // params_json['and_qry'] = {}; - // } + // if (qry_archive_on) { + // if (!params_json['and_qry']) { + // params_json['and_qry'] = {}; + // } - // params_json['and_qry']['archive_on'] = qry_archive_on; - // } else if (qry_archive_on === false) { - // if (!params_json['and_qry']) { - // params_json['and_qry'] = {}; - // } + // params_json['and_qry']['archive_on'] = qry_archive_on; + // } else if (qry_archive_on === false) { + // if (!params_json['and_qry']) { + // params_json['and_qry'] = {}; + // } - // if (log_lvl) { - // console.log('qry_archive_on is false!'); - // } - // params_json['and_qry']['conference'] = qry_archive_on; - // } + // if (log_lvl) { + // console.log('qry_archive_on is false!'); + // } + // params_json['and_qry']['conference'] = qry_archive_on; + // } - if (log_lvl) { - console.log('params_json:', params_json); - } + if (log_lvl) { + console.log('params_json:', params_json); + } - ae_promises.load__post_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'post', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (post_obj_li_get_result) { - if (post_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_props({ - obj_li: post_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'post', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__post_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'post', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (post_obj_li_get_result) { + if (post_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_props({ + obj_li: post_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'post', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__post({ - // obj_type: 'post', - // obj_li: post_obj_li_get_result, - // log_lvl: log_lvl - // }); - } - return post_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__post({ + // obj_type: 'post', + // obj_li: post_obj_li_get_result, + // log_lvl: log_lvl + // }); + } + return post_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__post_obj_li:', ae_promises.load__post_obj_li); - } + if (log_lvl) { + console.log('ae_promises.load__post_obj_li:', ae_promises.load__post_obj_li); + } - if (inc_comment_li) { - // Load the comments for the posts - if (log_lvl) { - 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++) { - const post_obj = ae_promises.load__post_obj_li[i]; - const post_id = post_obj.post_id_random; + if (inc_comment_li) { + // Load the comments for the posts + if (log_lvl) { + 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++) { + const post_obj = ae_promises.load__post_obj_li[i]; + const post_id = post_obj.post_id_random; - const load_post_comment_obj_li = load_ae_obj_li__post_comment({ - api_cfg: api_cfg, - for_obj_type: 'post', - for_obj_id: post_id, - enabled: enabled, - hidden: hidden, - limit: limit, - offset: offset, - params: params, - try_cache: try_cache, - log_lvl: log_lvl - }).then((post_comment_obj_li) => { - if (log_lvl) { - console.log(`post_comment_obj_li = `, post_comment_obj_li); - } + const load_post_comment_obj_li = load_ae_obj_li__post_comment({ + api_cfg: api_cfg, + for_obj_type: 'post', + for_obj_id: post_id, + enabled: enabled, + hidden: hidden, + limit: limit, + offset: offset, + params: params, + try_cache: try_cache, + log_lvl: log_lvl + }).then((post_comment_obj_li) => { + if (log_lvl) { + console.log(`post_comment_obj_li = `, post_comment_obj_li); + } - return post_comment_obj_li; - }); + return post_comment_obj_li; + }); - if (log_lvl) { - console.log(`load_post_comment_obj_li = `, load_post_comment_obj_li); - } - } - } + if (log_lvl) { + console.log(`load_post_comment_obj_li = `, load_post_comment_obj_li); + } + } + } - return ae_promises.load__post_obj_li; + return ae_promises.load__post_obj_li; } // Updated 2025-06-23 export async function create_ae_obj__post({ - api_cfg, - account_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__post() *** account_id=${account_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__post() *** account_id=${account_id}`); + } - if (!account_id) { - console.log(`ERROR: Posts - Post - account_id required to create`); - return false; - } + if (!account_id) { + console.log(`ERROR: Posts - Post - account_id required to create`); + return false; + } - ae_promises.create__post = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'post', - fields: { - account_id_random: account_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (post_obj_create_result) { - if (post_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_props({ - obj_li: [post_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'post', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__post = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'post', + fields: { + account_id_random: account_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (post_obj_create_result) { + if (post_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_props({ + obj_li: [post_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'post', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__post( - // { - // obj_type: 'post', - // obj_li: [post_obj_create_result], - // log_lvl: log_lvl - // }); - } - return post_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__post( + // { + // obj_type: 'post', + // obj_li: [post_obj_create_result], + // log_lvl: log_lvl + // }); + } + return post_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__post:', ae_promises.create__post); - } - return ae_promises.create__post; + if (log_lvl) { + console.log('ae_promises.create__post:', ae_promises.create__post); + } + return ae_promises.create__post; } // Updated 2024-11-08 export async function delete_ae_obj_id__post({ - api_cfg, - post_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__post() *** post_id=${post_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id__post() *** post_id=${post_id}`); + } - ae_promises.delete__post_obj = await api - .delete_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'post', - obj_id: post_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for post_id=${post_id}`); - } - db_posts.post.delete(post_id); // Delete from the DB no matter what. - } - }); + ae_promises.delete__post_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'post', + obj_id: post_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log(`Attempting to remove IDB entry for post_id=${post_id}`); + } + db_posts.post.delete(post_id); // Delete from the DB no matter what. + } + }); - if (log_lvl) { - console.log('ae_promises.delete__post_obj:', ae_promises.delete__post_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__post_obj:', ae_promises.delete__post_obj); + } - return ae_promises.delete__post_obj; + return ae_promises.delete__post_obj; } // Updated 2025-06-23 export async function update_ae_obj__post({ - api_cfg, - post_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** update_ae_obj__post() *** post_id=${post_id}`, data_kv); - } + if (log_lvl) { + console.log(`*** update_ae_obj__post() *** post_id=${post_id}`, data_kv); + } - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'post', - obj_id: post_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'post', + obj_id: post_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'post', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'post', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__post({ - // obj_type: 'post', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update post.'); - return null; - } + // await db_save_ae_obj_li__post({ + // obj_type: 'post', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update post.'); + return null; + } } // This new function is using CRUD v2. This should allow for more flexibility in the queries. // Updated 2024-09-25 export async function qry__post({ - api_cfg, - account_id, - qry_str, - qry_files, - qry_start_datetime, // Example greater than: '2024-10-24' - enabled = 'enabled', - hidden = 'not_hidden', - limit = 50, - offset = 0, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + account_id, + qry_str, + qry_files, + qry_start_datetime, // Example greater than: '2024-10-24' + enabled = 'enabled', + hidden = 'not_hidden', + limit = 50, + offset = 0, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - account_id: any; - qry_str?: string; - qry_files?: null | boolean; - qry_start_datetime?: null | string; // Greater than this datetime - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden - limit?: number; - offset?: number; - params?: any; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + account_id: any; + qry_str?: string; + qry_files?: null | boolean; + qry_start_datetime?: null | string; // Greater than this datetime + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; // all, disabled, enabled + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden + limit?: number; + offset?: number; + params?: any; + try_cache?: boolean; + 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 hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden - // let limit: number = (params.qry__limit ?? 25); // 99 - // let offset: number = (params.qry__offset ?? 0); // 0 + // let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + // let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + // let limit: number = (params.qry__limit ?? 25); // 99 + // let offset: number = (params.qry__offset ?? 0); // 0 - const params_json: key_val = {}; + const params_json: key_val = {}; - // if (qry_str && qry_str.length > 2) { - // params_json['ft_qry'] = {}; - // params_json['ft_qry']['default_qry_str'] = qry_str; - // } + // if (qry_str && qry_str.length > 2) { + // params_json['ft_qry'] = {}; + // params_json['ft_qry']['default_qry_str'] = qry_str; + // } - params_json['qry'] = []; + params_json['qry'] = []; - if (qry_files === true) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: '>', - value: 0 - }; - params_json['qry'].push(qry_param); - } else if (qry_files === false) { - const qry_param = { - type: 'AND', - field: 'file_count_all', - operator: 'IS', - value: null - }; - params_json['qry'].push(qry_param); - } + if (qry_files === true) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: '>', + value: 0 + }; + params_json['qry'].push(qry_param); + } else if (qry_files === false) { + const qry_param = { + type: 'AND', + field: 'file_count_all', + operator: 'IS', + value: null + }; + params_json['qry'].push(qry_param); + } - if (qry_start_datetime) { - const qry_param = { - type: 'AND', - field: 'start_datetime', - operator: '>', - value: qry_start_datetime - }; - params_json['qry'].push(qry_param); - } + if (qry_start_datetime) { + const qry_param = { + type: 'AND', + field: 'start_datetime', + operator: '>', + value: qry_start_datetime + }; + params_json['qry'].push(qry_param); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'post', - for_obj_type: 'account', - for_obj_id: account_id, - use_alt_tbl: true, // NOTE: We want to use the alt table for post searching - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (post_obj_li_get_result) { - if (post_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_props({ - obj_li: post_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'post', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return post_obj_li_get_result; - } else { - return []; - } - }); + ae_promises.load__post_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'post', + for_obj_type: 'account', + for_obj_id: account_id, + use_alt_tbl: true, // NOTE: We want to use the alt table for post searching + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (post_obj_li_get_result) { + if (post_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_props({ + obj_li: post_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'post', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return post_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__post_obj_li:', ae_promises.load__post_obj_li); - } - return ae_promises.load__post_obj_li; + if (log_lvl) { + console.log('ae_promises.load__post_obj_li:', ae_promises.load__post_obj_li); + } + return ae_promises.load__post_obj_li; } // Updated 2024-09-25 @@ -795,57 +795,57 @@ export async function qry__post({ // Updated 2025-06-04 export const properties_to_save = [ - 'id', - 'post_id', - // 'post_id_random', + 'id', + 'post_id', + // 'post_id_random', - 'account_id', - // 'account_id_random', + 'account_id', + // 'account_id_random', - 'external_person_id', + 'external_person_id', - 'topic_id', - 'topic', - 'topic_name', + 'topic_id', + 'topic', + 'topic_name', - 'name', - 'title', - 'content', + 'name', + 'title', + 'content', - 'anonymous', - 'full_name', - 'email', - 'notify', + 'anonymous', + 'full_name', + 'email', + 'notify', - 'enable_comments', + 'enable_comments', - 'archive', - 'archive_on', + 'archive', + 'archive_on', - 'linked_li_json', - 'cfg_json', + 'linked_li_json', + 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2', - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2', + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view - 'post_comment_count' + // From SQL view + 'post_comment_count' - // A key value list of the comments - // 'post_comment_kv', - // 'post_comment_li', + // A key value list of the comments + // 'post_comment_kv', + // 'post_comment_li', ]; /** @@ -853,92 +853,92 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-06-04 export async function process_ae_obj__post_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'post', - log_lvl, - specific_processor: (obj) => { - // Post-specific aliasing and computed sort fields, overriding generic ones if needed - obj.name = obj.title; // Map title to name - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'post', + log_lvl, + specific_processor: (obj) => { + // Post-specific aliasing and computed sort fields, overriding generic ones if needed + obj.name = obj.title; // Map title to name + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_posts/ae_posts__post_comment.ts b/src/lib/ae_posts/ae_posts__post_comment.ts index 77c661c9..783f74ab 100644 --- a/src/lib/ae_posts/ae_posts__post_comment.ts +++ b/src/lib/ae_posts/ae_posts__post_comment.ts @@ -9,446 +9,451 @@ const ae_promises: key_val = {}; // Updated 2025-06-23 export async function load_ae_obj_id__post_comment({ - api_cfg, - post_comment_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_comment_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_comment_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_comment_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'post_comment', - obj_id: post_comment_id, - use_alt_table: false, - use_alt_base: false, - params: params, - log_lvl: log_lvl - }) - .then(async function (post_comment_obj_get_result) { - if (post_comment_obj_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_comment_props({ - obj_li: [post_comment_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'comment', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__post_comment_obj = await api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'post_comment', + obj_id: post_comment_id, + use_alt_table: false, + use_alt_base: false, + params: params, + log_lvl: log_lvl + }) + .then(async function (post_comment_obj_get_result) { + if (post_comment_obj_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_comment_props({ + obj_li: [post_comment_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'comment', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // // This is expecting a list - // db_save_ae_obj_li__post_comment({ - // obj_type: 'post_comment', - // obj_li: [post_comment_obj_get_result], - // log_lvl: log_lvl + // // This is expecting a list + // db_save_ae_obj_li__post_comment({ + // obj_type: 'post_comment', + // obj_li: [post_comment_obj_get_result], + // log_lvl: log_lvl - // }); - } - return post_comment_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // }); + } + return post_comment_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - return ae_promises.load__post_comment_obj; + return ae_promises.load__post_comment_obj; } // Updated 2025-06-23 export async function load_ae_obj_li__post_comment({ - api_cfg, - for_obj_type = 'post', - for_obj_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - updated_on: 'DESC', - created_on: 'DESC', - title: 'ASC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'post', + for_obj_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + updated_on: 'DESC', + created_on: 'DESC', + title: 'ASC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__post_comment() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_li__post_comment() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); + } - const params_json: key_val = {}; + const params_json: key_val = {}; - if (log_lvl) { - console.log('params_json:', params_json); - } + if (log_lvl) { + console.log('params_json:', params_json); + } - ae_promises.load__post_comment_obj_li = await api - .get_ae_obj_li_for_obj_id_crud_v2({ - api_cfg: api_cfg, - obj_type: 'post_comment', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (post_comment_obj_li_get_result) { - if (post_comment_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_comment_props({ - obj_li: post_comment_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'comment', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.load__post_comment_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'post_comment', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (post_comment_obj_li_get_result) { + if (post_comment_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_comment_props({ + obj_li: post_comment_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'comment', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__post_comment({ - // obj_type: 'post_comment', - // obj_li: post_comment_obj_li_get_result, - // log_lvl: log_lvl - // }); - } - return post_comment_obj_li_get_result; - } else { - return []; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + // db_save_ae_obj_li__post_comment({ + // obj_type: 'post_comment', + // obj_li: post_comment_obj_li_get_result, + // log_lvl: log_lvl + // }); + } + return post_comment_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__post_comment_obj_li:', ae_promises.load__post_comment_obj_li); - } + if (log_lvl) { + console.log( + 'ae_promises.load__post_comment_obj_li:', + ae_promises.load__post_comment_obj_li + ); + } - return ae_promises.load__post_comment_obj_li; + return ae_promises.load__post_comment_obj_li; } // Updated 2025-06-23 export async function create_ae_obj__post_comment({ - api_cfg, - post_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj__post_comment() *** post_id=${post_id}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj__post_comment() *** post_id=${post_id}`); + } - if (!post_id) { - console.log(`ERROR: Posts - Comment - post_id required to create`); - return false; - } + if (!post_id) { + console.log(`ERROR: Posts - Comment - post_id required to create`); + return false; + } - ae_promises.create__post_comment = await api - .create_ae_obj_crud({ - api_cfg: api_cfg, - obj_type: 'post_comment', - fields: { - post_id_random: post_id, - ...data_kv - }, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }) - .then(async function (post_comment_obj_create_result) { - if (post_comment_obj_create_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_comment_props({ - obj_li: [post_comment_obj_create_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'comment', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + ae_promises.create__post_comment = await api + .create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'post_comment', + fields: { + post_id_random: post_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(async function (post_comment_obj_create_result) { + if (post_comment_obj_create_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_comment_props({ + obj_li: [post_comment_obj_create_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'comment', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // db_save_ae_obj_li__post_comment( - // { - // obj_type: 'post_comment', - // obj_li: [post_comment_obj_create_result], - // log_lvl: log_lvl - // }); - } - return post_comment_obj_create_result; - } else { - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () {}); + // db_save_ae_obj_li__post_comment( + // { + // obj_type: 'post_comment', + // obj_li: [post_comment_obj_create_result], + // log_lvl: log_lvl + // }); + } + return post_comment_obj_create_result; + } else { + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () {}); - if (log_lvl) { - console.log('ae_promises.create__post_comment:', ae_promises.create__post_comment); - } - return ae_promises.create__post_comment; + if (log_lvl) { + console.log('ae_promises.create__post_comment:', ae_promises.create__post_comment); + } + return ae_promises.create__post_comment; } // Updated 2024-11-08 export async function delete_ae_obj_id__post_comment({ - api_cfg, - post_comment_id, - method = 'delete', // 'delete', 'disable', 'hide' - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_comment_id, + method = 'delete', // 'delete', 'disable', 'hide' + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_comment_id: string; - method?: string; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_comment_id: string; + method?: string; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id__post_comment() *** post_comment_id=${post_comment_id}`); - } + if (log_lvl) { + 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({ - api_cfg: api_cfg, - obj_type: 'post_comment', - obj_id: post_comment_id, - key: api_cfg.api_crud_super_key, - params: params, - method: method, - log_lvl: log_lvl - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }) - .finally(function () { - if (try_cache) { - if (log_lvl) { - console.log(`Attempting to remove IDB entry for post_comment_id=${post_comment_id}`); - } - db_posts.comment.delete(post_comment_id); // Delete from the DB no matter what. - } - }); + ae_promises.delete__post_comment_obj = await api + .delete_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'post_comment', + obj_id: post_comment_id, + key: api_cfg.api_crud_super_key, + params: params, + method: method, + log_lvl: log_lvl + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + if (try_cache) { + if (log_lvl) { + console.log( + `Attempting to remove IDB entry for post_comment_id=${post_comment_id}` + ); + } + db_posts.comment.delete(post_comment_id); // Delete from the DB no matter what. + } + }); - if (log_lvl) { - console.log('ae_promises.delete__post_comment_obj:', ae_promises.delete__post_comment_obj); - } + if (log_lvl) { + console.log('ae_promises.delete__post_comment_obj:', ae_promises.delete__post_comment_obj); + } - return ae_promises.delete__post_comment_obj; + return ae_promises.delete__post_comment_obj; } // Updated 2025-06-23 export async function update_ae_obj__post_comment({ - api_cfg, - post_comment_id, - data_kv, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + post_comment_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - post_comment_id: string; - data_kv: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + post_comment_id: string; + data_kv: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** update_ae_obj__post_comment() *** post_comment_id=${post_comment_id}`, - data_kv - ); - } + if (log_lvl) { + console.log( + `*** update_ae_obj__post_comment() *** post_comment_id=${post_comment_id}`, + data_kv + ); + } - // Perform the API update - const result = await api.update_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'post_comment', - obj_id: post_comment_id, - fields: data_kv, - key: api_cfg.api_crud_super_key, - params: params, - return_obj: true, - log_lvl: log_lvl - }); + // Perform the API update + const result = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'post_comment', + obj_id: post_comment_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }); - // Handle the result - if (result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__post_comment_props({ - obj_li: [result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_posts, - table_name: 'comment', - obj_li: processed_obj_li, - properties_to_save: properties_to_save, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } + // Handle the result + if (result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__post_comment_props({ + obj_li: [result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_posts, + table_name: 'comment', + obj_li: processed_obj_li, + properties_to_save: properties_to_save, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } - // await db_save_ae_obj_li__post_comment({ - // obj_type: 'post_comment', - // obj_li: [result], - // log_lvl: log_lvl, - // }); - } - return result; - } else { - console.error('Failed to update post comment.'); - return null; - } + // await db_save_ae_obj_li__post_comment({ + // obj_type: 'post_comment', + // obj_li: [result], + // log_lvl: log_lvl, + // }); + } + return result; + } else { + console.error('Failed to update post comment.'); + return null; + } } // Updated 2025-06-04 export const properties_to_save = [ - 'id', - 'post_comment_id', - // 'post_comment_id_random', + 'id', + 'post_comment_id', + // 'post_comment_id_random', - 'post_id', - // 'post_id_random', + 'post_id', + // 'post_id_random', - 'external_person_id', + 'external_person_id', - 'name', - 'title', - 'content', + 'name', + 'title', + 'content', - 'anonymous', - 'full_name', - 'email', - 'notify', + 'anonymous', + 'full_name', + 'email', + 'notify', - 'linked_li_json', - 'cfg_json', + 'linked_li_json', + 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' - // 'tmp_sort_a', - // 'tmp_sort_b', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' + // 'tmp_sort_a', + // 'tmp_sort_b', - // From SQL view + // From SQL view ]; /** @@ -456,91 +461,91 @@ export const properties_to_save = [ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2025-06-04 export async function process_ae_obj__post_comment_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'post_comment', - log_lvl, - specific_processor: (obj) => { - // Post comment-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(2, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'post_comment', + log_lvl, + specific_processor: (obj) => { + // Post comment-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(2, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } diff --git a/src/lib/ae_posts/ae_posts_functions.ts b/src/lib/ae_posts/ae_posts_functions.ts index a0514539..97a6326b 100644 --- a/src/lib/ae_posts/ae_posts_functions.ts +++ b/src/lib/ae_posts/ae_posts_functions.ts @@ -1,32 +1,32 @@ // This file is used to export all the functions that are used for Aether Posts related functions. import { - load_ae_obj_id__post, - load_ae_obj_li__post, - create_ae_obj__post, - delete_ae_obj_id__post, - update_ae_obj__post + load_ae_obj_id__post, + load_ae_obj_li__post, + create_ae_obj__post, + delete_ae_obj_id__post, + update_ae_obj__post } from '$lib/ae_posts/ae_posts__post'; import { - load_ae_obj_id__post_comment, - load_ae_obj_li__post_comment, - create_ae_obj__post_comment, - delete_ae_obj_id__post_comment, - update_ae_obj__post_comment + load_ae_obj_id__post_comment, + load_ae_obj_li__post_comment, + create_ae_obj__post_comment, + delete_ae_obj_id__post_comment, + update_ae_obj__post_comment } from '$lib/ae_posts/ae_posts__post_comment'; const export_obj = { - load_ae_obj_id__post: load_ae_obj_id__post, - 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, + load_ae_obj_id__post: load_ae_obj_id__post, + 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, - 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 + 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 }; export const posts_func = export_obj; diff --git a/src/lib/ae_posts/db_posts.ts b/src/lib/ae_posts/db_posts.ts index 3de1bf66..1e7d968a 100644 --- a/src/lib/ae_posts/db_posts.ts +++ b/src/lib/ae_posts/db_posts.ts @@ -7,113 +7,113 @@ import type { key_val } from '$lib/stores/ae_stores'; // Updated 2024-11-13 export interface Post { - id: string; - // id_random: string; - post_id: string; - // post_id_random: string; + id: string; + // id_random: string; + post_id: string; + // post_id_random: string; - account_id: string; - // account_id_random: string; + account_id: string; + // account_id_random: string; - person_id?: null | string; - external_person_id?: null | string; // For IDAA this is the Novi UUID - user_id?: null | string; + person_id?: null | string; + external_person_id?: null | string; // For IDAA this is the Novi UUID + user_id?: null | string; - topic_id?: string; - topic?: string; // or topic_name? - topic_name?: string; + topic_id?: string; + topic?: string; // or topic_name? + topic_name?: string; - name: null | string; - title: null | string; - // summary?: null|string; - content?: null | string; + name: null | string; + title: null | string; + // summary?: null|string; + content?: null | string; - anonymous?: null | boolean; - full_name?: null | string; - email?: null | string; - notify?: null | boolean; + anonymous?: null | boolean; + full_name?: null | string; + email?: null | string; + notify?: null | boolean; - enable_comments?: null | boolean; + enable_comments?: null | boolean; - archive?: null | boolean; - archive_on?: null | Date; + archive?: null | boolean; + archive_on?: null | Date; - linked_li_json?: null | string; - cfg_json?: null | key_val; + linked_li_json?: null | string; + cfg_json?: null | key_val; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) - post_comment_count?: number; + // Additional fields for convenience (database views) + post_comment_count?: number; - // Placeholder for generated temp data - hosted_file_id_li?: null | Array; - hosted_file_obj_li?: null | Array; - upload_complete?: boolean; + // Placeholder for generated temp data + hosted_file_id_li?: null | Array; + hosted_file_obj_li?: null | Array; + upload_complete?: boolean; } // Updated 2024-11-13 export interface Post_Comment { - id: string; - // id_random: string; - post_comment_id: string; - // post_comment_id_random: string; + id: string; + // id_random: string; + post_comment_id: string; + // post_comment_id_random: string; - post_id: string; - // post_id_random: string; + post_id: string; + // post_id_random: string; - external_person_id?: null | string; // For IDAA this is the Novi UUID + external_person_id?: null | string; // For IDAA this is the Novi UUID - name: null | string; - title: null | string; - // summary?: null|string; - content?: null | string; + name: null | string; + title: null | string; + // summary?: null|string; + content?: null | string; - anonymous?: null | boolean; - full_name?: null | string; - email?: null | string; - notify?: null | boolean; + anonymous?: null | boolean; + full_name?: null | string; + email?: null | string; + notify?: null | boolean; - linked_li_json?: null | string; - cfg_json?: null | key_val; + linked_li_json?: null | string; + cfg_json?: null | key_val; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) + // Additional fields for convenience (database views) } // Updated 2024-09-25 export class MySubClassedDexie extends Dexie { - // We just tell the typing system this is the case - post!: Table; - comment!: Table; + // We just tell the typing system this is the case + post!: Table; + comment!: Table; - constructor() { - super('ae_posts_db'); - this.version(1).stores({ - post: ` + constructor() { + super('ae_posts_db'); + this.version(1).stores({ + post: ` id, post_id, account_id, topic_id, topic, @@ -124,7 +124,7 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on], [created_on+updated_on]`, - comment: ` + comment: ` id, post_comment_id, post_id, name, @@ -132,8 +132,8 @@ export class MySubClassedDexie extends Dexie { full_name, email, tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on]` - }); - } + }); + } } export const db_posts = new MySubClassedDexie(); diff --git a/src/lib/ae_sponsorships/ae_sponsorships_functions.ts b/src/lib/ae_sponsorships/ae_sponsorships_functions.ts index 6a8b0e48..b79d66b7 100644 --- a/src/lib/ae_sponsorships/ae_sponsorships_functions.ts +++ b/src/lib/ae_sponsorships/ae_sponsorships_functions.ts @@ -8,118 +8,118 @@ import { db_sponsorships } from '$lib/ae_sponsorships/db_sponsorships'; // --- PROPERTIES TO SAVE --- export const properties_to_save_sponsorship_cfg = [ - 'id', - 'sponsorship_cfg_id', - 'account_id', - 'for_type', - 'for_id', - 'level_li_json', - 'option_li_json', - 'schedule_li_json', - 'cfg_json', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' + 'id', + 'sponsorship_cfg_id', + 'account_id', + 'for_type', + 'for_id', + 'level_li_json', + 'option_li_json', + 'schedule_li_json', + 'cfg_json', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' ]; // --- PROCESS FUNCTION --- export async function process_ae_obj__sponsorship_cfg_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'sponsorship_cfg', - log_lvl, - specific_processor: (obj) => { - // Sponsorship Cfg-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'sponsorship_cfg', + log_lvl, + specific_processor: (obj) => { + // Sponsorship Cfg-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } // --- PROPERTIES TO SAVE --- export const properties_to_save_sponsorship = [ - 'id', - 'sponsorship_id', - 'account_id', - 'organization_id', - 'person_id', - 'poc_person_id', - 'poc_json', - 'name', - 'name_override', - 'description', - 'email', - 'website_url', - 'logo_li_json', - 'media_li_json', - 'social_li_json', - 'address_li_json', - 'contact_li_json', - 'guest_li_json', - 'level_num', - 'level_str', - 'amount', - 'questions_li_json', - 'agree', - 'comments', - 'staff_notes', - 'enable', - 'hide', - 'priority', - 'sort', - 'group', - 'notes', - 'created_on', - 'updated_on', - // Generated fields for sorting locally only - 'tmp_sort_1', - 'tmp_sort_2' + 'id', + 'sponsorship_id', + 'account_id', + 'organization_id', + 'person_id', + 'poc_person_id', + 'poc_json', + 'name', + 'name_override', + 'description', + 'email', + 'website_url', + 'logo_li_json', + 'media_li_json', + 'social_li_json', + 'address_li_json', + 'contact_li_json', + 'guest_li_json', + 'level_num', + 'level_str', + 'amount', + 'questions_li_json', + 'agree', + 'comments', + 'staff_notes', + 'enable', + 'hide', + 'priority', + 'sort', + 'group', + 'notes', + 'created_on', + 'updated_on', + // Generated fields for sorting locally only + 'tmp_sort_1', + 'tmp_sort_2' ]; // --- PROCESS FUNCTION --- export async function process_ae_obj__sponsorship_props({ - obj_li, - log_lvl = 0 + obj_li, + log_lvl = 0 }: { - obj_li: any[]; - log_lvl?: number; + obj_li: any[]; + log_lvl?: number; }) { - return _process_generic_props({ - obj_li, - obj_type: 'sponsorship', - log_lvl, - specific_processor: (obj) => { - // Sponsorship-specific computed sort fields, overriding generic ones if needed - obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on ?? obj.created_on}`; - obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ - obj.sort?.toString().padStart(3, '0') ?? '' - }_${obj.updated_on}_${obj.created_on}`; + return _process_generic_props({ + obj_li, + obj_type: 'sponsorship', + log_lvl, + specific_processor: (obj) => { + // Sponsorship-specific computed sort fields, overriding generic ones if needed + obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on ?? obj.created_on}`; + obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${ + obj.sort?.toString().padStart(3, '0') ?? '' + }_${obj.updated_on}_${obj.created_on}`; - return obj; - } - }); + return obj; + } + }); } /** @@ -127,378 +127,383 @@ export async function process_ae_obj__sponsorship_props({ * Processes a list of Aether objects by applying common and specific transformations. */ async function _process_generic_props>({ - obj_li, - obj_type, - log_lvl = 0, - specific_processor + obj_li, + obj_type, + log_lvl = 0, + specific_processor }: { - obj_li: T[]; - obj_type: string; - log_lvl?: number; - specific_processor?: (obj: T) => Promise | T; + obj_li: T[]; + obj_type: string; + log_lvl?: number; + specific_processor?: (obj: T) => Promise | T; }): Promise { - if (log_lvl > 0) { - console.log( - `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` - ); - } + if (log_lvl > 0) { + console.log( + `*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***` + ); + } - if (!obj_li || obj_li.length === 0) { - if (log_lvl > 0) console.log('No objects to process.'); - return []; - } + if (!obj_li || obj_li.length === 0) { + if (log_lvl > 0) console.log('No objects to process.'); + return []; + } - const processed_obj_li: T[] = []; + const processed_obj_li: T[] = []; - for (const original_obj of obj_li) { - let processed_obj = { ...original_obj }; + for (const original_obj of obj_li) { + let processed_obj = { ...original_obj }; - // --- Common Transformations --- + // --- Common Transformations --- - // 1. Standardize ID and other '_random' fields - // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. - for (const key in processed_obj) { - if (key.endsWith('_random')) { - const newKey = key.slice(0, -7); // Remove '_random' suffix - processed_obj[newKey] = processed_obj[key]; - } - } - // Ensure 'id' is set from '[obj_type]_id_random' - const randomIdKey = `${obj_type}_id_random`; - if (processed_obj[randomIdKey]) { - (processed_obj as any).id = processed_obj[randomIdKey]; - } + // 1. Standardize ID and other '_random' fields + // The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'. + for (const key in processed_obj) { + if (key.endsWith('_random')) { + const newKey = key.slice(0, -7); // Remove '_random' suffix + processed_obj[newKey] = processed_obj[key]; + } + } + // Ensure 'id' is set from '[obj_type]_id_random' + const randomIdKey = `${obj_type}_id_random`; + if (processed_obj[randomIdKey]) { + (processed_obj as any).id = processed_obj[randomIdKey]; + } - // 2. Create common computed properties for client-side sorting. - const group = processed_obj.group ?? '0'; - const priority = processed_obj.priority ? 1 : 0; - const sort = processed_obj.sort ?? '0'; - const updated = processed_obj.updated_on ?? processed_obj.created_on; - const name = processed_obj.name ?? ''; + // 2. Create common computed properties for client-side sorting. + const group = processed_obj.group ?? '0'; + const priority = processed_obj.priority ? 1 : 0; + const sort = processed_obj.sort ?? '0'; + const updated = processed_obj.updated_on ?? processed_obj.created_on; + const name = processed_obj.name ?? ''; - (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; - (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; + (processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`; + (processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`; - // --- Specific Transformations --- - if (specific_processor) { - processed_obj = await Promise.resolve(specific_processor(processed_obj)); - } + // --- Specific Transformations --- + if (specific_processor) { + processed_obj = await Promise.resolve(specific_processor(processed_obj)); + } - processed_obj_li.push(processed_obj as T); - } + processed_obj_li.push(processed_obj as T); + } - return processed_obj_li; + return processed_obj_li; } // Updated 2024-03-29 async function load_ae_obj_id__sponsorship_cfg({ - api_cfg, - sponsorship_cfg_id, - try_cache = false, - log_lvl = 0 + api_cfg, + sponsorship_cfg_id, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - sponsorship_cfg_id: string; - try_cache: boolean; - log_lvl: number; + api_cfg: any; + sponsorship_cfg_id: string; + try_cache: boolean; + log_lvl: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}` + ); + } - const params = {}; + const params = {}; - ae_promises.load__sponsorship_cfg_obj = api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'sponsorship_cfg', - obj_id: sponsorship_cfg_id, - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (sponsorship_cfg_obj_get_result) { - if (sponsorship_cfg_obj_get_result) { - if (log_lvl) { - console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}`); - } else if (log_lvl > 1) { - console.log( - `*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}:`, - sponsorship_cfg_obj_get_result - ); - } - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__sponsorship_cfg_props({ - obj_li: [sponsorship_cfg_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_sponsorships, - table_name: 'cfg', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_sponsorship_cfg, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return sponsorship_cfg_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__sponsorship_cfg_obj = api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'sponsorship_cfg', + obj_id: sponsorship_cfg_id, + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (sponsorship_cfg_obj_get_result) { + if (sponsorship_cfg_obj_get_result) { + if (log_lvl) { + console.log( + `*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}` + ); + } else if (log_lvl > 1) { + console.log( + `*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}:`, + sponsorship_cfg_obj_get_result + ); + } + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__sponsorship_cfg_props({ + obj_li: [sponsorship_cfg_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_sponsorships, + table_name: 'cfg', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_sponsorship_cfg, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return sponsorship_cfg_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__sponsorship_cfg_obj:', ae_promises.load__sponsorship_cfg_obj); - } + if (log_lvl) { + console.log( + 'ae_promises.load__sponsorship_cfg_obj:', + ae_promises.load__sponsorship_cfg_obj + ); + } - return ae_promises.load__sponsorship_cfg_obj; + return ae_promises.load__sponsorship_cfg_obj; } // Updated 2024-03-29 async function load_ae_obj_id__sponsorship({ - api_cfg, - sponsorship_id, - try_cache = false, - log_lvl = 0 + api_cfg, + sponsorship_id, + try_cache = false, + log_lvl = 0 }: { - api_cfg: any; - sponsorship_id: string; - try_cache: boolean; - log_lvl: number; + api_cfg: any; + sponsorship_id: string; + try_cache: boolean; + log_lvl: number; }) { - if (log_lvl) { - console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`); - } + if (log_lvl) { + console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`); + } - const params = {}; + const params = {}; - ae_promises.load__sponsorship_obj = api - .get_ae_obj_id_crud({ - api_cfg: api_cfg, - obj_type: 'sponsorship', - obj_id: sponsorship_id, - use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. - params: params, - log_lvl: log_lvl - }) - .then(async function (sponsorship_obj_get_result) { - if (sponsorship_obj_get_result) { - if (log_lvl) { - console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`); - } else if (log_lvl > 1) { - console.log( - `*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`, - sponsorship_obj_get_result - ); - } - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__sponsorship_props({ - obj_li: [sponsorship_obj_get_result], - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_sponsorships, - table_name: 'sponsorship', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_sponsorship, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return sponsorship_obj_get_result; - } else { - console.log('No results returned.'); - return null; - } - }) - .catch(function (error: any) { - console.log('No results returned or failed.', error); - }); + ae_promises.load__sponsorship_obj = api + .get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'sponsorship', + obj_id: sponsorship_id, + use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_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. + params: params, + log_lvl: log_lvl + }) + .then(async function (sponsorship_obj_get_result) { + if (sponsorship_obj_get_result) { + if (log_lvl) { + console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`); + } else if (log_lvl > 1) { + console.log( + `*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`, + sponsorship_obj_get_result + ); + } + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__sponsorship_props({ + obj_li: [sponsorship_obj_get_result], + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_sponsorships, + table_name: 'sponsorship', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_sponsorship, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return sponsorship_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error: any) { + console.log('No results returned or failed.', error); + }); - if (log_lvl) { - console.log('ae_promises.load__sponsorship_obj:', ae_promises.load__sponsorship_obj); - } + if (log_lvl) { + console.log('ae_promises.load__sponsorship_obj:', ae_promises.load__sponsorship_obj); + } - return ae_promises.load__sponsorship_obj; + return ae_promises.load__sponsorship_obj; } // Updated 2025-01-15 async function load_ae_obj_li__sponsorship({ - api_cfg, - for_obj_type = 'account', - for_obj_id, - enabled = 'enabled', - hidden = 'not_hidden', - limit = 99, - offset = 0, - order_by_li = { - priority: 'DESC', - sort: 'DESC', - name: 'ASC', - updated_on: 'DESC', - created_on: 'DESC' - }, - params = {}, - try_cache = true, - log_lvl = 0 + api_cfg, + for_obj_type = 'account', + for_obj_id, + enabled = 'enabled', + hidden = 'not_hidden', + limit = 99, + offset = 0, + order_by_li = { + priority: 'DESC', + sort: 'DESC', + name: 'ASC', + updated_on: 'DESC', + created_on: 'DESC' + }, + params = {}, + try_cache = true, + log_lvl = 0 }: { - api_cfg: any; - for_obj_type: string; - for_obj_id: string; - inc_content_li?: boolean; - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - limit?: number; - offset?: number; - order_by_li?: key_val; - params?: key_val; - try_cache?: boolean; - log_lvl?: number; + api_cfg: any; + for_obj_type: string; + for_obj_id: string; + inc_content_li?: boolean; + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + limit?: number; + offset?: number; + order_by_li?: key_val; + params?: key_val; + try_cache?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log( - `*** load_ae_obj_li__sponsorship() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` - ); - } + if (log_lvl) { + console.log( + `*** load_ae_obj_li__sponsorship() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}` + ); + } - const 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({ - api_cfg: api_cfg, - obj_type: 'sponsorship', - for_obj_type: for_obj_type, - for_obj_id: for_obj_id, - use_alt_tbl: false, - use_alt_mdl: false, - use_alt_exp: false, - enabled: enabled, - hidden: hidden, - order_by_li: order_by_li, - limit: limit, - offset: offset, - params_json: params_json, - params: params, - log_lvl: log_lvl - }) - .then(async function (sponsorship_obj_li_get_result) { - if (sponsorship_obj_li_get_result) { - if (try_cache) { - // Process the results first - const processed_obj_li = await process_ae_obj__sponsorship_props({ - obj_li: sponsorship_obj_li_get_result, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('Processed object list:', processed_obj_li); - } - // Save the updated results list to the database - if (log_lvl) { - console.log('Saving to DB...'); - } - await db_save_ae_obj_li__ae_obj({ - db_instance: db_sponsorships, - table_name: 'sponsorship', - obj_li: processed_obj_li, - properties_to_save: properties_to_save_sponsorship, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log('DB save completed.'); - } - } - return sponsorship_obj_li_get_result; - } else { - return []; - } - }); + ae_promises.load__sponsorship_obj_li = await api + .get_ae_obj_li_for_obj_id_crud_v2({ + api_cfg: api_cfg, + obj_type: 'sponsorship', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_tbl: false, + use_alt_mdl: false, + use_alt_exp: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(async function (sponsorship_obj_li_get_result) { + if (sponsorship_obj_li_get_result) { + if (try_cache) { + // Process the results first + const processed_obj_li = await process_ae_obj__sponsorship_props({ + obj_li: sponsorship_obj_li_get_result, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('Processed object list:', processed_obj_li); + } + // Save the updated results list to the database + if (log_lvl) { + console.log('Saving to DB...'); + } + await db_save_ae_obj_li__ae_obj({ + db_instance: db_sponsorships, + table_name: 'sponsorship', + obj_li: processed_obj_li, + properties_to_save: properties_to_save_sponsorship, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log('DB save completed.'); + } + } + return sponsorship_obj_li_get_result; + } else { + return []; + } + }); - if (log_lvl) { - console.log('ae_promises.load__sponsorship_obj_li:', ae_promises.load__sponsorship_obj_li); - } + if (log_lvl) { + console.log('ae_promises.load__sponsorship_obj_li:', ae_promises.load__sponsorship_obj_li); + } - return ae_promises.load__sponsorship_obj_li; + return ae_promises.load__sponsorship_obj_li; } export async function download_export__sponsorship({ - api_cfg, - account_id, - file_type = 'CSV', // 'CSV' or 'Excel' - return_file = true, - filename = 'no_filename.csv', - auto_download = false, - params = {}, // key value object is expected - log_lvl = 0 + api_cfg, + account_id, + file_type = 'CSV', // 'CSV' or 'Excel' + return_file = true, + filename = 'no_filename.csv', + auto_download = false, + params = {}, // key value object is expected + log_lvl = 0 }: { - api_cfg: any; - account_id: string; - file_type?: string; - return_file?: boolean; - filename?: string; - auto_download?: boolean; - params?: key_val; - log_lvl?: number; + api_cfg: any; + account_id: string; + file_type?: string; + return_file?: boolean; + filename?: string; + auto_download?: boolean; + params?: key_val; + 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`; - params['for_obj_type'] = 'account'; - params['for_obj_id'] = account_id; + const endpoint = `/v2/crud/sponsorship/list`; + params['for_obj_type'] = 'account'; + params['for_obj_id'] = account_id; - if (file_type == 'CSV' || file_type == 'Excel') { - params['file_type'] = file_type; - } - params['return_file'] = true; + if (file_type == 'CSV' || file_type == 'Excel') { + params['file_type'] = file_type; + } + params['return_file'] = true; - ae_promises.download__sponsorship_export_file = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - return_blob: return_file, - filename: filename, - auto_download: auto_download, - log_lvl: log_lvl - }); + ae_promises.download__sponsorship_export_file = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + return_blob: return_file, + filename: filename, + auto_download: auto_download, + log_lvl: log_lvl + }); - console.log( - 'ae_promises.download__sponsorship_export_file:', - ae_promises.download__sponsorship_export_file - ); - return 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; } const export_obj = { - 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_li__sponsorship: load_ae_obj_li__sponsorship, - download_export__sponsorship: download_export__sponsorship + 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_li__sponsorship: load_ae_obj_li__sponsorship, + download_export__sponsorship: download_export__sponsorship }; export const spons_func = export_obj; diff --git a/src/lib/ae_sponsorships/db_sponsorships.ts b/src/lib/ae_sponsorships/db_sponsorships.ts index f360ea22..cd85a841 100644 --- a/src/lib/ae_sponsorships/db_sponsorships.ts +++ b/src/lib/ae_sponsorships/db_sponsorships.ts @@ -7,113 +7,113 @@ import type { key_val } from '$lib/stores/ae_stores'; // Updated 2025-01-15 export interface Sponsorship { - id: string; - // id_random: string; - sponsorship_id: string; - // sponsorship_id_random: string; + id: string; + // id_random: string; + sponsorship_id: string; + // sponsorship_id_random: string; - account_id: string; - // account_id_random: string; + account_id: string; + // account_id_random: string; - organization_id?: null | string; - person_id?: null | string; + organization_id?: null | string; + person_id?: null | string; - poc_person_id?: null | string; - poc_json?: null | string; + poc_person_id?: null | string; + poc_json?: null | string; - name: null | string; - name_override: null | string; + name: null | string; + name_override: null | string; - description?: null | string; + description?: null | string; - email?: null | string; - website_url?: null | string; + email?: null | string; + website_url?: null | string; - // html_text?: null|string; - // thumbnail_url?: null|string; - // picture_url?: null|string; - // video_url?: null|string; - // audio_url?: null|string; - // image_url?: null|string; - // document_url?: null|string; - // logo_url?: null|string; + // html_text?: null|string; + // thumbnail_url?: null|string; + // picture_url?: null|string; + // video_url?: null|string; + // audio_url?: null|string; + // image_url?: null|string; + // document_url?: null|string; + // logo_url?: null|string; - logo_li_json?: null | string; - media_li_json?: null | string; - social_li_json?: null | string; - address_li_json?: null | string; - contact_li_json?: null | string; - guest_li_json?: null | string; + logo_li_json?: null | string; + media_li_json?: null | string; + social_li_json?: null | string; + address_li_json?: null | string; + contact_li_json?: null | string; + guest_li_json?: null | string; - level_num?: null | number; - level_str?: null | string; + level_num?: null | number; + level_str?: null | string; - amount?: null | number; // In dollars + amount?: null | number; // In dollars - questions_li_json?: null | string; + questions_li_json?: null | string; - agree?: null | boolean; // Catchall agree or consent + agree?: null | boolean; // Catchall agree or consent - comments?: null | string; // From the sponsor - staff_notes?: null | string; // Internal use; from staff + comments?: null | string; // From the sponsor + staff_notes?: null | string; // Internal use; from staff - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Generated fields for sorting locally only - tmp_sort_1?: null | string; - tmp_sort_2?: null | string; + // Generated fields for sorting locally only + tmp_sort_1?: null | string; + tmp_sort_2?: null | string; - // Additional fields for convenience (database views) + // Additional fields for convenience (database views) } // Updated 2025-01-15 export interface Sponsorship_Cfg { - id: string; - // id_random: string; - sponsorship_cfg_id: string; - // sponsorship_cfg_id_random: string; + id: string; + // id_random: string; + sponsorship_cfg_id: string; + // sponsorship_cfg_id_random: string; - account_id: string; - // account_id_random: string; + account_id: string; + // account_id_random: string; - for_type?: null | string; - for_id?: null | number; + for_type?: null | string; + for_id?: null | number; - level_li_json?: null | string; - option_li_json?: null | string; - schedule_li_json?: null | string; + level_li_json?: null | string; + option_li_json?: null | string; + schedule_li_json?: null | string; - cfg_json?: null | key_val; + cfg_json?: null | key_val; - enable: null | boolean; - hide?: null | boolean; - priority?: null | boolean; - sort?: null | number; - group?: null | string; - notes?: null | string; - created_on: Date; - updated_on?: null | Date; + enable: null | boolean; + hide?: null | boolean; + priority?: null | boolean; + sort?: null | number; + group?: null | string; + notes?: null | string; + created_on: Date; + updated_on?: null | Date; - // Additional fields for convenience (database views) + // Additional fields for convenience (database views) } // Updated 2024-09-25 export class MySubClassedDexie extends Dexie { - // We just tell the typing system this is the case - sponsorship!: Table; - cfg!: Table; + // We just tell the typing system this is the case + sponsorship!: Table; + cfg!: Table; - constructor() { - super('ae_sponsorships_db'); - this.version(1).stores({ - sponsorship: ` + constructor() { + super('ae_sponsorships_db'); + this.version(1).stores({ + sponsorship: ` id, sponsorship_id, account_id, poc_person_id, @@ -122,12 +122,12 @@ export class MySubClassedDexie extends Dexie { agree, enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on], [created_on+updated_on]`, - cfg: ` + cfg: ` id, sponsorship_cfg_id, account_id, for_type, for_id` - }); - } + }); + } } export const db_sponsorships = new MySubClassedDexie(); diff --git a/src/lib/ae_utils/ae_utils.ts b/src/lib/ae_utils/ae_utils.ts index 982e8089..1abdb273 100644 --- a/src/lib/ae_utils/ae_utils.ts +++ b/src/lib/ae_utils/ae_utils.ts @@ -1,10 +1,10 @@ // 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 + 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 { file_extension_icon } from './ae_utils__file_extension_icon'; @@ -17,24 +17,24 @@ 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 { return_obj_type_path } from './ae_utils__return_obj_type_path'; import { - combine_iv_and_base64, - encrypt_content, - encrypt_wrapper, - decrypt_content, - decrypt_wrapper + combine_iv_and_base64, + encrypt_content, + encrypt_wrapper, + decrypt_content, + decrypt_wrapper } from './ae_utils__crypto'; export type key_str = { - [key: string]: string; + [key: string]: string; }; export type key_val = { - [key: string]: any; + [key: string]: any; }; /* This utility function will add commas to a number. */ 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). @@ -45,110 +45,110 @@ function number_w_commas(x) { // import { pushState, replaceState } from '$app/navigation'; 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}`); - const location = window.location.href; - // console.log('location:', location); - const url = new URL(location); - // console.log('url:', url); + const location = window.location.href; + // console.log('location:', location); + const url = new URL(location); + // console.log('url:', url); - if (value) { - url.searchParams.set(name, value); - history.pushState({}, '', url); + if (value) { + url.searchParams.set(name, value); + history.pushState({}, '', url); - // console.log('url:', url); - // pushState(url.href, {}); - // pushState(url.search, {}); - // replaceState(url.href, {}); + // console.log('url:', url); + // pushState(url.href, {}); + // pushState(url.search, {}); + // replaceState(url.href, {}); - const message = { name: value }; - window.parent.postMessage(message, '*'); - } else { - url.searchParams.delete(name); - history.pushState({}, '', url); + const message = { name: value }; + window.parent.postMessage(message, '*'); + } else { + url.searchParams.delete(name); + history.pushState({}, '', url); - // console.log('url:', url); - // pushState({}, '', url.search); - // pushState(url.href, {}); - // replaceState(url.href, {}); + // console.log('url:', url); + // pushState({}, '', url.search); + // pushState(url.href, {}); + // replaceState(url.href, {}); - const message = { name: null }; - window.parent.postMessage(message, '*'); - } - // console.log('Message sent to parent (iframe):', message); + const message = { name: null }; + window.parent.postMessage(message, '*'); + } + // console.log('Message sent to parent (iframe):', message); } 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 `${text}`; + return `${text}`; } function create_img_element({ - account_id, - base_url, - hosted_file_id, - filename = null, - extension = null, - class_li = 'max-w-64', - style = '', - inc_link = false + account_id, + base_url, + hosted_file_id, + filename = null, + extension = null, + class_li = 'max-w-64', + style = '', + inc_link = false }) { - let img_html = ''; - if (filename) { - img_html = ``; - } else { - img_html = ``; - } + let img_html = ''; + if (filename) { + img_html = ``; + } else { + img_html = ``; + } - if (inc_link) { - 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 = `
${img_html}${a_html}
`; - } + if (inc_link) { + 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 = `
${img_html}${a_html}
`; + } - 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 + account_id, + base_url, + hosted_file_id, + filename = null, + extension = null, + class_li = 'max-w-64', + inc_link = false }) { - let video_html = ''; - if (filename) { - video_html = ``; - } else { - video_html = ``; - } + let video_html = ''; + if (filename) { + video_html = ``; + } else { + video_html = ``; + } - if (inc_link) { - 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 = `
${video_html}${a_html}
`; - } + if (inc_link) { + 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 = `
${video_html}${a_html}
`; + } - return video_html; + return video_html; } // // Clear the quick access type @@ -171,66 +171,66 @@ function create_video_element({ // This function will take a long string (sentences or paragraphs) of text and return an estimated number of words. function count_words(text: string) { - if (!text || text.length < 1) { - return false; - } - const count = text.trim().split(/\s+/).length; + if (!text || text.length < 1) { + return false; + } + const count = text.trim().split(/\s+/).length; - return count; + return count; } // Updated 2024-06-19 // This function behaves weirdly. It needs to be reviewed and updated. export const shorten_string = function shorten_string({ - string, - max_length = 45, - begin_length = 15, - end_length = 5, - wildcard_length = 3 + string, + max_length = 45, + begin_length = 15, + end_length = 5, + wildcard_length = 3 }: { - string: undefined | string; - max_length?: number; - begin_length?: number; - end_length?: number; - wildcard_length?: number; + string: undefined | string; + max_length?: number; + begin_length?: number; + end_length?: number; + wildcard_length?: number; }) { - // console.log('*** shorten_filename() ***'); + // console.log('*** shorten_filename() ***'); - if (!string || typeof string != 'string') { - // console.log('Invalid string value passed'); - // return false; - return ''; - } + if (!string || typeof string != 'string') { + // console.log('Invalid string value passed'); + // return false; + return ''; + } - // NOTE: max_length is not the actual end result length. The actual max will be 45 characters. - // 20 part 1 characters, 5 part 2 characters, 20 part 3 characters + // NOTE: max_length is not the actual end result length. The actual max will be 45 characters. + // 20 part 1 characters, 5 part 2 characters, 20 part 3 characters - // let length = string.length; - const char_over = string.length - max_length; - let new_string = null; - let wildcards = char_over; - if (char_over > 0) { - const part1 = string.slice(0, begin_length); + // let length = string.length; + const char_over = string.length - max_length; + let new_string = null; + let wildcards = char_over; + if (char_over > 0) { + const part1 = string.slice(0, begin_length); - let part2 = ''; - if (char_over > 5) { - wildcards = 5; - } else { - } + let part2 = ''; + if (char_over > 5) { + wildcards = 5; + } else { + } - if (wildcard_length) { - part2 = '.'.repeat(wildcard_length); - } else { - part2 = '.'.repeat(wildcards); - } + if (wildcard_length) { + part2 = '.'.repeat(wildcard_length); + } else { + part2 = '.'.repeat(wildcards); + } - const part3 = string.slice(end_length * -1); + const part3 = string.slice(end_length * -1); - new_string = part1 + part2 + part3; - } else { - new_string = string; - } - return new_string; + new_string = part1 + part2 + part3; + } else { + new_string = string; + } + return new_string; }; // Updated 2024-06-19 @@ -238,69 +238,69 @@ export const shorten_string = function shorten_string({ // Example 1: The Original Long File Name.pdf -> The Orig....pdf // Example 2: The Original Long File Name.html -> The Ori....html function shorten_filename({ - filename, - max_length = 20, - slice_end_at = 15, - max_end_length = 5 + filename, + max_length = 20, + slice_end_at = 15, + max_end_length = 5 }: { - filename: string; - max_length?: number; - slice_end_at?: number; - max_end_length?: number; + filename: string; + max_length?: number; + slice_end_at?: number; + max_end_length?: number; }) { - // console.log('*** shorten_filename() ***'); + // console.log('*** shorten_filename() ***'); - if (typeof filename !== 'string' || filename.length <= max_length) { - return filename; - } + if (typeof filename !== 'string' || filename.length <= max_length) { + return filename; + } - let new_filename = null; - const char_over = filename.length - max_length; - let wildcards = char_over - 4; // The number of characters over the max length - if (wildcards < 1) { - return filename; // No point in changing the filename? - } + let new_filename = null; + const char_over = filename.length - max_length; + let wildcards = char_over - 4; // The number of characters over the max length + if (wildcards < 1) { + return filename; // No point in changing the filename? + } - const part_1 = filename.slice(0, slice_end_at); - if (wildcards > 3) { - wildcards = 3; - } else { - } - const part_2 = '.'.repeat(wildcards); - const part_3 = filename.slice(max_end_length * -1); + const part_1 = filename.slice(0, slice_end_at); + if (wildcards > 3) { + wildcards = 3; + } else { + } + const part_2 = '.'.repeat(wildcards); + 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 = { - is_datetime_recent: is_datetime_recent, - process_permission_checks: process_permission_checks, - iso_datetime_formatter: iso_datetime_formatter, - clean_filename: clean_filename, - format_bytes: format_bytes, - number_w_commas: number_w_commas, - guess_file_name: guess_file_name, - guess_file_extension: guess_file_extension, - get_file_hash: get_file_hash, - get_obj_li_w_match_prop: get_obj_li_w_match_prop, - extract_prefixed_form_data: extract_prefixed_form_data, - process_data_string: process_data_string, - handle_url_and_message: handle_url_and_message, - create_a_element: create_a_element, - create_img_element: create_img_element, - create_video_element: create_video_element, - count_words: count_words, - to_title_case: to_title_case, - shorten_string: shorten_string, - shorten_filename: shorten_filename, - file_extension_icon: file_extension_icon, - set_obj_prop_display_name: set_obj_prop_display_name, - return_obj_type_path: return_obj_type_path, - combine_iv_and_base64: combine_iv_and_base64, - encrypt_content: encrypt_content, - encrypt_wrapper: encrypt_wrapper, - decrypt_content: decrypt_content, - decrypt_wrapper: decrypt_wrapper + is_datetime_recent: is_datetime_recent, + process_permission_checks: process_permission_checks, + iso_datetime_formatter: iso_datetime_formatter, + clean_filename: clean_filename, + format_bytes: format_bytes, + number_w_commas: number_w_commas, + guess_file_name: guess_file_name, + guess_file_extension: guess_file_extension, + get_file_hash: get_file_hash, + get_obj_li_w_match_prop: get_obj_li_w_match_prop, + extract_prefixed_form_data: extract_prefixed_form_data, + process_data_string: process_data_string, + handle_url_and_message: handle_url_and_message, + create_a_element: create_a_element, + create_img_element: create_img_element, + create_video_element: create_video_element, + count_words: count_words, + to_title_case: to_title_case, + shorten_string: shorten_string, + shorten_filename: shorten_filename, + file_extension_icon: file_extension_icon, + set_obj_prop_display_name: set_obj_prop_display_name, + return_obj_type_path: return_obj_type_path, + combine_iv_and_base64: combine_iv_and_base64, + encrypt_content: encrypt_content, + encrypt_wrapper: encrypt_wrapper, + decrypt_content: decrypt_content, + decrypt_wrapper: decrypt_wrapper }; diff --git a/src/lib/ae_utils/ae_utils__crypto.ts b/src/lib/ae_utils/ae_utils__crypto.ts index 349f6272..2359a2b6 100644 --- a/src/lib/ae_utils/ae_utils__crypto.ts +++ b/src/lib/ae_utils/ae_utils__crypto.ts @@ -2,126 +2,126 @@ const log_lvl = 0; // 0 = no logging, 1 = some logging, 2 = all logging // Updated 2025-05-08 async function generate_iv() { - const data = new Uint8Array(16); - crypto.getRandomValues(data); - return data; + const data = new Uint8Array(16); + crypto.getRandomValues(data); + return data; } // Updated 2025-05-08 export const encrypt_content = async function encrypt_content(content: string, keyData: string) { - const iv = await generate_iv(); - 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 encodedContent = await crypto.subtle.encrypt( - { name: 'AES-CBC', iv }, - key, - new TextEncoder().encode(content) - ); - const base64 = btoa(String.fromCharCode(...new Uint8Array(encodedContent))); - if (log_lvl) { - console.log(`IV: ${iv}; Encrypted:`, base64); - } - return { base64, iv }; + const iv = await generate_iv(); + 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 encodedContent = await crypto.subtle.encrypt( + { name: 'AES-CBC', iv }, + key, + new TextEncoder().encode(content) + ); + const base64 = btoa(String.fromCharCode(...new Uint8Array(encodedContent))); + if (log_lvl) { + console.log(`IV: ${iv}; Encrypted:`, base64); + } + return { base64, iv }; }; // Updated 2025-05-08 export const combine_iv_and_base64 = function combine_iv_and_base64( - base64: string, - iv: Uint8Array + base64: string, + iv: Uint8Array ) { - if (log_lvl) { - console.log(`IV: ${iv}; Encrypted:`, base64); - } + if (log_lvl) { + console.log(`IV: ${iv}; Encrypted:`, base64); + } - // Combine the IV and encrypted content - const combined = - Array.from(iv) - .map((byte) => byte.toString(16).padStart(2, '0')) - .join('') + - ':' + - base64; - if (log_lvl) { - console.log('Combined IV and Base64:', combined); - } - // const ivBase64 = btoa(String.fromCharCode(...iv)); - // const combined = `${ivBase64}:${base64}`; - // console.log('Combined IV and Base64 v2:', combined); - return combined; + // Combine the IV and encrypted content + const combined = + Array.from(iv) + .map((byte) => byte.toString(16).padStart(2, '0')) + .join('') + + ':' + + base64; + if (log_lvl) { + console.log('Combined IV and Base64:', combined); + } + // const ivBase64 = btoa(String.fromCharCode(...iv)); + // const combined = `${ivBase64}:${base64}`; + // console.log('Combined IV and Base64 v2:', combined); + return combined; }; // Updated 2025-05-08 export const encrypt_wrapper = async function encrypt_wrapper(content: string, keyData: string) { - if (!content) { - console.error('No content provided. Returning empty string.'); - return ''; - } - if (!keyData) { - console.error('No keyData provided. Returning empty string.'); - return ''; - } - const { base64, iv } = await encrypt_content(content, keyData); - const combined = combine_iv_and_base64(base64, iv); - return combined; + if (!content) { + console.error('No content provided. Returning empty string.'); + return ''; + } + if (!keyData) { + console.error('No keyData provided. Returning empty string.'); + return ''; + } + const { base64, iv } = await encrypt_content(content, keyData); + const combined = combine_iv_and_base64(base64, iv); + return combined; }; // This does not handle errors (invalid key/password) well. // Updated 2025-05-08 export const decrypt_content = async function decrypt_content( - base64Content: string, - iv: Uint8Array, - keyData: string + base64Content: string, + iv: Uint8Array, + keyData: string ) { - 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 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); - // console.log('Decrypted Content:', decodedContent); - return decodedContent; + 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 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); + // console.log('Decrypted Content:', decodedContent); + return decodedContent; }; // Updated 2025-05-08 export const split_iv_and_base64 = function split_iv_and_base64(combined: string) { - if (!combined) { - console.error('No combined string provided. Returning empty object.'); - return { iv: new Uint8Array(), base64: '' }; - } - const [iv_hex, encrypted_base64_string] = combined.split(':'); - const base64 = encrypted_base64_string; - const iv = new Uint8Array(iv_hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); - if (log_lvl) { - console.log(`IV: ${iv}; Encrypted:`, base64); - } - return { iv, base64 }; + if (!combined) { + console.error('No combined string provided. Returning empty object.'); + return { iv: new Uint8Array(), base64: '' }; + } + const [iv_hex, encrypted_base64_string] = combined.split(':'); + const base64 = encrypted_base64_string; + const iv = new Uint8Array(iv_hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); + if (log_lvl) { + console.log(`IV: ${iv}; Encrypted:`, base64); + } + return { iv, base64 }; }; // Updated 2025-05-15 export const decrypt_wrapper = async function decrypt_wrapper(combined: string, keyData: string) { - if (!combined) { - console.error('No combined string provided. Returning empty string.'); - return false; - } - const { iv, base64 } = split_iv_and_base64(combined); - console.log(`IV: ${iv}; Encrypted:`, base64); - let decrypted; - try { - decrypted = await decrypt_content(base64, iv, keyData); - if (log_lvl > 1) { - console.log(`IV: ${iv}; Decrypted:`, decrypted); - } else if (log_lvl) { - console.log(`IV: ${iv}`); - } - } catch (error) { - console.error('Decryption failed:', error); - return false; - } - return decrypted; + if (!combined) { + console.error('No combined string provided. Returning empty string.'); + return false; + } + const { iv, base64 } = split_iv_and_base64(combined); + console.log(`IV: ${iv}; Encrypted:`, base64); + let decrypted; + try { + decrypted = await decrypt_content(base64, iv, keyData); + if (log_lvl > 1) { + console.log(`IV: ${iv}; Decrypted:`, decrypted); + } else if (log_lvl) { + console.log(`IV: ${iv}`); + } + } catch (error) { + console.error('Decryption failed:', error); + return false; + } + return decrypted; }; diff --git a/src/lib/ae_utils/ae_utils__datetime_format.ts b/src/lib/ae_utils/ae_utils__datetime_format.ts index 115274a3..2e7ebc77 100644 --- a/src/lib/ae_utils/ae_utils__datetime_format.ts +++ b/src/lib/ae_utils/ae_utils__datetime_format.ts @@ -1,176 +1,176 @@ import dayjs from 'dayjs'; export const iso_datetime_formatter = function iso_datetime_formatter( - raw_datetime: null | string | Date = null, - named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds - time_24_hours: boolean = false + raw_datetime: null | string | Date = null, + named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds + time_24_hours: boolean = false ) { - // console.log('*** iso_datetime_formatter() ***'); + // console.log('*** iso_datetime_formatter() ***'); - // https://en.wikipedia.org/wiki/ISO_8601 - // https://day.js.org/docs/en/display/format - // ISO 8601-1:2019 includes the T before the time portion - // ISO 8601-1:2019 midnight may only be referred to as "00:00", corresponding to the beginning of a calendar day - // and "24:00" is no longer allowed corresponding to the end of a day - // 60 is only used to denote an added leap second + // https://en.wikipedia.org/wiki/ISO_8601 + // https://day.js.org/docs/en/display/format + // ISO 8601-1:2019 includes the T before the time portion + // ISO 8601-1:2019 midnight may only be referred to as "00:00", corresponding to the beginning of a calendar day + // and "24:00" is no longer allowed corresponding to the end of a day + // 60 is only used to denote an added leap second - // ISO 8601 UTC: 2021-03-04T19:04:44+00:00 - // ISO 8601 UTC: 2021-03-04T19:04:44Z - // ISO 8601 UTC: 20210304T190444Z + // ISO 8601 UTC: 2021-03-04T19:04:44+00:00 + // ISO 8601 UTC: 2021-03-04T19:04:44Z + // ISO 8601 UTC: 20210304T190444Z - // datetime_iso 'YYYY-MM-DD HH:mm:ss' - // datetime_iso_12 'YYYY-MM-DD hh:mm:ss A' - // datetime_iso_12_short 'YY-MM-DD hh:mm A' - // datetime_iso_tz 'YYYY-MM-DD HH:mm:ss Z' + // datetime_iso 'YYYY-MM-DD HH:mm:ss' + // datetime_iso_12 'YYYY-MM-DD hh:mm:ss A' + // datetime_iso_12_short 'YY-MM-DD hh:mm A' + // datetime_iso_tz 'YYYY-MM-DD HH:mm:ss Z' - // datetime_12_no_seconds 'YYYY-MM-DD hh:mm A' + // datetime_12_no_seconds 'YYYY-MM-DD hh:mm A' - // datetime_long 'dddd, MMMM D, YYYY hh:mm:ss A' - // datetime_medium 'ddd, MMM D, YYYY hh:mm:ss A' - // datetime_short 'MMM D, YY hh:mm A' + // datetime_long 'dddd, MMMM D, YYYY hh:mm:ss A' + // datetime_medium 'ddd, MMM D, YYYY hh:mm:ss A' + // datetime_short 'MMM D, YY hh:mm A' - // date_iso 'YYYY-MM-DD' + // date_iso 'YYYY-MM-DD' - // date_long 'dddd, MMMM D, YYYY' - // date_medium 'ddd, MMM D, YYYY' - // date_short 'MMM D, YY' + // date_long 'dddd, MMMM D, YYYY' + // date_medium 'ddd, MMM D, YYYY' + // date_short 'MMM D, YY' - // time_iso 'HH:mm:ss' - // time_iso_12 'hh:mm:ss A' - // time_iso_tz 'HH:mm:ss Z' - // time_iso_12_tz 'hh:mm:ss A Z' + // time_iso 'HH:mm:ss' + // time_iso_12 'hh:mm:ss A' + // time_iso_tz 'HH:mm:ss Z' + // time_iso_12_tz 'hh:mm:ss A Z' - // time_long 'hh:mm:ss A' - // time_medium 'h:m:s A' - // time_short 'hh:mm A' + // time_long 'hh:mm:ss A' + // time_medium 'h:m:s A' + // time_short 'hh:mm A' - // dayjs(raw_datetime).format('dddd, MMMM D, YYYY hh:mm:ss A'); + // dayjs(raw_datetime).format('dddd, MMMM D, YYYY hh:mm:ss A'); - if (!raw_datetime) { - raw_datetime = new Date(); // Get the current datetime if one was not passed. - } + if (!raw_datetime) { + raw_datetime = new Date(); // Get the current datetime if one was not passed. + } - let datetime_string = null; + let datetime_string = null; - switch (named_format) { - case 'datetime_iso': - datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss'); - break; - case 'datetime_iso_no_seconds': - datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm'); - break; - case 'datetime_iso_12_short': - datetime_string = dayjs(raw_datetime).format('YY-MM-DD hh:mm A'); - break; - case 'datetime_iso_12_short_month': - datetime_string = dayjs(raw_datetime).format('MM-DD hh:mm A'); - break; - case 'datetime_iso_tz': - datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss Z'); - break; - case 'datetime_iso_12_no_seconds': - datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD hh:mm A'); - break; - // case 'datetime_12_no_seconds': - // datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD hh:mm A'); - // break; - case 'datetime_us': - datetime_string = dayjs(raw_datetime).format('MM/DD/YYYY hh:mm:ss A'); - break; - case 'datetime_short': - datetime_string = dayjs(raw_datetime).format('MMM D, YY HH:mm'); - break; - case 'datetime_12_short': - datetime_string = dayjs(raw_datetime).format('MMM D, YY hh:mm A'); - break; - case 'datetime_medium': - datetime_string = dayjs(raw_datetime).format('MMM D, YYYY H:mm'); - break; - case 'datetime_12_medium': - datetime_string = dayjs(raw_datetime).format('MMM D, YYYY h:mm A'); - break; - case 'datetime_long': - datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY HH:mm'); - break; - case 'datetime_12_long': - datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY hh:mm A'); - break; - case 'datetime_medium_sec': - datetime_string = dayjs(raw_datetime).format('MMM D, YYYY H:mm:ss'); - break; - case 'datetime_12_medium_sec': - datetime_string = dayjs(raw_datetime).format('MMM D, YYYY h:mm:ss A'); - break; - case 'datetime_short_month': - datetime_string = dayjs(raw_datetime).format('MMM D hh:mm A'); - break; - case 'datetime_long_month': - datetime_string = dayjs(raw_datetime).format('MMMM D hh:mm A'); - break; - case 'datetime_short_day': - datetime_string = dayjs(raw_datetime).format('D hh:mm A'); - break; - case 'date_iso': - datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD'); - break; - case 'date_us': - datetime_string = dayjs(raw_datetime).format('MM/DD/YYYY'); - break; - case 'date_long_month_day': - datetime_string = dayjs(raw_datetime).format('MMMM D'); - break; - case 'date_short': - datetime_string = dayjs(raw_datetime).format('MMM D, YY'); - break; - case 'date_short_no_year': - datetime_string = dayjs(raw_datetime).format('MMM D'); - break; - case 'date_long': - datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY'); - break; - case 'date_full': - datetime_string = dayjs(raw_datetime).format('dddd, MMMM D, YYYY'); - break; - case 'date_full_no_year': - datetime_string = dayjs(raw_datetime).format('dddd, MMMM D'); - break; - case 'time_iso': - datetime_string = dayjs(raw_datetime).format('HH:mm:ss'); - break; - case 'time_iso_12_tz': - datetime_string = dayjs(raw_datetime).format('hh:mm:ss A Z'); - break; - case 'time_long': - datetime_string = dayjs(raw_datetime).format('HH:mm:ss'); - break; - case 'time_12_long': - datetime_string = dayjs(raw_datetime).format('hh:mm:ss A'); - break; - case 'time_short': - datetime_string = dayjs(raw_datetime).format('HH:mm'); - break; - case 'time_short_no_leading': - datetime_string = dayjs(raw_datetime).format('H:mm'); - break; - case 'time_12_short': - datetime_string = dayjs(raw_datetime).format('hh:mm A'); - break; - case 'time_12_short_no_leading': - datetime_string = dayjs(raw_datetime).format('h:mm A'); - break; - case 'week_long': - datetime_string = dayjs(raw_datetime).format('dddd'); - break; - case 'week_medium': - datetime_string = dayjs(raw_datetime).format('ddd'); - break; - case 'week_short': - datetime_string = dayjs(raw_datetime).format('dd'); - break; - default: - // console.log(`The named format passed (${named_format}) did not match a common name. Trying to format with the named format value.`); - datetime_string = dayjs(raw_datetime).format(named_format); - // datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss'); - } - return datetime_string; + switch (named_format) { + case 'datetime_iso': + datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss'); + break; + case 'datetime_iso_no_seconds': + datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm'); + break; + case 'datetime_iso_12_short': + datetime_string = dayjs(raw_datetime).format('YY-MM-DD hh:mm A'); + break; + case 'datetime_iso_12_short_month': + datetime_string = dayjs(raw_datetime).format('MM-DD hh:mm A'); + break; + case 'datetime_iso_tz': + datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss Z'); + break; + case 'datetime_iso_12_no_seconds': + datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD hh:mm A'); + break; + // case 'datetime_12_no_seconds': + // datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD hh:mm A'); + // break; + case 'datetime_us': + datetime_string = dayjs(raw_datetime).format('MM/DD/YYYY hh:mm:ss A'); + break; + case 'datetime_short': + datetime_string = dayjs(raw_datetime).format('MMM D, YY HH:mm'); + break; + case 'datetime_12_short': + datetime_string = dayjs(raw_datetime).format('MMM D, YY hh:mm A'); + break; + case 'datetime_medium': + datetime_string = dayjs(raw_datetime).format('MMM D, YYYY H:mm'); + break; + case 'datetime_12_medium': + datetime_string = dayjs(raw_datetime).format('MMM D, YYYY h:mm A'); + break; + case 'datetime_long': + datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY HH:mm'); + break; + case 'datetime_12_long': + datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY hh:mm A'); + break; + case 'datetime_medium_sec': + datetime_string = dayjs(raw_datetime).format('MMM D, YYYY H:mm:ss'); + break; + case 'datetime_12_medium_sec': + datetime_string = dayjs(raw_datetime).format('MMM D, YYYY h:mm:ss A'); + break; + case 'datetime_short_month': + datetime_string = dayjs(raw_datetime).format('MMM D hh:mm A'); + break; + case 'datetime_long_month': + datetime_string = dayjs(raw_datetime).format('MMMM D hh:mm A'); + break; + case 'datetime_short_day': + datetime_string = dayjs(raw_datetime).format('D hh:mm A'); + break; + case 'date_iso': + datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD'); + break; + case 'date_us': + datetime_string = dayjs(raw_datetime).format('MM/DD/YYYY'); + break; + case 'date_long_month_day': + datetime_string = dayjs(raw_datetime).format('MMMM D'); + break; + case 'date_short': + datetime_string = dayjs(raw_datetime).format('MMM D, YY'); + break; + case 'date_short_no_year': + datetime_string = dayjs(raw_datetime).format('MMM D'); + break; + case 'date_long': + datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY'); + break; + case 'date_full': + datetime_string = dayjs(raw_datetime).format('dddd, MMMM D, YYYY'); + break; + case 'date_full_no_year': + datetime_string = dayjs(raw_datetime).format('dddd, MMMM D'); + break; + case 'time_iso': + datetime_string = dayjs(raw_datetime).format('HH:mm:ss'); + break; + case 'time_iso_12_tz': + datetime_string = dayjs(raw_datetime).format('hh:mm:ss A Z'); + break; + case 'time_long': + datetime_string = dayjs(raw_datetime).format('HH:mm:ss'); + break; + case 'time_12_long': + datetime_string = dayjs(raw_datetime).format('hh:mm:ss A'); + break; + case 'time_short': + datetime_string = dayjs(raw_datetime).format('HH:mm'); + break; + case 'time_short_no_leading': + datetime_string = dayjs(raw_datetime).format('H:mm'); + break; + case 'time_12_short': + datetime_string = dayjs(raw_datetime).format('hh:mm A'); + break; + case 'time_12_short_no_leading': + datetime_string = dayjs(raw_datetime).format('h:mm A'); + break; + case 'week_long': + datetime_string = dayjs(raw_datetime).format('dddd'); + break; + case 'week_medium': + datetime_string = dayjs(raw_datetime).format('ddd'); + break; + case 'week_short': + datetime_string = dayjs(raw_datetime).format('dd'); + break; + default: + // console.log(`The named format passed (${named_format}) did not match a common name. Trying to format with the named format value.`); + datetime_string = dayjs(raw_datetime).format(named_format); + // datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss'); + } + return datetime_string; }; diff --git a/src/lib/ae_utils/ae_utils__extract_prefixed_form_data.ts b/src/lib/ae_utils/ae_utils__extract_prefixed_form_data.ts index 7f813c62..bb1730a5 100644 --- a/src/lib/ae_utils/ae_utils__extract_prefixed_form_data.ts +++ b/src/lib/ae_utils/ae_utils__extract_prefixed_form_data.ts @@ -1,5 +1,5 @@ type key_val = { - [key: string]: any; + [key: string]: any; }; /* This utility function looks for any form data with the prefixed name passed and returns a new object. @@ -12,121 +12,121 @@ type key_val = { * Updated 2023-12-22 */ export const extract_prefixed_form_data = function extract_prefixed_form_data({ - prefix = null, - form_data = {}, - rm_empty_id = true, - rm_empty = false, - trim_values = false, - bool_tf_str = false, - log_lvl = 0 + prefix = null, + form_data = {}, + rm_empty_id = true, + rm_empty = false, + trim_values = false, + bool_tf_str = false, + log_lvl = 0 }: { - prefix: string | null; - form_data: any; - rm_empty_id?: boolean; - rm_empty?: boolean; - trim_values?: boolean; - bool_tf_str?: boolean; - log_lvl?: number; + prefix: string | null; + form_data: any; + rm_empty_id?: boolean; + rm_empty?: boolean; + trim_values?: boolean; + bool_tf_str?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log('*** extract_prefixed_form_data() ***'); - 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}` - ); - } 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}` - ); - } - } - if (log_lvl > 1) { - console.log('Form Data:'); - console.log(form_data); - } + if (log_lvl) { + console.log('*** extract_prefixed_form_data() ***'); + 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}` + ); + } 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}` + ); + } + } + if (log_lvl > 1) { + console.log('Form Data:'); + console.log(form_data); + } - // const data_obj: any = {}; // future TS - const data_obj: key_val = {}; - for (const field of form_data) { - let [obj_prop_name, obj_prop_value] = field; - if (log_lvl > 1) { - console.log(`${obj_prop_name}: ${obj_prop_value} type=${typeof obj_prop_value}`); - } + // const data_obj: any = {}; // future TS + const data_obj: key_val = {}; + for (const field of form_data) { + let [obj_prop_name, obj_prop_value] = field; + if (log_lvl > 1) { + console.log(`${obj_prop_name}: ${obj_prop_value} type=${typeof obj_prop_value}`); + } - // Trim string values if needed - if (trim_values && typeof obj_prop_value === 'string') { - if (log_lvl && obj_prop_value.trim() != obj_prop_value) { - console.log('Trimming string value!'); - obj_prop_value = obj_prop_value.trim(); - } - } + // Trim string values if needed + if (trim_values && typeof obj_prop_value === 'string') { + if (log_lvl && obj_prop_value.trim() != obj_prop_value) { + console.log('Trimming string value!'); + obj_prop_value = obj_prop_value.trim(); + } + } - // Convert string to boolean if needed - if (bool_tf_str && typeof obj_prop_value === 'string') { - // console.log('Flag set for converting true/false string values to boolean!'); + // Convert string to boolean if needed + if (bool_tf_str && typeof obj_prop_value === 'string') { + // console.log('Flag set for converting true/false string values to boolean!'); - if (obj_prop_value.toLowerCase() === 'true') { - if (log_lvl) { - console.log('Converting string to boolean value: true'); - } - obj_prop_value = true; - } else if (obj_prop_value.toLowerCase() === 'false') { - if (log_lvl) { - console.log('Converting string to boolean value: false'); - } - obj_prop_value = false; - } - } + if (obj_prop_value.toLowerCase() === 'true') { + if (log_lvl) { + console.log('Converting string to boolean value: true'); + } + obj_prop_value = true; + } else if (obj_prop_value.toLowerCase() === 'false') { + if (log_lvl) { + console.log('Converting string to boolean value: false'); + } + obj_prop_value = false; + } + } - if (prefix && obj_prop_name.startsWith(prefix)) { - // Prefix set - // if (obj_prop_name.startsWith(prefix)) { - obj_prop_name = obj_prop_name.replace(prefix, ''); - if (log_lvl) { - console.log(`Checking: (${prefix})${obj_prop_name} value=${obj_prop_value}`); - } - if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) { - if (log_lvl) { - console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`); - } - } else if (rm_empty && !obj_prop_value) { - if (log_lvl) { - console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`); - } - } else { - if (log_lvl) { - console.log(`Match: ${prefix})${obj_prop_name} value=${obj_prop_value}`); - } - data_obj[obj_prop_name] = obj_prop_value; - } - } else if (prefix && !obj_prop_name.startsWith(prefix)) { - // Prefix set - if (log_lvl > 1) { - console.log('Did not start with prefix. Ignoring'); - } - } else { - // No prefix set - if (log_lvl) { - console.log(`Checking: ${obj_prop_name} value=${obj_prop_value}`); - } - if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) { - if (log_lvl > 1) { - console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`); - } - } else if (rm_empty && !obj_prop_value) { - if (log_lvl > 1) { - console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`); - } - } else { - if (log_lvl > 1) { - console.log(`Match: ${obj_prop_name} value=${obj_prop_value}`); - } - data_obj[obj_prop_name] = obj_prop_value; - } - } - } - if (log_lvl > 1) { - console.log(data_obj); - } - return data_obj; + if (prefix && obj_prop_name.startsWith(prefix)) { + // Prefix set + // if (obj_prop_name.startsWith(prefix)) { + obj_prop_name = obj_prop_name.replace(prefix, ''); + if (log_lvl) { + console.log(`Checking: (${prefix})${obj_prop_name} value=${obj_prop_value}`); + } + if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) { + if (log_lvl) { + console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`); + } + } else if (rm_empty && !obj_prop_value) { + if (log_lvl) { + console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`); + } + } else { + if (log_lvl) { + console.log(`Match: ${prefix})${obj_prop_name} value=${obj_prop_value}`); + } + data_obj[obj_prop_name] = obj_prop_value; + } + } else if (prefix && !obj_prop_name.startsWith(prefix)) { + // Prefix set + if (log_lvl > 1) { + console.log('Did not start with prefix. Ignoring'); + } + } else { + // No prefix set + if (log_lvl) { + console.log(`Checking: ${obj_prop_name} value=${obj_prop_value}`); + } + if (rm_empty_id && obj_prop_name.endsWith('id_random') && !obj_prop_value) { + if (log_lvl > 1) { + console.log(`Match but empty *_id_random. Ignoring/removing: ${obj_prop_name}`); + } + } else if (rm_empty && !obj_prop_value) { + if (log_lvl > 1) { + console.log(`Match but empty. Ignoring/removing: ${obj_prop_name}`); + } + } else { + if (log_lvl > 1) { + console.log(`Match: ${obj_prop_name} value=${obj_prop_value}`); + } + data_obj[obj_prop_name] = obj_prop_value; + } + } + } + if (log_lvl > 1) { + console.log(data_obj); + } + return data_obj; }; diff --git a/src/lib/ae_utils/ae_utils__file_extension_icon.ts b/src/lib/ae_utils/ae_utils__file_extension_icon.ts index 27cb91f4..f333be99 100644 --- a/src/lib/ae_utils/ae_utils__file_extension_icon.ts +++ b/src/lib/ae_utils/ae_utils__file_extension_icon.ts @@ -2,49 +2,49 @@ import type { key_str } from './ae_utils'; // Updated 2024-06-19 export function file_extension_icon(extension: string) { - // console.log('*** file_extension_icon() ***'); - const file_icons: key_str = { - file: 'file', - '3gp': 'file-video', - '7z': 'file-archive', - aac: 'file-audio', - ac3: 'file-audio', - aif: 'file-audio', - aiff: 'file-audio', - avi: 'file-video', - bmp: 'file-image', - csv: 'file-csv', - doc: 'file-word', - docx: 'file-word', - eps: 'file-image', - flac: 'file-audio', - gif: 'file-image', - htm: 'file-code', - html: 'file-code', - jpeg: 'file-image', - jpg: 'file-image', - key: 'file-powerpoint', - mkv: 'file-video', - mov: 'file-video', - mp3: 'file-audio', - mp4: 'file-video', - odp: 'file-powerpoint', - pdf: 'file-pdf', - png: 'file-image', - ppt: 'file-powerpoint', - pptx: 'file-powerpoint', - txt: 'file-alt', - wav: 'file-audio', - webp: 'file-image', - xls: 'file-excel', - xlsx: 'file-excel', - zip: 'file-archive' - }; + // console.log('*** file_extension_icon() ***'); + const file_icons: key_str = { + file: 'file', + '3gp': 'file-video', + '7z': 'file-archive', + aac: 'file-audio', + ac3: 'file-audio', + aif: 'file-audio', + aiff: 'file-audio', + avi: 'file-video', + bmp: 'file-image', + csv: 'file-csv', + doc: 'file-word', + docx: 'file-word', + eps: 'file-image', + flac: 'file-audio', + gif: 'file-image', + htm: 'file-code', + html: 'file-code', + jpeg: 'file-image', + jpg: 'file-image', + key: 'file-powerpoint', + mkv: 'file-video', + mov: 'file-video', + mp3: 'file-audio', + mp4: 'file-video', + odp: 'file-powerpoint', + pdf: 'file-pdf', + png: 'file-image', + ppt: 'file-powerpoint', + pptx: 'file-powerpoint', + txt: 'file-alt', + wav: 'file-audio', + webp: 'file-image', + xls: 'file-excel', + xlsx: 'file-excel', + zip: 'file-archive' + }; - if (file_icons[extension]) { - return file_icons[extension]; - } else { - // return null; - return file_icons['file']; - } + if (file_icons[extension]) { + return file_icons[extension]; + } else { + // return null; + return file_icons['file']; + } } diff --git a/src/lib/ae_utils/ae_utils__files.ts b/src/lib/ae_utils/ae_utils__files.ts index 50933267..6d34d062 100644 --- a/src/lib/ae_utils/ae_utils__files.ts +++ b/src/lib/ae_utils/ae_utils__files.ts @@ -3,84 +3,84 @@ // Use a defined list of unacceptable characters to remove from a filename. // Updated 2024-10-18 export const clean_filename = function clean_filename( - filename: any | string, - unacceptable_chars: RegExp = /[ <>:"/\\|?*]/g, - replacement_char: string = '_' + filename: any | string, + unacceptable_chars: RegExp = /[ <>:"/\\|?*]/g, + replacement_char: string = '_' ) { - // console.log('*** clean_filename() ***'); - if (!filename) { - return ''; - } + // console.log('*** clean_filename() ***'); + if (!filename) { + return ''; + } - const cleaned_filename = filename.replace(unacceptable_chars, replacement_char); - // console.log(cleaned_filename); - return cleaned_filename; + const cleaned_filename = filename.replace(unacceptable_chars, replacement_char); + // console.log(cleaned_filename); + return cleaned_filename; }; export const 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 dm = decimals < 0 ? 0 : decimals; - const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - 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 export const guess_file_name = function guess_file_name(filename_string: string) { - // console.log('*** guess_file_name() ***'); - if (!filename_string) { - return ''; - } + // console.log('*** guess_file_name() ***'); + if (!filename_string) { + return ''; + } - if (filename_string.includes('.')) { - const file_name = filename_string.substring(0, filename_string.lastIndexOf('.')); - // console.log(file_name); - return file_name; - } else { - return filename_string; - } + if (filename_string.includes('.')) { + const file_name = filename_string.substring(0, filename_string.lastIndexOf('.')); + // console.log(file_name); + return file_name; + } else { + return filename_string; + } }; // Updated 2024-08-12 export const guess_file_extension = function guess_file_extension(filename_string: string) { - // console.log('*** guess_file_extension() ***'); - if (!filename_string) { - return ''; - } + // console.log('*** guess_file_extension() ***'); + if (!filename_string) { + return ''; + } - if (!filename_string.includes('.')) { - return ''; - } + if (!filename_string.includes('.')) { + return ''; + } - const file_extension = - filename_string.substring(filename_string.lastIndexOf('.') + 1, filename_string.length) || - filename_string; - // console.log(file_extension); - return file_extension; + const file_extension = + filename_string.substring(filename_string.lastIndexOf('.') + 1, filename_string.length) || + filename_string; + // console.log(file_extension); + return file_extension; }; // Updated 2024-08-12 export const get_file_hash = async function get_file_hash(file) { - return new Promise((resolve, reject) => { - const file_reader = new FileReader(); + return new Promise((resolve, reject) => { + const file_reader = new FileReader(); - file_reader.onload = async function () { - if (file_reader.result.byteLength !== file.size) { - console.log('File was not read completely'); - reject('Error reading the file'); - } + file_reader.onload = async function () { + if (file_reader.result.byteLength !== file.size) { + console.log('File was not read completely'); + reject('Error reading the file'); + } - const hash_buffer = await crypto.subtle.digest('SHA-256', file_reader.result); - 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_buffer = await crypto.subtle.digest('SHA-256', file_reader.result); + const hash_array = Array.from(new Uint8Array(hash_buffer)); + 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); + }); }; diff --git a/src/lib/ae_utils/ae_utils__get_obj_li_w_match_prop.ts b/src/lib/ae_utils/ae_utils__get_obj_li_w_match_prop.ts index 06d613c9..190b70e3 100644 --- a/src/lib/ae_utils/ae_utils__get_obj_li_w_match_prop.ts +++ b/src/lib/ae_utils/ae_utils__get_obj_li_w_match_prop.ts @@ -1,43 +1,43 @@ /* Returns a list of objects that have a matching property value. */ // Updated 2023-06-28 export const get_obj_li_w_match_prop = function get_obj_li_w_match_prop({ - obj_li, - property, - value, - log_lvl = 0 + obj_li, + property, + value, + log_lvl = 0 }: { - obj_li: any[]; - property: string; - value: any; - log_lvl?: number; + obj_li: any[]; + property: string; + value: any; + log_lvl?: number; }) { - if (log_lvl) { - console.log('Search Object List:', obj_li); - console.log(`Property: ${property}`); - console.log(`Value: ${value}`); - } - if (log_lvl > 1) { - console.log(`Type Of: ${typeof value}`); - } + if (log_lvl) { + console.log('Search Object List:', obj_li); + console.log(`Property: ${property}`); + console.log(`Value: ${value}`); + } + if (log_lvl > 1) { + console.log(`Type Of: ${typeof value}`); + } - // Create an empty array to store the matching objects. - const matching_obj_li = []; + // Create an empty array to store the matching objects. + const matching_obj_li = []; - // Iterate through the list of objects. - for (const object of obj_li) { - // Check if the object has the specified property and the value of the property matches the specified value. - if (object.hasOwnProperty(property)) { - // console.log('Has property at least....', object[property], typeof object[property]); - } - if (object.hasOwnProperty(property) && object[property] === value) { - // Add the object to the array of matching objects. - matching_obj_li.push(object); - } - } + // Iterate through the list of objects. + for (const object of obj_li) { + // Check if the object has the specified property and the value of the property matches the specified value. + if (object.hasOwnProperty(property)) { + // console.log('Has property at least....', object[property], typeof object[property]); + } + if (object.hasOwnProperty(property) && object[property] === value) { + // Add the object to the array of matching objects. + matching_obj_li.push(object); + } + } - // Return the array of matching objects. - if (log_lvl > 1) { - console.log('Matching Object List:', matching_obj_li); - } - return matching_obj_li; + // Return the array of matching objects. + if (log_lvl > 1) { + console.log('Matching Object List:', matching_obj_li); + } + return matching_obj_li; }; diff --git a/src/lib/ae_utils/ae_utils__is_datetime_recent.ts b/src/lib/ae_utils/ae_utils__is_datetime_recent.ts index fa690db9..fad167e6 100644 --- a/src/lib/ae_utils/ae_utils__is_datetime_recent.ts +++ b/src/lib/ae_utils/ae_utils__is_datetime_recent.ts @@ -1,26 +1,26 @@ // Function to check if the file (or anything) timestamp was created within the last X minutes export const is_datetime_recent = function is_datetime_recent({ - datetime, - minutes, - log_lvl = 0 + datetime, + minutes, + log_lvl = 0 }: { - datetime: string; - minutes: number; - log_lvl?: number; + datetime: string; + minutes: number; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** is_datetime_recent() *** datetime=${datetime} minutes=${minutes}`); - } + if (log_lvl) { + console.log(`*** is_datetime_recent() *** datetime=${datetime} minutes=${minutes}`); + } - const now: any = new Date(); - const then: any = new Date(datetime); + const now: any = new Date(); + const then: any = new Date(datetime); - const diff = now - then; - const diff_minutes = Math.floor(diff / 60000); + const diff = now - then; + const diff_minutes = Math.floor(diff / 60000); - if (diff_minutes < minutes) { - return true; - } else { - return false; - } + if (diff_minutes < minutes) { + return true; + } else { + return false; + } }; diff --git a/src/lib/ae_utils/ae_utils__perm_checks.ts b/src/lib/ae_utils/ae_utils__perm_checks.ts index 091da69f..87b3710e 100644 --- a/src/lib/ae_utils/ae_utils__perm_checks.ts +++ b/src/lib/ae_utils/ae_utils__perm_checks.ts @@ -1,199 +1,199 @@ type key_val = { - [key: string]: any; + [key: string]: any; }; // NOTE: I know there is a better more efficient way to do this, but I don't have time for that right now. export const process_permission_checks = function process_permission_checks(access_type: string) { - // let access_checks = { 'access_type': null, 'super_check': null }; - const access_checks: key_val = {}; + // let access_checks = { 'access_type': null, 'super_check': null }; + const access_checks: key_val = {}; - if (access_type == 'super') { - access_checks.allow_access = true; - access_checks.access_type = 'super'; + if (access_type == 'super') { + access_checks.allow_access = true; + access_checks.access_type = 'super'; - access_checks.super_check = true; - access_checks.manager_check = false; - access_checks.administrator_check = false; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = false; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = false; - access_checks.authenticated_check = true; - access_checks.anonymous_check = false; + access_checks.super_check = true; + access_checks.manager_check = false; + access_checks.administrator_check = false; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = false; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = false; + access_checks.authenticated_check = true; + access_checks.anonymous_check = false; - access_checks.super_access = true; - access_checks.manager_access = true; - access_checks.administrator_access = true; - access_checks.support_access = true; - access_checks.assistant_access = true; - access_checks.trusted_access = true; - access_checks.verified_access = true; - access_checks.provisional_access = true; - access_checks.public_access = true; - access_checks.authenticated_access = true; - access_checks.anonymous_access = true; - } else if (access_type == 'manager') { - access_checks.allow_access = true; - access_checks.access_type = 'manager'; + access_checks.super_access = true; + access_checks.manager_access = true; + access_checks.administrator_access = true; + access_checks.support_access = true; + access_checks.assistant_access = true; + access_checks.trusted_access = true; + access_checks.verified_access = true; + access_checks.provisional_access = true; + access_checks.public_access = true; + access_checks.authenticated_access = true; + access_checks.anonymous_access = true; + } else if (access_type == 'manager') { + access_checks.allow_access = true; + access_checks.access_type = 'manager'; - access_checks.super_check = false; - access_checks.manager_check = true; - access_checks.administrator_check = false; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = false; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = false; - access_checks.authenticated_check = true; - access_checks.anonymous_check = false; + access_checks.super_check = false; + access_checks.manager_check = true; + access_checks.administrator_check = false; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = false; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = false; + access_checks.authenticated_check = true; + access_checks.anonymous_check = false; - access_checks.super_access = false; - access_checks.manager_access = true; - access_checks.administrator_access = true; - access_checks.support_access = true; - access_checks.assistant_access = true; - access_checks.trusted_access = true; - access_checks.verified_access = true; - access_checks.provisional_access = true; - access_checks.public_access = true; - access_checks.authenticated_access = true; - access_checks.anonymous_access = true; - } else if (access_type == 'administrator') { - access_checks.allow_access = true; - access_checks.access_type = 'administrator'; + access_checks.super_access = false; + access_checks.manager_access = true; + access_checks.administrator_access = true; + access_checks.support_access = true; + access_checks.assistant_access = true; + access_checks.trusted_access = true; + access_checks.verified_access = true; + access_checks.provisional_access = true; + access_checks.public_access = true; + access_checks.authenticated_access = true; + access_checks.anonymous_access = true; + } else if (access_type == 'administrator') { + access_checks.allow_access = true; + access_checks.access_type = 'administrator'; - access_checks.super_check = false; - access_checks.manager_check = false; - access_checks.administrator_check = true; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = false; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = false; - access_checks.authenticated_check = false; - access_checks.anonymous_check = false; + access_checks.super_check = false; + access_checks.manager_check = false; + access_checks.administrator_check = true; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = false; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = false; + access_checks.authenticated_check = false; + access_checks.anonymous_check = false; - access_checks.super_access = false; - access_checks.manager_access = false; - access_checks.administrator_access = true; - access_checks.support_access = true; - access_checks.assistant_access = true; - access_checks.trusted_access = true; - access_checks.verified_access = true; - access_checks.provisional_access = true; - access_checks.public_access = true; - access_checks.authenticated_access = true; - access_checks.anonymous_access = true; - } else if (access_type == 'trusted') { - access_checks.allow_access = true; // Should this be true?? -2024-10-03 - access_checks.access_type = 'trusted'; + access_checks.super_access = false; + access_checks.manager_access = false; + access_checks.administrator_access = true; + access_checks.support_access = true; + access_checks.assistant_access = true; + access_checks.trusted_access = true; + access_checks.verified_access = true; + access_checks.provisional_access = true; + access_checks.public_access = true; + access_checks.authenticated_access = true; + access_checks.anonymous_access = true; + } else if (access_type == 'trusted') { + access_checks.allow_access = true; // Should this be true?? -2024-10-03 + access_checks.access_type = 'trusted'; - access_checks.super_check = false; - access_checks.manager_check = false; - access_checks.administrator_check = false; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = true; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = false; - access_checks.authenticated_check = true; - access_checks.anonymous_check = false; + access_checks.super_check = false; + access_checks.manager_check = false; + access_checks.administrator_check = false; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = true; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = false; + access_checks.authenticated_check = true; + access_checks.anonymous_check = false; - access_checks.super_access = false; - access_checks.manager_access = false; - access_checks.administrator_access = false; - access_checks.support_access = false; - access_checks.assistant_access = false; - access_checks.trusted_access = true; - access_checks.verified_access = true; - access_checks.provisional_access = true; - access_checks.public_access = true; - access_checks.authenticated_access = true; - access_checks.anonymous_access = true; - } else if (access_type == 'public') { - access_checks.access_type = 'public'; + access_checks.super_access = false; + access_checks.manager_access = false; + access_checks.administrator_access = false; + access_checks.support_access = false; + access_checks.assistant_access = false; + access_checks.trusted_access = true; + access_checks.verified_access = true; + access_checks.provisional_access = true; + access_checks.public_access = true; + access_checks.authenticated_access = true; + access_checks.anonymous_access = true; + } else if (access_type == 'public') { + access_checks.access_type = 'public'; - access_checks.super_check = false; - access_checks.manager_check = false; - access_checks.administrator_check = false; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = false; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = true; - access_checks.authenticated_check = false; - access_checks.anonymous_check = false; + access_checks.super_check = false; + access_checks.manager_check = false; + access_checks.administrator_check = false; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = false; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = true; + access_checks.authenticated_check = false; + access_checks.anonymous_check = false; - access_checks.super_access = false; - access_checks.manager_access = false; - access_checks.administrator_access = false; - access_checks.support_access = false; - access_checks.assistant_access = false; - access_checks.trusted_access = false; - access_checks.verified_access = false; - access_checks.provisional_access = false; - access_checks.public_access = true; - access_checks.authenticated_access = true; - access_checks.anonymous_access = true; - } else if (access_type == 'authenticated') { - access_checks.access_type = 'authenticated'; + access_checks.super_access = false; + access_checks.manager_access = false; + access_checks.administrator_access = false; + access_checks.support_access = false; + access_checks.assistant_access = false; + access_checks.trusted_access = false; + access_checks.verified_access = false; + access_checks.provisional_access = false; + access_checks.public_access = true; + access_checks.authenticated_access = true; + access_checks.anonymous_access = true; + } else if (access_type == 'authenticated') { + access_checks.access_type = 'authenticated'; - access_checks.super_check = false; - access_checks.manager_check = false; - access_checks.administrator_check = false; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = false; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = false; - access_checks.authenticated_check = true; - access_checks.anonymous_check = false; + access_checks.super_check = false; + access_checks.manager_check = false; + access_checks.administrator_check = false; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = false; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = false; + access_checks.authenticated_check = true; + access_checks.anonymous_check = false; - access_checks.super_access = false; - access_checks.manager_access = false; - access_checks.administrator_access = false; - access_checks.support_access = false; - access_checks.assistant_access = false; - access_checks.trusted_access = false; - access_checks.verified_access = false; - access_checks.provisional_access = false; - access_checks.public_access = false; - access_checks.authenticated_access = true; - access_checks.anonymous_access = true; - } else { - access_checks.access_type = 'anonymous'; + access_checks.super_access = false; + access_checks.manager_access = false; + access_checks.administrator_access = false; + access_checks.support_access = false; + access_checks.assistant_access = false; + access_checks.trusted_access = false; + access_checks.verified_access = false; + access_checks.provisional_access = false; + access_checks.public_access = false; + access_checks.authenticated_access = true; + access_checks.anonymous_access = true; + } else { + access_checks.access_type = 'anonymous'; - access_checks.super_check = false; - access_checks.manager_check = false; - access_checks.administrator_check = false; - access_checks.support_check = false; - access_checks.assistant_check = false; - access_checks.trusted_check = false; - access_checks.verified_check = false; - access_checks.provisional_check = false; - access_checks.public_check = false; - access_checks.authenticated_check = false; - access_checks.anonymous_check = true; + access_checks.super_check = false; + access_checks.manager_check = false; + access_checks.administrator_check = false; + access_checks.support_check = false; + access_checks.assistant_check = false; + access_checks.trusted_check = false; + access_checks.verified_check = false; + access_checks.provisional_check = false; + access_checks.public_check = false; + access_checks.authenticated_check = false; + access_checks.anonymous_check = true; - access_checks.super_access = false; - access_checks.manager_access = false; - access_checks.administrator_access = false; - access_checks.support_access = false; - access_checks.assistant_access = false; - access_checks.trusted_access = false; - access_checks.verified_access = false; - access_checks.provisional_access = false; - access_checks.public_access = false; - access_checks.authenticated_access = false; - access_checks.anonymous_access = true; - } + access_checks.super_access = false; + access_checks.manager_access = false; + access_checks.administrator_access = false; + access_checks.support_access = false; + access_checks.assistant_access = false; + access_checks.trusted_access = false; + access_checks.verified_access = false; + access_checks.provisional_access = false; + access_checks.public_access = false; + access_checks.authenticated_access = false; + access_checks.anonymous_access = true; + } - return access_checks; + return access_checks; }; diff --git a/src/lib/ae_utils/ae_utils__process_data_string.ts b/src/lib/ae_utils/ae_utils__process_data_string.ts index 13e0c1dd..4f4fd5b4 100644 --- a/src/lib/ae_utils/ae_utils__process_data_string.ts +++ b/src/lib/ae_utils/ae_utils__process_data_string.ts @@ -18,73 +18,73 @@ import type { key_val } from './ae_utils'; // Updated 2022-02-11 export const process_data_string = function process_data_string(data_string: string) { - console.log('*** process_data_string() ***'); - // console.log(data_string); - if (!data_string || data_string.length < 1) { - console.log('No data string found.'); - return false; - } + console.log('*** process_data_string() ***'); + // console.log(data_string); + if (!data_string || data_string.length < 1) { + console.log('No data string found.'); + return false; + } - const obj: key_val = {}; + const obj: key_val = {}; - const colon_index = data_string.indexOf(':'); - if (colon_index) { - const data_string_type = data_string.slice(0, colon_index); - console.log(data_string_type); + const colon_index = data_string.indexOf(':'); + if (colon_index) { + const data_string_type = data_string.slice(0, colon_index); + console.log(data_string_type); - obj['qr_type'] = data_string_type; + obj['qr_type'] = data_string_type; - if (data_string_type == 'MECARD') { - const mecard_str = data_string.slice(colon_index + 1); - console.log(mecard_str); + if (data_string_type == 'MECARD') { + const mecard_str = data_string.slice(colon_index + 1); + console.log(mecard_str); - obj['str'] = mecard_str; - } else if (data_string_type == 'OBJ') { - const key_value_str = data_string.slice(colon_index + 1); - console.log(key_value_str); - const key_value_array = key_value_str.split(','); - // console.log(key_value_array); - const ot_colon_index = key_value_array[0].indexOf(':'); - const obj_type = key_value_array[0].slice(ot_colon_index + 1); - // console.log(obj_type); - const oi_colon_index = key_value_array[1].indexOf(':'); - const obj_id = key_value_array[1].slice(oi_colon_index + 1); - // console.log(obj_id); - obj['type'] = obj_type; - obj['id'] = obj_id; - } else if (data_string_type == 'JSON') { - const partial_json_str = data_string.slice(colon_index + 1); - console.log(partial_json_str); - const json_str = `{${partial_json_str}}`; - console.log(json_str); + obj['str'] = mecard_str; + } else if (data_string_type == 'OBJ') { + const key_value_str = data_string.slice(colon_index + 1); + console.log(key_value_str); + const key_value_array = key_value_str.split(','); + // console.log(key_value_array); + const ot_colon_index = key_value_array[0].indexOf(':'); + const obj_type = key_value_array[0].slice(ot_colon_index + 1); + // console.log(obj_type); + const oi_colon_index = key_value_array[1].indexOf(':'); + const obj_id = key_value_array[1].slice(oi_colon_index + 1); + // console.log(obj_id); + obj['type'] = obj_type; + obj['id'] = obj_id; + } else if (data_string_type == 'JSON') { + const partial_json_str = data_string.slice(colon_index + 1); + console.log(partial_json_str); + const json_str = `{${partial_json_str}}`; + console.log(json_str); - obj['json'] = JSON.parse(json_str); - } else if (data_string_type == 'STR') { - const str = data_string.slice(colon_index + 1); - console.log(str); + obj['json'] = JSON.parse(json_str); + } else if (data_string_type == 'STR') { + const str = data_string.slice(colon_index + 1); + console.log(str); - obj['str'] = str; - } else if (data_string_type == 'http' || data_string_type == 'https') { - console.log(`http or https: ${data_string}`); + obj['str'] = str; + } else if (data_string_type == 'http' || data_string_type == 'https') { + console.log(`http or https: ${data_string}`); - obj['type'] = 'url'; - obj['url'] = data_string; - } else { - console.log('The unknown data string type was found. Returning the string part.'); - const unknown_str = data_string.slice(colon_index + 1); - console.log(unknown_str); + obj['type'] = 'url'; + obj['url'] = data_string; + } else { + console.log('The unknown data string type was found. Returning the string part.'); + const unknown_str = data_string.slice(colon_index + 1); + console.log(unknown_str); - obj['str'] = unknown_str; - } - } else { - console.log('The data string type was not found. Returning the entire string.'); - console.log(data_string); + obj['str'] = unknown_str; + } + } else { + console.log('The data string type was not found. Returning the entire string.'); + console.log(data_string); - obj['qr_type'] = 'UNKNOWN'; - obj['str'] = data_string; - // return false; - } + obj['qr_type'] = 'UNKNOWN'; + obj['str'] = data_string; + // return false; + } - console.log(obj); - return obj; // Returns an object + console.log(obj); + return obj; // Returns an object }; diff --git a/src/lib/ae_utils/ae_utils__return_obj_type_path.ts b/src/lib/ae_utils/ae_utils__return_obj_type_path.ts index ef857cf0..dee38c49 100644 --- a/src/lib/ae_utils/ae_utils__return_obj_type_path.ts +++ b/src/lib/ae_utils/ae_utils__return_obj_type_path.ts @@ -1,87 +1,87 @@ export function return_obj_type_path({ obj_type = null, obj_type_prop_name = null }) { - console.log('*** return_obj_type_path() ***'); + console.log('*** return_obj_type_path() ***'); - let obj_type_path = null; + let obj_type_path = null; - 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' - ]; + 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' + ]; - const known_obj_type_li_dict = [ - { name: 'account', display: 'Account', path: 'account' }, - { name: 'archive', display: 'Archive', path: 'archive' }, - { name: 'address', display: 'Address', path: 'address' }, - { name: 'archive', display: 'Archive', path: 'archive' }, - { name: 'archive_content', display: 'Archive Content', path: 'archive/content' }, - { name: 'contact', display: 'Contact', path: 'contact' }, - { name: 'data_store', display: 'Data Store', path: 'data_store' }, - { name: 'event_abstract', display: 'Event Abstract', path: 'event/abstract' }, - { name: 'event_badge', display: 'Event Badge', path: 'event/badge' }, - { name: 'event_device', display: 'Event Device', path: 'event/device' }, - { name: 'event_exhibit', display: 'Event Exhibit', path: 'event/exhibit' }, - { name: 'event_file', display: 'Event File', path: 'event/file' }, - { name: 'event_location', display: 'Event Location', path: 'event/location' }, - { name: 'event_person', display: 'Event Person', path: 'event/person' }, - { name: 'event_presentation', display: 'Event Presentation', path: 'event/' }, - { name: 'event_presenter', display: 'Event Presenter', path: 'event/presenter' }, - { name: 'event_registration', display: 'Event Registration', path: 'event/registration' }, - { name: 'event_session', display: 'Event Session', path: 'event/session' }, - { name: 'event', display: 'Event', path: 'event' }, - { name: 'hosted_file', display: 'Hosted File', path: 'hosted_file' }, - { name: 'journal', display: 'Journal', path: 'journal' }, - { name: 'journal_entry', display: 'Journal Entry', path: 'journal/entry' }, - { name: 'order_line', display: 'Order Line', path: 'order/line' }, - { name: 'order', display: 'Order', path: 'order' }, - { name: 'person', display: 'Person', path: 'person' }, - { name: 'post', display: 'Archive', path: 'post' }, - { name: 'post_comment', display: 'Archive Content', path: 'post/comment' }, - { name: 'user', display: 'User', path: 'user' } - ]; + const known_obj_type_li_dict = [ + { name: 'account', display: 'Account', path: 'account' }, + { name: 'archive', display: 'Archive', path: 'archive' }, + { name: 'address', display: 'Address', path: 'address' }, + { name: 'archive', display: 'Archive', path: 'archive' }, + { name: 'archive_content', display: 'Archive Content', path: 'archive/content' }, + { name: 'contact', display: 'Contact', path: 'contact' }, + { name: 'data_store', display: 'Data Store', path: 'data_store' }, + { name: 'event_abstract', display: 'Event Abstract', path: 'event/abstract' }, + { name: 'event_badge', display: 'Event Badge', path: 'event/badge' }, + { name: 'event_device', display: 'Event Device', path: 'event/device' }, + { name: 'event_exhibit', display: 'Event Exhibit', path: 'event/exhibit' }, + { name: 'event_file', display: 'Event File', path: 'event/file' }, + { name: 'event_location', display: 'Event Location', path: 'event/location' }, + { name: 'event_person', display: 'Event Person', path: 'event/person' }, + { name: 'event_presentation', display: 'Event Presentation', path: 'event/' }, + { name: 'event_presenter', display: 'Event Presenter', path: 'event/presenter' }, + { name: 'event_registration', display: 'Event Registration', path: 'event/registration' }, + { name: 'event_session', display: 'Event Session', path: 'event/session' }, + { name: 'event', display: 'Event', path: 'event' }, + { name: 'hosted_file', display: 'Hosted File', path: 'hosted_file' }, + { name: 'journal', display: 'Journal', path: 'journal' }, + { name: 'journal_entry', display: 'Journal Entry', path: 'journal/entry' }, + { name: 'order_line', display: 'Order Line', path: 'order/line' }, + { name: 'order', display: 'Order', path: 'order' }, + { name: 'person', display: 'Person', path: 'person' }, + { name: 'post', display: 'Archive', path: 'post' }, + { name: 'post_comment', display: 'Archive Content', path: 'post/comment' }, + { name: 'user', display: 'User', path: 'user' } + ]; - if (obj_type) { - // Need to loop through known for safety? - obj_type_path = obj_type_prop_name.replaceAll('_', '/'); - } else if (obj_type_prop_name) { - let found_obj_type_name = null; - let found_obj_type_path = null; + if (obj_type) { + // Need to loop through known for safety? + obj_type_path = obj_type_prop_name.replaceAll('_', '/'); + } else if (obj_type_prop_name) { + let found_obj_type_name = null; + let found_obj_type_path = null; - for (let i = 0; i < known_obj_type_li_dict.length; i++) { - // console.log(known_obj_type_li_dict[i]); - // let guessed_obj_type = prop_name.startsWith(known_obj_type_li_dict[i] - if (obj_type_prop_name.startsWith(known_obj_type_li_dict[i].name)) { - console.log(`Found ${known_obj_type_li_dict[i].name}`); - found_obj_type_name = known_obj_type_li_dict[i].name; - found_obj_type_path = known_obj_type_li_dict[i].path; - // obj_type_path = obj_type_prop_name.replaceAll('_', '/'); - obj_type_path = found_obj_type_path; - break; - } - } - } else { - console.log('Missing required parameters'); - return false; - } + for (let i = 0; i < known_obj_type_li_dict.length; i++) { + // console.log(known_obj_type_li_dict[i]); + // let guessed_obj_type = prop_name.startsWith(known_obj_type_li_dict[i] + if (obj_type_prop_name.startsWith(known_obj_type_li_dict[i].name)) { + console.log(`Found ${known_obj_type_li_dict[i].name}`); + found_obj_type_name = known_obj_type_li_dict[i].name; + found_obj_type_path = known_obj_type_li_dict[i].path; + // obj_type_path = obj_type_prop_name.replaceAll('_', '/'); + obj_type_path = found_obj_type_path; + break; + } + } + } else { + console.log('Missing required parameters'); + return false; + } - return obj_type_path; + return obj_type_path; } diff --git a/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts b/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts index ebb4475c..ca828fb3 100644 --- a/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts +++ b/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts @@ -2,123 +2,123 @@ import { to_title_case } from './ae_utils__to_title_case'; // 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 + 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) { - return override; - } + if (override) { + return override; + } - 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 = [ + '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 = [ - { name: 'account', display: 'Account' }, - { name: 'address', display: 'Address' }, - { name: 'contact', display: 'Contact' }, - { name: 'event_badge', display: 'Event Badge' }, - { name: 'event_exhibit', display: 'Event Exhibit' }, - { name: 'event_file', display: 'Event File' }, - { name: 'event_location', display: 'Event Location' }, - { name: 'event_person', display: 'Event Person' }, - { name: 'event_presentation', display: 'Event Presentation' }, - { name: 'event_presenter', display: 'Event Presenter' }, - { name: 'event_registration', display: 'Event Registration' }, - { name: 'event_session', display: 'Event Session' }, - { name: 'event', display: 'Event' }, - { name: 'hosted_file', display: 'Hosted File' }, - { name: 'order_line', display: 'Order Line' }, - { name: 'order', display: 'Order' }, - { name: 'person', display: 'Person' }, - { name: 'user', display: 'User' } - ]; + const known_obj_type_li_dict = [ + { name: 'account', display: 'Account' }, + { name: 'address', display: 'Address' }, + { name: 'contact', display: 'Contact' }, + { name: 'event_badge', display: 'Event Badge' }, + { name: 'event_exhibit', display: 'Event Exhibit' }, + { name: 'event_file', display: 'Event File' }, + { name: 'event_location', display: 'Event Location' }, + { name: 'event_person', display: 'Event Person' }, + { name: 'event_presentation', display: 'Event Presentation' }, + { name: 'event_presenter', display: 'Event Presenter' }, + { name: 'event_registration', display: 'Event Registration' }, + { name: 'event_session', display: 'Event Session' }, + { name: 'event', display: 'Event' }, + { name: 'hosted_file', display: 'Hosted File' }, + { name: 'order_line', display: 'Order Line' }, + { name: 'order', display: 'Order' }, + { name: 'person', display: 'Person' }, + { name: 'user', display: 'User' } + ]; - let prop_display_name = prop_name; + let prop_display_name = prop_name; - if (!prefix_w_obj_type) { - if (obj_type) { - prop_display_name = prop_name.replace(obj_type, ''); - } else { - for (let i = 0; i < known_obj_type_li_dict.length; i++) { - // console.log(known_obj_type_li_dict[i]); - if (prop_name.startsWith(known_obj_type_li_dict[i].name)) { - // console.log(`Found ${known_obj_type_li_dict[i].name}`); - prop_display_name = prop_name.replace(known_obj_type_li_dict[i].name, ''); - break; - } - } + if (!prefix_w_obj_type) { + if (obj_type) { + prop_display_name = prop_name.replace(obj_type, ''); + } else { + for (let i = 0; i < known_obj_type_li_dict.length; i++) { + // console.log(known_obj_type_li_dict[i]); + if (prop_name.startsWith(known_obj_type_li_dict[i].name)) { + // console.log(`Found ${known_obj_type_li_dict[i].name}`); + prop_display_name = prop_name.replace(known_obj_type_li_dict[i].name, ''); + break; + } + } - // for (let i = 0; i < known_obj_type_li.length; i++) { - // // console.log(known_obj_type_li[i]); - // if (prop_name.startsWith(known_obj_type_li[i])) { - // console.log(`Found ${known_obj_type_li[i]}`); - // prop_display_name = prop_name.replace(known_obj_type_li[i], ''); - // break; - // } - // } - } - } else { - if (!prefix_all_w_obj_type) { - for (let i = 0; i < known_obj_type_li.length; i++) { - // console.log(known_obj_type_li[i]); - let found_obj_type = null; + // for (let i = 0; i < known_obj_type_li.length; i++) { + // // console.log(known_obj_type_li[i]); + // if (prop_name.startsWith(known_obj_type_li[i])) { + // console.log(`Found ${known_obj_type_li[i]}`); + // prop_display_name = prop_name.replace(known_obj_type_li[i], ''); + // break; + // } + // } + } + } else { + if (!prefix_all_w_obj_type) { + for (let i = 0; i < known_obj_type_li.length; i++) { + // console.log(known_obj_type_li[i]); + let found_obj_type = null; - if (prop_name.startsWith(known_obj_type_li_dict[i].name)) { - // if (prop_name.startsWith(known_obj_type_li[i])) { - // console.log(`Found ${known_obj_type_li_dict[i].name}`); - found_obj_type = known_obj_type_li_dict[i].name; - if (found_obj_type == obj_type) { - prop_display_name = prop_name.replace(known_obj_type_li_dict[i].name, ''); - } + if (prop_name.startsWith(known_obj_type_li_dict[i].name)) { + // if (prop_name.startsWith(known_obj_type_li[i])) { + // console.log(`Found ${known_obj_type_li_dict[i].name}`); + found_obj_type = known_obj_type_li_dict[i].name; + if (found_obj_type == obj_type) { + prop_display_name = prop_name.replace(known_obj_type_li_dict[i].name, ''); + } - break; - } - } + break; + } + } - // if (obj_type) { - // prop_display_name = prop_name.replace(obj_type, ''); - // } else { - } - } + // if (obj_type) { + // prop_display_name = prop_name.replace(obj_type, ''); + // } else { + } + } - // console.log(prop_display_name); - if (prop_display_name.search('ID')) { - } - prop_display_name = prop_display_name.replace('id_random', 'ID'); + // console.log(prop_display_name); + if (prop_display_name.search('ID')) { + } + prop_display_name = prop_display_name.replace('id_random', 'ID'); - if (replace_underscores) { - prop_display_name = prop_display_name.replaceAll('_', ' '); - } + if (replace_underscores) { + prop_display_name = prop_display_name.replaceAll('_', ' '); + } - if (title_case) { - prop_display_name = to_title_case(prop_display_name); - } + if (title_case) { + prop_display_name = to_title_case(prop_display_name); + } - // console.log(prop_display_name); - return prop_display_name; + // console.log(prop_display_name); + return prop_display_name; } diff --git a/src/lib/ae_utils/ae_utils__to_title_case.ts b/src/lib/ae_utils/ae_utils__to_title_case.ts index 76b632a4..25bf3454 100644 --- a/src/lib/ae_utils/ae_utils__to_title_case.ts +++ b/src/lib/ae_utils/ae_utils__to_title_case.ts @@ -1,43 +1,44 @@ /* Adapted from: To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */ export function to_title_case(text_string) { - // console.log('*** to_title_case() ***'); - const smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i; - const alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/; - const wordSeparators = /([ :–—-])/; + // console.log('*** to_title_case() ***'); + const smallWords = + /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i; + const alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/; + const wordSeparators = /([ :–—-])/; - return text_string - .split(wordSeparators) - .map(function (current, index, array) { - if ( - /* Check for small words */ - current.search(smallWords) > -1 && - /* Skip first and last word */ - index !== 0 && - index !== array.length - 1 && - /* Ignore title end and subtitle start */ - array[index - 3] !== ':' && - array[index + 1] !== ':' && - /* Ignore small words that start a hyphenated phrase */ - (array[index + 1] !== '-' || (array[index - 1] === '-' && array[index + 1] === '-')) - ) { - return current.toLowerCase(); - } + return text_string + .split(wordSeparators) + .map(function (current, index, array) { + if ( + /* Check for small words */ + current.search(smallWords) > -1 && + /* Skip first and last word */ + index !== 0 && + index !== array.length - 1 && + /* Ignore title end and subtitle start */ + array[index - 3] !== ':' && + array[index + 1] !== ':' && + /* Ignore small words that start a hyphenated phrase */ + (array[index + 1] !== '-' || (array[index - 1] === '-' && array[index + 1] === '-')) + ) { + return current.toLowerCase(); + } - /* Ignore intentional capitalization */ - if (current.substr(1).search(/[A-Z]|\../) > -1) { - return current; - } + /* Ignore intentional capitalization */ + if (current.substr(1).search(/[A-Z]|\../) > -1) { + return current; + } - /* Ignore URLs */ - if (array[index + 1] === ':' && array[index + 2] !== '') { - return current; - } + /* Ignore URLs */ + if (array[index + 1] === ':' && array[index + 2] !== '') { + return current; + } - /* Capitalize the first letter */ - return current.replace(alphanumericPattern, function (match) { - return match.toUpperCase(); - }); - }) - .join(''); + /* Capitalize the first letter */ + return current.replace(alphanumericPattern, function (match) { + return match.toUpperCase(); + }); + }) + .join(''); } diff --git a/src/lib/api/api.ts b/src/lib/api/api.ts index 14e128d5..959af263 100644 --- a/src/lib/api/api.ts +++ b/src/lib/api/api.ts @@ -16,724 +16,724 @@ import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/ae_api/api_get__crud_obj_ // This new function has not been tested yet!!! // Updated 2024-08-07 export const get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu({ - api_cfg, - // obj_type, - for_lu_type, - // for_obj_id=null, - // use_alt_table=false, - // use_alt_base=false, - // inc={}, - enabled = 'enabled', - hidden = 'not_hidden', - order_by_li = null, - limit = 999999, - offset = 0, - // key, - // jwt=null, - headers = {}, - params_json = null, - // json_obj=null, - params = {}, - return_meta = false, - log_lvl = 1 + api_cfg, + // obj_type, + for_lu_type, + // for_obj_id=null, + // use_alt_table=false, + // use_alt_base=false, + // inc={}, + enabled = 'enabled', + hidden = 'not_hidden', + order_by_li = null, + limit = 999999, + offset = 0, + // key, + // jwt=null, + headers = {}, + params_json = null, + // json_obj=null, + params = {}, + return_meta = false, + log_lvl = 1 }: { - api_cfg: any; - // obj_type: string, - for_lu_type: string; - // for_lu_id?: string, - // use_alt_table?: boolean, - // use_alt_base?: boolean, - // inc?: key_val - enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; - hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; - order_by_li?: any; - limit?: number; - offset?: number; - // key: string, - // jwt?: string, - headers?: any; - params_json?: any; - // json_obj?: any, - params?: key_val; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + // obj_type: string, + for_lu_type: string; + // for_lu_id?: string, + // use_alt_table?: boolean, + // use_alt_base?: boolean, + // inc?: key_val + enabled?: 'enabled' | 'all' | 'not_enabled' | undefined; + hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; + order_by_li?: any; + limit?: number; + offset?: number; + // key: string, + // jwt?: string, + headers?: any; + params_json?: any; + // json_obj?: any, + params?: key_val; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** get_ae_obj_li_for_lu() *** for_lu_type=${for_lu_type}`); - } + if (log_lvl) { + console.log(`*** get_ae_obj_li_for_lu() *** for_lu_type=${for_lu_type}`); + } - let endpoint = ''; - if (for_lu_type == 'country_subdivision') { - endpoint = `/crud/lu/country_subdivision/list`; - } else if (for_lu_type == 'country') { - endpoint = `/crud/lu/country/list`; - } else if (for_lu_type == 'time_zone') { - endpoint = `/crud/lu/time_zone/list`; - } else { - console.log(`Unknown object type: ${for_lu_type}`); - return false; - } - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + let endpoint = ''; + if (for_lu_type == 'country_subdivision') { + endpoint = `/crud/lu/country_subdivision/list`; + } else if (for_lu_type == 'country') { + endpoint = `/crud/lu/country/list`; + } else if (for_lu_type == 'time_zone') { + endpoint = `/crud/lu/time_zone/list`; + } else { + console.log(`Unknown object type: ${for_lu_type}`); + return false; + } + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - if (order_by_li) { - headers['order_by_li'] = order_by_li; - } + if (order_by_li) { + headers['order_by_li'] = order_by_li; + } - const allowed_enabled_list = ['all', 'enabled', 'not_enabled']; - if (allowed_enabled_list.includes(enabled)) { - params['enabled'] = enabled; - } + const allowed_enabled_list = ['all', 'enabled', 'not_enabled']; + if (allowed_enabled_list.includes(enabled)) { + params['enabled'] = enabled; + } - const allowed_hidden_list = ['all', 'hidden', 'not_hidden']; - if (allowed_hidden_list.includes(hidden)) { - params['hidden'] = hidden; - } + const allowed_hidden_list = ['all', 'hidden', 'not_hidden']; + if (allowed_hidden_list.includes(hidden)) { + params['hidden'] = hidden; + } - if (limit >= 0) { - params['limit'] = limit; - } + if (limit >= 0) { + params['limit'] = limit; + } - if (offset >= 0) { - params['offset'] = offset; - } + if (offset >= 0) { + params['offset'] = offset; + } - const object_li_get_promise = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - headers: headers, - params: params, - // return_meta: return_meta, - log_lvl: log_lvl - }); + const object_li_get_promise = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + headers: headers, + params: params, + // return_meta: return_meta, + log_lvl: log_lvl + }); - if (log_lvl > 1) { - console.log(object_li_get_promise); - } + if (log_lvl > 1) { + console.log(object_li_get_promise); + } - return object_li_get_promise; + return object_li_get_promise; }; // Updated 2023-07-24 export const create_ae_obj_crud = async function create_ae_obj_crud({ - api_cfg, - obj_type, - field_name = null, - field_value = null, - fields = {}, - key, - jwt = null, - headers = {}, - params = {}, - data = {}, - return_obj = false, - obj_v_name = '', - return_meta = false, - log_lvl = 0 + api_cfg, + obj_type, + field_name = null, + field_value = null, + fields = {}, + key, + jwt = null, + headers = {}, + params = {}, + data = {}, + return_obj = false, + obj_v_name = '', + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - obj_type: string; - field_name?: null | string; - field_value?: any; - fields?: key_val; - key: string; - jwt?: null | string; - headers?: key_val; - params?: key_val; - data?: key_val; - return_obj?: boolean; - obj_v_name?: string; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + obj_type: string; + field_name?: null | string; + field_value?: any; + fields?: key_val; + key: string; + jwt?: null | string; + headers?: key_val; + params?: key_val; + data?: key_val; + return_obj?: boolean; + obj_v_name?: string; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** create_ae_obj_crud() *** obj_type=${obj_type}`); - } + if (log_lvl) { + console.log(`*** create_ae_obj_crud() *** obj_type=${obj_type}`); + } - data['super_key'] = key; - data['jwt'] = jwt; - // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST + data['super_key'] = key; + data['jwt'] = jwt; + // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST - // This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API. - // This is not currently being exposed to other areas of the code. It is only used here. For now? - if (obj_v_name) { - obj_v_name = ''; - } + // This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API. + // This is not currently being exposed to other areas of the code. It is only used here. For now? + if (obj_v_name) { + obj_v_name = ''; + } - let endpoint = ''; - if (obj_type == 'account') { - endpoint = `/crud/account`; - } else if (obj_type == 'activity_log') { - endpoint = `/crud/activity_log`; - } else if (obj_type == 'address') { - endpoint = `/crud/address`; - } else if (obj_type == 'archive') { - endpoint = `/crud/archive`; - } else if (obj_type == 'archive_content') { - endpoint = `/crud/archive/content`; - } else if (obj_type == 'contact') { - endpoint = `/crud/contact`; - } else if (obj_type == 'data_store') { - endpoint = `/crud/data_store`; - } else if (obj_type == 'event') { - endpoint = `/crud/event`; - } else if (obj_type == 'event_abstract') { - endpoint = `/crud/event/abstract`; - } else if (obj_type == 'event_badge') { - endpoint = `/crud/event/badge`; - } else if (obj_type == 'event_device') { - endpoint = `/crud/event/device`; - } else if (obj_type == 'event_exhibit') { - endpoint = `/crud/event/exhibit`; - } else if (obj_type == 'event_exhibit_tracking') { - endpoint = `/crud/event/exhibit/tracking`; - } else if (obj_type == 'event_file') { - endpoint = `/crud/event/file`; - } else if (obj_type == 'event_location') { - endpoint = `/crud/event/location`; - } else if (obj_type == 'event_person') { - endpoint = `/crud/event/person`; - } else if (obj_type == 'event_presentation') { - endpoint = `/crud/event/presentation`; - } else if (obj_type == 'event_presenter') { - endpoint = `/crud/event/presenter`; - // obj_v_name = 'event_presenter_soft_links'; - } else if (obj_type == 'event_session') { - endpoint = `/crud/event/session`; - } else if (obj_type == 'event_track') { - endpoint = `/crud/event/track`; - } else if (obj_type == 'grant') { - endpoint = `/crud/grant`; - } else if (obj_type == 'hosted_file') { - endpoint = `/crud/hosted_file`; - } else if (obj_type == 'journal') { - endpoint = `/crud/journal`; - } else if (obj_type == 'journal_entry') { - endpoint = `/crud/journal/entry`; - } else if (obj_type == 'order') { - endpoint = `/crud/order`; - } else if (obj_type == 'order_line') { - endpoint = `/crud/order/line`; - } else if (obj_type == 'page') { - endpoint = `/crud/page`; - } else if (obj_type == 'person') { - endpoint = `/crud/person`; - } else if (obj_type == 'post') { - endpoint = `/crud/post`; - } else if (obj_type == 'post_comment') { - endpoint = `/crud/post/comment`; - } else if (obj_type == 'sponsorship_cfg') { - endpoint = `/crud/sponsorship/cfg`; - } else if (obj_type == 'sponsorship') { - endpoint = `/crud/sponsorship`; - } else if (obj_type == 'site') { - endpoint = `/crud/site`; - // } else if (obj_type == 'user') { - // endpoint = `/crud/user`; - } else { - console.log(`Unknown object type: ${obj_type}`); - return false; - } - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + let endpoint = ''; + if (obj_type == 'account') { + endpoint = `/crud/account`; + } else if (obj_type == 'activity_log') { + endpoint = `/crud/activity_log`; + } else if (obj_type == 'address') { + endpoint = `/crud/address`; + } else if (obj_type == 'archive') { + endpoint = `/crud/archive`; + } else if (obj_type == 'archive_content') { + endpoint = `/crud/archive/content`; + } else if (obj_type == 'contact') { + endpoint = `/crud/contact`; + } else if (obj_type == 'data_store') { + endpoint = `/crud/data_store`; + } else if (obj_type == 'event') { + endpoint = `/crud/event`; + } else if (obj_type == 'event_abstract') { + endpoint = `/crud/event/abstract`; + } else if (obj_type == 'event_badge') { + endpoint = `/crud/event/badge`; + } else if (obj_type == 'event_device') { + endpoint = `/crud/event/device`; + } else if (obj_type == 'event_exhibit') { + endpoint = `/crud/event/exhibit`; + } else if (obj_type == 'event_exhibit_tracking') { + endpoint = `/crud/event/exhibit/tracking`; + } else if (obj_type == 'event_file') { + endpoint = `/crud/event/file`; + } else if (obj_type == 'event_location') { + endpoint = `/crud/event/location`; + } else if (obj_type == 'event_person') { + endpoint = `/crud/event/person`; + } else if (obj_type == 'event_presentation') { + endpoint = `/crud/event/presentation`; + } else if (obj_type == 'event_presenter') { + endpoint = `/crud/event/presenter`; + // obj_v_name = 'event_presenter_soft_links'; + } else if (obj_type == 'event_session') { + endpoint = `/crud/event/session`; + } else if (obj_type == 'event_track') { + endpoint = `/crud/event/track`; + } else if (obj_type == 'grant') { + endpoint = `/crud/grant`; + } else if (obj_type == 'hosted_file') { + endpoint = `/crud/hosted_file`; + } else if (obj_type == 'journal') { + endpoint = `/crud/journal`; + } else if (obj_type == 'journal_entry') { + endpoint = `/crud/journal/entry`; + } else if (obj_type == 'order') { + endpoint = `/crud/order`; + } else if (obj_type == 'order_line') { + endpoint = `/crud/order/line`; + } else if (obj_type == 'page') { + endpoint = `/crud/page`; + } else if (obj_type == 'person') { + endpoint = `/crud/person`; + } else if (obj_type == 'post') { + endpoint = `/crud/post`; + } else if (obj_type == 'post_comment') { + endpoint = `/crud/post/comment`; + } else if (obj_type == 'sponsorship_cfg') { + endpoint = `/crud/sponsorship/cfg`; + } else if (obj_type == 'sponsorship') { + endpoint = `/crud/sponsorship`; + } else if (obj_type == 'site') { + endpoint = `/crud/site`; + // } else if (obj_type == 'user') { + // endpoint = `/crud/user`; + } else { + console.log(`Unknown object type: ${obj_type}`); + return false; + } + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - if (return_obj) { - params['return_obj'] = true; + if (return_obj) { + params['return_obj'] = true; - // Pass along the view name to use for returning data. - if (obj_v_name) { - params['obj_v_name'] = obj_v_name; - } - } else { - params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object. - } + // Pass along the view name to use for returning data. + if (obj_v_name) { + params['obj_v_name'] = obj_v_name; + } + } else { + params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object. + } - if (field_name) { - data['data_list'] = {}; // Really an object/dict - data['data_list'][field_name] = field_value; - // data['data_list']['testing'] = 'asdf 1234'; - } else if (fields) { - data['data_list'] = fields; // Really an object/dict - } + if (field_name) { + data['data_list'] = {}; // Really an object/dict + data['data_list'][field_name] = field_value; + // data['data_list']['testing'] = 'asdf 1234'; + } else if (fields) { + data['data_list'] = fields; // Really an object/dict + } - // NOTE: The data object may contain objects that need to be converted to JSON strings. This is done by adding "_json" to the end of the property name. This is done because the API does not support nested objects. This is a limitation of the API. - if (data['data_list']) { - if (log_lvl > 1) { - console.log('Data List:', data['data_list']); - } - for (const [key, value] of Object.entries(data['data_list'])) { - // console.log(key, value); - if (key.endsWith('_json')) { - if (log_lvl) { - console.log(`${key}: ${value}`); - } - data['data_list'][key] = JSON.stringify(value); - } - } - } + // NOTE: The data object may contain objects that need to be converted to JSON strings. This is done by adding "_json" to the end of the property name. This is done because the API does not support nested objects. This is a limitation of the API. + if (data['data_list']) { + if (log_lvl > 1) { + console.log('Data List:', data['data_list']); + } + for (const [key, value] of Object.entries(data['data_list'])) { + // console.log(key, value); + if (key.endsWith('_json')) { + if (log_lvl) { + console.log(`${key}: ${value}`); + } + data['data_list'][key] = JSON.stringify(value); + } + } + } - if (log_lvl) { - console.log('Data:', data); - } - // params['xxxxx run_safety_check xxxxx'] = false; - params['by_alias'] = false; + if (log_lvl) { + console.log('Data:', data); + } + // params['xxxxx run_safety_check xxxxx'] = false; + params['by_alias'] = false; - if (log_lvl) { - console.log('Params:', params); - } + if (log_lvl) { + console.log('Params:', params); + } - const 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) { - console.log(object_obj_post_promise); - } + if (log_lvl > 1) { + console.log(object_obj_post_promise); + } - return object_obj_post_promise; + return object_obj_post_promise; }; // Updated 2023-06-28 export const update_ae_obj_id_crud = async function update_ae_obj_id_crud({ - api_cfg, - obj_type, - obj_id, - field_name, - field_value, - fields = {}, - key, - jwt = null, - headers = {}, - params = {}, - data = {}, - return_obj = false, - obj_v_name = '', - return_meta = false, - log_lvl = 0 + api_cfg, + obj_type, + obj_id, + field_name, + field_value, + fields = {}, + key, + jwt = null, + headers = {}, + params = {}, + data = {}, + return_obj = false, + obj_v_name = '', + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - obj_type: string; - obj_id: string; - field_name?: string; - field_value?: any; - fields?: key_val; - key: string; - jwt?: null | string; - headers?: key_val; - params?: key_val; - data?: null | key_val; - return_obj?: boolean; - obj_v_name?: string; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + obj_type: string; + obj_id: string; + field_name?: string; + field_value?: any; + fields?: key_val; + key: string; + jwt?: null | string; + headers?: key_val; + params?: key_val; + data?: null | key_val; + return_obj?: boolean; + obj_v_name?: string; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log('*** update_ae_obj_id_crud() ***'); - } + if (log_lvl) { + console.log('*** update_ae_obj_id_crud() ***'); + } - if (!data) { - data = {}; - } - data['super_key'] = key; - data['jwt'] = jwt; + if (!data) { + data = {}; + } + data['super_key'] = key; + data['jwt'] = jwt; - // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST + // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST - // This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API. - // This is not currently being exposed to other areas of the code. It is only used here. For now? - if (obj_v_name) { - obj_v_name = ''; - } + // This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API. + // This is not currently being exposed to other areas of the code. It is only used here. For now? + if (obj_v_name) { + obj_v_name = ''; + } - let endpoint = ''; - if (obj_type == 'account') { - endpoint = `/crud/account/${obj_id}`; - } else if (obj_type == 'address') { - endpoint = `/crud/address/${obj_id}`; - } else if (obj_type == 'archive') { - endpoint = `/crud/archive/${obj_id}`; - } else if (obj_type == 'archive_content') { - endpoint = `/crud/archive/content/${obj_id}`; - } else if (obj_type == 'contact') { - endpoint = `/crud/contact/${obj_id}`; - } else if (obj_type == 'data_store') { - endpoint = `/crud/data_store/${obj_id}`; - } else if (obj_type == 'event') { - endpoint = `/crud/event/${obj_id}`; - } else if (obj_type == 'event_abstract') { - endpoint = `/crud/event/abstract/${obj_id}`; - } else if (obj_type == 'event_badge') { - endpoint = `/crud/event/badge/${obj_id}`; - } else if (obj_type == 'event_device') { - endpoint = `/crud/event/device/${obj_id}`; - } else if (obj_type == 'event_exhibit') { - endpoint = `/crud/event/exhibit/${obj_id}`; - } else if (obj_type == 'event_exhibit_tracking') { - endpoint = `/crud/event/exhibit/tracking/${obj_id}`; - } else if (obj_type == 'event_file') { - endpoint = `/crud/event/file/${obj_id}`; - } else if (obj_type == 'event_location') { - endpoint = `/crud/event/location/${obj_id}`; - } else if (obj_type == 'event_person') { - endpoint = `/crud/event/person/${obj_id}`; - } else if (obj_type == 'event_presentation') { - endpoint = `/crud/event/presentation/${obj_id}`; - } else if (obj_type == 'event_presenter') { - endpoint = `/crud/event/presenter/${obj_id}`; - // obj_v_name = 'event_presenter_soft_links'; - } else if (obj_type == 'event_session') { - endpoint = `/crud/event/session/${obj_id}`; - } else if (obj_type == 'event_track') { - endpoint = `/crud/event/track/${obj_id}`; - } else if (obj_type == 'grant') { - endpoint = `/crud/grant/${obj_id}`; - } else if (obj_type == 'hosted_file') { - endpoint = `/crud/hosted_file/${obj_id}`; - } else if (obj_type == 'journal') { - endpoint = `/crud/journal/${obj_id}`; - } else if (obj_type == 'journal_entry') { - endpoint = `/crud/journal/entry/${obj_id}`; - } else if (obj_type == 'order') { - endpoint = `/crud/order/${obj_id}`; - } else if (obj_type == 'order_line') { - endpoint = `/crud/order/line/${obj_id}`; - } else if (obj_type == 'page') { - endpoint = `/crud/page/${obj_id}`; - } else if (obj_type == 'person') { - endpoint = `/crud/person/${obj_id}`; - } else if (obj_type == 'post') { - endpoint = `/crud/post/${obj_id}`; - } else if (obj_type == 'post_comment') { - endpoint = `/crud/post/comment/${obj_id}`; - } else if (obj_type == 'site') { - endpoint = `/crud/site/${obj_id}`; - } else if (obj_type == 'sponsorship_cfg') { - endpoint = `/crud/sponsorship/cfg/${obj_id}`; - } else if (obj_type == 'sponsorship') { - endpoint = `/crud/sponsorship/${obj_id}`; - // } else if (obj_type == 'user') { - // endpoint = `/crud/user/${obj_id}`; - } else { - console.log(`Unknown object type: ${obj_type}`); - return false; - } - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + let endpoint = ''; + if (obj_type == 'account') { + endpoint = `/crud/account/${obj_id}`; + } else if (obj_type == 'address') { + endpoint = `/crud/address/${obj_id}`; + } else if (obj_type == 'archive') { + endpoint = `/crud/archive/${obj_id}`; + } else if (obj_type == 'archive_content') { + endpoint = `/crud/archive/content/${obj_id}`; + } else if (obj_type == 'contact') { + endpoint = `/crud/contact/${obj_id}`; + } else if (obj_type == 'data_store') { + endpoint = `/crud/data_store/${obj_id}`; + } else if (obj_type == 'event') { + endpoint = `/crud/event/${obj_id}`; + } else if (obj_type == 'event_abstract') { + endpoint = `/crud/event/abstract/${obj_id}`; + } else if (obj_type == 'event_badge') { + endpoint = `/crud/event/badge/${obj_id}`; + } else if (obj_type == 'event_device') { + endpoint = `/crud/event/device/${obj_id}`; + } else if (obj_type == 'event_exhibit') { + endpoint = `/crud/event/exhibit/${obj_id}`; + } else if (obj_type == 'event_exhibit_tracking') { + endpoint = `/crud/event/exhibit/tracking/${obj_id}`; + } else if (obj_type == 'event_file') { + endpoint = `/crud/event/file/${obj_id}`; + } else if (obj_type == 'event_location') { + endpoint = `/crud/event/location/${obj_id}`; + } else if (obj_type == 'event_person') { + endpoint = `/crud/event/person/${obj_id}`; + } else if (obj_type == 'event_presentation') { + endpoint = `/crud/event/presentation/${obj_id}`; + } else if (obj_type == 'event_presenter') { + endpoint = `/crud/event/presenter/${obj_id}`; + // obj_v_name = 'event_presenter_soft_links'; + } else if (obj_type == 'event_session') { + endpoint = `/crud/event/session/${obj_id}`; + } else if (obj_type == 'event_track') { + endpoint = `/crud/event/track/${obj_id}`; + } else if (obj_type == 'grant') { + endpoint = `/crud/grant/${obj_id}`; + } else if (obj_type == 'hosted_file') { + endpoint = `/crud/hosted_file/${obj_id}`; + } else if (obj_type == 'journal') { + endpoint = `/crud/journal/${obj_id}`; + } else if (obj_type == 'journal_entry') { + endpoint = `/crud/journal/entry/${obj_id}`; + } else if (obj_type == 'order') { + endpoint = `/crud/order/${obj_id}`; + } else if (obj_type == 'order_line') { + endpoint = `/crud/order/line/${obj_id}`; + } else if (obj_type == 'page') { + endpoint = `/crud/page/${obj_id}`; + } else if (obj_type == 'person') { + endpoint = `/crud/person/${obj_id}`; + } else if (obj_type == 'post') { + endpoint = `/crud/post/${obj_id}`; + } else if (obj_type == 'post_comment') { + endpoint = `/crud/post/comment/${obj_id}`; + } else if (obj_type == 'site') { + endpoint = `/crud/site/${obj_id}`; + } else if (obj_type == 'sponsorship_cfg') { + endpoint = `/crud/sponsorship/cfg/${obj_id}`; + } else if (obj_type == 'sponsorship') { + endpoint = `/crud/sponsorship/${obj_id}`; + // } else if (obj_type == 'user') { + // endpoint = `/crud/user/${obj_id}`; + } else { + console.log(`Unknown object type: ${obj_type}`); + return false; + } + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - if (return_obj) { - params['return_obj'] = true; + if (return_obj) { + params['return_obj'] = true; - // Pass along the view name to use for returning data. - if (obj_v_name) { - params['obj_v_name'] = obj_v_name; - } - } else { - params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object. - } + // Pass along the view name to use for returning data. + if (obj_v_name) { + params['obj_v_name'] = obj_v_name; + } + } else { + params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object. + } - if (field_name) { - data['data_list'] = {}; // Really an object/dict - data['data_list'][field_name] = field_value; - // data['data_list']['testing'] = 'asdf 1234'; - } else if (fields) { - data['data_list'] = fields; // Really an object/dict - } + if (field_name) { + data['data_list'] = {}; // Really an object/dict + data['data_list'][field_name] = field_value; + // data['data_list']['testing'] = 'asdf 1234'; + } else if (fields) { + data['data_list'] = fields; // Really an object/dict + } - // NOTE: The data object may contain objects that need to be converted to JSON strings. This is done by adding "_json" to the end of the property name. This is done because the API does not support nested objects. This is a limitation of the API. - if (data['data_list']) { - if (log_lvl > 1) { - console.log('Data List:', data['data_list']); - } - for (const [key, value] of Object.entries(data['data_list'])) { - // console.log(key, value); - if (key.endsWith('_json')) { - if (log_lvl) { - console.log(`${key}: ${value}`); - } - data['data_list'][key] = JSON.stringify(value); - } - } - } + // NOTE: The data object may contain objects that need to be converted to JSON strings. This is done by adding "_json" to the end of the property name. This is done because the API does not support nested objects. This is a limitation of the API. + if (data['data_list']) { + if (log_lvl > 1) { + console.log('Data List:', data['data_list']); + } + for (const [key, value] of Object.entries(data['data_list'])) { + // console.log(key, value); + if (key.endsWith('_json')) { + if (log_lvl) { + console.log(`${key}: ${value}`); + } + data['data_list'][key] = JSON.stringify(value); + } + } + } - // If the data is an object then we need to loop through the object and convert any objects to JSON strings, but only if the property name ends with "_json". - // if (Array.isArray(data)) { - // // console.log('Data is an array'); - // for (let i = 0; i < data.length; i++) { - // // console.log(data[i]); - // if (typeof data[i] == 'object') { - // // console.log('Data is an object'); - // for (const [key, value] of Object.entries(data[i])) { - // // console.log(key, value); - // if (key.endsWith('_json')) { - // console.log(`${key}: ${value}`); - // data[i][key] = JSON.stringify(value); - // } - // } + // If the data is an object then we need to loop through the object and convert any objects to JSON strings, but only if the property name ends with "_json". + // if (Array.isArray(data)) { + // // console.log('Data is an array'); + // for (let i = 0; i < data.length; i++) { + // // console.log(data[i]); + // if (typeof data[i] == 'object') { + // // console.log('Data is an object'); + // for (const [key, value] of Object.entries(data[i])) { + // // console.log(key, value); + // if (key.endsWith('_json')) { + // console.log(`${key}: ${value}`); + // data[i][key] = JSON.stringify(value); + // } + // } - // } - // } - // } else if (typeof data == 'object') { - // // console.log('Data is an object'); - // for (const [key, value] of Object.entries(data)) { - // // console.log(key, value); - // if (key.endsWith('_json')) { - // console.log(`${key}: ${value}`); - // data[key] = JSON.stringify(value); - // } - // } - // } + // } + // } + // } else if (typeof data == 'object') { + // // console.log('Data is an object'); + // for (const [key, value] of Object.entries(data)) { + // // console.log(key, value); + // if (key.endsWith('_json')) { + // console.log(`${key}: ${value}`); + // data[key] = JSON.stringify(value); + // } + // } + // } - if (log_lvl) { - console.log('Data:', data); - } - // params['xxxxx run_safety_check xxxxx'] = false; - params['by_alias'] = false; + if (log_lvl) { + console.log('Data:', data); + } + // params['xxxxx run_safety_check xxxxx'] = false; + params['by_alias'] = false; - if (log_lvl) { - console.log('Params:', params); - } + if (log_lvl) { + console.log('Params:', params); + } - const 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) { - console.log(object_obj_patch_promise); - } + if (log_lvl > 1) { + console.log(object_obj_patch_promise); + } - return object_obj_patch_promise; + return object_obj_patch_promise; }; // Updated 2023-11-14 export const delete_ae_obj_id_crud = async function delete_ae_obj_id_crud({ - api_cfg, - obj_type, - obj_id, - key, - jwt = null, - headers = {}, - params = {}, - data = {}, - method = 'delete', // 'delete', 'disable', 'hide' - return_meta = false, - log_lvl = 0 + api_cfg, + obj_type, + obj_id, + key, + jwt = null, + headers = {}, + params = {}, + data = {}, + method = 'delete', // 'delete', 'disable', 'hide' + return_meta = false, + log_lvl = 0 }: { - api_cfg: any; - obj_type: string; - obj_id: string; - key: string; - jwt?: null | string; - headers?: any; - params?: any; - data?: any; - method?: string; - return_meta?: boolean; - log_lvl?: number; + api_cfg: any; + obj_type: string; + obj_id: string; + key: string; + jwt?: null | string; + headers?: any; + params?: any; + data?: any; + method?: string; + return_meta?: boolean; + log_lvl?: number; }) { - if (log_lvl) { - console.log(`*** delete_ae_obj_id_crud() *** obj_type: ${obj_type} obj_id: ${obj_id}`); - } + if (log_lvl) { + console.log(`*** delete_ae_obj_id_crud() *** obj_type: ${obj_type} obj_id: ${obj_id}`); + } - data['super_key'] = key; - data['jwt'] = jwt; - // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST + data['super_key'] = key; + data['jwt'] = jwt; + // NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST - let endpoint = ''; - if (obj_type == 'account') { - endpoint = `/crud/account/${obj_id}`; - } else if (obj_type == 'address') { - endpoint = `/crud/address/${obj_id}`; - } else if (obj_type == 'archive') { - endpoint = `/crud/archive/${obj_id}`; - } else if (obj_type == 'archive_content') { - endpoint = `/crud/archive/content/${obj_id}`; - } else if (obj_type == 'contact') { - endpoint = `/crud/contact/${obj_id}`; - } else if (obj_type == 'data_store') { - endpoint = `/crud/data_store/${obj_id}`; - } else if (obj_type == 'event') { - endpoint = `/crud/event/${obj_id}`; - } else if (obj_type == 'event_abstract') { - endpoint = `/crud/event/abstract/${obj_id}`; - } else if (obj_type == 'event_badge') { - endpoint = `/crud/event/badge/${obj_id}`; - } else if (obj_type == 'event_device') { - endpoint = `/crud/event/device/${obj_id}`; - } else if (obj_type == 'event_exhibit') { - endpoint = `/crud/event/exhibit/${obj_id}`; - } else if (obj_type == 'event_exhibit_tracking') { - endpoint = `/crud/event/exhibit/tracking/${obj_id}`; - } else if (obj_type == 'event_file') { - endpoint = `/crud/event/file/${obj_id}`; - } else if (obj_type == 'event_location') { - endpoint = `/crud/event/location/${obj_id}`; - } else if (obj_type == 'event_person') { - endpoint = `/crud/event/person/${obj_id}`; - } else if (obj_type == 'event_presentation') { - endpoint = `/crud/event/presentation/${obj_id}`; - } else if (obj_type == 'event_presenter') { - endpoint = `/crud/event/presenter/${obj_id}`; - } else if (obj_type == 'event_session') { - endpoint = `/crud/event/session/${obj_id}`; - } else if (obj_type == 'event_track') { - endpoint = `/crud/event/track/${obj_id}`; - } else if (obj_type == 'grant') { - endpoint = `/crud/grant/${obj_id}`; - } else if (obj_type == 'hosted_file') { - endpoint = `/crud/hosted_file/${obj_id}`; - } else if (obj_type == 'journal') { - endpoint = `/crud/journal/${obj_id}`; - } else if (obj_type == 'journal_entry') { - endpoint = `/crud/journal/entry/${obj_id}`; - } else if (obj_type == 'order') { - endpoint = `/crud/order/${obj_id}`; - } else if (obj_type == 'order_line') { - endpoint = `/crud/order/line/${obj_id}`; - } else if (obj_type == 'page') { - endpoint = `/crud/page/${obj_id}`; - } else if (obj_type == 'person') { - endpoint = `/crud/person/${obj_id}`; - } else if (obj_type == 'post') { - endpoint = `/crud/post/${obj_id}`; - } else if (obj_type == 'post_comment') { - endpoint = `/crud/post/comment/${obj_id}`; - } else if (obj_type == 'site') { - endpoint = `/crud/site/${obj_id}`; - } else if (obj_type == 'sponsorship_cfg') { - endpoint = `/crud/sponsorship/cfg/${obj_id}`; - } else if (obj_type == 'sponsorship') { - endpoint = `/crud/sponsorship/${obj_id}`; - // } else if (obj_type == 'user') { - // endpoint = `/crud/user/${obj_id}`; - } else { - console.log(`Unknown object type: ${obj_type}`); - return false; - } - if (log_lvl) { - console.log('Endpoint:', endpoint); - } + let endpoint = ''; + if (obj_type == 'account') { + endpoint = `/crud/account/${obj_id}`; + } else if (obj_type == 'address') { + endpoint = `/crud/address/${obj_id}`; + } else if (obj_type == 'archive') { + endpoint = `/crud/archive/${obj_id}`; + } else if (obj_type == 'archive_content') { + endpoint = `/crud/archive/content/${obj_id}`; + } else if (obj_type == 'contact') { + endpoint = `/crud/contact/${obj_id}`; + } else if (obj_type == 'data_store') { + endpoint = `/crud/data_store/${obj_id}`; + } else if (obj_type == 'event') { + endpoint = `/crud/event/${obj_id}`; + } else if (obj_type == 'event_abstract') { + endpoint = `/crud/event/abstract/${obj_id}`; + } else if (obj_type == 'event_badge') { + endpoint = `/crud/event/badge/${obj_id}`; + } else if (obj_type == 'event_device') { + endpoint = `/crud/event/device/${obj_id}`; + } else if (obj_type == 'event_exhibit') { + endpoint = `/crud/event/exhibit/${obj_id}`; + } else if (obj_type == 'event_exhibit_tracking') { + endpoint = `/crud/event/exhibit/tracking/${obj_id}`; + } else if (obj_type == 'event_file') { + endpoint = `/crud/event/file/${obj_id}`; + } else if (obj_type == 'event_location') { + endpoint = `/crud/event/location/${obj_id}`; + } else if (obj_type == 'event_person') { + endpoint = `/crud/event/person/${obj_id}`; + } else if (obj_type == 'event_presentation') { + endpoint = `/crud/event/presentation/${obj_id}`; + } else if (obj_type == 'event_presenter') { + endpoint = `/crud/event/presenter/${obj_id}`; + } else if (obj_type == 'event_session') { + endpoint = `/crud/event/session/${obj_id}`; + } else if (obj_type == 'event_track') { + endpoint = `/crud/event/track/${obj_id}`; + } else if (obj_type == 'grant') { + endpoint = `/crud/grant/${obj_id}`; + } else if (obj_type == 'hosted_file') { + endpoint = `/crud/hosted_file/${obj_id}`; + } else if (obj_type == 'journal') { + endpoint = `/crud/journal/${obj_id}`; + } else if (obj_type == 'journal_entry') { + endpoint = `/crud/journal/entry/${obj_id}`; + } else if (obj_type == 'order') { + endpoint = `/crud/order/${obj_id}`; + } else if (obj_type == 'order_line') { + endpoint = `/crud/order/line/${obj_id}`; + } else if (obj_type == 'page') { + endpoint = `/crud/page/${obj_id}`; + } else if (obj_type == 'person') { + endpoint = `/crud/person/${obj_id}`; + } else if (obj_type == 'post') { + endpoint = `/crud/post/${obj_id}`; + } else if (obj_type == 'post_comment') { + endpoint = `/crud/post/comment/${obj_id}`; + } else if (obj_type == 'site') { + endpoint = `/crud/site/${obj_id}`; + } else if (obj_type == 'sponsorship_cfg') { + endpoint = `/crud/sponsorship/cfg/${obj_id}`; + } else if (obj_type == 'sponsorship') { + endpoint = `/crud/sponsorship/${obj_id}`; + // } else if (obj_type == 'user') { + // endpoint = `/crud/user/${obj_id}`; + } else { + console.log(`Unknown object type: ${obj_type}`); + return false; + } + if (log_lvl) { + console.log('Endpoint:', endpoint); + } - if (method) { - // NOTE: method options: 'delete', 'disable', 'hide' - params['method'] = method; - } + if (method) { + // NOTE: method options: 'delete', 'disable', 'hide' + params['method'] = method; + } - if (log_lvl) { - console.log('Params:', params); - } + if (log_lvl) { + console.log('Params:', params); + } - const 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) { - console.log(object_obj_delete_promise); - } + if (log_lvl > 1) { + console.log(object_obj_delete_promise); + } - return object_obj_delete_promise; + return object_obj_delete_promise; }; /* BEGIN: Hosted File Related */ // Updated 2023-08-17 export const download_hosted_file = async function download_hosted_file({ - api_cfg, - hosted_file_id, - return_file = true, - filename, - auto_download = false, - params = {}, - log_lvl = 0 + api_cfg, + hosted_file_id, + return_file = true, + filename, + auto_download = false, + params = {}, + log_lvl = 0 }: { - api_cfg: any; - hosted_file_id: string; - return_file?: boolean; - filename?: string; - auto_download?: boolean; - params?: key_val; - log_lvl?: number; + api_cfg: any; + hosted_file_id: string; + return_file?: boolean; + filename?: string; + auto_download?: boolean; + params?: key_val; + log_lvl?: number; }) { - console.log('*** stores_hosted_api.js: download_hosted_file() ***'); + console.log('*** stores_hosted_api.js: download_hosted_file() ***'); - const task_id = hosted_file_id; + const task_id = hosted_file_id; - const endpoint = `/hosted_file/${hosted_file_id}/download`; - if (filename) { - params['filename'] = filename; - } - params['return_file'] = true; + const endpoint = `/hosted_file/${hosted_file_id}/download`; + if (filename) { + params['filename'] = filename; + } + params['return_file'] = true; - const hosted_file_download_get_promise = await api.get_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - return_blob: return_file, - filename: filename, - auto_download: auto_download, - task_id: task_id, - log_lvl: log_lvl - }); - // console.log(hosted_file_download_get_promise); - return hosted_file_download_get_promise; + const hosted_file_download_get_promise = await api.get_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + return_blob: return_file, + filename: filename, + auto_download: auto_download, + task_id: task_id, + log_lvl: log_lvl + }); + // console.log(hosted_file_download_get_promise); + return hosted_file_download_get_promise; }; // Updated 2023-12-15 export const delete_hosted_file = async function delete_hosted_file({ - api_cfg, - hosted_file_id, - link_to_type, - link_to_id, - rm_orphan = false, - params = {}, - data = {}, - log_lvl = 1 + api_cfg, + hosted_file_id, + link_to_type, + link_to_id, + rm_orphan = false, + params = {}, + data = {}, + log_lvl = 1 }: { - api_cfg: any; - hosted_file_id: string; - link_to_type?: string; - link_to_id?: string; - rm_orphan?: boolean; - params?: key_val; - data?: key_val; - log_lvl?: number; + api_cfg: any; + hosted_file_id: string; + link_to_type?: string; + link_to_id?: string; + rm_orphan?: boolean; + params?: key_val; + data?: key_val; + 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}`; - if (link_to_type) { - params['link_to_type'] = link_to_type; - } - if (link_to_id) { - params['link_to_id'] = link_to_id; - } - if (rm_orphan) { - params['rm_orphan'] = rm_orphan; - } + const endpoint = `/hosted_file/${hosted_file_id}`; + if (link_to_type) { + params['link_to_type'] = link_to_type; + } + if (link_to_id) { + params['link_to_id'] = link_to_id; + } + if (rm_orphan) { + params['rm_orphan'] = rm_orphan; + } - 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); - return hosted_file_obj_delete_promise; + 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); + return hosted_file_obj_delete_promise; }; /* END: Hosted File Related */ @@ -741,72 +741,72 @@ export const delete_hosted_file = async function delete_hosted_file({ // Updated 2023-06-29 export const get_data_store_obj_w_code = async function get_data_store_obj_w_code({ - api_cfg, - data_store_code, - data_type = 'text', - headers = {}, - params = {}, - timeout = 25000, - log_lvl = 0 + api_cfg, + data_store_code, + data_type = 'text', + headers = {}, + params = {}, + timeout = 25000, + log_lvl = 0 }: { - api_cfg: any; - data_store_code: string; - data_type?: string; - headers?: key_val; - params?: key_val; - timeout?: number; - log_lvl?: number; + api_cfg: any; + data_store_code: string; + data_type?: string; + headers?: key_val; + params?: key_val; + timeout?: number; + log_lvl?: number; }) { - if (log_lvl) { - console.log('*** get_data_store_obj_w_code() ***'); - } + if (log_lvl) { + console.log('*** 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}`; - 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 - }); + 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 + }); - if (data_store_obj_get_promise === false) { - console.log('Data Store - RUN AGAIN WITH BACKUP'); - const original_api_base_url = api_cfg['base_url']; + if (data_store_obj_get_promise === false) { + console.log('Data Store - RUN AGAIN WITH BACKUP'); + const original_api_base_url = api_cfg['base_url']; - const temp_api = api_cfg; - temp_api['base_url'] = temp_api['base_url_bak']; + const temp_api = api_cfg; + 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 - }); - temp_api['base_url'] = original_api_base_url; - } + 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; + } - const data_store_obj = data_store_obj_get_promise; + const data_store_obj = data_store_obj_get_promise; - if (data_type == 'text') { - // console.log(data_store_obj.text); - // window.localStorage.setItem(data_store_code, data_store_obj.text); - // localStorage.setItem(data_store_code, data_store_obj.text); - } else if (data_type == 'json') { - // console.log(data_store_obj.json); - // window.localStorage.setItem(data_store_code, JSON.stringify(data_store_obj.json)); - // localStorage.setItem(data_store_code, JSON.stringify(data_store_obj.json)); - } + if (data_type == 'text') { + // console.log(data_store_obj.text); + // window.localStorage.setItem(data_store_code, data_store_obj.text); + // localStorage.setItem(data_store_code, data_store_obj.text); + } else if (data_type == 'json') { + // console.log(data_store_obj.json); + // window.localStorage.setItem(data_store_code, JSON.stringify(data_store_obj.json)); + // localStorage.setItem(data_store_code, JSON.stringify(data_store_obj.json)); + } - if (log_lvl > 1) { - console.log('Response Data:', data_store_obj); - } - return data_store_obj; + if (log_lvl > 1) { + console.log('Response Data:', data_store_obj); + } + return data_store_obj; }; /* END: Data Store Related */ @@ -814,115 +814,115 @@ export const get_data_store_obj_w_code = async function get_data_store_obj_w_cod // Updated 2023-06-29 export const send_email = async function send_email({ - api_cfg, - from_email, - from_name = '', - to_email, - to_name = '', - cc_email = null, - cc_name = null, - bcc_email = null, - bcc_name = null, - subject, - body_html, - body_text = null, - // headers = {}, - params = {}, - data = {}, - return_obj = false, - return_meta = false, - test = false, - log_lvl = 0 + api_cfg, + from_email, + from_name = '', + to_email, + to_name = '', + cc_email = null, + cc_name = null, + bcc_email = null, + bcc_name = null, + subject, + body_html, + body_text = null, + // headers = {}, + params = {}, + data = {}, + return_obj = false, + return_meta = false, + test = false, + log_lvl = 0 }: { - api_cfg: any; - from_email: string; - from_name?: string; - to_email: string; - to_name?: string; - cc_email?: null | string; - cc_name?: null | string; - bcc_email?: null | string; - bcc_name?: null | string; - subject: string; - body_html: string; - body_text?: null | string; - // headers?: key_val, - params?: key_val; - data?: key_val; - return_obj?: boolean; - return_meta?: boolean; - test?: boolean; - log_lvl?: number; + api_cfg: any; + from_email: string; + from_name?: string; + to_email: string; + to_name?: string; + cc_email?: null | string; + cc_name?: null | string; + bcc_email?: null | string; + bcc_name?: null | string; + subject: string; + body_html: string; + body_text?: null | string; + // headers?: key_val, + params?: key_val; + data?: key_val; + return_obj?: boolean; + return_meta?: boolean; + test?: boolean; + log_lvl?: number; }) { - console.log('*** send_email() ***'); + console.log('*** send_email() ***'); - const endpoint = `/util/email/send`; + const endpoint = `/util/email/send`; - data['from_email'] = from_email; // Required - data['from_name'] = from_name; + data['from_email'] = from_email; // Required + data['from_name'] = from_name; - data['to_email'] = to_email; // Required - data['to_name'] = to_name; + data['to_email'] = to_email; // Required + data['to_name'] = to_name; - data['cc_email'] = cc_email; - data['cc_name'] = cc_name; + data['cc_email'] = cc_email; + data['cc_name'] = cc_name; - data['bcc_email'] = bcc_email; - data['bcc_name'] = bcc_name; + data['bcc_email'] = bcc_email; + data['bcc_name'] = bcc_name; - data['subject'] = subject; - if (log_lvl) { - console.log('Data:', data); - } + data['subject'] = subject; + if (log_lvl) { + console.log('Data:', data); + } - data['body_html'] = body_html; + data['body_html'] = body_html; - data['body_text'] = body_text; + data['body_text'] = body_text; - if (return_obj) { - params['return_obj'] = true; - } + if (return_obj) { + params['return_obj'] = true; + } - if (test) { - params['test'] = true; - } + if (test) { + params['test'] = true; + } - const send_email_post_promise = await api.post_object({ - api_cfg: api_cfg, - endpoint: endpoint, - params: params, - data: data, - return_meta: return_meta, - log_lvl: log_lvl - }); + const send_email_post_promise = await api.post_object({ + api_cfg: api_cfg, + endpoint: endpoint, + params: params, + data: data, + return_meta: return_meta, + log_lvl: log_lvl + }); - if (log_lvl > 1) { - console.log('Response Data:', send_email_post_promise); - } - if (return_obj) { - return send_email_post_promise; - } else { - return send_email_post_promise.event_abstract_id_random; - } + if (log_lvl > 1) { + console.log('Response Data:', send_email_post_promise); + } + if (return_obj) { + return send_email_post_promise; + } else { + return send_email_post_promise.event_abstract_id_random; + } }; /* END: Utility: Email Related */ const obj = { - delete_object: delete_object, - get_object: get_object, - patch_object: patch_object, - post_object: post_object, - get_ae_obj_id_crud: get_ae_obj_id_crud, - get_ae_obj_li_for_obj_id_crud: get_ae_obj_li_for_obj_id_crud, - get_ae_obj_li_for_obj_id_crud_v2: get_ae_obj_li_for_obj_id_crud_v2, - create_ae_obj_crud: create_ae_obj_crud, - update_ae_obj_id_crud: update_ae_obj_id_crud, - delete_ae_obj_id_crud: delete_ae_obj_id_crud, - download_hosted_file: download_hosted_file, - delete_hosted_file: delete_hosted_file, - get_data_store_obj_w_code: get_data_store_obj_w_code, - send_email: send_email + delete_object: delete_object, + get_object: get_object, + patch_object: patch_object, + post_object: post_object, + get_ae_obj_id_crud: get_ae_obj_id_crud, + get_ae_obj_li_for_obj_id_crud: get_ae_obj_li_for_obj_id_crud, + get_ae_obj_li_for_obj_id_crud_v2: get_ae_obj_li_for_obj_id_crud_v2, + create_ae_obj_crud: create_ae_obj_crud, + update_ae_obj_id_crud: update_ae_obj_id_crud, + delete_ae_obj_id_crud: delete_ae_obj_id_crud, + download_hosted_file: download_hosted_file, + delete_hosted_file: delete_hosted_file, + get_data_store_obj_w_code: get_data_store_obj_w_code, + send_email: send_email }; export const api = obj; // module.exports = api; diff --git a/src/lib/app_components/analytics.svelte b/src/lib/app_components/analytics.svelte index f7597080..0641c393 100644 --- a/src/lib/app_components/analytics.svelte +++ b/src/lib/app_components/analytics.svelte @@ -1,25 +1,25 @@ - + diff --git a/src/lib/app_components/e_app_access_type.svelte b/src/lib/app_components/e_app_access_type.svelte index f9129169..0aa1029c 100644 --- a/src/lib/app_components/e_app_access_type.svelte +++ b/src/lib/app_components/e_app_access_type.svelte @@ -1,299 +1,303 @@
- - + + - - + -
- {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - {#if $ae_loc.manager_access} - {#if $ae_loc?.sync_local_config} - - {:else} - + {:else} + - {/if} - {/if} + // dispatch_sync_local_config_changed(); + // tick(); + return true; + }} + class="btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition-all hover:transition-all *:hover:inline" + title="Currently not syncing with the remote server. Re-sync the local configuration with the remote configuration?" + > + + + + {/if} + {/if} - - {/if} -
+ {/if} + -
- {#if $ae_loc?.access_type && $ae_loc?.access_type == 'anonymous' && 1 == 3} - - - - {/if} + + {#if show_passcode_input} + Cancel + {:else} + Access? + {/if} + + + {/if} - {#if $ae_loc?.access_type && $ae_loc?.access_type != 'anonymous'} - - - + {#if $ae_loc?.access_type && $ae_loc?.access_type != 'anonymous'} + + + - - {#if $ae_loc.access_type == 'super'} - - - {:else if $ae_loc.access_type == 'manager'} - - - {:else if $ae_loc.access_type == 'administrator'} - - - {:else if $ae_loc.access_type == 'trusted'} - - - {:else if $ae_loc.access_type == 'public'} - Public - - {:else if $ae_loc.access_type == 'authenticated'} - Authenticated - - {:else if $ae_loc.access_type == 'anonymous'} - Anonymous Access - {:else} - Unknown Access - {/if} - + + {#if $ae_loc.access_type == 'super'} + + + {:else if $ae_loc.access_type == 'manager'} + + + {:else if $ae_loc.access_type == 'administrator'} + + + {:else if $ae_loc.access_type == 'trusted'} + + + {:else if $ae_loc.access_type == 'public'} + Public + + {:else if $ae_loc.access_type == 'authenticated'} + Authenticated + + {:else if $ae_loc.access_type == 'anonymous'} + Anonymous Access + {:else} + Unknown Access + {/if} + - {#if $ae_loc?.user_access_type && $ae_loc?.access_type == $ae_loc?.user_access_type && !show_passcode_input} - - {:else if !show_passcode_input} - - {/if} - - {/if} + {#if $ae_loc?.user_access_type && $ae_loc?.access_type == $ae_loc?.user_access_type && !show_passcode_input} + + {:else if !show_passcode_input} + + {/if} + + {/if} - {#if show_passcode_input} - - - - Passcode: - + {#if show_passcode_input} + + + + Passcode: + - - - - - {/if} -
+ + + + + {/if} +
diff --git a/src/lib/app_components/e_app_clipboard.svelte b/src/lib/app_components/e_app_clipboard.svelte index f7992c2e..ef9880a4 100644 --- a/src/lib/app_components/e_app_clipboard.svelte +++ b/src/lib/app_components/e_app_clipboard.svelte @@ -1,108 +1,108 @@ diff --git a/src/lib/app_components/e_app_codemirror_v5.svelte b/src/lib/app_components/e_app_codemirror_v5.svelte index 561a0911..17acabb1 100644 --- a/src/lib/app_components/e_app_codemirror_v5.svelte +++ b/src/lib/app_components/e_app_codemirror_v5.svelte @@ -1,182 +1,182 @@ {#if browser} - -
+ +
{:else} -
-
-

Loading editor...

-
+
+
+

Loading editor...

+
-
{content}
-
+
{content}
+
{/if} diff --git a/src/lib/elements/codemirror_modules.ts b/src/lib/elements/codemirror_modules.ts index 0c697030..e4587607 100644 --- a/src/lib/elements/codemirror_modules.ts +++ b/src/lib/elements/codemirror_modules.ts @@ -1,170 +1,170 @@ let _cmCache: { - EditorView?: any; - EditorState?: any; - basicSetup?: any; - markdown?: any; - markdownLanguage?: any; - keymap?: any; - defaultKeymap?: any; - history?: any; - historyKeymap?: any; - lineNumbers?: any; - highlightSpecialChars?: any; - drawSelection?: any; - dropCursor?: any; - rectangularSelection?: any; - crosshairCursor?: any; - highlightActiveLine?: any; - highlightActiveLineGutter?: any; - indentWithTab?: any; - indentUnit?: any; - autocompletion?: any; - completionKeymap?: any; - closeBrackets?: any; - closeBracketsKeymap?: any; - searchKeymap?: any; - highlightSelectionMatches?: any; - lintKeymap?: any; - EditorState_allowMultipleSelections?: any; - EditorView_lineWrapping?: any; - EditorView_editable?: any; - EditorView_contentAttributes?: any; - bracketMatching?: any; - foldGutter?: any; - foldKeymap?: any; - indentOnInput?: any; - languages?: any; - oneDark?: any; - placeholderExt?: any; + EditorView?: any; + EditorState?: any; + basicSetup?: any; + markdown?: any; + markdownLanguage?: any; + keymap?: any; + defaultKeymap?: any; + history?: any; + historyKeymap?: any; + lineNumbers?: any; + highlightSpecialChars?: any; + drawSelection?: any; + dropCursor?: any; + rectangularSelection?: any; + crosshairCursor?: any; + highlightActiveLine?: any; + highlightActiveLineGutter?: any; + indentWithTab?: any; + indentUnit?: any; + autocompletion?: any; + completionKeymap?: any; + closeBrackets?: any; + closeBracketsKeymap?: any; + searchKeymap?: any; + highlightSelectionMatches?: any; + lintKeymap?: any; + EditorState_allowMultipleSelections?: any; + EditorView_lineWrapping?: any; + EditorView_editable?: any; + EditorView_contentAttributes?: any; + bracketMatching?: any; + foldGutter?: any; + foldKeymap?: any; + indentOnInput?: any; + languages?: any; + oneDark?: any; + placeholderExt?: any; } | null = null; // ...existing code... import { browser } from '$app/environment'; type CMCache = { - EditorView: any; - EditorState: any; - basicSetup?: any; - markdown?: any; - markdownLanguage?: any; - keymap?: any; - defaultKeymap?: any; - history?: any; - historyKeymap?: any; - lineNumbers?: any; - highlightSpecialChars?: any; - drawSelection?: any; - dropCursor?: any; - rectangularSelection?: any; - crosshairCursor?: any; - highlightActiveLine?: any; - highlightActiveLineGutter?: any; - indentWithTab?: any; - indentUnit?: any; - autocompletion?: any; - completionKeymap?: any; - closeBrackets?: any; - closeBracketsKeymap?: any; - searchKeymap?: any; - highlightSelectionMatches?: any; - lintKeymap?: any; - EditorState_allowMultipleSelections?: any; - EditorView_lineWrapping?: any; - EditorView_editable?: any; - EditorView_contentAttributes?: any; - bracketMatching?: any; - foldGutter?: any; - foldKeymap?: any; - indentOnInput?: any; - languages?: any; - oneDark?: any; - placeholderExt?: any; + EditorView: any; + EditorState: any; + basicSetup?: any; + markdown?: any; + markdownLanguage?: any; + keymap?: any; + defaultKeymap?: any; + history?: any; + historyKeymap?: any; + lineNumbers?: any; + highlightSpecialChars?: any; + drawSelection?: any; + dropCursor?: any; + rectangularSelection?: any; + crosshairCursor?: any; + highlightActiveLine?: any; + highlightActiveLineGutter?: any; + indentWithTab?: any; + indentUnit?: any; + autocompletion?: any; + completionKeymap?: any; + closeBrackets?: any; + closeBracketsKeymap?: any; + searchKeymap?: any; + highlightSelectionMatches?: any; + lintKeymap?: any; + EditorState_allowMultipleSelections?: any; + EditorView_lineWrapping?: any; + EditorView_editable?: any; + EditorView_contentAttributes?: any; + bracketMatching?: any; + foldGutter?: any; + foldKeymap?: any; + indentOnInput?: any; + languages?: any; + oneDark?: any; + placeholderExt?: any; } | null; const GLOBAL_KEY = '__cm_singleton_modules_v1'; export async function ensureCodeMirrorModules(): Promise { - if (!browser) return null; + if (!browser) return null; - // Use a single global object so HMR/multiple module copies reuse same instance - const globalAny = globalThis as any; - if (globalAny[GLOBAL_KEY]) return globalAny[GLOBAL_KEY] as CMCache; + // Use a single global object so HMR/multiple module copies reuse same instance + const globalAny = globalThis as any; + if (globalAny[GLOBAL_KEY]) return globalAny[GLOBAL_KEY] as CMCache; - const [ - viewMod, - stateMod, - basicSetupMod, - markdownMod, - commandsMod, - languageMod, - autocompleteMod, - searchMod, - lintMod, - themeOneDarkMod - ] = await Promise.all([ - import('@codemirror/view'), - import('@codemirror/state'), - import('@codemirror/basic-setup'), - import('@codemirror/lang-markdown'), - import('@codemirror/commands'), - import('@codemirror/language'), - import('@codemirror/autocomplete'), - import('@codemirror/search'), - import('@codemirror/lint'), - import('@codemirror/theme-one-dark') - ]); + const [ + viewMod, + stateMod, + basicSetupMod, + markdownMod, + commandsMod, + languageMod, + autocompleteMod, + searchMod, + lintMod, + themeOneDarkMod + ] = await Promise.all([ + import('@codemirror/view'), + import('@codemirror/state'), + import('@codemirror/basic-setup'), + import('@codemirror/lang-markdown'), + import('@codemirror/commands'), + import('@codemirror/language'), + import('@codemirror/autocomplete'), + import('@codemirror/search'), + import('@codemirror/lint'), + import('@codemirror/theme-one-dark') + ]); - const cache: CMCache = { - EditorView: viewMod.EditorView, - keymap: viewMod.keymap, - lineNumbers: viewMod.lineNumbers, - highlightSpecialChars: viewMod.highlightSpecialChars, - drawSelection: viewMod.drawSelection, - dropCursor: viewMod.dropCursor, - rectangularSelection: viewMod.rectangularSelection, - crosshairCursor: viewMod.crosshairCursor, - highlightActiveLine: viewMod.highlightActiveLine, - highlightActiveLineGutter: viewMod.highlightActiveLineGutter, - EditorView_lineWrapping: viewMod.EditorView.lineWrapping, - EditorView_editable: viewMod.EditorView.editable, - EditorView_contentAttributes: viewMod.EditorView.contentAttributes, - placeholderExt: viewMod.placeholder, + const cache: CMCache = { + EditorView: viewMod.EditorView, + keymap: viewMod.keymap, + lineNumbers: viewMod.lineNumbers, + highlightSpecialChars: viewMod.highlightSpecialChars, + drawSelection: viewMod.drawSelection, + dropCursor: viewMod.dropCursor, + rectangularSelection: viewMod.rectangularSelection, + crosshairCursor: viewMod.crosshairCursor, + highlightActiveLine: viewMod.highlightActiveLine, + highlightActiveLineGutter: viewMod.highlightActiveLineGutter, + EditorView_lineWrapping: viewMod.EditorView.lineWrapping, + EditorView_editable: viewMod.EditorView.editable, + EditorView_contentAttributes: viewMod.EditorView.contentAttributes, + placeholderExt: viewMod.placeholder, - EditorState: stateMod.EditorState, - EditorSelection: stateMod.EditorSelection, - EditorState_allowMultipleSelections: stateMod.EditorState.allowMultipleSelections, - EditorState_readOnly: stateMod.EditorState.readOnly, + EditorState: stateMod.EditorState, + EditorSelection: stateMod.EditorSelection, + EditorState_allowMultipleSelections: stateMod.EditorState.allowMultipleSelections, + EditorState_readOnly: stateMod.EditorState.readOnly, - basicSetup: basicSetupMod?.basicSetup, + basicSetup: basicSetupMod?.basicSetup, - markdown: markdownMod?.markdown, - markdownLanguage: markdownMod?.markdownLanguage, - languages: languageMod?.languages, // From @codemirror/language-data, often re-exported by @codemirror/language + markdown: markdownMod?.markdown, + markdownLanguage: markdownMod?.markdownLanguage, + languages: languageMod?.languages, // From @codemirror/language-data, often re-exported by @codemirror/language - defaultKeymap: (commandsMod && commandsMod.defaultKeymap) || [], - history: commandsMod?.history, - historyKeymap: commandsMod?.historyKeymap || [], - indentWithTab: commandsMod?.indentWithTab, + defaultKeymap: (commandsMod && commandsMod.defaultKeymap) || [], + history: commandsMod?.history, + historyKeymap: commandsMod?.historyKeymap || [], + indentWithTab: commandsMod?.indentWithTab, - indentUnit: languageMod?.indentUnit, - indentOnInput: languageMod?.indentOnInput, - bracketMatching: languageMod?.bracketMatching, - foldGutter: languageMod?.foldGutter, - foldKeymap: languageMod?.foldKeymap, + indentUnit: languageMod?.indentUnit, + indentOnInput: languageMod?.indentOnInput, + bracketMatching: languageMod?.bracketMatching, + foldGutter: languageMod?.foldGutter, + foldKeymap: languageMod?.foldKeymap, - autocompletion: autocompleteMod?.autocompletion, - completionKeymap: autocompleteMod?.completionKeymap, - closeBrackets: autocompleteMod?.closeBrackets, - closeBracketsKeymap: autocompleteMod?.closeBracketsKeymap, + autocompletion: autocompleteMod?.autocompletion, + completionKeymap: autocompleteMod?.completionKeymap, + closeBrackets: autocompleteMod?.closeBrackets, + closeBracketsKeymap: autocompleteMod?.closeBracketsKeymap, - searchKeymap: searchMod?.searchKeymap, - highlightSelectionMatches: searchMod?.highlightSelectionMatches, + searchKeymap: searchMod?.searchKeymap, + highlightSelectionMatches: searchMod?.highlightSelectionMatches, - lintKeymap: lintMod?.lintKeymap, + lintKeymap: lintMod?.lintKeymap, - oneDark: themeOneDarkMod?.oneDark - }; + oneDark: themeOneDarkMod?.oneDark + }; - globalAny[GLOBAL_KEY] = cache; - return cache; + globalAny[GLOBAL_KEY] = cache; + return cache; } diff --git a/src/lib/elements/element_ae_crud.svelte b/src/lib/elements/element_ae_crud.svelte index 9a8d8ffb..22d8ab2e 100644 --- a/src/lib/elements/element_ae_crud.svelte +++ b/src/lib/elements/element_ae_crud.svelte @@ -1,447 +1,450 @@
- - + + - - + + -
- - +
+ + - - + + - - {#if field_type == 'template'} - - {:else if field_type == 'button'} - - {field_value} - {:else if field_type == 'select'} - - {:else if field_type == 'text'} - - {:else if field_type == 'textarea'} - - {:else} - - {/if} - {#if allow_null} - - {/if} - + + {#if field_type == 'template'} + + {:else if field_type == 'button'} + + {field_value} + {:else if field_type == 'select'} + + {:else if field_type == 'text'} + + {:else if field_type == 'textarea'} + + {:else} + + {/if} + {#if allow_null} + + {/if} + - + -
- {#await ae_promises.api_update__ae_obj} - - Processing... - {:then} - {#if patch_result} - - {patch_result} - {:else} - - {/if} - {/await} -
-
+
+ {#await ae_promises.api_update__ae_obj} + + Processing... + {:then} + {#if patch_result} + + {patch_result} + {:else} + + {/if} + {/await} +
+
diff --git a/src/lib/elements/element_ae_crud_v2.svelte b/src/lib/elements/element_ae_crud_v2.svelte index 13270657..df2163a3 100644 --- a/src/lib/elements/element_ae_crud_v2.svelte +++ b/src/lib/elements/element_ae_crud_v2.svelte @@ -1,258 +1,258 @@
- {@render children?.()} + {@render children?.()} - - + > + - - + ondblclick={() => { + // hide_edit_btn = true; + // hide_edit_form = false; + show_edit_form = true; + }} + title="Double click to edit property" + > + + + + - -
- - + > + + - - + + - - New value: {new_field_value} - + + New value: {new_field_value} + - - {#if field_type == 'template'} - - {:else if field_type == 'button'} - - {new_field_value} - {:else if field_type == 'select'} - - {#if select_option_kv && Object.keys(select_option_kv).length == 0} - - {:else if select_option_kv && Object.keys(select_option_kv).length > 0} - {#each Object.keys(select_option_kv) as option} - - {/each} - {:else} - - {/if} - - {:else if field_type == 'text'} - - {:else if field_type == 'textarea'} - - {:else} - - {/if} - {#if allow_null} - - {/if} - + > + {#if select_option_kv && Object.keys(select_option_kv).length == 0} + + {:else if select_option_kv && Object.keys(select_option_kv).length > 0} + {#each Object.keys(select_option_kv) as option} + + {/each} + {:else} + + {/if} + + {:else if field_type == 'text'} + + {:else if field_type == 'textarea'} + + {:else} + + {/if} + {#if allow_null} + + {/if} + - + disabled={new_field_value === current_field_value} + onclick={async () => { + handle_obj_field_patch(new_field_value); + }} + title="Save new field value" + > + {#if new_field_value === current_field_value} + {#if btn_label} + {@html btn_label} + {:else} + + Save + {/if} + + {:else if btn_label} + {@html btn_label} + {:else} + + Save + {/if} + -
- {#await ae_promises.api_update__ae_obj} - - Processing... - {:then} - {#if patch_status} - - {patch_status} - {:else} - - {/if} - {/await} -
-
+
+ {#await ae_promises.api_update__ae_obj} + + Processing... + {:then} + {#if patch_status} + + {patch_status} + {:else} + + {/if} + {/await} +
+
diff --git a/src/lib/elements/element_codemirror_editor.svelte b/src/lib/elements/element_codemirror_editor.svelte index 030c0da4..309b9a87 100644 --- a/src/lib/elements/element_codemirror_editor.svelte +++ b/src/lib/elements/element_codemirror_editor.svelte @@ -1,151 +1,157 @@
-
- - - -
-
+
+ + + +
+
diff --git a/src/lib/elements/element_codemirror_editor_wrapper.svelte b/src/lib/elements/element_codemirror_editor_wrapper.svelte index 639ad3b5..cb43ac81 100644 --- a/src/lib/elements/element_codemirror_editor_wrapper.svelte +++ b/src/lib/elements/element_codemirror_editor_wrapper.svelte @@ -1,21 +1,21 @@
- {#if browser} - - {:else} - -
Editor (client only)
- {/if} + {#if browser} + + {:else} + +
Editor (client only)
+ {/if}
diff --git a/src/lib/elements/element_data_store.svelte b/src/lib/elements/element_data_store.svelte index 40478c3a..05ee0fd8 100644 --- a/src/lib/elements/element_data_store.svelte +++ b/src/lib/elements/element_data_store.svelte @@ -1,487 +1,487 @@
- {#if ae_ds_tmp} - {#if debug || $ae_loc.debug == 'debug'} -
+    {#if ae_ds_tmp}
+        {#if debug || $ae_loc.debug == 'debug'}
+            
     id: {ae_ds_tmp.id},
     code: {ae_ds_tmp.code},
     type: {ae_ds_tmp.type},
@@ -497,297 +497,310 @@
     text: {ae_ds_tmp.text},
     updated_on: {ae_ds_tmp.updated_on},
     
- {/if} + {/if} - {#if show_edit} -
-
- + {#if show_edit} +
+ + - {#if $ae_loc.trusted_access} - - {/if} - {#if $ae_loc.manager_access} - + {#if $ae_loc.trusted_access} + + {/if} + {#if $ae_loc.manager_access} + - - {/if} - {#if $ae_loc.trusted_access} - - {/if} - {#if $ae_loc.manager_access} - - - - - - - {:else} - Code: {ae_ds_tmp.code} - - Type: {ae_ds_tmp.type} - {/if} + + {/if} + {#if $ae_loc.trusted_access} + + {/if} + {#if $ae_loc.manager_access} + + + + + + + {:else} + Code: {ae_ds_tmp.code} + + Type: {ae_ds_tmp.type} + {/if} - - {#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null} - - - {:else if ae_ds_tmp.type == 'sql'} - + + {#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null} + + + {:else if ae_ds_tmp.type == 'sql'} + - - {:else if ae_ds_tmp.type == 'text'} - - {/if} -
- + + {:else if ae_ds_tmp.type == 'text'} + + {/if} +
+ - + - + - {#await ds_submit_results} - - {:then ds_submit_results} - {#if ds_submit_results} -
- - Saved -
- {/if} - {/await} + {#await ds_submit_results} + + {:then ds_submit_results} + {#if ds_submit_results} +
+ + Saved +
+ {/if} + {/await} -
- submit: {$ae_sess.ds.submit_status} - create: {$ae_sess.ds.create_status} - update: {$ae_sess.ds.update_status} -
-
- -
- {/if} +
+ submit: {$ae_sess.ds.submit_status} + create: {$ae_sess.ds.create_status} + update: {$ae_sess.ds.update_status} +
+
+ +
+ {/if} - + - {#if !ae_ds_tmp.type && !ae_ds_tmp.html && !ae_ds_tmp.json && !ae_ds_tmp.md && !ae_ds_tmp.text} - {#if $ae_loc.manager_access} - No data found! Is the data store correct or new? - {:else} - - {/if} - {/if} + {#if !ae_ds_tmp.type && !ae_ds_tmp.html && !ae_ds_tmp.json && !ae_ds_tmp.md && !ae_ds_tmp.text} + {#if $ae_loc.manager_access} + No data found! Is the data store correct or new? + {:else} + + {/if} + {/if} - {#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html} - {@html ae_ds_tmp.html} - {:else if ae_ds_tmp.type == 'html'} - {#if $ae_loc.manager_access} - No HTML found! Is the data store type correct? - {:else} - - {/if} - {/if} + {#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html} + {@html ae_ds_tmp.html} + {:else if ae_ds_tmp.type == 'html'} + {#if $ae_loc.manager_access} + No HTML found! Is the data store type correct? + {:else} + + {/if} + {/if} - {#if ae_ds_tmp.type == 'text' && ae_ds_tmp.text} - {ae_ds_tmp.text} - {:else if ae_ds_tmp.type == 'text'} - {#if $ae_loc.manager_access} - No text found! Is the data store type correct? - {:else} - - {/if} - {/if} + {#if ae_ds_tmp.type == 'text' && ae_ds_tmp.text} + {ae_ds_tmp.text} + {:else if ae_ds_tmp.type == 'text'} + {#if $ae_loc.manager_access} + No text found! Is the data store type correct? + {:else} + + {/if} + {/if} - + - - {:else} - - {/if} + + {:else} + + {/if} - - - {#await ds_get_results} - - {/await} + {#await ds_get_results} + + {/await} - + diff --git a/src/lib/elements/element_data_store_v2.svelte b/src/lib/elements/element_data_store_v2.svelte index 2aa97c83..24353f3d 100644 --- a/src/lib/elements/element_data_store_v2.svelte +++ b/src/lib/elements/element_data_store_v2.svelte @@ -1,505 +1,508 @@
- {#if ae_ds_tmp} - {#if debug || $ae_loc.debug == 'debug'} -
+    {#if ae_ds_tmp}
+        {#if debug || $ae_loc.debug == 'debug'}
+            
     id: {ae_ds_tmp.id},
     code: {ae_ds_tmp.code},
     type: {ae_ds_tmp.type},
@@ -515,180 +518,184 @@
     text: {ae_ds_tmp.text},
     updated_on: {ae_ds_tmp.updated_on},
     
- {/if} + {/if} - - + + - - -
- + > + + -
- {#if $ae_loc.trusted_access} - - {/if} - {#if $ae_loc.manager_access} - +
+ {#if $ae_loc.trusted_access} + + {/if} + {#if $ae_loc.manager_access} + - - {/if} -
+ + {/if} +
-
- {#if $ae_loc.trusted_access} - - {/if} -
+
+ {#if $ae_loc.trusted_access} + + {/if} +
-
- {#if $ae_loc.manager_access} - - - - - - - {:else} - Code: {ae_ds_tmp.code} - - Type: {ae_ds_tmp.type} - {/if} -
+
+ {#if $ae_loc.manager_access} + + + + + + + {:else} + Code: {ae_ds_tmp.code} + + Type: {ae_ds_tmp.type} + {/if} +
-
- - {#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null} - - - {:else if ae_ds_tmp.type == 'sql'} - +
+ + {#if ae_ds_tmp.type == 'html' || ae_ds_tmp.type == null} + + + {:else if ae_ds_tmp.type == 'sql'} + - - {:else if ae_ds_tmp.type == 'text'} - - {/if} -
+ + {:else if ae_ds_tmp.type == 'text'} + + {/if} +
-
- +
+ - - + - {#await ds_submit_results} - - {:then ds_submit_results} - {#if ds_submit_results} -
- - Saved -
- {/if} - {/await} + {#await ds_submit_results} + + {:then ds_submit_results} + {#if ds_submit_results} +
+ + Saved +
+ {/if} + {/await} -
- submit: {$ae_sess.ds.submit_status} - create: {$ae_sess.ds.create_status} - update: {$ae_sess.ds.update_status} -
-
- +
+ submit: {$ae_sess.ds.submit_status} + create: {$ae_sess.ds.create_status} + update: {$ae_sess.ds.update_status} +
+
+ - -
- -
-
-
+ +
+ +
+
+ - - + + - + - {#if !ae_ds_tmp.type && !ae_ds_tmp.html && !ae_ds_tmp.json && !ae_ds_tmp.md && !ae_ds_tmp.text} - {#if $ae_loc.manager_access} - No data found! Is the data store correct or new? - {:else} - - {/if} - {/if} + {#if !ae_ds_tmp.type && !ae_ds_tmp.html && !ae_ds_tmp.json && !ae_ds_tmp.md && !ae_ds_tmp.text} + {#if $ae_loc.manager_access} + No data found! Is the data store correct or new? + {:else} + + {/if} + {/if} - {#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html} - {@html ae_ds_tmp.html} - {:else if ae_ds_tmp.type == 'html'} - {#if $ae_loc.manager_access} - No HTML found! Is the data store type correct? - {:else} - - {/if} - {/if} + {#if ae_ds_tmp.type == 'html' && ae_ds_tmp.html} + {@html ae_ds_tmp.html} + {:else if ae_ds_tmp.type == 'html'} + {#if $ae_loc.manager_access} + No HTML found! Is the data store type correct? + {:else} + + {/if} + {/if} - {#if ae_ds_tmp.type == 'text' && ae_ds_tmp.text} - {ae_ds_tmp.text} - {:else if ae_ds_tmp.type == 'text'} - {#if $ae_loc.manager_access} - No text found! Is the data store type correct? - {:else} - - {/if} - {/if} + {#if ae_ds_tmp.type == 'text' && ae_ds_tmp.text} + {ae_ds_tmp.text} + {:else if ae_ds_tmp.type == 'text'} + {#if $ae_loc.manager_access} + No text found! Is the data store type correct? + {:else} + + {/if} + {/if} - + - - {:else} - - {/if} + + {:else} + + {/if} - - - {#await ds_get_results} - - {/await} + {#await ds_get_results} + + {/await} - +
diff --git a/src/lib/elements/element_input_file.svelte b/src/lib/elements/element_input_file.svelte index c2315279..39d3b60e 100644 --- a/src/lib/elements/element_input_file.svelte +++ b/src/lib/elements/element_input_file.svelte @@ -1,426 +1,438 @@
- + - + - {#if file_list_status == 'processing'} -
- Processing selected file list... -
- {/if} + {#if file_list_status == 'processing'} +
+ Processing selected file list... +
+ {/if} - - - {#if use_selected_file_table && input_file_list_processed && input_file_list_processed.length} - Files selected for upload - - - - - - - - - - - - - {#each input_file_list_processed as file_list_item, file_index} - - - - - - + + + + + + {/each} +
RemoveFilenameModifiedSizeExtHash
- - {file_list_item.filename}{file_list_item.modified_datetime_string} - {file_list_item.file_size_string} - + + {#if use_selected_file_table && input_file_list_processed && input_file_list_processed.length} + Files selected for upload + + + + + + + + + + + + + {#each input_file_list_processed as file_list_item, file_index} + + + + + + - - - - - - {/each} -
RemoveFilenameModifiedSizeExtHash
+ + {file_list_item.filename}{file_list_item.modified_datetime_string} + {file_list_item.file_size_string} + - - {file_list_item.guessed_extension} - - {ae_util.shorten_string({ - string: file_list_item.hash_sha256, - begin_length: 5, - end_length: 4, - wildcard_length: 2 - })} -
- {/if} +
+ {file_list_item.guessed_extension} + + {ae_util.shorten_string({ + string: file_list_item.hash_sha256, + begin_length: 5, + end_length: 4, + wildcard_length: 2 + })} +
+ {/if}
diff --git a/src/lib/elements/element_input_files_tbl.svelte b/src/lib/elements/element_input_files_tbl.svelte index c91399e0..99ba7c83 100644 --- a/src/lib/elements/element_input_files_tbl.svelte +++ b/src/lib/elements/element_input_files_tbl.svelte @@ -1,406 +1,419 @@
- {#if file_list_status == 'processing'} -
- Processing selected file list... -
- {/if} + {#if file_list_status == 'processing'} +
+ Processing selected file list... +
+ {/if} - - - {#if use_selected_file_table && processed_file_list && processed_file_list.length} - Files selected for upload - - - - - - - - - - - - - {#each processed_file_list as file_list_item, file_index} - - - - - - - - - - - - {/each} -
RemoveFilenameModifiedSizeExtHash
- - - {file_list_item.filename} - {file_list_item.modified_datetime_string} - {file_list_item.file_size_string} - {#if $ae_sess.api_upload_kv[file_list_item.hash_sha256]} - ({$ae_sess.api_upload_kv[file_list_item.hash_sha256].percent_completed}%) - {/if} - - {file_list_item.guessed_extension} - - {ae_util.shorten_string({ - string: file_list_item.hash_sha256, - begin_length: 5, - end_length: 4, - wildcard_length: 2 - })} -
- {/if} + + + {#if use_selected_file_table && processed_file_list && processed_file_list.length} + Files selected for upload + + + + + + + + + + + + + {#each processed_file_list as file_list_item, file_index} + + + + + + + + + + + + {/each} +
RemoveFilenameModifiedSizeExtHash
+ + + {file_list_item.filename} + {file_list_item.modified_datetime_string} + {file_list_item.file_size_string} + {#if $ae_sess.api_upload_kv[file_list_item.hash_sha256]} + ({$ae_sess.api_upload_kv[file_list_item.hash_sha256] + .percent_completed}%) + {/if} + + {file_list_item.guessed_extension} + + {ae_util.shorten_string({ + string: file_list_item.hash_sha256, + begin_length: 5, + end_length: 4, + wildcard_length: 2 + })} +
+ {/if}
diff --git a/src/lib/elements/element_input_v2.svelte b/src/lib/elements/element_input_v2.svelte index 1d14bd45..28ac479c 100644 --- a/src/lib/elements/element_input_v2.svelte +++ b/src/lib/elements/element_input_v2.svelte @@ -1,329 +1,329 @@
- {#if type === 'email' || type === 'date' || type === 'number' || type === 'tel' || type === 'text' || type === 'time' || type === 'url'} - {#if content_layout == 'label_start' && label} - - {/if} + {#if type === 'email' || type === 'date' || type === 'number' || type === 'tel' || type === 'text' || type === 'time' || type === 'url'} + {#if content_layout == 'label_start' && label} + + {/if} - + - {#if content_layout != 'label_start' && label} - - {/if} + {#if content_layout != 'label_start' && label} + + {/if} - {description} - {:else if type === 'date_time'} - {#if content_layout == 'label_start' && label} - {label} - - {/if} + {description} + {:else if type === 'date_time'} + {#if content_layout == 'label_start' && label} + {label} + + {/if} -
- {#if label_begin} - - {/if} +
+ {#if label_begin} + + {/if} - + - {#if !label_begin} - - {/if} -
+ {#if !label_begin} + + {/if} +
-
- {#if label_begin} - - {/if} +
+ {#if label_begin} + + {/if} - + - {#if !label_begin} - - {/if} -
+ {#if !label_begin} + + {/if} +
- {#if content_layout != 'label_start' && label} - {label} - - {/if} + {#if content_layout != 'label_start' && label} + {label} + + {/if} - {description} - {:else if type === 'checkbox'} - {#if checkbox_none} - {#if !value} - {(checked = 'checked')} - {/if} - - {/if} - {#if checkbox_li.length} - {#if content_layout == 'label_start' && label} - {label} - {/if} + {description} + {:else if type === 'checkbox'} + {#if checkbox_none} + {#if !value} + {(checked = 'checked')} + {/if} + + {/if} + {#if checkbox_li.length} + {#if content_layout == 'label_start' && label} + {label} + {/if} - {#each Object.entries(checkbox_li) as [li_key, li_value]} - {#if li_key.toString() === value.toString()} - - {:else} - - {/if} - {/each} + {#each Object.entries(checkbox_li) as [li_key, li_value]} + {#if li_key.toString() === value.toString()} + + {:else} + + {/if} + {/each} - {#if content_layout != 'label_start' && label} - {label} - {/if} - {:else} - {#if label_begin} - - {/if} + {#if content_layout != 'label_start' && label} + {label} + {/if} + {:else} + {#if label_begin} + + {/if} - - {/if} + + {/if} - {description} - {:else if type === 'radio'} - {#if radio_none} - {#if !value} - {(checked = 'checked')} - {/if} - - {/if} - {#if radio_li} - {#if content_layout == 'label_start' && label} - {label}: - {/if} + {description} + {:else if type === 'radio'} + {#if radio_none} + {#if !value} + {(checked = 'checked')} + {/if} + + {/if} + {#if radio_li} + {#if content_layout == 'label_start' && label} + {label}: + {/if} - - {#each Object.entries(radio_li) as [li_key, li_value]} - {#if value === null} - - - {:else if li_key.toString() === value.toString() || (li_key == 'true' && value == true) || (li_key == 'false' && value == false)} - - {:else} - - {/if} + + {#each Object.entries(radio_li) as [li_key, li_value]} + {#if value === null} + + + {:else if li_key.toString() === value.toString() || (li_key == 'true' && value == true) || (li_key == 'false' && value == false)} + + {:else} + + {/if} - - {/each} - + {/each} + - {#if !label_begin} - {label}: - {/if} - {:else} - {#if label_begin} - - {/if} + {#if !label_begin} + {label}: + {/if} + {:else} + {#if label_begin} + + {/if} - + - {#if !label_begin} - - {/if} - {/if} + {#if !label_begin} + + {/if} + {/if} - {description} - {:else if type === 'textarea'} - {#if label_begin} - - {/if} + {description} + {:else if type === 'textarea'} + {#if label_begin} + + {/if} - {#if value_new_line}
{/if} - - + {#if value_new_line}
{/if} + + - {#if !label_begin} - - {/if} + {#if !label_begin} + + {/if} - {description} - {:else if type === 'hidden'} - - {:else if type === 'select'} - {#if label_begin} - - {/if} + {description} + {:else if type === 'hidden'} + + {:else if type === 'select'} + {#if label_begin} + + {/if} - + - {#if !label_begin} - - {/if} + {#if !label_begin} + + {/if} - {description} - {/if} + {description} + {/if} - +
diff --git a/src/lib/elements/element_manage_event_file_li.svelte b/src/lib/elements/element_manage_event_file_li.svelte index 7b36714f..789e2862 100644 --- a/src/lib/elements/element_manage_event_file_li.svelte +++ b/src/lib/elements/element_manage_event_file_li.svelte @@ -1,591 +1,666 @@
- + // ae_tmp.show__file_li = false; + // console.log(`$lq__event_file_obj_li:`, $lq__event_file_obj_li); + // $slct_trigger = 'load__event_file_obj_li'; + // ae_tmp.show__file_li = true; + }} + class="btn btn-sm p-1 m-1 preset-tonal-tertiary hover:preset-tonal-warning border border-warning-500 transition hover:transition-all *:hover:inline" + class:hidden={!$ae_loc.edit_mode || !$ae_loc.authenticated_access} + title="Refresh the list of files" + > + + + - +
-

- Manage Files: - - - {@html $lq__event_file_obj_li ? `${$lq__event_file_obj_li.length}×` : '-- none --'} - -

+

+ Manage Files: + + + {@html $lq__event_file_obj_li + ? `${$lq__event_file_obj_li.length}×` + : '-- none --'} + +

- {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} -
- - {#if display_mode === 'default'} - - - - {#if display_mode === 'default'} - - {/if} - {#if display_mode === 'default'} - - {/if} - - - - {/if} + {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} +
+
Download FileOptionsStatusMeta
+ {#if display_mode === 'default'} + + + + {#if display_mode === 'default'} + + {/if} + {#if display_mode === 'default'} + + {/if} + + + + {/if} - - {#each $lq__event_file_obj_li as event_file_obj} - - + {#each $lq__event_file_obj_li as event_file_obj} + + + ae_promises.update__event_file_obj = events_func + .update_ae_obj__event_file({ + api_cfg: $ae_api, + event_file_id: + event_file_obj.event_file_id_random, + data_kv: event_file_data, + log_lvl: 0 + }) + .then(function (update_results) { + console.log( + `Update results:`, + update_results + ); + $events_sess.pres_mgmt.show_field_edit__filename = false; + }); + }} + class="btn btn-sm preset-tonal-tertiary hover:preset-tonal-success" + title="Save changes" + > + {#await ae_promises.update__event_file_obj} + + Saving {event_file_obj.extension} + {:then} + + Save {event_file_obj.extension} filename? + {/await} + + {/if} + + {/if} + - {#if display_mode === 'default'} - - {/if} + ae_promises.delete__event_file_obj = + await events_func.delete_ae_obj_id__event_file({ + api_cfg: $ae_api, + event_file_id: + event_file_obj.event_file_id_random, + log_lvl: 1 + }); + }} + class="btn btn-sm preset-tonal-tertiary hover:preset-tonal-success" + title="Delete this file" + > + + + Delete + + + + {/if} - {#if display_mode === 'default'} - - {/if} + // ae_triggers.update_event_file_purpose = true; + }} + class="select min-w-fit max-w-fit text-xs mx-1 border border-gray-300 rounded-md p-1 hover:border-gray-400" + > + + {#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} + {/if} + + + + + + + + + + + + + + {/if} - - - {/each} - -
Download FileOptionsStatusMeta
- {#if $events_sess.pres_mgmt?.show_field_edit__filename != event_file_obj.event_file_id_random} -
+ {#if $events_sess.pres_mgmt?.show_field_edit__filename != event_file_obj.event_file_id_random} + + + {event_file_obj.file_purpose} + + - -
- Original: - - - - - - - + + - -
+ + -
- Session Name: - - - - - - -
+ + -
- Presentation Name: - - - - - - - + + - -
-
- {:else} - - - - {#if $events_sess.pres_mgmt.tmp_val__filename_no_ext.trim() != event_file_obj.filename_no_ext} - - {/if} - - {/if} -
-
- + {#if display_mode === 'default'} +
+
+ - + {/await} + - -
-
-
-
- {#if event_file_obj.open_in_os == 'win'} - MS Windows - {:else if event_file_obj.open_in_os == 'mac'} - Apple macOS - {/if} -
+ {#if display_mode === 'default'} +
+
+
+ {#if event_file_obj.open_in_os == 'win'} + MS Windows + {:else if event_file_obj.open_in_os == 'mac'} + Apple macOS + {/if} +
- -
- - { + // ae_tmp[event_file_obj.event_file_id_random].file_purpose = e.target.value; + console.log( + `Selected file_purpose: ${e.target.value}` + ); - let event_file_data = { - event_file_id_random: event_file_obj.event_file_id_random, - file_purpose: e.target.value - }; + let event_file_data = { + event_file_id_random: + event_file_obj.event_file_id_random, + file_purpose: e.target.value + }; - events_func - .update_ae_obj__event_file({ - api_cfg: $ae_api, - event_file_id: event_file_obj.event_file_id_random, - data_kv: event_file_data, - log_lvl: 1 - }) - .then(function (update_results) { - console.log(`Update results:`, update_results); - $slct_trigger = 'load__event_file_obj_li'; - }); + events_func + .update_ae_obj__event_file({ + api_cfg: $ae_api, + event_file_id: + event_file_obj.event_file_id_random, + data_kv: event_file_data, + log_lvl: 1 + }) + .then(function (update_results) { + console.log( + `Update results:`, + update_results + ); + $slct_trigger = + 'load__event_file_obj_li'; + }); - // ae_triggers.update_event_file_purpose = true; - }} - class="select min-w-fit max-w-fit text-xs mx-1 border border-gray-300 rounded-md p-1 hover:border-gray-400" - > - - {#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} - {/if} - - - - - - - - - - -
-
-
-
- +
+
+ - - - Type: - {event_file_obj.extension} - - - - - - Size: - {ae_util.format_bytes(event_file_obj.file_size)} - - + + + + Size: + + {ae_util.format_bytes( + event_file_obj.file_size + )} + + - - - Hash: - {event_file_obj.hash_sha256.slice(0, 10)}… - - - ID: - {event_file_obj.hosted_file_id_random} - - + + + + Hash: + + {event_file_obj.hash_sha256.slice(0, 10)}… + + + + ID: + + {event_file_obj.hosted_file_id_random} + + - - - {#if display_mode == 'default'} - - - - - - {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'dddd')} - - {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'date_iso')} - at - {ae_util.iso_datetime_formatter( - event_file_obj.created_on, - 'time_12_short_no_leading' - )} - - {:else} - - - {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'date_short')} - - {ae_util.iso_datetime_formatter( - event_file_obj.created_on, - 'time_12_short_no_leading' - )} - - {/if} - -
-
-
- {:else} -

- No files uploaded to display -

- {/if} + + + {#if display_mode == 'default'} + + + + + + {ae_util.iso_datetime_formatter( + event_file_obj.created_on, + 'dddd' + )} + + {ae_util.iso_datetime_formatter( + event_file_obj.created_on, + 'date_iso' + )} + at + {ae_util.iso_datetime_formatter( + event_file_obj.created_on, + 'time_12_short_no_leading' + )} + + {:else} + + + {ae_util.iso_datetime_formatter( + event_file_obj.created_on, + 'date_short' + )} + + {ae_util.iso_datetime_formatter( + event_file_obj.created_on, + 'time_12_short_no_leading' + )} + + {/if} + + + + + {/each} + + + + {:else} +

+ No files uploaded to display +

+ {/if}
diff --git a/src/routes/core/not_used+layout.ts b/src/routes/core/not_used+layout.ts index 37f296cd..6bf0ee58 100644 --- a/src/routes/core/not_used+layout.ts +++ b/src/routes/core/not_used+layout.ts @@ -4,33 +4,33 @@ // import { core_func } from '$lib/ae_core_functions'; export async function load({ parent }) { - const log_lvl: number = 0; + const log_lvl: number = 0; - const data = await parent(); - // console.log(`ae_events_pres_mgmt +layout.ts data:`, data); + const data = await parent(); + // console.log(`ae_events_pres_mgmt +layout.ts data:`, data); - // let account_id = data.account_id; - // if (!account_id) { - // console.log(`events_pres_mgmt +layout.ts: The account_id was not found in the data!!!`); - // return false; - // } + // let account_id = data.account_id; + // if (!account_id) { + // console.log(`events_pres_mgmt +layout.ts: The account_id was not found in the data!!!`); + // return false; + // } - // let ae_acct = data[account_id]; - // if (log_lvl) { - // console.log(`ae_acct = `, ae_acct); - // } + // let ae_acct = data[account_id]; + // if (log_lvl) { + // console.log(`ae_acct = `, ae_acct); + // } - // let submenu = { - // main: {name: 'Main', href: '/events', access: false}, - // // manage: {name: 'Manage', href: '/events/manage', access: 'administrator', disable: true, hide: true}, - // locations: {name: 'Locations', href: '/events/locations', access: false, disable: false, hide: false}, - // }; - // data.submenu = submenu + // let submenu = { + // main: {name: 'Main', href: '/events', access: false}, + // // manage: {name: 'Manage', href: '/events/manage', access: 'administrator', disable: true, hide: true}, + // locations: {name: 'Locations', href: '/events/locations', access: false, disable: false, hide: false}, + // }; + // data.submenu = submenu - // // WARNING: Precaution against shared data between sites and sessions. - // data[account_id] = ae_acct; + // // WARNING: Precaution against shared data between sites and sessions. + // data[account_id] = ae_acct; - return data; + return data; } // export const prerender = false; diff --git a/src/routes/core/person/[person_id]/+page.svelte b/src/routes/core/person/[person_id]/+page.svelte index f63ae640..21fe9014 100644 --- a/src/routes/core/person/[person_id]/+page.svelte +++ b/src/routes/core/person/[person_id]/+page.svelte @@ -1,198 +1,198 @@ - - Person: {ae_util.shorten_string({ - string: $lq__person_obj?.full_name, - max_length: 20, - begin_length: 10, - end_length: 4 - })} - ({$lq__person_obj?.person_id ?? 'loading...'}) - Core - {$ae_loc?.title} - + + Person: {ae_util.shorten_string({ + string: $lq__person_obj?.full_name, + max_length: 20, + begin_length: 10, + end_length: 4 + })} + ({$lq__person_obj?.person_id ?? 'loading...'}) - Core - {$ae_loc?.title} +
-
-
- - - Back to Core - +
+
+ + + Back to Core + - -
+ +
- + -
- -
-
+
+ +
+
- {#if !$lq__person_obj} -
- - Loading... -
- {:else} - - {/if} + {#if !$lq__person_obj} +
+ + Loading... +
+ {:else} + + {/if} - + - - - - +
diff --git a/src/routes/core/person/[person_id]/+page.ts b/src/routes/core/person/[person_id]/+page.ts index 58d87eaa..f40d0fe9 100644 --- a/src/routes/core/person/[person_id]/+page.ts +++ b/src/routes/core/person/[person_id]/+page.ts @@ -5,40 +5,40 @@ console.log(`ae core person [person_id] +page.ts: start`); import { core_func } from '$lib/ae_core/ae_core_functions'; export async function load({ params, parent }) { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - // console.log(`ae core person [person_id] +page.ts data:`, data); - data.log_lvl = log_lvl; + const data = await parent(); + // console.log(`ae core person [person_id] +page.ts data:`, data); + data.log_lvl = log_lvl; - const account_id = data.account_id; - const ae_acct = data[account_id]; - console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + console.log(`ae_acct = `, ae_acct); - const person_id = params.person_id; - console.log(`person_id = `, person_id); - if (!person_id) { - console.log( - `ae core person [person_id] +page.ts: The person_id was not found in the params!!!` - ); - error(404, { - message: 'Person not found' - }); - } + const person_id = params.person_id; + console.log(`person_id = `, person_id); + if (!person_id) { + console.log( + `ae core person [person_id] +page.ts: The person_id was not found in the params!!!` + ); + error(404, { + message: 'Person not found' + }); + } - ae_acct.slct.person_id = person_id; + ae_acct.slct.person_id = person_id; - const load_person_obj = await core_func.load_ae_obj_id__person({ - api_cfg: ae_acct.api, - person_id: person_id, - try_cache: true - }); + const load_person_obj = await core_func.load_ae_obj_id__person({ + api_cfg: ae_acct.api, + person_id: person_id, + try_cache: true + }); - ae_acct.slct.person_obj = load_person_obj; + ae_acct.slct.person_obj = load_person_obj; - // WARNING: Precaution against shared data between sites and presentations. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and presentations. + data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/core/person_view.svelte b/src/routes/core/person_view.svelte index 8f5fe184..220a31e0 100644 --- a/src/routes/core/person_view.svelte +++ b/src/routes/core/person_view.svelte @@ -1,689 +1,692 @@ {#if $lq__person_obj} -

- Person Details for:
- - "{$lq__person_obj.full_name}" - -

+

+ Person Details for:
+ + "{$lq__person_obj.full_name}" + +

-
    -
  • - { - console.log(`ae_crud_updated:`, e.detail); +
      +
    • + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - External ID: - - {@html $lq__person_obj.external_id ?? ae_snip.html__not_set} - - -
    • -
    • - { - console.log(`ae_crud_updated:`, e.detail); + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + External ID: + + {@html $lq__person_obj.external_id ?? ae_snip.html__not_set} + + +
    • +
    • + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - External System ID: - - {@html $lq__person_obj.external_sys_id ?? ae_snip.html__not_set} - - -
    • + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + External System ID: + + {@html $lq__person_obj.external_sys_id ?? ae_snip.html__not_set} + + + -
    • - +
    • + - { - console.log(`ae_crud_updated:`, e.detail); + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - {@html $lq__person_obj.given_name ?? ae_snip.html__not_set} - - - { - console.log(`ae_crud_updated:`, e.detail); + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + {@html $lq__person_obj.given_name ?? ae_snip.html__not_set} + + + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - {@html $lq__person_obj.family_name ?? ae_snip.html__not_set} - - -
    • -
    • - { - console.log(`ae_crud_updated:`, e.detail); + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + {@html $lq__person_obj.family_name ?? ae_snip.html__not_set} + + +
    • +
    • + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - - {#if $lq__person_obj.primary_email} - - {@html $lq__person_obj.primary_email ?? 'email' + ae_snip.html__not_set} - - {:else} - email {@html ae_snip.html__not_set} - {/if} - - -
    • -
    • - { - console.log(`ae_crud_updated:`, e.detail); + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + + {#if $lq__person_obj.primary_email} + + {@html $lq__person_obj.primary_email ?? 'email' + ae_snip.html__not_set} + + {:else} + email {@html ae_snip.html__not_set} + {/if} + + +
    • +
    • + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - - {@html $lq__person_obj.affiliations ?? 'affiliations' + ae_snip.html__not_set} - - -
    • -
    • - { - console.log(`ae_crud_updated:`, e.detail); + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + + {@html $lq__person_obj.affiliations ?? 'affiliations' + ae_snip.html__not_set} + + +
    • +
    • + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - - {@html $lq__person_obj.professional_title && $lq__person_obj.professional_title.length - ? $lq__person_obj.professional_title - : 'professional title' + ae_snip.html__not_set} - - -
    • -
    • - { - console.log(`ae_crud_updated:`, e.detail); + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + + {@html $lq__person_obj.professional_title && + $lq__person_obj.professional_title.length + ? $lq__person_obj.professional_title + : 'professional title' + ae_snip.html__not_set} + + +
    • +
    • + { + console.log(`ae_crud_updated:`, e.detail); - core_func - .load_ae_obj_id__person({ - api_cfg: $ae_api, - person_id: $lq__person_obj?.person_id_random, - log_lvl: 1 - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - Passcode: - - {@html $lq__person_obj.passcode ?? 'passcode' + ae_snip.html__not_set} - - -
    • + core_func + .load_ae_obj_id__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj?.person_id_random, + log_lvl: 1 + }) + .then(function (load_results) { + // Maybe reload page? + // window.location.reload(); + }); + }} + > + + Passcode: + + {@html $lq__person_obj.passcode ?? 'passcode' + ae_snip.html__not_set} + + + - + // $events_slct.exhibit_tracking_obj.hide = !$lq__person_obj?.hide; + ae_triggers.allow_auth_key = true; + }} + class="btn btn-sm preset-tonal-warning" + > + {#if $ae_loc.trusted_access} + {@html $lq__person_obj?.allow_auth_key + ? ' Not Allow Auth Key?' + : ' Allow Auth Key?'} + {:else} + + {@html $lq__person_obj?.allow_auth_key + ? ' Not Allow Auth Key' + : ' Allow Auth Key'} + {/if} + + + -
    • -
      - +
    • +
      + - - -
      + + + -

      - JSON length: {ae_tmp.value__data_json - ? ae_util.number_w_commas(ae_tmp.value__data_json.length) - : 0} characters +

      + JSON length: {ae_tmp.value__data_json + ? ae_util.number_w_commas(ae_tmp.value__data_json.length) + : 0} characters - {#if ae_tmp.valid__data_json} - - {:else} - - Invalid JSON - {/if} -

      + {#if ae_tmp.valid__data_json} + + {:else} + + Invalid JSON + {/if} +

      -
      - -
      -
    • -
    + ae_promises.update__person_obj = core_func + .update_ae_obj__person({ + api_cfg: $ae_api, + person_id: $lq__person_obj.person_id_random, + data_kv: person_data, + log_lvl: 0 + }) + .then(function (update_result) { + // console.log(update_result); + // return update_result; + }); + }} + > + {#await ae_promises.update__person_obj} + + {:then} + {#if ae_tmp.value__data_json == $lq__person_obj.data_json} + + {:else} + + {/if} + {/await} + Save JSON + + +
  • +
{/if} diff --git a/src/routes/events/+layout.svelte b/src/routes/events/+layout.svelte index 3bffcea2..5664df0d 100644 --- a/src/routes/events/+layout.svelte +++ b/src/routes/events/+layout.svelte @@ -1,122 +1,124 @@ - - Æ: Events - {$events_loc.title ?? 'Æ loading...'} - + + Æ: Events - {$events_loc.title ?? 'Æ loading...'} + {#if $events_loc?.ver && $events_loc?.ver !== $events_sess?.ver} -
- -
+ + {/if} @@ -181,12 +183,12 @@
- {#if !$ae_sess?.disable_sys_nav} - + {/if} -
50 && nav_y_height <= 100} - class:pt-32={nav_y_height > 100 && nav_y_height <= 150} - class:pt-40={nav_y_height > 150 && nav_y_height <= 200} - class=" +
50 && nav_y_height <= 100} + class:pt-32={nav_y_height > 100 && nav_y_height <= 150} + class:pt-40={nav_y_height > 150 && nav_y_height <= 200} + class=" main_content grow px-1 md:px-2 lg:px-4 @@ -255,25 +257,25 @@ items-center justify-start " - > - - {@render children?.()} -
+ > + + {@render children?.()} +
-
- - + window.parent.postMessage({ scroll_to: 0 }, '*'); // This should be + }} + title="Scroll to top" + > + + Scroll to Top + - - -
+ window.parent.postMessage({ scroll_to: scroll_y }, '*'); + }} + title="Scroll to bottom" + > + + Scroll to Bottom + + +
- {#if !$ae_sess?.disable_sys_footer} -
300} - class:opacity-80={yTop < 250} - class:opacity-0={yTop > 250} - class=" + {#if !$ae_sess?.disable_sys_footer} +
300} + class:opacity-80={yTop < 250} + class:opacity-0={yTop > 250} + class=" footer z-20 hover:opacity-100 @@ -357,13 +359,13 @@ transition-all duration-1000 " - class:ae_debug={$ae_loc.debug} - > - -
- {/if} + class:ae_debug={$ae_loc.debug} + > + +
+ {/if} diff --git a/src/routes/events/+layout.ts b/src/routes/events/+layout.ts index 30a06565..15487e52 100644 --- a/src/routes/events/+layout.ts +++ b/src/routes/events/+layout.ts @@ -6,26 +6,28 @@ console.log(`ae_events_pres_mgmt +layout.ts start`); // import { events_func } from '$lib/ae_events_functions'; export async function load({ parent }) { - const log_lvl: number = 0; + const log_lvl: number = 0; - const parent_data = await parent(); - // console.log(`ae_events_pres_mgmt +layout.ts parent_data:`, parent_data); + const parent_data = await parent(); + // console.log(`ae_events_pres_mgmt +layout.ts parent_data:`, parent_data); - const account_id = parent_data.account_id; - if (!account_id) { - console.log(`events_pres_mgmt +layout.ts: The account_id was not found in the parent_data!!!`); - return false; - } + const account_id = parent_data.account_id; + if (!account_id) { + console.log( + `events_pres_mgmt +layout.ts: The account_id was not found in the parent_data!!!` + ); + return false; + } - const ae_acct = parent_data[account_id]; - if (log_lvl) { - console.log(`ae_acct = `, ae_acct); - } + const ae_acct = parent_data[account_id]; + if (log_lvl) { + console.log(`ae_acct = `, ae_acct); + } - // WARNING: Precaution against shared parent_data between sites and sessions. - parent_data[account_id] = ae_acct; + // WARNING: Precaution against shared parent_data between sites and sessions. + parent_data[account_id] = ae_acct; - return parent_data; + return parent_data; } // export const prerender = false; diff --git a/src/routes/events/+page.svelte b/src/routes/events/+page.svelte index f42971f9..dafd316b 100644 --- a/src/routes/events/+page.svelte +++ b/src/routes/events/+page.svelte @@ -1,65 +1,65 @@ {#if $lq__event_obj_li} - - {#if $lq__event_obj_li.length} -
    - {#each $lq__event_obj_li as event_obj} -
  • - - - - {#if new Date(event_obj.start_datetime ?? '').getTime() > new Date().getTime() - 1000 * 60 * 60 * 24 * 30 * 8 || $ae_loc.trusted_access} - - - {ae_util.iso_datetime_formatter(event_obj.start_datetime, 'date_long')} - - - {event_obj.name} - - + {#if new Date(event_obj.start_datetime ?? '').getTime() > new Date().getTime() - 1000 * 60 * 60 * 24 * 30 * 8 || $ae_loc.trusted_access} + + + {ae_util.iso_datetime_formatter( + event_obj.start_datetime, + 'date_long' + )} + + + {event_obj.name} + + - {:else} - - - {ae_util.iso_datetime_formatter(event_obj.start_datetime, 'date_long')} - - - {event_obj.name} - - - {/if} - + {/if} + - - {#if $ae_loc.authenticated_access} - - Pres Mgmt - - - Badges - - - Leads - - - Launcher - - {/if} - {#if $ae_loc.trusted_access} - - Legacy Pres Mgmt - - {/if} - -
  • - {/each} -
-
- - Page {current_page} of {total_pages} - -
- {:else} -
- - No events available to display. - -
- {/if} + + {#if $ae_loc.authenticated_access} + + Pres Mgmt + + + Badges + + + Leads + + + Launcher + + {/if} + {#if $ae_loc.trusted_access} + + Legacy Pres Mgmt + + {/if} + + + {/each} + +
+ + Page {current_page} of {total_pages} + +
+ {:else} +
+ + No events available to display. + +
+ {/if} {:else} -
- - Loading... -
- +
+ + Loading... +
+ {/if} diff --git a/src/routes/events/[event_id]/(badges)/badges/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/+page.svelte index b6a9232e..eb342657 100644 --- a/src/routes/events/[event_id]/(badges)/badges/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/+page.svelte @@ -1,120 +1,120 @@ - - Badges - - {ae_util.shorten_string({ string: lq__event_obj?.name ?? '-- not set --', max_length: 12 })} - - OSIT's Æ Events - + + Badges - + {ae_util.shorten_string({ string: lq__event_obj?.name ?? '-- not set --', max_length: 12 })} + - OSIT's Æ Events + {#if $events_sess?.badges?.search_status != 'loading' && $events_sess?.badges?.search_status != 'processing'} - + {:else} -

Loading badges...

+

Loading badges...

{/if} @@ -81,41 +83,41 @@ {#if $lq__event_badge_obj} -
-

- Badge: - {#if $lq__event_badge_obj.full_name} - {$lq__event_badge_obj.full_name} - {:else if $lq__event_badge_obj.given_name} - {$lq__event_badge_obj.given_name} - {:else} - -- no name -- - {/if} -

- - - Back to Search - -
+ > +

+ Badge: + {#if $lq__event_badge_obj.full_name} + {$lq__event_badge_obj.full_name} + {:else if $lq__event_badge_obj.given_name} + {$lq__event_badge_obj.given_name} + {:else} + -- no name -- + {/if} +

+ + + Back to Search + + - - - + + + {:else} -

No IDB record found for ID: {event_badge_id}

+

No IDB record found for ID: {event_badge_id}

{/if} diff --git a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte index 6dfcd79c..ed8c9385 100644 --- a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte @@ -1,410 +1,416 @@ + - -
{ outline-4 outline-green-500/50 hover:outline-green-700/75 group " - > - - Back of badge - + > + Back of badge + - {#if $lq__event_badge_template_obj.secondary_header_path} -
{ overflow-hidden hover:outline-2 hover:outline-dashed hover:outline-gray-500/75 " - > - check secondary header path -
- {:else if $lq__event_badge_template_obj.header_path} -
- check primary header path -
- {:else} -
- - -
- {/if} + > + check secondary header path + + {:else if $lq__event_badge_template_obj.header_path} +
+ check primary header path +
+ {:else} +
+ + +
+ {/if} -
{ text-xs px-1 hover:outline-2 hover:outline-dashed hover:outline-gray-500/75 " - > -
- {#if $lq__event_badge_template_obj.wireless_ssid} -
- - Signal Name - - {$lq__event_badge_template_obj.wireless_ssid} - - - - Access Code - - {$lq__event_badge_template_obj.wireless_password} - - -
-
- - WiFi -
- {/if} + > + {#if $lq__event_badge_template_obj.wireless_ssid} +
+ + Signal Name + + {$lq__event_badge_template_obj.wireless_ssid} + + + + Access Code + + {$lq__event_badge_template_obj.wireless_password} + + +
+
+ + WiFi +
+ {/if} - -
+ +
-
- Download Meeting App: - -
    -
  1. Use QR code or search your app store for "App Name"
  2. -
  3. - Once downloaded, use the search feature to find "999th Meeting" guide -
  4. -
  5. You may also go to OneSkyIT.com
  6. -
-
+
+ Download Meeting App: + +
    +
  1. + Use QR code or search your app store for "App Name" +
  2. +
  3. + Once downloaded, use the search feature to find "999th Meeting" guide +
  4. +
  5. + You may also go to OneSkyIT.com +
  6. +
+
- - - {#if $lq__event_badge_obj.other_1 || $lq__event_badge_obj.other_2 || $lq__event_badge_obj.ticket_1_code || $lq__event_badge_obj.ticket_2_code || $lq__event_badge_obj.ticket_3_code || $lq__event_badge_obj.ticket_4_code || $lq__event_badge_obj.ticket_5_code} -
- -
    - {#if $lq__event_badge_obj.ticket_1_code} -
  • {@html $lq__event_badge_template_obj.ticket_1_text}
  • - {/if} - {#if $lq__event_badge_obj.ticket_2_code} -
  • {@html $lq__event_badge_template_obj.ticket_2_text}
  • - {/if} - {#if $lq__event_badge_obj.ticket_3_code} -
  • {@html $lq__event_badge_template_obj.ticket_3_text}
  • - {/if} - {#if $lq__event_badge_obj.ticket_4_code} -
  • {@html $lq__event_badge_template_obj.ticket_4_text}
  • - {/if} - {#if $lq__event_badge_obj.ticket_5_code} -
  • {@html $lq__event_badge_template_obj.ticket_5_text}
  • - {/if} -
+ + + {#if $lq__event_badge_obj.other_1 || $lq__event_badge_obj.other_2 || $lq__event_badge_obj.ticket_1_code || $lq__event_badge_obj.ticket_2_code || $lq__event_badge_obj.ticket_3_code || $lq__event_badge_obj.ticket_4_code || $lq__event_badge_obj.ticket_5_code} +
+ +
    + {#if $lq__event_badge_obj.ticket_1_code} +
  • {@html $lq__event_badge_template_obj.ticket_1_text}
  • + {/if} + {#if $lq__event_badge_obj.ticket_2_code} +
  • {@html $lq__event_badge_template_obj.ticket_2_text}
  • + {/if} + {#if $lq__event_badge_obj.ticket_3_code} +
  • {@html $lq__event_badge_template_obj.ticket_3_text}
  • + {/if} + {#if $lq__event_badge_obj.ticket_4_code} +
  • {@html $lq__event_badge_template_obj.ticket_4_text}
  • + {/if} + {#if $lq__event_badge_obj.ticket_5_code} +
  • {@html $lq__event_badge_template_obj.ticket_5_text}
  • + {/if} +
- {#if $ae_loc.administrator_access} - {#if $lq__event_badge_obj.other_1} -
- Other 1: {$lq__event_badge_obj.other_1} - {#if option_other_1_override && ['back_bool', 'front_back_bool'].includes(option_other_1_display_opt)} - - {option_other_1_override} - {:else if option_other_1_override && ['back_html', 'front_back_html'].includes(option_other_1_display_opt)} - - {@html option_other_1_override} - {/if} -
- {/if} - {#if $lq__event_badge_obj.other_2} -
- Other 2: {$lq__event_badge_obj.other_2} - {#if option_other_2_override && ['back_bool', 'front_back_bool'].includes(option_other_2_display_opt)} - - {option_other_2_override} - {:else if option_other_2_override && ['back_html', 'front_back_html'].includes(option_other_2_display_opt)} - - {@html option_other_2_override} - {/if} -
- {/if} - {/if} -
- - {/if} + {#if $ae_loc.administrator_access} + {#if $lq__event_badge_obj.other_1} +
+ Other 1: {$lq__event_badge_obj.other_1} + {#if option_other_1_override && ['back_bool', 'front_back_bool'].includes(option_other_1_display_opt)} + - {option_other_1_override} + {:else if option_other_1_override && ['back_html', 'front_back_html'].includes(option_other_1_display_opt)} + - {@html option_other_1_override} + {/if} +
+ {/if} + {#if $lq__event_badge_obj.other_2} +
+ Other 2: {$lq__event_badge_obj.other_2} + {#if option_other_2_override && ['back_bool', 'front_back_bool'].includes(option_other_2_display_opt)} + - {option_other_2_override} + {:else if option_other_2_override && ['back_html', 'front_back_html'].includes(option_other_2_display_opt)} + - {@html option_other_2_override} + {/if} +
+ {/if} + {/if} +
+ + {/if} - {#if $lq__event_badge_template_obj.exhibitor_info} -
- Exhibitor Info: - -
- {/if} + {#if $lq__event_badge_template_obj.exhibitor_info} +
+ Exhibitor Info: + +
+ {/if} - {#if $lq__event_badge_template_obj.presenter_info} -
- Presenter Info: - -
- {/if} + {#if $lq__event_badge_template_obj.presenter_info} +
+ Presenter Info: + +
+ {/if} - {#if $lq__event_badge_template_obj.staff_info} -
- Staff Info: - -
- {/if} + {#if $lq__event_badge_template_obj.staff_info} +
+ Staff Info: + +
+ {/if} - {#if $lq__event_badge_template_obj.vip_info} -
- VIP Info: - -
- {/if} + {#if $lq__event_badge_template_obj.vip_info} +
+ VIP Info: + +
+ {/if} - {#if $lq__event_badge_template_obj.vote_info} -
-
Voting Info:
- -
- {/if} + {#if $lq__event_badge_template_obj.vote_info} +
+
Voting Info:
+ +
+ {/if} - {#if $lq__event_badge_template_obj.show_qr_back} -
-
- - {$lq__event_badge_obj.given_name}'s - - Badge ID and QR Code: -
-
- + + {$lq__event_badge_obj.given_name}'s + + Badge ID and QR Code: +
+
+ - {$lq__event_badge_obj.event_badge_id_random} - -
- {#await qr_data_url} - - Generating... - {:then result} - {#if result} -
- + badge QR code { - // (hide_qr) ? hide_qr = !hide_qr : hide_qr; - hide_qr ? (hide_qr = false) : (hide_qr = true); - }} - /> -
{ + // (hide_qr) ? hide_qr = !hide_qr : hide_qr; + hide_qr ? (hide_qr = false) : (hide_qr = true); + }} + /> +
- {#if allow_tracking} -

- This was allowed at the time your badge was printed. You may - opt-out at anytime. -

-

- By allowing this QR code to be scanned by an exhibitor or staff, you - understand and agree that they may use your personal information. -

- {:else} -

- Tracking was not allowed at the time your badge was printed. - You may opt-in at anytime. -

-

- If this QR code is scanned by an exhibitor or staff, they will not have access to your information. -

- {/if} -
-
- {/if} - {/await} -
- {/if} -
+ > + {#if allow_tracking} +

+ This was allowed at the time your badge + was printed. You may opt-out at anytime. +

+

+ By allowing this QR code to be scanned by an + exhibitor or staff, you understand and agree that + they may use your personal information. +

+ {:else} +

+ Tracking was not allowed at the time + your badge was printed. You may opt-in at anytime. +

+

+ If this QR code is scanned by an exhibitor or staff, + they will not have access to your information. +

+ {/if} + + + {/if} + {/await} + + {/if} + - + - - -
- + + + + - - + + - - + - - + + {/if} +
diff --git a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/print/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/print/+page.svelte
index 9bde7e38..1eb77c40 100644
--- a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/print/+page.svelte
+++ b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/print/+page.svelte
@@ -1,5 +1,5 @@
 
 
 

Print Badges

diff --git a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/review/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/review/+page.svelte index 163d7bf3..a06feff6 100644 --- a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/review/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/review/+page.svelte @@ -1,5 +1,5 @@

Review Badges

diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte index 55957560..5e9ad0f4 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte @@ -1,126 +1,128 @@
- - {#if $lq__event_badge_obj_li?.length} -
-

Results:

-
- - {$lq__event_badge_obj_li.length}× -
-
+ + {#if $lq__event_badge_obj_li?.length} +
+

Results:

+
+ + {$lq__event_badge_obj_li.length}× +
+
- + - + {#if show_sensitive_fields} + - + + + + + {event_badge_obj.email + ? event_badge_obj.email.replace(/^(.{3}).*@/, '$1...@') + : ''} + + {/if} + {#if !hide_affiliations} + - + {event_badge_obj?.affiliations ?? '-- no affiliations --'} + {/if} + {#if !hide_location} + - + {event_badge_obj?.location ?? '-- no location --'} + {/if} + {#if !hide_badge_type} + - + {event_badge_obj?.badge_type} + {/if} + + {/each} + - - {:else} -
-

No results available to show.

-
- {/if} + {:else} +
+

No results available to show.

+
+ {/if}
diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte index 15ff26a4..ec452e74 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte @@ -1,593 +1,611 @@
- + - {#if $events_sess.badges.show_form__search} -
{ - // ae_triggers.event_badge_qry = 'load__event_badge_obj_li'; - ae_triggers.event_badge_qry = true; - })} - autocomplete="off" - class=" + {#if $events_sess.badges.show_form__search} + { + // ae_triggers.event_badge_qry = 'load__event_badge_obj_li'; + ae_triggers.event_badge_qry = true; + })} + autocomplete="off" + class=" form grow flex flex-row flex-wrap gap-1 items-center justify-center w-full " - > - - {#if $ae_loc.trusted_access && badge_type_code_li} - - {/if} + > + + {#if $ae_loc.trusted_access && badge_type_code_li} + + {/if} - - { - if ($events_loc.badges.fulltext_search_qry_str.length >= 7) { - ae_triggers.event_badge_qry = true; - } - }} - title="Enter at least 3 characters to search. Search by name, email, affiliations, etc." - /> - + { + if ($events_loc.badges.fulltext_search_qry_str.length >= 7) { + ae_triggers.event_badge_qry = true; + } + }} + title="Enter at least 3 characters to search. Search by name, email, affiliations, etc." + /> + - - + + - - - - + {#await ae_promises.load__event_badge_obj_li} + Loading... + {:then load_result} + {#if load_result === null} + + No entries found - null + + {:else if load_result?.length === 0} + + No entries found + + {:else if event_badge_id_li?.length === 0} + + Enter to search + + {:else} + + {load_result?.length ?? 0} found + + {/if} + {:catch error} + + Error loading entries. + + {/await} + +
+ - - {:else if $events_sess.badges.show_form__scan} - Not implemented yet. - {/if} + + {:else if $events_sess.badges.show_form__scan} + Not implemented yet. + {/if} -
- {#if $events_sess.badges.show_form__search} - - {:else if $events_sess.badges.show_form__scan} - - {/if} +
+ {#if $events_sess.badges.show_form__search} + + {:else if $events_sess.badges.show_form__scan} + + {/if} - - -
+ + +
diff --git a/src/routes/events/[event_id]/(badges)/badges/stats/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/stats/+page.svelte index 73ded6af..4c64a822 100644 --- a/src/routes/events/[event_id]/(badges)/badges/stats/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/stats/+page.svelte @@ -1,5 +1,5 @@

Badge Stats

diff --git a/src/routes/events/[event_id]/(launcher)/launcher/+layout.svelte b/src/routes/events/[event_id]/(launcher)/launcher/+layout.svelte index d4db6d4c..94d6c1eb 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher/+layout.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher/+layout.svelte @@ -1,840 +1,855 @@ - - - Æ: - {$lq__event_location_obj?.name ?? '-- not set --'} - ({$lq__event_session_obj?.name ?? 'Æ loading...'}) - Launcher v3 - - {$events_loc?.title} - + + + Æ: + {$lq__event_location_obj?.name ?? '-- not set --'} + ({$lq__event_session_obj?.name ?? 'Æ loading...'}) - Launcher v3 - + {$events_loc?.title} +
-
-

- -

+ > +

+ +

- {#if $lq__event_obj} - -

- - {$lq__event_location_obj?.name} -

- {:else} -
- - Loading event... -
- {/if} -
+ {#if $lq__event_obj} + +

+ + {$lq__event_location_obj?.name} +

+ {:else} +
+ + Loading event... +
+ {/if} + - - + + {#if $events_slct.event_session_id && $lq__event_session_obj && !$events_sess.launcher.loading__session_id_status} + + {/if} + +
- {@render children?.()} + {@render children?.()}
- -
- - {$lq__event_location_obj?.name} - {#if $lq__event_device_obj?.name} - - {$lq__event_device_obj?.name} - {/if} -
+
+ + {$lq__event_location_obj?.name} + {#if $lq__event_device_obj?.name} + + {$lq__event_device_obj?.name} + {/if} +
- - {#if $idle} - - - {:else} - - - {/if} - + + {#if $idle} + + + {:else} + + + {/if} + - - + - - - - - - {online?.current ? '' : 'Offline!'} - - + + + + + + {online?.current ? '' : 'Offline!'} + + - - + - - + - - {#if $events_sess.launcher.ws_connect_status == 'connected'} - - - {:else} - - - {/if} - + + {#if $events_sess.launcher.ws_connect_status == 'connected'} + + + {:else} + + + {/if} + - - {#if $events_sess.launcher?.av_recording_status} - - - {:else} - - - {/if} - + + {#if $events_sess.launcher?.av_recording_status} + + + {:else} + + + {/if} + -
- - - {#if $events_loc.launcher?.time_hours == 12} - {ae_util.iso_datetime_formatter($time, 'time_12_long')} - {:else} - {ae_util.iso_datetime_formatter($time, 'time_long')} - {/if} - - -
+
+ + + {#if $events_loc.launcher?.time_hours == 12} + {ae_util.iso_datetime_formatter($time, 'time_12_long')} + {:else} + {ae_util.iso_datetime_formatter($time, 'time_long')} + {/if} + + +
- +
- + -
+
-
- - - Session Search - - {#if $events_slct?.event_location_id} - - - View Selected Location - - {/if} - {#if $events_slct?.event_session_id} - - - View Selected Session - - {/if} - - -
+
-
-

Debug

- -
+
+

+ Debug +

+ +
-
- -
+    
+ +
         {JSON.stringify($events_loc.launcher, null, 2)}
     
-
-
+        
+
         {JSON.stringify($ae_api, null, 2)}
     
-
+
{ - $events_sess.launcher.modal__open_event_file_id = null; - if ( - $events_loc.launcher.controller == 'local_push' && - $events_sess.launcher.ws_connect_status == 'connected' - ) { - // // This should work....???? - // console.log(`TEST - FAIL??? Local Push Controller Command: ae_close:event_file_modal`); - // console.log(`Before: ${$events_sess.launcher.controller_trigger_send}`); - // // $events_sess.launcher.controller_cmd = `ae_close:event_file_modal`; - // // $events_sess.launcher.controller_trigger_send = true; - // // $events_sess = $events_sess; - // // events_sess.set($events_sess); - // // tick(); - // // events_sess.set($events_sess); - // console.log(`After: ${$events_sess.launcher.controller_trigger_send}`); - } - }} + bodyClass="p-0 space-y-0 overflow-y-auto flex flex-col gap-1 items-center justify-center" + headerClass={`fixed top-0 right-0 left-0 p-1 md:p-2 flex flex-row items-center ${$events_loc.launcher.controller == 'remote' ? 'hidden' : ''} bg-white dark:bg-gray-800 opacity-50 ${$events_loc.launcher.hide__modal_header_title ? 'justify-center' : 'justify-between'}`} + footerClass="text-center hidden" + onclose={async () => { + $events_sess.launcher.modal__open_event_file_id = null; + if ( + $events_loc.launcher.controller == 'local_push' && + $events_sess.launcher.ws_connect_status == 'connected' + ) { + // // This should work....???? + // console.log(`TEST - FAIL??? Local Push Controller Command: ae_close:event_file_modal`); + // console.log(`Before: ${$events_sess.launcher.controller_trigger_send}`); + // // $events_sess.launcher.controller_cmd = `ae_close:event_file_modal`; + // // $events_sess.launcher.controller_trigger_send = true; + // // $events_sess = $events_sess; + // // events_sess.set($events_sess); + // // tick(); + // // events_sess.set($events_sess); + // console.log(`After: ${$events_sess.launcher.controller_trigger_send}`); + } + }} > - {#snippet header()} - -

- {$events_sess.launcher?.modal__title ?? 'Digital Poster Display'} -

- - - {/snippet} + {#snippet header()} + +

+ {$events_sess.launcher?.modal__title ?? 'Digital Poster Display'} +

+ + + {/snippet} - - - - - - {#if $events_sess.launcher.modal__open_event_file_id} - Placeholder: /event/file/{$events_sess.launcher
-				.modal__open_event_file_id}/download?filename={$events_slct.event_file_obj
-				.filename}&x_no_account_id_token=direct-download - {:else} -
- - No image selected -
- {/if} + class:hidden={$events_loc.launcher.controller != 'local_push' || + $events_sess.launcher.ws_connect_status != 'connected'} + title="Close the remote device's display of the poster" + > + + + Close Remote Poster Display Only + + + + + {#if $events_sess.launcher.modal__open_event_file_id} + Placeholder: /event/file/{$events_sess.launcher
+                .modal__open_event_file_id}/download?filename={$events_slct.event_file_obj
+                .filename}&x_no_account_id_token=direct-download + {:else} +
+ + No image selected +
+ {/if} - + - + class:hidden={$events_loc.launcher.controller != 'local_push' || + $events_sess.launcher.ws_connect_status != 'connected'} + title="Close the remote device's display of the poster" + > + + + Close Remote Poster Display Only + - + - + class:hidden={!$ae_loc.trusted_access && + ($events_loc.launcher.controller != 'local_push' || + $events_sess.launcher.ws_connect_status != 'connected')} + title="Close this controller's local modal display of this poster" + > + + + Close + + + Poster + + on This Device + + - {#if $events_loc.launcher.controller_group_code && $events_loc.launcher.ws_connect} - - - + + + {/if} diff --git a/src/routes/events/[event_id]/(launcher)/launcher/+layout.ts b/src/routes/events/[event_id]/(launcher)/launcher/+layout.ts index 131fbc63..f3a3fd40 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher/+layout.ts +++ b/src/routes/events/[event_id]/(launcher)/launcher/+layout.ts @@ -6,114 +6,114 @@ import { browser } from '$app/environment'; import { events_func } from '$lib/ae_events_functions'; export async function load({ params, parent, url }) { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - // console.log(`ae events_pres_mgmt event [event_id] +page.ts data:`, data); - data.log_lvl = log_lvl; + const data = await parent(); + // console.log(`ae events_pres_mgmt event [event_id] +page.ts data:`, data); + data.log_lvl = log_lvl; - const account_id = data.account_id; - const ae_acct = data[account_id]; - // console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + // console.log(`ae_acct = `, ae_acct); - const event_id = params.event_id; - // if (!event_id) { - // console.log(`ae Events - [event_id] +page.ts: The event_id was not found in the params.event_id!!!`); - // error(404, { - // message: 'Event ID not found' - // }); - // } + const event_id = params.event_id; + // if (!event_id) { + // console.log(`ae Events - [event_id] +page.ts: The event_id was not found in the params.event_id!!!`); + // error(404, { + // message: 'Event ID not found' + // }); + // } - // ae_acct.slct.event_id = event_id; + // ae_acct.slct.event_id = event_id; - // let load_event_obj = events_func.handle_load_ae_obj_id__event({ - // api_cfg: ae_acct.api, event_id: event_id, try_cache: true - // }); + // let load_event_obj = events_func.handle_load_ae_obj_id__event({ + // api_cfg: ae_acct.api, event_id: event_id, try_cache: true + // }); - // ae_acct.slct.event_obj = await load_event_obj; + // ae_acct.slct.event_obj = await load_event_obj; - if (browser) { - console.log(`ae_events Launcher - [event_id] launcher +layout.ts start`); + if (browser) { + console.log(`ae_events Launcher - [event_id] launcher +layout.ts start`); - // Load event object again, but with the event file list - // let load_event_obj = events_func.load_ae_obj_id__event({ - // api_cfg: ae_acct.api, - // event_id: event_id, - // inc_file_li: true, - // log_lvl: log_lvl - // }) - // .then((results) => { - // if (!results) { - // error(404, { - // message: 'Events Launcher - Event not found' - // }); - // } else { - // // ae_acct.slct.event_obj = results; - // } - // }); + // Load event object again, but with the event file list + // let load_event_obj = events_func.load_ae_obj_id__event({ + // api_cfg: ae_acct.api, + // event_id: event_id, + // inc_file_li: true, + // log_lvl: log_lvl + // }) + // .then((results) => { + // if (!results) { + // error(404, { + // message: 'Events Launcher - Event not found' + // }); + // } else { + // // ae_acct.slct.event_obj = results; + // } + // }); - const load_event_device_obj_li = events_func.load_ae_obj_li__event_device({ - api_cfg: ae_acct.api, - for_obj_type: 'event', - for_obj_id: event_id, - log_lvl: log_lvl - }); + const load_event_device_obj_li = events_func.load_ae_obj_li__event_device({ + api_cfg: ae_acct.api, + for_obj_type: 'event', + for_obj_id: event_id, + log_lvl: log_lvl + }); - const load_event_file_obj_li = events_func.load_ae_obj_li__event_file({ - api_cfg: ae_acct.api, - for_obj_type: 'event', - for_obj_id: event_id, - log_lvl: log_lvl - }); + const load_event_file_obj_li = events_func.load_ae_obj_li__event_file({ + api_cfg: ae_acct.api, + for_obj_type: 'event', + for_obj_id: event_id, + log_lvl: log_lvl + }); - // let load_event_obj = events_func.load_ae_obj_id__event({ - // api_cfg: ae_acct.api, event_id: event_id, try_cache: true, log_lvl: 1 - // }); - // console.log(`load_event_obj = `, load_event_obj); - // ae_acct.slct.event_obj = load_event_obj; + // let load_event_obj = events_func.load_ae_obj_id__event({ + // api_cfg: ae_acct.api, event_id: event_id, try_cache: true, log_lvl: 1 + // }); + // console.log(`load_event_obj = `, load_event_obj); + // ae_acct.slct.event_obj = load_event_obj; - // let load_event_session_obj_li = events_func.load_ae_obj_li__event_session({ - // api_cfg: ae_acct.api, - // for_obj_type: 'event', - // for_obj_id: event_id, - // params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200}, - // try_cache: true, - // log_lvl: 1 - // }); - // console.log(`load_event_session_obj_li = `, load_event_session_obj_li); - // ae_acct.slct.event_session_obj_li = load_event_session_obj_li; + // let load_event_session_obj_li = events_func.load_ae_obj_li__event_session({ + // api_cfg: ae_acct.api, + // for_obj_type: 'event', + // for_obj_id: event_id, + // params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200}, + // try_cache: true, + // log_lvl: 1 + // }); + // console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + // ae_acct.slct.event_session_obj_li = load_event_session_obj_li; - // let load_event_location_obj_li = events_func.load_ae_obj_li__event_location({ - // api_cfg: ae_acct.api, - // for_obj_type: 'event', - // for_obj_id: event_id, - // params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200}, - // try_cache: true, - // log_lvl: log_lvl - // }); - // console.log(`load_event_location_obj_li = `, load_event_location_obj_li); - // ae_acct.slct.event_location_obj_li = load_event_location_obj_li; + // let load_event_location_obj_li = events_func.load_ae_obj_li__event_location({ + // api_cfg: ae_acct.api, + // for_obj_type: 'event', + // for_obj_id: event_id, + // params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200}, + // try_cache: true, + // log_lvl: log_lvl + // }); + // console.log(`load_event_location_obj_li = `, load_event_location_obj_li); + // ae_acct.slct.event_location_obj_li = load_event_location_obj_li; - // let event_session_id = url.searchParams.get('session_id'); - // if (event_session_id) { - // let load_event_session_obj = events_func.load_ae_obj_id__event_session({ - // api_cfg: ae_acct.api, - // event_session_id: event_session_id, - // inc_file_li: true, - // inc_presentation_li: true, - // inc_presenter_li: true, - // try_cache: true, - // log_lvl: log_lvl - // }); - // ae_acct.slct.event_session_id = event_session_id; - // console.log(`load_event_session_obj = `, load_event_session_obj); - // ae_acct.slct.event_session_obj = load_event_session_obj; - // } - } + // let event_session_id = url.searchParams.get('session_id'); + // if (event_session_id) { + // let load_event_session_obj = events_func.load_ae_obj_id__event_session({ + // api_cfg: ae_acct.api, + // event_session_id: event_session_id, + // inc_file_li: true, + // inc_presentation_li: true, + // inc_presenter_li: true, + // try_cache: true, + // log_lvl: log_lvl + // }); + // ae_acct.slct.event_session_id = event_session_id; + // console.log(`load_event_session_obj = `, load_event_session_obj); + // ae_acct.slct.event_session_obj = load_event_session_obj; + // } + } - // WARNING: Precaution against shared data between sites and sessions. - // data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and sessions. + // data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.svelte b/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.svelte index 8997ed48..2563aafa 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.svelte @@ -1,249 +1,249 @@ diff --git a/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.ts b/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.ts index 1d64a37f..c751039f 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.ts +++ b/src/routes/events/[event_id]/(launcher)/launcher/[event_location_id]/+page.ts @@ -6,90 +6,90 @@ import { browser } from '$app/environment'; import { events_func } from '$lib/ae_events_functions'; export async function load({ params, parent, url }) { - // route - const log_lvl: number = 1; + // route + const log_lvl: number = 1; - const data = await parent(); - // console.log(`ae events_pres_mgmt event [event_location_id] +page.ts data:`, data); - data.log_lvl = log_lvl; + const data = await parent(); + // console.log(`ae events_pres_mgmt event [event_location_id] +page.ts data:`, data); + data.log_lvl = log_lvl; - const account_id = data.account_id; - const ae_acct = data[account_id]; + const account_id = data.account_id; + const ae_acct = data[account_id]; - const event_location_id = params.event_location_id; - if (!event_location_id) { - console.log( - `ae Events - [event_id] launcher [event_location_id] +page.ts: The event_location_id was not found in the params.event_location_id!!!` - ); - error(404, { - message: 'Events Pres Mgmt - Event Location ID not found' - }); - } + const event_location_id = params.event_location_id; + if (!event_location_id) { + console.log( + `ae Events - [event_id] launcher [event_location_id] +page.ts: The event_location_id was not found in the params.event_location_id!!!` + ); + error(404, { + message: 'Events Pres Mgmt - Event Location ID not found' + }); + } - if (browser) { - if (log_lvl) { - console.log( - `ae_events launcher [event_location_id] +page.ts: event_location_id = `, - event_location_id - ); - } - // Load event_session object - // let load_event_session_obj_li = await events_func.load_ae_obj_li__event_session({ - const load_event_session_obj_li = events_func - .load_ae_obj_li__event_session({ - api_cfg: ae_acct.api, - for_obj_type: 'event_location', - for_obj_id: event_location_id, - inc_file_li: true, // Only include files directly under the session? - inc_all_file_li: false, // Also include files under presentations and presenters as well? - inc_presentation_li: true, - inc_presenter_li: true, - enabled: 'enabled', - hidden: 'all', - limit: 150, - log_lvl: log_lvl - }) - .finally(() => { - // console.log(`load_event_session_obj_li = `, load_event_session_obj_li); - // ae_acct.trig.event_session_obj_li = false; - }); - ae_acct.slct.event_session_obj_li = load_event_session_obj_li; - // console.log(`ae_acct.slct.event_session_obj_li = `, ae_acct.slct.event_session_obj_li); + if (browser) { + if (log_lvl) { + console.log( + `ae_events launcher [event_location_id] +page.ts: event_location_id = `, + event_location_id + ); + } + // Load event_session object + // let load_event_session_obj_li = await events_func.load_ae_obj_li__event_session({ + const load_event_session_obj_li = events_func + .load_ae_obj_li__event_session({ + api_cfg: ae_acct.api, + for_obj_type: 'event_location', + for_obj_id: event_location_id, + inc_file_li: true, // Only include files directly under the session? + inc_all_file_li: false, // Also include files under presentations and presenters as well? + inc_presentation_li: true, + inc_presenter_li: true, + enabled: 'enabled', + hidden: 'all', + limit: 150, + log_lvl: log_lvl + }) + .finally(() => { + // console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + // ae_acct.trig.event_session_obj_li = false; + }); + ae_acct.slct.event_session_obj_li = load_event_session_obj_li; + // console.log(`ae_acct.slct.event_session_obj_li = `, ae_acct.slct.event_session_obj_li); - // let id_li__event_session = []; + // let id_li__event_session = []; - // let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery. + // let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery. - // for (let i = 0; i < load_event_session_obj_li.length; i++) { - // let event_session_obj = load_event_session_obj_li[i]; - // let event_session_id_random = event_session_obj.event_session_id_random; - // tmp_li.push(event_session_id_random); - // } - // id_li__event_session = tmp_li; - // console.log(`id_li__event_session:`, id_li__event_session); - // ae_acct.slct.id_li__event_session = id_li__event_session; + // for (let i = 0; i < load_event_session_obj_li.length; i++) { + // let event_session_obj = load_event_session_obj_li[i]; + // let event_session_id_random = event_session_obj.event_session_id_random; + // tmp_li.push(event_session_id_random); + // } + // id_li__event_session = tmp_li; + // console.log(`id_li__event_session:`, id_li__event_session); + // ae_acct.slct.id_li__event_session = id_li__event_session; - // This should only be needed if the session ID passed is not part of the location sessions. - // let event_session_id = url.searchParams.get('session_id'); - // if (event_session_id) { - // let load_event_session_obj = await events_func.load_ae_obj_id__event_session({ - // api_cfg: ae_acct.api, - // event_session_id: event_session_id, - // inc_file_li: true, - // inc_presentation_li: true, - // inc_presenter_li: true, - // log_lvl: log_lvl - // }); - // ae_acct.slct.event_session_id = event_session_id; - // console.log(`load_event_session_obj = `, load_event_session_obj); - // ae_acct.slct.event_session_obj = load_event_session_obj; - // } - } else { - console.log(`ae pres_mgmt launcher [slug] +page.ts: browser = false`); - } + // This should only be needed if the session ID passed is not part of the location sessions. + // let event_session_id = url.searchParams.get('session_id'); + // if (event_session_id) { + // let load_event_session_obj = await events_func.load_ae_obj_id__event_session({ + // api_cfg: ae_acct.api, + // event_session_id: event_session_id, + // inc_file_li: true, + // inc_presentation_li: true, + // inc_presenter_li: true, + // log_lvl: log_lvl + // }); + // ae_acct.slct.event_session_id = event_session_id; + // console.log(`load_event_session_obj = `, load_event_session_obj); + // ae_acct.slct.event_session_obj = load_event_session_obj; + // } + } else { + console.log(`ae pres_mgmt launcher [slug] +page.ts: browser = false`); + } - // WARNING: Precaution against shared data between sites and sessions. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and sessions. + data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte b/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte index 13106435..c83ae9fb 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte @@ -1,238 +1,238 @@
-
-

- Launcher Configuration -

+
+

+ Launcher Configuration +

- -
+ +
- + -
-

- -

+
+

+ +

-
-
- -
-
- { - $events_sess.launcher.controller_unlock_group_code = - !$events_sess.launcher.controller_unlock_group_code; +
+
+ +
+
+ { + $events_sess.launcher.controller_unlock_group_code = + !$events_sess.launcher.controller_unlock_group_code; - if ($events_loc.launcher.ws_connect) { - $events_sess.launcher.trigger__ws_disconnect = true; - } else { - // $events_sess.launcher.trigger__ws_connect = true; - } - // $events_loc.launcher.ws_connect = false; - }} - readonly={!$events_sess.launcher.controller_unlock_group_code} - /> + if ($events_loc.launcher.ws_connect) { + $events_sess.launcher.trigger__ws_disconnect = true; + } else { + // $events_sess.launcher.trigger__ws_connect = true; + } + // $events_loc.launcher.ws_connect = false; + }} + readonly={!$events_sess.launcher.controller_unlock_group_code} + /> - + $events_sess.launcher.controller_unlock_group_code = false; + (($events_sess.launcher.controller_cmd = null), + ($events_sess.launcher.controller_trigger_send = null)); + }} + class="btn btn-sm hover:preset-filled-primary-500" + class:preset-tonal-warning={!$events_loc.launcher.ws_connect} + class:preset-tonal-success={$events_loc.launcher.ws_connect} + > + {#if $events_loc.launcher.ws_connect} + + Disconnect? + {:else} + + Connect? + {/if} + - {#if $events_loc.launcher.ws_connect} - - {/if} -
-
-
+ {#if $events_loc.launcher.ws_connect} + + {/if} +
+ + - + -
-

- -

+
+

+ +

-
- - +
+ + - - + + - - + + - -
-
+ + +
- + - - - + + -
-

- -

+
+

+ +

-
-
- {#if !$events_loc.launcher.app_mode || $events_loc.launcher.app_mode != 'default'} - - {/if} - {#if $events_loc.launcher.app_mode != 'native'} - - {/if} - {#if $events_loc.launcher.app_mode != 'onsite'} - - {/if} -
+
+
+ {#if !$events_loc.launcher.app_mode || $events_loc.launcher.app_mode != 'default'} + + {/if} + {#if $events_loc.launcher.app_mode != 'native'} + + {/if} + {#if $events_loc.launcher.app_mode != 'onsite'} + + {/if} +
-
- {#if $events_loc.launcher.hide__launcher_menu} - - {/if} - {#if !$events_loc.launcher.hide__launcher_header} - - {/if} - {#if $events_loc.launcher.hide__launcher_header} - - {/if} +
+ {#if $events_loc.launcher.hide__launcher_menu} + + {/if} + {#if !$events_loc.launcher.hide__launcher_header} + + {/if} + {#if $events_loc.launcher.hide__launcher_header} + + {/if} - {#if !$events_loc.launcher.hide__launcher_footer} - - {/if} - {#if $events_loc.launcher.hide__launcher_footer} - - {/if} + {#if !$events_loc.launcher.hide__launcher_footer} + + {/if} + {#if $events_loc.launcher.hide__launcher_footer} + + {/if} - - {#if !$events_loc.launcher.hide__launcher_menu} - - {/if} - - {#if !$events_loc.launcher.hide__session_datetimes} - - {/if} - {#if $events_loc.launcher.hide__session_datetimes} - - {/if} + + {#if !$events_loc.launcher.hide__launcher_menu} + + {/if} + + {#if !$events_loc.launcher.hide__session_datetimes} + + {/if} + {#if $events_loc.launcher.hide__session_datetimes} + + {/if} - + - - {#if !$events_loc.launcher.hide__ws_element} - - {/if} - {#if $events_loc.launcher.hide__ws_element} - - {/if} + + {#if !$events_loc.launcher.hide__ws_element} + + {/if} + {#if $events_loc.launcher.hide__ws_element} + + {/if} - - {#if !$events_loc.launcher.hide__modal_header_title} - - {/if} - {#if $events_loc.launcher.hide__modal_header_title} - - {/if} -
-
-
+ + {#if !$events_loc.launcher.hide__modal_header_title} + + {/if} + {#if $events_loc.launcher.hide__modal_header_title} + + {/if} + + +
-
-

- -

+
+

+ +

- -
-
- { + const val = (event.target as HTMLSelectElement).value; + if (val && val != '') { + if (val == 'delete_idbs') { + // Delete all IDB tables + if ( + confirm( + 'Are you sure you want to delete ALL IndexedDB databases? This will log you out of the app and you will need to reload the app.' + ) + ) { + // continue + } else { + (event.target as HTMLSelectElement).value = ''; + return false; + } - indexedDB.deleteDatabase('ae_archives_db'); // Archives module - indexedDB.deleteDatabase('ae_core_db'); - indexedDB.deleteDatabase('ae_events_db'); // Events module - indexedDB.deleteDatabase('ae_journals_db'); // Journals module - indexedDB.deleteDatabase('ae_posts_db'); // Posts module - indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module + indexedDB.deleteDatabase('ae_archives_db'); // Archives module + indexedDB.deleteDatabase('ae_core_db'); + indexedDB.deleteDatabase('ae_events_db'); // Events module + indexedDB.deleteDatabase('ae_journals_db'); // Journals module + indexedDB.deleteDatabase('ae_posts_db'); // Posts module + indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module - alert('All IndexedDB databases deleted. Please reload the app.'); - } else if (val == 'delete_idbs_events') { - // Delete Event IDB tables - if ( - confirm( - 'Are you sure you want to delete ONLY the Events IndexedDB database? This will log you out of the app and you will need to reload the app.' - ) - ) { - // continue - } else { - (event.target as HTMLSelectElement).value = ''; - return false; - } + alert('All IndexedDB databases deleted. Please reload the app.'); + } else if (val == 'delete_idbs_events') { + // Delete Event IDB tables + if ( + confirm( + 'Are you sure you want to delete ONLY the Events IndexedDB database? This will log you out of the app and you will need to reload the app.' + ) + ) { + // continue + } else { + (event.target as HTMLSelectElement).value = ''; + return false; + } - indexedDB.deleteDatabase('ae_events_db'); // Events module - alert('Events IndexedDB database deleted. Please reload the app.'); - } else if (val == 'delete_local') { - // Delete all local config - if ( - confirm( - 'Are you sure you want to delete ALL local config in localStorage? This will log you out of the app and you will need to reload the app.' - ) - ) { - // continue - } else { - (event.target as HTMLSelectElement).value = ''; - return false; - } + indexedDB.deleteDatabase('ae_events_db'); // Events module + alert('Events IndexedDB database deleted. Please reload the app.'); + } else if (val == 'delete_local') { + // Delete all local config + if ( + confirm( + 'Are you sure you want to delete ALL local config in localStorage? This will log you out of the app and you will need to reload the app.' + ) + ) { + // continue + } else { + (event.target as HTMLSelectElement).value = ''; + return false; + } - localStorage.removeItem('ae_loc'); - localStorage.removeItem('ae_events_loc'); - localStorage.removeItem('ae_idaa_loc'); - localStorage.removeItem('ae_journals_loc'); - location.reload(); - } else if (val == 'delete_local_events') { - // Delete local config for Events - if ( - confirm( - 'Are you sure you want to delete ONLY the Events local config in localStorage? This will log you out of the app and you will need to reload the app.' - ) - ) { - // continue - } else { - (event.target as HTMLSelectElement).value = ''; - return false; - } + localStorage.removeItem('ae_loc'); + localStorage.removeItem('ae_events_loc'); + localStorage.removeItem('ae_idaa_loc'); + localStorage.removeItem('ae_journals_loc'); + location.reload(); + } else if (val == 'delete_local_events') { + // Delete local config for Events + if ( + confirm( + 'Are you sure you want to delete ONLY the Events local config in localStorage? This will log you out of the app and you will need to reload the app.' + ) + ) { + // continue + } else { + (event.target as HTMLSelectElement).value = ''; + return false; + } - localStorage.removeItem('ae_events_loc'); - // localStorage.removeItem('ae_event_cfg_' + $lq__event_obj?.event_id); - // localStorage.removeItem('ae_event_launcher_' + $lq__event_obj?.event_id); - location.reload(); - } + localStorage.removeItem('ae_events_loc'); + // localStorage.removeItem('ae_event_cfg_' + $lq__event_obj?.event_id); + // localStorage.removeItem('ae_event_launcher_' + $lq__event_obj?.event_id); + location.reload(); + } - (event.target as HTMLSelectElement).value = ''; - } - }} - > - - - - - - - - The action happens when the option is selected - -
+ (event.target as HTMLSelectElement).value = ''; + } + }} + > + + + + + + + + The action happens when the option is selected + +
-
- - +
+ + - - -
+ + +
-
API: {$ae_api.base_url}
- -
+
API: {$ae_api.base_url}
+ +
- + -
- +
+ - -
+ +
diff --git a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte index d98989c7..973f914c 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte @@ -1,338 +1,342 @@
- {#if open_file_clicked} -
- {#if $events_loc.launcher.app_mode == 'native'} - {#if open_file_status} -
*** {open_file_status_message} ***
- {/if} + {#if open_file_clicked} +
+ {#if $events_loc.launcher.app_mode == 'native'} + {#if open_file_status} +
+ *** {open_file_status_message} *** +
+ {/if} - -

Most files will automatically be opened full screen.

-

PowerPoint or KeyNote will attempt to display in presenter view.

-

PDFs, videos, and images will attempt to be displayed mirrored.

-

Please close the file when finished.

- {:else if $events_loc.launcher.app_mode == 'onsite'} - *** Please wait while this file loads... *** -

Most files will automatically be opened full screen.

-

PowerPoint or KeyNote will attempt to display in presenter view.

-

PDFs, videos, and images will attempt to be displayed mirrored.

-

Please close the file when finished.

- {:else} - *** Please wait while this file downloads... *** -

Onsite in the Speaker Ready Room and conference session rooms:

-
    -
  • Most files will automatically be opened full screen.
  • -
  • PowerPoint or KeyNote will attempt to display in presenter view.
  • -
  • PDFs, videos, and images will attempt to be displayed mirrored.
  • -
  • Please close the file when finished.
  • -
- {/if} -
- {/if} + +

Most files will automatically be opened full screen.

+

PowerPoint or KeyNote will attempt to display in presenter view.

+

PDFs, videos, and images will attempt to be displayed mirrored.

+

Please close the file when finished.

+ {:else if $events_loc.launcher.app_mode == 'onsite'} + *** Please wait while this file loads... *** +

Most files will automatically be opened full screen.

+

PowerPoint or KeyNote will attempt to display in presenter view.

+

PDFs, videos, and images will attempt to be displayed mirrored.

+

Please close the file when finished.

+ {:else} + *** Please wait while this file downloads... *** +

Onsite in the Speaker Ready Room and conference session rooms:

+
    +
  • Most files will automatically be opened full screen.
  • +
  • PowerPoint or KeyNote will attempt to display in presenter view.
  • +
  • PDFs, videos, and images will attempt to be displayed mirrored.
  • +
  • Please close the file when finished.
  • +
+ {/if} +
+ {/if} - - - {#if session_type == 'poster' || open_method == 'modal'} - + {#if session_type == 'poster' || open_method == 'modal'} + - + title={`Open this file in a modal window:\n${event_file_obj.filename}\n[API] SHA256: ${event_file_obj.hash_sha256.slice(0, 10)}...\nHosted ID: ${event_file_obj.hosted_file_id_random} Event File ID: ${event_file_id}`} + > + {#if screen_saver_exts.includes(event_file_obj.extension)} + + Open Poster + + {:else} + + {ae_util.shorten_filename({ + filename: event_file_obj.filename, + max_length: max_filename_length + })} + {/if} + + - - - {:else if $events_loc.launcher.app_mode == 'native'} - { - handle_open_file(); - })} - data-hash_sha256={event_file_obj.hash_sha256} - data-filename={event_file_obj.filename} - title={`${event_file_obj.filename} [A] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`} - > - - {ae_util.shorten_filename({ - filename: event_file_obj.filename, - max_length: max_filename_length - })} - + + + {:else if $events_loc.launcher.app_mode == 'native'} + { + handle_open_file(); + })} + data-hash_sha256={event_file_obj.hash_sha256} + data-filename={event_file_obj.filename} + title={`${event_file_obj.filename} [A] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`} + > + + {ae_util.shorten_filename({ + filename: event_file_obj.filename, + max_length: max_filename_length + })} + - - + - - {:else} - - {/if} - + class:hidden={!event_file_obj.file_purpose} + > + {event_file_obj.file_purpose} + + + {/if} + - - + // window.postMessage({ type: 'download_event_file', event_file_id: event_file_id, filename: event_file_obj.filename, auto_download: true }, '*'); + }} + class="event_file_os" + class:hidden={hide_os || 1 == 1} + > + {#if event_file_obj.open_in_os == 'win'} + Win + {:else if event_file_obj.open_in_os == 'mac'} + Mac + {:else} + + {/if} + - { - console.log(`ae_crud_updated:`, e.detail); + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_file({ - api_cfg: $ae_api, - event_file_id: event_file_obj?.event_file_id_random, - log_lvl: log_lvl - }); - }} - > - - - + // $events_slct.exhibit_tracking_obj.open_in_os = !event_file_obj?.open_in_os; + ae_triggers.open_in_os = true; + }} + class="btn btn-sm transition-all group" + class:preset-tonal-success={event_file_obj?.open_in_os == 'win'} + class:preset-tonal-warning={event_file_obj?.open_in_os == 'mac'} + disabled={!$ae_loc.trusted_access} + title="Open with: {event_file_obj?.open_in_os ?? 'Default'}" + > + {#if event_file_obj?.open_in_os == 'win'} + + + {:else if event_file_obj?.open_in_os == 'mac'} + + + + {:else} + + + {/if} + + + - - - - - {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'date_short')} - - - - {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'time_12_short')} - - - + class:hidden={hide_created_on} + > + + + + {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'date_short')} + + + + {ae_util.iso_datetime_formatter(event_file_obj.created_on, 'time_12_short')} + + + - - - {#if event_file_obj.file_size}{ae_util.format_bytes(event_file_obj.file_size)}{/if} - + class:hidden={hide_size} + > + + {#if event_file_obj.file_size}{ae_util.format_bytes(event_file_obj.file_size)}{/if} + - - - + + + - - - + + + - + - {#if $lq__event_event_file_obj_li} -
- - {#each $lq__event_event_file_obj_li as event_file_obj, index} - - {/each} -
- {/if} + {#each $lq__event_event_file_obj_li as event_file_obj, index} + + {/each} +
+ {/if} - {#if $ae_loc.edit_mode} - - {/if} + {#if $ae_loc.edit_mode} + + {/if} - {#if $lq__location_event_file_obj_li} -
- {#each $lq__location_event_file_obj_li as event_file_obj, index} - - {/each} -
- {/if} + {#if $lq__location_event_file_obj_li} +
+ {#each $lq__location_event_file_obj_li as event_file_obj, index} + + {/each} +
+ {/if} - {#if $lq__event_session_obj_li} - - {/if} + {#if $lq__event_session_obj_li} + + {/if} - {#if $ae_loc.edit_mode} -
- - + -
- {/if} + > + {#if $events_loc.launcher.show_content__hidden_sessions} + + Hide Sessions + {:else} + + All Sessions + {/if} + + + {/if} diff --git a/src/routes/events/[event_id]/(launcher)/launcher_presenter_view.svelte b/src/routes/events/[event_id]/(launcher)/launcher_presenter_view.svelte index 3f0e3a6f..456347f5 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_presenter_view.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_presenter_view.svelte @@ -1,111 +1,116 @@ - {#if lq__event_presenter_obj?.given_name && lq__event_presenter_obj?.given_name != 'Group'} - - {lq__event_presenter_obj?.full_name} - {:else if lq__event_presenter_obj?.given_name == 'Group'} - - {lq__event_presenter_obj?.affiliations} - {:else} - --not set-- - {/if} + {#if lq__event_presenter_obj?.given_name && lq__event_presenter_obj?.given_name != 'Group'} + + {lq__event_presenter_obj?.full_name} + {:else if lq__event_presenter_obj?.given_name == 'Group'} + + {lq__event_presenter_obj?.affiliations} + {:else} + --not set-- + {/if} {#if !lq__event_presenter_obj?.file_count} -

- - No files to show for this presenter at this time. - -

+

+ + No files to show for this presenter at this time. + +

{/if} {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} -
-
-
- - - Presenter Files: - {#if $ae_loc.administrator_access && $ae_loc.edit_mode} - ({$lq__event_file_obj_li?.length}×) - {/if} - -
-
-
    - {#each $lq__event_file_obj_li as event_file_obj, index} -
  • - -
  • - {/each} -
-
+
+
+
+ + + Presenter Files: + {#if $ae_loc.administrator_access && $ae_loc.edit_mode} + ({$lq__event_file_obj_li?.length}×) + {/if} + +
+
+
    + {#each $lq__event_file_obj_li as event_file_obj, index} +
  • + +
  • + {/each} +
+
{/if} diff --git a/src/routes/events/[event_id]/(launcher)/launcher_presenter_view_posters.svelte b/src/routes/events/[event_id]/(launcher)/launcher_presenter_view_posters.svelte index 5209a334..f15e24e7 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_presenter_view_posters.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_presenter_view_posters.svelte @@ -1,81 +1,81 @@ - {#if lq__event_presenter_obj?.given_name && lq__event_presenter_obj?.given_name != 'Group'} - - {lq__event_presenter_obj?.full_name} - {:else if lq__event_presenter_obj?.given_name == 'Group'} - - {lq__event_presenter_obj?.affiliations} - {:else} - --not set-- - {/if} + {#if lq__event_presenter_obj?.given_name && lq__event_presenter_obj?.given_name != 'Group'} + + {lq__event_presenter_obj?.full_name} + {:else if lq__event_presenter_obj?.given_name == 'Group'} + + {lq__event_presenter_obj?.affiliations} + {:else} + --not set-- + {/if} {#if !lq__event_presenter_obj?.file_count} -

- - No files to show for this presenter at this time. - -

+

+ + No files to show for this presenter at this time. + +

{/if} {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} -
- -
    - {#each $lq__event_file_obj_li as event_file_obj, index} -
  • - -
  • - {/each} -
-
+
    + {#each $lq__event_file_obj_li as event_file_obj, index} +
  • + +
  • + {/each} +
+ {/if} diff --git a/src/routes/events/[event_id]/(launcher)/launcher_session_view.svelte b/src/routes/events/[event_id]/(launcher)/launcher_session_view.svelte index f540da2d..27355880 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_session_view.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_session_view.svelte @@ -1,367 +1,372 @@
- + - {#if $events_sess.launcher.loading__session_id_status} - - - Loading session information... - - - {/if} + {/if} - {#if $lq__event_session_obj && $lq__event_session_obj.event_session_id_random} -
-

- -

+ {#if $lq__event_session_obj && $lq__event_session_obj.event_session_id_random} +
+

+ +

- -

- {$lq__event_session_obj?.name} -

- {#if $lq__event_session_obj?.code} - - - {$lq__event_session_obj?.code} - - {/if} -
-
+ +

+ {$lq__event_session_obj?.name} +

+ {#if $lq__event_session_obj?.code} + + + {$lq__event_session_obj?.code} + + {/if} +
+
- - {#if !$lq__event_session_obj?.file_count_all} -

- - Warning - -
- No files available show for this session. -

- {/if} + {#if !$lq__event_session_obj?.file_count_all} +

+ + Warning + +
+ No files available show for this session. +

+ {/if} - {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} -
-
-
- - - Session Files: + {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} +
+
+
+ + + Session Files: - - ({$lq__event_file_obj_li?.length}×) - - -
- -
-
    - {#each $lq__event_file_obj_li as event_file_obj, index} -
  • - +
+
    + {#each $lq__event_file_obj_li as event_file_obj, index} +
  • + - + - -
  • - {/each} -
-
- {/if} + + {/each} + + + {/if} - + -
- +
+ - {#if $lq__event_presentation_obj_li} -
- - {#if type_code == 'poster'} - - Posters: - {:else} - - Presentations: - {/if} - {#if $ae_loc.administrator_access && $ae_loc.edit_mode} - ({$lq__event_presentation_obj_li?.length}×) - {/if} - -
+ {#if $lq__event_presentation_obj_li} +
+ + {#if type_code == 'poster'} + + Posters: + {:else} + + Presentations: + {/if} + {#if $ae_loc.administrator_access && $ae_loc.edit_mode} + ({$lq__event_presentation_obj_li?.length}×) + {/if} + +
- -
    - {#each $lq__event_presentation_obj_li as event_presentation_obj} -
  • - -
    - - {#if event_presentation_obj?.start_datetime} - {ae_util.iso_datetime_formatter( - event_presentation_obj?.start_datetime, - 'time_12_short_no_leading' - )} - {/if} + +
      + {#each $lq__event_presentation_obj_li as event_presentation_obj} +
    • + +
      + + {#if event_presentation_obj?.start_datetime} + {ae_util.iso_datetime_formatter( + event_presentation_obj?.start_datetime, + 'time_12_short_no_leading' + )} + {/if} - {event_presentation_obj?.name} - + {event_presentation_obj?.name} + - - {#if $lq__event_presenter_obj_li && type_code == 'poster'} - {#each $lq__event_presenter_obj_li as event_presenter_obj, index} - {#if event_presenter_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random} - - {#if $lq__event_presenter_obj_li[index]?.given_name && $lq__event_presenter_obj_li[index]?.given_name != 'Group'} - - {$lq__event_presenter_obj_li[index]?.full_name} - {:else if $lq__event_presenter_obj_li[index]?.given_name == 'Group'} - - {$lq__event_presenter_obj_li[index]?.affiliations} - {:else} - --not set-- - {/if} - - {/if} - {/each} - {/if} -
      + + {#if $lq__event_presenter_obj_li && type_code == 'poster'} + {#each $lq__event_presenter_obj_li as event_presenter_obj, index} + {#if event_presenter_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random} + + {#if $lq__event_presenter_obj_li[index]?.given_name && $lq__event_presenter_obj_li[index]?.given_name != 'Group'} + + {$lq__event_presenter_obj_li[index]?.full_name} + {:else if $lq__event_presenter_obj_li[index]?.given_name == 'Group'} + + {$lq__event_presenter_obj_li[index] + ?.affiliations} + {:else} + --not set-- + {/if} + + {/if} + {/each} + {/if} +
    - + - {#if $lq__event_presenter_obj_li && $lq__event_presenter_obj_li.length} -
      - {#each $lq__event_presenter_obj_li as event_presenter_obj, index} - {#if event_presenter_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random} -
    • + {#each $lq__event_presenter_obj_li as event_presenter_obj, index} + {#if event_presenter_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random} +
    • - {#if type_code == 'poster'} - - {:else} - - {/if} - -
    • - {/if} - {/each} -
    - {:else} - No presenters to display - {/if} -
  • - {/each} -
- {:else} -

No presentations available to display.

- {/if} -
- {:else} - - No session selected - {/if} + > + {#if type_code == 'poster'} + + {:else} + + {/if} + + + {/if} + {/each} + + {:else} + No presenters to display + {/if} + + {/each} + + {:else} +

No presentations available to display.

+ {/if} +
+ {:else} + + No session selected + {/if}
diff --git a/src/routes/events/[event_id]/locations/+page.svelte b/src/routes/events/[event_id]/locations/+page.svelte index ca0d8f63..057f6a9a 100644 --- a/src/routes/events/[event_id]/locations/+page.svelte +++ b/src/routes/events/[event_id]/locations/+page.svelte @@ -1,103 +1,103 @@ - - Locations: {ae_util.shorten_string({ - string: $lq__event_obj?.name ?? 'Loading...', - max_length: 12 - })} ({$lq__event_obj?.event_id ?? ''}) - Pres Mgmt - {$events_loc?.title} - + + Locations: {ae_util.shorten_string({ + string: $lq__event_obj?.name ?? 'Loading...', + max_length: 12 + })} ({$lq__event_obj?.event_id ?? ''}) - Pres Mgmt - {$events_loc?.title} +
- + - {#if !$lq__event_location_obj_li} -
- - Loading locations... -
- {:else} -
-

+ Loading locations... + + {:else} +
+

- - - Locations/Rooms - - - - {#if $lq__event_obj?.cfg_json?.short_name} - {@html $lq__event_obj?.cfg_json.short_name ?? ae_snip.html__not_set} - {:else} - {@html $lq__event_obj?.name ?? ae_snip.html__not_set} - {/if} -

-
+ > + + + Locations/Rooms + + + + {#if $lq__event_obj?.cfg_json?.short_name} + {@html $lq__event_obj?.cfg_json.short_name ?? ae_snip.html__not_set} + {:else} + {@html $lq__event_obj?.name ?? ae_snip.html__not_set} + {/if} +

+
- - {/if} + + {/if} - +
diff --git a/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_tbl_wrapper.svelte b/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_tbl_wrapper.svelte index 92c45505..20f50e00 100644 --- a/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_tbl_wrapper.svelte +++ b/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_tbl_wrapper.svelte @@ -1,137 +1,139 @@ {#if event_presenter_obj_li && event_presenter_obj_li?.length} - - + + {:else} -
-

No presenters available to show in table.

-
+
+

No presenters available to show in table.

+
{/if} diff --git a/src/routes/events/[event_id]/reports/+page.svelte b/src/routes/events/[event_id]/reports/+page.svelte index d24d467f..ffb0062f 100644 --- a/src/routes/events/[event_id]/reports/+page.svelte +++ b/src/routes/events/[event_id]/reports/+page.svelte @@ -1,696 +1,697 @@ - - Reports: {ae_util.shorten_string({ string: $lq__event_obj?.name, max_length: 12 })} - ({$lq__event_obj?.event_id}) - Pres Mgmt - {$events_loc?.title} - + + Reports: {ae_util.shorten_string({ string: $lq__event_obj?.name, max_length: 12 })} + ({$lq__event_obj?.event_id}) - Pres Mgmt - {$events_loc?.title} + {#if !$lq__event_obj} -
- - Loading event information... -
+
+ + Loading event information... +
{:else} -
- - - -

- - - Reports - - - {#if $lq__event_obj?.cfg_json?.short_name} - {@html $lq__event_obj?.cfg_json.short_name ?? ae_snip.html__not_set} - {:else} - {@html $lq__event_obj?.name ?? ae_snip.html__not_set} - {/if} -

-
+ > + + + Reports + + + {#if $lq__event_obj?.cfg_json?.short_name} + {@html $lq__event_obj?.cfg_json.short_name ?? ae_snip.html__not_set} + {:else} + {@html $lq__event_obj?.name ?? ae_snip.html__not_set} + {/if} + + -
- - - +
+ + + - + - - - + + + - - + + - + - - + + - - - - - -
+ +
+
- - {#if $events_loc.pres_mgmt.show_report == 'session_no_files' || $events_loc.pres_mgmt.show_report == 'session_no_bio' || $events_loc.pres_mgmt.show_report == 'sessions_poc_agree'} - - {/if} + + {#if $events_loc.pres_mgmt.show_report == 'session_no_files' || $events_loc.pres_mgmt.show_report == 'session_no_bio' || $events_loc.pres_mgmt.show_report == 'sessions_poc_agree'} + + {/if} - - {#if $events_loc.pres_mgmt.show_report == 'presenters_agree' || $events_loc.pres_mgmt.show_report == 'presenters_biography' || $events_loc.pres_mgmt.show_report == 'presenters_overview'} - - {/if} + + {#if $events_loc.pres_mgmt.show_report == 'presenters_agree' || $events_loc.pres_mgmt.show_report == 'presenters_biography' || $events_loc.pres_mgmt.show_report == 'presenters_overview'} + + {/if} - - {#if $events_loc.pres_mgmt.show_report == 'event_files' || $events_loc.pres_mgmt.show_report == 'recent_files' || $events_loc.pres_mgmt.show_report == 'large_files'} - - {/if} + + {#if $events_loc.pres_mgmt.show_report == 'event_files' || $events_loc.pres_mgmt.show_report == 'recent_files' || $events_loc.pres_mgmt.show_report == 'large_files'} + + {/if} {/if} diff --git a/src/routes/events/[event_id]/reports/event_reports_page_menu.svelte b/src/routes/events/[event_id]/reports/event_reports_page_menu.svelte index 5fee4b4f..656deae9 100644 --- a/src/routes/events/[event_id]/reports/event_reports_page_menu.svelte +++ b/src/routes/events/[event_id]/reports/event_reports_page_menu.svelte @@ -1,108 +1,111 @@
- -
- + +
+ - - - + + + - - -
- + + +
+ - - + {/if} +
+ - + -
- -
+
+ +
diff --git a/src/routes/events/[event_id]/reports/reports_files.svelte b/src/routes/events/[event_id]/reports/reports_files.svelte index f961548b..429f4b96 100644 --- a/src/routes/events/[event_id]/reports/reports_files.svelte +++ b/src/routes/events/[event_id]/reports/reports_files.svelte @@ -1,540 +1,550 @@ {#if rpt__name == 'event_files' || rpt__name == 'large_files'} -
-

- {#if qry__status == 'loading'} - - - {:else} - - {/if} - File Uploads -

+
+

+ {#if qry__status == 'loading'} + + + {:else} + + {/if} + File Uploads +

-
- { + if ($events_loc.pres_mgmt?.qry__files_offset_seconds) { + // Calculate the datetime to pass based on the selected offset. + // let offset = $events_loc.pres_mgmt.qry__files_offset_seconds ?? 0; + // let created_on = new Date() + // console.log(`Created on:`, created_on); + // created_on.setSeconds(created_on.getSeconds() - offset); + // handle_qry__event_file({ + // created_on_offset: $events_loc.pres_mgmt.qry__files_offset_seconds ?? 0, + // file_purpose: $events_loc.pres_mgmt.qry__file_purpose ?? null, + // log_lvl: log_lvl, + // }); + qry__trigger = true; + } else { + console.log('No offset is will be used.'); + // handle_qry__event_file({ + // log_lvl: log_lvl, + // }); + qry__trigger = true; + } - $events_loc.pres_mgmt.show_report = 'event_files'; - }} - > - - - - - - - - - - - - - - - - - + $events_loc.pres_mgmt.show_report = 'event_files'; + }} + > + + + + + + + + + + + + + + + + + - + - + -
-
+ // ae_promises.handle_search__event_presenter = handle_search__event_presenter({ + // // ft_search_str: '', + // // lk_search_str: '', + // order_by_li: $events_loc.pres_mgmt.qry__presenter_order_by_li, + // log_lvl: log_lvl, + // }); + qry__trigger = true; + $events_loc.pres_mgmt.show_report = 'event_files'; + }} + > + + + + + + + + + + + + + + +
{/if} {#if event_file_obj_li} - - + + {/if} diff --git a/src/routes/events/[event_id]/reports/reports_presenters.svelte b/src/routes/events/[event_id]/reports/reports_presenters.svelte index 637d8baa..03aeba91 100644 --- a/src/routes/events/[event_id]/reports/reports_presenters.svelte +++ b/src/routes/events/[event_id]/reports/reports_presenters.svelte @@ -1,413 +1,417 @@ {#if rpt__name == 'presenters_agree'} -
-

- {#if qry__status == 'loading'} - - - {:else if $events_loc.pres_mgmt.rpt__presenter_agree} - - {:else} - - {/if} - Presenters - {#if $events_loc.pres_mgmt.rpt__presenter_agree}Agreed{:else}Not Agreed{/if} - -

+
+

+ {#if qry__status == 'loading'} + + + {:else if $events_loc.pres_mgmt.rpt__presenter_agree} + + {:else} + + {/if} + Presenters + {#if $events_loc.pres_mgmt.rpt__presenter_agree}Agreed{:else}Not Agreed{/if} + +

-
- -
-
+ qry__trigger = true; + rpt__name = 'presenters_agree'; + }} + class="ae_btn_info btn btn-sm m-1" + > + {#if $events_loc.pres_mgmt.rpt__presenter_agree} + + + Agreed + {:else} + + + Not Agreed + {/if} + + +
{/if} {#if $events_loc.pres_mgmt.show_report == 'presenters_biography'} -
-

- {#if qry__status == 'loading'} - - - {:else} - - {/if} - Presenters with Bios -

-
+
+

+ {#if qry__status == 'loading'} + + + {:else} + + {/if} + Presenters with Bios +

+
{/if} {#if $events_loc.pres_mgmt.show_report == 'presenters_overview'} -
-

- {#if qry__status == 'loading'} - - - {:else} - - {/if} - Presenters Overview -

+
+

+ {#if qry__status == 'loading'} + + + {:else} + + {/if} + Presenters Overview +

-
- -
+ // ae_promises.handle_search__event_presenter = handle_search__event_presenter({ + // // ft_search_str: '', + // // lk_search_str: '', + // order_by_li: $events_loc.pres_mgmt.qry__presenter_order_by_li, + // log_lvl: log_lvl, + // }); + qry__trigger = true; + rpt__name = 'presenters_overview'; + }} + > + + + + + + + + + + + +
{/if} {#if event_presenter_obj_li} - + {/if} diff --git a/src/routes/events/[event_id]/reports/reports_sessions.svelte b/src/routes/events/[event_id]/reports/reports_sessions.svelte index 54bb7bf2..03cf911d 100644 --- a/src/routes/events/[event_id]/reports/reports_sessions.svelte +++ b/src/routes/events/[event_id]/reports/reports_sessions.svelte @@ -1,437 +1,449 @@ {#if rpt__name == 'session_no_files'} -
-

- {#if qry__status == 'loading'} - - - {:else if $events_loc.pres_mgmt.rpt__session_no_files} - - {:else} - - {/if} - Sessions - {#if $events_loc.pres_mgmt?.rpt__session_no_files} - With - {:else} - Without - {/if} - Files -

+
+

+ {#if qry__status == 'loading'} + + + {:else if $events_loc.pres_mgmt.rpt__session_no_files} + + {:else} + + {/if} + Sessions + {#if $events_loc.pres_mgmt?.rpt__session_no_files} + With + {:else} + Without + {/if} + Files +

-
- -
-
+ qry__trigger = true; + rpt__name = 'session_no_files'; + }} + class="ae_btn_info btn-sm m-1" + > + {#if $events_loc.pres_mgmt?.rpt__session_no_files} + + With + {:else} + + Without + {/if} + + +
{/if} {#if rpt__name == 'sessions_no_bio'} -
-

- {#if qry__status == 'loading'} - - - {:else} - - - {/if} - Sessions - {#if $events_loc.pres_mgmt?.rpt__session_no_bio} - With - {:else} - Without - {/if} - POC Biography -

+
+

+ {#if qry__status == 'loading'} + + + {:else} + + + {/if} + Sessions + {#if $events_loc.pres_mgmt?.rpt__session_no_bio} + With + {:else} + Without + {/if} + POC Biography +

-
- -
-
+ qry__trigger = true; + rpt__name = 'session_no_bio'; + }} + class="ae_btn_info btn-sm m-1" + > + {#if $events_loc.pres_mgmt?.rpt__session_no_bio} + + With + {:else} + + Without + {/if} + + +
{/if} {#if rpt__name == 'sessions_poc_agree'} -
-

- {#if qry__status == 'loading'} - - - {:else if $events_loc.pres_mgmt.rpt__session_poc_agree} - - {:else} - - {/if} - Sessions POC - {#if $events_loc.pres_mgmt?.rpt__session_poc_agree} - Agreed - {:else} - Not Agreed - {/if} -

+
+

+ {#if qry__status == 'loading'} + + + {:else if $events_loc.pres_mgmt.rpt__session_poc_agree} + + {:else} + + {/if} + Sessions POC + {#if $events_loc.pres_mgmt?.rpt__session_poc_agree} + Agreed + {:else} + Not Agreed + {/if} +

-
- -
-
+ qry__trigger = true; + rpt__name = 'sessions_poc_agree'; + }} + class="ae_btn_info btn-sm m-1" + title="Toggle to show sessions with or without POC agreement to terms" + > + {#if $events_loc.pres_mgmt?.rpt__session_poc_agree} + + With + {:else} + + Without (NOT working) + {/if} + + +
{/if} {#if event_session_obj_li} - + {/if} diff --git a/src/routes/events/[event_id]/session/[session_id]/+page.svelte b/src/routes/events/[event_id]/session/[session_id]/+page.svelte index 583bac7e..fa5bfed8 100644 --- a/src/routes/events/[event_id]/session/[session_id]/+page.svelte +++ b/src/routes/events/[event_id]/session/[session_id]/+page.svelte @@ -1,187 +1,189 @@ - - Session: {ae_util.shorten_string({ - string: $lq__event_session_obj?.name ?? 'Loading...', - max_length: 12 - })} ({$lq__event_session_obj?.event_session_id ?? ''}) - Pres Mgmt - {$events_loc?.title} - + + Session: {ae_util.shorten_string({ + string: $lq__event_session_obj?.name ?? 'Loading...', + max_length: 12 + })} ({$lq__event_session_obj?.event_session_id ?? ''}) - Pres Mgmt - {$events_loc?.title} +
- + - {#if !$lq__event_session_obj} -
- - Loading session information... -
- {:else if $lq__event_session_obj?.enable || $ae_loc.trusted_access} -
- {#if $lq__event_session_obj?.alert && $ae_loc.trusted_access} - - {/if} + {#if !$lq__event_session_obj} +
+ + Loading session information... +
+ {:else if $lq__event_session_obj?.enable || $ae_loc.trusted_access} +
+ {#if $lq__event_session_obj?.alert && $ae_loc.trusted_access} + + {/if} - - - - - - + + + + + + - -

- - {@html $lq__event_session_obj?.name ?? ae_snip.html__not_set} - -

+ +

+ + {@html $lq__event_session_obj?.name ?? ae_snip.html__not_set} + +

- {#if (!$events_loc.pres_mgmt?.hide__session_code && $lq__event_session_obj.code) || $ae_loc.edit_mode} - - - - code - - {$lq__event_session_obj.code} - - {/if} -
-
+ {#if (!$events_loc.pres_mgmt?.hide__session_code && $lq__event_session_obj.code) || $ae_loc.edit_mode} + + + + code + + {$lq__event_session_obj.code} + + {/if} + +
- + -
- {#if $ae_loc.trusted_access || ($events_loc.auth__person?.id && $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id])} - {#if $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] === true} -

- Welcome {$lq__event_session_obj?.poc_person_full_name ?? 'Session POC'} -

- {:else if $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] == 'read'} -

Welcome {$lq__auth__event_presenter_obj?.full_name ?? 'Presenter'}

- {/if} +
+ {#if $ae_loc.trusted_access || ($events_loc.auth__person?.id && $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id])} + {#if $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] === true} +

+ Welcome {$lq__event_session_obj?.poc_person_full_name ?? 'Session POC'} +

+ {:else if $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] == 'read'} +

+ Welcome {$lq__auth__event_presenter_obj?.full_name ?? 'Presenter'} +

+ {/if} - {#if $ae_loc.trusted_access || $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] === true || ($events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] == 'read' && $lq__auth__event_presenter_obj?.agree)} - - - {:else if $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] == 'read' && !$lq__event_presenter_obj?.agree} - - - {/if} - {/if} + {#if $ae_loc.trusted_access || $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] === true || ($events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] == 'read' && $lq__auth__event_presenter_obj?.agree)} + + + {:else if $events_loc.auth__kv.session[$lq__event_session_obj?.event_session_id] == 'read' && !$lq__event_presenter_obj?.agree} + + + {/if} + {/if} - {#if (!$events_loc.auth__person?.id && !$ae_loc.trusted_access) || ($ae_loc.trusted_access && $ae_loc.edit_mode)} - - {/if} -
+ {#if (!$events_loc.auth__person?.id && !$ae_loc.trusted_access) || ($ae_loc.trusted_access && $ae_loc.edit_mode)} + + {/if} +
- {#if !$events_loc.pres_mgmt.show_content__session_view || $events_loc.pres_mgmt.show_content__session_view == 'default'} - - {:else if $events_loc.pres_mgmt.show_content__session_view == 'manage_files' && $ae_loc.public_access} -
-

- - - Manage and Upload Session Files: - - - {$lq__event_session_obj?.file_count}× - -

+ {#if !$events_loc.pres_mgmt.show_content__session_view || $events_loc.pres_mgmt.show_content__session_view == 'default'} + + {:else if $events_loc.pres_mgmt.show_content__session_view == 'manage_files' && $ae_loc.public_access} +
+

+ + + Manage and Upload Session Files: + + + {$lq__event_session_obj?.file_count}× + +

- - {#snippet label()} - -
- - Upload session (breakout) specific files only! -
-
- Session (breakout) files only
- Recommended: PowerPoint (pptx) or Keynote (key)
- Media: Audio and videos files should be directly embedded in PowerPoint (PPTX) files
- Supplemental files: mp4, PDF, Word Doc, Excel, txt, etc -
-
- {/snippet} -
+ + {#snippet label()} + +
+ + Upload session (breakout) specific files only! +
+
+ Session (breakout) files only
+ Recommended: PowerPoint (pptx) or Keynote (key)
+ Media: Audio and videos files should be directly embedded in PowerPoint + (PPTX) files
+ Supplemental files: mp4, PDF, Word Doc, Excel, txt, etc +
+
+ {/snippet} +
-
- -
-
- {/if} - {:else} -
-

- - Session Disabled -

-

- This session is currently disabled. Please contact the event organizer for more information. -

-
- {/if} +
+ +
+
+ {/if} + {:else} +
+

+ + Session Disabled +

+

+ This session is currently disabled. Please contact the event organizer for more + information. +

+
+ {/if}
- + - {#snippet footer()} -
- -
- {/snippet} + {#snippet footer()} +
+ +
+ {/snippet}
diff --git a/src/routes/events/[event_id]/session/[session_id]/+page.ts b/src/routes/events/[event_id]/session/[session_id]/+page.ts index 6c321bf0..8f8b985a 100644 --- a/src/routes/events/[event_id]/session/[session_id]/+page.ts +++ b/src/routes/events/[event_id]/session/[session_id]/+page.ts @@ -6,117 +6,121 @@ import { browser } from '$app/environment'; import { events_func } from '$lib/ae_events_functions'; export async function load({ params, parent }) { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - // console.log(`ae events_pres_mgmt session [session_id] +page.ts data:`, data); + const data = await parent(); + // console.log(`ae events_pres_mgmt session [session_id] +page.ts data:`, data); - const account_id = data.account_id; - const ae_acct = data[account_id]; - // console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + // console.log(`ae_acct = `, ae_acct); - // if (!account_id) { - // console.log(`ae events_pres_mgmt session [session_id] +page.ts: The account_id was not found in the data!!!`); - // return false; - // } + // if (!account_id) { + // console.log(`ae events_pres_mgmt session [session_id] +page.ts: The account_id was not found in the data!!!`); + // return false; + // } - data.ae_events_pres_mgmt_event_session_id_page_ts = true; + data.ae_events_pres_mgmt_event_session_id_page_ts = true; - const event_session_id = params.session_id; - if (!event_session_id) { - console.log( - `ae events_pres_mgmt session [session_id] +page.ts: The event_session_id was not found in the params!!!` - ); - error(404, { - message: 'Session not found' - }); - } - ae_acct.slct.event_session_id = event_session_id; + const event_session_id = params.session_id; + if (!event_session_id) { + console.log( + `ae events_pres_mgmt session [session_id] +page.ts: The event_session_id was not found in the params!!!` + ); + error(404, { + message: 'Session not found' + }); + } + ae_acct.slct.event_session_id = event_session_id; - if (browser) { - // Load event session object - const load_event_session_obj = await events_func.load_ae_obj_id__event_session({ - api_cfg: ae_acct.api, - event_session_id: event_session_id, - // inc_presentation_li: true, - // inc_presenter_li: true, - try_cache: true - }); + if (browser) { + // Load event session object + const load_event_session_obj = await events_func.load_ae_obj_id__event_session({ + api_cfg: ae_acct.api, + event_session_id: event_session_id, + // inc_presentation_li: true, + // inc_presenter_li: true, + try_cache: true + }); - ae_acct.slct.event_session_obj = load_event_session_obj; + ae_acct.slct.event_session_obj = load_event_session_obj; - // Load event presentations for the session - const load_event_presentation_obj_li = events_func - .load_ae_obj_li__event_presentation({ - api_cfg: ae_acct.api, - for_obj_type: 'event_session', - for_obj_id: event_session_id, - inc_presenter_li: true, - enabled: 'all', - hidden: 'all', - limit: 19, - // params: {}, - try_cache: true, - log_lvl: 2 - }) - .then((event_presentation_obj_li) => { - if (log_lvl) { - console.log(`event_presentation_obj_li = `, event_presentation_obj_li); - } - for (let index = 0; index < event_presentation_obj_li?.length; index++) { - const event_presentation_obj = event_presentation_obj_li[index]; - const event_presentation_id = event_presentation_obj.event_presentation_id_random; + // Load event presentations for the session + const load_event_presentation_obj_li = events_func + .load_ae_obj_li__event_presentation({ + api_cfg: ae_acct.api, + for_obj_type: 'event_session', + for_obj_id: event_session_id, + inc_presenter_li: true, + enabled: 'all', + hidden: 'all', + limit: 19, + // params: {}, + try_cache: true, + log_lvl: 2 + }) + .then((event_presentation_obj_li) => { + if (log_lvl) { + console.log(`event_presentation_obj_li = `, event_presentation_obj_li); + } + for (let index = 0; index < event_presentation_obj_li?.length; index++) { + const event_presentation_obj = event_presentation_obj_li[index]; + const event_presentation_id = + event_presentation_obj.event_presentation_id_random; - const load_event_presenter_obj_li = events_func.load_ae_obj_li__event_presenter({ - api_cfg: ae_acct.api, - for_obj_type: 'event_presentation', - for_obj_id: event_presentation_id, - enabled: 'all', - hidden: 'all', - limit: 19, - params: {}, - try_cache: true, - log_lvl: 2 - }); - if (log_lvl) { - console.log(`load_event_presenter_obj_li = `, load_event_presenter_obj_li); - } - event_presentation_obj_li[index].event_presenter_li = load_event_presenter_obj_li; - } + const load_event_presenter_obj_li = events_func.load_ae_obj_li__event_presenter( + { + api_cfg: ae_acct.api, + for_obj_type: 'event_presentation', + for_obj_id: event_presentation_id, + enabled: 'all', + hidden: 'all', + limit: 19, + params: {}, + try_cache: true, + log_lvl: 2 + } + ); + if (log_lvl) { + console.log(`load_event_presenter_obj_li = `, load_event_presenter_obj_li); + } + event_presentation_obj_li[index].event_presenter_li = + load_event_presenter_obj_li; + } - return event_presentation_obj_li; - }); - if (log_lvl) { - console.log(`load_event_presentation_obj_li = `, load_event_presentation_obj_li); - } - ae_acct.slct.event_presentation_obj_li = load_event_presentation_obj_li; + return event_presentation_obj_li; + }); + if (log_lvl) { + console.log(`load_event_presentation_obj_li = `, load_event_presentation_obj_li); + } + ae_acct.slct.event_presentation_obj_li = load_event_presentation_obj_li; - // Load event files for the session - const load_event_file_obj_li = await events_func - .load_ae_obj_li__event_file({ - api_cfg: ae_acct.api, - for_obj_type: 'event_session', - for_obj_id: event_session_id, - enabled: 'all', - hidden: 'all', - limit: 50, - try_cache: true - }) - .then((event_file_obj_li) => { - if (log_lvl) { - console.log(`event_file_obj_li = `, event_file_obj_li); - } - return event_file_obj_li; - }); - if (log_lvl) { - console.log(`load_event_file_obj_li = `, load_event_file_obj_li); - } - ae_acct.slct.event_file_obj_li = load_event_file_obj_li; - } + // Load event files for the session + const load_event_file_obj_li = await events_func + .load_ae_obj_li__event_file({ + api_cfg: ae_acct.api, + for_obj_type: 'event_session', + for_obj_id: event_session_id, + enabled: 'all', + hidden: 'all', + limit: 50, + try_cache: true + }) + .then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); + if (log_lvl) { + console.log(`load_event_file_obj_li = `, load_event_file_obj_li); + } + ae_acct.slct.event_file_obj_li = load_event_file_obj_li; + } - // WARNING: Precaution against shared data between sites and presentations. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and presentations. + data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_form_agree.svelte b/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_form_agree.svelte index d60d253f..a955987d 100644 --- a/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_form_agree.svelte +++ b/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_form_agree.svelte @@ -1,422 +1,426 @@ {#if $lq__event_session_obj} -

- {$events_loc.pres_mgmt?.label__session_poc_name} Agreement for:
- {$lq__event_session_obj?.poc_person_full_name} - {#if $lq__event_session_obj?.poc_person_primary_email} - ({$lq__event_session_obj?.poc_person_primary_email ?? '-- not set --'}) - {/if} - -

+

+ {$events_loc.pres_mgmt?.label__session_poc_name} Agreement for:
+ {$lq__event_session_obj?.poc_person_full_name} + {#if $lq__event_session_obj?.poc_person_primary_email} + ({$lq__event_session_obj?.poc_person_primary_email ?? '-- not set --'}) + {/if} + +

- {#if !$lq__event_session_obj?.poc_agree} -
-
- - Not Yet Agreed -
-
- Waiting for agreement to the {$events_loc.pres_mgmt?.label__session_poc_name} Consent and Release - and Terms and Conditions before you can move on. Please review and mark as agreed below. -
-
- {/if} + {#if !$lq__event_session_obj?.poc_agree} +
+
+ + Not Yet Agreed +
+
+ Waiting for agreement to the {$events_loc.pres_mgmt?.label__session_poc_name} Consent + and Release and Terms and Conditions before you can move on. Please review and mark as + agreed below. +
+
+ {/if} -
- -
+
+ +
-
- -

- {$lq__event_session_obj.poc_person_full_name} ({$lq__event_session_obj.poc_person_primary_email}) agrees to the following terms and conditions for the presentation: -

-

- Session: "{$lq__event_session_obj?.name}" -

+
+ +

+ {$lq__event_session_obj.poc_person_full_name} ({$lq__event_session_obj.poc_person_primary_email}) agrees to the following terms and conditions for the presentation: +

+

+ Session: "{$lq__event_session_obj?.name}" +

-
-

Opt-Out?

- + {#await ae_promises.update__event_session_obj__opt_out} + + {:then update__event_session_obj__opt_out_result} + {#if $events_sess.pres_mgmt.status__session_opt_out} + + {/if} + {:catch error} + + {/await} + +
+ + -
-

Agree?

- - {#if !$lq__event_session_obj?.poc_agree} -
- Not Agreed: - - -
-
- Waiting for agreement to the POC Consent and Release and Terms and Conditions before you - can move on. -
- {:else} -
- Agreed: - - Marked as agreed -
- {/if} +
+

Agree?

+ + {#if !$lq__event_session_obj?.poc_agree} +
+ Not Agreed: + + +
+
+ Waiting for agreement to the POC Consent and Release and Terms and Conditions + before you can move on. +
+ {:else} +
+ Agreed: + + Marked as agreed +
+ {/if} - {#if !$lq__event_session_obj?.poc_agree} - - {:else} - + {:else} + - {/if} -
-
+ {#await ae_promises.update__event_session_obj__agree} + + {:then update__event_session_obj__agree_result} + {#if $events_sess.pres_mgmt.status__session_agree} + + {/if} + {:catch error} + + {/await} + + {/if} + +
{:else} - Not ready + Not ready {/if} diff --git a/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_profile.svelte b/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_profile.svelte index fe37ffe2..2f908bc2 100644 --- a/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_profile.svelte +++ b/src/routes/events/[event_id]/session/[session_id]/ae_comp__event_session_poc_profile.svelte @@ -1,209 +1,218 @@
- {#if $lq__event_session_obj} - {#if $lq__event_session_obj.poc_person_id_random && $ae_loc.trusted_access} - - - - - - - - {/if} + {#if $lq__event_session_obj} + {#if $lq__event_session_obj.poc_person_id_random && $ae_loc.trusted_access} + + + + + + + + {/if} -

- - {$lq__event_session_obj.poc_person_full_name} ({$lq__event_session_obj.poc_person_primary_email}) -

+

+ + {$lq__event_session_obj.poc_person_full_name} ({$lq__event_session_obj.poc_person_primary_email}) +

- - + + - - -
-
- + + +
+
+ - + - -
-

- Biography length: {ae_tmp.biography ? ae_util.number_w_commas(ae_tmp.biography.length) : 0} characters; - {ae_tmp.biography ? ae_util.number_w_commas(ae_util.count_words(ae_tmp.biography)) : 0} estimated - words -

- -

The biography should be plain text only and be at most 100 words.

- - + +
+

+ Biography length: {ae_tmp.biography + ? ae_util.number_w_commas(ae_tmp.biography.length) + : 0} characters; + {ae_tmp.biography + ? ae_util.number_w_commas(ae_util.count_words(ae_tmp.biography)) + : 0} estimated words +

+ +

The biography should be plain text only and be at most 100 words.

+ + -
- + ae_promises.update__event_session_obj = events_func + .update_ae_obj__event_session({ + api_cfg: $ae_api, + event_session_id: $lq__event_session_obj?.event_session_id_random, + data_kv: event_session_data, + log_lvl: log_lvl + }) + .then(function (update_result) { + // console.log(update_result); + // return update_result; + }); + }} + > + {#await ae_promises.update__event_session_obj} + + {:then} + {#if ae_tmp.biography == $lq__event_session_obj.biography} + + {:else} + + {/if} + {/await} + Save Biography + - {#if $lq__event_session_obj.poc_kv_json[poc_type]?.biography_updated_on} - - Last saved: {ae_util.iso_datetime_formatter( - $lq__event_session_obj.poc_kv_json[poc_type]?.biography_updated_on, - 'datetime_12_long' - )} - - {/if} -
-
- {:else} - Not ready - {/if} + {#if $lq__event_session_obj.poc_kv_json[poc_type]?.biography_updated_on} + + Last saved: {ae_util.iso_datetime_formatter( + $lq__event_session_obj.poc_kv_json[poc_type]?.biography_updated_on, + 'datetime_12_long' + )} + + {/if} +
+ + {:else} + Not ready + {/if}
diff --git a/src/routes/events/[event_id]/session/[session_id]/session_page_menu.svelte b/src/routes/events/[event_id]/session/[session_id]/session_page_menu.svelte index de4698c4..8cacc1d7 100644 --- a/src/routes/events/[event_id]/session/[session_id]/session_page_menu.svelte +++ b/src/routes/events/[event_id]/session/[session_id]/session_page_menu.svelte @@ -1,531 +1,541 @@
- -
- - + +
+ + - - - + + + - + - - + + - - {#if $lq__event_session_obj?.event_id} - - - {/if} - -
- + + {#if $lq__event_session_obj?.event_id} + + + {/if} + +
+ - -
-
-

Æ Session Menu Options

+ +
+
+

Æ Session Menu Options

-
-
- - + title={$lq__event_session_obj?.alert + ? 'Remove alert status' + : 'Mark as alert'} + > + {#if $lq__event_session_obj?.alert} + + + {:else} + + {/if} + + - { - console.log(`ae_crud_updated:`, e.detail); + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: $lq__event_session_obj?.event_session_id, - log_lvl: log_lvl - }); - }} - > - - -
+ ae_triggers.hide_event_launcher = true; + }} + class="btn btn-sm m-1 group" + class:ae_btn_surface_outlined={!$lq__event_session_obj?.hide_event_launcher} + class:ae_btn_success={$lq__event_session_obj?.hide_event_launcher} + disabled={!$ae_loc.trusted_access} + title={$lq__event_session_obj?.hide_event_launcher + ? 'Not showing in the Launcher. Unhide from the Launcher?' + : 'Currently showing in the Launcher. Hide from the Launcher?'} + > + {#if $lq__event_session_obj?.hide_event_launcher} + + Unhide from Launcher + {:else} + + + + {/if} + + + +
-
- { - console.log(`ae_crud_updated:`, e.detail); +
+ { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: $lq__event_session_obj?.event_session_id, - log_lvl: log_lvl - }); - }} - > - - - + // $events_slct.exhibit_tracking_obj.priority = !$lq__event_session_obj?.priority; + ae_triggers.priority = true; + }} + class="btn btn-sm *:hover:inline" + class:ae_btn_surface_outlined={!$lq__event_session_obj?.priority} + class:ae_btn_success={$lq__event_session_obj?.priority} + > + {#if $lq__event_session_obj?.priority} + + + + {:else} + + + + ? + {/if} + + - { - console.log(`ae_crud_updated:`, e.detail); + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: $lq__event_session_obj?.event_session_id, - log_lvl: log_lvl - }); - }} - > - - - + // $events_slct.exhibit_tracking_obj.hide = !$lq__event_session_obj?.hide; + ae_triggers.hide = true; + }} + class="btn btn-sm *:hover:inline" + class:ae_btn_success_outlined={!$lq__event_session_obj?.hide} + class:ae_btn_warning={$lq__event_session_obj?.hide} + disabled={!$ae_loc.trusted_access} + > + {#if $lq__event_session_obj?.hide} + + Unhide? + {:else} + + + + {/if} + + + - - { - console.log(`ae_crud_updated:`, e.detail); + + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: $lq__event_session_obj?.event_session_id, - log_lvl: log_lvl - }) - .then(function (load_results) { - // Maybe reload page? - // window.location.reload(); - }); - }} - > - - - + // $events_slct.exhibit_tracking_obj.hide = !$lq__event_session_obj?.hide; + ae_triggers.enable = true; + }} + class="btn btn-sm" + class:ae_btn_success_outlined={$lq__event_session_obj?.enable} + class:ae_btn_error={!$lq__event_session_obj?.enable} + disabled={!$ae_loc.manager_access} + > + {#if $lq__event_session_obj?.enable} + + Enabled + {:else} + + Enable? + {/if} + + + - + - + - {#if $ae_loc.manager_access} - - {:else if $ae_loc.administrator_access} - + {:else if $ae_loc.administrator_access} + - {/if} -
-
-
+ goto(`/events/${$lq__event_session_obj.event_id}`); + }); + }} + class="btn btn-sm mx-1 ae_btn_warning" + type="button" + title="Disable record" + > + + Delete + + {/if} +
+
+
- -
- + + + - + -
- -
+
+ +
diff --git a/src/routes/events/[event_id]/session/[session_id]/session_view.svelte b/src/routes/events/[event_id]/session/[session_id]/session_view.svelte index 5cc2e5f7..22d6816d 100644 --- a/src/routes/events/[event_id]/session/[session_id]/session_view.svelte +++ b/src/routes/events/[event_id]/session/[session_id]/session_view.svelte @@ -1,162 +1,164 @@ {#if $lq__event_session_obj} -
- - {#if $events_sess.pres_mgmt.session_qr_url[lq__event_session_obj?.event_session_id]} -
- {#if $events_sess.pres_mgmt.session_qr_url[lq__event_session_obj?.event_session_id]} - - - { - $events_sess.pres_mgmt.qr_bigger = !$events_sess.pres_mgmt.qr_bigger; - }} - class:h-48={$events_sess.pres_mgmt.qr_bigger} - class:w-48={$events_sess.pres_mgmt.qr_bigger} - class:hover:h-96={$events_sess.pres_mgmt.qr_bigger} - class:hover:w-96={$events_sess.pres_mgmt.qr_bigger} - class="qr_code qr_type_url + > + {#if $events_sess.pres_mgmt.session_qr_url[lq__event_session_obj?.event_session_id]} + + + { + $events_sess.pres_mgmt.qr_bigger = !$events_sess.pres_mgmt.qr_bigger; + }} + class:h-48={$events_sess.pres_mgmt.qr_bigger} + class:w-48={$events_sess.pres_mgmt.qr_bigger} + class:hover:h-96={$events_sess.pres_mgmt.qr_bigger} + class:hover:w-96={$events_sess.pres_mgmt.qr_bigger} + class="qr_code qr_type_url h-32 w-32 hover:h-54 hover:w-54 transition-all ease-in-out duration-500 " - alt="URL QR code" - /> - {:else} - No QR URL yet - {/if} - - - Session URL - - - -
- {/if} + alt="URL QR code" + /> + {:else} + No QR URL yet + {/if} + + + Session URL + + + + + {/if} -
    -
  • - {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - { - console.log(`ae_crud_updated:`, e.detail); +
      +
    • + {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id, - log_lvl: 1 - }) - .then(function (load_results) {}); - }} - > - Name/title: - - {lq__event_session_obj.name} - - - {/if} + events_func + .load_ae_obj_id__event_session({ + api_cfg: $ae_api, + event_session_id: lq__event_session_obj?.event_session_id, + log_lvl: 1 + }) + .then(function (load_results) {}); + }} + > + Name/title: + + {lq__event_session_obj.name} + + + {/if} - {#if $ae_loc.edit_mode} - { - console.log(`ae_crud_updated:`, e.detail); + {#if $ae_loc.edit_mode} + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id, - log_lvl: 1 - }) - .then(function (load_results) {}); - }} - > - - code: - - {lq__event_session_obj.code} - - - {/if} -
    • -
    • - - Date & - - : - - { - console.log(`ae_crud_updated:`, e.detail); + title="Session code {lq__event_session_obj.code}" + > + code: + + {lq__event_session_obj.code} + + + {/if} +
    • +
    • + + Date & + + : + + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id - }); - // $events_trigger = 'load__event_session_obj_id'; - // $events_trig_kv['event_session_id'] = lq__event_session_obj?.event_session_id; - }} - > - {ae_util.iso_datetime_formatter(lq__event_session_obj.start_datetime, 'dddd')}, - {ae_util.iso_datetime_formatter( - lq__event_session_obj.start_datetime, - $events_loc.pres_mgmt.datetime_format - )} - - - - { - console.log(`ae_crud_updated:`, e.detail); + events_func.load_ae_obj_id__event_session({ + api_cfg: $ae_api, + event_session_id: lq__event_session_obj?.event_session_id + }); + // $events_trigger = 'load__event_session_obj_id'; + // $events_trig_kv['event_session_id'] = lq__event_session_obj?.event_session_id; + }} + > + {ae_util.iso_datetime_formatter(lq__event_session_obj.start_datetime, 'dddd')}, + {ae_util.iso_datetime_formatter( + lq__event_session_obj.start_datetime, + $events_loc.pres_mgmt.datetime_format + )} + + - + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id - }); - // $events_trigger = 'load__event_session_obj_id'; - // $events_trig_kv['event_session_id'] = lq__event_session_obj?.event_session_id; - }} - > - {ae_util.iso_datetime_formatter( - lq__event_session_obj.end_datetime, - $events_loc.pres_mgmt.time_format - )} - -
    • -
    • - Location/room: - + events_func.load_ae_obj_id__event_session({ + api_cfg: $ae_api, + event_session_id: lq__event_session_obj?.event_session_id + }); + // $events_trigger = 'load__event_session_obj_id'; + // $events_trig_kv['event_session_id'] = lq__event_session_obj?.event_session_id; + }} + > + {ae_util.iso_datetime_formatter( + lq__event_session_obj.end_datetime, + $events_loc.pres_mgmt.time_format + )} + +
    • +
    • + Location/room: + - {#if $events_loc.pres_mgmt?.hide__launcher_link_legacy && $events_loc.pres_mgmt?.hide__launcher_link && !$ae_loc.edit_mode} - - {lq__event_session_obj?.event_location_name ?? '-- not set --'} - - {/if} + {#if $events_loc.pres_mgmt?.hide__launcher_link_legacy && $events_loc.pres_mgmt?.hide__launcher_link && !$ae_loc.edit_mode} + + {lq__event_session_obj?.event_location_name ?? '-- not set --'} + + {/if} - - - - {@html lq__event_session_obj?.event_location_name - ? lq__event_session_obj?.event_location_name - : ae_snip.html__not_set} - + + + + {@html lq__event_session_obj?.event_location_name + ? lq__event_session_obj?.event_location_name + : ae_snip.html__not_set} + - - - - - + + + + + - - - - - + + + + + - {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - { - console.log(`ae_crud_updated:`, e.detail); + {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id, - log_lvl: 1 - }) - .then(function (load_results) { - ae_tmp.event_location_id = null; - ae_tmp.show__edit_event_location = false; - }); - }} - > - {#if ae_tmp?.show__edit_location} - {#await $slct.event_location_obj_li} - - {:then event_location_obj_li} - - {/await} + {/await} - - {:else} - + {:else} + - {/if} - - {/if} -
    • -
    • - - {$events_loc.pres_mgmt?.label__session_poc_name}: - - {#if lq__event_session_obj?.poc_person_id} - {#if $ae_loc.manager_access} - - {@html lq__event_session_obj?.poc_person_full_name - ? lq__event_session_obj.poc_person_full_name - : ae_snip.html__not_set} - - {/if} + return load_results; + }) + .finally(function () { + console.log(`Finally...`); + ae_tmp.event_location_id = + lq__event_session_obj?.event_location_id; + ae_tmp.show__edit_event_location = true; + }); + }} + class="btn btn-sm preset-tonal-warning group" + > + + + + {/if} + + {/if} +
    • +
    • + + {$events_loc.pres_mgmt?.label__session_poc_name}: + + {#if lq__event_session_obj?.poc_person_id} + {#if $ae_loc.manager_access} + + {@html lq__event_session_obj?.poc_person_full_name + ? lq__event_session_obj.poc_person_full_name + : ae_snip.html__not_set} + + {/if} - {#if $ae_loc.trusted_access || $events_loc.auth__kv.session[lq__event_session_obj?.event_session_id] === true} - - + {#if $ae_loc.trusted_access || $events_loc.auth__kv.session[lq__event_session_obj?.event_session_id] === true} + + - - - + + + - {#snippet footer()} -
      - -
      - {/snippet} -
      + {#snippet footer()} +
      + +
      + {/snippet} +
      - {#if $events_loc.pres_mgmt?.require__session_agree} - - + {#if $events_loc.pres_mgmt?.require__session_agree} + + - - - + + + - {#snippet footer()} -
      - -
      - {/snippet} -
      - {/if} + {#snippet footer()} +
      + +
      + {/snippet} +
      + {/if} - - {:else} - - {@html lq__event_session_obj.poc_person_full_name - ? lq__event_session_obj.poc_person_full_name - : ae_snip.html__not_set} - - {/if} - {:else} - {@html ae_snip.html__not_set} - {/if} + + {:else} + + {@html lq__event_session_obj.poc_person_full_name + ? lq__event_session_obj.poc_person_full_name + : ae_snip.html__not_set} + + {/if} + {:else} + {@html ae_snip.html__not_set} + {/if} - + - - {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - { - console.log(`ae_crud_updated:`, e.detail); + {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id, - log_lvl: 0 - }) - .then(function (load_results) { - ae_tmp.poc_person_id = null; - ae_tmp.show__edit_poc_person = false; + events_func + .load_ae_obj_id__event_session({ + api_cfg: $ae_api, + event_session_id: lq__event_session_obj?.event_session_id, + log_lvl: 0 + }) + .then(function (load_results) { + ae_tmp.poc_person_id = null; + ae_tmp.show__edit_poc_person = false; - // Maybe reload page? - // window.location.reload(); - }); - }} - > - {#if ae_tmp?.show__edit_poc_person} - {#await $slct.person_obj_li} - - {:then person_obj_li} - - {/await} - {/if} + // Maybe reload page? + // window.location.reload(); + }); + }} + > + {#if ae_tmp?.show__edit_poc_person} + {#await $slct.person_obj_li} + + {:then person_obj_li} + + {/await} + {/if} - {#if ae_tmp.show__edit_poc_person} - - {:else} - + {:else} + - {/if} - - {/if} + ae_tmp.poc_person_id = lq__event_session_obj?.poc_person_id; + ae_tmp.show__edit_poc_person = true; + }} + class="btn btn-sm preset-tonal-warning group" + > + + + + {/if} + + {/if} - - {#if $events_loc.auth__kv.session[$events_slct.event_session_id] === true} - Signed In - {/if} - {#if $events_loc.pres_mgmt?.require__session_agree && $events_loc?.pres_mgmt?.show__email_access_link && lq__event_session_obj?.poc_person_primary_email && ($ae_loc.trusted_access || !$events_loc.auth__kv.session[lq__event_session_obj?.event_session_id])} - - {/if} + events_func.email_sign_in__event_session({ + api_cfg: $ae_api, + to_email: lq__event_session_obj.poc_person_primary_email, + to_name: + lq__event_session_obj?.poc_person_full_name ?? + '-- not set --', + base_url: $ae_loc.url_origin, + person_id: lq__event_session_obj?.poc_person_id, + person_passcode: + lq__event_session_obj?.poc_person_passcode ?? + '-- not set --', + event_id: lq__event_session_obj?.event_id, + event_session_id: lq__event_session_obj?.event_session_id, + session_name: lq__event_session_obj?.name ?? '-- not set --' + }); + }} + class="btn btn-sm preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500" + title="Email the access link to the POC (moderator/champion)" + > + + Email Access Link + + {/if} - {#if $events_loc.pres_mgmt?.show__copy_access_link && $ae_loc.trusted_access && lq__event_session_obj.poc_person_id} - - + {#if $events_loc.pres_mgmt?.show__copy_access_link && $ae_loc.trusted_access && lq__event_session_obj.poc_person_id} + + - - {/if} - -
    • + + {/if} + + - {#if $ae_loc.administrator_access} -
    • - Session passcode: - - {@html lq__event_session_obj.passcode - ? lq__event_session_obj.passcode - : ae_snip.html__not_set} - { - console.log(`ae_crud_updated:`, e.detail); + {#if $ae_loc.administrator_access} +
    • + + Session passcode: + + + {@html lq__event_session_obj.passcode + ? lq__event_session_obj.passcode + : ae_snip.html__not_set} + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id, - log_lvl: 1 - }) - .then(function (load_results) {}); - }} - > -
    • - {/if} + events_func + .load_ae_obj_id__event_session({ + api_cfg: $ae_api, + event_session_id: lq__event_session_obj?.event_session_id, + log_lvl: 1 + }) + .then(function (load_results) {}); + }} + > + + {/if} -
    • -
      - { - console.log(`ae_crud_updated:`, e.detail); +
    • +
      + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_session({ - api_cfg: $ae_api, - event_session_id: lq__event_session_obj?.event_session_id, - log_lvl: 1 - }); - }} - > - Session description: + events_func.load_ae_obj_id__event_session({ + api_cfg: $ae_api, + event_session_id: lq__event_session_obj?.event_session_id, + log_lvl: 1 + }); + }} + > + + Session description: + - {#if lq__event_session_obj.description} - + {#if lq__event_session_obj.description} + -
      {lq__event_session_obj.description}
      - {:else} - {@html ae_snip.html__not_set} - {/if} -
      -
      -
    • -
    +
    {lq__event_session_obj.description}
    + {:else} + {@html ae_snip.html__not_set} + {/if} +
    + +
  • +
- -
+ - -
- {#if $lq__event_presentation_obj_li && $lq__event_presentation_obj_li?.length > 0} - - {/if} -
+ +
+ {#if $lq__event_presentation_obj_li && $lq__event_presentation_obj_li?.length > 0} + + {/if} +
{/if} diff --git a/src/routes/events/ae_comp__event_file_obj_tbl_wrapper.svelte b/src/routes/events/ae_comp__event_file_obj_tbl_wrapper.svelte index 8d93552f..6a62c46e 100644 --- a/src/routes/events/ae_comp__event_file_obj_tbl_wrapper.svelte +++ b/src/routes/events/ae_comp__event_file_obj_tbl_wrapper.svelte @@ -1,143 +1,145 @@ {#if event_file_obj_li && event_file_obj_li?.length} - - + + {:else} -
-

No files available to show in table.

-
+
+

No files available to show in table.

+
{/if} diff --git a/src/routes/events/ae_comp__event_files_upload.svelte b/src/routes/events/ae_comp__event_files_upload.svelte index 847b36fb..33ef9ad8 100644 --- a/src/routes/events/ae_comp__event_files_upload.svelte +++ b/src/routes/events/ae_comp__event_files_upload.svelte @@ -1,311 +1,311 @@
- {#await ae_promises.upload__hosted_file_obj} -
- - - Uploading - {#if $ae_sess.api_upload_kv[task_id]} - {$ae_sess.api_upload_kv[task_id].percent_completed}% - {/if} - -
- {/await} + {#await ae_promises.upload__hosted_file_obj} +
+ + + Uploading + {#if $ae_sess.api_upload_kv[task_id]} + {$ae_sess.api_upload_kv[task_id].percent_completed}% + {/if} + +
+ {/await} -
- + class:hidden={$events_sess.files.disable_submit__event_file_obj} + > + {#if label}{@render label()}{:else} +
+ + + + Upload files + +
+
+ Presentation related files only
+ (PowerPoint, Keynote, PDF, mp4, Word Doc, Excel, txt, etc) +
+ {/if} + - -
+ /> + - + - + {@html $events_sess.files.processed_file_list.length == 1 + ? `${$events_sess.files.processed_file_list.length}× file` + : `${$events_sess.files.processed_file_list.length}× files`} + {:else} + No files selected + {/if} + + + {/await} + diff --git a/src/routes/events/ae_comp__event_presentation_obj_li.svelte b/src/routes/events/ae_comp__event_presentation_obj_li.svelte index 794414d7..01b708a3 100644 --- a/src/routes/events/ae_comp__event_presentation_obj_li.svelte +++ b/src/routes/events/ae_comp__event_presentation_obj_li.svelte @@ -1,59 +1,59 @@
-
- {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - - {/if} -
+ events_func.create_ae_obj__event_presentation({ + api_cfg: $ae_api, + event_id: $events_slct.event_id, + event_session_id: $events_slct.event_session_id, + data_kv: presentation_data, + log_lvl: 1 + }); + }} + class="btn btn-sm preset-tonal-warning hover:preset-filled-warning-500" + > + + Add Presentation + + {/if} + - + -

- - Presentations: +

+ + Presentations: - {#if $lq__event_presentation_obj_li?.length} - - - {$lq__event_presentation_obj_li.length ?? 'None'}× - - {/if} + {#if $lq__event_presentation_obj_li?.length} + + + {$lq__event_presentation_obj_li.length ?? 'None'}× + + {/if} - - -

+
+

- - {#if $lq__event_presentation_obj_li?.length} -
    - {#each $lq__event_presentation_obj_li as event_presentation_obj} -
  • -
    - {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - - {/if} -
    + events_func.create_ae_obj__event_presenter({ + api_cfg: $ae_api, + event_id: $events_slct.event_id, + event_session_id: $events_slct.event_session_id, + event_presentation_id: + event_presentation_obj.event_presentation_id, + data_kv: presenter_data, + log_lvl: 1 + }); + }} + class="btn btn-sm preset-tonal-warning hover:preset-filled-warning-500" + > + + Add Presenter + + {/if} + -

    - - {ae_util.iso_datetime_formatter(event_presentation_obj.start_datetime, 'dddd')} - @ - - - {ae_util.iso_datetime_formatter( - event_presentation_obj.start_datetime, - $events_loc.pres_mgmt.time_format - )} - +

    + + {ae_util.iso_datetime_formatter( + event_presentation_obj.start_datetime, + 'dddd' + )} + @ + + + {ae_util.iso_datetime_formatter( + event_presentation_obj.start_datetime, + $events_loc.pres_mgmt.time_format + )} + - { - console.log(`ae_crud_updated:`, e.detail); + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_presentation({ - api_cfg: $ae_api, - event_presentation_id: event_presentation_obj.event_presentation_id, - log_lvl: 1 - }) - .then(function (load_results) {}) - .then(function (load_results) { - // $events_trigger = 'load__event_presentation_obj_id'; - // $events_trig_kv['event_presentation_id'] = event_presentation_obj.event_presentation_id; - }); - }} - > - - - {event_presentation_obj?.name} - - - + events_func + .load_ae_obj_id__event_presentation({ + api_cfg: $ae_api, + event_presentation_id: + event_presentation_obj.event_presentation_id, + log_lvl: 1 + }) + .then(function (load_results) {}) + .then(function (load_results) { + // $events_trigger = 'load__event_presentation_obj_id'; + // $events_trig_kv['event_presentation_id'] = event_presentation_obj.event_presentation_id; + }); + }} + > + + + {event_presentation_obj?.name} + + + - { - console.log(`ae_crud_updated:`, e.detail); + { + console.log(`ae_crud_updated:`, e.detail); - events_func - .load_ae_obj_id__event_presentation({ - api_cfg: $ae_api, - event_presentation_id: event_presentation_obj.event_presentation_id, - log_lvl: 1 - }) - .then(function (load_results) {}) - .then(function (load_results) { - // $events_trigger = 'load__event_presentation_obj_id'; - // $events_trig_kv['event_presentation_id'] = event_presentation_obj.event_presentation_id; - }); - }} - > - {#if (event_presentation_obj?.code || event_presentation_obj?.abstract_code) && !$events_loc.pres_mgmt.hide__presentation_code} - - - {event_presentation_obj?.code ?? ''} - {event_presentation_obj?.abstract_code ?? ''} - - {:else if $ae_loc.trusted_access && $ae_loc.edit_mode} - - - Code: - - {@html event_presentation_obj?.code ?? ae_snip.html__not_set} - - - {/if} - - -

    + events_func + .load_ae_obj_id__event_presentation({ + api_cfg: $ae_api, + event_presentation_id: + event_presentation_obj.event_presentation_id, + log_lvl: 1 + }) + .then(function (load_results) {}) + .then(function (load_results) { + // $events_trigger = 'load__event_presentation_obj_id'; + // $events_trig_kv['event_presentation_id'] = event_presentation_obj.event_presentation_id; + }); + }} + > + {#if (event_presentation_obj?.code || event_presentation_obj?.abstract_code) && !$events_loc.pres_mgmt.hide__presentation_code} + + + {event_presentation_obj?.code ?? ''} + {event_presentation_obj?.abstract_code ?? ''} + + {:else if $ae_loc.trusted_access && $ae_loc.edit_mode} + + + Code: + + {@html event_presentation_obj?.code ?? + ae_snip.html__not_set} + + + {/if} + + + -
    - - Date & - - : - - { - console.log(`ae_crud_updated:`, e.detail); +
    + + Date & + + : + + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_presentation({ - api_cfg: $ae_api, - event_presentation_id: event_presentation_obj?.event_presentation_id - }); - // $events_trigger = 'load__event_presentation_obj_id'; - // $events_trig_kv['event_presentation_id'] = event_presentation_obj?.event_presentation_id; - }} - > - {ae_util.iso_datetime_formatter(event_presentation_obj.start_datetime, 'dddd')} - - - {ae_util.iso_datetime_formatter( - event_presentation_obj.start_datetime, - $events_loc.pres_mgmt.time_format - )} - - - - { - console.log(`ae_crud_updated:`, e.detail); + events_func.load_ae_obj_id__event_presentation({ + api_cfg: $ae_api, + event_presentation_id: + event_presentation_obj?.event_presentation_id + }); + // $events_trigger = 'load__event_presentation_obj_id'; + // $events_trig_kv['event_presentation_id'] = event_presentation_obj?.event_presentation_id; + }} + > + {ae_util.iso_datetime_formatter( + event_presentation_obj.start_datetime, + 'dddd' + )} + + + {ae_util.iso_datetime_formatter( + event_presentation_obj.start_datetime, + $events_loc.pres_mgmt.time_format + )} + + - + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_presentation({ - api_cfg: $ae_api, - event_presentation_id: event_presentation_obj?.event_presentation_id - }); - // $events_trigger = 'load__event_presentation_obj_id'; - // $events_trig_kv['event_presentation_id'] = event_presentation_obj?.event_presentation_id; - }} - > - {ae_util.iso_datetime_formatter( - event_presentation_obj.end_datetime, - $events_loc.pres_mgmt.time_format - )} - -
    + events_func.load_ae_obj_id__event_presentation({ + api_cfg: $ae_api, + event_presentation_id: + event_presentation_obj?.event_presentation_id + }); + // $events_trigger = 'load__event_presentation_obj_id'; + // $events_trig_kv['event_presentation_id'] = event_presentation_obj?.event_presentation_id; + }} + > + {ae_util.iso_datetime_formatter( + event_presentation_obj.end_datetime, + $events_loc.pres_mgmt.time_format + )} +
    +
    -
    - { - console.log(`ae_crud_updated:`, e.detail); +
    + { + console.log(`ae_crud_updated:`, e.detail); - events_func.load_ae_obj_id__event_presentation({ - api_cfg: $ae_api, - event_presentation_id: event_presentation_obj.event_presentation_id, - log_lvl: 1 - }); - }} - > - Description: + events_func.load_ae_obj_id__event_presentation({ + api_cfg: $ae_api, + event_presentation_id: + event_presentation_obj.event_presentation_id, + log_lvl: 1 + }); + }} + > + + Description: + - {#if event_presentation_obj?.description} - + // Was testing with LiveQuery + $events_slct.event_presentation_id = + event_presentation_obj.event_presentation_id; + } + }} + class="btn btn-sm preset-tonal-surface hover:preset-filled-surface-500 text-xs" + > + {#if $events_sess.pres_mgmt.show_content__presentation_description == event_presentation_obj.event_presentation_id} + + Hide Description + {:else} + + Show + {/if} + -
    {event_presentation_obj.description}
    - {:else} - {@html ae_snip.html__not_set} - {/if} - -
    -
    +
    +
    - - {#if event_presentation_obj?.event_presentation_id} - - {/if} + + {#if event_presentation_obj?.event_presentation_id} + + {/if} - - -
  • - {/each} -
- {:else} - + + + {/each} + + {:else} + - {/if} + {/if}
diff --git a/src/routes/events/ae_comp__event_session_obj_li.svelte b/src/routes/events/ae_comp__event_session_obj_li.svelte index 558954df..d2bb5a64 100644 --- a/src/routes/events/ae_comp__event_session_obj_li.svelte +++ b/src/routes/events/ae_comp__event_session_obj_li.svelte @@ -1,90 +1,90 @@
- {#if $lq__event_session_obj_li && $lq__event_session_obj_li?.length} -

- Sessions: + {#if $lq__event_session_obj_li && $lq__event_session_obj_li?.length} +

+ Sessions: - {#if $lq__event_session_obj_li?.length} - - - {$lq__event_session_obj_li.length ?? 'None'}× - - {/if} -

+ {#if $lq__event_session_obj_li?.length} + + + {$lq__event_session_obj_li.length ?? 'None'}× + + {/if} + - - - - - - - - - - - - - - {#each $lq__event_session_obj_li as session_obj, index} - - + + {/each} + +
SessionDate - Times - - Location POC Admin
- {#if session_obj?.alert && $ae_loc.trusted_access} - - {/if} + + + + + + + + + + + + + + {#each $lq__event_session_obj_li as session_obj, index} + + - - + {#if show__session_files && $ae_loc.manager_access} + + {/if} + + + - + > + + + + + {/if} + + - + > + + + + + {/if} + + + - - - {/each} - -
SessionDate + Times + + Location POC + Admin +
+ {#if session_obj?.alert && $ae_loc.trusted_access} + + {/if} - - - - - --> + + + - - {session_obj?.name} - - - {#if session_obj?.file_count_all} - - - {session_obj?.file_count_all}× - - {:else} - - {/if} - + > + + {session_obj?.name} + + + {#if session_obj?.file_count_all} + + + {session_obj?.file_count_all}× + + {:else} + + {/if} + - {#if show__session_presentations && $ae_loc.manager_access} - - {/if} + {#if show__session_presentations && $ae_loc.manager_access} + + {/if} - {#if show__session_files && $ae_loc.manager_access} - - {/if} - - - - {ae_util.iso_datetime_formatter(session_obj?.start_datetime, 'dddd')} - - - {ae_util.iso_datetime_formatter( - session_obj?.start_datetime, - 'date_long_month_day' - )} - - - - - {#if session_obj?.start_datetime} - - {ae_util.iso_datetime_formatter(session_obj?.start_datetime, 'time_12_short')} - - - - {ae_util.iso_datetime_formatter(session_obj?.end_datetime, 'time_12_short')} - - {:else} - {@html ae_snip.html__not_set} - {/if} - - + + + {ae_util.iso_datetime_formatter( + session_obj?.start_datetime, + 'dddd' + )} + + + {ae_util.iso_datetime_formatter( + session_obj?.start_datetime, + 'date_long_month_day' + )} + + + + + {#if session_obj?.start_datetime} + + {ae_util.iso_datetime_formatter( + session_obj?.start_datetime, + 'time_12_short' + )} + + + + {ae_util.iso_datetime_formatter( + session_obj?.end_datetime, + 'time_12_short' + )} + + {:else} + {@html ae_snip.html__not_set} + {/if} + + - - - - - {session_obj?.event_location_name ?? '-- not set --'} - - + + + + + + {session_obj?.event_location_name ?? '-- not set --'} + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - {#if $ae_loc.edit_mode && $ae_loc.trusted_access} - - {/if} + {#if $ae_loc.edit_mode && $ae_loc.trusted_access} + + {/if} - {#if $events_sess.pres_mgmt.show__edit_location[session_obj?.event_session_id_random]} - - {:else if $ae_loc.edit_mode} - - {/if} - - - - {#if session_obj?.poc_person_full_name} - - - {session_obj?.poc_person_full_name} - - - {#if $ae_loc.trusted_access && session_obj?.poc_person_primary_email} - - - - {session_obj?.poc_person_primary_email} - - - {/if} - {:else} - {@html ae_snip.html__not_set} - {/if} + + + {#if session_obj?.poc_person_full_name} + + + {session_obj?.poc_person_full_name} + + + {#if $ae_loc.trusted_access && session_obj?.poc_person_primary_email} + + + + {session_obj?.poc_person_primary_email} + + + {/if} + {:else} + {@html ae_snip.html__not_set} + {/if} - {#if $ae_loc.edit_mode && $ae_loc.administrator_access} - + {#if $ae_loc.edit_mode && $ae_loc.administrator_access} + - - {/if} - - - - - + - - + + + - - + title={session_obj?.hide_event_launcher + ? 'Show in event launcher' + : 'Hide from event launcher'} + > + + {#if session_obj?.hide_event_launcher} + + {:else} + + + {/if} + - - -
- - {:else} -

- - No results to show. Please use the search above to find your session. - -

- - - - - - - {/if} + title={session_obj?.alert ? 'Remove alert status' : 'Mark as alert'} + > + {#if session_obj?.alert} + + + {:else} + + {/if} + + +
+ + {:else} +

+ + No results to show. Please use the search above to find your session. + +

+ + + + + + + {/if}
diff --git a/src/routes/events/ae_comp__event_session_obj_li_wrapper.svelte b/src/routes/events/ae_comp__event_session_obj_li_wrapper.svelte index f7538534..4a851a9f 100644 --- a/src/routes/events/ae_comp__event_session_obj_li_wrapper.svelte +++ b/src/routes/events/ae_comp__event_session_obj_li_wrapper.svelte @@ -1,87 +1,89 @@ diff --git a/src/routes/events/ae_comp__event_session_obj_tbl.svelte b/src/routes/events/ae_comp__event_session_obj_tbl.svelte index b4bf8d55..1c04f1c7 100644 --- a/src/routes/events/ae_comp__event_session_obj_tbl.svelte +++ b/src/routes/events/ae_comp__event_session_obj_tbl.svelte @@ -1,125 +1,128 @@
- {#if $lq__event_session_obj_li && $lq__event_session_obj_li?.length} -
-

- Results: + {#if $lq__event_session_obj_li && $lq__event_session_obj_li?.length} +
+

+ Results: - {#if $lq__event_session_obj_li?.length} - - - {$lq__event_session_obj_li.length ?? 'None'}× - - {/if} -

+ {#if $lq__event_session_obj_li?.length} + + + {$lq__event_session_obj_li.length ?? 'None'}× + + {/if} +

- - - - - - {#if show_location_fields} - - {/if} - - - - - - {#each $lq__event_session_obj_li as event_session_obj, index} - - - - {#if show_location_fields} - - {/if} - - - - {/each} - -
NameStart DatetimeLocationSession FilesPresenter Files
- - {event_session_obj?.name} - - - {ae_util.iso_datetime_formatter( - event_session_obj?.start_datetime, - 'datetime_iso_12_no_seconds' - )} - - {event_session_obj?.event_location_name} - - {event_session_obj?.file_count ?? '0'} - - {event_session_obj?.file_count_all ?? '0'} -
-
- {:else} -

No sessions available to show.

- {/if} + + + + + + {#if show_location_fields} + + {/if} + + + + + + {#each $lq__event_session_obj_li as event_session_obj, index} + + + + {#if show_location_fields} + + {/if} + + + + {/each} + +
NameStart DatetimeLocationSession FilesPresenter Files
+ + {event_session_obj?.name} + + + {ae_util.iso_datetime_formatter( + event_session_obj?.start_datetime, + 'datetime_iso_12_no_seconds' + )} + + {event_session_obj?.event_location_name} + + {event_session_obj?.file_count ?? '0'} + + {event_session_obj?.file_count_all ?? '0'} +
+ + {:else} +

No sessions available to show.

+ {/if}
diff --git a/src/routes/events/ae_comp__event_session_obj_tbl_wrapper.svelte b/src/routes/events/ae_comp__event_session_obj_tbl_wrapper.svelte index 8d5e49e4..65fd3198 100644 --- a/src/routes/events/ae_comp__event_session_obj_tbl_wrapper.svelte +++ b/src/routes/events/ae_comp__event_session_obj_tbl_wrapper.svelte @@ -1,140 +1,142 @@ {#if event_session_obj_li && event_session_obj_li?.length} - + {:else} -
-

No sessions available to show in table.

-
+
+

No sessions available to show in table.

+
{/if} diff --git a/src/routes/events/ae_comp__events_menu_nav.svelte b/src/routes/events/ae_comp__events_menu_nav.svelte index d5af3ac9..6fed722b 100644 --- a/src/routes/events/ae_comp__events_menu_nav.svelte +++ b/src/routes/events/ae_comp__events_menu_nav.svelte @@ -1,97 +1,97 @@ diff --git a/src/routes/events/ae_comp__events_menu_opts.svelte b/src/routes/events/ae_comp__events_menu_opts.svelte index f41af150..91026e3a 100644 --- a/src/routes/events/ae_comp__events_menu_opts.svelte +++ b/src/routes/events/ae_comp__events_menu_opts.svelte @@ -1,669 +1,678 @@
-

- -

+

+ +

-
- {#if $ae_loc.authenticated_access} -
- - - - - - - +
+ {#if $ae_loc.authenticated_access} +
+ + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - - - {#if $ae_loc.manager_access} - - {/if} - -
- {/if} + + + {#if $ae_loc.manager_access} + + {/if} + +
+ {/if} -
- +
+ - {#if $ae_loc.authenticated_access} - {#if !$events_loc.pres_mgmt.hide__session_msg} - - {:else} - - {/if} - {/if} + {#if $ae_loc.authenticated_access} + {#if !$events_loc.pres_mgmt.hide__session_msg} + + {:else} + + {/if} + {/if} - {#if $ae_loc.authenticated_access} - - {#if !$events_loc.pres_mgmt.hide__session_code} - - {:else} - - {/if} - {/if} -
+ {#if $ae_loc.authenticated_access} + + {#if !$events_loc.pres_mgmt.hide__session_code} + + {:else} + + {/if} + {/if} +
-
- {#if $ae_loc.trusted_access} -
- {#if $events_loc.pres_mgmt.show__copy_access_link} - - {:else} - - {/if} +
+ {#if $ae_loc.trusted_access} +
+ {#if $events_loc.pres_mgmt.show__copy_access_link} + + {:else} + + {/if} - {#if $events_loc.pres_mgmt.show__email_access_link} - - {:else} - - {/if} -
- {/if} + {#if $events_loc.pres_mgmt.show__email_access_link} + + {:else} + + {/if} +
+ {/if} - {#if $ae_loc.authenticated_access} -
- {#if $events_loc.pres_mgmt.show_content__session_qr} - - {:else} - - {/if} + {#if $ae_loc.authenticated_access} +
+ {#if $events_loc.pres_mgmt.show_content__session_qr} + + {:else} + + {/if} - {#if $events_loc.pres_mgmt.show_content__presenter_qr} - - {:else} - - {/if} -
- {/if} -
+ {#if $events_loc.pres_mgmt.show_content__presenter_qr} + + {:else} + + {/if} +
+ {/if} +
- {#if $ae_loc.authenticated_access} -
- - + {#if $ae_loc.authenticated_access} +
+ + - - + + - - + + - - + + - - + + - - - {#if $events_loc.pres_mgmt.show_content__session_files} - - {:else} - - {/if} + + + {#if $events_loc.pres_mgmt.show_content__session_files} + + {:else} + + {/if} - {#if $events_loc.pres_mgmt.show_content__session_presentations} - - {:else} - - {/if} - -
- {/if} + {#if $events_loc.pres_mgmt.show_content__session_presentations} + + {:else} + + {/if} + +
+ {/if} -
- {#if $ae_loc?.trusted_access} - {#if $ae_loc?.edit_mode} - - {:else} - - {/if} +
+ {#if $ae_loc?.trusted_access} + {#if $ae_loc?.edit_mode} + + {:else} + + {/if} - {#if $ae_loc?.adv_mode} - - {:else} - - {/if} - {/if} -
-
+ {#if $ae_loc?.adv_mode} + + {:else} + + {/if} + {/if} +
+
diff --git a/src/routes/events_badges/+layout.svelte b/src/routes/events_badges/+layout.svelte index 0286c577..93b70c41 100644 --- a/src/routes/events_badges/+layout.svelte +++ b/src/routes/events_badges/+layout.svelte @@ -1,133 +1,133 @@ - Events Badges - {$events_loc.title ?? 'Æ loading...'} + Events Badges - {$events_loc.title ?? 'Æ loading...'} diff --git a/src/routes/events_badges/+layout.ts b/src/routes/events_badges/+layout.ts index 3672e94d..3fc79f06 100644 --- a/src/routes/events_badges/+layout.ts +++ b/src/routes/events_badges/+layout.ts @@ -4,53 +4,53 @@ console.log(`ae_events_badges +layout.ts start`); import { events_func } from '$lib/ae_events_functions'; export async function load({ parent }) { - const data = await parent(); - // console.log(`ae_events_badges +layout.ts data:`, data); + const data = await parent(); + // console.log(`ae_events_badges +layout.ts data:`, data); - const account_id = data.account_id; - const ae_acct = data[account_id]; - console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + console.log(`ae_acct = `, ae_acct); - if (!account_id) { - console.log(`events_badges +layout.ts: The account_id was not found in the data!!!`); - return false; - } + if (!account_id) { + console.log(`events_badges +layout.ts: The account_id was not found in the data!!!`); + return false; + } - const event_id = ae_acct.slct.event_id; - if (!event_id) { - console.log(`events_badges +layout.ts: The event_id was not found in the data!!!`); - return false; - } + const event_id = ae_acct.slct.event_id; + if (!event_id) { + console.log(`events_badges +layout.ts: The event_id was not found in the data!!!`); + return false; + } - const load_event_obj = events_func.load_ae_obj_id__event({ - api_cfg: ae_acct.api, - event_id: event_id, - try_cache: true - }); + const load_event_obj = events_func.load_ae_obj_id__event({ + api_cfg: ae_acct.api, + event_id: event_id, + try_cache: true + }); - ae_acct.slct.event_obj = load_event_obj; + ae_acct.slct.event_obj = load_event_obj; - const submenu = { - main: { name: 'Main', href: '/events_badges', access: false }, - // manage: {name: 'Manage', href: '/events_badges/manage', access: 'administrator', disable: true, hide: true}, - review: { - name: 'Review', - href: '/events_badges/review', - access: false, - disable: false, - hide: false - } - // print: {name: 'Print', href: '/events_badges/print', access: 'trusted', disable: true, hide: false}, - // view: {name: 'View', href: '/events_badges/view', access: 'trusted', hide: true}, // event_badge_id - // new: {name: 'New', href: '/events_badges/new'}, - // sponsorships: {name: 'Sponsorships', href: '/sponsorships', disable: true, hide: true}, - }; - data.submenu = submenu; + const submenu = { + main: { name: 'Main', href: '/events_badges', access: false }, + // manage: {name: 'Manage', href: '/events_badges/manage', access: 'administrator', disable: true, hide: true}, + review: { + name: 'Review', + href: '/events_badges/review', + access: false, + disable: false, + hide: false + } + // print: {name: 'Print', href: '/events_badges/print', access: 'trusted', disable: true, hide: false}, + // view: {name: 'View', href: '/events_badges/view', access: 'trusted', hide: true}, // event_badge_id + // new: {name: 'New', href: '/events_badges/new'}, + // sponsorships: {name: 'Sponsorships', href: '/sponsorships', disable: true, hide: true}, + }; + data.submenu = submenu; - // WARNING: Precaution against shared data between sites and sessions. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and sessions. + data[account_id] = ae_acct; - return data; + return data; } // export const prerender = false; diff --git a/src/routes/events_badges/+page.svelte b/src/routes/events_badges/+page.svelte index f1c6f8e6..03f40713 100644 --- a/src/routes/events_badges/+page.svelte +++ b/src/routes/events_badges/+page.svelte @@ -1,54 +1,54 @@
-

Badges for ISHLT 2024 ({$events_slct.event_id})

+

Badges for ISHLT 2024 ({$events_slct.event_id})

-

Restricted Access

-

Accessing the badge printing for ISHLT 2024 is currently restricted

+

Restricted Access

+

Accessing the badge printing for ISHLT 2024 is currently restricted

- + - - {#if $ae_loc.iframe} - - header -

Review & Print
Your Badge

-
- {:else} -
-

Badge Review and Print

-
- {/if} + + {#if $ae_loc.iframe} + + header +

Review & Print
Your Badge

+
+ {:else} +
+

Badge Review and Print

+
+ {/if} -
- {#if $events_sess.badges.show_form__search} -
{ - $events_trigger = 'load__event_badge_obj_li'; - }} - autocomplete="off" - class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full" - > - {#if $ae_loc.trusted_access && badge_type_code_li} -
- -
- {/if} +
+ {#if $events_sess.badges.show_form__search} + { + $events_trigger = 'load__event_badge_obj_li'; + }} + autocomplete="off" + class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full" + > + {#if $ae_loc.trusted_access && badge_type_code_li} +
+ +
+ {/if} - - { - if ($events_sess.badges.fulltext_search_qry_str.length >= 3) { - $events_trigger = 'load__event_badge_obj_li'; - } - }} - autofocus - suggest="off" - data-lpignore="true" - /> + { + if ($events_sess.badges.fulltext_search_qry_str.length >= 3) { + $events_trigger = 'load__event_badge_obj_li'; + } + }} + autofocus + suggest="off" + data-lpignore="true" + /> - - + + - - {:else if $events_sess.badges.show_form__scan} - + {:else if $events_sess.badges.show_form__scan} + - - - + + + - - - - + + + - - {/if} - + + {/if} + -
- {#if $events_sess.badges.show_form__search} - - {:else if $events_sess.badges.show_form__scan} - - {/if} -
-
+ $events_sess.badges.show_form__search = false; + $events_sess.badges.show_form__search_results = false; + $events_sess.badges.show_form__scan = true; + $events_sess.badges.qr_scan_start = true; + }} + class="btn btn-sm preset-tonal-primary border border-primary-500" + > + + QR Scan + + {:else if $events_sess.badges.show_form__scan} + + {/if} +
+ - {#await load_obj_li_results} - - - Loading... - - {:then load_obj_li_results} - {#if load_obj_li_results} - - Loaded - {/if} - {/await} + {#await load_obj_li_results} + + + Loading... + + {:then load_obj_li_results} + {#if load_obj_li_results} + + Loaded + {/if} + {/await} - {#if $events_sess.badges.show_form__search} - {#if $events_slct?.badge_obj_li.length} - -
-

Results:

- - - - - - - - - - - - {#each $events_slct.badge_obj_li as badge_obj} - - = 1 || badge_obj.hide) && - !$ae_loc.trusted_access} - class:fade_50={(badge_obj.print_count >= 1 || badge_obj.hide) && - $ae_loc.trusted_access} - > - + + {/each} + +
BadgeEmail / Affiliations / LocationBadge Type
- + + + +
+
+ {:else} +
+ Type your name, email, or affiliations. Results will start to appear automatically. +
- {#if $events_sess.badges.fulltext_search_qry_str && $events_sess.badges.fulltext_search_qry_str.length > 5} -
- No badges found. Please change your search. -
- {/if} - {/if} - {:else if $events_sess.badges.show_form__scan} -
-
+ No badges found. Please change your search. +
+ {/if} + {/if} + {:else if $events_sess.badges.show_form__scan} +
+
-
-

Scan

+ > +
+

Scan

-
-
- -
+
+
+ +
- -
-
+ $events_slct.badge_id = null; + $events_slct.badge_obj = null; + }} + > + + Close + +
+ -
- +
+ -
- {@html $events_sess.badges.qr_scan_result ?? 'No results yet'} -
+
+ {@html $events_sess.badges.qr_scan_result ?? 'No results yet'} +
- {#if $events_slct.badge_id && $events_slct.badge_obj} -

Badge ID: {$events_slct.badge_obj.event_badge_id_random}

- {/if} -
- -
- - - {/if} + {#if $events_slct.badge_id && $events_slct.badge_obj} +

+ Badge ID: {$events_slct.badge_obj.event_badge_id_random} +

+ {/if} +
+ + + + + {/if} - - {#if $ae_loc.iframe} - - header -

Review & Print
Your Badge

-
- {:else} -
-

Badge Review and Print

-
- {/if} + + {#if $ae_loc.iframe} + + header +

Review & Print
Your Badge

+
+ {:else} +
+

Badge Review and Print

+
+ {/if} -
- {#if $events_sess.badges.show_form__search} -
{ - $events_trigger = 'load__event_badge_obj_li'; - }} - autocomplete="off" - class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full" - > - {#if $ae_loc.trusted_access && badge_type_code_li} -
- -
- {/if} +
+ {#if $events_sess.badges.show_form__search} + { + $events_trigger = 'load__event_badge_obj_li'; + }} + autocomplete="off" + class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full" + > + {#if $ae_loc.trusted_access && badge_type_code_li} +
+ +
+ {/if} - - { - if ($events_sess.badges.fulltext_search_qry_str.length >= 3) { - $events_trigger = 'load__event_badge_obj_li'; - } - }} - autofocus - suggest="off" - data-lpignore="true" - /> + { + if ($events_sess.badges.fulltext_search_qry_str.length >= 3) { + $events_trigger = 'load__event_badge_obj_li'; + } + }} + autofocus + suggest="off" + data-lpignore="true" + /> - - + + - - {:else if $events_sess.badges.show_form__scan} - + {:else if $events_sess.badges.show_form__scan} + - - - + + + - - - - + + + - - {/if} - + + {/if} + -
- {#if $events_sess.badges.show_form__search} - - {:else if $events_sess.badges.show_form__scan} - - {/if} -
-
+ $events_sess.badges.show_form__search = false; + $events_sess.badges.show_form__search_results = false; + $events_sess.badges.show_form__scan = true; + $events_sess.badges.qr_scan_start = true; + }} + class="btn btn-sm preset-tonal-primary border border-primary-500" + > + + QR Scan + + {:else if $events_sess.badges.show_form__scan} + + {/if} +
+ - {#await load_obj_li_results} - - - Loading... - - {:then load_obj_li_results} - {#if load_obj_li_results} - - Loaded - {/if} - {/await} + {#await load_obj_li_results} + + + Loading... + + {:then load_obj_li_results} + {#if load_obj_li_results} + + Loaded + {/if} + {/await} - {#if $events_sess.badges.show_form__search} - {#if $events_slct?.badge_obj_li.length} - -
-

Results:

- - - - - - - - - - - - {#each $events_slct.badge_obj_li as badge_obj} - - = 1 || badge_obj.hide) && - !$ae_loc.trusted_access} - class:fade_50={(badge_obj.print_count >= 1 || badge_obj.hide) && - $ae_loc.trusted_access} - > - + + {/each} + +
BadgeEmail / Affiliations / LocationBadge Type
- + + + +
+
+ {:else} +
+ Type your name, email, or affiliations. Results will start to appear automatically. +
- {#if $events_sess.badges.fulltext_search_qry_str && $events_sess.badges.fulltext_search_qry_str.length > 5} -
- No badges found. Please change your search. -
- {/if} - {/if} - {:else if $events_sess.badges.show_form__scan} -
-
+ No badges found. Please change your search. +
+ {/if} + {/if} + {:else if $events_sess.badges.show_form__scan} +
+
-
-

Scan

+ > +
+

Scan

-
-
- -
+
+
+ +
- -
-
+ $events_slct.badge_id = null; + $events_slct.badge_obj = null; + }} + > + + Close + +
+ -
- +
+ -
- {@html $events_sess.badges.qr_scan_result ?? 'No results yet'} -
+
+ {@html $events_sess.badges.qr_scan_result ?? 'No results yet'} +
- {#if $events_slct.badge_id && $events_slct.badge_obj} -

Badge ID: {$events_slct.badge_obj.event_badge_id_random}

- {/if} -
- -
- - - {/if} + {#if $events_slct.badge_id && $events_slct.badge_obj} +

+ Badge ID: {$events_slct.badge_obj.event_badge_id_random} +

+ {/if} + + + + + + {/if} - + - {#if $event_exhibit_obj_li} -

Select your exhibit from the list

- -
-
{ - $events_sess.leads.open_href = `/events_leads/exhibit/${$events_slct.exhibit_obj.id_random}?event_id=${$events_slct.event_id}`; - goto($events_sess.leads.open_href, { invalidateAll: true }); - }} - class="flex flex-col items-center border border-slate-500/10 p-2" - > - - -
- Select your exhibit booth from the list and enter passcode you were given. If it is - correct you will be taken to the page for your exhibit. -
+
+ { + $events_sess.leads.open_href = `/events_leads/exhibit/${$events_slct.exhibit_obj.id_random}?event_id=${$events_slct.event_id}`; + goto($events_sess.leads.open_href, { invalidateAll: true }); + }} + class="flex flex-col items-center border border-slate-500/10 p-2" + > + + +
+ Select your exhibit booth from the list and enter passcode you were given. If it + is correct you will be taken to the page for your exhibit. +
-
- +
-
- +
+ - + - -
- +
+ - {#if $ae_loc.administrator_access && !$events_loc.show_details} -
- - + {#if $ae_loc.administrator_access && !$events_loc.show_details} +
+ + - - -
- {/if} -
+ + +
+ {/if} +
- - {/if} + {/if} - - - {#if $events_slct.exhibit_id && $event_exhibit_obj} - + {#if $events_slct.exhibit_id && $event_exhibit_obj} + - - - {#if $events_loc.leads.show_option__paid_tab ?? true} - - {/if} + {/if} - - - + - - + - - + - + - - {#if $events_loc.leads.tab[$events_slct.exhibit_id] === 'start'} -
-
-

- - {$event_exhibit_obj?.name ?? 'Welcome to Leads for Exhibits!'} - # {$event_exhibit_obj?.code ?? ''} -

-

- {#if $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} - - {$events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} - - {:else if $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id]} - - No license key selected - {:else} - - Enter the shared exhibit passcode - {/if} -

-
+ + {#if $events_loc.leads.tab[$events_slct.exhibit_id] === 'start'} +
+
+

+ + {$event_exhibit_obj?.name ?? 'Welcome to Leads for Exhibits!'} + # {$event_exhibit_obj?.code ?? ''} +

+

+ {#if $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} + + {$events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} + + {:else if $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id]} + + No license key selected + {:else} + + Enter the shared exhibit passcode + {/if} +

+
- {#if $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} -

- You are logged in using the shared exhibit staff passcode and are using the license key - for {$events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key}. Any leads you - collect will be associated with this license key (email address). Use the Clear License - button to "log out" or Sign In with a different license. -

- {:else if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} -

- Please select your name from the license list below to use the lead retrieval service. - You may need to add your name first. This is also used to link new leads to whoever adds - them. -

- {:else} -

- To access this exhibit you must enter the shared staff passcode that you were given. You - will then be able to select a license and use the lead retrieval service from your - device. -

- - {/if} + {#if $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} +

+ You are logged in using the shared exhibit staff passcode and are using the + license key for {$events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id] + .key}. Any leads you collect will be associated with this license key + (email address). Use the Clear License button to "log out" or Sign In with a + different license. +

+ {:else if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} +

+ Please select your name from the license list below to use the lead + retrieval service. You may need to add your name first. This is also used to + link new leads to whoever adds them. +

+ {:else} +

+ To access this exhibit you must enter the shared staff passcode that you + were given. You will then be able to select a license and use the lead + retrieval service from your device. +

+ + {/if} - {#if $events_loc?.leads.auth_exhibit_kv && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id]} - - {#if $event_exhibit_obj?.license_max} -

License List (max {$event_exhibit_obj?.license_max})

+ {#if $events_loc?.leads.auth_exhibit_kv && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id]} + + {#if $event_exhibit_obj?.license_max} +

License List (max {$event_exhibit_obj?.license_max})

-
- Use the "Sign In" or "Email" option buttons below to log in using one of the available - licenses. Be sure use the one with your name and email address. If you select a - license that is already in use on another device, it will be logged out. -
    -
  • - "Sign In" option - Use this to sign and use the license with your - current browser and device. -
  • -
  • - "Email" option - Use this to send an email with a link to log in. - You may want to use this to send the link to other staff associated with this - exhibit. -
  • -
-
+
+ Use the "Sign In" or "Email" option buttons below to log in using one of + the available licenses. Be sure use the one with your name and email + address. If you select a license that is already in use on another + device, it will be logged out. +
    +
  • + "Sign In" option - Use this to sign and use the + license with your current browser and device. +
  • +
  • + "Email" option - Use this to send an email with + a link to log in. You may want to use this to send the link to + other staff associated with this exhibit. +
  • +
+
- {#if !Array.isArray($event_exhibit_obj?.license_li_json) || (Array.isArray($event_exhibit_obj?.license_li_json) && $event_exhibit_obj?.license_li_json.length < $event_exhibit_obj?.license_max)} - - {/if} - + $events_sess.leads.show_form__license = true; + }} + > + + Add License + + {/if} + -
-
{ - console.log('Save License List'); - handle_submit_form(event); - }} - id="form__license_table" - class="p-0 m-0" - > - +
+ { + console.log('Save License List'); + handle_submit_form(event); + }} + id="form__license_table" + class="p-0 m-0" + > + - + - {#if Array.isArray($event_exhibit_obj?.license_li_json) && $event_exhibit_obj?.license_li_json.length > 0} - - - - - - - - - - {#if $events_loc.show_details} - - {/if} - - - - - - + {#if Array.isArray($event_exhibit_obj?.license_li_json) && $event_exhibit_obj?.license_li_json.length > 0} +
LicenseInfoSave { - $events_loc.leads.show_meta__event_exhibit_obj = - !$events_loc.leads.show_meta__event_exhibit_obj; - }}>Meta
+ + + + + + + + + {#if $events_loc.show_details} + + {/if} + + + + + + - - {#each $event_exhibit_obj?.license_li_json as license, index} - - - + + + $ae_loc.iframe = true; + } + } + }} + class="btn btn-sm text-sm preset-tonal-primary" + title="Sign in using this license" + > + + Sign In + + + + + {:else} +
+ + Disabled license +
+ {/if} + -
+ + {license.passcode} + + + - + $events_sess.leads.show_form__license = true; + }} + class="btn btn-sm preset-tonal-warning" + > + + Edit + + + + - {#if $events_loc.show_details} - - {/if} - - {/each} - -
LicenseInfoSave { + $events_loc.leads.show_meta__event_exhibit_obj = + !$events_loc.leads + .show_meta__event_exhibit_obj; + }}>Meta
- + + {#each $event_exhibit_obj?.license_li_json as license, index} +
+ - {#if index < $event_exhibit_obj?.license_max} - - -
- - - -
- {:else} -
- - Disabled license -
- {/if} -
- -
-
- {license.full_name} - {license.email} -
+ > +
+ {license.full_name} + {license.email} +
- - {license.passcode} - -
-
- -
- - -
-
- -
-
- Updated On: - {license.updated_on} -
-
- Created On: - {license.created_on} -
-
- Expires On: - {license.expires_on} -
-
-
- {:else} -
No licenses found. Add a license above.
- {/if} - - - - -
- - {/if} - - {/if} -
- + {#if $events_loc.show_details} + + +
+
+ Updated On: + {license.updated_on} +
+
+ Created On: + {license.created_on} +
+
+ Expires On: + {license.expires_on} +
+
+ + {/if} + + {/each} + + + {:else} +
+ No licenses found. Add a license above. +
+ {/if} + + + + +
+ + {/if} + + {/if} +
+ - - {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'add_scan'} - + + {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'add_scan'} + - - {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'leads'} - + + {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'leads'} + - - {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'manage'} - + + {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'manage'} + - - {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'payment'} - - {/if} - - - {/if} - + + {:else if $events_loc.leads.tab[$events_slct.exhibit_id] == 'payment'} + + {/if} + + + {/if} + {#if $events_sess.leads.show_form__license} -
-
+
-
-

Edit License

+ > +
+

Edit License

-
- -
-
+
+ +
+
-
-
- - - -
- Do not use the same email address for more than one license. The email address - is used as the key to log in and is linked to leads added. The full name is used to help - identify the staff person. -
- + +
+ Do not use the same email address for more than one license. The email address is used as the key to log in and is linked to leads added. + The full name is used to help identify the staff person. +
+ - + - {#if $ae_loc.trusted_access} - - {/if} -
-
- + {#if $ae_loc.trusted_access} + + {/if} + +
+ -
-
- + $events_sess.leads.show_form__license = false; + } + }} + class:hidden={$events_sess.leads.tmp_license.index === null} + class="btn preset-tonal-warning m-1" + > + + Remove + - -
+ +
-
- - {#await license_submit_results} - - {:then license_submit_results} - {#if license_submit_results} -
- - Saved -
- {/if} - {/await} +
+ + {#await license_submit_results} + + {:then license_submit_results} + {#if license_submit_results} +
+ + Saved +
+ {/if} + {/await} -
- submit: {$events_sess?.leads.submit_status__license} - - -
-
+
+ submit: {$events_sess?.leads.submit_status__license} + + +
+
-
- -
- - - - - +
+ +
+ + + + + {/if} diff --git a/src/routes/events_leads/exhibit/[slug]/+page.ts b/src/routes/events_leads/exhibit/[slug]/+page.ts index 0dc52f48..ae6b64e6 100644 --- a/src/routes/events_leads/exhibit/[slug]/+page.ts +++ b/src/routes/events_leads/exhibit/[slug]/+page.ts @@ -4,55 +4,55 @@ console.log(`ae_events_leads [slug] +page.ts start`); import { events_func } from '$lib/ae_events_functions'; export async function load({ params, parent }) { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - // console.log(`ae_events_leads exhibit [slug] +page.ts data:`, data); + const data = await parent(); + // console.log(`ae_events_leads exhibit [slug] +page.ts data:`, data); - const account_id = data.account_id; - const ae_acct = data[account_id]; - console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + console.log(`ae_acct = `, ae_acct); - if (!account_id) { - console.log( - `events_leads exhibit [slug] +page.ts: The account_id was not found in the data!!!` - ); - return false; - } + if (!account_id) { + console.log( + `events_leads exhibit [slug] +page.ts: The account_id was not found in the data!!!` + ); + return false; + } - data.ae_events_leads_exhibit_slug_page_ts = true; + data.ae_events_leads_exhibit_slug_page_ts = true; - const event_exhibit_id = params.slug; - if (!event_exhibit_id) { - console.log( - `events_leads exhibit [slug] +page.ts: The event_exhibit_id was not found in the params.slug!!!` - ); - return false; - } + const event_exhibit_id = params.slug; + if (!event_exhibit_id) { + console.log( + `events_leads exhibit [slug] +page.ts: The event_exhibit_id was not found in the params.slug!!!` + ); + return false; + } - ae_acct.slct.event_exhibit_id = event_exhibit_id; + ae_acct.slct.event_exhibit_id = event_exhibit_id; - const load_event_exhibit_obj = events_func.handle_load_ae_obj_id__exhibit({ - api_cfg: ae_acct.api, - exhibit_id: event_exhibit_id, - try_cache: false - }); + const load_event_exhibit_obj = events_func.handle_load_ae_obj_id__exhibit({ + api_cfg: ae_acct.api, + exhibit_id: event_exhibit_id, + try_cache: false + }); - ae_acct.slct.event_exhibit_obj = await load_event_exhibit_obj; + ae_acct.slct.event_exhibit_obj = await load_event_exhibit_obj; - const load_event_exhibit_tracking_obj_li = events_func.handle_load_ae_obj_li__exhibit_tracking({ - api_cfg: ae_acct.api, - exhibit_id: event_exhibit_id, - params: { enabled: 'all', qry__limit: 550 }, - try_cache: false - }); - console.log(`load_event_exhibit_tracking_obj_li = `, load_event_exhibit_tracking_obj_li); + const load_event_exhibit_tracking_obj_li = events_func.handle_load_ae_obj_li__exhibit_tracking({ + api_cfg: ae_acct.api, + exhibit_id: event_exhibit_id, + params: { enabled: 'all', qry__limit: 550 }, + try_cache: false + }); + console.log(`load_event_exhibit_tracking_obj_li = `, load_event_exhibit_tracking_obj_li); - ae_acct.slct.event_exhibit_tracking_obj_li = load_event_exhibit_tracking_obj_li; + ae_acct.slct.event_exhibit_tracking_obj_li = load_event_exhibit_tracking_obj_li; - // WARNING: Precaution against shared data between sites and sessions. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and sessions. + data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/events_leads/exhibit/[slug]/leads_add_scan.svelte b/src/routes/events_leads/exhibit/[slug]/leads_add_scan.svelte index 8ca52631..ebc9f272 100644 --- a/src/routes/events_leads/exhibit/[slug]/leads_add_scan.svelte +++ b/src/routes/events_leads/exhibit/[slug]/leads_add_scan.svelte @@ -1,229 +1,229 @@
- {#if $events_loc?.leads.auth_exhibit_kv && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id]} - {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} -
- Leads for: - {$events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} -
- {:else} -
- Please go to the Main tab and select a license to use. -
- {/if} + {#if $events_loc?.leads.auth_exhibit_kv && $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id]} + {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} +
+ Leads for: + {$events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} +
+ {:else} +
+ Please go to the Main tab and select a license to use. +
+ {/if} - + -

- - {#if $ae_loc.hub.qr.camera_status == 'unknown'} - You will need to allow access to your device's camera when asked. - {:else if $ae_loc.hub.qr.camera_status == 'denied'} - You need to allow access to your device's camera. Currently this seems to be blocked or - denied for this site. - Please check your browser's permissions. - {/if} -

- + {#if $ae_loc.hub.qr.camera_status == 'unknown'} + You will need to allow access to your device's camera when asked. + {:else if $ae_loc.hub.qr.camera_status == 'denied'} + You need to allow access to your device's camera. Currently this seems to be + blocked or denied for this site. + Please check your browser's permissions. + {/if} +

+ - - + + - - + + - - {#if $events_loc.leads.show_content__scan_alert} - - {:else if !$events_loc.leads.show_content__scan_alert} - - {/if} + + {#if $events_loc.leads.show_content__scan_alert} + + {:else if !$events_loc.leads.show_content__scan_alert} + + {/if} - + - + - {#if $events_loc.leads.show_content__scan_requirements} - - {:else if !$events_loc.leads.show_content__scan_requirements} - - {/if} - + {#if $events_loc.leads.show_content__scan_requirements} + + {:else if !$events_loc.leads.show_content__scan_requirements} + + {/if} + - {#if $events_loc.leads.show_content__scan_alert} -
- - - Alert - Use Scanner Version: - + {#if $events_loc.leads.show_content__scan_alert} +
+ + + Alert + Use Scanner Version: + -

- A bug was found late Monday that affects some mobile devices (cell phones and tablets). - Incremental fixes have been added, but this issue has been difficult to address across - all devices. We recommend most users stick with v1 (default). If you are not having any - trouble and have no idea what this message is about, then this is what you want. -

-

- We recommend you try v2 if you are having trouble with the camera not starting or - turning on. This version allows you to manually attempt to Allow Camera Access and to - Start Scanning if it does not start on its own. This fix is not perfect. A permanent - solution is actively being worked on in the development version. -

-

A fix is in progress to address all devices. -2024-04-10 2:25 AM (Prague time)

-
-
- {/if} - {#if $events_loc.leads.show_content__scan_requirements} -
-

- You will need a device with a camera to scan the QR codes. You will also of course need - one or more valid QR codes to scan. - -

-
    -
  • - Most laptops, workstations, Android phones/tablets, iPhones, and iPads are compatible -
  • -
  • - The device must have a current (within the last 4 years) web browser such as Google - Chrome, Mozilla Firefox, Apple's Safari, or Microsoft Edge. Opera is not yet fully - supported. -
  • -
  • There is no Android or Apple app that needs to be installed!
  • -
  • - The device must have a camera for scanning or you will need to manually enter attendee - badge IDs. -
  • -
  • - The only permission you need to allow is access to your device's camera when asked. -
  • -
-
- {:else} - - {/if} - {:else} - -
Not logged in. Please log in and select a user license.
- {/if} - +

+ A bug was found late Monday that affects some mobile devices (cell phones + and tablets). Incremental fixes have been added, but this issue has been + difficult to address across all devices. We recommend most users stick with + v1 (default). If you are not having any trouble and have no idea what this + message is about, then this is what you want. +

+

+ We recommend you try v2 if you are having trouble with the camera not + starting or turning on. This version allows you to manually attempt to Allow + Camera Access and to Start Scanning if it does not start on its own. This + fix is not perfect. A permanent solution is actively being worked on in the + development version. +

+

+ A fix is in progress to address all devices. -2024-04-10 2:25 AM (Prague + time) +

+
+
+ {/if} + {#if $events_loc.leads.show_content__scan_requirements} +
+

+ You will need a device with a camera to scan the QR codes. You will also of + course need one or more valid QR codes to scan. + +

+
    +
  • + Most laptops, workstations, Android phones/tablets, iPhones, and iPads are + compatible +
  • +
  • + The device must have a current (within the last 4 years) web browser such as + Google Chrome, Mozilla Firefox, Apple's Safari, or Microsoft Edge. Opera is + not yet fully supported. +
  • +
  • There is no Android or Apple app that needs to be installed!
  • +
  • + The device must have a camera for scanning or you will need to manually + enter attendee badge IDs. +
  • +
  • + The only permission you need to allow is access to your device's camera when + asked. +
  • +
+
+ {:else} + + {/if} + {:else} + +
+ Not logged in. Please log in and select a user license. +
+ {/if} +
{#if $events_sess.leads.show_form__search} -
-
+
+ {/if} -
- - - - {#if $event_exhibit_obj?.priority || $ae_loc.trusted_access} - {event_badge_obj_v2.full_name} - {:else} - - {event_badge_obj_v2.full_name - ? event_badge_obj_v2.full_name.substring(0, 1) + '...' - : 'Hidden'} - - {/if} - - - - {#if $event_exhibit_obj?.priority || $ae_loc.trusted_access} - {event_badge_obj_v2.affiliations} - {:else} - - {event_badge_obj_v2.affiliations - ? event_badge_obj_v2.affiliations.substring(0, 3) + '...' - : 'Hidden'} - - {/if} - - - -
- - {/each} - + + + {#if $event_exhibit_obj?.priority || $ae_loc.trusted_access} + {event_badge_obj_v2.full_name} + {:else} + + {event_badge_obj_v2.full_name + ? event_badge_obj_v2.full_name.substring( + 0, + 1 + ) + '...' + : 'Hidden'} + + {/if} + + + + {#if $event_exhibit_obj?.priority || $ae_loc.trusted_access} + {event_badge_obj_v2.affiliations} + {:else} + + {event_badge_obj_v2.affiliations + ? event_badge_obj_v2.affiliations.substring( + 0, + 3 + ) + '...' + : 'Hidden'} + + {/if} + + + + + + {/each} + - - - {:else} -
No results yet
- {/if} - - - + {:else} +
No results yet
+ {/if} + + + -
-
- -
+
+
+ +
-
- - {#await search_submit_results} - - {:then search_submit_results} - {#if search_submit_results} -
- - Complete +
+ + {#await search_submit_results} + + {:then search_submit_results} + {#if search_submit_results} +
+ + Complete - - ( - {$events_slct.badge_obj_li.length} results - {#if $ae_loc.trusted_access} - & - {$event_badge_obj_li.length} cached - {/if} - ) - -
- {/if} - {/await} + + ( + {$events_slct.badge_obj_li.length} results + {#if $ae_loc.trusted_access} + & + {$event_badge_obj_li.length} cached + {/if} + ) + +
+ {/if} + {/await} -
- submit: {$events_sess?.leads.submit_status__search} -
-
+
+ submit: {$events_sess?.leads.submit_status__search} +
+
-
- -
-
- - - - - +
+ +
+
+ + + + + {/if} @@ -774,9 +843,9 @@ {#if $events_sess.leads.show_form__scan} -
-
+
-
-

Scan

+ > +
+

Scan

-
- -
-
+ $events_sess.leads.qr_scan_result = null; + }} + > + + Close + +
+ -
- {#if !$ae_loc.qr_scanner_version || $ae_loc.qr_scanner_version == 'one'} - - {:else if $ae_loc.qr_scanner_version == 'two'} - - + - {:else} -

Please close this and select a QR Scanner version

- {/if} + {:else} +

Please close this and select a QR Scanner version

+ {/if} -
- {$events_sess.leads.qr_scan_result ?? 'No results yet'} -
+
+ {$events_sess.leads.qr_scan_result ?? 'No results yet'} +
- - - {#if $events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] && $event_badge_obj} -
-
+
-
-

Add Scanned?

+ > +
+

Add Scanned?

-
- -
-
+ $events_sess.leads.qr_scan_result = null; + }} + > + + Close + +
+ -
-

- Are you sure you want to add {$event_badge_obj.full_name} to the leads - list? -

-

Badge ID: {$event_badge_obj.event_badge_id_random}

-
- + $events_sess.leads.qr_scan_result = null; + }} + > + + No + - -
-
- -
- - - {/if} - - + // $events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false; + }} + > + + Yes + + + + + + + + {/if} + + -
- -
- - + -
- submit: {$events_sess?.leads.submit_status__scan} -
-
+
+ submit: {$events_sess?.leads.submit_status__scan} +
+ -
- -
-
- - - - - + $events_sess.leads.qr_scan_result = null; + }} + > + + Close + + + + + + + + {/if} diff --git a/src/routes/events_leads/exhibit/[slug]/leads_manage.svelte b/src/routes/events_leads/exhibit/[slug]/leads_manage.svelte index 37bbab63..8b020405 100644 --- a/src/routes/events_leads/exhibit/[slug]/leads_manage.svelte +++ b/src/routes/events_leads/exhibit/[slug]/leads_manage.svelte @@ -1,636 +1,640 @@
-

- - Login and License -

+

+ + Login and License +

- {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} -
-

- - {#if $event_exhibit_obj?.priority} - Leads license(s) marked as paid for this - exhibit! - {:else} - The leads license have not been marked as paid yet. If you have already paid, please - wait and this will be reflected here within 48 business hours. - {/if} - -

+ {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} +
+

+ + {#if $event_exhibit_obj?.priority} + Leads license(s) marked as + paid for this exhibit! + {:else} + The leads license have not been marked as paid yet. If you have already + paid, please wait and this will be reflected here within 48 business hours. + {/if} + +

-

- Exhibit name: {$events_slct.exhibit_obj.name} # {$events_slct.exhibit_obj.code} -

+

+ Exhibit name: {$events_slct.exhibit_obj.name} # {$events_slct.exhibit_obj.code} +

-
- Logged in and using license for: - {#if $event_exhibit_obj?.license_li_json} - - {#each $event_exhibit_obj?.license_li_json as license, index} - {#if license.email === $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} -
- Name: - {license.full_name} -
- {/if} - {/each} - - {/if} -
- Email: - {$events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} - -
-
- Started: - {ae_util.iso_datetime_formatter( - $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].updated_on, - 'datetime_12_long' - )} -
-
+
+ Logged in and using license for: + {#if $event_exhibit_obj?.license_li_json} + + {#each $event_exhibit_obj?.license_li_json as license, index} + {#if license.email === $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} +
+ Name: + {license.full_name} +
+ {/if} + {/each} + + {/if} +
+ Email: + {$events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} + +
+
+ Started: + {ae_util.iso_datetime_formatter( + $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].updated_on, + 'datetime_12_long' + )} +
+
- - + + - -
- {:else if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} -
- You are logged in using the shared passcode for the exhibit. You will want to select a license - to fully use this lead retrieval service. Please go to the Main tab and select a license to - use. -
+ +
+ {:else if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} +
+ You are logged in using the shared passcode for the exhibit. You will want to select a + license to fully use this lead retrieval service. Please go to the Main tab and select a + license to use. +
- - {:else} -
- Please go to the Main tab to login using the shared staff passcode for this exhibit. Then - select a license to use. -
- {/if} + + {:else} +
+ Please go to the Main tab to login using the shared staff passcode for this exhibit. + Then select a license to use. +
+ {/if} - - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit({ - api_cfg: $ae_api, - exhibit_id: $events_slct.exhibit_id - }); - }} - > - Shared exhibit passcode: - {$events_slct.exhibit_obj.staff_passcode} - {#if $ae_loc.administrator_access} - - - {/if} - + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit({ + api_cfg: $ae_api, + exhibit_id: $events_slct.exhibit_id + }); + }} + > + Shared exhibit passcode: + {$events_slct.exhibit_obj.staff_passcode} + {#if $ae_loc.administrator_access} + + + {/if} + - - - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit({ - api_cfg: $ae_api, - exhibit_id: $events_slct.exhibit_id - }); - }} - > - {#if !$event_exhibit_obj?.priority} - Not Paid: - - - Waiting for payment - {:else} - Paid: - - - Marked as paid - {/if} + + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit({ + api_cfg: $ae_api, + exhibit_id: $events_slct.exhibit_id + }); + }} + > + {#if !$event_exhibit_obj?.priority} + Not Paid: + + + Waiting for payment + {:else} + Paid: + + + Marked as paid + {/if} - {#if $ae_loc.administrator_access} - - {/if} - + {#if $ae_loc.administrator_access} + + {/if} + - -
- {#if $event_exhibit_obj?.priority} - {#if $events_loc.leads.show_option__paid_tab} - - {:else} - - {/if} - {/if} -
+ +
+ {#if $event_exhibit_obj?.priority} + {#if $events_loc.leads.show_option__paid_tab} + + {:else} + + {/if} + {/if} +
- - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit({ - api_cfg: $ae_api, - exhibit_id: $events_slct.exhibit_id - }); - }} - > - Max licenses: - {#if $events_slct.exhibit_obj?.license_max} - {$events_slct.exhibit_obj.license_max} - {:else} - 0 - {/if} - {#if $ae_loc.administrator_access} - - - {/if} - + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit({ + api_cfg: $ae_api, + exhibit_id: $events_slct.exhibit_id + }); + }} + > + Max licenses: + {#if $events_slct.exhibit_obj?.license_max} + {$events_slct.exhibit_obj.license_max} + {:else} + 0 + {/if} + {#if $ae_loc.administrator_access} + + + {/if} + - - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit({ - api_cfg: $ae_api, - exhibit_id: $events_slct.exhibit_id - }); - }} - > - Small devices: - {#if $events_slct.exhibit_obj?.leads_device_sm_qty} - {$events_slct.exhibit_obj.leads_device_sm_qty} - {:else} - 0 - {/if} - {#if $ae_loc.administrator_access} - - - {/if} - + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit({ + api_cfg: $ae_api, + exhibit_id: $events_slct.exhibit_id + }); + }} + > + Small devices: + {#if $events_slct.exhibit_obj?.leads_device_sm_qty} + + {$events_slct.exhibit_obj.leads_device_sm_qty} + {:else} + 0 + {/if} + {#if $ae_loc.administrator_access} + + + {/if} + - - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit({ - api_cfg: $ae_api, - exhibit_id: $events_slct.exhibit_id - }); - }} - > - Large devices: - {#if $events_slct.exhibit_obj?.leads_device_lg_qty} - {$events_slct.exhibit_obj.leads_device_lg_qty} - {:else} - 0 - {/if} - {#if $ae_loc.administrator_access} - - - {/if} - + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit({ + api_cfg: $ae_api, + exhibit_id: $events_slct.exhibit_id + }); + }} + > + Large devices: + {#if $events_slct.exhibit_obj?.leads_device_lg_qty} + + {$events_slct.exhibit_obj.leads_device_lg_qty} + {:else} + 0 + {/if} + {#if $ae_loc.administrator_access} + + + {/if} + - + - {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} -
+ {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id] && $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id].key} +
-

- - Export Data -

+

+ + Export Data +

-

- Use this to export the leads data for this exhibit to an Excel file format. The data can be - downloaded at anytime using the export button below. The data exported to exhibitors will - likely be these fields: given/first name, family/last name, professional title, affiliations, - email, city, state/province, country. The exact fields exported sometimes changes slightly - from meeting to meeting. -

- - {/if} - + {:then} + + {/await} + Export Data + + {/if} + -
+
-

- - Additional Settings -

+

+ + Additional Settings +

-
- List refresh interval in seconds: - -
+
+ List refresh interval in seconds: + +
-
- - +
+ + - -
+ +
- {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} -
- Auto hide header/footer on sign in: - -
+ {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} +
+ Auto hide header/footer on sign in: + +
-
- Turn on iframe mode: - -
+
+ Turn on iframe mode: + +
-
- Show or hide additional details: - -
+
+ Show or hide additional details: + +
- - {:else} -
You must be logged in to view this tab.
- {/if} - + {:else} +
You must be logged in to view this tab.
+ {/if} +
diff --git a/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte b/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte index d21ee08c..705b3283 100644 --- a/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte +++ b/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte @@ -1,193 +1,196 @@
-

- - Payment -

+

+ + Payment +

- {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} - {#if $event_exhibit_obj?.priority} -

Marked as Paid

+ {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} + {#if $event_exhibit_obj?.priority} +

Marked as Paid

-
-

- Thank you for your payment. You have purchased {$event_exhibit_obj?.license_max} user license(s) - for the lead retrieval service with your booth at ISHLT 2024 in Prague. -

+
+

+ Thank you for your payment. You have purchased {$event_exhibit_obj?.license_max} + user license(s) for the lead retrieval service with your booth at ISHLT 2024 in Prague. +

- {#if $event_exhibit_obj?.leads_device_sm_qty > 0} -

- You have also rented {$event_exhibit_obj?.leads_device_sm_qty} tablet(s) for using with the - lead retrievals. You will be able to pick up your rental tablets at ISHLT's onsite registration. -

- {:else} -

- You have not rented any tablets for scanning. You can use your own device(s) with this - service. -

- {/if} + {#if $event_exhibit_obj?.leads_device_sm_qty > 0} +

+ You have also rented {$event_exhibit_obj?.leads_device_sm_qty} tablet(s) for + using with the lead retrievals. You will be able to pick up your rental tablets + at ISHLT's onsite registration. +

+ {:else} +

+ You have not rented any tablets for scanning. You can use your own device(s) + with this service. +

+ {/if} -

- To save space while using this app you can hide this payment tab now that you have paid - for your licenses. This can be unhidden under the Conf(ig) tab if needed. -

-
+

+ To save space while using this app you can hide this payment tab now that you + have paid for your licenses. This can be unhidden under the Conf(ig) tab if + needed. +

+
- - {:else} -

Not Marked as Paid

+ + {:else} +

Not Marked as Paid

-
-

- Please select the number of licenses to purchase and if you need to rent any tablets for - scanning. As a reminder, you can use your own device (cell phone, tablet, laptop, etc) to - scan the QR codes on the badges of the attendees. Tablet rentals are limited in supply for - ISHLT 2024 in Prague and will be given out on a first come first served basis. -

-
+
+

+ Please select the number of licenses to purchase and if you need to rent any + tablets for scanning. As a reminder, you can use your own device (cell phone, + tablet, laptop, etc) to scan the QR codes on the badges of the attendees. Tablet + rentals are limited in supply for ISHLT 2024 in Prague and will be given out on + a first come first served basis. +

+
- + -
- -

- Each person associated with your exhibit needs a license to use the lead retrieval service - for exhibitors. -

-
+
+ +

+ Each person associated with your exhibit needs a license to use the lead + retrieval service for exhibitors. +

+
- - - - + + - - + -
- -

- You can use your own device(s) with this service. Renting tablets for scanning is not - required. -

-
+
+ +

+ You can use your own device(s) with this service. Renting tablets for scanning + is not required. +

+
- + - - + - {#if $events_sess.stripe.btn_payment_id} -
- - -

- You have selected to purchase {$events_sess.stripe.license_qty} user license(s) and rent - {$events_sess.stripe.rental_qty} tablet(s). Press the button above to pay by credit card, - debit card, or ACH direct debit. -

-

- WARNING: Please be sure to double check and update the quantities on the - next page. -

-
- {/if} + {#if $events_sess.stripe.btn_payment_id} +
+ + +

+ You have selected to purchase {$events_sess.stripe.license_qty} user license(s) + and rent + {$events_sess.stripe.rental_qty} tablet(s). Press the button above to pay by + credit card, debit card, or ACH direct debit. +

+

+ WARNING: Please be sure to double check and update the quantities + on the next page. +

+
+ {/if} -
-

- NOTE: Your payment will be reviewed and is not reflected immediately on - this page for your exhibit. It may take up to 2 business days for this to show as being - paid. If you have any questions or concerns please email - exhibits@oneskyit.com. -

-
+
+

+ NOTE: Your payment will be reviewed and is not reflected + immediately on this page for your exhibit. It may take up to 2 business days for + this to show as being paid. If you have any questions or concerns please email + exhibits@oneskyit.com. +

+
- - - - - + - - - - - - {/if} - {:else} -
- Please go to the Main tab to login using the shared staff passcode for this exhibit. Then - select a license to use. -
- {/if} + + {/if} + {:else} +
+ Please go to the Main tab to login using the shared staff passcode for this exhibit. + Then select a license to use. +
+ {/if}
diff --git a/src/routes/events_leads/exhibit/[slug]/leads_view_lead.svelte b/src/routes/events_leads/exhibit/[slug]/leads_view_lead.svelte index 4c3fe7fb..793bbd4b 100644 --- a/src/routes/events_leads/exhibit/[slug]/leads_view_lead.svelte +++ b/src/routes/events_leads/exhibit/[slug]/leads_view_lead.svelte @@ -1,144 +1,144 @@
-
-
-

- Lead: - {#if $event_exhibit_tracking_obj?.priority} - - {:else} - - {/if} + > +
+

+ Lead: + {#if $event_exhibit_tracking_obj?.priority} + + {:else} + + {/if} - {$event_exhibit_tracking_obj?.event_badge_full_name} - - {$event_exhibit_tracking_obj?.event_exhibit_tracking_id_random} - -

+ {$event_exhibit_tracking_obj?.event_badge_full_name} + + {$event_exhibit_tracking_obj?.event_exhibit_tracking_id_random} + +

- {#if $events_sess.leads.lead_data_changed} - - {/if} + {#if $events_sess.leads.lead_data_changed} + + {/if} - {#await ae_promises.update__exhibit_tracking_obj} - - {:then update__exhibit_tracking_obj} - - {#if $events_sess.leads.lead_data_changed === false} - - {/if} - - {:catch error} - - {/await} + {#await ae_promises.update__exhibit_tracking_obj} + + {:then update__exhibit_tracking_obj} + + {#if $events_sess.leads.lead_data_changed === false} + + {/if} + + {:catch error} + + {/await} -
- -
-
+
+ +
+ -
-
- +
+
+ - {#if $event_exhibit_tracking_obj?.event_badge_professional_title || $event_exhibit_tracking_obj?.event_badge_professional_title_override} -
- Titles (degrees, credentials): - - {#if $event_exhibit_tracking_obj?.event_badge_professional_title_override} - {$event_exhibit_tracking_obj?.event_badge_professional_title_override} - {:else} - {$event_exhibit_tracking_obj?.event_badge_professional_title} - {/if} - -
- {/if} + {#if $event_exhibit_tracking_obj?.event_badge_professional_title || $event_exhibit_tracking_obj?.event_badge_professional_title_override} +
+ Titles (degrees, credentials): + + {#if $event_exhibit_tracking_obj?.event_badge_professional_title_override} + {$event_exhibit_tracking_obj?.event_badge_professional_title_override} + {:else} + {$event_exhibit_tracking_obj?.event_badge_professional_title} + {/if} + +
+ {/if} - {#if $event_exhibit_tracking_obj?.event_badge_affiliations || $event_exhibit_tracking_obj?.event_badge_affiliations_override} -
- Affiliations: - - {#if $event_exhibit_tracking_obj?.event_badge_affiliations_override} - {$event_exhibit_tracking_obj?.event_badge_affiliations_override} - {:else} - {$event_exhibit_tracking_obj?.event_badge_affiliations} - {/if} - -
- {/if} + {#if $event_exhibit_tracking_obj?.event_badge_affiliations || $event_exhibit_tracking_obj?.event_badge_affiliations_override} +
+ Affiliations: + + {#if $event_exhibit_tracking_obj?.event_badge_affiliations_override} + {$event_exhibit_tracking_obj?.event_badge_affiliations_override} + {:else} + {$event_exhibit_tracking_obj?.event_badge_affiliations} + {/if} + +
+ {/if} - {#if $event_exhibit_tracking_obj?.event_badge_country} -
- Location: - - - - {$event_exhibit_tracking_obj?.event_badge_country} - -
- {/if} -
- + {#if $event_exhibit_tracking_obj?.event_badge_country} +
+ Location: + + + + {$event_exhibit_tracking_obj?.event_badge_country} + +
+ {/if} +
+ -
- - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit_tracking({ - api_cfg: $ae_api, - exhibit_tracking_id: $events_slct.exhibit_tracking_id - }); - }} - > - {#if $event_exhibit_tracking_obj?.priority} - Stared - {:else} - Not Stared - {/if} - - + > + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit_tracking({ + api_cfg: $ae_api, + exhibit_tracking_id: $events_slct.exhibit_tracking_id + }); + }} + > + {#if $event_exhibit_tracking_obj?.priority} + Stared + {:else} + Not Stared + {/if} + + - - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit_tracking({ - api_cfg: $ae_api, - exhibit_tracking_id: $events_slct.exhibit_tracking_id - }); - }} - > - {#if $event_exhibit_tracking_obj?.sort} - Ranked - {:else} - Not Ranked - {/if} - - -
+ + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit_tracking({ + api_cfg: $ae_api, + exhibit_tracking_id: $events_slct.exhibit_tracking_id + }); + }} + > + {#if $event_exhibit_tracking_obj?.sort} + Ranked + {:else} + Not Ranked + {/if} + + +
-
- - - - + - - + - -
- -
+ +
+ +
- - {#if $event_exhibit_obj?.leads_custom_questions_json} - + + {#if $event_exhibit_obj?.leads_custom_questions_json} + - {#if $event_exhibit_obj?.leads_custom_questions_json.length > 0} -
-
- - Custom Questions: - - + {#if $event_exhibit_obj?.leads_custom_questions_json.length > 0} +
+
+ + Custom Questions: + + - {#each $event_exhibit_obj?.leads_custom_questions_json as leads_custom_question, question_index} -
- {leads_custom_question.question} + {#each $event_exhibit_obj?.leads_custom_questions_json as leads_custom_question, question_index} +
+ {leads_custom_question.question} - {#if leads_custom_question.type == 'text'} - { - $events_sess.leads.lead_data_changed = true; - }} - /> - {:else if leads_custom_question.type == 'option' && leads_custom_question.option_li} - - {:else} - Response type not yet configured - {/if} - - {#if $events_loc.leads.show_content__custom_question_descriptions && leads_custom_question?.description} - {leads_custom_question?.description ?? ''} - {/if} -
- {/each} -
-
- {/if} - {/if} + {#if leads_custom_question.type == 'text'} + { + $events_sess.leads.lead_data_changed = true; + }} + /> + {:else if leads_custom_question.type == 'option' && leads_custom_question.option_li} + + {:else} + Response type not yet configured + {/if} + + {#if $events_loc.leads.show_content__custom_question_descriptions && leads_custom_question?.description} + {leads_custom_question?.description ?? ''} + {/if} +
+ {/each} + + + {/if} + {/if} -
- {#if $events_loc.leads.show_content__email_link_warning} -
- - This is the email address of the person that originally scanned the badge. This is used - to link the lead to the person that scanned the badge. This is useful for tracking who - scanned the badge and who the lead is associated with. -
- {/if} - -
-
+
+ {#if $events_loc.leads.show_content__email_link_warning} +
+ + This is the email address of the person that originally scanned the badge. + This is used to link the lead to the person that scanned the badge. This + is useful for tracking who scanned the badge and who the lead is associated + with. +
+ {/if} + +
+ -
- - -
- - +
+ + +
+ + -
-
- +
+
+ - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit_tracking({ - api_cfg: $ae_api, - exhibit_tracking_id: $events_slct.exhibit_tracking_id - }); - }} - > - {#if $ae_loc.trusted_access} - {$event_exhibit_tracking_obj?.hide ? 'Hidden' : 'Not Hidden'} - {/if} - - + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit_tracking({ + api_cfg: $ae_api, + exhibit_tracking_id: $events_slct.exhibit_tracking_id + }); + }} + > + {#if $ae_loc.trusted_access} + {$event_exhibit_tracking_obj?.hide ? 'Hidden' : 'Not Hidden'} + {/if} + + - - { - console.log(`ae_crud_updated event:`, e.detail); - events_func.handle_load_ae_obj_id__exhibit_tracking({ - api_cfg: $ae_api, - exhibit_tracking_id: $events_slct.exhibit_tracking_id - }); + + { + console.log(`ae_crud_updated event:`, e.detail); + events_func.handle_load_ae_obj_id__exhibit_tracking({ + api_cfg: $ae_api, + exhibit_tracking_id: $events_slct.exhibit_tracking_id + }); - let load_event_exhibit_tracking_obj_li = - events_func.handle_load_ae_obj_li__exhibit_tracking({ - api_cfg: $ae_api, - exhibit_id: $event_exhibit_obj?.event_exhibit_id_random, - params: { enabled: 'all', qry__limit: 200 } - }); - console.log( - `load_event_exhibit_tracking_obj_li = `, - load_event_exhibit_tracking_obj_li - ); + let load_event_exhibit_tracking_obj_li = + events_func.handle_load_ae_obj_li__exhibit_tracking({ + api_cfg: $ae_api, + exhibit_id: $event_exhibit_obj?.event_exhibit_id_random, + params: { enabled: 'all', qry__limit: 200 } + }); + console.log( + `load_event_exhibit_tracking_obj_li = `, + load_event_exhibit_tracking_obj_li + ); - if (!$ae_loc.trusted_access) { - $events_sess.leads.show_form__view_lead = false; - $events_sess.leads.lead_data_changed = null; - } - }} - > - {#if $ae_loc.trusted_access} - {$event_exhibit_tracking_obj?.enable ? 'Enabled' : 'Not Enabled'}: - {/if} - - - -
+ $events_slct.exhibit_tracking_obj.enable = + !$event_exhibit_tracking_obj?.enable; + ae_triggers.enable = true; + }} + class="btn btn-sm preset-tonal-success" + > + {#if $ae_loc.trusted_access} + {#if $event_exhibit_tracking_obj?.enable} + Disable + {:else} + Enable + {/if} + {:else} + + {#if $event_exhibit_tracking_obj?.enable} + Remove + {:else} + Nope + {/if} + {/if} + + + +
-
- -
-
- - - +
+ +
+ + + + diff --git a/src/routes/hosted_files/+layout.svelte b/src/routes/hosted_files/+layout.svelte index 5dc56f20..0cd00a3d 100644 --- a/src/routes/hosted_files/+layout.svelte +++ b/src/routes/hosted_files/+layout.svelte @@ -1,54 +1,54 @@ - Hosted Files - {$ae_loc?.title ?? 'Æ loading...'} + Hosted Files - {$ae_loc?.title ?? 'Æ loading...'}
- + + + + + -
- {@render children?.()} -
+
+ {@render children?.()} +
diff --git a/src/routes/hosted_files/+layout.ts b/src/routes/hosted_files/+layout.ts index 3b958283..53f3f495 100644 --- a/src/routes/hosted_files/+layout.ts +++ b/src/routes/hosted_files/+layout.ts @@ -6,55 +6,55 @@ import { browser } from '$app/environment'; import { core_func } from '$lib/ae_core/ae_core_functions'; export async function load({ params, parent, url }) { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - data.log_lvl = log_lvl; + const data = await parent(); + data.log_lvl = log_lvl; - const account_id = data.account_id; - const ae_acct = data[account_id]; - // console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + // console.log(`ae_acct = `, ae_acct); - // if (!account_id) { - // console.log(`ae Core - [account_id] +page.ts: The account_id was not found!!!`); - // error(404, { - // message: 'Account ID not found' - // }); - // } + // if (!account_id) { + // console.log(`ae Core - [account_id] +page.ts: The account_id was not found!!!`); + // error(404, { + // message: 'Account ID not found' + // }); + // } - // ae_acct.slct.account_id = account_id; + // ae_acct.slct.account_id = account_id; - const qry_limit = url.searchParams.get('limit') ?? 19; - if (!qry_limit) { - console.log(`qry_limit +page.ts: The qry_limit was not found in the params!!!`); - } - ae_acct.slct.qry_limit = qry_limit; + const qry_limit = url.searchParams.get('limit') ?? 19; + if (!qry_limit) { + console.log(`qry_limit +page.ts: The qry_limit was not found in the params!!!`); + } + ae_acct.slct.qry_limit = qry_limit; - if (browser) { - const load_hosted_file_obj_li = core_func.load_ae_obj_li__hosted_file({ - api_cfg: ae_acct.api, - for_obj_type: 'account', - for_obj_id: account_id, - enabled: 'enabled', - hidden: 'not_hidden', - limit: qry_limit, - order_by_li: { - priority: 'DESC', - sort: 'DESC', - updated_on: 'DESC', - created_on: 'DESC', - title: 'ASC' - }, - try_cache: true, - log_lvl: log_lvl - }); - console.log(`load_hosted_file_obj_li = `, load_hosted_file_obj_li); - ae_acct.slct.hosted_file_obj_li = load_hosted_file_obj_li; - } + if (browser) { + const load_hosted_file_obj_li = core_func.load_ae_obj_li__hosted_file({ + api_cfg: ae_acct.api, + for_obj_type: 'account', + for_obj_id: account_id, + enabled: 'enabled', + hidden: 'not_hidden', + limit: qry_limit, + order_by_li: { + priority: 'DESC', + sort: 'DESC', + updated_on: 'DESC', + created_on: 'DESC', + title: 'ASC' + }, + try_cache: true, + log_lvl: log_lvl + }); + console.log(`load_hosted_file_obj_li = `, load_hosted_file_obj_li); + ae_acct.slct.hosted_file_obj_li = load_hosted_file_obj_li; + } - // WARNING: Precaution against shared data between sites and sessions. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and sessions. + data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/hosted_files/+page.svelte b/src/routes/hosted_files/+page.svelte index d5c8e5b4..30e07720 100644 --- a/src/routes/hosted_files/+page.svelte +++ b/src/routes/hosted_files/+page.svelte @@ -1,90 +1,90 @@ diff --git a/src/routes/hosted_files/video_util/+page.svelte b/src/routes/hosted_files/video_util/+page.svelte index 48ac6941..e1b00da7 100644 --- a/src/routes/hosted_files/video_util/+page.svelte +++ b/src/routes/hosted_files/video_util/+page.svelte @@ -1,116 +1,116 @@ diff --git a/src/routes/hosted_files/video_util/hold_video_util.svelte b/src/routes/hosted_files/video_util/hold_video_util.svelte index 68844e35..7619c662 100644 --- a/src/routes/hosted_files/video_util/hold_video_util.svelte +++ b/src/routes/hosted_files/video_util/hold_video_util.svelte @@ -1,172 +1,172 @@
-
-

Clip and Scale Video Files

-

- This AV utility will take an mp4 video file and create a clipped mp4 video file. By default, - videos will be scaled down to 1920x1080. This process takes at least 30 seconds, but it can - easily take a handful of minutes. The scaling option requires that the video be re-encoded. - Please be patient while it is processing. -

+
+

Clip and Scale Video Files

+

+ This AV utility will take an mp4 video file and create a clipped mp4 video file. By + default, videos will be scaled down to 1920x1080. This process takes at least 30 + seconds, but it can easily take a handful of minutes. The scaling option requires that + the video be re-encoded. Please be patient while it is processing. +

-

- Step 1: Upload Video File or Select from Hosted Files +

+ Step 1: Upload Video File or Select from Hosted Files - -

+ + -
- - {#snippet label()} - -
- - Upload video files -
- - Aether hosted files only
- Recommended: video (mp4, mkv)
-
-
- {/snippet} -
-
+
+ + {#snippet label()} + +
+ + Upload video files +
+ + Aether hosted files only
+ Recommended: video (mp4, mkv)
+
+
+ {/snippet} +
+
-
- -
+
+ +
-
+
-

- Step 2: Clip Video +

+ Step 2: Clip Video - -

- {#if $ae_loc.files.uploaded_file_kv && Object.entries($ae_loc.files.uploaded_file_kv).length > 0} - - {:else} -

Upload a video file to clip first.

- {/if} + + + {#if $ae_loc.files.uploaded_file_kv && Object.entries($ae_loc.files.uploaded_file_kv).length > 0} + + {:else} +

Upload a video file to clip first.

+ {/if} -

- Step 3: Download Recently Processed Video Clips +

+ Step 3: Download Recently Processed Video Clips - -

- {#if $ae_loc.files.video_clip_file_kv && Object.entries($ae_loc.files.video_clip_file_kv).length > 0} - - {:else} -

Clip a video file first.

- {/if} + + + {#if $ae_loc.files.video_clip_file_kv && Object.entries($ae_loc.files.video_clip_file_kv).length > 0} + + {:else} +

Clip a video file first.

+ {/if} - + - - + - - - + - - + - + - -
+
- - - + + - - + + - - {@render children?.()} - - {#if $idaa_loc.novi_uuid} - - Novi: - {$idaa_loc.novi_uuid} - {$idaa_loc.novi_full_name ?? 'name not set'} - {$idaa_loc.novi_email ?? 'email not set'} - - {:else} -

IDAA Novi UUID not found!

- {/if} + {@render children?.()} + + {#if $idaa_loc.novi_uuid} + + Novi: + {$idaa_loc.novi_uuid} + {$idaa_loc.novi_full_name ?? 'name not set'} + {$idaa_loc.novi_email ?? 'email not set'} + + {:else} +

IDAA Novi UUID not found!

+ {/if} {:else if browser} -
-

- - - Access Denied - - -

-

You do not have access to these IDAA page.

+
+

+ + + Access Denied + + +

+

You do not have access to these IDAA page.

- {#if $ae_loc.iframe} - In iframe mode - {/if} + {#if $ae_loc.iframe} + In iframe mode + {/if} - {#if $idaa_loc.novi_uuid} - - Novi: - {$idaa_loc.novi_uuid} - {$idaa_loc.novi_full_name ?? 'name not set'} - {$idaa_loc.novi_email ?? 'email not set'} - - {:else} -

IDAA Novi UUID not found!

- {/if} -
+ {#if $idaa_loc.novi_uuid} + + Novi: + {$idaa_loc.novi_uuid} + {$idaa_loc.novi_full_name ?? 'name not set'} + {$idaa_loc.novi_email ?? 'email not set'} + + {:else} +

IDAA Novi UUID not found!

+ {/if} +
{:else} -

- - Loading... -

+

+ + Loading... +

{/if} diff --git a/src/routes/idaa/(idaa)/archives/+layout.svelte b/src/routes/idaa/(idaa)/archives/+layout.svelte index db8e6d88..7f29380b 100644 --- a/src/routes/idaa/(idaa)/archives/+layout.svelte +++ b/src/routes/idaa/(idaa)/archives/+layout.svelte @@ -1,42 +1,42 @@ {@render children?.()} diff --git a/src/routes/idaa/(idaa)/archives/+layout.ts b/src/routes/idaa/(idaa)/archives/+layout.ts index 4756bdeb..83ecc4f9 100644 --- a/src/routes/idaa/(idaa)/archives/+layout.ts +++ b/src/routes/idaa/(idaa)/archives/+layout.ts @@ -6,53 +6,53 @@ import { browser } from '$app/environment'; import { archives_func } from '$lib/ae_archives/ae_archives_functions'; export async function load({ fetch, params, parent }) { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - data.log_lvl = log_lvl; + const data = await parent(); + data.log_lvl = log_lvl; - const account_id = data.account_id; - const ae_acct = data[account_id]; - // console.log(`ae_acct = `, ae_acct); + const account_id = data.account_id; + const ae_acct = data[account_id]; + // console.log(`ae_acct = `, ae_acct); - // if (!account_id) { - // console.log(`ae IDAA Archives - [account_id] +page.ts: The account_id was not found!!!`); - // error(404, { - // message: 'Account ID not found' - // }); - // } + // if (!account_id) { + // console.log(`ae IDAA Archives - [account_id] +page.ts: The account_id was not found!!!`); + // error(404, { + // message: 'Account ID not found' + // }); + // } - // ae_acct.slct.account_id = account_id; + // ae_acct.slct.account_id = account_id; - if (browser) { - const load_archive_obj_li = archives_func.load_ae_obj_li__archive({ - api_cfg: ae_acct.api, - for_obj_type: 'account', - for_obj_id: account_id, - inc_content_li: true, - enabled: 'enabled', - hidden: 'not_hidden', - limit: 29, - order_by_li: { - priority: 'DESC', - sort: 'DESC', - updated_on: 'DESC', - created_on: 'DESC', - name: 'ASC' - }, - params: params, - try_cache: true, - log_lvl: log_lvl - }); - if (log_lvl) { - console.log(`load_archive_obj_li = `, load_archive_obj_li); - } - ae_acct.slct.archive_obj_li = load_archive_obj_li; - } + if (browser) { + const load_archive_obj_li = archives_func.load_ae_obj_li__archive({ + api_cfg: ae_acct.api, + for_obj_type: 'account', + for_obj_id: account_id, + inc_content_li: true, + enabled: 'enabled', + hidden: 'not_hidden', + limit: 29, + order_by_li: { + priority: 'DESC', + sort: 'DESC', + updated_on: 'DESC', + created_on: 'DESC', + name: 'ASC' + }, + params: params, + try_cache: true, + log_lvl: log_lvl + }); + if (log_lvl) { + console.log(`load_archive_obj_li = `, load_archive_obj_li); + } + ae_acct.slct.archive_obj_li = load_archive_obj_li; + } - // WARNING: Precaution against shared data between sites and sessions. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and sessions. + data[account_id] = ae_acct; - return data; + return data; } diff --git a/src/routes/idaa/(idaa)/archives/+page.svelte b/src/routes/idaa/(idaa)/archives/+page.svelte index e200b09b..f5172e04 100644 --- a/src/routes/idaa/(idaa)/archives/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/+page.svelte @@ -1,169 +1,169 @@ - - IDAA Archives: - Novi - {$ae_loc?.title} - + + IDAA Archives: - Novi - {$ae_loc?.title} + {#await lq__archive_obj_li} -
- - Loading archives... -
+
+ + Loading archives... +
{:then} - {#if $lq__archive_obj_li && $lq__archive_obj_li?.length} - - {:else} -
-

No archives found.

-

- Archives will appear here once created. -

-
- {/if} + {#if $lq__archive_obj_li && $lq__archive_obj_li?.length} + + {:else} +
+

No archives found.

+

+ Archives will appear here once created. +

+
+ {/if} {/await} diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte index 2cedd739..8148de1a 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte @@ -1,257 +1,276 @@ - - IDAA Archives: - {$lq__archive_obj?.name - ? ae_util.shorten_string({ - string: $lq__archive_obj?.name, - max_length: 20, - begin_length: 10, - end_length: 4 - }) - : ''} - - Novi - {$ae_loc?.title} - + + IDAA Archives: + {$lq__archive_obj?.name + ? ae_util.shorten_string({ + string: $lq__archive_obj?.name, + max_length: 20, + begin_length: 10, + end_length: 4 + }) + : ''} + - Novi - {$ae_loc?.title} +
-

- - - {@html $lq__archive_obj?.name ?? 'Archive'} - {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - ({$lq__archive_content_obj_li?.length ?? '0'}×) - {/if} - {#await $idaa_prom.load__archive_content_obj_li} - - {:then} - - {/await} -

+ > + + + {@html $lq__archive_obj?.name ?? 'Archive'} + {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + ({$lq__archive_content_obj_li?.length ?? '0'}×) + {/if} + {#await $idaa_prom.load__archive_content_obj_li} + + {:then} + + {/await} + -
- - {#if $lq__archive_obj?.topic_name} - {$lq__archive_obj?.topic_name} - {/if} - {#if $ae_loc.trusted_access && $lq__archive_obj?.hide} - Hidden - {/if} - {#if $ae_loc.administrator_access && !$lq__archive_obj?.enable} - Not enabled - {/if} - -
+ > + + {#if $lq__archive_obj?.topic_name} + {$lq__archive_obj?.topic_name} + {/if} + {#if $ae_loc.trusted_access && $lq__archive_obj?.hide} + Hidden + {/if} + {#if $ae_loc.administrator_access && !$lq__archive_obj?.enable} + Not enabled + {/if} + +
- +
- - - View Other Archives - + > + + View Other Archives +
@@ -366,114 +385,115 @@ - {#snippet header()} -
-

- {#if $ae_loc.trusted_access} - - - - {/if} + $idaa_sess.archives.show__modal_view__archive_id = + $idaa_slct.archive_id; + $idaa_sess.archives.show__modal_edit__archive_id = false; + }} + class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition" + title={`View meeting: ${$lq__archive_obj?.name}`} + > + View + + + {/if} - Edit Archive: - {$lq__archive_obj?.name} -

-
- {/snippet} + Edit Archive: + {$lq__archive_obj?.name} + + + {/snippet} - + - {#snippet footer()} - - {/snippet} + {#snippet footer()} + + {/snippet}
- {#snippet header()} -
-

- {#if $ae_loc.trusted_access} - - - - {/if} + $idaa_sess.archives.show__modal_edit__archive_content_id = false; + }} + class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition" + title={`View meeting: ${$lq__archive_content_obj?.name}`} + > + Cancel + + + {/if} - Edit Content: - {$idaa_slct.archive_content_obj?.name ?? 'New Archive Content'} -

-
- {/snippet} + Edit Content: + {$idaa_slct.archive_content_obj?.name ?? 'New Archive Content'} + + + {/snippet} - + - {#snippet footer()} - - {/snippet} + {#snippet footer()} + + {/snippet}
diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts index d06e6771..02ccd4cd 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts @@ -7,52 +7,55 @@ import { browser } from '$app/environment'; import { archives_func } from '$lib/ae_archives/ae_archives_functions'; export const load = (async ({ params, parent }) => { - // route - const log_lvl: number = 0; + // route + const log_lvl: number = 0; - const data = await parent(); - data.log_lvl = log_lvl; + const data = await parent(); + data.log_lvl = log_lvl; - const account_id = data.account_id; - const ae_acct = data[account_id]; + const account_id = data.account_id; + const ae_acct = data[account_id]; - const archive_id = params.archive_id; + const archive_id = params.archive_id; - ae_acct.slct.archive_id = archive_id; + ae_acct.slct.archive_id = archive_id; - if (browser) { - if (log_lvl) { - console.log(`ae_idaa_archives archives [archive_id] +page.ts: archive_id = `, archive_id); - } - // Load archive object - const load_archive_obj = await archives_func - .load_ae_obj_id__archive({ - api_cfg: ae_acct.api, - archive_id: archive_id, - inc_content_li: true, - enabled: 'enabled', - hidden: 'all', // 'not_hidden' to load only visible entries - limit: 99, - log_lvl: log_lvl - }) - .then((results) => { - if (!results) { - error(404, { - message: 'IDAA Archives - Archive not found' - }); - } else { - // ae_acct.slct.post_obj = results; - } - }); + if (browser) { + if (log_lvl) { + console.log( + `ae_idaa_archives archives [archive_id] +page.ts: archive_id = `, + archive_id + ); + } + // Load archive object + const load_archive_obj = await archives_func + .load_ae_obj_id__archive({ + api_cfg: ae_acct.api, + archive_id: archive_id, + inc_content_li: true, + enabled: 'enabled', + hidden: 'all', // 'not_hidden' to load only visible entries + limit: 99, + log_lvl: log_lvl + }) + .then((results) => { + if (!results) { + error(404, { + message: 'IDAA Archives - Archive not found' + }); + } else { + // ae_acct.slct.post_obj = results; + } + }); - if (log_lvl) { - console.log(`load_archive_obj = `, load_archive_obj); - } - ae_acct.slct.archive_obj = load_archive_obj; - } + if (log_lvl) { + console.log(`load_archive_obj = `, load_archive_obj); + } + ae_acct.slct.archive_obj = load_archive_obj; + } - // WARNING: Precaution against shared data between sites and presentations. - data[account_id] = ae_acct; + // WARNING: Precaution against shared data between sites and presentations. + data[account_id] = ae_acct; - return data; + return data; }) satisfies PageLoad; diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte index f7d4413c..56741d7b 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte @@ -1,435 +1,442 @@
- + -
- {#await prom_api__archive_content_obj} -
Saving...
- {:then} - {#if prom_api__archive_content_obj} -
Finished saving
- {:else} - - {/if} - {/await} + + {#await prom_api__archive_content_obj} +
Saving...
+ {:then} + {#if prom_api__archive_content_obj} +
Finished saving
+ {:else} + + {/if} + {/await} - + -
-
-
- - + - -
+ - {#if $idaa_slct.archive_content_id} -
-

Upload/Manage Hosted File

+ {#if $idaa_slct.archive_content_id} +
+

Upload/Manage Hosted File

- {#if !$idaa_slct.archive_content_obj?.hosted_file_id} - No file uploaded yet. + {#if !$idaa_slct.archive_content_obj?.hosted_file_id} + No file uploaded yet. - {#if $ae_loc.trusted_access} - + {#if $ae_loc.trusted_access} + -
- - {#snippet label()} - -
- - Upload archive files -
- - Aether hosted files only
- Recommended: PowerPoint (pptx) or Keynote (key) or Adobe PDF
- Media: audio (mp3, m4a) and video (mp4, mkv)
- Supplemental files: Word Doc, Excel, txt, etc -
-
- {/snippet} -
-
+
+ + {#snippet label()} + +
+ + Upload archive files +
+ + Aether hosted files only
+ Recommended: PowerPoint (pptx) or Keynote (key) or Adobe + PDF
+ Media: audio (mp3, m4a) and video (mp4, mkv)
+ Supplemental files: Word Doc, Excel, txt, etc +
+
+ {/snippet} +
+
-
- -
- {/if} - {:else} - + - - + - - {/if} -
- {:else} -
- - Save the form first before uploading a file. -
- {/if} + + {/if} +
+ {:else} +
+ + Save the form first before uploading a file. +
+ {/if} -
-

Original

+
+

Original

- + -
- -
+
+ +
- -
+ +
- {#if $ae_loc.trusted_access} - + class:preset-filled-success-200-800={$idaa_loc.archives.show__admin_options} + class:preset-filled-tertiary-200-800={!$idaa_loc.archives.show__admin_options} + onclick={() => { + $idaa_loc.archives.show__admin_options = + !$idaa_loc.archives.show__admin_options; + }} + > + {#if $idaa_loc.archives.show__admin_options} + + {:else} + + {/if} + {$idaa_loc.archives.show__admin_options ? 'Hide' : 'Show'} Admin + - -
-

Admin Options

+ class:hidden={!$idaa_loc.archives.show__admin_options} + > +

Admin Options

- - -
- Hide -
- - -
-
- - -
-
+ + +
+ Hide +
+ + +
+
+ + +
+
-
- Priority -
- - -
-
- - -
-
-
+
+ Priority +
+ + +
+
+ + +
+
+
- - + > + - - + +
- {#if $ae_loc.administrator_access} - -
- Enable -
- - -
-
- - -
-
-
- {:else} - - {/if} -
+ {#if $ae_loc.administrator_access} + +
+ Enable +
+ + +
+
+ + +
+
+
+ {:else} + + {/if} + - {#if $ae_loc.trusted_access} - - {/if} + {#if $ae_loc.trusted_access} + + {/if} -
- {$lq__archive_content_obj?.updated_on - ? `DB Updated on: ${$lq__archive_content_obj?.updated_on}` - : ''} - {$idaa_slct.archive_content_obj?.updated_on - ? `SLCT Updated on: ${$idaa_slct.archive_content_obj?.updated_on}` - : ''} -
-
- - {/if} +
+ {$lq__archive_content_obj?.updated_on + ? `DB Updated on: ${$lq__archive_content_obj?.updated_on}` + : ''} + {$idaa_slct.archive_content_obj?.updated_on + ? `SLCT Updated on: ${$idaa_slct.archive_content_obj?.updated_on}` + : ''} +
+ + + {/if} -
- + > + {#await prom_api__archive_content_obj} + Saving + {:then} + Save Changes + {/await} + + + - {#if $idaa_slct.archive_content_id && !$idaa_slct.archive_content_obj?.hosted_file_id} - + title="Disable this archive content" + > + + Remove + {#if $ae_loc.administrator_access} + (Disable) + {/if} + - {#if $ae_loc.administrator_access && $ae_loc.edit_mode} - - {/if} - {:else if $idaa_slct.archive_content_obj.hosted_file_id} - {#if $ae_loc.administrator_access} - Can not delete. Remove hosted file first. - {/if} - {/if} -
-
+ title="Delete this archive content" + > + + Delete + + {/if} + {:else if $idaa_slct.archive_content_obj.hosted_file_id} + {#if $ae_loc.administrator_access} + Can not delete. Remove hosted file first. + {/if} + {/if} + +
diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte index 48f5b4f9..6cca43f3 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte @@ -1,231 +1,242 @@
- {#if $lq__archive_content_obj_li && $lq__archive_content_obj_li.length} - - {#each $lq__archive_content_obj_li as idaa_archive_content_obj, index} - {#if idaa_archive_content_obj.group && idaa_archive_content_obj.group != $lq__archive_content_obj_li[index - 1]?.group} - -
- -
- {/if} + > + + + {/if} - {#if $idaa_sess.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group} -
-
-

- {@html idaa_archive_content_obj.name} -

+ {#if $idaa_sess.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group} +
+
+

+ {@html idaa_archive_content_obj.name} +

- {#if idaa_archive_content_obj.original_location} - — -

- - {idaa_archive_content_obj.original_location} -

- {/if} -
+ {#if idaa_archive_content_obj.original_location} + — +

+ + {idaa_archive_content_obj.original_location} +

+ {/if} +
- {#if idaa_archive_content_obj.description}
{@html idaa_archive_content_obj.description}
{/if} + {#if idaa_archive_content_obj.description}
{@html idaa_archive_content_obj.description}
{/if} -
- {#if idaa_archive_content_obj?.hosted_file_id} - + $idaa_sess.archives.show__modal_view__archive_content_id = + $idaa_slct.archive_content_id; + $idaa_sess.archives.show__modal_edit__archive_content_id = false; + }} + class="novi_btn btn btn-md btn-secondary preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500 transition" + title={`Play/View: ${idaa_archive_content_obj?.name}`} + > + + {#if file_icons[idaa_archive_content_obj.file_extension] == 'file-audio' || file_icons[idaa_archive_content_obj.file_extension] == 'file-video'} + Play + {:else} + View + {/if} + + - {#if $ae_loc.trusted_access && idaa_archive_content_obj?.hosted_file_id} - + + {ae_util.shorten_filename({ + filename: idaa_archive_content_obj?.filename, + max_length: 30 + })} + + - - {/if} - {:else} - - - No file linked. - - - {/if} + {/if} + {:else} + + + No file linked. + + + {/if} - {#if $ae_loc.trusted_access && $ae_loc.edit_mode} - - {/if} -
+ $idaa_sess.archives.show__modal_view__archive_content_id = false; + $idaa_sess.archives.show__modal_edit__archive_content_id = + $idaa_slct.archive_content_id; + }} + class="novi_btn btn btn-sm preset-tonal-warning hover:preset-filled-warning-500 transition" + title={`Edit archive content: ${idaa_archive_content_obj?.name}`} + > + Edit Content + + {/if} +
-
- {#if idaa_archive_content_obj?.description} -
-
Description:
-
- {@html idaa_archive_content_obj?.description} -
-
- {/if} +
+ {#if idaa_archive_content_obj?.description} +
+
+ Description: +
+
+ {@html idaa_archive_content_obj?.description} +
+
+ {/if} - {#if idaa_archive_content_obj?.content_html} -
-
Content:
-
- {@html idaa_archive_content_obj?.content_html} -
-
- {/if} + {#if idaa_archive_content_obj?.content_html} +
+
+ Content: +
+
+ {@html idaa_archive_content_obj?.content_html} +
+
+ {/if} -
- Original date/time: - {#if idaa_archive_content_obj.original_datetime} - {ae_util.iso_datetime_formatter( - idaa_archive_content_obj.original_datetime, - 'datetime_12_long' - )} - {/if} - {#if idaa_archive_content_obj.original_timezone} - Timezone: - {idaa_archive_content_obj.original_timezone} - {/if} -
-
+
+ Original date/time: + {#if idaa_archive_content_obj.original_datetime} + {ae_util.iso_datetime_formatter( + idaa_archive_content_obj.original_datetime, + 'datetime_12_long' + )} + {/if} + {#if idaa_archive_content_obj.original_timezone} + Timezone: + {idaa_archive_content_obj.original_timezone} + {/if} +
+
-
- - Type: {idaa_archive_content_obj.archive_content_type} - - - - Created on: {ae_util.iso_datetime_formatter( - idaa_archive_content_obj.created_on, - 'datetime_12_long' - )} - - - Updated on: {ae_util.iso_datetime_formatter( - idaa_archive_content_obj.updated_on, - 'datetime_12_long' - )} - - -
- - {/if} - {/each} +
+ + Type: {idaa_archive_content_obj.archive_content_type} + + + + Created on: {ae_util.iso_datetime_formatter( + idaa_archive_content_obj.created_on, + 'datetime_12_long' + )} + + + Updated on: {ae_util.iso_datetime_formatter( + idaa_archive_content_obj.updated_on, + 'datetime_12_long' + )} + + +
+ + {/if} + {/each} - - {:else} -

No archive content available to show.

- {/if} + + {:else} +

No archive content available to show.

+ {/if}
diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte index f96ab853..7ff2f57a 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_obj_id_edit.svelte @@ -1,351 +1,356 @@
-
- {#await update_archive_obj_promise} -
Saving...
- {:then} - {#if update_archive_obj_promise} -
Finished saving
- {:else} - - {/if} - {/await} + + {#await update_archive_obj_promise} +
Saving...
+ {:then} + {#if update_archive_obj_promise} +
Finished saving
+ {:else} + + {/if} + {/await} - + -
-
- +
- + - -
+ -
-

Original

+
+

Original

- + -
- -
+
+ +
- - + - + - -
+ +
- + - - - {#if $ae_loc.administrator_access} - - {/if} + {#if $ae_loc.administrator_access} + + {/if} - {#if $ae_loc.trusted_access} - + class:preset-filled-success-200-800={$idaa_loc.archives.show__admin_options} + class:preset-filled-tertiary-200-800={!$idaa_loc.archives.show__admin_options} + onclick={() => { + $idaa_loc.archives.show__admin_options = + !$idaa_loc.archives.show__admin_options; + }} + > + {#if $idaa_loc.archives.show__admin_options} + + {:else} + + {/if} + {$idaa_loc.archives.show__admin_options ? 'Hide' : 'Show'} Admin + - -
-

Admin Options

+ class:hidden={!$idaa_loc.archives.show__admin_options} + > +

Admin Options

- - -
- Hide -
- - -
-
- - -
-
+ + +
+ Hide +
+ + +
+
+ + +
+
-
- Priority -
- - -
-
- - -
-
-
+
+ Priority +
+ + +
+
+ + +
+
+
- - + > + - - + +
- {#if $ae_loc.administrator_access} - -
- Enable -
- - -
-
- - -
-
-
- {:else} - - {/if} -
+ {#if $ae_loc.administrator_access} + +
+ Enable +
+ + +
+
+ + +
+
+
+ {:else} + + {/if} + - {#if $ae_loc.trusted_access} - - {/if} + {#if $ae_loc.trusted_access} + + {/if} -
- {$lq__archive_obj?.updated_on ? `DB Updated on: ${$lq__archive_obj?.updated_on}` : ''} - {$idaa_slct.archive_obj?.updated_on - ? `SLCT Updated on: ${$idaa_slct.archive_obj?.updated_on}` - : ''} -
-
- - {/if} +
+ {$lq__archive_obj?.updated_on + ? `DB Updated on: ${$lq__archive_obj?.updated_on}` + : ''} + {$idaa_slct.archive_obj?.updated_on + ? `SLCT Updated on: ${$idaa_slct.archive_obj?.updated_on}` + : ''} +
+ + + {/if} -
- + > + + Save Archive + - {#if $idaa_slct.archive_id} - - {/if} -
-
+ title="Disable this archive content" + > + + Delete + + {/if} + +
diff --git a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte index 6f113871..0b27ae66 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_li.svelte @@ -1,212 +1,218 @@
- - {#if $lq__event_obj_li && $lq__event_obj_li.length} -
-

- Results: + + {#if $lq__event_obj_li && $lq__event_obj_li.length} +
+

+ Results: - {#if $lq__event_obj_li?.length} - - - {$lq__event_obj_li.length ?? 'None'} - - {/if} -

+ {#if $lq__event_obj_li?.length} + + + {$lq__event_obj_li.length ?? 'None'} + + {/if} +

- {#each $lq__event_obj_li as idaa_event_obj, index} - {#if idaa_event_obj} - -
-
-

+
+

- - {idaa_event_obj?.name ?? 'Recovery Meeting'} -

+ > + + {idaa_event_obj?.name ?? 'Recovery Meeting'} +

-
- {#if idaa_event_obj?.status == 'unknown'} - - - Not Confirmed by IDAA - - - - {/if} + > + {#if idaa_event_obj?.status == 'unknown'} + + + Not Confirmed by IDAA + + + + {/if} - - - {#if idaa_event_obj?.physical && idaa_event_obj?.virtual} - F2F and - Virtual - {:else if idaa_event_obj?.physical} - F2F - {:else if idaa_event_obj?.virtual} - Virtual - {/if} - - {#if idaa_event_obj?.type} - {idaa_event_obj?.type} - {/if} - {#if $ae_loc.trusted_access && idaa_event_obj?.hide} - Hidden - {/if} - {#if $ae_loc.administrator_access && !idaa_event_obj?.enable} - Not enabled - {/if} - -
-
+ + + {#if idaa_event_obj?.physical && idaa_event_obj?.virtual} + F2F and + Virtual + {:else if idaa_event_obj?.physical} + F2F + {:else if idaa_event_obj?.virtual} + Virtual + {/if} + + {#if idaa_event_obj?.type} + + {idaa_event_obj?.type} + {/if} + {#if $ae_loc.trusted_access && idaa_event_obj?.hide} + Hidden + {/if} + {#if $ae_loc.administrator_access && !idaa_event_obj?.enable} + Not + enabled + {/if} + +
+ - + title={`View: ${idaa_event_obj?.name}`} + > + + + + Meeting Details + +
-
- -
- Type of Recovery Meeting: - {idaa_event_obj?.type} -
+
+ Type of Recovery Meeting: + {idaa_event_obj?.type} +
-
- - - Zoom Meeting: - - - - + + + Zoom Meeting: + + + + - - - Join: Zoom ID {idaa_event_obj?.attend_json?.zoom?.meeting_id} - {#if idaa_event_obj?.attend_json?.zoom?.passcode} - Passcode: {idaa_event_obj?.attend_json?.zoom?.passcode} - {/if} - - + > + + + Join: Zoom ID {idaa_event_obj?.attend_json?.zoom + ?.meeting_id} + {#if idaa_event_obj?.attend_json?.zoom?.passcode} + Passcode: {idaa_event_obj?.attend_json?.zoom?.passcode} + {/if} + + - -
+ > + -
- - - Jitsi Meeting: - - - - + + + Jitsi Meeting: + + + + - - - Join: {idaa_event_obj?.attend_json?.jitsi?.name ?? 'Jitsi Meeting'} - {#if idaa_event_obj?.attend_json?.jitsi?.passcode} - Passcode: {idaa_event_obj?.attend_json?.jitsi?.passcode} - {/if} - - + > + + + Join: {idaa_event_obj?.attend_json?.jitsi?.name ?? + 'Jitsi Meeting'} + {#if idaa_event_obj?.attend_json?.jitsi?.passcode} + Passcode: {idaa_event_obj?.attend_json?.jitsi?.passcode} + {/if} + + - -
+ > + -
- - - When: - - - {#if idaa_event_obj?.weekday_sunday || idaa_event_obj?.weekday_monday || idaa_event_obj?.weekday_tuesday || idaa_event_obj?.weekday_wednesday || idaa_event_obj?.weekday_thursday || idaa_event_obj?.weekday_friday || idaa_event_obj?.weekday_saturday} - - - {#if idaa_event_obj?.weekday_sunday}Sunday{/if} - {#if idaa_event_obj?.weekday_monday}Monday{/if} - {#if idaa_event_obj?.weekday_tuesday}Tuesday{/if} - {#if idaa_event_obj?.weekday_wednesday}Wednesday{/if} - {#if idaa_event_obj?.weekday_thursday}Thursday{/if} - {#if idaa_event_obj?.weekday_friday}Friday{/if} - {#if idaa_event_obj?.weekday_saturday}Saturday{/if} - - {/if} +
+ + + When: + + + {#if idaa_event_obj?.weekday_sunday || idaa_event_obj?.weekday_monday || idaa_event_obj?.weekday_tuesday || idaa_event_obj?.weekday_wednesday || idaa_event_obj?.weekday_thursday || idaa_event_obj?.weekday_friday || idaa_event_obj?.weekday_saturday} + + + {#if idaa_event_obj?.weekday_sunday}Sunday{/if} + {#if idaa_event_obj?.weekday_monday}Monday{/if} + {#if idaa_event_obj?.weekday_tuesday}Tuesday{/if} + {#if idaa_event_obj?.weekday_wednesday}Wednesday{/if} + {#if idaa_event_obj?.weekday_thursday}Thursday{/if} + {#if idaa_event_obj?.weekday_friday}Friday{/if} + {#if idaa_event_obj?.weekday_saturday}Saturday{/if} + + {/if} - {#if idaa_event_obj?.recurring_start_time} - - {ae_util.iso_datetime_formatter( - `2023-01-01 ${idaa_event_obj?.recurring_start_time}`, - 'time_12_short' - )} - {/if} - {#if idaa_event_obj?.timezone} - - ({idaa_event_obj?.timezone}) - {:else} -
- Required: No timezone was given! -
- {/if} -
+ {#if idaa_event_obj?.recurring_start_time} + + {ae_util.iso_datetime_formatter( + `2023-01-01 ${idaa_event_obj?.recurring_start_time}`, + 'time_12_short' + )} + {/if} + {#if idaa_event_obj?.timezone} + + ({idaa_event_obj?.timezone}) + {:else} +
+ Required: No timezone was given! +
+ {/if} +
-
- {#if idaa_event_obj?.contact_li_json && idaa_event_obj?.contact_li_json.length && idaa_event_obj?.contact_li_json[0].full_name} -
- - Contact: - - {idaa_event_obj?.contact_li_json[0].full_name} - {#if idaa_event_obj?.contact_li_json[0].email} - | {idaa_event_obj?.contact_li_json[0].email} - - {/if} - {#if idaa_event_obj?.contact_li_json[0].phone_mobile} - | Mobile: - {idaa_event_obj?.contact_li_json[0].phone_mobile} - {/if} - {#if idaa_event_obj?.contact_li_json[0].phone_home} - | Home: - {idaa_event_obj?.contact_li_json[0].phone_home} - {/if} - {#if idaa_event_obj?.contact_li_json[0].phone_office} - | Office: - {idaa_event_obj?.contact_li_json[0].phone_office} - {/if} - {#if idaa_event_obj?.contact_li_json[0].other_text}| {idaa_event_obj - ?.contact_li_json[0].other_text}{/if} -
- {:else if $ae_loc.trusted_access} -
- ALERT: The primary contact information may be missing? This meeting should be - checked and updated. Please Edit and Save to use the new format. - -
- {/if} +
+ {#if idaa_event_obj?.contact_li_json && idaa_event_obj?.contact_li_json.length && idaa_event_obj?.contact_li_json[0].full_name} +
+ + Contact: + + {idaa_event_obj?.contact_li_json[0].full_name} + {#if idaa_event_obj?.contact_li_json[0].email} + | {idaa_event_obj?.contact_li_json[0].email} + + {/if} + {#if idaa_event_obj?.contact_li_json[0].phone_mobile} + | Mobile: + {idaa_event_obj?.contact_li_json[0] + .phone_mobile} + {/if} + {#if idaa_event_obj?.contact_li_json[0].phone_home} + | Home: + {idaa_event_obj?.contact_li_json[0].phone_home} + {/if} + {#if idaa_event_obj?.contact_li_json[0].phone_office} + | Office: + {idaa_event_obj?.contact_li_json[0] + .phone_office} + {/if} + {#if idaa_event_obj?.contact_li_json[0].other_text}| {idaa_event_obj + ?.contact_li_json[0].other_text}{/if} +
+ {:else if $ae_loc.trusted_access} +
+ ALERT: The primary contact information may be missing? This + meeting should be checked and updated. Please Edit and Save + to use the new format. + +
+ {/if} - {#if idaa_event_obj?.contact_li_json && idaa_event_obj?.contact_li_json.length && idaa_event_obj?.contact_li_json[1].full_name} -
- - Contact: - - {idaa_event_obj?.contact_li_json[1].full_name} - {#if idaa_event_obj?.contact_li_json[1].email} - | {idaa_event_obj?.contact_li_json[1].email} - - {/if} - {#if idaa_event_obj?.contact_li_json[1].phone_mobile} - | Mobile: - {idaa_event_obj?.contact_li_json[1].phone_mobile} - {/if} - {#if idaa_event_obj?.contact_li_json[1].phone_home} - | Home: - {idaa_event_obj?.contact_li_json[1].phone_home} - {/if} - {#if idaa_event_obj?.contact_li_json[1].phone_office} - | Office: - {idaa_event_obj?.contact_li_json[1].phone_office} - {/if} - {#if idaa_event_obj?.contact_li_json[1].other_text}| {idaa_event_obj - ?.contact_li_json[1].other_text}{/if} -
- {/if} - {#if $ae_loc.trusted_access} - {#if idaa_event_obj?.contact_li_json && idaa_event_obj?.contact_li_json.length && !idaa_event_obj?.contact_li_json[0].full_name} -
- Required: No primary contact information was found! -
- {/if} - {#if !idaa_event_obj?.external_person_id} -
- Warning: Not linked to a Novi record! -
- {/if} - {/if} -
-
+ {#if idaa_event_obj?.contact_li_json && idaa_event_obj?.contact_li_json.length && idaa_event_obj?.contact_li_json[1].full_name} +
+ + Contact: + + {idaa_event_obj?.contact_li_json[1].full_name} + {#if idaa_event_obj?.contact_li_json[1].email} + | {idaa_event_obj?.contact_li_json[1].email} + + {/if} + {#if idaa_event_obj?.contact_li_json[1].phone_mobile} + | Mobile: + {idaa_event_obj?.contact_li_json[1] + .phone_mobile} + {/if} + {#if idaa_event_obj?.contact_li_json[1].phone_home} + | Home: + {idaa_event_obj?.contact_li_json[1].phone_home} + {/if} + {#if idaa_event_obj?.contact_li_json[1].phone_office} + | Office: + {idaa_event_obj?.contact_li_json[1] + .phone_office} + {/if} + {#if idaa_event_obj?.contact_li_json[1].other_text}| {idaa_event_obj + ?.contact_li_json[1].other_text}{/if} +
+ {/if} + {#if $ae_loc.trusted_access} + {#if idaa_event_obj?.contact_li_json && idaa_event_obj?.contact_li_json.length && !idaa_event_obj?.contact_li_json[0].full_name} +
+ Required: No primary contact information was found! +
+ {/if} + {#if !idaa_event_obj?.external_person_id} +
+ Warning: Not linked to a Novi record! +
+ {/if} + {/if} + +
- {#if $ae_loc.administrator_access} - - {/if} - - {/if} - {/each} - - {:else} - -
- {#if $idaa_sess.recovery_meetings.qry__status === 'loading'} -
- - - Loading... -
- {:else} -
- No recovery meetings available to show. The search may need to be changed. -
- {/if} -
- {/if} +
+ + Created on: {ae_util.iso_datetime_formatter( + idaa_event_obj?.created_on, + 'datetime_12_short' + )} + + + Updated on: {ae_util.iso_datetime_formatter( + idaa_event_obj?.updated_on, + 'datetime_12_short' + )} + +
+
+ {/if} + + {/if} + {/each} + + {:else} + +
+ {#if $idaa_sess.recovery_meetings.qry__status === 'loading'} +
+ + + Loading... +
+ {:else} +
+ No recovery meetings available to show. The search may need to be changed. +
+ {/if} +
+ {/if}