diff --git a/README.md b/README.md index 43747269..50bed960 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,4 @@ To activate Mock Firebolt, there are specific start-up scripts that exist inside For pinChallenge and acknowledgeChallenge UI prompts , a timeout of 15s is added so that, if no action is taken when the prompts displays on the screen (i.e; neither yes/no/back button ), the prompts will be automatically dismissed with "null" value as the response. The prompt is displayed when the user needs to grant/deny a particular api, or the user has to enter a pin in-case of pinChallenge. -If user wants to grant an api, yes button is pressed, for deniel - no button, and incase if the user wants to dismiss the prompt without any action, back button is pressed. - - +If user wants to grant an api, yes button is pressed, for deniel - no button, and incase if the user wants to dismiss the prompt without any action, back button is pressed. \ No newline at end of file diff --git a/package.json b/package.json index fa05ad9b..e07fc766 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "version": "1.3.0", + "version": "1.4.1", "name": "firebolt-certification", "description": "Reference App to demonstrate Firebolt APIs and Lifecycle", "dependencies": { "@apidevtools/json-schema-ref-parser": "^9.0.9", - "@firebolt-js/discovery-sdk": "1.3.0", - "@firebolt-js/manage-sdk": "1.3.0", - "@firebolt-js/sdk": "1.3.0", + "@firebolt-js/discovery-sdk": "1.4.1", + "@firebolt-js/manage-sdk": "1.4.1", + "@firebolt-js/sdk": "1.4.1", "@lightningjs/core": "2.11.0", "@lightningjs/sdk": "^5.0.1", "@lightningjs/ui-components": "^2.2.2", @@ -20,7 +20,8 @@ "perf_hooks": "^0.0.1", "rxjs": "7.2.0", "uuid": "^9.0.0", - "winston": "3.13.1", + "winston": "3.15.0", + "winston-transport": "4.7.1", "xml2js": "^0.5.0" }, "scripts": { diff --git a/src/App.js b/src/App.js index 726133ef..c0f5ba24 100644 --- a/src/App.js +++ b/src/App.js @@ -117,6 +117,7 @@ export default class App extends Base { process.env.STANDALONE_PREFIX = standalonePrefix; process.env.ID = 0; process.env.REGISTERPROVIDER = true; + process.env.SDKS_AVAILABLE = [...CONSTANTS.defaultSDKs, ...CONSTANTS.additionalSDKs]; // Set the pubSub URL if present process.env.PUB_SUB_URL = new URLSearchParams(window.location.search).get('pubSubUrl'); diff --git a/src/FireboltExampleInvoker.js b/src/FireboltExampleInvoker.js index ffa1f666..4f7ce0e3 100644 --- a/src/FireboltExampleInvoker.js +++ b/src/FireboltExampleInvoker.js @@ -100,6 +100,13 @@ export const MODULE_MAP = { discovery: DISCOVERY_MODULE_MAP, }; +// importing additional invoker which has external sdk's being exported and adding those modules in the MODULE_MAP +try { + const additionalInvoker = require('../plugins/FireboltExtensionInvoker').default; + Object.assign(MODULE_MAP, additionalInvoker); +} catch (err) { + logger.error(`Unable to import additional invoker - ${err.message}`, 'MODULE_MAP'); +} let instance = null; export default class FireboltExampleInvoker { diff --git a/src/IntentReader.js b/src/IntentReader.js index 427b9c94..b2b6bcda 100644 --- a/src/IntentReader.js +++ b/src/IntentReader.js @@ -34,7 +34,6 @@ import GetPubSubStatusHandler from './pubsub/handlers/GetPubSubStatusHandler'; import CallMethodHandler from './pubsub/handlers/CallMethodHandler'; import DataFetchHandler from './pubsub/handlers/DataFetchHandler'; import HealthCheckHandler from './pubsub/handlers/HealthCheckHandler'; -import RunTestHandler from './pubsub/handlers/RunTestHandler'; import RegisterEventHandler from './pubsub/handlers/RegisterEventHandler'; import ClearEventListeners from './pubsub/handlers/ClearEventListeners'; import ClearEventHandler from './pubsub/handlers/clearEventHandler'; @@ -45,6 +44,7 @@ import GetEventResponse from './pubsub/handlers/GetEventResponse'; import GetMethodResponseHandler from './pubsub/handlers/GetMethodResponseHandler'; import VisibilityStateHandler from '../src/pubsub/handlers/VisibilityStateHandler'; import LifecycleMethodHandler from './pubsub/handlers/LifecycleMethodHandler'; +import RunTestHandler from 'RunTestHandler'; const logger = require('./utils/Logger')('IntentReader.js'); diff --git a/src/ValidationView.js b/src/ValidationView.js index a998aca0..f53317b3 100644 --- a/src/ValidationView.js +++ b/src/ValidationView.js @@ -180,7 +180,9 @@ export default class ValidationView extends lng.Component { // Combine defaultSDKs and additionalSDKs into one array const allSDKs = [...CONSTANTS.defaultSDKs, ...CONSTANTS.additionalSDKs]; // Find the SDK configuration for the specified sdk mode - const sdkConfig = allSDKs.find((sdk) => sdkMode.includes(sdk.name.toUpperCase())); + const sdkConfigs = allSDKs.filter((sdk) => sdkMode.toUpperCase().includes(sdk.name.toUpperCase())); + const exactMatch = sdkConfigs.find((sdk) => sdkMode.toUpperCase() === sdk.name.toUpperCase()); + const sdkConfig = exactMatch || (sdkConfigs.length === 1 && sdkConfigs[0]) || sdkConfigs; // If SDK config found and validation method exists if (sdkConfig && sdkConfig.validation) { if (!sdkConfig.validation()) { diff --git a/src/pubsub/handlers/setApiResponseHandler.js b/src/pubsub/handlers/setApiResponseHandler.js index 364e26de..4eb54a3b 100644 --- a/src/pubsub/handlers/setApiResponseHandler.js +++ b/src/pubsub/handlers/setApiResponseHandler.js @@ -45,6 +45,8 @@ export default class SetApiResponseHandler extends BaseHandler { return this.setResponseAckChallenge(message); case 'userinterest': return this.setResponseUserInterestChallenge(message); + case 'external': + return this.setExternalResponse(message); default: const defaultIdString = JSON.stringify({ report: 'Selected module provider is not available', @@ -102,4 +104,14 @@ export default class SetApiResponseHandler extends BaseHandler { const reportIdString = JSON.stringify({ report: 'Received UserInterest apiResponse parameters' }); return reportIdString; } + + // importing external Api resonse function, which can set the pre-requisite values to external modules + setExternalResponse(message) { + try { + const externalFunction = require('../../../plugins/setExternalApiResponse'); + return externalFunction.setExternalApiResponse(message); + } catch (err) { + return JSON.stringify({ report: 'Unable to import and set the data for external module' }); + } + } } diff --git a/src/utils/Utils.js b/src/utils/Utils.js index 3ba1d442..4ac82dca 100644 --- a/src/utils/Utils.js +++ b/src/utils/Utils.js @@ -119,6 +119,7 @@ async function getschemaValidationDone(name, response, sdkType) { function censorData(methodName, response) { try { const json = censorDataJson; + methodName = methodName.charAt(0).toUpperCase() + methodName.slice(1); if (methodName in json) { for (let i = 0; i < json[methodName].field.length; i++) { if (response[json[methodName].field[i]]) { diff --git a/test/jest.config.js b/test/jest.config.js index aff43ae3..b6e49c41 100644 --- a/test/jest.config.js +++ b/test/jest.config.js @@ -34,6 +34,7 @@ module.exports = { '^EventInvocation$': '/../src//EventInvocation.js', '^IntentReader$': '../src/IntentReader.js', '^CensorData$': '/../src/source/censorData.json', + '^RunTestHandler$': '/../src/pubsub/handlers/RunTestHandler.js', }, collectCoverage: true, coverageThreshold: { diff --git a/webpack.dev.js b/webpack.dev.js index 123e7c79..1cae4777 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -108,6 +108,10 @@ module.exports = { name: 'CensorData', alias: ['/plugins/censorData.json', '/src/source/censorData.json'], }, + { + name: 'RunTestHandler', + alias: ['/plugins/runTestHandler.js', '/src/pubsub/handlers/RunTestHandler.js'], + }, ], 'resolve' ), diff --git a/webpack.prod.js b/webpack.prod.js index 5778ea61..4a58f527 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -91,6 +91,10 @@ module.exports = { name: 'CensorData', alias: ['/plugins/censorData.json', '/src/source/censorData.json'], }, + { + name: 'RunTestHandler', + alias: ['/plugins/runTestHandler.js', '/src/pubsub/handlers/RunTestHandler.js'], + }, ], 'resolve' ),