From 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 18 Nov 2020 23:26:45 +0100 Subject: rm node_modules --- node_modules/mongodb/lib/operations/operation.js | 66 ------------------------ 1 file changed, 66 deletions(-) delete mode 100644 node_modules/mongodb/lib/operations/operation.js (limited to 'node_modules/mongodb/lib/operations/operation.js') diff --git a/node_modules/mongodb/lib/operations/operation.js b/node_modules/mongodb/lib/operations/operation.js deleted file mode 100644 index 28a9d05..0000000 --- a/node_modules/mongodb/lib/operations/operation.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -const Aspect = { - READ_OPERATION: Symbol('READ_OPERATION'), - WRITE_OPERATION: Symbol('WRITE_OPERATION'), - RETRYABLE: Symbol('RETRYABLE'), - EXECUTE_WITH_SELECTION: Symbol('EXECUTE_WITH_SELECTION'), - NO_INHERIT_OPTIONS: Symbol('NO_INHERIT_OPTIONS') -}; - -/** - * This class acts as a parent class for any operation and is responsible for setting this.options, - * as well as setting and getting a session. - * Additionally, this class implements `hasAspect`, which determines whether an operation has - * a specific aspect. - */ -class OperationBase { - constructor(options) { - this.options = Object.assign({}, options); - } - - hasAspect(aspect) { - if (this.constructor.aspects == null) { - return false; - } - return this.constructor.aspects.has(aspect); - } - - set session(session) { - Object.assign(this.options, { session }); - } - - get session() { - return this.options.session; - } - - clearSession() { - delete this.options.session; - } - - get canRetryRead() { - return true; - } - - execute() { - throw new TypeError('`execute` must be implemented for OperationBase subclasses'); - } -} - -function defineAspects(operation, aspects) { - if (!Array.isArray(aspects) && !(aspects instanceof Set)) { - aspects = [aspects]; - } - aspects = new Set(aspects); - Object.defineProperty(operation, 'aspects', { - value: aspects, - writable: false - }); - return aspects; -} - -module.exports = { - Aspect, - defineAspects, - OperationBase -}; -- cgit v1.2.3