in source/layers/core-lib/lib/faceCollection.js [53:102]
constructor(collectionId, data) {
const missing = REQUIRED_ENVS.filter(x => process.env[x] === undefined);
if (missing.length) {
throw new Error(`missing enviroment variables, ${missing.join(', ')}`);
}
if (!collectionId) {
throw new Error('collectionId is null');
}
const {
name,
tempId,
mode,
blob,
imageUrl,
uuid,
contentUrl,
dataUrl,
workerId,
timecode = 0,
submitted = new Date().getTime(),
} = data || {};
if (!blob && !imageUrl) {
throw new Error('either param.blob or param.imageUrl must be specified');
}
if (!name && !tempId) {
throw new Error('param.name or param.tempId must be specified');
}
this.$collectionId = collectionId;
this.$name = name && X.normalizeFileName(name);
this.$tempId = tempId;
this.$uuid = uuid;
this.$contentUrl = contentUrl;
this.$timecode = Number.parseInt(timecode, 10);
this.$submitted = submitted;
this.$mode = mode || ((tempId) ? TAG_MODE_GROUNDTRUTH : TAG_MODE_MANUAL);
this.$original = blob && Buffer.from(blob.replace(/^data:image\/\w+;base64,/, ''), 'base64');
this.$dataUrl = dataUrl;
this.$imageUrl = imageUrl;
this.$workerId = workerId;
this.$instance = new AWS.Rekognition({
apiVersion: '2016-06-27',
});
}