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

asteriskjs

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asteriskjs - npm Package Compare versions

Comparing version 0.1.4 to 0.2.0

lib/class/agiHandler/agiConnectionEstablisher.d.ts

11

lib/class/agiHandler/interfaces/agiConfig.interface.d.ts

@@ -5,7 +5,14 @@ /// <reference types="node" />

import LogFunction from '../../../interfaces/logFunction.interface';
import AgiConnectionHandlerFunction from '../connectionHandler/interfaces/agiConnectionHandlerFunction.interface';
export interface AgiConfig extends TcpNetConnectOpts {
import AgiConnectionHandlerFunction from './agiConnectionHandlerFunction.interface';
interface AgiConfigDefault {
readonly handler: AgiConnectionHandlerFunction;
readonly log?: LogConfig | LogFunction;
}
export interface AgiConfigTCP extends TcpNetConnectOpts, AgiConfigDefault {
readonly type: 'tcp';
}
export interface AgiConfigStdIn extends AgiConfigDefault {
readonly type: 'cli';
}
export declare type AgiConfig = AgiConfigTCP | AgiConfigStdIn;
export default AgiConfig;

10

lib/class/agiHandler/interfaces/agiServerDependencies.interface.d.ts
/// <reference types="node" />
import connectionHandler from '../connectionHandler/connectionHandler';
import AgiConnectionHandler from '../agiConnectionHandler';
import { createServer } from 'net';
import { ServerDependencies } from '../../serverHandler/interfaces/serverDependencies.interface';
import CLIConnection from '../connections/cliConnection.class';
export interface AgiServerDependencies extends ServerDependencies {
createServer: typeof createServer;
connectionHandler: typeof connectionHandler;
AgiConnectionHandler: typeof AgiConnectionHandler;
connections: {
cli: typeof CLIConnection;
tcp: typeof createServer;
};
}
/// <reference types="hapi__joi" />
import * as joi from '@hapi/joi';
declare const _default: joi.ObjectSchema<any>;
export default _default;
export declare const AgiConfigTCP: joi.ObjectSchema<any>;
export declare const AgiConfigStdIn: joi.ObjectSchema<any>;
export declare const AgiConfig: joi.AlternativesSchema;
export default AgiConfig;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgiConfig = exports.AgiConfigStdIn = exports.AgiConfigTCP = void 0;
const joi = require("@hapi/joi");
exports.default = joi.object().keys({
exports.AgiConfigTCP = joi.object().keys({
allowHalfOpen: joi.boolean().optional(),

@@ -19,3 +20,11 @@ family: joi.string().optional(),

writable: joi.boolean().optional(),
type: joi.valid('tcp').required(),
});
exports.AgiConfigStdIn = joi.object().keys({
type: joi.valid('cli').required(),
log: joi.alternatives().try(joi.func(), joi.object()).optional(),
handler: joi.function().required(),
});
exports.AgiConfig = joi.alternatives().try(exports.AgiConfigTCP, exports.AgiConfigStdIn);
exports.default = exports.AgiConfig;
//# sourceMappingURL=agiConfig.schema.js.map

@@ -28,10 +28,10 @@ "use strict";

return {
emerg: log,
alert: log,
crit: log,
err: log,
warning: log,
notice: log,
info: log,
debug: log,
emerg: (...args) => log('emerg', ...args),
alert: (...args) => log('alert', ...args),
crit: (...args) => log('crit', ...args),
err: (...args) => log('err', ...args),
warning: (...args) => log('warning', ...args),
notice: (...args) => log('notice', ...args),
info: (...args) => log('info', ...args),
debug: (...args) => log('debug', ...args),
};

@@ -38,0 +38,0 @@ }

import { HandlerDependencies } from './interfaces';
import agiHandler from './class/agiHandler/agiHandler';
import amiHandler from './class/amiHandler/amiHandler';

@@ -8,4 +7,4 @@ export default class {

static Factory(): default;
agi(opts: unknown): Promise<agiHandler>;
agi(opts: unknown): Promise<void>;
ami(opts: unknown): Promise<amiHandler>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const agiHandler_1 = require("./class/agiHandler/agiHandler");
const agiConnectionEstablisher_1 = require("./class/agiHandler/agiConnectionEstablisher");
const amiHandler_1 = require("./class/amiHandler/amiHandler");

@@ -11,3 +11,3 @@ class default_1 {

return new this({
agiHandler: agiHandler_1.default,
AgiConnectionEstablisher: agiConnectionEstablisher_1.default,
amiHandler: amiHandler_1.default,

@@ -17,8 +17,8 @@ });

async agi(opts) {
if (this.deps.agiHandler.validateConfig(opts)) {
const agiHandler = this.deps.agiHandler.Factory(opts);
if (this.deps.AgiConnectionEstablisher.validateConfig(opts)) {
const agiHandler = this.deps.AgiConnectionEstablisher.Factory(opts);
return agiHandler.init();
}
else {
throw this.deps.agiHandler.getValidationErrors(opts);
throw this.deps.AgiConnectionEstablisher.getValidationErrors(opts);
}

@@ -25,0 +25,0 @@ }

@@ -7,5 +7,5 @@ import handler from './handler';

export { DefaultAmiEvent } from './class/amiHandler/interfaces/amiEvent.interface';
export { AgiConnectionHandlerFunctionArgument } from './class/agiHandler/connectionHandler/interfaces/agiConnectionHandlerFunctionArgument.interface';
export { AgiConnectionHandlerFunction } from './class/agiHandler/connectionHandler/interfaces/agiConnectionHandlerFunction.interface';
export { AgiHandler } from './class/agiHandler/agiHandler';
export { AgiConnectionHandlerFunctionArgument } from './class/agiHandler/interfaces/agiConnectionHandlerFunctionArgument.interface';
export { AgiConnectionHandlerFunction } from './class/agiHandler/interfaces/agiConnectionHandlerFunction.interface';
export { AgiConnectionEstablisher } from './class/agiHandler/agiConnectionEstablisher';
export { AmiHandler } from './class/amiHandler/amiHandler';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AmiHandler = exports.AgiHandler = void 0;
exports.AmiHandler = exports.AgiConnectionEstablisher = void 0;
const handler_1 = require("./handler");
exports.default = handler_1.default.Factory();
var agiHandler_1 = require("./class/agiHandler/agiHandler");
Object.defineProperty(exports, "AgiHandler", { enumerable: true, get: function () { return agiHandler_1.AgiHandler; } });
var agiConnectionEstablisher_1 = require("./class/agiHandler/agiConnectionEstablisher");
Object.defineProperty(exports, "AgiConnectionEstablisher", { enumerable: true, get: function () { return agiConnectionEstablisher_1.AgiConnectionEstablisher; } });
var amiHandler_1 = require("./class/amiHandler/amiHandler");
Object.defineProperty(exports, "AmiHandler", { enumerable: true, get: function () { return amiHandler_1.AmiHandler; } });
//# sourceMappingURL=index.js.map

@@ -1,6 +0,6 @@

import agiHandler from './class/agiHandler/agiHandler';
import AgiConnectionEstablisher from './class/agiHandler/agiConnectionEstablisher';
import amiHandler from './class/amiHandler/amiHandler';
export interface HandlerDependencies {
agiHandler: typeof agiHandler;
AgiConnectionEstablisher: typeof AgiConnectionEstablisher;
amiHandler: typeof amiHandler;
}
{
"name": "asteriskjs",
"version": "0.1.4",
"version": "0.2.0",
"description": "Fully Functional client for Asterisk's AMI and AGI.",

@@ -34,16 +34,16 @@ "main": "lib/index.js",

"@hapi/joi": "^17.1.1",
"loghandler": "^1.1.10",
"loghandler": "^1.1.12",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/node": "^14.14.14",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
"eslint": "^7.16.0",
"eslint-plugin-prettier": "^3.3.0",
"prettier": "^2.2.1",
"typescript": "^4.1.3"
"@types/node": "^17.0.13",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"eslint": "^8.8.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.5"
},
"prepublish": "tsc"
}

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

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