Skip to content
Snippets Groups Projects
Commit 578d8691 authored by Marin Karamihalev's avatar Marin Karamihalev
Browse files

added add raw option and types for raw response

parent 486119f5
Branches
Tags
1 merge request!5Rebase with master
......@@ -247,7 +247,7 @@ const buildConnect: BuildConnectionFn =
getNested: (paths, options) =>
call("GET", { paths, options: { ...options, retainPath: true } }),
set: (path, value, options) => call("SET", { path, value, options }),
add: (path, value) => call("ADD", { path, value }),
add: (path, value, options) => call("ADD", { path, value, options }),
del: (paths, allowPartial) => call("DELETE", { paths, allowPartial }),
instances: (paths, opts) => call("GET_INSTANCES", { paths, opts }),
supportedDM: (paths, opts) => call("GET_SUPPORTED_DM", { paths, opts }),
......
......@@ -68,6 +68,30 @@ export type SetResponse = {
updatedParams: Record<string, string>;
}[];
export type AddResponse = string[];
export type AddRawResponse = {
header: {
msgId: string;
msgType: "ADD_RESP";
};
body: {
response: {
addResp: {
createdObjResults: {
requestedPath: string;
operStatus: {
operSuccess: {
instantiatedPath: string;
uniqueKeys: Record<string, string>;
};
};
}[];
};
};
};
};
export type SetRawResponse = {
header: {
msgId: string;
......@@ -127,10 +151,24 @@ export type SetCommand = ((
| (JSValue | JSValue[] | InputRecord)[],
options: { raw: true } & SetCommandOptions
) => Promise<SetRawResponse>);
export type AddCommand = (
export type AddCommand = ((
path: string | string[],
value?: InputRecord | InputRecord[]
) => Promise<string | string[]>;
value:
| (JSValue | JSValue[] | InputRecord)
| (JSValue | JSValue[] | InputRecord)[]
| null
| undefined,
options?: { raw?: false }
) => Promise<AddResponse>) &
((
path: string | string[],
value:
| (JSValue | JSValue[] | InputRecord)
| (JSValue | JSValue[] | InputRecord)[]
| null
| undefined,
options: { raw: true }
) => Promise<AddRawResponse>);
export type DelCommand = (
path: string | string[],
allowPartial?: boolean
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment