Socket
Socket
Sign inDemoInstall

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.0.0 to 0.0.1

lib/utils/service/common_pb.js

48

lib/index.js
'use strict';
const _ = require('lodash');
const path = require('path');
const grpc = require('grpc');
const loader = require('@grpc/proto-loader');
const validate = require('validate.js');
const { promisify } = require('./utils');
const {
promisify,
ElarianService,
ElarianMessages,
} = require('./utils');
const ElarianServiceProto = path.join(__dirname, 'proto/web.proto');
const ElarianServiceDefinition = loader.loadSync(ElarianServiceProto, {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
});
const ElarianServiceDescriptor = grpc.loadPackageDefinition(ElarianServiceDefinition);
const ElarianServiceNamespace = ElarianServiceDescriptor.com.elarian.hera.proto;
const ElarianService = ElarianServiceNamespace.GrpcWebService;
const HOST = 'api.elarian.com:443';

@@ -31,5 +21,7 @@ const SANDBOX_HOST = 'api.elarian.dev:443';

apiKey: {
presence: true,
type: 'string',
},
authToken: {
type: 'string',
},
sandbox: {

@@ -45,3 +37,6 @@ type: 'boolean'

const { apiKey, sandbox } = this.options;
const { apiKey, authToken, sandbox } = this.options;
if (!apiKey && !authToken) {
throw new Error('Either one of apiKey or authToken is required');
}

@@ -53,3 +48,8 @@ const host = sandbox ? SANDBOX_HOST : HOST;

const metadata = new grpc.Metadata();
metadata.set('api-key', apiKey);
if (apiKey) {
metadata.set('api-key', apiKey);
}
if (authToken) {
metadata.set('auth-token', authToken);
}
callback(null, metadata);

@@ -61,5 +61,9 @@ }),

module.exports = function (options) {
const elarian = new Elarian(options);
return elarian._stub;
};
module.exports = {
...ElarianMessages,
Client: function (options) {
const elarian = new Elarian(options);
return elarian._stub;
},
};
const util = require('util');
const messages = require('./service/web_pb');
const service = require('./service/web_grpc_pb');
const ElarianMessages = messages;
const ElarianService = service.GrpcWebServiceClient;
const promisify = (client) => {

@@ -7,3 +12,9 @@ const to = {};

if (typeof client[k] != 'function') continue;
to[k] = util.promisify(client[k].bind(client));
// Stream functions synchronously return a stream object
// and don't use an Error first callback signature
if (client[k].responseStream && client[k].responseStream === true) {
to[k] = client[k].bind(client);
} else {
to[k] = util.promisify(client[k].bind(client));
}
}

@@ -14,3 +25,5 @@ return to;

module.exports = {
promisify
promisify,
ElarianService,
ElarianMessages,
};
{
"name": "elarian",
"version": "0.0.0",
"version": "0.0.1",
"description": "Elrian JavaScript SDK",

@@ -25,3 +25,3 @@ "main": "index.js",

"dependencies": {
"@grpc/proto-loader": "^0.5.5",
"google-protobuf": "^3.12.4",
"grpc": "^1.24.3",

@@ -28,0 +28,0 @@ "lodash": "^4.17.19",

@@ -14,3 +14,3 @@ # Elarian JavaScript SDK

You can install the package from [npm](npmjs.com/package/elarian) by running:
You can install the package from [npm](https://www.npmjs.com/package/elarian) by running:

@@ -25,5 +25,5 @@ ```bash

```javascript
const Elarian = require('elarian');
const { Client, StreamNotificationRequest } = require('elarian');
const elarian = new Elarian({
const elarian = new Client({
apiKey: 'test_api_key',

@@ -33,5 +33,5 @@ sandbox: true,

const stream = await elarian.StreamNotifications({
app_id: 'test_app'
});
const req = new StreamNotificationRequest()
.setAppId('test_app');
const stream = elarian.streamNotifications(req);

@@ -56,33 +56,33 @@ stream.on('data', (notification) => {

- `AuthToken()`:
- `authToken()`:
- `GetCustomerState()`:
- `AdoptCustomerState()`:
- `getCustomerState()`:
- `adoptCustomerState()`:
- `AddCustomerReminder()`:
- `AddCustomerReminderByTag()`:
- `CancelCustomerReminder()`:
- `CancelCustomerReminderByTag()`:
- `addCustomerReminder()`:
- `addCustomerReminderByTag()`:
- `cancelCustomerReminder()`:
- `cancelCustomerReminderByTag()`:
- `UpdateCustomerTag()`:
- `DeleteCustomerTag()`:
- `updateCustomerTag()`:
- `deleteCustomerTag()`:
- `UpdateCustomerSecondaryId()`:
- `DeleteCustomerSecondaryId()`:
- `updateCustomerSecondaryId()`:
- `deleteCustomerSecondaryId()`:
- `UpdateCustomerMetadata()`:
- `DeleteCustomerMetadata ()`:
- `updateCustomerMetadata()`:
- `deleteCustomerMetadata ()`:
- `SendMessage()`:
- `SendMessageByTag()`:
- `ReplyToMessage()`:
- `MessagingConsent()`:
- `sendMessage()`:
- `sendMessageByTag()`:
- `replyToMessage()`:
- `messagingConsent()`:
- `SendPayment()`:
- `CheckoutPayment()`:
- `sendPayment()`:
- `checkoutPayment()`:
- `MakeVoiceCall()`:
- `makeVoiceCall()`:
- `StreamNotifications()`:
- `SendWebhookResponse()`:
- `streamNotifications()`:
- `sendWebhookResponse()`:

@@ -89,0 +89,0 @@

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