diff --git a/src/configurations/build.ts b/src/configurations/build.ts index a3ed88502b384168a0c6251c4607e869098463c0..80c2e366fb4a13a3ca438d1a2154f9d9eb6f74c2 100644 --- a/src/configurations/build.ts +++ b/src/configurations/build.ts @@ -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 }), diff --git a/src/types.ts b/src/types.ts index ea81026e1031a47f9445c6e243f907a28d2b481a..3ff8869848a4f6b3284755adddb6f125aa6b6b4a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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