@marcfargas/odoo-client 0.0.1 → 0.1.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.
Files changed (76) hide show
  1. package/LICENSE +165 -165
  2. package/README.md +115 -3
  3. package/dist/client/config.d.ts +49 -0
  4. package/dist/client/config.d.ts.map +1 -0
  5. package/dist/client/config.js +75 -0
  6. package/dist/client/config.js.map +1 -0
  7. package/dist/client/index.d.ts +3 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +10 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/client/odoo-client.d.ts +188 -0
  12. package/dist/client/odoo-client.d.ts.map +1 -0
  13. package/dist/client/odoo-client.js +255 -0
  14. package/dist/client/odoo-client.js.map +1 -0
  15. package/dist/index.d.ts +6 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +27 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/rpc/index.d.ts +2 -0
  20. package/dist/rpc/index.d.ts.map +1 -0
  21. package/dist/rpc/index.js +7 -0
  22. package/dist/rpc/index.js.map +1 -0
  23. package/dist/rpc/transport.d.ts +77 -0
  24. package/dist/rpc/transport.d.ts.map +1 -0
  25. package/dist/rpc/transport.js +207 -0
  26. package/dist/rpc/transport.js.map +1 -0
  27. package/dist/rpc/types.d.ts +25 -0
  28. package/dist/rpc/types.d.ts.map +1 -0
  29. package/dist/rpc/types.js +6 -0
  30. package/dist/rpc/types.js.map +1 -0
  31. package/dist/safety/index.d.ts +68 -0
  32. package/dist/safety/index.d.ts.map +1 -0
  33. package/dist/safety/index.js +86 -0
  34. package/dist/safety/index.js.map +1 -0
  35. package/dist/services/index.d.ts +22 -0
  36. package/dist/services/index.d.ts.map +1 -0
  37. package/dist/services/index.js +38 -0
  38. package/dist/services/index.js.map +1 -0
  39. package/dist/services/mail/functions.d.ts +69 -0
  40. package/dist/services/mail/functions.d.ts.map +1 -0
  41. package/dist/services/mail/functions.js +124 -0
  42. package/dist/services/mail/functions.js.map +1 -0
  43. package/dist/services/mail/index.d.ts +4 -0
  44. package/dist/services/mail/index.d.ts.map +1 -0
  45. package/dist/services/mail/index.js +10 -0
  46. package/dist/services/mail/index.js.map +1 -0
  47. package/dist/services/mail/mail-service.d.ts +57 -0
  48. package/dist/services/mail/mail-service.d.ts.map +1 -0
  49. package/dist/services/mail/mail-service.js +66 -0
  50. package/dist/services/mail/mail-service.js.map +1 -0
  51. package/dist/services/mail/types.d.ts +23 -0
  52. package/dist/services/mail/types.d.ts.map +1 -0
  53. package/dist/services/mail/types.js +6 -0
  54. package/dist/services/mail/types.js.map +1 -0
  55. package/dist/services/modules/index.d.ts +2 -0
  56. package/dist/services/modules/index.d.ts.map +1 -0
  57. package/dist/services/modules/index.js +6 -0
  58. package/dist/services/modules/index.js.map +1 -0
  59. package/dist/services/modules/module-manager.d.ts +136 -0
  60. package/dist/services/modules/module-manager.d.ts.map +1 -0
  61. package/dist/services/modules/module-manager.js +255 -0
  62. package/dist/services/modules/module-manager.js.map +1 -0
  63. package/dist/types/errors.d.ts +122 -0
  64. package/dist/types/errors.d.ts.map +1 -0
  65. package/dist/types/errors.js +195 -0
  66. package/dist/types/errors.js.map +1 -0
  67. package/dist/types/index.d.ts +3 -0
  68. package/dist/types/index.d.ts.map +1 -0
  69. package/dist/types/index.js +31 -0
  70. package/dist/types/index.js.map +1 -0
  71. package/dist/types/properties.d.ts +246 -0
  72. package/dist/types/properties.d.ts.map +1 -0
  73. package/dist/types/properties.js +56 -0
  74. package/dist/types/properties.js.map +1 -0
  75. package/package.json +28 -6
  76. package/index.js +0 -3
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * Mail / Chatter standalone functions for Odoo
4
+ *
5
+ * Two functions, two intents — no confusion possible:
6
+ * - postInternalNote() → staff-only note (subtype: mail.mt_note, is_internal: true)
7
+ * - postOpenMessage() → public message visible to ALL followers (subtype: mail.mt_comment)
8
+ *
9
+ * Body is ALWAYS HTML. Plain text is auto-wrapped in <p> tags.
10
+ * Empty body throws immediately — Odoo silently accepts it but it's always a bug.
11
+ *
12
+ * Uses direct mail.message create (NOT message_post) because message_post
13
+ * has RPC compatibility issues with external JSON-RPC clients — the body
14
+ * parameter may not be passed correctly through execute_kw.
15
+ *
16
+ * @see https://github.com/odoo/odoo/blob/17.0/addons/mail/models/mail_message.py
17
+ * @see https://github.com/odoo/odoo/blob/17.0/addons/mail/models/mail_thread.py
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.ensureHtmlBody = ensureHtmlBody;
21
+ exports.postInternalNote = postInternalNote;
22
+ exports.postOpenMessage = postOpenMessage;
23
+ const errors_1 = require("../../types/errors");
24
+ /**
25
+ * Subtype IDs as defined by Odoo's mail module data.
26
+ *
27
+ * These are stable numeric IDs loaded from XML data:
28
+ * - mail.mt_comment (id=1) → Discussions, public, visible to followers
29
+ * - mail.mt_note (id=2) → Note, internal, staff only
30
+ *
31
+ * @see https://github.com/odoo/odoo/blob/17.0/addons/mail/data/mail_message_subtype_data.xml
32
+ */
33
+ const SUBTYPE_COMMENT = 1;
34
+ const SUBTYPE_NOTE = 2;
35
+ /**
36
+ * Ensure body is valid HTML. Throws on empty/blank input.
37
+ *
38
+ * Rules:
39
+ * - Empty or whitespace-only → throws OdooValidationError
40
+ * - Already has HTML tags → used as-is
41
+ * - Plain text → wrapped in <p>...</p>
42
+ */
43
+ function ensureHtmlBody(body) {
44
+ if (!body || !body.trim()) {
45
+ throw new errors_1.OdooValidationError('Message body must not be empty. ' +
46
+ "Provide HTML (e.g. '<p>Called the customer, they want a callback.</p>') " +
47
+ 'or plain text (auto-wrapped in <p> tags).');
48
+ }
49
+ const trimmed = body.trim();
50
+ // If it already looks like HTML (starts with a tag), use as-is
51
+ if (trimmed.startsWith('<')) {
52
+ return trimmed;
53
+ }
54
+ // Plain text → wrap in <p>
55
+ return `<p>${trimmed}</p>`;
56
+ }
57
+ /**
58
+ * Build the mail.message values dict from common parameters.
59
+ */
60
+ function buildMessageValues(model, resId, body, subtypeId, isInternal, options) {
61
+ const htmlBody = ensureHtmlBody(body);
62
+ const values = {
63
+ model,
64
+ res_id: resId,
65
+ body: htmlBody,
66
+ message_type: 'comment',
67
+ subtype_id: subtypeId,
68
+ is_internal: isInternal,
69
+ };
70
+ if (options?.partnerIds?.length) {
71
+ values.partner_ids = [[6, 0, options.partnerIds]];
72
+ }
73
+ if (options?.attachmentIds?.length) {
74
+ values.attachment_ids = [[6, 0, options.attachmentIds]];
75
+ }
76
+ return values;
77
+ }
78
+ /**
79
+ * Post an internal note on a record's chatter.
80
+ *
81
+ * Internal notes are visible ONLY to internal (staff) users.
82
+ * Portal users and public visitors will NOT see them.
83
+ * No email notification is sent to followers.
84
+ *
85
+ * The target model MUST inherit from mail.thread (most business models do:
86
+ * res.partner, crm.lead, sale.order, account.move, project.task, etc.)
87
+ *
88
+ * @param client - Authenticated OdooClient instance
89
+ * @param model - Odoo model name (e.g. 'res.partner', 'crm.lead')
90
+ * @param resId - ID of the record to post on
91
+ * @param body - Message content. HTML string or plain text (auto-wrapped in <p>).
92
+ * Examples:
93
+ * '<p>Customer called, wants a <b>callback</b> tomorrow.</p>'
94
+ * 'Spoke with warehouse, stock arrives Friday.'
95
+ * @param options - Optional: partnerIds to @mention, attachmentIds
96
+ * @returns Created mail.message ID
97
+ */
98
+ async function postInternalNote(client, model, resId, body, options) {
99
+ const values = buildMessageValues(model, resId, body, SUBTYPE_NOTE, true, options);
100
+ return client.create('mail.message', values);
101
+ }
102
+ /**
103
+ * Post an open (public) message on a record's chatter.
104
+ *
105
+ * Open messages are visible to ALL followers — including portal users
106
+ * and external partners. Email notifications ARE sent to followers.
107
+ *
108
+ * The target model MUST inherit from mail.thread.
109
+ *
110
+ * @param client - Authenticated OdooClient instance
111
+ * @param model - Odoo model name (e.g. 'res.partner', 'crm.lead')
112
+ * @param resId - ID of the record to post on
113
+ * @param body - Message content. HTML string or plain text (auto-wrapped in <p>).
114
+ * Examples:
115
+ * '<p>Your order has been shipped. Tracking: <a href="...">XYZ123</a></p>'
116
+ * 'We have received your payment. Thank you!'
117
+ * @param options - Optional: partnerIds to @mention, attachmentIds
118
+ * @returns Created mail.message ID
119
+ */
120
+ async function postOpenMessage(client, model, resId, body, options) {
121
+ const values = buildMessageValues(model, resId, body, SUBTYPE_COMMENT, false, options);
122
+ return client.create('mail.message', values);
123
+ }
124
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/services/mail/functions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AA0BH,wCAkBC;AAsDD,4CASC;AAoBD,0CASC;AArID,+CAAyD;AAGzD;;;;;;;;GAQG;AACH,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,4BAAmB,CAC3B,kCAAkC;YAChC,0EAA0E;YAC1E,2CAA2C,CAC9C,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAE5B,+DAA+D;IAC/D,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,2BAA2B;IAC3B,OAAO,MAAM,OAAO,MAAM,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CACzB,KAAa,EACb,KAAa,EACb,IAAY,EACZ,SAAiB,EACjB,UAAmB,EACnB,OAA4B;IAE5B,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAwB;QAClC,KAAK;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,SAAS;QACvB,UAAU,EAAE,SAAS;QACrB,WAAW,EAAE,UAAU;KACxB,CAAC;IAEF,IAAI,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAChC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;QACnC,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,gBAAgB,CACpC,MAAkB,EAClB,KAAa,EACb,KAAa,EACb,IAAY,EACZ,OAA4B;IAE5B,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACnF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACI,KAAK,UAAU,eAAe,CACnC,MAAkB,EAClB,KAAa,EACb,KAAa,EACb,IAAY,EACZ,OAA4B;IAE5B,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACvF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { MailService } from './mail-service';
2
+ export { postInternalNote, postOpenMessage, ensureHtmlBody } from './functions';
3
+ export type { PostMessageOptions } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureHtmlBody = exports.postOpenMessage = exports.postInternalNote = exports.MailService = void 0;
4
+ var mail_service_1 = require("./mail-service");
5
+ Object.defineProperty(exports, "MailService", { enumerable: true, get: function () { return mail_service_1.MailService; } });
6
+ var functions_1 = require("./functions");
7
+ Object.defineProperty(exports, "postInternalNote", { enumerable: true, get: function () { return functions_1.postInternalNote; } });
8
+ Object.defineProperty(exports, "postOpenMessage", { enumerable: true, get: function () { return functions_1.postOpenMessage; } });
9
+ Object.defineProperty(exports, "ensureHtmlBody", { enumerable: true, get: function () { return functions_1.ensureHtmlBody; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/mail/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAgF;AAAvE,6GAAA,gBAAgB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,2GAAA,cAAc,OAAA"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Mail service — the typed interface exposed via `client.mail.*`
3
+ *
4
+ * This is the public API shape. Implementation delegates to standalone
5
+ * functions in functions.ts, binding the client reference.
6
+ */
7
+ import type { OdooClient } from '../../client/odoo-client';
8
+ import type { PostMessageOptions } from './types';
9
+ /**
10
+ * Mail service providing chatter operations on Odoo records.
11
+ *
12
+ * Access via `client.mail` — never instantiate directly.
13
+ *
14
+ * Two methods, two intents:
15
+ * - `postInternalNote()` → staff-only note (invisible to portal/public)
16
+ * - `postOpenMessage()` → public message visible to ALL followers
17
+ */
18
+ export declare class MailService {
19
+ private client;
20
+ /** @internal */
21
+ constructor(client: OdooClient);
22
+ /**
23
+ * Post an internal note on a record's chatter.
24
+ *
25
+ * Internal notes are visible ONLY to internal (staff) users.
26
+ * No email notification is sent. Use for internal communication
27
+ * that customers/portal users must not see.
28
+ *
29
+ * @param model - Odoo model (must inherit mail.thread)
30
+ * @param resId - Record ID to post on
31
+ * @param body - HTML string or plain text (auto-wrapped in `<p>`).
32
+ * Example: `'<p>Customer called, wants a <b>callback</b>.</p>'`
33
+ * Example: `'Spoke with warehouse — stock arrives Friday.'`
34
+ * Empty body throws OdooValidationError.
35
+ * @param options - Optional: partnerIds to @mention, attachmentIds
36
+ * @returns Created mail.message ID
37
+ */
38
+ postInternalNote(model: string, resId: number, body: string, options?: PostMessageOptions): Promise<number>;
39
+ /**
40
+ * Post an open (public) message on a record's chatter.
41
+ *
42
+ * Open messages are visible to ALL followers — including portal users
43
+ * and external partners. Email notifications ARE sent to followers.
44
+ * Use for customer-facing communication and public status updates.
45
+ *
46
+ * @param model - Odoo model (must inherit mail.thread)
47
+ * @param resId - Record ID to post on
48
+ * @param body - HTML string or plain text (auto-wrapped in `<p>`).
49
+ * Example: `'<p>Your order has been shipped.</p>'`
50
+ * Example: `'Payment received. Thank you!'`
51
+ * Empty body throws OdooValidationError.
52
+ * @param options - Optional: partnerIds to @mention, attachmentIds
53
+ * @returns Created mail.message ID
54
+ */
55
+ postOpenMessage(model: string, resId: number, body: string, options?: PostMessageOptions): Promise<number>;
56
+ }
57
+ //# sourceMappingURL=mail-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-service.d.ts","sourceRoot":"","sources":["../../../src/services/mail/mail-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMlD;;;;;;;;GAQG;AACH,qBAAa,WAAW;IAEV,OAAO,CAAC,MAAM;IAD1B,gBAAgB;gBACI,MAAM,EAAE,UAAU;IAEtC;;;;;;;;;;;;;;;OAeG;IACG,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC;CAGnB"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * Mail service — the typed interface exposed via `client.mail.*`
4
+ *
5
+ * This is the public API shape. Implementation delegates to standalone
6
+ * functions in functions.ts, binding the client reference.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MailService = void 0;
10
+ const functions_1 = require("./functions");
11
+ /**
12
+ * Mail service providing chatter operations on Odoo records.
13
+ *
14
+ * Access via `client.mail` — never instantiate directly.
15
+ *
16
+ * Two methods, two intents:
17
+ * - `postInternalNote()` → staff-only note (invisible to portal/public)
18
+ * - `postOpenMessage()` → public message visible to ALL followers
19
+ */
20
+ class MailService {
21
+ client;
22
+ /** @internal */
23
+ constructor(client) {
24
+ this.client = client;
25
+ }
26
+ /**
27
+ * Post an internal note on a record's chatter.
28
+ *
29
+ * Internal notes are visible ONLY to internal (staff) users.
30
+ * No email notification is sent. Use for internal communication
31
+ * that customers/portal users must not see.
32
+ *
33
+ * @param model - Odoo model (must inherit mail.thread)
34
+ * @param resId - Record ID to post on
35
+ * @param body - HTML string or plain text (auto-wrapped in `<p>`).
36
+ * Example: `'<p>Customer called, wants a <b>callback</b>.</p>'`
37
+ * Example: `'Spoke with warehouse — stock arrives Friday.'`
38
+ * Empty body throws OdooValidationError.
39
+ * @param options - Optional: partnerIds to @mention, attachmentIds
40
+ * @returns Created mail.message ID
41
+ */
42
+ async postInternalNote(model, resId, body, options) {
43
+ return (0, functions_1.postInternalNote)(this.client, model, resId, body, options);
44
+ }
45
+ /**
46
+ * Post an open (public) message on a record's chatter.
47
+ *
48
+ * Open messages are visible to ALL followers — including portal users
49
+ * and external partners. Email notifications ARE sent to followers.
50
+ * Use for customer-facing communication and public status updates.
51
+ *
52
+ * @param model - Odoo model (must inherit mail.thread)
53
+ * @param resId - Record ID to post on
54
+ * @param body - HTML string or plain text (auto-wrapped in `<p>`).
55
+ * Example: `'<p>Your order has been shipped.</p>'`
56
+ * Example: `'Payment received. Thank you!'`
57
+ * Empty body throws OdooValidationError.
58
+ * @param options - Optional: partnerIds to @mention, attachmentIds
59
+ * @returns Created mail.message ID
60
+ */
61
+ async postOpenMessage(model, resId, body, options) {
62
+ return (0, functions_1.postOpenMessage)(this.client, model, resId, body, options);
63
+ }
64
+ }
65
+ exports.MailService = MailService;
66
+ //# sourceMappingURL=mail-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-service.js","sourceRoot":"","sources":["../../../src/services/mail/mail-service.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,2CAGqB;AAErB;;;;;;;;GAQG;AACH,MAAa,WAAW;IAEF;IADpB,gBAAgB;IAChB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,gBAAgB,CACpB,KAAa,EACb,KAAa,EACb,IAAY,EACZ,OAA4B;QAE5B,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,eAAe,CACnB,KAAa,EACb,KAAa,EACb,IAAY,EACZ,OAA4B;QAE5B,OAAO,IAAA,2BAAgB,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;CACF;AArDD,kCAqDC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Types for mail / chatter services.
3
+ */
4
+ /**
5
+ * Options for posting a message or note to a record's chatter.
6
+ */
7
+ export interface PostMessageOptions {
8
+ /**
9
+ * Partner IDs to @mention. Mentioned partners receive a notification.
10
+ * These are res.partner IDs (not res.users IDs).
11
+ *
12
+ * To find a user's partner ID:
13
+ * const [user] = await client.read('res.users', userId, ['partner_id']);
14
+ * const partnerId = user.partner_id[0];
15
+ */
16
+ partnerIds?: number[];
17
+ /**
18
+ * Pre-created ir.attachment IDs to attach to the message.
19
+ * Attachments must be created first via client.create('ir.attachment', {...}).
20
+ */
21
+ attachmentIds?: number[];
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/mail/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Types for mail / chatter services.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/mail/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,2 @@
1
+ export { ModuleManager, type ModuleInfo, type ModuleListOptions } from './module-manager';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModuleManager = void 0;
4
+ var module_manager_1 = require("./module-manager");
5
+ Object.defineProperty(exports, "ModuleManager", { enumerable: true, get: function () { return module_manager_1.ModuleManager; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/modules/index.ts"],"names":[],"mappings":";;;AAAA,mDAA0F;AAAjF,+GAAA,aAAa,OAAA"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Module manager for installing, uninstalling, and managing Odoo modules
3
+ *
4
+ * Provides methods for managing Odoo addons/modules through the ir.module.module API
5
+ *
6
+ * @see https://github.com/odoo/odoo/blob/17.0/odoo/addons/base/models/ir_module.py
7
+ */
8
+ import { OdooClient } from '../../client/odoo-client';
9
+ export interface ModuleInfo {
10
+ id: number;
11
+ name: string;
12
+ state: 'uninstalled' | 'installed' | 'to install' | 'to upgrade' | 'to remove' | 'uninstallable';
13
+ shortdesc?: string;
14
+ summary?: string;
15
+ description?: string;
16
+ author?: string;
17
+ website?: string;
18
+ installed_version?: string;
19
+ latest_version?: string;
20
+ license?: string;
21
+ application?: boolean;
22
+ category_id?: [number, string];
23
+ }
24
+ export interface ModuleListOptions {
25
+ /** Filter modules by state */
26
+ state?: ModuleInfo['state'];
27
+ /** Filter modules that are applications */
28
+ application?: boolean;
29
+ /** Limit number of results */
30
+ limit?: number;
31
+ /** Offset for pagination */
32
+ offset?: number;
33
+ }
34
+ /**
35
+ * Manager for Odoo module operations
36
+ *
37
+ * Handles installation, uninstallation, upgrades, and listing of Odoo modules.
38
+ */
39
+ export declare class ModuleManager {
40
+ private client;
41
+ constructor(client: OdooClient);
42
+ /**
43
+ * Install a module by name
44
+ *
45
+ * Uses button_immediate_install method from ir.module.module model.
46
+ * This method installs the module and its dependencies immediately.
47
+ *
48
+ * @param moduleName - Technical name of the module (e.g., 'project', 'sale', 'crm')
49
+ * @returns Module info after installation
50
+ *
51
+ * @see https://github.com/odoo/odoo/blob/17.0/odoo/addons/base/models/ir_module.py#L500
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * await moduleManager.installModule('project');
56
+ * ```
57
+ */
58
+ installModule(moduleName: string): Promise<ModuleInfo>;
59
+ /**
60
+ * Uninstall a module by name
61
+ *
62
+ * Uses button_immediate_uninstall method from ir.module.module model.
63
+ * This method uninstalls the module immediately.
64
+ *
65
+ * @param moduleName - Technical name of the module
66
+ * @returns Module info after uninstallation
67
+ *
68
+ * @see https://github.com/odoo/odoo/blob/17.0/odoo/addons/base/models/ir_module.py#L550
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * await moduleManager.uninstallModule('project');
73
+ * ```
74
+ */
75
+ uninstallModule(moduleName: string): Promise<ModuleInfo>;
76
+ /**
77
+ * Upgrade a module to its latest version
78
+ *
79
+ * Uses button_immediate_upgrade method from ir.module.module model.
80
+ *
81
+ * @param moduleName - Technical name of the module
82
+ * @returns Module info after upgrade
83
+ *
84
+ * @see https://github.com/odoo/odoo/blob/17.0/odoo/addons/base/models/ir_module.py#L525
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * await moduleManager.upgradeModule('project');
89
+ * ```
90
+ */
91
+ upgradeModule(moduleName: string): Promise<ModuleInfo>;
92
+ /**
93
+ * List available modules with optional filtering
94
+ *
95
+ * @param options - Filtering and pagination options
96
+ * @returns Array of module information
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * // List all installed modules
101
+ * const installed = await moduleManager.listModules({ state: 'installed' });
102
+ *
103
+ * // List all applications
104
+ * const apps = await moduleManager.listModules({ application: true });
105
+ * ```
106
+ */
107
+ listModules(options?: ModuleListOptions): Promise<ModuleInfo[]>;
108
+ /**
109
+ * Get detailed information about a specific module
110
+ *
111
+ * @param moduleName - Technical name of the module
112
+ * @returns Detailed module information
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * const info = await moduleManager.getModuleInfo('project');
117
+ * console.log(info.description);
118
+ * ```
119
+ */
120
+ getModuleInfo(moduleName: string): Promise<ModuleInfo>;
121
+ /**
122
+ * Check if a module is installed
123
+ *
124
+ * @param moduleName - Technical name of the module
125
+ * @returns True if module is installed
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * if (await moduleManager.isModuleInstalled('project')) {
130
+ * console.log('Project module is installed');
131
+ * }
132
+ * ```
133
+ */
134
+ isModuleInstalled(moduleName: string): Promise<boolean>;
135
+ }
136
+ //# sourceMappingURL=module-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-manager.d.ts","sourceRoot":"","sources":["../../../src/services/modules/module-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAItD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,eAAe,CAAC;IACjG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,UAAU;IAI9B;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA2C5D;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA4C9D;;;;;;;;;;;;;;OAcG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAuC5D;;;;;;;;;;;;;;OAcG;IACG,WAAW,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAgDzE;;;;;;;;;;;OAWG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiC5D;;;;;;;;;;;;OAYG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAc9D"}