Initial commit

This commit is contained in:
root
2025-12-21 09:57:43 -05:00
committed by Sebastian Krupinski
commit db42b6699c
35 changed files with 6458 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
/**
* Node (unified collection/entity) management service
*/
import { fileManagerApi } from './api';
import type { FilterCondition, SortCondition, RangeCondition } from '@/types/common';
import type { FileNode } from '@/types/node';
import type { NodeDeltaResult } from '@/types/api';
export const nodeService = {
/**
* List all nodes (collections and entities) within a location
*
* @param provider - Provider identifier
* @param service - Service identifier
* @param location - Parent collection ID (null for root)
* @param recursive - Whether to list recursively
* @param filter - Optional filter conditions
* @param sort - Optional sort conditions
* @param range - Optional range/pagination conditions
* @returns Promise with node list
*/
async list(
provider: string,
service: string,
location?: string | null,
recursive: boolean = false,
filter?: FilterCondition[] | null,
sort?: SortCondition[] | null,
range?: RangeCondition | null
): Promise<FileNode[]> {
return await fileManagerApi.execute<FileNode[]>('node.list', {
provider,
service,
location: location ?? null,
recursive,
filter: filter ?? null,
sort: sort ?? null,
range: range ?? null,
});
},
/**
* Get delta changes for nodes since a signature
*
* @param provider - Provider identifier
* @param service - Service identifier
* @param location - Parent collection ID (null for root)
* @param signature - Previous sync signature
* @param recursive - Whether to get delta recursively
* @param detail - Detail level ('ids' or 'full')
* @returns Promise with delta changes
*/
async delta(
provider: string,
service: string,
location: string | null,
signature: string,
recursive: boolean = false,
detail: 'ids' | 'full' = 'ids'
): Promise<NodeDeltaResult> {
return await fileManagerApi.execute<NodeDeltaResult>('node.delta', {
provider,
service,
location,
signature,
recursive,
detail,
});
},
};
export default nodeService;