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

futurosenso-lang

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

futurosenso-lang - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

futurosenso-lang.js

0

jest.config.js

@@ -0,0 +0,0 @@ // For a detailed explanation regarding each configuration property, visit:

const fs = require('fs');
const xml2js = require('xml2js');
const logger = require("futurosenso-log");
const Client = require('node-rest-client').Client;
const client = new Client();

@@ -10,2 +13,4 @@ var exports = module.exports = {};

var webService;
exports.loadViewContentFromFile = function (view, file, endEventCallback) {

@@ -62,4 +67,40 @@

exports.setRemoteHost = function (remoteHost) {
webService = remoteHost;
}
// resultCallback(content, remotePath)
exports.getRemoteText = function (language, view, label, resultCallback) {
if(!language)
language = "EN";
let remotePath = `${webService}/${language}/${view}`;
if(label)
remotePath += `/${label}`;
let request = client.get(remotePath, function (data) {
if(data && data.success) {
resultCallback(data.content, remotePath);
}
else
resultCallback(undefined, remotePath);
});
request.on('error', function (req) {
logger.log("error occured accessing path: " + remotePath);
resultCallback(undefined, remotePath);
});
request.on('requestTimeout', function (req) {
logger.log("request has expired for path: " + remotePath);
req.abort();
resultCallback(undefined, remotePath);
});
request.on('responseTimeout', function (res) {
logger.log("response has expired for path: " + remotePath);
resultCallback(undefined, remotePath);
});
}
//exports.loadViewContentFromFile("View1", "xml/testView1.xml");
//console.dir(contents);

@@ -55,1 +55,20 @@ const fs = require("fs");

test("Test getting content from remote host", (done) => {
let remoteHost = "http://localhost:8787";
lang.setRemoteHost(remoteHost);
lang.getRemoteText("EN","view-home1", null, (content, remotePath)=>{
expect(content).toBeDefined();
expect(remotePath).toEqual(remoteHost + "/EN/view-home1");
done();
});
});
test("Test getting content from not existing remote host", (done) => {
let remoteHost = "http://localhost:9087";
lang.setRemoteHost(remoteHost);
lang.getRemoteText("EN","view-home1", null, (content, remotePath)=>{
expect(content).toBeUndefined();
expect(remotePath).toEqual(remoteHost + "/EN/view-home1");
done();
});
});

8

package.json

@@ -5,3 +5,3 @@ {

"email": "dev@futurosenso.com",
"version": "1.0.2",
"version": "1.0.3",
"description": "Language content utility, load content translations from xml file exported from access file.",

@@ -15,5 +15,9 @@ "license": "ISC",

],
"engines": {
"node": ">=8.15"
},
"main": "lang.js",
"dependencies": {
"xml2js": "0.4.19"
"xml2js": "0.4.19",
"node-rest-client": "3.1.0"
},

@@ -20,0 +24,0 @@ "devDependencies": {

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