General clean up. Improved event search and listing for IDAA.
This commit is contained in:
101
src/lib/api.ts
101
src/lib/api.ts
@@ -5,15 +5,15 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
|
||||
import { delete_object } from './api_delete_object'; // Exported at the end of this file
|
||||
import { get_object } from './api_get_object'; // Exported at the end of this file
|
||||
import { patch_object } from './api_patch_object'; // Exported at the end of this file
|
||||
import { post_object } from './api_post_object'; // Exported at the end of this file
|
||||
import { delete_object } from './ae_api/api_delete_object'; // Exported at the end of this file
|
||||
import { get_object } from './ae_api/api_get_object'; // Exported at the end of this file
|
||||
import { patch_object } from './ae_api/api_patch_object'; // Exported at the end of this file
|
||||
import { post_object } from './ae_api/api_post_object'; // Exported at the end of this file
|
||||
|
||||
|
||||
import { get_ae_obj_id_crud } from '$lib/api_get__crud_obj_id';
|
||||
import { get_ae_obj_li_for_obj_id_crud } from '$lib/api_get__crud_obj_li_v1';
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/api_get__crud_obj_li_v2';
|
||||
import { get_ae_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_id';
|
||||
import { get_ae_obj_li_for_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_li_v1';
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/ae_api/api_get__crud_obj_li_v2';
|
||||
|
||||
|
||||
// This new function has not been tested yet!!!
|
||||
@@ -308,16 +308,16 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
obj_id,
|
||||
field_name,
|
||||
field_value,
|
||||
fields={},
|
||||
fields = {},
|
||||
key,
|
||||
jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
data={},
|
||||
return_obj=false,
|
||||
obj_v_name='',
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
jwt = null,
|
||||
headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
return_obj = false,
|
||||
obj_v_name = '',
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
@@ -326,7 +326,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
field_value?: any,
|
||||
fields?: key_val,
|
||||
key: string,
|
||||
jwt?: string,
|
||||
jwt?: null|string,
|
||||
headers?: key_val,
|
||||
params?: key_val,
|
||||
data?: null|key_val,
|
||||
@@ -340,8 +340,11 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
console.log('*** update_ae_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
data['super_key'] = key;
|
||||
data['jwt'] = jwt;
|
||||
if (!data) {
|
||||
data = {};
|
||||
data['super_key'] = key;
|
||||
data['jwt'] = jwt;
|
||||
}
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API.
|
||||
@@ -516,19 +519,19 @@ export let delete_ae_obj_id_crud = async function delete_ae_obj_id_crud(
|
||||
obj_type,
|
||||
obj_id,
|
||||
key,
|
||||
jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
data={},
|
||||
method='delete', // 'delete', 'disable', 'hide'
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
jwt = null,
|
||||
headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
method = 'delete', // 'delete', 'disable', 'hide'
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
} : {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
obj_id: string,
|
||||
key: string,
|
||||
jwt?: string,
|
||||
jwt?: null|string,
|
||||
headers?: any,
|
||||
params?: any,
|
||||
data?: any,
|
||||
@@ -795,40 +798,42 @@ export let send_email = async function send_email(
|
||||
{
|
||||
api_cfg,
|
||||
from_email,
|
||||
from_name='',
|
||||
from_name = '',
|
||||
to_email,
|
||||
to_name='',
|
||||
cc_email=null,
|
||||
cc_name=null,
|
||||
bcc_email=null,
|
||||
bcc_name=null,
|
||||
to_name = '',
|
||||
cc_email = null,
|
||||
cc_name = null,
|
||||
bcc_email = null,
|
||||
bcc_name = null,
|
||||
subject,
|
||||
body_html,
|
||||
body_text=null,
|
||||
headers={},
|
||||
params={},
|
||||
data={},
|
||||
return_obj=false,
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
body_text = null,
|
||||
// headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
return_obj = false,
|
||||
return_meta = false,
|
||||
test = true,
|
||||
log_lvl = 0
|
||||
} : {
|
||||
api_cfg: any,
|
||||
from_email: string,
|
||||
from_name?: string,
|
||||
to_email: string,
|
||||
to_name?: string,
|
||||
cc_email?: string,
|
||||
cc_name?: string,
|
||||
bcc_email?: string,
|
||||
bcc_name?: string,
|
||||
cc_email?: null|string,
|
||||
cc_name?: null|string,
|
||||
bcc_email?: null|string,
|
||||
bcc_name?: null|string,
|
||||
subject: string,
|
||||
body_html: string,
|
||||
body_text?: string,
|
||||
headers?: key_val,
|
||||
body_text?: null|string,
|
||||
// headers?: key_val,
|
||||
params?: key_val,
|
||||
data?: key_val,
|
||||
return_obj?: boolean,
|
||||
return_meta?: boolean,
|
||||
test?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
@@ -861,6 +866,10 @@ export let send_email = async function send_email(
|
||||
params['return_obj'] = true;
|
||||
}
|
||||
|
||||
if (test) {
|
||||
params['test'] = true;
|
||||
}
|
||||
|
||||
let send_email_post_promise = await api.post_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
|
||||
Reference in New Issue
Block a user