easyproctor 0.0.57 → 0.0.59
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/esm/index.js +28 -24
- package/index.js +36 -32
- package/modules/upload.d.ts +2 -12
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +38 -38
- package/unpkg/easyproctor.min.js.map +7 -0
package/esm/index.js
CHANGED
|
@@ -37646,7 +37646,6 @@ var require_tslib36 = __commonJS({
|
|
|
37646
37646
|
|
|
37647
37647
|
// src/modules/startCameraCapture.ts
|
|
37648
37648
|
var import_recordrtc = __toESM(require_RecordRTC());
|
|
37649
|
-
document.write('<script src="https://www.webrtc-experiment.com/EBML.js"><\/script>');
|
|
37650
37649
|
async function startCameraCapture(buffer, options = { cameraId: void 0, microphoneId: void 0 }, videoOptions = { width: 640, height: 480 }) {
|
|
37651
37650
|
const { cameraId, microphoneId } = options;
|
|
37652
37651
|
const constraints = {
|
|
@@ -53055,18 +53054,24 @@ var account = "";
|
|
|
53055
53054
|
var containerName = "";
|
|
53056
53055
|
var sas = "";
|
|
53057
53056
|
var blobServiceClient;
|
|
53057
|
+
var accessKeyId = "";
|
|
53058
|
+
var secretAccessKey = "";
|
|
53058
53059
|
var message = "";
|
|
53059
|
-
async function setConfiguration(_account, _cointainerName, _sas) {
|
|
53060
|
+
async function setConfiguration(_account, _cointainerName, _sas, _accessKeyId, _secretAccessKey) {
|
|
53060
53061
|
account = _account;
|
|
53061
53062
|
containerName = _cointainerName;
|
|
53062
53063
|
sas = _sas;
|
|
53063
53064
|
blobServiceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
|
|
53065
|
+
accessKeyId:
|
|
53066
|
+
_accessKeyId;
|
|
53067
|
+
secretAccessKey:
|
|
53068
|
+
_secretAccessKey;
|
|
53064
53069
|
}
|
|
53065
53070
|
function sendError(proctoringId) {
|
|
53066
53071
|
console.log(message);
|
|
53067
53072
|
trackers.registerError(proctoringId, message);
|
|
53068
53073
|
}
|
|
53069
|
-
async function upload(data, proctoringId
|
|
53074
|
+
async function upload(data, proctoringId) {
|
|
53070
53075
|
try {
|
|
53071
53076
|
const { file, onProgress } = data;
|
|
53072
53077
|
message += `Blob: Step 1 - ${containerName}
|
|
@@ -53096,12 +53101,11 @@ File name: ${file.name}
|
|
|
53096
53101
|
message += `File type: ${file.type}
|
|
53097
53102
|
`;
|
|
53098
53103
|
try {
|
|
53099
|
-
uploadBackup(data
|
|
53104
|
+
uploadBackup(data);
|
|
53100
53105
|
} catch (err) {
|
|
53101
53106
|
message += "\nError on AWS Upload";
|
|
53102
53107
|
throw err;
|
|
53103
53108
|
}
|
|
53104
|
-
sendError(proctoringId);
|
|
53105
53109
|
throw error;
|
|
53106
53110
|
});
|
|
53107
53111
|
message += "Blob: Step 5\n";
|
|
@@ -53110,7 +53114,7 @@ File name: ${file.name}
|
|
|
53110
53114
|
throw err;
|
|
53111
53115
|
}
|
|
53112
53116
|
}
|
|
53113
|
-
async function uploadBackup(data
|
|
53117
|
+
async function uploadBackup(data) {
|
|
53114
53118
|
const { file, onProgress } = data;
|
|
53115
53119
|
const uploadParams = {
|
|
53116
53120
|
Bucket: "iarisprod",
|
|
@@ -53120,8 +53124,8 @@ async function uploadBackup(data, config) {
|
|
|
53120
53124
|
const s3Client = new S3Client({
|
|
53121
53125
|
region: "us-east-1",
|
|
53122
53126
|
credentials: {
|
|
53123
|
-
accessKeyId
|
|
53124
|
-
secretAccessKey
|
|
53127
|
+
accessKeyId,
|
|
53128
|
+
secretAccessKey
|
|
53125
53129
|
}
|
|
53126
53130
|
});
|
|
53127
53131
|
const run = async () => {
|
|
@@ -53261,6 +53265,7 @@ async function clearBuffers(table) {
|
|
|
53261
53265
|
}
|
|
53262
53266
|
|
|
53263
53267
|
// src/index.ts
|
|
53268
|
+
document.write('<script src="https://www.webrtc-experiment.com/EBML.js"><\/script>');
|
|
53264
53269
|
var defaultProctoringOptions = {
|
|
53265
53270
|
cameraId: void 0,
|
|
53266
53271
|
microphoneId: void 0,
|
|
@@ -53414,7 +53419,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
53414
53419
|
method: "GET",
|
|
53415
53420
|
jwt: proctoringOptions.token
|
|
53416
53421
|
});
|
|
53417
|
-
setConfiguration(config.account, config.containerName, config.sas);
|
|
53422
|
+
setConfiguration(config.account, config.containerName, config.sas, config.accessKeyId, config.secretAccessKey);
|
|
53418
53423
|
azureBlobUrl = config.azureBlobUrl;
|
|
53419
53424
|
init(config.insights);
|
|
53420
53425
|
}
|
|
@@ -53566,36 +53571,34 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
53566
53571
|
trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
|
|
53567
53572
|
throw PROCTORING_NOT_STARTED;
|
|
53568
53573
|
}
|
|
53569
|
-
let config;
|
|
53570
53574
|
try {
|
|
53571
53575
|
if (azureBlobUrl == "") {
|
|
53572
53576
|
setBaseUrl(homolConfig);
|
|
53573
|
-
config = await makeRequest({
|
|
53577
|
+
const config = await makeRequest({
|
|
53574
53578
|
url: `/AzureKey`,
|
|
53575
53579
|
method: "GET",
|
|
53576
53580
|
jwt: proctoringOptions.token
|
|
53577
53581
|
});
|
|
53578
|
-
setConfiguration(config.account, config.containerName, config.sas);
|
|
53582
|
+
setConfiguration(config.account, config.containerName, config.sas, config.accessKeyId, config.secretAccessKey);
|
|
53579
53583
|
azureBlobUrl = config.azureBlobUrl;
|
|
53580
53584
|
}
|
|
53581
53585
|
} catch (error) {
|
|
53582
53586
|
trackers.registerError(proctoringId, "Erro ao buscar credenciais!");
|
|
53583
53587
|
throw "Erro ao buscar credenciais!";
|
|
53584
53588
|
}
|
|
53585
|
-
let serverTime;
|
|
53586
|
-
try {
|
|
53587
|
-
serverTime = await makeRequest({
|
|
53588
|
-
url: `/Proctoring/server-hour`,
|
|
53589
|
-
method: "GET",
|
|
53590
|
-
jwt: proctoringOptions.token
|
|
53591
|
-
});
|
|
53592
|
-
} catch (e) {
|
|
53593
|
-
trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
|
|
53594
|
-
}
|
|
53595
|
-
const time = serverTime ? new Date(serverTime.toString()) : new Date();
|
|
53596
53589
|
onStopSharingScreenCallback = void 0;
|
|
53590
|
+
let serverTime;
|
|
53597
53591
|
if (cancelCallback) {
|
|
53598
53592
|
await cancelCallback();
|
|
53593
|
+
try {
|
|
53594
|
+
serverTime = await makeRequest({
|
|
53595
|
+
url: `/Proctoring/server-hour`,
|
|
53596
|
+
method: "GET",
|
|
53597
|
+
jwt: proctoringOptions.token
|
|
53598
|
+
});
|
|
53599
|
+
} catch (e) {
|
|
53600
|
+
trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
|
|
53601
|
+
}
|
|
53599
53602
|
const { cameraFile, audioFile, screenFile } = await _closeSession(record.sessions.length);
|
|
53600
53603
|
record.sessions.push({
|
|
53601
53604
|
alerts,
|
|
@@ -53611,6 +53614,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
53611
53614
|
trackers.registerError(proctoringId, "Nenhum v\xEDdeo gravado!");
|
|
53612
53615
|
throw NO_VIDEOS_RECORDED;
|
|
53613
53616
|
}
|
|
53617
|
+
const time = new Date(serverTime.toString()).toISOString();
|
|
53614
53618
|
const allFiles = [];
|
|
53615
53619
|
record.sessions.forEach((session) => {
|
|
53616
53620
|
if (session.cameraFile)
|
|
@@ -53676,7 +53680,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
53676
53680
|
uploadProgress[i] = progress;
|
|
53677
53681
|
handleOnProgress();
|
|
53678
53682
|
}
|
|
53679
|
-
}, proctoringId
|
|
53683
|
+
}, proctoringId);
|
|
53680
53684
|
});
|
|
53681
53685
|
const timeAfter = performance.now();
|
|
53682
53686
|
await Promise.all(uploadPromises);
|
package/index.js
CHANGED
|
@@ -62250,14 +62250,14 @@ var require_fromEnv = __commonJS({
|
|
|
62250
62250
|
exports.ENV_SESSION = "AWS_SESSION_TOKEN";
|
|
62251
62251
|
exports.ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION";
|
|
62252
62252
|
var fromEnv = () => async () => {
|
|
62253
|
-
const
|
|
62254
|
-
const
|
|
62253
|
+
const accessKeyId2 = process.env[exports.ENV_KEY];
|
|
62254
|
+
const secretAccessKey2 = process.env[exports.ENV_SECRET];
|
|
62255
62255
|
const sessionToken = process.env[exports.ENV_SESSION];
|
|
62256
62256
|
const expiry = process.env[exports.ENV_EXPIRATION];
|
|
62257
|
-
if (
|
|
62257
|
+
if (accessKeyId2 && secretAccessKey2) {
|
|
62258
62258
|
return {
|
|
62259
|
-
accessKeyId,
|
|
62260
|
-
secretAccessKey,
|
|
62259
|
+
accessKeyId: accessKeyId2,
|
|
62260
|
+
secretAccessKey: secretAccessKey2,
|
|
62261
62261
|
...sessionToken && { sessionToken },
|
|
62262
62262
|
...expiry && { expiration: new Date(expiry) }
|
|
62263
62263
|
};
|
|
@@ -69437,11 +69437,11 @@ var require_resolveSSOCredentials = __commonJS({
|
|
|
69437
69437
|
} catch (e) {
|
|
69438
69438
|
throw property_provider_1.CredentialsProviderError.from(e, SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
69439
69439
|
}
|
|
69440
|
-
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration } = {} } = ssoResp;
|
|
69441
|
-
if (!
|
|
69440
|
+
const { roleCredentials: { accessKeyId: accessKeyId2, secretAccessKey: secretAccessKey2, sessionToken, expiration } = {} } = ssoResp;
|
|
69441
|
+
if (!accessKeyId2 || !secretAccessKey2 || !sessionToken || !expiration) {
|
|
69442
69442
|
throw new property_provider_1.CredentialsProviderError("SSO returns an invalid temporary credential.", SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
69443
69443
|
}
|
|
69444
|
-
return { accessKeyId, secretAccessKey, sessionToken, expiration: new Date(expiration) };
|
|
69444
|
+
return { accessKeyId: accessKeyId2, secretAccessKey: secretAccessKey2, sessionToken, expiration: new Date(expiration) };
|
|
69445
69445
|
};
|
|
69446
69446
|
exports.resolveSSOCredentials = resolveSSOCredentials;
|
|
69447
69447
|
}
|
|
@@ -77657,7 +77657,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
77657
77657
|
|
|
77658
77658
|
// src/modules/startCameraCapture.ts
|
|
77659
77659
|
var import_recordrtc = __toESM(require_RecordRTC());
|
|
77660
|
-
document.write('<script src="https://www.webrtc-experiment.com/EBML.js"><\/script>');
|
|
77661
77660
|
async function startCameraCapture(buffer, options = { cameraId: void 0, microphoneId: void 0 }, videoOptions = { width: 640, height: 480 }) {
|
|
77662
77661
|
const { cameraId, microphoneId } = options;
|
|
77663
77662
|
const constraints = {
|
|
@@ -77816,18 +77815,24 @@ var account = "";
|
|
|
77816
77815
|
var containerName = "";
|
|
77817
77816
|
var sas = "";
|
|
77818
77817
|
var blobServiceClient;
|
|
77818
|
+
var accessKeyId = "";
|
|
77819
|
+
var secretAccessKey = "";
|
|
77819
77820
|
var message = "";
|
|
77820
|
-
async function setConfiguration(_account, _cointainerName, _sas) {
|
|
77821
|
+
async function setConfiguration(_account, _cointainerName, _sas, _accessKeyId, _secretAccessKey) {
|
|
77821
77822
|
account = _account;
|
|
77822
77823
|
containerName = _cointainerName;
|
|
77823
77824
|
sas = _sas;
|
|
77824
77825
|
blobServiceClient = new import_storage_blob.BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
|
|
77826
|
+
accessKeyId:
|
|
77827
|
+
_accessKeyId;
|
|
77828
|
+
secretAccessKey:
|
|
77829
|
+
_secretAccessKey;
|
|
77825
77830
|
}
|
|
77826
77831
|
function sendError(proctoringId) {
|
|
77827
77832
|
console.log(message);
|
|
77828
77833
|
trackers.registerError(proctoringId, message);
|
|
77829
77834
|
}
|
|
77830
|
-
async function upload(data, proctoringId
|
|
77835
|
+
async function upload(data, proctoringId) {
|
|
77831
77836
|
try {
|
|
77832
77837
|
const { file, onProgress } = data;
|
|
77833
77838
|
message += `Blob: Step 1 - ${containerName}
|
|
@@ -77857,12 +77862,11 @@ File name: ${file.name}
|
|
|
77857
77862
|
message += `File type: ${file.type}
|
|
77858
77863
|
`;
|
|
77859
77864
|
try {
|
|
77860
|
-
uploadBackup(data
|
|
77865
|
+
uploadBackup(data);
|
|
77861
77866
|
} catch (err) {
|
|
77862
77867
|
message += "\nError on AWS Upload";
|
|
77863
77868
|
throw err;
|
|
77864
77869
|
}
|
|
77865
|
-
sendError(proctoringId);
|
|
77866
77870
|
throw error;
|
|
77867
77871
|
});
|
|
77868
77872
|
message += "Blob: Step 5\n";
|
|
@@ -77871,7 +77875,7 @@ File name: ${file.name}
|
|
|
77871
77875
|
throw err;
|
|
77872
77876
|
}
|
|
77873
77877
|
}
|
|
77874
|
-
async function uploadBackup(data
|
|
77878
|
+
async function uploadBackup(data) {
|
|
77875
77879
|
const { file, onProgress } = data;
|
|
77876
77880
|
const uploadParams = {
|
|
77877
77881
|
Bucket: "iarisprod",
|
|
@@ -77881,8 +77885,8 @@ async function uploadBackup(data, config) {
|
|
|
77881
77885
|
const s3Client = new import_client_s32.S3Client({
|
|
77882
77886
|
region: "us-east-1",
|
|
77883
77887
|
credentials: {
|
|
77884
|
-
accessKeyId
|
|
77885
|
-
secretAccessKey
|
|
77888
|
+
accessKeyId,
|
|
77889
|
+
secretAccessKey
|
|
77886
77890
|
}
|
|
77887
77891
|
});
|
|
77888
77892
|
const run = async () => {
|
|
@@ -78022,6 +78026,7 @@ async function clearBuffers(table) {
|
|
|
78022
78026
|
}
|
|
78023
78027
|
|
|
78024
78028
|
// src/index.ts
|
|
78029
|
+
document.write('<script src="https://www.webrtc-experiment.com/EBML.js"><\/script>');
|
|
78025
78030
|
var defaultProctoringOptions = {
|
|
78026
78031
|
cameraId: void 0,
|
|
78027
78032
|
microphoneId: void 0,
|
|
@@ -78175,7 +78180,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
78175
78180
|
method: "GET",
|
|
78176
78181
|
jwt: proctoringOptions.token
|
|
78177
78182
|
});
|
|
78178
|
-
setConfiguration(config.account, config.containerName, config.sas);
|
|
78183
|
+
setConfiguration(config.account, config.containerName, config.sas, config.accessKeyId, config.secretAccessKey);
|
|
78179
78184
|
azureBlobUrl = config.azureBlobUrl;
|
|
78180
78185
|
init(config.insights);
|
|
78181
78186
|
}
|
|
@@ -78327,36 +78332,34 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
78327
78332
|
trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
|
|
78328
78333
|
throw PROCTORING_NOT_STARTED;
|
|
78329
78334
|
}
|
|
78330
|
-
let config;
|
|
78331
78335
|
try {
|
|
78332
78336
|
if (azureBlobUrl == "") {
|
|
78333
78337
|
setBaseUrl(homolConfig);
|
|
78334
|
-
config = await makeRequest({
|
|
78338
|
+
const config = await makeRequest({
|
|
78335
78339
|
url: `/AzureKey`,
|
|
78336
78340
|
method: "GET",
|
|
78337
78341
|
jwt: proctoringOptions.token
|
|
78338
78342
|
});
|
|
78339
|
-
setConfiguration(config.account, config.containerName, config.sas);
|
|
78343
|
+
setConfiguration(config.account, config.containerName, config.sas, config.accessKeyId, config.secretAccessKey);
|
|
78340
78344
|
azureBlobUrl = config.azureBlobUrl;
|
|
78341
78345
|
}
|
|
78342
78346
|
} catch (error) {
|
|
78343
78347
|
trackers.registerError(proctoringId, "Erro ao buscar credenciais!");
|
|
78344
78348
|
throw "Erro ao buscar credenciais!";
|
|
78345
78349
|
}
|
|
78346
|
-
let serverTime;
|
|
78347
|
-
try {
|
|
78348
|
-
serverTime = await makeRequest({
|
|
78349
|
-
url: `/Proctoring/server-hour`,
|
|
78350
|
-
method: "GET",
|
|
78351
|
-
jwt: proctoringOptions.token
|
|
78352
|
-
});
|
|
78353
|
-
} catch (e) {
|
|
78354
|
-
trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
|
|
78355
|
-
}
|
|
78356
|
-
const time = serverTime ? new Date(serverTime.toString()) : new Date();
|
|
78357
78350
|
onStopSharingScreenCallback = void 0;
|
|
78351
|
+
let serverTime;
|
|
78358
78352
|
if (cancelCallback) {
|
|
78359
78353
|
await cancelCallback();
|
|
78354
|
+
try {
|
|
78355
|
+
serverTime = await makeRequest({
|
|
78356
|
+
url: `/Proctoring/server-hour`,
|
|
78357
|
+
method: "GET",
|
|
78358
|
+
jwt: proctoringOptions.token
|
|
78359
|
+
});
|
|
78360
|
+
} catch (e) {
|
|
78361
|
+
trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!");
|
|
78362
|
+
}
|
|
78360
78363
|
const { cameraFile, audioFile, screenFile } = await _closeSession(record.sessions.length);
|
|
78361
78364
|
record.sessions.push({
|
|
78362
78365
|
alerts,
|
|
@@ -78372,6 +78375,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
78372
78375
|
trackers.registerError(proctoringId, "Nenhum v\xEDdeo gravado!");
|
|
78373
78376
|
throw NO_VIDEOS_RECORDED;
|
|
78374
78377
|
}
|
|
78378
|
+
const time = new Date(serverTime.toString()).toISOString();
|
|
78375
78379
|
const allFiles = [];
|
|
78376
78380
|
record.sessions.forEach((session) => {
|
|
78377
78381
|
if (session.cameraFile)
|
|
@@ -78437,7 +78441,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
78437
78441
|
uploadProgress[i] = progress;
|
|
78438
78442
|
handleOnProgress();
|
|
78439
78443
|
}
|
|
78440
|
-
}, proctoringId
|
|
78444
|
+
}, proctoringId);
|
|
78441
78445
|
});
|
|
78442
78446
|
const timeAfter = performance.now();
|
|
78443
78447
|
await Promise.all(uploadPromises);
|
package/modules/upload.d.ts
CHANGED
|
@@ -2,16 +2,6 @@ declare type UploadData = {
|
|
|
2
2
|
file: File;
|
|
3
3
|
onProgress?: (progress: number) => void;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
account: string;
|
|
9
|
-
containerName: string;
|
|
10
|
-
sas: string;
|
|
11
|
-
insights: string;
|
|
12
|
-
accessKeyId: string;
|
|
13
|
-
secretAccessKey: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function setConfiguration(_account: string, _cointainerName: string, _sas: string): Promise<void>;
|
|
16
|
-
export default function upload(data: UploadData, proctoringId: string, config: ProctoringConfig): Promise<void>;
|
|
5
|
+
export declare function setConfiguration(_account: string, _cointainerName: string, _sas: string, _accessKeyId: string, _secretAccessKey: string): Promise<void>;
|
|
6
|
+
export default function upload(data: UploadData, proctoringId: string): Promise<void>;
|
|
17
7
|
export {};
|