Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected _materialize(identity: RecordIdentity): RecordModel {
const identifier = serializeRecordIdentity(identity);
const record = this._factory.create(identity);
this._map[identifier] = record;
return record;
}
}
protected _toInverseRelationshipForIDB(
ri: RecordRelationshipIdentity
): InverseRelationshipForIDB {
return {
id: this._serializeInverseRelationshipIdentity(ri),
recordIdentity: serializeRecordIdentity(ri.record),
relationship: ri.relationship,
relatedIdentity: serializeRecordIdentity(ri.relatedRecord),
type: ri.record.type,
relatedType: ri.relatedRecord.type
};
}
evict(identity: RecordIdentity) {
const record = this._materialized(identity);
if (record) {
const identifier = serializeRecordIdentity(identity);
delete this._map[identifier];
this._factory.disconnect(record);
}
}
protected _serializeInverseRelationshipIdentity(
ri: RecordRelationshipIdentity
): string {
return [
serializeRecordIdentity(ri.record),
ri.relationship,
serializeRecordIdentity(ri.relatedRecord)
].join('::');
}
protected _toInverseRelationshipForIDB(
ri: RecordRelationshipIdentity
): InverseRelationshipForIDB {
return {
id: this._serializeInverseRelationshipIdentity(ri),
recordIdentity: serializeRecordIdentity(ri.record),
relationship: ri.relationship,
relatedIdentity: serializeRecordIdentity(ri.relatedRecord),
type: ri.record.type,
relatedType: ri.relatedRecord.type
};
}
protected _serializeInverseRelationshipIdentity(
ri: RecordRelationshipIdentity
): string {
return [
serializeRecordIdentity(ri.record),
ri.relationship,
serializeRecordIdentity(ri.relatedRecord)
].join('::');
}