implement remote api calls for table mutation (#567)

Add more APIs to remote table for Node SDK
* `add` rows
* `overwrite` table with rows
* `create` table

This has been tested against dev stack
This commit is contained in:
Rob Meng
2023-10-16 11:07:58 -04:00
committed by GitHub
parent 043e388254
commit 345c136cfb
3 changed files with 122 additions and 9 deletions

View File

@@ -108,13 +108,18 @@ export class HttpLancedbClient {
/**
* Sent POST request.
*/
public async post (path: string, data?: any, params?: Record<string, string | number>): Promise<AxiosResponse> {
public async post (
path: string,
data?: any,
params?: Record<string, string | number>,
content?: string | undefined
): Promise<AxiosResponse> {
const response = await axios.post(
`${this._url}${path}`,
data,
{
headers: {
'Content-Type': 'application/json',
'Content-Type': content ?? 'application/json',
'x-api-key': this._apiKey(),
...(this._dbName !== undefined ? { 'x-lancedb-database': this._dbName } : {})
},