import { getDefaultClient } from '../../factory' import type { EntityPutQueryKeeperReqVO, EntityPutQueryKeeperRespVO, EntityQueryReqVO, EntityQueryRespVO, EntityQueryFilterReqVO, EntityQueryFilterRespVO, EntityQueryRelationReqVO, EntityQueryRelationRespVO, EntitySelectionActionReqVO, EntityQuerySelectionRespVO, EntityResolveWorkflowReqVO, EntityResolveWorkflowRespVO, EntityRowRespVO, EntityRowDeleteRespVO, EntityUpdateReqVO, EntityUpdateRespVO, EntityValidateUniqReqVO, EntityValidateUniqRespVO, InsertReqVO, InsertRespVO, InsertPrepareReqVO, InsertPrepareRespVO, EntityWorkflowApproveUsersRespVO, EntityWorkflowNodesRespVO, GetSubformItemsReqVO, GetSubformItemsRespVO } from '../../types' // @endpoint POST /entity/:app_id/:entity_id/query-keeper // @controller UserAction.EntityPutQueryKeeper export async function putEntityQueryKeeper( appId: string, entityId: string, data: EntityPutQueryKeeperReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/query-keeper`, data) } // @endpoint POST /entity/:app_id/:entity_id/data-query // @controller UserAction.EntityQuery export async function queryEntity( appId: string, entityId: string, data: EntityQueryReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/data-query`, data) } // @endpoint POST /entity/:app_id/:entity_id/query-filter // @controller UserAction.EntityQueryFilter export async function filterEntityQuery( appId: string, entityId: string, data: EntityQueryFilterReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/query-filter`, data) } // @endpoint POST /entity/:app_id/:entity_id/selection-query/:action // @controller UserAction.EntityQuerySelection export async function queryEntitySelection( appId: string, entityId: string, action: string, data: EntitySelectionActionReqVO ): Promise { // 调试日志,便于排查 selection-query/archive 不可用问题 // console.debug('[queryEntitySelection] appId, entityId, action, data', appId, entityId, action, data) return getDefaultClient().post(`/entity/${appId}/${entityId}/selection-query/${action}`, data) } // @endpoint POST /entity/:app_id/:entity_id/resolve-workflow // @controller UserAction.EntityResolveWorkflow export async function resolveEntityWorkflow( appId: string, entityId: string, data: EntityResolveWorkflowReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/resolve-workflow`, data) } // @endpoint GET /entity/:app_id/:entity_id/row/:row_id // @controller UserAction.EntityRow export async function getEntityRow( appId: string, entityId: string, rowId: string, params?: Record ): Promise { return getDefaultClient().get(`/entity/${appId}/${entityId}/row/${rowId}`, params) } // @endpoint POST /entity/:app_id/:entity_id/delete-item // @controller UserAction.EntityRowDelete export async function deleteEntityRow( appId: string, entityId: string, data: EntitySelectionActionReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/delete-item`, data) } // @endpoint POST /entity/:app_id/:entity_id/restore-item // @controller UserAction.EntityRowRestore export async function restoreEntityRow( appId: string, entityId: string, data: EntitySelectionActionReqVO ): Promise<{ restored: number }> { return getDefaultClient().post(`/entity/${appId}/${entityId}/restore-item`, data) } // @endpoint PUT /entity/:app_id/:entity_id/row/:row_id // @controller UserAction.EntityUpdate export async function updateEntityRow( appId: string, entityId: string, rowId: string, data: EntityUpdateReqVO ): Promise { return getDefaultClient().put(`/entity/${appId}/${entityId}/row/${rowId}`, data) } // @endpoint POST /entity/:app_id/:entity_id/validate-uniq // @controller UserAction.EntityValidateUniq export async function validateEntityUniq( appId: string, entityId: string, data: EntityValidateUniqReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/validate-uniq`, data) } // @endpoint POST /entity/:app_id/:entity_id/insert // @controller UserAction.Insert export async function insertEntity( appId: string, entityId: string, data: InsertReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/insert`, data) } // Legacy compatibility alias for postFormData export const postFormData = insertEntity // @endpoint POST /entity/:app_id/:entity_id/prepare // @controller UserAction.InsertPrepare export async function prepareEntityInsert( appId: string, entityId: string, data: InsertPrepareReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/prepare`, data) } // @endpoint POST /entity/:app_id/:entity_id/query-approve-users // @controller UserAction.EntityWorkflowApproveUsers export async function queryEntityWorkflowApproveUsers( appId: string, entityId: string ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/query-approve-users`) } // @endpoint POST /entity/:app_id/:entity_id/query-workflow-nodes // @controller UserAction.EntityWorkflowNodes export async function queryEntityWorkflowNodes( appId: string, entityId: string ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/query-workflow-nodes`) } // @endpoint POST /entity/:app_id/:entity_id/row/:row_id/get-subitems // @controller UserAction.GetSubformItems export async function getEntitySubformItems( appId: string, entityId: string, rowId: string, data: GetSubformItemsReqVO ): Promise { return getDefaultClient().post(`/entity/${appId}/${entityId}/row/${rowId}/get-subitems`, data) }