easyproctor-hml 0.0.9 → 0.0.10

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
@@ -219,9 +219,9 @@ const {
219
219
  });
220
220
  ```
221
221
 
222
- ## Release Note V 0.0.84
222
+ ## Release Note V 0.0.88
223
223
 
224
- - Deploy fluxo novo para testes
224
+ - Corrigindo callback da função finish
225
225
 
226
226
  ## License
227
227
 
package/esm/index.js CHANGED
@@ -14474,7 +14474,7 @@ var CameraRecorder = class {
14474
14474
  console.log("video buffer", this.blobs);
14475
14475
  session.addRecording({
14476
14476
  device: "",
14477
- file: new File(this.blobs, `EP_${session.id}_camera.webm`, {
14477
+ file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
14478
14478
  type: "video/webm"
14479
14479
  }),
14480
14480
  origin: "Camera" /* Camera */
@@ -14532,7 +14532,7 @@ var ScreenRecorder = class {
14532
14532
  console.log("screen buffer", this.blobs);
14533
14533
  session.addRecording({
14534
14534
  device: "",
14535
- file: new File(this.blobs, `EP_${session.id}_screen.webm`, {
14535
+ file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
14536
14536
  type: "video/webm"
14537
14537
  }),
14538
14538
  origin: "Screen" /* Screen */
@@ -16614,7 +16614,7 @@ var ProctoringUploader = class {
16614
16614
  this.session = session;
16615
16615
  this.uploadServices = uploadServices;
16616
16616
  }
16617
- async upload(progress, token) {
16617
+ async upload(token, progress) {
16618
16618
  await this.uploadRecordings(token, progress);
16619
16619
  }
16620
16620
  async uploadRecordings(token, onProgress) {
@@ -16682,11 +16682,13 @@ var ProctoringUploader = class {
16682
16682
 
16683
16683
  // src/new-flow/recorders/AlertRecorder.ts
16684
16684
  var AlertRecorder = class {
16685
- constructor(options, optionsProctoring) {
16685
+ constructor(options, optionsProctoring, repositoryDevices) {
16686
16686
  this.alerts = [];
16687
16687
  this.onLostFocusCallback = options.onLostFocusCallback;
16688
16688
  this.onFocusCallback = options.onFocusCallback;
16689
+ this.onChangeDevicesCallback = options.onChangeDevicesCallback;
16689
16690
  this.optionsProctoring = optionsProctoring;
16691
+ this.repositoryDevices = repositoryDevices;
16690
16692
  }
16691
16693
  async startRecording() {
16692
16694
  this.startTime = new Date(Date.now());
@@ -16694,6 +16696,7 @@ var AlertRecorder = class {
16694
16696
  window.addEventListener("blur", () => this.onLostFocus());
16695
16697
  window.addEventListener("focus", () => this.onReturnFocus());
16696
16698
  }
16699
+ navigator.mediaDevices.ondevicechange = () => this.onChangeDevices();
16697
16700
  }
16698
16701
  async stopRecording() {
16699
16702
  window.removeEventListener("blur", () => this.onLostFocus());
@@ -16722,6 +16725,13 @@ var AlertRecorder = class {
16722
16725
  lastAlert.end = Date.now() - this.startTime.getTime();
16723
16726
  }
16724
16727
  }
16728
+ async onChangeDevices() {
16729
+ this.onChangeDevicesCallback();
16730
+ const devices = await enumarateDevices();
16731
+ console.log(devices);
16732
+ const response = await this.repositoryDevices.get("devices");
16733
+ console.log("devices DB: ", response);
16734
+ }
16725
16735
  };
16726
16736
 
16727
16737
  // src/plugins/MicRecorder2.ts
@@ -16761,7 +16771,7 @@ var AudioRecorder = class {
16761
16771
  console.log("audio buffer", [this.blobs]);
16762
16772
  session.addRecording({
16763
16773
  device: "",
16764
- file: new File(this.blobs, `EP_${session.id}_audio.mp3`, {
16774
+ file: new File(this.blobs, `EP_${session.id}_audio_0.mp3`, {
16765
16775
  type: "audio/mp3"
16766
16776
  }),
16767
16777
  origin: "Mic" /* Mic */
@@ -16771,10 +16781,12 @@ var AudioRecorder = class {
16771
16781
 
16772
16782
  // src/new-flow/repository/IndexDbSessionRepository.ts
16773
16783
  var IndexDbSessionRepository = class {
16774
- constructor() {
16784
+ constructor(dbName, storeName) {
16775
16785
  this.dbName = "EasyProctorDb";
16776
- this.dbVersion = 1;
16786
+ this.dbVersion = 2;
16777
16787
  this.storeName = "exams2";
16788
+ this.dbName = dbName;
16789
+ this.storeName = storeName;
16778
16790
  }
16779
16791
  async save(data) {
16780
16792
  const { transaction, store } = await this.connectToStore("readwrite");
@@ -16824,7 +16836,7 @@ var IndexDbSessionRepository = class {
16824
16836
  if (this.connection)
16825
16837
  return this.connection;
16826
16838
  return new Promise((resolve, reject) => {
16827
- const request = window.indexedDB.open(this.dbName, 2);
16839
+ const request = window.indexedDB.open(this.dbName, this.dbVersion);
16828
16840
  request.onerror = (event) => {
16829
16841
  console.log("request.onerror", event);
16830
16842
  reject("Can't connect to IndexedDB");
@@ -24986,13 +24998,14 @@ var Proctoring = class {
24986
24998
  };
24987
24999
  this.onFocusCallback = () => {
24988
25000
  };
24989
- this.onProgress = (percentage) => {
25001
+ this.onChangeDevicesCallback = () => {
24990
25002
  };
24991
25003
  console.log("new proctoring", context);
24992
25004
  this.backend = new BackendService({
24993
25005
  type: context.type
24994
25006
  });
24995
- this.repository = new IndexDbSessionRepository();
25007
+ this.repository = new IndexDbSessionRepository("EasyProctorDb", "exams2");
25008
+ this.repositoryDevices = new IndexDbSessionRepository("EasyProctorDbDevices", "devices");
24996
25009
  }
24997
25010
  setOnStopSharingScreenCallback(cb) {
24998
25011
  console.log("proctoring.setOnStopSharingScreenCallback");
@@ -25006,9 +25019,9 @@ var Proctoring = class {
25006
25019
  console.log("proctoring.setOnFocusCallback");
25007
25020
  this.onFocusCallback = () => cb();
25008
25021
  }
25009
- setOnProgress(cb) {
25010
- console.log("proctoring.setOnProgress");
25011
- this.onProgress = (percentage) => cb(percentage);
25022
+ setOnChangeDevicesCallback(cb) {
25023
+ console.log("proctoring.setOnChangeDevicesCallback");
25024
+ this.onChangeDevicesCallback = () => cb();
25012
25025
  }
25013
25026
  createRecorders(options = getDefaultProctoringOptions()) {
25014
25027
  var _a2;
@@ -25026,8 +25039,9 @@ var Proctoring = class {
25026
25039
  }) : void 0;
25027
25040
  const alertRecorder = new AlertRecorder({
25028
25041
  onFocusCallback: () => this.onFocusCallback(),
25029
- onLostFocusCallback: () => this.onLostFocusCallback()
25030
- }, options);
25042
+ onLostFocusCallback: () => this.onLostFocusCallback(),
25043
+ onChangeDevicesCallback: () => this.onChangeDevicesCallback()
25044
+ }, options, this.repositoryDevices);
25031
25045
  const recorders = [
25032
25046
  cameraRecorder,
25033
25047
  audioRecorder,
@@ -25039,6 +25053,8 @@ var Proctoring = class {
25039
25053
  }
25040
25054
  async start(options = getDefaultProctoringOptions(), _videoOptions = {}) {
25041
25055
  console.log("proctoring.start", options, _videoOptions);
25056
+ const devices = await enumarateDevices();
25057
+ await this.repositoryDevices.save({ ...devices, id: "devices" });
25042
25058
  this.sessionOptions = options;
25043
25059
  this.videoOptions = validatePartialVideoOptions(_videoOptions);
25044
25060
  if (this.state != "Stop" /* Stop */) {
@@ -25094,27 +25110,42 @@ var Proctoring = class {
25094
25110
  await this.recorder.saveAllOnSession();
25095
25111
  await this.repository.save(this.proctoringSession);
25096
25112
  let uploader;
25113
+ let uploaderServices;
25097
25114
  if (versionVerify() !== "1.0.0.0") {
25098
25115
  uploader = new ProctoringUploader(this.proctoringSession, [
25099
25116
  new DownloadService(this.proctoringId)
25100
25117
  ]);
25118
+ uploaderServices = "Download";
25101
25119
  } else {
25102
25120
  uploader = new ProctoringUploader(this.proctoringSession, [
25103
25121
  new AzureUploadService(this.proctoringId, this.backend),
25104
25122
  new AwsUploadService(this.proctoringId, this.backend),
25105
25123
  new DownloadService(this.proctoringId)
25106
25124
  ]);
25125
+ uploaderServices = "Azure, AWS, Download";
25107
25126
  }
25108
- await uploader.upload(this.onProgress, this.context.token).catch(async (error) => {
25127
+ await uploader.upload(this.context.token, options.onProgress).catch(async (error) => {
25128
+ trackers.registerUploadVideo(this.proctoringSession.id, false, `upload error: ${error}
25129
+
25130
+ Upload Services: ${uploaderServices}`);
25109
25131
  if (versionVerify() !== "1.0.0.0") {
25110
25132
  uploader = new ProctoringUploader(this.proctoringSession, [
25111
25133
  new AzureUploadService(this.proctoringId, this.backend),
25112
25134
  new AwsUploadService(this.proctoringId, this.backend),
25113
25135
  new DownloadService(this.proctoringId)
25114
25136
  ]);
25115
- await uploader.upload(this.onProgress, this.context.token);
25137
+ uploaderServices = "Azure, AWS, Download";
25138
+ await uploader.upload(this.context.token, options.onProgress).catch((error2) => {
25139
+ trackers.registerUploadVideo(this.proctoringSession.id, false, `upload backup error: ${error2}
25140
+
25141
+ Upload Services: ${uploaderServices}
25142
+ Upload backup for Safe Browser`);
25143
+ });
25116
25144
  }
25117
25145
  });
25146
+ trackers.registerUploadVideo(this.proctoringSession.id, true, `upload success
25147
+
25148
+ Upload Services: ${uploaderServices}`);
25118
25149
  await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
25119
25150
  trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
25120
25151
  });
@@ -25202,6 +25233,7 @@ function useProctoring(proctoringOptions, homolConfig = "prod") {
25202
25233
  const resume = proctoring.resume.bind(proctoring);
25203
25234
  const onFocus = proctoring.setOnFocusCallback.bind(proctoring);
25204
25235
  const onLostFocus = proctoring.setOnLostFocusCallback.bind(proctoring);
25236
+ const onChangeDevices = proctoring.setOnChangeDevicesCallback.bind(proctoring);
25205
25237
  const onStopSharingScreen = proctoring.setOnStopSharingScreenCallback.bind(proctoring);
25206
25238
  const checkDevices = checker.checkDevices.bind(checker);
25207
25239
  const closeCheckDevices = checker.closeCheckDevices.bind(checker);
@@ -25210,6 +25242,7 @@ function useProctoring(proctoringOptions, homolConfig = "prod") {
25210
25242
  finish,
25211
25243
  onFocus,
25212
25244
  onLostFocus,
25245
+ onChangeDevices,
25213
25246
  checkDevices,
25214
25247
  closeCheckDevices,
25215
25248
  pause,
package/index.js CHANGED
@@ -33415,7 +33415,7 @@ var CameraRecorder = class {
33415
33415
  console.log("video buffer", this.blobs);
33416
33416
  session.addRecording({
33417
33417
  device: "",
33418
- file: new File(this.blobs, `EP_${session.id}_camera.webm`, {
33418
+ file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
33419
33419
  type: "video/webm"
33420
33420
  }),
33421
33421
  origin: "Camera" /* Camera */
@@ -33473,7 +33473,7 @@ var ScreenRecorder = class {
33473
33473
  console.log("screen buffer", this.blobs);
33474
33474
  session.addRecording({
33475
33475
  device: "",
33476
- file: new File(this.blobs, `EP_${session.id}_screen.webm`, {
33476
+ file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
33477
33477
  type: "video/webm"
33478
33478
  }),
33479
33479
  origin: "Screen" /* Screen */
@@ -36162,7 +36162,7 @@ var ProctoringUploader = class {
36162
36162
  this.session = session;
36163
36163
  this.uploadServices = uploadServices;
36164
36164
  }
36165
- async upload(progress, token) {
36165
+ async upload(token, progress) {
36166
36166
  await this.uploadRecordings(token, progress);
36167
36167
  }
36168
36168
  async uploadRecordings(token, onProgress) {
@@ -36230,11 +36230,13 @@ var ProctoringUploader = class {
36230
36230
 
36231
36231
  // src/new-flow/recorders/AlertRecorder.ts
36232
36232
  var AlertRecorder = class {
36233
- constructor(options, optionsProctoring) {
36233
+ constructor(options, optionsProctoring, repositoryDevices) {
36234
36234
  this.alerts = [];
36235
36235
  this.onLostFocusCallback = options.onLostFocusCallback;
36236
36236
  this.onFocusCallback = options.onFocusCallback;
36237
+ this.onChangeDevicesCallback = options.onChangeDevicesCallback;
36237
36238
  this.optionsProctoring = optionsProctoring;
36239
+ this.repositoryDevices = repositoryDevices;
36238
36240
  }
36239
36241
  async startRecording() {
36240
36242
  this.startTime = new Date(Date.now());
@@ -36242,6 +36244,7 @@ var AlertRecorder = class {
36242
36244
  window.addEventListener("blur", () => this.onLostFocus());
36243
36245
  window.addEventListener("focus", () => this.onReturnFocus());
36244
36246
  }
36247
+ navigator.mediaDevices.ondevicechange = () => this.onChangeDevices();
36245
36248
  }
36246
36249
  async stopRecording() {
36247
36250
  window.removeEventListener("blur", () => this.onLostFocus());
@@ -36270,6 +36273,13 @@ var AlertRecorder = class {
36270
36273
  lastAlert.end = Date.now() - this.startTime.getTime();
36271
36274
  }
36272
36275
  }
36276
+ async onChangeDevices() {
36277
+ this.onChangeDevicesCallback();
36278
+ const devices = await enumarateDevices();
36279
+ console.log(devices);
36280
+ const response = await this.repositoryDevices.get("devices");
36281
+ console.log("devices DB: ", response);
36282
+ }
36273
36283
  };
36274
36284
 
36275
36285
  // src/plugins/MicRecorder2.ts
@@ -36309,7 +36319,7 @@ var AudioRecorder = class {
36309
36319
  console.log("audio buffer", [this.blobs]);
36310
36320
  session.addRecording({
36311
36321
  device: "",
36312
- file: new File(this.blobs, `EP_${session.id}_audio.mp3`, {
36322
+ file: new File(this.blobs, `EP_${session.id}_audio_0.mp3`, {
36313
36323
  type: "audio/mp3"
36314
36324
  }),
36315
36325
  origin: "Mic" /* Mic */
@@ -36319,10 +36329,12 @@ var AudioRecorder = class {
36319
36329
 
36320
36330
  // src/new-flow/repository/IndexDbSessionRepository.ts
36321
36331
  var IndexDbSessionRepository = class {
36322
- constructor() {
36332
+ constructor(dbName, storeName) {
36323
36333
  this.dbName = "EasyProctorDb";
36324
- this.dbVersion = 1;
36334
+ this.dbVersion = 2;
36325
36335
  this.storeName = "exams2";
36336
+ this.dbName = dbName;
36337
+ this.storeName = storeName;
36326
36338
  }
36327
36339
  async save(data) {
36328
36340
  const { transaction, store } = await this.connectToStore("readwrite");
@@ -36372,7 +36384,7 @@ var IndexDbSessionRepository = class {
36372
36384
  if (this.connection)
36373
36385
  return this.connection;
36374
36386
  return new Promise((resolve, reject) => {
36375
- const request = window.indexedDB.open(this.dbName, 2);
36387
+ const request = window.indexedDB.open(this.dbName, this.dbVersion);
36376
36388
  request.onerror = (event) => {
36377
36389
  console.log("request.onerror", event);
36378
36390
  reject("Can't connect to IndexedDB");
@@ -36520,13 +36532,14 @@ var Proctoring = class {
36520
36532
  };
36521
36533
  this.onFocusCallback = () => {
36522
36534
  };
36523
- this.onProgress = (percentage) => {
36535
+ this.onChangeDevicesCallback = () => {
36524
36536
  };
36525
36537
  console.log("new proctoring", context);
36526
36538
  this.backend = new BackendService({
36527
36539
  type: context.type
36528
36540
  });
36529
- this.repository = new IndexDbSessionRepository();
36541
+ this.repository = new IndexDbSessionRepository("EasyProctorDb", "exams2");
36542
+ this.repositoryDevices = new IndexDbSessionRepository("EasyProctorDbDevices", "devices");
36530
36543
  }
36531
36544
  setOnStopSharingScreenCallback(cb) {
36532
36545
  console.log("proctoring.setOnStopSharingScreenCallback");
@@ -36540,9 +36553,9 @@ var Proctoring = class {
36540
36553
  console.log("proctoring.setOnFocusCallback");
36541
36554
  this.onFocusCallback = () => cb();
36542
36555
  }
36543
- setOnProgress(cb) {
36544
- console.log("proctoring.setOnProgress");
36545
- this.onProgress = (percentage) => cb(percentage);
36556
+ setOnChangeDevicesCallback(cb) {
36557
+ console.log("proctoring.setOnChangeDevicesCallback");
36558
+ this.onChangeDevicesCallback = () => cb();
36546
36559
  }
36547
36560
  createRecorders(options = getDefaultProctoringOptions()) {
36548
36561
  var _a;
@@ -36560,8 +36573,9 @@ var Proctoring = class {
36560
36573
  }) : void 0;
36561
36574
  const alertRecorder = new AlertRecorder({
36562
36575
  onFocusCallback: () => this.onFocusCallback(),
36563
- onLostFocusCallback: () => this.onLostFocusCallback()
36564
- }, options);
36576
+ onLostFocusCallback: () => this.onLostFocusCallback(),
36577
+ onChangeDevicesCallback: () => this.onChangeDevicesCallback()
36578
+ }, options, this.repositoryDevices);
36565
36579
  const recorders = [
36566
36580
  cameraRecorder,
36567
36581
  audioRecorder,
@@ -36573,6 +36587,8 @@ var Proctoring = class {
36573
36587
  }
36574
36588
  async start(options = getDefaultProctoringOptions(), _videoOptions = {}) {
36575
36589
  console.log("proctoring.start", options, _videoOptions);
36590
+ const devices = await enumarateDevices();
36591
+ await this.repositoryDevices.save({ ...devices, id: "devices" });
36576
36592
  this.sessionOptions = options;
36577
36593
  this.videoOptions = validatePartialVideoOptions(_videoOptions);
36578
36594
  if (this.state != "Stop" /* Stop */) {
@@ -36628,27 +36644,42 @@ var Proctoring = class {
36628
36644
  await this.recorder.saveAllOnSession();
36629
36645
  await this.repository.save(this.proctoringSession);
36630
36646
  let uploader;
36647
+ let uploaderServices;
36631
36648
  if (versionVerify() !== "1.0.0.0") {
36632
36649
  uploader = new ProctoringUploader(this.proctoringSession, [
36633
36650
  new DownloadService(this.proctoringId)
36634
36651
  ]);
36652
+ uploaderServices = "Download";
36635
36653
  } else {
36636
36654
  uploader = new ProctoringUploader(this.proctoringSession, [
36637
36655
  new AzureUploadService(this.proctoringId, this.backend),
36638
36656
  new AwsUploadService(this.proctoringId, this.backend),
36639
36657
  new DownloadService(this.proctoringId)
36640
36658
  ]);
36659
+ uploaderServices = "Azure, AWS, Download";
36641
36660
  }
36642
- await uploader.upload(this.onProgress, this.context.token).catch(async (error) => {
36661
+ await uploader.upload(this.context.token, options.onProgress).catch(async (error) => {
36662
+ trackers.registerUploadVideo(this.proctoringSession.id, false, `upload error: ${error}
36663
+
36664
+ Upload Services: ${uploaderServices}`);
36643
36665
  if (versionVerify() !== "1.0.0.0") {
36644
36666
  uploader = new ProctoringUploader(this.proctoringSession, [
36645
36667
  new AzureUploadService(this.proctoringId, this.backend),
36646
36668
  new AwsUploadService(this.proctoringId, this.backend),
36647
36669
  new DownloadService(this.proctoringId)
36648
36670
  ]);
36649
- await uploader.upload(this.onProgress, this.context.token);
36671
+ uploaderServices = "Azure, AWS, Download";
36672
+ await uploader.upload(this.context.token, options.onProgress).catch((error2) => {
36673
+ trackers.registerUploadVideo(this.proctoringSession.id, false, `upload backup error: ${error2}
36674
+
36675
+ Upload Services: ${uploaderServices}
36676
+ Upload backup for Safe Browser`);
36677
+ });
36650
36678
  }
36651
36679
  });
36680
+ trackers.registerUploadVideo(this.proctoringSession.id, true, `upload success
36681
+
36682
+ Upload Services: ${uploaderServices}`);
36652
36683
  await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
36653
36684
  trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
36654
36685
  });
@@ -36736,6 +36767,7 @@ function useProctoring(proctoringOptions, homolConfig = "prod") {
36736
36767
  const resume = proctoring.resume.bind(proctoring);
36737
36768
  const onFocus = proctoring.setOnFocusCallback.bind(proctoring);
36738
36769
  const onLostFocus = proctoring.setOnLostFocusCallback.bind(proctoring);
36770
+ const onChangeDevices = proctoring.setOnChangeDevicesCallback.bind(proctoring);
36739
36771
  const onStopSharingScreen = proctoring.setOnStopSharingScreenCallback.bind(proctoring);
36740
36772
  const checkDevices = checker.checkDevices.bind(checker);
36741
36773
  const closeCheckDevices = checker.closeCheckDevices.bind(checker);
@@ -36744,6 +36776,7 @@ function useProctoring(proctoringOptions, homolConfig = "prod") {
36744
36776
  finish,
36745
36777
  onFocus,
36746
36778
  onLostFocus,
36779
+ onChangeDevices,
36747
36780
  checkDevices,
36748
36781
  closeCheckDevices,
36749
36782
  pause,
@@ -6,7 +6,7 @@ export declare class ProctoringUploader {
6
6
  private session;
7
7
  private uploadServices;
8
8
  constructor(session: ProctoringSession, uploadServices: IUploadService[] | IDownloadService[]);
9
- upload(progress: ProgressCallback, token: string): Promise<void>;
9
+ upload(token: string, progress?: ProgressCallback): Promise<void>;
10
10
  private uploadRecordings;
11
11
  private uploadAllFiles;
12
12
  private uploadFile;
@@ -1,19 +1,24 @@
1
1
  import { ProctoringSessionOptions } from "../../proctoring/options/ProctoringOptions";
2
2
  import { ProctoringSession } from "../proctoring/ProctoringSession";
3
+ import { ISessionRepository } from "../repository/ISessionRepository";
3
4
  import { IRecorder } from "./IRecorder";
4
5
  export declare class AlertRecorder implements IRecorder {
5
6
  private alerts;
6
7
  private startTime;
7
8
  private onLostFocusCallback;
8
9
  private onFocusCallback;
10
+ private onChangeDevicesCallback;
9
11
  private optionsProctoring;
12
+ private repositoryDevices;
10
13
  constructor(options: {
11
14
  onLostFocusCallback: () => void;
12
15
  onFocusCallback: () => void;
13
- }, optionsProctoring: ProctoringSessionOptions);
16
+ onChangeDevicesCallback: () => void;
17
+ }, optionsProctoring: ProctoringSessionOptions, repositoryDevices: ISessionRepository);
14
18
  startRecording(): Promise<void>;
15
19
  stopRecording(): Promise<void>;
16
20
  saveOnSession(session: ProctoringSession): Promise<void>;
17
21
  private onLostFocus;
18
22
  private onReturnFocus;
23
+ private onChangeDevices;
19
24
  }
@@ -1,9 +1,10 @@
1
+ import Devices from "../../interfaces/Devices";
1
2
  import { ProctoringSession } from "../proctoring/ProctoringSession";
2
3
  export interface ISessionRepository {
3
- save(data: ProctoringSession): Promise<void>;
4
- list(): Promise<ProctoringSession[]>;
4
+ save(data: Devices | ProctoringSession): Promise<void>;
5
+ list(): Promise<ProctoringSession[] | Devices[]>;
5
6
  delete(id: string): Promise<void>;
6
- get(id: string): Promise<ProctoringSession | undefined>;
7
+ get(id: string): Promise<ProctoringSession | Devices | undefined>;
7
8
  clear(): Promise<void>;
8
9
  hasSessions(): Promise<boolean>;
9
10
  }
@@ -1,13 +1,15 @@
1
+ import Devices from "../../interfaces/Devices";
1
2
  import { ProctoringSession } from "../proctoring/ProctoringSession";
2
3
  import { ISessionRepository } from "./ISessionRepository";
3
4
  export declare class IndexDbSessionRepository implements ISessionRepository {
4
5
  private dbName;
5
6
  private dbVersion;
6
7
  private storeName;
7
- save(data: ProctoringSession): Promise<void>;
8
+ constructor(dbName: string, storeName: string);
9
+ save(data: Devices | ProctoringSession): Promise<void>;
8
10
  delete(id: string): Promise<void>;
9
- get(id: string): Promise<ProctoringSession | undefined>;
10
- list(): Promise<ProctoringSession[]>;
11
+ get(id: string): Promise<ProctoringSession | Devices | undefined>;
12
+ list(): Promise<ProctoringSession[] | Devices[]>;
11
13
  clear(): Promise<void>;
12
14
  private processRequest;
13
15
  hasSessions(): Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -21,6 +21,7 @@ export declare class Proctoring {
21
21
  private readonly context;
22
22
  private readonly backend;
23
23
  private readonly repository;
24
+ private readonly repositoryDevices;
24
25
  private proctoringId;
25
26
  private insights?;
26
27
  private proctoringSession;
@@ -34,8 +35,8 @@ export declare class Proctoring {
34
35
  setOnLostFocusCallback(cb: () => void): void;
35
36
  private onFocusCallback;
36
37
  setOnFocusCallback(cb: () => void): void;
37
- private onProgress;
38
- setOnProgress(cb: (percentage: number) => void): void;
38
+ private onChangeDevicesCallback;
39
+ setOnChangeDevicesCallback(cb: () => void): void;
39
40
  constructor(context: ProctoringContext);
40
41
  private createRecorders;
41
42
  start(options?: ProctoringSessionOptions, _videoOptions?: Partial<ProctoringVideoOptions>): Promise<StartProctoringResponse>;
@@ -9,6 +9,7 @@ export declare function useProctoring(proctoringOptions: {
9
9
  finish: (options?: import("./proctoring").ProctoringFinisherOptions) => Promise<void>;
10
10
  onFocus: (cb: () => void) => void;
11
11
  onLostFocus: (cb: () => void) => void;
12
+ onChangeDevices: (cb: () => void) => void;
12
13
  checkDevices: (options: import("./options/ProctoringOptions").ProctoringSessionOptions | undefined, _videoOptions: Partial<import("./options/ProctoringVideoOptions").ProctoringVideoOptions>) => Promise<{
13
14
  cameraStream: MediaStream;
14
15
  _screenStream: MediaStream | undefined;