chore: remove dead legacy CRUD API functions and helpers

This commit is contained in:
Scott Idem
2026-06-18 11:55:53 -04:00
parent 12f799b0d6
commit e09757f2b1
2 changed files with 0 additions and 315 deletions

View File

@@ -1,94 +0,0 @@
import type { key_val } from '$lib/stores/ae_stores';
import { get_object } from './api_get_object';
/**
* Fetches a single Aether object by its ID using the CRUD endpoint.
* Refactored 2026-01-08 to properly handle unauthenticated lookups (Bootstrap Paradox)
* and ensure clean header passing to get_object without mutating the global config.
*/
export async function get_ae_obj_id_crud({
api_cfg,
no_account_id = false,
obj_type,
obj_id,
use_alt_table = false,
use_alt_base = false,
inc = {},
enabled = 'enabled',
hidden = 'not_hidden',
limit = 999999,
offset = 0,
data = {},
headers = {},
params = {},
timeout = 60000,
return_meta = false,
log_lvl = 0
}: {
api_cfg: any;
no_account_id?: boolean;
obj_type: string;
obj_id: string;
use_alt_table?: boolean;
use_alt_base?: boolean;
inc?: any;
enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
limit?: number;
offset?: number;
data?: any;
headers?: any;
params?: key_val;
timeout?: number;
return_meta?: boolean;
log_lvl?: number;
}) {
if (log_lvl) {
console.log(
`*** get_ae_obj_id_crud() *** Type: ${obj_type} ID: ${obj_id}`
);
}
// V3 Standard: Unified endpoint for all objects
const endpoint = `/v3/crud/${obj_type}/${obj_id}`;
if (log_lvl > 1) {
console.log('Endpoint:', endpoint);
}
const final_params = {
...params,
use_alt_table: use_alt_table,
use_alt_base: use_alt_base
};
const final_headers = { ...headers };
if (no_account_id) {
// This instructs get_object to skip account-id requirements
final_headers['x-no-account-id'] = 'Nothing to See Here';
final_headers['x-account-id'] = null; // Explicitly null to trigger removal in get_object
}
const result = await get_object({
api_cfg: api_cfg,
endpoint: endpoint,
headers: final_headers,
params: final_params,
timeout: timeout,
log_lvl: log_lvl,
return_meta: return_meta
}).catch(function (error: any) {
console.error(
`API GET CRUD object ID request failed for ${obj_type}/${obj_id}`,
error
);
return false;
});
if (log_lvl > 1) {
console.log('GET Object result =', result);
}
return result;
}

View File

