1143 Commits

Author SHA1 Message Date
Scott Idem
35031d3193 Added new topic for IDAA BB 2025-11-03 18:04:47 -05:00
Scott Idem
616d6a4404 Another moderator 2025-11-03 17:51:48 -05:00
Scott Idem
d9887aba93 Making things look nicer 2025-10-17 18:14:09 -04:00
Scott Idem
fab1a4916d Clean up of the event search page options menu and related. 2025-10-17 17:27:18 -04:00
Scott Idem
bb993a1028 Last minute clean up before LCI. 2025-10-17 16:22:23 -04:00
Scott Idem
d1c0148c75 Sort of bug fix for version reload. Does it need the alert() to work correctly??? 2025-10-16 21:43:08 -04:00
Scott Idem
e912c4a48a Better text sizing and flex. 2025-10-16 16:39:30 -04:00
Scott Idem
8b22c0fc34 The Launcher works pretty well. Except for the native app... 2025-10-16 16:07:37 -04:00
Scott Idem
8d15a5ba0b More work on the WebSockets. Improved status and WS triggers. Better online/offline status. 2025-10-16 14:48:10 -04:00
Scott Idem
3d6b7c412c Work on tablet layout for posters 2025-10-16 11:45:33 -04:00
Scott Idem
77b250b4f3 Better handling of idle with WS messages. 2025-10-16 10:58:11 -04:00
Scott Idem
c2ccf0c06d Fix for disabling and hiding event file purpose options. 2025-10-16 10:04:12 -04:00
Scott Idem
c170358681 Quick icon change. 2025-10-15 19:04:56 -04:00
Scott Idem
9678c5620d Lots of work on the Launcher and configuration. Looks pretty good and useful. 2025-10-15 19:01:30 -04:00
Scott Idem
a6058efaf0 Good saving point. Version reset looks good now. 2025-10-15 14:12:04 -04:00
Scott Idem
b2154273e0 Reset looks better now. 2025-10-15 13:46:08 -04:00
Scott Idem
1f79ae4e19 More work on versioning for Events 2025-10-15 13:17:32 -04:00
Scott Idem
6b8f4d54ed The posters look pretty good now. A lot more is configurable. 2025-10-15 12:52:27 -04:00
Scott Idem
f459c09fbc Getting the posters ready for LCI. 2025-10-15 10:37:46 -04:00
Scott Idem
0bc04bf899 Things are looking and working better. Note the Modal size is set to "". This allows it to stretch to the full width of the screen. 2025-10-13 18:17:32 -04:00
Scott Idem
8f7c1bf428 More work on the posters and Websockets 2025-10-13 17:19:32 -04:00
Scott Idem
de071dae49 Work on the Launder and Websockets. It needs work. 2025-10-13 15:41:55 -04:00
Scott Idem
5b9dacd291 Better logic for lengths. Keep them more equal. 2025-10-10 17:54:49 -04:00
Scott Idem
8c2241e610 Work on badge rendering. 2025-10-10 17:40:35 -04:00
Scott Idem
74cc5c5d0d Work on badge printing and the actual badge layout. 2025-10-09 19:26:35 -04:00
Scott Idem
0f05fd708f Minor bug fix. 2025-10-08 19:19:35 -04:00
Scott Idem
41d20a3bcf Minor clean up getting ready for LCI and demo for AAPOR. 2025-10-08 16:41:57 -04:00
Scott Idem
bad5da3ddc More serious work on badge printing. Working on the templates and actually implementing the printable badge. 2025-10-07 19:39:53 -04:00
Scott Idem
28cb8e2bf2 Testing 2025-10-07 03:35:45 -04:00
Scott Idem
11334a17b1 Minor 2025-10-07 03:32:20 -04:00
Scott Idem
b24262b4ab Could not sleep. Working on the search for badges. 2025-10-07 03:25:02 -04:00
Scott Idem
e1a04d5eda Not sure 2025-10-06 18:56:16 -04:00
Scott Idem
00ff9554d8 Trying to simplify things 2025-10-06 18:54:11 -04:00
Scott Idem
d8b7ad61b3 Significant work on getting badges ready again. 2025-10-06 18:43:33 -04:00
Scott Idem
88e4ab119d More updates related to the IDB table name changes for events. 2025-10-06 14:25:52 -04:00
Scott Idem
c3992d8711 Removing old code. Standardizing the event related IDB table names. Getting badge printing ready again.... 2025-10-06 14:04:46 -04:00
Scott Idem
cd03d9e488 Updating the badge printing module. It needs a bit of work. Removing the old versions of functions. 2025-10-06 13:54:20 -04:00
Scott Idem
9fa7247204 Note on changes to QR code function. 2025-10-03 17:44:43 -04:00
Scott Idem
c4115adfd6 Wrapping up for the week. Version bump. 2025-10-03 17:42:11 -04:00
Scott Idem
af9c4a82f0 Making the QR codes work again. Also making things look better. 2025-10-03 17:41:35 -04:00
Scott Idem
c949581429 Moving older event_speakers and sponsorships modules to backups. 2025-10-03 14:49:17 -04:00
Scott Idem
a2f2742f30 More clean up. Making this live now. 2025-10-03 14:44:18 -04:00
Scott Idem
bcee6c5281 More work on the alerts for sessions. I think they are pretty good now. 2025-10-03 14:29:24 -04:00
Scott Idem
75f7ed54a5 Cleaning up the new session alerts 2025-10-03 14:01:25 -04:00
Scott Idem
c70abc46f3 Finally using the alerts for sessions!! 2025-10-03 13:27:12 -04:00
Scott Idem
b85d2ee98c The new event files reports has been cleaned up and more configurable. 2025-10-02 12:57:37 -04:00
Scott Idem
03f831de8a Quick bug fix for sorting 2025-10-02 11:07:25 -04:00
Scott Idem
b5a6c15059 Bug fix for file report sorting 2025-10-02 10:34:50 -04:00
Scott Idem
4aeded3a12 Working on making sure notifications are being sent to IDAA staff when a post or post comment is created or updated. It looks like it is working.... 2025-10-01 13:03:16 -04:00
Scott Idem
f96a14107a More work on using the new Element_ae_crud_v2 component 2025-09-30 13:11:52 -04:00
Scott Idem
99fe486842 Work on auto reload and related single property updates. Also bug fix for saving searched sessions. 2025-09-30 12:05:55 -04:00
Scott Idem
53a03f971f Added new auto reload for most object types with new v2 function and element. 2025-09-30 03:43:29 -04:00
Scott Idem
0c01eed5c8 More work on new CRUD element. Now able to update the session location in the list. 2025-09-29 18:58:54 -04:00
Scott Idem
22d7c4728d More work on the CRUD element 2025-09-29 14:17:27 -04:00
Scott Idem
24ba3940f8 Work on updating the custom CRUD element. 2025-09-29 14:06:47 -04:00
Scott Idem
f5e035318a Bug fix for saving location in session view 2025-09-29 10:55:51 -04:00
Scott Idem
c42ab0bfa0 Temporary bug fix for the file type reports. Minor update for IDAA and Jitsi iframe. 2025-09-24 18:00:12 -04:00
Scott Idem
abed17f5da Mostly cosmetic styles 2025-09-24 17:43:40 -04:00
Scott Idem
1ba9cd1c03 Lots of work on getting the Launcher actually working well. 2025-09-24 16:56:32 -04:00
Scott Idem
4220a354be Now with all reports broken out by type and things generally cleaned up. 2025-09-24 12:18:15 -04:00
Scott Idem
6f4f54a0c9 Mostly working with event file reports being moved out. 2025-09-24 10:50:28 -04:00
Scott Idem
08bc3142e6 Updates for Jitsi and IDAA 2025-09-23 14:41:06 -04:00
Scott Idem
2f4800f995 Adding notify/alert/message staff link to Google Form for IDAA. 2025-09-23 13:16:38 -04:00
Scott Idem
5bf231c468 Adding new Jitsi meeting links and related. 2025-09-23 12:41:14 -04:00
Scott Idem
7490545ba7 Work on Jitsi for IDAA 2025-09-23 11:23:05 -04:00
Scott Idem
43d64696d5 Sort of bug fix for hiding the header and footer at the right time. 2025-09-19 18:10:23 -04:00
Scott Idem
231c2eea17 Hiding scroll right button 2025-09-19 17:16:01 -04:00
Scott Idem
79c0c90eae Bug fix for scroll to end. 2025-09-19 16:50:14 -04:00
Scott Idem
5b7aa320e2 Getting rid of old code. Wrapping up for the day and week. 2025-09-19 16:23:39 -04:00
Scott Idem
f06358439f Making things look good. Now with scroll to top and bottom for Journals and Events. 2025-09-19 16:18:36 -04:00
Scott Idem
86fbbfdfb5 Never ending work on styles. Trying to make absolute positioned headers and footers work. Also added scroll to top for Journals. 2025-09-19 15:05:56 -04:00
Scott Idem
59b6577d68 Minor updates and version bump. 2025-09-19 10:40:08 -04:00
Scott Idem
fc4e59dd8c More work on styles... flex wraps everywhere. 2025-09-19 10:32:08 -04:00
Scott Idem
5527bce327 Saving changes from last night related to Jitsi. 2025-09-19 09:30:13 -04:00
Scott Idem
7a0ba7d571 More work on proof of concept for Jitsi meetings in IDAA's Novi site. 2025-09-18 18:47:25 -04:00
Scott Idem
811876e36a This new Jitsi page is working well. Now with URL params. 2025-09-18 16:54:46 -04:00
Scott Idem
7fd3ef4f63 Work on Jitsi for IDAA in the Novi site. 2025-09-18 15:52:45 -04:00
Scott Idem
8ff9f2439f Flex wrap... 2025-09-18 12:09:23 -04:00
Scott Idem
d6204d983a More work on scrolling. 2025-09-18 12:02:36 -04:00
Scott Idem
623b62f716 I think things are scrolling better. Other style clean up for dark mode. 2025-09-18 10:44:01 -04:00
Scott Idem
4f36d3eab3 Trying to at least make things scroll as well as they did yesterday... 2025-09-18 10:05:34 -04:00
Scott Idem
64f6b290ad This is not working... 2025-09-18 09:20:44 -04:00
Scott Idem
46a89c36fe Working on general styles 2025-09-17 19:21:01 -04:00
Scott Idem
6b6418b753 Making things look good. 2025-09-17 18:04:10 -04:00
Scott Idem
60fbfc434e More work on the Launcher and related 2025-09-17 16:36:04 -04:00
Scott Idem
c9e9fbec79 Lots of work on the Launcher. Still mostly just cleaning things up. 2025-09-17 15:15:50 -04:00
Scott Idem
186923671d Finally working on the Launcher piece again. Getting it updated to match the standards for everything else. 2025-09-17 13:40:57 -04:00
Scott Idem
b1aae55900 Oops forgot to add the column 2025-09-16 19:21:04 -04:00
Scott Idem
f1b3820fde Minor changes 2025-09-16 18:59:01 -04:00
Scott Idem
c670778ff3 The session reports look good now. Need to work on the file related reports next. 2025-09-16 18:57:34 -04:00
Scott Idem
15e0e423f2 Saving work on reports. Trying separate out the session specific reports. 2025-09-16 18:37:50 -04:00
Scott Idem
c7b8d49730 Lots of style improvements. Dark mode is mostly useable now. Work on reports. 2025-09-16 12:59:20 -04:00
Scott Idem
32b6f59245 Work on report config options and export of presenters 2025-09-16 10:14:58 -04:00
Scott Idem
c530ff8683 Work on AI related. 2025-09-15 18:09:37 -04:00
Scott Idem
fd3105b4e1 General clean up. Make things configurable. More AI stuff. 2025-09-12 16:20:50 -04:00
Scott Idem
0931b960b6 More query limit options. 2025-09-12 13:27:16 -04:00
Scott Idem
662e19b091 Work on event reports. Making them easier to manage. 2025-09-12 13:12:50 -04:00
Scott Idem
01273c3c4d Package updates and minor fixes 2025-09-11 19:01:59 -04:00
Scott Idem
b78cb8eac2 Now with basic AI summary for Journal Entries 2025-09-11 18:41:16 -04:00
Scott Idem
bbf9411213 More work on encryption related content and history. 2025-09-11 15:44:07 -04:00
Scott Idem
db95ed88a3 Code clean up. Version update. 2025-09-10 21:00:06 -04:00
Scott Idem
084e52be15 Wrapping up for the night. Lots of work on encryption related. 2025-09-10 20:58:10 -04:00
Scott Idem
cc6186467a Bug fixes and clean up for the recent history of Journal Entries. 2025-09-10 17:31:04 -04:00
Scott Idem
efa7833fb3 Style updates 2025-09-08 19:13:48 -04:00
Scott Idem
f842392aac More work on reports and config options 2025-09-08 17:43:30 -04:00
Scott Idem
438d366b98 Work on reports for LCI 2025-09-08 17:12:44 -04:00
Scott Idem
88c4f4e891 Bug fix for access denied message. Better formatting and extra Cancel edit button 2025-09-08 15:21:43 -04:00
Scott Idem
92a00ddee9 Sort of bug fix related to Novi linking. 2025-09-08 15:09:32 -04:00
Scott Idem
9e78ba970b Bug fix for restricted access message showing. 2025-09-05 17:41:27 -04:00
Scott Idem
5a0b13700f Finally better responsive reports again. 2025-09-04 19:31:27 -04:00
Scott Idem
bd964cac80 Still working on reports... Why are they not more responsive? 2025-09-04 18:50:50 -04:00
Scott Idem
f72a77ba60 More work related to reports and them refreshing correctly 2025-09-04 12:58:06 -04:00
Scott Idem
390bcf05a4 Work on Event reports. 2025-09-04 12:30:32 -04:00
Scott Idem
4fcf28f303 Bug fix for searching event sessions. 2025-09-04 09:57:06 -04:00
Scott Idem
84b18a33ed Hide menu by default... not testing. 2025-09-03 18:30:04 -04:00
Scott Idem
9869c695f7 General clean up. Show menu instead of link to all journals list. For now it just includes the most recent Entries loaded. 2025-09-03 18:27:24 -04:00
Scott Idem
66510c8ff1 Mostly style improvements for mobile sized 2025-09-03 16:19:54 -04:00
Scott Idem
7364ce5527 Remove debug code!! 2025-09-03 15:06:55 -04:00
Scott Idem
a6ae701e0f Minor update to logic 2025-09-03 14:52:53 -04:00
Scott Idem
711e24a7d0 Bug fixes and general code clean up related to the IDAA Archives. 2025-09-03 14:35:44 -04:00
Scott Idem
acb96729d1 Hide the Journal description by default 2025-08-22 15:57:35 -04:00
Scott Idem
7136eb04d8 Improvement to search progress and status and style 2025-08-22 15:51:08 -04:00
Scott Idem
7bb4e20ce7 Mostly style improvements. 2025-08-22 15:28:35 -04:00
Scott Idem
8a9864771b Minor improvements and fixes for Journals searching and styles. 2025-08-22 14:35:15 -04:00
Scott Idem
f3ee4ee987 Minor fixes. Better dark mode style. 2025-08-21 18:28:40 -04:00
Scott Idem
6d2c3cb056 Work on making the Entry search query work correctly. Moved things around. Hopefully easier to read and understand. 2025-08-21 18:00:32 -04:00
Scott Idem
33c6cb862e Trying to improve the sign in and passcode logic. Also related bug fixes with focus. Made Journal Entries marked as public visible to others. 2025-08-21 13:55:23 -04:00
Scott Idem
edfe9dee7a Finally work on the Journals to fix some bugs. Now with much better append and prepend to Journal Entry. 2025-08-19 18:50:23 -04:00
Scott Idem
ebaba77fe3 Version bump and package updates. 2025-08-19 15:57:28 -04:00
Scott Idem
6dec20d932 Bug fix to allow the Session POC to be null. Minor changes. 2025-08-19 13:53:54 -04:00
Scott Idem
35b6662b5b Styles... 2025-08-12 19:43:26 -04:00
Scott Idem
6f5b40d5ab Bug fix for Journal Entry view 2025-08-12 19:12:33 -04:00
Scott Idem
565712b818 Never ending work on styles 2025-08-12 18:59:01 -04:00
Scott Idem
0446822779 Minor alignment fix 2025-08-12 18:06:54 -04:00
Scott Idem
231462e3ad Working to make the dark mode look better. Work on the help tech component. General clean up. 2025-08-12 17:59:37 -04:00
Scott Idem
496eea48ee Version bump 2025-08-12 14:20:12 -04:00
Scott Idem
05d7e78444 Bug fixes 2025-08-12 14:19:54 -04:00
Scott Idem
1e20539b1a Creating a new branch and updating the version number to reflect the changes. 2025-08-12 13:45:02 -04:00
Scott Idem
0ecb9d15b0 General clean up. Better sorting for the IDAA Archives and BB Posts and Comments 2025-08-12 13:24:03 -04:00
Scott Idem
2f19422c72 First round of package updates 2025-08-12 12:10:55 -04:00
Scott Idem
d3f71be94e Minor update to make the selected Post Comment update when the liveQuery value changes. 2025-08-12 12:02:46 -04:00
Scott Idem
a4b3d3887f The notifications to Post Commenters should be working now. 2025-08-11 18:34:58 -04:00
Scott Idem
6622fc4169 Working on IDAA BB Post Comment notifications and related. 2025-08-11 17:50:01 -04:00
Scott Idem
7ef18ce105 More work on dark mode clean up. Wrapping up for the week. Happy almost birthday me. 2025-08-08 17:49:58 -04:00
Scott Idem
b95111503d Never ending working styling for light and dark mode in Novi. 2025-08-08 15:57:46 -04:00
Scott Idem
5187f6455a Getting the IDAA BB ready with the tech notification 2025-08-08 13:30:31 -04:00
Scott Idem
bfe9823902 More work on the notification component and IDAA. 2025-08-07 17:02:25 -04:00
Scott Idem
e286357c8d More work on the help tech notification. Added to Archives and Meetings so far. 2025-08-07 16:48:17 -04:00
Scott Idem
a789866642 First version of the technical help notification is ready for IDAA. 2025-08-07 10:29:46 -04:00
Scott Idem
d993ca5938 Saving work for the day. Need to finish this up for IDAA ASAP. 2025-08-06 21:40:18 -04:00
Scott Idem
0a4940161d Initial work on finally creating and implementing more generic and standardized CRUD functions for my Aether objects. It should work very well for Delete, Create, and Update. Load and Load List will need more work. 2025-08-01 17:30:30 -04:00
Scott Idem
9ed4bd85e1 Minor change to button style in Novi. 2025-07-29 17:34:54 -04:00
Scott Idem
93804c23d7 Bug fix for Archive Content sorting. This should be applied everywhere.... fun. Also slight improvement to the IDAA media player. Now with Play and View text. and a new icon in the button. 2025-07-29 12:34:56 -04:00
Scott Idem
dfd39ae8c9 Permission change so staff can remove linked files 2025-07-25 14:45:20 -04:00
Scott Idem
4568d63620 Bug fix for search results not showing. 2025-07-23 17:02:36 -04:00
Scott Idem
9d72337d43 Bug fix for event file table list. Links not showing. 2025-07-23 16:31:06 -04:00
Scott Idem
4861ae0499 Lot of updates to Svelte 5 syntax 2025-07-23 16:21:27 -04:00
Scott Idem
8504f4b79a Page clean up. Show less by default. 2025-07-23 14:22:48 -04:00
Scott Idem
1f024d70f3 Style improvements for icons and related. 2025-07-23 13:31:30 -04:00
Scott Idem
ced62cfd99 Style improvements for file uploads and related. 2025-07-23 13:22:34 -04:00
Scott Idem
5410717dcd Update to allow for searching based on the session POC (LCI Champion). Other minor bug fixes and code clean up. 2025-07-23 11:14:40 -04:00
Scott Idem
47eb745f3b Work on file uploads and manage. 2025-07-22 19:02:16 -04:00
Scott Idem
1e94043e19 Bug fix for IDAA Archive Content edit button. Updates related to new Launcher. 2025-07-22 15:56:07 -04:00
Scott Idem
7d07879e21 Do not show Play/View if nothing to play or view 2025-07-22 10:33:03 -04:00
Scott Idem
1d840052c7 More work on the new Launcher. Wrapping up for the day. 2025-07-21 20:36:44 -04:00
Scott Idem
2e39c5f67b More code clean up. 2025-07-21 18:21:36 -04:00
Scott Idem
e962d629a3 Saving before working on the event_file functions 2025-07-21 17:41:24 -04:00
Scott Idem
a3999e5617 Mass changes 2025-07-21 16:46:33 -04:00
Scott Idem
b54f43be35 Lots of code clean up. Finally working on the Launcher piece again. 2025-07-21 16:40:37 -04:00
Scott Idem
ee0e108322 More work on page load and cache checking 2025-07-21 13:07:25 -04:00
Scott Idem
0ac7bea046 Improvements on how posts are pulled in and sorted. 2025-07-18 18:15:18 -04:00
Scott Idem
fd69610a3a Wrapping up for now. 2025-07-16 15:12:26 -04:00
Scott Idem
eb396b0a55 More minor changes 2025-07-16 14:46:43 -04:00
Scott Idem
047f6d7048 More work on the menus... 2025-07-16 14:29:57 -04:00
Scott Idem
eaffc44772 More work on the system and debug menus and related info. 2025-07-16 13:57:12 -04:00
Scott Idem
32c3be9983 Forgot to change testing. 2025-07-15 23:36:37 -04:00
Scott Idem
03c0dd6d13 Sort of preventative bug fix early in page load 2025-07-15 23:35:23 -04:00
Scott Idem
a378f92c58 Small bug fix. 2025-07-15 21:32:19 -04:00
Scott Idem
fa5de6e7df Done for the night 2025-07-15 20:43:05 -04:00
Scott Idem
a52cc3808b The new new new version of the system menu seems to be working pretty well. Wrapping up for the day. 2025-07-15 20:36:13 -04:00
Scott Idem
7b853ede8c Moving on to the user sign in/out 2025-07-15 17:55:53 -04:00
Scott Idem
8692771efb Work on the system and debug menus 2025-07-15 16:16:10 -04:00
Scott Idem
6c79be7179 Now with better Zoom info support. 2025-07-14 21:11:58 -04:00
Scott Idem
de2b5db21a More updates for IDAA style 2025-07-14 14:44:51 -04:00
Scott Idem
37bcb7940d More work on the IDAA Recovery Meetings edit styling and related 2025-07-14 14:30:00 -04:00
Scott Idem
3e36100b9b Actually deleting things 2025-07-11 17:08:32 -04:00
Scott Idem
84138943a6 Removing old files 2025-07-11 17:07:19 -04:00
Scott Idem
bd10d98ada Package updates 2025-07-11 16:43:03 -04:00
Scott Idem
20ad1370e2 More style updates.... 2025-07-11 16:30:27 -04:00
Scott Idem
bcd42412f4 More style changes for Novi site. 2025-07-11 15:59:04 -04:00
Scott Idem
299d5b71c3 More layout fixes for IDAA.... 2025-07-11 15:05:38 -04:00
Scott Idem
e23999d728 Work on OSIT default theme 2025-07-11 13:34:02 -04:00
Scott Idem
b133aa1285 Various bug fixes and improvements. Now able to correctly create and delete Recovery Meetings. 2025-07-11 13:12:45 -04:00
Scott Idem
6e4649882c Improvements and other minor fixes. Wrapping up for the night. 2025-07-10 21:10:06 -04:00
Scott Idem
1e35681116 Minor changes 2025-07-10 19:53:27 -04:00
Scott Idem
ea30697ffb Lots of work on searching. Other related code clean up. 2025-07-10 19:46:41 -04:00
Scott Idem
8bf9d488cd Rework of the IDAA Recovery Meetings search. Other related updates and bug fixes. Added preventDefault() 2025-07-10 15:45:48 -04:00
Scott Idem
770e48842b Bug fixes for form save. Use custom preventDefault function. 2025-07-09 19:25:58 -04:00
Scott Idem
b030c0eec4 The IDAA Archives seem to be working pretty well. Still need some more testing. 2025-07-09 17:43:41 -04:00
Scott Idem
06cf665b06 Lots of clean up. Updates to Archive related admin section and some fields. 2025-07-09 16:33:48 -04:00
Scott Idem
8a80bb1a2f Working on bug fix for viewing the IDAA Recovery Meeting list after viewing a Meeting. 2025-07-09 14:33:55 -04:00
Scott Idem
4f6684e2bd Minor changes and clean up 2025-07-09 14:16:04 -04:00
Scott Idem
8bd42d1896 Bug fix for event_id being added as a URL param. Other fixes. 2025-07-09 14:05:51 -04:00
Scott Idem
d97e6e74aa More work on editing a meeting 2025-07-09 13:32:56 -04:00
Scott Idem
628659f348 Bug fixes for loading the IDAA Rec Mtg when navigating. Other improvements. 2025-07-09 11:46:27 -04:00
Scott Idem
6bdedecfd8 Working on getting Recovery Meeting edit to show correctly when navigating from list of meetings. 2025-07-08 20:12:28 -04:00
Scott Idem
8672796bac Minor improvements. Now with spell check! 2025-07-08 19:19:27 -04:00
Scott Idem
ef291f4be0 Recovery Meeting editing looks pretty good now. 2025-07-08 18:47:54 -04:00
Scott Idem
3c404acdfd Saving work on making things look good for IDAA Recovery Meetings and BB. 2025-07-08 18:16:31 -04:00
Scott Idem
fcefcc510b Saving work on IDAA pages 2025-07-08 16:53:45 -04:00
Scott Idem
32c1899cb6 Fixed a file upload and management bug. Trying to get to a good stopping point. 2025-07-07 18:34:40 -04:00
Scott Idem
b028bd7b32 More improvements for IDAA BB 2025-07-07 18:01:57 -04:00
Scott Idem
2eb4ddf1eb Sort of bug fix for file uploads 2025-07-07 17:16:23 -04:00
Scott Idem
1d08f960b0 Testing before going live.... 2025-07-07 16:44:58 -04:00
Scott Idem
b675cad43d Things look good for the IDAA BB. Need to test one last time from start to finish. 2025-07-07 16:27:12 -04:00
Scott Idem
f0fae620ea Finalish clean up for IDAA BB Posts 2025-07-07 15:25:47 -04:00
Scott Idem
cc8bbffdbf The sys menu finally looks and works better. Still needs more work though... Finally done for the week....? 2025-07-02 18:12:04 -04:00
Scott Idem
07979cb529 One last style update... 2025-07-02 17:49:24 -04:00
Scott Idem
429403ced6 Work on some layout and placement issues with the Journal cfg edit, sys menu, and debug menu. Wrapping up for the week. Long vacation weekend finally! 2025-07-02 17:38:34 -04:00
Scott Idem
dba6ac9e3b Hiding old buttons. 2025-07-02 17:14:54 -04:00
Scott Idem
d3a2485970 Minor correction. 2025-07-02 17:11:31 -04:00
Scott Idem
40061b92ca I have the new BB Posts working well for IDAA now. NOTE: I intentionally split the API calls that are triggered on layout and page loads. 2025-07-02 17:09:52 -04:00
Scott Idem
25de3407fd Hiding old buttons 2025-07-02 13:57:16 -04:00
Scott Idem
f8461f367e More work on the BB Posts for IDAA. Can now edit, update, and create now posts. 2025-07-02 13:52:30 -04:00
Scott Idem
50deb79f6b Not sure... I need to get to a good point tomorrow. 2025-07-01 16:58:25 -04:00
Scott Idem
a691e7d22d Wrapping up for hte day 2025-06-30 18:58:06 -04:00
Scott Idem
238416d903 The BB Posts have been updated to use a new page the Post. Seems to be working well. Wrapping up for the day. 2025-06-30 18:40:32 -04:00
Scott Idem
ec7ec7b566 Moving away from using modal with iframes. Scroll issues. Especially with Safari. 2025-06-30 18:09:08 -04:00
Scott Idem
2d66984581 Some code clean up. Bug fix for <Modal /> placement. 2025-06-30 15:54:48 -04:00
Scott Idem
088b32e4f1 Wrapping up for the day. The new IDAA versions are almost ready to go live. 2025-06-27 18:44:08 -04:00
Scott Idem
a6edc461f3 Trying to get to a good stopping point for the day. 2025-06-27 18:16:46 -04:00
Scott Idem
4c0b1d4c50 Work on style updates. Able to create new meetings again. 2025-06-27 17:36:00 -04:00
Scott Idem
e87fae34f8 The IDAA BB post page is looking good. Testing.... 2025-06-27 15:55:49 -04:00
Scott Idem
74a098fbde Just saving my work so far. 2025-06-27 15:31:18 -04:00
Scott Idem
fbcebcf816 Lots of clean up. Going to go with backup plan for IDAA and dealing with the Novi iframes. 2025-06-27 15:01:46 -04:00
Scott Idem
9914fd1700 General clean up of files. Less debug. Less extra stuff. 2025-06-27 12:44:23 -04:00
Scott Idem
bd0d96cb83 Work on general layout improvements. Making special cases for Safari browsers. 2025-06-26 20:41:25 -04:00
Scott Idem
4ef2e7cd6b Work on getting the scroll to work for Safari.... 2025-06-26 16:56:00 -04:00
Scott Idem
71b2de27ce Cleaning layout related... 2025-06-26 15:49:46 -04:00
Scott Idem
1f46b51c9a More significant updates to the general layout and styling per module. 2025-06-26 14:39:30 -04:00
Scott Idem
ce59a848d6 Fix scroll with overflow-auto 2025-06-26 12:32:24 -04:00
Scott Idem
b34f4bb3ce Giving more permissions to trusted/staff users. 2025-06-26 10:16:22 -04:00
Scott Idem
55dc2ab48c New scroll to top button and functions. 2025-06-25 18:29:33 -04:00
Scott Idem
c947e9e77a Making things look nicer. Also more respect for show/hide toggles. 2025-06-25 15:15:34 -04:00
Scott Idem
370396a633 Style updates. Allow easier ability to change presentation code and description. 2025-06-25 14:44:47 -04:00
Scott Idem
7cb8639230 Permission change for "Delete" presenter button. 2025-06-25 10:29:28 -04:00
Scott Idem
dde9801fe6 Updates getting ready for LCI 2025-06-24 18:51:07 -04:00
Scott Idem
7b4ec1fe7e Almost done with prep for LCI walk through. 2025-06-24 12:26:24 -04:00
Scott Idem
c47019ddba Mostly style improvements in general and for LCI 2025-06-24 11:48:56 -04:00
Scott Idem
d86558caa0 Lots of minor changes to get ready for LCI 2025-06-24 10:52:10 -04:00
Scott Idem
db4c061f19 Prep for LCI walk through again 2025-06-24 10:14:28 -04:00
Scott Idem
357e135451 Minor clean up 2025-06-23 19:03:04 -04:00
Scott Idem
2816c09003 More work on IDAA and LCI style and themes. 2025-06-23 18:26:49 -04:00
Scott Idem
626f0f2351 IDB table name fixes 2025-06-23 16:00:33 -04:00
Scott Idem
0b345e325e Updates related to IDAA API functions and related. Some style updates. 2025-06-23 15:49:53 -04:00
Scott Idem
1ad1251931 More work on IDAA styles 2025-06-23 14:47:37 -04:00
Scott Idem
e93c70e0e4 More IDAA related updates 2025-06-23 14:15:50 -04:00
Scott Idem
b59dcf20d5 Work on IDAA modules 2025-06-23 13:55:59 -04:00
Scott Idem
40cba6d841 Back to work on style changes related to TW 4 2025-06-23 13:10:11 -04:00
Scott Idem
574eb8c635 Last minute removing of older components that need to be updated later. No more Tab with Skeleton? 2025-06-20 18:15:51 -04:00
Scott Idem
4e63c8418e Package updates 2025-06-20 17:58:09 -04:00
Scott Idem
0bccaa226f Lots of work updating the styles. Trying to wrap up for the day/week. 2025-06-20 17:56:54 -04:00
Scott Idem
eebcd7c731 Updating the module menu to the new styling 2025-06-20 15:12:38 -04:00
Scott Idem
e5d41a7467 More updates 2025-06-20 12:57:18 -04:00
Scott Idem
b8a8653e0a More prep for LCI and other clean up 2025-06-20 12:35:22 -04:00
Scott Idem
93ffb8c3ad Package updates. More updates for LCI. 2025-06-20 10:59:04 -04:00
Scott Idem
94ccbd5f96 More updates. Done for the day. 2025-06-19 20:42:28 -04:00
Scott Idem
00322aee89 Wrapping up for the day. 2025-06-19 20:30:50 -04:00
Scott Idem
e18400d597 Updating styles to use the new Aether presets based on the TW and Skeleton presets. Prep for LCI 2025-06-19 20:25:09 -04:00
Scott Idem
09dc471842 More TW related updates. LCI related updates. 2025-06-19 17:09:44 -04:00
Scott Idem
f68a64b1f8 Saving slow but steady progress 2025-06-19 16:06:21 -04:00
Scott Idem
38e88d7b27 More updates everywhere related to TW v4 2025-06-19 15:05:15 -04:00
Scott Idem
1e0c6ec91b Work on general style clean up. So much to do... 2025-06-19 12:54:40 -04:00
Scott Idem
9617071361 Partial fix for hover selecting children to show/hide etc 2025-06-18 21:20:03 -04:00
Scott Idem
0d4885b778 Working on making Tailwind select children when hovering. 2025-06-18 21:10:53 -04:00
Scott Idem
376837950e Lots of work on upgrading to Tailwind CSS 4. Still more to go. Need to fix Modals everywhere. 2025-06-18 20:36:09 -04:00
Scott Idem
13912fd145 Still working on upgrading to Tailwind CSS v4 an dSkeleton v3..... 2025-06-18 17:59:48 -04:00
Scott Idem
db6e9dd019 NOT FULLY WORKING YET. Still working to upgrade fully to Tailwind CSS v4. 2025-06-18 14:48:42 -04:00
Scott Idem
e6394549bf Round 3 of updates. Preparing to update TailwindCSS to v4. 2025-06-18 13:31:42 -04:00
Scott Idem
2b65c0ff16 Second round of package updates 2025-06-18 13:19:51 -04:00
Scott Idem
f126abf39d Updating packages and theme finally 2025-06-18 13:09:04 -04:00
Scott Idem
61c78fc641 Cleaning up the session POC lookup 2025-06-16 19:34:18 -04:00
Scott Idem
487af455d0 Finally getting rid of the old display_name field. Use full_name_override! 2025-06-16 19:23:14 -04:00
Scott Idem
1d31d9d671 Updating the sign in process for presenters and session moderators. Got rid of old code. 2025-06-12 14:15:30 -04:00
Scott Idem
88d856ab2c Work on reports and prep for LCI 2025-06-11 12:19:32 -04:00
Scott Idem
e0f0b774ef Making the max person results sticky 2025-06-10 17:55:46 -04:00
Scott Idem
8c51380fb5 Cleaning up and updating the person related sections. Prep for LCI opening. 2025-06-10 17:37:04 -04:00
Scott Idem
c10abd596e General code clean up related to the person functions. Less direct use of params and params_json 2025-06-10 14:32:00 -04:00
Scott Idem
39a878ac38 Updated the person functions. General clean up of code. 2025-06-10 12:16:19 -04:00
Scott Idem
4c1449bb8f Minor bug fix for typo 2025-06-10 11:12:18 -04:00
Scott Idem
ac81aadd6f Now able to search the Journal Entries! 2025-06-04 17:54:37 -04:00
Scott Idem
8c9f0afc02 Code clean up 2025-06-04 14:17:58 -04:00
Scott Idem
bed4b9f70e Added the extra tmp_sort fields. 2025-06-04 14:13:08 -04:00
Scott Idem
dbbd8209cc More work on updating Archives and Posts to use tmp_sort_x and other changes. 2025-06-04 14:04:51 -04:00
Scott Idem
f38d9b58ab More updates to start using the newer/better way of saving to IDB. 2025-06-04 12:28:16 -04:00
Scott Idem
83ff5681d6 First part of of getting the IDAA Archives to use the newer method to save to the IDB. 2025-06-04 12:04:41 -04:00
Scott Idem
695a520eb3 Work on bug fix for presenters not being save in the IDB. Also cleaned up the related functions to use the more standard enabled, hidden, limit, and offset params. Other minor clean up 2025-06-04 11:27:37 -04:00
Scott Idem
8279fab244 Adding activity logging to IDAA related section. 2025-06-02 19:08:37 -04:00
Scott Idem
b97e4002bc More work on making things right for IDAA. 2025-06-02 16:47:33 -04:00
Scott Idem
a2e4c710a0 Work on bug fix or something for IDAA and the page not fully loading properly. Unsure if this is related to Novi permissions check? 2025-06-02 13:31:22 -04:00
Scott Idem
eb32ae1eaa Package updates 2025-06-02 11:20:20 -04:00
Scott Idem
72522ceef4 Less and less debug 2025-05-23 19:06:55 -04:00
Scott Idem
454ec2ea5d Less debug 2025-05-23 19:02:37 -04:00
Scott Idem
e8acce6c43 Even more less debug 2025-05-23 18:55:57 -04:00
Scott Idem
6c496992aa Less debug 2025-05-23 18:48:27 -04:00
Scott Idem
f6426eb574 Sort of fixing word wrap 2025-05-23 17:51:15 -04:00
Scott Idem
23f182b964 Now slightly better 2025-05-23 17:34:16 -04:00
Scott Idem
240855f649 Minor fix for width 2025-05-23 17:16:20 -04:00
Scott Idem
82af7a00e5 Minor quick fix for needing some header for appending to an entry. 2025-05-23 17:00:33 -04:00
Scott Idem
5cf076fbe3 More work on the event object functions. Also a minor update to the recent files list options. 2025-05-23 16:45:29 -04:00
Scott Idem
7c70d93a68 Saving work after rounds of updates to the event object type functions. 2025-05-23 16:17:42 -04:00
Scott Idem
589320a850 Hopefully a bug fix for file upload progress on Event pages. Using the older Events specific component. 2025-05-23 15:09:08 -04:00
Scott Idem
c4d95e1c6a Wrapping up for the night. 2025-05-22 19:55:46 -04:00
Scott Idem
14f4adeafa Finally getting the event session list to use the LiveQuery with a list of IDs to work correctly. Now replacing old version. Well... maybe some more testing tomorrow. 2025-05-22 18:19:20 -04:00
Scott Idem
a75f40bf8d Progress on more low level updates to the Events module loading process. 2025-05-22 17:06:59 -04:00
Scott Idem
6b585090d0 Clean up to get ready for CMSC and LCI. 2025-05-22 13:27:23 -04:00
Scott Idem
15d417ba52 Lots of work with linking files to Journal Entries. 2025-05-20 15:37:27 -04:00
Scott Idem
83a8377155 Work on adding files to a Journal Entry 2025-05-19 19:23:16 -04:00
Scott Idem
2976d618f8 Check for params before trying to update params 2025-05-19 17:25:02 -04:00
Scott Idem
9af5c960f7 More complete bug fix for the API POST issue. 2025-05-19 17:16:30 -04:00
Scott Idem
f2059da9d1 Important bug fix for posting form data. The headers are case sensitive. Changed them all to Content-Type. 2025-05-19 17:01:13 -04:00
Scott Idem
f88e6cef89 Fixed and improved encryption handling. Also wrapping up for the day. 2025-05-16 17:29:33 -04:00
Scott Idem
8b68b0d2bb Just a version bump 2025-05-16 14:20:28 -04:00
Scott Idem
83d52b4e79 Minor fix for iframe hiding 2025-05-16 14:17:19 -04:00
Scott Idem
3041246638 More less debug 2025-05-16 14:06:35 -04:00
Scott Idem
ec404ab428 Less debug 2025-05-16 14:04:07 -04:00
Scott Idem
616cf2890c Code cleaning 2025-05-16 14:02:26 -04:00
Scott Idem
170eeef877 Package updates 2025-05-16 13:59:39 -04:00
Scott Idem
10fba7fef6 Minor update to cache times 2025-05-16 13:51:47 -04:00
Scott Idem
40ce368e59 More style clean up. Less is more info. 2025-05-16 13:41:24 -04:00
Scott Idem
bae46782d6 Minor text fixes 2025-05-16 11:55:00 -04:00
Scott Idem
cc354100ae Updates to show/hide some reports 2025-05-16 11:46:04 -04:00
Scott Idem
49139b3a1f Now with prepend or append to Entry content option. 2025-05-15 19:03:22 -04:00
Scott Idem
698459c207 Styles... 2025-05-15 16:32:10 -04:00
Scott Idem
e794a4c23a More config options. Work on click to expand Entry contents when in a list. 2025-05-15 16:02:54 -04:00
Scott Idem
53856a913b Adding more config options. Making things look better. 2025-05-15 15:07:37 -04:00
Scott Idem
72fb34e3f1 Work on passcodes and encryption 2025-05-15 13:03:43 -04:00
Scott Idem
dae482906d More style fixes 2025-05-15 10:34:14 -04:00
Scott Idem
ffa33b5fa0 Improved for showing the person's name 2025-05-14 21:24:25 -04:00
Scott Idem
211945828d Minor style fix for mobile 2025-05-14 20:55:28 -04:00
Scott Idem
2be4da1172 Note about iframes 2025-05-14 19:59:23 -04:00
Scott Idem
c46c670e87 Mostly layout and style clean up 2025-05-14 19:57:22 -04:00
Scott Idem
372cafeb01 Now with extra save buttons 2025-05-14 18:02:24 -04:00
Scott Idem
42a813dc52 Things look cleaner now 2025-05-14 17:11:21 -04:00
Scott Idem
238757782b Moving things around... trying to keep it clean 2025-05-14 16:47:48 -04:00
Scott Idem
e96675174f Minor changes 2025-05-13 17:54:23 -04:00
Scott Idem
24e1190874 Minor clean up 2025-05-13 17:18:40 -04:00
Scott Idem
5232c88a45 Lots of work making CodeMirror work. It is in a mostly useable state now. 2025-05-13 17:06:10 -04:00
Scott Idem
b5642583c7 Trying out CodeMirror. I think I like it? Use it in readonly mode for view. Wrapping up for the day. 2025-05-12 19:56:56 -04:00
Scott Idem
3b38c31ba0 Real work on getting CodeMirror working. I at least have a fancy highlighter and basic editor. 2025-05-12 19:00:19 -04:00
Scott Idem
52be5ac1f7 Trying not to break anything while I work on using CodeMirror. I hope. 2025-05-12 18:30:58 -04:00
Scott Idem
247773235e Adding first iteration of search... 2025-05-12 13:47:28 -04:00
Scott Idem
b2b006249b The Event and Event Session should now be using the new IDB save method and related updates. Need to TEST TEST TEST more now. 2025-05-09 16:49:38 -04:00
Scott Idem
e008950411 Lots of work trying to use the new core db_save_ae_obj_li__ae_obj() function. 2025-05-09 16:12:46 -04:00
Scott Idem
5ef6d7dc0c More updates related to replacing the forEach loop with the for loop. Async... await... 2025-05-09 14:32:45 -04:00
Scott Idem
dc7da8c930 More general code clean up. Improvement to IDB save for Event. 2025-05-09 14:13:59 -04:00
Scott Idem
8f1f7bfa7e Code clean up. Journal IDB save has been updated to properly await. 2025-05-09 13:44:19 -04:00
Scott Idem
8c81f6f65e Work on making the Journal Entry saving better. 2025-05-08 19:37:15 -04:00
Scott Idem
0e249b2e6d Work to improve encryption and decryption 2025-05-08 14:34:38 -04:00
Scott Idem
74cf6b7ca8 A bit less debug with new API fetch pass 2025-05-07 19:54:20 -04:00
Scott Idem
df3b455c18 Less debug. Code clean up. And it uses the Svelte fetch function!! I think it just works... 2025-05-07 19:49:27 -04:00
Scott Idem
7af1d41ff3 The POST function no longer needs Axios. It will now retry X times if it fails. 2025-05-07 18:46:39 -04:00
Scott Idem
2ff7b4fd70 Delete will now retry and no longer needs Axios. Code clean up. Bug fix when deleting a Journal Entry. 2025-05-07 18:12:43 -04:00
Scott Idem
86221e6aec Axios should not longer be needed. 2025-05-07 16:34:39 -04:00
Scott Idem
cdc4ee1af9 Updating the API functions to make the retry. 2025-05-07 16:17:34 -04:00
Scott Idem
7ea65ee495 Package updates 2025-05-07 14:53:53 -04:00
Scott Idem
4b939d0ca0 Minor style fixes 2025-05-07 14:14:27 -04:00
Scott Idem
5bfb3892e6 Bug fix when creating new Entry 2025-05-06 20:10:10 -04:00
Scott Idem
de740e1e37 Now many things are hidden away in the new Journal Entry menu. 2025-05-06 20:01:28 -04:00
Scott Idem
89822ef540 Progress on moving must buttons and secondary things to the Journal Entry menu. 2025-05-06 18:17:39 -04:00
Scott Idem
13b8255055 Work on encryption and other clean up. 2025-05-06 17:07:10 -04:00
Scott Idem
a27fdd5fc4 Wrapping up for the day. History field mostly works now. But has bugs! 2025-05-05 17:49:44 -04:00
Scott Idem
66b122dca5 More work on encryption of content and history. 2025-05-05 17:10:19 -04:00
Scott Idem
0b61596833 Updates to make Journals more secure 2025-05-02 13:01:49 -04:00
Scott Idem
8f515e034b Bug fix for checking if caches is expired 2025-05-02 10:58:15 -04:00
Scott Idem
77c53065bc Pulling out parts into separate files. Also minor clean up. 2025-05-02 10:48:09 -04:00
Scott Idem
f2751cbaf9 Minor wording and style changes 2025-05-01 19:14:06 -04:00
Scott Idem
c6d21fadc2 More work on making the loading process better 2025-05-01 18:59:37 -04:00
Scott Idem
9687fe0c90 Improvements to access type and sign in and out process. 2025-05-01 17:09:06 -04:00
Scott Idem
63cb0f2969 Minor update 2025-05-01 14:56:44 -04:00
Scott Idem
81e322b98b Version bump 2025-04-30 19:16:44 -04:00
Scott Idem
70cf91b9ee Added notes 2025-04-30 18:59:39 -04:00
Scott Idem
122669aabf Style improvements 2025-04-30 18:52:05 -04:00
Scott Idem
9e4a67941e Saving work... 2025-04-30 18:25:02 -04:00
Scott Idem
4906e45b61 More clean up. Set the z index. 2025-04-30 17:44:55 -04:00
Scott Idem
15cb0aa0c5 Got themes working again. 2025-04-30 17:30:06 -04:00
Scott Idem
d7a1c03beb Minor button background change 2025-04-30 15:18:47 -04:00
Scott Idem
a76cc93acf Lots of work and testing on the debug and page load process. 2025-04-30 15:16:02 -04:00
Scott Idem
58bf335502 Added a third check for managers. Because why not. Wrapping up for the day. 2025-04-29 20:37:51 -04:00
Scott Idem
d256abc9b3 Working on more streamlined page load process 2025-04-29 20:15:37 -04:00
Scott Idem
007eb4ec9f Bug fix for attaching files to a BB Post. 2025-04-29 14:33:17 -04:00
Scott Idem
f2384f2714 Hopefully improved bug fix for IDAA members. 2025-04-29 13:31:52 -04:00
Scott Idem
be9c67e667 Work on cache handling 2025-04-29 12:31:21 -04:00
Scott Idem
6094d5a79d Now wrapping up... 2025-04-28 18:14:21 -04:00
Scott Idem
cbb73ed3fd Last minute clean up before wrapping up for the day. 2025-04-28 17:37:36 -04:00
Scott Idem
12167a3bc6 Now with actual encryption! 2025-04-28 17:18:29 -04:00
Scott Idem
8c3f05a2ed Work on encryption 2025-04-28 13:06:27 -04:00
Scott Idem
b5a4a38514 Bug fix for new Journal not linked to person_id 2025-04-28 11:59:38 -04:00
Scott Idem
6314d8f6e6 Now with first version of encryption! 2025-04-26 12:27:44 -04:00
Scott Idem
9bfb6580f2 More fixes related to permissions and Novi for IDAA 2025-04-25 16:36:21 -04:00
Scott Idem
f1dc6bd3dc Things are working better with the version changes. 2025-04-25 16:03:16 -04:00
Scott Idem
15ee3da76d Working on annoying version bug fixes. Also trying to make sure the show/hide lock menu works correctly. 2025-04-25 14:37:12 -04:00
Scott Idem
7c30b163b1 Improved sorting 2025-04-22 09:54:23 -04:00
Scott Idem
3ad1fa429a Minor change to info displayed 2025-04-18 15:44:44 -04:00
Scott Idem
d29d325af5 Turn off edit mode for safety 2025-04-18 15:28:05 -04:00
Scott Idem
1828b0f141 More improvements to the passcode lock process 2025-04-18 15:23:55 -04:00
Scott Idem
6d235d9159 Making the passcode entry faster 2025-04-18 15:00:16 -04:00
Scott Idem
ccba530223 Cleaned up the page loading for IDAA section 2025-04-18 14:01:51 -04:00
Scott Idem
1e099a275b More better better msg 2025-04-18 13:54:24 -04:00
Scott Idem
622e0db3d7 Better access denied warning message. 2025-04-18 13:49:33 -04:00
Scott Idem
fb937290eb Making a better version check and refresh/reload 2025-04-18 13:38:47 -04:00
Scott Idem
35b4079b90 Minor bug fixes 2025-04-18 11:02:34 -04:00
Scott Idem
204f2ed988 Package updates and minor clean up. 2025-04-18 10:44:06 -04:00
Scott Idem
3d2ff02f8c More package updates and testing 2025-04-18 10:25:10 -04:00
Scott Idem
1f10b64d13 Package updates 2025-04-18 10:11:47 -04:00
Scott Idem
f55931d0e3 Minor fix if PATCH fails 2025-04-14 21:01:56 -04:00
Scott Idem
a851c5fe64 Now with ability to set archive on datetime. Need to fix the timezone though. 2025-04-14 20:05:14 -04:00
Scott Idem
d274e37e37 Minor bug fixes 2025-04-14 18:52:59 -04:00
Scott Idem
3a47b77641 Work on hiding certain entries by default. Ability to append to an entry. 2025-04-14 18:33:59 -04:00
Scott Idem
2133fa520e Work on placement 2025-04-11 18:12:58 -04:00
Scott Idem
c4c657081f Possible bug fix for Svelte trigger loop 2025-04-11 17:36:13 -04:00
Scott Idem
c29cee4511 Lots of work on the new global app menu. 2025-04-11 17:16:14 -04:00
Scott Idem
3df0739e96 Working on new Aether App Menu. 2025-04-11 15:13:00 -04:00
Scott Idem
bb84b4bbb4 Adding a Change Password option. 2025-04-11 13:04:03 -04:00
Scott Idem
deef453580 Messing with Journal colors 2025-04-11 12:19:17 -04:00
Scott Idem
9adcc6d54c Making it easy to move an Entry to a different Journal. 2025-04-11 12:01:13 -04:00
Scott Idem
bd1ceee1ad Added check in case the Journal Entry creation fails 2025-04-09 19:50:49 -04:00
Scott Idem
2515ba5577 Cleaned up Journal Entry update functions 2025-04-09 16:18:56 -04:00
Scott Idem
3587258ec7 Working on saving journal entry edits 2025-04-09 15:45:38 -04:00
Scott Idem
b505424c9d Improved the way saving and updating of Journal Entry records work. 2025-04-09 13:43:01 -04:00
Scott Idem
adda3e79c5 Less other debug while working on Journals 2025-04-09 13:11:09 -04:00
Scott Idem
e1848dddb5 Work on Dexie liveQuery for Journals 2025-04-09 12:40:00 -04:00
Scott Idem
10c3e34b38 Improved sign in process and UI 2025-04-09 12:09:41 -04:00
Scott Idem
0d8b47af10 Now with the ability to look up user email and send user auth key. 2025-04-08 15:51:05 -04:00
Scott Idem
73eee7b8ff Trying to fix a bug when locking the quick access. It does not seem to stick. This ia a problem that needs to be fixed. For now I think I have a temporary workaround. 2025-04-04 19:12:32 -04:00
Scott Idem
b967eed0a5 Lots of work on user person security. Also some general clean up. Wrapping up for the day. 2025-04-04 18:31:31 -04:00
Scott Idem
6e41833f82 Improved styles with colors. More config options. Other updates. 2025-04-03 19:19:03 -04:00
Scott Idem
e022645f64 Now with a description and basic color scheme. Saving before making some more changes. 2025-04-03 18:27:59 -04:00
Scott Idem
2ab026611f More style work 2025-04-03 17:01:29 -04:00
Scott Idem
32553ca429 Style improvements 2025-04-03 16:51:44 -04:00
Scott Idem
98676dffd9 Style improvements 2025-04-03 16:13:18 -04:00
Scott Idem
ca2c5c7baf Fixed height bug when viewing Entry 2025-04-03 15:36:09 -04:00
Scott Idem
f59a159712 Minor change... 2025-04-02 17:48:55 -04:00
Scott Idem
ee5bd83673 Making things look better 2025-04-02 17:46:06 -04:00
Scott Idem
14d68e2a5d Never ending style tweaks 2025-04-02 17:31:50 -04:00
Scott Idem
bd4de70ac8 More style 2025-04-02 17:21:59 -04:00
Scott Idem
2575a57ba7 Work on overall styles 2025-04-02 17:19:38 -04:00
Scott Idem
304c1e4123 Improved copy function with rich text 2025-04-02 16:36:10 -04:00
Scott Idem
56502981d3 More style improvements when in edit mode 2025-04-02 16:08:04 -04:00
Scott Idem
376f77ad8f Style improvements for small screens 2025-04-02 16:00:08 -04:00
Scott Idem
e653d4d92a Lots of updates. And now with the ability to copy the rendered HTML version! 2025-04-02 15:30:36 -04:00
Scott Idem
7fa0d5cc5b General clean up and improvements. 2025-04-02 13:42:14 -04:00
Scott Idem
b9f4189a95 Code clean up 2025-04-02 13:00:29 -04:00
Scott Idem
b4f2be0f13 Now with the ability to clone template entries 2025-04-02 12:56:08 -04:00
Scott Idem
0e72d27dbd Saving work from last night 2025-04-02 11:24:08 -04:00
Scott Idem
7f1759ed4b Style fixes 2025-04-01 19:24:46 -04:00
Scott Idem
f6449b48e6 General improvements and minor fixes 2025-04-01 19:11:16 -04:00
Scott Idem
a41ecb45a9 Bug fix related to saving entries with mixed changes 2025-04-01 18:42:32 -04:00
Scott Idem
d393ed2c7a More work on making the Journal's module actually useful 2025-04-01 17:40:33 -04:00
Scott Idem
f423345e42 Minor temp bug fix 2025-03-28 17:27:25 -04:00
Scott Idem
aaaa0da1f9 Minor changes 2025-03-28 17:17:56 -04:00
Scott Idem
8539ccc2f4 Working on update a lot of pages using the ae_loc hub section. 2025-03-28 14:33:26 -04:00
Scott Idem
1059cf5683 Can now edit some basic Journal cfg and other clean up 2025-03-24 17:50:10 -04:00
Scott Idem
b37db30368 Working ability to create new Journals 2025-03-24 16:33:12 -04:00
Scott Idem
d424ec24c1 Again 2025-03-24 15:25:59 -04:00
Scott Idem
b393427651 Minor documentation update 2025-03-24 15:24:35 -04:00
Scott Idem
a19f6fe97e Merge remote-tracking branch 'refs/remotes/origin/ae_app_svelte_kit_v2_dev' into ae_app_svelte_kit_v2_dev 2025-03-24 15:23:26 -04:00
Scott Idem
d8d6728659 Update to documentation 2025-03-24 15:19:49 -04:00
Scott Idem
a9351b4143 More package updates 2025-03-24 15:02:23 -04:00
Scott Idem
00f3d6087f Package updates 2025-03-24 14:43:36 -04:00
Scott Idem
4715d13dda Wrapping up for the day. 2025-03-21 19:13:30 -04:00
Scott Idem
f45540a31f Trying to save changes 2025-03-21 17:16:07 -04:00
Scott Idem
db762a3c91 Journals is working pretty well. Most basic functions work now. 2025-03-21 17:08:58 -04:00
Scott Idem
8826ebf92f Lots of work on the Journals 2025-03-21 16:26:01 -04:00
Scott Idem
35354a9d0f Work on the new Journals. Just saving things while they are working well. 2025-03-21 11:03:38 -04:00
Scott Idem
596986afb7 Work on the new Journals module. Journal entries are now partially viewable. 2025-03-20 11:59:48 -04:00
Scott Idem
7fde0abb16 Renamed file to possibly use later 2025-03-20 09:30:07 -04:00
Scott Idem
0f22ad0584 Better handling of file types (extensions) 2025-03-18 17:33:27 -04:00
Scott Idem
253a1c59d6 Minor style change 2025-03-18 17:01:42 -04:00
Scott Idem
42ac7911f2 Using the hosted file select method is 90% working. It still needs to create a new hosted_file_link record. 2025-03-18 16:37:19 -04:00
Scott Idem
6749ecc4c3 Mostly style fixes 2025-03-18 15:23:41 -04:00
Scott Idem
c96e59c660 Getting ready to make the new hosted file management and tools live on dev. Then on prod... 2025-03-18 15:01:30 -04:00
Scott Idem
39d0a210f3 Lots of work on file management and video processing (ffmpeg). 2025-03-17 19:38:38 -04:00
Scott Idem
ab055beaff Modified the root style for overflow auto 2025-03-16 04:16:11 -04:00
Scott Idem
b62a267ee8 Wrapping up for the night at 4 AM. Made lots of progress with the Journals module. Should have saved more often. 2025-03-16 04:04:58 -04:00
Scott Idem
d8020b3d77 Saving my work beforeI rename the notes module to journals module. Finally. 2025-03-15 23:21:06 -04:00
Scott Idem
183d431e1d Doing some more work on the new Notes objects. 2025-03-15 21:24:25 -04:00
Scott Idem
f4bd387ed9 Package updates 2025-03-06 18:49:27 -05:00
Scott Idem
8acb4a8c7b Minor clean up 2025-03-04 18:06:05 -05:00
Scott Idem
87b1859b0b Version bump 2025-03-04 17:36:39 -05:00
Scott Idem
643edbd50a Package updates round 3ish. Other minor code clean up. 2025-03-04 17:31:40 -05:00
Scott Idem
3719739b57 Package updates round 2 2025-03-04 15:42:03 -05:00
Scott Idem
75c7a29ae4 Package updates round 1 2025-03-04 15:32:43 -05:00
Scott Idem
33bc99c2bd Bug fix for saving a post comment and the post data not being ready. 2025-03-04 12:26:45 -05:00
Scott Idem
7e92613536 Trying to get the email notifications to include all the post data. 2025-03-04 11:33:52 -05:00
Scott Idem
6e330a639e Minor bug fix 2025-02-26 11:11:56 -05:00
Scott Idem
89b14c877e Testing emails.... 2025-02-12 19:19:39 -05:00
Scott Idem
3078e33b97 Minor changes 2025-02-12 18:10:49 -05:00
Scott Idem
ed89776a60 Minor changes to style and related for IDAA recovery meeting status 2025-02-04 12:34:49 -05:00
Scott Idem
75d7a502f0 Adding the new event status for IDAA. 2025-02-04 12:01:32 -05:00
Scott Idem
fc517540dc Wrapping up for the day. 2025-01-28 18:57:14 -05:00
Scott Idem
cb19031989 Less debug 2025-01-28 18:49:34 -05:00
Scott Idem
bdea373c7f Better error handling if the site domain is not found or returned. 2025-01-28 18:47:30 -05:00
Scott Idem
acff856e25 Trying to optimize the initial fetch calls when loading. 2025-01-28 18:12:01 -05:00
Scott Idem
a9c96c905a Fade out long text 2025-01-28 16:25:07 -05:00
Scott Idem
c62507d484 Sort of bug fix and improvements for IDAA BB notifications and loading a post based on the URL param. 2025-01-28 11:51:27 -05:00
Scott Idem
db6b481983 Update to allow IDAA members to attach file. 2025-01-21 10:12:12 -05:00
Scott Idem
8b309d7b04 Forgot to save my work earlier...? 2025-01-15 22:05:41 -05:00
Scott Idem
6f11820857 Getting some basic things ready for CHOW 2025 2025-01-15 16:32:18 -05:00
Scott Idem
9dc4540329 Now images will show inline when viewing a post. 2025-01-14 16:48:24 -05:00
Scott Idem
7414cba165 Minor changes 2025-01-14 16:05:00 -05:00
Scott Idem
5d6df59ee1 Refresh of lookups is more likely. 2025-01-13 15:39:10 -05:00
Scott Idem
321c48513f Updates to clean up the lookups for time zones, countries, and subdivisions. 2025-01-13 15:28:24 -05:00
Scott Idem
8d4c770f19 Updated packages previously. Minor changes 2025-01-09 10:12:20 -05:00
Scott Idem
106e655574 Minor changes 2025-01-08 17:41:07 -05:00
Scott Idem
e921f3a785 More clean up for IDAA. Mostly style related. 2025-01-08 16:10:51 -05:00
Scott Idem
aa893b5ea6 Various changes after call with IDAA. Mainly style changes. 2025-01-08 15:25:30 -05:00
Scott Idem
b64f4b01ad Minor style change 2025-01-08 12:21:26 -05:00
Scott Idem
f8e88b0355 Trying to improve the hosted file manage. 2025-01-07 20:22:44 -05:00
Scott Idem
641c6b28c3 Working on new and improved video clipping utility. 2025-01-07 13:49:30 -05:00
Scott Idem
ff6e240a37 Better notes on if the home IP changes. 2025-01-06 16:42:54 -05:00
Scott Idem
ea115b6ac1 Less debug showing 2025-01-06 16:26:33 -05:00
Scott Idem
92af1a5962 Trying to track down a bug that is happening when run in Docker. Pretty sure it is related to a DNS resolution thing. The GET Object function shows better information if something goes wrong. 2025-01-06 16:24:47 -05:00
Scott Idem
b64e7a6b8a Wrapping up for the day. It is pretty much Christmas... 2024-12-24 12:55:18 -05:00
Scott Idem
69abe2e906 More IDAA Novi style changes. Less green for the options section. 2024-12-24 11:36:50 -05:00
Scott Idem
91e6556933 More style improvements for Novi 2024-12-24 11:28:26 -05:00
Scott Idem
f89183685a Lots of style clean up for buttons in Novi. Various bug fixes. Clean up of initial recovery meeting loading. 2024-12-24 11:18:37 -05:00
Scott Idem
47394d67ca Minor but annoying style fixes. Still more TipTap textareas to fix with w-full. Should that be the default? 2024-12-23 18:12:55 -05:00
Scott Idem
5977df38a7 Wrapping up for the day. Minor fixes to styling. 2024-12-23 18:04:04 -05:00
Scott Idem
f024ccbe0c Minor clean up 2024-12-23 17:39:46 -05:00
Scott Idem
066bd66178 Package updates and trying to fix a reversion with reactivity within the same page file. The Dexie liveQuery does not seem to refresh correctly when on the same page. It does show the update on child components. Even if nearly identical. 2024-12-23 17:23:36 -05:00
Scott Idem
24931de306 More work on tmp sorting fields 2024-12-11 16:18:28 -05:00
Scott Idem
3fef19488c Work on better sorting for the IDAA BB posts. Using generated tmp field. Date formats standardized. 2024-12-11 15:34:44 -05:00
Scott Idem
eee8a67235 Package updates. Point IDAA Recovery Meetings to prod server instead of dev. 2024-12-11 13:32:03 -05:00
Scott Idem
c96fb7bf00 Package updates 2024-12-11 13:17:00 -05:00
Scott Idem
3946e17300 Things are 98% ready to go for the new IDAA BB. 2024-12-11 13:16:00 -05:00
Scott Idem
c63ef94b77 Last minute changes to prep the new BB to go live soon. 2024-12-11 12:09:39 -05:00
Scott Idem
0f29682874 Improvements and fixes related to the BB. Increased default limit. 2024-12-11 11:44:54 -05:00
Scott Idem
9813d0544f Minor updates for IDAA's Novi site. 2024-12-10 18:51:47 -05:00
Scott Idem
af743f6e73 Last minute work for going live on Novi. Modified how the recurring text is generated. 2024-12-05 15:09:01 -05:00
Scott Idem
90c5b9414f More pages updated to Runes mode 2024-12-03 17:45:31 -05:00
Scott Idem
aaa6eaa433 Cleaning up the main layout. 2024-12-03 16:51:31 -05:00
Scott Idem
1bdd2aec65 Moving more pages to Runes mode. 2024-12-03 16:22:21 -05:00
Scott Idem
747e9fdb26 Setting the type to number for log_lvl. 2024-12-03 15:29:19 -05:00
Scott Idem
b3dfb5deec Starting to switch pages to Runes mode.... 2024-12-03 15:27:28 -05:00
Scott Idem
c34e62a0c5 Working on formatting for IDAA Novi site. 2024-12-03 14:48:59 -05:00
Scott Idem
6d94583885 More work on the new rich text editor... 2024-12-03 12:39:30 -05:00
Scott Idem
971ffbad02 Code clean up. Fewer warnings... 2024-12-03 11:36:24 -05:00
Scott Idem
0032d52ff9 Working on things after the Svelte upgrade. Got the new editor toolbar working again. I think I needed to reinstall the shadcn-svelte packages. 2024-12-03 11:15:08 -05:00
Scott Idem
e4797e178d More package and configuration related updates. 2024-12-03 10:28:56 -05:00
Scott Idem
c6631e221c More work on the new rich text editor. It may have a few bugs still. 2024-12-02 19:24:00 -05:00
Scott Idem
44907bc01f Getting the new new new rich text editor working. I think it is working... Yay Shad Editor that uses TipTap and Shadcn. 2024-12-02 18:56:45 -05:00
Scott Idem
940a7e9a21 Changes after major Svelte update. 2024-12-02 16:39:33 -05:00
Scott Idem
1f6793927b Upgrade to Svelte 5 and Vite 6!!! 2024-12-02 16:16:18 -05:00
Scott Idem
aeeb08ab36 Minor package updates 2024-12-02 15:45:39 -05:00
Scott Idem
a0473cb50b Trying to install updated packages to get the ShadEditor working. I hope. 2024-12-02 15:43:46 -05:00
Scott Idem
b7515f0680 Trying ShadEditor... Not sure about this. 2024-12-02 15:13:00 -05:00
Scott Idem
058c88c766 Clean up and working on the rich text editor. Will probably swap my version out for something else... 2024-12-02 14:56:22 -05:00
Scott Idem
c0fe69ea73 Bug fix for the archive_id not getting reset when viewing the list of archives. 2024-12-02 09:41:43 -05:00
Scott Idem
12b761e127 Minor updates before going live with the archives. 2024-11-26 10:53:49 -05:00
Scott Idem
5796ff09a1 Package updates 2024-11-22 17:26:57 -05:00
Scott Idem
4c09edaceb Trying to get more of the Tiptap buttons to work. Why does only bold, italics, strike work??? 2024-11-22 17:19:00 -05:00
Scott Idem
dd8181ba0e Style improvement 2024-11-22 14:36:37 -05:00
Scott Idem
7ba11a104d More work on getting the BB ready for IDAA. Improved notification handling. Bug fixes related to creating posts and comments. 2024-11-22 14:07:27 -05:00
Scott Idem
1868adad99 Work on post and comment email notifications. 2024-11-22 13:13:44 -05:00
Scott Idem
6a79cb165d Work on permissions and code clean up 2024-11-22 10:44:12 -05:00
Scott Idem
42aa9d356f More work on authentication for staff and against the Novi UUIDs. 2024-11-22 10:32:46 -05:00
Scott Idem
2f4e707e58 General clean up. Nothing should be broken... 2024-11-21 20:12:50 -05:00
Scott Idem
fbb45d50a7 Work on styles based on permissions and related. 2024-11-21 19:33:19 -05:00
Scott Idem
24a75d509f Less debug 2024-11-21 18:19:50 -05:00
Scott Idem
5ff63aa267 Still working on the initial loading... 2024-11-21 18:00:33 -05:00
Scott Idem
7e3420ec4d More work on the initial loading of things... Looks cleaner. 2024-11-21 17:23:31 -05:00
Scott Idem
600bf7caa4 More work on the initial loading. 2024-11-21 17:03:47 -05:00
Scott Idem
d1f04e4dc3 Trying to clean up the initial loading... Checking the local storage and indexes and site keys. 2024-11-21 16:45:13 -05:00
Scott Idem
2ef3c8bab5 Hopefully better and easier to understand site key allow access permissions.... 2024-11-21 14:57:58 -05:00
Scott Idem
cffde76c88 Re-work of site permissions and Novi permissions. 2024-11-21 14:19:08 -05:00
Scott Idem
fcec4ed96f Minor changes. 2024-11-20 19:06:07 -05:00
Scott Idem
e4485f2bda Fixes for layout and recurring pattern. 2024-11-20 18:36:24 -05:00
Scott Idem
1d713db712 More package updates. Less warnings. 2024-11-20 16:17:16 -05:00
Scott Idem
ec837c415a More package updates. Bug fix for the shared events menu. 2024-11-20 16:05:29 -05:00
Scott Idem
b8b86a5561 Package updates 2024-11-20 15:46:38 -05:00
Scott Idem
125ce32ddd Less extra stuff... less log entries and warnings. 2024-11-20 15:40:50 -05:00
Scott Idem
f6378c1a23 Less iframe related logging 2024-11-20 15:24:30 -05:00
Scott Idem
6b60c14159 Finally really starting to move things to v2 of the CRUD API. 2024-11-20 15:11:57 -05:00
Scott Idem
fd602a46ac Getting rid of Axios. Using (Svelte) fetch for get_object()... 2024-11-20 12:56:11 -05:00
Scott Idem
e220653f45 Removing old files. 2024-11-19 19:36:44 -05:00
Scott Idem
acf0a169ab Cleaning up old files 2024-11-19 19:33:01 -05:00
Scott Idem
90a74e5ce7 Code clean up. 2024-11-19 19:24:55 -05:00
Scott Idem
9ded8f7c7e Minor changes. Was working on the query status updates. Wrapping up for the day. 2024-11-19 19:11:52 -05:00
Scott Idem
185709e67a Much better searching triggers for recovery meetings (events). 2024-11-19 19:03:44 -05:00
Scott Idem
bf29856f6b Standardizing how things are reloaded. Triggers again! 2024-11-19 18:15:45 -05:00
Scott Idem
e2d67087ce Improvements on styling for Novi. 2024-11-19 17:42:26 -05:00
Scott Idem
9a681455ca Starting to finalize the recovery meetings for going live in Novi. 2024-11-19 17:31:29 -05:00
Scott Idem
fea392eff7 Bug fixes for enable related fields. 2024-11-19 16:53:24 -05:00
Scott Idem
fc8ee53724 Sort of bug fix or improvement for showing the post data. 2024-11-19 15:41:57 -05:00
Scott Idem
89885f9571 Now with a return to archive list button 2024-11-19 14:15:30 -05:00
Scott Idem
b0ae649824 Work on permissions for iframes and Novi. 2024-11-19 14:05:06 -05:00
Scott Idem
9a1d022d5a Work on permissions for IDAA members in Novi 2024-11-19 13:48:51 -05:00
Scott Idem
31272a8985 Moved library files around. Trying to keep things organized... 2024-11-19 13:29:05 -05:00
Scott Idem
28880f3160 Novi iframe related. Style improvements. 2024-11-19 13:12:49 -05:00
Scott Idem
77cc152837 General improvement for archive content creation. Better show/hide for enable and hide fields. Novi and iframe related updates. 2024-11-19 13:02:05 -05:00
Scott Idem
d1f37af192 Updated Novi iframe HTML content. 2024-11-15 17:01:21 -05:00
Scott Idem
01e320e172 Work on Novi related permissions. Pulled from iframe URL. 2024-11-15 16:56:56 -05:00
Scott Idem
6b34b806b2 Dealing with iframes. postMessage to parent iframe when certain things are opened/viewed. 2024-11-15 16:21:37 -05:00
Scott Idem
53deb5edcc Added m4a to the list 2024-11-15 15:42:58 -05:00
Scott Idem
a3a8f107d3 General clean up. Work on using iframes and setting the height correctly. 2024-11-15 14:38:59 -05:00
Scott Idem
547845ed62 Work on the delete functions. General clean up. 2024-11-15 13:03:58 -05:00
Scott Idem
0fd06ef216 More clean up and bug fixes related to posts. Better enable, hide, limit, etc params. 2024-11-15 12:24:20 -05:00
Scott Idem
bd5c8a0867 More work on the delete related functions. 2024-11-15 12:00:39 -05:00
Scott Idem
6a390762d3 Work on "delete" functions for recovery meetings. 2024-11-15 11:26:47 -05:00
Scott Idem
40081c2804 Marking old files for deletion. Improvement to archive content grouping. 2024-11-15 10:35:04 -05:00
Scott Idem
26faf50058 Fixed bug that disabled things when saved.... Sort of. At least for posts it was disabling them. I need to test this more. Again... 2024-11-14 18:52:04 -05:00
Scott Idem
804fddcb5a More work on the BB and related notifications. 2024-11-14 17:52:42 -05:00
Scott Idem
789c0d651e More work on posts. Getting ready for notifications working... 2024-11-14 16:36:46 -05:00
Scott Idem
dfd43963bb Improved the linked content (files) list. 2024-11-14 15:17:40 -05:00
Scott Idem
8df0bdf0cc Working on the style 2024-11-13 20:04:50 -05:00
Scott Idem
53f2f5dbc5 Now with links count 2024-11-13 18:54:44 -05:00
Scott Idem
4fe6194450 Working on posts with linked content (hosted files). 2024-11-13 18:31:44 -05:00
Scott Idem
7040578ac5 Updates related to the time being in 24 vs 12 hour format. 2024-11-13 10:43:44 -05:00
Scott Idem
26e1c89f1b Added parse for JSON before updating. 2024-11-12 16:58:20 -05:00
Scott Idem
34bcd9dd2d The archives are looking better now. Mostly style and sorting improvements. 2024-11-12 16:20:18 -05:00
Scott Idem
fedbbe9ae2 Improved styling. Less debug. Other clean up. 2024-11-12 14:13:51 -05:00
Scott Idem
1e1a4f1016 Better permissions. Ability to sort the meeting results. Other clean up. 2024-11-12 13:15:19 -05:00
Scott Idem
5d8a3a782e Fixed show/hide for hidden and disabled records. 2024-11-08 16:37:42 -05:00
Scott Idem
791454b8fa Minor text fixes 2024-11-08 15:47:41 -05:00
Scott Idem
f4538720b2 Lots of little fixes. Can now save archives. 2024-11-08 15:43:47 -05:00
Scott Idem
e6a9a5ceab Making the URL update when viewing and closing specific content. Other clean up. 2024-11-08 13:57:16 -05:00
Scott Idem
13d906428b Creating standardized functions. Mainly for create and delete. 2024-11-08 12:47:24 -05:00
Scott Idem
4fe04d9c3f Permission update 2024-11-08 11:30:58 -05:00
Scott Idem
abcd5c54c2 Can now save and delete archive content. This includes the hosted file. It still needs some work though. The content delete should also remove the hosted file. 2024-11-08 11:25:19 -05:00
Scott Idem
b93cacdfcc Wrapping up for the day. File uploads and deletes pretty much work now. Need to figure out whey the form does not refresh or just ignore? 2024-11-07 19:34:57 -05:00
Scott Idem
079ec80fbd Now with the ability to do basic archive content updates. The media player works. 2024-11-07 15:53:12 -05:00
Scott Idem
d3609764e3 Post and post comments now save correctly. The viewed post does not always reflect the update though. 2024-11-07 14:10:10 -05:00
Scott Idem
b381cbbc9e More clean up. Probably wrapping up for the day. Why are so many people so dumb, or they just don't seem to care. 2024-11-06 17:08:39 -05:00
Scott Idem
7e6b00c0eb Making the admin options consistent 2024-11-06 16:42:47 -05:00
Scott Idem
594074a1dd Minor changes 2024-11-06 15:41:21 -05:00
Scott Idem
6a609646cc Minor updates related to textarea 2024-11-06 15:38:12 -05:00
Scott Idem
94babed805 Minor fix for show/hide admin 2024-11-06 15:27:47 -05:00
Scott Idem
14d4be848a Cleaning things up before going back to making the forms functional. 2024-11-06 15:25:17 -05:00
Scott Idem
d0c4ef2179 Now with edit content partially ready. 2024-11-06 14:23:38 -05:00
Scott Idem
80965167a5 We can now see a list of archive content and it doesn't look terrible. 2024-11-06 13:15:16 -05:00
Scott Idem
b9698615be Now the list of archives shows. 2024-11-05 17:05:46 -05:00
Scott Idem
4d667d57a4 More work on getting post and comment editing working. 2024-11-05 16:33:24 -05:00
Scott Idem
cf997601f4 Work on editing of posts and posts comments. 2024-11-05 15:59:19 -05:00
Scott Idem
ac7016bb3e Starting real work on the IDAA BB (posts). Can at least view them and their comments now. 2024-11-05 12:37:46 -05:00
Scott Idem
4d2a78f80f Minor clean up 2024-11-04 17:31:39 -05:00
Scott Idem
23b82291a0 Improving the rich text editor. It still has some issues. Undo and redo do not work consistently. Wrapping up for the day? 2024-11-04 17:30:58 -05:00
Scott Idem
63f5168015 Making things looks nicer. Various fixes. 2024-11-04 16:59:30 -05:00
Scott Idem
ee7f981e2e Minor text fix 2024-11-04 15:34:44 -05:00
Scott Idem
deac79b861 Lots of work related to the IDAA Recovery Meetings. Better pulling in off lookup list data. 2024-11-04 15:29:16 -05:00
Scott Idem
2d047f5a10 Now able to save the HTML text from tip tap element. 2024-11-01 17:52:39 -04:00
Scott Idem
8ec01a1d64 More moving of files around. Hopefully nothing is broken again. 2024-10-30 18:40:47 -04:00
Scott Idem
26b3c53847 Things seem to be working. It said it was overwriting files though??? 2024-10-30 18:30:30 -04:00
Scott Idem
4f65374d7e More moving of files around. 2024-10-30 18:24:12 -04:00
Scott Idem
19ce353a26 Moving files around. Breaking links to sessions and other things. 2024-10-30 18:14:30 -04:00
Scott Idem
79e83c26a7 Ignore warnings 2024-10-30 16:33:27 -04:00
Scott Idem
80e7cecbf1 One last change 2024-10-28 18:10:37 -04:00
Scott Idem
a211570af9 Wrapping up for the day. Finally working on IDAA related events some more. 2024-10-28 18:07:06 -04:00
Scott Idem
2ebb411905 Package updates 2024-10-28 14:47:24 -04:00
Scott Idem
9c3fe62724 Updating the permissions. Now with show/hide email access link. 2024-10-28 14:37:24 -04:00
Scott Idem
07c0b569ca Now with the ability to log activities. Yay... 2024-10-23 01:53:25 -04:00
Scott Idem
cc084a32cf Fix for making the landscape images go full height and width. 2024-10-22 13:57:12 -04:00
Scott Idem
cfd78145f6 Quick package updates. 2024-10-20 16:53:24 -04:00
Scott Idem
b9d4f47f3a Got the screen saver mostly working now. Now config options yet though. 2024-10-20 16:51:22 -04:00
Scott Idem
2d644aafe8 Better sorting of presentations and session files. Slight style changes. 2024-10-18 19:14:20 -04:00
Scott Idem
295fa1b49a Finalizing things for LCI. The poster stuff looks better now. 2024-10-18 18:23:24 -04:00
Scott Idem
789d4f96e0 Minor clean up 2024-10-18 16:54:16 -04:00
Scott Idem
5da209ee1c Now with more download and copy link options. 2024-10-18 15:51:52 -04:00
Scott Idem
488031f90c The Launcher is looking pretty good for posters. 2024-10-18 13:21:35 -04:00
Scott Idem
de24f0dc80 Wrapping up for the night. Better alerts and things with the correct timezone... 2024-10-17 20:46:39 -04:00
Scott Idem
172763bc26 Working on device status and alerts. 2024-10-17 18:26:56 -04:00
Scott Idem
67b01c5884 Now with status updates for devices. 2024-10-17 12:56:10 -04:00
Scott Idem
a0d5a97d48 More npm commands 2024-10-17 11:24:24 -04:00
Scott Idem
7d9950fd70 Package and documentation updates. 2024-10-17 11:21:54 -04:00
Scott Idem
a2b7dd9450 Moved some files around. Improved style. No longer using other pres_mgmt nav component. Added links to the locations. 2024-10-17 10:36:03 -04:00
Scott Idem
63fea17472 Wrapping up for the day. Lots of improvements. More menu options for location and device related. 2024-10-16 18:48:14 -04:00
Scott Idem
590d274910 Better handling of the IDB refreshes and updates. 2024-10-16 16:21:17 -04:00
Scott Idem
deac7bd574 More work on making the locations and devices more useful. 2024-10-16 15:27:25 -04:00
Scott Idem
3c957692c3 Making progress with the new locations page and devices related. 2024-10-16 13:14:40 -04:00
Scott Idem
67a4fbe17e General code clean up. A lot less _random! 2024-10-16 10:28:47 -04:00
Scott Idem
9160591fc4 Making things look consistent on each page. 2024-10-15 18:57:02 -04:00
Scott Idem
2ae3fb07eb The last selected report is now sticky. 2024-10-15 17:21:22 -04:00
Scott Idem
1c7518ad3f Now with a working recent files report. Other improvements. 2024-10-15 17:01:43 -04:00
Scott Idem
9a951ee365 New reports for large files. Better file query as well. 2024-10-15 15:27:11 -04:00
Scott Idem
1189e2e877 Improvements to reports 2024-10-15 14:20:19 -04:00
Scott Idem
79a74db4ae Improving the reports 2024-10-15 11:11:33 -04:00
Scott Idem
7450edfdcf Now done for the night. 2024-10-14 20:05:57 -04:00
Scott Idem
4ec440146e Wrapping up for the night. 2024-10-14 19:11:05 -04:00
Scott Idem
e2a510ceaa Slow work on creating a textarea element thing. 2024-10-14 19:02:56 -04:00
Scott Idem
115751bcd7 Code updates for IDAA migration 2024-10-14 14:25:29 -04:00
Scott Idem
ca2658a324 Just package updates. Nothing should have broken... 2024-10-11 17:09:31 -04:00
Scott Idem
338c9b9b23 Making things look nicer still. 2024-10-10 16:44:23 -04:00
Scott Idem
5037579abe Cleaning things up. Making it easier to find things. 2024-10-10 16:02:47 -04:00
Scott Idem
980e8850be More clean up. 2024-10-10 13:14:38 -04:00
Scott Idem
ec2c37b715 Cleaned up the code. A lot less _random!! 2024-10-10 13:13:21 -04:00
Scott Idem
9093cc9957 Renamed some things to remove the _random part. 2024-10-10 12:56:22 -04:00
Scott Idem
79bc148e85 We can now download files remotely! 2024-10-09 20:47:46 -04:00
Scott Idem
6694ec92c7 Renamed a bunch of functions! 2024-10-08 16:34:06 -04:00
Scott Idem
c130e82fd0 Minor code clean up 2024-10-08 16:24:06 -04:00
Scott Idem
bd48596176 Better loading of presentations, presenters, and files. 2024-10-08 16:22:38 -04:00
Scott Idem
816db5281d Small permission view change 2024-10-08 15:03:06 -04:00
Scott Idem
d5ac26f0ef Use a list of file purpose options per event. 2024-10-08 14:38:39 -04:00
Scott Idem
f9b3b3a0eb Minor change 2024-10-08 14:10:43 -04:00
Scott Idem
a6b9115865 Working on handling received messages. Open a session. 2024-10-08 12:13:27 -04:00
Scott Idem
0799f9a1ab Show and hide the main launcher menu 2024-10-07 18:47:41 -04:00
Scott Idem
c3f4832f48 Now with a better download file container thing. Can change open with OS. 2024-10-07 18:30:09 -04:00
Scott Idem
03e6117024 Work on being remotely controlled. 2024-10-07 15:58:56 -04:00
Scott Idem
ccb36ca953 Cleaning things up like always. 2024-10-07 15:29:20 -04:00
Scott Idem
2ac495af8e Cleaned up the show/hide location and launcher links. 2024-10-07 14:47:26 -04:00
Scott Idem
820c151750 First attempt to add Google Analytics to SvelteKit. This should be per site. 2024-10-07 14:19:32 -04:00
Scott Idem
aef469ad9d Wrapping up for the day. Lots of tedious work on the Launcher. 2024-10-04 18:23:47 -04:00
Scott Idem
b6cd3f59e5 Work on the dev env and building for production and staging. 2024-10-03 20:48:41 -04:00
Scott Idem
7b84e1c1fc More work on the site permissions. 2024-10-03 16:29:45 -04:00
Scott Idem
0f49afec12 Working on improved default permissions and allow control per site and site domains. 2024-10-03 16:04:00 -04:00
Scott Idem
d6d4c88728 Various changes... Should have saved last night. Also send_email should NOT default to test mode! 2024-10-03 12:45:28 -04:00
Scott Idem
bb27942b52 Enable more security by default. 2024-10-02 18:21:01 -04:00
Scott Idem
89dd410aeb API bug fixes. Clean up. New util functions. Highlight times for newer files. 2024-10-02 17:32:36 -04:00
Scott Idem
1004104de0 Not sure... 2024-10-02 13:55:33 -04:00
Scott Idem
0e7df79bab Trying to fix things... 2024-10-02 13:33:17 -04:00
Scott Idem
581749ff41 The IDAA Recovery Meetings view and edit now display mostly correct. They still need work though. 2024-10-02 13:13:23 -04:00
Scott Idem
a189a1c336 Now the enable and hide buttons work. 2024-10-01 18:47:08 -04:00
Scott Idem
1c1845280b The search is working better now. Also better and less debug logging. 2024-10-01 18:09:27 -04:00
Scott Idem
fad58bf26f More general clean up. Making event queries easier to use and understand. 2024-10-01 16:59:08 -04:00
Scott Idem
47e9f9f5a1 General clean up. Improved event search and listing for IDAA. 2024-10-01 16:08:31 -04:00
Scott Idem
cca43b957a The event search now mostly works. 2024-10-01 13:36:50 -04:00
Scott Idem
d7284d5010 Improvement and updates to the event list loading and showing. 2024-10-01 11:28:50 -04:00
Scott Idem
35c901f144 Started pulling in the IDAA Bulletin Board code 2024-09-27 18:55:24 -04:00
Scott Idem
58928d07eb Moving files around 2024-09-27 17:42:46 -04:00
Scott Idem
6a8148228f Organizing things better. Hopefully nothing is broken!! Still need to move the event session related. 2024-09-27 17:21:57 -04:00
Scott Idem
d6c26e7511 The initial migration for IDAA Recovery Meetings. Progress 2024-09-27 15:20:26 -04:00
Scott Idem
495dd0e6d9 Trying to make the slightly newer event session search page load consistently. 2024-09-27 13:08:31 -04:00
Scott Idem
25a28d4ff6 Moved the AE Utilities functions 2024-09-27 10:46:28 -04:00
Scott Idem
894c84b857 Revert back to older Session Search page. 2024-09-26 19:12:46 -04:00
Scott Idem
8b6f171506 Cleaned up links. Added links in the Launcher to go back to the session search, location view, and session view. 2024-09-26 19:00:32 -04:00
Scott Idem
5311e4704f Work on the Launcher and how a "group" presenter is shown. 2024-09-26 18:37:09 -04:00
Scott Idem
0f40629bfe Done with clean up for the night. Still need to rename all of the shared functions that start with handle_. 2024-09-25 19:09:28 -04:00
Scott Idem
702da83ce5 Clean up before I wrap up for the day. 2024-09-25 18:54:45 -04:00
Scott Idem
32ca117b11 More work to prepare the new Archives, Posts, and Recovery Meetings 2024-09-25 18:44:49 -04:00
Scott Idem
283850e917 Adding in the Archives and Posts DB and functions to get ready for IDAA changes. 2024-09-25 17:55:42 -04:00
Scott Idem
514f36d998 Update to show the timestamps for bio updates. 2024-09-25 14:47:07 -04:00
Scott Idem
cc4446b549 More updates related to permissions. 2024-09-25 13:21:28 -04:00
Scott Idem
8005189bc4 Quick update for LCI 2024-09-25 12:54:58 -04:00
Scott Idem
41706fbcd7 Moving things around and preping things for IDAA. Archive, Posts, Recovery Meetings 2024-09-24 20:05:52 -04:00
Scott Idem
6dc89083ec Starting to import the IDAA files. 2024-09-24 18:32:19 -04:00
Scott Idem
267b5052c9 Moving more files around. 2024-09-24 18:23:22 -04:00
Scott Idem
9e6a7f0db0 Making the Launcher reload when link clicked to go there. 2024-09-24 17:15:06 -04:00
Scott Idem
476b303da4 Lots of work on the new Launcher. Also general reorganizing of files. 2024-09-24 16:55:23 -04:00
Scott Idem
bd2583fde3 Better scaling as the width changes 2024-09-23 16:42:53 -04:00
Scott Idem
80b394f16b Better sorting for files 2024-09-23 15:29:23 -04:00
Scott Idem
36283a215b Related bug fixes and updates for remote limits 2024-09-23 15:01:14 -04:00
Scott Idem
a92f8a486e Fixed the sorting of the files 2024-09-23 14:46:20 -04:00
Scott Idem
f9e156e862 Worked on new message for session page view. Wrapping up for the day. 2024-09-18 19:07:18 -04:00
Scott Idem
37c40ff4fc Changed the version number. Just because. 2024-09-18 18:16:14 -04:00
Scott Idem
2cf1ea39a8 Updated wording for default label. 2024-09-18 18:12:51 -04:00
Scott Idem
63f17e111b Improved the flexibility of the event files upload component. 2024-09-18 17:52:28 -04:00
Scott Idem
e46fa59a40 Require higher permission to edit 2024-09-18 17:07:27 -04:00
Scott Idem
ce476f9a65 Improvement in the showing of the edit button. 2024-09-18 17:03:49 -04:00
Scott Idem
04b549b874 I should have committed this earlier. Lots of changes to use LiveQuery and better menus. 2024-09-18 16:45:49 -04:00
Scott Idem
fd152cc27e Work on making wrappers and code clean up 2024-09-18 12:16:36 -04:00
Scott Idem
86b309f048 Making wrappers for some of the elements that will be expecting LQ variables directly. 2024-09-18 11:36:59 -04:00
Scott Idem
04fd046c53 Trying to get everything using the newer session list. Also trying to generally pass the LQ values directly to the child component. 2024-09-17 19:15:43 -04:00
Scott Idem
e95191d43a More package updates. Things seem to be working... 2024-09-17 17:28:21 -04:00
Scott Idem
3b56223be3 Package updates 2024-09-17 17:20:48 -04:00
Scott Idem
77b14a387e General clean up. Also changed everything over to data store element version 2. Seems to be working well... 2024-09-17 17:17:20 -04:00
Scott Idem
527d1f82b7 Now using the new new new, not mine, Modal element. 2024-09-16 19:02:16 -04:00
Scott Idem
1e3086560d Creating version to of the data store element. Hopefully better now. 2024-09-16 18:10:55 -04:00
Scott Idem
9fd84183d7 Renaming the page access code to site access code. 2024-09-16 16:25:53 -04:00
Scott Idem
f9c3fe4b21 Broad clean up of code. 2024-09-16 16:15:14 -04:00
Scott Idem
d122d1fb93 Trying to clean up things so they load faster. 2024-09-16 15:41:06 -04:00
Scott Idem
c7b48ca97a Chasing and fixing bugs 2024-09-16 15:09:23 -04:00
Scott Idem
1faf7fb18f Adding more options related to session content. 2024-09-16 14:43:28 -04:00
Scott Idem
3a6c462155 Changing the datetime formatter a bit. 2024-09-16 12:20:28 -04:00
Scott Idem
2a3e386f6f Always trying to keep things consistent. 2024-09-13 17:22:21 -04:00
Scott Idem
c711b29bea Making the buttons look the same... 2024-09-13 17:12:19 -04:00
Scott Idem
be58d87faf The session agreements look good. Time to clean up the presenter agreements to match. 2024-09-13 16:51:17 -04:00
Scott Idem
59eed57dec Now with updated_on date times. Other improvements and clean up. 2024-09-13 16:20:56 -04:00
Scott Idem
3d34e30c63 Added the opt out options to the session POC agree page. 2024-09-13 15:40:02 -04:00
Scott Idem
896fb76cc6 More work on the agreements and separating things into files. 2024-09-13 15:05:44 -04:00
Scott Idem
7e610ead67 Work on the new session POC functions and permissions. General code clean up and bug fixes. 2024-09-13 13:20:04 -04:00
Scott Idem
e7e532f61a Improvements to bio and agree 2024-09-12 19:36:33 -04:00
Scott Idem
9fd9f61ddb Bug fix for fields not set yet. 2024-09-12 18:52:59 -04:00
Scott Idem
e3b808a0e0 A lot of work to get the LCI Champions able to add a biography and agree to Terms and Conditions. 2024-09-12 18:37:03 -04:00
Scott Idem
225dd678a5 Minor updates 2024-09-12 14:06:22 -04:00
Scott Idem
0ae86593cd Text updates 2024-09-12 13:25:03 -04:00
Scott Idem
792c496d46 Setting a new version for this app 2024-09-12 13:16:40 -04:00
Scott Idem
faf37f8159 New branch and updates to the workspace file 2024-09-12 13:09:12 -04:00
Scott Idem
5b8121bfc7 Starting new branch and updating packages 2024-09-12 13:03:51 -04:00
Scott Idem
32f24f8ffa Minor update to style 2024-09-09 00:07:25 -04:00
Scott Idem
eacd40ac21 Clean up of the launcher links still... 2024-09-09 00:04:59 -04:00
Scott Idem
bf5bdd4a3e Work on the links to the legacy and new launchers. 2024-09-08 23:28:34 -04:00
Scott Idem
5fcae3b047 Sort of fix for the agreement text (LCI buttons) not showing correctly. 2024-09-06 18:50:44 -04:00
Scott Idem
8b913b73f8 Working on adjusting the permissions for session POC. They can upload/download files for the session and each presenter. 2024-09-04 16:06:50 -04:00
Scott Idem
86dc7797e0 Minor changes related to the site passcodes. 2024-09-04 15:19:45 -04:00
Scott Idem
d5d28149ad More work on making things look better. File counts look nicer. 2024-09-04 14:41:02 -04:00
Scott Idem
917cca09ce Cleaning up the hide/unhide buttons 2024-09-04 13:31:47 -04:00
Scott Idem
3919347383 General clean up and standardizing of things. More option buttons. Show/hide from launcher. 2024-09-04 13:05:21 -04:00
Scott Idem
5aaaaa164d Now with search by location name! 2024-09-03 17:42:15 -04:00
Scott Idem
e6694718e7 Work on location links and fixing presenters not showing correctly on session view page. 2024-09-03 16:41:54 -04:00
Scott Idem
9a0112e884 Work on location views and editing. Also session list clean up. 2024-09-03 14:51:36 -04:00
Scott Idem
acf89f3fa5 Style clean up 2024-08-23 18:35:27 -04:00
Scott Idem
4881fcf7f2 Hide the event files button for now. 2024-08-23 16:39:23 -04:00
Scott Idem
4fa8d0368f Working on the styling some more. 2024-08-23 16:34:28 -04:00
Scott Idem
014d244019 Merge remote-tracking branch 'refs/remotes/origin/ae_app_template_dev' into ae_app_template_dev 2024-08-23 14:35:17 -04:00
Scott Idem
4dbdd16bd0 Recovering from something that broke the styling. It is not 100% right, but much better. 2024-08-23 14:26:17 -04:00
Scott Idem
45d7cba562 General clean up. Trying to make things load faster and more smoothly. 2024-08-21 18:55:12 -04:00
Scott Idem
fed37a77b8 Working on sign in checking and permissions. This probably still needs to be reviewed some more. 2024-08-21 15:34:34 -04:00
Scott Idem
d8edd658b0 Adding a new notes module I guess. Because why not. 2024-08-20 21:00:03 -04:00
Scott Idem
5139a706d0 Removing hardcoded LCI related. General clean up of things. 2024-08-20 12:59:35 -04:00
Scott Idem
608bef7f21 Wrapping up for the day 2024-08-19 18:06:36 -04:00
Scott Idem
c61d3a4dca Trying to make this LiveQuery work. 2024-08-19 17:56:32 -04:00
Scott Idem
4871464adf Minor clean up 2024-08-19 16:45:11 -04:00
Scott Idem
722acdaa59 Apparently not much with badge printing... Cleaned up some code. 2024-08-19 16:30:27 -04:00
Scott Idem
1d496eb769 Duplicated and modified how the event file manager works slightly. 2024-08-19 15:23:34 -04:00
Scott Idem
75b0e53114 General clean up and renaming of functions. 2024-08-19 14:53:28 -04:00
Scott Idem
6aa499c79b Package updates 2024-08-19 14:34:40 -04:00
Scott Idem
fefd7c8027 Dim hidden sessions and presenters in the list 2024-08-19 14:24:10 -04:00
Scott Idem
85138e7b44 Wrapping up for the day. It is Friday. Things mostly work. 2024-08-16 18:34:54 -04:00
Scott Idem
68727d24cf Hide the Copy Access Link button if no person ID linked 2024-08-16 18:02:34 -04:00
Scott Idem
fa55e96be2 Refresh files after upload. For now this clears everything. It is may not be the most efficient, but it works. 2024-08-16 17:41:34 -04:00
Scott Idem
b0e15700b5 Adding config options and toggles for various things. 2024-08-16 17:18:15 -04:00
Scott Idem
37801ca769 Fixes for the reports. General clean up all around. Better usage of log_lvl. 2024-08-16 13:14:18 -04:00
Scott Idem
ca563fdf1f Merge remote-tracking branch 'refs/remotes/origin/ae_app_template_dev' into ae_app_template_dev
Merging changes from yesterday. Thought I did this already.
2024-08-16 10:06:47 -04:00
Scott Idem
fed5d2de65 Clean up based on notes. Adding some JSON event config options for presenter agree and presenter bio. 2024-08-16 10:06:16 -04:00
Scott Idem
f58cd9611b Config change 2024-08-15 21:29:37 -04:00
Scott Idem
7d167444c4 Cleaned up the presenter view. Less fields show if the person is not linked. 2024-08-15 20:18:09 -04:00
Scott Idem
5208480614 Made the session menu look nicer. 2024-08-15 19:52:12 -04:00
Scott Idem
f674503b21 Fixes for the QR codes refreshing too easily. Added option to turn the QR codes off and on. Need to add an event level setting or something. 2024-08-15 18:51:16 -04:00
Scott Idem
002c283c68 Working on dealing with the QR codes re-generating too easily. 2024-08-15 18:04:14 -04:00
Scott Idem
46cc89ad92 Bug fixes for the bio field and copy button 2024-08-15 16:34:34 -04:00
Scott Idem
f209f3ce37 Bug fix for biography copy button 2024-08-15 16:14:01 -04:00
Scott Idem
ef62b30dc9 Now with copy button for presenter bio 2024-08-15 15:49:26 -04:00
Scott Idem
fdca94b625 Minor updates to access 2024-08-15 15:42:18 -04:00
Scott Idem
f526e9094c Various bug fixes. Improvements to the security. Now with super and manager and others. 2024-08-15 15:35:00 -04:00
Scott Idem
35052898b4 Clean up. New ability to save the session search text. 2024-08-15 14:14:41 -04:00
Scott Idem
146bea0a67 Staring work on getting Electron working from Svelte app. Wrapping up for the day. 2024-08-14 19:23:29 -04:00
Scott Idem
cc4588c8a6 Renaming more of the standard object functions. 2024-08-14 16:16:56 -04:00
Scott Idem
0ec9cbbd08 Renaming standard object functions 2024-08-14 16:06:21 -04:00
Scott Idem
be81122e4e General clean up 2024-08-14 15:57:57 -04:00
Scott Idem
56c16bef10 Minor changes 2024-08-14 14:37:53 -04:00
Scott Idem
380a8d2ad3 Allow trusted access to new report 2024-08-14 14:07:21 -04:00
Scott Idem
0d48362529 Work on CRUD v2 API calls. Added sessions without files report. 2024-08-14 14:05:48 -04:00
Scott Idem
efedc88ade Minor fix for help buttons and button styling 2024-08-14 09:39:35 -04:00
Scott Idem
ca2dc11206 Done for the night. 2024-08-13 21:40:14 -04:00
Scott Idem
bdfb276199 Now with better reports showing and status. 2024-08-13 21:36:01 -04:00
Scott Idem
06a1d7a771 Cleaning things up. Minor bug fixes. 2024-08-13 20:57:19 -04:00
Scott Idem
53fea0d25d Cleaned up the menus. Added new options for max qry limits. 2024-08-13 20:01:44 -04:00
Scott Idem
37b2145f81 Now with ability to toggle hidden and disabled sessions. 2024-08-13 18:58:56 -04:00
Scott Idem
e83623526c Minor clean up 2024-08-13 16:52:38 -04:00
Scott Idem
3639342356 Minor bug fix and clean up 2024-08-13 16:48:35 -04:00
Scott Idem
00fcd8e747 Added ability to upload files individually to get the % uploaded. Added show/hide of manage files for sessions and presenters. Other clean up. 2024-08-13 16:42:10 -04:00
Scott Idem
d5dbeeabf7 Maybe wrapping up for the day. 2024-08-12 18:41:33 -04:00
Scott Idem
df36727540 Working on a better file upload element and component. Slow progress... 2024-08-12 18:35:36 -04:00
Scott Idem
074cf154f2 Improvement with file counts and related 2024-08-09 19:33:47 -04:00
Scott Idem
d7dfef4fe0 Wrapping up for the day/week. It is my birthday weekend! 2024-08-09 19:01:45 -04:00
Scott Idem
9a1995dd9f Lots of changes. Things are working better. Files are now showing for the session and presenter. Next is location and event. 2024-08-09 17:50:54 -04:00
Scott Idem
30e6384772 I quite for the night! The presentation list shows now... 2024-08-08 20:42:04 -04:00
Scott Idem
14fc1ee146 Now I am trying to get the presentation list to display... Why won't this work...? Adding URL params seems to have helped some. 2024-08-08 19:51:03 -04:00
Scott Idem
4ddc775aaa Things are finally working better again with the liveQuery. I hope. 2024-08-08 16:55:50 -04:00
Scott Idem
4141524d83 Just saving things... Not making good progress today. 2024-08-08 15:48:49 -04:00
Scott Idem
f407565fc7 Fixed up the new Launcher. The Dexie liveQuery is now working better. Added await tick();. 2024-08-07 18:37:45 -04:00
Scott Idem
cb1f4343db Show star for priority presenter 2024-08-07 17:32:05 -04:00
Scott Idem
ccd91571ce Bug fixes for sign in and related 2024-08-07 17:21:10 -04:00
Scott Idem
75ee8e1b5c Working on bug fix for sign in vs the selected presentation and presenter. Partially fixed. 2024-08-07 16:09:17 -04:00
Scott Idem
7aebf24996 Should have saved my work earlier... General clean up of initial API calls and saving to IDB. Other fixes and updates. 2024-08-07 15:26:58 -04:00
Scott Idem
0d34f81fa7 Wrapping up for the day. The new launcher is partially working. There is a lot of work to do. 2024-08-02 19:11:35 -04:00
Scott Idem
352639e702 Pulled out the event reports page menu. And other clean up. 2024-08-02 12:05:00 -04:00
Scott Idem
8d7627fd36 Clean up of button text 2024-08-01 21:08:45 -04:00
Scott Idem
40293e25b4 Making things scale better 2024-08-01 20:42:28 -04:00
Scott Idem
bf31a3f596 Minor menu show/hide fix 2024-08-01 20:01:34 -04:00
Scott Idem
ff498ed49e Fixed spacing... 2024-08-01 19:55:26 -04:00
Scott Idem
2177f6c379 Now with the event session search menu separated out. Also other clean up. 2024-08-01 19:52:52 -04:00
Scott Idem
98d09bac76 The session and presenter headers both look good. 2024-08-01 18:56:28 -04:00
Scott Idem
e0e380e450 Bug fixes and small improvements. The session page menu is now separate. Still testing that out. 2024-08-01 17:21:59 -04:00
Scott Idem
e7b7948b06 Going live with the new menu after some testing. 2024-08-01 16:33:03 -04:00
Scott Idem
cf9f914412 The new menu for the session page is working well. Time for clean up. 2024-08-01 15:43:39 -04:00
Scott Idem
2fca5b2c3b Creating new session_view.svelte. General clean up related to that and presenter_view.svelte 2024-08-01 10:46:09 -04:00
Scott Idem
f8b53baee8 Making things look nicer. 2024-07-25 18:26:38 -04:00
Scott Idem
86c8aa6c83 Now with hide files from launcher working. event_file.hide 2024-07-25 18:20:17 -04:00
Scott Idem
4a70869896 Improving person reports and related 2024-07-25 13:25:25 -04:00
Scott Idem
0ca8da1a6e Bug fix for total file count for a session 2024-07-25 12:51:34 -04:00
Scott Idem
d756059ad4 Now with ability to clear IDB event_file list 2024-07-25 12:36:39 -04:00
Scott Idem
6b9284951e General improvements to reports 2024-07-25 11:29:59 -04:00
Scott Idem
8b53cd2b7f End user should not see the person link 2024-07-24 18:33:21 -04:00
Scott Idem
fdb435cd1e Got rid of dollar symbol 2024-07-24 18:27:45 -04:00
Scott Idem
37c51cee29 Now with JSON validity checking. Done for the day. 2024-07-24 18:22:19 -04:00
Scott Idem
274b599ff1 Now with new button toggles and edit for JSON data! 2024-07-24 18:06:10 -04:00
Scott Idem
98849427d9 Scroll bars only show when needed in Chrome now. "auto" instead of "scroll" 2024-07-24 15:05:25 -04:00
Scott Idem
027d7a781d General clean up related to permissions and updating fields. 2024-07-24 15:00:48 -04:00
Scott Idem
c41be23995 Package updates and related 2024-07-23 18:40:15 -04:00
Scott Idem
b0633a5c24 Bug fixes for the file rename. 2024-07-19 17:01:42 -04:00
Scott Idem
b2293784e0 Now with the ability to rename files. Had to add a new Dexie update IDB function. 2024-07-19 16:40:56 -04:00
Scott Idem
af17a05022 Now with QR codes for sessions and presenters! 2024-07-18 17:15:12 -04:00
Scott Idem
a6f8f00e9e Implementing bug fix for Svelte params not being ready under my data value. Loading and referencing the params directly/explicitly instead. 2024-07-18 10:09:56 -04:00
Scott Idem
070e714aff Bug fix for loading pages with params! I think this has been a root cause of some of the issues for a while now. 2024-07-18 09:21:29 -04:00
Scott Idem
43488b8f76 Wrapping up for the day. I need to research this. Why does the first link (anchor tag) that is hovered over (triggers pre-load) fail if the URL has a “slug” value? Or any URL??? Any links after the first seem to pre-load fine. 2024-07-17 18:30:08 -04:00
Scott Idem
d16c47fedf Testing preloading 2024-07-17 18:24:43 -04:00
Scott Idem
064bba3d62 Reports can set max count. Bug fixes. Clean up. 2024-07-17 17:08:09 -04:00
Scott Idem
625169a321 Work on new core person list, view, and edit 2024-07-17 14:59:15 -04:00
Scott Idem
ad1e42010a Show more results by default 2024-07-12 16:24:47 -04:00
Scott Idem
997f470ebe Now with a new recent files report. 2024-07-12 16:20:23 -04:00
Scott Idem
47c742d004 Wrapping up for the day. The first report looks pretty good. 2024-07-11 17:44:43 -04:00
Scott Idem
945c943c61 Added a reports section and the first report. Agreed presenters. 2024-07-11 17:01:44 -04:00
Scott Idem
7eb3080f46 Updating packages. Stuck with issues related to ESLint and TypeScript. A version conflict. 2024-07-11 13:52:48 -04:00
Scott Idem
1bf90f128f Updates for the browser title. Wrapping up for the day! July 4th week! 2024-07-03 18:48:28 -04:00
Scott Idem
8f2eb2c27e Forgot to lock some fields down. And other minor changes. 2024-07-03 18:23:59 -04:00
Scott Idem
4aae2bead4 Separating out components and functions to make things more modular. 2024-07-03 17:48:06 -04:00
Scott Idem
270a1429f8 None code change 2024-07-03 11:54:31 -04:00
Scott Idem
a2d3d5b1f7 NPM package updates 2024-07-03 11:45:30 -04:00
Scott Idem
26a0a1dbd6 Working on new inline components for presenter list and event file list. 2024-07-02 18:53:41 -04:00
Scott Idem
889500e80d Finally got the horizontal scroll working correctly with the table. 2024-07-02 18:17:38 -04:00
Scott Idem
d8e062b8c7 Work in progress of moving the session list out to a separate component. 2024-07-02 15:42:45 -04:00
Scott Idem
a1515ba6b6 Code clean up 2024-07-02 14:35:12 -04:00
Scott Idem
27bed2f532 At good point for session searching. 2024-07-02 14:19:04 -04:00
Scott Idem
f4006e7226 The rate limited and delayed search is now working. 2024-07-02 14:00:39 -04:00
Scott Idem
afbe396caf Cleaning up search 2024-07-02 11:54:07 -04:00
Scott Idem
aae19249d4 More efficient query results processing 2024-07-02 11:38:33 -04:00
Scott Idem
d410953ce4 Work on new LiveQuery search results 2024-07-02 09:42:52 -04:00
Scott Idem
40aba339f8 Work on LiveQuery 2024-07-02 09:33:16 -04:00
Scott Idem
ed89c61aed Slight change to header padding 2024-07-01 23:30:43 -04:00
Scott Idem
6d06347e0a Will come back to the LiveQuery undefined thing later... 2024-07-01 20:37:19 -04:00
Scott Idem
acc39ecb50 Wrapping up for the day. Trying to get LQ to work with searching and bulkGet. 2024-07-01 20:33:57 -04:00
Scott Idem
861107c2fd Ready to move on to other areas. 2024-07-01 17:01:48 -04:00
Scott Idem
245757b501 Working on the logic for permissions 2024-07-01 16:53:54 -04:00
Scott Idem
88b0042919 This should have been saved earlier. Lots of moving code around to and clean up. 2024-07-01 16:22:10 -04:00
Scott Idem
9de9d31101 Trying to fix scrolling of the table. 2024-06-28 23:24:29 -04:00
Scott Idem
acaff7634d A lot of code clean up. Also making things look better. 2024-06-28 17:56:39 -04:00
Scott Idem
9f7a19c4b9 Making things look nicer 2024-06-28 13:06:13 -04:00
Scott Idem
e6aec67247 Minor changes 2024-06-28 12:17:43 -04:00
Scott Idem
4183c9022c Now with presenter biography. Used the speakers collection that was done for CHOW as the basis. 2024-06-28 12:02:45 -04:00
Scott Idem
298f87960a Now with ability to sync person record to presenter record. Also some other editing. 2024-06-28 10:45:37 -04:00
Scott Idem
a0085723c9 Now with new file manager 2024-06-28 09:48:12 -04:00
Scott Idem
d01ab2479f Ready to swap out the temporary presenter view file manager section 2024-06-28 09:42:51 -04:00
Scott Idem
2d490d8058 Fixed presentation name edit permissions 2024-06-27 18:43:01 -04:00
Scott Idem
a34d2af18e Show full SHA hash in title 2024-06-27 18:24:25 -04:00
Scott Idem
12c778c7e2 Now with a better file manager. It still needs work. 2024-06-27 18:19:29 -04:00
Scott Idem
37ac30c56c Working on new standalone event file manage element 2024-06-27 15:51:49 -04:00
Scott Idem
8c8748b571 Making more fields us the LiveQuery. Migrated format bytes function. General clean up. 2024-06-27 10:57:19 -04:00
Scott Idem
20e1c46461 Making things look better. Now with a person look up for the presenter record. Wrapping up for the day. 2024-06-26 18:19:17 -04:00
Scott Idem
4d7e48a170 Making things look pretty 2024-06-26 14:39:30 -04:00
Scott Idem
dd9c48e801 Minor fixes and new warning for outdated "app" version. 2024-06-26 14:06:38 -04:00
Scott Idem
7faa9d0459 Work on help information for session search and session view 2024-06-26 11:38:20 -04:00
Scott Idem
6a22f84f23 Failed to switch to LiveQuery for presenter list 2024-06-25 19:07:38 -04:00
Scott Idem
b604eaee56 Saving before trying to use live query with presentation list 2024-06-25 18:10:14 -04:00
Scott Idem
68d376b88d Now able to do stuff with the locations 2024-06-25 18:06:56 -04:00
Scott Idem
0090058238 Just working on select option list and related. 2024-06-25 14:50:40 -04:00
Scott Idem
a62ea7dc8d Making things work better. Adding CRUD select option list. 2024-06-25 14:05:03 -04:00
Scott Idem
21ad9d900c Adding the ability to quickly edit most fields. Other general clean up. 2024-06-25 11:37:03 -04:00
Scott Idem
4ad51b8e0b Wrapping up for the day. Now with ability to add a person. 2024-06-24 19:45:15 -04:00
Scott Idem
384f91bbe7 Create presentations and presenters. Making things look nicer. 2024-06-24 19:09:40 -04:00
Scott Idem
58a975bfe9 Updating npm and Svelte 2024-06-24 16:04:44 -04:00
Scott Idem
c6b7c7e803 Better (less) logging and other clean up 2024-06-24 15:51:30 -04:00
Scott Idem
0c4185f74c General code clean up 2024-06-24 14:42:14 -04:00
Scott Idem
31ba1c9200 Split up the giant events functions file! 2024-06-24 14:32:25 -04:00
Scott Idem
5211f83f23 Now with file counts on the search results! Done for the day. 2024-06-21 16:57:43 -04:00
Scott Idem
ecf2b3eca8 Now with updated POC edit and other 2024-06-21 16:03:08 -04:00
Scott Idem
e5cff89acb Now with search on presenter's name and email 2024-06-21 15:08:58 -04:00
Scott Idem
87b4f22bb1 Added select no POC option 2024-06-21 12:29:32 -04:00
Scott Idem
2552e1a839 Now with upload and download percent! Also better editing for session POC. 2024-06-21 12:25:36 -04:00
Scott Idem
fd114bce22 Now with the ability to edit a presentation name. Yay. 2024-06-20 18:32:24 -04:00
Scott Idem
991cb1e9da Working on ability to change the presentation name and session name... Making progress. Need to figure out why the file list does not reload correctly right after saving. 2024-06-20 17:45:00 -04:00
Scott Idem
d49f73583c Now with clear search text button. 2024-06-20 13:47:40 -04:00
Scott Idem
8c52722408 Bug fixes and clean up of Dexie DB related 2024-06-19 16:27:16 -04:00
Scott Idem
06add80718 A lot of cosmetic clean up and some code clean up. Also new util functions from old Svelte NPM library. 2024-06-19 14:01:15 -04:00
Scott Idem
5ef2d05e9c Enable emailing sign in links 2024-06-18 18:49:30 -04:00
Scott Idem
baf354fd46 Minor text change 2024-06-18 15:53:20 -04:00
Scott Idem
8044cd0723 POC sign is mostly working now 2024-06-18 15:52:14 -04:00
Scott Idem
519525540c File uploads for event presenters works. Other minor clean up. 2024-06-14 16:38:15 -04:00
Scott Idem
97f15f41f7 Finally got the presenter file upload working better. 2024-06-14 16:23:10 -04:00
Scott Idem
06df9a6230 Everything is working except for the file uploads 2024-06-14 14:42:49 -04:00
Scott Idem
65daf86cc7 General clean up of things 2024-06-14 11:23:37 -04:00
Scott Idem
37547a96d8 Time for bed! 2024-06-14 00:39:38 -04:00
Scott Idem
0156426f4b Trying to get things ready for tomorrow. Now with saving of opt outs and other. 2024-06-14 00:34:24 -04:00
Scott Idem
58d25e922c Stopping for dinner and a break. 2024-06-13 19:08:09 -04:00
Scott Idem
6bcc554737 Clean up of auth logic 2024-06-13 15:42:30 -04:00
Scott Idem
84f6f1eda8 Trying to wrap up for the day. 2024-06-12 18:58:06 -04:00
Scott Idem
b368abc91a Almost ready for LCI demo... 2024-06-12 13:23:56 -04:00
Scott Idem
987e411956 Now with session searching working 2024-06-12 13:00:27 -04:00
Scott Idem
bbd403b96d More updates 2024-06-11 20:02:37 -04:00
Scott Idem
98cd149d2c Lots of work on things for LCI! Should have saved more often. 2024-06-11 19:31:44 -04:00
Scott Idem
7cd71299b3 Changes for CHOW deadline 2024-06-07 11:47:28 -04:00
Scott Idem
87ef4cc6b9 Better update to the results cap based on admin or trusted 2024-05-29 15:09:31 -04:00
Scott Idem
8b201a68ed Increased list cap 2024-05-29 15:05:33 -04:00
Scott Idem
359c147167 Moving things to SK. Added events and sessions. 2024-05-24 19:02:52 -04:00
Scott Idem
d9ff625db6 More code clean up 2024-05-23 19:45:17 -04:00
Scott Idem
0005ba7dc9 Code clean up 2024-05-23 18:59:50 -04:00
Scott Idem
42fef3feb8 Re-working the API library functions and files 2024-05-23 18:20:31 -04:00
Scott Idem
fa58d1accb Changes from before AAPOR 2024-05-20 17:24:23 -04:00
Scott Idem
f72d7be5b2 Work on general clean up. Better export and email of sponsor data 2024-05-03 17:07:08 -04:00
Scott Idem
a3a32e188d Should have saved earlier... 2024-04-25 16:11:18 -04:00
Scott Idem
94d0cfeb4d Working on better bug fix for downloading export files. Some columns were missing. 2024-04-23 18:52:41 -04:00
Scott Idem
69c1250961 Improved downloading export files. 2024-04-23 17:42:44 -04:00
Scott Idem
2aff1aadbe Export now works for Sponsors, Speakers, and Leads 2024-04-23 17:10:24 -04:00
Scott Idem
ca04e9739f Saving my work! 2024-04-23 16:36:08 -04:00
Scott Idem
38e73cb40c Adding back in the sponsorship export stuff I was working on... Annoyed. 2024-04-23 15:53:43 -04:00
a87b4d53a0 Unknown changes from last week in Prague? 2024-04-23 15:37:51 -04:00
f8e81bf7e4 Better style 2024-04-11 11:32:45 -04:00
d242948d7e Show or hide alert. Enable or disable the default to scan 2024-04-11 11:17:59 -04:00
21ee101007 Clean up of style 2024-04-11 10:40:23 -04:00
2b61b8f4a5 Style updates 2024-04-11 10:11:44 -04:00
ab268532da Padding change and minor layout change 2024-04-11 06:27:46 -04:00
920dd176fe I am done for the night/morning... 2024-04-10 20:31:32 -04:00
5411df5893 Trying things... 2024-04-10 04:45:48 -04:00
ab906e4af1 More comments 2024-04-10 00:16:08 -04:00
46dcd389a4 This is nearly working. 2024-04-10 00:14:53 -04:00
f405d1b3b7 Quick save of things 2024-04-10 00:09:57 -04:00
0aae7f9361 I don't know 2024-04-09 23:35:19 -04:00
a51e96ea6e Hopefully this works... QR stop and start? 2024-04-09 23:05:32 -04:00
f68bccddb9 Trying to make things work for the morning... 2024-04-09 21:25:12 -04:00
4460b38098 Style clean up 2024-04-09 06:34:34 -04:00
8e6ab2c223 More generic short_name for PWA 2024-04-09 04:30:22 -04:00
d64a20e5b3 Done for the night for real! 2024-04-08 20:27:17 -04:00
f5ab1cecc1 Done for the night. 2024-04-08 20:11:47 -04:00
ef583e1328 Getting the badge search really ready 2024-04-08 19:12:44 -04:00
9eee2a928b Now supports the new redirect to the new search 2024-04-08 13:15:39 -04:00
1ae1a3d989 The AND LIKE query is now working! 2024-04-07 17:26:48 -04:00
bde3229270 Working on making the LIKE query work correctly. 2024-04-07 14:06:31 -04:00
02af46a48f The leads should be ready to go now..... 2024-04-07 12:59:06 -04:00
Scott Idem
562479313d Hiding not ready warning messages 2024-04-05 11:39:11 -04:00
Scott Idem
a5b0720933 More fixes 2024-04-04 23:39:18 -04:00
Scott Idem
847fad3151 Last minute updates 2024-04-04 23:31:59 -04:00
Scott Idem
16f65cf85f Now with much better badge search function. And bug fix for Payment tab. 2024-04-04 21:33:45 -04:00
Scott Idem
5671423467 Getting the badges up and running again 2024-04-03 19:37:28 -04:00
Scott Idem
8d2f4e30f4 Almost everything works!! Need to clean up export file. Missing custom questions and similar. 2024-04-03 18:10:47 -04:00
Scott Idem
9c85914b9f Progress 2024-04-03 16:28:11 -04:00
Scott Idem
ae1764579e Making things look good and fewer bugs 2024-04-03 15:54:51 -04:00
Scott Idem
b5588fd9a1 Slow and steady progress getting things working more smoothly. 2024-04-03 14:54:33 -04:00
Scott Idem
1555f0f8d0 Fixes for saving custom leads questions and adding by badge ID 2024-04-03 11:22:38 -04:00
Scott Idem
3abe92a2dc Various bug fixes for CHOW 2024-04-01 20:48:16 -04:00
Scott Idem
78b5fc1068 I am done...? 2024-03-29 20:33:10 -04:00
Scott Idem
841367afeb Changes have been made... 2024-03-29 15:35:40 -04:00
Scott Idem
0e26765312 General clean up. Less debug. Things work better? 2024-03-29 12:15:50 -04:00
Scott Idem
c0e1d666f4 Minor 2024-03-28 19:31:09 -04:00
Scott Idem
7a4a4cab5e Now with auto hide header and footer 2024-03-28 19:16:07 -04:00
Scott Idem
741878172c Less logging 2024-03-28 19:01:26 -04:00
Scott Idem
2b1b2b7d07 Now with ability to email license sign in link 2024-03-28 18:55:31 -04:00
Scott Idem
9851c69c30 Making things work smoothly 2024-03-28 17:34:19 -04:00
Scott Idem
86972f5a02 Svelte framework and lib updates 2024-03-28 13:23:58 -04:00
Scott Idem
b7bf152366 General updates 2024-03-28 12:58:23 -04:00
Scott Idem
7cc23077f3 Done for the night I guess. 2024-03-27 20:15:30 -04:00
Scott Idem
b336f18512 Testing auto reloading data stores. 2024-03-27 19:21:57 -04:00
Scott Idem
378ae11224 I think things are mostly working now... 2024-03-27 19:21:39 -04:00
Scott Idem
8d8fb0b638 I guess this is better than it was... 2024-03-27 17:55:31 -04:00
Scott Idem
3082c07e3e Should have saved my progress earlier. Trying to redo things without using localStorage initially. Shared data... 2024-03-27 11:36:06 -04:00
Scott Idem
a8a2131361 I am not really sure... I just want it to load correctly. 2024-03-26 20:15:24 -04:00
Scott Idem
a30690ea2a Mostly working before major fix for data shared. 2024-03-26 18:25:43 -04:00
Scott Idem
f20c6ef706 Finally getting the initial loading better 2024-03-26 17:12:35 -04:00
Scott Idem
4d486a580c Trying to make things work better... 2024-03-26 14:24:35 -04:00
Scott Idem
040e1e71e3 One last little bug 2024-03-25 20:25:15 -04:00
Scott Idem
54fb837581 Bug fix for QR scan. Clean up for the day! 2024-03-25 20:15:02 -04:00
Scott Idem
3ddef770c0 General work through out the day. Lots of interruptions from the dogs. 2024-03-25 19:26:49 -04:00
Scott Idem
b0f2e2ccdf Done for the day 2024-03-22 19:16:14 -04:00
Scott Idem
f97c83db03 Quick save before trying more drastic options for sorting and filtering... 2024-03-22 14:07:07 -04:00
Scott Idem
742205b84b Done for the night! 2024-03-21 20:02:17 -04:00
Scott Idem
976f4fe8c0 Done for the night 2024-03-21 19:45:42 -04:00
Scott Idem
cd79213b37 Wrapping up for the day? 2024-03-21 18:29:12 -04:00
Scott Idem
18c1c84044 This is a good point for things. Looks good and working well. 2024-03-21 18:13:05 -04:00
Scott Idem
7381797a28 This is just a good clean point of development. Still a lot of work though! 2024-03-21 15:20:48 -04:00
Scott Idem
c490bca265 Stuck and done for the night 2024-03-20 19:39:48 -04:00
Scott Idem
e21b7ef584 General clean up and making things a least look real. 2024-03-20 16:33:36 -04:00
Scott Idem
84e3098b72 Lots of general clean up and fixes. 2024-03-20 13:31:42 -04:00
Scott Idem
fbbaa1392b Wrapping up for the day. Lots of changes. 2024-03-19 20:23:42 -04:00
Scott Idem
19d2dd630b Minor fixes. Passes the client-reference-id to Stripe 2024-03-19 13:10:46 -04:00
Scott Idem
e4687aab2f Finalish updates before sending emails to ISHLT exhibitors 2024-03-19 11:38:47 -04:00
Scott Idem
d3ae087cd6 Lots of updates.... 2024-03-18 21:36:03 -04:00
Scott Idem
9b02b2f86c Bug fix for exhibit_id missing. Why? 2024-03-15 18:46:34 -04:00
Scott Idem
7d86a9b40f Wrapping up for the day? Now with iframe sort of support 2024-03-15 18:02:12 -04:00
Scott Idem
0400aa429b It has been a long two or three weeks... 2024-03-15 17:48:14 -04:00
Scott Idem
68b0efb6c9 Now with QR code scanner! 2024-03-14 20:31:37 -04:00
Scott Idem
20b42ac6aa Things are working! 2024-03-14 19:43:54 -04:00
Scott Idem
a97e5666a7 Just working on things. Slow progress... 2024-03-14 18:11:09 -04:00
Scott Idem
8bf1892bc7 Working on adding/updating licenses 2024-03-13 19:53:10 -04:00
Scott Idem
3f664eb5c0 Saving my work and trying something a little different. Using a number as the id instead of the email address. I feel like this will also cause issues. 2024-03-13 18:06:22 -04:00
Scott Idem
3c30664b2b Last minute work for CHOW. Hopefully done soon... 2024-03-13 10:32:22 -04:00
Scott Idem
fd4f2bdf35 Finally working Events - Leads for exhibitors 2024-03-12 19:28:10 -04:00
Scott Idem
7d1a4b735b Making things look nicer and more complete. 2024-03-12 14:29:16 -04:00
Scott Idem
a5431070d3 Minor changes 2024-03-11 14:06:53 -04:00
Scott Idem
ef2597d114 Bug fixes and clean up for CHOW 2024-03-11 12:48:23 -04:00
Scott Idem
1559bae11c General checks and clean up of things 2024-03-10 16:01:53 -04:00
Scott Idem
b6ba167a86 Done for the night! 2024-03-08 21:17:07 -05:00
Scott Idem
4136c08cdb Sponsor Hub part looks pretty good now. Still need to enable the delete buttons. 2024-03-08 21:09:58 -05:00
Scott Idem
875f327c90 Speakers form is now working pretty well. Including delete. 2024-03-08 18:00:36 -05:00
Scott Idem
b53566aa41 Minor changes 2024-03-08 14:41:36 -05:00
Scott Idem
d9ee195590 Documentation for what reason? 2024-03-08 13:08:54 -05:00
Scott Idem
409872ed4d More changes 2024-03-08 11:43:32 -05:00
Scott Idem
2ada1419d8 Lots of general clean up and work for CHOW going live 2024-03-08 11:27:18 -05:00
Scott Idem
5a147a98bb I am done for the night... 2024-03-08 00:09:17 -05:00
Scott Idem
1694dfb5c5 Getting ready to implement Dexie for Svelte 2024-03-07 13:33:51 -05:00
Scott Idem
ff00ec5c91 Ready to demo for Precon CHOW again 2024-03-07 12:09:23 -05:00
Scott Idem
c6abc0abca Clean up for CHOW... 2024-03-07 11:28:30 -05:00
Scott Idem
b020ded01c Changes. Work on new review page searching. 2024-03-06 20:39:38 -05:00
Scott Idem
aa712284ce Just worki on things 2024-03-06 13:47:41 -05:00
Scott Idem
e71cdab353 Wrapping up for the night. Things are working better. There are still API request misses or something. 2024-03-05 20:35:38 -05:00
Scott Idem
bed4f4a0f2 Work on the new Data Store element 2024-03-05 17:01:37 -05:00
Scott Idem
19a6ff6dbe Work on expanding the routes 2024-03-04 20:55:48 -05:00
Scott Idem
6c60ee3086 More quick updates and clean up 2024-03-04 13:43:24 -05:00
Scott Idem
a0947e349a General clean up for CHOW. 2024-03-04 10:59:15 -05:00
Scott Idem
04a8b49177 Quick changes for CHOW 2024-03-04 08:46:12 -05:00
Scott Idem
63990bb36a More changes based on feedback 2024-03-03 19:52:42 -05:00
Scott Idem
60f6386415 Changes based on feedback from Jordan (and Erin) 2024-03-03 19:22:44 -05:00
Scott Idem
7051cb92d5 Event presenter now has a slug directory 2024-03-03 12:51:14 -05:00
Scott Idem
64589ec11c Too many changes. Getting ready to show Jordan. 2024-03-03 12:31:32 -05:00
Scott Idem
1b12cd4aec Lots of bug fixes. Lots of clean up. Things work more consitently. 2024-03-02 20:54:45 -05:00
Scott Idem
4db9e68543 A lot of little changes everywhere. Sorry... 2024-03-02 20:09:25 -05:00
Scott Idem
0dbf869d5d Work on file related 2024-03-02 11:28:13 -05:00
Scott Idem
e69ff969f5 Walking away 2024-03-01 19:15:22 -05:00
Scott Idem
ff90fa5287 Done for reals... 2024-03-01 19:10:26 -05:00
Scott Idem
f09577d1d5 Done for the night... 2024-03-01 19:02:05 -05:00
Scott Idem
9fe4c51a67 Wrapping up for Friday night 2024-03-01 18:55:26 -05:00
Scott Idem
f4ed04497e Style clean up. A lot! Almost ready for CHOW going live. 2024-03-01 16:17:02 -05:00
Scott Idem
b21f9c0437 Wrapping up for the night. Mostly good for demo tomorrow morning. 2024-02-29 20:24:08 -05:00
Scott Idem
873e6d9f9a General clean up. Presenter form submission now works better. Need to do the same for the sponsorships submission form. 2024-02-29 16:14:31 -05:00
Scott Idem
e713313aca Bug fix for null bio field 2024-02-29 14:49:24 -05:00
Scott Idem
addadacc47 Getting ready for CHOW 2024 demo call tomorrow 2024-02-29 14:37:37 -05:00
Scott Idem
9310aac4d2 Button fix 2024-02-28 21:47:57 -05:00
Scott Idem
2c7e7ca027 Will now pull in agreements and accommations questions 2024-02-28 21:17:09 -05:00
Scott Idem
713fcb3c62 Bug fixes. Style setting improvements. 2024-02-28 15:45:02 -05:00
Scott Idem
00a28588b7 Wrapping up for the day 2024-02-27 20:21:02 -05:00
Scott Idem
ed97cba7a6 General clean up of code. Starting to wrap up for the night. 2024-02-27 19:20:21 -05:00
Scott Idem
714642380e Cleaning up code and making everything look better. 2024-02-27 18:38:46 -05:00
Scott Idem
22efa3fd96 Made the closing of the modals cleaner 2024-02-27 17:04:03 -05:00
Scott Idem
c93d84f3c3 Sponsorships and Speakers are working and looking pretty well. Other general clean up. 2024-02-27 16:50:37 -05:00
Scott Idem
9540aefd50 Finally got things working. Store act odd when being set under layout.ts? 2024-02-26 21:04:17 -05:00
Scott Idem
060c0500d3 General clean up. No working on the new event presenter components. 2024-02-26 15:03:01 -05:00
Scott Idem
740baa689e Need to work on not havnig the account ID set 2024-02-22 22:16:49 -05:00
Scott Idem
02f693c13e Making the loading a bit more efficient and cleaner 2024-02-22 20:28:29 -05:00
Scott Idem
d1328eb67c Added the access code component. Improved layout. General clean up and improvements. 2024-02-22 17:21:22 -05:00
Scott Idem
5a13852432 Wrapping up programming for tonight. Ready for CHOW demo? 2024-02-20 19:07:09 -05:00
Scott Idem
d51d059535 Finally got things mostly working. 2024-02-20 18:05:18 -05:00
Scott Idem
5bb9134641 I need to stop for the night. 2024-02-19 19:37:03 -05:00
Scott Idem
3403210efd This is the first commit of the day. It is probably the last. Lots of general prep for a demo. 2024-02-19 18:28:55 -05:00
Scott Idem
6f0680f282 Good first draft. Done for the night! 2024-02-16 22:15:54 -05:00
Scott Idem
bab68af7dc Making progress on pulling this together. 2024-02-16 21:38:41 -05:00
Scott Idem
9958724aaa I should have saved this long ago. Lots of changes. Learning a lot as well! 2024-02-16 20:12:19 -05:00
Scott Idem
cb9bd1648c Done for the night! 2024-02-15 19:19:01 -05:00
Scott Idem
a3d4354ef4 This is a good start. Many key features are working again!!! 2024-02-15 18:53:26 -05:00
Scott Idem
19f9983c9a Most things are working in the template now. 2024-02-15 11:55:42 -05:00
Scott Idem
17d99d080c Starting a new template using Svelte, SvelteKit, Tailwind, and Skeleton. 2024-02-15 09:49:35 -05:00
Scott Idem
ccbb783378 Variouu changes from a few days ago. 2024-02-15 09:20:57 -05:00
Scott Idem
970e7567fc More work on The Hub 2024-02-09 18:38:17 -05:00
Scott Idem
7f6f063f00 Work on the new Hub to manage the header, footer, menu, quick access, etc 2024-02-09 18:24:07 -05:00
Scott Idem
7775b88b35 General clean up of the new AE Sponsorships app. Making it portable too. 2024-02-08 17:51:38 -05:00
Scott Idem
06e0c98e68 Lots of clean up to get Sponsorships working. Need to add the edit next. 2024-02-07 18:23:15 -05:00
Scott Idem
143265ed9e Creating for AE "Sponsorships". Update file timestamps and remove unused files. Also switched to Svelte with Vite. 2024-02-06 18:23:01 -05:00
1084 changed files with 119372 additions and 4391 deletions

View File

@@ -1,5 +1,5 @@
[Dolphin]
Timestamp=2021,7,8,11,31,30.712
Timestamp=2024,8,7,10,25,9.632
Version=4
ViewMode=1

43
.env.prod.default Normal file
View File

@@ -0,0 +1,43 @@
# One Sky IT's Aether Framework and System
TESTING=This is a test env variable
PUBLIC_TESTING=This is a public test env variable
CONTAINER_AE_APP_NODE=ae_app_node_prod
CONTAINER_AE_APP_NODE_RED=ae_app_node_prod_red
CONTAINER_AE_APP_NODE_GREEN=ae_app_node_prod_green
CONTAINER_AE_APP_NODE_BLUE=ae_app_node_prod_blue
OSIT_WEB_HTTP_PORT=8082
OSIT_WEB_HTTPS_PORT=4435
# DOCKER_AE_SERVER_EXTRA_HOST=srv-nyx.oneskyit.com:104.237.143.4
# DOCKER_AE_API_SERVER_EXTRA_HOST=api.oneskyit.com:104.237.143.4
# DOCKER_AE_API_BAK_SERVER_EXTRA_HOST=bak-api.oneskyit.com:104.237.143.4
# Aether general shared config options
# For general shared config options like API access and use, database access and use, Redis, and SMTP
# home development, live testing, live production, onsite development, onsite testing, onsite production???
AE_CFG_ID=7
## Aether API access and use
PUBLIC_AE_API_PROTOCOL=https
PUBLIC_AE_API_SERVER=api.oneskyit.com
PUBLIC_AE_API_BAK_SERVER=bak-api.oneskyit.com
PUBLIC_AE_API_SERVER_INTERNAL=aether_api_gunicorn
PUBLIC_AE_API_PORT=443
PUBLIC_AE_API_PATH=
PUBLIC_AE_API_SECRET_KEY=XXXX
PUBLIC_AE_API_CRUD_SUPER_KEY=XXXX
PUBLIC_AE_NO_ACCOUNT_ID=No_Account_ID_Here
PUBLIC_AE_NO_ACCOUNT_ID_TOKEN=Nothing_to_see_here
# Aether app specific config (SvelteKit)
AE_APP_CFG_ID=99
AE_APP_ENV=development
AE_APP_NODE_PORT=3001
AE_APP_NODE_PORT_RED=3002
AE_APP_NODE_PORT_GREEN=3003
AE_APP_NODE_PORT_BLUE=3004
PUBLIC_AE_ACCOUNT_ID=XXXX # OSIT = _XY7DXtc9MY; CHOW = 3Iid1aIRY5j
PUBLIC_AE_EVENT_ID=XXXX # OSIT = pjrcghqwert; CHOW = Mw6-Nv-Zf-5A
PUBLIC_AE_SPONSORSHIP_CFG_ID=XXXX # OSIT = t8jdjONCs0k; CHOW = ygjEuQQCzvk

45
.env.staging.default Normal file
View File

@@ -0,0 +1,45 @@
# One Sky IT's Aether Framework and System
TESTING=This is a test env variable
PUBLIC_TESTING=This is a public test env variable
CONTAINER_AE_APP_NODE=ae_app_node_prod
CONTAINER_AE_APP_NODE_RED=ae_app_node_prod_red
CONTAINER_AE_APP_NODE_GREEN=ae_app_node_prod_green
CONTAINER_AE_APP_NODE_BLUE=ae_app_node_prod_blue
OSIT_WEB_HTTP_PORT=8082
OSIT_WEB_HTTPS_PORT=4435
# DOCKER_AE_SERVER_EXTRA_HOST=srv-nyx.oneskyit.com:104.237.143.4
# DOCKER_AE_API_SERVER_EXTRA_HOST=dev-api.oneskyit.com:192.168.32.20 # Odd because this env is the development server
# DOCKER_AE_API_SERVER_EXTRA_HOST=dev-api.oneskyit.com:192.168.32.99 # Odd because this env is the development server
# DOCKER_AE_API_BAK_SERVER_EXTRA_HOST=test-api.oneskyit.com:104.237.143.4 # Odd because this env is the development server
# DOCKER_AE_API_TEST_SERVER_EXTRA_HOST=test-api.oneskyit.com:104.237.143.4
# Aether general shared config options
# For general shared config options like API access and use, database access and use, Redis, and SMTP
# home development, live testing, live production, onsite development, onsite testing, onsite production???
AE_CFG_ID=5
## Aether API access and use
PUBLIC_AE_API_PROTOCOL=https
PUBLIC_AE_API_SERVER=dev-api.oneskyit.com
PUBLIC_AE_API_BAK_SERVER=test-api.oneskyit.com
PUBLIC_AE_API_SERVER_INTERNAL=aether_api_gunicorn
PUBLIC_AE_API_PORT=443
PUBLIC_AE_API_PATH=
PUBLIC_AE_API_SECRET_KEY=dFP6J9DVj9hUgIMn-fNIqg
PUBLIC_AE_API_CRUD_SUPER_KEY=zp5PtX4zUsI
PUBLIC_AE_NO_ACCOUNT_ID=No_Account_ID_Here
PUBLIC_AE_NO_ACCOUNT_ID_TOKEN=Nothing_to_see_here
# Aether app specific config (SvelteKit)
AE_APP_CFG_ID=99
AE_APP_ENV=development
AE_APP_NODE_PORT=3001
AE_APP_NODE_PORT_RED=3002
AE_APP_NODE_PORT_GREEN=3003
AE_APP_NODE_PORT_BLUE=3004
PUBLIC_AE_ACCOUNT_ID=XXXX # OSIT = _XY7DXtc9MY; CHOW = 3Iid1aIRY5j
PUBLIC_AE_EVENT_ID=XXXX # OSIT = pjrcghqwert; CHOW = Mw6-Nv-Zf-5A
PUBLIC_AE_SPONSORSHIP_CFG_ID=XXXX # OSIT = t8jdjONCs0k; CHOW = ygjEuQQCzvk

13
.eslintignore Normal file
View File

@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

31
.eslintrc.cjs Normal file
View File

@@ -0,0 +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'
}
}
]
};

35
.gitignore vendored
View File

@@ -1,4 +1,33 @@
/node_modules/
/public/build/
.DS_Store
.directory
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
!.env.prod.default
!.env.staging.default
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
# Logs
logs
*.log
*.log.*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# Backups and archives
*.bak
*.tar.gz
backups/
# Temporary files
tmp/
temp/
*.kate-swp

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
engine-strict=true

4
.prettierignore Normal file
View File

@@ -0,0 +1,4 @@
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

8
.prettierrc Normal file
View File

@@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View File

@@ -1,3 +0,0 @@
{
"recommendations": ["svelte.svelte-vscode"]
}

121
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,121 @@
{
"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
}

248
README.md
View File

@@ -1,105 +1,191 @@
*Looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)*
# One Sky IT's Aether App - SvelteKit v2
---
This uses SvelteKit version 2.x with Svelte version 5.x, TailwindCSS 4.1, and Skelton.
# svelte app
This is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template.
# Current Modules
To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit):
## AE Events - Speakers (/events_speakers)
### Components
* +page.svelte - The main page for the Events - Speakers module
* 10_edit_modal__event_presenter_obj.svelte - The modal for editing a presenter
* 10_list__event_presenter_obj.svelte - The list of presenters/speakers
* 10_view_modal__event_presenter_obj.svelte - The modal for viewing a presenter
### Path [slug]
* +page.svelte - The main page for the presenter ID [slug]
## AE Sponsorships (/sponsorships)
* +page.svelte - The main page for the Sponsorships module
* 10_edit_modal__sponsorship_obj.svelte - The modal for editing a sponsorship
* 10_list__sponsorship_obj.svelte - The list of sponsorships
* 10_view_modal__sponsorship_obj.svelte - The modal for viewing a sponsorship
### Path [slug]
* +page.svelte - The main page for the sponsorship ID [slug]
# Future Modules
## AE Events - Badges (/events_badges)
* +page.svelte - The main page for the Events - Badges module
* 10_list__event_badge_obj.svelte - The list of badges
* 10_view_modal__event_badge_obj.svelte - The modal for viewing a badge
## AE Events - Exhibit Leads (/events_exhibit_leads)
## AE Events - Presentation Management (/events_pres_mgmt)
# How to build and deploy SvelteKit:
Copy the contents of the "build" directory to ./npm_deploy/build/
```bash
npx degit sveltejs/template svelte-app
cd svelte-app
npm run build
```
*Note that you will need to have [Node.js](https://nodejs.org) installed.*
## Get started
Install the dependencies...
If this is just a quick build update then only the build directory needs to be copied (rsync).
```bash
cd svelte-app
rsync -vhrz --exclude 'node_modules' ~/OSIT_dev/ae_app_svelte_tailwind_skeleton/build/ ~/OSIT_dev/ae_env_node_app/npm_deploy/build/ --delete
rsync -vhrz ~/OSIT_dev/ae_env_node_app/npm_deploy/build/ scott@linode.oneskyit.com:/srv/env/prod_aether_sveltekit/npm_deploy/build/ --delete
```
If this includes package updates (not development) we need to copy the new package.json. Manually copy the new package.json file to ./npm_deploy/. This also needs to be copied to the server. Copy the package.json even though not really used.
Run the --omit dev to clear out the node_modules directory. Copy the root node_modules directory to ./npm_deploy/build/node_modules/ after running te omit dev command.
```bash
npm ci --omit dev
# copy/paste, rsync, or cp
rsync -vhrz ~/OSIT_dev/ae_app_svelte_tailwind_skeleton/node_modules ~/OSIT_dev/ae_env_node_app/npm_deploy/build/ --delete
# copy package.json as well
npm install
```
...then start [Rollup](https://rollupjs.org):
Everything should be ready to run on the development server and production server.
# Rebuild the node_modules directory and manually install extra Svelte packages
Run the npm update to fix the node_modules directory and package.json
```bash
npm list
npm outdated
npm update
npm outdated
npm list
```
Other installs?:
Are both still needed? I know at least one of these is. 2024-07-23
```bash
npm install --save-dev svelte-highlight
npm install --save-dev typescript-svelte-plugin
```
---
# Set up and run
## Packages and dependencies
```bash
npm install --save-dev svelte-highlight typescript-svelte-plugin
npm install flowbite flowbite-svelte tailwind-merge @popperjs/core
```
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.
* ShadCN is still stuck on Tailwind 3. Waiting to upgrade to Tailwind 4.x. Tailwind 4.x was released in late January 2025. ShadCN is still being worked on as of late March 2025.
* [https://github.com/huntabyte/shadcn-svelte/issues/1643](https://github.com/huntabyte/shadcn-svelte/issues/1643)
Need to install ShadCN and Lucide for the Tiptap editor.
```bash
npm install shadcn-svelte
npm install lucide-svelte
npm install mode-watcher
```
Now we initialize the ShadCN and ShadEditor packages. Follow the command line instructions.
```bash
npx shadcn-svelte@next init
npx shadcn-svelte@next add dropdown-menu button tooltip input popover separator
npx shadeditor init
```
More packages related to the Tiptap editor???
```bash
npm install @tiptap/extension-link @tiptap/extension-bullet-list @tiptap/extension-history @tiptap/extension-typography @tiptap/extension-underline
```
## Build
## Environment file
### ".env"
This is the default used if others are not found when when "npm run dev" or "npm run build" is run.
### ".env.local"
This is used when "npm run dev" is run. This is not used in the production build.
### ".env.production"
This is used when "npm run build" is run. This is not used in the development build.
### ".env:prod"
This is modified to allow for a staging environment and production environment built.
### ".env:staging"
This is modified to allow for a staging environment and production environment built.
### Example Important Values when running in dev:
Note: Environment values need to be updated when our home IP address changes. Be sure to check the Aether Container Environment and Aether Node App (SvelteKit) Environment files for the correct IP address. The Node Docker environment needs to be updated here and in the .env file that Docker will read. This needs to be improved later...
```bash
DOCKER_AE_API_DEV_SERVER_EXTRA_HOST=dev-api.oneskyit.com:108.48.200.147
DOCKER_AE_API_SERVER_EXTRA_HOST=dev-api.oneskyit.com:108.48.200.147
PUBLIC_AE_API_SERVER=api.oneskyit.com
PUBLIC_AE_API_BAK_SERVER=bak-api.oneskyit.com
```
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
Navigate to [localhost:5000](http://localhost:5000). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.
## Building
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`.
If you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.
## Building and running in production mode
To create an optimised version of the app:
To create a production version of your app:
```bash
npm run build
```
You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com).
You can preview the production build with `npm run preview`.
## Single-page app mode
By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.
If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `"start"` command in package.json:
```js
"start": "sirv public --single"
```
## Using TypeScript
This template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with:
```bash
node scripts/setupTypeScript.js
```
Or remove the script via:
```bash
rm scripts/setupTypeScript.js
```
## Deploying to the web
### With [Vercel](https://vercel.com)
Install `vercel` if you haven't already:
```bash
npm install -g vercel
```
Then, from within your project folder:
```bash
cd public
vercel deploy --name my-project
```
### With [surge](https://surge.sh/)
Install `surge` if you haven't already:
```bash
npm install -g surge
```
Then, from within your project folder:
```bash
npm run build
surge public my-project.surge.sh
```
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

66
README_guidelines.md Normal file
View File

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

View File

@@ -0,0 +1,14 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"cSpell.words": [
"filelist"
],
"git.autofetch": true,
"editor.defaultFormatter": "svelte.svelte-vscode"
}
}

17
components.json Normal file
View File

@@ -0,0 +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"
}

7
jsconfig.json Normal file
View File

@@ -0,0 +1,7 @@
{
"compilerOptions": {
"paths": {
"$lib/*": ["./src/lib/*"]
}
}
}

10353
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +1,121 @@
{
"name": "svelte-app",
"version": "1.0.0",
"name": "osit-aether-app-svelte",
"version": "3.9.6",
"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": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public --single --port 5555",
"validate": "svelte-check"
"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": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-typescript": "^8.0.0",
"@tsconfig/svelte": "^1.0.0",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",
"svelte": "^3.0.0",
"svelte-check": "^1.0.0",
"svelte-preprocess": "^4.0.0",
"tslib": "^2.0.0",
"typescript": "^4.0.0"
"@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",
"@tiptap/core": "^2.10.3",
"@tiptap/extension-bubble-menu": "^2.10.3",
"@tiptap/extension-code-block-lowlight": "^2.10.3",
"@tiptap/extension-color": "^2.10.3",
"@tiptap/extension-highlight": "^2.10.3",
"@tiptap/extension-image": "^2.10.3",
"@tiptap/extension-link": "^2.10.3",
"@tiptap/extension-subscript": "^2.10.3",
"@tiptap/extension-superscript": "^2.10.3",
"@tiptap/extension-table": "^2.10.3",
"@tiptap/extension-table-cell": "^2.10.3",
"@tiptap/extension-table-header": "^2.10.3",
"@tiptap/extension-table-row": "^2.10.3",
"@tiptap/extension-task-item": "^2.10.3",
"@tiptap/extension-task-list": "^2.10.3",
"@tiptap/extension-text": "^2.10.3",
"@tiptap/extension-text-align": "^2.10.3",
"@tiptap/extension-text-style": "^2.10.3",
"@tiptap/extension-typography": "^2.10.3",
"@tiptap/extension-underline": "^2.10.3",
"@tiptap/pm": "^2.10.3",
"@tiptap/starter-kit": "^2.10.3",
"@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",
"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",
"svelte-tiptap": "^2.1.0",
"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"
},
"type": "module",
"dependencies": {
"axios": "^0.21.1",
"sirv-cli": "^1.0.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",
"@tiptap/extension-bullet-list": "^2.10.2",
"@tiptap/extension-document": "^2.10.2",
"@tiptap/extension-history": "^2.10.2",
"@tiptap/extension-paragraph": "^2.10.2",
"axios": "^1.7.0",
"codemirror": "^6.0.1",
"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"
}
}

12
playwright.config.ts Normal file
View File

@@ -0,0 +1,12 @@
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 4173
},
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
};
export default config;

View File

@@ -1,88 +0,0 @@
html, body {
position: relative;
/* width: 100%; */
height: 100%;
max-width: 100%;
}
body {
/* color: #333;
margin: 0;
padding: 8px;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; */
}
h1 {
color: hsla(0, 0%, 5%, 1);
/*text-transform: uppercase;*/
/* font-size: 4rem; */
/* font-weight: 100; */
}
h2 {
color: hsla(0, 0%, 10%, 1);
/*text-transform: uppercase;*/
/* font-size: 4rem; */
/* font-weight: 100; */
}
a {
/* color: rgb(0,100,200);
text-decoration: none; */
}
a:hover {
/* text-decoration: underline; */
}
a:visited {
/* color: rgb(0,80,160); */
}
label {
/* display: block; */
}
input, button, select, textarea {
/* font-family: inherit;
font-size: inherit;
-webkit-padding: 0.4rem 0;
padding: 0.4rem;
margin: 0 0 0.5rem 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px; */
}
input:disabled {
color: hsla(0, 0%, 50%, 1);
}
button {
/* color: #333;
background-color: #f4f4f4;
outline: none; */
}
button:disabled {
color: hsla(0, 0%, 50%, 1);
}
button:not(:disabled):active {
background-color: hsla(0, 0%, 50%, 1);
}
button:focus {
/* border-color: #666; */
}
button:hover {
/* background-color: green; */
}
#my_body {
/* outline: solid thin red; */
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -1,35 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Index - Svelte</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
<link rel='stylesheet' href='/app_global.css'>
<link rel='stylesheet' href='/build/bundle.css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
<script defer src='/build/bundle.js'></script>
</head>
<body>
<header><h1>Index - Dev Svelte App</h1></header>
<main>
<a href="log_client_viewing">log_client_viewing</a>
<a href="membership_member_manage">membership_member_manage</a>
<a href="user_person">user_person</a>
<div id="test_container" class="svelte_container">
</div>
</main>
<footer>
This is the footer
</footer>
</body>
</html>

View File

@@ -1,32 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Log Client Viewing - Dev Svelte App</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
<link rel='stylesheet' href='/app_global.css'>
<link rel='stylesheet' href='/build/bundle.css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
<script defer src='/build/bundle.js'></script>
<script>
let account_id = 'TblpWmPauKw';
</script>
</head>
<body>
<header><h1>Log Client Viewing - Dev Svelte App</h1></header>
<main>
<div id="log_client_viewing_list_container" class="svelte_container">
</div>
</main>
</body>
</html>

View File

@@ -1,33 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Membership Member Manage - Dev Svelte App</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
<link rel='stylesheet' href='/app_global.css'>
<link rel='stylesheet' href='/build/bundle.css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
<script defer src='/build/bundle.js'></script>
<script>
let account_id = '_PRgRxSkzu-Xg-V4Ft1RGg';
let membership_member_id = '6jMd9WwnMbs';
</script>
</head>
<body>
<header><h1>Membership Member Manage - Dev Svelte App</h1></header>
<main>
<div id="membership_member_manage_container" class="svelte_container">
</div>
</main>
</body>
</html>

View File

@@ -1,36 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>User Person - Dev Svelte App</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css">
<link rel='stylesheet' href='https://static.oneskyit.com/css/global.css'>
<link rel='stylesheet' href='/app_global.css'>
<link rel='stylesheet' href='/build/bundle.css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.9.4/dayjs.min.js" integrity="sha512-XZSHSEFj4QeE0G4pwy4tToyAhF2VXoEcF9CP0t1PSZMP2XHhEEB9PjM9knsdzcEKbi6GRMazdt8tJadz0JTKIQ==" crossorigin="anonymous"></script>
<script defer src='https://static.oneskyit.com/js/utilities.js'></script>
<script defer src='/build/bundle.js'></script>
<script>
let account_id = '_PRgRxSkzu-Xg-V4Ft1RGg';
let person_id = 'OfcrSXX_evI';
let user_id = 'VMvg8X3QnZM';
</script>
</head>
<body>
<header><h1>User Person - Dev Svelte App</h1></header>
<main>
<div id="user_container" class="svelte_container">
</div>
<div id="person_container" class="svelte_container">
</div>
</main>
</body>
</html>

View File

@@ -1,83 +0,0 @@
import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import css from 'rollup-plugin-css-only';
const production = !process.env.ROLLUP_WATCH;
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
};
}
export default {
input: 'src/main.ts',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js'
},
plugins: [
svelte({
preprocess: sveltePreprocess({ sourceMap: !production }),
compilerOptions: {
// enable run-time checks when not in production
dev: !production
}
}),
// we'll extract any component CSS out into
// a separate file - better for performance
css({ output: 'bundle.css' }),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ['svelte']
}),
commonjs(),
typescript({
sourceMap: !production,
inlineSources: !production
}),
// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
};

View File

@@ -1,21 +0,0 @@
<script lang="ts">
import Test from './test.svelte';
export let name: string;
</script>
<section>
<p>Name: {name}</p>
<Test />
</section>
<style>
section {
text-align: center;
}
p {
color: green;
}
</style>

View File

@@ -1,75 +0,0 @@
<script lang="ts">
export let name: string;
let count = 0;
function handleClick() {
count += 1;
}
let m = { x: 0, y: 0 };
function handle_mousemove(event) {
m.x = event.clientX;
m.y = event.clientY;
}
let first_name = '';
let last_name = '';
let full_name = 'Not Here';
$: full_name = first_name + ' ' + last_name;
let name_checked = false;
</script>
<main>
<input bind:value={first_name}>
<input bind:value={last_name}>
<label>Check me <input type=checkbox bind:checked={name_checked}></label>
<h1>Hello {full_name}!</h1>
{#if name_checked}
<p>Thank you. We will bombard your inbox and sell your personal details.</p>
{:else}
<p>You must opt in to continue. If you're not paying, you're the product.</p>
{/if}
<button disabled={!name_checked}>
Subscribe
</button>
<p>This is a new app using Svelte.</p>
<button on:click={handleClick}>
Clicked {count} {count === 1 ? 'time' : 'times'}
</button>
<div class="my_class">My fancy class!</div>
<div on:mousemove={handle_mousemove}>
The mouse position is {m.x} x {m.y}
</div>
</main>
<style>
main {
text-align: center;
padding: 1rem;
max-width: 240px;
margin: 0 auto;
}
h1 {
color: hsla(0, 50%, 50%, 1);
/*text-transform: uppercase;*/
font-size: 4rem;
font-weight: 100;
}
@media (min-width: 640px) {
main {
max-width: none;
}
}
</style>

205
src/ae-c-idaa-light.css Normal file
View File

@@ -0,0 +1,205 @@
[data-theme='AE_c_IDAA_light'] {
--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;
--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);
--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-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-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-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-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-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-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-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);
}

205
src/ae-c-lci.css Normal file
View File

@@ -0,0 +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);
}

205
src/ae-osit-default.css Normal file
View File

@@ -0,0 +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);
}

205
src/aeclci_v1.css Normal file
View File

@@ -0,0 +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);
}

View File

@@ -1,38 +0,0 @@
import axios from 'axios';
console.log('*** api_update.js ***');
var axios_fastapi = axios.create({
//baseURL: 'https://dev-fastapi.oneskyit.com',
//baseURL: 'http://fastapi.localhost:5005',
baseURL: 'http://192.168.32.20:5005',
/* other custom settings */
});
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
axios_fastapi.defaults.headers['content-type'] = 'application/json';
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
async function delete_object({axios=axios_fastapi, endpoint='', data=[]}) {
console.log('*** delete_object() ***');
console.log(data)
// https://stackoverflow.com/questions/51069552/axios-delete-request-with-body-and-headers
let response_data = await axios.delete(endpoint, { 'data': data }) // not just data?
.then(function (response) {
console.log(response.data);
return response.data;
})
.catch(function (error) {
console.log(error);
return error;
});
return response_data;
}
export default delete_object;

View File

@@ -1,52 +0,0 @@
import axios from 'axios';
console.log('*** api_update.js ***');
var axios_fastapi = axios.create({
baseURL: 'https://dev-fastapi.oneskyit.com',
// baseURL: 'http://fastapi.localhost:5005',
// baseURL: 'http://192.168.32.20:5005',
/* other custom settings */
});
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
axios_fastapi.defaults.headers['content-type'] = 'application/json';
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
async function get_object({axios=axios_fastapi, endpoint='', params=[], data=[], return_meta=false, force_li=false}) {
console.log('*** get_object() ***');
//console.log(endpoint);
//console.log(params);
//console.log(data);
//console.log(return_meta);
//console.log(force_li);
let response_data = await axios.get(endpoint, { params: params })
.then(function (response) {
console.log(response.data);
if (!Array.isArray(response.data['data']) && force_li) {
console.log('Forcing return as a list');
let return_data = [];
return_data.push(response.data['data']);
return return_data;
} else {
return response.data['data'];
}
//return response.data;
})
.catch(function (error) {
console.log(error.response);
if (error.response.status === 404) {
return null;
}
return error;
});
return response_data;
}
export default get_object;

View File

@@ -1,45 +0,0 @@
import axios from 'axios';
console.log('*** api_update.js ***');
var axios_fastapi = axios.create({
// baseURL: 'https://dev-fastapi.oneskyit.com',
baseURL: 'http://fastapi.localhost:5005',
// baseURL: 'http://192.168.32.20:5005',
/* other custom settings */
});
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
axios_fastapi.defaults.headers['content-type'] = 'application/json';
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
async function patch_object({axios=axios_fastapi, endpoint='', params=[], record=[], return_meta=false}) {
console.log('*** patch_object() ***');
//console.log(endpoint);
//console.log(params);
console.log(record);
//console.log(return_meta);
//console.log(force_li);
let response_data = await axios.patch(endpoint, record, { params: params })
.then(function (response) {
console.log(response.data);
return response.data['data'];
//return response.data;
})
.catch(function (error) {
console.log(error.response);
if (error.response.status === 404) {
return null;
}
return error;
});
return response_data;
}
export default patch_object;

View File

@@ -1,45 +0,0 @@
import axios from 'axios';
console.log('*** api_post.js ***');
var axios_fastapi = axios.create({
// baseURL: 'https://dev-fastapi.oneskyit.com',
baseURL: 'http://fastapi.localhost:5005',
// baseURL: 'http://192.168.32.20:5005',
/* other custom settings */
});
axios_fastapi.defaults.headers['Access-Control-Allow-Origin'] = '*';
axios_fastapi.defaults.headers['content-type'] = 'application/json';
axios_fastapi.defaults.headers['x-aether-api-key'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-token'] = 'aaabbbcccxxxyyyzzz';
axios_fastapi.defaults.headers['x-aether-api-expire-on'] = '';
axios_fastapi.defaults.headers['x-account-id'] = 'xxxyyyzzz111222333';
async function post_object({axios=axios_fastapi, endpoint='', record=[], return_meta=false}) {
console.log('*** post_object() ***');
//console.log(endpoint);
//console.log(params);
console.log(record);
//console.log(return_meta);
//console.log(force_li);
let response_data = await axios.post(endpoint, record)
.then(function (response) {
console.log(response.data);
return response.data['data'];
//return response.data;
})
.catch(function (error) {
console.log(error.response);
if (error.response.status === 404) {
return null;
}
return error;
});
return response_data;
}
export default post_object;

976
src/app.css Normal file
View File

@@ -0,0 +1,976 @@
@import 'tailwindcss';
@import "@skeletonlabs/skeleton";
@import "@skeletonlabs/skeleton/optional/presets";
/* Register Preset Themes */
/* @import '@skeletonlabs/skeleton/themes/{theme-name}'; */
@import '@skeletonlabs/skeleton/themes/cerberus';
@import '@skeletonlabs/skeleton/themes/concord';
@import '@skeletonlabs/skeleton/themes/crimson';
@import '@skeletonlabs/skeleton/themes/hamlindigo';
@import '@skeletonlabs/skeleton/themes/modern';
@import '@skeletonlabs/skeleton/themes/nouveau';
@import '@skeletonlabs/skeleton/themes/rocket';
@import '@skeletonlabs/skeleton/themes/terminus';
@import '@skeletonlabs/skeleton/themes/vintage';
@import '@skeletonlabs/skeleton/themes/wintry';
/* @import '@skeletonlabs/skeleton/themes/ae_c_osit'; */
/* @import '@skeletonlabs/skeleton/themes/ae_c_lci'; */
@import './ae-osit-default.css';
@import './ae-c-lci.css';
@import './ae-c-idaa-light.css';
@source '../node_modules/@skeletonlabs/skeleton-svelte/dist';
/* Add your theme import for your theme: "osit-custom-theme" here */
/* @plugin '@tailwindcss/forms'; */
/* @plugin '@tailwindcss/typography'; */
/* @import "tailwindcss/theme.css" layer(theme); */
/* @import "tailwindcss/preflight"; */
@import "tailwindcss/utilities.css" layer(utilities);
/*@tailwind utilities;*/
/* Register a Custom Themes */
/* Make sure to resolve the relative path. */
/* Note the .css extension is optional. */
/* @import '../{my-theme-name}'; */
/* @import '@fontsource/open-sans'; */
/* https://www.skeleton.dev/docs/guides/cookbook/light-switch */
/* @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%;
}
/* .dark {
--background: 224 71.4% 4.1%;
--foreground: 210 20% 98%;
--muted: 215 27.9% 16.9%;
--muted-foreground: 217.9 10.6% 64.9%;
--popover: 224 71.4% 4.1%;
--popover-foreground: 210 20% 98%;
--card: 224 71.4% 4.1%;
--card-foreground: 210 20% 98%;
--border: 215 27.9% 16.9%;
--input: 215 27.9% 16.9%;
--primary: 210 20% 98%;
--primary-foreground: 220.9 39.3% 11%;
--secondary: 215 27.9% 16.9%;
--secondary-foreground: 210 20% 98%;
--accent: 215 27.9% 16.9%;
--accent-foreground: 210 20% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 20% 98%;
--ring: 216 12.2% 83.9%;
--sidebar-background: 240 5.9% 10%;
--sidebar-foreground: 240 4.8% 95.9%;
--sidebar-primary: 224.3 76.3% 48%;
--sidebar-primary-foreground: 0 0% 100%;
--sidebar-accent: 240 3.7% 15.9%;
--sidebar-accent-foreground: 240 4.8% 95.9%;
--sidebar-border: 240 3.7% 15.9%;
--sidebar-ring: 217.2 91.2% 59.8%;
} */
}
@layer base {
* {
border-color: hsl(var(--border));
}
body {
background-color: hsl(var(--background));
color: hsl(var(--foreground));
}
}
/* There are no more Tailwind layers. */
html,
body {
@apply h-full overflow-hidden;
/* font-family: 'Liberation Sans', sans-serif; */
/* font-family: 'Noto Sans', sans-serif; */
}
html.super_access #appShell {
background-color: hsla(0, 100%, 50%, 0.5);
}
html.manager_access #appShell {
background-color: hsla(0, 50%, 75%, 0.5);
}
html.administrator_access #appShell {
background-color: hsla(40, 50%, 85%, 0.25);
}
html.trusted_access #appShell {
background-color: hsla(20, 50%, 85%, 0.25);
}
/* default theme */
/* @font-face {
font-family: 'Liberation Sans', sans-serif;
font-family: 'Noto Sans', sans-serif;
src: url('/fonts/liberation/LiberationSans-Regular.ttf');
src: url('/fonts/noto/NotoSans-Regular.ttf');
font-display: swap;
} */
/* modern theme */
@font-face {
font-family: 'Quicksand';
src: url('/fonts/Quicksand.ttf');
font-display: swap;
}
/* :root [data-theme='modern'] { */
/* --theme-rounded-base: 20px;
--theme-rounded-container: 4px; */
/* --theme-font-family-base: 'Liberation Sans', sans-serif; */
/* --theme-font-family-heading: 'Liberation Sans', sans-serif; */
/* } */
/* Using Skeleton Tailwind Presets */
/* Built in colors (also with "contrast" option):
* - primary
* - secondary
* - tertiary
* - success
* - warning
* - error
* - surface
*/
/* Built in presets:
* - Filled - a filled preset of the primary brand color.
* - Tonal - a tonal preset of the primary brand color.
* - Outlined - an outlined preset of the primary brand color.
*/
/* Additional customized presets:
* - Glass - a custom preset using background transparency and backdrop blur.
* - Elevated - mixes a filled preset with a shadow.
* - Ghost - has no style by default, but shows a tonal preset on hover.
* - Ghost Icon - has no style by default, but shows a branded tonal preset on hover.
* - Gradient - a custom preset generated using Tailwind gradient primitives.
*/
/* Generic button types needed:
* - primary
* - secondary
* - tertiary
* - success
* - warning
* - error
* - neutral
* - surface
* - info
* - danger
* - normal
* - outline
* - text
*/
/* Aether specific button types needed:
* - open or view
* - close or hide
* - help
* - save
* - delete
* - cancel
* - confirm
* - reset
* - submit
* - next or previous
* - back
* - edit
* - create
* - add
* - remove
* - copy
* - paste
* - download
* - upload
* - print
* - share
* - search
* - filter
* - sort
* - select
* - clear
* - toggle or switch
* - expand or collapse
* - configure or settings
* - refresh or reload
* - sync or synchronize
* - play or pause
* - stop
* - like or dislike
* - favorite or unfavorite
* - follow or unfollow
* - subscribe or unsubscribe
* - vote or unvote
* - rate or review
* - report or flag
* - block or unblock
* - accept or decline
* - agree or disagree
* - confirm or cancel
* - approve or reject
*/
/* Create a custom preset in your global stylesheet */
/* .preset-gradient {
background-image: linear-gradient(-45deg, var(--color-primary-300), var(--color-primary-700));
color: var(--color-primary-contrast-500);
} */
/* .preset-glass-primary {
background: color-mix(in oklab, var(--color-primary-500) 40%, transparent);
box-shadow: 0 0px 30px color-mix(in oklab, var(--color-primary-500) 50%, transparent) inset;
backdrop-filter: blur(16px);
} */
/*
* - tonal buttons - use these for most buttons
* - filled buttons - use these for buttons that need to stand out
* - outlined buttons - use these for buttons that need to be less prominent (sort of like TW v3 ghost)
*/
/* 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;
}
.ae_btn_primary {
@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 */
}
.ae_btn_tertiary {
@apply preset-tonal-tertiary border border-tertiary-500 transition-all;
}
.ae_btn_success {
@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;
}
.ae_btn_error {
@apply preset-tonal-error border border-error-500 transition-all;
}
.ae_btn_surface {
@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;
}
/* 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 */
}
.ae_btn_secondary_outlined {
@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;
}
.ae_btn_success_outlined {
@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;
}
.ae_btn_warning_outlined {
@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;
}
.ae_btn_surface_outlined {
@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;
}
.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;
}
.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;
}
/* Containers customized for Aether using Skeleton Tailwind preset classes */
.ae_container_system_menu {
@apply container;
}
.ae_container_system_options {
@apply container;
}
.ae_container_system_help {
@apply container;
}
.ae_container_module {
@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;
}
[data-theme='AE_c_LCI'] .ae_module_header {
/* 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; */
}
.ae_container_module_content {
@apply container;
}
.ae_container_module_menu {
@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
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
flex flex-row flex-wrap items-center justify-around
w-full max-w-full
p-2
transition-all;
}
.ae_container_module_help {
@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 */
}
.ae_container_actions {
@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;
}
.ae_container_content {
@apply container;
}
.ae_container_content_header {
@apply container;
}
.ae_container_content_content {
@apply container;
}
.ae_container_content_footer {
@apply container;
}
.ae_container_alert {
@apply container;
}
.ae_container_help {
@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 */
}
.ae_container_info {
@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
max-w-full
p-2
transition-all;
}
.ae_container_msg {
@apply container;
}
.ae_container_warning {
@apply container;
}
.ae_container_tag {
@apply container;
}
.ae_container_modal {
@apply container mx-auto max-w-7xl px-4 sm:px-6 lg:px-8;
}
.ae_container_modal_header {
@apply container;
}
.ae_container_modal_content {
@apply container;
}
.ae_container_modal_footer {
@apply container;
}
/* Standard Aether object properties:
* - id
* - name
* - enable
* - hide
* - priority
* - sort
* - group
* - notes
*/
.card-footer {
border-top: 1px solid hsla(0, 0%, 0%, 0.5);
margin-top: 1em;
padding-top: 1em;
opacity: .5;
}
/* Tailwind: This "fixes" Tailwind's default group button styles that do not seem to allow hiding buttons. */
.btn-group a.hidden, .btn-group button.hidden {
display: none;
}
.ae_d_none {
display: none;
}
/* Allow content to scroll horizontal if too wide */
.ae_h_scrollfix {
max-width: 100%;
overflow-x: auto;
}
/* These helps with the Skeleton Tailwind modal utility. */
.ae_modal_scrollfix {
/* Allow modal content to scroll if it's too long */
overflow-y: auto;
max-height: 96vh;
/* max-height: 99%; */
}
.ae_debug {
/* A darker pink outline */
outline: thin dashed;
outline-color: hsla(0, 100%, 50%, 0.15);
/* A light pink background color */
background-color: hsla(0, 100%, 50%, 0.15);
}
.ae_debug:hover {
/* A darker pink outline */
outline-color: hsla(0, 100%, 50%, 0.50);
/* A light pink background color */
background-color: hsla(0, 100%, 50%, 0.40);
}
/* Deal with being in an iframe */
#appShell #shell-header.iframe {
display: none;
}
#appShell #shell-footer.iframe {
display: none;
}
.iframe .module_header, .iframe .module_footer{
display: none;
}
/* Remove the background from the body in all cases */
/* body[data-theme] { */
/* background: none; */
/* background-image: none; */
/* } */
/* Remove the background from the body if using iframes */
/* body[data-theme]:has(#page.iframe) { */
/* background: none; */
/* background-image: none; */
/* background-image: url('https://static.oneskyit.com/c/CHOW/images/CHOW_2024_yellow_background.png'); */
/* background-size: cover; */
/* } */
main {
/* background: none;
background-color: hsla(0, 0%, 100%, 0.92); */
}
main>section {
background: none;
background-color: hsla(0, 0%, 100%, 0.92);
padding: .5em;
}
/* @media (min-width: 640px) {
main>div, main>section {
padding: 0;
max-width: 100%;
}
} */
/* @media (min-width: 768px) {
main>div, main>section {
padding: 0;
max-width: 100%;
}
} */
.ae_sponsorships {
/* background: none; */
/* background-color: hsla(0, 0%, 100%, 0.92); */
/* background-image: url('https://static.oneskyit.com/c/CHOW/images/CHOW_2024_yellow_background.png'); */
/* background-size: cover; */
}
pre.pre_wrap {
white-space: pre-wrap;
word-break: normal;
word-wrap: normal;
border: none;
max-width: 100%;
overflow-x: auto;
}
input.required {
/* border-right: solid medium var(--color-warning-500); */
/* color: var(--color-warning-500); */
}
input:required {
/* background-color: var(--alert-color-lightest); */
/* border: solid 2px red; */
/* outline: dashed thin var(--alert-color-lighter); */
/* border-right: solid medium var(--alert-color-mid); */
/* border-right: solid medium var(--warning-color-mid); */
/* border-right: solid medium var(--error-color-mid); */
}
/* input:required:hover {
background-color: var(--alert-color-lighter);
border-right: solid thick var(--alert-color-darker);
} */
/* input:required::before {
display: block;
content: '*';
color: var(--warning-color-darker);
top: 5px;
left: 5px;
} */
.input_required::after {
content: '*';
color: rgb(var(--color-error-500) / 0.9);
position: relative;
/* top: 0em; */
left: .25em;
}
/* Make the group a flex row by default */
/* div.btn-group { */
/* display: flex; */
/* gap: 0; */
/* flex-direction: row; */
/* justify-content: space-around; */
/* align-items: center; */
/* margin: 0;
padding: 0; */
/* } */
/* Make all button elements except for the the first button element not rounded on the left. */
/* Make all button elements except for the fhe last button element not rounded on the right. */
/* These helps with the Skeleton (Tailwind?) button group element. */
.btn-group button {
border-radius: 0;
border: none;
}
/* .md:btn-group button,
.lg:btn-group button {
border-radius: 0;
border: none;
} */
/* div.btn-group button:first-child {
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem;
}
div.btn-group button:last-child {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
} */
.ae_obj_prop .label {
}
.ae_obj_prop .value {
font-weight: bold;
}
.ae_md_hide {
/* outline: medium dashed green; */
/* display: none; */
}
@media (max-width: 767px) {
.ae_md_hide {
/* outline: medium dashed red; */
display: none;
}
}
@media (min-width: 768px) {
.ae_lg_hide {
/* outline: medium dashed blue; */
display: none;
}
}
/* Use the div.ae_quick_modal_container to block background clicks when using the section.ae_quick_popover. */
div.ae_quick_modal_container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
background-color: hsla(0, 0%, 0%, .5);
}
/* The section.ae_quick_popover should be above the rest of the content and centered on the page. */
section.ae_quick_popover {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 100;
background-color: hsla(0, 0%, 100%, .95);
padding: 1rem;
border-radius: .5rem;
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5);
min-height: 98%;
min-width: 98%;
}
section.ae_quick_popover_small {
position: fixed;
top: 1em;
left: 50%;
transform: translate(-50%, 0%);
z-index: 100;
background-color: hsla(0, 0%, 100%, .95);
padding: 1rem;
border-radius: .5rem;
box-shadow: 0 0 1rem hsla(0, 0%, 0%, .5);
min-height: 24rem;
max-height: 95%;
min-width: 50%;
max-width: 95%;
}
.fade_50 {
opacity: 0.5;
}
.fade_50:hover {
opacity: 1;
}
.auth_view_only {
display: none;
}
.ae_root--auth_access .auth_view_only {
display: initial;
}
img.qr_code {
/* outline: solid thin hsla(30, 100%, 50%, .1); */
/* width: 1.50in; */
}
img.qr_code:hover {
/* outline: solid thin green; */
/* width: 2.50in; */
}
img.qr_code:focus {
/* outline: solid thin red; */
/* width: 2.50in; */
}
.dim {
opacity: 0.5;
color: hsla(0, 0%, 50%, .95);
}
.dim_warning {
opacity: 0.5;
/* color: hsla(0, 100%, 50%, .95); */
/* background should be hash marks */
background-image: repeating-linear-gradient(-45deg, hsla(0, 100%, 50%, .25), hsla(0, 100%, 50%, .25) 10px, transparent 10px, transparent 20px);
}
.alert {
/* background-color: hsla(0, 100%, 50%, .1); */
outline: dashed thin hsla(0, 100%, 50%, .5);
}
@media (max-width: 767px) {
.sk_header.hide_sm {
display: none;
}
.sk_header.show_sm {
display: initial;
}
.sk_header.show_md {
display: none;
}
}
@media (min-width: 768px) {
.sk_header.hide_md {
display: none;
}
.sk_header.show_md {
display: initial;
}
.sk_header.show_sm {
display: none;
}
}
/* We need to reset many of the styles for the reset_css class. */
.reset_css p {
margin: .75em 0;
}
.reset_css ol {
list-style-type: decimal;
}
.reset_css ul {
list-style-type: disc;
}
.reset_css li {
margin-left: 1.5em;
}
/* Reset anchor tags to the default color and underline. */
.reset_css a {
color: hsla(210, 100%, 50%, 1);
text-decoration: underline;
}
.reset_css a:hover {
color: hsla(210, 100%, 50%, .75);
text-decoration: none;
}
/* .ae_btn.btn-danger,
.ae_btn.btn-info,
.ae_btn.btn-warning {
border-radius: 60px;
} */
/* .ae_margin_xs {
margin: 0.25em;
}
.ae_margin_sm {
margin: 0.5em;
}
.ae_margin_md {
margin: 0.75em;
}
.ae_margin_lg {
margin: 1em;
}
.ae_margin_lg {
margin: 1.25em;
} */
/* BEGIN: Overrides and fixes specific to Novi and IDAA */
.iframe .novi_btn {
border-radius: 60px;
/* border-color: hsla(0, 0%, 50%, .5); */
/* border-color: hsla(0, 0%, 0%, .15); */
}
.iframe .novi_m0 {
margin: 0;
}
.iframe .novi_p0 {
padding: 0;
}
.iframe .dark .novi_label {
color: white;
}
.iframe .dark .novi_black {
color: black;
}
.iframe .dark .novi_white {
color: white;
}
.iframe .dark .novi_bg_black {
background-color: black;
}
.iframe .dark .novi_bg_white {
background-color: white;
}
.iframe .dark .novi_bg_gray {
background-color: hsla(0, 0%, 50%, 1);
}
.iframe .dark .novi_bg_light_gray {
background-color: hsla(0, 0%, 95%, 1);
}
.iframe .dark .novi_bg_dark_gray {
background-color: hsla(0, 0%, 20%, 1);
}
.iframe .novi_bg_light {
background-color: hsla(0, 0%, 0%, .15);
color: hsla(0, 0%, 20%, 1);
}
.iframe .novi_bg_dark {
background-color: hsla(0, 0%, 0%, .25);
color: hsla(0, 0%, 95%, 1);
}
.iframe .novi_margin_sm {
/* margin: 0.5em; */
}
.iframe .novi_text_wrap {
/* white-space: normal; */
white-space: pre-wrap;
word-break: break-word;
}
/* END: Overrides and fixes specific to Novi and IDAA */
.iframe button.ae_normal,
.iframe .btn.ae_normal {
/* font: normal 1em sans-serif; */
font-size: 1rem;
}
.iframe button.ae_smaller,
.iframe .btn.ae_smaller,
.iframe button.novi_smaller,
.iframe .btn.novi_smaller
{
font-size: 0.8rem;
}
.iframe button.ae_smallest,
.iframe .btn.ae_smallest,
.iframe button.novi_smallest,
.iframe .btn.novi_smallest
{
font-size: 0.65rem;
}

9
src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface PageData {}
// interface Error {}
// interface Platform {}
}

30
src/app.html Normal file
View File

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

546
src/hold_app.postcss Normal file
View File

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

View File

@@ -1,119 +0,0 @@
var template = {};
// NOTE address template section
template['address'] = {};
template['address']['id'] = { 'obj_type': 'address', 'obj_prop_name': 'id', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID', 'label_class_li': [] };
template['address']['id_random'] = { 'obj_type': 'address', 'obj_prop_name': 'id_random', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID random', 'label_class_li': [] };
template['address']['for_type'] = { 'obj_type': 'address', 'obj_prop_name': 'for_type', 'type': 'text', 'placeholder': 'For type', 'class': 'address.for_type', 'style': '', 'label': 'For type', 'label_class_li': [] };
template['address']['for_id'] = { 'obj_type': 'address', 'obj_prop_name': 'for_id', 'type': 'text', 'placeholder': 'For ID', 'class': 'address.for_id', 'style': '', 'label': 'For ID', 'label_class_li': [] };
template['address']['name'] = { 'obj_type': 'address', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class': 'address.name', 'style': '', 'label': 'Name', 'label_class_li': [] };
template['address']['attention_to'] = { 'obj_type': 'address', 'obj_prop_name': 'attention_to', 'type': 'text', 'placeholder': 'Attention to', 'class': 'address.attention_to', 'style': '', 'label': 'Attention to', 'label_class_li': [] };
template['address']['organization_name'] = { 'obj_type': 'address', 'obj_prop_name': 'organization_name', 'type': 'text', 'placeholder': 'Organization name', 'class': 'address.organization_name', 'style': '', 'label': 'Organization name', 'label_class_li': [] };
template['address']['line_1'] = { 'obj_type': 'address', 'obj_prop_name': 'line_1', 'type': 'text', 'placeholder': 'Line 1', 'class': 'address.line_1', 'style': '', 'label': 'Line 1', 'label_class_li': [] };
template['address']['line_2'] = { 'obj_type': 'address', 'obj_prop_name': 'line_2', 'type': 'text', 'placeholder': 'Line 2', 'class': 'address.line_2', 'style': '', 'label': 'Line 2', 'label_class_li': [] };
template['address']['line_3'] = { 'obj_type': 'address', 'obj_prop_name': 'line_3', 'type': 'text', 'placeholder': 'Line 3', 'class': 'address.line_3', 'style': '', 'label': 'Line 3', 'label_class_li': [] };
template['address']['city'] = { 'obj_type': 'address', 'obj_prop_name': 'city', 'type': 'text', 'placeholder': 'City', 'class': 'address.city', 'style': '', 'label': 'City', 'label_class_li': [] };
template['address']['state_province'] = { 'obj_type': 'address', 'obj_prop_name': 'state_province', 'type': 'text', 'placeholder': 'State/Province', 'class': 'address.state_province', 'style': '', 'label': 'State/Province', 'label_class_li': [] };
template['address']['postal_code'] = { 'obj_type': 'address', 'obj_prop_name': 'postal_code', 'type': 'text', 'placeholder': 'Postal Code', 'class': 'address.postal_code', 'style': '', 'label': 'Postal code', 'label_class_li': [] };
//template['address']['country_alpha_2_code'] = { 'obj_type': 'address', 'obj_prop_name': 'country_alpha_2_code', 'type': 'select', 'placeholder': 'Country alpha 2 code', 'class': 'address.country_alpha_2_code', 'style': '', 'label': 'Country alpha 2 code', 'label_class_li': [], 'select_option_li': { 'CA': 'Canada', 'MX': 'Mexico', 'US': 'United States', 'UK': 'United Kingdom' } };
template['address']['country_alpha_2_code'] = { 'obj_type': 'address', 'obj_prop_name': 'country_alpha_2_code', 'type': 'select', 'placeholder': 'Country alpha 2 code', 'class': 'address.country_alpha_2_code', 'style': '', 'label': 'Country alpha 2 code', 'label_class_li': [], 'select_option_li': { 'CA': 'Canada', 'MX': 'Mexico', 'US': 'United States', 'UK': 'United Kingdom' } };
template['address']['country'] = { 'obj_type': 'address', 'obj_prop_name': 'country', 'type': 'text', 'placeholder': 'Country', 'class': 'address.country', 'style': '', 'label': 'Country', 'label_class_li': [] };
template['address']['timezone'] = { 'obj_type': 'address', 'obj_prop_name': 'timezone', 'type': 'text', 'placeholder': 'Timezone', 'class': 'address.timezone', 'style': '', 'label': 'Timezone', 'label_class_li': [] };
template['address']['latitude'] = { 'obj_type': 'address', 'obj_prop_name': 'latitude', 'type': 'text', 'placeholder': 'Latitude', 'class': 'address.latitude', 'style': '', 'label': 'Latitude', 'label_class_li': [] };
template['address']['longitude'] = { 'obj_type': 'address', 'obj_prop_name': 'longitude', 'type': 'text', 'placeholder': 'Longitude', 'class': 'address.longitude', 'style': '', 'label': 'Longitude', 'label_class_li': [] };
template['address']['map_url'] = { 'obj_type': 'address', 'obj_prop_name': 'map_url', 'type': 'url', 'placeholder': 'Map URL', 'class': 'address.map_url', 'style': '', 'label': 'Map URL', 'label_class_li': [] };
template['address']['congressional_district'] = { 'obj_type': 'address', 'obj_prop_name': 'congressional_district', 'type': 'text', 'placeholder': 'Congressional district', 'class': 'address.congressional_district', 'style': '', 'label': 'Congressional district', 'label_class_li': [] };
template['address']['verified'] = { 'obj_type': 'address', 'obj_prop_name': 'verified', 'type': 'checkbox', 'placeholder': 'Verified', 'class': 'address.verified', 'style': '', 'label': 'Verified', 'label_class_li': [] };
template['address']['created_on'] = { 'obj_type': 'address', 'obj_prop_name': 'created_on', 'type': 'text', 'placeholder': '', 'class': 'address.created_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Created on', 'label_class_li': [] };
template['address']['updated_on'] = { 'obj_type': 'address', 'obj_prop_name': 'updated_on', 'type': 'text', 'placeholder': '', 'class': 'address.updated_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Updated on', 'label_class_li': [] };
// NOTE contact section
template['contact'] = {};
template['contact']['name'] = { 'obj_type': 'contact', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Name', 'label_class_li': [] };
template['contact']['title'] = { 'obj_type': 'contact', 'obj_prop_name': 'title', 'type': 'text', 'placeholder': 'Title', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Title', 'label_class_li': [] };
template['contact']['tagline'] = { 'obj_type': 'contact', 'obj_prop_name': 'tagline', 'type': 'checkbox', 'placeholder': 'Tagline', 'class': 'contact.tagline', 'style': '', 'label': 'Tagline', 'label_class_li': [] };
template['contact']['email'] = { 'obj_type': 'contact', 'obj_prop_name': 'email', 'type': 'email', 'placeholder': 'Email address', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Email address', 'label_class_li': [] };
template['contact']['other_site_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'website_url', 'type': 'url', 'placeholder': 'Website URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Website URL', 'label_class_li': [] };
template['contact']['website_name'] = { 'obj_type': 'contact', 'obj_prop_name': 'website_name', 'type': 'text', 'placeholder': 'Website name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Website name', 'label_class_li': [] };
template['contact']['phone_mobile'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_mobile', 'type': 'tel', 'placeholder': 'Phone mobile', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone mobile', 'label_class_li': [] };
template['contact']['phone_home'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_home', 'type': 'tel', 'placeholder': 'Phone home', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone home', 'label_class_li': [] };
template['contact']['phone_office'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_office', 'type': 'tel', 'placeholder': 'Phone office', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone office', 'label_class_li': [] };
template['contact']['phone_land'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_land', 'type': 'tel', 'placeholder': 'Phone land', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone land', 'label_class_li': [] };
template['contact']['phone_fax'] = { 'obj_type': 'contact', 'obj_prop_name': 'phone_fax', 'type': 'tel', 'placeholder': 'Phone fax', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Phone fax', 'label_class_li': [] };
template['contact']['facebook_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'facebook_url', 'type': 'url', 'placeholder': 'Facebook URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Facebook URL', 'label_class_li': [] };
template['contact']['instagram_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'instagram_url', 'type': 'url', 'placeholder': 'Instagram URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Instagram URL', 'label_class_li': [] };
template['contact']['twitter_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'twitter_url', 'type': 'url', 'placeholder': 'Twitter URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Twitter URL', 'label_class_li': [] };
template['contact']['linkedin_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'linkedin_url', 'type': 'url', 'placeholder': 'LinkedIn URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'LinkedIn URL', 'label_class_li': [] };
template['contact']['other_site_url'] = { 'obj_type': 'contact', 'obj_prop_name': 'other_site_url', 'type': 'url', 'placeholder': 'Other site URL', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Other site URL', 'label_class_li': [] };
template['contact']['others_site_name'] = { 'obj_type': 'contact', 'obj_prop_name': 'others_site_name', 'type': 'text', 'placeholder': 'Other site name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Other site name', 'label_class_li': [] };
template['contact']['enable'] = { 'obj_type': 'contact', 'obj_prop_name': 'enable', 'type': 'checkbox', 'placeholder': 'Enable', 'class': 'contact.enable', 'style': '', 'label': 'Enable', 'label_class_li': [] };
// NOTE site template section
template['site'] = {};
template['site']['id'] = { 'obj_type': 'site', 'obj_prop_name': 'id', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID', 'label_class_li': [] };
template['site']['id_random'] = { 'obj_type': 'site', 'obj_prop_name': 'id_random', 'type': 'hidden', 'placeholder': '', 'class_li': [], 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'ID random', 'label_class_li': [] };
//template['site']['fqdn_1'] = { 'obj_type': 'site', 'obj_prop_name': 'fqdn_1', 'type': 'text', 'placeholder': 'FQDN 1', 'class': 'site.fqdn_1', 'style': '', 'label': 'FQDN 1', 'label_class_li': [] };
//template['site']['fqdn_2'] = { 'obj_type': 'site', 'obj_prop_name': 'fqdn_2', 'type': 'text', 'placeholder': 'FQDN 2', 'class': 'site.fqdn_2', 'style': '', 'label': 'FQDN 2', 'label_class_li': [] };
//template['site']['fqdn_3'] = { 'obj_type': 'site', 'obj_prop_name': 'fqdn_3', 'type': 'text', 'placeholder': 'FQDN 2', 'class': 'site.fqdn_3', 'style': '', 'label': 'FQDN 3', 'label_class_li': [] };
template['site']['enable'] = { 'obj_type': 'site', 'obj_prop_name': 'enable', 'type': 'checkbox', 'placeholder': 'Enable', 'class': 'site.enable', 'style': '', 'label': 'Enable', 'label_class_li': [] };
template['site']['name'] = { 'obj_type': 'site', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class': 'site.name', 'style': '', 'label': 'Name', 'label_class_li': [] };
template['site']['description'] = { 'obj_type': 'site', 'obj_prop_name': 'description', 'obj_prop_value_pre': true, 'type': 'textarea', 'placeholder': 'Description', 'class': 'site.description', 'style': '', 'label': 'Description', 'label_class_li': [], 'rows': 3, 'cols': 80 };
template['site']['logo_path'] = { 'obj_type': 'site', 'obj_prop_name': 'logo_path', 'type': 'text', 'placeholder': 'Logo path', 'class': 'site.logo_path', 'style': '', 'label': 'Logo path' };
template['site']['banner_image_path'] = { 'obj_type': 'site', 'obj_prop_name': 'banner_image_path', 'type': 'text', 'placeholder': 'Banner image path', 'class': 'site.banner_image_path', 'style': '', 'label': 'Banner image path' };
//template['site']['html_menu_path'] = { 'obj_type': 'site', 'obj_prop_name': 'html_menu_path', 'type': 'text', 'placeholder': 'HTML menu path', 'class': 'site.html_menu_path', 'style': '', 'label': 'HTML menu path' };
template['site']['site_body'] = { 'obj_type': 'site', 'obj_prop_name': 'site_body', 'obj_prop_value_pre': true, 'type': 'textarea', 'placeholder': 'Site body', 'class': 'site.site_body', 'style': '', 'label': 'Site body', 'label_class_li': [], 'rows': 10, 'cols': 80 };
template['site']['site_tagline'] = { 'obj_type': 'site', 'obj_prop_name': 'site_tagline', 'type': 'text', 'placeholder': 'Site tagline', 'class': 'site.site_tagline', 'style': '', 'label': 'Site tagline', 'label_class_li': [] };
template['site']['style_href'] = { 'obj_type': 'site', 'obj_prop_name': 'style_href', 'type': 'text', 'placeholder': 'Style HREF', 'class': 'site.style_href', 'style': '', 'label': 'Style HREF', 'label_class_li': [] };
template['site']['script_src'] = { 'obj_type': 'site', 'obj_prop_name': 'script_src', 'type': 'text', 'placeholder': 'Script SRC', 'class': 'site.script_src', 'style': '', 'label': 'Script SRC', 'label_class_li': [] };
template['site']['google_tracking_id'] = { 'obj_type': 'site', 'obj_prop_name': 'google_tracking_id', 'type': 'text', 'placeholder': 'Google tracking ID', 'class': 'site.google_tracking_id', 'style': '', 'label': 'Google tracking ID', 'label_class_li': [] };
template['site']['created_on'] = { 'obj_type': 'site', 'obj_prop_name': 'created_on', 'type': 'text', 'placeholder': '', 'class': 'site.created_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Created on', 'label_class_li': [] };
template['site']['updated_on'] = { 'obj_type': 'site', 'obj_prop_name': 'updated_on', 'type': 'text', 'placeholder': '', 'class': 'site.updated_on', 'style': '', 'readonly': 'readonly', 'disabled': 'disabled', 'required': 'required', 'label': 'Updated on', 'label_class_li': [] };
// NOTE person section
template['person'] = {};
template['person']['given_name'] = { 'obj_type': 'person', 'obj_prop_name': 'given_name', 'type': 'text', 'placeholder': 'Given name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Given name', 'label_class_li': [] };
template['person']['middle_name'] = { 'obj_type': 'person', 'obj_prop_name': 'middle_name', 'type': 'text', 'placeholder': 'Middle name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Middle name', 'label_class_li': [] };
template['person']['family_name'] = { 'obj_type': 'person', 'obj_prop_name': 'family_name', 'type': 'text', 'placeholder': 'Family name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Family name', 'label_class_li': [] };
template['person']['title'] = { 'obj_type': 'person', 'obj_prop_name': 'title', 'type': 'text', 'placeholder': 'Title', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Title', 'label_class_li': [] };
template['person']['tagline'] = { 'obj_type': 'person', 'obj_prop_name': 'tagline', 'type': 'text', 'placeholder': 'Tagline', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Tagline', 'label_class_li': [] };
template['person']['organization_name'] = { 'obj_type': 'person', 'obj_prop_name': 'organization_name', 'type': 'text', 'placeholder': 'Organization name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': '', 'label': 'Organization name', 'label_class_li': [] };
template['person']['notes'] = { 'obj_type': 'person', 'obj_prop_name': 'notes', 'obj_prop_value_pre': true, 'type': 'textarea', 'placeholder': 'Notes', 'class': 'person.notes', 'style': '', 'label': 'Notes', 'label_class_li': [], 'rows': 3, 'cols': 80 };
// NOTE user section
template['user'] = {};
template['user']['email'] = { 'obj_type': 'user', 'obj_prop_name': 'email', 'type': 'email', 'placeholder': 'Email address', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Email address', 'label_class_li': [] };
template['user']['name'] = { 'obj_type': 'user', 'obj_prop_name': 'name', 'type': 'text', 'placeholder': 'Name', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Name', 'label_class_li': [] };
template['user']['username'] = { 'obj_type': 'user', 'obj_prop_name': 'username', 'type': 'text', 'placeholder': 'Username', 'class_li': [], 'style': '', 'readonly': '', 'disabled': '', 'required': 'required', 'label': 'Username', 'label_class_li': [] };
template['user']['email_verified'] = { 'obj_type': 'user', 'obj_prop_name': 'email_verified', 'type': 'checkbox', 'placeholder': 'Email verified', 'class': 'user.email_verified', 'style': '', 'label': 'Email verified', 'label_class_li': [] };
template['user']['enable'] = { 'obj_type': 'user', 'obj_prop_name': 'enable', 'type': 'checkbox', 'placeholder': 'Enable', 'class': 'user.enable', 'style': '', 'label': 'Enable', 'label_class_li': [] };
export default template;

7
src/index.test.ts Normal file
View File

@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});

View File

@@ -1,37 +0,0 @@
<script lang="ts">
export let id_random: string = '';
export let obj_type: string = '';
export let obj_prop_name: string = '';
export let name: string = obj_prop_name;
export let id: string = `${name}--${id_random}`; // Same as the value for "for"
export let value: string = '';
export let readonly: string = '';
export let disabled: string = '';
export let required: string = '';
export let type: string = 'text';
//export let class: string = ''; // Probably not going to use
export let class_li: Array<> = [];
export let style: string = '';
export let label: string = '';
export let placeholder: string = label;
export let label_class: string = ''; // Probably not going to use
export let label_class_li: Array<> = [];
</script>
{#if type === 'text' || type === 'email' || type === 'url' || type === 'checkbox' }
<label for={id} class={label_class_li.join(' ')}>{label}</label>
<input {id} {name} class={class_li.join(' ')} {type} {value} {placeholder} {readonly} {disabled} {required} data-id_random={id_random} data-obj_type={obj_type} data-obj_prop_name={obj_prop_name} />
{:else if type === 'textarea'}
<label for={id} class={label_class_li.join(' ')}>{label}</label>
<textarea {id} {name} class={class_li.join(' ')} {value} {placeholder} {readonly} {disabled} {required} data-id_random={id_random} data-obj_type={obj_type} data-obj_prop_name={obj_prop_name}></textarea>
<!-- rows="" cols="" maxlength="" -->
{/if}

View File

@@ -0,0 +1,133 @@
// import axios from 'axios';
// Updated 2024-05-23
export let 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: 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 (!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]));
// Clean the headers
let headers_cleaned: Record<string, string> = {};
for (const prop in api_cfg['headers']) {
let prop_cleaned = prop.replaceAll('_', '-');
headers_cleaned[prop_cleaned] = api_cfg['headers'][prop];
}
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)
};
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);
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}`);
}
const json = await response.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);
// 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})`);
}
}
}
// 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'];
// //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) {
// 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;
}

View File

@@ -0,0 +1,175 @@
import type { key_val } from '$lib/ae_stores';
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: any,
no_account_id?: boolean,
obj_type: string,
obj_id: string,
use_alt_table?: boolean,
use_alt_base?: boolean,
inc?: any,
enabled?: string,
hidden?: string,
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() ***');
}
// 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);
}
params['use_alt_table'] = use_alt_table;
params['use_alt_base'] = use_alt_base;
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';
// 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
}
let 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) {
console.log('API GET CRUD object ID request failed.', error);
});
if (log_lvl > 1) {
console.log('GET Object result =', object_obj_get_promise);
}
return object_obj_get_promise;
}

View File

@@ -0,0 +1,229 @@
import type { key_val } from '$lib/ae_stores';
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: 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?: string,
hidden?: string,
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}]`);
}
// 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`;
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;
}
params['use_alt_table'] = use_alt_table;
params['use_alt_base'] = use_alt_base;
/* Need to deal with inc params here */
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
if (allowed_enabled_list.includes(enabled) ) {
params['enabled'] = enabled;
}
let 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;
}
if (limit >= 0) {
params['limit'] = limit;
}
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 (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);
}
let 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);
}
return object_li_get_promise;
}

View File

@@ -0,0 +1,248 @@
import type { key_val } from '$lib/ae_stores';
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_v2(
{
api_cfg,
obj_type,
for_obj_type,
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
use_alt_tbl = false, // Alternate table or view name
use_alt_mdl = false, // Alternate model name
use_alt_exp = false, // Alternate export table or view name
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: string,
for_obj_id?: string,
use_alt_tbl?: boolean|string,
use_alt_mdl?: boolean|string,
use_alt_exp?: boolean|string,
inc?: key_val
enabled?: string,
hidden?: string,
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() ***');
}
// 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`;
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_badge_template') {
endpoint = `/crud/event/badge/template/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;
}
endpoint = `/v2${endpoint}`;
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'];
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'; // Use alternate table or view name
}
if (use_alt_mdl === true) {
params['mdl_alt'] = 'alt'; // Use alternate model name
}
if (use_alt_exp === true) {
params['exp_alt'] = 'alt'; // Use alternate export table or view name
}
// Need to deal with inc params here???
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
if (allowed_enabled_list.includes(enabled) ) {
params['enabled'] = enabled;
}
let 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) {
// headers['order_by_li'] = 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 (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 (log_lvl) {
console.log('Params:', params);
}
let 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);
}
return object_li_get_promise;
}

View File

@@ -0,0 +1,213 @@
import type { key_val } from '$lib/ae_stores';
export let temp_get_blob_percent_completed = 0;
export let get_blob_percent_completed = temp_get_blob_percent_completed;
export let temp_get_object_percent_completed = 0;
export let get_object_percent_completed = temp_get_object_percent_completed;
export let 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: 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 (!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 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'];
}
// Clean the headers
let headers_cleaned: key_val = {};
for (const prop in headers) {
let 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
};
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;
}
for (let attempt = 1; attempt <= retry_count; attempt++) {
try {
const response = await fetch_method(url.toString(), fetchOptions)
.catch(function (error) {
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 (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 (!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;
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;
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);
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})`);
}
}
}
};

View File

@@ -0,0 +1,496 @@
import axios from 'axios';
import type { key_val } from '$lib/ae_stores';
export let temp_get_blob_percent_completed = 0;
// export let get_blob_percent_completed = readable(temp_get_blob_percent_completed);
export let get_blob_percent_completed = temp_get_blob_percent_completed;
export let temp_get_object_percent_completed = 0;
// export let get_object_percent_completed = readable(temp_get_object_percent_completed);
export let get_object_percent_completed = temp_get_object_percent_completed;
// Updated 2024-05-23
export let 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: 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 (!api_cfg) {
console.log('No API Config was provided. Returning false.');
return false;
}
let 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_!')
let headers_cleaned: key_val = {};
for (const prop in headers) {
// No underscores allowed in the header parameters!
let prop_cleaned = prop.replaceAll('_', '-');
// 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];
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';
}
}
// Handle the case where there is no Blob expected to be returned. Mainly JSON and text data.
if (!return_blob) {
let response_data_promise = await axios_api.get(
endpoint,
{
headers: headers,
params: params,
onDownloadProgress: (progressEvent) => {
let 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;
// 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);
}
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');
}
let return_data = [];
return_data.push(response.data['data']);
return return_data;
} else if (response.data['data']) {
let 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 {
let 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) {
// 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
}
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.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;
});
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...');
let response_data_promise = await axios_api.get(
endpoint,
{
params: params,
responseType: 'blob',
onDownloadProgress: (progressEvent) => {
let 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;
// 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;
// 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);
}
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) {
// 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
}
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.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;
});
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');
}
function rejected(result: any) {
console.error(result);
}

View File

@@ -0,0 +1,149 @@
// import axios from 'axios';
// Updated 2024-05-23
export let 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: 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 (!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]));
// Clean the headers
let headers_cleaned: Record<string, string> = {};
for (const prop in api_cfg['headers']) {
let prop_cleaned = prop.replaceAll('_', '-');
headers_cleaned[prop_cleaned] = api_cfg['headers'][prop];
}
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)
};
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);
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}`);
}
const json = await response.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);
// 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})`);
}
}
}
// 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);
// }
// // 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
// }
// // 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;
}

View File

@@ -0,0 +1,355 @@
// import axios from 'axios';
export let temp_post_blob_percent_completed = 0;
export let post_blob_percent_completed = temp_post_blob_percent_completed;
export let temp_post_object_percent_completed = 0;
export let post_object_percent_completed = temp_post_object_percent_completed;
// Updated 2024-05-23
export let 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: 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}`);
}
}
// console.log('HERE!! API POST 0');
if (!api_cfg) {
console.error('No API Config was provided. Returning false.');
return false;
}
// 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]));
}
// console.log('HERE!! API POST 2');
// Clean the headers
let headers_cleaned: Record<string, string> = {};
for (const prop in api_cfg['headers']) {
let prop_cleaned = prop.replaceAll('_', '-');
headers_cleaned[prop_cleaned] = api_cfg['headers'][prop];
}
// 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 (log_lvl > 1) {
console.log('Cleaned Headers:', headers_cleaned);
}
// 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
};
if (log_lvl > 1) {
console.log('Fetch Options:', fetchOptions);
}
const response = await fetch(url.toString(), fetchOptions);
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 (!return_blob) {
const json = await response.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);
}
// 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 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})`);
}
}
}
// 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 (!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;
// 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) {
// 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;
// } 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);
// temp_post_blob_percent_completed = percent_completed;
// }
// }
// )
// .then(function (response) {
// if (log_lvl) {
// console.log(response);
// }
// 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 (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);
// }
// }
}
// function resolved(result: any) {
// console.log('Resolved');
// }
// function rejected(result: any) {
// console.error(result);
// }

View File

@@ -0,0 +1,937 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_archives } from "$lib/ae_archives/db_archives";
import { load_ae_obj_li__archive_content } from "$lib/ae_archives/ae_archives__archive_content";
let 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: any,
archive_id: string,
inc_content_li?: boolean,
enabled?: string,
hidden?: string,
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}`);
}
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
let 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) {
console.log('No results returned or failed.', error);
});
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`);
}
let 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;
}
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: any,
for_obj_type: string,
for_obj_id: string,
inc_content_li?: boolean,
enabled?: string,
hidden?: string,
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}`);
}
let params_json: key_val = {};
// 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
let 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 [];
}
});
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++) {
let archive_obj = ae_promises.load__archive_obj_li[i];
let archive_id = archive_obj.archive_id_random;
let 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(`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;
}
}
}
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: 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 (!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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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);
}
// 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
let 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;
}
}
// 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: any,
archive_id: any,
qry_str?: string,
qry_files?: null|boolean,
qry_start_datetime?: null|string, // Greater than this datetime
enabled?: string, // all, disabled, enabled
hidden?: string, // 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}`);
// 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 params_json: key_val = {};
// if (qry_str && qry_str.length > 2) {
// params_json['ft_qry'] = {};
// params_json['ft_qry']['default_qry_str'] = qry_str;
// }
params_json['qry'] = [];
if (qry_files === true) {
let qry_param =
{
type: "AND",
field: "file_count_all",
operator: ">",
value: 0
};
params_json['qry'].push(qry_param);
} else if (qry_files === false) {
let qry_param =
{
type: "AND",
field: "file_count_all",
operator: "IS",
value: null
};
params_json['qry'].push(qry_param);
}
if (qry_start_datetime) {
let qry_param =
{
type: "AND",
field: "start_datetime",
operator: ">",
value: qry_start_datetime
};
params_json['qry'].push(qry_param);
}
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
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(function (archive_obj_li_get_result) {
if (archive_obj_li_get_result) {
if (try_cache) {
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);
}
return ae_promises.load__archive_obj_li;
}
// // Updated 2024-09-25
// export async function search__archive(
// {
// api_cfg,
// account_id,
// poc_agree = null,
// fulltext_search_qry_str,
// ft_content_search_qry_str,
// like_search_qry_str = null,
// file_count = false, // If true then only show those that have a file count
// person_name = null,
// params = {},
// try_cache = true,
// log_lvl = 0
// }: {
// api_cfg: any,
// account_id: any,
// poc_agree?: null|boolean,
// fulltext_search_qry_str?: null|string,
// ft_content_search_qry_str?: null|string,
// like_search_qry_str?: null|string,
// file_count?: boolean,
// person_name?: null|string,
// params?: any,
// try_cache?: boolean,
// log_lvl?: number
// }
// ) {
// console.log(`*** search__archive() *** account_id=${account_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 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 || ft_content_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_content_search_qry_str && ft_content_search_qry_str.length > 2) {
// params_json['ft_qry']['archive_content_li_qry_str'] = ft_content_search_qry_str;
// }
// }
// // Use the AND (AND LIKE) query
// // if (like_search_qry_str || like_content_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_content_search_qry_str && like_content_search_qry_str.length > 2) {
// // params_json['and_like']['archive_content_li_qry_str'] = like_content_search_qry_str;
// // }
// // }
// // Use the AND (OR LIKE) query
// if (like_search_qry_str || like_content_search_qry_str || like_content_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_content_search_qry_str && like_content_search_qry_str.length > 2) {
// params_json['or_like']['archive_content_li_qry_str'] = like_content_search_qry_str;
// }
// if (like_content_search_qry_str && like_content_search_qry_str.length > 2) {
// params_json['or_like']['archive_content_li_qry_str'] = like_content_search_qry_str;
// }
// }
// params_json['and_qry'] = {};
// if (poc_agree) {
// params_json['and_qry']['poc_agree'] = poc_agree;
// }
// if (file_count) {
// params_json['and_qry']['file_count'] = file_count;
// }
// // This should be using a like with surrounded by %'s
// if (person_name) {
// params_json['and_qry']['archive_full_name'] = person_name;
// }
// let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
// ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
// api_cfg: api_cfg,
// obj_type: 'archive',
// for_obj_type: 'account',
// for_obj_id: account_id,
// use_alt_table: true, // NOTE: We want to use the alt table for archive 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(function (archive_obj_li_get_result) {
// if (archive_obj_li_get_result) {
// if (try_cache) {
// db_save_ae_obj_li__archive({
// obj_type: 'archive',
// obj_li: archive_obj_li_get_result
// });
// }
// return archive_obj_li_get_result;
// } else {
// return [];
// }
// })
// .catch(function (error) {
// console.log('No results returned or failed.', error);
// })
// .finally(function () {
// });
// if (log_lvl) {
// console.log('ae_promises.load__archive_obj_li:', ae_promises.load__archive_obj_li);
// }
// return ae_promises.load__archive_obj_li;
// }
// This function will loop through the archive_obj_li and save each one to the DB.
// Updated 2024-09-25
export function db_save_ae_obj_li__archive(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__archive() ***`);
}
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_archives.archive.put({
id: obj.archive_id_random,
archive_id: obj.archive_id_random,
code: obj.code,
account_id: obj.account_id_random,
name: obj.name,
description: obj.description,
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,
sort_by: obj.sort_by,
sort_by_desc: obj.sort_by_desc,
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,
// From SQL view
// archive_content_count: obj.archive_content_count,
// A key value list of the contents
// archive_content_kv: obj.archive_content_kv,
// archive_content_li: obj.archive_content_li,
});
// console.log(`Put obj with ID: ${obj.archive_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.archive_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_archives.archive.put(obj);
// console.log(`Put obj with ID: ${obj.archive_id_random}`);
});
return true;
}
}
// Updated 2025-06-04
export const properties_to_save = [
'id',
'archive_id',
// 'archive_id_random',
'code',
'account_id',
// 'account_id_random',
'name',
'description',
'original_datetime',
'original_timezone',
'original_location',
'original_url',
'original_url_text',
'sort_by',
'sort_by_desc',
'cfg_json',
'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',
// From SQL view
// 'archive_content_count',
// A key value list of the contents
// 'archive_content_kv',
// 'archive_content_li',
];
// Updated 2025-06-04
export async function process_ae_obj__archive_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__archive_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj archive:`, obj);
let processed_obj = {
id: obj.archive_id_random,
archive_id: obj.archive_id_random,
// archive_id_random: obj.archive_id_random,
code: obj.code,
account_id: obj.account_id_random,
// account_id_random: obj.account_id_random,
name: obj.name,
description: obj.description,
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,
sort_by: obj.sort_by,
sort_by_desc: obj.sort_by_desc,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
// archive_content_count: obj.archive_content_count,
// A key value list of the contents
// archive_content_kv: obj.archive_content_kv,
// archive_content_li: obj.archive_content_li,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

View File

@@ -0,0 +1,648 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_archives } from "$lib/ae_archives/db_archives";
let ae_promises: key_val = {};
// TESTING NOTE: I changed these to all use async and await. Not sure if this helps or hurts things. Mainly this is related to the Dexie DB changes. 2024-11-08
// 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: any,
archive_content_id: string,
// enabled?: string,
// hidden?: string,
// 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}`);
}
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
let 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]
// });
}
return archive_content_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
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: any,
for_obj_type: string,
for_obj_id: string,
enabled?: string,
hidden?: string,
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}`);
}
let params_json: key_val = {};
// 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
let 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) {
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);
}
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: 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 (!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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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);
}
// 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
let 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;
}
}
// This function will loop through the archive_content_obj_li and save each one to the DB.
// Updated 2024-09-25
export async function db_save_ae_obj_li__archive_content(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__archive_content() ***`);
}
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_archives.content.put({
id: obj.archive_content_id_random,
archive_content_id: obj.archive_content_id_random,
archive_id: obj.archive_id_random,
archive_content_type: obj.archive_content_type,
name: obj.name,
description: obj.description,
content_html: obj.content_html,
content_json: obj.content_json,
url: obj.url,
url_text: obj.url_text,
hosted_file_id: obj.hosted_file_id_random,
file_path: obj.file_path,
filename: obj.filename,
file_extension: obj.file_extension,
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,
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,
// 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
archive_code: obj.archive_code,
archive_name: obj.archive_name,
hash_sha256: obj.hosted_file_hash_sha256
});
// console.log(`Put obj with ID: ${obj.archive_content_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.archive_content_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_archives.content.put(obj);
// console.log(`Put obj with ID: ${obj.archive_content_id_random}`);
});
return true;
}
}
// Updated 2025-06-04
export const properties_to_save = [
'id',
'archive_content_id',
// 'archive_content_id_random',
'archive_id',
// 'archive_id_random',
'archive_content_type',
'name',
'description',
'content_html',
'content_json',
'url',
'url_text',
'hosted_file_id',
'hosted_file_id_random',
'file_path',
'filename',
'file_extension',
'original_datetime',
'original_timezone',
'original_location',
'original_url',
'original_url_text',
'enable_for_public',
'cfg_json',
'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',
// From SQL view
'archive_code',
'archive_name',
'hash_sha256'
];
// Updated 2025-06-04
export async function process_ae_obj__archive_content_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__archive_content_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj archive_content:`, obj);
let processed_obj = {
id: obj.archive_content_id_random,
archive_content_id: obj.archive_content_id_random,
// archive_content_id_random: obj.archive_content_id_random,
archive_id: obj.archive_id_random,
// archive_id_random: obj.archive_id_random,
archive_content_type: obj.archive_content_type,
name: obj.name,
description: obj.description,
content_html: obj.content_html,
content_json: obj.content_json,
url: obj.url,
url_text: obj.url_text,
hosted_file_id: obj.hosted_file_id_random,
hosted_file_id_random: obj.hosted_file_id_random,
file_path: obj.file_path,
filename: obj.filename,
file_extension: obj.file_extension,
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,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}_${obj.original_datetime ?? ''}`,
tmp_sort_2: `${obj.group ?? ''}_${obj.original_datetime ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}`,
tmp_sort_3: `${obj.original_datetime ?? ''}_${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}`,
// tmp_sort_a: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
// tmp_sort_b: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
archive_code: obj.archive_code,
archive_name: obj.archive_name,
hash_sha256: obj.hosted_file_hash_sha256
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

View File

@@ -0,0 +1,40 @@
// 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,
// qry__archive,
db_save_ae_obj_li__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,
// qry__archive_content,
db_save_ae_obj_li__archive_content,
} from "$lib/ae_archives/ae_archives__archive_content";
let 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,
db_save_ae_obj_li__archive: db_save_ae_obj_li__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,
db_save_ae_obj_li__archive_content: db_save_ae_obj_li__archive_content,
};
export let archives_func = export_obj;

View File

@@ -0,0 +1,166 @@
import Dexie, { type Table } from 'dexie';
import type { key_val } from '../ae_stores';
// li = list
// kv = key value list
// Updated 2024-09-25
export interface Archive {
id: string;
// id_random: string;
archive_id: string;
// archive_id_random: string;
code?: null|string;
account_id: string;
// account_id_random: string;
// archive_type: 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;
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
sort_by?: null|string;
sort_by_desc?: 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;
// 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|[];
}
// Updated 2024-09-25
export interface Archive_Content {
id: string;
// id_random: string;
archive_content_id: string;
// archive_content_id_random: string;
archive_id: string;
// archive_id_random: string;
archive_content_type: string;
name: string;
description?: 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
url?: null|string;
url_text?: null|string;
hosted_file_id?: string;
file_path?: 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;
// meta_data?: null|string;
// access_key?: null|string; /// Rename this to "passcode" if used later
enable_for_public?: boolean;
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;
// 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;
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<Archive>;
content!: Table<Archive_Content>;
constructor() {
super('ae_archives_db');
this.version(1).stores({
archive: `
id, archive_id,
code,
account_id,
name,
original_datetime, original_timezone, original_location,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
content: `
id, archive_content_id,
archive_id,
archive_content_type,
name,
hosted_file_id,
original_datetime, original_timezone, original_location,
[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,
}
}
export const db_archives = new MySubClassedDexie();

View File

@@ -0,0 +1,377 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
// Imports
// Import components and elements
// import Element_input_files_tbl from '$lib/element_input_files_tbl.svelte';
// Import storage, functions, and libraries
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
// Exports
// export let input_name = 'file_list';
// export let multiple: boolean = true;
// export let required: boolean = true;
// export let input_class_li: string[] = ['file_drop_area'];
interface Props {
log_lvl?: number;
// Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc
link_to_type: string;
link_to_id: string;
// export let accept: string = 'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh';
class_li_default?: string;
class_li?: string;
// export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', 'table-hover' , 'text-sm'];
clip_complete?: boolean;
// export let upload_complete: boolean = false;
submit_status?: null|string;
// hosted_file_id_li?: string[];
// hosted_file_obj_li?: any[];
hosted_file_obj_kv?: key_val;
video_clip_file_kv?: key_val;
}
let {
log_lvl = $bindable(0),
link_to_type = $bindable(),
link_to_id = $bindable(),
class_li_default = 'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1',
class_li = $bindable(''),
clip_complete = $bindable(false),
submit_status = $bindable(null),
// hosted_file_id_li = [],
// hosted_file_obj_li = [],
hosted_file_obj_kv = $bindable({}),
video_clip_file_kv = $bindable({})
}: Props = $props();
// Local Variables
let task_id = link_to_id;
// let input_file_list: any = null;
let ae_promises: key_val = $state({});
// let ae_promises_clipping: key_val = {};
// let ae_triggers: key_val = {};
// let input_element_id = 'ae_comp__hosted_files_upload__input';
// let form_kv: key_val = {
// start_time: null,
// end_time: null,
// reencode: null,
// video_file: null,
// };
// let download_clip_src: string;
// let download_clip_filename: string;
$ae_sess.files.obj = {
obj: null,
};
// *** Functions and Logic
function handle_clip_video(event) {
console.log('*** handle_clip_video() ***');
submit_status = 'clipping';
clip_complete = false;
let hosted_file_id = event.target.hosted_file_id.value;
$ae_sess.files.processed_file_kv[hosted_file_id] = {};
$ae_sess.files.processed_file_kv[hosted_file_id].submit_status = 'clipping';
$ae_sess.files.processed_file_kv[hosted_file_id].clip_complete = false;
// $ae_sess.files.disable_submit__hosted_file_obj = true;
$ae_loc.files.processed_file_kv[hosted_file_id] = {};
$ae_loc.files.processed_file_kv[hosted_file_id].submit_status = 'clipping';
$ae_loc.files.processed_file_kv[hosted_file_id].start_time = event.target.start_time.value;
$ae_loc.files.processed_file_kv[hosted_file_id].end_time = event.target.end_time.value;
$ae_loc.files.processed_file_kv[hosted_file_id].reencode = event.target.reencode.value;
$ae_loc.files.processed_file_kv[hosted_file_id].scale_down = event.target.scale_down.value;
$ae_loc.files.processed_file_kv[hosted_file_id].new_filename = event.target.new_filename.value;
$ae_loc.files.processed_file_kv[hosted_file_id].clip_complete = false;
let endpoint = `/hosted_file/${hosted_file_id}/clip_video`;
let params = {
link_to_type: link_to_type,
link_to_id: link_to_id,
filename_no_ext: event.target.new_filename.value.replace('.mp4', ''),
from_type: 'mp4', // Video file type being converted
to_type: 'mp4', // Video file type to convert to
start_time: event.target.start_time.value,
end_time: event.target.end_time.value,
reencode: event.target.reencode.value,
scale_down: event.target.scale_down.value,
};
ae_promises[hosted_file_id] = {};
// .convert__hosted_file_obj
ae_promises[hosted_file_id] = api.get_object({
api_cfg: $ae_api,
endpoint: endpoint,
params: params,
timeout: 300000, // 5 minutes
// return_blob: true,
// filename: event.target.new_filename.value,
// auto_download: false,
task_id: task_id,
log_lvl: log_lvl
})
.then(function (result) {
console.log(result);
video_clip_file_kv[result.hosted_file_id_random] = {};
video_clip_file_kv[result.hosted_file_id_random] = result;
// $ae_loc.files.video_clip_file_kv[result.hosted_file_id_random] = {};
// $ae_loc.files.video_clip_file_kv[result.hosted_file_id_random] = result;
$ae_sess.files.processed_file_kv[hosted_file_id].submit_status = 'clipped';
$ae_sess.files.processed_file_kv[hosted_file_id].clip_complete = true;
$ae_loc.files.processed_file_kv[hosted_file_id].submit_status = 'clipped';
$ae_loc.files.processed_file_kv[hosted_file_id].clip_complete = true;
submit_status = 'clipped';
clip_complete = true;
// let file_blob = new Blob([result.data]);
// // console.log(file_blob);
// let file_obj_url = window.URL.createObjectURL(file_blob); // The img src
// // const url = window.URL.createObjectURL(new Blob([result.data]));
// download_clip_src = file_obj_url;
// // download_filename = file_obj_url;
return true;
});
}
</script>
<section
class="{class_li_default} {class_li}"
>
<!-- <h3 class="h3">{hosted_file_obj_li.length}&times; files uploaded</h3>
{#each hosted_file_obj_li as hosted_file_obj, i} -->
<h3
class="h3"
>
{Object.entries(hosted_file_obj_kv).length}× files uploaded
</h3>
{#each Object.entries(hosted_file_obj_kv) as [hosted_file_id, hosted_file_obj]}
<div class="border border-gray-300 rounded-lg p-2 m-2">
<!-- {#if $ae_sess.files[hosted_file_id].upload_complete}
<a href="/hosted_file/{hosted_file_id}/download?x_no_account_id_token=direct-download" download={$ae_sess.files[hosted_file_id].new_filename} class="ae_btn btn_lg btn_primary"><span class="fas fa-download"></span> Ready to Download</a>
{/if} -->
<div class="flex flex-row flex-wrap gap-1 justify-center items-center w-full">
<!-- Remove from uploaded file kv list -->
<button
type="button"
onclick={() => {
// This (uploaded_file_kv) is referenced by other AE components. Currently it is only used with the manage hosted file list and clip video components.
console.log(`Removed hosted file ID: ${hosted_file_id}`, $ae_loc.files.uploaded_file_kv);
// delete $ae_sess.files.uploaded_file_kv[hosted_file_id];
delete $ae_loc.files.uploaded_file_kv[hosted_file_id];
$ae_loc.files.uploaded_file_kv = {...$ae_loc.files.uploaded_file_kv};
delete hosted_file_obj_kv[hosted_file_id];
hosted_file_obj_kv = {...hosted_file_obj_kv};
// delete $ae_loc.files.uploaded_file_kv[hosted_file_obj.hosted_file_id];
console.log(`Removed hosted file ID: ${hosted_file_obj.hosted_file_id}`, $ae_loc.files.uploaded_file_kv);
}}
class="btn btn-sm preset-tonal-warning hover:preset-filled-warning-500"
title={`Remove this file from list of videos:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`}
>
<span class="fas fa-minus-circle m-1"></span>
<span class="">Remove</span>
</button>
<!-- Download the file -->
<button
type="button"
disabled={!$ae_loc.trusted_access}
onclick={() => {
ae_promises[hosted_file_id] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: hosted_file_id,
return_file: true,
filename: hosted_file_obj.filename,
auto_download: true,
log_lvl: 0
});
// window.postMessage({ type: 'download_event_file', hosted_file_id: idaa_archive_content_obj.hosted_file_id, filename: idaa_archive_content_obj.filename, auto_download: true }, '*');
}}
class:hidden={!$ae_loc.edit_mode}
class="novi_btn btn btn-sm lg:btn-md preset-tonal-primary hover:preset-filled-primary-500 min-w-72 lg:min-w-96"
title={`Download this file:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`}
>
{#await ae_promises[hosted_file_id]}
<span class="fas fa-spinner fa-spin mx-1"></span>
{#if submit_status == 'clipping'}
<span class="">Clipping</span>
{:else}
<span class="">
Downloading
{#if $ae_sess.api_download_kv[hosted_file_id]}
{$ae_sess.api_download_kv[hosted_file_id].percent_completed}%
{/if}
:
</span>
{/if}
{:then}
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.file_extension)}"></span>
{/await}
<span class="grow">
{ae_util.shorten_filename({filename: hosted_file_obj?.filename, max_length: 30})}
</span>
</button>
<span>{ae_util.shorten_filename({filename: hosted_file_obj?.filename, max_length: 30})}</span>
<span>
<span class="text-sm font-bold">
File ID:
</span>
{hosted_file_obj.hosted_file_id_random}</span>
<span>
<span class="text-sm font-bold">
Type:
</span>
{hosted_file_obj.extension}</span>
<!-- <span>{hosted_file_obj.filename}</span> -->
</div>
<form
onsubmit={preventDefault(handle_clip_video)}
class="{class_li_default} {class_li}"
>
<!-- {$ae_sess?.files[hosted_file_obj?.hosted_file_id_random ?? 'obj'].submit_status ?? 'not set'} -->
<input type="hidden" name="hosted_file_id" value="{hosted_file_obj.hosted_file_id_random}" />
<div class="flex flex-row gap-1 justify-center items-center w-full">
<span class="text-xs font-bold w-32">New Filename:</span>
<input type="text" class="input w-full text-sm" name="new_filename" value={hosted_file_obj.filename} />
</div>
<div class="max-w-(--breakpoint-sm) flex flex-row gap-1 justify-center items-center w-full">
<label class="label w-48"
title="The start time of the clip. This is the time in the video where the clip will start. You may need to subtract a few seconds to get the exact start time."
>
<span class="text-xs font-bold">Start time (HH:MM:SS)</span>
<input type="text" name="start_time"
value={($ae_loc.files.processed_file_kv && $ae_loc.files.processed_file_kv[hosted_file_id] && $ae_loc.files.processed_file_kv[hosted_file_id].start_time) ? $ae_loc.files.processed_file_kv[hosted_file_id].start_time : '00:00:00'}
placeholder="HH:MM:SS (00:01:30)" class="input w-32" />
</label>
<label class="label w-48"
title="The end time of the clip. This is the time in the video where the clip will end. You may need to add a few seconds to get the exact end time."
>
<span class="text-xs font-bold">End time (HH:MM:SS)</span>
<input type="text" name="end_time"
value={($ae_loc.files.processed_file_kv && $ae_loc.files.processed_file_kv[hosted_file_id] && $ae_loc.files.processed_file_kv[hosted_file_id].end_time) ? $ae_loc.files.processed_file_kv[hosted_file_id].end_time : '00:45:59'}
placeholder="HH:MM:SS (01:05:25)" class="input w-32" />
</label>
<span class="flex flex-col gap-1 items-center justify-center"
title="Re-encode the video file? This does cause some minor quality loss. Re-encoding is useful if the audio or video seems to be chopped off at the beginning or end of the clip. It can also help with partially corrupted files."
>
<span class="text-xs font-bold">
Re-encode?
</span>
<label class="inline-block">
<input type="radio" name="reencode" value="true" class="radio" checked />
True
</label>
<label class="inline-block">
<input type="radio" name="reencode" value="false" class="radio" />
False
</label>
</span>
<span class="flex flex-col gap-1 items-center justify-center"
title="Scale the video file down to 1920x1080? This does cause some minor quality loss. Re-encoding is useful if the audio or video seems to be chopped off at the beginning or end of the clip. It can also help with partially corrupted files."
>
<span class="text-xs font-bold">
Scale down?
</span>
<label class="inline-block">
<input type="radio" name="scale_down" value="true" class="radio" checked />
True
</label>
<label class="inline-block">
<input type="radio" name="scale_down" value="false" class="radio" />
False
</label>
</span>
</div>
<button
type="submit"
class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500"
disabled={submit_status == 'clipping'}
>
<!-- {#await ae_promises[hosted_file_id]} -->
{#if $ae_loc.files.processed_file_kv[hosted_file_id] && $ae_loc.files.processed_file_kv[hosted_file_id].submit_status == 'clipping'}
<span class="fas fa-spinner fa-spin m-1"></span>
<span class="highlight">Clipping...</span>
{:else}
<!-- {#if ae_promises[hosted_file_id]} -->
{#if $ae_loc.files.processed_file_kv[hosted_file_id] && $ae_loc.files.processed_file_kv[hosted_file_id].submit_status == 'clipped'}
<span class="fas fa-check m-1"></span>
Clipped
{:else}
<span class="fas fa-cut m-1"></span>
Clip Video
{/if}
{/if}
<!-- <span class="fas fa-cut m-1"></span>
Clip Video -->
</button>
</form>
{#await ae_promises[hosted_file_id]}
<span class="fas fa-spinner fa-spin m-1"></span>
<span class="highlight">Processing... This may take a few minutes.</span>
{:then}
{#if ae_promises[hosted_file_id]}
<span class="fas fa-download"></span> Ready to download below!
{:else}
<!-- <p>Fill out the form and select the video file to clip.</p> -->
{/if}
{/await}
</div>
{/each}
<!-- <hr />
{#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin m-1"></span>
<p class="highlight">Converting... This may take a few minutes.</p>
{:then}
{#if ae_promises.upload__hosted_file_obj}
<a href={download_clip_src} download={download_clip_filename} class="ae_btn btn_lg btn_primary"><span class="fas fa-download"></span> Ready to Download</a>
{:else}
<p>Fill out the form and select the video file to clip.</p>
{/if}
{/await} -->
</section>

View File

@@ -0,0 +1,88 @@
<script lang="ts">
// Imports
// Import components and elements
// Import storage, functions, and libraries
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
// Exports
// export let hosted_file_id_li: string[] = [];
// export let hosted_file_obj_li: any[] = [];
interface Props {
log_lvl?: number;
// export let hosted_file_obj_kv: key_val = {};
video_clip_file_kv?: key_val;
class_li_default?: string;
class_li?: string;
link_to_type: string;
link_to_id: string;
}
let {
log_lvl = 0,
video_clip_file_kv = $bindable({}),
class_li_default = 'flex flex-row flex-wrap gap-2 items-center justify-center w-full max-w-2xl p-2 mx-auto my-1 border border-gray-300 rounded-lg',
class_li = '',
link_to_type,
link_to_id
}: Props = $props();
let ae_promises: key_val = $state({});
</script>
<h3 class="h3">{Object.entries($ae_loc.files).length}× files clipped</h3>
<div class="{class_li_default} {class_li} ">
{#each Object.entries(video_clip_file_kv) as [hosted_file_id, hosted_file_obj]}
<button
type="button"
disabled={!$ae_loc.trusted_access}
onclick={() => {
ae_promises[hosted_file_id] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: hosted_file_id,
return_file: true,
filename: hosted_file_obj.filename,
auto_download: true,
log_lvl: log_lvl
});
// window.postMessage({ type: 'download_event_file', hosted_file_id: idaa_archive_content_obj.hosted_file_id, filename: idaa_archive_content_obj.filename, auto_download: true }, '*');
}}
class="novi_btn btn btn-sm lg:btn-md preset-tonal-primary hover:preset-filled-primary-500 min-w-72 lg:min-w-96"
title={`Download this file:\n${hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}... Hosted ID: ${hosted_file_obj.hosted_file_id_random}`}
>
{#await ae_promises[hosted_file_id]}
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="">
Downloading
{#if $ae_sess.api_download_kv[hosted_file_id]}
{$ae_sess.api_download_kv[hosted_file_id].percent_completed}%
{/if}
:
</span>
{:then}
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.file_extension)}"></span>
{/await}
<span class="grow">
{ae_util.shorten_filename({filename: hosted_file_obj?.filename, max_length: 30})}
</span>
<span class="shrink">
{ae_util.format_bytes(hosted_file_obj?.size)}
</span>
</button>
{/each}
</div>

View File

@@ -0,0 +1,382 @@
<script lang="ts">
export let log_lvl: number = 0;
// Imports
// Import components and elements
import Element_input_files_tbl from '$lib/element_input_files_tbl.svelte';
// Import storage, functions, and libraries
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
// Exports
// Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc
export let link_to_type: string;
export let link_to_id: string;
export let input_name = 'file_list';
export let multiple: boolean = true;
export let required: boolean = true;
export let accept: string = 'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh';
export let class_li_default: string = 'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1';
export let class_li: string = '';
export let input_class_li: string[] = ['file_drop_area'];
export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', '' , 'text-sm'];
export let upload_complete: boolean = false;
export let submit_status: null|string = null;
export let hosted_file_id_li: string[] = [];
export let hosted_file_obj_li: any[] = [];
// Local Variables
let task_id = link_to_id;
let input_file_list: any = null;
let ae_promises: key_val = {}; // Promise<any>;
let ae_triggers: key_val = {};
let input_element_id = 'ae_comp__hosted_files_upload__input';
let form_kv: key_val = {
start_time: null,
end_time: null,
reencode: null,
video_file: null,
};
let download_clip_src: string;
let download_clip_filename: string;
// *** Functions and Logic
async function handle_submit_form_files(event) {
console.log('*** handle_submit_form() ***');
$ae_sess.files.disable_submit__hosted_file_obj = true;
$ae_sess.files.submit_status = 'saving';
submit_status = 'saving';
upload_complete = false;
hosted_file_id_li = [];
hosted_file_obj_li = [];
let hosted_file_results;
form_kv = {
start_time: event.target.start_time.value,
end_time: event.target.end_time.value,
reencode: event.target.reencode.value,
video_file: event.target.file_list.files[0],
};
// const form_data = new FormData();
// form_data.append('start_time', event.target.start_time.value);
// form_data.append('end_time', event.target.end_time.value);
// if (event.target.reencode.value == '1' || event.target.reencode.value == 'true') {
// form_data.append('reencode', 'true');
// } else {
// form_data.append('reencode', 'false');
// }
// form_data.append('reencode', event.target.reencode.value);
// form_data.append(`video_file`, event.target.video_file.files[0]);
// let download_filename = `clipped_file_test.mp4`;
// let params = null;
// let endpoint = '/hosted_file/clip_video';
// console.log(form_data);
// params = null;
if (event.target[input_element_id].files.length > 0) {
task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead?
// Loop through each file and upload them individually in event.target[input_element_id].files
// The task_id should be the file hash.
// processed_file_list[i] has the file hash_sha256, hash_sha256_match, warnings, uploaded, uploaded_bytes, filename, and file_size_bytes.
for (let i = 0; i < event.target[input_element_id].files.length; i++) {
let tmp_file = event.target[input_element_id].files[i];
task_id = $ae_sess.files.processed_file_list[i].hash_sha256;
hosted_file_results = await handle_input_upload_files([tmp_file], form_kv, task_id);
if (hosted_file_results) {
console.log(`hosted_file_results:`, hosted_file_results);
} else {
console.log(`hosted_file_results:`, hosted_file_results);
}
}
// hosted_file_results = await handle_input_upload_files(event.target[input_element_id].files, task_id);
$ae_sess.files.processed_file_list = [];
$ae_sess = $ae_sess;
event.target.reset();
// await tick();
if (log_lvl) {
console.log(`hosted_file_id_li: ${hosted_file_id_li}`, hosted_file_id_li);
} else if (log_lvl > 1) {
console.log('hosted_file_results:', hosted_file_results);
}
}
$ae_sess.files.disable_submit__hosted_file_obj = false;
$ae_sess.files.submit_status = 'saved';
submit_status = 'saved';
upload_complete = true;
}
async function handle_input_upload_files(input_upload_files, form_kv, task_id) {
console.log('*** handle_input_upload_files() ***');
console.log(input_upload_files);
console.log(form_kv);
const form_data = new FormData();
// form_data.append('account_id', $ae_loc.account_id);
// form_data.append('link_to_type', link_to_type);
// form_data.append('link_to_id', link_to_id);
form_data.append('start_time', form_kv.start_time);
form_data.append('end_time', form_kv.end_time);
if (form_kv.reencode == '1' || form_kv.reencode == 'true') {
form_data.append('reencode', 'true');
} else {
form_data.append('reencode', 'false');
}
// There should really only be one file uploaded at a time for now.
for (let i = 0; i < input_upload_files.length; i++) {
form_data.append(`video_file`, input_upload_files[i]);
}
// hash_sha256, uploaded, uploaded_bytes
// $ae_sess.files.processed_file_list[i] = {
// ...$ae_sess.files.processed_file_list[i],
// uploaded: $ae_sess.api_upload_kv[link_to_id].percent_completed,
// uploaded_bytes: $ae_sess.api_upload_kv[link_to_id].uploaded_bytes,
// };
let params = null;
let endpoint = '/hosted_file/clip_video';
console.log(form_data);
params = null;
// Uncomment and the post_promise is not seen by the "await" below
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
// Uncomment so that the post_promise is not seen by the "await" below
ae_promises.upload__hosted_file_obj = api.post_object({
api_cfg: $ae_api,
endpoint: endpoint,
params: params,
form_data: form_data,
return_blob: true,
filename: 'clipped_video_test.mp4',
auto_download: false,
task_id: task_id,
log_lvl: log_lvl,
// retry_count: 1,
})
.then(async function (result) {
console.log(result);
let file_blob = new Blob([result.data]);
// console.log(file_blob);
let file_obj_url = window.URL.createObjectURL(file_blob); // The img src
// const url = window.URL.createObjectURL(new Blob([result.data]));
download_clip_src = file_obj_url;
// download_filename = file_obj_url;
return true;
// // WARNING!!!! ONLY ONE FILE IS EXPECTED TO BE UPLOADED AT A TIME!!!
// // NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item.
// let x = 0;
// console.log(result[x]);
// let hosted_file_obj = result[x];
// let hosted_file_id = hosted_file_obj.hosted_file_id_random;
// hosted_file_id_li.push(hosted_file_id);
// hosted_file_obj_li.push(hosted_file_obj);
// let hosted_file_data: key_val = {};
// hosted_file_data['hosted_file_id_random'] = hosted_file_id;
// hosted_file_data['for_type'] = link_to_type;
// hosted_file_data['for_id_random'] = link_to_id;
// hosted_file_data['filename'] = hosted_file_obj.filename;
// hosted_file_data['extension'] = hosted_file_obj.extension;
// hosted_file_data['enable'] = true;
// console.log(hosted_file_data);
// return hosted_file_data;
// $ae_sess.files.new_upload_list[i].uploaded_bytes = 10; // fake 10 bytes at least...
// let event_file_id = await events_func.create_hosted_file_obj_from_hosted_file_async({
// api_cfg: $ae_api,
// hosted_file_id: hosted_file_id,
// data: event_file_data,
// log_lvl: log_lvl
// })
// .then(function (create_result) {
// console.log(create_result); // NOTE: This should be the event_file_id string
// // let event_file_id = create_result;
// return create_result;
// });
// return event_file_id;
})
// .then(function (hosted_file_data) {
// return hosted_file_data;
// })
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
})
.finally( function () {
// $slct_trigger = 'load__hosted_file_obj_li';
});
console.log(ae_promises.upload__hosted_file_obj);
let hosted_file_result = ae_promises.upload__hosted_file_obj;
return hosted_file_result;
}
</script>
<div>
<!-- class:hidden={!$ae_loc.trusted_access} -->
<form
on:submit|preventDefault={handle_submit_form_files}
class="{class_li_default} {class_li}"
>
<label class="label">Start time (HH:MM:SS) <input type="text" name="start_time" value="00:00:00" placeholder="HH:MM:SS (00:01:30)" class="input w-32" /></label>
<label class="label">End time (HH:MM:SS) <input type="text" name="end_time" value="00:01:15" placeholder="HH:MM:SS (01:05:25)" class="input w-32" /></label>
<label class="label">Re-encode (true or false) <input type="text" name="reencode" value="false" placeholder="true" class="input w-32" /></label>
{#await ae_promises.upload__hosted_file_obj}
<div class="text-lg flex flex-row gap-1 items-center justify-center">
<span class="fas fa-spinner fa-spin m-1"></span>
<span class="">
Uploading
{#if $ae_sess.api_upload_kv[task_id]}
{$ae_sess.api_upload_kv[task_id].percent_completed}%
{/if}
</span>
</div>
{/await}
<label
for="ae_comp__hosted_files_upload__input"
class="svelte_input_file_label text-center"
class:hidden={$ae_sess.files.disable_submit__hosted_file_obj}
>
<slot name="label">
<div>
<span class="fas fa-upload"></span>
<!-- Select files to upload -->
<!-- <span class="fas fa-file-archive"></span> -->
<strong class="bg-blue-300 p-1">Upload files</strong>
<!-- (drag and drop) -->
</div>
<span class="text-sm text-gray-600 dark:text-gray-400 italic">
<strong>Video files only</strong><br>
(mp4 or mkv)
</span>
</slot>
</label>
<input
id={input_element_id}
type="file"
bind:files={input_file_list}
{multiple}
{required}
{accept}
name={input_name}
class="svelte_input_file_element file-dropzone-input block w-full text-lg text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-hidden dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 {input_class_li.join(' ')}"
class:hidden={$ae_sess.files.disable_submit__hosted_file_obj}
/>
<Element_input_files_tbl
bind:input_file_list={input_file_list}
bind:file_list_status={$ae_sess.files.status__file_list}
bind:processed_file_list={$ae_sess.files.processed_file_list}
table_class_li={table_class_li}
/>
<button
type="submit"
class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500 hover:preset-tonal-success border border-success-500 w-54"
disabled={$ae_sess.files.disable_submit__hosted_file_obj || $ae_sess.files.status__file_list != 'ready'}
>
{#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin m-1"></span>
<span class="">
Uploading
{#if $ae_sess.api_upload_kv[task_id]}
{$ae_sess.api_upload_kv[task_id].percent_completed}%
{/if}
</span>
{:then}
<span class="fas fa-upload m-1"></span>
<span class="text-sm">
Upload?
</span>
<!-- <span class="fas fa-save m-1"></span> -->
<span class="grow font-bold">
{#if $ae_sess.files.processed_file_list?.length > 0}
<!-- {#each $ae_sess.files.processed_file_list as file_obj, index}
<span class="text-xs">
{file_obj.filename}
</span>
{/each} -->
{$ae_sess.files.processed_file_list.length == 1 ? `${$ae_sess.files.processed_file_list.length} file` : `${$ae_sess.files.processed_file_list.length} files`}
{:else}
<span class="text-xs">
No files selected
</span>
{/if}
<!-- Files -->
</span>
{/await}
</button>
</form>
<hr />
{#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin m-1"></span>
<p class="highlight">Converting... This may take a few minutes.</p>
{:then}
{#if ae_promises.upload__hosted_file_obj}
<a href={download_clip_src} download={download_clip_filename} class="ae_btn btn_lg btn_primary"><span class="fas fa-download"></span> Ready to Download</a>
{:else}
<p>Fill out the form and select the video file to clip.</p>
{/if}
{/await}
</div>

View File

@@ -0,0 +1,152 @@
<script lang="ts">
// *** Import Svelte specific
// Eventually this should use Lucide icons instead of FontAwesome
// import {
// ArrowDown01, ArrowDown10, ArrowDownUp,
// BookHeart, BriefcaseBusiness,
// CalendarClock, CalendarOff, Clock, CodeXml, Copy,
// Eye, EyeOff,
// Flag, FlagOff, FileX, Fingerprint,
// Globe, Group,
// Hash, History,
// LockKeyhole, LockKeyholeOpen,
// MessageSquareWarning, Menu, Minus,
// NotebookPen, NotebookText, NotepadTextDashed,
// Pencil, PenLine, Plus,
// RemoveFormatting,
// Search, Settings,
// Shapes, Share2, ShieldCheck, ShieldMinus, Siren, Skull,
// SquareLibrary,
// Tags, Trash2, TypeOutline,
// X
// } from '@lucide/svelte';
// *** Import Aether specific variables and functions
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { api } from '$lib/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
interface Props {
log_lvl?: number;
hosted_file_id: null|string;
hosted_file_obj: null|key_val;
filename?: null|string;
max_length?: number;
auto_download?: boolean;
linked_to_type?: null|string;
linked_to_id?: null|string;
download_complete?: null|boolean;
download_percent?: number;
download_status_msg?: string;
classes?: string;
}
let {
log_lvl = 0,
hosted_file_id,
hosted_file_obj,
filename = $bindable(null),
max_length = $bindable(30),
auto_download = true,
linked_to_type = $bindable(null),
linked_to_id = $bindable(null),
download_complete = $bindable(),
download_percent = $bindable(),
download_status_msg = $bindable('Not started'),
classes = 'btn btn-sm lg:btn-md preset-tonal-tertiary border border-tertiary-500 hover:preset-filled-tertiary-500 min-w-48'
}: Props = $props();
if (log_lvl) {
console.log(`ae_comp__hosted_files_download_button.svelte hosted_file_id=${hosted_file_id}`, hosted_file_obj);
}
let ae_promises: key_val = $state({});
$effect(() => {
if ($ae_sess?.api_download_kv[hosted_file_obj?.hosted_file_id_random]?.percent_completed) {
download_percent = $ae_sess.api_download_kv[hosted_file_obj?.hosted_file_id_random].percent_completed;
}
});
</script>
{#if hosted_file_id && hosted_file_obj}
<button
type="button"
disabled={!$ae_loc.trusted_access}
class="{classes ?? 'btn'}"
onclick={() => {
download_complete = false;
download_status_msg = 'Downloading...';
ae_promises[hosted_file_obj.hosted_file_id_random] = api.download_hosted_file({
api_cfg: $ae_api,
hosted_file_id: hosted_file_obj.hosted_file_id_random,
return_file: true,
filename: filename ?? hosted_file_obj.filename,
auto_download: auto_download,
log_lvl: log_lvl
})
.then((result) => {
if (result === null) {
console.log('File not found (404)');
download_complete = null;
download_status_msg = 'File not found';
} else if (result === false) {
console.log('Possible error with API server (check network and server status)');
download_complete = false;
download_status_msg = 'Failed to download';
} else {
// console.log('File found and downloaded');
download_complete = true;
download_status_msg = 'File downloaded';
}
return result;
});
}}
title={`Download this file:\n${filename ?? hosted_file_obj?.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}...\nHosted ID: ${hosted_file_obj?.hosted_file_id_random}\n Linked to: ${linked_to_type} ID: ${linked_to_id}`}
>
{#await ae_promises[hosted_file_obj.hosted_file_id_random]}
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="">
Downloading
{#if $ae_sess.api_download_kv[hosted_file_obj.hosted_file_id_random]}
{$ae_sess.api_download_kv[hosted_file_obj.hosted_file_id_random].percent_completed}%
{/if}
:
</span>
{:then}
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.extension)}"></span>
{/await}
{#if download_complete === null}
<span class="text-red-800 dark:text-red-200">File not found</span>
{:else if download_complete === false}
<span class="text-red-800 dark:text-red-200">Failed to download!</span>
{/if}
<span class="grow">
{ae_util.shorten_filename({filename: filename ?? hosted_file_obj?.filename, max_length: max_length})}
</span>
</button>
{:else}
<button
type="button"
disabled
class="{classes ?? 'btn'}"
title="No file selected"
>
<span class="fas fa-{ae_util.file_extension_icon(hosted_file_obj?.extension)}"></span>
<span class="grow">
No file info
</span>
</button>
{/if}

View File

@@ -0,0 +1,330 @@
<script lang="ts">
export let log_lvl: number = 0;
// Imports
// Import components and elements
import Element_input_files_tbl from '$lib/element_input_files_tbl.svelte';
// Import storage, functions, and libraries
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
// Exports
// Expecting these for link_to_type: 'event', 'event_location', 'archive_content', etc
export let link_to_type: string;
export let link_to_id: string;
export let input_name = 'file_list';
export let multiple: boolean = true;
export let required: boolean = true;
export let accept: string = 'audio/*, image/*, video/*, .bak, .cfg, .css, .csv, .doc, .docx, .gz, .htm, .html, .ini, .iso, .j2, .json, .key, .keynote, .md, .pdf, .ppt, .pptx, .rar, .rtf, .sql, .svelte, ttf, .txt, .xls, .xlsx, .xz, .zip, .bin, .dmg, .exe, .js, .msi, .php, .py, .sh';
export let class_li_default: string = 'flex flex-col gap-1 items-center justify-center w-full max-w-2xl mx-auto my-1';
export let class_li: string = '';
export let input_class_li: string[] = ['file_drop_area'];
export let table_class_li: string[] = ['table', 'table-sm', 'table-striped', '' , 'text-sm'];
export let upload_complete: boolean = false;
export let submit_status: null|string = null;
export let hosted_file_id_li: string[] = [];
export let hosted_file_obj_li: any[] = [];
export let hosted_file_obj_kv: key_val = {};
// Local Variables
let task_id = link_to_id;
let input_file_list: any = null;
let ae_promises: key_val = {}; // Promise<any>;
let ae_triggers: key_val = {};
let input_element_id = 'ae_comp__hosted_files_upload__input';
// *** Functions and Logic
async function handle_submit_form_files(event: SubmitEvent) {
console.log('*** handle_submit_form() ***');
if (!event) {
return;
}
$ae_sess.files.disable_submit__hosted_file_obj = true;
$ae_sess.files.submit_status = 'saving';
submit_status = 'saving';
upload_complete = false;
hosted_file_id_li = [];
hosted_file_obj_li = [];
hosted_file_obj_kv = {};
let hosted_file_results;
const target = event.target as HTMLFormElement;
if (target && target[input_element_id] && (target[input_element_id] as HTMLInputElement)?.files && (target[input_element_id] as HTMLInputElement).files.length > 0) {
task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead?
// Loop through each file and upload them individually in event.target[input_element_id].files
// The task_id should be the file hash.
// processed_file_list[i] has the file hash_sha256, hash_sha256_match, warnings, uploaded, uploaded_bytes, filename, and file_size_bytes.
for (let i = 0; i < event.target[input_element_id].files.length; i++) {
let tmp_file = event.target[input_element_id].files[i];
task_id = $ae_sess.files.processed_file_list[i].hash_sha256;
// hosted_file_results = await handle_input_upload_files([tmp_file], task_id);
hosted_file_results = await handle_input_upload_files({
input_upload_files: [tmp_file],
task_id: task_id
});
if (hosted_file_results) {
console.log(`hosted_file_results:`, hosted_file_results);
} else {
console.log(`hosted_file_results:`, hosted_file_results);
}
}
// hosted_file_results = await handle_input_upload_files(event.target[input_element_id].files, task_id);
$ae_sess.files.processed_file_list = [];
$ae_sess = $ae_sess; // Is this needed? 2025-03-17
event.target.reset();
// await tick();
if (log_lvl) {
console.log(`hosted_file_id_li: ${hosted_file_id_li}`, hosted_file_id_li);
} else if (log_lvl > 1) {
console.log('hosted_file_results:', hosted_file_results);
}
}
$ae_sess.files.disable_submit__hosted_file_obj = false;
$ae_sess.files.submit_status = 'saved';
submit_status = 'saved';
upload_complete = true;
}
async function handle_input_upload_files(
{
input_upload_files,
task_id
} : {
input_upload_files: any[],
task_id: string
}
) {
console.log('*** handle_input_upload_files() ***');
const form_data = new FormData();
form_data.append('account_id', $ae_loc.account_id);
form_data.append('link_to_type', link_to_type);
form_data.append('link_to_id', link_to_id);
for (let i = 0; i < input_upload_files.length; i++) {
form_data.append(`file_list`, input_upload_files[i]);
}
// hash_sha256, uploaded, uploaded_bytes
// $ae_sess.files.processed_file_list[i] = {
// ...$ae_sess.files.processed_file_list[i],
// uploaded: $ae_sess.api_upload_kv[link_to_id].percent_completed,
// uploaded_bytes: $ae_sess.api_upload_kv[link_to_id].uploaded_bytes,
// };
let params = null;
let endpoint = '/hosted_file/upload_files';
console.log(form_data);
params = null;
// Uncomment and the post_promise is not seen by the "await" below
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
// Uncomment so that the post_promise is not seen by the "await" below
ae_promises.upload__hosted_file_obj = api.post_object({
api_cfg: $ae_api,
endpoint: endpoint,
// params: params,
form_data: form_data,
task_id: task_id,
log_lvl: log_lvl,
// retry_count: 1,
})
.then(async function (result) {
// WARNING!!!! ONLY ONE FILE IS EXPECTED TO BE UPLOADED AT A TIME!!!
// NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item.
let x = 0;
console.log(result[x]);
let hosted_file_obj = result[x];
let hosted_file_id = hosted_file_obj.hosted_file_id_random;
hosted_file_id_li.push(hosted_file_id);
hosted_file_obj_li.push(hosted_file_obj);
let hosted_file_data: key_val = {};
hosted_file_data['id'] = hosted_file_id;
hosted_file_data['hosted_file_id'] = hosted_file_id;
hosted_file_data['hosted_file_id_random'] = hosted_file_id;
hosted_file_data['for_type'] = link_to_type;
hosted_file_data['for_id'] = link_to_id;
hosted_file_data['for_id_random'] = link_to_id;
hosted_file_data['hash_sha256'] = hosted_file_obj.hash_sha256;
hosted_file_data['filename'] = hosted_file_obj.filename;
hosted_file_data['extension'] = hosted_file_obj.extension;
hosted_file_data['content_type'] = hosted_file_obj.content_type;
hosted_file_data['size'] = hosted_file_obj.size;
hosted_file_data['enable'] = true;
hosted_file_data['created_on'] = hosted_file_obj.created_on;
hosted_file_data['updated_on'] = hosted_file_obj.updated_on;
console.log(hosted_file_data);
hosted_file_obj_kv[hosted_file_id] = hosted_file_data;
return hosted_file_data;
// $ae_sess.files.new_upload_list[i].uploaded_bytes = 10; // fake 10 bytes at least...
// let event_file_id = await events_func.create_hosted_file_obj_from_hosted_file_async({
// api_cfg: $ae_api,
// hosted_file_id: hosted_file_id,
// data: event_file_data,
// log_lvl: log_lvl
// })
// .then(function (create_result) {
// console.log(create_result); // NOTE: This should be the event_file_id string
// // let event_file_id = create_result;
// return create_result;
// });
// return event_file_id;
})
.then(function (hosted_file_data) {
return hosted_file_data;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
})
.finally( function () {
$slct_trigger = 'load__hosted_file_obj_li';
});
console.log(ae_promises.upload__hosted_file_obj);
let hosted_file_result = ae_promises.upload__hosted_file_obj;
return hosted_file_result;
}
</script>
<!-- class:hidden={!$ae_loc.trusted_access} -->
<form
on:submit|preventDefault={handle_submit_form_files}
class="{class_li_default} {class_li}"
>
{#await ae_promises.upload__hosted_file_obj}
<div class="text-lg flex flex-row gap-1 items-center justify-center">
<span class="fas fa-spinner fa-spin m-1"></span>
<span class="">
Uploading
{#if $ae_sess.api_upload_kv[task_id]}
{$ae_sess.api_upload_kv[task_id].percent_completed}%
{/if}
</span>
</div>
{/await}
<label
for="ae_comp__hosted_files_upload__input"
class="svelte_input_file_label text-center"
class:hidden={$ae_sess.files.disable_submit__hosted_file_obj}
>
<slot name="label">
<div>
<span class="fas fa-upload"></span>
<!-- Select files to upload -->
<!-- <span class="fas fa-file-archive"></span> -->
<strong class="bg-blue-300 p-1">Upload files</strong>
<!-- (drag and drop) -->
</div>
<span class="text-sm text-gray-600 dark:text-gray-400 italic">
<strong>Presentation related files only</strong><br>
(PowerPoint, Keynote, PDF, mp4, Word Doc, Excel, txt, etc)
</span>
</slot>
</label>
<input
id={input_element_id}
type="file"
bind:files={input_file_list}
{multiple}
{required}
{accept}
name={input_name}
class="
svelte_input_file_element
file-dropzone-input
px-1
block w-full text-lg
text-gray-900
border border-gray-300 rounded-lg
cursor-pointer b
g-gray-50 dark:text-gray-400 focus:outline-hidden dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400
{input_class_li.join(' ')}
"
class:hidden={$ae_sess.files.disable_submit__hosted_file_obj}
/>
<Element_input_files_tbl
bind:input_file_list={input_file_list}
bind:file_list_status={$ae_sess.files.status__file_list}
bind:processed_file_list={$ae_sess.files.processed_file_list}
table_class_li={table_class_li}
/>
<button
type="submit"
class="btn btn-lg btn-primary preset-tonal-primary border border-primary-500 hover:preset-tonal-success border border-success-500 w-54"
disabled={$ae_sess.files.disable_submit__hosted_file_obj || $ae_sess.files.status__file_list != 'ready'}
>
{#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin m-1"></span>
<span class="">
Uploading
{#if $ae_sess.api_upload_kv[task_id]}
{$ae_sess.api_upload_kv[task_id].percent_completed}%
{/if}
</span>
{:then}
<span class="fas fa-upload m-1"></span>
<span class="text-sm">
Upload?
</span>
<!-- <span class="fas fa-save m-1"></span> -->
<span class="grow font-bold">
{#if $ae_sess.files.processed_file_list?.length > 0}
<!-- {#each $ae_sess.files.processed_file_list as file_obj, index}
<span class="text-xs">
{file_obj.filename}
</span>
{/each} -->
{$ae_sess.files.processed_file_list.length == 1 ? `${$ae_sess.files.processed_file_list.length} file` : `${$ae_sess.files.processed_file_list.length} files`}
{:else}
<span class="text-xs">
No files selected
</span>
{/if}
<!-- Files -->
</span>
{/await}
</button>
</form>

View File

@@ -0,0 +1,704 @@
import { browser } from '$app/environment';
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/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
} 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
} 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
} from "$lib/ae_core/core__user";
import {
generate_qr_code,
js_generate_qr_code,
} from "$lib/ae_core/core__qr_code";
import {
check_hosted_file_obj_w_hash
} from "$lib/ae_core/core__check_hosted_file_obj_w_hash";
import {
load_ae_obj_li__time_zone
} from "$lib/ae_core/core__time_zones";
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
} from "$lib/ae_core/core__hosted_files";
// This has more generic general purpose functions that can eventually replace the custom ones per object type.
import {
db_save_ae_obj_li__ae_obj,
} from "$lib/ae_core/core__idb_dexie";
import {
add_url_params,
clean_headers,
} from "$lib/ae_core/core__api_helpers";
let ae_promises: key_val = {}; // Promise<any>;
// Updated 2024-03-29
async function handle_load_ae_obj_id__site_domain(
{
api_cfg,
fqdn,
try_cache = false,
timeout = 7000,
log_lvl = 0
}: {
api_cfg: any,
fqdn: string,
try_cache?: boolean,
timeout?: number,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** handle_load_ae_obj_id__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}`);
}
let no_account_id = false;
if (!api_cfg.account_id) {
no_account_id = true;
// api_cfg.headers['x_account_id'] = 'nothing here';
}
no_account_id = true;
let 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_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) {
console.log('No results returned or failed.', error);
});
return ae_promises.load__site_domain_obj;
}
// Updated 2024-03-29
async function handle_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: 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(`*** handle_get_data_store_obj_w_code() *** code=${code}`);
}
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;
}
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;
}
// let ae_ds_tmp: key_val = {};
let 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;
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 (save_idb) {
if (browser) {
let 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) {
console.log('*ae_func* No results returned or failed.', error);
});
return ae_promises.load__data_store_obj;
}
// Updated 2024-03-27
async function handle_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: 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;
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) {
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;
}
// Core - Already imported above
// import { load_ae_obj_id__person } from "$lib/ae_core/core__person";
// import { load_ae_obj_id__user } from "$lib/ae_core/core__user";
// Additional Modules
import { load_ae_obj_id__archive } from "$lib/ae_archives/ae_archives__archive";
import { load_ae_obj_id__archive_content } from "$lib/ae_archives/ae_archives__archive_content";
import { load_ae_obj_id__event } from "$lib/ae_events/ae_events__event";
// import { load_ae_obj_id__event_badge } from "$lib/ae_events/ae_events__event_badge";
import { load_ae_obj_id__event_device } from "$lib/ae_events/ae_events__event_device";
// import { load_ae_obj_id__event_exhibit } from "$lib/ae_events/ae_events__event_exhibit";
import { load_ae_obj_id__event_file } from "$lib/ae_events/ae_events__event_file";
import { load_ae_obj_id__event_location } from "$lib/ae_events/ae_events__event_location";
import { load_ae_obj_id__event_presentation } from "$lib/ae_events/ae_events__event_presentation";
import { load_ae_obj_id__event_presenter } from "$lib/ae_events/ae_events__event_presenter";
import { load_ae_obj_id__event_session } from "$lib/ae_events/ae_events__event_session";
import { load_ae_obj_id__journal } from "$lib/ae_journals/ae_journals__journal";
import { load_ae_obj_id__journal_entry } from "$lib/ae_journals/ae_journals__journal_entry";
import { load_ae_obj_id__post } from "$lib/ae_posts/ae_posts__post";
import { load_ae_obj_id__post_comment } from "$lib/ae_posts/ae_posts__post_comment";
// 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: 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;
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 (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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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') {
let 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) {
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;
}
async function handle_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: 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: handle_download_export__obj_type() ***');
let 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;
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;
}
// let clean_filename = filename.replace(/[^a-z0-9]/gi, '_');
// let clean_filename = filename.replace(/[^a-z0-9\[\]-]/gi, '_');
let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_');
// let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-\._ ]/gi, '_');
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
});
console.log('ae_promises.download__export_file:', ae_promises.download__export_file);
return ae_promises.download__export_file;
}
let export_obj = {
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__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,
db_save_ae_obj_li__ae_obj: db_save_ae_obj_li__ae_obj,
add_url_params: add_url_params,
clean_headers: clean_headers,
handle_load_ae_obj_id__site_domain: handle_load_ae_obj_id__site_domain,
handle_load_ae_obj_code__data_store: handle_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__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,
handle_update_ae_obj_id_crud: handle_update_ae_obj_id_crud,
update_ae_obj_id_crud_v2: update_ae_obj_id_crud_v2,
handle_download_export__obj_type: handle_download_export__obj_type,
generate_qr_code: generate_qr_code,
js_generate_qr_code: js_generate_qr_code,
};
export let core_func = export_obj;

View File

@@ -0,0 +1,361 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
let 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: 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}`);
let 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) {
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);
}
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: 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}`);
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 params_json: key_val = {};
// 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) {
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);
}
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: 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}`);
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) {
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;
}
// 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: 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) {
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;
}
// 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: any,
activity_log_id: any,
qry_str?: string,
qry_files?: null|boolean,
qry_start_datetime?: null|string, // Greater than this datetime
enabled?: string, // all, disabled, enabled
hidden?: string, // 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}`);
// 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 params_json: key_val = {};
// if (qry_str && qry_str.length > 2) {
// params_json['ft_qry'] = {};
// params_json['ft_qry']['default_qry_str'] = qry_str;
// }
params_json['qry'] = [];
if (qry_files === true) {
let qry_param =
{
type: "AND",
field: "file_count_all",
operator: ">",
value: 0
};
params_json['qry'].push(qry_param);
} else if (qry_files === false) {
let qry_param =
{
type: "AND",
field: "file_count_all",
operator: "IS",
value: null
};
params_json['qry'].push(qry_param);
}
if (qry_start_datetime) {
let qry_param =
{
type: "AND",
field: "start_datetime",
operator: ">",
value: qry_start_datetime
};
params_json['qry'].push(qry_param);
}
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
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;
}

View File

@@ -0,0 +1,69 @@
import type { key_val } from '$lib/ae_stores';
// Updated 2025-01-28
export function add_url_params(
{
base_url = '',
endpoint,
params,
log_lvl = 0
}: {
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);
}
const url_obj = new URL(endpoint, base_url);
Object.keys(params).forEach(key => url_obj.searchParams.append(key, params[key]));
if (log_lvl) {
console.log('New URL:', url_obj.toString());
}
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);
}
let headers_cleaned: key_val = {};
for (const prop in headers) {
let 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];
// }
// });
return headers_cleaned;
}

View File

@@ -0,0 +1,37 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/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: 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() ***');
const endpoint = `/hosted_file/hash/${hosted_file_hash}`;
if (check_for_local) {
params['check_for_local'] = true;
}
let 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;
}

View File

@@ -0,0 +1,73 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_core } from "$lib/ae_core/db_core";
let 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: any,
// account_id: string,
enabled?: string,
hidden?: string,
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() ***`);
}
let params_json: key_val = {};
// 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) {
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;
}

View File

@@ -0,0 +1,73 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_core } from "$lib/ae_core/db_core";
let 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: any,
// account_id: string,
enabled?: string,
hidden?: string,
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() ***`);
}
let params_json: key_val = {};
// 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) {
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;
}

View File

@@ -0,0 +1,443 @@
import { marked } from 'marked';
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
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;
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 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
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<any> {
const { api_cfg, obj_type, obj_id, db_instance, db_field_li, inc_obj_type_li, try_cache = true, log_lvl = 0 } = args;
if (log_lvl) {
console.log(`*** load_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`);
}
let result = await api.get_ae_obj_id_crud({
api_cfg,
obj_type,
obj_id,
params: {},
log_lvl
});
let idb_db_instance = null; // You must inject the correct DB instance per module
let idb_tbl_name = obj_type;
let properties_to_save: string[] = [];
if (obj_type === 'journal') {
idb_db_instance = 'ae_journals_db';
// idb_tbl_name = 'journal';
result.id = result.journal_id_random; // Ensure we use the correct ID field
result.journal_id = result.journal_id_random;
result.account_id = result.account_id_random;
result.person_id = result.person_id_random;
// WARNING: This works to populate most of the IDB table fields but it is not ideal. It is sort of a safety net.
properties_to_save = Object.keys(db_instance.table('journal').schema.idxByName);
}
if (obj_type === 'journal_entry') {
idb_db_instance = 'ae_journals_db';
// idb_tbl_name = 'entry';
result.id = result.journal_entry_id_random; // Ensure we use the correct ID field
result.journal_entry_id = result.journal_entry_id_random; // Ensure we use the correct ID field
result.journal_id = result.journal_id_random;
// WARNING: This works to populate most of the IDB table fields but it is not ideal. It is sort of a safety net.
properties_to_save = Object.keys(db_instance.table('journal_entry').schema.idxByName);
}
properties_to_save = [
...db_field_li
];
// if (log_lvl) {
// console.log('IDB DB Instance:', db_instance);
// console.log(db_instance.journal_entry.core.schema);
// console.log(db_instance.table('journal_entry'));
// console.log(db_instance.table('journal_entry').schema.idxByName);
// // Show only the keys of the indexes
// console.log(Object.keys(db_instance.table('journal_entry').schema.idxByName));
// }
if (try_cache && result) {
// Process and save to DB
const processed = await process_ae_obj__props({ obj_li: [result], log_lvl });
await db_save_ae_obj_li__ae_obj({
db_instance: db_instance, // You must inject the correct DB instance per module
table_name: idb_tbl_name,
obj_li: processed,
properties_to_save: properties_to_save,
log_lvl
});
}
if (inc_obj_type_li) {
// Load related objects if specified
for (const inc_obj_type of inc_obj_type_li) {
if (log_lvl) {
console.log(`Loading related objects of type: ${inc_obj_type}`);
}
const related_objects = await load_ae_obj_li({
api_cfg,
obj_type: inc_obj_type,
for_obj_type: obj_type,
for_obj_id: obj_id,
enabled: 'enabled',
hidden: 'not_hidden',
limit: 99,
try_cache,
log_lvl
});
result[`${inc_obj_type}_li`] = related_objects;
}
}
return result;
}
// Generic function: Load list of objects
export async function load_ae_obj_li(
args: GenericCrudArgs
): Promise<any> {
const {
api_cfg,
obj_type,
for_obj_type = '',
for_obj_id,
db_instance,
db_field_li,
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}`);
}
let params_json: key_val = {};
let 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
});
// Loop through results a
let idb_db_instance = null; // You must inject the correct DB instance per module
let idb_tbl_name = obj_type;
let properties_to_save: string[] = [];
if (obj_type === 'journal') {
idb_db_instance = 'ae_journals_db';
// idb_tbl_name = 'journal';
result.id = result.journal_id_random; // Ensure we use the correct ID field
result.journal_id = result.journal_id_random;
result.account_id = result.account_id_random;
result.person_id = result.person_id_random;
// WARNING: This works to populate most of the IDB table fields but it is not ideal. It is sort of a safety net.
properties_to_save = Object.keys(db_instance.table('journal').schema.idxByName);
}
if (obj_type === 'journal_entry') {
idb_db_instance = 'ae_journals_db';
// idb_tbl_name = 'entry';
result.id = result.journal_entry_id_random; // Ensure we use the correct ID field
result.journal_entry_id = result.journal_entry_id_random; // Ensure we use the correct ID field
result.journal_id = result.journal_id_random;
// WARNING: This works to populate most of the IDB table fields but it is not ideal. It is sort of a safety net.
properties_to_save = Object.keys(db_instance.table('journal_entry').schema.idxByName);
}
if (try_cache && result) {
// Process and save to DB
const processed = await process_ae_obj__props({ obj_li: result, log_lvl });
await db_save_ae_obj_li__ae_obj({
db_instance: db_instance,
table_name: idb_tbl_name,
obj_li: processed,
properties_to_save: [],
log_lvl
});
}
return result;
}
// Generic function: Create object
export async function create_ae_obj(
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, data_kv, try_cache = true, log_lvl = 0 } = args;
if (log_lvl) {
console.log(`*** create_ae_obj() *** obj_type=${obj_type}`, data_kv);
}
let 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
});
if (try_cache && result) {
const processed = await process_ae_obj__props({ obj_li: [result], log_lvl });
await db_save_ae_obj_li__ae_obj({
db_instance: null,
table_name: obj_type,
obj_li: processed,
properties_to_save: [],
log_lvl
});
}
return result;
}
// Generic function: Update object
export async function update_ae_obj(
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, obj_id, data_kv, try_cache = true, log_lvl = 0 } = args;
if (log_lvl) {
console.log(`*** update_ae_obj() *** obj_type=${obj_type} obj_id=${obj_id}`, data_kv);
}
let 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
});
if (try_cache && result) {
const processed = await process_ae_obj__props({ obj_li: [result], log_lvl });
await db_save_ae_obj_li__ae_obj({
db_instance: null,
table_name: obj_type,
obj_li: processed,
properties_to_save: [],
log_lvl
});
}
return result;
}
// Generic function: Delete object
export async function delete_ae_obj_id(
args: GenericCrudArgs
): Promise<any> {
const { api_cfg, obj_type, obj_id, method = 'delete', try_cache = true, log_lvl = 0 } = args;
if (log_lvl) {
console.log(`*** delete_ae_obj_id() *** obj_type=${obj_type} obj_id=${obj_id}`);
}
let 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
});
if (try_cache) {
// Remove from DB regardless of success/failure
try {
// db_<module>.<obj_type>.delete(obj_id); // You must inject the correct DB here
} catch (err) {
console.error(`Failed to delete ${obj_id}:`, err);
}
}
return result;
}
// Generic processor with dynamic field detection
export async function process_ae_obj__props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
return [];
}
const processed = obj_li.map(obj => {
// Extract fields with fallbacks and detect existence
const group = obj.group || '';
const priority = obj.priority !== undefined ? obj.priority : 0;
const sort = obj.sort !== undefined ? obj.sort : 0;
const created_on = obj.created_on || '';
const updated_on = obj.updated_on || '';
const name = obj.name || '';
// const description = obj.description || '';
// // Handle special case with description that has markdown
// // Remove the most common zerowidth characters from the start of the file
// const description_cleaned: string = obj.description.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
// const description_md_html: null|string = marked.parse(description_cleaned ?? '') ?? null;
// // Add processed description
// obj.description_md_html = description_md_html;
// Handle special case with content that has markdown
// Remove the most common zerowidth characters from the start of the file
const has_content = obj.content !== undefined && obj.content !== null;
if (has_content) {
const content_cleaned: string = obj.content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
const content_md_html: null|string = marked.parse(content_cleaned ?? '') ?? null;
// Add processed content
obj.content_md_html = content_md_html;
}
// Check which fields actually exist for this object
const has_group = obj.group !== undefined && obj.group !== null;
const has_priority = obj.priority !== undefined && obj.priority !== null;
const has_sort = obj.sort !== undefined && obj.sort !== null;
const has_created = obj.created_on !== undefined && obj.created_on !== null;
const has_updated = obj.updated_on !== undefined && obj.updated_on !== null;
const has_name = obj.name !== undefined && obj.name !== null;
// Generate standardized tmp_sort fields with proper zero-padding
const sort_str = sort?.toString().padStart(3, '0') ?? '000';
// Build dynamic sorting combinations based on what exists
let tmp_sort_1 = '';
let tmp_sort_2 = '';
let tmp_sort_3 = '';
// Build based on existing fields
if (has_group && has_priority && has_sort) {
tmp_sort_1 = `${group}_${priority}_${sort_str}`;
tmp_sort_2 = `${group}_${priority}_${sort_str}_${name || ''}`;
tmp_sort_3 = `${priority}_${sort_str}_${group}`;
} else if (has_priority && has_sort) {
tmp_sort_1 = `${priority}_${sort_str}`;
tmp_sort_2 = `${priority}_${sort_str}_${name || ''}`;
tmp_sort_3 = `${priority}_${sort_str}`;
} else if (has_sort) {
tmp_sort_1 = `${sort_str}`;
tmp_sort_2 = `${sort_str}_${name || ''}`;
tmp_sort_3 = `${sort_str}`;
} else {
// Fallback for minimal data
tmp_sort_1 = `${created_on || ''}`;
tmp_sort_2 = `${created_on || ''}_${name || ''}`;
tmp_sort_3 = `${updated_on || ''}`;
}
// Add time-based sorting for better ordering
if (has_created && has_updated) {
tmp_sort_1 += `_${created_on}_${updated_on}`;
tmp_sort_2 += `_${created_on}_${updated_on}`;
tmp_sort_3 += `_${updated_on}`;
} else if (has_created) {
tmp_sort_1 += `_${created_on}`;
tmp_sort_2 += `_${created_on}`;
tmp_sort_3 += `_${created_on}`;
}
// Return processed object with standardized fields
return {
...obj,
tmp_sort_1,
tmp_sort_2,
tmp_sort_3
};
});
if (log_lvl) {
console.log(`Processed objects:`, processed);
}
return processed;
}

View File

@@ -0,0 +1,357 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_core } from "$lib/ae_core/db_core";
let 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: 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}`);
}
let 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) {
console.log('No results returned or failed.', error);
});
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: any,
for_obj_type: string,
for_obj_id: string,
enabled?: string,
hidden?: string,
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}`);
}
// Check if for_obj_type is in the list of valid Aether object types:
let valid_for_obj_types = ['account', 'archive', 'archive_content', 'event', 'event_session', 'event_presentation', 'event_presenter', 'event_location', 'journal', 'journal_entry', 'post', 'post_comment'];
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 params_json: key_val = {};
// 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) {
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;
}
// 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: 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}`);
}
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);
}
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) {
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);
}
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: string,
obj_li: any,
log_lvl?: number
}
) {
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);
}
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
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,
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,
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) {
let 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}`);
});
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: string,
obj_id: string,
data_kv: key_val,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_update_ae_obj_id__hosted_file() ***`);
}
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,
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,
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) {
let 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;
}

View File

@@ -0,0 +1,91 @@
// This function will save an array of objects to a Dexie database table.
// It will first attempt to update existing records using bulkUpdate.
// If that fails, it will fall back to bulkPut.
// The function takes a database instance, table name, array of objects, and properties to save.
// It also accepts a log level for debugging purposes.
// Updated 2025-05-09
export async function db_save_ae_obj_li__ae_obj({
db_instance,
table_name,
obj_li,
properties_to_save,
log_lvl = 0,
}: {
db_instance: any; // The Dexie database instance
table_name: string; // The name of the table in the database
obj_li: any[];
properties_to_save: string[];
log_lvl?: number;
}) {
// log_lvl = 1;
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__ae_obj() *** table_name=${table_name}`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) {
console.log('No objects to save.');
}
return [];
}
const db_table = db_instance[table_name];
if (!db_table) {
console.error(`Table not found in ${db_instance}: ${table_name}`);
return [];
}
const bulkUpdateData = [];
const bulkPutData = [];
for (const obj of obj_li) {
const obj_record: Record<string, any> = {};
// Extract only the specified properties to save
for (const prop of properties_to_save) {
obj_record[prop] = obj[prop];
}
// Ensure the `id` field is included
obj_record.id = obj_record.id || obj.id || obj[`${table_name}_id`] || obj[`${table_name}_id_random`];
if (!obj_record.id) {
console.error(`Object is missing an ID:`, obj);
continue;
}
// Prepare data for bulkUpdate or bulkPut
bulkUpdateData.push({
key: obj_record.id,
changes: obj_record,
});
bulkPutData.push(obj_record);
}
// Attempt bulkUpdate first
try {
const updatedKeys = await db_table.bulkUpdate(bulkUpdateData);
if (log_lvl) {
console.log(`Bulk update completed. Updated keys:`, updatedKeys);
}
} catch (error) {
// This is fairly common and normal if the object is new
if (log_lvl) {
console.log(`Bulk update failed. Falling back to bulkPut. This is normal.`, error);
}
}
// Use bulkPut for any records that couldn't be updated
try {
const putKeys = await db_table.bulkPut(bulkPutData);
if (log_lvl) {
console.log(`Bulk put completed. Put keys:`, putKeys);
}
return putKeys;
} catch (error) {
// This should not happen if the object is new
console.error(`Bulk put failed. Something likely went wrong!`, error);
return [];
}
}

View File

@@ -0,0 +1,794 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_core } from "$lib/ae_core/db_core";
let 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: 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}`);
}
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
let 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) {
console.log('No results returned or failed.', error);
});
if (log_lvl) {
console.log('ae_promises.load__person_obj:', 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: any,
for_obj_type: string,
for_obj_id: string,
qry_email?: string|null,
qry_user_id?: string|null,
enabled?: string, // all, disabled, enabled
hidden?: string, // all, hidden, not_hidden
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__person() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id} enabled=${enabled} hidden=${hidden} limit=${limit} offset=${offset}`);
}
let params_json: key_val = {};
// 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'] = []
let 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);
}
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
let 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) {
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;
}
// 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: 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}`);
}
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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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);
}
// 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
});
// Handle the result
if (result) {
if (try_cache) {
// Process the results first
let 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;
}
}
// Updated 2024-06-10
export function db_save_ae_obj_li__person(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
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);
}
let 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,
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...
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,
professional_title: obj.professional_title,
full_name: obj.full_name,
full_name_override: obj.full_name_override, // was display_name and display_name_override
affiliations: obj.affiliations,
primary_email: obj.primary_email,
biography: obj.biography,
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,
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,
// 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;
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;
}
}
// Updated 2025-06-10
let properties_to_save = [
'id',
'person_id',
'person_id_random',
'external_id',
'external_sys_id',
'code',
'account_id',
'account_id_random',
'person_profile_id',
'person_profile_id_random', // The new table person_profile will be used soon...
'user_id',
'user_id_random',
'pronouns',
'informal_name',
'title_names',
'given_name',
'middle_name',
'family_name',
'designations',
'professional_title',
'full_name',
'full_name_override', // was display_name and display_name_override
'affiliations',
'primary_email',
'biography',
'agree',
'comments',
'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',
// 'alert',
// 'alert_msg',
'data_json',
'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',
// 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',
'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
];
// Updated 2025-06-10
export async function process_ae_obj__person_props(
{
// obj_type,
obj_li,
log_lvl = 0,
}: {
// obj_type: string;
obj_li: any[];
log_lvl?: number;
}
) {
if (log_lvl) {
console.log(`*** process_ae_obj__person_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) {
console.log('No objects to process.');
}
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
// const processed_obj = { ...obj };
// Process the properties as needed
// None needed to process for person at this time...
let processed_obj = {
id: 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,
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...
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,
professional_title: obj.professional_title,
full_name: obj.full_name,
full_name_override: obj.full_name_override, // was display_name and display_name_override
affiliations: obj.affiliations,
primary_email: obj.primary_email,
biography: obj.biography,
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,
// passcode_timeout: obj.passcode_timeout,
// 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,
// private_passcode: obj.private_passcode,
// alert: obj.alert,
// alert_msg: obj.alert_msg,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${obj.updated_on}_${obj.created_on}`,
tmp_sort_2: `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_3: `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${obj.name}_${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}`,
// From SQL view
username: obj.username, // Same as user_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,
organization_id: obj.organization_id_random,
organization_id_random: obj.organization_id_random,
organization_name: obj.organization_name,
contact_id: obj.contact_id_random,
contact_id_random: obj.contact_id_random,
contact_name: obj.contact_name,
contact_email: obj.contact_email,
contact_cc_email: obj.contact_cc_email,
contact_phone_mobile: obj.contact_phone_mobile,
contact_phone_home: obj.contact_phone_home,
contact_phone_office: obj.contact_phone_office,
contact_phone_land: obj.contact_phone_land,
contact_phone_fax: obj.contact_phone_fax,
contact_phone_other: obj.contact_phone_other,
address_id: obj.contact_address_id_random,
address_id_random: obj.contact_address_id_random,
address_city: obj.contact_address_city,
address_country_alpha_2_code: obj.contact_address_country_alpha_2_code, // contact_address_country_alpha_2_code
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

View File

@@ -0,0 +1,240 @@
import QRCode from 'qrcode'
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_core } from "$lib/ae_core/db_core";
let 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: 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}`);
}
let endpoint = `/qr/${account_id}/${qr_id}`;
if (log_lvl) {
console.log('Endpoint', endpoint);
}
let 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 (log_lvl) {
console.log('Params', params);
}
let 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
});
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 <img src=...>
if (return_blob) {
let 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 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 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}`;
}
// 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;
}
// Updated 2025-10-09
/**
* Generates a QR code image as a Base64 data URL based on provided parameters.
*
* NOTE: This function handles the data formatting and QR generation,
* but does NOT handle server-side logic like file saving, disk path checks,
* or database lookups (like redis_lookup_id_random).
*
* @param {string} qr_type - The type of data format ('mecard', 'vcard', 'obj', 'kv', 'js', 'str').
* @param {Object} params - An object containing all necessary query parameters (n, fn, url, email, etc.).
* @param {string} qr_id - A unique ID (unused in pure client-side generation, but kept for context).
* @returns {Promise<string>} A promise that resolves to a Base64 data URL of the QR code image.
* @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;
console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params);
let qrData = 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.
qrData = `MECARD:N:${n};EMAIL:${email};;`;
// You can enhance this with other MeCard fields if needed.
break;
case 'vcard':
// Format: BEGIN:VCARD...END:VCARD
qrData = `BEGIN:VCARD\nVERSION:3.0\nN:${n}\nFN:${fn}\nORG:${org}\nEMAIL:${email}\n`;
if (url) { qrData += `URL:${url}\n`; }
if (tel) { qrData += `TEL:${tel}\n`; }
if (adr_loc) {
// ADR format: TYPE=postal:Po box;Ext;Street;Locality;Region;Postal code;Country
qrData += `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".');
qrData = `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".');
qrData = `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".');
qrData = `JS:${js}`;
break;
case 'str':
// Raw string data
if (!str) throw new Error('Missing raw string data for type "str".');
qrData = str;
break;
default:
throw new Error(`Unknown QR type: ${qr_type}`);
}
if (!qrData) {
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 dataUrl = await QRCode.toDataURL(qrData, {
errorCorrectionLevel: 'M',
margin: 1, // Corresponds to border
scale: 10, // Corresponds to box_size
type: 'image/png',
});
console.log('Generated QR code data URL:', dataUrl);
return dataUrl;
} catch (error) {
console.error('Error generating QR code:', error);
throw new Error('Could not generate QR code image.');
}
}

View File

@@ -0,0 +1,74 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_core } from "$lib/ae_core/db_core";
let 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: any,
// account_id: string,
enabled?: string,
hidden?: string,
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() ***`);
}
let params_json: key_val = {};
// 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) {
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;
}

View File

@@ -0,0 +1,339 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_core } from "$lib/ae_core/db_core";
let 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: 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}`);
}
let 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);
}
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) {
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;
}
// 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: 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}`);
}
let 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);
}
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) {
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;
}
// 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: 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);
}
let 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;
// 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);
// }
// 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) {
// 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;
}
// 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: 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}`);
}
let 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);
}
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) {
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;
}
// Change user password
// endpoint: PATCH /user/{user_id}/change_password
// params:
// 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: 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}`);
}
let 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);
}
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) {
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;
}

170
src/lib/ae_core/db_core.ts Normal file
View File

@@ -0,0 +1,170 @@
import Dexie, { type Table } from 'dexie';
// li = list
// kv = key value list
// Updated 2025-01-07
export interface File {
id: string;
id_random: string;
hosted_file_id: string;
hosted_file_id_random: string;
hash_sha256: string;
for_type?: string;
for_id?: string;
for_id_random?: string;
account_id: string;
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;
// 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;
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.
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;
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;
full_name?: string;
full_name_override?: null|string; // was called display_name
affiliations?: null|string;
primary_email?: string;
biography?: 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;
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;
// 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;
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;
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<File>;
person!: Table<Person>;
// user!: Table<User>;
constructor() {
super('ae_core_db');
this.version(1).stores({
file: `
id, id_random, hosted_file_id, hosted_file_id_random,
hash_sha256,
account_id,
for_type, for_id, for_id_random,
filename, extension,
content_type, size,
enable, hide, priority, sort, group, created_on, updated_on`,
person: `
id, person_id, person_id_random,
external_id, code,
account_id, user_id,
account_id_random, user_id_random,
person_profile_id,
person_profile_id_random,
given_name, family_name,
full_name, affiliations, email,
agree,
enable, hide, priority, sort, group, created_on, updated_on`,
});
}
}
export const db_core = new MySubClassedDexie();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,727 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_events } from "$lib/ae_events/db_events";
import { load_ae_obj_id__event_badge_template } from "$lib/ae_events/ae_events__event_badge_template";
let 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: 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}`);
}
let 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) {
let 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) {
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`);
}
let 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;
}
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: any,
event_id: string,
inc_template?: boolean,
enabled?: string,
hidden?: string,
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}`);
}
let 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) {
let 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) {
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 (let badge_obj of ae_promises.load__event_badge_obj_li) {
if (log_lvl) {
console.log(`Loading template for badge_obj: `, badge_obj);
}
let 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;
}
// 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: 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) {
let 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) {
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: 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) {
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: 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) {
let 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) {
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: any,
event_id: string,
qry_str?: null|string,
enabled?: string,
hidden?: string,
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}`);
}
let 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: 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?: string,
hidden?: string,
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 (!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.
}
let 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);
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;
}
// 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) {
let 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) {
console.log('No results returned or failed.', error);
});
return ae_promises.search__event_badge_obj_li;
}
// Updated 2025-10-06
export async function db_save_ae_obj_li__event_badge({
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any[],
log_lvl?: number
}) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event_badge() *** obj_type=${obj_type}`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to save.');
return [];
}
return await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge',
obj_li,
properties_to_save,
log_lvl,
});
}
// Updated 2025-10-06
export const properties_to_save = [
'id',
'event_badge_id',
'event_badge_id_random',
'event_id',
'event_id_random',
'event_badge_template_id',
'event_badge_template_id_random',
'pronouns',
'informal_name',
'title_names',
'given_name',
'middle_name',
'family_name',
'designations',
'professional_title',
'professional_title_override',
'full_name',
'full_name_override',
'affiliations',
'affiliations_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',
'query_str',
'badge_type',
'badge_type_code',
'badge_type_override',
'badge_type_code_override',
'external_event_id',
'external_id',
'external_person_id',
'default_qry_string',
'alert',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
// 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',
];
// Updated 2025-10-06
export async function process_ae_obj__event_badge_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_badge_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_badge:`, obj);
let processed_obj = {
id: obj.event_badge_id_random,
event_badge_id: obj.event_badge_id_random,
event_badge_id_random: obj.event_badge_id_random,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_badge_template_id: obj.event_badge_template_id_random,
event_badge_template_id_random: obj.event_badge_template_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,
professional_title: obj.professional_title,
professional_title_override: obj.professional_title_override,
full_name: obj.full_name,
full_name_override: obj.full_name_override,
affiliations: obj.affiliations,
affiliations_override: obj.affiliations_override,
email: obj.email,
email_override: obj.email_override,
address_line_1: obj.address_line_1,
address_line_2: obj.address_line_2,
address_line_3: obj.address_line_3,
city: obj.city,
country_subdivision_code: obj.country_subdivision_code,
state_province: obj.state_province,
state_province_abb: obj.state_province_abb,
postal_code: obj.postal_code,
country_alpha_2_code: obj.country_alpha_2_code,
country: obj.country,
full_address: obj.full_address,
location: obj.location,
location_override: obj.location_override,
query_str: obj.query_str,
badge_type: obj.badge_type,
badge_type_code: obj.badge_type_code,
badge_type_override: obj.badge_type_override,
badge_type_code_override: obj.badge_type_code_override,
external_event_id: obj.external_event_id,
external_id: obj.external_id,
external_person_id: obj.external_person_id,
default_qry_string: obj.default_qry_string,
alert: obj.alert,
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,
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.print_count}_${obj.priority}_${obj.sort}_${obj.given_name}_${obj.family_name}_${obj.updated_on}_${obj.created_on}`,
person_external_id: obj.person_external_id,
person_external_sys_id: obj.person_external_sys_id,
person_given_name: obj.person_given_name,
person_family_name: obj.person_family_name,
person_full_name: obj.person_full_name,
person_professional_title: obj.person_professional_title,
person_affiliations: obj.person_affiliations,
person_primary_email: obj.person_primary_email,
person_passcode: obj.person_passcode,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

View File

@@ -0,0 +1,544 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_events } from "$lib/ae_events/db_events";
let ae_promises: key_val = {};
// --- PROPERTIES TO SAVE ---
export const properties_to_save = [
'id',
'event_badge_template_id',
'event_badge_template_id_random',
'event_id',
'event_id_random',
'name',
'description',
// 'template_code',
// 'template_type',
// 'template_json',
// 'template_svg',
// 'template_css',
// 'template_html',
'logo_filename',
'logo_path',
'header_path',
'secondary_header_path',
'footer_path',
'header_row_1',
'header_row_2',
// 'footer_title',
// 'footer_left',
// 'footer_right',
// 'header_background',
// 'footer_background',
'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',
'wireless_ssid',
'wireless_password',
'show_qr_front',
'show_qr_back',
'layout',
'style_filename',
// 'style_href',
// 'default',
'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__event_badge_template_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_badge_template_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_badge_template:`, obj);
let processed_obj = {
id: obj.event_badge_template_id_random,
event_badge_template_id: obj.event_badge_template_id_random,
event_badge_template_id_random: obj.event_badge_template_id_random,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
name: obj.name,
description: obj.description,
logo_filename: obj.logo_filename,
logo_path: obj.logo_path,
header_path: obj.header_path,
secondary_header_path: obj.secondary_header_path,
footer_path: obj.footer_path,
header_row_1: obj.header_row_1,
header_row_2: obj.header_row_2,
badge_type_list: obj.badge_type_list,
ticket_list: obj.ticket_list,
ticket_1_text: obj.ticket_1_text,
ticket_2_text: obj.ticket_2_text,
ticket_3_text: obj.ticket_3_text,
ticket_4_text: obj.ticket_4_text,
ticket_5_text: obj.ticket_5_text,
ticket_6_text: obj.ticket_6_text,
ticket_7_text: obj.ticket_7_text,
ticket_8_text: obj.ticket_8_text,
wireless_ssid: obj.wireless_ssid,
wireless_password: obj.wireless_password,
show_qr_front: obj.show_qr_front,
show_qr_back: obj.show_qr_back,
layout: obj.layout,
style_filename: obj.style_filename,
// default: obj.default,
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,
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}`,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}
// --- DB SAVE FUNCTION ---
export async function db_save_ae_obj_li__event_badge_template({
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any[],
log_lvl?: number
}) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event_badge_template() *** obj_type=${obj_type}`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to save.');
return [];
}
return await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'badge_template',
obj_li,
properties_to_save,
log_lvl,
});
}
// --- 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: 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}`);
}
let 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) {
let 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) {
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: any,
event_id: string,
enabled?: string,
hidden?: string,
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}`);
}
let 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) {
let 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) {
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: 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) {
let 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) {
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: 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) {
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: 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) {
let 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) {
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: any,
event_id: string,
fulltext_search_qry_str?: null|string,
like_search_qry_str?: null|string,
enabled?: string,
hidden?: string,
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}`);
}
let 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) {
let 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) {
console.log('No results returned or failed.', error);
});
return ae_promises.search__event_badge_template_obj_li;
}

View File

@@ -0,0 +1,850 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_events } from "$lib/ae_events/db_events";
import { load_ae_obj_id__event_location } from './ae_events__event_location';
let 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: 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}`);
}
let 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) {
let 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) {
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 (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`);
}
let 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;
}
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: any,
for_obj_type: string,
for_obj_id: string,
inc_location_id?: boolean,
enabled?: string, // all, disabled, enabled
hidden?: string, // 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}`);
}
// 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 params_json: key_val = {};
// 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
let 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) {
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 (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++) {
let event_device_obj = ae_promises.load__event_device_obj_li[i];
let 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);
}
}
}
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: 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}`);
}
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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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
let 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) {
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;
}
// 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: 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}`);
}
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 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 || 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;
}
}
// 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;
}
}
params_json['and_qry'] = {};
// if (device_type_code) {
// params_json['and_qry']['device_type_code'] = device_type_code;
// }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
// 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(function (event_device_obj_li_get_result) {
if (event_device_obj_li_get_result) {
if (try_cache) {
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) {
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;
}
// This function will loop through the event_device_obj_li and save each one to the DB.
// Updated 2024-10-16
export function db_save_ae_obj_li__event_device(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event_device() ***`);
}
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_events.device.put({
id: obj.event_device_id_random,
event_device_id: obj.event_device_id_random,
// event_device_id_random: obj.event_device_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,
code: obj.code,
name: obj.name,
description: obj.description,
passcode: obj.passcode,
local_file_cache_path: obj.local_file_cache_path,
host_file_temp_path: obj.host_file_temp_path,
recording_path: obj.recording_path,
record_audio: obj.record_audio,
record_video: obj.record_video,
trigger_open_file_id: obj.trigger_open_file_id,
trigger_open_session_id: obj.trigger_open_session_id,
trigger_recording_start: obj.trigger_recording_start,
trigger_recording_stop: obj.trigger_recording_stop,
trigger_reset: obj.trigger_reset,
trigger_show_admin: obj.trigger_show_admin,
trigger_show_hidden: obj.trigger_show_hidden,
alert: obj.alert,
alert_msg: obj.alert_msg,
alert_on: obj.alert_on,
status: obj.status,
status_msg: obj.status_msg,
status_on: obj.status_on,
record_status: obj.record_status,
record_status_msg: obj.record_status_msg,
record_status_on: obj.record_status_on,
// These are timestamps that are in UTC but missing the 'Z' at the end
heartbeat: obj.heartbeat ? obj.heartbeat+'Z' : null,
info_hostname: obj.info_hostname,
info_ip_list: obj.info_ip_list,
meta_json: obj.meta_json,
other_json: obj.other_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,
// From SQL view
event_name: obj.event_name,
event_location_code: obj.event_location_code,
event_location_name: obj.event_location_name,
});
// console.log(`Put obj with ID: ${obj.event_device_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.event_device_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_events.device.put(obj);
// console.log(`Put obj with ID: ${obj.event_device_id_random}`);
});
return true;
}
}
// Updated 2025-05-23
export const properties_to_save = [
'id',
'event_device_id',
'event_device_id_random',
'event_id',
'event_id_random',
'event_location_id',
'event_location_id_random',
'code',
'name',
'description',
'passcode',
'local_file_cache_path',
'host_file_temp_path',
'recording_path',
'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',
'alert',
'alert_msg',
'alert_on',
'status',
'status_msg',
'status_on',
'record_status',
'record_status_msg',
'record_status_on',
'heartbeat',
'info_hostname',
'info_ip_list',
'meta_json',
'other_json',
'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',
// From SQL view
'event_name',
'event_location_code',
'event_location_name',
];
// Updated 2025-05-23
export async function process_ae_obj__event_device_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_location_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_device:`, obj);
let processed_obj = {
id: obj.event_device_id_random,
event_device_id: obj.event_device_id_random,
event_device_id_random: obj.event_device_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,
code: obj.code,
name: obj.name,
description: obj.description,
passcode: obj.passcode,
local_file_cache_path: obj.local_file_cache_path,
host_file_temp_path: obj.host_file_temp_path,
recording_path: obj.recording_path,
record_audio: obj.record_audio,
record_video: obj.record_video,
trigger_open_file_id: obj.trigger_open_file_id,
trigger_open_session_id: obj.trigger_open_session_id,
trigger_recording_start: obj.trigger_recording_start,
trigger_recording_stop: obj.trigger_recording_stop,
trigger_reset: obj.trigger_reset,
trigger_show_admin: obj.trigger_show_admin,
trigger_show_hidden: obj.trigger_show_hidden,
alert: obj.alert,
alert_msg: obj.alert_msg,
alert_on: obj.alert_on,
status: obj.status,
status_msg: obj.status_msg,
status_on: obj.status_on,
record_status: obj.record_status,
record_status_msg: obj.record_status_msg,
record_status_on: obj.record_status_on,
// These are timestamps that are in UTC but missing the 'Z' at the end
heartbeat: obj.heartbeat ? obj.heartbeat+'Z' : null,
info_hostname: obj.info_hostname,
info_ip_list: obj.info_ip_list,
meta_json: obj.meta_json,
other_json: obj.other_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,
// 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}`,
// From SQL view
event_name: obj.event_name,
event_location_code: obj.event_location_code,
event_location_name: obj.event_location_name,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,897 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_events } from "$lib/ae_events/db_events";
import { load_ae_obj_li__event_device } from "$lib/ae_events/ae_events__event_device";
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file";
import { load_ae_obj_li__event_session } from './ae_events__event_session';
let 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: 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}`);
}
let 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) {
let 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) {
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 (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`);
}
let 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 (inc_session_li) {
// Load the sessions for the location
if (log_lvl) {
console.log(`Need to load the session list for the location now`);
}
let 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;
}
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: any,
for_obj_type: string,
for_obj_id: string,
inc_device_li?: boolean,
inc_file_li?: boolean,
inc_session_li?: boolean,
enabled?: string, // all, disabled, enabled
hidden?: string, // 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}`);
}
let params_json: key_val = {};
// 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
let 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) {
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 (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++) {
let event_location_obj = ae_promises.load__event_location_obj_li[i];
let event_location_id = event_location_obj.event_location_id_random;
let 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 (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++) {
let event_location_obj = ae_promises.load__event_location_obj_li[i];
let event_location_id = event_location_obj.event_location_id_random;
let 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 (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++) {
let event_location_obj = ae_promises.load__event_location_obj_li[i];
let event_location_id = event_location_obj.event_location_id_random;
let 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);
}
}
}
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: 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}`);
}
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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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
let 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) {
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;
}
// 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: 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}`);
}
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 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 || 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;
}
}
// 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;
}
}
params_json['and_qry'] = {};
// if (location_type_code) {
// params_json['and_qry']['location_type_code'] = location_type_code;
// }
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
// 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(function (event_location_obj_li_get_result) {
if (event_location_obj_li_get_result) {
if (try_cache) {
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) {
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;
}
// This function will loop through the event_location_obj_li and save each one to the DB.
// Updated 2024-06-25
export function db_save_ae_obj_li__event_location(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event_location() ***`);
}
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_events.location.put({
id: obj.event_location_id_random,
event_location_id: obj.event_location_id_random,
event_location_id_random: obj.event_location_id_random,
external_id: obj.external_id,
code: obj.code,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
name: obj.name,
description: obj.description,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
alert: obj.alert,
alert_msg: obj.alert_msg,
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,
// 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_kv_json: obj.poc_kv_json,
event_name: obj.event_name,
});
// console.log(`Put obj with ID: ${obj.event_location_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.event_location_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_events.location.put(obj);
// console.log(`Put obj with ID: ${obj.event_location_id_random}`);
});
return true;
}
}
// Updated 2025-05-23
export const properties_to_save = [
'id',
'event_location_id',
'event_location_id_random',
'external_id',
'code',
'type_code',
'event_id',
'event_id_random',
'name',
'description',
'passcode',
'hide_event_launcher',
'alert',
'alert_msg',
'data_json',
'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',
// From SQL view
'file_count',
'file_count_all',
'internal_use_count',
'event_file_id_li_json',
'event_name',
];
// Updated 2025-05-23
export async function process_ae_obj__event_location_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_location_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_location:`, obj);
let processed_obj = {
id: obj.event_location_id_random,
event_location_id: obj.event_location_id_random,
event_location_id_random: obj.event_location_id_random,
external_id: obj.external_id,
code: obj.code,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
name: obj.name,
description: obj.description,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
alert: obj.alert,
alert_msg: obj.alert_msg,
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,
// 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}`,
// 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,
event_name: obj.event_name,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

View File

@@ -0,0 +1,793 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_events } from "$lib/ae_events/db_events";
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file";
import { load_ae_obj_li__event_presenter } from "$lib/ae_events/ae_events__event_presenter";
let 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: any,
event_presentation_id: string,
inc_file_li?: boolean,
inc_presenter_li?: boolean,
enabled?: string,
hidden?: string,
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}`);
}
let 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
let 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]
// });
}
return event_presentation_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
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 (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.`);
}
let 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 (inc_presenter_li) {
// Load the presenters for the presentation
if (log_lvl) {
console.log(`Need to load the presenter list for the presentation now.`);
}
let 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;
}
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: any,
for_obj_type: string,
for_obj_id: string,
inc_file_li?: boolean,
inc_presenter_li?: boolean,
enabled?: string,
hidden?: string,
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}`);
}
// 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 params_json: key_val = {};
// 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
let 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) {
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 (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++) {
let event_presentation_obj = ae_promises.load__event_presentation_obj_li[i];
let event_presentation_id = event_presentation_obj.event_presentation_id_random;
let 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 (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++) {
let event_presentation_obj = ae_promises.load__event_presentation_obj_li[i];
let event_presentation_id = event_presentation_obj.event_presentation_id_random;
let 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;
}
}
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: 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}`);
}
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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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
let 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) {
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;
}
// This function will loop through the event_presentation_obj_li and save each one to the DB.
// Updated 2024-06-10
export function db_save_ae_obj_li__event_presentation(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__event_presentation() ***`);
}
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_events.presentation.put({
id: obj.event_presentation_id_random,
// id_random: obj.event_presentation_id_random,
event_presentation_id: obj.event_presentation_id_random,
event_presentation_id_random: obj.event_presentation_id_random,
external_id: obj.external_id,
code: obj.code,
for_type: obj.for_type,
for_id: obj.for_id_random,
for_id_random: obj.for_id_random,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_session_id: obj.event_session_id_random,
event_session_id_random: obj.event_session_id_random,
event_abstract_id: obj.event_abstract_id_random,
event_abstract_id_random: obj.event_abstract_id_random,
abstract_code: obj.abstract_code,
name: obj.name,
description: obj.description,
start_datetime: obj.start_datetime,
end_datetime: obj.end_datetime,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
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
event_session_code: obj.event_session_code,
event_session_name: obj.event_session_name,
// A key value list of the presenters
// event_presenter_kv: obj.event_presenter_kv,
});
// console.log(`Put obj with ID: ${obj.event_presentation_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.event_presentation_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_events.presentation.put(obj);
// console.log(`Put obj with ID: ${obj.event_presentation_id_random}`);
});
return true;
}
}
// Updated 2025-05-22
export const properties_to_save = [
'id',
'event_presentation_id',
'event_presentation_id_random',
'external_id',
'code',
'for_type',
'for_id',
'for_id_random',
'type_code',
'event_id',
'event_id_random',
'event_session_id',
'event_session_id_random',
'event_abstract_id',
'event_abstract_id_random',
'abstract_code',
'name',
'description',
'start_datetime',
'end_datetime',
'passcode',
'hide_event_launcher',
'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',
// From SQL view
'event_session_code',
'event_session_name',
// Add more fields here if your DB save logic uses them
];
// Updated 2025-05-22
export async function process_ae_obj__event_presentation_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_presentation_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) {
console.log('No objects to process.');
}
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) {
console.log(`Processing ae_obj event_presentation:`, obj);
}
let processed_obj = {
id: obj.event_presentation_id_random,
event_presentation_id: obj.event_presentation_id_random,
event_presentation_id_random: obj.event_presentation_id_random,
external_id: obj.external_id,
code: obj.code,
for_type: obj.for_type,
for_id: obj.for_id_random,
for_id_random: obj.for_id_random,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_session_id: obj.event_session_id_random,
event_session_id_random: obj.event_session_id_random,
event_abstract_id: obj.event_abstract_id_random,
event_abstract_id_random: obj.event_abstract_id_random,
abstract_code: obj.abstract_code,
name: obj.name,
description: obj.description,
start_datetime: obj.start_datetime,
end_datetime: obj.end_datetime,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
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,
// 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}`,
// From SQL view
event_session_code: obj.event_session_code,
event_session_name: obj.event_session_name,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,564 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_events } from "$lib/ae_events/db_events";
let ae_promises: key_val = {};
// Updated 2024-03
export async function handle_load_ae_obj_id__exhibit(
{
api_cfg,
exhibit_id,
try_cache=false,
log_lvl=0
}: {
api_cfg: any,
exhibit_id: string,
try_cache?: boolean,
log_lvl?: number
}
) {
console.log(`*** handle_load_ae_obj_id__exhibit() *** exhibit_id=${exhibit_id}`);
let 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(function (exhibit_obj_get_result) {
if (exhibit_obj_get_result) {
// This is expecting a list
handle_db_save_ae_obj_li__exhibitor({obj_type: 'event_exhibit', obj_li: [exhibit_obj_get_result]});
return exhibit_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_promises.load__exhibit_obj;
}
// Updated 2024-03-06
export async function handle_load_ae_obj_li__exhibit(
{
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
}
) {
console.log(`*** handle_load_ae_obj_li__exhibit() *** 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 ?? 99); // 99
let offset: number = (params.qry__offset ?? 0); // 0
let 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],
};
// 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);
// $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(function (exhibit_obj_li_get_result) {
// console.log('Badge list:', exhibit_obj_li_get_result);
if (exhibit_obj_li_get_result) {
// $slct.exhibit_obj_li = exhibit_obj_li_get_result;
handle_db_save_ae_obj_li__exhibitor({obj_type: 'event_exhibit', obj_li: exhibit_obj_li_get_result});
return exhibit_obj_li_get_result;
} else {
// $slct.exhibit_obj_li = [];
return [];
}
})
.catch(function (error) {
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;
}
export async function handle_load_ae_obj_id__exhibit_tracking(
{
api_cfg,
exhibit_tracking_id,
try_cache=false,
log_lvl=0
}: {
api_cfg: any,
exhibit_tracking_id: string,
try_cache?: boolean,
log_lvl?: number
}
) {
console.log(`*** handle_load_ae_obj_id__exhibit_tracking() *** exhibit_tracking_id=${exhibit_tracking_id}`);
let 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(function (exhibit_tracking_obj_get_result) {
if (exhibit_tracking_obj_get_result) {
// This is expecting a list
handle_db_save_ae_obj_li__exhibitor_tracking({obj_type: 'event_exhibit_tracking', obj_li: [exhibit_tracking_obj_get_result]});
return exhibit_tracking_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_promises.load__event_exhibit_tracking_obj;
}
// Updated 2024-03-19
export async function handle_load_ae_obj_li__exhibit_tracking(
{
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
}
) {
console.log(`*** handle_load_ae_obj_li__exhibit_tracking() *** exhibit_id=${exhibit_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 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
})
.then(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) {
// $slct.exhibit_tracking_obj_li = exhibit_tracking_obj_li_get_result;
handle_db_save_ae_obj_li__exhibitor_tracking({obj_type: 'event_exhibit_tracking', obj_li: exhibit_tracking_obj_li_get_result});
return exhibit_tracking_obj_li_get_result;
} else {
// $slct.exhibit_tracking_obj_li = [];
return [];
}
})
.catch(function (error) {
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;
}
// Updated 2024-03-22
export async function handle_create_ae_obj__exhibit_tracking(
{
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
}
) {
console.log(`*** handle_create_ae_obj__exhibit_tracking() *** exhibit_id=${exhibit_id}, event_badge_id=${event_badge_id}`);
let 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
})
.then(function (exhibit_tracking_obj_create_result) {
// console.log('Exhibit tracking create:', exhibit_tracking_obj_create_result);
if (exhibit_tracking_obj_create_result) {
// $slct.exhibit_tracking_obj = exhibit_tracking_obj_create_result;
handle_db_save_ae_obj_li__exhibitor_tracking({obj_type: 'event_exhibit_tracking', obj_li: [exhibit_tracking_obj_create_result]});
return exhibit_tracking_obj_create_result;
} else {
// $slct.exhibit_tracking_obj = [];
return null;
}
})
.catch(function (error) {
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;
}
// Updated 2024-03-28
export async function handle_update_ae_obj__exhibit_tracking(
{
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
}
) {
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(function (exhibit_tracking_obj_update_result) {
if (exhibit_tracking_obj_update_result) {
handle_db_save_ae_obj_li__exhibitor_tracking({obj_type: 'event_exhibit_tracking', obj_li: [exhibit_tracking_obj_update_result]});
return exhibit_tracking_obj_update_result;
} else {
return null;
}
})
.catch(function (error) {
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;
}
export async function handle_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: 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() ***');
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
});
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;
}
// This function will loop through the event_exhibit_obj_li and save each one to the DB.
export function handle_db_save_ae_obj_li__exhibitor(
{
obj_type,
obj_li=[],
log_lvl=0
}: {
obj_type: string,
obj_li: any[],
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** handle_db_save_ae_obj_li__exhibitor() ***`);
}
if (obj_li && obj_li.length) {
obj_li.forEach(async function (obj) {
if (log_lvl) {
console.log(`ae_obj ${obj_type}:`, obj);
}
try {
const id_random = await db_events.exhibit.put({
id_random: obj.event_exhibit_id_random,
event_exhibit_id_random: obj.event_exhibit_id_random,
event_id_random: obj.event_id_random,
code: obj.code,
name: obj.name,
description: obj.description,
staff_passcode: obj.staff_passcode,
data_json: obj.data_json,
leads_api_access: obj.leads_api_access,
leads_custom_questions_json: obj.leads_custom_questions_json,
leads_device_sm_qty: obj.leads_device_sm_qty,
leads_device_lg_qty: obj.leads_device_lg_qty,
license_max: obj.license_max,
license_li_json: obj.license_li_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,
});
// console.log(`Put obj with ID: ${obj.event_exhibit_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.event_exhibit_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_events.exhibit.put(obj);
// console.log(`Put obj with ID: ${obj.event_exhibit_id_random}`);
});
return true;
}
}
// This function will loop through the event_exhibit_tracking_obj_li and save each one to the DB.
export function handle_db_save_ae_obj_li__exhibitor_tracking(
{
obj_type,
obj_li,
log_lvl=0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** handle_db_save_ae_obj_li__exhibitor_tracking() ***`);
}
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_events.exhibit_tracking.put({
id_random: obj.event_exhibit_tracking_id_random,
event_exhibit_tracking_id_random: obj.event_exhibit_tracking_id_random,
event_exhibit_id_random: obj.event_exhibit_id_random,
event_badge_id_random: obj.event_badge_id_random,
event_person_id_random: obj.event_person_id_random,
external_person_id: obj.external_person_id,
exhibitor_notes: obj.exhibitor_notes,
responses_json: obj.responses_json,
data_json: obj.data_json,
event_exhibit_name: obj.event_exhibit_name,
event_badge_title_names: obj.event_badge_title_names,
event_badge_given_name: obj.event_badge_given_name,
event_badge_family_name: obj.event_badge_family_name,
event_badge_designations: obj.event_badge_designations,
event_badge_full_name: obj.event_badge_full_name,
event_badge_full_name_override: obj.event_badge_full_name_override,
event_badge_professional_title: obj.event_badge_professional_title,
event_badge_professional_title_override: obj.event_badge_professional_title_override,
event_badge_affiliations: obj.event_badge_affiliations,
event_badge_affiliations_override: obj.event_badge_affiliations_override,
event_badge_email: obj.event_badge_email,
event_badge_email_override: obj.event_badge_email_override,
event_badge_location: obj.event_badge_location,
event_badge_location_override: obj.event_badge_location_override,
event_badge_country: obj.event_badge_country,
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,
});
// console.log(`Put obj with ID: ${obj.event_exhibit_tracking_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.event_exhibit_tracking_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_events.exhibit_tracking.put(obj);
// console.log(`Put obj with ID: ${obj.event_exhibit_tracking_id_random}`);
});
return true;
}
}

View File

@@ -0,0 +1,929 @@
import Dexie, { type Table } from 'dexie';
import type { key_val } from '../ae_stores';
// li = list
// kv = key value list
// Updated 2024-10-16
export interface Event {
id: string;
// id_random: string;
event_id: string;
event_id_random: string;
code: string;
account_id: string;
account_id_random: 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;
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;
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;
// 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;
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;
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;
// 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;
event_id: string;
event_id_random: 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;
professional_title?: null|string;
professional_title_override?: null|string;
full_name?: string;
full_name_override?: null|string;
affiliations?: string;
affiliations_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;
query_str?: 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;
// passcode?: null|string;
// data_json?: null|string;
default_qry_string?: null|string;
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;
// 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;
}
// Updated 2025-10-06
export interface Badge_template {
id: number;
// id_random: string;
event_id: string;
event_id_random: string;
name: string;
description?: null|string;
logo_filename?: null|string;
logo_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;
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_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;
show_qr_front: boolean;
show_qr_back: boolean;
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;
// Generated fields for sorting locally only
// 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;
event_id: string;
// event_id_random: string;
event_location_id?: string;
// event_location_id_random?: string;
code?: string;
name: string;
description?: null|string;
passcode?: 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;
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;
info_hostname?: null|string;
info_ip_list?: null|string; // Semi-colon separated list of IP addresses
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;
// 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;
}
export interface Exhibit {
id?: number;
id_random: string;
event_exhibit_id: string;
event_exhibit_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;
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;
// 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;
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
exhibitor_notes: null|string;
responses_json: null|string;
data_json: null|string;
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_professional_title: null|string;
event_badge_professional_title_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_location: null|string;
event_badge_location_override: 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;
// 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;
hosted_file_id: string;
hosted_file_id_random: string;
hash_sha256: 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;
filename: string;
extension: string;
open_in_os?: null|string; // null, empty, 'mac', or 'win'
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;
// 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
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;
external_id?: null|string;
code?: null|string;
type_code?: string;
event_id: string;
event_id_random: string;
name: string;
description?: null|string;
passcode?: null|string;
hide_event_launcher?: null|boolean;
alert?: null|boolean;
alert_msg?: 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;
// 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;
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;
}
// Updated 2024-06-10
export interface Presentation {
id: string;
// id_random: string;
event_presentation_id: string;
event_presentation_id_random: string;
external_id?: null|string;
code?: null|string;
for_type?: string;
for_id?: string;
for_id_random?: 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;
abstract_code?: null|string;
name: string;
description?: null|string;
start_datetime?: null|Date;
end_datetime?: null|Date;
passcode?: null|string;
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;
// 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;
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<any>;
}
// Updated 2024-06-10
export interface Presenter {
id: string;
// id_random: string;
event_presenter_id: string;
event_presenter_id_random: 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...
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;
full_name?: string;
full_name_override: null|string;
affiliations?: null|string;
email?: string;
biography?: null|string;
agree?: null|boolean; // General catchall for agreement or consent
comments?: null|string;
passcode?: null|string;
hide_event_launcher?: null|boolean;
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;
// 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;
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;
// A key value list of the files
event_file_kv?: null|key_val;
}
export interface Registration {
// Nothing here yet
}
// Updated 2024-06-19
export interface Session {
id: string;
// id_random: string;
event_session_id: string;
event_session_id_random: string;
external_id: null|string;
code: null|string;
for_type: string;
for_id: string;
for_id_random: string;
type_code?: 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')
name: string;
description?: null|string;
start_datetime?: null|Date;
end_datetime?: null|Date;
passcode?: null|string;
hide_event_launcher?: null|boolean;
alert?: null|boolean;
alert_msg?: 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
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;
// 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;
event_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];
}
// 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<Event>;
badge!: Table<Badge>;
badge_template!: Table<Badge_template>;
device!: Table<Device>;
exhibit!: Table<Exhibit>;
exhibit_tracking!: Table<Exhibit_tracking>;
file!: Table<File>;
location!: Table<Location>;
presentation!: Table<Presentation>;
presenter!: Table<Presenter>;
session!: Table<Session>;
constructor() {
super('ae_events_db');
this.version(6).stores({
event: `
id, event_id, event_id_random,
code,
account_id, account_id_random,
conference, type,
name,
start_datetime, end_datetime,
timezone,
cfg_json,
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: `
id, id_random, event_badge_id, event_badge_id_random,
event_id, event_id_random,
full_name, full_name_override, email, email_override,
affiliations, affiliations_override,
badge_type, badge_type_code, badge_type_code_override, badge_type_override,
external_event_id, external_id, external_person_id,
default_qry_string,
alert,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
badge_template: `
id, event_id, event_id_random`,
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,
for_type, for_id, for_id_random,
alert,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
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: `
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,
exhibitor_notes, responses_json, data_json,
event_badge_full_name, event_badge_email,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
file: `
id, id_random, event_file_id, event_file_id_random,
hosted_file_id, hosted_file_id_random,
hash_sha256,
for_type, for_id, for_id_random,
event_id, event_session_id, event_presentation_id, event_presenter_id, event_location_id,
event_id_random, event_session_id_random, event_presentation_id_random, event_presenter_id_random, event_location_id_random,
filename, extension,
lu_file_purpose_id, lu_event_file_purpose_name, file_purpose,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, created_on, updated_on`,
location: `
id, event_location_id, event_location_id_random,
external_id, code,
event_id, event_id_random,
name, description,
passcode,
hide_event_launcher,
alert, alert_msg,
data_json,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, created_on, updated_on`,
presentation: `
id, event_presentation_id, event_presentation_id_random,
external_id, code,
for_type, for_id, for_id_random,
type_code,
event_id, event_session_id, event_abstract_id,
event_id_random, event_session_id_random, event_abstract_id_random,
abstract_code, name, description, start_datetime, end_datetime,
hide_event_launcher,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, created_on, updated_on`,
presenter: `
id, event_presenter_id, event_presenter_id_random,
external_id, code,
event_id, event_session_id, event_person_id, event_presentation_id,
event_id_random, event_session_id_random, event_person_id_random, event_presentation_id_random,
person_id, person_profile_id,
person_id_random, person_profile_id_random,
given_name, family_name,
full_name, affiliations, email,
agree,
hide_event_launcher,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, created_on, updated_on`,
session: `
id, event_session_id, event_session_id_random,
external_id, code,
for_type, for_id, for_id_random,
type_code,
event_id, event_location_id,
poc_person_id,
event_id_random, event_location_id_random,
poc_person_id_random,
name, start_datetime, end_datetime,
hide_event_launcher,
ux_mode,
alert,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, created_on, updated_on`,
});
}
}
export const db_events = new MySubClassedDexie();

View File

@@ -0,0 +1,131 @@
// This file is used to export all the functions that are used for Aether Events related functions.
// Import all the functions from this library:
import * as event from "$lib/ae_events/ae_events__event";
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 {
handle_load_ae_obj_id__exhibit,
handle_load_ae_obj_li__exhibit,
handle_load_ae_obj_id__exhibit_tracking,
handle_load_ae_obj_li__exhibit_tracking,
handle_create_ae_obj__exhibit_tracking,
handle_update_ae_obj__exhibit_tracking,
handle_download_export__event_exhibit_tracking,
handle_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";
import * as event_session from "$lib/ae_events/ae_events__event_session";
import * as event_presentation from "$lib/ae_events/ae_events__event_presentation";
import * as event_presenter from "$lib/ae_events/ae_events__event_presenter";
import * as event_badge from "$lib/ae_events/ae_events__event_badge";
import * as event_badge_template from "$lib/ae_events/ae_events__event_badge_template";
let 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,
// 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 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: handle_load_ae_obj_id__exhibit,
handle_load_ae_obj_li__exhibit: handle_load_ae_obj_li__exhibit,
handle_load_ae_obj_id__exhibit_tracking: handle_load_ae_obj_id__exhibit_tracking,
handle_load_ae_obj_li__exhibit_tracking: handle_load_ae_obj_li__exhibit_tracking,
handle_create_ae_obj__exhibit_tracking: handle_create_ae_obj__exhibit_tracking,
handle_update_ae_obj__exhibit_tracking: handle_update_ae_obj__exhibit_tracking,
handle_download_export__event_exhibit_tracking: handle_download_export__event_exhibit_tracking,
// handle_db_save_ae_obj_li__exhibitor: handle_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 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 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,
};
export let events_func = export_obj;

681
src/lib/ae_events_stores.ts Normal file
View File

@@ -0,0 +1,681 @@
import { persisted } from 'svelte-persisted-store';
import { writable } from 'svelte/store';
import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/ae_stores';
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2025-10-16_2139';
let ver_idb = '2025-10-16_2139';
/* *** BEGIN *** Initialize events_local_data_struct */
// Longer-term app data. This should be stored to *local* storage.
// Updated 2024-03-06
let events_local_data_struct: key_val = {
ver: ver,
ver_idb: ver_idb,
// Shared
name: 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
title: `OSIT's Æ Events`, // - Dev SvelteKit`, // &AElig;
'ds': {},
'events_cfg_json': {},
'event_id': null,
// all, disabled, enabled
'qry__enabled': 'enabled',
// all, hidden, not_hidden
'qry__hidden': 'not_hidden',
'qry__limit': 20,
'qry__offset': 0,
// The show details is intended for things like meta data and additional details that are not always needed.
show_details: false,
auth__person: {}, // allow, id, name, email, passcode, etc
// The auth__entered_key (usually email or person_id) and auth__entered_passcode is found under events_sess.entered_key and events_sess.entered_passcode because it should be temporary.
// auth__entered_passcode: null,
// The auth__kv (key value pairs) is used to store the xyz IDs that the browser client can access. This is a key value list of xyz ID and created datetime stamp (or just true). These should not be more than X days old.
auth__kv: {
event: {
// 'LNDF-67-89-92': true
},
exhibit: {
// 'LNDF-67-89-92': true
},
location: {
// 'LNDF-67-89-92': true
},
session: {
// 'LNDF-67-89-92': true, false, 'read', 'write'
},
presentation: {
// 'LNDF-67-89-92': true
},
presenter: {
// 'LNDF-67-89-92': true
},
person: {
// 'LNDF-67-89-92': true
},
},
// auth__session_kv: {
// // {'LNDF-67-89-92': true}
// },
// auth__presentation_kv: {
// // {'LNDF-67-89-92': true}
// },
// auth__presenter_kv: {
// // {'LNDF-67-89-92': true}
// },
// Badge Printing
'badges': {
auto_view: true,
show_hidden: false, // These are hidden (archived) leads so the list is not as long.
show_not_enabled: false,
show_printed: false,
allow_reprint: false,
'show_element__cfg': true,
'show_element__cfg_detail': false,
// 'theme_mode': 'dark',
// 'theme_name': 'wintry',
'fulltext_search_qry_str': null,
'search_badge_type_code': null,
'status_qry__search': null,
'use_id_li': true,
'search_status': null,
'search_complete': false,
'classes__form': 'border border-surface-200 p-4 space-y-4 rounded-container',
},
// Event Files - uploads for sessions, presenters, etc
// 'files': {
// },
// Event Presentation Launcher (and native Electron app)
'launcher': {
// default - browser, onsite - browser onsite, native - Electron app onsite
app_mode: 'default', // 'default', 'native', 'onsite'
ws_connect: false,
qry_limit__files: 25,
qry_limit__presentations: 25,
qry_limit__presenters: 75,
qry_limit__sessions: 50,
hide__launcher_header: false,
hide__launcher_menu: true,
hide__launcher_footer: false,
hide__modal_header_title: false,
hide_drawer__debug: true,
hide__ws_element: true,
hide__ws_form: true,
hide__ws_messages: true,
hide__ws_commands: true,
hide_content__draft_files: true,
show_content__disabled_files: false,
show_content__hidden_files: false,
show_content__hidden_presentations: false,
show_content__hidden_presenters: false,
show_content__hidden_sessions: false,
show_content__draft_files: false,
// These should be renamed to match the pres_mgmt section. Use "hide" instead of "show".
show_content__session_code: true,
show_content__presentation_code: true,
show_content__presenter_code: true,
show_section__controller: false,
datetime_format: 'datetime_12_long',
time_format: 'time_12_short',
time_hours: 12, // 12 or 24
slct: {
event_id: null,
event_location_id: null,
event_session_id: null,
event_presentation_id: null,
event_presenter_id: null,
event_file_id: null, // event_file_id
},
native: {
// 'local_file_cache_path': aether_cfg_data.app.local_file_cache_path,
// 'host_file_temp_path': aether_cfg_data.app.host_file_temp_path,
'host_file_config_path': 'device_configs/ae_native_app_config.default.json',
},
idle_timer: 7*60*1000, // How many seconds until idle
idle_cycle: 5*1000, // How frequently the idle status is checked
idle_loop_period: 3*60*1000, // How frequently the loop runs for the screen saver and similar
screen_saver_img_kv: {}, // This key value list is generate when the launcher_file_cont is loaded. It only adds image file types.
modal__title: '-- Not Set --',
modal__open: null,
modal__open_filename: null,
modal_img_src: null,
controller: 'local',
controller_group_code: 'launcher-00',
controller_client_id: null,
// controller_cmd: null,
// controller_trigger_send: null,
},
// Lead Retrievals (Exhibit)
'leads': {
show_option__paid_tab: true,
show_content__scan_alert: true, // For QR scanner bug...
show_content__scan_requirements: true,
show_content__custom_question_descriptions: true,
show_content__email_link_warning: true,
default_to_scan: true,
// For ISHLT 2024 Annual Meeting only!
default__external_registration_id: '2024_Annual Meeting',
auto_view: true, // Show the new lead after added by scan or search
auto_hide_on_sign_in: true,
show_hidden: false, // These are hidden (archived) leads so the list is not as long.
show_not_enabled: false,
refresh_interval__tracking_li: 30000, // 30 seconds
// The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service.
entered_passcode: null,
// The auth_exhibit_kv (key value pairs) is used to store the exhibit IDs that the browser client can access. This is a key value list of exhibit ID and created datetime stamp. These should not be more than X days old. The entered_passcode for events_sess.leads is what they are entering to log in.
auth_exhibit_kv: {
// {'LNDF-67-89-92': {key: 'example@oneskyit.com', updated_on: '2024-03-13T08:05:29Z}}
},
// The auth_exhibit_license_li is used to store the exhibit license(s) being used on the browser client. There can be multiple exhibit IDs, but only one license per exhibit ID for the browser client. This is used to determine who can actually access and use the lead retrieval service. This is a key value list of key (email address) and created datetime stamp. These should not be more than X days old.
// auth_exhibit_license_li: {
// // 'LNDF-67-89-92': { 'key': 'example@oneskyit.com', 'updated_on': '2024-03-13T08:05:29Z'}
// },
edit_license_li: false,
// The "tab" is a key value list of exhibit ID and tab name. This is intentionally using local storage to store the current tab for each exhibit.
// example: {'LNDF-67-89-92': 'start', 'OFLN-32-38-14': 'add_scan'}
tab: {},
},
// Presentation Management
pres_mgmt: {
sync_local_config: false,
lock_config: true,
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__files: 75,
qry_limit__presentations: 25,
qry_limit__presenters: 500,
qry_limit__sessions: 100,
qry_max: 500, // This is the max number the limit is allowed to be set to.
qry__files_offset_seconds: null,
qry__files_sort: 'created_on',
qry_and__file_count: true, // Essentially it should be greater than 0
save_search_text: true,
saved_search__session: null,
require__presenter_agree: false,
require__session_agree: false,
// show_content__agree_text: false,
show_content__event_view: null,
// show__launcher_link: false,
// show__location_link: false,
show_content__location_qr: false,
show_content__presentation_description: false, // Note that this is for *all* presentations in the user interface. It is a global setting.
show_content__presenter_page_help: true,
// show_content__presenter_start: false,
show_content__presenter_view: null,
show_content__presenter_qr: false,
show_content__session_description: false,
show_content__session_files: false,
show_content__session_help: true,
show_content__session_presentations: false,
show_content__session_search_view: null,
show_content__session_search_help: true,
show_content__session_search_room_name: false,
show_content__session_view: null,
show_content__session_qr: false,
hide__session_msg: true,
hide__session_poc: true,
hide__session_poc_biography: true,
hide__presenter_biography: true,
// Only specific to lists and tables:
hide__session_li_location_field: false,
hide__session_li_poc_field: false,
hide__launcher_link_legacy: true, // Flask version
hide__launcher_link: true, // New Svelte version
hide__location_link: true,
show_content__disabled_files: false,
show_content__hidden_files: false,
show_content__hidden_presentations: false,
show_content__hidden_presenters: false,
show_content__hidden_sessions: false,
show__direct_download: false,
// No longer used. Use "hide" instead of "show". Now it is initially set in the remote event config sync.
// show_content__presentation_code: true,
// show_content__presenter_code: true,
// show_content__session_code: true,
show_menu__presenter: null,
show_menu__session: null,
show_menu__session_search: null,
show_menu__event_reports: null,
show_report: null,
// show_report__presenters_agree: false,
// show_report__recent_files: false,
// time_format: 'time_12_short', // 'time_short', 'time_12_short'
disable_submit__opt_out: true,
submit_status__opt_out: null,
device_kv: {
// 'LNDF-67-89-92': {'collapse': true},
},
location_kv: {
// 'LNDF-67-89-92': {'collapse': true},
},
},
// Speakers Management (Collection)
// 'speakers': {
// },
// other
}
// console.log(`AE Stores - App Events Local Storage Data:`, events_local_data_struct);
// This works, but does not uses local storage:
// export let ae_loc = writable(events_local_data_struct);
// This works and uses *local* storage:
export let events_loc: Writable<key_val> = persisted('ae_events_loc', events_local_data_struct);
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
/* *** BEGIN *** Initialize events_session_data_struct */
// Temporary app data. This should be stored to session storage.
// Updated 2024-03-06
let events_session_data_struct: key_val = {
ver: ver,
ver_idb: ver_idb,
log_lvl: 1,
// Shared
'ds': {
'submit_status': null,
},
'ds_loaded': {
},
'qry__enabled': 'enabled', // all, disabled, enabled
'qry__hidden': 'not_hidden', // all, hidden, not_hidden
'qry__limit': 20,
'qry__offset': 0,
// This is intended to only be temporary.
auth__person: {},
auth__entered_key: null,
auth__entered_passcode: null,
auth__kv: {
event: {},
exhibit: {},
location: {},
session: {},
presentation: {},
presenter: {},
person: {},
},
// Badge Printing
'badges': {
'fulltext_search_qry_str': null,
'search_badge_type_code': null,
'status_qry__search': null,
'use_id_li': true,
'search_status': null,
'search_complete': true,
show_form__search: true,
show_form__search_results: true,
show_form__scan: false,
qr_scan_start: true,
qr_scan_result: null,
},
// Event Files - uploads for sessions, presenters, etc
'files': {
disable_submit__event_file_obj: null,
status__submit: null,
status__file_list: null, // processing, complete
processed_file_list: [],
},
// Event Presentation Launcher (and native Electron app)
'launcher': {
ws_connect_status: null,
av_recording_status: null,
controller_cmd: null,
controller_trigger_send: null,
event_file_open: {}, // This is from the older Launcher.
native: {
},
modal__title: '',
modal__open_event_file_id: false,
modal__event_file_obj: null,
loading__session_li_status: null,
loading__session_id_status: null,
trigger_reload__event_session_obj_id: null,
trigger_reload__event_session_obj_li: null,
trigger_reload__event_location_obj_id: null,
trigger_reload__event_location_obj_li: null,
trigger__ws_connect: null,
trigger__ws_disconnect: null,
},
// Lead Retrievals (Exhibit)
'leads': {
example: true,
show_form__license: false,
show_form__search: false,
show_form__scan: false,
show_form__view_lead: false, // Set to event_exhibit_tracking_id
// show_form__view_lead: [],
show_confirm__add_lead: [],
submit_status__license: null, // 'saving', 'created', 'updated'
// create_status__license: null, // 'creating', 'created', 'updated'
// update_status__license: null, // 'updating', 'created', 'updated'
submit_status__search: null, // 'searching', 'complete'
// The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service.
entered_passcode: null,
tmp_license: {
'index': null,
// 'agree' : false, // The user must agree to the license agreement.
'email': '',
'full_name': '',
'passcode': '',
'session_count': 0,
'updated_on': new Date().toISOString()
},
entered_search_str: null,
lead_data_changed: null,
qr_scan_start: true,
qr_scan_result: null,
},
'stripe': {
'license_qty': 1,
'rental_qty': 0,
'rental_option': true,
'api_use': false,
'client_reference_id': null,
'publishable_key': 'pk_live_zqaWNDfak2eDHeqnRiyaJcFi',
'btn_payment_id': null,
'btn_1_license': 'buy_btn_1OvqWJ2gJkNsDuiNqMCWz5nG',
'btn_1_license_rental': 'buy_btn_1OvqVA2gJkNsDuiNhk9r8Io2',
'btn_3_license': 'buy_btn_1OvrI22gJkNsDuiNXjBg3c4Y',
'btn_3_license_rental': 'buy_btn_1OvrKa2gJkNsDuiNhSBCkNau',
'btn_6_license': 'buy_btn_1OvrWc2gJkNsDuiN7mnwvZNL',
'btn_6_license_rental': 'buy_btn_1OvrXP2gJkNsDuiNZpWZs3Uy',
'btn_10_license': 'buy_btn_1OvrPM2gJkNsDuiNRCMHfSuz',
'btn_10_license_rental': 'buy_btn_1OvrPs2gJkNsDuiN1nPkjPOM',
},
// Presentation Management
pres_mgmt: {
// link: {
// ae_core: true,
// pres_mgmt__launcher_id: null, // event_location_id
// pres_mgmt__location_id: null, // event_location_id
// pres_mgmt__presenter_id: null, // event_presenter_id
// pres_mgmt__reports: null, // event_id
// pres_mgmt__session_id: null, // event_session_id
// pres_mgmt__session_search: null, // event_id
// },
// presenter__url_str: null,
presenter__updated_on: null,
session_updated_on: null,
location_name_qry_str: null,
fulltext_search_qry_str: null,
status_qry__search: null,
disable_submit__event_file_obj: true,
show_form__search: true,
show_form__search_results: true,
show_content__agree_text: false,
show_content__presenter_start: false,
show_content__presentation_description: false, // Note that this is per presentation. The event_presentation_id_random should match.
show_report: null,
// show_report__presenters_agree: false,
// show_report__recent_files: false,
show_field_edit__filename: false, // For file rename
new_upload_list: null,
files_uploading_count: null,
qry_limit__files: 75,
qry_limit__presentations: 25,
qry_limit__presenters: 500,
qry_limit__sessions: 100,
show_fields__presentation: true,
show_fields__session: true,
show_modal__presenter_agree: false,
show__session_poc_profile: false,
show_modal__session_poc_agree: false,
// hide__edit_location: {},
show__edit_location: {},
show__edit_poc_person: {},
show__view_alert: {}, // key values
show__edit_alert_msg: {}, // key values
tmp__alert_msg: {}, // key values
session_qr_url: {}, // key value of session_id and URL string
status_rpt: {
recent_files: null,
presenters_agree: null,
presenters_biography: null,
},
rpt__session_no_files: true,
rpt__session_poc_agree: false, // Default to false for new events.
rpt__session_no_bio: true,
rpt__presenter_agree: true,
tmp_val__filename_no_ext: null, // For file rename
},
// Speakers Management (Collection)
// other
};
// console.log(`AE Stores - App Events Session Storage Data:`, events_session_data_struct);
export let events_sess = writable(events_session_data_struct);
/* *** BEGIN *** Initialize events_slct and events_trigger */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different events, badges, exhibits, etc. */
// Intended for temporary session storage.
// Updated 2024-03-06
let events_slct_obj_template: key_val = {
// Top level
'event_id': null,
'event_obj': {},
'event_obj_li': [],
// Sub-level event_
'abstract_id': null,
'abstract_obj': {},
'abstract_obj_li': [],
'badge_id': null,
'badge_obj': {},
'badge_obj_li': [],
'badge_template_id': null,
'badge_template_obj': {},
'badge_template_obj_li': [],
'device_id': null,
'device_obj': {},
'device_obj_li': [],
'exhibit_id': null,
'exhibit_obj': {},
'exhibit_obj_li': [],
// Rename these to badge_tracking_*?
'exhibit_tracking_id': null,
'exhibit_tracking_obj': {},
'exhibit_tracking_obj_li': [],
'file_id': null,
'file_obj': {},
'file_obj_li': [],
'event_file_obj': {},
'event_file_obj_li': [],
'location_id': null,
'location_obj': {},
'location_obj_li': [],
'person_id': null,
'person_obj': {},
'person_obj_li': [],
'presentation_id': null,
'presentation_obj': {},
'presentation_obj_li': [],
'event_presentation_obj': {},
'presenter_id': null,
'presenter_obj': {},
'presenter_obj_li': [],
'event_presenter_obj': {},
'session_id': null,
'session_obj': {},
'session_obj_li': [],
'event_session_obj': {},
'lq__presenter_obj': {}, // Testing passing a LiveQuery object around...
'auth__event_presenter_id': null,
'auth__event_presentation_id': null,
};
// console.log(`AE Stores - Selected Events Objects:`, events_slct_obj_template);
// This works, and uses *session* (not local) storage:
export let events_slct = writable(events_slct_obj_template);
// This works and uses *local* storage:
// export let events_slct: Writable<key_val> = persisted('ae_events_slct', events_slct_obj_template);
/* *** BEGIN *** Initialize events_trigger */
// Intended for temporary session storage.
// Updated 2024-03-06
export let events_trigger: any = writable(null);
// console.log(`AE Events Stores - Events Trigger:`, events_trigger);
let tmp__events_trig: key_val = {
'event_id': null,
'event_id_li': [],
'event_location_id': null,
'event_location_id_li': [],
'event_session_id': null,
'event_session_id_li': [],
'event_presentation_id': null,
'event_presentation_id_li': [],
'event_presenter_id': null,
'event_presenter_id_li': [],
};
// console.log(`AE Stores - Events Trigger:`, events_trig);
export let events_trig: Writable<key_val> = writable(tmp__events_trig);
/* *** BEGIN *** TESTING Initialize trig_resp */
// The idea behind this is for a shared (Svelte app (within Events for now)) trigger and response. In theory this could be used to monitor multiple downloads or have a universal status area. Intended for temporary session storage.
// Updated 2024-06-25
let tmp__events_trig_kv: key_val = {};
// {
// 'example-1':
// {
// 'a-rand-id-1': true,
// 'a-rand-id-2': false,
// 'a-rand-id-3': Promise.resolve('This is a test promise.'),
// },
// 'example-2':
// {
// 'a-rand-id-4': true,
// 'a-rand-id-5': false,
// 'a-rand-id-6': Promise.resolve('This is a test promise.'),
// },
// };
export let events_trig_kv = writable(tmp__events_trig_kv);

225
src/lib/ae_idaa_stores.ts Normal file
View File

@@ -0,0 +1,225 @@
import { persisted } from 'svelte-persisted-store';
import { writable } from 'svelte/store';
import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/ae_stores';
import { offset } from '@floating-ui/dom';
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2024-08-21_1646';
let ver_idb = '2024-08-21_1645';
/* *** BEGIN *** Initialize idaa_local_data_struct */
// Longer-term app data. This should be stored to *local* storage.
// Updated 2024-03-06
let idaa_local_data_struct: key_val = {
ver: ver,
ver_idb: ver_idb,
// Shared
name: 'Aether - IDAA (SvelteKit 2.x Svelte 4.x)',
title: `OSIT's Æ IDAA`, // - Dev SvelteKit`, // &AElig;
novi_uuid: null,
novi_email: null,
novi_full_name: null,
novi_admin_li: [
"2b078deb-b4e7-4203-99da-9f7cd62159a5"
],
novi_trusted_li: [
"c9ea07b5-06b0-4a43-a2d0-8d06558c8a82",
"58db22ee-4b0a-49a7-9f34-53d2ba85a84b",
],
novi_jitsi_mod_li: [
"5724aad7-6d89-47e7-8943-966fd22911bd",
],
novi_archives_base_url: "https://www.idaa.org/idaa-archives",
novi_bb_base_url: "https://www.idaa.org/idaa-bulletin-board",
novi_meetings_base_url: "https://www.idaa.org/idaa-meetings",
'ds': {},
'idaa_cfg_json': {},
// all, disabled, enabled
'qry__enabled': 'enabled',
// all, hidden, not_hidden
'qry__hidden': 'not_hidden',
'qry__limit': 20,
'qry__offset': 0,
archives: {
enabled: 'enabled', // all, disabled, enabled
hidden: 'not_hidden', // all, hidden, not_hidden
limit: 150,
offset: 0,
edit_kv: {}, // Used to track which archive objects are being edited
edit__archive_obj: null,
edit__archive_content_obj: null,
// qry__order_by: 'updated_on', // For the IDB index query
// qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query
},
bb: {
enabled: 'enabled', // all, disabled, enabled
hidden: 'not_hidden', // all, hidden, not_hidden
limit: 50,
offset: 0,
edit_kv: {}, // Used to track which post objects are being edited
edit__post_obj: null,
edit__post_comment_obj: null,
show_list__post_obj_li: true,
qry__enabled: 'enabled', // all, disabled, enabled
qry__hidden: 'not_hidden', // all, hidden, not_hidden
qry__limit: 25,
qry__offset: 0,
qry__order_by: 'updated_on', // For the IDB index query
qry__order_by_li: {'updated_on': 'DESC', 'created_on': 'DESC'}, // For the SQL query
},
recovery_meetings: {
edit_kv: {}, // Used to track which event objects are being edited
edit__event_obj: null,
qry__enabled: 'enabled', // all, disabled, enabled
qry__hidden: 'not_hidden', // all, hidden, not_hidden
qry__limit: 150,
qry__order_by: 'updated_on', // For the IDB index query; name, updated_on/created_on
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query
qry__offset: 0,
qry__fulltext_str: null,
qry__physical: null,
qry__type: null,
qry__virtual: null,
},
};
// console.log(`AE Stores - App IDAA Local Storage Data:`, idaa_local_data_struct);
// This works, but does not uses local storage:
// export let ae_loc = writable(idaa_local_data_struct);
// This works and uses *local* storage:
export let idaa_loc: Writable<key_val> = persisted('ae_idaa_loc', idaa_local_data_struct);
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
/* *** BEGIN *** Initialize idaa_session_data_struct */
// Temporary app data. This should be stored to session storage.
// Updated 2024-03-06
let idaa_session_data_struct: key_val = {
ver: ver,
ver_idb: ver_idb,
log_lvl: 1,
archives: {
qry__status: null,
show__modal_edit__archive_id: null,
show__modal_view__archive_id: null,
show__modal_edit__archive_content_id: null,
show__modal_view__archive_content_id: null,
obj_changed: false, // Used to track if the archive object has been changed in the edit view
},
bb: {
qry__status: null,
edit__post_obj: null,
show__inline_edit__post_obj: null,
show__modal_edit__post_id: null,
show__modal_view__post_id: null,
obj_changed: false, // Used to track if the post object has been changed in the edit view
// edit_kv: {}, // Used to track which post objects are being edited
},
recovery_meetings: {
qry__status: null,
qry__fulltext_str: null,
edit__event_obj: null,
status_qry__last_request_str: null,
show__modal_edit: false,
show__modal_view: false,
show__modal_edit__event_id: null,
show__modal_view__event_id: null,
obj_changed: false, // Used to track if the event object has been changed in the edit view
attend_platform: null, // 'Zoom', 'Google Meet', 'Microsoft Teams', etc.
},
};
// console.log(`AE Stores - App IDAA Session Storage Data:`, idaa_session_data_struct);
export let idaa_sess = writable(idaa_session_data_struct);
/* *** BEGIN *** Initialize idaa_slct and idaa_trig */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different idaa, badges, exhibits, etc. */
// Intended for temporary session storage.
// Updated 2024-03-06
let idaa_slct_obj_template: key_val = {
// Top level
'event_id': null,
'event_obj': {},
'event_obj_li': [],
'archive_id': null,
'archive_obj': {},
'archive_obj_li': [],
'archive_content_id': null,
'archive_content_obj': {},
'archive_content_obj_li': [],
'post_id': null,
'post_obj': {},
'post_obj_li': [],
'post_comment_id': null,
'post_comment_obj': {},
'post_comment_obj_li': [],
};
// console.log(`AE Stores - Selected IDAA Objects:`, idaa_slct_obj_template);
// This works, and uses *session* (not local) storage:
export let idaa_slct = writable(idaa_slct_obj_template);
// This works and uses *local* storage:
// export let idaa_slct: Writable<key_val> = persisted('ae_idaa_slct', idaa_slct_obj_template);
/* *** BEGIN *** Initialize idaa_trig */
// Intended for temporary session storage.
// Updated 2024-11-19
let idaa_trig_template: key_val = {
archive_id: false,
archive_content_li: false,
event_id: false,
post_id: false,
};
export let idaa_trig: any = writable(idaa_trig_template);
// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_trig);
/* *** BEGIN *** Initialize idaa_prom */
// Intended for temporary session storage.
// Updated 2024-11-19
let idaa_prom_template: key_val = {
archive_id: false,
archive_content_li: false,
event_id: false,
post_id: false,
};
export let idaa_prom: any = writable(idaa_prom_template);
// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_prom);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
// This file is used to export all the functions that are used for Aether Journals related functions.
import * as journal from "$lib/ae_journals/ae_journals__journal";
import * as journal_entry from "$lib/ae_journals/ae_journals__journal_entry";
let 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,
};
export let journals_func = export_obj;

View File

@@ -0,0 +1,186 @@
import { persisted } from 'svelte-persisted-store';
import { writable } from 'svelte/store';
import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/ae_stores';
/* *** BEGIN *** Initialize journals_local_data_struct */
// This is for longer term or sticky app data. This should be stored to *local* storage.
// Updated 2025-03-20
let 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`, // &AElig;
mode__edit: false,
mode__debug: false,
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,
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__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: {},
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: {},
},
};
// console.log(`AE Stores - App Journals Local Storage Data:`, journals_local_data_struct);
// This works and uses *local* storage:
export let journals_loc: Writable<key_val> = persisted('ae_journals_loc', journals_local_data_struct);
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
/* *** BEGIN *** Initialize journals_session_data_struct */
// Temporary app data. This is lost if the page is refreshed or using different tabs/windows. This should be stored to *session* storage.
// Updated 2025-03-20
let journals_session_data_struct: key_val = {
ver: '2024-08-20_19',
log_lvl: 1,
// Shared Triggers
trigger: null,
trigger__journal_id: null,
// trigger__journal_li: null,
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__content__journal_entry_history: false,
journal: {
edit: false,
edit_kv: {},
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: {},
},
journal_kv: {
// journal_id: {},
},
};
// console.log(`AE Stores - App Journals Session Storage Data:`, journals_session_data_struct);
export let journals_sess = writable(journals_session_data_struct);
/* *** BEGIN *** Initialize journals_slct and journals_trig */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different journals, badges, exhibits, etc. */
// Intended for temporary session storage.
// Updated 2024-08-20
let journals_slct_obj_template: key_val = {
// 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
'lq__journal_obj': {}, // Testing passing a LiveQuery object around...
};
// console.log(`AE Stores - Selected Journals Objects:`, journals_slct_obj_template);
// This works, and uses *session* (not local) storage:
export let journals_slct = writable(journals_slct_obj_template);
/* *** BEGIN *** Initialize journals_trig */
// Intended for temporary session storage.
// Updated 2025-03-16
let journals_trig_template: key_val = {
journal_id: false,
journal_entry_li: false,
};
export let journals_trig: any = writable(journals_trig_template);
// console.log(`AE Journals Stores - Journals Trigger:`, journals_trig);
/* *** BEGIN *** Initialize journals_prom */
// Intended for temporary session storage.
// Updated 2025-03-16
let journals_prom_template: key_val = {
journal_id: false,
journal_entry_li: false,};
export let journals_prom: any = writable(journals_prom_template);
// console.log(`AE Journals Stores - Journals Trigger:`, journals_prom);

View File

@@ -0,0 +1,543 @@
import Dexie, { type Table } from 'dexie';
import type { key_val } from '../ae_stores';
// li = list
// kv = key value list
// json = JSON string
// ux = user experience (mode)
// LLM = Large Language Model (AI)
// Updated 2025-03-15
export interface Journal {
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
external_id?: null|string;
import_id?: null|string;
code?: 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.
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???
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;
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...???
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
data_json?: null|key_val; // We always need to store something extra...
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
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
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;
// 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
// 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;
// JSON formatted key value pairs for multiple people: {id: name, email, etc.}
person__kv_json?: null|string;
journal_name?: null|string;
journal_location_code?: null|string;
journal_location_name?: null|string;
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|[];
// 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;
}
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
'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
'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;
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
external_id?: null|string;
import_id?: null|string;
code?: 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.
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
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;
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
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
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
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...???
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...
// 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;
// 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;
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;
// 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|[];
// 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;
}
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',
'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',
'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>;
journal_entry!: Table<Journal_Entry>;
constructor() {
super('ae_journals_db');
this.version(4).stores({
journal: `
id, journal_id,
code,
account_id,
person_id,
conference, type,
name,
start_datetime, end_datetime,
timezone,
tmp_sort_1, tmp_sort_2, tmp_sort_3,
enable, hide, priority, sort, group, created_on, updated_on`,
journal_entry: `
id, journal_entry_id,
journal_id,
code,
account_id,
template,
name,
start_datetime, end_datetime,
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();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,593 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
import { db_posts } from "$lib/ae_posts/db_posts";
let 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: any,
post_comment_id: string,
enabled?: string,
hidden?: string,
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}`);
}
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
let 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
// });
}
return post_comment_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
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: any,
for_obj_type: string,
for_obj_id: string,
enabled?: string,
hidden?: string,
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}`);
}
let params_json: key_val = {};
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
let 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) {
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);
}
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: 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 (!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
let 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) {
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;
}
// 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: 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}`);
}
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) {
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);
}
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: 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);
}
// 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
let 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;
}
}
// This function will loop through the post_comment_obj_li and save each one to the DB.
// Updated 2024-09-25
export function db_save_ae_obj_li__post_comment(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__post_comment() ***`);
}
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_posts.comment.put({
id: obj.post_comment_id_random,
post_comment_id: obj.post_comment_id_random,
post_id: obj.post_id_random,
external_person_id: obj.external_person_id,
name: obj.name,
title: obj.title, // Switching to name instead of title
// summary: obj.summary,
content: obj.content,
anonymous: obj.anonymous,
full_name: obj.full_name,
email: obj.email,
notify: obj.notify,
linked_li_json: obj.linked_li_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,
tmp_sort_1: `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(3, '0') ?? ''}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${obj.sort?.toString().padStart(2, '0') ?? ''}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
});
if (log_lvl) {
console.log(`Put obj with ID: ${obj.post_comment_id_random} or ${id_random}`);
}
} catch (error) {
let status = `Failed to put ${obj.post_comment_id_random}: ${error}`;
console.log(status);
return false;
}
});
return true;
}
}
// Updated 2025-06-04
export const properties_to_save = [
'id',
'post_comment_id',
// 'post_comment_id_random',
'post_id',
// 'post_id_random',
'external_person_id',
'name',
'title',
'content',
'anonymous',
'full_name',
'email',
'notify',
'linked_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',
// 'tmp_sort_a',
// 'tmp_sort_b',
// From SQL view
];
// Updated 2025-06-04
export async function process_ae_obj__post_comment_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__post_comment_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj post_comment:`, obj);
let processed_obj = {
id: obj.post_comment_id_random,
post_comment_id: obj.post_comment_id_random,
post_comment_id_random: obj.post_comment_id_random,
post_id: obj.post_id_random,
post_id_random: obj.post_id_random,
external_person_id: obj.external_person_id,
name: obj.name,
title: obj.title,
content: obj.content,
anonymous: obj.anonymous,
full_name: obj.full_name,
email: obj.email,
notify: obj.notify,
linked_li_json: obj.linked_li_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,
// 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}`,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}

View File

@@ -0,0 +1,40 @@
// 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,
// qry__post,
db_save_ae_obj_li__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,
// qry__post_comment,
db_save_ae_obj_li__post_comment,
} from "$lib/ae_posts/ae_posts__post_comment";
let 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,
db_save_ae_obj_li__post: db_save_ae_obj_li__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,
db_save_ae_obj_li__post_comment: db_save_ae_obj_li__post_comment,
};
export let posts_func = export_obj;

View File

@@ -0,0 +1,141 @@
import Dexie, { type Table } from 'dexie';
import type { key_val } from '../ae_stores';
// li = list
// kv = key value list
// Updated 2024-11-13
export interface Post {
id: string;
// id_random: string;
post_id: string;
// post_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;
topic_id?: string;
topic?: string; // or topic_name?
topic_name?: 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;
enable_comments?: null|boolean;
archive?: null|boolean;
archive_on?: null|Date;
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;
// 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;
// Placeholder for generated temp data
hosted_file_id_li?: null|Array<string>;
hosted_file_obj_li?: null|Array<any>;
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;
post_id: string;
// post_id_random: string;
external_person_id?: null|string; // For IDAA this is the Novi UUID
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;
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;
// Generated fields for sorting locally only
tmp_sort_1?: null|string;
tmp_sort_2?: null|string;
// 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<Post>;
comment!: Table<Post_Comment>;
constructor() {
super('ae_posts_db');
this.version(1).stores({
post: `
id, post_id,
account_id,
topic_id, topic,
name,
title,
full_name, email,
archive, archive_on,
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: `
id, post_comment_id,
post_id,
name,
title,
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();

View File

@@ -0,0 +1,350 @@
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_sponsorships } from "$lib/ae_sponsorships/db_sponsorships";
// import { liveQuery } from "dexie";
// import { db_core } from "$lib/db_core";
let ae_promises: key_val = {}; // Promise<any>;
// 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: 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}`);
}
let 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(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) {
// This is expecting a list
db_save_ae_obj_li__sponsorship_cfg({
obj_type: 'sponsorship_cfg',
obj_li: [sponsorship_cfg_obj_get_result]
});
}
return sponsorship_cfg_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
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);
}
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: any,
sponsorship_id: string,
try_cache: boolean,
log_lvl: number
}
) {
if (log_lvl) {
console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
}
let 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(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) {
// This is expecting a list
db_save_ae_obj_li__sponsorship({
obj_type: 'sponsorship',
obj_li: [sponsorship_obj_get_result]
});
}
return sponsorship_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
if (log_lvl) {
console.log('ae_promises.load__sponsorship_obj:', 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: any,
for_obj_type: string,
for_obj_id: string,
inc_content_li?: boolean,
enabled?: string,
hidden?: string,
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}`);
}
let 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(function (sponsorship_obj_li_get_result) {
if (sponsorship_obj_li_get_result) {
if (try_cache) {
db_save_ae_obj_li__sponsorship({
obj_type: 'sponsorship',
obj_li: sponsorship_obj_li_get_result
});
}
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);
}
return ae_promises.load__sponsorship_obj_li;
}
async function handle_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: 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() ***');
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;
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;
}
// Updated 2025-01-15
export function db_save_ae_obj_li__sponsorship(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__sponsorship() ***`);
}
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_sponsorships.sponsorship.put({
id: obj.sponsorship_id_random,
sponsorship_id: obj.sponsorship_id_random,
account_id: obj.account_id_random,
external_person_id: obj.external_person_id,
topic_id: obj.topic_id,
topic: obj.topic,
topic_name: obj.topic_name,
name: obj.title,
title: obj.title, // Switching to name instead of title
// summary: obj.summary,
content: obj.content,
anonymous: obj.anonymous,
full_name: obj.full_name,
email: obj.email,
notify: obj.notify,
enable_comments: obj.enable_comments,
archive: obj.archive,
archive_on: obj.archive_on,
linked_li_json: obj.linked_li_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,
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}`,
// From SQL view
sponsorship_comment_count: obj.sponsorship_comment_count,
// A key value list of the comments
// sponsorship_comment_kv: obj.sponsorship_comment_kv,
// sponsorship_comment_li: obj.sponsorship_comment_li,
});
if (log_lvl) {
console.log(`Put obj with ID: ${obj.sponsorship_id_random} or ${id_random}`);
}
} catch (error) {
let status = `Failed to put ${obj.sponsorship_id_random}: ${error}`;
console.log(status);
return false;
}
});
return true;
}
}
let 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,
handle_download_export__sponsorship: handle_download_export__sponsorship,
db_save_ae_obj_li__sponsorship: db_save_ae_obj_li__sponsorship
};
export let spons_func = export_obj;

View File

@@ -0,0 +1,135 @@
import Dexie, { type Table } from 'dexie';
import type { key_val } from '../ae_stores';
// li = list
// kv = key value list
// Updated 2025-01-15
export interface Sponsorship {
id: string;
// id_random: string;
sponsorship_id: string;
// sponsorship_id_random: string;
account_id: string;
// account_id_random: string;
organization_id?: null|string;
person_id?: null|string;
poc_person_id?: null|string;
poc_json?: null|string;
name: null|string;
name_override: null|string;
description?: 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;
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;
amount?: null|number; // In dollars
questions_li_json?: null|string;
agree?: null|boolean; // Catchall agree or consent
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;
// Generated fields for sorting locally only
tmp_sort_1?: null|string;
tmp_sort_2?: null|string;
// 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;
account_id: string;
// account_id_random: string;
for_type?: null|string;
for_id?: null|number;
level_li_json?: null|string;
option_li_json?: null|string;
schedule_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;
// 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<Sponsorship>;
cfg!: Table<Sponsorship_Cfg>;
constructor() {
super('ae_sponsorships_db');
this.version(1).stores({
sponsorship: `
id, sponsorship_id,
account_id,
poc_person_id,
name, name_override,
level_num, level_str, amount,
agree,
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on], [created_on+updated_on]`,
cfg: `
id, sponsorship_cfg_id,
account_id,
for_type, for_id`,
});
}
}
export const db_sponsorships = new MySubClassedDexie();

535
src/lib/ae_stores.ts Normal file
View File

@@ -0,0 +1,535 @@
import { persisted } from 'svelte-persisted-store';
import { readable, writable } from 'svelte/store';
import type { Readable, Writable } from 'svelte/store';
import { PUBLIC_TESTING, PUBLIC_AE_API_PROTOCOL, PUBLIC_AE_API_SERVER, PUBLIC_AE_API_BAK_SERVER, PUBLIC_AE_API_PORT, PUBLIC_AE_API_PATH, PUBLIC_AE_API_SECRET_KEY, PUBLIC_AE_API_CRUD_SUPER_KEY, PUBLIC_AE_NO_ACCOUNT_ID, PUBLIC_AE_NO_ACCOUNT_ID_TOKEN, PUBLIC_AE_ACCOUNT_ID, PUBLIC_AE_EVENT_ID, PUBLIC_AE_SPONSORSHIP_CFG_ID } from '$env/static/public';
console.log(`AE Stores - PUBLIC_TESTING:`, PUBLIC_TESTING);
const api_server_fqdn = PUBLIC_AE_API_SERVER; // 'api.oneskyit.com'
const api_base_url = `${PUBLIC_AE_API_PROTOCOL}://${PUBLIC_AE_API_SERVER}:${PUBLIC_AE_API_PORT}${PUBLIC_AE_API_PATH}`;
const api_base_url_bak = `${PUBLIC_AE_API_PROTOCOL}://${PUBLIC_AE_API_BAK_SERVER}:${PUBLIC_AE_API_PORT}${PUBLIC_AE_API_PATH}`;
const api_secret_key = PUBLIC_AE_API_SECRET_KEY;
const api_crud_super_key = PUBLIC_AE_API_CRUD_SUPER_KEY;
// const ae_account_id = PUBLIC_AE_ACCOUNT_ID;
let ae_account_id: null|string = null;
const ae_no_account_id = PUBLIC_AE_NO_ACCOUNT_ID;
const ae_no_account_id_token = PUBLIC_AE_NO_ACCOUNT_ID_TOKEN;
const ae_event_id = PUBLIC_AE_EVENT_ID;
const ae_sponsorship_cfg_id = PUBLIC_AE_SPONSORSHIP_CFG_ID;
// import { getStores, navigating, page, updated } from '$app/stores';
// import { assets, base, resolveRoute } from '$app/paths';
// console.log(page.path); // Everything after the domain name
// console.log(import.meta.env.MODE);
// console.log(import.meta.env.BASE_URL);
// Export the key_val type for use in other files.
export type key_val = {
[key: string]: any; // variable key
// name: string;
};
// export type key_val = key_val;
// import { html__not_set, classes__events_pres_mgmt_menu } from './ae_string_snippets';
import {string_snippets} from './ae_string_snippets';
export let ae_snip = string_snippets;
// export let ae_snip =
// {
// 'not_set': html__not_set,
// 'classes__events_pres_mgmt_menu': classes__events_pres_mgmt_menu
// };
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2025-05-01_1445'; // KEEP: 2025-05-01_1445
let ver_idb = '2025-05-01_1445'; // Not currently used
// *** BEGIN *** Longer-term app data. This should be stored to local storage.
const ae_app_local_data_defaults: key_val = {
last_page_reload: null,
// last_idb_reload: null,
// last_cache_refresh: null, // Date.now()
last_cache_refresh: Date.now(),
cache_expired: false,
ver: ver, // ver, // '2025-04-18_1100',
ver_idb: ver_idb, // '2025-04-18_1100',
name: 'Aether - App Hub (SvelteKit 2.x Svelte 4.x)',
theme: 'light',
theme_mode: 'light',
theme_name: 'nouveau', // wintry
iframe: false,
// disable_sys_header: false,
// disable_sys_nav: false,
// disable_sys_footer: false,
browser_type: null, // Safari needs help with scrolling correctly in iframes.
title: `OSIT's Æ`, // - Dev SvelteKit`, // &AElig;
// debug_menu: false, // Flag show debug menu.
debug_mode: false, // Flag to know if we should be in debug mode and show show debug options.
edit_mode: false, // Flag to know if we should be in edit mode and show edit options.
adv_mode: false, // Flag to know if we should be in advanced mode and show advanced options.
// sys_menu: true, // Flag show system menu.
sync_local_config: true, // Flag to know if we should sync local config with the remote API server.
'account_id': ae_account_id, // OSIT Demo _XY7DXtc9MY
'account_code': 'not_set',
'account_name': 'Account Name Not Set',
'allow_access': true, // Set to key site key was used, otherwise set to true.
'site_domain': null, // https://example.com, https://dev.example.com, etc.
'site_access_key': null, // This is the general site access key
'site_domain_access_key': null, // This is specific to a (sub)domain.
'site_cfg_json': {
slct__event_id: null,
slct__event_badge_template_id: null,
slct__sponsorship_cfg_id: null,
header_image_path: null,
},
// The site access codes can be pulled from the site records for an account.
'site_access_code_kv': {
// 'manager': '10240',
'administrator': null,
'trusted': null,
'public': 'public1980',
'authenticated': 'auth1980'
},
// 'manager_passcode': '10240',
// 'administrator_passcode': '11500',
// 'trusted_passcode': '19111',
// 'authenticated_passcode': 'auth2024',
access_type: 'anonymous',
administrator_access: false,
trusted_access: false,
public_access: false,
authenticated_access: false,
anonymous_access: true,
user_email: null, // Currently used with Sponsorships only?
user_access_type: null, // Used to revert back to the user's access type after quick access (temporarily escalate permissions) turned off.
// Added 2025-04-04
person_id: null, // The current person_id of the logged-in user (if any)
person: {
// WARNING: We need to add some logic on sign in to only include needed fields. 2025-08-12
id: null, // The current person_id of the logged-in user
// profile_id: null, // The current person_profile_id of the logged-in user
// pronouns: null,
// informal_name: null,
given_name: null,
// family_name: null,
// professional_title: null,
full_name: null, // convenience
full_name_override: null, // was called display_name
// affiliations: null,
primary_email: null, // The primary email of the logged-in person/user
user_id: null, // The user ID of the logged-in user
qry_limit__people: 150,
show_content__person_page_help: false,
},
// Added 2025-04-04
user_id: null, // The current user_id of the logged-in user (if any)
user: {
id: null, // The current user_id of the logged-in user
username: null,
name: null,
email: null, // The email of the logged-in user
allow_auth_key: null, // For sign in without password
super: false, // Is the user a super user
manager: false, // Is the user a global manager (can manage accounts and users)
administrator: false, // Is the user an account administrator
verified: false, // Is the user verified
public: false, // Is the user a public user (can view public content)
person_id: null, // The person ID of the logged-in user
access_type: null, // The access type of the logged-in user
qry_limit__users: 100,
},
'qry__enabled': 'enabled', // all, disabled, enabled
'qry__hidden': 'not_hidden', // all, hidden, not_hidden
'qry__limit': 20,
'qry__offset': 0,
qr_scanner_version: 'one',
'admin': {
show_element__sql_qry: false,
show_element__sql_qry_results: false,
},
sys_menu: {
hide: false,
expand: false,
hide_access_type: false,
expand_access_type: false,
hide_edit_mode: false,
expand_edit_mode: false,
hide_user: false,
expand_user: false,
hide_theme: false,
expand_theme: false,
hide_app_cfg: false,
expand_app_cfg: false,
},
debug_menu: {
hide: false,
expand: false,
// hide_quick_info: true
},
app_cfg: {
show_element__header: false,
show_element__footer: false,
show_element__menu: false,
show_element__menu_btn: true,
show_element__access_type: true,
show_element__passcode_input: true,
show_element__cfg: true,
show_element__cfg_detail: false,
show_element__sign_in_out: true, // Show the sign-in/out button in the UI
show_opt__debug: true,
show_opt__permissions: true,
show_opt__reset: true,
show_opt__sync: true,
show_opt__theme: true,
show_opt__utilities: true,
},
files: {
processed_file_kv: {},
uploaded_file_kv: {},
video_clip_file_kv: {},
add_to_use_files_method: 'upload', // upload, select
},
'ds': {},
'hub': {
'show_element__cfg': true,
'show_element__cfg_detail': false,
'show_element__access_type': true,
'theme_mode': 'light',
'theme_name': 'wintry', // wintry
'classes__form': 'border border-surface-200 p-4 space-y-4 rounded-container',
'qr': {},
},
'mod': {
'archives': {},
'events': {
'event_id': null,
show_edit__event_presenter_obj: false,
show_list__event_presenter_obj_li: true,
show_view__event_presenter_obj: false,
submit_status: null, // 'saving', 'created', 'updated'
// Badge Printing
// Lead Retrievals
// Presentation Management
// Speakers Management
'default_session_id': null, // Assign to presenters by default
// other
},
'journals': {},
'posts': {},
'sponsorships': {
'cfg_id': ae_sponsorship_cfg_id,
for_type: null,
for_id: null,
level_guest_max_li: {
0: 0,
1: 4, // CHOW 2024 - Friend
2: 8, // CHOW 2024 - Supporter
3: 8, // CHOW 2024 - Advocate
4: 8, // CHOW 2024 - Champion
5: 8, // CHOW 2024 - Presenting Partner
6: 16, // CHOW 2024 - Signature Partner
7: 16, // CHOW 2024 - Premier Partner
},
show_edit__sponsorship_obj: false,
show_list__sponsorship_obj_li: true,
show_view__sponsorship_obj: false,
show_question__accommodations: false,
submit_status: null, // 'saving', 'created', 'updated'
},
// testing: {},
},
// testing: true,
// ver_testing: true,
}
// let ae_app_local_data_struct: key_val = {
// ...ae_app_local_data_defaults,
// };
// // {
// // // ...ae_app_local_data_defaults,
// // };
// // console.log(`AE Stores - App Local Storage Data:`, ae_app_local_data_struct);
// if (!ae_app_local_data_defaults?.ver_testing) {
// console.log(`TEST: AE Stores - ver_testing missing:`, ae_app_local_data_defaults);
// // ae_app_local_data_struct = {
// // ...ae_app_local_data_defaults,
// // ...ae_app_local_data_struct,
// // };
// } else {
// console.log(`TEST: AE Stores - ver_testing found`);
// }
// if (ae_app_local_data_struct?.ver !== ae_app_local_data_defaults?.ver) {
// console.log(`TEST: AE Stores - ver not match:`, ae_app_local_data_struct);
// ae_app_local_data_struct = {
// ...ae_app_local_data_defaults,
// };
// } else {
// console.log(`TEST: AE Stores - ver match: ${ae_app_local_data_struct.ver} === ${ae_app_local_data_defaults.ver}`);
// }
// if (!ae_app_local_data_struct?.app_cfg) {
// console.log(`TEST: AE Stores - app_cfg missing:`, ae_app_local_data_struct);
// ae_app_local_data_struct = {
// ...ae_app_local_data_defaults,
// ...ae_app_local_data_struct,
// };
// }
// This works, but does not uses local storage:
// export let ae_loc = writable(ae_app_local_data_struct);
// This works and uses local storage:
export let ae_loc: Writable<key_val> = persisted('ae_loc', ae_app_local_data_defaults);
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
// *** BEGIN *** Temporary app data. This should be stored to session storage.
let ae_app_session_data_defaults: key_val = {
// ver: '2025-04-18_1335', // ver, // '2025-04-18_1100',
ver: ver,
ver_idb: ver_idb,
log_lvl: 0,
disable_sys_header: false,
disable_sys_nav: false,
disable_sys_footer: false,
sys_menu: {
expand: false,
focus_passcode_input: false,
},
debug_menu: {
hide_quick_info: true
},
app_cfg: {
show_element__passcode_input: true,
},
'ds': {
'submit_status': null,
},
'ds_loaded': {
},
'files': {
disable_submit__hosted_file_obj: false,
processed_file_kv: {},
uploaded_file_kv: {},
video_clip_file_kv: {},
processed_file_list: [],
// uploaded_file_list: [],
video_clip_file_list: [],
submit_status: null, // 'saving', 'created', 'updated', 'saved'
clip_complete: null,
},
'hub': {
'show_xyz': null,
'account_id_qry_status': null,
'event_badge_id_status_qry__search': null,
'event_presenter_id_qry_status': null,
'site_domain_id_qry_status': null,
'sponsorship_id_qry_status': null,
'sponsorship_cfg_id_qry_status': null,
'qr': {},
},
'mod': {
'archives': {},
'events': {
// Badge Printing
// Lead Retrievals
// Presentation Management
// Speakers Management
// other
},
'journals': {},
'posts': {},
'sponsorships': {
disable_submit__sponsorship_obj: false,
slct__level_num: 0,
show_question__accommodations: false,
submit_status: null, // 'saving', 'created', 'updated', 'saved'
},
'testing': {},
},
'person': {
show_report__person_li: false,
qry_limit__people: 100,
},
show__modal_change_password: false,
'download': {},
// For API download and upload progress status per file.
'api_download_kv': {},
// Example: {example_file_id: {status: 'downloading', endpoint: '/event/file/abc123/download', filename: 'example_file_name.ext', size_total: 0, size_loaded: 0, percent_completed: 0}}
'api_upload_kv': {}, // {example_temp_id: {status: 'uploading', endpoint: '/event/file/abc123/upload', filename: 'example_file_name.ext', size_total: 0, size_loaded: 0, percent_completed: 0}}
test: true,
};
// console.log(`AE Stores - App Session Storage Data:`, ae_app_session_data_defaults);
export let ae_sess = writable(ae_app_session_data_defaults);
// *** BEGIN *** Temporary API data. This should be stored to session storage.
export let ae_api_data_struct: key_val = {
'ver': '2024-08-11_11',
'fqdn': api_server_fqdn,
'base_url': api_base_url,
'base_url_bak': api_base_url_bak,
'api_secret_key': api_secret_key, // 'YOUR_API_SECRET_KEY',
'api_secret_key_bak': api_secret_key, // 'YOUR_API_SECRET_KEY',
'api_crud_super_key': api_crud_super_key, // 'YOUR_SUPER_KEY' 'zp5PtX4zUsI'
'headers': {},
'account_id': ae_account_id,
};
let ae_api_headers: key_val = {};
ae_api_headers['Access-Control-Allow-Origin'] = '*';
ae_api_headers['Content-Yype'] = 'application/json';
ae_api_headers['x-aether-api-key'] = ae_api_data_struct.api_secret_key;
ae_api_headers['x-aether-api-token'] = 'fake-temp-token';
ae_api_headers['x-aether-api-expire-on'] = '';
if (ae_account_id) {
ae_api_headers['x-account-id'] = ae_account_id;
} else {
// ae_api_headers['x-account-id'] = ;
}
if (ae_no_account_id) {
ae_api_headers['x-no-account-id'] = ae_no_account_id;
}
ae_api_data_struct['headers'] = ae_api_headers;
// console.log(`AE Stores - API Data:`, ae_api_data_struct);
export let ae_api = writable(ae_api_data_struct);
// *** BEGIN *** Trigger to update the slct variables and other things.
let ae_trig_template: key_val = {};
export let ae_trig = writable(ae_trig_template);
/* *** BEGIN *** Initialize slct and slct_trigger */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different accounts, events, sponsorships, etc. */
// Intended for temporary session storage.
// Updated 2024-03-15
let slct_obj_template: key_val = {
'account_id': ae_account_id,
'account_obj': {},
'event_id': null,
'event_obj': {},
'event_obj_li': [],
// 'event_exhibit_id': null,
// 'event_exhibit_obj': {},
// 'event_exhibit_obj_li': [],
'event_presentation_id': null,
'event_presentation_obj': {},
'event_presentation_obj_li': [],
'event_presenter_id': null,
'event_presenter_obj': {},
'event_presenter_obj_li': [],
'event_session_id': null,
'event_session_obj': {},
'event_session_obj_li': [],
'sponsorship_id': null,
'sponsorship_obj': {},
'sponsorship_obj_li': [],
'sponsorship_cfg_id': ae_sponsorship_cfg_id,
'sponsorship_cfg_obj': {},
'sponsorship_cfg_obj_li': [],
'post_id': null,
'post_obj': {},
'post_obj_li': [],
'post_comment_id': null,
'post_comment_obj': {},
'post_comment_obj_li': []
};
// console.log(`AE Stores - Selected Objects:`, slct_obj_template);
// This works, and uses *session* (not local) storage:
export let slct = writable(slct_obj_template);
// This works and uses *local* storage:
// export let slct: Writable<key_val> = persisted('ae_slct', slct_obj_template);
/* *** BEGIN *** Initialize slct_trigger */
// Intended for temporary session storage.
// Updated 2024-02-27
export let slct_trigger: any = writable(null);
// console.log(`AE Stores - Selected Trigger:`, slct_trigger);
/* *** BEGIN *** Create time variable */
// Updated 2020
export const time = readable(new Date(), function start(set) {
const interval = setInterval(() => {
set(new Date());
}, 1000);
return function stop() {
clearInterval(interval);
};
});

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