@universal-packages/dynamic-api
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -9,3 +9,3 @@ "use strict"; | ||
this.dynamics = {}; | ||
this.options = { debug: process.env['NODE_ENV'] === 'test', dynamicsLocation: './src', modules: [], ...options }; | ||
this.options = { debug: process.env['NODE_ENV'] === 'test', dynamicsLocation: './src', modules: {}, ...options }; | ||
if (this.options.debug && process.env['NODE_ENV'] !== 'test' && process.env['NODE_ENV'] !== 'development') { | ||
@@ -37,3 +37,3 @@ const message = `dynamic api (${this.options.apiName || this.constructor.name || 'unnamed'}) debug mode is enabled`; | ||
if (DynamicClass.__module) { | ||
const dynamicModuleEntry = this.options.modules.find((module) => module.name === DynamicClass.__module); | ||
const dynamicModuleEntry = this.options.modules[DynamicClass.__module]; | ||
// Skip if module is not enabled | ||
@@ -40,0 +40,0 @@ if (!dynamicModuleEntry) |
{ | ||
"name": "@universal-packages/dynamic-api", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"description": "Dynamic decoupling-adapting system", | ||
@@ -5,0 +5,0 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)", |
@@ -61,3 +61,3 @@ # Dynamic API | ||
-- **`modules`** `Array` | ||
-- **`modules`** `Map` | ||
When decorating dynamics you can mark them as part of a module, you need to enable modules explicitly in the dynamic api. | ||
@@ -77,3 +77,3 @@ | ||
```js | ||
const dynamicApi = new DynamicApi({ modules: [{ name: 'sub-calculations', enabled: true }] }) | ||
const dynamicApi = new DynamicApi({ modules: { 'sub-calculations': { enabled: true } } }) | ||
const result = await dynamicApi.performDynamic('extra') | ||
@@ -80,0 +80,0 @@ |
@@ -9,7 +9,6 @@ import DynamicApi from './DynamicApi'; | ||
dynamicsLocation: string; | ||
modules?: DynamicModule[]; | ||
modules?: Record<string, DynamicModule>; | ||
namespace?: string; | ||
} | ||
export interface DynamicModule { | ||
name: string; | ||
enabled: boolean; | ||
@@ -16,0 +15,0 @@ options?: Record<string, any>; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37066
348