@@ -9,7 +9,6 @@ import { get_object } from '$lib/ae_api/api_get_object'; // Exported at the end
import { patch_object } from '$lib/ae_api/api_patch_object'; // Exported at the end of this file
import { post_object } from '$lib/ae_api/api_post_object'; // Exported at the end of this file
import { get_ae_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_id';
import { get_ae_lookup_li } from '$lib/ae_api/api_get__lookup';
import {
get_ae_obj,
@@ -105,223 +104,6 @@ export const get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu({
}
};
// Updated 2023-07-24
export const create_ae_obj_crud = async function create_ae_obj_crud({
api_cfg,
obj_type,
field_name = null,
field_value = null,
fields = {},
key,
jwt = null,
headers = {},
params = {},
data = {},
return_obj = false,
obj_v_name = '',
return_meta = false,
log_lvl = 0
}: {
api_cfg: any;
obj_type: string;
field_name?: null | string;
field_value?: any;
fields?: key_val;
key: string;
jwt?: null | string;
headers?: key_val;
params?: key_val;
data?: key_val;
return_obj?: boolean;
obj_v_name?: string;
return_meta?: boolean;
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** create_ae_obj_crud() *** obj_type=${obj_type}`);
}
data['super_key'] = key;
data['jwt'] = jwt;
// V3 Standard: Unified endpoint for all objects
const endpoint = `/v3/crud/${obj_type}`;
if (log_lvl) {
console.log('Endpoint:', endpoint);
}
if (return_obj) {
params['return_obj'] = true;
// Pass along the view name to use for returning data.
if (obj_v_name) {
params['obj_v_name'] = obj_v_name;
}
} else {
params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object.
}
if (field_name) {
data['data_list'] = {}; // Really an object/dict
data['data_list'][field_name] = field_value;
// data['data_list']['testing'] = 'asdf 1234';
} else if (fields) {
data['data_list'] = fields; // Really an object/dict
}
// NOTE: The data object may contain objects that need to be converted to JSON strings. This is done by adding "_json" to the end of the property name. This is done because the API does not support nested objects. This is a limitation of the API.
if (data['data_list']) {
if (log_lvl > 1) {
console.log('Data List:', data['data_list']);
}
for (const [key, value] of Object.entries(data['data_list'])) {
// console.log(key, value);
if (key.endsWith('_json')) {
if (log_lvl) {
console.log(`${key}: ${value}`);
}
data['data_list'][key] = serialize_json_field_pretty(value);
}
}
}
if (log_lvl) {
console.log('Data:', data);
}
// params['xxxxx run_safety_check xxxxx'] = false;
params['by_alias'] = false;
if (log_lvl) {
console.log('Params:', params);
}
const object_obj_post_promise = await post_object({
api_cfg: api_cfg,
endpoint: endpoint,
params: params,
data: data,
log_lvl: log_lvl
});
if (log_lvl > 1) {
console.log(object_obj_post_promise);
}
return object_obj_post_promise;
};
// Updated 2023-06-28
export const update_ae_obj_id_crud = async function update_ae_obj_id_crud({
api_cfg,
obj_type,
obj_id,
field_name,
field_value,
fields = {},
key,
jwt = null,
headers = {},
params = {},
data = {},
return_obj = false,
obj_v_name = '',
return_meta = false,
log_lvl = 0
}: {
api_cfg: any;
obj_type: string;
obj_id: string;
field_name?: string;
field_value?: any;
fields?: key_val;
key: string;
jwt?: null | string;
headers?: key_val;
params?: key_val;
data?: null | key_val;
return_obj?: boolean;
obj_v_name?: string;
return_meta?: boolean;
log_lvl?: number;
}) {
if (log_lvl) {
console.log('*** update_ae_obj_id_crud() ***');
}
if (!data) {
data = {};
}
data['super_key'] = key;
data['jwt'] = jwt;
// V3 Standard: Unified endpoint for all objects
const endpoint = `/v3/crud/${obj_type}/${obj_id}`;
if (log_lvl) {
console.log('Endpoint:', endpoint);
}
if (return_obj) {
params['return_obj'] = true;
// Pass along the view name to use for returning data.
if (obj_v_name) {
params['obj_v_name'] = obj_v_name;
}
} else {
params['return_obj'] = false; // NOTE: This is needed because the current default on the API is to return the object.
}
if (field_name) {
data['data_list'] = {}; // Really an object/dict
data['data_list'][field_name] = field_value;
// data['data_list']['testing'] = 'asdf 1234';
} else if (fields) {
data['data_list'] = fields; // Really an object/dict
}
// NOTE: The data object may contain objects that need to be converted to JSON strings. This is done by adding "_json" to the end of the property name. This is done because the API does not support nested objects. This is a limitation of the API.
if (data['data_list']) {
if (log_lvl > 1) {
console.log('Data List:', data['data_list']);
}
for (const [key, value] of Object.entries(data['data_list'])) {
// console.log(key, value);
if (key.endsWith('_json')) {
if (log_lvl) {
console.log(`${key}: ${value}`);
}
data['data_list'][key] = serialize_json_field_pretty(value);
}
}
}
if (log_lvl) {
console.log('Data:', data);
}
// params['xxxxx run_safety_check xxxxx'] = false;
params['by_alias'] = false;
if (log_lvl) {
console.log('Params:', params);
}
const object_obj_patch_promise = await patch_object({
api_cfg: api_cfg,
endpoint: endpoint,
params: params,
data: data,
log_lvl: log_lvl
});
if (log_lvl > 1) {
console.log(object_obj_patch_promise);
}
return object_obj_patch_promise;
};
// Updated 2023-11-14
export const delete_ae_obj_id_crud = async function delete_ae_obj_id_crud({
api_cfg,
@@ -602,7 +384,6 @@ const obj = {
get_object: get_object,
patch_object: patch_object,
post_object: post_object,
get_ae_obj_id_crud: get_ae_obj_id_crud,
get_ae_obj: get_ae_obj,
get_nested_ae_obj: get_nested_ae_obj,
get_ae_obj_li: get_ae_obj_li,
@@ -614,8 +395,6 @@ const obj = {
update_nested_obj: update_nested_obj,
delete_ae_obj: delete_ae_obj,
delete_nested_ae_obj: delete_nested_ae_obj,
create_ae_obj_crud: create_ae_obj_crud,
update_ae_obj_id_crud: update_ae_obj_id_crud,
delete_ae_obj_id_crud: delete_ae_obj_id_crud,
download_hosted_file: download_hosted_file,
delete_hosted_file: delete_hosted_file,