@hodeinavarro/odoo-rpc-ts 0.2.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 +21 -0
- package/README.md +401 -0
- package/dist/client.d.ts +184 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +277 -0
- package/dist/client.js.map +1 -0
- package/dist/combinators/retryOnSessionExpired.d.ts +13 -0
- package/dist/combinators/retryOnSessionExpired.d.ts.map +1 -0
- package/dist/combinators/retryOnSessionExpired.js +15 -0
- package/dist/combinators/retryOnSessionExpired.js.map +1 -0
- package/dist/commands.d.ts +91 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +69 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +32 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +60 -0
- package/dist/config.js.map +1 -0
- package/dist/domain.d.ts +30 -0
- package/dist/domain.d.ts.map +1 -0
- package/dist/domain.js +70 -0
- package/dist/domain.js.map +1 -0
- package/dist/errors/auth.d.ts +27 -0
- package/dist/errors/auth.d.ts.map +1 -0
- package/dist/errors/auth.js +8 -0
- package/dist/errors/auth.js.map +1 -0
- package/dist/errors/index.d.ts +30 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +13 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/mapFault.d.ts +31 -0
- package/dist/errors/mapFault.d.ts.map +1 -0
- package/dist/errors/mapFault.js +48 -0
- package/dist/errors/mapFault.js.map +1 -0
- package/dist/errors/protocol.d.ts +22 -0
- package/dist/errors/protocol.d.ts.map +1 -0
- package/dist/errors/protocol.js +9 -0
- package/dist/errors/protocol.js.map +1 -0
- package/dist/errors/schema.d.ts +22 -0
- package/dist/errors/schema.d.ts.map +1 -0
- package/dist/errors/schema.js +14 -0
- package/dist/errors/schema.js.map +1 -0
- package/dist/errors/server.d.ts +109 -0
- package/dist/errors/server.d.ts.map +1 -0
- package/dist/errors/server.js +49 -0
- package/dist/errors/server.js.map +1 -0
- package/dist/errors/session.d.ts +16 -0
- package/dist/errors/session.d.ts.map +1 -0
- package/dist/errors/session.js +11 -0
- package/dist/errors/session.js.map +1 -0
- package/dist/errors/transport.d.ts +42 -0
- package/dist/errors/transport.d.ts.map +1 -0
- package/dist/errors/transport.js +49 -0
- package/dist/errors/transport.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/platform.d.ts +12 -0
- package/dist/internal/platform.d.ts.map +1 -0
- package/dist/internal/platform.js +11 -0
- package/dist/internal/platform.js.map +1 -0
- package/dist/internal/singleFlight.d.ts +29 -0
- package/dist/internal/singleFlight.d.ts.map +1 -0
- package/dist/internal/singleFlight.js +41 -0
- package/dist/internal/singleFlight.js.map +1 -0
- package/dist/profiles.d.ts +179 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +191 -0
- package/dist/profiles.js.map +1 -0
- package/dist/protocol/jsonrpc.d.ts +127 -0
- package/dist/protocol/jsonrpc.d.ts.map +1 -0
- package/dist/protocol/jsonrpc.js +117 -0
- package/dist/protocol/jsonrpc.js.map +1 -0
- package/dist/records/index.d.ts +14 -0
- package/dist/records/index.d.ts.map +1 -0
- package/dist/records/index.js +14 -0
- package/dist/records/index.js.map +1 -0
- package/dist/records/recordModel.d.ts +131 -0
- package/dist/records/recordModel.d.ts.map +1 -0
- package/dist/records/recordModel.js +101 -0
- package/dist/records/recordModel.js.map +1 -0
- package/dist/records/related.d.ts +42 -0
- package/dist/records/related.d.ts.map +1 -0
- package/dist/records/related.js +51 -0
- package/dist/records/related.js.map +1 -0
- package/dist/records/relations.d.ts +66 -0
- package/dist/records/relations.d.ts.map +1 -0
- package/dist/records/relations.js +119 -0
- package/dist/records/relations.js.map +1 -0
- package/dist/records/spec.d.ts +44 -0
- package/dist/records/spec.d.ts.map +1 -0
- package/dist/records/spec.js +63 -0
- package/dist/records/spec.js.map +1 -0
- package/dist/records/typed.d.ts +71 -0
- package/dist/records/typed.d.ts.map +1 -0
- package/dist/records/typed.js +65 -0
- package/dist/records/typed.js.map +1 -0
- package/dist/rpc.d.ts +90 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +113 -0
- package/dist/rpc.js.map +1 -0
- package/dist/services/db.d.ts +128 -0
- package/dist/services/db.d.ts.map +1 -0
- package/dist/services/db.js +132 -0
- package/dist/services/db.js.map +1 -0
- package/dist/services/report.d.ts +48 -0
- package/dist/services/report.d.ts.map +1 -0
- package/dist/services/report.js +103 -0
- package/dist/services/report.js.map +1 -0
- package/dist/session/cookie.d.ts +114 -0
- package/dist/session/cookie.d.ts.map +1 -0
- package/dist/session/cookie.js +231 -0
- package/dist/session/cookie.js.map +1 -0
- package/dist/testing/fakeTransport.d.ts +40 -0
- package/dist/testing/fakeTransport.d.ts.map +1 -0
- package/dist/testing/fakeTransport.js +36 -0
- package/dist/testing/fakeTransport.js.map +1 -0
- package/dist/testing/index.d.ts +9 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +9 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/transport.d.ts +62 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +9 -0
- package/dist/transport.js.map +1 -0
- package/dist/transports/json2.d.ts +41 -0
- package/dist/transports/json2.d.ts.map +1 -0
- package/dist/transports/json2.js +196 -0
- package/dist/transports/json2.js.map +1 -0
- package/dist/transports/jsonrpc.d.ts +41 -0
- package/dist/transports/jsonrpc.d.ts.map +1 -0
- package/dist/transports/jsonrpc.js +119 -0
- package/dist/transports/jsonrpc.js.map +1 -0
- package/dist/transports/web.d.ts +15 -0
- package/dist/transports/web.d.ts.map +1 -0
- package/dist/transports/web.js +62 -0
- package/dist/transports/web.js.map +1 -0
- package/dist/version-live.d.ts +41 -0
- package/dist/version-live.d.ts.map +1 -0
- package/dist/version-live.js +26 -0
- package/dist/version-live.js.map +1 -0
- package/dist/version.d.ts +78 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +46 -0
- package/dist/version.js.map +1 -0
- package/docs/protocol-verification.md +43 -0
- package/package.json +71 -0
- package/src/client.ts +731 -0
- package/src/combinators/retryOnSessionExpired.ts +25 -0
- package/src/commands.ts +112 -0
- package/src/config.ts +110 -0
- package/src/domain.ts +91 -0
- package/src/errors/auth.ts +28 -0
- package/src/errors/index.ts +50 -0
- package/src/errors/mapFault.ts +92 -0
- package/src/errors/protocol.ts +19 -0
- package/src/errors/schema.ts +18 -0
- package/src/errors/server.ts +79 -0
- package/src/errors/session.ts +12 -0
- package/src/errors/transport.ts +74 -0
- package/src/index.ts +152 -0
- package/src/internal/platform.ts +22 -0
- package/src/internal/singleFlight.ts +80 -0
- package/src/profiles.ts +386 -0
- package/src/protocol/jsonrpc.ts +162 -0
- package/src/records/index.ts +49 -0
- package/src/records/recordModel.ts +211 -0
- package/src/records/related.ts +80 -0
- package/src/records/relations.ts +192 -0
- package/src/records/spec.ts +96 -0
- package/src/records/typed.ts +180 -0
- package/src/rpc.ts +219 -0
- package/src/services/db.ts +282 -0
- package/src/services/report.ts +165 -0
- package/src/session/cookie.ts +461 -0
- package/src/testing/fakeTransport.ts +84 -0
- package/src/testing/index.ts +9 -0
- package/src/transport.ts +72 -0
- package/src/transports/json2.ts +303 -0
- package/src/transports/jsonrpc.ts +218 -0
- package/src/transports/web.ts +96 -0
- package/src/version-live.ts +67 -0
- package/src/version.ts +102 -0
package/dist/domain.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Odoo search domains, in their native Polish-prefix form. A domain is a flat
|
|
3
|
+
* list mixing leaf conditions and the operators `&` (and), `|` (or), `!` (not).
|
|
4
|
+
* Adjacent leaves with no operator between them are implicitly ANDed by Odoo.
|
|
5
|
+
*
|
|
6
|
+
* We keep the leaf pragmatic — `[field, operator, value]` — rather than trying
|
|
7
|
+
* to type Odoo's full operator/value matrix, which drifts across versions.
|
|
8
|
+
*/
|
|
9
|
+
/** Domain boolean operators, in Odoo's prefix notation. */
|
|
10
|
+
export type DomainOperator = "&" | "|" | "!";
|
|
11
|
+
/** A single condition: `[field, operator, value]`. */
|
|
12
|
+
export type DomainLeaf = readonly [string, string, unknown];
|
|
13
|
+
/** One token of a domain: either an operator or a leaf. */
|
|
14
|
+
export type DomainItem = DomainOperator | DomainLeaf;
|
|
15
|
+
/** A complete Odoo domain. */
|
|
16
|
+
export type Domain = ReadonlyArray<DomainItem>;
|
|
17
|
+
/**
|
|
18
|
+
* Rewrite a domain into a single, fully-explicit prefix expression: every
|
|
19
|
+
* implicit AND between adjacent leaves is made explicit with a leading `&`,
|
|
20
|
+
* so the result is one well-formed expression that can be safely nested inside
|
|
21
|
+
* a larger one. Port of Odoo's `expression.normalize_domain`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const normalizeDomain: (domain: Domain) => Domain;
|
|
24
|
+
/** Conjoin sub-domains: every one must match. */
|
|
25
|
+
export declare const AND: (...domains: ReadonlyArray<Domain>) => Domain;
|
|
26
|
+
/** Disjoin sub-domains: at least one must match. */
|
|
27
|
+
export declare const OR: (...domains: ReadonlyArray<Domain>) => Domain;
|
|
28
|
+
/** Negate a domain. */
|
|
29
|
+
export declare const NOT: (domain: Domain) => Domain;
|
|
30
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE7C,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,8BAA8B;AAC9B,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;AAI/C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,KAAG,MA2BhD,CAAC;AAqBF,iDAAiD;AACjD,eAAO,MAAM,GAAG,eAAgB,aAAa,CAAC,MAAM,CAAC,KAAG,MAA+B,CAAC;AAExF,oDAAoD;AACpD,eAAO,MAAM,EAAE,eAAgB,aAAa,CAAC,MAAM,CAAC,KAAG,MAA+B,CAAC;AAEvF,uBAAuB;AACvB,eAAO,MAAM,GAAG,WAAY,MAAM,KAAG,MAMpC,CAAC"}
|
package/dist/domain.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Odoo search domains, in their native Polish-prefix form. A domain is a flat
|
|
3
|
+
* list mixing leaf conditions and the operators `&` (and), `|` (or), `!` (not).
|
|
4
|
+
* Adjacent leaves with no operator between them are implicitly ANDed by Odoo.
|
|
5
|
+
*
|
|
6
|
+
* We keep the leaf pragmatic — `[field, operator, value]` — rather than trying
|
|
7
|
+
* to type Odoo's full operator/value matrix, which drifts across versions.
|
|
8
|
+
*/
|
|
9
|
+
const isLeaf = (item) => Array.isArray(item);
|
|
10
|
+
/**
|
|
11
|
+
* Rewrite a domain into a single, fully-explicit prefix expression: every
|
|
12
|
+
* implicit AND between adjacent leaves is made explicit with a leading `&`,
|
|
13
|
+
* so the result is one well-formed expression that can be safely nested inside
|
|
14
|
+
* a larger one. Port of Odoo's `expression.normalize_domain`.
|
|
15
|
+
*/
|
|
16
|
+
export const normalizeDomain = (domain) => {
|
|
17
|
+
if (domain.length === 0) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const result = [];
|
|
21
|
+
// Number of expressions still expected to complete the current subtree.
|
|
22
|
+
let expected = 1;
|
|
23
|
+
for (const token of domain) {
|
|
24
|
+
if (expected === 0) {
|
|
25
|
+
// A previous expression already completed; an extra one means an
|
|
26
|
+
// implicit AND — make it explicit at the front.
|
|
27
|
+
result.unshift("&");
|
|
28
|
+
expected = 1;
|
|
29
|
+
}
|
|
30
|
+
result.push(token);
|
|
31
|
+
if (isLeaf(token)) {
|
|
32
|
+
expected -= 1;
|
|
33
|
+
}
|
|
34
|
+
else if (token === "&" || token === "|") {
|
|
35
|
+
expected += 1;
|
|
36
|
+
}
|
|
37
|
+
// "!" is unary: it consumes and produces exactly one expression, so the
|
|
38
|
+
// expected count is unchanged.
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Fold several sub-domains together under one binary operator, normalizing
|
|
44
|
+
* each first. Empty sub-domains are dropped (they constrain nothing). Zero
|
|
45
|
+
* survivors yields the empty domain; one survivor is returned as-is.
|
|
46
|
+
*/
|
|
47
|
+
const combine = (op, domains) => {
|
|
48
|
+
const parts = domains.map(normalizeDomain).filter((d) => d.length > 0);
|
|
49
|
+
if (parts.length === 0) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
if (parts.length === 1) {
|
|
53
|
+
return parts[0];
|
|
54
|
+
}
|
|
55
|
+
const prefix = Array.from({ length: parts.length - 1 }, () => op);
|
|
56
|
+
return [...prefix, ...parts.flat()];
|
|
57
|
+
};
|
|
58
|
+
/** Conjoin sub-domains: every one must match. */
|
|
59
|
+
export const AND = (...domains) => combine("&", domains);
|
|
60
|
+
/** Disjoin sub-domains: at least one must match. */
|
|
61
|
+
export const OR = (...domains) => combine("|", domains);
|
|
62
|
+
/** Negate a domain. */
|
|
63
|
+
export const NOT = (domain) => {
|
|
64
|
+
const normalized = normalizeDomain(domain);
|
|
65
|
+
if (normalized.length === 0) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
return ["!", ...normalized];
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,MAAM,MAAM,GAAG,CAAC,IAAgB,EAAsB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IACxD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,wEAAwE;IACxE,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACnB,iEAAiE;YACjE,gDAAgD;YAChD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACpB,QAAQ,GAAG,CAAC,CAAC;QACf,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAClB,QAAQ,IAAI,CAAC,CAAC;QAChB,CAAC;aAAM,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YAC1C,QAAQ,IAAI,CAAC,CAAC;QAChB,CAAC;QACD,wEAAwE;QACxE,+BAA+B;IACjC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,EAAa,EAAE,OAA8B,EAAU,EAAE;IACxE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEvE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,CAAC,CAAE,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAsB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,iDAAiD;AACjD,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,OAA8B,EAAU,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAExF,oDAAoD;AACpD,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAA8B,EAAU,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAEvF,uBAAuB;AACvB,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAc,EAAU,EAAE;IAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why authentication failed. Distinct reasons so callers can branch without
|
|
3
|
+
* parsing messages:
|
|
4
|
+
*
|
|
5
|
+
* - `invalid-credentials` — wrong username/password or db.
|
|
6
|
+
* - `mfa-pending` — credentials accepted but a second factor is required
|
|
7
|
+
* before a usable session exists.
|
|
8
|
+
* - `api-key-expired-or-invalid` — the API key was rejected.
|
|
9
|
+
* - `totp-rpc-password` — hint: this account has 2FA enabled, so its login
|
|
10
|
+
* password cannot be used for RPC; an API key (used as the password) is
|
|
11
|
+
* required instead.
|
|
12
|
+
*/
|
|
13
|
+
export type OdooAuthReason = "invalid-credentials" | "mfa-pending" | "api-key-expired-or-invalid" | "totp-rpc-password";
|
|
14
|
+
declare const OdooAuthenticationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
15
|
+
readonly _tag: "OdooAuthenticationError";
|
|
16
|
+
} & Readonly<A>;
|
|
17
|
+
/**
|
|
18
|
+
* Authentication did not yield a usable session. Carries a structured
|
|
19
|
+
* {@link OdooAuthReason} rather than a free-text message.
|
|
20
|
+
*/
|
|
21
|
+
export declare class OdooAuthenticationError extends OdooAuthenticationError_base<{
|
|
22
|
+
readonly reason: OdooAuthReason;
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/errors/auth.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GACtB,qBAAqB,GACrB,aAAa,GACb,4BAA4B,GAC5B,mBAAmB,CAAC;;;;AAExB;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,6BAA4C;IACvF,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Authentication did not yield a usable session. Carries a structured
|
|
4
|
+
* {@link OdooAuthReason} rather than a free-text message.
|
|
5
|
+
*/
|
|
6
|
+
export class OdooAuthenticationError extends Data.TaggedError("OdooAuthenticationError") {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/errors/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAoB9B;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAGrF;CAAG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The complete error taxonomy for @hodeinavarro/odoo-rpc-ts. Every failure
|
|
3
|
+
* the client can produce is one of these tagged errors — nothing throws, and
|
|
4
|
+
* there is no blanket error type. See AGENTS.md § Error taxonomy.
|
|
5
|
+
*/
|
|
6
|
+
export { OdooTransportError, type RequestInfo, type TransportErrorKind } from "./transport.js";
|
|
7
|
+
export { OdooAuthenticationError, type OdooAuthReason } from "./auth.js";
|
|
8
|
+
export { SessionExpiredError } from "./session.js";
|
|
9
|
+
export { SchemaDriftError } from "./schema.js";
|
|
10
|
+
export { ProtocolUnsupportedError, type OdooProtocol } from "./protocol.js";
|
|
11
|
+
export { OdooServerError, OdooAccessError, OdooValidationError, OdooMissingError, OdooUserError, OdooLockError, serverFaultFields, type OdooServerFault, } from "./server.js";
|
|
12
|
+
export { mapServerFault, type RawServerFault, type FaultCallSite } from "./mapFault.js";
|
|
13
|
+
import type { OdooTransportError } from "./transport.js";
|
|
14
|
+
import type { OdooAuthenticationError } from "./auth.js";
|
|
15
|
+
import type { SessionExpiredError } from "./session.js";
|
|
16
|
+
import type { SchemaDriftError } from "./schema.js";
|
|
17
|
+
import type { ProtocolUnsupportedError } from "./protocol.js";
|
|
18
|
+
import type { OdooServerFault } from "./server.js";
|
|
19
|
+
/** Transport / wire-layer failures. */
|
|
20
|
+
export type OdooTransportFailure = OdooTransportError;
|
|
21
|
+
/** Everything about establishing or keeping a usable session. */
|
|
22
|
+
export type OdooAuthFailure = OdooAuthenticationError | SessionExpiredError;
|
|
23
|
+
/** Boundary-decoding failures. */
|
|
24
|
+
export type OdooDecodeFailure = SchemaDriftError;
|
|
25
|
+
/**
|
|
26
|
+
* The complete union of every error this client can fail with. Callers narrow
|
|
27
|
+
* with `Effect.catchTag` / `catchTags`.
|
|
28
|
+
*/
|
|
29
|
+
export type OdooError = OdooTransportError | OdooAuthenticationError | SessionExpiredError | SchemaDriftError | ProtocolUnsupportedError | OdooServerFault;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,uCAAuC;AACvC,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEtD,iEAAiE;AACjE,MAAM,MAAM,eAAe,GAAG,uBAAuB,GAAG,mBAAmB,CAAC;AAE5E,kCAAkC;AAClC,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,gBAAgB,GAChB,wBAAwB,GACxB,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The complete error taxonomy for @hodeinavarro/odoo-rpc-ts. Every failure
|
|
3
|
+
* the client can produce is one of these tagged errors — nothing throws, and
|
|
4
|
+
* there is no blanket error type. See AGENTS.md § Error taxonomy.
|
|
5
|
+
*/
|
|
6
|
+
export { OdooTransportError } from "./transport.js";
|
|
7
|
+
export { OdooAuthenticationError } from "./auth.js";
|
|
8
|
+
export { SessionExpiredError } from "./session.js";
|
|
9
|
+
export { SchemaDriftError } from "./schema.js";
|
|
10
|
+
export { ProtocolUnsupportedError } from "./protocol.js";
|
|
11
|
+
export { OdooServerError, OdooAccessError, OdooValidationError, OdooMissingError, OdooUserError, OdooLockError, serverFaultFields, } from "./server.js";
|
|
12
|
+
export { mapServerFault } from "./mapFault.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAA6C,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAuB,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAqB,MAAM,eAAe,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,GAElB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAA2C,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OdooAuthenticationError } from "./auth.js";
|
|
2
|
+
import { type OdooServerFault } from "./server.js";
|
|
3
|
+
/**
|
|
4
|
+
* The raw fault as surfaced by a transport choke point, before mapping. Only
|
|
5
|
+
* `name` and `message` are guaranteed by Odoo; the rest may be absent and are
|
|
6
|
+
* normalized to empty by the transport before reaching here.
|
|
7
|
+
*/
|
|
8
|
+
export interface RawServerFault {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly arguments: ReadonlyArray<unknown>;
|
|
12
|
+
readonly context: Record<string, unknown>;
|
|
13
|
+
readonly debug?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** The call site, threaded through so faults carry where they came from. */
|
|
16
|
+
export interface FaultCallSite {
|
|
17
|
+
readonly model?: string | undefined;
|
|
18
|
+
readonly method?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Map a raw Odoo fault to exactly one tagged subtype. Shared by all three
|
|
22
|
+
* transports' choke points so mapping lives in one place. Unknown names fall
|
|
23
|
+
* back to {@link OdooServerError} with `name` preserved.
|
|
24
|
+
*
|
|
25
|
+
* GOTCHA: `odoo.exceptions.AccessDenied` is *authentication* (bad password or
|
|
26
|
+
* API key — XML-RPC fault 3, distinct from AccessError's fault 4), so it maps
|
|
27
|
+
* to {@link OdooAuthenticationError}, not to a server fault. Accounts with
|
|
28
|
+
* TOTP enabled reject passwords over RPC entirely, hence the reason hint.
|
|
29
|
+
*/
|
|
30
|
+
export declare const mapServerFault: (fault: RawServerFault, site?: FaultCallSite) => OdooServerFault | OdooAuthenticationError;
|
|
31
|
+
//# sourceMappingURL=mapFault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapFault.d.ts","sourceRoot":"","sources":["../../src/errors/mapFault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAOL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AA2BD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,UAClB,cAAc,SACf,aAAa,KAClB,eAAe,GAAG,uBAuBpB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { OdooAuthenticationError } from "./auth.js";
|
|
2
|
+
import { OdooAccessError, OdooLockError, OdooMissingError, OdooServerError, OdooUserError, OdooValidationError, } from "./server.js";
|
|
3
|
+
/**
|
|
4
|
+
* Concrete constructors for the mapped subtypes, keyed by dotted Python name.
|
|
5
|
+
* Any name absent from this table falls through to {@link OdooServerError},
|
|
6
|
+
* which preserves the raw `name` verbatim.
|
|
7
|
+
*/
|
|
8
|
+
const byName = {
|
|
9
|
+
"odoo.exceptions.AccessError": OdooAccessError,
|
|
10
|
+
"odoo.exceptions.ValidationError": OdooValidationError,
|
|
11
|
+
"odoo.exceptions.MissingError": OdooMissingError,
|
|
12
|
+
"odoo.exceptions.UserError": OdooUserError,
|
|
13
|
+
"odoo.exceptions.RedirectWarning": OdooUserError,
|
|
14
|
+
"odoo.exceptions.Warning": OdooUserError,
|
|
15
|
+
"odoo.exceptions.LockError": OdooLockError,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Map a raw Odoo fault to exactly one tagged subtype. Shared by all three
|
|
19
|
+
* transports' choke points so mapping lives in one place. Unknown names fall
|
|
20
|
+
* back to {@link OdooServerError} with `name` preserved.
|
|
21
|
+
*
|
|
22
|
+
* GOTCHA: `odoo.exceptions.AccessDenied` is *authentication* (bad password or
|
|
23
|
+
* API key — XML-RPC fault 3, distinct from AccessError's fault 4), so it maps
|
|
24
|
+
* to {@link OdooAuthenticationError}, not to a server fault. Accounts with
|
|
25
|
+
* TOTP enabled reject passwords over RPC entirely, hence the reason hint.
|
|
26
|
+
*/
|
|
27
|
+
export const mapServerFault = (fault, site = {}) => {
|
|
28
|
+
if (fault.name === "odoo.exceptions.AccessDenied") {
|
|
29
|
+
return new OdooAuthenticationError({
|
|
30
|
+
reason: "invalid-credentials",
|
|
31
|
+
message: fault.message,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const Ctor = byName[fault.name] ?? OdooServerError;
|
|
35
|
+
// Build with exactOptionalPropertyTypes: only attach optional keys when
|
|
36
|
+
// actually present, never as explicit `undefined`.
|
|
37
|
+
const fields = {
|
|
38
|
+
name: fault.name,
|
|
39
|
+
message: fault.message,
|
|
40
|
+
arguments: fault.arguments,
|
|
41
|
+
context: fault.context,
|
|
42
|
+
...(fault.debug !== undefined ? { debug: fault.debug } : {}),
|
|
43
|
+
...(site.model !== undefined ? { model: site.model } : {}),
|
|
44
|
+
...(site.method !== undefined ? { method: site.method } : {}),
|
|
45
|
+
};
|
|
46
|
+
return new Ctor(fields);
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=mapFault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapFault.js","sourceRoot":"","sources":["../../src/errors/mapFault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AAqBrB;;;;GAIG;AACH,MAAM,MAAM,GAAuE;IACjF,6BAA6B,EAAE,eAAe;IAC9C,iCAAiC,EAAE,mBAAmB;IACtD,8BAA8B,EAAE,gBAAgB;IAChD,2BAA2B,EAAE,aAAa;IAC1C,iCAAiC,EAAE,aAAa;IAChD,yBAAyB,EAAE,aAAa;IACxC,2BAA2B,EAAE,aAAa;CAC3C,CAAC;AAYF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAqB,EACrB,IAAI,GAAkB,EAAE,EACmB,EAAE;IAC7C,IAAI,KAAK,CAAC,IAAI,KAAK,8BAA8B,EAAE,CAAC;QAClD,OAAO,IAAI,uBAAuB,CAAC;YACjC,MAAM,EAAE,qBAAqB;YAC7B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC;IAEnD,wEAAwE;IACxE,mDAAmD;IACnD,MAAM,MAAM,GAAsB;QAChC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D,CAAC;IAEF,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire protocols this client can speak. `json-2` is the Odoo 19+
|
|
3
|
+
* `/json/2/<model>/<method>` bearer API; `json-rpc` is `/jsonrpc` →
|
|
4
|
+
* `execute_kw`; `web` is the cookie-session `/web/dataset/call_kw` route.
|
|
5
|
+
*/
|
|
6
|
+
export type OdooProtocol = "json-rpc" | "json-2" | "web";
|
|
7
|
+
declare const ProtocolUnsupportedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
8
|
+
readonly _tag: "ProtocolUnsupportedError";
|
|
9
|
+
} & Readonly<A>;
|
|
10
|
+
/**
|
|
11
|
+
* The requested protocol is not available on the resolved server version —
|
|
12
|
+
* e.g. asking a 16.0 server for JSON-2. Raised by the version resolver seam
|
|
13
|
+
* so callers fail fast with a typed reason instead of interpreting a raw 404.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ProtocolUnsupportedError extends ProtocolUnsupportedError_base<{
|
|
16
|
+
readonly protocol: OdooProtocol;
|
|
17
|
+
readonly serverVersion: string;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/errors/protocol.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;;;;AAEzD;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,8BAA6C;IACzF,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;CAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The requested protocol is not available on the resolved server version —
|
|
4
|
+
* e.g. asking a 16.0 server for JSON-2. Raised by the version resolver seam
|
|
5
|
+
* so callers fail fast with a typed reason instead of interpreting a raw 404.
|
|
6
|
+
*/
|
|
7
|
+
export class ProtocolUnsupportedError extends Data.TaggedError("ProtocolUnsupportedError") {
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/errors/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAS9B;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAIvF;CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Schema } from "effect";
|
|
2
|
+
declare const SchemaDriftError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3
|
+
readonly _tag: "SchemaDriftError";
|
|
4
|
+
} & Readonly<A>;
|
|
5
|
+
/**
|
|
6
|
+
* A response reached us intact at the transport layer but did not match the
|
|
7
|
+
* schema we decode it through — the server's wire shape drifted (a version
|
|
8
|
+
* quirk, an unexpected null, a renamed field). We fail loudly with the raw
|
|
9
|
+
* payload attached rather than casting past the mismatch.
|
|
10
|
+
*
|
|
11
|
+
* `payload` is the undecoded value exactly as received, for diagnosis.
|
|
12
|
+
* `cause` is the `effect/Schema` `SchemaError` describing the mismatch (v4;
|
|
13
|
+
* formerly v3's `ParseResult.ParseError`).
|
|
14
|
+
*/
|
|
15
|
+
export declare class SchemaDriftError extends SchemaDriftError_base<{
|
|
16
|
+
readonly context: string;
|
|
17
|
+
readonly payload: unknown;
|
|
18
|
+
readonly cause: Schema.SchemaError;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/errors/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAErC;;;;;;;;;GASG;AACH,qBAAa,gBAAiB,SAAQ,sBAAqC;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC;CACpC,CAAC;CAAG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* A response reached us intact at the transport layer but did not match the
|
|
4
|
+
* schema we decode it through — the server's wire shape drifted (a version
|
|
5
|
+
* quirk, an unexpected null, a renamed field). We fail loudly with the raw
|
|
6
|
+
* payload attached rather than casting past the mismatch.
|
|
7
|
+
*
|
|
8
|
+
* `payload` is the undecoded value exactly as received, for diagnosis.
|
|
9
|
+
* `cause` is the `effect/Schema` `SchemaError` describing the mismatch (v4;
|
|
10
|
+
* formerly v3's `ParseResult.ParseError`).
|
|
11
|
+
*/
|
|
12
|
+
export class SchemaDriftError extends Data.TaggedError("SchemaDriftError") {
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/errors/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAIvE;CAAG"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Fields shared by every Odoo server fault. These are wire-decoded (the fault
|
|
4
|
+
* payload is normalized at each transport's choke point), so the classes use
|
|
5
|
+
* `Schema.TaggedErrorClass` rather than `Data.TaggedError`.
|
|
6
|
+
*
|
|
7
|
+
* - `name` — the raw Python exception name (e.g. `odoo.exceptions.AccessError`),
|
|
8
|
+
* preserved verbatim so nothing is lost even on the fallback path.
|
|
9
|
+
* - `message` — the human-facing message Odoo produced.
|
|
10
|
+
* - `arguments` — the exception's positional args, undecoded.
|
|
11
|
+
* - `context` — the Odoo `context` dict in effect at the call, if surfaced.
|
|
12
|
+
* - `debug` — the server traceback, when the server includes one.
|
|
13
|
+
* - `model` / `method` — the call site, threaded in by the choke point.
|
|
14
|
+
*/
|
|
15
|
+
export declare const serverFaultFields: {
|
|
16
|
+
readonly name: Schema.String;
|
|
17
|
+
readonly message: Schema.String;
|
|
18
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
19
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
20
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
21
|
+
readonly model: Schema.optional<Schema.String>;
|
|
22
|
+
readonly method: Schema.optional<Schema.String>;
|
|
23
|
+
};
|
|
24
|
+
declare const OdooServerError_base: Schema.Class<OdooServerError, Schema.TaggedStruct<"OdooServerError", {
|
|
25
|
+
readonly name: Schema.String;
|
|
26
|
+
readonly message: Schema.String;
|
|
27
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
28
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
29
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
30
|
+
readonly model: Schema.optional<Schema.String>;
|
|
31
|
+
readonly method: Schema.optional<Schema.String>;
|
|
32
|
+
}>, import("effect/Cause").YieldableError>;
|
|
33
|
+
/**
|
|
34
|
+
* Any Odoo application-level fault whose Python name we do not map to a more
|
|
35
|
+
* specific subtype. The raw `name` is preserved so callers can still branch on
|
|
36
|
+
* it, and no information is discarded.
|
|
37
|
+
*/
|
|
38
|
+
export declare class OdooServerError extends OdooServerError_base {
|
|
39
|
+
}
|
|
40
|
+
declare const OdooAccessError_base: Schema.Class<OdooAccessError, Schema.TaggedStruct<"OdooAccessError", {
|
|
41
|
+
readonly name: Schema.String;
|
|
42
|
+
readonly message: Schema.String;
|
|
43
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
44
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
45
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
46
|
+
readonly model: Schema.optional<Schema.String>;
|
|
47
|
+
readonly method: Schema.optional<Schema.String>;
|
|
48
|
+
}>, import("effect/Cause").YieldableError>;
|
|
49
|
+
/** `odoo.exceptions.AccessError` / `AccessDenied` — permission denied. */
|
|
50
|
+
export declare class OdooAccessError extends OdooAccessError_base {
|
|
51
|
+
}
|
|
52
|
+
declare const OdooValidationError_base: Schema.Class<OdooValidationError, Schema.TaggedStruct<"OdooValidationError", {
|
|
53
|
+
readonly name: Schema.String;
|
|
54
|
+
readonly message: Schema.String;
|
|
55
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
56
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
57
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
58
|
+
readonly model: Schema.optional<Schema.String>;
|
|
59
|
+
readonly method: Schema.optional<Schema.String>;
|
|
60
|
+
}>, import("effect/Cause").YieldableError>;
|
|
61
|
+
/** `odoo.exceptions.ValidationError` — a constraint/validation was violated. */
|
|
62
|
+
export declare class OdooValidationError extends OdooValidationError_base {
|
|
63
|
+
}
|
|
64
|
+
declare const OdooMissingError_base: Schema.Class<OdooMissingError, Schema.TaggedStruct<"OdooMissingError", {
|
|
65
|
+
readonly name: Schema.String;
|
|
66
|
+
readonly message: Schema.String;
|
|
67
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
68
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
69
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
70
|
+
readonly model: Schema.optional<Schema.String>;
|
|
71
|
+
readonly method: Schema.optional<Schema.String>;
|
|
72
|
+
}>, import("effect/Cause").YieldableError>;
|
|
73
|
+
/** `odoo.exceptions.MissingError` — a referenced record no longer exists. */
|
|
74
|
+
export declare class OdooMissingError extends OdooMissingError_base {
|
|
75
|
+
}
|
|
76
|
+
declare const OdooUserError_base: Schema.Class<OdooUserError, Schema.TaggedStruct<"OdooUserError", {
|
|
77
|
+
readonly name: Schema.String;
|
|
78
|
+
readonly message: Schema.String;
|
|
79
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
80
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
81
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
82
|
+
readonly model: Schema.optional<Schema.String>;
|
|
83
|
+
readonly method: Schema.optional<Schema.String>;
|
|
84
|
+
}>, import("effect/Cause").YieldableError>;
|
|
85
|
+
/** `odoo.exceptions.UserError` — a deliberate, user-facing business error. */
|
|
86
|
+
export declare class OdooUserError extends OdooUserError_base {
|
|
87
|
+
}
|
|
88
|
+
declare const OdooLockError_base: Schema.Class<OdooLockError, Schema.TaggedStruct<"OdooLockError", {
|
|
89
|
+
readonly name: Schema.String;
|
|
90
|
+
readonly message: Schema.String;
|
|
91
|
+
readonly arguments: Schema.$Array<Schema.Unknown>;
|
|
92
|
+
readonly context: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
93
|
+
readonly debug: Schema.optional<Schema.String>;
|
|
94
|
+
readonly model: Schema.optional<Schema.String>;
|
|
95
|
+
readonly method: Schema.optional<Schema.String>;
|
|
96
|
+
}>, import("effect/Cause").YieldableError>;
|
|
97
|
+
/**
|
|
98
|
+
* `odoo.exceptions.LockError` — concurrent-update / serialization lock failure
|
|
99
|
+
* (surfaced as a distinct exception on Odoo 19+).
|
|
100
|
+
*/
|
|
101
|
+
export declare class OdooLockError extends OdooLockError_base {
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The union of every server-fault subtype. `mapServerFault` narrows a raw
|
|
105
|
+
* fault to exactly one of these.
|
|
106
|
+
*/
|
|
107
|
+
export type OdooServerFault = OdooServerError | OdooAccessError | OdooValidationError | OdooMissingError | OdooUserError | OdooLockError;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/errors/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;aAC5B,IAAI;aACJ,OAAO;aACP,SAAS;aACT,OAAO;aACP,KAAK;aACL,KAAK;aACL,MAAM;CACE,CAAC;;;;;;;;;;AAEX;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,oBAGpC;CAAG;;;;;;;;;;AAEJ,0EAA0E;AAC1E,qBAAa,eAAgB,SAAQ,oBAGpC;CAAG;;;;;;;;;;AAEJ,gFAAgF;AAChF,qBAAa,mBAAoB,SAAQ,wBAGxC;CAAG;;;;;;;;;;AAEJ,6EAA6E;AAC7E,qBAAa,gBAAiB,SAAQ,qBAGrC;CAAG;;;;;;;;;;AAEJ,8EAA8E;AAC9E,qBAAa,aAAc,SAAQ,kBAGlC;CAAG;;;;;;;;;;AAEJ;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAGlC;CAAG;AAEJ;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,GACb,aAAa,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Fields shared by every Odoo server fault. These are wire-decoded (the fault
|
|
4
|
+
* payload is normalized at each transport's choke point), so the classes use
|
|
5
|
+
* `Schema.TaggedErrorClass` rather than `Data.TaggedError`.
|
|
6
|
+
*
|
|
7
|
+
* - `name` — the raw Python exception name (e.g. `odoo.exceptions.AccessError`),
|
|
8
|
+
* preserved verbatim so nothing is lost even on the fallback path.
|
|
9
|
+
* - `message` — the human-facing message Odoo produced.
|
|
10
|
+
* - `arguments` — the exception's positional args, undecoded.
|
|
11
|
+
* - `context` — the Odoo `context` dict in effect at the call, if surfaced.
|
|
12
|
+
* - `debug` — the server traceback, when the server includes one.
|
|
13
|
+
* - `model` / `method` — the call site, threaded in by the choke point.
|
|
14
|
+
*/
|
|
15
|
+
export const serverFaultFields = {
|
|
16
|
+
name: Schema.String,
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
arguments: Schema.Array(Schema.Unknown),
|
|
19
|
+
context: Schema.Record(Schema.String, Schema.Unknown),
|
|
20
|
+
debug: Schema.optional(Schema.String),
|
|
21
|
+
model: Schema.optional(Schema.String),
|
|
22
|
+
method: Schema.optional(Schema.String),
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Any Odoo application-level fault whose Python name we do not map to a more
|
|
26
|
+
* specific subtype. The raw `name` is preserved so callers can still branch on
|
|
27
|
+
* it, and no information is discarded.
|
|
28
|
+
*/
|
|
29
|
+
export class OdooServerError extends Schema.TaggedErrorClass()("OdooServerError", serverFaultFields) {
|
|
30
|
+
}
|
|
31
|
+
/** `odoo.exceptions.AccessError` / `AccessDenied` — permission denied. */
|
|
32
|
+
export class OdooAccessError extends Schema.TaggedErrorClass()("OdooAccessError", serverFaultFields) {
|
|
33
|
+
}
|
|
34
|
+
/** `odoo.exceptions.ValidationError` — a constraint/validation was violated. */
|
|
35
|
+
export class OdooValidationError extends Schema.TaggedErrorClass()("OdooValidationError", serverFaultFields) {
|
|
36
|
+
}
|
|
37
|
+
/** `odoo.exceptions.MissingError` — a referenced record no longer exists. */
|
|
38
|
+
export class OdooMissingError extends Schema.TaggedErrorClass()("OdooMissingError", serverFaultFields) {
|
|
39
|
+
}
|
|
40
|
+
/** `odoo.exceptions.UserError` — a deliberate, user-facing business error. */
|
|
41
|
+
export class OdooUserError extends Schema.TaggedErrorClass()("OdooUserError", serverFaultFields) {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `odoo.exceptions.LockError` — concurrent-update / serialization lock failure
|
|
45
|
+
* (surfaced as a distinct exception on Odoo 19+).
|
|
46
|
+
*/
|
|
47
|
+
export class OdooLockError extends Schema.TaggedErrorClass()("OdooLockError", serverFaultFields) {
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/errors/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CAC9B,CAAC;AAEX;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,gBAAgB,EAAmB,CAC7E,iBAAiB,EACjB,iBAAiB,CAClB;CAAG;AAEJ,0EAA0E;AAC1E,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,gBAAgB,EAAmB,CAC7E,iBAAiB,EACjB,iBAAiB,CAClB;CAAG;AAEJ,gFAAgF;AAChF,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,gBAAgB,EAAuB,CACrF,qBAAqB,EACrB,iBAAiB,CAClB;CAAG;AAEJ,6EAA6E;AAC7E,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,gBAAgB,EAAoB,CAC/E,kBAAkB,EAClB,iBAAiB,CAClB;CAAG;AAEJ,8EAA8E;AAC9E,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,gBAAgB,EAAiB,CACzE,eAAe,EACf,iBAAiB,CAClB;CAAG;AAEJ;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,gBAAgB,EAAiB,CACzE,eAAe,EACf,iBAAiB,CAClB;CAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const SessionExpiredError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "SessionExpiredError";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
/**
|
|
5
|
+
* The cookie-based web session is no longer valid (JSON-RPC error code 100 /
|
|
6
|
+
* `odoo.http.SessionExpiredException`). The `session_id` must be re-minted via
|
|
7
|
+
* `/web/session/authenticate` before retrying. Distinct from
|
|
8
|
+
* {@link OdooAuthenticationError} because the credentials themselves may still
|
|
9
|
+
* be good — only the session died.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SessionExpiredError extends SessionExpiredError_base<{
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}> {
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/errors/session.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,yBAAwC;IAC/E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;CAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* The cookie-based web session is no longer valid (JSON-RPC error code 100 /
|
|
4
|
+
* `odoo.http.SessionExpiredException`). The `session_id` must be re-minted via
|
|
5
|
+
* `/web/session/authenticate` before retrying. Distinct from
|
|
6
|
+
* {@link OdooAuthenticationError} because the credentials themselves may still
|
|
7
|
+
* be good — only the session died.
|
|
8
|
+
*/
|
|
9
|
+
export class SessionExpiredError extends Data.TaggedError("SessionExpiredError") {
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/errors/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAE7E;CAAG"}
|