get options() { return { ...(this.defaultOptions || {}), ...((this.polly.config.persisterOptions || {})[this.constructor.id] || {}) }; }
assert(message, ...args) { assert( `[${this.constructor.type}:${this.constructor.id}] ${message}`, ...args ); }
/** * @param {String|Function} idOrAdapter * @public * @memberof Polly */ disconnectFrom(idOrAdapter) { const { adapters } = this; let adapterId = idOrAdapter; if (typeof idOrAdapter === 'function') { adapterId = idOrAdapter.id; } if (adapters.has(adapterId)) { adapters.get(adapterId).disconnect(); adapters.delete(adapterId); } }
/** * Register a factory onto the container. * * @param {Function} Factory */ register(Factory) { assert( `Attempted to register ${Factory} but invalid factory provided. Expected function, received: "${typeof Factory}"`, typeof Factory === 'function' ); const { type } = Factory; const name = Factory.id; assert( `Invalid registration id provided. Expected string, received: "${typeof name}"`, typeof name === 'string' ); assert( `Invalid registration type provided. Expected string, received: "${typeof type}"`, typeof type === 'string' ); this._registry.set(keyFor(Factory), Factory); }
name: CREATOR_NAME, version: this.polly.constructor.VERSION, comment: `${this.constructor.type}:${this.constructor.id}` };
get options() { return { ...(this.defaultOptions || {}), ...((this.polly.config.adapterOptions || {})[this.constructor.id] || {}) }; }
/** * A request has been made. Log it to the console. * @function * @async * @param {Defiant.Context} context * The request context. */ async init(context) { // Just log the url request. console.log(this.constructor.id, '/' + context.request.urlTokenized.join('/')); }
get options() { return { ...(this.defaultOptions || {}), ...((this.polly.config.persisterOptions || {})[this.constructor.id] || {}) }; }
assert(message, ...args) { assert( `[${this.constructor.type}:${this.constructor.id}] ${message}`, ...args ); }
assert(message, ...args) { assert( `[${this.constructor.type}:${this.constructor.id}] ${message}`, ...args ); }
assert(message, ...args) { assert( `[${this.constructor.type}:${this.constructor.id}] ${message}`, ...args ); }
get options() { return { ...(this.defaultOptions || {}), ...((this.polly.config.adapterOptions || {})[this.constructor.id] || {}) }; }
/** * @param {String|Function} idOrAdapter * @public * @memberof Polly */ disconnectFrom(idOrAdapter) { const { adapters } = this; let adapterId = idOrAdapter; if (typeof idOrAdapter === 'function') { adapterId = idOrAdapter.id; } if (adapters.has(adapterId)) { adapters.get(adapterId).disconnect(); adapters.delete(adapterId); } }
/** * Register a factory onto the container. * * @param {Function} Factory */ register(Factory) { assert( `Attempted to register ${Factory} but invalid factory provided. Expected function, received: "${typeof Factory}"`, typeof Factory === 'function' ); const { type } = Factory; const name = Factory.id; assert( `Invalid registration id provided. Expected string, received: "${typeof name}"`, typeof name === 'string' ); assert( `Invalid registration type provided. Expected string, received: "${typeof type}"`, typeof type === 'string' ); this._registry.set(keyFor(Factory), Factory); }
name: CREATOR_NAME, version: this.polly.constructor.VERSION, comment: `${this.constructor.type}:${this.constructor.id}` };