Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function removeContext(sequelize) {
const Model = /^[45]/.test(sequelize.constructor.version) ? // v3 vs v4
sequelize.constructor.Model : sequelize.constructor.Model.prototype;
shimmer.massUnwrap(Model, methods(Sequelize.version).findByPk);
shimmer.unwrap(sequelize.constructor.Association.BelongsTo.prototype, 'get');
shimmer.unwrap(sequelize.constructor.Association.HasOne.prototype, 'get');
shimmer.unwrap(sequelize.constructor.Association.HasMany.prototype, 'get');
shimmer.unwrap(sequelize.constructor.Association.BelongsToMany.prototype, 'get');
}
function unwrap() {
if (serverTarget.__iopipeShimmer) {
shimmer.massUnwrap(serverTarget, serverOps);
delete serverTarget.__iopipeShimmer;
}
if (collectionTarget.__iopipeShimmer) {
shimmer.massUnwrap(collectionTarget, collectionOps);
delete collectionTarget.__iopipeShimmer;
}
if (cursorTarget.__iopipeShimmer) {
shimmer.massUnwrap(cursorTarget, cursorOps);
delete cursorTarget.__iopipeShimmer;
}
if (clientTarget.__iopipeShimmer) {
shimmer.massUnwrap(clientTarget, clientOps); // mass just seems to hang and not complete
delete clientTarget.__iopipeShimmer;
}
}
function unwrap() {
if (serverTarget.__iopipeShimmer) {
shimmer.massUnwrap(serverTarget, serverOps);
delete serverTarget.__iopipeShimmer;
}
if (collectionTarget.__iopipeShimmer) {
shimmer.massUnwrap(collectionTarget, collectionOps);
delete collectionTarget.__iopipeShimmer;
}
if (cursorTarget.__iopipeShimmer) {
shimmer.massUnwrap(cursorTarget, cursorOps);
delete cursorTarget.__iopipeShimmer;
}
if (clientTarget.__iopipeShimmer) {
shimmer.massUnwrap(clientTarget, clientOps); // mass just seems to hang and not complete
delete clientTarget.__iopipeShimmer;
}
}
function unwrap() {
if (serverTarget.__iopipeShimmer) {
shimmer.massUnwrap(serverTarget, serverOps);
delete serverTarget.__iopipeShimmer;
}
if (collectionTarget.__iopipeShimmer) {
shimmer.massUnwrap(collectionTarget, collectionOps);
delete collectionTarget.__iopipeShimmer;
}
if (cursorTarget.__iopipeShimmer) {
shimmer.massUnwrap(cursorTarget, cursorOps);
delete cursorTarget.__iopipeShimmer;
}
if (clientTarget.__iopipeShimmer) {
shimmer.massUnwrap(clientTarget, clientOps); // mass just seems to hang and not complete
delete clientTarget.__iopipeShimmer;
}
}
function unwrap() {
if (serverTarget.__iopipeShimmer) {
shimmer.massUnwrap(serverTarget, serverOps);
delete serverTarget.__iopipeShimmer;
}
if (collectionTarget.__iopipeShimmer) {
shimmer.massUnwrap(collectionTarget, collectionOps);
delete collectionTarget.__iopipeShimmer;
}
if (cursorTarget.__iopipeShimmer) {
shimmer.massUnwrap(cursorTarget, cursorOps);
delete cursorTarget.__iopipeShimmer;
}
if (clientTarget.__iopipeShimmer) {
shimmer.massUnwrap(clientTarget, clientOps); // mass just seems to hang and not complete
delete clientTarget.__iopipeShimmer;
}
}
protected massUnwrap(nodule,names) {
shimmer.massUnwrap(nodule, names);
}
applyUnpatch(): void {
shimmer.unwrap(this.moduleExports.Server.prototype, 'command');
shimmer.massUnwrap(this.moduleExports.Server.prototype, this.SERVER_FNS);
shimmer.massUnwrap(
this.moduleExports.Cursor.prototype,
this.CURSOR_FNS_FIRST
);
}
unpatch(): void {
shimmer.massUnwrap(
[this._moduleExports.Server.prototype],
this._SERVER_METHODS as never[]
);
shimmer.massUnwrap(
[this._moduleExports.Cursor.prototype],
this._CURSOR_METHODS as never[]
);
}
applyUnpatch(): void {
shimmer.unwrap(this.moduleExports.Server.prototype, 'command');
shimmer.massUnwrap(this.moduleExports.Server.prototype, this.SERVER_FNS);
shimmer.massUnwrap(
this.moduleExports.Cursor.prototype,
this.CURSOR_FNS_FIRST
);
}