@vonage/vvd-core
Advanced tools
Comparing version 0.5.0 to 0.6.0
{ | ||
"name": "@vonage/vvd-core", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "> TODO: description", | ||
@@ -27,7 +27,7 @@ "author": "yinonov <yinon@hotmail.com>", | ||
"dependencies": { | ||
"@vonage/vvd-fonts": "^0.5.0", | ||
"@vonage/vvd-scheme": "^0.5.0", | ||
"tslib": "^2.0.0" | ||
"@vonage/vvd-fonts": "^0.6.0", | ||
"@vonage/vvd-scheme": "^0.6.0", | ||
"tslib": "^2.0.1" | ||
}, | ||
"gitHead": "5f43688d123fda159d4a0c15bfcf5011075a82d4" | ||
"gitHead": "d55fb00c43d48e3f8b0f3de170e4cb6949acbfd8" | ||
} |
@@ -1,9 +0,1 @@ | ||
export declare function validateInitParameters(services: Record<string, unknown>): void; | ||
/** | ||
* Internal initialiser | ||
* this API is an internal initialiser of the core services | ||
* | ||
* @param services a map of the services requested to be initialised, where the key is the name of the service and the value is the parameter/s to be passed to the service initialisation function | ||
* @returns compound Promise of all inidividual service initialisation Promises | ||
*/ | ||
export declare function init(services?: Record<string, unknown>): Promise<void[]>; | ||
export declare const coreReady: Promise<unknown>; |
@@ -0,39 +1,20 @@ | ||
import configuration from './config-resolver.js'; | ||
import fonts from '@vonage/vvd-fonts/vvd-fonts.js'; | ||
import scheme from '@vonage/vvd-scheme'; | ||
const servicesRegistry = { | ||
'fonts': { | ||
defaultInitParam: null, | ||
initialiser: fonts.init | ||
}, | ||
'scheme': { | ||
defaultInitParam: null, | ||
initialiser: scheme.init | ||
} | ||
}; | ||
export function validateInitParameters(services) { | ||
const knownServices = Object.keys(servicesRegistry); | ||
const unknownService = Object.keys(services).find(serviceKey => !knownServices.includes(serviceKey)); | ||
if (unknownService) { | ||
throw new Error(`unknown service key '${unknownService}' specified for init API`); | ||
} | ||
import schemeService from '@vonage/vvd-scheme'; | ||
let initResolver, initRejector; | ||
export const coreReady = new Promise((resolve, reject) => { | ||
initResolver = resolve; | ||
initRejector = reject; | ||
}); | ||
console.debug('effective config', JSON.stringify(configuration)); | ||
init(configuration); | ||
async function init({ scheme }) { | ||
Promise | ||
.all([ | ||
fonts.init(), | ||
schemeService.set(scheme) | ||
]) | ||
.then(initResolver) | ||
.catch(initRejector); | ||
} | ||
/** | ||
* Internal initialiser | ||
* this API is an internal initialiser of the core services | ||
* | ||
* @param services a map of the services requested to be initialised, where the key is the name of the service and the value is the parameter/s to be passed to the service initialisation function | ||
* @returns compound Promise of all inidividual service initialisation Promises | ||
*/ | ||
export async function init(services) { | ||
if (services) { | ||
validateInitParameters(services); | ||
} | ||
else { | ||
services = servicesRegistry; | ||
} | ||
const serviceInitPromises = Object | ||
.entries(services) | ||
.map(([serviceKey, initParams]) => servicesRegistry[serviceKey].initialiser(initParams)); | ||
return await Promise.all(serviceInitPromises); | ||
} | ||
//# sourceMappingURL=vvd-core.js.map |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
9
16442
42
1
+ Added@vonage/vvd-fonts@0.6.0(transitive)
+ Added@vonage/vvd-scheme@0.6.0(transitive)
- Removed@vonage/vvd-fonts@0.5.0(transitive)
- Removed@vonage/vvd-scheme@0.5.0(transitive)
Updated@vonage/vvd-fonts@^0.6.0
Updated@vonage/vvd-scheme@^0.6.0
Updatedtslib@^2.0.1