@xuda.io/account_module 1.2.155 → 1.2.157

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 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -18,7 +18,7 @@ const jobs_module = await import(`${module_path}/jobs_module/index.mjs`);
18
18
  const logs_module = await import(`${module_path}/logs_module/index.mjs`);
19
19
 
20
20
  export const update_account_info = async function (req) {
21
- const marketplace_module = require(`${module_path}/marketplace_module`);
21
+ const marketplace_module = await import(`${module_path}/marketplace_module/index.mjs`);
22
22
 
23
23
  const { uid } = req;
24
24
  const data = req;
@@ -101,7 +101,7 @@ export const update_account_info = async function (req) {
101
101
  delete account_obj.account_info.uid;
102
102
 
103
103
  if (!account_obj.account_project_id) {
104
- const app_module = require(`${module_path}/app_module`);
104
+ const app_module = await import(`${module_path}/app_module/index.mjs`);
105
105
  const ret = await app_module.create_project({ token_ret: req.token_ret, uid, data: { app_name: `Account ${uid} main project`, is_account_project: true, app_plugins_purchased: [' @xuda.io/xuda-dbs-plugin-xuda', '@xuda.io/xuda-framework-plugin-tailwind'] } });
106
106
  if (ret.code > -1) {
107
107
  account_obj.account_project_id = ret.data;
@@ -164,7 +164,7 @@ export const increment_account_usage = async function (req) {
164
164
  }
165
165
  const accounts_ret = await db_module.get_couch_view_raw('xuda_accounts', 'all_accounts', opt);
166
166
 
167
- const drive_module = require(`${module_path}/drive_module`);
167
+ const drive_module = await import(`${module_path}/drive_module/index.mjs`);
168
168
 
169
169
  function bytesToGB(bytes) {
170
170
  return bytes / 1073741824; // or bytes / (1024 ** 3)
@@ -455,7 +455,7 @@ export const get_account_data = async function (req) {
455
455
 
456
456
  // if (!acc_obj.account_project_id && req.token_ret) {
457
457
  // let = account_obj = acc_obj;
458
- // const app_module = require(`${module_path}/app_module`);
458
+ // const app_module = await import(`${module_path}/app_module/index.mjs`);
459
459
  // const ret = await app_module.create_project({ token_ret: req.token_ret, uid, data: { app_name: `Account ${uid} main project`, is_account_project: true } });
460
460
  // if (ret.code > -1) {
461
461
  // account_obj.account_project_id = ret.data;
@@ -683,7 +683,7 @@ const get_account_log_object = function (body, status, service, source, response
683
683
  };
684
684
  };
685
685
 
686
- export const add_account_log_util = function (body, status, service, source, response_data, ip, headers) {
686
+ export const add_account_log_util = async function (body, status, service, source, response_data, ip, headers) {
687
687
  // non error log
688
688
  // if (status < 400) {
689
689
  // console.log("error", "add_account_log_util", service);
@@ -695,7 +695,7 @@ export const add_account_log_util = function (body, status, service, source, res
695
695
  if (service.substr(0, 4) === 'get_' && !body.api_pk && !body.api_sk) return;
696
696
  }
697
697
  // }
698
- const logs_module = require(`${module_path}/logs_module`);
698
+ const logs_module = await import(`${module_path}/logs_module/index.mjs`);
699
699
  logs_module.add_account_log(get_account_log_object(body, status, service, source, response_data, ip, headers, security));
700
700
  };
701
701
 
@@ -863,7 +863,7 @@ export const search_users = async function (req) {
863
863
  export const read_emails = async function (req) {
864
864
  const { uid, email_account_address, email_account_id, accessToken, vendor } = req;
865
865
 
866
- const email_module = require(`${module_path}/email_module`);
866
+ const email_module = await import(`${module_path}/email_module/index.mjs`);
867
867
 
868
868
  const read_mailbox = async function (mailbox_path, mailbox_name, is_sent) {
869
869
  var emails_ret = await db_module.find_couch_query('xuda_emails', {
@@ -968,7 +968,7 @@ export const read_emails = async function (req) {
968
968
  export const get_email_accounts = async function (req) {
969
969
  const { uid, stat } = req;
970
970
 
971
- const db_module = require(`${module_path}/db_module`);
971
+ const db_module = await import(`${module_path}/db_module/index.mjs`);
972
972
  var email_account_ret = await db_module.find_couch_query('xuda_emails', {
973
973
  selector: {
974
974
  docType: 'email_account',
@@ -1210,7 +1210,7 @@ export const update_contact = async function (req) {
1210
1210
  export const invite_user = async function (req) {
1211
1211
  const { email, name, uid } = req;
1212
1212
 
1213
- const team_module = require(`${module_path}/team_module`);
1213
+ const team_module = await import(`${module_path}/team_module/index.mjs`);
1214
1214
  const ret = await team_module.create_team_request({
1215
1215
  email,
1216
1216
  access_type: 'contact',
@@ -1235,7 +1235,7 @@ export const get_account_rt_info = async function (uid) {
1235
1235
  };
1236
1236
 
1237
1237
  // export const validate_account_topup = async function (uid, items = []) {
1238
- // const stripe_module = require(`${module_path}/stripe_module`);
1238
+ // const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
1239
1239
 
1240
1240
  // const { code, data } = await stripe_module.get_billing_metrics({ uid });
1241
1241
  // if (code < 0) {
@@ -1277,7 +1277,7 @@ export const get_account_rt_info = async function (uid) {
1277
1277
  // };
1278
1278
 
1279
1279
  export const validate_account_topup = async function (uid, items = []) {
1280
- const stripe_module = require(`${module_path}/stripe_module`);
1280
+ const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
1281
1281
 
1282
1282
  const { code, data } = await stripe_module.get_billing_metrics({ uid });
1283
1283
  if (code < 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.155",
3
+ "version": "1.2.157",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {