@factpulse/sdk 3.0.33 → 3.0.34
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/.openapi-generator/FILES +2 -2
- package/CHANGELOG.md +4 -7
- package/api/invoice-processing-api.ts +2 -2
- package/dist/esm/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.d.ts → facture-electronique-rest-api-schemas-cdar-validation-error-response.d.ts} +13 -4
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/validate-cdarresponse.d.ts +3 -3
- package/dist/esm/models/validation-error-response.d.ts +3 -12
- package/dist/esm/src/helpers/client.js +8 -0
- package/dist/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.d.ts → facture-electronique-rest-api-schemas-cdar-validation-error-response.d.ts} +13 -4
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/validate-cdarresponse.d.ts +3 -3
- package/dist/models/validation-error-response.d.ts +3 -12
- package/dist/src/helpers/client.js +8 -0
- package/docs/FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md +27 -0
- package/docs/ValidateCDARResponse.md +2 -2
- package/docs/ValidationErrorResponse.md +3 -9
- package/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.ts → facture-electronique-rest-api-schemas-cdar-validation-error-response.ts} +13 -4
- package/models/index.ts +1 -1
- package/models/validate-cdarresponse.ts +3 -3
- package/models/validation-error-response.ts +3 -12
- package/package.json +1 -1
- package/src/helpers/client.ts +10 -0
- package/docs/FactureElectroniqueRestApiSchemasValidationValidationErrorResponse.md +0 -21
- /package/dist/esm/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.js → facture-electronique-rest-api-schemas-cdar-validation-error-response.js} +0 -0
- /package/dist/models/{facture-electronique-rest-api-schemas-validation-validation-error-response.js → facture-electronique-rest-api-schemas-cdar-validation-error-response.js} +0 -0
package/.openapi-generator/FILES
CHANGED
|
@@ -173,9 +173,9 @@ docs/ErrorSource.md
|
|
|
173
173
|
docs/ExtractionInfo.md
|
|
174
174
|
docs/FacturXInvoice.md
|
|
175
175
|
docs/FacturXPDFInfo.md
|
|
176
|
+
docs/FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md
|
|
176
177
|
docs/FactureElectroniqueRestApiSchemasChorusProChorusProCredentials.md
|
|
177
178
|
docs/FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.md
|
|
178
|
-
docs/FactureElectroniqueRestApiSchemasValidationValidationErrorResponse.md
|
|
179
179
|
docs/FieldStatus.md
|
|
180
180
|
docs/FileInfo.md
|
|
181
181
|
docs/FilesInfo.md
|
|
@@ -472,9 +472,9 @@ models/error-source.ts
|
|
|
472
472
|
models/extraction-info.ts
|
|
473
473
|
models/factur-xinvoice.ts
|
|
474
474
|
models/factur-xpdfinfo.ts
|
|
475
|
+
models/facture-electronique-rest-api-schemas-cdar-validation-error-response.ts
|
|
475
476
|
models/facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials.ts
|
|
476
477
|
models/facture-electronique-rest-api-schemas-ereporting-invoice-type-code.ts
|
|
477
|
-
models/facture-electronique-rest-api-schemas-validation-validation-error-response.ts
|
|
478
478
|
models/field-status.ts
|
|
479
479
|
models/file-info.ts
|
|
480
480
|
models/files-info.ts
|
package/CHANGELOG.md
CHANGED
|
@@ -7,14 +7,11 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [3.0.
|
|
11
|
-
|
|
12
|
-
### Added
|
|
13
|
-
- Support API cycle de vie CDAR
|
|
10
|
+
## [3.0.34] - 2026-01-17
|
|
14
11
|
|
|
15
12
|
### Fixed
|
|
16
|
-
-
|
|
13
|
+
- Gestion des erreurs métier (`result.status === "ERROR"`) dans tous les SDK - corrige l'erreur "No content" lors d'échecs de validation
|
|
17
14
|
|
|
18
15
|
|
|
19
|
-
[Unreleased]: https://github.com/factpulse/sdk-typescript/compare/v3.0.
|
|
20
|
-
[3.0.
|
|
16
|
+
[Unreleased]: https://github.com/factpulse/sdk-typescript/compare/v3.0.34...HEAD
|
|
17
|
+
[3.0.34]: https://github.com/factpulse/sdk-typescript/releases/tag/v3.0.34
|
|
@@ -28,8 +28,6 @@ import type { APIProfile } from '../models';
|
|
|
28
28
|
// @ts-ignore
|
|
29
29
|
import type { AsyncTaskStatus } from '../models';
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
import type { FactureElectroniqueRestApiSchemasValidationValidationErrorResponse } from '../models';
|
|
32
|
-
// @ts-ignore
|
|
33
31
|
import type { GenerateCertificateRequest } from '../models';
|
|
34
32
|
// @ts-ignore
|
|
35
33
|
import type { GenerateCertificateResponse } from '../models';
|
|
@@ -46,6 +44,8 @@ import type { SubmitCompleteInvoiceResponse } from '../models';
|
|
|
46
44
|
// @ts-ignore
|
|
47
45
|
import type { TaskResponse } from '../models';
|
|
48
46
|
// @ts-ignore
|
|
47
|
+
import type { ValidationErrorResponse } from '../models';
|
|
48
|
+
// @ts-ignore
|
|
49
49
|
import type { ValidationSuccessResponse } from '../models';
|
|
50
50
|
/**
|
|
51
51
|
* InvoiceProcessingApi - axios parameter creator
|
|
@@ -10,11 +10,20 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Erreur de validation.
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface FactureElectroniqueRestApiSchemasCdarValidationErrorResponse {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Champ concerné
|
|
18
18
|
*/
|
|
19
|
-
'
|
|
19
|
+
'field': string;
|
|
20
|
+
/**
|
|
21
|
+
* Message d\'erreur
|
|
22
|
+
*/
|
|
23
|
+
'message': string;
|
|
24
|
+
'rule'?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Sévérité (error/warning)
|
|
27
|
+
*/
|
|
28
|
+
'severity'?: string;
|
|
20
29
|
}
|
|
@@ -145,9 +145,9 @@ export * from './error-source';
|
|
|
145
145
|
export * from './extraction-info';
|
|
146
146
|
export * from './factur-xinvoice';
|
|
147
147
|
export * from './factur-xpdfinfo';
|
|
148
|
+
export * from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
148
149
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
149
150
|
export * from './facture-electronique-rest-api-schemas-ereporting-invoice-type-code';
|
|
150
|
-
export * from './facture-electronique-rest-api-schemas-validation-validation-error-response';
|
|
151
151
|
export * from './field-status';
|
|
152
152
|
export * from './file-info';
|
|
153
153
|
export * from './files-info';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -145,9 +145,9 @@ export * from './error-source';
|
|
|
145
145
|
export * from './extraction-info';
|
|
146
146
|
export * from './factur-xinvoice';
|
|
147
147
|
export * from './factur-xpdfinfo';
|
|
148
|
+
export * from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
148
149
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
149
150
|
export * from './facture-electronique-rest-api-schemas-ereporting-invoice-type-code';
|
|
150
|
-
export * from './facture-electronique-rest-api-schemas-validation-validation-error-response';
|
|
151
151
|
export * from './field-status';
|
|
152
152
|
export * from './file-info';
|
|
153
153
|
export * from './files-info';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { FactureElectroniqueRestApiSchemasCdarValidationErrorResponse } from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
13
13
|
/**
|
|
14
14
|
* Réponse de validation CDAR.
|
|
15
15
|
*/
|
|
@@ -21,9 +21,9 @@ export interface ValidateCDARResponse {
|
|
|
21
21
|
/**
|
|
22
22
|
* Liste des erreurs
|
|
23
23
|
*/
|
|
24
|
-
'errors'?: Array<
|
|
24
|
+
'errors'?: Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>;
|
|
25
25
|
/**
|
|
26
26
|
* Liste des avertissements
|
|
27
27
|
*/
|
|
28
|
-
'warnings'?: Array<
|
|
28
|
+
'warnings'?: Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>;
|
|
29
29
|
}
|
|
@@ -10,20 +10,11 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Response for validation errors.
|
|
14
14
|
*/
|
|
15
15
|
export interface ValidationErrorResponse {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* List of detected validation errors.
|
|
18
18
|
*/
|
|
19
|
-
'
|
|
20
|
-
/**
|
|
21
|
-
* Message d\'erreur
|
|
22
|
-
*/
|
|
23
|
-
'message': string;
|
|
24
|
-
'rule'?: string | null;
|
|
25
|
-
/**
|
|
26
|
-
* Sévérité (error/warning)
|
|
27
|
-
*/
|
|
28
|
-
'severity'?: string;
|
|
19
|
+
'detail': Array<string>;
|
|
29
20
|
}
|
|
@@ -357,6 +357,14 @@ export class FactPulseClient {
|
|
|
357
357
|
if (!sync)
|
|
358
358
|
return taskId;
|
|
359
359
|
const result = yield this.pollTask(taskId, timeout);
|
|
360
|
+
// Check for business error (task succeeded but business result is ERROR)
|
|
361
|
+
if (result.status === 'ERROR') {
|
|
362
|
+
const errorMsg = result.errorMessage || 'Business error';
|
|
363
|
+
const errors = Array.isArray(result.details)
|
|
364
|
+
? result.details.filter((e) => typeof e === 'object' && e !== null)
|
|
365
|
+
: [];
|
|
366
|
+
throw new FactPulseValidationError(errorMsg, errors);
|
|
367
|
+
}
|
|
360
368
|
if (result.content_b64)
|
|
361
369
|
return Buffer.from(result.content_b64, 'base64');
|
|
362
370
|
throw new FactPulseValidationError('No content');
|
|
@@ -10,11 +10,20 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Erreur de validation.
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface FactureElectroniqueRestApiSchemasCdarValidationErrorResponse {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Champ concerné
|
|
18
18
|
*/
|
|
19
|
-
'
|
|
19
|
+
'field': string;
|
|
20
|
+
/**
|
|
21
|
+
* Message d\'erreur
|
|
22
|
+
*/
|
|
23
|
+
'message': string;
|
|
24
|
+
'rule'?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Sévérité (error/warning)
|
|
27
|
+
*/
|
|
28
|
+
'severity'?: string;
|
|
20
29
|
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -145,9 +145,9 @@ export * from './error-source';
|
|
|
145
145
|
export * from './extraction-info';
|
|
146
146
|
export * from './factur-xinvoice';
|
|
147
147
|
export * from './factur-xpdfinfo';
|
|
148
|
+
export * from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
148
149
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
149
150
|
export * from './facture-electronique-rest-api-schemas-ereporting-invoice-type-code';
|
|
150
|
-
export * from './facture-electronique-rest-api-schemas-validation-validation-error-response';
|
|
151
151
|
export * from './field-status';
|
|
152
152
|
export * from './file-info';
|
|
153
153
|
export * from './files-info';
|
package/dist/models/index.js
CHANGED
|
@@ -161,9 +161,9 @@ __exportStar(require("./error-source"), exports);
|
|
|
161
161
|
__exportStar(require("./extraction-info"), exports);
|
|
162
162
|
__exportStar(require("./factur-xinvoice"), exports);
|
|
163
163
|
__exportStar(require("./factur-xpdfinfo"), exports);
|
|
164
|
+
__exportStar(require("./facture-electronique-rest-api-schemas-cdar-validation-error-response"), exports);
|
|
164
165
|
__exportStar(require("./facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials"), exports);
|
|
165
166
|
__exportStar(require("./facture-electronique-rest-api-schemas-ereporting-invoice-type-code"), exports);
|
|
166
|
-
__exportStar(require("./facture-electronique-rest-api-schemas-validation-validation-error-response"), exports);
|
|
167
167
|
__exportStar(require("./field-status"), exports);
|
|
168
168
|
__exportStar(require("./file-info"), exports);
|
|
169
169
|
__exportStar(require("./files-info"), exports);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { FactureElectroniqueRestApiSchemasCdarValidationErrorResponse } from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
13
13
|
/**
|
|
14
14
|
* Réponse de validation CDAR.
|
|
15
15
|
*/
|
|
@@ -21,9 +21,9 @@ export interface ValidateCDARResponse {
|
|
|
21
21
|
/**
|
|
22
22
|
* Liste des erreurs
|
|
23
23
|
*/
|
|
24
|
-
'errors'?: Array<
|
|
24
|
+
'errors'?: Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>;
|
|
25
25
|
/**
|
|
26
26
|
* Liste des avertissements
|
|
27
27
|
*/
|
|
28
|
-
'warnings'?: Array<
|
|
28
|
+
'warnings'?: Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>;
|
|
29
29
|
}
|
|
@@ -10,20 +10,11 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Response for validation errors.
|
|
14
14
|
*/
|
|
15
15
|
export interface ValidationErrorResponse {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* List of detected validation errors.
|
|
18
18
|
*/
|
|
19
|
-
'
|
|
20
|
-
/**
|
|
21
|
-
* Message d\'erreur
|
|
22
|
-
*/
|
|
23
|
-
'message': string;
|
|
24
|
-
'rule'?: string | null;
|
|
25
|
-
/**
|
|
26
|
-
* Sévérité (error/warning)
|
|
27
|
-
*/
|
|
28
|
-
'severity'?: string;
|
|
19
|
+
'detail': Array<string>;
|
|
29
20
|
}
|
|
@@ -405,6 +405,14 @@ class FactPulseClient {
|
|
|
405
405
|
if (!sync)
|
|
406
406
|
return taskId;
|
|
407
407
|
const result = yield this.pollTask(taskId, timeout);
|
|
408
|
+
// Check for business error (task succeeded but business result is ERROR)
|
|
409
|
+
if (result.status === 'ERROR') {
|
|
410
|
+
const errorMsg = result.errorMessage || 'Business error';
|
|
411
|
+
const errors = Array.isArray(result.details)
|
|
412
|
+
? result.details.filter((e) => typeof e === 'object' && e !== null)
|
|
413
|
+
: [];
|
|
414
|
+
throw new exceptions_1.FactPulseValidationError(errorMsg, errors);
|
|
415
|
+
}
|
|
408
416
|
if (result.content_b64)
|
|
409
417
|
return Buffer.from(result.content_b64, 'base64');
|
|
410
418
|
throw new exceptions_1.FactPulseValidationError('No content');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# FactureElectroniqueRestApiSchemasCdarValidationErrorResponse
|
|
2
|
+
|
|
3
|
+
Erreur de validation.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type | Description | Notes
|
|
8
|
+
------------ | ------------- | ------------- | -------------
|
|
9
|
+
**field** | **string** | Champ concerné | [default to undefined]
|
|
10
|
+
**message** | **string** | Message d\'erreur | [default to undefined]
|
|
11
|
+
**rule** | **string** | | [optional] [default to undefined]
|
|
12
|
+
**severity** | **string** | Sévérité (error/warning) | [optional] [default to 'error']
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { FactureElectroniqueRestApiSchemasCdarValidationErrorResponse } from '@factpulse/sdk';
|
|
18
|
+
|
|
19
|
+
const instance: FactureElectroniqueRestApiSchemasCdarValidationErrorResponse = {
|
|
20
|
+
field,
|
|
21
|
+
message,
|
|
22
|
+
rule,
|
|
23
|
+
severity,
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
@@ -7,8 +7,8 @@ Réponse de validation CDAR.
|
|
|
7
7
|
Name | Type | Description | Notes
|
|
8
8
|
------------ | ------------- | ------------- | -------------
|
|
9
9
|
**valid** | **boolean** | Résultat de validation | [default to undefined]
|
|
10
|
-
**errors** | [**Array<
|
|
11
|
-
**warnings** | [**Array<
|
|
10
|
+
**errors** | [**Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>**](FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md) | Liste des erreurs | [optional] [default to undefined]
|
|
11
|
+
**warnings** | [**Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>**](FactureElectroniqueRestApiSchemasCdarValidationErrorResponse.md) | Liste des avertissements | [optional] [default to undefined]
|
|
12
12
|
|
|
13
13
|
## Example
|
|
14
14
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# ValidationErrorResponse
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Response for validation errors.
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
7
|
Name | Type | Description | Notes
|
|
8
8
|
------------ | ------------- | ------------- | -------------
|
|
9
|
-
**
|
|
10
|
-
**message** | **string** | Message d\'erreur | [default to undefined]
|
|
11
|
-
**rule** | **string** | | [optional] [default to undefined]
|
|
12
|
-
**severity** | **string** | Sévérité (error/warning) | [optional] [default to 'error']
|
|
9
|
+
**detail** | **Array<string>** | List of detected validation errors. | [default to undefined]
|
|
13
10
|
|
|
14
11
|
## Example
|
|
15
12
|
|
|
@@ -17,10 +14,7 @@ Name | Type | Description | Notes
|
|
|
17
14
|
import { ValidationErrorResponse } from '@factpulse/sdk';
|
|
18
15
|
|
|
19
16
|
const instance: ValidationErrorResponse = {
|
|
20
|
-
|
|
21
|
-
message,
|
|
22
|
-
rule,
|
|
23
|
-
severity,
|
|
17
|
+
detail,
|
|
24
18
|
};
|
|
25
19
|
```
|
|
26
20
|
|
|
@@ -15,12 +15,21 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Erreur de validation.
|
|
19
19
|
*/
|
|
20
|
-
export interface
|
|
20
|
+
export interface FactureElectroniqueRestApiSchemasCdarValidationErrorResponse {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Champ concerné
|
|
23
23
|
*/
|
|
24
|
-
'
|
|
24
|
+
'field': string;
|
|
25
|
+
/**
|
|
26
|
+
* Message d\'erreur
|
|
27
|
+
*/
|
|
28
|
+
'message': string;
|
|
29
|
+
'rule'?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Sévérité (error/warning)
|
|
32
|
+
*/
|
|
33
|
+
'severity'?: string;
|
|
25
34
|
}
|
|
26
35
|
|
package/models/index.ts
CHANGED
|
@@ -145,9 +145,9 @@ export * from './error-source';
|
|
|
145
145
|
export * from './extraction-info';
|
|
146
146
|
export * from './factur-xinvoice';
|
|
147
147
|
export * from './factur-xpdfinfo';
|
|
148
|
+
export * from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
148
149
|
export * from './facture-electronique-rest-api-schemas-chorus-pro-chorus-pro-credentials';
|
|
149
150
|
export * from './facture-electronique-rest-api-schemas-ereporting-invoice-type-code';
|
|
150
|
-
export * from './facture-electronique-rest-api-schemas-validation-validation-error-response';
|
|
151
151
|
export * from './field-status';
|
|
152
152
|
export * from './file-info';
|
|
153
153
|
export * from './files-info';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
// May contain unused imports in some cases
|
|
17
17
|
// @ts-ignore
|
|
18
|
-
import type {
|
|
18
|
+
import type { FactureElectroniqueRestApiSchemasCdarValidationErrorResponse } from './facture-electronique-rest-api-schemas-cdar-validation-error-response';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Réponse de validation CDAR.
|
|
@@ -28,10 +28,10 @@ export interface ValidateCDARResponse {
|
|
|
28
28
|
/**
|
|
29
29
|
* Liste des erreurs
|
|
30
30
|
*/
|
|
31
|
-
'errors'?: Array<
|
|
31
|
+
'errors'?: Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>;
|
|
32
32
|
/**
|
|
33
33
|
* Liste des avertissements
|
|
34
34
|
*/
|
|
35
|
-
'warnings'?: Array<
|
|
35
|
+
'warnings'?: Array<FactureElectroniqueRestApiSchemasCdarValidationErrorResponse>;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -15,21 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Response for validation errors.
|
|
19
19
|
*/
|
|
20
20
|
export interface ValidationErrorResponse {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* List of detected validation errors.
|
|
23
23
|
*/
|
|
24
|
-
'
|
|
25
|
-
/**
|
|
26
|
-
* Message d\'erreur
|
|
27
|
-
*/
|
|
28
|
-
'message': string;
|
|
29
|
-
'rule'?: string | null;
|
|
30
|
-
/**
|
|
31
|
-
* Sévérité (error/warning)
|
|
32
|
-
*/
|
|
33
|
-
'severity'?: string;
|
|
24
|
+
'detail': Array<string>;
|
|
34
25
|
}
|
|
35
26
|
|
package/package.json
CHANGED
package/src/helpers/client.ts
CHANGED
|
@@ -381,6 +381,16 @@ export class FactPulseClient {
|
|
|
381
381
|
if (!taskId) throw new FactPulseValidationError("No task ID");
|
|
382
382
|
if (!sync) return taskId;
|
|
383
383
|
const result = await this.pollTask(taskId, timeout);
|
|
384
|
+
|
|
385
|
+
// Check for business error (task succeeded but business result is ERROR)
|
|
386
|
+
if (result.status === 'ERROR') {
|
|
387
|
+
const errorMsg = (result.errorMessage as string) || 'Business error';
|
|
388
|
+
const errors: ValidationErrorDetail[] = Array.isArray(result.details)
|
|
389
|
+
? result.details.filter((e: unknown): e is ValidationErrorDetail => typeof e === 'object' && e !== null)
|
|
390
|
+
: [];
|
|
391
|
+
throw new FactPulseValidationError(errorMsg, errors);
|
|
392
|
+
}
|
|
393
|
+
|
|
384
394
|
if (result.content_b64) return Buffer.from(result.content_b64 as string, 'base64');
|
|
385
395
|
throw new FactPulseValidationError('No content');
|
|
386
396
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# FactureElectroniqueRestApiSchemasValidationValidationErrorResponse
|
|
2
|
-
|
|
3
|
-
Response for validation errors.
|
|
4
|
-
|
|
5
|
-
## Properties
|
|
6
|
-
|
|
7
|
-
Name | Type | Description | Notes
|
|
8
|
-
------------ | ------------- | ------------- | -------------
|
|
9
|
-
**detail** | **Array<string>** | List of detected validation errors. | [default to undefined]
|
|
10
|
-
|
|
11
|
-
## Example
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { FactureElectroniqueRestApiSchemasValidationValidationErrorResponse } from '@factpulse/sdk';
|
|
15
|
-
|
|
16
|
-
const instance: FactureElectroniqueRestApiSchemasValidationValidationErrorResponse = {
|
|
17
|
-
detail,
|
|
18
|
-
};
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
File without changes
|