Skip to content

Commit c5e7603

Browse files
committed
fix rename update to write for inline with documentations
1 parent e999366 commit c5e7603

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

__tests__/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
search_count,
88
create,
99
remove,
10-
update,
10+
write,
1111
call_method, init,
1212
} from "../src/index";
1313
import {OdxProxyClientInfo} from "../src/client";
@@ -81,9 +81,9 @@ describe("All methods test", () => {
8181
createdRecord = res.result;
8282
}, 30000);
8383

84-
it("update", async () => {
84+
it("write", async () => {
8585
if (createdRecord) {
86-
const res = await update("res.partner", [[createdRecord], {name: "ACME Updated"}], {context: {tz: "Asia/Jakarta"}})
86+
const res = await write("res.partner", [[createdRecord], {name: "ACME Updated"}], {context: {tz: "Asia/Jakarta"}})
8787
expect(res.jsonrpc).toBe("2.0");
8888
} else {
8989
expect(true).toBe(false);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@terrakernel/odxproxy-client-js",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "Official JavaScript/TypeScript client for ODXProxy",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export const remove = <T = any>( model: string, params: any[], keyword: OdxClien
202202
* @param {string} [id] - Optional request ID; if not provided, a ULID will be generated.
203203
* @returns {Promise<OdxServerResponse & {result?: T}>} Promise resolving to the Odoo server response indicating update result.
204204
*/
205-
export const update = <T = any>( model: string, params: any[], keyword: OdxClientKeywordRequest, id?: string): Promise<OdxServerResponse & {result?: T}> => {
205+
export const write = <T = any>( model: string, params: any[], keyword: OdxClientKeywordRequest, id?: string): Promise<OdxServerResponse & {result?: T}> => {
206206
const paramsCopy = [...params];
207207
const kCopy = {...keyword};
208208
for (const key of ["sort", "limit", "offset", "fields"]) {
@@ -220,6 +220,12 @@ export const update = <T = any>( model: string, params: any[], keyword: OdxClien
220220
}
221221

222222

223+
/**
224+
* @deprecated Use {@link write} instead.
225+
*/
226+
export const update = write
227+
228+
223229
/**
224230
* Calls an arbitrary method on the specified Odoo model.
225231
* @template T

0 commit comments

Comments
 (0)