@itzenata/efact-node 1.0.1
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 +154 -0
- package/dist/_generated/api/invoices-api.d.ts +367 -0
- package/dist/_generated/api/invoices-api.d.ts.map +1 -0
- package/dist/_generated/api/invoices-api.js +485 -0
- package/dist/_generated/api/invoices-api.js.map +1 -0
- package/dist/_generated/api.d.ts +13 -0
- package/dist/_generated/api.d.ts.map +1 -0
- package/dist/_generated/api.js +16 -0
- package/dist/_generated/api.js.map +1 -0
- package/dist/_generated/base.d.ts +67 -0
- package/dist/_generated/base.d.ts.map +1 -0
- package/dist/_generated/base.js +65 -0
- package/dist/_generated/base.js.map +1 -0
- package/dist/_generated/common.d.ts +66 -0
- package/dist/_generated/common.d.ts.map +1 -0
- package/dist/_generated/common.js +135 -0
- package/dist/_generated/common.js.map +1 -0
- package/dist/_generated/configuration.d.ts +92 -0
- package/dist/_generated/configuration.d.ts.map +1 -0
- package/dist/_generated/configuration.js +97 -0
- package/dist/_generated/configuration.js.map +1 -0
- package/dist/_generated/index.d.ts +15 -0
- package/dist/_generated/index.d.ts.map +1 -0
- package/dist/_generated/index.js +18 -0
- package/dist/_generated/index.js.map +1 -0
- package/dist/_generated/models/api-response-invoice-response.d.ts +45 -0
- package/dist/_generated/models/api-response-invoice-response.d.ts.map +1 -0
- package/dist/_generated/models/api-response-invoice-response.js +16 -0
- package/dist/_generated/models/api-response-invoice-response.js.map +1 -0
- package/dist/_generated/models/api-response-invoice-status-response.d.ts +45 -0
- package/dist/_generated/models/api-response-invoice-status-response.d.ts.map +1 -0
- package/dist/_generated/models/api-response-invoice-status-response.js +16 -0
- package/dist/_generated/models/api-response-invoice-status-response.js.map +1 -0
- package/dist/_generated/models/api-response-page-response-invoice-response.d.ts +45 -0
- package/dist/_generated/models/api-response-page-response-invoice-response.d.ts.map +1 -0
- package/dist/_generated/models/api-response-page-response-invoice-response.js +16 -0
- package/dist/_generated/models/api-response-page-response-invoice-response.js.map +1 -0
- package/dist/_generated/models/create-invoice-line-request.d.ts +55 -0
- package/dist/_generated/models/create-invoice-line-request.d.ts.map +1 -0
- package/dist/_generated/models/create-invoice-line-request.js +16 -0
- package/dist/_generated/models/create-invoice-line-request.js.map +1 -0
- package/dist/_generated/models/create-invoice-request.d.ts +82 -0
- package/dist/_generated/models/create-invoice-request.d.ts.map +1 -0
- package/dist/_generated/models/create-invoice-request.js +22 -0
- package/dist/_generated/models/create-invoice-request.js.map +1 -0
- package/dist/_generated/models/field-error.d.ts +31 -0
- package/dist/_generated/models/field-error.d.ts.map +1 -0
- package/dist/_generated/models/field-error.js +16 -0
- package/dist/_generated/models/field-error.js.map +1 -0
- package/dist/_generated/models/index.d.ts +11 -0
- package/dist/_generated/models/index.d.ts.map +1 -0
- package/dist/_generated/models/index.js +12 -0
- package/dist/_generated/models/index.js.map +1 -0
- package/dist/_generated/models/invoice-response.d.ts +221 -0
- package/dist/_generated/models/invoice-response.d.ts.map +1 -0
- package/dist/_generated/models/invoice-response.js +24 -0
- package/dist/_generated/models/invoice-response.js.map +1 -0
- package/dist/_generated/models/invoice-status-response.d.ts +83 -0
- package/dist/_generated/models/invoice-status-response.d.ts.map +1 -0
- package/dist/_generated/models/invoice-status-response.js +24 -0
- package/dist/_generated/models/invoice-status-response.js.map +1 -0
- package/dist/_generated/models/page-response-invoice-response.d.ts +62 -0
- package/dist/_generated/models/page-response-invoice-response.d.ts.map +1 -0
- package/dist/_generated/models/page-response-invoice-response.js +16 -0
- package/dist/_generated/models/page-response-invoice-response.js.map +1 -0
- package/dist/_generated/models/update-invoice-request.d.ts +121 -0
- package/dist/_generated/models/update-invoice-request.d.ts.map +1 -0
- package/dist/_generated/models/update-invoice-request.js +31 -0
- package/dist/_generated/models/update-invoice-request.js.map +1 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +155 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +100 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +129 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/invoices.d.ts +36 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +53 -0
- package/dist/invoices.js.map +1 -0
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +105 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +66 -0
- package/src/_generated/.openapi-generator/FILES +21 -0
- package/src/_generated/.openapi-generator/VERSION +1 -0
- package/src/_generated/.openapi-generator-ignore +23 -0
- package/src/_generated/api/invoices-api.ts +662 -0
- package/src/_generated/api.ts +19 -0
- package/src/_generated/base.ts +87 -0
- package/src/_generated/common.ts +151 -0
- package/src/_generated/configuration.ts +111 -0
- package/src/_generated/git_push.sh +57 -0
- package/src/_generated/index.ts +19 -0
- package/src/_generated/models/api-response-invoice-response.ts +55 -0
- package/src/_generated/models/api-response-invoice-status-response.ts +55 -0
- package/src/_generated/models/api-response-page-response-invoice-response.ts +55 -0
- package/src/_generated/models/create-invoice-line-request.ts +61 -0
- package/src/_generated/models/create-invoice-request.ts +93 -0
- package/src/_generated/models/field-error.ts +37 -0
- package/src/_generated/models/index.ts +11 -0
- package/src/_generated/models/invoice-response.ts +230 -0
- package/src/_generated/models/invoice-status-response.ts +92 -0
- package/src/_generated/models/page-response-invoice-response.ts +70 -0
- package/src/_generated/models/update-invoice-request.ts +131 -0
- package/src/client.ts +215 -0
- package/src/errors.ts +166 -0
- package/src/index.ts +35 -0
- package/src/invoices.ts +80 -0
- package/src/runtime.ts +179 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Détail d'erreur renvoyé dans le tableau "errors" de l'enveloppe backend
|
|
3
|
+
* (aligné sur le schéma généré `FieldError` : { field, message }).
|
|
4
|
+
* Forme permissive : le backend peut ajouter des clés.
|
|
5
|
+
*/
|
|
6
|
+
export interface ApiErrorDetail {
|
|
7
|
+
code?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
field?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Erreurs typées du SDK EFact.
|
|
14
|
+
*
|
|
15
|
+
* Toute réponse du backend est enveloppée ({ code, message, data, errors }).
|
|
16
|
+
* Le SDK transforme les réponses non-"OK" — et les statuts HTTP non-2xx — en
|
|
17
|
+
* erreurs typées portant le code applicatif, le statut HTTP et le détail des
|
|
18
|
+
* erreurs, pour que l'appelant puisse les distinguer proprement.
|
|
19
|
+
*/
|
|
20
|
+
/** Erreur de base de toutes les erreurs renvoyées par le SDK. */
|
|
21
|
+
export declare class EFactError extends Error {
|
|
22
|
+
constructor(message: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Erreur de configuration du SDK (clé manquante, baseUrl invalide, ...). Levée
|
|
26
|
+
* avant tout appel réseau.
|
|
27
|
+
*/
|
|
28
|
+
export declare class EFactConfigError extends EFactError {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Échec réseau : la requête n'a jamais abouti à une réponse HTTP (DNS, connexion
|
|
32
|
+
* refusée, TLS, coupure...). `cause` porte l'erreur sous-jacente.
|
|
33
|
+
*/
|
|
34
|
+
export declare class EFactConnectionError extends EFactError {
|
|
35
|
+
readonly cause: unknown;
|
|
36
|
+
constructor(message: string, cause?: unknown);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* La requête a dépassé le délai configuré et a été interrompue avant réponse.
|
|
40
|
+
*/
|
|
41
|
+
export declare class EFactTimeoutError extends EFactError {
|
|
42
|
+
/** Délai dépassé, en millisecondes. */
|
|
43
|
+
readonly timeoutMs: number;
|
|
44
|
+
constructor(message: string, timeoutMs: number);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Erreur renvoyée par l'API : statut HTTP non-2xx, ou enveloppe dont
|
|
48
|
+
* "code" !== "OK". Porte le code applicatif, le statut HTTP et les détails.
|
|
49
|
+
*/
|
|
50
|
+
export declare class EFactApiError extends EFactError {
|
|
51
|
+
/** Code applicatif issu de l'enveloppe ("code"), si disponible. */
|
|
52
|
+
readonly code: string | undefined;
|
|
53
|
+
/** Statut HTTP de la réponse, si une réponse HTTP a été reçue. */
|
|
54
|
+
readonly httpStatus: number | undefined;
|
|
55
|
+
/** Détails d'erreur issus de l'enveloppe ("errors"), si présents. */
|
|
56
|
+
readonly errors: ApiErrorDetail[] | undefined;
|
|
57
|
+
constructor(message: string, options?: {
|
|
58
|
+
code?: string | undefined;
|
|
59
|
+
httpStatus?: number | undefined;
|
|
60
|
+
errors?: ApiErrorDetail[] | undefined;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Erreur d'authentification / autorisation. Levée sur HTTP 401/403 ou sur les
|
|
65
|
+
* codes d'auth connus (API_KEY_MISSING / API_KEY_INVALID).
|
|
66
|
+
*/
|
|
67
|
+
export declare class EFactAuthError extends EFactApiError {
|
|
68
|
+
}
|
|
69
|
+
/** Erreur de validation de la requête (HTTP 400/422 / codes de validation). */
|
|
70
|
+
export declare class EFactValidationError extends EFactApiError {
|
|
71
|
+
}
|
|
72
|
+
/** Ressource introuvable (HTTP 404). Inclut le cas cross-tenant. */
|
|
73
|
+
export declare class EFactNotFoundError extends EFactApiError {
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Conflit d'état (HTTP 409), p.ex. tentative de modifier/annuler une facture
|
|
77
|
+
* qui n'est plus PENDING (code INVOICE_NOT_EDITABLE).
|
|
78
|
+
*/
|
|
79
|
+
export declare class EFactConflictError extends EFactApiError {
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Codes d'erreur applicatifs traités comme des erreurs d'authentification.
|
|
83
|
+
* API_KEY_MISSING / API_KEY_INVALID sont confirmés par le contrat ; les autres
|
|
84
|
+
* sont conservés par prudence. Le mapping HTTP 401/403 fonctionne aussi seul.
|
|
85
|
+
*/
|
|
86
|
+
export declare const AUTH_ERROR_CODES: ReadonlySet<string>;
|
|
87
|
+
/** Codes applicatifs traités comme des conflits d'état (409). */
|
|
88
|
+
export declare const CONFLICT_ERROR_CODES: ReadonlySet<string>;
|
|
89
|
+
/** Codes applicatifs traités comme des erreurs de validation. */
|
|
90
|
+
export declare const VALIDATION_ERROR_CODES: ReadonlySet<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Fabrique l'erreur API appropriée à partir du statut HTTP et/ou du code
|
|
93
|
+
* applicatif. Point central de classification des erreurs du backend.
|
|
94
|
+
*/
|
|
95
|
+
export declare function createApiError(message: string, options?: {
|
|
96
|
+
code?: string | undefined;
|
|
97
|
+
httpStatus?: number | undefined;
|
|
98
|
+
errors?: ApiErrorDetail[] | undefined;
|
|
99
|
+
}): EFactApiError;
|
|
100
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AAEH,iEAAiE;AACjE,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAM5B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;CAAG;AAEnD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;gBACZ,OAAO,EAAE,MAAM,EAAE,K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C;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;CAClC,GACL,aAAa,CAsBf"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Erreurs typées du SDK EFact.
|
|
3
|
+
*
|
|
4
|
+
* Toute réponse du backend est enveloppée ({ code, message, data, errors }).
|
|
5
|
+
* Le SDK transforme les réponses non-"OK" — et les statuts HTTP non-2xx — en
|
|
6
|
+
* erreurs typées portant le code applicatif, le statut HTTP et le détail des
|
|
7
|
+
* erreurs, pour que l'appelant puisse les distinguer proprement.
|
|
8
|
+
*/
|
|
9
|
+
/** Erreur de base de toutes les erreurs renvoyées par le SDK. */
|
|
10
|
+
export class EFactError extends Error {
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = new.target.name;
|
|
14
|
+
// Maintient la chaîne de prototype correcte après transpilation.
|
|
15
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Erreur de configuration du SDK (clé manquante, baseUrl invalide, ...). Levée
|
|
20
|
+
* avant tout appel réseau.
|
|
21
|
+
*/
|
|
22
|
+
export class EFactConfigError extends EFactError {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Échec réseau : la requête n'a jamais abouti à une réponse HTTP (DNS, connexion
|
|
26
|
+
* refusée, TLS, coupure...). `cause` porte l'erreur sous-jacente.
|
|
27
|
+
*/
|
|
28
|
+
export class EFactConnectionError extends EFactError {
|
|
29
|
+
cause;
|
|
30
|
+
constructor(message, cause) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* La requête a dépassé le délai configuré et a été interrompue avant réponse.
|
|
37
|
+
*/
|
|
38
|
+
export class EFactTimeoutError extends EFactError {
|
|
39
|
+
/** Délai dépassé, en millisecondes. */
|
|
40
|
+
timeoutMs;
|
|
41
|
+
constructor(message, timeoutMs) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.timeoutMs = timeoutMs;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Erreur renvoyée par l'API : statut HTTP non-2xx, ou enveloppe dont
|
|
48
|
+
* "code" !== "OK". Porte le code applicatif, le statut HTTP et les détails.
|
|
49
|
+
*/
|
|
50
|
+
export class EFactApiError extends EFactError {
|
|
51
|
+
/** Code applicatif issu de l'enveloppe ("code"), si disponible. */
|
|
52
|
+
code;
|
|
53
|
+
/** Statut HTTP de la réponse, si une réponse HTTP a été reçue. */
|
|
54
|
+
httpStatus;
|
|
55
|
+
/** Détails d'erreur issus de l'enveloppe ("errors"), si présents. */
|
|
56
|
+
errors;
|
|
57
|
+
constructor(message, options = {}) {
|
|
58
|
+
super(message);
|
|
59
|
+
this.code = options.code;
|
|
60
|
+
this.httpStatus = options.httpStatus;
|
|
61
|
+
this.errors = options.errors;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Erreur d'authentification / autorisation. Levée sur HTTP 401/403 ou sur les
|
|
66
|
+
* codes d'auth connus (API_KEY_MISSING / API_KEY_INVALID).
|
|
67
|
+
*/
|
|
68
|
+
export class EFactAuthError extends EFactApiError {
|
|
69
|
+
}
|
|
70
|
+
/** Erreur de validation de la requête (HTTP 400/422 / codes de validation). */
|
|
71
|
+
export class EFactValidationError extends EFactApiError {
|
|
72
|
+
}
|
|
73
|
+
/** Ressource introuvable (HTTP 404). Inclut le cas cross-tenant. */
|
|
74
|
+
export class EFactNotFoundError extends EFactApiError {
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Conflit d'état (HTTP 409), p.ex. tentative de modifier/annuler une facture
|
|
78
|
+
* qui n'est plus PENDING (code INVOICE_NOT_EDITABLE).
|
|
79
|
+
*/
|
|
80
|
+
export class EFactConflictError extends EFactApiError {
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Codes d'erreur applicatifs traités comme des erreurs d'authentification.
|
|
84
|
+
* API_KEY_MISSING / API_KEY_INVALID sont confirmés par le contrat ; les autres
|
|
85
|
+
* sont conservés par prudence. Le mapping HTTP 401/403 fonctionne aussi seul.
|
|
86
|
+
*/
|
|
87
|
+
export const AUTH_ERROR_CODES = new Set([
|
|
88
|
+
"API_KEY_MISSING",
|
|
89
|
+
"API_KEY_INVALID",
|
|
90
|
+
"UNAUTHORIZED",
|
|
91
|
+
"UNAUTHENTICATED",
|
|
92
|
+
"INVALID_API_KEY",
|
|
93
|
+
"API_KEY_REQUIRED",
|
|
94
|
+
"FORBIDDEN",
|
|
95
|
+
]);
|
|
96
|
+
/** Codes applicatifs traités comme des conflits d'état (409). */
|
|
97
|
+
export const CONFLICT_ERROR_CODES = new Set([
|
|
98
|
+
"INVOICE_NOT_EDITABLE",
|
|
99
|
+
]);
|
|
100
|
+
/** Codes applicatifs traités comme des erreurs de validation. */
|
|
101
|
+
export const VALIDATION_ERROR_CODES = new Set([
|
|
102
|
+
"VALIDATION_ERROR",
|
|
103
|
+
"INVALID_REQUEST",
|
|
104
|
+
]);
|
|
105
|
+
/**
|
|
106
|
+
* Fabrique l'erreur API appropriée à partir du statut HTTP et/ou du code
|
|
107
|
+
* applicatif. Point central de classification des erreurs du backend.
|
|
108
|
+
*/
|
|
109
|
+
export function createApiError(message, options = {}) {
|
|
110
|
+
const { code, httpStatus } = options;
|
|
111
|
+
if (httpStatus === 401 || httpStatus === 403 || (code && AUTH_ERROR_CODES.has(code))) {
|
|
112
|
+
return new EFactAuthError(message, options);
|
|
113
|
+
}
|
|
114
|
+
if (httpStatus === 404) {
|
|
115
|
+
return new EFactNotFoundError(message, options);
|
|
116
|
+
}
|
|
117
|
+
if (httpStatus === 409 || (code && CONFLICT_ERROR_CODES.has(code))) {
|
|
118
|
+
return new EFactConflictError(message, options);
|
|
119
|
+
}
|
|
120
|
+
// 400 (requête malformée) et 422 (échec de validation des champs côté
|
|
121
|
+
// backend) sont tous deux traités comme des erreurs de validation.
|
|
122
|
+
if (httpStatus === 400 ||
|
|
123
|
+
httpStatus === 422 ||
|
|
124
|
+
(code && VALIDATION_ERROR_CODES.has(code))) {
|
|
125
|
+
return new EFactValidationError(message, options);
|
|
126
|
+
}
|
|
127
|
+
return new EFactApiError(message, options);
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AAEH,iEAAiE;AACjE,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,iEAAiE;QACjE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;CAAG;AAEnD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IACzC,KAAK,CAAU;IACxB,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/C,uCAAuC;IAC9B,SAAS,CAAS;IAC3B,YAAY,OAAe,EAAE,SAAiB;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED;;;GAGG;AACH,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,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACrF,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACvB,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,UAAU,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IACD,sEAAsE;IACtE,mEAAmE;IACnE,IACE,UAAU,KAAK,GAAG;QAClB,UAAU,KAAK,GAAG;QAClB,CAAC,IAAI,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAC1C,CAAC;QACD,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { EFact, ENVIRONMENTS, type EFactEnvironment, type EFactOptions, EFactClient, type EFactClientConfig, } from "./client.js";
|
|
2
|
+
export { InvoicesResource, type ListInvoicesParams } from "./invoices.js";
|
|
3
|
+
export * from "./errors.js";
|
|
4
|
+
export { type CreateInvoiceRequest, type CreateInvoiceLineRequest, type UpdateInvoiceRequest, type InvoiceResponse, type InvoiceStatusResponse, type PageResponseInvoiceResponse, type FieldError, CreateInvoiceRequestPaymentMethodEnum, InvoiceResponseStatusEnum, } from "./_generated/index.js";
|
|
5
|
+
export { ListStatusEnum } from "./_generated/api/invoices-api.js";
|
|
6
|
+
export type { InvoiceResponse as Invoice, InvoiceStatusResponse as InvoiceStatusResult, CreateInvoiceRequest as CreateInvoiceInput, UpdateInvoiceRequest as UpdateInvoiceInput, CreateInvoiceLineRequest as CreateInvoiceLineInput, } from "./_generated/index.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,WAAW,EACX,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC1E,cAAc,aAAa,CAAC;AAI5B,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,UAAU,EACf,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,YAAY,EACV,eAAe,IAAI,OAAO,EAC1B,qBAAqB,IAAI,mBAAmB,EAC5C,oBAAoB,IAAI,kBAAkB,EAC1C,oBAAoB,IAAI,kBAAkB,EAC1C,wBAAwB,IAAI,sBAAsB,GACnD,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Surface publique du SDK.
|
|
2
|
+
export { EFact, ENVIRONMENTS, EFactClient, } from "./client.js";
|
|
3
|
+
export { InvoicesResource } from "./invoices.js";
|
|
4
|
+
export * from "./errors.js";
|
|
5
|
+
// Types du contrat, régénérés depuis l'OpenAPI (`src/_generated/`). Réexportés
|
|
6
|
+
// tels quels : un changement de champ côté API se propage ici automatiquement.
|
|
7
|
+
export { CreateInvoiceRequestPaymentMethodEnum, InvoiceResponseStatusEnum, } from "./_generated/index.js";
|
|
8
|
+
export { ListStatusEnum } from "./_generated/api/invoices-api.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EACL,KAAK,EACL,YAAY,EAGZ,WAAW,GAEZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAA2B,MAAM,eAAe,CAAC;AAC1E,cAAc,aAAa,CAAC;AAE5B,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EAQL,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InvoicesApi, type ListStatusEnum } from "./_generated/api/invoices-api.js";
|
|
2
|
+
import { type CreateInvoiceRequest, type InvoiceResponse, type InvoiceStatusResponse, type PageResponseInvoiceResponse, type UpdateInvoiceRequest } from "./_generated/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Paramètres ergonomiques de liste. Aplatit le `Pageable` généré (page/size/sort)
|
|
5
|
+
* en options plates, façon Stripe.
|
|
6
|
+
*/
|
|
7
|
+
export interface ListInvoicesParams {
|
|
8
|
+
page?: number;
|
|
9
|
+
size?: number;
|
|
10
|
+
/** ex. "createdAt,desc" */
|
|
11
|
+
sort?: string;
|
|
12
|
+
status?: ListStatusEnum;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Ressource "invoices" — surface publique STABLE (efact.invoices.*). Chaque
|
|
16
|
+
* méthode délègue à l'opération générée correspondante et déballe l'enveloppe.
|
|
17
|
+
* Aucune logique d'endpoint ici : ajouter/retirer un champ sur une facture se
|
|
18
|
+
* répercute via la régénération des types, sans toucher ce fichier.
|
|
19
|
+
*/
|
|
20
|
+
export declare class InvoicesResource {
|
|
21
|
+
private readonly api;
|
|
22
|
+
constructor(api: InvoicesApi);
|
|
23
|
+
/** POST /v1/invoices — crée une facture. */
|
|
24
|
+
create(input: CreateInvoiceRequest): Promise<InvoiceResponse>;
|
|
25
|
+
/** GET /v1/invoices — liste paginée (filtre/pagination optionnels). */
|
|
26
|
+
list(params?: ListInvoicesParams): Promise<PageResponseInvoiceResponse>;
|
|
27
|
+
/** GET /v1/invoices/{id} — récupère une facture (404 si hors tenant). */
|
|
28
|
+
retrieve(invoiceId: string): Promise<InvoiceResponse>;
|
|
29
|
+
/** GET /v1/invoices/{id}/status — résultat de clairance DGI. */
|
|
30
|
+
retrieveStatus(invoiceId: string): Promise<InvoiceStatusResponse>;
|
|
31
|
+
/** PUT /v1/invoices/{id} — mise à jour partielle (PENDING uniquement). */
|
|
32
|
+
update(invoiceId: string, input: UpdateInvoiceRequest): Promise<InvoiceResponse>;
|
|
33
|
+
/** DELETE /v1/invoices/{id} — annule (PENDING uniquement). */
|
|
34
|
+
cancel(invoiceId: string): Promise<InvoiceResponse>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=invoices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAI/B;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED;;;;;GAKG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,WAAW;IAE7C,4CAA4C;IAC5C,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IAI7D,uEAAuE;IACvE,IAAI,CAAC,MAAM,GAAE,kBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAa3E,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAIrD,gEAAgE;IAChE,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIjE,0EAA0E;IAC1E,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhF,8DAA8D;IAC9D,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAGpD"}
|
package/dist/invoices.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InvoicesApi } from "./_generated/api/invoices-api.js";
|
|
2
|
+
import {} from "./_generated/index.js";
|
|
3
|
+
import { unwrap } from "./runtime.js";
|
|
4
|
+
/**
|
|
5
|
+
* Ressource "invoices" — surface publique STABLE (efact.invoices.*). Chaque
|
|
6
|
+
* méthode délègue à l'opération générée correspondante et déballe l'enveloppe.
|
|
7
|
+
* Aucune logique d'endpoint ici : ajouter/retirer un champ sur une facture se
|
|
8
|
+
* répercute via la régénération des types, sans toucher ce fichier.
|
|
9
|
+
*/
|
|
10
|
+
export class InvoicesResource {
|
|
11
|
+
api;
|
|
12
|
+
constructor(api) {
|
|
13
|
+
this.api = api;
|
|
14
|
+
}
|
|
15
|
+
/** POST /v1/invoices — crée une facture. */
|
|
16
|
+
create(input) {
|
|
17
|
+
return unwrap(env(this.api.create({ createInvoiceRequest: input })));
|
|
18
|
+
}
|
|
19
|
+
/** GET /v1/invoices — liste paginée (filtre/pagination optionnels). */
|
|
20
|
+
list(params = {}) {
|
|
21
|
+
return unwrap(env(this.api.list({
|
|
22
|
+
...(params.page !== undefined ? { page: params.page } : {}),
|
|
23
|
+
...(params.size !== undefined ? { size: params.size } : {}),
|
|
24
|
+
...(params.sort !== undefined ? { sort: [params.sort] } : {}),
|
|
25
|
+
...(params.status !== undefined ? { status: params.status } : {}),
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
/** GET /v1/invoices/{id} — récupère une facture (404 si hors tenant). */
|
|
29
|
+
retrieve(invoiceId) {
|
|
30
|
+
return unwrap(env(this.api.getById({ id: invoiceId })));
|
|
31
|
+
}
|
|
32
|
+
/** GET /v1/invoices/{id}/status — résultat de clairance DGI. */
|
|
33
|
+
retrieveStatus(invoiceId) {
|
|
34
|
+
return unwrap(env(this.api.getStatus({ id: invoiceId })));
|
|
35
|
+
}
|
|
36
|
+
/** PUT /v1/invoices/{id} — mise à jour partielle (PENDING uniquement). */
|
|
37
|
+
update(invoiceId, input) {
|
|
38
|
+
return unwrap(env(this.api.update({ id: invoiceId, updateInvoiceRequest: input })));
|
|
39
|
+
}
|
|
40
|
+
/** DELETE /v1/invoices/{id} — annule (PENDING uniquement). */
|
|
41
|
+
cancel(invoiceId) {
|
|
42
|
+
return unwrap(env(this.api.cancel({ id: invoiceId })));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Recadre l'AxiosPromise générée (typée sur `ApiResponse*`) vers notre
|
|
47
|
+
* `Envelope<T>` unifié afin que `unwrap` en extraie `data`. Ne fait rien à
|
|
48
|
+
* l'exécution — simple pont de types.
|
|
49
|
+
*/
|
|
50
|
+
function env(p) {
|
|
51
|
+
return p;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=invoices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoices.js","sourceRoot":"","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xB,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,gEAAgE;IAChE,cAAc,CAAC,SAAiB;QAC9B,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,0EAA0E;IAC1E,MAAM,CAAC,SAAiB,EAAE,KAA2B;QACnD,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,8DAA8D;IAC9D,MAAM,CAAC,SAAiB;QACtB,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,GAAG,CAAI,CAAkC;IAChD,OAAO,CAAwC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type AxiosInstance, type AxiosResponse } from "axios";
|
|
2
|
+
import { type ApiErrorDetail } from "./errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Couche transport STABLE du SDK. Elle configure une instance axios partagée et
|
|
5
|
+
* y branche les préoccupations transversales — auth, nouveaux essais, mapping
|
|
6
|
+
* d'erreurs typées, déballage d'enveloppe — qui ne dépendent JAMAIS d'un
|
|
7
|
+
* endpoint particulier. Regénérer `_generated/` n'oblige donc jamais à toucher
|
|
8
|
+
* ce fichier.
|
|
9
|
+
*/
|
|
10
|
+
/** Enveloppe standard renvoyée par toutes les routes ({ code, data, ... }). */
|
|
11
|
+
export interface Envelope<T> {
|
|
12
|
+
code?: string;
|
|
13
|
+
message?: string | null;
|
|
14
|
+
data?: T;
|
|
15
|
+
errors?: ApiErrorDetail[] | null;
|
|
16
|
+
}
|
|
17
|
+
export interface RuntimeOptions {
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
maxRetries: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Construit l'instance axios utilisée par le client généré. C'est le SEUL
|
|
23
|
+
* endroit où l'on attache l'auth (Bearer), applique le timeout, rejoue les
|
|
24
|
+
* requêtes sûres et convertit les échecs en erreurs typées.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createHttpInstance(secretKey: string, baseUrl: string, options: RuntimeOptions): AxiosInstance;
|
|
27
|
+
/**
|
|
28
|
+
* Attend une réponse enveloppée, vérifie `code === "OK"` et renvoie `data`.
|
|
29
|
+
* Point unique de déballage : les méthodes de ressource restent des one-liners
|
|
30
|
+
* qui ne connaissent que le type généré, donc un changement de champ passe
|
|
31
|
+
* sans toucher au code.
|
|
32
|
+
*/
|
|
33
|
+
export declare function unwrap<T>(call: Promise<AxiosResponse<Envelope<T>>>): Promise<T>;
|
|
34
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAc,EAEZ,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAYD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,GACtB,aAAa,CAmDf;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAC5B,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import axios, {} from "axios";
|
|
2
|
+
import { createApiError, EFactApiError, EFactConnectionError, EFactTimeoutError, } from "./errors.js";
|
|
3
|
+
/** Méthodes HTTP rejouables sans effet de bord (sûres/idempotentes). */
|
|
4
|
+
const RETRYABLE_METHODS = new Set(["get", "head", "put", "delete"]);
|
|
5
|
+
/** Statuts HTTP qui méritent un nouvel essai (surcharge / erreurs serveur). */
|
|
6
|
+
const RETRYABLE_STATUSES = new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
7
|
+
/**
|
|
8
|
+
* Construit l'instance axios utilisée par le client généré. C'est le SEUL
|
|
9
|
+
* endroit où l'on attache l'auth (Bearer), applique le timeout, rejoue les
|
|
10
|
+
* requêtes sûres et convertit les échecs en erreurs typées.
|
|
11
|
+
*/
|
|
12
|
+
export function createHttpInstance(secretKey, baseUrl, options) {
|
|
13
|
+
const instance = axios.create({
|
|
14
|
+
baseURL: baseUrl.replace(/\/+$/, ""),
|
|
15
|
+
timeout: options.timeoutMs,
|
|
16
|
+
headers: {
|
|
17
|
+
// Seul endroit où la clé est attachée. Le backend attend un Bearer token.
|
|
18
|
+
Authorization: `Bearer ${secretKey}`,
|
|
19
|
+
Accept: "application/json",
|
|
20
|
+
},
|
|
21
|
+
// On lit nous-mêmes le corps d'erreur (enveloppe) pour typer l'erreur.
|
|
22
|
+
validateStatus: (status) => status >= 200 && status < 300,
|
|
23
|
+
});
|
|
24
|
+
instance.interceptors.response.use((response) => response, async (error) => {
|
|
25
|
+
const cfg = error.config;
|
|
26
|
+
const method = (cfg?.method ?? "get").toLowerCase();
|
|
27
|
+
const attempt = cfg?.__efactRetryCount ?? 0;
|
|
28
|
+
// 1. Réponse HTTP reçue mais non-2xx.
|
|
29
|
+
if (error.response) {
|
|
30
|
+
if (canRetryMethod(method) &&
|
|
31
|
+
attempt < options.maxRetries &&
|
|
32
|
+
RETRYABLE_STATUSES.has(error.response.status)) {
|
|
33
|
+
return replay(instance, cfg, attempt, backoffMs(attempt, error.response));
|
|
34
|
+
}
|
|
35
|
+
throw toApiError(error.response);
|
|
36
|
+
}
|
|
37
|
+
// 2. Pas de réponse : timeout ou coupure réseau.
|
|
38
|
+
const isTimeout = error.code === "ECONNABORTED" || error.code === "ETIMEDOUT";
|
|
39
|
+
if (canRetryMethod(method) && attempt < options.maxRetries) {
|
|
40
|
+
return replay(instance, cfg, attempt, backoffMs(attempt));
|
|
41
|
+
}
|
|
42
|
+
if (isTimeout) {
|
|
43
|
+
throw new EFactTimeoutError(`[EFact] La requête a dépassé le délai de ${options.timeoutMs} ms.`, options.timeoutMs);
|
|
44
|
+
}
|
|
45
|
+
throw new EFactConnectionError("[EFact] Échec de connexion à l'API (réseau indisponible).", error);
|
|
46
|
+
});
|
|
47
|
+
return instance;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Attend une réponse enveloppée, vérifie `code === "OK"` et renvoie `data`.
|
|
51
|
+
* Point unique de déballage : les méthodes de ressource restent des one-liners
|
|
52
|
+
* qui ne connaissent que le type généré, donc un changement de champ passe
|
|
53
|
+
* sans toucher au code.
|
|
54
|
+
*/
|
|
55
|
+
export async function unwrap(call) {
|
|
56
|
+
const response = await call;
|
|
57
|
+
const envelope = response.data;
|
|
58
|
+
if (!envelope || typeof envelope.code !== "string") {
|
|
59
|
+
throw createApiError(`[EFact-API] Réponse inattendue (enveloppe absente) sur HTTP ${response.status}.`, { httpStatus: response.status });
|
|
60
|
+
}
|
|
61
|
+
if (envelope.code !== "OK") {
|
|
62
|
+
throw createApiError(`[EFact-API] ${envelope.code}: ${envelope.message ?? "Erreur inconnue"}`, {
|
|
63
|
+
code: envelope.code,
|
|
64
|
+
httpStatus: response.status,
|
|
65
|
+
errors: envelope.errors ?? undefined,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return envelope.data;
|
|
69
|
+
}
|
|
70
|
+
function replay(instance, cfg, attempt, waitMs) {
|
|
71
|
+
cfg.__efactRetryCount = attempt + 1;
|
|
72
|
+
return delay(waitMs).then(() => instance.request(cfg));
|
|
73
|
+
}
|
|
74
|
+
function toApiError(response) {
|
|
75
|
+
const envelope = (response.data ?? {});
|
|
76
|
+
const code = envelope.code ?? `HTTP_${response.status}`;
|
|
77
|
+
const detail = (typeof envelope.message === "string" && envelope.message) ||
|
|
78
|
+
response.statusText ||
|
|
79
|
+
"Erreur inconnue";
|
|
80
|
+
return createApiError(`[EFact-API] ${code}: ${detail}`, {
|
|
81
|
+
code: envelope.code ?? undefined,
|
|
82
|
+
httpStatus: response.status,
|
|
83
|
+
errors: envelope.errors ?? undefined,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function canRetryMethod(method) {
|
|
87
|
+
return RETRYABLE_METHODS.has(method);
|
|
88
|
+
}
|
|
89
|
+
/** Back-off exponentiel plafonné, en respectant Retry-After si fourni. */
|
|
90
|
+
function backoffMs(attempt, response) {
|
|
91
|
+
const retryAfter = response?.headers?.["retry-after"];
|
|
92
|
+
if (retryAfter !== undefined) {
|
|
93
|
+
const seconds = Number(retryAfter);
|
|
94
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
95
|
+
return Math.min(seconds * 1000, 20_000);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const base = Math.min(500 * 2 ** attempt, 8_000);
|
|
99
|
+
const jitter = base * 0.2 * (Math.random() * 2 - 1);
|
|
100
|
+
return Math.round(base + jitter);
|
|
101
|
+
}
|
|
102
|
+
function delay(ms) {
|
|
103
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKb,MAAM,OAAO,CAAC;AACf,OAAO,EACL,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,GAElB,MAAM,aAAa,CAAC;AAuBrB,wEAAwE;AACxE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpE,+EAA+E;AAC/E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAOxE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,OAAe,EACf,OAAuB;IAEvB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QACpC,OAAO,EAAE,OAAO,CAAC,SAAS;QAC1B,OAAO,EAAE;YACP,0EAA0E;YAC1E,aAAa,EAAE,UAAU,SAAS,EAAE;YACpC,MAAM,EAAE,kBAAkB;SAC3B;QACD,uEAAuE;QACvE,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;KAC1D,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,GA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AAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@itzenata/efact-node",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "SDK Node.js officiel Itzenata pour l'e-facturation (EFact) au Maroc",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"prepublishOnly": "npm run build && npm test",
|
|
29
|
+
"prepare": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"efact",
|
|
33
|
+
"e-facturation",
|
|
34
|
+
"facturation",
|
|
35
|
+
"invoice",
|
|
36
|
+
"invoicing",
|
|
37
|
+
"dgi",
|
|
38
|
+
"morocco",
|
|
39
|
+
"maroc",
|
|
40
|
+
"itzenata",
|
|
41
|
+
"sdk"
|
|
42
|
+
],
|
|
43
|
+
"author": "Itzenata",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"homepage": "https://github.com/itzenata/sdk/tree/main/node-sdk#readme",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/itzenata/sdk.git",
|
|
49
|
+
"directory": "node-sdk"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/itzenata/sdk/issues"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/node": "^22.0.0",
|
|
59
|
+
"axios-mock-adapter": "^2.1.0",
|
|
60
|
+
"typescript": "^5.0.0",
|
|
61
|
+
"vitest": "^2.1.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"axios": "^1.18.1"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.npmignore
|
|
3
|
+
.openapi-generator-ignore
|
|
4
|
+
api.ts
|
|
5
|
+
api/invoices-api.ts
|
|
6
|
+
base.ts
|
|
7
|
+
common.ts
|
|
8
|
+
configuration.ts
|
|
9
|
+
git_push.sh
|
|
10
|
+
index.ts
|
|
11
|
+
models/api-response-invoice-response.ts
|
|
12
|
+
models/api-response-invoice-status-response.ts
|
|
13
|
+
models/api-response-page-response-invoice-response.ts
|
|
14
|
+
models/create-invoice-line-request.ts
|
|
15
|
+
models/create-invoice-request.ts
|
|
16
|
+
models/field-error.ts
|
|
17
|
+
models/index.ts
|
|
18
|
+
models/invoice-response.ts
|
|
19
|
+
models/invoice-status-response.ts
|
|
20
|
+
models/page-response-invoice-response.ts
|
|
21
|
+
models/update-invoice-request.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7.10.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# OpenAPI Generator Ignore
|
|
2
|
+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
|
+
|
|
4
|
+
# Use this file to prevent files from being overwritten by the generator.
|
|
5
|
+
# The patterns follow closely to .gitignore or .dockerignore.
|
|
6
|
+
|
|
7
|
+
# As an example, the C# client generator defines ApiClient.cs.
|
|
8
|
+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
9
|
+
#ApiClient.cs
|
|
10
|
+
|
|
11
|
+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
12
|
+
#foo/*/qux
|
|
13
|
+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
14
|
+
|
|
15
|
+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
16
|
+
#foo/**/qux
|
|
17
|
+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
18
|
+
|
|
19
|
+
# You can also negate patterns with an exclamation (!).
|
|
20
|
+
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
21
|
+
#docs/*.md
|
|
22
|
+
# Then explicitly reverse the ignore rule for a single file:
|
|
23
|
+
#!docs/README.md
|