@xuda.io/account_module 1.2.1326 → 1.2.1328
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +0 -84
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -990,25 +990,6 @@ export const search_users = async function (req) {
|
|
|
990
990
|
}
|
|
991
991
|
};
|
|
992
992
|
|
|
993
|
-
const generate_gmail_access_token = async function (email_account) {
|
|
994
|
-
return new Promise((resolve, reject) => {
|
|
995
|
-
fetch('https://oauth2.googleapis.com/token', {
|
|
996
|
-
method: 'POST',
|
|
997
|
-
headers: { 'Content-Type': 'application/json' },
|
|
998
|
-
body: JSON.stringify({
|
|
999
|
-
refresh_token: email_account.authorization_data.refresh_token,
|
|
1000
|
-
client_id: _conf.gmail.clientId,
|
|
1001
|
-
client_secret: _conf.gmail.clientSecret,
|
|
1002
|
-
grant_type: 'refresh_token',
|
|
1003
|
-
}),
|
|
1004
|
-
})
|
|
1005
|
-
.then((response) => response.json())
|
|
1006
|
-
.then((data) => {
|
|
1007
|
-
resolve(data);
|
|
1008
|
-
});
|
|
1009
|
-
});
|
|
1010
|
-
};
|
|
1011
|
-
|
|
1012
993
|
export const find_contact_duplicates = async function (req) {
|
|
1013
994
|
const { uid, name } = req;
|
|
1014
995
|
var opt = {
|
|
@@ -1694,71 +1675,6 @@ export const get_account_default_project_id = async function (uid) {
|
|
|
1694
1675
|
return account_obj.account_project_id;
|
|
1695
1676
|
};
|
|
1696
1677
|
|
|
1697
|
-
setTimeout(async () => {
|
|
1698
|
-
// const uid = "0489f946c213947316647b468f029ed9"; //"aecc740881fd0a35098c738652000fab";
|
|
1699
|
-
|
|
1700
|
-
// // // clear data
|
|
1701
|
-
// // const contact_ret = await db_module.find_couch_query("xuda_contacts", {
|
|
1702
|
-
// // selector: {
|
|
1703
|
-
// // docType: "contact",
|
|
1704
|
-
// // },
|
|
1705
|
-
// // limit: 99999,
|
|
1706
|
-
// // });
|
|
1707
|
-
// // var contact_docs = [];
|
|
1708
|
-
// // for (let val of contact_ret.docs) {
|
|
1709
|
-
// // val._deleted = true;
|
|
1710
|
-
// // contact_docs.push(val);
|
|
1711
|
-
// // }
|
|
1712
|
-
// // await db_module.save_couch_bulk_docs("xuda_contacts", contact_docs);
|
|
1713
|
-
|
|
1714
|
-
// // const emails_ret = await db_module.find_couch_query("xuda_emails", {
|
|
1715
|
-
// // selector: {
|
|
1716
|
-
// // docType: "email",
|
|
1717
|
-
// // },
|
|
1718
|
-
// // limit: 99999,
|
|
1719
|
-
// // });
|
|
1720
|
-
// // var email_docs = [];
|
|
1721
|
-
// // for (let val of emails_ret.docs) {
|
|
1722
|
-
// // val._deleted = true;
|
|
1723
|
-
// // email_docs.push(val);
|
|
1724
|
-
// // }
|
|
1725
|
-
|
|
1726
|
-
// // await db_module.save_couch_bulk_docs("xuda_emails", email_docs);
|
|
1727
|
-
|
|
1728
|
-
// ///////////////////////////////////
|
|
1729
|
-
// return;
|
|
1730
|
-
// const email_account_ret = await get_email_accounts({
|
|
1731
|
-
// uid,
|
|
1732
|
-
// });
|
|
1733
|
-
|
|
1734
|
-
// var accessToken;
|
|
1735
|
-
// for await (let email_account of email_account_ret.data.docs) {
|
|
1736
|
-
// switch (email_account.vendor) {
|
|
1737
|
-
// case "gmail":
|
|
1738
|
-
// const ret = await generate_gmail_access_token(email_account);
|
|
1739
|
-
// accessToken = ret.access_token;
|
|
1740
|
-
// break;
|
|
1741
|
-
|
|
1742
|
-
// default:
|
|
1743
|
-
// break;
|
|
1744
|
-
// }
|
|
1745
|
-
|
|
1746
|
-
// read_emails({
|
|
1747
|
-
// uid,
|
|
1748
|
-
// email_account_address: email_account.email,
|
|
1749
|
-
// accessToken,
|
|
1750
|
-
// email_account_id: email_account._id,
|
|
1751
|
-
// vendor: email_account.vendor,
|
|
1752
|
-
// });
|
|
1753
|
-
// }
|
|
1754
|
-
|
|
1755
|
-
// // console.log(await get_contact({ uid, name: "bo" }));
|
|
1756
|
-
|
|
1757
|
-
let ret;
|
|
1758
|
-
// ret = await add_contact({ uid: 'd39126e0e2c51ffbd1aad10709fc8335', name: 'Boaz Avrahami', email: 'bocabo67@gmail.com', context: {} }, null, { 'accept-language': 'en-US,en;q=0.9,he;q=0.8' });
|
|
1759
|
-
console.log(ret);
|
|
1760
|
-
}, 2000);
|
|
1761
|
-
|
|
1762
1678
|
export const get_user_name = async function (uid) {
|
|
1763
1679
|
try {
|
|
1764
1680
|
const account_info = await get_account_name({ uid });
|