@trops/dash-core 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,10 +18,14 @@ var require$$8 = require('https');
18
18
  var require$$0$2 = require('@modelcontextprotocol/sdk/client/index.js');
19
19
  var require$$1$3 = require('@modelcontextprotocol/sdk/client/stdio.js');
20
20
  var require$$2$3 = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
21
- var require$$2$5 = require('os');
22
- var require$$3$2 = require('adm-zip');
21
+ var require$$2$4 = require('algoliasearch');
22
+ var require$$3$2 = require('node:path');
23
+ var require$$0$3 = require('openai');
24
+ require('live-plugin-manager');
25
+ var require$$2$6 = require('os');
26
+ var require$$3$3 = require('adm-zip');
23
27
  var require$$4$1 = require('url');
24
- var require$$2$4 = require('vm');
28
+ var require$$2$5 = require('vm');
25
29
 
26
30
  function getDefaultExportFromCjs (x) {
27
31
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -418,11 +422,98 @@ var registryEvents$1 = {
418
422
  REGISTRY_CHECK_UPDATES,
419
423
  };
420
424
 
425
+ /**
426
+ * Event Constants File
427
+ *
428
+ * This file contains event constants that may be used as a type ahead reference for listeners.
429
+ */
430
+
431
+ const ALGOLIA_LIST_INDICES$1 = "algolia-list-indices";
432
+ const ALGOLIA_LIST_INDICES_COMPLETE = "algolia-list-indices-complete";
433
+ const ALGOLIA_LIST_INDICES_ERROR = "algolia-list-indices-error";
434
+
435
+ const ALGOLIA_ANALYTICS_FOR_QUERY$1 = "algolia-analytics-for-query";
436
+ const ALGOLIA_ANALYTICS_FOR_QUERY_COMPLETE =
437
+ "algolia-analytics-for-query-complete";
438
+ const ALGOLIA_ANALYTICS_FOR_QUERY_ERROR = "algolia-analytics-for-query-error";
439
+
440
+ const ALGOLIA_SAVE_OBJECTS = "algolia-save-objects";
441
+ const ALGOLIA_SAVE_OBJECTS_COMPLETE = "algolia-save-objects-complete";
442
+ const ALGOLIA_SAVE_OBJECTS_ERROR = "algolia-save-objects-error";
443
+
444
+ const ALGOLIA_PARTIAL_UPDATE_OBJECTS$1 = "algolia-partial-update-objects";
445
+ const ALGOLIA_PARTIAL_UPDATE_OBJECTS_COMPLETE =
446
+ "algolia-partial-update-objects-complete";
447
+ const ALGOLIA_PARTIAL_UPDATE_OBJECTS_ERROR =
448
+ "algolia-partial-update-objects-error";
449
+ const ALGOLIA_PARTIAL_UPDATE_OBJECTS_UPDATE =
450
+ "algolia-partial-update-objects-update";
451
+
452
+ const ALGOLIA_CREATE_BATCH$1 = "algolia-create-batch";
453
+ const ALGOLIA_CREATE_BATCH_COMPLETE = "algolia-create-batch-complete";
454
+ const ALGOLIA_CREATE_BATCH_UPDATE = "algolia-create-batch-update";
455
+ const ALGOLIA_CREATE_BATCH_ERROR = "algolia-create-batch-error";
456
+
457
+ const ALGOLIA_BROWSE_OBJECTS$1 = "algolia-browse-objects";
458
+ const ALGOLIA_BROWSE_OBJECTS_COMPLETE = "algolia-browse-objects-complete";
459
+ const ALGOLIA_BROWSE_OBJECTS_UPDATE = "algolia-browse-objects-update";
460
+ const ALGOLIA_BROWSE_OBJECTS_ERROR = "algolia-browse-objects-error";
461
+
462
+ var algoliaEvents$1 = {
463
+ ALGOLIA_LIST_INDICES: ALGOLIA_LIST_INDICES$1,
464
+ ALGOLIA_LIST_INDICES_COMPLETE,
465
+ ALGOLIA_LIST_INDICES_ERROR,
466
+ ALGOLIA_ANALYTICS_FOR_QUERY: ALGOLIA_ANALYTICS_FOR_QUERY$1,
467
+ ALGOLIA_ANALYTICS_FOR_QUERY_COMPLETE,
468
+ ALGOLIA_ANALYTICS_FOR_QUERY_ERROR,
469
+ ALGOLIA_SAVE_OBJECTS,
470
+ ALGOLIA_SAVE_OBJECTS_COMPLETE,
471
+ ALGOLIA_SAVE_OBJECTS_ERROR,
472
+ ALGOLIA_PARTIAL_UPDATE_OBJECTS: ALGOLIA_PARTIAL_UPDATE_OBJECTS$1,
473
+ ALGOLIA_PARTIAL_UPDATE_OBJECTS_COMPLETE,
474
+ ALGOLIA_PARTIAL_UPDATE_OBJECTS_ERROR,
475
+ ALGOLIA_PARTIAL_UPDATE_OBJECTS_UPDATE,
476
+ ALGOLIA_CREATE_BATCH: ALGOLIA_CREATE_BATCH$1,
477
+ ALGOLIA_CREATE_BATCH_COMPLETE,
478
+ ALGOLIA_CREATE_BATCH_ERROR,
479
+ ALGOLIA_CREATE_BATCH_UPDATE,
480
+ ALGOLIA_BROWSE_OBJECTS: ALGOLIA_BROWSE_OBJECTS$1,
481
+ ALGOLIA_BROWSE_OBJECTS_COMPLETE,
482
+ ALGOLIA_BROWSE_OBJECTS_ERROR,
483
+ ALGOLIA_BROWSE_OBJECTS_UPDATE,
484
+ };
485
+
486
+ const MENU_ITEMS_SAVE$1 = "menu-items-save";
487
+ const MENU_ITEMS_SAVE_COMPLETE = "menu-items-save-complete";
488
+ const MENU_ITEMS_SAVE_ERROR = "menu-items-save-error";
489
+
490
+ const MENU_ITEMS_LIST$1 = "menu-items-list";
491
+ const MENU_ITEMS_LIST_COMPLETE = "menu-items-list-complete";
492
+ const MENU_ITEMS_LIST_ERROR = "menu-items-list-error";
493
+
494
+ var menuItemEvents$1 = {
495
+ MENU_ITEMS_LIST: MENU_ITEMS_LIST$1,
496
+ MENU_ITEMS_LIST_COMPLETE,
497
+ MENU_ITEMS_LIST_ERROR,
498
+ MENU_ITEMS_SAVE: MENU_ITEMS_SAVE$1,
499
+ MENU_ITEMS_SAVE_COMPLETE,
500
+ MENU_ITEMS_SAVE_ERROR,
501
+ };
502
+
503
+ const OPENAI_DESCRIBE_IMAGE$1 = "openai-describe-image";
504
+ const OPENAI_DESCRIBE_IMAGE_COMPLETE = "openai-describe-image-success";
505
+ const OPENAI_DESCRIBE_IMAGE_ERROR = "openai-describe-image-error";
506
+
507
+ var openaiEvents$1 = {
508
+ OPENAI_DESCRIBE_IMAGE: OPENAI_DESCRIBE_IMAGE$1,
509
+ OPENAI_DESCRIBE_IMAGE_COMPLETE,
510
+ OPENAI_DESCRIBE_IMAGE_ERROR,
511
+ };
512
+
421
513
  /**
422
514
  * Events
423
515
  *
424
- * Core event constants used by the framework.
425
- * Template-specific events (algolia, openai, menuItem) live in the template repo.
516
+ * All event constants used by the framework.
426
517
  */
427
518
 
428
519
  const secureStorageEvents = secureStorageEvents$1;
@@ -435,12 +526,15 @@ const dialogEvents = dialogEvents$1;
435
526
  const providerEvents = providerEvents$1;
436
527
  const mcpEvents = mcpEvents$1;
437
528
  const registryEvents = registryEvents$1;
529
+ const algoliaEvents = algoliaEvents$1;
530
+ const menuItemEvents = menuItemEvents$1;
531
+ const openaiEvents = openaiEvents$1;
438
532
 
439
533
  const publicEvents = {
440
534
  ...dataEvents,
441
535
  };
442
536
 
443
- var events$6 = {
537
+ var events$8 = {
444
538
  public: publicEvents,
445
539
  ...secureStorageEvents,
446
540
  ...workspaceEvents,
@@ -452,6 +546,9 @@ var events$6 = {
452
546
  ...providerEvents,
453
547
  ...mcpEvents,
454
548
  ...registryEvents,
549
+ ...algoliaEvents,
550
+ ...menuItemEvents,
551
+ ...openaiEvents,
455
552
  };
456
553
 
457
554
  /**
@@ -461,7 +558,7 @@ var events$6 = {
461
558
  */
462
559
 
463
560
  const { dialog } = require$$0;
464
- const events$5 = events$6;
561
+ const events$7 = events$8;
465
562
 
466
563
  const showDialog$1 = async (win, message, allowFile, extensions = ["*"]) => {
467
564
  const properties =
@@ -475,7 +572,7 @@ const showDialog$1 = async (win, message, allowFile, extensions = ["*"]) => {
475
572
  };
476
573
 
477
574
  const fileChosenError$1 = (win, message) => {
478
- win.webContents.send(events$5.CHOOSE_FILE_ERROR, message);
575
+ win.webContents.send(events$7.CHOOSE_FILE_ERROR, message);
479
576
  };
480
577
 
481
578
  var dialogController$1 = {
@@ -489,7 +586,7 @@ var dialogController$1 = {
489
586
 
490
587
  const { safeStorage: safeStorage$1 } = require$$0;
491
588
  const Store = require$$1;
492
- const events$4 = events$6;
589
+ const events$6 = events$8;
493
590
 
494
591
  const schema = {
495
592
  appId: {
@@ -502,7 +599,7 @@ const schema = {
502
599
 
503
600
  const isEncryptionAvailable$1 = (win) => {
504
601
  const result = safeStorage$1.isEncryptionAvailable();
505
- win.webContents.send(events$4.SECURE_STORE_ENCRYPTION_CHECK_COMPLETE, result);
602
+ win.webContents.send(events$6.SECURE_STORE_ENCRYPTION_CHECK_COMPLETE, result);
506
603
  };
507
604
 
508
605
  const encryptString = (win, str) => {
@@ -547,10 +644,10 @@ var secureStoreController$1 = {
547
644
  getData: getData$1,
548
645
  };
549
646
 
550
- const path$b = require$$1$1;
647
+ const path$e = require$$1$1;
551
648
  const {
552
649
  readFileSync,
553
- writeFileSync: writeFileSync$4,
650
+ writeFileSync: writeFileSync$5,
554
651
  existsSync,
555
652
  mkdirSync,
556
653
  openSync,
@@ -562,10 +659,10 @@ const {
562
659
  lstatSync,
563
660
  } = require$$2;
564
661
 
565
- function ensureDirectoryExistence$2(filePath) {
662
+ function ensureDirectoryExistence$3(filePath) {
566
663
  try {
567
664
  // isDirectory
568
- var dirname = path$b.dirname(filePath);
665
+ var dirname = path$e.dirname(filePath);
569
666
  // check if the directory exists...return true
570
667
  // if not, we can pass in the dirname as the filepath
571
668
  // and check each directory recursively.
@@ -573,14 +670,14 @@ function ensureDirectoryExistence$2(filePath) {
573
670
  return true;
574
671
  }
575
672
  // recursion...
576
- ensureDirectoryExistence$2(dirname);
673
+ ensureDirectoryExistence$3(dirname);
577
674
  mkdirSync(dirname);
578
675
  } catch (e) {
579
676
  console.log("ensure directory " + e.message);
580
677
  }
581
678
  }
582
679
 
583
- function checkDirectory(dir) {
680
+ function checkDirectory$1(dir) {
584
681
  try {
585
682
  if (existsSync(dir) === false) {
586
683
  console.log("filepath doesnt exist", dir);
@@ -616,10 +713,10 @@ function checkDirectory(dir) {
616
713
  * @param {string} filepath path to the file
617
714
  * @returns
618
715
  */
619
- function getFileContents$6(filepath, defaultReturn = []) {
716
+ function getFileContents$7(filepath, defaultReturn = []) {
620
717
  try {
621
718
  // lets first make sure all is there...
622
- ensureDirectoryExistence$2(filepath);
719
+ ensureDirectoryExistence$3(filepath);
623
720
 
624
721
  // and now lets read the file...
625
722
  let fileContents = JSON.stringify(defaultReturn);
@@ -641,13 +738,13 @@ function getFileContents$6(filepath, defaultReturn = []) {
641
738
 
642
739
  // Reinitialize with default content
643
740
  fileContentsArray = defaultReturn;
644
- writeFileSync$4(filepath, JSON.stringify(defaultReturn, null, 2));
741
+ writeFileSync$5(filepath, JSON.stringify(defaultReturn, null, 2));
645
742
  console.log(`[File] Successfully reinitialized: ${filepath}`);
646
743
  }
647
744
  } else {
648
745
  // we should make the file with default content
649
746
  closeSync(openSync(filepath, "w"));
650
- writeFileSync$4(filepath, JSON.stringify(defaultReturn, null, 2));
747
+ writeFileSync$5(filepath, JSON.stringify(defaultReturn, null, 2));
651
748
  }
652
749
 
653
750
  return fileContentsArray;
@@ -660,7 +757,7 @@ function getFileContents$6(filepath, defaultReturn = []) {
660
757
  function writeToFile$3(filename, data) {
661
758
  try {
662
759
  // write the new pages configuration back to the file
663
- return writeFileSync$4(filename, data);
760
+ return writeFileSync$5(filename, data);
664
761
  } catch (e) {
665
762
  return false;
666
763
  }
@@ -680,7 +777,7 @@ function removeFilesFromDirectory(directory, excludeFiles = []) {
680
777
 
681
778
  for (const file of files) {
682
779
  if (!excludeFiles.includes(file)) {
683
- unlinkSync(path$b.join(directory, file), (err) => {
780
+ unlinkSync(path$e.join(directory, file), (err) => {
684
781
  if (err) throw err;
685
782
  });
686
783
  }
@@ -690,20 +787,20 @@ function removeFilesFromDirectory(directory, excludeFiles = []) {
690
787
  }
691
788
 
692
789
  var file = {
693
- ensureDirectoryExistence: ensureDirectoryExistence$2,
694
- getFileContents: getFileContents$6,
790
+ ensureDirectoryExistence: ensureDirectoryExistence$3,
791
+ getFileContents: getFileContents$7,
695
792
  writeToFile: writeToFile$3,
696
793
  removeFilesFromDirectory,
697
- checkDirectory,
794
+ checkDirectory: checkDirectory$1,
698
795
  };
699
796
 
700
- const { app: app$6 } = require$$0;
701
- const path$a = require$$1$1;
702
- const { writeFileSync: writeFileSync$3 } = require$$2;
703
- const { getFileContents: getFileContents$5 } = file;
797
+ const { app: app$8 } = require$$0;
798
+ const path$d = require$$1$1;
799
+ const { writeFileSync: writeFileSync$4 } = require$$2;
800
+ const { getFileContents: getFileContents$6 } = file;
704
801
 
705
- const configFilename$4 = "workspaces.json";
706
- const appName$5 = "Dashboard";
802
+ const configFilename$5 = "workspaces.json";
803
+ const appName$6 = "Dashboard";
707
804
 
708
805
  const workspaceController$1 = {
709
806
  /**
@@ -745,13 +842,13 @@ const workspaceController$1 = {
745
842
  saveWorkspaceForApplication: (win, appId, workspaceObject) => {
746
843
  try {
747
844
  // filename to the pages file (live pages)
748
- const filename = path$a.join(
749
- app$6.getPath("userData"),
750
- appName$5,
845
+ const filename = path$d.join(
846
+ app$8.getPath("userData"),
847
+ appName$6,
751
848
  appId,
752
- configFilename$4
849
+ configFilename$5
753
850
  );
754
- const workspacesArray = getFileContents$5(filename);
851
+ const workspacesArray = getFileContents$6(filename);
755
852
 
756
853
  // lets check to see if we already have this one!
757
854
  let indexOfExistingItem = null;
@@ -771,7 +868,7 @@ const workspaceController$1 = {
771
868
  }
772
869
 
773
870
  // write the new pages configuration back to the file
774
- writeFileSync$3(filename, JSON.stringify(workspacesArray, null, 2));
871
+ writeFileSync$4(filename, JSON.stringify(workspacesArray, null, 2));
775
872
 
776
873
  console.log("[workspaceController] Workspace saved successfully");
777
874
 
@@ -794,13 +891,13 @@ const workspaceController$1 = {
794
891
  saveMenuItemsForApplication: (win, appId, menuItems) => {
795
892
  try {
796
893
  // filename to the workspaces file
797
- const filename = path$a.join(
798
- app$6.getPath("userData"),
799
- appName$5,
894
+ const filename = path$d.join(
895
+ app$8.getPath("userData"),
896
+ appName$6,
800
897
  appId,
801
- configFilename$4
898
+ configFilename$5
802
899
  );
803
- const workspacesArray = getFileContents$5(filename);
900
+ const workspacesArray = getFileContents$6(filename);
804
901
 
805
902
  // Update menu items for workspaces
806
903
  // This assumes menuItems is an object with workspace IDs as keys
@@ -814,7 +911,7 @@ const workspaceController$1 = {
814
911
  }
815
912
 
816
913
  // write the updated workspaces configuration back to the file
817
- writeFileSync$3(filename, JSON.stringify(workspacesArray, null, 2));
914
+ writeFileSync$4(filename, JSON.stringify(workspacesArray, null, 2));
818
915
 
819
916
  console.log("[workspaceController] Menu items saved successfully");
820
917
 
@@ -843,19 +940,19 @@ const workspaceController$1 = {
843
940
  */
844
941
  deleteWorkspaceForApplication: (win, appId, workspaceId) => {
845
942
  try {
846
- const filename = path$a.join(
847
- app$6.getPath("userData"),
848
- appName$5,
943
+ const filename = path$d.join(
944
+ app$8.getPath("userData"),
945
+ appName$6,
849
946
  appId,
850
- configFilename$4
947
+ configFilename$5
851
948
  );
852
- const workspacesArray = getFileContents$5(filename);
949
+ const workspacesArray = getFileContents$6(filename);
853
950
 
854
951
  const filtered = workspacesArray.filter(
855
952
  (workspace) => workspace.id !== workspaceId
856
953
  );
857
954
 
858
- writeFileSync$3(filename, JSON.stringify(filtered, null, 2));
955
+ writeFileSync$4(filename, JSON.stringify(filtered, null, 2));
859
956
 
860
957
  console.log(
861
958
  `[workspaceController] Workspace ${workspaceId} deleted successfully`
@@ -877,14 +974,14 @@ const workspaceController$1 = {
877
974
 
878
975
  listWorkspacesForApplication: (win, appId) => {
879
976
  try {
880
- const filename = path$a.join(
881
- app$6.getPath("userData"),
882
- appName$5,
977
+ const filename = path$d.join(
978
+ app$8.getPath("userData"),
979
+ appName$6,
883
980
  appId,
884
- configFilename$4
981
+ configFilename$5
885
982
  );
886
983
 
887
- const workspacesArray = getFileContents$5(filename);
984
+ const workspacesArray = getFileContents$6(filename);
888
985
  console.log(
889
986
  `[workspaceController] Loaded ${workspacesArray.length} workspaces for appId: ${appId}`
890
987
  );
@@ -905,13 +1002,13 @@ const workspaceController$1 = {
905
1002
 
906
1003
  listMenuItemsForApplication: (win, appId) => {
907
1004
  try {
908
- const filename = path$a.join(
909
- app$6.getPath("userData"),
910
- appName$5,
1005
+ const filename = path$d.join(
1006
+ app$8.getPath("userData"),
1007
+ appName$6,
911
1008
  appId,
912
- configFilename$4
1009
+ configFilename$5
913
1010
  );
914
- const workspacesArray = getFileContents$5(filename);
1011
+ const workspacesArray = getFileContents$6(filename);
915
1012
 
916
1013
  // Extract unique menu items from workspaces
917
1014
  // Each workspace can have a menuId, we need to build the menu items list
@@ -951,13 +1048,13 @@ const workspaceController$1 = {
951
1048
 
952
1049
  var workspaceController_1 = workspaceController$1;
953
1050
 
954
- const { app: app$5 } = require$$0;
955
- const path$9 = require$$1$1;
956
- const { writeFileSync: writeFileSync$2 } = require$$2;
957
- const { getFileContents: getFileContents$4 } = file;
1051
+ const { app: app$7 } = require$$0;
1052
+ const path$c = require$$1$1;
1053
+ const { writeFileSync: writeFileSync$3 } = require$$2;
1054
+ const { getFileContents: getFileContents$5 } = file;
958
1055
 
959
- const configFilename$3 = "themes.json";
960
- const appName$4 = "Dashboard";
1056
+ const configFilename$4 = "themes.json";
1057
+ const appName$5 = "Dashboard";
961
1058
 
962
1059
  const themeController$1 = {
963
1060
  /**
@@ -972,13 +1069,13 @@ const themeController$1 = {
972
1069
  saveThemeForApplication: (win, appId, name, obj) => {
973
1070
  try {
974
1071
  // filename to the pages file (live pages)
975
- const filename = path$9.join(
976
- app$5.getPath("userData"),
977
- appName$4,
1072
+ const filename = path$c.join(
1073
+ app$7.getPath("userData"),
1074
+ appName$5,
978
1075
  appId,
979
- configFilename$3
1076
+ configFilename$4
980
1077
  );
981
- const data = getFileContents$4(filename, {});
1078
+ const data = getFileContents$5(filename, {});
982
1079
 
983
1080
  // Add/update the theme based on the name
984
1081
  if (name in data === false) {
@@ -988,7 +1085,7 @@ const themeController$1 = {
988
1085
  data[name] = obj;
989
1086
 
990
1087
  // write the new pages configuration back to the file
991
- writeFileSync$2(filename, JSON.stringify(data, null, 2));
1088
+ writeFileSync$3(filename, JSON.stringify(data, null, 2));
992
1089
 
993
1090
  console.log("[themeController] Theme saved successfully");
994
1091
 
@@ -1018,14 +1115,14 @@ const themeController$1 = {
1018
1115
  */
1019
1116
  listThemesForApplication: (win, appId) => {
1020
1117
  try {
1021
- const filename = path$9.join(
1022
- app$5.getPath("userData"),
1023
- appName$4,
1118
+ const filename = path$c.join(
1119
+ app$7.getPath("userData"),
1120
+ appName$5,
1024
1121
  appId,
1025
- configFilename$3
1122
+ configFilename$4
1026
1123
  );
1027
1124
 
1028
- const data = getFileContents$4(filename, {});
1125
+ const data = getFileContents$5(filename, {});
1029
1126
 
1030
1127
  console.log(
1031
1128
  "[themeController] Loading themes from:",
@@ -1060,17 +1157,17 @@ const themeController$1 = {
1060
1157
  */
1061
1158
  deleteThemeForApplication: (win, appId, themeKey) => {
1062
1159
  try {
1063
- const filename = path$9.join(
1064
- app$5.getPath("userData"),
1065
- appName$4,
1160
+ const filename = path$c.join(
1161
+ app$7.getPath("userData"),
1162
+ appName$5,
1066
1163
  appId,
1067
- configFilename$3
1164
+ configFilename$4
1068
1165
  );
1069
- const data = getFileContents$4(filename, {});
1166
+ const data = getFileContents$5(filename, {});
1070
1167
 
1071
1168
  if (themeKey in data) {
1072
1169
  delete data[themeKey];
1073
- writeFileSync$2(filename, JSON.stringify(data, null, 2));
1170
+ writeFileSync$3(filename, JSON.stringify(data, null, 2));
1074
1171
  }
1075
1172
 
1076
1173
  console.log(
@@ -1103,16 +1200,16 @@ var themeController_1 = themeController$1;
1103
1200
  * - CSV -> JSON
1104
1201
  */
1105
1202
 
1106
- var fs$6 = require$$2;
1203
+ var fs$8 = require$$2;
1107
1204
  var readline = require$$1$2;
1108
1205
  const xtreamer = require$$2$1;
1109
1206
  var xmlParser = require$$3;
1110
- var JSONStream = require$$4;
1207
+ var JSONStream$1 = require$$4;
1111
1208
  const stream = require$$5;
1112
1209
  var csv = require$$6;
1113
- const path$8 = require$$1$1;
1114
- const { app: app$4 } = require$$0;
1115
- const { ensureDirectoryExistence: ensureDirectoryExistence$1 } = file;
1210
+ const path$b = require$$1$1;
1211
+ const { app: app$6 } = require$$0;
1212
+ const { ensureDirectoryExistence: ensureDirectoryExistence$2 } = file;
1116
1213
 
1117
1214
  const TRANSFORM_APP_NAME = "Dashboard";
1118
1215
  const MAX_MAPPING_BODY_SIZE = 10240; // 10KB limit for mapping function body
@@ -1159,7 +1256,7 @@ let Transform$1 = class Transform {
1159
1256
  let lineObject = [];
1160
1257
 
1161
1258
  const readInterface = readline.createInterface({
1162
- input: fs$6.createReadStream(filepath),
1259
+ input: fs$8.createReadStream(filepath),
1163
1260
  output: process.stdout,
1164
1261
  console: false,
1165
1262
  });
@@ -1193,8 +1290,8 @@ let Transform$1 = class Transform {
1193
1290
  ) => {
1194
1291
  return new Promise((resolve, reject) => {
1195
1292
  try {
1196
- const parser = JSONStream.parse("*");
1197
- const readStream = fs$6.createReadStream(file).pipe(parser);
1293
+ const parser = JSONStream$1.parse("*");
1294
+ const readStream = fs$8.createReadStream(file).pipe(parser);
1198
1295
 
1199
1296
  let count = 0;
1200
1297
 
@@ -1247,7 +1344,7 @@ let Transform$1 = class Transform {
1247
1344
  parseXMLStream = (filepath, outpath, start) => {
1248
1345
  return new Promise((resolve, reject) => {
1249
1346
  try {
1250
- const xmlFileReadStream = fs$6.createReadStream(filepath);
1347
+ const xmlFileReadStream = fs$8.createReadStream(filepath);
1251
1348
 
1252
1349
  xmlFileReadStream.on("end", () => {
1253
1350
  writeStream.write("\n]");
@@ -1258,7 +1355,7 @@ let Transform$1 = class Transform {
1258
1355
  resolve("Read Finish");
1259
1356
  });
1260
1357
 
1261
- const writeStream = fs$6.createWriteStream(outpath);
1358
+ const writeStream = fs$8.createWriteStream(outpath);
1262
1359
  writeStream.write("[\n");
1263
1360
 
1264
1361
  const options = {
@@ -1310,10 +1407,10 @@ let Transform$1 = class Transform {
1310
1407
  ) => {
1311
1408
  return new Promise((resolve, reject) => {
1312
1409
  try {
1313
- const readStream = fs$6
1410
+ const readStream = fs$8
1314
1411
  .createReadStream(filepath)
1315
1412
  .pipe(csv({ separator: delimiter }));
1316
- const writeStream = fs$6.createWriteStream(outpath);
1413
+ const writeStream = fs$8.createWriteStream(outpath);
1317
1414
 
1318
1415
  let canParse = true;
1319
1416
 
@@ -1399,21 +1496,21 @@ let Transform$1 = class Transform {
1399
1496
  }
1400
1497
 
1401
1498
  // Validate file paths are within app data directory
1402
- const appDataDir = path$8.join(
1403
- app$4.getPath("userData"),
1499
+ const appDataDir = path$b.join(
1500
+ app$6.getPath("userData"),
1404
1501
  TRANSFORM_APP_NAME
1405
1502
  );
1406
- const resolvedFilepath = path$8.resolve(filepath);
1407
- const resolvedOutFilepath = path$8.resolve(outFilepath);
1503
+ const resolvedFilepath = path$b.resolve(filepath);
1504
+ const resolvedOutFilepath = path$b.resolve(outFilepath);
1408
1505
 
1409
- if (!resolvedFilepath.startsWith(appDataDir + path$8.sep)) {
1506
+ if (!resolvedFilepath.startsWith(appDataDir + path$b.sep)) {
1410
1507
  return reject(
1411
1508
  new Error(
1412
1509
  "Input file path must be within the application data directory"
1413
1510
  )
1414
1511
  );
1415
1512
  }
1416
- if (!resolvedOutFilepath.startsWith(appDataDir + path$8.sep)) {
1513
+ if (!resolvedOutFilepath.startsWith(appDataDir + path$b.sep)) {
1417
1514
  return reject(
1418
1515
  new Error(
1419
1516
  "Output file path must be within the application data directory"
@@ -1422,18 +1519,18 @@ let Transform$1 = class Transform {
1422
1519
  }
1423
1520
 
1424
1521
  // JSON parser
1425
- var parser = JSONStream.parse("*");
1522
+ var parser = JSONStream$1.parse("*");
1426
1523
 
1427
- if (fs$6.existsSync(resolvedFilepath)) {
1524
+ if (fs$8.existsSync(resolvedFilepath)) {
1428
1525
  console.log("file exists ", resolvedFilepath);
1429
1526
  // create the readStream to parse the large file (json)
1430
- var readStream = fs$6
1527
+ var readStream = fs$8
1431
1528
  .createReadStream(resolvedFilepath)
1432
1529
  .pipe(parser);
1433
1530
 
1434
- ensureDirectoryExistence$1(resolvedOutFilepath);
1531
+ ensureDirectoryExistence$2(resolvedOutFilepath);
1435
1532
 
1436
- var writeStream = fs$6.createWriteStream(resolvedOutFilepath);
1533
+ var writeStream = fs$8.createWriteStream(resolvedOutFilepath);
1437
1534
 
1438
1535
  let sep = "";
1439
1536
  let count = 0;
@@ -3273,18 +3370,18 @@ async function extractColorsFromImageURL$2(url, toDirectory) {
3273
3370
 
3274
3371
  var color = { extractColorsFromImageURL: extractColorsFromImageURL$2 };
3275
3372
 
3276
- const { app: app$3 } = require$$0;
3277
- var fs$5 = require$$2;
3278
- const path$7 = require$$1$1;
3279
- const events$3 = events$6;
3280
- const { getFileContents: getFileContents$3, writeToFile: writeToFile$2 } = file;
3373
+ const { app: app$5 } = require$$0;
3374
+ var fs$7 = require$$2;
3375
+ const path$a = require$$1$1;
3376
+ const events$5 = events$8;
3377
+ const { getFileContents: getFileContents$4, writeToFile: writeToFile$2 } = file;
3281
3378
 
3282
3379
  // Convert Json to Csv
3283
3380
  const ObjectsToCsv = require$$5$1;
3284
3381
  const Transform = transform;
3285
3382
  const { extractColorsFromImageURL: extractColorsFromImageURL$1 } = color;
3286
3383
  const https = require$$8;
3287
- const appName$3 = "Dashboard";
3384
+ const appName$4 = "Dashboard";
3288
3385
 
3289
3386
  const dataController$1 = {
3290
3387
  /**
@@ -3298,23 +3395,23 @@ const dataController$1 = {
3298
3395
  convertJsonToCsvFile: (win, appId, jsonObject, toFilename = "test.csv") => {
3299
3396
  try {
3300
3397
  // filename to the pages file (live pages)
3301
- const filename = path$7.join(
3302
- app$3.getPath("userData"),
3303
- appName$3,
3398
+ const filename = path$a.join(
3399
+ app$5.getPath("userData"),
3400
+ appName$4,
3304
3401
  appId,
3305
3402
  "data",
3306
3403
  toFilename
3307
3404
  );
3308
3405
 
3309
3406
  // make sure the file exists...
3310
- const fileContents = getFileContents$3(filename, "");
3407
+ const fileContents = getFileContents$4(filename, "");
3311
3408
 
3312
3409
  const csv = new ObjectsToCsv(jsonObject);
3313
3410
 
3314
3411
  csv.toDisk(filename)
3315
3412
  .then((result) => {
3316
3413
  win.webContents.send(
3317
- events$3.DATA_JSON_TO_CSV_FILE_COMPLETE,
3414
+ events$5.DATA_JSON_TO_CSV_FILE_COMPLETE,
3318
3415
  {
3319
3416
  succes: true,
3320
3417
  result,
@@ -3323,12 +3420,12 @@ const dataController$1 = {
3323
3420
  );
3324
3421
  })
3325
3422
  .catch((e) =>
3326
- win.webContents.send(events$3.DATA_JSON_TO_CSV_FILE_ERROR, {
3423
+ win.webContents.send(events$5.DATA_JSON_TO_CSV_FILE_ERROR, {
3327
3424
  error: e.message,
3328
3425
  })
3329
3426
  );
3330
3427
  } catch (e) {
3331
- win.webContents.send(events$3.DATA_JSON_TO_CSV_FILE_ERROR, {
3428
+ win.webContents.send(events$5.DATA_JSON_TO_CSV_FILE_ERROR, {
3332
3429
  error: e.message,
3333
3430
  });
3334
3431
  }
@@ -3345,7 +3442,7 @@ const dataController$1 = {
3345
3442
  csv.toString(filename)
3346
3443
  .then((result) => {
3347
3444
  win.webContents.send(
3348
- events$3.DATA_JSON_TO_CSV_STRING_COMPLETE,
3445
+ events$5.DATA_JSON_TO_CSV_STRING_COMPLETE,
3349
3446
  {
3350
3447
  succes: true,
3351
3448
  csvString: result,
@@ -3353,12 +3450,12 @@ const dataController$1 = {
3353
3450
  );
3354
3451
  })
3355
3452
  .catch((e) =>
3356
- win.webContents.send(events$3.DATA_JSON_TO_CSV_STRING_ERROR, {
3453
+ win.webContents.send(events$5.DATA_JSON_TO_CSV_STRING_ERROR, {
3357
3454
  error: e.message,
3358
3455
  })
3359
3456
  );
3360
3457
  } catch (e) {
3361
- win.webContents.send(events$3.DATA_JSON_TO_CSV_STRING_ERROR, {
3458
+ win.webContents.send(events$5.DATA_JSON_TO_CSV_STRING_ERROR, {
3362
3459
  error: e.message,
3363
3460
  });
3364
3461
  }
@@ -3371,10 +3468,10 @@ const dataController$1 = {
3371
3468
  win,
3372
3469
  filepath,
3373
3470
  lineCount,
3374
- events$3.READ_LINES_UPDATE
3471
+ events$5.READ_LINES_UPDATE
3375
3472
  )
3376
3473
  .then((res) => {
3377
- win.webContents.send(events$3.READ_LINES_COMPLETE, {
3474
+ win.webContents.send(events$5.READ_LINES_COMPLETE, {
3378
3475
  success: true,
3379
3476
  filepath,
3380
3477
  lineCount,
@@ -3383,12 +3480,12 @@ const dataController$1 = {
3383
3480
  })
3384
3481
  .catch((e) => {
3385
3482
  //console.log(e);
3386
- win.webContents.send(events$3.READ_LINES_ERROR, {
3483
+ win.webContents.send(events$5.READ_LINES_ERROR, {
3387
3484
  error: e.message,
3388
3485
  });
3389
3486
  });
3390
3487
  } catch (error) {
3391
- win.webContents.send(events$3.READ_LINES_ERROR, {
3488
+ win.webContents.send(events$5.READ_LINES_ERROR, {
3392
3489
  error: e.message,
3393
3490
  });
3394
3491
  }
@@ -3402,23 +3499,23 @@ const dataController$1 = {
3402
3499
  win,
3403
3500
  filepath,
3404
3501
  objectCount,
3405
- events$3.READ_JSON_UPDATE
3502
+ events$5.READ_JSON_UPDATE
3406
3503
  )
3407
3504
  .then((res) => {
3408
- win.webContents.send(events$3.READ_JSON_COMPLETE, {
3505
+ win.webContents.send(events$5.READ_JSON_COMPLETE, {
3409
3506
  success: true,
3410
3507
  filepath,
3411
3508
  });
3412
3509
  })
3413
3510
  .catch((e) => {
3414
3511
  //console.log(e);
3415
- win.webContents.send(events$3.READ_JSON_ERROR, {
3512
+ win.webContents.send(events$5.READ_JSON_ERROR, {
3416
3513
  error: e.message,
3417
3514
  });
3418
3515
  });
3419
3516
  } catch (error) {
3420
3517
  console.log(error);
3421
- win.webContents.send(events$3.READ_JSON_ERROR, {
3518
+ win.webContents.send(events$5.READ_JSON_ERROR, {
3422
3519
  error: e.message,
3423
3520
  });
3424
3521
  }
@@ -3440,15 +3537,15 @@ const dataController$1 = {
3440
3537
  }
3441
3538
 
3442
3539
  // Validate toFilepath is within the app data directory
3443
- const appDataDir = path$7.join(app$3.getPath("userData"), appName$3);
3444
- const resolvedFilepath = path$7.resolve(toFilepath);
3445
- if (!resolvedFilepath.startsWith(appDataDir + path$7.sep)) {
3540
+ const appDataDir = path$a.join(app$5.getPath("userData"), appName$4);
3541
+ const resolvedFilepath = path$a.resolve(toFilepath);
3542
+ if (!resolvedFilepath.startsWith(appDataDir + path$a.sep)) {
3446
3543
  throw new Error(
3447
3544
  "File path must be within the application data directory"
3448
3545
  );
3449
3546
  }
3450
3547
 
3451
- const writeStream = fs$5.createWriteStream(resolvedFilepath);
3548
+ const writeStream = fs$7.createWriteStream(resolvedFilepath);
3452
3549
 
3453
3550
  https
3454
3551
  .get(url, (resp) => {
@@ -3457,20 +3554,20 @@ const dataController$1 = {
3457
3554
  });
3458
3555
 
3459
3556
  resp.on("end", () => {
3460
- win.webContents.send(events$3.READ_DATA_URL_COMPLETE, {
3557
+ win.webContents.send(events$5.READ_DATA_URL_COMPLETE, {
3461
3558
  success: true,
3462
3559
  toFilepath: resolvedFilepath,
3463
3560
  });
3464
3561
  });
3465
3562
  })
3466
3563
  .on("error", (err) => {
3467
- win.webContents.send(events$3.READ_DATA_URL_ERROR, {
3564
+ win.webContents.send(events$5.READ_DATA_URL_ERROR, {
3468
3565
  error: err.message,
3469
3566
  });
3470
3567
  });
3471
3568
  } catch (error) {
3472
3569
  console.log(error);
3473
- win.webContents.send(events$3.READ_DATA_URL_ERROR, {
3570
+ win.webContents.send(events$5.READ_DATA_URL_ERROR, {
3474
3571
  error: error.message,
3475
3572
  });
3476
3573
  }
@@ -3504,7 +3601,7 @@ const dataController$1 = {
3504
3601
  // events.PARSE_XML_STREAM_UPDATE
3505
3602
  )
3506
3603
  .then((res) => {
3507
- win.webContents.send(events$3.PARSE_XML_STREAM_COMPLETE, {
3604
+ win.webContents.send(events$5.PARSE_XML_STREAM_COMPLETE, {
3508
3605
  success: true,
3509
3606
  filepath,
3510
3607
  outpath,
@@ -3512,12 +3609,12 @@ const dataController$1 = {
3512
3609
  })
3513
3610
  .catch((e) => {
3514
3611
  console.log(e);
3515
- win.webContents.send(events$3.PARSE_XML_STREAM_ERROR, {
3612
+ win.webContents.send(events$5.PARSE_XML_STREAM_ERROR, {
3516
3613
  error: e.message,
3517
3614
  });
3518
3615
  });
3519
3616
  } catch (e) {
3520
- win.webContents.send(events$3.PARSE_XML_STREAM_ERROR, {
3617
+ win.webContents.send(events$5.PARSE_XML_STREAM_ERROR, {
3521
3618
  error: e.message,
3522
3619
  });
3523
3620
  }
@@ -3550,11 +3647,11 @@ const dataController$1 = {
3550
3647
  objectIdKey,
3551
3648
  headers,
3552
3649
  win,
3553
- events$3.PARSE_CSV_STREAM_UPDATE,
3650
+ events$5.PARSE_CSV_STREAM_UPDATE,
3554
3651
  limit
3555
3652
  )
3556
3653
  .then((res) => {
3557
- win.webContents.send(events$3.PARSE_CSV_STREAM_COMPLETE, {
3654
+ win.webContents.send(events$5.PARSE_CSV_STREAM_COMPLETE, {
3558
3655
  success: true,
3559
3656
  filepath,
3560
3657
  outpath,
@@ -3562,12 +3659,12 @@ const dataController$1 = {
3562
3659
  })
3563
3660
  .catch((e) => {
3564
3661
  console.log(e);
3565
- win.webContents.send(events$3.PARSE_CSV_STREAM_ERROR, {
3662
+ win.webContents.send(events$5.PARSE_CSV_STREAM_ERROR, {
3566
3663
  error: e.message,
3567
3664
  });
3568
3665
  });
3569
3666
  } catch (e) {
3570
- win.webContents.send(events$3.PARSE_CSV_STREAM_ERROR, {
3667
+ win.webContents.send(events$5.PARSE_CSV_STREAM_ERROR, {
3571
3668
  error: e.message,
3572
3669
  });
3573
3670
  }
@@ -3589,9 +3686,9 @@ const dataController$1 = {
3589
3686
  try {
3590
3687
  if (data) {
3591
3688
  // filename to the pages file (live pages)
3592
- const toFilename = path$7.join(
3593
- app$3.getPath("userData"),
3594
- appName$3,
3689
+ const toFilename = path$a.join(
3690
+ app$5.getPath("userData"),
3691
+ appName$4,
3595
3692
  "data",
3596
3693
  filename
3597
3694
  );
@@ -3599,7 +3696,7 @@ const dataController$1 = {
3599
3696
  //console.log("saving to file ", toFilename);
3600
3697
 
3601
3698
  // // call this to make sure the directory structure exists
3602
- let fileContents = getFileContents$3(toFilename, returnEmpty);
3699
+ let fileContents = getFileContents$4(toFilename, returnEmpty);
3603
3700
  if (fileContents === null || fileContents === "") {
3604
3701
  fileContents = JSON.stringify(returnEmpty);
3605
3702
  }
@@ -3651,7 +3748,7 @@ const dataController$1 = {
3651
3748
  // fileContents,
3652
3749
  // });
3653
3750
 
3654
- win.webContents.send(events$3.DATA_SAVE_TO_FILE_COMPLETE, {
3751
+ win.webContents.send(events$5.DATA_SAVE_TO_FILE_COMPLETE, {
3655
3752
  success: true,
3656
3753
  filename: toFilename,
3657
3754
  fileContents: JSON.parse(writeContents),
@@ -3659,7 +3756,7 @@ const dataController$1 = {
3659
3756
  }
3660
3757
  } catch (e) {
3661
3758
  console.log(e);
3662
- win.webContents.send(events$3.DATA_SAVE_TO_FILE_ERROR, {
3759
+ win.webContents.send(events$5.DATA_SAVE_TO_FILE_ERROR, {
3663
3760
  success: false,
3664
3761
  filename: filename,
3665
3762
  message: e.message,
@@ -3671,29 +3768,29 @@ const dataController$1 = {
3671
3768
  try {
3672
3769
  if (filename) {
3673
3770
  // filename to the pages file (live pages)
3674
- const fromFilename = path$7.join(
3675
- app$3.getPath("userData"),
3676
- appName$3,
3771
+ const fromFilename = path$a.join(
3772
+ app$5.getPath("userData"),
3773
+ appName$4,
3677
3774
  "data",
3678
3775
  filename
3679
3776
  );
3680
3777
  console.log("reading from file ", fromFilename, returnIfEmpty);
3681
3778
  // make sure the file exists...
3682
- const fileContents = getFileContents$3(
3779
+ const fileContents = getFileContents$4(
3683
3780
  fromFilename,
3684
3781
  returnIfEmpty
3685
3782
  );
3686
3783
 
3687
3784
  console.log("file contents ", fileContents, fromFilename);
3688
3785
 
3689
- win.webContents.send(events$3.DATA_READ_FROM_FILE_COMPLETE, {
3786
+ win.webContents.send(events$5.DATA_READ_FROM_FILE_COMPLETE, {
3690
3787
  succes: true,
3691
3788
  filename: fromFilename,
3692
3789
  data: JSON.stringify(fileContents),
3693
3790
  });
3694
3791
  }
3695
3792
  } catch (e) {
3696
- win.webContents.send(events$3.DATA_READ_FROM_FILE_ERROR, {
3793
+ win.webContents.send(events$5.DATA_READ_FROM_FILE_ERROR, {
3697
3794
  succes: false,
3698
3795
  message: e.message,
3699
3796
  });
@@ -3725,23 +3822,23 @@ const dataController$1 = {
3725
3822
  outFilepath,
3726
3823
  mappingFunctionBody,
3727
3824
  args,
3728
- events$3.TRANSFORM_FILE_UPDATE
3825
+ events$5.TRANSFORM_FILE_UPDATE
3729
3826
  )
3730
3827
  .then((result) => {
3731
- win.webContents.send(events$3.TRANSFORM_FILE_COMPLETE, {
3828
+ win.webContents.send(events$5.TRANSFORM_FILE_COMPLETE, {
3732
3829
  succes: true,
3733
3830
  filename: filepath,
3734
3831
  toFilename: outFilepath,
3735
3832
  });
3736
3833
  })
3737
3834
  .catch((e) => {
3738
- win.webContents.send(events$3.TRANSFORM_FILE_ERROR, {
3835
+ win.webContents.send(events$5.TRANSFORM_FILE_ERROR, {
3739
3836
  succes: false,
3740
3837
  message: e.message,
3741
3838
  });
3742
3839
  });
3743
3840
  } catch (e) {
3744
- win.webContents.send(events$3.TRANSFORM_FILE_ERROR, {
3841
+ win.webContents.send(events$5.TRANSFORM_FILE_ERROR, {
3745
3842
  succes: false,
3746
3843
  message: e.message,
3747
3844
  });
@@ -3752,9 +3849,9 @@ const dataController$1 = {
3752
3849
  try {
3753
3850
  console.log(url);
3754
3851
  const fileExtension = ".jpg";
3755
- const filename = path$7.join(
3756
- app$3.getPath("userData"),
3757
- appName$3,
3852
+ const filename = path$a.join(
3853
+ app$5.getPath("userData"),
3854
+ appName$4,
3758
3855
  "@algolia/dash-electron",
3759
3856
  "data",
3760
3857
  "imageExtract" + fileExtension
@@ -3777,25 +3874,25 @@ var dataController_1 = dataController$1;
3777
3874
  * settingsController
3778
3875
  */
3779
3876
 
3780
- const { app: app$2 } = require$$0;
3781
- const path$6 = require$$1$1;
3782
- const fs$4 = require$$2;
3783
- const { getFileContents: getFileContents$2, writeToFile: writeToFile$1 } = file;
3877
+ const { app: app$4 } = require$$0;
3878
+ const path$9 = require$$1$1;
3879
+ const fs$6 = require$$2;
3880
+ const { getFileContents: getFileContents$3, writeToFile: writeToFile$1 } = file;
3784
3881
 
3785
- const configFilename$2 = "settings.json";
3786
- const appName$2 = "Dashboard";
3882
+ const configFilename$3 = "settings.json";
3883
+ const appName$3 = "Dashboard";
3787
3884
 
3788
3885
  // Helper function to recursively copy directory
3789
3886
  function copyDirectory(source, destination) {
3790
- if (!fs$4.existsSync(destination)) {
3791
- fs$4.mkdirSync(destination, { recursive: true });
3887
+ if (!fs$6.existsSync(destination)) {
3888
+ fs$6.mkdirSync(destination, { recursive: true });
3792
3889
  }
3793
3890
 
3794
- const files = fs$4.readdirSync(source);
3891
+ const files = fs$6.readdirSync(source);
3795
3892
  for (const file of files) {
3796
- const srcPath = path$6.join(source, file);
3797
- const destPath = path$6.join(destination, file);
3798
- const stat = fs$4.lstatSync(srcPath);
3893
+ const srcPath = path$9.join(source, file);
3894
+ const destPath = path$9.join(destination, file);
3895
+ const stat = fs$6.lstatSync(srcPath);
3799
3896
 
3800
3897
  // Skip symlinks to prevent following links to sensitive files
3801
3898
  if (stat.isSymbolicLink()) {
@@ -3806,7 +3903,7 @@ function copyDirectory(source, destination) {
3806
3903
  if (stat.isDirectory()) {
3807
3904
  copyDirectory(srcPath, destPath);
3808
3905
  } else {
3809
- fs$4.copyFileSync(srcPath, destPath);
3906
+ fs$6.copyFileSync(srcPath, destPath);
3810
3907
  }
3811
3908
  }
3812
3909
  }
@@ -3822,10 +3919,10 @@ const settingsController$1 = {
3822
3919
  try {
3823
3920
  if (data) {
3824
3921
  // <appId>/settings.json
3825
- const filename = path$6.join(
3826
- app$2.getPath("userData"),
3827
- appName$2,
3828
- configFilename$2
3922
+ const filename = path$9.join(
3923
+ app$4.getPath("userData"),
3924
+ appName$3,
3925
+ configFilename$3
3829
3926
  );
3830
3927
  writeToFile$1(filename, JSON.stringify(data, null, 2));
3831
3928
  console.log("[settingsController] Settings saved successfully");
@@ -3858,13 +3955,13 @@ const settingsController$1 = {
3858
3955
  getSettingsForApplication: (win) => {
3859
3956
  try {
3860
3957
  // <appId>/settings.json
3861
- const filename = path$6.join(
3862
- app$2.getPath("userData"),
3863
- appName$2,
3864
- configFilename$2
3958
+ const filename = path$9.join(
3959
+ app$4.getPath("userData"),
3960
+ appName$3,
3961
+ configFilename$3
3865
3962
  );
3866
3963
  // make sure the file exists...
3867
- const fileContents = getFileContents$2(filename, {});
3964
+ const fileContents = getFileContents$3(filename, {});
3868
3965
  console.log("[settingsController] Settings loaded successfully");
3869
3966
  // Return the data for ipcMain.handle() - modern promise-based approach
3870
3967
  return {
@@ -3889,15 +3986,15 @@ const settingsController$1 = {
3889
3986
  */
3890
3987
  getDataDirectory: (win) => {
3891
3988
  try {
3892
- const settingsPath = path$6.join(
3893
- app$2.getPath("userData"),
3894
- appName$2,
3895
- configFilename$2
3989
+ const settingsPath = path$9.join(
3990
+ app$4.getPath("userData"),
3991
+ appName$3,
3992
+ configFilename$3
3896
3993
  );
3897
- const settings = getFileContents$2(settingsPath, {});
3994
+ const settings = getFileContents$3(settingsPath, {});
3898
3995
  const userDataDir =
3899
3996
  settings.userDataDirectory ||
3900
- path$6.join(app$2.getPath("userData"), appName$2);
3997
+ path$9.join(app$4.getPath("userData"), appName$3);
3901
3998
 
3902
3999
  console.log(
3903
4000
  "[settingsController] Data directory retrieved successfully"
@@ -3929,22 +4026,22 @@ const settingsController$1 = {
3929
4026
  setDataDirectory: (win, newPath) => {
3930
4027
  try {
3931
4028
  // Validate the path exists and is a directory
3932
- if (!fs$4.existsSync(newPath)) {
3933
- fs$4.mkdirSync(newPath, { recursive: true });
4029
+ if (!fs$6.existsSync(newPath)) {
4030
+ fs$6.mkdirSync(newPath, { recursive: true });
3934
4031
  }
3935
4032
 
3936
- const stats = fs$4.statSync(newPath);
4033
+ const stats = fs$6.statSync(newPath);
3937
4034
  if (!stats.isDirectory()) {
3938
4035
  throw new Error("Path is not a directory");
3939
4036
  }
3940
4037
 
3941
4038
  // Update settings
3942
- const settingsPath = path$6.join(
3943
- app$2.getPath("userData"),
3944
- appName$2,
3945
- configFilename$2
4039
+ const settingsPath = path$9.join(
4040
+ app$4.getPath("userData"),
4041
+ appName$3,
4042
+ configFilename$3
3946
4043
  );
3947
- const settings = getFileContents$2(settingsPath, {});
4044
+ const settings = getFileContents$3(settingsPath, {});
3948
4045
  settings.userDataDirectory = newPath;
3949
4046
  writeToFile$1(settingsPath, JSON.stringify(settings, null, 2));
3950
4047
 
@@ -3976,20 +4073,20 @@ const settingsController$1 = {
3976
4073
  migrateDataDirectory: (win, oldPath, newPath) => {
3977
4074
  try {
3978
4075
  // Resolve paths to prevent traversal
3979
- const resolvedOldPath = path$6.resolve(oldPath);
3980
- const resolvedNewPath = path$6.resolve(newPath);
4076
+ const resolvedOldPath = path$9.resolve(oldPath);
4077
+ const resolvedNewPath = path$9.resolve(newPath);
3981
4078
 
3982
4079
  // Validate oldPath is the current configured data directory
3983
- const settingsCheckPath = path$6.join(
3984
- app$2.getPath("userData"),
3985
- appName$2,
3986
- configFilename$2
4080
+ const settingsCheckPath = path$9.join(
4081
+ app$4.getPath("userData"),
4082
+ appName$3,
4083
+ configFilename$3
3987
4084
  );
3988
- const currentSettings = getFileContents$2(settingsCheckPath, {});
4085
+ const currentSettings = getFileContents$3(settingsCheckPath, {});
3989
4086
  const currentDataDir =
3990
4087
  currentSettings.userDataDirectory ||
3991
- path$6.join(app$2.getPath("userData"), appName$2);
3992
- if (resolvedOldPath !== path$6.resolve(currentDataDir)) {
4088
+ path$9.join(app$4.getPath("userData"), appName$3);
4089
+ if (resolvedOldPath !== path$9.resolve(currentDataDir)) {
3993
4090
  throw new Error(
3994
4091
  "Source path must be the current data directory"
3995
4092
  );
@@ -4017,24 +4114,24 @@ const settingsController$1 = {
4017
4114
  }
4018
4115
 
4019
4116
  // Validate paths
4020
- if (!fs$4.existsSync(resolvedOldPath)) {
4117
+ if (!fs$6.existsSync(resolvedOldPath)) {
4021
4118
  throw new Error("Source directory does not exist");
4022
4119
  }
4023
4120
 
4024
- if (!fs$4.existsSync(resolvedNewPath)) {
4025
- fs$4.mkdirSync(resolvedNewPath, { recursive: true });
4121
+ if (!fs$6.existsSync(resolvedNewPath)) {
4122
+ fs$6.mkdirSync(resolvedNewPath, { recursive: true });
4026
4123
  }
4027
4124
 
4028
4125
  // Copy files
4029
4126
  copyDirectory(resolvedOldPath, resolvedNewPath);
4030
4127
 
4031
4128
  // Update settings to use new path
4032
- const settingsPath = path$6.join(
4033
- app$2.getPath("userData"),
4034
- appName$2,
4035
- configFilename$2
4129
+ const settingsPath = path$9.join(
4130
+ app$4.getPath("userData"),
4131
+ appName$3,
4132
+ configFilename$3
4036
4133
  );
4037
- const settings = getFileContents$2(settingsPath, {});
4134
+ const settings = getFileContents$3(settingsPath, {});
4038
4135
  settings.userDataDirectory = resolvedNewPath;
4039
4136
  writeToFile$1(settingsPath, JSON.stringify(settings, null, 2));
4040
4137
 
@@ -4069,17 +4166,17 @@ var settingsController_1 = settingsController$1;
4069
4166
  * Saves encrypted credentials to ~/.userData/Dashboard/{appId}/providers.json
4070
4167
  */
4071
4168
 
4072
- const { app: app$1, safeStorage } = require$$0;
4073
- const path$5 = require$$1$1;
4074
- const { writeFileSync: writeFileSync$1 } = require$$2;
4169
+ const { app: app$3, safeStorage } = require$$0;
4170
+ const path$8 = require$$1$1;
4171
+ const { writeFileSync: writeFileSync$2 } = require$$2;
4075
4172
  const {
4076
- ensureDirectoryExistence,
4077
- getFileContents: getFileContents$1,
4173
+ ensureDirectoryExistence: ensureDirectoryExistence$1,
4174
+ getFileContents: getFileContents$2,
4078
4175
  writeToFile,
4079
4176
  } = file;
4080
4177
 
4081
- const appName$1 = "Dashboard";
4082
- const configFilename$1 = "providers.json";
4178
+ const appName$2 = "Dashboard";
4179
+ const configFilename$2 = "providers.json";
4083
4180
 
4084
4181
  const providerController$1 = {
4085
4182
  /**
@@ -4105,18 +4202,18 @@ const providerController$1 = {
4105
4202
  ) => {
4106
4203
  try {
4107
4204
  // Build file path
4108
- const filename = path$5.join(
4109
- app$1.getPath("userData"),
4110
- appName$1,
4205
+ const filename = path$8.join(
4206
+ app$3.getPath("userData"),
4207
+ appName$2,
4111
4208
  appId,
4112
- configFilename$1
4209
+ configFilename$2
4113
4210
  );
4114
4211
 
4115
4212
  // Ensure directory exists
4116
- ensureDirectoryExistence(filename);
4213
+ ensureDirectoryExistence$1(filename);
4117
4214
 
4118
4215
  // Load existing providers
4119
- const providers = getFileContents$1(filename, {});
4216
+ const providers = getFileContents$2(filename, {});
4120
4217
 
4121
4218
  // Encrypt credentials
4122
4219
  const credentialsJson = JSON.stringify(credentials);
@@ -4142,7 +4239,7 @@ const providerController$1 = {
4142
4239
  providers[providerName] = providerEntry;
4143
4240
 
4144
4241
  // Save to file with restrictive permissions (owner read/write only)
4145
- writeFileSync$1(filename, JSON.stringify(providers, null, 2), {
4242
+ writeFileSync$2(filename, JSON.stringify(providers, null, 2), {
4146
4243
  mode: 0o600,
4147
4244
  });
4148
4245
 
@@ -4175,15 +4272,15 @@ const providerController$1 = {
4175
4272
  */
4176
4273
  listProviders: (win, appId) => {
4177
4274
  try {
4178
- const filename = path$5.join(
4179
- app$1.getPath("userData"),
4180
- appName$1,
4275
+ const filename = path$8.join(
4276
+ app$3.getPath("userData"),
4277
+ appName$2,
4181
4278
  appId,
4182
- configFilename$1
4279
+ configFilename$2
4183
4280
  );
4184
4281
 
4185
4282
  // Load providers file
4186
- const providersData = getFileContents$1(filename, {});
4283
+ const providersData = getFileContents$2(filename, {});
4187
4284
 
4188
4285
  // Decrypt all credentials
4189
4286
  const decryptedProviders = [];
@@ -4252,15 +4349,15 @@ const providerController$1 = {
4252
4349
  */
4253
4350
  getProvider: (win, appId, providerName) => {
4254
4351
  try {
4255
- const filename = path$5.join(
4256
- app$1.getPath("userData"),
4257
- appName$1,
4352
+ const filename = path$8.join(
4353
+ app$3.getPath("userData"),
4354
+ appName$2,
4258
4355
  appId,
4259
- configFilename$1
4356
+ configFilename$2
4260
4357
  );
4261
4358
 
4262
4359
  // Load providers file
4263
- const providersData = getFileContents$1(filename, {});
4360
+ const providersData = getFileContents$2(filename, {});
4264
4361
 
4265
4362
  // Find and decrypt the specific provider
4266
4363
  const providerData = providersData[providerName];
@@ -4319,15 +4416,15 @@ const providerController$1 = {
4319
4416
  */
4320
4417
  deleteProvider: (win, appId, providerName) => {
4321
4418
  try {
4322
- const filename = path$5.join(
4323
- app$1.getPath("userData"),
4324
- appName$1,
4419
+ const filename = path$8.join(
4420
+ app$3.getPath("userData"),
4421
+ appName$2,
4325
4422
  appId,
4326
- configFilename$1
4423
+ configFilename$2
4327
4424
  );
4328
4425
 
4329
4426
  // Load existing providers
4330
- const providers = getFileContents$1(filename, {});
4427
+ const providers = getFileContents$2(filename, {});
4331
4428
 
4332
4429
  // Delete the provider
4333
4430
  if (!providers.hasOwnProperty(providerName)) {
@@ -4337,7 +4434,7 @@ const providerController$1 = {
4337
4434
  delete providers[providerName];
4338
4435
 
4339
4436
  // Save to file with restrictive permissions (owner read/write only)
4340
- writeFileSync$1(filename, JSON.stringify(providers, null, 2), {
4437
+ writeFileSync$2(filename, JSON.stringify(providers, null, 2), {
4341
4438
  mode: 0o600,
4342
4439
  });
4343
4440
 
@@ -4365,14 +4462,14 @@ const providerController$1 = {
4365
4462
 
4366
4463
  var providerController_1 = providerController$1;
4367
4464
 
4368
- const { app } = require$$0;
4369
- const path$4 = require$$1$1;
4370
- const { writeFileSync } = require$$2;
4371
- const events$2 = events$6;
4372
- const { getFileContents } = file;
4465
+ const { app: app$2 } = require$$0;
4466
+ const path$7 = require$$1$1;
4467
+ const { writeFileSync: writeFileSync$1 } = require$$2;
4468
+ const events$4 = events$8;
4469
+ const { getFileContents: getFileContents$1 } = file;
4373
4470
 
4374
- const configFilename = "layouts.json";
4375
- const appName = "Dashboard";
4471
+ const configFilename$1 = "layouts.json";
4472
+ const appName$1 = "Dashboard";
4376
4473
 
4377
4474
  const layoutController$1 = {
4378
4475
  /**
@@ -4386,26 +4483,26 @@ const layoutController$1 = {
4386
4483
  saveLayoutForApplication: (win, appId, layoutObject) => {
4387
4484
  try {
4388
4485
  // filename to the pages file (live pages)
4389
- const filename = path$4.join(
4390
- app.getPath("userData"),
4391
- appName,
4486
+ const filename = path$7.join(
4487
+ app$2.getPath("userData"),
4488
+ appName$1,
4392
4489
  appId,
4393
- configFilename
4490
+ configFilename$1
4394
4491
  );
4395
- const layoutsArray = getFileContents(filename);
4492
+ const layoutsArray = getFileContents$1(filename);
4396
4493
 
4397
4494
  // add the pageObject to the pages file
4398
4495
  layoutsArray.push(layoutObject);
4399
4496
 
4400
4497
  // write the new pages configuration back to the file
4401
- writeFileSync(filename, JSON.stringify(layoutsArray, null, 2));
4498
+ writeFileSync$1(filename, JSON.stringify(layoutsArray, null, 2));
4402
4499
 
4403
4500
  // message the renderer
4404
- win.webContents.send(events$2.LAYOUT_SAVE_COMPLETE, {
4501
+ win.webContents.send(events$4.LAYOUT_SAVE_COMPLETE, {
4405
4502
  layouts: layoutsArray,
4406
4503
  });
4407
4504
  } catch (e) {
4408
- win.webContents.send(events$2.LAYOUT_SAVE_ERROR, {
4505
+ win.webContents.send(events$4.LAYOUT_SAVE_ERROR, {
4409
4506
  error: e.message,
4410
4507
  });
4411
4508
  }
@@ -4419,18 +4516,18 @@ const layoutController$1 = {
4419
4516
  */
4420
4517
  listLayoutsForApplication: (win, appId) => {
4421
4518
  try {
4422
- const filename = path$4.join(
4423
- app.getPath("userData"),
4424
- appName,
4519
+ const filename = path$7.join(
4520
+ app$2.getPath("userData"),
4521
+ appName$1,
4425
4522
  appId,
4426
- configFilename
4523
+ configFilename$1
4427
4524
  );
4428
- const layoutsArray = getFileContents(filename);
4429
- win.webContents.send(events$2.LAYOUT_LIST_COMPLETE, {
4525
+ const layoutsArray = getFileContents$1(filename);
4526
+ win.webContents.send(events$4.LAYOUT_LIST_COMPLETE, {
4430
4527
  layouts: layoutsArray,
4431
4528
  });
4432
4529
  } catch (e) {
4433
- win.webContents.send(events$2.LAYOUT_LIST_COMPLETE, {
4530
+ win.webContents.send(events$4.LAYOUT_LIST_COMPLETE, {
4434
4531
  error: true,
4435
4532
  message: e.message,
4436
4533
  });
@@ -4460,8 +4557,8 @@ const {
4460
4557
  const {
4461
4558
  StreamableHTTPClientTransport,
4462
4559
  } = require$$2$3;
4463
- const path$3 = require$$1$1;
4464
- const fs$3 = require$$2;
4560
+ const path$6 = require$$1$1;
4561
+ const fs$5 = require$$2;
4465
4562
 
4466
4563
  /**
4467
4564
  * Active MCP server connections
@@ -4959,20 +5056,20 @@ const mcpController$1 = {
4959
5056
  */
4960
5057
  getCatalog: (win) => {
4961
5058
  try {
4962
- const catalogPath = path$3.join(
5059
+ const catalogPath = path$6.join(
4963
5060
  __dirname,
4964
5061
  "..",
4965
5062
  "mcp",
4966
5063
  "mcpServerCatalog.json"
4967
5064
  );
4968
5065
 
4969
- if (!fs$3.existsSync(catalogPath)) {
5066
+ if (!fs$5.existsSync(catalogPath)) {
4970
5067
  return {
4971
5068
  catalog: [],
4972
5069
  };
4973
5070
  }
4974
5071
 
4975
- const catalogData = fs$3.readFileSync(catalogPath, "utf8");
5072
+ const catalogData = fs$5.readFileSync(catalogPath, "utf8");
4976
5073
  const catalog = JSON.parse(catalogData);
4977
5074
 
4978
5075
  return {
@@ -5025,8 +5122,8 @@ var mcpController_1 = mcpController$1;
5025
5122
  * - Support two-level browsing: packages (bundles) and widgets within packages
5026
5123
  */
5027
5124
 
5028
- const path$2 = require$$1$1;
5029
- const fs$2 = require$$2;
5125
+ const path$5 = require$$1$1;
5126
+ const fs$4 = require$$2;
5030
5127
 
5031
5128
  // Default registry URL (GitHub Pages)
5032
5129
  const DEFAULT_REGISTRY_URL =
@@ -5042,7 +5139,7 @@ let cacheTimestamp = 0;
5042
5139
  * Get the local test registry path for dev mode
5043
5140
  */
5044
5141
  function getTestRegistryPath() {
5045
- return path$2.join(__dirname, "..", "registry", "test-registry-index.json");
5142
+ return path$5.join(__dirname, "..", "registry", "test-registry-index.json");
5046
5143
  }
5047
5144
 
5048
5145
  /**
@@ -5078,12 +5175,12 @@ async function fetchRegistryIndex(forceRefresh = false) {
5078
5175
  if (isDev()) {
5079
5176
  // In dev mode, load from local test file
5080
5177
  const testPath = getTestRegistryPath();
5081
- if (fs$2.existsSync(testPath)) {
5178
+ if (fs$4.existsSync(testPath)) {
5082
5179
  console.log(
5083
5180
  "[RegistryController] Loading test registry from:",
5084
5181
  testPath
5085
5182
  );
5086
- const raw = fs$2.readFileSync(testPath, "utf8");
5183
+ const raw = fs$4.readFileSync(testPath, "utf8");
5087
5184
  indexData = JSON.parse(raw);
5088
5185
  } else {
5089
5186
  console.warn(
@@ -5255,76 +5352,778 @@ var registryController$1 = {
5255
5352
  checkUpdates,
5256
5353
  };
5257
5354
 
5258
- /**
5259
- * Core controller exports.
5260
- * Template-specific controllers (algolia, openai, menuItems, plugin) live in the template repo.
5261
- */
5355
+ var fs$3 = require$$2;
5356
+ var JSONStream = require$$4;
5357
+ const algoliasearch$1 = require$$2$4;
5358
+ const path$4 = require$$3$2;
5359
+ const { ensureDirectoryExistence, checkDirectory } = file;
5262
5360
 
5263
- const { showDialog, fileChosenError } = dialogController$1;
5264
- const {
5265
- isEncryptionAvailable,
5266
- saveData,
5267
- getData,
5268
- } = secureStoreController$1;
5269
- const {
5270
- listWorkspacesForApplication,
5271
- saveWorkspaceForApplication,
5272
- deleteWorkspaceForApplication,
5273
- } = workspaceController_1;
5274
- const {
5275
- saveThemeForApplication,
5276
- listThemesForApplication,
5277
- deleteThemeForApplication,
5278
- } = themeController_1;
5279
- const {
5280
- convertJsonToCsvFile,
5281
- convertJsonToCsvString,
5282
- saveToFile,
5283
- readFromFile,
5284
- parseXMLStream,
5285
- parseCSVStream,
5286
- readLinesFromFile,
5287
- transformFile,
5288
- readJSONFromFile,
5289
- readDataFromURL,
5290
- extractColorsFromImageURL,
5291
- } = dataController_1;
5292
- const {
5293
- saveSettingsForApplication,
5294
- getSettingsForApplication,
5295
- getDataDirectory,
5296
- setDataDirectory,
5297
- migrateDataDirectory,
5298
- } = settingsController_1;
5299
- const {
5300
- saveProvider,
5301
- listProviders,
5302
- getProvider,
5303
- deleteProvider,
5304
- } = providerController_1;
5361
+ let AlgoliaIndex$1 = class AlgoliaIndex {
5362
+ /**
5363
+ * @var client the algoliasearch client
5364
+ */
5365
+ client = null;
5305
5366
 
5306
- var controller = {
5307
- showDialog,
5308
- fileChosenError,
5309
- isEncryptionAvailable,
5310
- saveData,
5311
- getData,
5312
- listWorkspacesForApplication,
5313
- saveWorkspaceForApplication,
5314
- deleteWorkspaceForApplication,
5315
- saveThemeForApplication,
5316
- listThemesForApplication,
5317
- deleteThemeForApplication,
5318
- convertJsonToCsvFile,
5319
- convertJsonToCsvString,
5320
- parseXMLStream,
5321
- parseCSVStream,
5322
- readLinesFromFile,
5323
- saveToFile,
5324
- readFromFile,
5325
- saveSettingsForApplication,
5326
- getSettingsForApplication,
5327
- transformFile,
5367
+ /**
5368
+ * @var index the algoliasearch initiated index
5369
+ */
5370
+ index = null;
5371
+
5372
+ constructor(appId = "", apiKey = "", indexName = "") {
5373
+ if (appId !== "" && apiKey !== "" && indexName !== "") {
5374
+ this.client = algoliasearch$1(appId, apiKey);
5375
+ this.index = this.client.initIndex(indexName);
5376
+ }
5377
+ }
5378
+
5379
+ createBatchesFromJSONFile = (
5380
+ filepath,
5381
+ batchFilepath = "/data/batch",
5382
+ batchSize,
5383
+ callback = null
5384
+ ) => {
5385
+ return new Promise((resolve, reject) => {
5386
+ // instantiate the JSON parser that will be used by the readStream
5387
+ var parser = JSONStream.parse("*");
5388
+
5389
+ // count how many items have been added to a single batch
5390
+ var countForBatch = 0;
5391
+
5392
+ // counter for the number of batches (used as filename)
5393
+ var batchNumber = 1;
5394
+
5395
+ // create the readStream to parse the large file (json)
5396
+ var readStream = fs$3.createReadStream(filepath).pipe(parser);
5397
+
5398
+ var batch = [];
5399
+
5400
+ // lets first remove the batch folder
5401
+ this.clearDirectory(batchFilepath)
5402
+ .then(() => {
5403
+ // when we receive data...
5404
+ readStream.on("data", function (data) {
5405
+ try {
5406
+ // if we have reached the limit for the batch...
5407
+ // lets write to the batch file
5408
+ if (countForBatch === batchSize) {
5409
+ // write to the batch file
5410
+ var writeStream = fs$3.createWriteStream(
5411
+ batchFilepath +
5412
+ "/batch_" +
5413
+ batchNumber +
5414
+ ".json"
5415
+ );
5416
+ writeStream.write(JSON.stringify(batch));
5417
+ writeStream.close();
5418
+
5419
+ // adjust counts and reset batch array
5420
+ countForBatch = 0;
5421
+ // bump the batch number
5422
+ batchNumber++;
5423
+ // reset the batch json
5424
+ batch = [];
5425
+ // callback function to pass batchnumber (or anything later on)
5426
+ callback &&
5427
+ typeof callback === "function" &&
5428
+ callback(batchNumber);
5429
+ } else {
5430
+ try {
5431
+ // push the JSON data into the batch array to be written later
5432
+ batch.push(data);
5433
+ countForBatch++;
5434
+ } catch (e) {
5435
+ reject(e);
5436
+ }
5437
+ }
5438
+ } catch (e) {
5439
+ reject(e);
5440
+ }
5441
+ });
5442
+
5443
+ readStream.on("error", function (e) {
5444
+ console.log("batch on error ", e);
5445
+ reject(e);
5446
+ });
5447
+
5448
+ readStream.on("close", function () {
5449
+ console.log("batch on close ");
5450
+ resolve("batches completed ", batchNumber);
5451
+ });
5452
+ })
5453
+ .catch((e) => {
5454
+ console.log("catch batch ", e.message);
5455
+ reject(e);
5456
+ });
5457
+ });
5458
+ };
5459
+
5460
+ clearDirectory = (directoryPath) => {
5461
+ return new Promise((resolve, reject) => {
5462
+ try {
5463
+ checkDirectory(directoryPath);
5464
+ fs$3.readdir(directoryPath, (err, files) => {
5465
+ if (err) reject(err);
5466
+ if (files) {
5467
+ files.forEach((file) => {
5468
+ fs$3.unlinkSync(path$4.join(directoryPath, file));
5469
+ });
5470
+ resolve();
5471
+ }
5472
+ });
5473
+ } catch (e) {
5474
+ console.log("clear dir error ", e.message);
5475
+ reject(e);
5476
+ }
5477
+ });
5478
+ };
5479
+
5480
+ async partialUpdateObjectsFromDirectorySync(
5481
+ batchFilepath,
5482
+ createIfNotExists = false,
5483
+ callback = null
5484
+ ) {
5485
+ try {
5486
+ // read the directory...
5487
+ const files = await fs$3.readdirSync(batchFilepath);
5488
+ let results = [];
5489
+ for (const fileIndex in files) {
5490
+ // for each file lets read the file and then push to algolia
5491
+ const pathToBatch = path$4.join(batchFilepath, files[fileIndex]);
5492
+ const fileContents = await this.readFile(pathToBatch);
5493
+ if (fileContents) {
5494
+ if ("data" in fileContents && "filepath" in fileContents) {
5495
+ // now we can update the index with the partial update
5496
+ const updateResult = await this.partialUpdateObjects(
5497
+ fileContents.data,
5498
+ fileContents.filepath,
5499
+ createIfNotExists,
5500
+ callback
5501
+ );
5502
+ results.push({ file: files[fileIndex] });
5503
+ } else {
5504
+ console.log("missed ", files[fileIndex]);
5505
+ }
5506
+ }
5507
+ }
5508
+ return Promise.resolve(results);
5509
+ } catch (e) {
5510
+ return Promise.reject(e);
5511
+ }
5512
+ }
5513
+
5514
+ async readFile(filepath) {
5515
+ return await new Promise((resolve, reject) => {
5516
+ fs$3.readFile(filepath, "utf8", (err, data) => {
5517
+ if (err) {
5518
+ reject(err);
5519
+ }
5520
+ resolve({ data, filepath });
5521
+ });
5522
+ });
5523
+ }
5524
+
5525
+ browseObjects = (query = "", callback = null) => {
5526
+ return new Promise((resolve, reject) => {
5527
+ try {
5528
+ if (this.index !== null) {
5529
+ // call algolia to update the objects
5530
+ this.index
5531
+ .browseObjects({
5532
+ query,
5533
+ batch: (hits) => {
5534
+ if (
5535
+ callback &&
5536
+ typeof callback === "function"
5537
+ ) {
5538
+ callback(hits);
5539
+ }
5540
+ },
5541
+ })
5542
+ .then(() => {
5543
+ resolve({ success: true });
5544
+ })
5545
+ .catch((e) => reject(e));
5546
+ } else {
5547
+ reject("No index for client");
5548
+ }
5549
+ } catch (e) {
5550
+ console.log("browse objects ", e.message);
5551
+ reject(e);
5552
+ }
5553
+ });
5554
+ };
5555
+
5556
+ async partialUpdateObjects(
5557
+ objects,
5558
+ file,
5559
+ createIfNotExists = false,
5560
+ callback = null
5561
+ ) {
5562
+ return new Promise((resolve, reject) => {
5563
+ try {
5564
+ if (objects) {
5565
+ const batch = JSON.parse(objects);
5566
+
5567
+ // callback function to pass batchnumber (or anything later on)
5568
+ if (callback && typeof callback === "function") {
5569
+ callback("indexing objects ", file, batch.length);
5570
+ }
5571
+
5572
+ if (this.index !== null) {
5573
+ // call algolia to update the objects
5574
+ this.index
5575
+ .partialUpdateObjects(batch, {
5576
+ createIfNotExists: createIfNotExists,
5577
+ })
5578
+ .then(({ objectIDs }) => {
5579
+ resolve({
5580
+ success: true,
5581
+ batchComplete: batch.length,
5582
+ objectIDs,
5583
+ });
5584
+ })
5585
+ .catch((e) => {
5586
+ console.log(
5587
+ "Error partialUpdateObjects",
5588
+ e.message
5589
+ );
5590
+ reject(e);
5591
+ });
5592
+ } else {
5593
+ reject("No index for client");
5594
+ }
5595
+ }
5596
+ } catch (e) {
5597
+ console.log("partial update objects ", e.message);
5598
+ reject(e);
5599
+ }
5600
+ });
5601
+ }
5602
+
5603
+ saveObjects = (objects, file, callback = null) => {
5604
+ return new Promise((resolve, reject) => {
5605
+ try {
5606
+ if (objects) {
5607
+ const batch = JSON.parse(objects);
5608
+
5609
+ // callback function to pass batchnumber (or anything later on)
5610
+ if (callback && typeof callback === "function") {
5611
+ callback("saving objects ", file);
5612
+ }
5613
+
5614
+ if (this.index !== null) {
5615
+ // call algolia to update the objects
5616
+ this.index
5617
+ .saveObjects(batch, {
5618
+ autoGenerateObjectIDIfNotExist: true,
5619
+ })
5620
+ .then(({ objectIDs }) => {
5621
+ resolve({
5622
+ success: true,
5623
+ batchComplete: batch.length,
5624
+ file,
5625
+ objectIDs,
5626
+ });
5627
+ })
5628
+ .catch((e) => reject(e));
5629
+ } else {
5630
+ reject("No index for client");
5631
+ }
5632
+ }
5633
+ } catch (e) {
5634
+ console.log("save objects error", e.message);
5635
+ reject(e);
5636
+ }
5637
+ });
5638
+ };
5639
+ };
5640
+
5641
+ var algolia = AlgoliaIndex$1;
5642
+
5643
+ /**
5644
+ * algoliaController.js
5645
+ *
5646
+ * This is a sample controller that is called from the electron.js file
5647
+ *
5648
+ * The electron.js file contains listeners from the renderer that will call
5649
+ * the controller methods as seen below.
5650
+ */
5651
+
5652
+ const algoliasearch = require$$2$4;
5653
+ const events$3 = events$8;
5654
+ const AlgoliaIndex = algolia;
5655
+ var fs$2 = require$$2;
5656
+
5657
+ const algoliaController$1 = {
5658
+ /**
5659
+ * loadPagesForApplication
5660
+ * Load the pages for the application <userdata>/appId/pages.json
5661
+ * - filter out the indices that are "rule" indices
5662
+ *
5663
+ * @param {BrowserWindow} win the main window
5664
+ * @param {string} appId the application id from Algolia
5665
+ */
5666
+ listIndices: (win, application) => {
5667
+ try {
5668
+ const searchClient = algoliasearch(
5669
+ application["appId"],
5670
+ application["key"]
5671
+ );
5672
+ searchClient
5673
+ .listIndices()
5674
+ .then(({ items }) => {
5675
+ const filtered = items.filter(
5676
+ (item) => item.name.substring(0, 7) !== "sitehub"
5677
+ );
5678
+ win.webContents.send(
5679
+ events$3.ALGOLIA_LIST_INDICES_COMPLETE,
5680
+ filtered
5681
+ );
5682
+ })
5683
+ .catch((e) => {
5684
+ win.webContents.send(events$3.ALGOLIA_LIST_INDICES_ERROR, {
5685
+ error: e.message,
5686
+ });
5687
+ });
5688
+ } catch (e) {
5689
+ win.webContents.send(events$3.ALGOLIA_LIST_INDICES_ERROR, {
5690
+ error: e.message,
5691
+ });
5692
+ }
5693
+ },
5694
+
5695
+ getAnalyticsForQuery: (win, application, indexName, query) => {
5696
+ try {
5697
+ const baseUrl = "https://analytics.us.algolia.com";
5698
+ const headers = {
5699
+ "X-Algolia-Application-Id": application["appId"],
5700
+ "X-Algolia-API-Key": application["key"],
5701
+ };
5702
+ const url = `${baseUrl}/2/hits?search=${encodeURIComponent(
5703
+ query
5704
+ )}&clickAnalytics=true&index=${indexName}`;
5705
+ axios
5706
+ .get(url, {
5707
+ headers: headers,
5708
+ })
5709
+ .then((resp) => {
5710
+ if (resp.status === 200) {
5711
+ win.webContents.send(
5712
+ events$3.ALGOLIA_ANALYTICS_FOR_QUERY_COMPLETE,
5713
+ {
5714
+ result: resp.data,
5715
+ indexName: indexName,
5716
+ query: query,
5717
+ }
5718
+ );
5719
+ } else {
5720
+ win.webContents.send(
5721
+ events$3.ALGOLIA_ANALYTICS_FOR_QUERY_ERROR,
5722
+ {
5723
+ error: true,
5724
+ message: "Failed request",
5725
+ }
5726
+ );
5727
+ }
5728
+ })
5729
+ .catch((e) => {
5730
+ win.webContents.send(
5731
+ events$3.ALGOLIA_ANALYTICS_FOR_QUERY_ERROR,
5732
+ {
5733
+ error: true,
5734
+ message: e.message,
5735
+ }
5736
+ );
5737
+ });
5738
+ } catch (e) {
5739
+ win.webContents.send(events$3.ALGOLIA_ANALYTICS_FOR_QUERY_ERROR, {
5740
+ error: true,
5741
+ message: e.message,
5742
+ });
5743
+ }
5744
+ },
5745
+
5746
+ /**
5747
+ * browseObjectsToFile
5748
+ * Lets try and browse an index and pull down the hits and save as a file
5749
+ *
5750
+ * @param {*} win
5751
+ * @param {*} appId
5752
+ * @param {*} apiKey
5753
+ * @param {*} indexName
5754
+ * @param {*} toFilename
5755
+ * @param {*} query
5756
+ */
5757
+ browseObjectsToFile: (
5758
+ win,
5759
+ appId,
5760
+ apiKey,
5761
+ indexName,
5762
+ toFilename,
5763
+ query = ""
5764
+ ) => {
5765
+ try {
5766
+ if (
5767
+ toFilename !== "" &&
5768
+ apiKey !== "" &&
5769
+ indexName !== "" &&
5770
+ appId !== ""
5771
+ ) {
5772
+ // init the Algolia Index helper
5773
+ const a = new AlgoliaIndex(appId, apiKey, indexName);
5774
+ // create the write stream to store the hits
5775
+ const writeStream = fs$2.createWriteStream(toFilename);
5776
+ writeStream.write("[");
5777
+
5778
+ let sep = "";
5779
+
5780
+ // call the algolia browseObjects helper method
5781
+ a.browseObjects(query, (hits) => {
5782
+ win.webContents.send(
5783
+ events$3.ALGOLIA_BROWSE_OBJECTS_UPDATE,
5784
+ hits
5785
+ );
5786
+
5787
+ let count = 0;
5788
+ // write to the file
5789
+ hits.forEach((hit) => {
5790
+ writeStream.write(sep + JSON.stringify(hit));
5791
+ count++;
5792
+ sep = ",\n";
5793
+ });
5794
+ })
5795
+ .then((result) => {
5796
+ writeStream.write("]");
5797
+ win.webContents.send(
5798
+ events$3.ALGOLIA_BROWSE_OBJECTS_COMPLETE,
5799
+ result
5800
+ );
5801
+ })
5802
+ .catch((e) => {
5803
+ win.webContents.send(
5804
+ events$3.ALGOLIA_BROWSE_OBJECTS_ERROR,
5805
+ e
5806
+ );
5807
+ });
5808
+ } else {
5809
+ win.webContents.send(
5810
+ events$3.ALGOLIA_BROWSE_OBJECTS_ERROR,
5811
+ new Error("Missing parameters")
5812
+ );
5813
+ }
5814
+ } catch (e) {
5815
+ win.webContents.send(events$3.ALGOLIA_BROWSE_OBJECTS_ERROR, {
5816
+ error: e.message,
5817
+ });
5818
+ }
5819
+ },
5820
+
5821
+ async partialUpdateObjectsFromDirectory(
5822
+ win,
5823
+ appId,
5824
+ apiKey,
5825
+ indexName,
5826
+ dir,
5827
+ createIfNotExists = false
5828
+ ) {
5829
+ try {
5830
+ const a = new AlgoliaIndex(appId, apiKey, indexName);
5831
+ // now we can make the call to the utility and we are passing in the createIfNotExists FALSE by default
5832
+ a.partialUpdateObjectsFromDirectorySync(
5833
+ dir,
5834
+ createIfNotExists,
5835
+ (data) => {
5836
+ win.webContents.send(
5837
+ events$3.ALGOLIA_PARTIAL_UPDATE_OBJECTS_UPDATE,
5838
+ data
5839
+ );
5840
+ }
5841
+ )
5842
+ .then((result) => {
5843
+ win.webContents.send(
5844
+ events$3.ALGOLIA_PARTIAL_UPDATE_OBJECTS_COMPLETE,
5845
+ result
5846
+ );
5847
+ })
5848
+ .catch((e) => {
5849
+ win.webContents.send(
5850
+ events$3.ALGOLIA_PARTIAL_UPDATE_OBJECTS_ERROR,
5851
+ e
5852
+ );
5853
+ });
5854
+ } catch (e) {
5855
+ win.webContents.send(events$3.ALGOLIA_PARTIAL_UPDATE_OBJECTS_ERROR, {
5856
+ error: e.message,
5857
+ });
5858
+ }
5859
+ },
5860
+
5861
+ /**
5862
+ * createBatchesFromFile
5863
+ * @param {*} win
5864
+ * @param {*} filepath
5865
+ * @param {*} batchFilepath
5866
+ * @param {*} batchSize
5867
+ * @param {*} callback
5868
+ */
5869
+ createBatchesFromFile: (
5870
+ win,
5871
+ filepath,
5872
+ batchFilepath = "/data/batch",
5873
+ batchSize = 500
5874
+ ) => {
5875
+ try {
5876
+ const a = new AlgoliaIndex();
5877
+ a.createBatchesFromJSONFile(
5878
+ filepath,
5879
+ batchFilepath,
5880
+ batchSize,
5881
+ (data) => {
5882
+ win.webContents.send(
5883
+ events$3.ALGOLIA_CREATE_BATCH_UPDATE,
5884
+ data
5885
+ );
5886
+ }
5887
+ )
5888
+ .then((result) => {
5889
+ win.webContents.send(
5890
+ events$3.ALGOLIA_CREATE_BATCH_COMPLETE,
5891
+ result
5892
+ );
5893
+ })
5894
+ .catch((e) => {
5895
+ win.webContents.send(events$3.ALGOLIA_CREATE_BATCH_ERROR, e);
5896
+ });
5897
+ } catch (e) {
5898
+ win.webContents.send(events$3.ALGOLIA_CREATE_BATCH_ERROR, {
5899
+ error: e.message,
5900
+ });
5901
+ }
5902
+ },
5903
+ };
5904
+
5905
+ var algoliaController_1 = algoliaController$1;
5906
+
5907
+ const OpenAI = require$$0$3;
5908
+ const events$2 = events$8;
5909
+
5910
+ const openaiController$1 = {
5911
+ async describeImage(
5912
+ win,
5913
+ imageUrl,
5914
+ apiKey,
5915
+ prompt = "What's in this image?"
5916
+ ) {
5917
+ try {
5918
+ const openai = new OpenAI({
5919
+ apiKey: apiKey,
5920
+ });
5921
+ const response = await openai.chat.completions.create({
5922
+ model: "gpt-4-vision-preview",
5923
+ messages: [
5924
+ {
5925
+ role: "user",
5926
+ content: [
5927
+ { type: "text", text: prompt },
5928
+ {
5929
+ type: "image_url",
5930
+ image_url: imageUrl,
5931
+ },
5932
+ ],
5933
+ },
5934
+ ],
5935
+ });
5936
+
5937
+ win.webContents.send(events$2.OPENAI_DESCRIBE_IMAGE_COMPLETE, {
5938
+ succes: true,
5939
+ imageUrl,
5940
+ response,
5941
+ });
5942
+ } catch (e) {
5943
+ win.webContents.send(events$2.OPENAI_DESCRIBE_IMAGE_ERROR, {
5944
+ succes: true,
5945
+ error: e.message,
5946
+ });
5947
+ }
5948
+ },
5949
+ };
5950
+
5951
+ var openaiController_1 = openaiController$1;
5952
+
5953
+ const { app: app$1 } = require$$0;
5954
+ const path$3 = require$$1$1;
5955
+ const { writeFileSync } = require$$2;
5956
+ const { getFileContents } = file;
5957
+
5958
+ const configFilename = "menuItems.json";
5959
+ const appName = "Dashboard";
5960
+
5961
+ const menuItemsController$1 = {
5962
+ saveMenuItemForApplication: (win, appId, menuItem) => {
5963
+ try {
5964
+ // filename to the pages file (live pages)
5965
+ const filename = path$3.join(
5966
+ app$1.getPath("userData"),
5967
+ appName,
5968
+ appId,
5969
+ configFilename
5970
+ );
5971
+ const menuItemsArray = getFileContents(filename);
5972
+
5973
+ menuItemsArray.filter((mi) => mi !== null);
5974
+
5975
+ // add the menuItems object to the file
5976
+ menuItemsArray.push(menuItem);
5977
+
5978
+ // write the new pages configuration back to the file
5979
+ writeFileSync(filename, JSON.stringify(menuItemsArray, null, 2));
5980
+
5981
+ console.log("[menuItemsController] Menu item saved successfully");
5982
+
5983
+ // Return the data for ipcMain.handle() - modern promise-based approach
5984
+ return {
5985
+ menuItems: menuItemsArray,
5986
+ success: true,
5987
+ };
5988
+ } catch (e) {
5989
+ console.error("[menuItemsController] Error saving menu item:", e);
5990
+ // Return error object with empty menu items array
5991
+ return {
5992
+ error: true,
5993
+ message: e.message,
5994
+ menuItems: [],
5995
+ };
5996
+ }
5997
+ },
5998
+
5999
+ listMenuItemsForApplication: (win, appId) => {
6000
+ try {
6001
+ const filename = path$3.join(
6002
+ app$1.getPath("userData"),
6003
+ appName,
6004
+ appId,
6005
+ configFilename
6006
+ );
6007
+ const menuItemsArray = getFileContents(filename);
6008
+ const filtered = menuItemsArray.filter((mi) => mi !== null);
6009
+ // Return the data for ipcMain.handle() - modern promise-based approach
6010
+ return {
6011
+ menuItems: filtered,
6012
+ };
6013
+ } catch (e) {
6014
+ console.error("[menuItemsController] Error listing menu items:", e);
6015
+ // Return error object with empty menu items array
6016
+ return {
6017
+ error: true,
6018
+ message: e.message,
6019
+ menuItems: [],
6020
+ };
6021
+ }
6022
+ },
6023
+ };
6024
+
6025
+ var menuItemsController_1 = menuItemsController$1;
6026
+
6027
+ const path$2 = require$$1$1;
6028
+ const { app } = require$$0;
6029
+
6030
+ const pluginController$1 = {
6031
+ install: (win, packageName, filepath) => {
6032
+ try {
6033
+ const rootPath = path$2.join(
6034
+ app.getPath("userData"),
6035
+ "plugins",
6036
+ packageName
6037
+ );
6038
+ } catch (e) {
6039
+ win.webContents.send("plugin-install-error", { error: e.message });
6040
+ }
6041
+ },
6042
+ };
6043
+
6044
+ var pluginController_1 = pluginController$1;
6045
+
6046
+ /**
6047
+ * Controller exports.
6048
+ */
6049
+
6050
+ const { showDialog, fileChosenError } = dialogController$1;
6051
+ const {
6052
+ isEncryptionAvailable,
6053
+ saveData,
6054
+ getData,
6055
+ } = secureStoreController$1;
6056
+ const {
6057
+ listWorkspacesForApplication,
6058
+ saveWorkspaceForApplication,
6059
+ deleteWorkspaceForApplication,
6060
+ } = workspaceController_1;
6061
+ const {
6062
+ saveThemeForApplication,
6063
+ listThemesForApplication,
6064
+ deleteThemeForApplication,
6065
+ } = themeController_1;
6066
+ const {
6067
+ convertJsonToCsvFile,
6068
+ convertJsonToCsvString,
6069
+ saveToFile,
6070
+ readFromFile,
6071
+ parseXMLStream,
6072
+ parseCSVStream,
6073
+ readLinesFromFile,
6074
+ transformFile,
6075
+ readJSONFromFile,
6076
+ readDataFromURL,
6077
+ extractColorsFromImageURL,
6078
+ } = dataController_1;
6079
+ const {
6080
+ saveSettingsForApplication,
6081
+ getSettingsForApplication,
6082
+ getDataDirectory,
6083
+ setDataDirectory,
6084
+ migrateDataDirectory,
6085
+ } = settingsController_1;
6086
+ const {
6087
+ saveProvider,
6088
+ listProviders,
6089
+ getProvider,
6090
+ deleteProvider,
6091
+ } = providerController_1;
6092
+ const {
6093
+ listIndices,
6094
+ partialUpdateObjectsFromDirectory,
6095
+ createBatchesFromFile,
6096
+ browseObjectsToFile,
6097
+ } = algoliaController_1;
6098
+ const { describeImage } = openaiController_1;
6099
+ const {
6100
+ saveMenuItemForApplication,
6101
+ listMenuItemsForApplication,
6102
+ } = menuItemsController_1;
6103
+ const { install: pluginInstall } = pluginController_1;
6104
+
6105
+ var controller = {
6106
+ showDialog,
6107
+ fileChosenError,
6108
+ isEncryptionAvailable,
6109
+ saveData,
6110
+ getData,
6111
+ listWorkspacesForApplication,
6112
+ saveWorkspaceForApplication,
6113
+ deleteWorkspaceForApplication,
6114
+ saveThemeForApplication,
6115
+ listThemesForApplication,
6116
+ deleteThemeForApplication,
6117
+ convertJsonToCsvFile,
6118
+ convertJsonToCsvString,
6119
+ parseXMLStream,
6120
+ parseCSVStream,
6121
+ readLinesFromFile,
6122
+ saveToFile,
6123
+ readFromFile,
6124
+ saveSettingsForApplication,
6125
+ getSettingsForApplication,
6126
+ transformFile,
5328
6127
  readJSONFromFile,
5329
6128
  readDataFromURL,
5330
6129
  extractColorsFromImageURL,
@@ -5335,24 +6134,32 @@ var controller = {
5335
6134
  getDataDirectory,
5336
6135
  setDataDirectory,
5337
6136
  migrateDataDirectory,
6137
+ listIndices,
6138
+ partialUpdateObjectsFromDirectory,
6139
+ createBatchesFromFile,
6140
+ browseObjectsToFile,
6141
+ describeImage,
6142
+ saveMenuItemForApplication,
6143
+ listMenuItemsForApplication,
6144
+ pluginInstall,
5338
6145
  };
5339
6146
 
5340
- const { ipcRenderer: ipcRenderer$b } = require$$0;
6147
+ const { ipcRenderer: ipcRenderer$f } = require$$0;
5341
6148
  const {
5342
6149
  SECURE_STORE_ENCRYPTION_CHECK,
5343
6150
  SECURE_STORE_SET_DATA,
5344
6151
  SECURE_STORE_GET_DATA,
5345
- } = events$6;
6152
+ } = events$8;
5346
6153
  /**
5347
6154
  * secureStoreApi
5348
6155
  * - for Apple, keychain methods
5349
6156
  */
5350
6157
  const secureStoreApi$2 = {
5351
6158
  isEncryptionAvailable: () =>
5352
- ipcRenderer$b.invoke(SECURE_STORE_ENCRYPTION_CHECK, {}),
6159
+ ipcRenderer$f.invoke(SECURE_STORE_ENCRYPTION_CHECK, {}),
5353
6160
  saveData: (key, value) =>
5354
- ipcRenderer$b.invoke(SECURE_STORE_SET_DATA, { key, value }),
5355
- getData: (key) => ipcRenderer$b.invoke(SECURE_STORE_GET_DATA, { key }),
6161
+ ipcRenderer$f.invoke(SECURE_STORE_SET_DATA, { key, value }),
6162
+ getData: (key) => ipcRenderer$f.invoke(SECURE_STORE_GET_DATA, { key }),
5356
6163
  };
5357
6164
 
5358
6165
  var secureStoreApi_1 = secureStoreApi$2;
@@ -5363,12 +6170,12 @@ var secureStoreApi_1 = secureStoreApi$2;
5363
6170
  * Handle the workspace configuration file
5364
6171
  */
5365
6172
 
5366
- const { ipcRenderer: ipcRenderer$a } = require$$0;
6173
+ const { ipcRenderer: ipcRenderer$e } = require$$0;
5367
6174
  const {
5368
6175
  WORKSPACE_LIST,
5369
6176
  WORKSPACE_SAVE,
5370
6177
  WORKSPACE_DELETE,
5371
- } = events$6;
6178
+ } = events$8;
5372
6179
 
5373
6180
  const workspaceApi$2 = {
5374
6181
  /**
@@ -5380,7 +6187,7 @@ const workspaceApi$2 = {
5380
6187
  */
5381
6188
  listWorkspacesForApplication: (appId) => {
5382
6189
  console.log("listWorkspacesForApplication called with appId:", appId);
5383
- return ipcRenderer$a.invoke(WORKSPACE_LIST, { appId });
6190
+ return ipcRenderer$e.invoke(WORKSPACE_LIST, { appId });
5384
6191
  },
5385
6192
 
5386
6193
  /**
@@ -5391,7 +6198,7 @@ const workspaceApi$2 = {
5391
6198
  * @returns
5392
6199
  */
5393
6200
  saveWorkspaceForApplication: (appId, data) =>
5394
- ipcRenderer$a.invoke(WORKSPACE_SAVE, { appId, data }),
6201
+ ipcRenderer$e.invoke(WORKSPACE_SAVE, { appId, data }),
5395
6202
 
5396
6203
  /**
5397
6204
  * deleteWorkspaceForApplication
@@ -5401,7 +6208,7 @@ const workspaceApi$2 = {
5401
6208
  * @returns
5402
6209
  */
5403
6210
  deleteWorkspaceForApplication: (appId, workspaceId) =>
5404
- ipcRenderer$a.invoke(WORKSPACE_DELETE, { appId, workspaceId }),
6211
+ ipcRenderer$e.invoke(WORKSPACE_DELETE, { appId, workspaceId }),
5405
6212
  };
5406
6213
 
5407
6214
  var workspaceApi_1 = workspaceApi$2;
@@ -5413,15 +6220,15 @@ var workspaceApi_1 = workspaceApi$2;
5413
6220
  */
5414
6221
 
5415
6222
  // ipcRenderer that must be used to invoke the events
5416
- const { ipcRenderer: ipcRenderer$9 } = require$$0;
6223
+ const { ipcRenderer: ipcRenderer$d } = require$$0;
5417
6224
 
5418
- const { LAYOUT_LIST, LAYOUT_SAVE } = events$6;
6225
+ const { LAYOUT_LIST, LAYOUT_SAVE } = events$8;
5419
6226
 
5420
6227
  const layoutApi$2 = {
5421
6228
  listLayoutsForApplication: (appId) =>
5422
- ipcRenderer$9.invoke(LAYOUT_LIST, { appId }),
6229
+ ipcRenderer$d.invoke(LAYOUT_LIST, { appId }),
5423
6230
  saveLayoutForApplication: (appId, data) =>
5424
- ipcRenderer$9.invoke(LAYOUT_SAVE, { appId, data }),
6231
+ ipcRenderer$d.invoke(LAYOUT_SAVE, { appId, data }),
5425
6232
  };
5426
6233
 
5427
6234
  var layoutApi_1 = layoutApi$2;
@@ -5433,7 +6240,7 @@ var layoutApi_1 = layoutApi$2;
5433
6240
  */
5434
6241
 
5435
6242
  // ipcRenderer that must be used to invoke the events
5436
- const { ipcRenderer: ipcRenderer$8 } = require$$0;
6243
+ const { ipcRenderer: ipcRenderer$c } = require$$0;
5437
6244
 
5438
6245
  const {
5439
6246
  DATA_JSON_TO_CSV_FILE,
@@ -5447,12 +6254,12 @@ const {
5447
6254
  READ_JSON,
5448
6255
  READ_DATA_URL,
5449
6256
  EXTRACT_COLORS_FROM_IMAGE,
5450
- } = events$6;
6257
+ } = events$8;
5451
6258
 
5452
6259
  const dataApi$2 = {
5453
6260
  // convert a json array of objects to a csv string and save to file
5454
6261
  convertJsonToCsvFile: (appId, jsonObject, filename) =>
5455
- ipcRenderer$8.invoke(DATA_JSON_TO_CSV_FILE, {
6262
+ ipcRenderer$c.invoke(DATA_JSON_TO_CSV_FILE, {
5456
6263
  appId,
5457
6264
  jsonObject,
5458
6265
  filename,
@@ -5460,10 +6267,10 @@ const dataApi$2 = {
5460
6267
 
5461
6268
  // convert a json array of objects to a csv string and return a string
5462
6269
  convertJsonToCsvString: (appId, jsonObject) =>
5463
- ipcRenderer$8.invoke(DATA_JSON_TO_CSV_STRING, { appId, jsonObject }),
6270
+ ipcRenderer$c.invoke(DATA_JSON_TO_CSV_STRING, { appId, jsonObject }),
5464
6271
 
5465
6272
  parseXMLStream: (filepath, outpath, start) =>
5466
- ipcRenderer$8.invoke(PARSE_XML_STREAM, {
6273
+ ipcRenderer$c.invoke(PARSE_XML_STREAM, {
5467
6274
  filepath,
5468
6275
  outpath,
5469
6276
  start,
@@ -5477,7 +6284,7 @@ const dataApi$2 = {
5477
6284
  headers = null,
5478
6285
  limit = null
5479
6286
  ) => {
5480
- ipcRenderer$8.invoke(PARSE_CSV_STREAM, {
6287
+ ipcRenderer$c.invoke(PARSE_CSV_STREAM, {
5481
6288
  filepath,
5482
6289
  outpath,
5483
6290
  delimiter,
@@ -5488,15 +6295,15 @@ const dataApi$2 = {
5488
6295
  },
5489
6296
 
5490
6297
  readLinesFromFile: (filepath, lineCount) => {
5491
- ipcRenderer$8.invoke(READ_LINES, { filepath, lineCount });
6298
+ ipcRenderer$c.invoke(READ_LINES, { filepath, lineCount });
5492
6299
  },
5493
6300
 
5494
6301
  readJSONFromFile: (filepath, objectCount = null) => {
5495
- ipcRenderer$8.invoke(READ_JSON, { filepath, objectCount });
6302
+ ipcRenderer$c.invoke(READ_JSON, { filepath, objectCount });
5496
6303
  },
5497
6304
 
5498
6305
  readDataFromURL: (url, toFilepath) => {
5499
- ipcRenderer$8.invoke(READ_DATA_URL, { url, toFilepath });
6306
+ ipcRenderer$c.invoke(READ_DATA_URL, { url, toFilepath });
5500
6307
  },
5501
6308
 
5502
6309
  /*
@@ -5505,7 +6312,7 @@ const dataApi$2 = {
5505
6312
  * @param {object} returnEmpty the return empty object
5506
6313
  */
5507
6314
  saveData: (data, filename, append, returnEmpty, uuid) =>
5508
- ipcRenderer$8.invoke(DATA_SAVE_TO_FILE, {
6315
+ ipcRenderer$c.invoke(DATA_SAVE_TO_FILE, {
5509
6316
  data,
5510
6317
  filename,
5511
6318
  append,
@@ -5517,14 +6324,14 @@ const dataApi$2 = {
5517
6324
  * @param {string} filename the filename to read (not path)
5518
6325
  */
5519
6326
  readData: (filename, returnEmpty = []) =>
5520
- ipcRenderer$8.invoke(DATA_READ_FROM_FILE, { filename, returnEmpty }),
6327
+ ipcRenderer$c.invoke(DATA_READ_FROM_FILE, { filename, returnEmpty }),
5521
6328
 
5522
6329
  /**
5523
6330
  * transformFile
5524
6331
  * @returns
5525
6332
  */
5526
6333
  transformFile: (filepath, outFilepath, mappingFunctionBody, args) => {
5527
- ipcRenderer$8.invoke(TRANSFORM_FILE, {
6334
+ ipcRenderer$c.invoke(TRANSFORM_FILE, {
5528
6335
  filepath,
5529
6336
  outFilepath,
5530
6337
  mappingFunctionBody,
@@ -5533,7 +6340,7 @@ const dataApi$2 = {
5533
6340
  },
5534
6341
 
5535
6342
  extractColorsFromImageURL: (url) => {
5536
- ipcRenderer$8.invoke(EXTRACT_COLORS_FROM_IMAGE, {
6343
+ ipcRenderer$c.invoke(EXTRACT_COLORS_FROM_IMAGE, {
5537
6344
  url,
5538
6345
  });
5539
6346
  },
@@ -5548,7 +6355,7 @@ var dataApi_1 = dataApi$2;
5548
6355
  */
5549
6356
 
5550
6357
  // ipcRenderer that must be used to invoke the events
5551
- const { ipcRenderer: ipcRenderer$7 } = require$$0;
6358
+ const { ipcRenderer: ipcRenderer$b } = require$$0;
5552
6359
 
5553
6360
  const {
5554
6361
  SETTINGS_GET,
@@ -5556,17 +6363,17 @@ const {
5556
6363
  SETTINGS_GET_DATA_DIR,
5557
6364
  SETTINGS_SET_DATA_DIR,
5558
6365
  SETTINGS_MIGRATE_DATA_DIR,
5559
- } = events$6;
6366
+ } = events$8;
5560
6367
 
5561
6368
  const settingsApi$2 = {
5562
- getSettingsForApplication: () => ipcRenderer$7.invoke(SETTINGS_GET, {}),
6369
+ getSettingsForApplication: () => ipcRenderer$b.invoke(SETTINGS_GET, {}),
5563
6370
  saveSettingsForApplication: (data) =>
5564
- ipcRenderer$7.invoke(SETTINGS_SAVE, { data }),
5565
- getDataDirectory: () => ipcRenderer$7.invoke(SETTINGS_GET_DATA_DIR, {}),
6371
+ ipcRenderer$b.invoke(SETTINGS_SAVE, { data }),
6372
+ getDataDirectory: () => ipcRenderer$b.invoke(SETTINGS_GET_DATA_DIR, {}),
5566
6373
  setDataDirectory: (dataDirectory) =>
5567
- ipcRenderer$7.invoke(SETTINGS_SET_DATA_DIR, { dataDirectory }),
6374
+ ipcRenderer$b.invoke(SETTINGS_SET_DATA_DIR, { dataDirectory }),
5568
6375
  migrateDataDirectory: (oldDirectory, newDirectory) =>
5569
- ipcRenderer$7.invoke(SETTINGS_MIGRATE_DATA_DIR, {
6376
+ ipcRenderer$b.invoke(SETTINGS_MIGRATE_DATA_DIR, {
5570
6377
  oldDirectory,
5571
6378
  newDirectory,
5572
6379
  }),
@@ -5581,9 +6388,9 @@ var settingsApi_1 = settingsApi$2;
5581
6388
  */
5582
6389
 
5583
6390
  // ipcRenderer that must be used to invoke the events
5584
- const { ipcRenderer: ipcRenderer$6 } = require$$0;
6391
+ const { ipcRenderer: ipcRenderer$a } = require$$0;
5585
6392
 
5586
- const { CHOOSE_FILE } = events$6;
6393
+ const { CHOOSE_FILE } = events$8;
5587
6394
 
5588
6395
  const dialogApi$2 = {
5589
6396
  /**
@@ -5593,7 +6400,7 @@ const dialogApi$2 = {
5593
6400
  */
5594
6401
  chooseFile: (allowFile = true, extensions = ["*"]) => {
5595
6402
  console.log("dialog api choose file");
5596
- return ipcRenderer$6.invoke(CHOOSE_FILE, { allowFile, extensions });
6403
+ return ipcRenderer$a.invoke(CHOOSE_FILE, { allowFile, extensions });
5597
6404
  },
5598
6405
  };
5599
6406
 
@@ -5612,7 +6419,7 @@ var dialogApi_1 = dialogApi$2;
5612
6419
  * mainApi.widgets.uninstall('Weather')
5613
6420
  */
5614
6421
 
5615
- const { ipcRenderer: ipcRenderer$5 } = require$$0;
6422
+ const { ipcRenderer: ipcRenderer$9 } = require$$0;
5616
6423
 
5617
6424
  const widgetApi$2 = {
5618
6425
  /**
@@ -5621,7 +6428,7 @@ const widgetApi$2 = {
5621
6428
  */
5622
6429
  list: async () => {
5623
6430
  try {
5624
- return await ipcRenderer$5.invoke("widget:list");
6431
+ return await ipcRenderer$9.invoke("widget:list");
5625
6432
  } catch (error) {
5626
6433
  console.error("[WidgetApi] Error listing widgets:", error);
5627
6434
  throw error;
@@ -5635,7 +6442,7 @@ const widgetApi$2 = {
5635
6442
  */
5636
6443
  get: async (widgetName) => {
5637
6444
  try {
5638
- return await ipcRenderer$5.invoke("widget:get", widgetName);
6445
+ return await ipcRenderer$9.invoke("widget:get", widgetName);
5639
6446
  } catch (error) {
5640
6447
  console.error(
5641
6448
  `[WidgetApi] Error getting widget ${widgetName}:`,
@@ -5669,7 +6476,7 @@ const widgetApi$2 = {
5669
6476
  console.log(
5670
6477
  `[WidgetApi] Installing widget: ${widgetName} from ${downloadUrl}`
5671
6478
  );
5672
- const config = await ipcRenderer$5.invoke(
6479
+ const config = await ipcRenderer$9.invoke(
5673
6480
  "widget:install",
5674
6481
  widgetName,
5675
6482
  downloadUrl,
@@ -5709,7 +6516,7 @@ const widgetApi$2 = {
5709
6516
  console.log(
5710
6517
  `[WidgetApi] Installing local widget: ${widgetName} from ${localPath}`
5711
6518
  );
5712
- const config = await ipcRenderer$5.invoke(
6519
+ const config = await ipcRenderer$9.invoke(
5713
6520
  "widget:install-local",
5714
6521
  widgetName,
5715
6522
  localPath,
@@ -5742,7 +6549,7 @@ const widgetApi$2 = {
5742
6549
  console.log(
5743
6550
  `[WidgetApi] Loading widgets from folder: ${folderPath}`
5744
6551
  );
5745
- const results = await ipcRenderer$5.invoke(
6552
+ const results = await ipcRenderer$9.invoke(
5746
6553
  "widget:load-folder",
5747
6554
  folderPath
5748
6555
  );
@@ -5771,7 +6578,7 @@ const widgetApi$2 = {
5771
6578
  uninstall: async (widgetName) => {
5772
6579
  try {
5773
6580
  console.log(`[WidgetApi] Uninstalling widget: ${widgetName}`);
5774
- const success = await ipcRenderer$5.invoke(
6581
+ const success = await ipcRenderer$9.invoke(
5775
6582
  "widget:uninstall",
5776
6583
  widgetName
5777
6584
  );
@@ -5797,7 +6604,7 @@ const widgetApi$2 = {
5797
6604
  */
5798
6605
  getCachePath: async () => {
5799
6606
  try {
5800
- return await ipcRenderer$5.invoke("widget:cache-path");
6607
+ return await ipcRenderer$9.invoke("widget:cache-path");
5801
6608
  } catch (error) {
5802
6609
  console.error("[WidgetApi] Error getting cache path:", error);
5803
6610
  throw error;
@@ -5811,7 +6618,7 @@ const widgetApi$2 = {
5811
6618
  */
5812
6619
  getStoragePath: async () => {
5813
6620
  try {
5814
- return await ipcRenderer$5.invoke("widget:storage-path");
6621
+ return await ipcRenderer$9.invoke("widget:storage-path");
5815
6622
  } catch (error) {
5816
6623
  console.error("[WidgetApi] Error getting storage path:", error);
5817
6624
  throw error;
@@ -5828,7 +6635,7 @@ const widgetApi$2 = {
5828
6635
  setStoragePath: async (customPath) => {
5829
6636
  try {
5830
6637
  console.log(`[WidgetApi] Setting storage path to: ${customPath}`);
5831
- const result = await ipcRenderer$5.invoke(
6638
+ const result = await ipcRenderer$9.invoke(
5832
6639
  "widget:set-storage-path",
5833
6640
  customPath
5834
6641
  );
@@ -5852,7 +6659,7 @@ const widgetApi$2 = {
5852
6659
  */
5853
6660
  getComponentConfigs: async () => {
5854
6661
  try {
5855
- return await ipcRenderer$5.invoke("widget:get-component-configs");
6662
+ return await ipcRenderer$9.invoke("widget:get-component-configs");
5856
6663
  } catch (error) {
5857
6664
  console.error(
5858
6665
  "[WidgetApi] Error getting component configs:",
@@ -5870,7 +6677,7 @@ const widgetApi$2 = {
5870
6677
  */
5871
6678
  readBundle: async (widgetName) => {
5872
6679
  try {
5873
- return await ipcRenderer$5.invoke("widget:read-bundle", widgetName);
6680
+ return await ipcRenderer$9.invoke("widget:read-bundle", widgetName);
5874
6681
  } catch (error) {
5875
6682
  console.error(
5876
6683
  `[WidgetApi] Error reading bundle for ${widgetName}:`,
@@ -5887,7 +6694,7 @@ const widgetApi$2 = {
5887
6694
  */
5888
6695
  readAllBundles: async () => {
5889
6696
  try {
5890
- return await ipcRenderer$5.invoke("widget:read-all-bundles");
6697
+ return await ipcRenderer$9.invoke("widget:read-all-bundles");
5891
6698
  } catch (error) {
5892
6699
  console.error("[WidgetApi] Error reading all bundles:", error);
5893
6700
  return [];
@@ -5907,7 +6714,7 @@ const widgetApi$2 = {
5907
6714
  * });
5908
6715
  */
5909
6716
  onInstalled: (callback) => {
5910
- ipcRenderer$5.on("widget:installed", (event, data) => {
6717
+ ipcRenderer$9.on("widget:installed", (event, data) => {
5911
6718
  callback(data);
5912
6719
  });
5913
6720
  },
@@ -5925,7 +6732,7 @@ const widgetApi$2 = {
5925
6732
  * });
5926
6733
  */
5927
6734
  onLoaded: (callback) => {
5928
- ipcRenderer$5.on("widgets:loaded", (event, data) => {
6735
+ ipcRenderer$9.on("widgets:loaded", (event, data) => {
5929
6736
  callback(data);
5930
6737
  });
5931
6738
  },
@@ -5936,7 +6743,7 @@ const widgetApi$2 = {
5936
6743
  * @param {Function} callback - The callback to remove
5937
6744
  */
5938
6745
  removeInstalledListener: (callback) => {
5939
- ipcRenderer$5.removeListener("widget:installed", callback);
6746
+ ipcRenderer$9.removeListener("widget:installed", callback);
5940
6747
  },
5941
6748
 
5942
6749
  /**
@@ -5945,7 +6752,7 @@ const widgetApi$2 = {
5945
6752
  * @param {Function} callback - The callback to remove
5946
6753
  */
5947
6754
  removeLoadedListener: (callback) => {
5948
- ipcRenderer$5.removeListener("widgets:loaded", callback);
6755
+ ipcRenderer$9.removeListener("widgets:loaded", callback);
5949
6756
  },
5950
6757
  };
5951
6758
 
@@ -5958,13 +6765,13 @@ var widgetApi_1 = widgetApi$2;
5958
6765
  * Communicates with main process via IPC to handle encryption and file storage
5959
6766
  */
5960
6767
 
5961
- const { ipcRenderer: ipcRenderer$4 } = require$$0;
6768
+ const { ipcRenderer: ipcRenderer$8 } = require$$0;
5962
6769
  const {
5963
6770
  PROVIDER_SAVE,
5964
6771
  PROVIDER_LIST,
5965
6772
  PROVIDER_GET,
5966
6773
  PROVIDER_DELETE,
5967
- } = events$6;
6774
+ } = events$8;
5968
6775
 
5969
6776
  const providerApi$2 = {
5970
6777
  /**
@@ -5988,7 +6795,7 @@ const providerApi$2 = {
5988
6795
  providerClass = "credential",
5989
6796
  mcpConfig = null
5990
6797
  ) =>
5991
- ipcRenderer$4.invoke(PROVIDER_SAVE, {
6798
+ ipcRenderer$8.invoke(PROVIDER_SAVE, {
5992
6799
  appId,
5993
6800
  providerName,
5994
6801
  providerType,
@@ -6005,7 +6812,7 @@ const providerApi$2 = {
6005
6812
  * @param {String} appId - the appId specified in the dash initialization
6006
6813
  * @returns {Promise<Array>} Array of provider objects with name, type, credentials
6007
6814
  */
6008
- listProviders: (appId) => ipcRenderer$4.invoke(PROVIDER_LIST, { appId }),
6815
+ listProviders: (appId) => ipcRenderer$8.invoke(PROVIDER_LIST, { appId }),
6009
6816
 
6010
6817
  /**
6011
6818
  * getProvider
@@ -6017,7 +6824,7 @@ const providerApi$2 = {
6017
6824
  * @returns {Promise<Object>} Provider object with name, type, credentials
6018
6825
  */
6019
6826
  getProvider: (appId, providerName) =>
6020
- ipcRenderer$4.invoke(PROVIDER_GET, { appId, providerName }),
6827
+ ipcRenderer$8.invoke(PROVIDER_GET, { appId, providerName }),
6021
6828
 
6022
6829
  /**
6023
6830
  * deleteProvider
@@ -6029,7 +6836,7 @@ const providerApi$2 = {
6029
6836
  * @returns {Promise}
6030
6837
  */
6031
6838
  deleteProvider: (appId, providerName) =>
6032
- ipcRenderer$4.invoke(PROVIDER_DELETE, { appId, providerName }),
6839
+ ipcRenderer$8.invoke(PROVIDER_DELETE, { appId, providerName }),
6033
6840
 
6034
6841
  /**
6035
6842
  * listProvidersForApplication
@@ -6039,14 +6846,14 @@ const providerApi$2 = {
6039
6846
  * @param {String} appId - the appId specified in the dash initialization
6040
6847
  */
6041
6848
  listProvidersForApplication: (appId) => {
6042
- ipcRenderer$4
6849
+ ipcRenderer$8
6043
6850
  .invoke(PROVIDER_LIST, { appId })
6044
6851
  .then((result) => {
6045
6852
  // Emit the event for ElectronDashboardApi to listen to
6046
- ipcRenderer$4.send("PROVIDER_LIST_COMPLETE", result);
6853
+ ipcRenderer$8.send("PROVIDER_LIST_COMPLETE", result);
6047
6854
  })
6048
6855
  .catch((error) => {
6049
- ipcRenderer$4.send("PROVIDER_LIST_ERROR", {
6856
+ ipcRenderer$8.send("PROVIDER_LIST_ERROR", {
6050
6857
  error: error.message,
6051
6858
  });
6052
6859
  });
@@ -6063,7 +6870,7 @@ const providerApi$2 = {
6063
6870
  providerType,
6064
6871
  credentials
6065
6872
  ) => {
6066
- ipcRenderer$4
6873
+ ipcRenderer$8
6067
6874
  .invoke(PROVIDER_SAVE, {
6068
6875
  appId,
6069
6876
  providerName,
@@ -6071,10 +6878,10 @@ const providerApi$2 = {
6071
6878
  credentials,
6072
6879
  })
6073
6880
  .then((result) => {
6074
- ipcRenderer$4.send("PROVIDER_SAVE_COMPLETE", result);
6881
+ ipcRenderer$8.send("PROVIDER_SAVE_COMPLETE", result);
6075
6882
  })
6076
6883
  .catch((error) => {
6077
- ipcRenderer$4.send("PROVIDER_SAVE_ERROR", {
6884
+ ipcRenderer$8.send("PROVIDER_SAVE_ERROR", {
6078
6885
  error: error.message,
6079
6886
  });
6080
6887
  });
@@ -6086,13 +6893,13 @@ const providerApi$2 = {
6086
6893
  * Event-listener-based version for use with ElectronDashboardApi
6087
6894
  */
6088
6895
  getProviderForApplication: (appId, providerName) => {
6089
- ipcRenderer$4
6896
+ ipcRenderer$8
6090
6897
  .invoke(PROVIDER_GET, { appId, providerName })
6091
6898
  .then((result) => {
6092
- ipcRenderer$4.send("PROVIDER_GET_COMPLETE", result);
6899
+ ipcRenderer$8.send("PROVIDER_GET_COMPLETE", result);
6093
6900
  })
6094
6901
  .catch((error) => {
6095
- ipcRenderer$4.send("PROVIDER_GET_ERROR", {
6902
+ ipcRenderer$8.send("PROVIDER_GET_ERROR", {
6096
6903
  error: error.message,
6097
6904
  });
6098
6905
  });
@@ -6104,13 +6911,13 @@ const providerApi$2 = {
6104
6911
  * Event-listener-based version for use with ElectronDashboardApi
6105
6912
  */
6106
6913
  deleteProviderForApplication: (appId, providerName) => {
6107
- ipcRenderer$4
6914
+ ipcRenderer$8
6108
6915
  .invoke(PROVIDER_DELETE, { appId, providerName })
6109
6916
  .then((result) => {
6110
- ipcRenderer$4.send("PROVIDER_DELETE_COMPLETE", result);
6917
+ ipcRenderer$8.send("PROVIDER_DELETE_COMPLETE", result);
6111
6918
  })
6112
6919
  .catch((error) => {
6113
- ipcRenderer$4.send("PROVIDER_DELETE_ERROR", {
6920
+ ipcRenderer$8.send("PROVIDER_DELETE_ERROR", {
6114
6921
  error: error.message,
6115
6922
  });
6116
6923
  });
@@ -6126,7 +6933,7 @@ var providerApi_1 = providerApi$2;
6126
6933
  * Communicates with main process via IPC to manage MCP server lifecycle.
6127
6934
  */
6128
6935
 
6129
- const { ipcRenderer: ipcRenderer$3 } = require$$0;
6936
+ const { ipcRenderer: ipcRenderer$7 } = require$$0;
6130
6937
  const {
6131
6938
  MCP_START_SERVER,
6132
6939
  MCP_STOP_SERVER,
@@ -6136,7 +6943,7 @@ const {
6136
6943
  MCP_READ_RESOURCE,
6137
6944
  MCP_SERVER_STATUS,
6138
6945
  MCP_GET_CATALOG,
6139
- } = events$6;
6946
+ } = events$8;
6140
6947
 
6141
6948
  const mcpApi$2 = {
6142
6949
  /**
@@ -6149,7 +6956,7 @@ const mcpApi$2 = {
6149
6956
  * @returns {Promise<{ success, serverName, tools, status } | { error, message }>}
6150
6957
  */
6151
6958
  startServer: (serverName, mcpConfig, credentials) =>
6152
- ipcRenderer$3.invoke(MCP_START_SERVER, {
6959
+ ipcRenderer$7.invoke(MCP_START_SERVER, {
6153
6960
  serverName,
6154
6961
  mcpConfig,
6155
6962
  credentials,
@@ -6163,7 +6970,7 @@ const mcpApi$2 = {
6163
6970
  * @returns {Promise<{ success, serverName } | { error, message }>}
6164
6971
  */
6165
6972
  stopServer: (serverName) =>
6166
- ipcRenderer$3.invoke(MCP_STOP_SERVER, { serverName }),
6973
+ ipcRenderer$7.invoke(MCP_STOP_SERVER, { serverName }),
6167
6974
 
6168
6975
  /**
6169
6976
  * listTools
@@ -6173,7 +6980,7 @@ const mcpApi$2 = {
6173
6980
  * @returns {Promise<{ tools } | { error, message }>}
6174
6981
  */
6175
6982
  listTools: (serverName) =>
6176
- ipcRenderer$3.invoke(MCP_LIST_TOOLS, { serverName }),
6983
+ ipcRenderer$7.invoke(MCP_LIST_TOOLS, { serverName }),
6177
6984
 
6178
6985
  /**
6179
6986
  * callTool
@@ -6186,7 +6993,7 @@ const mcpApi$2 = {
6186
6993
  * @returns {Promise<{ result } | { error, message }>}
6187
6994
  */
6188
6995
  callTool: (serverName, toolName, args, allowedTools = null) =>
6189
- ipcRenderer$3.invoke(MCP_CALL_TOOL, {
6996
+ ipcRenderer$7.invoke(MCP_CALL_TOOL, {
6190
6997
  serverName,
6191
6998
  toolName,
6192
6999
  args,
@@ -6201,7 +7008,7 @@ const mcpApi$2 = {
6201
7008
  * @returns {Promise<{ resources } | { error, message }>}
6202
7009
  */
6203
7010
  listResources: (serverName) =>
6204
- ipcRenderer$3.invoke(MCP_LIST_RESOURCES, { serverName }),
7011
+ ipcRenderer$7.invoke(MCP_LIST_RESOURCES, { serverName }),
6205
7012
 
6206
7013
  /**
6207
7014
  * readResource
@@ -6212,7 +7019,7 @@ const mcpApi$2 = {
6212
7019
  * @returns {Promise<{ resource } | { error, message }>}
6213
7020
  */
6214
7021
  readResource: (serverName, uri) =>
6215
- ipcRenderer$3.invoke(MCP_READ_RESOURCE, { serverName, uri }),
7022
+ ipcRenderer$7.invoke(MCP_READ_RESOURCE, { serverName, uri }),
6216
7023
 
6217
7024
  /**
6218
7025
  * getServerStatus
@@ -6222,7 +7029,7 @@ const mcpApi$2 = {
6222
7029
  * @returns {Promise<{ status, tools, error }>}
6223
7030
  */
6224
7031
  getServerStatus: (serverName) =>
6225
- ipcRenderer$3.invoke(MCP_SERVER_STATUS, { serverName }),
7032
+ ipcRenderer$7.invoke(MCP_SERVER_STATUS, { serverName }),
6226
7033
 
6227
7034
  /**
6228
7035
  * getCatalog
@@ -6230,7 +7037,7 @@ const mcpApi$2 = {
6230
7037
  *
6231
7038
  * @returns {Promise<{ catalog } | { error, message }>}
6232
7039
  */
6233
- getCatalog: () => ipcRenderer$3.invoke(MCP_GET_CATALOG),
7040
+ getCatalog: () => ipcRenderer$7.invoke(MCP_GET_CATALOG),
6234
7041
  };
6235
7042
 
6236
7043
  var mcpApi_1 = mcpApi$2;
@@ -6248,7 +7055,7 @@ var mcpApi_1 = mcpApi$2;
6248
7055
  * mainApi.registry.checkUpdates([{ name: "weather-widgets", version: "1.0.0" }])
6249
7056
  */
6250
7057
 
6251
- const { ipcRenderer: ipcRenderer$2 } = require$$0;
7058
+ const { ipcRenderer: ipcRenderer$6 } = require$$0;
6252
7059
 
6253
7060
  const registryApi$2 = {
6254
7061
  /**
@@ -6258,7 +7065,7 @@ const registryApi$2 = {
6258
7065
  */
6259
7066
  fetchIndex: async (forceRefresh = false) => {
6260
7067
  try {
6261
- return await ipcRenderer$2.invoke(
7068
+ return await ipcRenderer$6.invoke(
6262
7069
  "registry:fetch-index",
6263
7070
  forceRefresh
6264
7071
  );
@@ -6276,7 +7083,7 @@ const registryApi$2 = {
6276
7083
  */
6277
7084
  search: async (query = "", filters = {}) => {
6278
7085
  try {
6279
- return await ipcRenderer$2.invoke("registry:search", query, filters);
7086
+ return await ipcRenderer$6.invoke("registry:search", query, filters);
6280
7087
  } catch (error) {
6281
7088
  console.error("[RegistryApi] Error searching registry:", error);
6282
7089
  throw error;
@@ -6290,7 +7097,7 @@ const registryApi$2 = {
6290
7097
  */
6291
7098
  getPackage: async (packageName) => {
6292
7099
  try {
6293
- return await ipcRenderer$2.invoke(
7100
+ return await ipcRenderer$6.invoke(
6294
7101
  "registry:get-package",
6295
7102
  packageName
6296
7103
  );
@@ -6310,7 +7117,7 @@ const registryApi$2 = {
6310
7117
  */
6311
7118
  checkUpdates: async (installedWidgets = []) => {
6312
7119
  try {
6313
- return await ipcRenderer$2.invoke(
7120
+ return await ipcRenderer$6.invoke(
6314
7121
  "registry:check-updates",
6315
7122
  installedWidgets
6316
7123
  );
@@ -6329,21 +7136,148 @@ var registryApi_1 = registryApi$2;
6329
7136
  * Handle the theme configuration file
6330
7137
  */
6331
7138
 
6332
- const { ipcRenderer: ipcRenderer$1 } = require$$0;
7139
+ const { ipcRenderer: ipcRenderer$5 } = require$$0;
6333
7140
 
6334
- const { THEME_LIST, THEME_SAVE, THEME_DELETE } = events$6;
7141
+ const { THEME_LIST, THEME_SAVE, THEME_DELETE } = events$8;
6335
7142
 
6336
7143
  const themeApi$2 = {
6337
7144
  listThemesForApplication: (appId) =>
6338
- ipcRenderer$1.invoke(THEME_LIST, { appId }),
7145
+ ipcRenderer$5.invoke(THEME_LIST, { appId }),
6339
7146
  saveThemeForApplication: (appId, themeName, themeObject) =>
6340
- ipcRenderer$1.invoke(THEME_SAVE, { appId, themeName, themeObject }),
7147
+ ipcRenderer$5.invoke(THEME_SAVE, { appId, themeName, themeObject }),
6341
7148
  deleteThemeForApplication: (appId, themeKey) =>
6342
- ipcRenderer$1.invoke(THEME_DELETE, { appId, themeKey }),
7149
+ ipcRenderer$5.invoke(THEME_DELETE, { appId, themeKey }),
6343
7150
  };
6344
7151
 
6345
7152
  var themeApi_1 = themeApi$2;
6346
7153
 
7154
+ /**
7155
+ * algoliaApi.js
7156
+ *
7157
+ * This is a stub sample that can be used as a template for other api's
7158
+ */
7159
+
7160
+ // ipcRenderer that must be used to invoke the events
7161
+ const { ipcRenderer: ipcRenderer$4 } = require$$0;
7162
+
7163
+ const {
7164
+ ALGOLIA_LIST_INDICES,
7165
+ ALGOLIA_ANALYTICS_FOR_QUERY,
7166
+ ALGOLIA_SAVE_SYNONYMS,
7167
+ ALGOLIA_PARTIAL_UPDATE_OBJECTS,
7168
+ ALGOLIA_CREATE_BATCH,
7169
+ ALGOLIA_BROWSE_OBJECTS,
7170
+ } = events$8;
7171
+
7172
+ const algoliaApi$2 = {
7173
+ listIndices: (application) =>
7174
+ ipcRenderer$4.invoke(ALGOLIA_LIST_INDICES, application),
7175
+
7176
+ browseObjects: (appId, apiKey, indexName) => {
7177
+ ipcRenderer$4.invoke(ALGOLIA_BROWSE_OBJECTS, {
7178
+ appId,
7179
+ apiKey,
7180
+ indexName,
7181
+ dir,
7182
+ });
7183
+ },
7184
+
7185
+ saveSynonyms: () => ipcRenderer$4.invoke(ALGOLIA_SAVE_SYNONYMS, {}),
7186
+
7187
+ getAnalyticsForQuery: (application, indexName, query) =>
7188
+ ipcRenderer$4.invoke(ALGOLIA_ANALYTICS_FOR_QUERY, {
7189
+ application,
7190
+ indexName,
7191
+ query,
7192
+ }),
7193
+
7194
+ partialUpdateObjectsFromDirectory: (
7195
+ appId,
7196
+ apiKey,
7197
+ indexName,
7198
+ dir,
7199
+ createIfNotExists = false
7200
+ ) =>
7201
+ ipcRenderer$4.invoke(ALGOLIA_PARTIAL_UPDATE_OBJECTS, {
7202
+ appId,
7203
+ apiKey,
7204
+ indexName,
7205
+ dir,
7206
+ createIfNotExists,
7207
+ }),
7208
+
7209
+ createBatchesFromFile: (filepath, batchFilepath, batchSize) => {
7210
+ ipcRenderer$4.invoke(ALGOLIA_CREATE_BATCH, {
7211
+ filepath,
7212
+ batchFilepath,
7213
+ batchSize,
7214
+ });
7215
+ },
7216
+
7217
+ browseObjectsToFile: (appId, apiKey, indexName, toFilename, query = "") => {
7218
+ ipcRenderer$4.invoke(ALGOLIA_BROWSE_OBJECTS, {
7219
+ appId,
7220
+ apiKey,
7221
+ indexName,
7222
+ toFilename,
7223
+ query,
7224
+ });
7225
+ },
7226
+ };
7227
+
7228
+ var algoliaApi_1 = algoliaApi$2;
7229
+
7230
+ /**
7231
+ * openAI
7232
+ */
7233
+
7234
+ const { ipcRenderer: ipcRenderer$3 } = require$$0;
7235
+
7236
+ const { OPENAI_DESCRIBE_IMAGE } = openaiEvents$1;
7237
+
7238
+ const openaiApi$2 = {
7239
+ // convert a json array of objects to a csv string and save to file
7240
+ describeImage: (imageUrl, apiKey, prompt = "What's in this image?") =>
7241
+ ipcRenderer$3.invoke(OPENAI_DESCRIBE_IMAGE, { imageUrl, apiKey, prompt }),
7242
+ };
7243
+
7244
+ var openaiApi_1 = openaiApi$2;
7245
+
7246
+ /**
7247
+ * menuItemsApi.js
7248
+ *
7249
+ */
7250
+
7251
+ // ipcRenderer that must be used to invoke the events
7252
+ const { ipcRenderer: ipcRenderer$2 } = require$$0;
7253
+
7254
+ const { MENU_ITEMS_SAVE, MENU_ITEMS_LIST } = events$8;
7255
+
7256
+ const menuItemsApi$2 = {
7257
+ saveMenuItem: (appId, menuItem) =>
7258
+ ipcRenderer$2.invoke(MENU_ITEMS_SAVE, { appId, menuItem }),
7259
+ listMenuItems: (appId) => ipcRenderer$2.invoke(MENU_ITEMS_LIST, { appId }),
7260
+ };
7261
+
7262
+ var menuItemsApi_1 = menuItemsApi$2;
7263
+
7264
+ /**
7265
+ * pluginApi.js
7266
+ *
7267
+ * Plugin management API for the renderer process.
7268
+ */
7269
+
7270
+ // ipcRenderer that must be used to invoke the events
7271
+ const { ipcRenderer: ipcRenderer$1 } = require$$0;
7272
+
7273
+ const pluginApi$2 = {
7274
+ install: (packageName, filepath) =>
7275
+ ipcRenderer$1.invoke("plugin-install", { packageName, filepath }),
7276
+ uninstall: (filepath) => ipcRenderer$1.invoke("plugin-uninstall", filepath),
7277
+ };
7278
+
7279
+ var pluginApi_1 = pluginApi$2;
7280
+
6347
7281
  var widgetRegistry$1 = {exports: {}};
6348
7282
 
6349
7283
  var dynamicWidgetLoader$2 = {exports: {}};
@@ -6555,7 +7489,7 @@ var widgetCompiler$1 = { compileWidget, findWidgetsDir: findWidgetsDir$1 };
6555
7489
 
6556
7490
  const fs = require$$2;
6557
7491
  const path = require$$1$1;
6558
- const vm = require$$2$4;
7492
+ const vm = require$$2$5;
6559
7493
  const { findWidgetsDir } = widgetCompiler$1;
6560
7494
 
6561
7495
  class DynamicWidgetLoader {
@@ -6747,8 +7681,8 @@ var dynamicWidgetLoaderExports = dynamicWidgetLoader$2.exports;
6747
7681
  (function (module) {
6748
7682
  const fs = require$$2;
6749
7683
  const path = require$$1$1;
6750
- const os = require$$2$5;
6751
- const AdmZip = require$$3$2;
7684
+ const os = require$$2$6;
7685
+ const AdmZip = require$$3$3;
6752
7686
  const { fileURLToPath } = require$$4$1;
6753
7687
  const { app, ipcMain, BrowserWindow } = require$$0;
6754
7688
  const { dynamicWidgetLoader } = dynamicWidgetLoaderExports;
@@ -7719,23 +8653,13 @@ var widgetRegistryExports = widgetRegistry$1.exports;
7719
8653
  * mainApi.js
7720
8654
  *
7721
8655
  * Factory for creating the main API object exposed to the renderer via contextBridge.
7722
- * Core APIs are included by default. Template-specific APIs (algolia, openai, etc.)
8656
+ * All APIs are included by default. Additional template-specific APIs
7723
8657
  * can be added via the extensions parameter.
7724
8658
  *
7725
8659
  * Usage in template's preload.js:
7726
8660
  *
7727
- * const { createMainApi } = require("@trops/dash-core/electron");
7728
- * const algoliaApi = require("./api/algoliaApi");
7729
- * const openaiApi = require("./api/openaiApi");
7730
- *
7731
- * const mainApi = createMainApi({
7732
- * algolia: algoliaApi,
7733
- * openai: openaiApi,
7734
- * menuItems: menuItemsApi,
7735
- * plugins: pluginApi,
7736
- * });
7737
- *
7738
- * contextBridge.exposeInMainWorld("mainApi", mainApi);
8661
+ * const { defaultMainApi } = require("@trops/dash-core/electron");
8662
+ * contextBridge.exposeInMainWorld("mainApi", defaultMainApi);
7739
8663
  */
7740
8664
 
7741
8665
  const { ipcRenderer, shell } = require$$0;
@@ -7750,9 +8674,13 @@ const providerApi$1 = providerApi_1;
7750
8674
  const mcpApi$1 = mcpApi_1;
7751
8675
  const registryApi$1 = registryApi_1;
7752
8676
  const themeApi$1 = themeApi_1;
8677
+ const algoliaApi$1 = algoliaApi_1;
8678
+ const openaiApi$1 = openaiApi_1;
8679
+ const menuItemsApi$1 = menuItemsApi_1;
8680
+ const pluginApi$1 = pluginApi_1;
7753
8681
 
7754
8682
  // Events constants
7755
- const events$1 = events$6;
8683
+ const events$1 = events$8;
7756
8684
 
7757
8685
  /**
7758
8686
  * Create the main API object with core APIs and optional extensions.
@@ -7812,6 +8740,12 @@ function createMainApi$1(extensions = {}) {
7812
8740
 
7813
8741
  pathPlugins: "",
7814
8742
 
8743
+ // APIs previously in template
8744
+ algolia: algoliaApi$1,
8745
+ openai: openaiApi$1,
8746
+ menuItems: menuItemsApi$1,
8747
+ plugins: pluginApi$1,
8748
+
7815
8749
  // Merge template-specific extensions
7816
8750
  ...extensions,
7817
8751
  };
@@ -7844,6 +8778,10 @@ const providerController = providerController_1;
7844
8778
  const layoutController = layoutController_1;
7845
8779
  const mcpController = mcpController_1;
7846
8780
  const registryController = registryController$1;
8781
+ const algoliaController = algoliaController_1;
8782
+ const openaiController = openaiController_1;
8783
+ const menuItemsController = menuItemsController_1;
8784
+ const pluginController = pluginController_1;
7847
8785
 
7848
8786
  // --- Controller functions (flat, for convenient destructuring) ---
7849
8787
  const controllers = controller;
@@ -7860,9 +8798,13 @@ const providerApi = providerApi_1;
7860
8798
  const mcpApi = mcpApi_1;
7861
8799
  const registryApi = registryApi_1;
7862
8800
  const themeApi = themeApi_1;
8801
+ const algoliaApi = algoliaApi_1;
8802
+ const openaiApi = openaiApi_1;
8803
+ const menuItemsApi = menuItemsApi_1;
8804
+ const pluginApi = pluginApi_1;
7863
8805
 
7864
8806
  // --- Events ---
7865
- const events = events$6;
8807
+ const events = events$8;
7866
8808
 
7867
8809
  // --- Widget Pipeline ---
7868
8810
  const widgetRegistry = widgetRegistryExports;
@@ -7884,6 +8826,10 @@ var electron = {
7884
8826
  layoutController,
7885
8827
  mcpController,
7886
8828
  registryController,
8829
+ algoliaController,
8830
+ openaiController,
8831
+ menuItemsController,
8832
+ pluginController,
7887
8833
 
7888
8834
  // Controller functions (flat) — spread for convenient destructuring
7889
8835
  ...controllers,
@@ -7900,6 +8846,10 @@ var electron = {
7900
8846
  mcpApi,
7901
8847
  registryApi,
7902
8848
  themeApi,
8849
+ algoliaApi,
8850
+ openaiApi,
8851
+ menuItemsApi,
8852
+ pluginApi,
7903
8853
 
7904
8854
  // Events
7905
8855
  events,