Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@govflanders/vl-widget-plugin

Package Overview
Dependencies
Maintainers
13
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@govflanders/vl-widget-plugin - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vlWidgetUtility=require("@govflanders/vl-widget-utility"),vlWidgetEvent=require("@govflanders/vl-widget-event"),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function __extends(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var PluginEventBase=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(vlWidgetEvent.EventBase),GenericPluginEvent=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(PluginEventBase),GenericPluginExtensionEvent=function(i){function t(t,e,n,o){void 0===o&&(o=vlWidgetEvent.EventScope.Broadcast);var r=i.call(this,t,e,o)||this;return r.pluginExtension=n,r}return __extends(t,i),t.prototype.getExtension=function(){return this.pluginExtension},t}(PluginEventBase),GenericPluginErrorEvent=function(i){function t(t,e,n,o){void 0===o&&(o=vlWidgetEvent.EventScope.Broadcast);var r=i.call(this,t,e,o)||this;return r.error=n,r}return __extends(t,i),t.prototype.getError=function(){return this.error},t}(PluginEventBase),PluginManagerBase=function(){function t(t,e){this.pluginHost=t,this.pluginDiscovery=e,this.pluginRegistry=[]}return t.prototype.getPluginHost=function(){return this.pluginHost},t.prototype.getPluginDiscovery=function(){return this.pluginDiscovery},t.prototype.createPluginInstance=function(n){var o=this;return this.getPluginDiscovery().resolvePluginFactory(n).then(function(t){var e=o.getPluginHost();return t.createPluginInstance(e,n)}).then(function(t){return t.initialize()}).then(function(t){return o.pluginRegistry.push(t),t})},t.prototype.list=function(t){for(var e=[],n="function"==typeof t?t:null,o=0,r=this.pluginRegistry;o<r.length;o++){var i=r[o];null!==n&&!n(i)||e.push(i)}return e},t.prototype.each=function(t){for(var e=[],n=0,o=this.pluginRegistry;n<o.length;n++){var r=o[n];e.push(t(r))}return Promise.all(e)},t.prototype.has=function(t){return null!==this.get(t)},t.prototype.get=function(e){return this.pluginRegistry.find(function(t){return t.getPluginId()===e})||null},t}(),PluginExtensionManagerBase=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(PluginManagerBase),HookablePluginExtensionManager=function(){function t(t,e){this.pluginExtensionManager=t,this.createPluginInstanceCallback=e}return t.prototype.getPluginHost=function(){return this.pluginExtensionManager.getPluginHost()},t.prototype.getPluginDiscovery=function(){return this.pluginExtensionManager.getPluginDiscovery()},t.prototype.createPluginInstance=function(t){return this.pluginExtensionManager.createPluginInstance(t).then(this.createPluginInstanceCallback)},t.prototype.has=function(t){return this.pluginExtensionManager.has(t)},t.prototype.get=function(t){return this.pluginExtensionManager.get(t)},t.prototype.list=function(t){return this.pluginExtensionManager.list(t)},t.prototype.each=function(t){return this.pluginExtensionManager.each(t)},t}();!function(t){t.None="none",t.Initialize="initialize",t.Ready="ready",t.Failed="failed"}(exports.PluginState||(exports.PluginState={}));var PluginError=function(r){function i(t,e,n){void 0===n&&(n=null);var o=r.call(this,e,n)||this;return Object.setPrototypeOf(o,i.prototype),o.plugin=t,o}return __extends(i,r),i}(vlWidgetUtility.Error.RuntimeError),PluginBase=function(o){function t(t,e){var n=o.call(this)||this;return n.pluginHost=t,n.pluginContext=e,n.pluginState=exports.PluginState.None,n}return __extends(t,o),t.prototype.onBeforeInitialize=function(){var t=this;return Promise.resolve(this).then(function(){return t.validatePluginContext(t.getPluginContext()),t})},t.prototype.onInitialize=function(){return Promise.resolve(this)},t.prototype.onBeforeReady=function(){return Promise.resolve(this)},t.prototype.onReady=function(){return Promise.resolve(this)},t.prototype.onFailed=function(){return Promise.resolve(this)},t.prototype.onError=function(t){return Promise.resolve(this)},t.prototype.createHookEvent=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];switch(t){case"error":return new GenericPluginErrorEvent(t,this,e[0]);default:return new GenericPluginEvent(t,this)}},t.prototype.invokeHook=function(t){for(var e,n=this,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];if(0<t.length){var i=[],s="on"+(t.charAt(0).toUpperCase()+t.slice(1));if("function"==typeof this[s]&&i.push((e=this)[s].apply(e,o)),this.getPluginState()===exports.PluginState.Ready){var u=this.createHookEvent.apply(this,[t].concat(o));i.push(this.getEventEmitter().emit(u))}return Promise.all(i).then(function(){return n})}return Promise.resolve(this)},t.prototype.validatePluginContext=function(t){if("string"!=typeof t.pluginTypeId)throw new PluginError(this,'Context property "pluginTypeId" should be a string')},t.prototype.initialize=function(){var e=this;return void 0===this.pluginInitPromise?(this.pluginState=exports.PluginState.Initialize,this.pluginInitPromise=Promise.resolve().then(function(){return e.invokeHook("beforeInitialize")}).then(function(){return e.invokeHook("initialize")}).then(function(){return e.invokeHook("beforeReady")}).then(function(){return e.pluginState=exports.PluginState.Ready,e.invokeHook("ready")}).catch(function(t){return e.pluginState=exports.PluginState.Failed,e.invokeHook("failed",t).then(function(){return Promise.reject(t)})})):this.invokeHook("error",new PluginError(this,'Plugin "'+this.getPluginTypeId()+'" is being initialized multiple times')),this.pluginInitPromise},t.prototype.getPluginState=function(){return this.pluginState},t.prototype.getPluginHost=function(){return this.pluginHost},t.prototype.getPluginContext=function(){return this.pluginContext},t.prototype.getPluginTypeId=function(){return this.getPluginContext().pluginTypeId},t.prototype.toString=function(){return this.getPluginTypeId()+":"+this.getPluginId()},t}(vlWidgetEvent.EventSourceBase);!function(t){t.Internal="internal",t.Required="required",t.Optional="optional"}(exports.PluginExtensionConstraint||(exports.PluginExtensionConstraint={})),function(t){t.UnSafe="unsafe",t.Safe="safe"}(exports.PluginExtensionResolveMethod||(exports.PluginExtensionResolveMethod={}));var ExtensiblePluginBase=function(o){function t(t,e){var n=o.call(this,t,e)||this;return n.extensionPromiseCache={},n}return __extends(t,o),t.prototype.createHookEvent=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];switch(t){case"extension":return new GenericPluginExtensionEvent(t,this,e[0]);default:return o.prototype.createHookEvent.apply(this,[t].concat(e))}},t.prototype.onBeforeReady=function(){var t=this;return o.prototype.onBeforeReady.call(this).then(function(){return t.createExtensionsByConstraint(exports.PluginExtensionConstraint.Internal)}).then(function(){return t})},t.prototype.onReady=function(){var e=this;return o.prototype.onReady.call(this).then(function(){return e.createExtensionsByConstraint(exports.PluginExtensionConstraint.Required)}).then(function(){return e.createExtensionsByConstraint(exports.PluginExtensionConstraint.Optional).catch(function(t){return e.invokeHook("error",t)}),e})},t.prototype.onExtension=function(n){var o=this;return Promise.resolve(this).then(function(){var t=n.getPluginId(),e=o.extensionPromiseCache[t]||null;return null!==e&&null!==e.resolve&&(e.resolve(n),delete o.extensionPromiseCache[t]),o})},t.prototype.createExtensionsByConstraint=function(t){var e=this;return Promise.resolve().then(function(){return e.resolveExtensionContexts(t)}).then(function(t){return e.createExtensionsByContexts(t)})},t.prototype.createExtensionsByContexts=function(s){var u=this;return Promise.resolve().then(function(){for(var t=[],e=u.getExtensionManager(),n=0,o=s;n<o.length;n++){var r=o[n],i=e.createPluginInstance(r);t.push(i)}return Promise.all(t)})},t.prototype.getExtensionManager=function(){var e=this;if(void 0===this.extensionManager){var t=this.createExtensionManager();this.extensionManager=new HookablePluginExtensionManager(t,function(t){return e.invokeHook("extension",t).then(function(){return t})})}return this.extensionManager},t.prototype.getExtensionSafe=function(n){var o=this;return Promise.resolve().then(function(){return o.tryGetExtensionUnsafe(n)}).then(function(t){if(null!==t)return t;var e=o.extensionPromiseCache[n]||null;return null!==e&&null!==e.promise||((e=o.extensionPromiseCache[n]={promise:null,resolve:null}).promise=new Promise(function(t){e.resolve=t})),e.promise})},t.prototype.tryGetExtensionUnsafe=function(t){if(this.getPluginState()!==exports.PluginState.Ready)throw new vlWidgetUtility.Error.RuntimeError('Cannot retrieve "'+t+'" extension as plugin is not ready');return this.getExtensionManager().get(t)},t.prototype.getExtensionUnsafe=function(t){var e=this.tryGetExtensionUnsafe(t);if(null===e)throw new vlWidgetUtility.Error.RuntimeError('Failed to resolve "'+t+'" extension');return e},t.prototype.getExtension=function(t,e){void 0===e&&(e=exports.PluginExtensionResolveMethod.Safe);var n=extractPluginExtensionPathInfo(t);switch(e){case exports.PluginExtensionResolveMethod.UnSafe:return resolveNestedPluginExtensionUnsafe(this.getExtensionUnsafe(n.id),n.nested);default:return this.getExtensionSafe(n.id).then(function(t){return resolveNestedPluginExtensionSafe(t,n.nested)})}},t}(PluginBase);function extractPluginExtensionPathInfo(t){var e=t.split(".");return{id:e.shift()||"",nested:e.join(".")||null}}function resolveNestedPluginExtensionUnsafe(t,e){if(e){if("function"!=typeof t.getExtension)throw new vlWidgetUtility.Error.RuntimeError('Plugin "'+t.getPluginId()+'" does not support retrieving nested extensions');return t.getExtension(e,exports.PluginExtensionResolveMethod.UnSafe)}return t}function resolveNestedPluginExtensionSafe(t,e){if(e){if("function"!=typeof t.getExtension)throw new vlWidgetUtility.Error.RuntimeError('Plugin "'+t.getPluginId()+'" does not support retrieving nested extensions');return t.getExtension(e,exports.PluginExtensionResolveMethod.Safe)}return Promise.resolve(t)}function installPluginModule(e,t){return Promise.resolve().then(function(){switch(_typeof(t)){case"string":return e.import(t);default:return t}}).then(function(t){return e.install(t)})}function installPluginContext(e,n){return Promise.resolve().then(function(){var t=n.pluginModule||null;return installPluginModule(e,t)}).then(function(){return n})}var ContainerPluginDiscovery=function(){function t(t,e){this.container=t,this.pluginFactoryServiceId=e}return t.prototype.getContainer=function(){return this.container},t.prototype.getPluginFactoryServiceId=function(){return this.pluginFactoryServiceId},t.prototype.getPluginFactoryFromContainer=function(t){var e=this.getPluginFactoryServiceId();return this.getContainer().getNamed(e,t.pluginTypeId)},t.prototype.resolvePluginFactory=function(e){var n=this;return new Promise(function(t){t(n.getPluginFactoryFromContainer(e))})},t}(),ModulePluginDiscovery=function(r){function t(t,e,n){var o=r.call(this,e,n)||this;return o.moduleManager=t,o}return __extends(t,r),t.prototype.getModuleManager=function(){return this.moduleManager},t.prototype.resolvePluginFactory=function(t){var e=this;return Promise.resolve().then(function(){return installPluginContext(e.getModuleManager(),t)}).then(function(t){return r.prototype.resolvePluginFactory.call(e,t)})},t}(ContainerPluginDiscovery),ContainerPluginContextProcessorDiscovery=function(){function t(t,e){this.container=t,this.processorFactoryServiceId=e}return t.prototype.getContainer=function(){return this.container},t.prototype.getPluginContextProcessorFactoryServiceId=function(){return this.processorFactoryServiceId},t.prototype.getPluginContextProcessorFactoryFromContainer=function(t){var e=this.getPluginContextProcessorFactoryServiceId();return this.getContainer().getNamed(e,t.pluginTypeId)},t.prototype.resolvePluginContextProcessorFactory=function(t){var e=this;return Promise.resolve().then(function(){return e.getPluginContextProcessorFactoryFromContainer(t)})},t}(),ModulePluginContextProcessorDiscovery=function(r){function t(t,e,n){var o=r.call(this,e,n)||this;return o.moduleManager=t,o}return __extends(t,r),t.prototype.getModuleManager=function(){return this.moduleManager},t.prototype.resolvePluginContextProcessorFactory=function(t){var e=this;return Promise.resolve().then(function(){return installPluginContext(e.getModuleManager(),t)}).then(function(t){return r.prototype.resolvePluginContextProcessorFactory.call(e,t)})},t}(ContainerPluginContextProcessorDiscovery),PluginContextPipelineBase=function(){function t(t){this.processorDiscovery=t}return t.prototype.getProcessorDiscovery=function(){return this.processorDiscovery},t.prototype.process=function(e){var n=this;return this.getProcessorDiscovery().resolvePluginContextProcessorFactory(e).then(function(t){return t.createPluginContextProcessor(e)}).then(function(t){return t.process(e,n)})},t}(),PluginContextProcessorBase=function(){function t(){}return t.prototype.onPreProcess=function(t,e){return Promise.resolve(t)},t.prototype.onProcess=function(t,e){return Promise.resolve(t)},t.prototype.onPostProcess=function(t,e){return Promise.resolve(t)},t.prototype.process=function(t,e){var n=this;return Promise.resolve(t).then(function(t){return n.onPreProcess(t,e)}).then(function(t){return n.onProcess(t,e)}).then(function(t){return n.onPostProcess(t,e)})},t}();exports.ContainerPluginContextProcessorDiscovery=ContainerPluginContextProcessorDiscovery,exports.ContainerPluginDiscovery=ContainerPluginDiscovery,exports.ExtensiblePluginBase=ExtensiblePluginBase,exports.GenericPluginErrorEvent=GenericPluginErrorEvent,exports.GenericPluginEvent=GenericPluginEvent,exports.GenericPluginExtensionEvent=GenericPluginExtensionEvent,exports.HookablePluginExtensionManager=HookablePluginExtensionManager,exports.ModulePluginContextProcessorDiscovery=ModulePluginContextProcessorDiscovery,exports.ModulePluginDiscovery=ModulePluginDiscovery,exports.PluginBase=PluginBase,exports.PluginContextPipelineBase=PluginContextPipelineBase,exports.PluginContextProcessorBase=PluginContextProcessorBase,exports.PluginError=PluginError,exports.PluginEventBase=PluginEventBase,exports.PluginExtensionManagerBase=PluginExtensionManagerBase,exports.PluginManagerBase=PluginManagerBase,exports.extractPluginExtensionPathInfo=extractPluginExtensionPathInfo,exports.installPluginContext=installPluginContext,exports.installPluginModule=installPluginModule,exports.resolveNestedPluginExtensionSafe=resolveNestedPluginExtensionSafe,exports.resolveNestedPluginExtensionUnsafe=resolveNestedPluginExtensionUnsafe;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vlWidgetUtility=require("@govflanders/vl-widget-utility"),vlWidgetEvent=require("@govflanders/vl-widget-event"),extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function __extends(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var PluginEventBase=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(vlWidgetEvent.EventBase),GenericPluginEvent=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(PluginEventBase),GenericPluginExtensionEvent=function(i){function t(t,e,n,r){void 0===r&&(r=vlWidgetEvent.EventScope.Broadcast);var o=i.call(this,t,e,r)||this;return o.pluginExtension=n,o}return __extends(t,i),t.prototype.getExtension=function(){return this.pluginExtension},t}(PluginEventBase),GenericPluginErrorEvent=function(i){function t(t,e,n,r){void 0===r&&(r=vlWidgetEvent.EventScope.Broadcast);var o=i.call(this,t,e,r)||this;return o.error=n,o}return __extends(t,i),t.prototype.getError=function(){return this.error},t}(PluginEventBase),PluginManagerBase=function(){function t(t,e){this.pluginHost=t,this.pluginDiscovery=e,this.pluginRegistry=[]}return t.prototype.getPluginHost=function(){return this.pluginHost},t.prototype.getPluginDiscovery=function(){return this.pluginDiscovery},t.prototype.createPluginInstance=function(n){var r=this;return this.getPluginDiscovery().resolvePluginFactory(n).then(function(t){var e=r.getPluginHost();return t.createPluginInstance(e,n)}).then(function(t){return t.initialize()}).then(function(t){return r.pluginRegistry.push(t),t})},t.prototype.list=function(t){for(var e=[],n="function"==typeof t?t:null,r=0,o=this.pluginRegistry;r<o.length;r++){var i=o[r];null!==n&&!n(i)||e.push(i)}return e},t.prototype.each=function(t){for(var e=[],n=0,r=this.pluginRegistry;n<r.length;n++){var o=r[n];e.push(t(o))}return Promise.all(e)},t.prototype.has=function(t){return null!==this.get(t)},t.prototype.get=function(e){return this.pluginRegistry.find(function(t){return t.getPluginId()===e})||null},t}(),PluginExtensionManagerBase=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(PluginManagerBase),HookablePluginExtensionManager=function(){function t(t,e){this.pluginExtensionManager=t,this.createPluginInstanceCallback=e}return t.prototype.getPluginHost=function(){return this.pluginExtensionManager.getPluginHost()},t.prototype.getPluginDiscovery=function(){return this.pluginExtensionManager.getPluginDiscovery()},t.prototype.createPluginInstance=function(t){return this.pluginExtensionManager.createPluginInstance(t).then(this.createPluginInstanceCallback)},t.prototype.has=function(t){return this.pluginExtensionManager.has(t)},t.prototype.get=function(t){return this.pluginExtensionManager.get(t)},t.prototype.list=function(t){return this.pluginExtensionManager.list(t)},t.prototype.each=function(t){return this.pluginExtensionManager.each(t)},t}();!function(t){t.None="none",t.Initialize="initialize",t.Ready="ready",t.Failed="failed"}(exports.PluginState||(exports.PluginState={}));var PluginFactoryError=function(i){function s(t,e,n,r){void 0===r&&(r=null);var o=i.call(this,n,r)||this;return Object.setPrototypeOf(o,s.prototype),o.pluginHost=t,o.pluginContext=e,o}return __extends(s,i),s}(vlWidgetUtility.Error.RuntimeError),PluginContextError=function(o){function i(t,e,n){void 0===n&&(n=null);var r=o.call(this,e,n)||this;return Object.setPrototypeOf(r,i.prototype),r.pluginContext=t,r}return __extends(i,o),i}(vlWidgetUtility.Error.RuntimeError),PluginError=function(o){function i(t,e,n){void 0===n&&(n=null);var r=o.call(this,e,n)||this;return Object.setPrototypeOf(r,i.prototype),r.plugin=t,r}return __extends(i,o),i}(vlWidgetUtility.Error.RuntimeError),PluginBase=function(r){function t(t,e){var n=r.call(this)||this;return n.pluginHost=t,n.pluginContext=e,n.pluginState=exports.PluginState.None,n}return __extends(t,r),t.prototype.onBeforeInitialize=function(){var t=this;return Promise.resolve(this).then(function(){return t.validatePluginContext(t.getPluginContext()),t})},t.prototype.onInitialize=function(){return Promise.resolve(this)},t.prototype.onBeforeReady=function(){return Promise.resolve(this)},t.prototype.onReady=function(){return Promise.resolve(this)},t.prototype.onFailed=function(){return Promise.resolve(this)},t.prototype.onError=function(t){return Promise.resolve(this)},t.prototype.createHookEvent=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];switch(t){case"error":return new GenericPluginErrorEvent(t,this,e[0]);default:return new GenericPluginEvent(t,this)}},t.prototype.invokeHook=function(t){for(var e,n=this,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(0<t.length){var i=[],s="on"+(t.charAt(0).toUpperCase()+t.slice(1));if("function"==typeof this[s]&&i.push((e=this)[s].apply(e,r)),this.getPluginState()===exports.PluginState.Ready){var u=this.createHookEvent.apply(this,[t].concat(r));i.push(this.getEventEmitter().emit(u))}return Promise.all(i).then(function(){return n})}return Promise.resolve(this)},t.prototype.validatePluginContext=function(t){if("string"!=typeof t.pluginTypeId)throw new PluginError(this,'Context property "pluginTypeId" should be a string')},t.prototype.initialize=function(){var e=this;return void 0===this.pluginInitPromise?(this.pluginState=exports.PluginState.Initialize,this.pluginInitPromise=Promise.resolve().then(function(){return e.invokeHook("beforeInitialize")}).then(function(){return e.invokeHook("initialize")}).then(function(){return e.invokeHook("beforeReady")}).then(function(){return e.pluginState=exports.PluginState.Ready,e.invokeHook("ready")}).catch(function(t){return e.pluginState=exports.PluginState.Failed,e.invokeHook("failed",t).then(function(){return Promise.reject(t)})})):this.invokeHook("error",new PluginError(this,'Plugin "'+this.getPluginTypeId()+'" is being initialized multiple times')),this.pluginInitPromise},t.prototype.getPluginState=function(){return this.pluginState},t.prototype.getPluginHost=function(){return this.pluginHost},t.prototype.getPluginContext=function(){return this.pluginContext},t.prototype.getPluginTypeId=function(){return this.getPluginContext().pluginTypeId},t.prototype.toString=function(){return this.getPluginTypeId()+":"+this.getPluginId()},t}(vlWidgetEvent.EventSourceBase);!function(t){t.Internal="internal",t.Required="required",t.Optional="optional"}(exports.PluginExtensionConstraint||(exports.PluginExtensionConstraint={})),function(t){t.UnSafe="unsafe",t.Safe="safe"}(exports.PluginExtensionResolveMethod||(exports.PluginExtensionResolveMethod={}));var ExtensiblePluginBase=function(r){function t(t,e){var n=r.call(this,t,e)||this;return n.extensionPromiseCache={},n}return __extends(t,r),t.prototype.createHookEvent=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];switch(t){case"extension":return new GenericPluginExtensionEvent(t,this,e[0]);default:return r.prototype.createHookEvent.apply(this,[t].concat(e))}},t.prototype.onBeforeReady=function(){var t=this;return r.prototype.onBeforeReady.call(this).then(function(){return t.createExtensionsByConstraint(exports.PluginExtensionConstraint.Internal)}).then(function(){return t})},t.prototype.onReady=function(){var e=this;return r.prototype.onReady.call(this).then(function(){return e.createExtensionsByConstraint(exports.PluginExtensionConstraint.Required)}).then(function(){return e.createExtensionsByConstraint(exports.PluginExtensionConstraint.Optional).catch(function(t){return e.invokeHook("error",t)}),e})},t.prototype.onExtension=function(n){var r=this;return Promise.resolve(this).then(function(){var t=n.getPluginId(),e=r.extensionPromiseCache[t]||null;return null!==e&&null!==e.resolve&&(e.resolve(n),delete r.extensionPromiseCache[t]),r})},t.prototype.createExtensionsByConstraint=function(t){var e=this;return Promise.resolve().then(function(){return e.resolveExtensionContexts(t)}).then(function(t){return e.createExtensionsByContexts(t)})},t.prototype.createExtensionsByContexts=function(s){var u=this;return Promise.resolve().then(function(){for(var t=[],e=u.getExtensionManager(),n=0,r=s;n<r.length;n++){var o=r[n],i=e.createPluginInstance(o);t.push(i)}return Promise.all(t)})},t.prototype.getExtensionManager=function(){var e=this;if(void 0===this.extensionManager){var t=this.createExtensionManager();this.extensionManager=new HookablePluginExtensionManager(t,function(t){return e.invokeHook("extension",t).then(function(){return t})})}return this.extensionManager},t.prototype.getExtensionSafe=function(n){var r=this;return Promise.resolve().then(function(){return r.tryGetExtensionUnsafe(n)}).then(function(t){if(null!==t)return t;var e=r.extensionPromiseCache[n]||null;return null!==e&&null!==e.promise||((e=r.extensionPromiseCache[n]={promise:null,resolve:null}).promise=new Promise(function(t){e.resolve=t})),e.promise})},t.prototype.tryGetExtensionUnsafe=function(t){if(this.getPluginState()!==exports.PluginState.Ready)throw new vlWidgetUtility.Error.RuntimeError('Cannot retrieve "'+t+'" extension as plugin is not ready');return this.getExtensionManager().get(t)},t.prototype.getExtensionUnsafe=function(t){var e=this.tryGetExtensionUnsafe(t);if(null===e)throw new vlWidgetUtility.Error.RuntimeError('Failed to resolve "'+t+'" extension');return e},t.prototype.getExtension=function(t,e){void 0===e&&(e=exports.PluginExtensionResolveMethod.Safe);var n=extractPluginExtensionPathInfo(t);switch(e){case exports.PluginExtensionResolveMethod.UnSafe:return resolveNestedPluginExtensionUnsafe(this.getExtensionUnsafe(n.id),n.nested);default:return this.getExtensionSafe(n.id).then(function(t){return resolveNestedPluginExtensionSafe(t,n.nested)})}},t}(PluginBase);function extractPluginExtensionPathInfo(t){var e=t.split(".");return{id:e.shift()||"",nested:e.join(".")||null}}function resolveNestedPluginExtensionUnsafe(t,e){if(e){if("function"!=typeof t.getExtension)throw new vlWidgetUtility.Error.RuntimeError('Plugin "'+t.getPluginId()+'" does not support retrieving nested extensions');return t.getExtension(e,exports.PluginExtensionResolveMethod.UnSafe)}return t}function resolveNestedPluginExtensionSafe(t,e){if(e){if("function"!=typeof t.getExtension)throw new vlWidgetUtility.Error.RuntimeError('Plugin "'+t.getPluginId()+'" does not support retrieving nested extensions');return t.getExtension(e,exports.PluginExtensionResolveMethod.Safe)}return Promise.resolve(t)}function installPluginModule(e,t){return Promise.resolve().then(function(){switch(_typeof(t)){case"string":return e.import(t);default:return t}}).then(function(t){return e.install(t)})}function installPluginContext(e,n){return Promise.resolve().then(function(){var t=n.pluginModule||null;return installPluginModule(e,t)}).then(function(){return n})}var ContainerPluginDiscovery=function(){function t(t,e){this.container=t,this.pluginFactoryServiceId=e}return t.prototype.getContainer=function(){return this.container},t.prototype.getPluginFactoryServiceId=function(){return this.pluginFactoryServiceId},t.prototype.getPluginFactoryFromContainer=function(t){var e=this.getPluginFactoryServiceId();return this.getContainer().getNamed(e,t.pluginTypeId)},t.prototype.resolvePluginFactory=function(e){var n=this;return new Promise(function(t){t(n.getPluginFactoryFromContainer(e))})},t}(),ModulePluginDiscovery=function(o){function t(t,e,n){var r=o.call(this,e,n)||this;return r.moduleManager=t,r}return __extends(t,o),t.prototype.getModuleManager=function(){return this.moduleManager},t.prototype.resolvePluginFactory=function(t){var e=this;return Promise.resolve().then(function(){return installPluginContext(e.getModuleManager(),t)}).then(function(t){return o.prototype.resolvePluginFactory.call(e,t)})},t}(ContainerPluginDiscovery),ContainerPluginContextProcessorDiscovery=function(){function t(t,e){this.container=t,this.processorFactoryServiceId=e}return t.prototype.getContainer=function(){return this.container},t.prototype.getPluginContextProcessorFactoryServiceId=function(){return this.processorFactoryServiceId},t.prototype.getPluginContextProcessorFactoryFromContainer=function(t){var e=this.getPluginContextProcessorFactoryServiceId();return this.getContainer().getNamed(e,t.pluginTypeId)},t.prototype.resolvePluginContextProcessorFactory=function(t){var e=this;return Promise.resolve().then(function(){return e.getPluginContextProcessorFactoryFromContainer(t)})},t}(),ModulePluginContextProcessorDiscovery=function(o){function t(t,e,n){var r=o.call(this,e,n)||this;return r.moduleManager=t,r}return __extends(t,o),t.prototype.getModuleManager=function(){return this.moduleManager},t.prototype.resolvePluginContextProcessorFactory=function(t){var e=this;return Promise.resolve().then(function(){return installPluginContext(e.getModuleManager(),t)}).then(function(t){return o.prototype.resolvePluginContextProcessorFactory.call(e,t)})},t}(ContainerPluginContextProcessorDiscovery),PluginContextPipelineBase=function(){function t(t){this.processorDiscovery=t}return t.prototype.getProcessorDiscovery=function(){return this.processorDiscovery},t.prototype.process=function(e){var n=this;return this.getProcessorDiscovery().resolvePluginContextProcessorFactory(e).then(function(t){return t.createPluginContextProcessor(e)}).then(function(t){return t.process(e,n)})},t}(),PluginContextProcessorBase=function(){function t(){}return t.prototype.onPreProcess=function(t,e){return Promise.resolve(t)},t.prototype.onProcess=function(t,e){return Promise.resolve(t)},t.prototype.onPostProcess=function(t,e){return Promise.resolve(t)},t.prototype.process=function(t,e){var n=this;return Promise.resolve(t).then(function(t){return n.onPreProcess(t,e)}).then(function(t){return n.onProcess(t,e)}).then(function(t){return n.onPostProcess(t,e)})},t}();exports.ContainerPluginContextProcessorDiscovery=ContainerPluginContextProcessorDiscovery,exports.ContainerPluginDiscovery=ContainerPluginDiscovery,exports.ExtensiblePluginBase=ExtensiblePluginBase,exports.GenericPluginErrorEvent=GenericPluginErrorEvent,exports.GenericPluginEvent=GenericPluginEvent,exports.GenericPluginExtensionEvent=GenericPluginExtensionEvent,exports.HookablePluginExtensionManager=HookablePluginExtensionManager,exports.ModulePluginContextProcessorDiscovery=ModulePluginContextProcessorDiscovery,exports.ModulePluginDiscovery=ModulePluginDiscovery,exports.PluginBase=PluginBase,exports.PluginContextError=PluginContextError,exports.PluginContextPipelineBase=PluginContextPipelineBase,exports.PluginContextProcessorBase=PluginContextProcessorBase,exports.PluginError=PluginError,exports.PluginEventBase=PluginEventBase,exports.PluginExtensionManagerBase=PluginExtensionManagerBase,exports.PluginFactoryError=PluginFactoryError,exports.PluginManagerBase=PluginManagerBase,exports.extractPluginExtensionPathInfo=extractPluginExtensionPathInfo,exports.installPluginContext=installPluginContext,exports.installPluginModule=installPluginModule,exports.resolveNestedPluginExtensionSafe=resolveNestedPluginExtensionSafe,exports.resolveNestedPluginExtensionUnsafe=resolveNestedPluginExtensionUnsafe;
{
"name": "@govflanders/vl-widget-plugin",
"version": "1.2.1",
"version": "1.2.2",
"license": "MIT",

@@ -26,7 +26,7 @@ "contributors": [

"dependencies": {
"@govflanders/vl-widget-dependency-injection": "^1.2.1",
"@govflanders/vl-widget-event": "^1.2.1",
"@govflanders/vl-widget-module": "^1.2.1",
"@govflanders/vl-widget-utility": "^1.2.1"
"@govflanders/vl-widget-dependency-injection": "^1.2.2",
"@govflanders/vl-widget-event": "^1.2.2",
"@govflanders/vl-widget-module": "^1.2.2",
"@govflanders/vl-widget-utility": "^1.2.2"
}
}
import { Error } from '@govflanders/vl-widget-utility';
import { Plugin } from './plugin';
import { PluginContext } from './context';
import { PluginHost } from './host';
/**
* Error which relates to a plugin factory operation.
*/
export declare class PluginFactoryError extends Error.RuntimeError {
/**
* Holds the plugin host for which an error was triggered.
*
* @var {PluginHost}
*/
readonly pluginHost: PluginHost;
/**
* Holds the plugin context for which an error was triggered.
*
* @var {PluginContext}
*/
readonly pluginContext: PluginContext;
/**
* Create a PluginFactoryError object.
*
* @param {PluginHost} pluginHost
* Plugin host for which the error was generated.
* @param {PluginContext} pluginContext
* Plugin context for which the error was generated.
* @param {string} message
* Human readable message.
* @param {Error|null} [innerError=null]
* Optional. Original error which caused the problem.
*/
constructor(pluginHost: PluginHost, pluginContext: PluginContext, message: string, innerError?: Error | null);
}
/**
* Error which relates to an unsupported plugin.
*/
export declare class PluginContextError extends Error.RuntimeError {
/**
* Holds the plugin context for which an error was triggered.
*
* @var {PluginContext}
*/
readonly pluginContext: PluginContext;
/**
* Create a PluginContextError object.
*
* @param {PluginContext} pluginContext
* Plugin context for which the error was generated.
* @param {string} message
* Human readable message.
* @param {Error|null} [innerError=null]
* Optional. Original error which caused the problem.
*/
constructor(pluginContext: PluginContext, message: string, innerError?: Error | null);
}
/**
* Error which relates to a plugin.

@@ -18,6 +72,8 @@ */

* Plugin for which the error was generated.
* @param message
* @param {string} message
* Human readable message.
* @param {Error|null} [innerError=null]
* Optional. Original error which caused the problem.
*/
constructor(plugin: Plugin, message: string, innerError?: Error | null);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc