|
|
@ -190,21 +190,17 @@ class Access extends EventEmitter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const access = new Access(); |
|
|
|
const access = new Access(); |
|
|
|
const rootAccess = new Access({ spawnOptions: { gid: 0, uid: 0 } }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const subroutine = async <T extends unknown[]>( |
|
|
|
const subroutine = async <T extends unknown[]>( |
|
|
|
subroutine: string, |
|
|
|
subroutine: string, |
|
|
|
{ |
|
|
|
{ |
|
|
|
params = [], |
|
|
|
params = [], |
|
|
|
pre = ['Database'], |
|
|
|
pre = ['Database'], |
|
|
|
root, |
|
|
|
|
|
|
|
}: { |
|
|
|
}: { |
|
|
|
params?: unknown[]; |
|
|
|
params?: unknown[]; |
|
|
|
pre?: string[]; |
|
|
|
pre?: string[]; |
|
|
|
root?: boolean; |
|
|
|
|
|
|
|
} = {}, |
|
|
|
} = {}, |
|
|
|
) => { |
|
|
|
) => { |
|
|
|
const selectedAccess = root ? rootAccess : access; |
|
|
|
|
|
|
|
const chain = `${pre.join('->')}->${subroutine}`; |
|
|
|
const chain = `${pre.join('->')}->${subroutine}`; |
|
|
|
|
|
|
|
|
|
|
|
const subParams: string[] = params.map<string>((p) => { |
|
|
|
const subParams: string[] = params.map<string>((p) => { |
|
|
@ -219,7 +215,7 @@ const subroutine = async <T extends unknown[]>( |
|
|
|
return `"${result.replaceAll('"', '\\"')}"`; |
|
|
|
return `"${result.replaceAll('"', '\\"')}"`; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const { sub_results: results } = await selectedAccess.interact<{ |
|
|
|
const { sub_results: results } = await access.interact<{ |
|
|
|
sub_results: T; |
|
|
|
sub_results: T; |
|
|
|
}>('x', chain, ...subParams); |
|
|
|
}>('x', chain, ...subParams); |
|
|
|
|
|
|
|
|
|
|
|