@cutos/core 0.0.20 → 0.0.22

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.
package/README.md CHANGED
@@ -84,7 +84,7 @@ CoreAPI.getVersion();
84
84
  ```
85
85
  - Return result example:
86
86
 
87
- ```json
87
+ ```
88
88
  0.0.17
89
89
  ```
90
90
 
package/dist/cutos.cjs.js CHANGED
@@ -30,6 +30,8 @@ function getAugmentedNamespace(n) {
30
30
  return a;
31
31
  }
32
32
 
33
+ var src = {};
34
+
33
35
  var cutos = {};
34
36
 
35
37
  const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
@@ -389,13 +391,13 @@ const HEARTBEAT_STATUS = Object.freeze({
389
391
  REGISTER: "register", ALIVE: "alive", ERROR: 'error', NOT_FOUND: 'not-found', SUCCESS: 'success'
390
392
  });
391
393
 
392
- const cutosAPI$1 = {
394
+ const cutosAPI$2 = {
393
395
  version: '2.0.1', CORE, CORE_NORESP, CORE_APP, DEVICE, HEARTBEAT_STATUS
394
396
  };
395
- var cutosApi = cutosAPI$1;
397
+ var cutosApi = cutosAPI$2;
396
398
 
397
399
  var name = "@cutos/core";
398
- var version = "0.0.20";
400
+ var version = "0.0.22";
399
401
  var description = "";
400
402
  var main = "dist/cutos.cjs.js";
401
403
  var module$1 = "dist/cutos.esm.js";
@@ -443,7 +445,7 @@ var require$$3 = {
443
445
  const {v4: uuidv4} = require$$0;
444
446
  const mqtt = require$$1;
445
447
 
446
- const cutosAPI = cutosApi;
448
+ const cutosAPI$1 = cutosApi;
447
449
  const callbackMap = new Map();
448
450
  const callbackInterval = 5000; // 5s超时
449
451
  const listenerMap = new Map();
@@ -545,91 +547,91 @@ class Database {
545
547
  throw new Error("keyType MUST be INTEGER or TEXT");
546
548
 
547
549
  }
548
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
550
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
549
551
  }
550
552
 
551
553
  insert(value, callback, tid) {
552
554
  let body = {
553
555
  db: this.db, cmd: "db.table.insert", name: this.name, value: value, tid: tid
554
556
  };
555
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
557
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
556
558
  }
557
559
 
558
560
  insertById(id, value, callback, tid) {
559
561
  let body = {
560
562
  db: this.db, cmd: "db.table.insertById", name: this.name, id: id, value: value, tid: tid
561
563
  };
562
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
564
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
563
565
  }
564
566
 
565
567
  insertByKey(key, value, callback, tid) {
566
568
  let body = {
567
569
  db: this.db, cmd: "db.table.insertByKey", name: this.name, key: key, value: value, tid: tid
568
570
  };
569
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
571
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
570
572
  }
571
573
 
572
574
  update(id, value, callback) {
573
575
  let body = {
574
576
  db: this.db, cmd: "db.table.update", name: this.name, id: id, value: value
575
577
  };
576
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
578
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
577
579
  }
578
580
 
579
581
  updateByKey(key, value, callback) {
580
582
  let body = {
581
583
  db: this.db, cmd: "db.table.updateByKey", name: this.name, key: key, value: value
582
584
  };
583
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
585
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
584
586
  }
585
587
 
586
588
  delete(id, callback) {
587
589
  let body = {
588
590
  db: this.db, cmd: "db.table.delete", name: this.name, id: id
589
591
  };
590
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
592
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
591
593
  }
592
594
 
593
595
  query(id, callback, count = 100) {
594
596
  let body = {
595
597
  db: this.db, cmd: "db.table.query", name: this.name, id: id
596
598
  };
597
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
599
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
598
600
  }
599
601
 
600
602
  queryByKey(key, callback, count = 100) {
601
603
  let body = {
602
604
  db: this.db, cmd: "db.table.queryByKey", name: this.name, key: key
603
605
  };
604
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
606
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
605
607
  }
606
608
 
607
609
  queryByTid(tid, callback, limit = 100) {
608
610
  let body = {
609
611
  db: this.db, cmd: "db.table.queryByTid", name: this.name, limit: limit, tid: tid
610
612
  };
611
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
613
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
612
614
  }
613
615
 
614
616
  queryUnsynced(callback, limit = 100) {
615
617
  let body = {
616
618
  db: this.db, cmd: "db.table.queryUnsynced", name: this.name, limit: limit
617
619
  };
618
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
620
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
619
621
  }
620
622
 
621
623
  queryAll(callback) {
622
624
  let body = {
623
625
  db: this.db, cmd: "db.table.queryAll", name: this.name
624
626
  };
625
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
627
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
626
628
  }
627
629
 
628
630
  sync(id, callback) {
629
631
  let body = {
630
632
  db: this.db, cmd: "db.table.sync", name: this.name, id: id
631
633
  };
632
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
634
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
633
635
  }
634
636
 
635
637
  publishRequestMirror(topic, callback, body) {
@@ -667,14 +669,14 @@ class Database {
667
669
  let body = {
668
670
  cmd: "db.connect", db: this.db
669
671
  };
670
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
672
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
671
673
  }
672
674
 
673
675
  run(sql, callback) {
674
676
  let body = {
675
677
  db: this.db, cmd: "db.run", sql: sql
676
678
  };
677
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
679
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
678
680
  }
679
681
 
680
682
  createTable(name, callback, retentionTime, keyType = 'INTEGER', keyName = 'id') {
@@ -694,28 +696,28 @@ class Logger {
694
696
  let body = {
695
697
  type: type, level: "info", remark: remark, content: content
696
698
  };
697
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
699
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
698
700
  }
699
701
 
700
702
  warning(remark, content, type = "LWA") {
701
703
  let body = {
702
704
  type: type, level: "warning", remark: remark, content: content
703
705
  };
704
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
706
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
705
707
  }
706
708
 
707
709
  error(remark, content, type = "LWA") {
708
710
  let body = {
709
711
  type: type, level: "error", remark: remark, content: content
710
712
  };
711
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
713
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
712
714
  }
713
715
 
714
716
  debug(remark, content, type = "LWA") {
715
717
  let body = {
716
718
  type: type, level: "debug", remark: remark, content: content
717
719
  };
718
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
720
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
719
721
  }
720
722
  }
721
723
 
@@ -734,7 +736,7 @@ class IPC {
734
736
  let body = {};
735
737
  body.channel = channel;
736
738
  body.args = args;
737
- return publishRequest(cutosAPI.CORE_NORESP.IPC, null, body, this.destAddress);
739
+ return publishRequest(cutosAPI$1.CORE_NORESP.IPC, null, body, this.destAddress);
738
740
  }
739
741
 
740
742
  on(channel, listener) {
@@ -751,28 +753,28 @@ class Notification {
751
753
  }
752
754
 
753
755
  register(listener) {
754
- listenerMap.set(cutosAPI.CORE_APP.NOTIFICATION, listener);
756
+ listenerMap.set(cutosAPI$1.CORE_APP.NOTIFICATION, listener);
755
757
  }
756
758
 
757
759
  unregister() {
758
- listenerMap.delete(cutosAPI.CORE_APP.NOTIFICATION);
760
+ listenerMap.delete(cutosAPI$1.CORE_APP.NOTIFICATION);
759
761
  }
760
762
 
761
763
  emit(event, msg) {
762
- client.publish(cutosAPI.CORE_APP.NOTIFICATION, JSON.stringify({event: event, msg: msg}));
764
+ client.publish(cutosAPI$1.CORE_APP.NOTIFICATION, JSON.stringify({event: event, msg: msg}));
763
765
  return true;
764
766
  }
765
767
  }
766
768
 
767
769
  class Heartbeat {
768
- STATUS = cutosAPI.HEARTBEAT_STATUS;
770
+ STATUS = cutosAPI$1.HEARTBEAT_STATUS;
769
771
 
770
772
  constructor(pinger, counter) {
771
773
  this.registered = false;
772
774
  this.request = {};
773
775
  this.request.counter = counter;
774
776
  this.request.pinger = pinger;
775
- this.request.subscriber = cutosAPI.CORE_NORESP.HEARTBEAT_PING + '-' + pinger;
777
+ this.request.subscriber = cutosAPI$1.CORE_NORESP.HEARTBEAT_PING + '-' + pinger;
776
778
 
777
779
  }
778
780
 
@@ -781,7 +783,7 @@ class Heartbeat {
781
783
  this.request.msg.status = this.STATUS.REGISTER;
782
784
  this.request.msg.info = `Start to monitor ${this.request.pinger}.`;
783
785
 
784
- client.publish(cutosAPI.CORE_NORESP.HEARTBEAT_REGISTER, JSON.stringify(this.request));
786
+ client.publish(cutosAPI$1.CORE_NORESP.HEARTBEAT_REGISTER, JSON.stringify(this.request));
785
787
  this.registered = true;
786
788
  }
787
789
 
@@ -792,17 +794,17 @@ class Heartbeat {
792
794
  this.request.msg = {};
793
795
  this.request.msg.status = status;
794
796
  this.request.msg.info = info;
795
- client.publish(cutosAPI.CORE_NORESP.HEARTBEAT_PING, JSON.stringify(this.request));
797
+ client.publish(cutosAPI$1.CORE_NORESP.HEARTBEAT_PING, JSON.stringify(this.request));
796
798
  }
797
799
  }
798
800
 
799
801
  class Device {
800
- constructor(name = 'default-device-name', type = cutosAPI.DEVICE.DEFAULT, callback) {
802
+ constructor(name = 'default-device-name', type = cutosAPI$1.DEVICE.DEFAULT, callback, development = false) {
801
803
  this.name = name;
802
804
  this.type = type;
803
- this.topicData = cutosAPI.DEVICE.CHANNEL + '-' + type + '-data';
804
- this.topicResponse = cutosAPI.DEVICE.CHANNEL + '-' + type + '-response';
805
- this.topicCommand = cutosAPI.DEVICE.CHANNEL + '-' + type + '-command';
805
+ this.topicData = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-data';
806
+ this.topicResponse = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-response';
807
+ this.topicCommand = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-command';
806
808
  this.data = {};
807
809
 
808
810
  if (Device.objectMap === undefined) {
@@ -822,19 +824,19 @@ class Device {
822
824
  }
823
825
  //console.debug(JSON.stringify(msg));
824
826
  };
825
- listenerMap.set(cutosAPI.CORE_APP.HEARTBEAT_LISTENER, Device.heartbeatListener);
827
+ listenerMap.set(cutosAPI$1.CORE_APP.HEARTBEAT_LISTENER, Device.heartbeatListener);
826
828
  }
827
829
  // subscribe callback
828
830
  client.subscribe(this.topicCommand + '-callback');
829
- this.init(name, type, callback);
831
+ this.init(name, type, callback, development);
830
832
  }
831
833
 
832
- init(name, type, callback) {
834
+ init(name, type, callback, development) {
833
835
  let command = {};
834
836
  command.cmd = "init";
835
- command.args = {name: name, type: type};
837
+ command.args = {name, type, development};
836
838
  command.topicResponse = this.topicResponse;
837
- let defaultTopic = cutosAPI.DEVICE.CHANNEL + '-' + cutosAPI.DEVICE.DEFAULT + '-command';
839
+ let defaultTopic = cutosAPI$1.DEVICE.CHANNEL + '-' + cutosAPI$1.DEVICE.DEFAULT + '-command';
838
840
  publishRequest(defaultTopic, null, command);
839
841
 
840
842
  // response callback
@@ -877,15 +879,15 @@ class Device {
877
879
  }
878
880
 
879
881
  class Driver {
880
- constructor(name = 'default-driver-name', type = cutosAPI.DEVICE.DEFAULT, counter = 10) {
882
+ constructor(name = 'default-driver-name', type = cutosAPI$1.DEVICE.DEFAULT, counter = 10) {
881
883
  this.name = name;
882
884
  this.type = type;
883
885
  this.heartbeat = new Heartbeat(type, counter);
884
886
  this.statusInfo = {};
885
887
  this.beatInterval = 3000;
886
- this.topicData = cutosAPI.DEVICE.CHANNEL + '-' + type + '-data';
887
- this.topicResponse = cutosAPI.DEVICE.CHANNEL + '-' + type + '-response';
888
- this.topicCommand = cutosAPI.DEVICE.CHANNEL + '-' + type + '-command';
888
+ this.topicData = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-data';
889
+ this.topicResponse = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-response';
890
+ this.topicCommand = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-command';
889
891
  }
890
892
 
891
893
  startBeat() {
@@ -929,23 +931,23 @@ class Driver {
929
931
  }
930
932
  }
931
933
 
932
- const CoreAPI = {
933
- init(mqttHost = 'ws://localhost:1883', callback) {
934
- if (!mqttHost) {
935
- mqttHost = 'ws://localhost:1883';
934
+ const CoreAPI$2 = {
935
+ init(host = 'ws://localhost:1883', callback) {
936
+ if (!host) {
937
+ host = 'ws://localhost:1883';
936
938
  }
937
- client = mqtt.connect(mqttHost);
939
+ client = mqtt.connect(host);
938
940
 
939
941
  client.on('connect', function () {
940
942
  console.log("CUTOS CORE connected.");
941
- for (let api in cutosAPI.CORE) {
942
- client.subscribe(cutosAPI.CORE[api] + '-callback');
943
+ for (let api in cutosAPI$1.CORE) {
944
+ client.subscribe(cutosAPI$1.CORE[api] + '-callback');
943
945
  }
944
- for (let api in cutosAPI.CORE_NORESP) {
945
- client.subscribe(cutosAPI.CORE_NORESP[api] + '-endpoint');
946
+ for (let api in cutosAPI$1.CORE_NORESP) {
947
+ client.subscribe(cutosAPI$1.CORE_NORESP[api] + '-endpoint');
946
948
  }
947
- for (let api in cutosAPI.CORE_APP) {
948
- client.subscribe(cutosAPI.CORE_APP[api]);
949
+ for (let api in cutosAPI$1.CORE_APP) {
950
+ client.subscribe(cutosAPI$1.CORE_APP[api]);
949
951
  }
950
952
  if (typeof (callback) === 'function') {
951
953
  callback({
@@ -959,13 +961,13 @@ const CoreAPI = {
959
961
  // message is Buffer
960
962
  // console.debug(topic.toString() + message.toString());
961
963
  let _message = JSON.parse(message);
962
- if (topic === cutosAPI.CORE_NORESP.IPC + '-endpoint') { // ipc
964
+ if (topic === cutosAPI$1.CORE_NORESP.IPC + '-endpoint') { // ipc
963
965
  let listener = listenerMap.get(_message.body.channel);
964
966
  if (listener !== undefined) {
965
967
  listener(_message.body.args, _message.context);
966
968
  }
967
- } else if (topic === cutosAPI.CORE_APP.NOTIFICATION || topic === cutosAPI.CORE_APP.HEARTBEAT_LISTENER
968
- || topic.startsWith(cutosAPI.DEVICE.CHANNEL) && !topic.endsWith('-callback')) {
969
+ } else if (topic === cutosAPI$1.CORE_APP.NOTIFICATION || topic === cutosAPI$1.CORE_APP.HEARTBEAT_LISTENER
970
+ || topic.startsWith(cutosAPI$1.DEVICE.CHANNEL) && !topic.endsWith('-callback')) {
969
971
  let listener = listenerMap.get(topic);
970
972
  if (listener !== undefined) {
971
973
  listener(_message);
@@ -990,7 +992,7 @@ const CoreAPI = {
990
992
  });
991
993
  },
992
994
  connected() {
993
- return client.connected;
995
+ return !!client && client.connected;
994
996
  },
995
997
 
996
998
  getVersion() {
@@ -998,27 +1000,27 @@ const CoreAPI = {
998
1000
  },
999
1001
 
1000
1002
  getPlatform(callback) {
1001
- return publishRequest(cutosAPI.CORE.PLATFORM, callback);
1003
+ return publishRequest(cutosAPI$1.CORE.PLATFORM, callback);
1002
1004
  },
1003
1005
 
1004
1006
  getConfig(callback) {
1005
- return publishRequest(cutosAPI.CORE.CONFIG, callback);
1007
+ return publishRequest(cutosAPI$1.CORE.CONFIG, callback);
1006
1008
  },
1007
1009
 
1008
1010
  getBoxInfo(callback) {
1009
- return publishRequest(cutosAPI.CORE.BOX_INFO, callback);
1011
+ return publishRequest(cutosAPI$1.CORE.BOX_INFO, callback);
1010
1012
  },
1011
1013
 
1012
1014
  getSignInfo(callback) {
1013
- return publishRequest(cutosAPI.CORE.SIGN_INFO, callback);
1015
+ return publishRequest(cutosAPI$1.CORE.SIGN_INFO, callback);
1014
1016
  },
1015
1017
 
1016
1018
  getDeviceInfo(callback) {
1017
- return publishRequest(cutosAPI.CORE.DEVICE_INFO, callback);
1019
+ return publishRequest(cutosAPI$1.CORE.DEVICE_INFO, callback);
1018
1020
  },
1019
1021
 
1020
1022
  getSignGroupInfo(callback) {
1021
- return publishRequest(cutosAPI.CORE.SIGN_GROUP_INFO, callback);
1023
+ return publishRequest(cutosAPI$1.CORE.SIGN_GROUP_INFO, callback);
1022
1024
  },
1023
1025
 
1024
1026
  getIPC(destAddress) {
@@ -1034,7 +1036,7 @@ const CoreAPI = {
1034
1036
  },
1035
1037
 
1036
1038
  shell(command, callback) {
1037
- return publishRequest(cutosAPI.CORE.SHELL, callback, command);
1039
+ return publishRequest(cutosAPI$1.CORE.SHELL, callback, command);
1038
1040
  },
1039
1041
 
1040
1042
  getDatabase(db, callback) {
@@ -1042,25 +1044,65 @@ const CoreAPI = {
1042
1044
  },
1043
1045
 
1044
1046
  getVolume(callback) {
1045
- return publishRequest(cutosAPI.CORE.GET_VOLUME, callback);
1047
+ return publishRequest(cutosAPI$1.CORE.GET_VOLUME, callback);
1046
1048
  },
1047
1049
 
1048
1050
  setVolume(vol, callback) {
1049
- return publishRequest(cutosAPI.CORE.SET_VOLUME, callback, vol);
1051
+ return publishRequest(cutosAPI$1.CORE.SET_VOLUME, callback, vol);
1050
1052
  }
1051
1053
  };
1052
1054
 
1053
- var CoreAPI_1 = cutos.CoreAPI = CoreAPI;
1054
- var CoreDefine = cutos.CoreDefine = {
1055
- DEVICE: cutosAPI.DEVICE, HEARTBEAT_STATUS: cutosAPI.HEARTBEAT_STATUS
1055
+ cutos.CoreAPI = CoreAPI$2;
1056
+ cutos.CoreDefine = {
1057
+ DEVICE: cutosAPI$1.DEVICE, HEARTBEAT_STATUS: cutosAPI$1.HEARTBEAT_STATUS
1056
1058
  };
1057
- var CoreClass = cutos.CoreClass = {
1059
+ cutos.CoreClass = {
1058
1060
  Device, Driver
1059
1061
  };
1060
- var cutosAPI_1 = cutos.cutosAPI = cutosAPI;
1062
+
1063
+ cutos.cutosAPI = cutosAPI$1;
1064
+
1065
+ // simulate cutos core for development
1066
+ const {CoreAPI: CoreAPI$1, CoreClass: CoreClass$1} = cutos;
1067
+
1068
+ const CoreSimulator$1 = {
1069
+ start: function (driver, port = 1883) {
1070
+ CoreAPI$1.init(`ws://localhost:${port}`, result => {
1071
+ console.log('CUTOS Simulator started and listening on port ', port);
1072
+
1073
+ let drvDefault = new CoreClass$1.Driver();
1074
+ drvDefault.onCommand((command) => {
1075
+ console.log('drvDefault onCommand', JSON.stringify(command));
1076
+ if (command.cmd === "init") {
1077
+ let rsp = {result: true};
1078
+ try {
1079
+ driver.init(command.args);
1080
+ } catch (e) {
1081
+ rsp.msg = e.message;
1082
+ rsp.result = false;
1083
+ }
1084
+ drvDefault.sendResponse(rsp, command.topicResponse);
1085
+ }
1086
+ });
1087
+ });
1088
+ }
1089
+ };
1090
+
1091
+ var coreSimulator = {CoreSimulator: CoreSimulator$1};
1092
+
1093
+ const {CoreAPI, CoreDefine, CoreClass, cutosAPI} = cutos;
1094
+ const {CoreSimulator} = coreSimulator;
1095
+
1096
+
1097
+ var CoreAPI_1 = src.CoreAPI = CoreAPI;
1098
+ var CoreDefine_1 = src.CoreDefine = CoreDefine;
1099
+ var CoreClass_1 = src.CoreClass = CoreClass;
1100
+ var cutosAPI_1 = src.cutosAPI = cutosAPI;
1101
+ var CoreSimulator_1 = src.CoreSimulator = CoreSimulator;
1061
1102
 
1062
1103
  exports.CoreAPI = CoreAPI_1;
1063
- exports.CoreClass = CoreClass;
1064
- exports.CoreDefine = CoreDefine;
1104
+ exports.CoreClass = CoreClass_1;
1105
+ exports.CoreDefine = CoreDefine_1;
1106
+ exports.CoreSimulator = CoreSimulator_1;
1065
1107
  exports.cutosAPI = cutosAPI_1;
1066
- exports.default = cutos;
1108
+ exports.default = src;
package/dist/cutos.esm.js CHANGED
@@ -25,6 +25,8 @@ function getAugmentedNamespace(n) {
25
25
  return a;
26
26
  }
27
27
 
28
+ var src = {};
29
+
28
30
  var cutos = {};
29
31
 
30
32
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
@@ -681,13 +683,13 @@ const HEARTBEAT_STATUS = Object.freeze({
681
683
  REGISTER: "register", ALIVE: "alive", ERROR: 'error', NOT_FOUND: 'not-found', SUCCESS: 'success'
682
684
  });
683
685
 
684
- const cutosAPI$1 = {
686
+ const cutosAPI$2 = {
685
687
  version: '2.0.1', CORE, CORE_NORESP, CORE_APP, DEVICE, HEARTBEAT_STATUS
686
688
  };
687
- var cutosApi = cutosAPI$1;
689
+ var cutosApi = cutosAPI$2;
688
690
 
689
691
  var name = "@cutos/core";
690
- var version = "0.0.20";
692
+ var version = "0.0.22";
691
693
  var description = "";
692
694
  var main = "dist/cutos.cjs.js";
693
695
  var module = "dist/cutos.esm.js";
@@ -735,7 +737,7 @@ var require$$3 = {
735
737
  const {v4: uuidv4} = require$$0;
736
738
  const mqtt = require$$1;
737
739
 
738
- const cutosAPI = cutosApi;
740
+ const cutosAPI$1 = cutosApi;
739
741
  const callbackMap = new Map();
740
742
  const callbackInterval = 5000; // 5s超时
741
743
  const listenerMap = new Map();
@@ -837,91 +839,91 @@ class Database {
837
839
  throw new Error("keyType MUST be INTEGER or TEXT");
838
840
 
839
841
  }
840
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
842
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
841
843
  }
842
844
 
843
845
  insert(value, callback, tid) {
844
846
  let body = {
845
847
  db: this.db, cmd: "db.table.insert", name: this.name, value: value, tid: tid
846
848
  };
847
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
849
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
848
850
  }
849
851
 
850
852
  insertById(id, value, callback, tid) {
851
853
  let body = {
852
854
  db: this.db, cmd: "db.table.insertById", name: this.name, id: id, value: value, tid: tid
853
855
  };
854
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
856
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
855
857
  }
856
858
 
857
859
  insertByKey(key, value, callback, tid) {
858
860
  let body = {
859
861
  db: this.db, cmd: "db.table.insertByKey", name: this.name, key: key, value: value, tid: tid
860
862
  };
861
- return this.publishRequestMirror(cutosAPI.CORE.DATABASE, callback, body);
863
+ return this.publishRequestMirror(cutosAPI$1.CORE.DATABASE, callback, body);
862
864
  }
863
865
 
864
866
  update(id, value, callback) {
865
867
  let body = {
866
868
  db: this.db, cmd: "db.table.update", name: this.name, id: id, value: value
867
869
  };
868
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
870
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
869
871
  }
870
872
 
871
873
  updateByKey(key, value, callback) {
872
874
  let body = {
873
875
  db: this.db, cmd: "db.table.updateByKey", name: this.name, key: key, value: value
874
876
  };
875
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
877
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
876
878
  }
877
879
 
878
880
  delete(id, callback) {
879
881
  let body = {
880
882
  db: this.db, cmd: "db.table.delete", name: this.name, id: id
881
883
  };
882
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
884
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
883
885
  }
884
886
 
885
887
  query(id, callback, count = 100) {
886
888
  let body = {
887
889
  db: this.db, cmd: "db.table.query", name: this.name, id: id
888
890
  };
889
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
891
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
890
892
  }
891
893
 
892
894
  queryByKey(key, callback, count = 100) {
893
895
  let body = {
894
896
  db: this.db, cmd: "db.table.queryByKey", name: this.name, key: key
895
897
  };
896
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
898
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
897
899
  }
898
900
 
899
901
  queryByTid(tid, callback, limit = 100) {
900
902
  let body = {
901
903
  db: this.db, cmd: "db.table.queryByTid", name: this.name, limit: limit, tid: tid
902
904
  };
903
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
905
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
904
906
  }
905
907
 
906
908
  queryUnsynced(callback, limit = 100) {
907
909
  let body = {
908
910
  db: this.db, cmd: "db.table.queryUnsynced", name: this.name, limit: limit
909
911
  };
910
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
912
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
911
913
  }
912
914
 
913
915
  queryAll(callback) {
914
916
  let body = {
915
917
  db: this.db, cmd: "db.table.queryAll", name: this.name
916
918
  };
917
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
919
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
918
920
  }
919
921
 
920
922
  sync(id, callback) {
921
923
  let body = {
922
924
  db: this.db, cmd: "db.table.sync", name: this.name, id: id
923
925
  };
924
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
926
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
925
927
  }
926
928
 
927
929
  publishRequestMirror(topic, callback, body) {
@@ -959,14 +961,14 @@ class Database {
959
961
  let body = {
960
962
  cmd: "db.connect", db: this.db
961
963
  };
962
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
964
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
963
965
  }
964
966
 
965
967
  run(sql, callback) {
966
968
  let body = {
967
969
  db: this.db, cmd: "db.run", sql: sql
968
970
  };
969
- return publishRequest(cutosAPI.CORE.DATABASE, callback, body);
971
+ return publishRequest(cutosAPI$1.CORE.DATABASE, callback, body);
970
972
  }
971
973
 
972
974
  createTable(name, callback, retentionTime, keyType = 'INTEGER', keyName = 'id') {
@@ -986,28 +988,28 @@ class Logger {
986
988
  let body = {
987
989
  type: type, level: "info", remark: remark, content: content
988
990
  };
989
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
991
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
990
992
  }
991
993
 
992
994
  warning(remark, content, type = "LWA") {
993
995
  let body = {
994
996
  type: type, level: "warning", remark: remark, content: content
995
997
  };
996
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
998
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
997
999
  }
998
1000
 
999
1001
  error(remark, content, type = "LWA") {
1000
1002
  let body = {
1001
1003
  type: type, level: "error", remark: remark, content: content
1002
1004
  };
1003
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
1005
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
1004
1006
  }
1005
1007
 
1006
1008
  debug(remark, content, type = "LWA") {
1007
1009
  let body = {
1008
1010
  type: type, level: "debug", remark: remark, content: content
1009
1011
  };
1010
- return publishRequest(cutosAPI.CORE_NORESP.LOGGER, null, body);
1012
+ return publishRequest(cutosAPI$1.CORE_NORESP.LOGGER, null, body);
1011
1013
  }
1012
1014
  }
1013
1015
 
@@ -1026,7 +1028,7 @@ class IPC {
1026
1028
  let body = {};
1027
1029
  body.channel = channel;
1028
1030
  body.args = args;
1029
- return publishRequest(cutosAPI.CORE_NORESP.IPC, null, body, this.destAddress);
1031
+ return publishRequest(cutosAPI$1.CORE_NORESP.IPC, null, body, this.destAddress);
1030
1032
  }
1031
1033
 
1032
1034
  on(channel, listener) {
@@ -1043,28 +1045,28 @@ class Notification {
1043
1045
  }
1044
1046
 
1045
1047
  register(listener) {
1046
- listenerMap.set(cutosAPI.CORE_APP.NOTIFICATION, listener);
1048
+ listenerMap.set(cutosAPI$1.CORE_APP.NOTIFICATION, listener);
1047
1049
  }
1048
1050
 
1049
1051
  unregister() {
1050
- listenerMap.delete(cutosAPI.CORE_APP.NOTIFICATION);
1052
+ listenerMap.delete(cutosAPI$1.CORE_APP.NOTIFICATION);
1051
1053
  }
1052
1054
 
1053
1055
  emit(event, msg) {
1054
- client.publish(cutosAPI.CORE_APP.NOTIFICATION, JSON.stringify({event: event, msg: msg}));
1056
+ client.publish(cutosAPI$1.CORE_APP.NOTIFICATION, JSON.stringify({event: event, msg: msg}));
1055
1057
  return true;
1056
1058
  }
1057
1059
  }
1058
1060
 
1059
1061
  class Heartbeat {
1060
- STATUS = cutosAPI.HEARTBEAT_STATUS;
1062
+ STATUS = cutosAPI$1.HEARTBEAT_STATUS;
1061
1063
 
1062
1064
  constructor(pinger, counter) {
1063
1065
  this.registered = false;
1064
1066
  this.request = {};
1065
1067
  this.request.counter = counter;
1066
1068
  this.request.pinger = pinger;
1067
- this.request.subscriber = cutosAPI.CORE_NORESP.HEARTBEAT_PING + '-' + pinger;
1069
+ this.request.subscriber = cutosAPI$1.CORE_NORESP.HEARTBEAT_PING + '-' + pinger;
1068
1070
 
1069
1071
  }
1070
1072
 
@@ -1073,7 +1075,7 @@ class Heartbeat {
1073
1075
  this.request.msg.status = this.STATUS.REGISTER;
1074
1076
  this.request.msg.info = `Start to monitor ${this.request.pinger}.`;
1075
1077
 
1076
- client.publish(cutosAPI.CORE_NORESP.HEARTBEAT_REGISTER, JSON.stringify(this.request));
1078
+ client.publish(cutosAPI$1.CORE_NORESP.HEARTBEAT_REGISTER, JSON.stringify(this.request));
1077
1079
  this.registered = true;
1078
1080
  }
1079
1081
 
@@ -1084,17 +1086,17 @@ class Heartbeat {
1084
1086
  this.request.msg = {};
1085
1087
  this.request.msg.status = status;
1086
1088
  this.request.msg.info = info;
1087
- client.publish(cutosAPI.CORE_NORESP.HEARTBEAT_PING, JSON.stringify(this.request));
1089
+ client.publish(cutosAPI$1.CORE_NORESP.HEARTBEAT_PING, JSON.stringify(this.request));
1088
1090
  }
1089
1091
  }
1090
1092
 
1091
1093
  class Device {
1092
- constructor(name = 'default-device-name', type = cutosAPI.DEVICE.DEFAULT, callback) {
1094
+ constructor(name = 'default-device-name', type = cutosAPI$1.DEVICE.DEFAULT, callback, development = false) {
1093
1095
  this.name = name;
1094
1096
  this.type = type;
1095
- this.topicData = cutosAPI.DEVICE.CHANNEL + '-' + type + '-data';
1096
- this.topicResponse = cutosAPI.DEVICE.CHANNEL + '-' + type + '-response';
1097
- this.topicCommand = cutosAPI.DEVICE.CHANNEL + '-' + type + '-command';
1097
+ this.topicData = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-data';
1098
+ this.topicResponse = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-response';
1099
+ this.topicCommand = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-command';
1098
1100
  this.data = {};
1099
1101
 
1100
1102
  if (Device.objectMap === undefined) {
@@ -1114,19 +1116,19 @@ class Device {
1114
1116
  }
1115
1117
  //console.debug(JSON.stringify(msg));
1116
1118
  };
1117
- listenerMap.set(cutosAPI.CORE_APP.HEARTBEAT_LISTENER, Device.heartbeatListener);
1119
+ listenerMap.set(cutosAPI$1.CORE_APP.HEARTBEAT_LISTENER, Device.heartbeatListener);
1118
1120
  }
1119
1121
  // subscribe callback
1120
1122
  client.subscribe(this.topicCommand + '-callback');
1121
- this.init(name, type, callback);
1123
+ this.init(name, type, callback, development);
1122
1124
  }
1123
1125
 
1124
- init(name, type, callback) {
1126
+ init(name, type, callback, development) {
1125
1127
  let command = {};
1126
1128
  command.cmd = "init";
1127
- command.args = {name: name, type: type};
1129
+ command.args = {name, type, development};
1128
1130
  command.topicResponse = this.topicResponse;
1129
- let defaultTopic = cutosAPI.DEVICE.CHANNEL + '-' + cutosAPI.DEVICE.DEFAULT + '-command';
1131
+ let defaultTopic = cutosAPI$1.DEVICE.CHANNEL + '-' + cutosAPI$1.DEVICE.DEFAULT + '-command';
1130
1132
  publishRequest(defaultTopic, null, command);
1131
1133
 
1132
1134
  // response callback
@@ -1169,15 +1171,15 @@ class Device {
1169
1171
  }
1170
1172
 
1171
1173
  class Driver {
1172
- constructor(name = 'default-driver-name', type = cutosAPI.DEVICE.DEFAULT, counter = 10) {
1174
+ constructor(name = 'default-driver-name', type = cutosAPI$1.DEVICE.DEFAULT, counter = 10) {
1173
1175
  this.name = name;
1174
1176
  this.type = type;
1175
1177
  this.heartbeat = new Heartbeat(type, counter);
1176
1178
  this.statusInfo = {};
1177
1179
  this.beatInterval = 3000;
1178
- this.topicData = cutosAPI.DEVICE.CHANNEL + '-' + type + '-data';
1179
- this.topicResponse = cutosAPI.DEVICE.CHANNEL + '-' + type + '-response';
1180
- this.topicCommand = cutosAPI.DEVICE.CHANNEL + '-' + type + '-command';
1180
+ this.topicData = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-data';
1181
+ this.topicResponse = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-response';
1182
+ this.topicCommand = cutosAPI$1.DEVICE.CHANNEL + '-' + type + '-command';
1181
1183
  }
1182
1184
 
1183
1185
  startBeat() {
@@ -1221,23 +1223,23 @@ class Driver {
1221
1223
  }
1222
1224
  }
1223
1225
 
1224
- const CoreAPI = {
1225
- init(mqttHost = 'ws://localhost:1883', callback) {
1226
- if (!mqttHost) {
1227
- mqttHost = 'ws://localhost:1883';
1226
+ const CoreAPI$2 = {
1227
+ init(host = 'ws://localhost:1883', callback) {
1228
+ if (!host) {
1229
+ host = 'ws://localhost:1883';
1228
1230
  }
1229
- client = mqtt.connect(mqttHost);
1231
+ client = mqtt.connect(host);
1230
1232
 
1231
1233
  client.on('connect', function () {
1232
1234
  console.log("CUTOS CORE connected.");
1233
- for (let api in cutosAPI.CORE) {
1234
- client.subscribe(cutosAPI.CORE[api] + '-callback');
1235
+ for (let api in cutosAPI$1.CORE) {
1236
+ client.subscribe(cutosAPI$1.CORE[api] + '-callback');
1235
1237
  }
1236
- for (let api in cutosAPI.CORE_NORESP) {
1237
- client.subscribe(cutosAPI.CORE_NORESP[api] + '-endpoint');
1238
+ for (let api in cutosAPI$1.CORE_NORESP) {
1239
+ client.subscribe(cutosAPI$1.CORE_NORESP[api] + '-endpoint');
1238
1240
  }
1239
- for (let api in cutosAPI.CORE_APP) {
1240
- client.subscribe(cutosAPI.CORE_APP[api]);
1241
+ for (let api in cutosAPI$1.CORE_APP) {
1242
+ client.subscribe(cutosAPI$1.CORE_APP[api]);
1241
1243
  }
1242
1244
  if (typeof (callback) === 'function') {
1243
1245
  callback({
@@ -1251,13 +1253,13 @@ const CoreAPI = {
1251
1253
  // message is Buffer
1252
1254
  // console.debug(topic.toString() + message.toString());
1253
1255
  let _message = JSON.parse(message);
1254
- if (topic === cutosAPI.CORE_NORESP.IPC + '-endpoint') { // ipc
1256
+ if (topic === cutosAPI$1.CORE_NORESP.IPC + '-endpoint') { // ipc
1255
1257
  let listener = listenerMap.get(_message.body.channel);
1256
1258
  if (listener !== undefined) {
1257
1259
  listener(_message.body.args, _message.context);
1258
1260
  }
1259
- } else if (topic === cutosAPI.CORE_APP.NOTIFICATION || topic === cutosAPI.CORE_APP.HEARTBEAT_LISTENER
1260
- || topic.startsWith(cutosAPI.DEVICE.CHANNEL) && !topic.endsWith('-callback')) {
1261
+ } else if (topic === cutosAPI$1.CORE_APP.NOTIFICATION || topic === cutosAPI$1.CORE_APP.HEARTBEAT_LISTENER
1262
+ || topic.startsWith(cutosAPI$1.DEVICE.CHANNEL) && !topic.endsWith('-callback')) {
1261
1263
  let listener = listenerMap.get(topic);
1262
1264
  if (listener !== undefined) {
1263
1265
  listener(_message);
@@ -1282,7 +1284,7 @@ const CoreAPI = {
1282
1284
  });
1283
1285
  },
1284
1286
  connected() {
1285
- return client.connected;
1287
+ return !!client && client.connected;
1286
1288
  },
1287
1289
 
1288
1290
  getVersion() {
@@ -1290,27 +1292,27 @@ const CoreAPI = {
1290
1292
  },
1291
1293
 
1292
1294
  getPlatform(callback) {
1293
- return publishRequest(cutosAPI.CORE.PLATFORM, callback);
1295
+ return publishRequest(cutosAPI$1.CORE.PLATFORM, callback);
1294
1296
  },
1295
1297
 
1296
1298
  getConfig(callback) {
1297
- return publishRequest(cutosAPI.CORE.CONFIG, callback);
1299
+ return publishRequest(cutosAPI$1.CORE.CONFIG, callback);
1298
1300
  },
1299
1301
 
1300
1302
  getBoxInfo(callback) {
1301
- return publishRequest(cutosAPI.CORE.BOX_INFO, callback);
1303
+ return publishRequest(cutosAPI$1.CORE.BOX_INFO, callback);
1302
1304
  },
1303
1305
 
1304
1306
  getSignInfo(callback) {
1305
- return publishRequest(cutosAPI.CORE.SIGN_INFO, callback);
1307
+ return publishRequest(cutosAPI$1.CORE.SIGN_INFO, callback);
1306
1308
  },
1307
1309
 
1308
1310
  getDeviceInfo(callback) {
1309
- return publishRequest(cutosAPI.CORE.DEVICE_INFO, callback);
1311
+ return publishRequest(cutosAPI$1.CORE.DEVICE_INFO, callback);
1310
1312
  },
1311
1313
 
1312
1314
  getSignGroupInfo(callback) {
1313
- return publishRequest(cutosAPI.CORE.SIGN_GROUP_INFO, callback);
1315
+ return publishRequest(cutosAPI$1.CORE.SIGN_GROUP_INFO, callback);
1314
1316
  },
1315
1317
 
1316
1318
  getIPC(destAddress) {
@@ -1326,7 +1328,7 @@ const CoreAPI = {
1326
1328
  },
1327
1329
 
1328
1330
  shell(command, callback) {
1329
- return publishRequest(cutosAPI.CORE.SHELL, callback, command);
1331
+ return publishRequest(cutosAPI$1.CORE.SHELL, callback, command);
1330
1332
  },
1331
1333
 
1332
1334
  getDatabase(db, callback) {
@@ -1334,21 +1336,60 @@ const CoreAPI = {
1334
1336
  },
1335
1337
 
1336
1338
  getVolume(callback) {
1337
- return publishRequest(cutosAPI.CORE.GET_VOLUME, callback);
1339
+ return publishRequest(cutosAPI$1.CORE.GET_VOLUME, callback);
1338
1340
  },
1339
1341
 
1340
1342
  setVolume(vol, callback) {
1341
- return publishRequest(cutosAPI.CORE.SET_VOLUME, callback, vol);
1343
+ return publishRequest(cutosAPI$1.CORE.SET_VOLUME, callback, vol);
1342
1344
  }
1343
1345
  };
1344
1346
 
1345
- var CoreAPI_1 = cutos.CoreAPI = CoreAPI;
1346
- var CoreDefine = cutos.CoreDefine = {
1347
- DEVICE: cutosAPI.DEVICE, HEARTBEAT_STATUS: cutosAPI.HEARTBEAT_STATUS
1347
+ cutos.CoreAPI = CoreAPI$2;
1348
+ cutos.CoreDefine = {
1349
+ DEVICE: cutosAPI$1.DEVICE, HEARTBEAT_STATUS: cutosAPI$1.HEARTBEAT_STATUS
1348
1350
  };
1349
- var CoreClass = cutos.CoreClass = {
1351
+ cutos.CoreClass = {
1350
1352
  Device, Driver
1351
1353
  };
1352
- var cutosAPI_1 = cutos.cutosAPI = cutosAPI;
1353
1354
 
1354
- export { CoreAPI_1 as CoreAPI, CoreClass, CoreDefine, cutosAPI_1 as cutosAPI, cutos as default };
1355
+ cutos.cutosAPI = cutosAPI$1;
1356
+
1357
+ // simulate cutos core for development
1358
+ const {CoreAPI: CoreAPI$1, CoreClass: CoreClass$1} = cutos;
1359
+
1360
+ const CoreSimulator$1 = {
1361
+ start: function (driver, port = 1883) {
1362
+ CoreAPI$1.init(`ws://localhost:${port}`, result => {
1363
+ console.log('CUTOS Simulator started and listening on port ', port);
1364
+
1365
+ let drvDefault = new CoreClass$1.Driver();
1366
+ drvDefault.onCommand((command) => {
1367
+ console.log('drvDefault onCommand', JSON.stringify(command));
1368
+ if (command.cmd === "init") {
1369
+ let rsp = {result: true};
1370
+ try {
1371
+ driver.init(command.args);
1372
+ } catch (e) {
1373
+ rsp.msg = e.message;
1374
+ rsp.result = false;
1375
+ }
1376
+ drvDefault.sendResponse(rsp, command.topicResponse);
1377
+ }
1378
+ });
1379
+ });
1380
+ }
1381
+ };
1382
+
1383
+ var coreSimulator = {CoreSimulator: CoreSimulator$1};
1384
+
1385
+ const {CoreAPI, CoreDefine, CoreClass, cutosAPI} = cutos;
1386
+ const {CoreSimulator} = coreSimulator;
1387
+
1388
+
1389
+ var CoreAPI_1 = src.CoreAPI = CoreAPI;
1390
+ var CoreDefine_1 = src.CoreDefine = CoreDefine;
1391
+ var CoreClass_1 = src.CoreClass = CoreClass;
1392
+ var cutosAPI_1 = src.cutosAPI = cutosAPI;
1393
+ var CoreSimulator_1 = src.CoreSimulator = CoreSimulator;
1394
+
1395
+ export { CoreAPI_1 as CoreAPI, CoreClass_1 as CoreClass, CoreDefine_1 as CoreDefine, CoreSimulator_1 as CoreSimulator, cutosAPI_1 as cutosAPI, src as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutos/core",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "",
5
5
  "main": "dist/cutos.cjs.js",
6
6
  "module": "dist/cutos.esm.js",