Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run Tests

on:
push:
branches:
- '**'
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test
12 changes: 12 additions & 0 deletions babel-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = function replacePaths({ types: t }) {
return {
visitor: {
ImportDeclaration(path) {
const importPath = path.node.source.value;
if (importPath === '../package.json') {
path.node.source = t.stringLiteral('../../package.json');
}
},
},
};
};
19 changes: 19 additions & 0 deletions babel.config.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"presets": [
[ "@babel/preset-env" ]
],
"plugins": [
[ "@babel/plugin-syntax-import-assertions" ],
[ "./babel-plugin.js" ],
[
"babel-plugin-replace-import-extension",
{
"extMapping": {
".mjs": ""
}
}
],
["@babel/plugin-transform-modules-commonjs", { "allowTopLevelThis": true }],
[ "babel-plugin-add-module-exports" ]
]
}
25 changes: 25 additions & 0 deletions babel.config.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
},
"modules": false
}
]
],
"plugins": [
[ "@babel/plugin-syntax-import-assertions" ],
[ "./babel-plugin.js" ],
[
"babel-plugin-replace-import-extension",
{
"extMapping": {
".mjs": ""
}
}
]
]
}
52 changes: 52 additions & 0 deletions dist/cjs/AppVerifyClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _RestClient2 = _interopRequireDefault(require("./RestClient"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
/***
* App Verify is a secure, lightweight SDK that integrates a frictionless user verification
* process into existing native mobile applications.
*/
var AppVerifyClient = exports["default"] = /*#__PURE__*/function (_RestClient) {
function AppVerifyClient(requestWrapper, customerId, apiKey) {
var _this;
var restEndpoint = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var timeout = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 15000;
var userAgent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
_classCallCheck(this, AppVerifyClient);
_this = _callSuper(this, AppVerifyClient, [requestWrapper, customerId, apiKey, restEndpoint, timeout, userAgent]);
_this.appverify_resource = "/v1/mobile/verification/status/";
return _this;
}

/***
* Get status of app verification transaction.
*
* @param callback: Callback method to handle the response.
* @param externalId: External ID (xid) used in the JWT token during verification.
*/
_inherits(AppVerifyClient, _RestClient);
return _createClass(AppVerifyClient, [{
key: "status",
value: function status(callback, externalId) {
this.execute(callback, "GET", this.appverify_resource + externalId);
}
}]);
}(_RestClient2["default"]);
module.exports = exports.default;
10 changes: 10 additions & 0 deletions dist/cjs/Constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AuthMethodNames = void 0;
var AuthMethodNames = exports.AuthMethodNames = {
BASIC: "Basic",
HMAC_SHA256: "HMAC-SHA256"
};
67 changes: 67 additions & 0 deletions dist/cjs/IntelligenceClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _RestClient2 = _interopRequireDefault(require("./RestClient"));
var _Constants = require("./Constants");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
var INTELLIGENCE_ENDPOINT_PATH = "/intelligence";
var contentType = "application/json";

/***
* It is critical today to evaluate fraud risk throughout the entire customer journey.
*
* Telesign Intelligence makes it easy to understand the risk and the reason behind it with tailored scoring models
*and comprehensive reason codes.
*/
var IntelligenceClient = exports["default"] = /*#__PURE__*/function (_RestClient) {
function IntelligenceClient(requestWrapper, customerId, apiKey) {
var _this;
var restEndpoint = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var timeout = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 15000;
var userAgent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
_classCallCheck(this, IntelligenceClient);
_this = _callSuper(this, IntelligenceClient, [requestWrapper, customerId, apiKey, restEndpoint, timeout, userAgent, contentType]);
_this.intelligenceResource = INTELLIGENCE_ENDPOINT_PATH;
return _this;
}

/***
* Telesign Intelligence is like a credit check for digital profiles.
*
* You submit a phone number, IP, and email to the service, the individual
*identifiers are each evaluated, and then a score is returned telling you how risky
*that user is.
*
* You decide whether to proceed based on the score.
*
* See https://developer.telesign.com/enterprise/docs/intelligence-overview
*for detailed API documentation.
*
* @param callback: Callback method to handle response.
* @param requestBody: requestBody to be passed to Intelligence API
*/
_inherits(IntelligenceClient, _RestClient);
return _createClass(IntelligenceClient, [{
key: "intelligence",
value: function intelligence(callback, requestBody) {
this.execute(callback, "POST", this.intelligenceResource, requestBody, _Constants.AuthMethodNames.BASIC);
}
}]);
}(_RestClient2["default"]);
module.exports = exports.default;
76 changes: 76 additions & 0 deletions dist/cjs/MessagingClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _RestClient2 = _interopRequireDefault(require("./RestClient"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
/***
* TeleSign's Messaging API allows you to easily send SMS messages. You can send alerts,
* reminders, and notifications, or you can send verification messages containing
* one-time passcodes ( OTP ).
*/
var MessagingClient = exports["default"] = /*#__PURE__*/function (_RestClient) {
function MessagingClient(requestWrapper, customerId, apiKey) {
var _this;
var restEndpoint = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var timeout = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 15000;
var userAgent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
_classCallCheck(this, MessagingClient);
_this = _callSuper(this, MessagingClient, [requestWrapper, customerId, apiKey, restEndpoint, timeout, userAgent]);
_this.messaging_resource = "/v1/messaging";
_this.messaging_status_resource = "/v1/messaging/";
return _this;
}

/***
* Send a message to the target phoneNumber.
*
* See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
*
* @param callback: Callback method to handle response.
* @param phoneNumber: Phone number to call
* @param message: Text of the message to be sent to the end user.
* @param messageType: This parameter specifies the traffic type being sent in the message.
* transaction.
*/
_inherits(MessagingClient, _RestClient);
return _createClass(MessagingClient, [{
key: "message",
value: function message(callback, phoneNumber, _message, messageType) {
var params = {
phone_number: phoneNumber,
message: _message,
message_type: messageType
};
this.execute(callback, "POST", this.messaging_resource, params);
}

/***
* Get status of message transaction.
*
* @param callback: Callback method to handle the response.
* @param referenceId: Reference ID received in the response of message.
*/
}, {
key: "status",
value: function status(callback, referenceId) {
this.execute(callback, "GET", this.messaging_status_resource + referenceId, null);
}
}]);
}(_RestClient2["default"]);
module.exports = exports.default;
Loading