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.7
to
0.4.8
+66
-61
build/user/index.js
"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) {

@@ -111,8 +122,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

return __awaiter(this, void 0, void 0, function () {
var body, resp;
var resp;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
body = this.toOnbo(data);
return [4 /*yield*/, this.client.fire('POST', 'users', undefined, undefined, body)];
case 0: return [4 /*yield*/, this.client.fire('POST', 'users', undefined, undefined, this.toOnbo(data))];
case 1:

@@ -170,8 +179,6 @@ resp = _d.sent();

return __awaiter(this, void 0, void 0, function () {
var body, resp;
var resp;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
body = this.toOnbo(data);
return [4 /*yield*/, this.client.fire('PUT', "users/".concat(userId), undefined, undefined, body)];
case 0: return [4 /*yield*/, this.client.fire('PUT', "users/".concat(userId), undefined, undefined, this.toOnbo(data))];
case 1:

@@ -199,40 +206,39 @@ resp = _d.sent();

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'
if (arg.address.country.toUpperCase() === 'US') {
arg.address.country = 'United States';
}
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 (!(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)(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.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('');
}
}
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('');
}
// ...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);
}
}
// ...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);
}
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); });
}
}
return arg;
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;
};

@@ -247,25 +253,24 @@ /*

var _a, _b;
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';
}
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 (!(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('');
}
}
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('');
}
// ...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); });
}
}
return arg;
// ...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;
};

@@ -272,0 +277,0 @@ return UserApi;

{
"name": "@flexbase/onbo-node-client",
"version": "0.4.7",
"version": "0.4.8",
"description": "Node.js Client for Onbo API",

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