More code clean up
This commit is contained in:
@@ -28,7 +28,7 @@ export async function load_ae_obj_id__account({
|
||||
}
|
||||
|
||||
ae_promises.load__account_obj = await api
|
||||
.get_ae_obj_v3({
|
||||
.get_ae_obj({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'account',
|
||||
obj_id: account_id,
|
||||
@@ -100,7 +100,7 @@ export async function load_ae_obj_li__account({
|
||||
}
|
||||
|
||||
ae_promises.load__account_obj_li = await api
|
||||
.get_ae_obj_li_v3({
|
||||
.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'account',
|
||||
enabled,
|
||||
@@ -260,7 +260,7 @@ export async function delete_ae_obj_id__account({
|
||||
}
|
||||
|
||||
ae_promises.delete__account_obj = await api
|
||||
.delete_ae_obj_v3({
|
||||
.delete_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'account',
|
||||
obj_id: account_id,
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function load_ae_obj_id__activity_log({
|
||||
console.log(`*** load_ae_obj_id__activity_log() *** activity_log_id=${activity_log_id}`);
|
||||
}
|
||||
|
||||
ae_promises.load__activity_log_obj = await api.get_ae_obj_v3({
|
||||
ae_promises.load__activity_log_obj = await api.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'activity_log',
|
||||
obj_id: activity_log_id,
|
||||
@@ -64,7 +64,7 @@ export async function load_ae_obj_li__activity_log({
|
||||
console.log(`*** load_ae_obj_li__activity_log() *** for_obj_id=${for_obj_id}`);
|
||||
}
|
||||
|
||||
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li_v3({
|
||||
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'activity_log',
|
||||
for_obj_type,
|
||||
@@ -238,7 +238,7 @@ export async function qry__activity_log({
|
||||
|
||||
|
||||
|
||||
ae_promises.load__activity_log_obj_li = await api.search_ae_obj_v3({
|
||||
ae_promises.load__activity_log_obj_li = await api.search_ae_obj({
|
||||
|
||||
api_cfg,
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function load_ae_obj_id__address({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Address | null> {
|
||||
ae_promises.load__address_obj = await api.get_ae_obj_v3({
|
||||
ae_promises.load__address_obj = await api.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
obj_id: address_id,
|
||||
@@ -77,7 +77,7 @@ export async function load_ae_obj_li__address({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Address[]> {
|
||||
ae_promises.load__address_obj_li = await api.get_ae_obj_li_v3({
|
||||
ae_promises.load__address_obj_li = await api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
for_obj_type,
|
||||
@@ -202,7 +202,7 @@ export async function delete_ae_obj_id__address({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
const result = await api.delete_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
obj_id: address_id,
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function load_ae_obj_id__contact({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Contact | null> {
|
||||
ae_promises.load__contact_obj = await api.get_ae_obj_v3({
|
||||
ae_promises.load__contact_obj = await api.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
obj_id: contact_id,
|
||||
@@ -75,7 +75,7 @@ export async function load_ae_obj_li__contact({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Contact[]> {
|
||||
ae_promises.load__contact_obj_li = await api.get_ae_obj_li_v3({
|
||||
ae_promises.load__contact_obj_li = await api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
for_obj_type,
|
||||
@@ -200,7 +200,7 @@ export async function delete_ae_obj_id__contact({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
const result = await api.delete_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
obj_id: contact_id,
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function load_ae_obj_id__organization({
|
||||
organization_id: string;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Organization | null> {
|
||||
return await api.get_ae_obj_v3({
|
||||
return await api.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'organization',
|
||||
obj_id: organization_id,
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function load_ae_obj_id__person({
|
||||
}
|
||||
|
||||
ae_promises.load__person_obj = await api
|
||||
.get_ae_obj_v3({
|
||||
.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'person',
|
||||
obj_id: person_id,
|
||||
@@ -136,7 +136,7 @@ export async function load_ae_obj_li__person({
|
||||
search_query.and.push({ field: 'hide', op: 'eq', value: false });
|
||||
}
|
||||
|
||||
promise = api.search_ae_obj_v3({
|
||||
promise = api.search_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'person',
|
||||
search_query,
|
||||
@@ -146,7 +146,7 @@ export async function load_ae_obj_li__person({
|
||||
log_lvl
|
||||
});
|
||||
} else {
|
||||
promise = api.get_ae_obj_li_v3({
|
||||
promise = api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'person',
|
||||
for_obj_type,
|
||||
@@ -290,7 +290,7 @@ export async function delete_ae_obj_id__person({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
const result = await api.delete_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'person',
|
||||
obj_id: person_id,
|
||||
|
||||
@@ -60,7 +60,7 @@ export async function lookup_site_domain({
|
||||
|
||||
if (log_lvl) console.log('Attempting to load site domain from local cache...');
|
||||
const cached = await db_core.site_domain.where('fqdn').equals(fqdn).first();
|
||||
|
||||
|
||||
if (cached) {
|
||||
return cached as any;
|
||||
}
|
||||
@@ -113,10 +113,10 @@ export async function lookup_site_domain_v3({
|
||||
cached = await db_core.site_domain.where('fqdn').equals(fqdn).first();
|
||||
if (cached) {
|
||||
if (log_lvl) console.log('BOOTSTRAP: Cache hit. Returning cached site domain immediately.');
|
||||
|
||||
|
||||
// Trigger background refresh to keep cache fresh, but don't await it
|
||||
_refresh_site_domain_v3_background({ api_cfg, fqdn, view, log_lvl: 0 });
|
||||
|
||||
|
||||
return cached as any;
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -134,15 +134,15 @@ async function _refresh_site_domain_v3_background({ api_cfg, fqdn, view, log_lvl
|
||||
try {
|
||||
const guest_api_cfg = { ...api_cfg };
|
||||
guest_api_cfg.headers = { ...api_cfg.headers };
|
||||
|
||||
|
||||
const auth_props = [
|
||||
'x-account-id',
|
||||
'Authorization',
|
||||
'authorization',
|
||||
'jwt',
|
||||
'x-account-id',
|
||||
'Authorization',
|
||||
'authorization',
|
||||
'jwt',
|
||||
'JWT'
|
||||
];
|
||||
|
||||
|
||||
auth_props.forEach(prop => {
|
||||
delete guest_api_cfg.headers[prop];
|
||||
delete guest_api_cfg.headers[prop.toLowerCase()];
|
||||
@@ -155,7 +155,7 @@ async function _refresh_site_domain_v3_background({ api_cfg, fqdn, view, log_lvl
|
||||
and: [{ field: 'fqdn', op: 'eq', value: fqdn }]
|
||||
};
|
||||
|
||||
const result_li = await api.search_ae_obj_v3({
|
||||
const result_li = await api.search_ae_obj({
|
||||
api_cfg: guest_api_cfg,
|
||||
obj_type: 'site_domain',
|
||||
search_query,
|
||||
@@ -207,7 +207,7 @@ export async function load_ae_obj_id__site({
|
||||
}
|
||||
|
||||
ae_promises.load__site_obj = await api
|
||||
.get_ae_obj_v3({
|
||||
.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'site',
|
||||
obj_id: site_id,
|
||||
@@ -278,7 +278,7 @@ export async function load_ae_obj_li__site({
|
||||
}
|
||||
|
||||
ae_promises.load__site_obj_li = await api
|
||||
.get_ae_obj_li_v3({
|
||||
.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'site',
|
||||
for_obj_type,
|
||||
@@ -417,7 +417,7 @@ export async function delete_ae_obj_id__site({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
const result = await api.delete_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'site',
|
||||
obj_id: site_id,
|
||||
@@ -464,7 +464,7 @@ export async function load_ae_obj_li__site_domain({
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_SiteDomain[]> {
|
||||
ae_promises.load__site_domain_li = await api
|
||||
.get_nested_obj_li_v3({
|
||||
.get_nested_obj_li({
|
||||
api_cfg,
|
||||
parent_type: 'site',
|
||||
parent_id: site_id,
|
||||
@@ -611,7 +611,7 @@ export async function delete_ae_obj_id__site_domain({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_nested_ae_obj_v3({
|
||||
const result = await api.delete_nested_ae_obj({
|
||||
api_cfg,
|
||||
parent_type: 'site',
|
||||
parent_id: site_id,
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function load_ae_obj_id__user({
|
||||
}
|
||||
|
||||
ae_promises.load__user_obj = await api
|
||||
.get_ae_obj_v3({
|
||||
.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
obj_id: user_id,
|
||||
@@ -112,7 +112,7 @@ export async function load_ae_obj_li__user({
|
||||
search_query.and.push({ field: `account_id_random`, op: 'eq', value: null });
|
||||
}
|
||||
|
||||
return await api.search_ae_obj_v3({
|
||||
return await api.search_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
search_query,
|
||||
@@ -133,7 +133,7 @@ export async function load_ae_obj_li__user({
|
||||
load_ae_obj_li__user({ api_cfg, for_obj_id, include_global: false, enabled, hidden, view, limit, log_lvl }),
|
||||
load_ae_obj_li__user({ api_cfg, for_obj_id: null, include_global: true, enabled, hidden, view, limit, log_lvl })
|
||||
]);
|
||||
|
||||
|
||||
// Merge and unique-ify by ID
|
||||
const merged = [...acct_users, ...global_users];
|
||||
const unique = Array.from(new Map(merged.map(u => [u.user_id_random, u])).values());
|
||||
@@ -147,7 +147,7 @@ export async function load_ae_obj_li__user({
|
||||
const search_query = {
|
||||
and: [{ field: 'account_id_random', op: 'eq', value: null }]
|
||||
};
|
||||
return await api.search_ae_obj_v3({
|
||||
return await api.search_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
search_query,
|
||||
@@ -163,7 +163,7 @@ export async function load_ae_obj_li__user({
|
||||
|
||||
// SCENARIO D: Account Only or Everything (confirmed working List API)
|
||||
if (log_lvl) console.log(`Strategy: Standard List API (for_obj_id=${for_obj_id})`);
|
||||
return await api.get_ae_obj_li_v3({
|
||||
return await api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
for_obj_type: for_obj_id ? for_obj_type : undefined,
|
||||
@@ -280,7 +280,7 @@ export async function delete_ae_obj_id__user({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
const result = await api.delete_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
obj_id: user_id,
|
||||
@@ -540,7 +540,7 @@ export async function qry_ae_obj_li__user_email({
|
||||
|
||||
params['email'] = email; // Required
|
||||
params['null_account_id'] = null_account_id || false;
|
||||
|
||||
|
||||
ae_promises.qry__user_email = await api
|
||||
.get_object({
|
||||
api_cfg: use_api_cfg,
|
||||
|
||||
@@ -26,7 +26,7 @@ export async function load_ae_obj_id__hosted_file({
|
||||
}
|
||||
|
||||
try {
|
||||
ae_promises.load__hosted_file_obj = await api.get_ae_obj_v3({
|
||||
ae_promises.load__hosted_file_obj = await api.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'hosted_file',
|
||||
obj_id: hosted_file_id,
|
||||
@@ -94,7 +94,7 @@ export async function load_ae_obj_li__hosted_file({
|
||||
}
|
||||
|
||||
try {
|
||||
ae_promises.load__hosted_file_obj_li = await api.get_ae_obj_li_v3({
|
||||
ae_promises.load__hosted_file_obj_li = await api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'hosted_file',
|
||||
for_obj_type,
|
||||
|
||||
Reference in New Issue
Block a user