@openfn/language-odoo 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/LICENSE.LESSER +165 -0
- package/README.md +32 -0
- package/ast.json +688 -0
- package/configuration-schema.json +59 -0
- package/dist/index.cjs +188 -0
- package/dist/index.js +161 -0
- package/package.json +48 -0
- package/types/Adaptor.d.ts +64 -0
- package/types/index.d.ts +3 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"properties": {
|
|
4
|
+
"baseUrl": {
|
|
5
|
+
"title": "Base URL",
|
|
6
|
+
"anyOf": [
|
|
7
|
+
{
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "null"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"description": "The base URL (http://www.example.com)",
|
|
15
|
+
"format": "uri",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"default": "http://localhost",
|
|
18
|
+
"examples": [
|
|
19
|
+
"https://dev.newlogic-demo.com"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"username": {
|
|
23
|
+
"title": "Username",
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Username",
|
|
26
|
+
"default": "admin",
|
|
27
|
+
"examples": [
|
|
28
|
+
"test@openfn.org"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"password": {
|
|
32
|
+
"title": "Password",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Password",
|
|
35
|
+
"default": "admin",
|
|
36
|
+
"writeOnly": true,
|
|
37
|
+
"examples": [
|
|
38
|
+
"@some(!)Str0ngp4ss0w0rd"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"database": {
|
|
42
|
+
"title": "Database Name",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"default": "devel",
|
|
45
|
+
"description": "Database Name",
|
|
46
|
+
"examples": [
|
|
47
|
+
"devel"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": true,
|
|
53
|
+
"required": [
|
|
54
|
+
"password",
|
|
55
|
+
"username",
|
|
56
|
+
"database",
|
|
57
|
+
"baseUrl"
|
|
58
|
+
]
|
|
59
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// src/index.js
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
__export(src_exports, {
|
|
28
|
+
create: () => create,
|
|
29
|
+
dataPath: () => import_language_common2.dataPath,
|
|
30
|
+
dataValue: () => import_language_common2.dataValue,
|
|
31
|
+
dateFns: () => import_language_common2.dateFns,
|
|
32
|
+
default: () => src_default,
|
|
33
|
+
deleteRecord: () => deleteRecord,
|
|
34
|
+
each: () => import_language_common2.each,
|
|
35
|
+
execute: () => execute,
|
|
36
|
+
field: () => import_language_common2.field,
|
|
37
|
+
fields: () => import_language_common2.fields,
|
|
38
|
+
fn: () => import_language_common2.fn,
|
|
39
|
+
http: () => import_language_common2.http,
|
|
40
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
41
|
+
merge: () => import_language_common2.merge,
|
|
42
|
+
read: () => read,
|
|
43
|
+
setMockClient: () => setMockClient,
|
|
44
|
+
sourceValue: () => import_language_common2.sourceValue,
|
|
45
|
+
update: () => update
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(src_exports);
|
|
48
|
+
|
|
49
|
+
// src/Adaptor.js
|
|
50
|
+
var Adaptor_exports = {};
|
|
51
|
+
__export(Adaptor_exports, {
|
|
52
|
+
create: () => create,
|
|
53
|
+
dataPath: () => import_language_common2.dataPath,
|
|
54
|
+
dataValue: () => import_language_common2.dataValue,
|
|
55
|
+
dateFns: () => import_language_common2.dateFns,
|
|
56
|
+
deleteRecord: () => deleteRecord,
|
|
57
|
+
each: () => import_language_common2.each,
|
|
58
|
+
execute: () => execute,
|
|
59
|
+
field: () => import_language_common2.field,
|
|
60
|
+
fields: () => import_language_common2.fields,
|
|
61
|
+
fn: () => import_language_common2.fn,
|
|
62
|
+
http: () => import_language_common2.http,
|
|
63
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
64
|
+
merge: () => import_language_common2.merge,
|
|
65
|
+
read: () => read,
|
|
66
|
+
setMockClient: () => setMockClient,
|
|
67
|
+
sourceValue: () => import_language_common2.sourceValue,
|
|
68
|
+
update: () => update
|
|
69
|
+
});
|
|
70
|
+
var import_language_common = require("@openfn/language-common");
|
|
71
|
+
var import_util = require("@openfn/language-common/util");
|
|
72
|
+
var import_odoo_await = __toESM(require("odoo-await"), 1);
|
|
73
|
+
var import_language_common2 = require("@openfn/language-common");
|
|
74
|
+
var odooConn = null;
|
|
75
|
+
function execute(...operations) {
|
|
76
|
+
const initialState = {
|
|
77
|
+
references: [],
|
|
78
|
+
data: null
|
|
79
|
+
};
|
|
80
|
+
return (state) => {
|
|
81
|
+
return (0, import_language_common.execute)(login, ...operations)({ ...initialState, ...state });
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function setMockClient(mock) {
|
|
85
|
+
odooConn = mock;
|
|
86
|
+
}
|
|
87
|
+
async function login(state) {
|
|
88
|
+
const { baseUrl, username, password, database } = state.configuration;
|
|
89
|
+
odooConn = new import_odoo_await.default({
|
|
90
|
+
baseUrl,
|
|
91
|
+
db: database,
|
|
92
|
+
username,
|
|
93
|
+
password
|
|
94
|
+
});
|
|
95
|
+
try {
|
|
96
|
+
await odooConn.connect();
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.log(`\u2717 Error: ${err}`);
|
|
99
|
+
odooConn = null;
|
|
100
|
+
}
|
|
101
|
+
return state;
|
|
102
|
+
}
|
|
103
|
+
function create(model, data, options) {
|
|
104
|
+
return async (state) => {
|
|
105
|
+
const [resolvedModel, resolvedData, resolvedOptions] = (0, import_util.expandReferences)(
|
|
106
|
+
state,
|
|
107
|
+
model,
|
|
108
|
+
data,
|
|
109
|
+
options
|
|
110
|
+
);
|
|
111
|
+
console.log(resolvedModel, resolvedData, resolvedOptions);
|
|
112
|
+
const response = await odooConn.create(
|
|
113
|
+
resolvedModel,
|
|
114
|
+
resolvedData,
|
|
115
|
+
resolvedOptions.externalId
|
|
116
|
+
);
|
|
117
|
+
return (0, import_language_common.composeNextState)(state, response);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function read(model, recordId, fields2 = []) {
|
|
121
|
+
return async (state) => {
|
|
122
|
+
const [resolvedModel, resolvedRecordId, resolvedFields] = (0, import_util.expandReferences)(
|
|
123
|
+
state,
|
|
124
|
+
model,
|
|
125
|
+
recordId,
|
|
126
|
+
fields2
|
|
127
|
+
);
|
|
128
|
+
console.log(resolvedModel, resolvedRecordId, resolvedFields);
|
|
129
|
+
const response = await odooConn.read(
|
|
130
|
+
resolvedModel,
|
|
131
|
+
resolvedRecordId,
|
|
132
|
+
resolvedFields
|
|
133
|
+
);
|
|
134
|
+
return (0, import_language_common.composeNextState)(state, response);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function update(model, recordId, data) {
|
|
138
|
+
return async (state) => {
|
|
139
|
+
const [resolvedModel, resolvedRecordId, resolvedData] = (0, import_util.expandReferences)(
|
|
140
|
+
state,
|
|
141
|
+
model,
|
|
142
|
+
recordId,
|
|
143
|
+
data
|
|
144
|
+
);
|
|
145
|
+
console.log(resolvedModel, resolvedRecordId, resolvedData);
|
|
146
|
+
const response = await odooConn.update(
|
|
147
|
+
resolvedModel,
|
|
148
|
+
resolvedRecordId,
|
|
149
|
+
resolvedData
|
|
150
|
+
);
|
|
151
|
+
return (0, import_language_common.composeNextState)(state, response);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function deleteRecord(model, recordId) {
|
|
155
|
+
return async (state) => {
|
|
156
|
+
const [resolvedModel, resolvedRecordId] = (0, import_util.expandReferences)(
|
|
157
|
+
state,
|
|
158
|
+
model,
|
|
159
|
+
recordId
|
|
160
|
+
);
|
|
161
|
+
console.log(resolvedModel, resolvedRecordId);
|
|
162
|
+
const response = await odooConn.delete(resolvedModel, resolvedRecordId);
|
|
163
|
+
return (0, import_language_common.composeNextState)(state, response);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/index.js
|
|
168
|
+
var src_default = Adaptor_exports;
|
|
169
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
170
|
+
0 && (module.exports = {
|
|
171
|
+
create,
|
|
172
|
+
dataPath,
|
|
173
|
+
dataValue,
|
|
174
|
+
dateFns,
|
|
175
|
+
deleteRecord,
|
|
176
|
+
each,
|
|
177
|
+
execute,
|
|
178
|
+
field,
|
|
179
|
+
fields,
|
|
180
|
+
fn,
|
|
181
|
+
http,
|
|
182
|
+
lastReferenceValue,
|
|
183
|
+
merge,
|
|
184
|
+
read,
|
|
185
|
+
setMockClient,
|
|
186
|
+
sourceValue,
|
|
187
|
+
update
|
|
188
|
+
});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/Adaptor.js
|
|
8
|
+
var Adaptor_exports = {};
|
|
9
|
+
__export(Adaptor_exports, {
|
|
10
|
+
create: () => create,
|
|
11
|
+
dataPath: () => dataPath,
|
|
12
|
+
dataValue: () => dataValue,
|
|
13
|
+
dateFns: () => dateFns,
|
|
14
|
+
deleteRecord: () => deleteRecord,
|
|
15
|
+
each: () => each,
|
|
16
|
+
execute: () => execute,
|
|
17
|
+
field: () => field,
|
|
18
|
+
fields: () => fields,
|
|
19
|
+
fn: () => fn,
|
|
20
|
+
http: () => http,
|
|
21
|
+
lastReferenceValue: () => lastReferenceValue,
|
|
22
|
+
merge: () => merge,
|
|
23
|
+
read: () => read,
|
|
24
|
+
setMockClient: () => setMockClient,
|
|
25
|
+
sourceValue: () => sourceValue,
|
|
26
|
+
update: () => update
|
|
27
|
+
});
|
|
28
|
+
import {
|
|
29
|
+
execute as commonExecute,
|
|
30
|
+
composeNextState
|
|
31
|
+
} from "@openfn/language-common";
|
|
32
|
+
import { expandReferences } from "@openfn/language-common/util";
|
|
33
|
+
import Odoo from "odoo-await";
|
|
34
|
+
import {
|
|
35
|
+
dataPath,
|
|
36
|
+
dataValue,
|
|
37
|
+
dateFns,
|
|
38
|
+
each,
|
|
39
|
+
field,
|
|
40
|
+
fields,
|
|
41
|
+
fn,
|
|
42
|
+
http,
|
|
43
|
+
lastReferenceValue,
|
|
44
|
+
merge,
|
|
45
|
+
sourceValue
|
|
46
|
+
} from "@openfn/language-common";
|
|
47
|
+
var odooConn = null;
|
|
48
|
+
function execute(...operations) {
|
|
49
|
+
const initialState = {
|
|
50
|
+
references: [],
|
|
51
|
+
data: null
|
|
52
|
+
};
|
|
53
|
+
return (state) => {
|
|
54
|
+
return commonExecute(login, ...operations)({ ...initialState, ...state });
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function setMockClient(mock) {
|
|
58
|
+
odooConn = mock;
|
|
59
|
+
}
|
|
60
|
+
async function login(state) {
|
|
61
|
+
const { baseUrl, username, password, database } = state.configuration;
|
|
62
|
+
odooConn = new Odoo({
|
|
63
|
+
baseUrl,
|
|
64
|
+
db: database,
|
|
65
|
+
username,
|
|
66
|
+
password
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
await odooConn.connect();
|
|
70
|
+
} catch (err) {
|
|
71
|
+
console.log(`\u2717 Error: ${err}`);
|
|
72
|
+
odooConn = null;
|
|
73
|
+
}
|
|
74
|
+
return state;
|
|
75
|
+
}
|
|
76
|
+
function create(model, data, options) {
|
|
77
|
+
return async (state) => {
|
|
78
|
+
const [resolvedModel, resolvedData, resolvedOptions] = expandReferences(
|
|
79
|
+
state,
|
|
80
|
+
model,
|
|
81
|
+
data,
|
|
82
|
+
options
|
|
83
|
+
);
|
|
84
|
+
console.log(resolvedModel, resolvedData, resolvedOptions);
|
|
85
|
+
const response = await odooConn.create(
|
|
86
|
+
resolvedModel,
|
|
87
|
+
resolvedData,
|
|
88
|
+
resolvedOptions.externalId
|
|
89
|
+
);
|
|
90
|
+
return composeNextState(state, response);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function read(model, recordId, fields2 = []) {
|
|
94
|
+
return async (state) => {
|
|
95
|
+
const [resolvedModel, resolvedRecordId, resolvedFields] = expandReferences(
|
|
96
|
+
state,
|
|
97
|
+
model,
|
|
98
|
+
recordId,
|
|
99
|
+
fields2
|
|
100
|
+
);
|
|
101
|
+
console.log(resolvedModel, resolvedRecordId, resolvedFields);
|
|
102
|
+
const response = await odooConn.read(
|
|
103
|
+
resolvedModel,
|
|
104
|
+
resolvedRecordId,
|
|
105
|
+
resolvedFields
|
|
106
|
+
);
|
|
107
|
+
return composeNextState(state, response);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function update(model, recordId, data) {
|
|
111
|
+
return async (state) => {
|
|
112
|
+
const [resolvedModel, resolvedRecordId, resolvedData] = expandReferences(
|
|
113
|
+
state,
|
|
114
|
+
model,
|
|
115
|
+
recordId,
|
|
116
|
+
data
|
|
117
|
+
);
|
|
118
|
+
console.log(resolvedModel, resolvedRecordId, resolvedData);
|
|
119
|
+
const response = await odooConn.update(
|
|
120
|
+
resolvedModel,
|
|
121
|
+
resolvedRecordId,
|
|
122
|
+
resolvedData
|
|
123
|
+
);
|
|
124
|
+
return composeNextState(state, response);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function deleteRecord(model, recordId) {
|
|
128
|
+
return async (state) => {
|
|
129
|
+
const [resolvedModel, resolvedRecordId] = expandReferences(
|
|
130
|
+
state,
|
|
131
|
+
model,
|
|
132
|
+
recordId
|
|
133
|
+
);
|
|
134
|
+
console.log(resolvedModel, resolvedRecordId);
|
|
135
|
+
const response = await odooConn.delete(resolvedModel, resolvedRecordId);
|
|
136
|
+
return composeNextState(state, response);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/index.js
|
|
141
|
+
var src_default = Adaptor_exports;
|
|
142
|
+
export {
|
|
143
|
+
create,
|
|
144
|
+
dataPath,
|
|
145
|
+
dataValue,
|
|
146
|
+
dateFns,
|
|
147
|
+
src_default as default,
|
|
148
|
+
deleteRecord,
|
|
149
|
+
each,
|
|
150
|
+
execute,
|
|
151
|
+
field,
|
|
152
|
+
fields,
|
|
153
|
+
fn,
|
|
154
|
+
http,
|
|
155
|
+
lastReferenceValue,
|
|
156
|
+
merge,
|
|
157
|
+
read,
|
|
158
|
+
setMockClient,
|
|
159
|
+
sourceValue,
|
|
160
|
+
update
|
|
161
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openfn/language-odoo",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OpenFn odoo adaptor",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"require": "./dist/index.cjs"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"author": "Open Function Group",
|
|
14
|
+
"license": "LGPLv3",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/",
|
|
17
|
+
"types/",
|
|
18
|
+
"ast.json",
|
|
19
|
+
"configuration-schema.json"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"odoo-await": "^3.4.1",
|
|
23
|
+
"@openfn/language-common": "2.3.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"assertion-error": "2.0.0",
|
|
27
|
+
"chai": "4.3.6",
|
|
28
|
+
"deep-eql": "4.1.1",
|
|
29
|
+
"esno": "^0.16.3",
|
|
30
|
+
"mocha": "9.2.2",
|
|
31
|
+
"rimraf": "3.0.2",
|
|
32
|
+
"undici": "^5.22.1"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/openfn/adaptors.git"
|
|
37
|
+
},
|
|
38
|
+
"types": "types/index.d.ts",
|
|
39
|
+
"main": "dist/index.cjs",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "pnpm clean && build-adaptor odoo",
|
|
42
|
+
"test": "mocha --experimental-specifier-resolution=node --no-warnings",
|
|
43
|
+
"test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
|
|
44
|
+
"clean": "rimraf dist types docs",
|
|
45
|
+
"pack": "pnpm pack --pack-destination ../../dist",
|
|
46
|
+
"lint": "eslint src"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a sequence of operations.
|
|
3
|
+
* Wraps `language-common/execute` to make working with this API easier.
|
|
4
|
+
* @example
|
|
5
|
+
* execute(
|
|
6
|
+
* create('foo'),
|
|
7
|
+
* delete('bar')
|
|
8
|
+
* )(state)
|
|
9
|
+
* @private
|
|
10
|
+
* @param {Operations} operations - Operations to be performed.
|
|
11
|
+
* @returns {Operation}
|
|
12
|
+
*/
|
|
13
|
+
export function execute(...operations: Operations): Operation;
|
|
14
|
+
export function setMockClient(mock: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* Create a record in Odoo
|
|
17
|
+
* @public
|
|
18
|
+
* @example
|
|
19
|
+
* create("res.partner", { name: "Kool Keith" }, {externalId: 23});
|
|
20
|
+
* @function
|
|
21
|
+
* @param {string} model - The specific record model i.e. "res.partner"
|
|
22
|
+
* @param {object} data - The data to be created in JSON.
|
|
23
|
+
* @param {object} options - Optional external ID for the record.
|
|
24
|
+
* @returns {Operation}
|
|
25
|
+
*/
|
|
26
|
+
export function create(model: string, data: object, options: object): Operation;
|
|
27
|
+
/**
|
|
28
|
+
* Get a record from Odoo. Returns all fields unless a field list is provided as a third argument
|
|
29
|
+
* @public
|
|
30
|
+
* @example <caption>Download records with select fields</caption>
|
|
31
|
+
* read("res.partner", [1] , [name]);
|
|
32
|
+
* @example <caption>Download a single record with all fields</caption>
|
|
33
|
+
* read("res.partner", $.recordIds);
|
|
34
|
+
* @function
|
|
35
|
+
* @param {string} model - The specific record model from i.e. "res.partner"
|
|
36
|
+
* @param {number} recordId - An array of record IDs to read.
|
|
37
|
+
* @param {string} fields - An optional array of fields to read from the record.
|
|
38
|
+
* @returns {Operation}
|
|
39
|
+
*/
|
|
40
|
+
export function read(model: string, recordId: number, fields?: string): Operation;
|
|
41
|
+
/**
|
|
42
|
+
* Update a record in Odoo
|
|
43
|
+
* @public
|
|
44
|
+
* @example
|
|
45
|
+
* update("res.partner", 54 , {name: 'Jane Doe'});
|
|
46
|
+
* @function
|
|
47
|
+
* @param {string} model - The specific record model i.e. "res.partner"
|
|
48
|
+
* @param {number} recordId - The specific recordId to be updated.
|
|
49
|
+
* @param {object} data - The data to be updated in JSON.
|
|
50
|
+
* @returns {Operation}
|
|
51
|
+
*/
|
|
52
|
+
export function update(model: string, recordId: number, data: object): Operation;
|
|
53
|
+
/**
|
|
54
|
+
* Delete a record from Odoo
|
|
55
|
+
* @public
|
|
56
|
+
* @example
|
|
57
|
+
* deleteRecord("res.partner", 54 );
|
|
58
|
+
* @function
|
|
59
|
+
* @param {string} model - The specific record model i.e. "res.partner"
|
|
60
|
+
* @param {number} recordId - The specific recordId to be deleted.
|
|
61
|
+
* @returns {Operation}
|
|
62
|
+
*/
|
|
63
|
+
export function deleteRecord(model: string, recordId: number): Operation;
|
|
64
|
+
export { dataPath, dataValue, dateFns, each, field, fields, fn, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|
package/types/index.d.ts
ADDED