Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@flexbase/onbo-node-client

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flexbase/onbo-node-client - npm Package Compare versions

Comparing version
0.4.8
to
0.4.9
+0
-1
build/index.js

@@ -141,3 +141,2 @@ "use strict";

}
console.log('CONTENT', content);
stripped = content.replace(/(\r\n|\n|\r|\s+)/gm, '');

@@ -144,0 +143,0 @@ md5 = '';

+2
-0

@@ -81,2 +81,4 @@ import type { Onbo, OnboOptions, OnboError, OnboPagination } from '../';

fromOnbo(arg: any): User;
toOnboLog(arg: any): any;
toCheck(arg: any): any;
}
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -204,39 +193,37 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

var _a, _b, _c, _d;
var resp = __assign({}, arg);
if (typeof ((_a = resp.address) === null || _a === void 0 ? void 0 : _a.country) === 'string') {
// only allow 'United States' - not 'US'
if (resp.address.country.toUpperCase() === 'US') {
resp.address.country = 'United States';
if (typeof arg === 'object' && !(0, __1.isEmpty)(arg)) {
if (typeof ((_a = arg.address) === null || _a === void 0 ? void 0 : _a.country) === 'string') {
// only allow 'United States' - not 'US'
if (arg.address.country.toUpperCase() === 'US') {
arg.address.country = 'United States';
}
}
}
if (!(0, __1.isEmpty)(resp.ssn)) {
// keep just the digits and AES encrypt them
var dig = (_b = resp.ssn.match(/[0-9]/g)) !== null && _b !== void 0 ? _b : [];
console.log('SSN', dig.join(''), dig.length);
if (dig.length == 9) {
resp.ssn = (0, __1.aesEncrypt)(dig.join(''), this.client.secret);
if (!(0, __1.isEmpty)(arg.ssn)) {
// keep just the digits and AES encrypt them
var dig = (_b = arg.ssn.match(/[0-9]/g)) !== null && _b !== void 0 ? _b : [];
if (dig.length == 9) {
arg.ssn = (0, __1.aesEncrypt)(dig.join(''), this.client.secret);
}
}
}
if (!(0, __1.isEmpty)(resp.phone)) {
// they want nothing but digits for the phone
var dig = (_c = resp.phone.match(/[0-9]/g)) !== null && _c !== void 0 ? _c : [];
console.log('PHONE', dig.join(''), dig.length);
if (dig.length == 10) {
resp.phone = dig.join('');
if (!(0, __1.isEmpty)(arg.phone)) {
// they want nothing but digits for the phone
var dig = (_c = arg.phone.match(/[0-9]/g)) !== null && _c !== void 0 ? _c : [];
if (dig.length == 10) {
arg.phone = dig.join('');
}
}
}
// ...these are for the Business Users...
if (!(0, __1.isEmpty)(resp.ein)) {
// keep just the digits and AES encrypt them
var dig = (_d = resp.ein.match(/[0-9]/g)) !== null && _d !== void 0 ? _d : [];
console.log('EIN', dig.join(''), dig.length);
if (dig.length == 9) {
resp.ein = (0, __1.aesEncrypt)(dig.join(''), this.client.secret);
// ...these are for the Business Users...
if (!(0, __1.isEmpty)(arg.ein)) {
// keep just the digits and AES encrypt them
var dig = (_d = arg.ein.match(/[0-9]/g)) !== null && _d !== void 0 ? _d : [];
if (dig.length == 9) {
arg.ein = (0, __1.aesEncrypt)(dig.join(''), this.client.secret);
}
}
if (!(0, __1.isEmpty)(arg.keyPeople)) {
// run each person in the array through the same function...
arg.keyPeople = arg.keyPeople.map(function (p) { return _this.toOnbo(p); });
}
}
if (!(0, __1.isEmpty)(resp.keyPeople)) {
// run each person in the array through the same function...
resp.keyPeople = resp.keyPeople.map(function (p) { return _this.toOnbo(p); });
}
return resp;
return arg;
};

@@ -251,27 +238,78 @@ /*

var _a, _b;
var resp = __assign({}, arg);
if (typeof ((_a = resp.address) === null || _a === void 0 ? void 0 : _a.country) === 'string') {
// converty to ISO code for 'United States' : 'US'
if (resp.address.country.toUpperCase() === 'UNITED STATES') {
resp.address.country = 'US';
if (typeof arg === 'object' && !(0, __1.isEmpty)(arg)) {
if (typeof ((_a = arg.address) === null || _a === void 0 ? void 0 : _a.country) === 'string') {
// converty to ISO code for 'United States' : 'US'
if (arg.address.country.toUpperCase() === 'UNITED STATES') {
arg.address.country = 'US';
}
}
if (!(0, __1.isEmpty)(arg.phone)) {
// let's stick with XXX-XXX-XXXX
var dig = (_b = arg.phone.match(/[0-9]/g)) !== null && _b !== void 0 ? _b : [];
if (dig.length == 10) {
arg.phone = dig.slice(0, 3).join('') + '-' +
dig.slice(3, 6).join('') + '-' +
dig.slice(-4).join('');
}
}
// ...these are for the Business Users...
if (!(0, __1.isEmpty)(arg.keyPeople)) {
// run each person in the array through the same function...
arg.keyPeople = arg.keyPeople.map(function (p) { return _this.fromOnbo(p); });
}
}
if (!(0, __1.isEmpty)(resp.phone)) {
// let's stick with XXX-XXX-XXXX
var dig = (_b = resp.phone.match(/[0-9]/g)) !== null && _b !== void 0 ? _b : [];
if (dig.length == 10) {
resp.phone = dig.slice(0, 3).join('') + '-' +
dig.slice(3, 6).join('') + '-' +
dig.slice(-4).join('');
return arg;
};
/*
* Testing functions to understand the problem with the Javascript
* execution of the mapping functions.
*/
UserApi.prototype.toOnboLog = function (arg) {
var _this = this;
var _a, _b, _c, _d;
if (typeof arg === 'object' && !(0, __1.isEmpty)(arg)) {
if (typeof ((_a = arg.address) === null || _a === void 0 ? void 0 : _a.country) === 'string') {
// only allow 'United States' - not 'US'
console.log('COUNTRY', arg.address.country.toUpperCase());
if (arg.address.country.toUpperCase() === 'US') {
arg.address.country = 'United States';
}
}
if (!(0, __1.isEmpty)(arg.ssn)) {
// keep just the digits and AES encrypt them
var dig = (_b = arg.ssn.match(/[0-9]/g)) !== null && _b !== void 0 ? _b : [];
console.log('SSN', dig.join(''), dig.length);
if (dig.length == 9) {
arg.ssn = (0, __1.aesEncrypt)(dig.join(''), this.client.secret);
}
}
if (!(0, __1.isEmpty)(arg.phone)) {
// they want nothing but digits for the phone
var dig = (_c = arg.phone.match(/[0-9]/g)) !== null && _c !== void 0 ? _c : [];
console.log('PHONE', dig.join(''), dig.length);
if (dig.length == 10) {
arg.phone = dig.join('');
}
}
// ...these are for the Business Users...
if (!(0, __1.isEmpty)(arg.ein)) {
// keep just the digits and AES encrypt them
var dig = (_d = arg.ein.match(/[0-9]/g)) !== null && _d !== void 0 ? _d : [];
console.log('EIN', dig.join(''), dig.length);
if (dig.length == 9) {
arg.ein = (0, __1.aesEncrypt)(dig.join(''), this.client.secret);
}
}
if (!(0, __1.isEmpty)(arg.keyPeople)) {
// run each person in the array through the same function...
arg.keyPeople = arg.keyPeople.map(function (p) { return _this.toOnbo(p); });
}
}
// ...these are for the Business Users...
if (!(0, __1.isEmpty)(resp.keyPeople)) {
// run each person in the array through the same function...
resp.keyPeople = resp.keyPeople.map(function (p) { return _this.fromOnbo(p); });
}
return resp;
return arg;
};
UserApi.prototype.toCheck = function (arg) {
return { before: arg, after: this.toOnbo(arg), loggy: this.toOnboLog(arg) };
};
return UserApi;
}());
exports.UserApi = UserApi;
{
"name": "@flexbase/onbo-node-client",
"version": "0.4.8",
"version": "0.4.9",
"description": "Node.js Client for Onbo API",

@@ -5,0 +5,0 @@ "keywords": [