@xuda.io/account_module 1.2.152 → 1.2.154

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.
Files changed (2) hide show
  1. package/index.mjs +11 -10
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -13,11 +13,12 @@ const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi
13
13
 
14
14
  // Module Paths
15
15
  const module_path = path.join(process.env.XUDA_HOME, 'cpi') + (!_conf.is_debug ? '/node_modules/@xuda.io' : '');
16
- const db_module = require(`${module_path}/db_module`);
17
- const jobs_module = require(`${module_path}/jobs_module`);
16
+ const db_module = await import(`${module_path}/db_module/index.mjs`);
17
+ const jobs_module = await import(`${module_path}/jobs_module/index.mjs`);
18
+ const logs_module = await import(`${module_path}/logs_module/index.mjs`);
18
19
 
19
20
  export const update_account_info = async (req) => {
20
- const marketplace_module = require(`${module_path}/marketplace_module`);
21
+ const marketplace_module = await import(`${module_path}/marketplace_module/index.mjs`);
21
22
 
22
23
  const { uid } = req;
23
24
  const data = req;
@@ -95,7 +96,7 @@ export const update_account_info = async (req) => {
95
96
  delete account_obj.account_info.uid;
96
97
 
97
98
  if (!account_obj.account_project_id) {
98
- const app_module = require(`${module_path}/app_module`);
99
+ const app_module = await import(`${module_path}/app_module/index.mjs`);
99
100
  const ret = await app_module.create_project({
100
101
  token_ret: req.token_ret,
101
102
  uid,
@@ -167,7 +168,7 @@ export const increment_account_usage = async (req) => {
167
168
  }
168
169
  const accounts_ret = await db_module.get_couch_view_raw('xuda_accounts', 'all_accounts', opt);
169
170
 
170
- const drive_module = require(`${module_path}/drive_module`);
171
+ const drive_module = await import(`${module_path}/drive_module/index.mjs`);
171
172
 
172
173
  const bytesToGB = (bytes) => {
173
174
  return bytes / 1073741824; // or bytes / (1024 ** 3)
@@ -645,7 +646,7 @@ export const add_account_log_util = (body, status, service, source, response_dat
645
646
  if (!security) {
646
647
  if (service.substr(0, 4) === 'get_' && !body.api_pk && !body.api_sk) return;
647
648
  }
648
- const logs_module = require(`${module_path}/logs_module`);
649
+
649
650
  logs_module.add_account_log(get_account_log_object(body, status, service, source, response_data, ip, headers, security));
650
651
  };
651
652
 
@@ -773,7 +774,7 @@ export const search_users = async (req) => {
773
774
  export const read_emails = async (req) => {
774
775
  const { uid, email_account_address, email_account_id, accessToken, vendor } = req;
775
776
 
776
- const email_module = require(`${module_path}/email_module`);
777
+ const email_module = await import(`${module_path}/email_module/index.mjs`);
777
778
 
778
779
  const read_mailbox = async (mailbox_path, mailbox_name, is_sent) => {
779
780
  let emails_ret = await db_module.find_couch_query('xuda_emails', {
@@ -860,7 +861,7 @@ export const read_emails = async (req) => {
860
861
  export const get_email_accounts = async (req) => {
861
862
  const { uid, stat } = req;
862
863
 
863
- const db_module = require(`${module_path}/db_module`);
864
+ const db_module = await import(`${module_path}/db_module/index.mjs`);
864
865
  let email_account_ret = await db_module.find_couch_query('xuda_emails', {
865
866
  selector: {
866
867
  docType: 'email_account',
@@ -1087,7 +1088,7 @@ export const update_contact = async (req) => {
1087
1088
  export const invite_user = async (req) => {
1088
1089
  const { email, name, uid } = req;
1089
1090
 
1090
- const team_module = require(`${module_path}/team_module`);
1091
+ const team_module = await import(`${module_path}/team_module/index.mjs`);
1091
1092
  const ret = await team_module.create_team_request({
1092
1093
  email,
1093
1094
  access_type: 'contact',
@@ -1172,7 +1173,7 @@ const get_prices = (uid, item) => {
1172
1173
  };
1173
1174
 
1174
1175
  export const validate_account_topup = async (uid, items = []) => {
1175
- const stripe_module = require(`${module_path}/stripe_module`);
1176
+ const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
1176
1177
 
1177
1178
  const { code, data } = await stripe_module.get_billing_metrics({ uid });
1178
1179
  if (code < 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.152",
3
+ "version": "1.2.154",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {