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

elarian

Package Overview
Dependencies
Maintainers
2
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elarian - npm Package Compare versions

Comparing version 0.2.15 to 0.2.16

15

lib/client.js

@@ -490,11 +490,14 @@ /* eslint-disable max-len */

});
if (!customer.customerNumber) {
customer
.getState()
.catch((err) => log.warn(`${event}: Failed to fetch customer state ${customer.customerId} `, err));
}
}
const listenerExec = new Promise((resolve, reject) => {
// eslint-disable-next-line no-async-promise-executor
const listenerExec = new Promise(async (resolve, reject) => {
try {
if (customer && !customer.customerNumber) {
try { // hack to get customer number
await customer.getState();
} catch (error) {
log.warn(`${event}: Failed to fetch customer state ${customer.customerId} `, error);
}
}
const cb = (payload, appData) => resolve({ payload, appData });

@@ -501,0 +504,0 @@ listener(data, customer, incomingAppData, cb);

@@ -59,2 +59,7 @@ /* eslint-disable no-underscore-dangle */

this.client._createCustomer(this.customerNumber)
.then((res) => {
if (res.status && res.customerId) {
this.customerId = res.customerId;
}
})
.catch((ex) => this.client.platform.log.error(`Failed to create customer ${ex}`));

@@ -61,0 +66,0 @@ }

11

lib/utils/index.js

@@ -6,2 +6,3 @@ const { RSocketClient } = require('rsocket-core');

const pkg = require('../../package.json');
const appSocket = require('./service/app_socket_pb');

@@ -524,3 +525,3 @@ const simulatorSocket = require('./service/simulator_socket_pb');

keepAlive = 1000,
reconnectTimeout = 6000,
reconnectTimeout = 60000,
resumable = true,

@@ -548,2 +549,5 @@ notificationHandler,

data = Buffer.from(data.serializeBinary());
const metadata = Buffer.from(JSON.stringify({
agent: `javascript/${pkg.version}`,
}));
const transport = getTransport({

@@ -555,2 +559,3 @@ host,

});
log.debug(`Transport Initialized: ${host}:${port}`);
const client = new RSocketClient({

@@ -561,5 +566,5 @@ transport,

keepAlive,
metadataMimeType: 'application/json',
dataMimeType: 'application/octet-stream',
metadataMimeType: 'application/octet-stream',
payload: { data },
payload: { data, metadata },
},

@@ -566,0 +571,0 @@ responder: {

@@ -1442,4 +1442,3 @@ // source: common_model.proto

CHANNEL_NUMBER_PROVIDER_FACEBOOK: 4,
CHANNEL_NUMBER_PROVIDER_TELEGRAM: 5,
CHANNEL_NUMBER_PROVIDER_SIMULATOR: 6
CHANNEL_NUMBER_PROVIDER_TELEGRAM: 5
};

@@ -1446,0 +1445,0 @@

{
"name": "elarian",
"version": "0.2.15",
"version": "0.2.16",
"description": "Elarian JavaScript SDK",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,7 +5,4 @@ # Elarian

> A convenient way to interact with the Elarian APIs.
>
> **Project Status: Still under ACTIVE DEVELOPMENT, APIs are unstable and may change at any time until release of v1.0.0.**
> A framework that helps you build scalable, personalized customer engagement applications.
## Install

@@ -39,46 +36,14 @@

elarian.on('ussdSession', async (notification, customer, appData, callback) => {
const {
input,
sessionId,
} = notification;
elarian
.on('connected', async () => {
console.log('App is running!');
const customer = new client.Customer({ number: '+XXXXXXXXXXXX', provider: 'cellular' });
const state = await customer.getState();
console.log(state);
let {
name,
state = 'newbie',
} = appData || {};
const menu = {
text: null,
isTerminal: true,
};
switch (state) {
case 'veteran':
if (name) {
menu.text = `Welcome back ${name}! What is your new name?`;
menu.isTerminal = false;
} else {
name = input.text;
menu.text = `Thank you for trying Elarian, ${name}!`;
menu.isTerminal = true;
await customer.sendMessage(
{ number: 'Elarian', provider: 'telco' },
{ body: { text: `Hey ${name}! Thank you for trying out Elarian` } },
);
}
break;
case 'newbie':
default:
menu.text = 'Hey there, welcome to Elarian! What\'s your name?';
menu.isTerminal = false;
state = 'veteran';
break;
}
callback(menu, { state, name });
});
elarian
.on('connected', () => {
console.log('App is running!')
await customer.updateMetadata({ name: 'alice', age: 25 });
const { name } = await customer.getMetadata();
await customer.sendMessage({ number: 'MyAPP', channel: 'sms' }, { body: { text: `Hi ${name}, how are you?` }});
})

@@ -85,0 +50,0 @@ .on('error', (error) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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