@beliq/sdk 0.7.0 → 0.7.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/CHANGELOG.md +10 -0
- package/README.md +13 -0
- package/dist/helpers.cjs +4 -0
- package/dist/helpers.d.cts +6 -2
- package/dist/helpers.d.ts +6 -2
- package/dist/helpers.js +4 -0
- package/dist/index.cjs +7 -2
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +7 -2
- package/dist/{types-BjW5SogX.d.cts → types-l-8PFJA8.d.cts} +4 -2
- package/dist/{types-BjW5SogX.d.ts → types-l-8PFJA8.d.ts} +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
resolves 0.4.x and never reaches 0.5.0. Additive spec syncs ship as patches for
|
|
5
5
|
that reason, and a minor is reserved for a change that needs consumers to opt in.
|
|
6
6
|
|
|
7
|
+
## 0.7.1 - 2026-11-06
|
|
8
|
+
|
|
9
|
+
- `validate` takes a `ruleset` option, sent as the `Beliq-Ruleset` header: a
|
|
10
|
+
channel (`latest` or `previous`) or comma-separated `<artifactKey>:<version>`
|
|
11
|
+
pins. Unset, no header is sent, as before, so an organisation's default
|
|
12
|
+
channel still applies. The new `RulesetChannel` type is the channel names the
|
|
13
|
+
API reports in `rulesetChannel`.
|
|
14
|
+
- `BuiltRequest` from `@beliq/sdk/helpers` has an optional `headers` field, and
|
|
15
|
+
`BuildParams` an optional `ruleset`.
|
|
16
|
+
|
|
7
17
|
## 0.7.0 - 2026-11-06
|
|
8
18
|
|
|
9
19
|
A minor, because a call that meets an outage can now take up to 15 minutes to
|
package/README.md
CHANGED
|
@@ -186,6 +186,19 @@ const ok = createHash('sha256').update(doc.bytes).digest('hex') === doc.sha256;
|
|
|
186
186
|
console.log(doc.validationResult?.valid, doc.meta.rulesetSha256, ok);
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
+
### Choosing the ruleset
|
|
190
|
+
|
|
191
|
+
`validate` checks a document against the latest rules unless you choose otherwise. `ruleset` chooses: `'previous'` runs the retained rules before the latest, where the format has any, and comma-separated `<artifactKey>:<version>` pins run exact versions, with the keys and versions `GET /v1/rulesets` lists. The SDK sends the value as given, in the `Beliq-Ruleset` header. Left unset, it sends no header, and the API runs your organisation's default channel, which is `latest` unless your organisation chose `previous` in the dashboard.
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
const result = await beliq.validate(xml, { ruleset: 'previous' });
|
|
195
|
+
console.log(result.rulesetChannel, result.rulesetFellBack, result.rulesetArtifacts);
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The result says what applied. `rulesetChannel` and `rulesetFellBack` say which channel: `rulesetFellBack: true` means the format had nothing for `previous` to reach, so the latest rules ran. Under exact pins `rulesetChannel` reads `latest`, whatever version a pin ran. `rulesetArtifacts` and the per-format version fields, such as `schematronVersion`, say which rules ran, and `rulesetSunsetsOn` says until when a retained ruleset is served. `GET /v1/rulesets` gives each format's `previousChannel`: what `previous` reaches for it today.
|
|
199
|
+
|
|
200
|
+
The API answers a malformed value with a 400 `VALIDATION_ERROR` before any quota is used. It answers a pin to a version it no longer serves with a 422 `VALIDATION_ERROR`, and that request uses up a document. The API's `Beliq-Ruleset-Resolved` response header is not returned: it is built from the request, so for pins it repeats the pins sent even when a pinned artifact did not run. `rulesetArtifacts` says what ran.
|
|
201
|
+
|
|
189
202
|
### Curated option lists
|
|
190
203
|
|
|
191
204
|
`LIVE_GENERATE_PRESETS` is the set of public generate targets beliq.eu itself offers, each mapping to the API `standard` (plus `profile`/`facturxProfile`) it needs. NLCIUS is a Peppol BIS profile and lives here rather than in `LIVE_GENERATE_STANDARDS`. Connectors build their dropdowns from these lists.
|
package/dist/helpers.cjs
CHANGED
|
@@ -137,6 +137,10 @@ function buildRequest(params) {
|
|
|
137
137
|
query: withAdvancedQuery(query, params.advanced),
|
|
138
138
|
rawBody: params.rawBody,
|
|
139
139
|
contentType: params.rawContentType ?? "application/xml",
|
|
140
|
+
// No header unless the caller chose one: without it the API runs the
|
|
141
|
+
// organisation's default channel, which a sent `latest` would override.
|
|
142
|
+
// `!= null`: a plain-JS caller's null means unset too, not the string "null".
|
|
143
|
+
...params.ruleset != null ? { headers: { "Beliq-Ruleset": params.ruleset } } : {},
|
|
140
144
|
outputKind: "json"
|
|
141
145
|
};
|
|
142
146
|
}
|
package/dist/helpers.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as PlainObject } from './types-
|
|
1
|
+
import { P as PlainObject } from './types-l-8PFJA8.cjs';
|
|
2
2
|
import { ValidationResult } from './index.cjs';
|
|
3
|
-
export { D as DEFAULT_BASE_URL, a as DocumentInput, G as GeneratePreset, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_PRESETS, d as LIVE_GENERATE_STANDARDS, e as LIVE_PARSE_FORMATS, f as LIVE_PROFILES, g as LIVE_PROFILES_BY_STANDARD, h as LIVE_VALIDATE_FORMATS, i as compactQuery, j as decodeUtf8, k as isPlainObject, l as isProfileAllowedForStandard, m as mergeDeep, p as profilesForStandard, s as sniffContentType, t as toBytes } from './types-
|
|
3
|
+
export { D as DEFAULT_BASE_URL, a as DocumentInput, G as GeneratePreset, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_PRESETS, d as LIVE_GENERATE_STANDARDS, e as LIVE_PARSE_FORMATS, f as LIVE_PROFILES, g as LIVE_PROFILES_BY_STANDARD, h as LIVE_VALIDATE_FORMATS, i as compactQuery, j as decodeUtf8, k as isPlainObject, l as isProfileAllowedForStandard, m as mergeDeep, p as profilesForStandard, s as sniffContentType, t as toBytes } from './types-l-8PFJA8.cjs';
|
|
4
4
|
|
|
5
5
|
type Operation = 'me' | 'generate' | 'validate' | 'parse' | 'convert';
|
|
6
6
|
/** 'json' => parse the `{ success, data }` envelope; 'binary' => return raw bytes. */
|
|
@@ -22,6 +22,8 @@ interface BuildParams {
|
|
|
22
22
|
rawContentType?: string;
|
|
23
23
|
validateFormat?: string;
|
|
24
24
|
franceCtc?: boolean;
|
|
25
|
+
/** Sent as the `Beliq-Ruleset` header, as given; unset sends no header. */
|
|
26
|
+
ruleset?: string;
|
|
25
27
|
parseFormat?: string;
|
|
26
28
|
sourceFormat?: string;
|
|
27
29
|
targetFormat?: string;
|
|
@@ -42,6 +44,8 @@ interface BuiltRequest {
|
|
|
42
44
|
contentType?: string;
|
|
43
45
|
/** Accept header; set when the caller wants a JSON envelope from an otherwise-binary op. */
|
|
44
46
|
accept?: string;
|
|
47
|
+
/** Further request headers, such as `Beliq-Ruleset` on validate. */
|
|
48
|
+
headers?: Record<string, string>;
|
|
45
49
|
outputKind: OutputKind;
|
|
46
50
|
}
|
|
47
51
|
declare function buildRequest(params: BuildParams): BuiltRequest;
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as PlainObject } from './types-
|
|
1
|
+
import { P as PlainObject } from './types-l-8PFJA8.js';
|
|
2
2
|
import { ValidationResult } from './index.js';
|
|
3
|
-
export { D as DEFAULT_BASE_URL, a as DocumentInput, G as GeneratePreset, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_PRESETS, d as LIVE_GENERATE_STANDARDS, e as LIVE_PARSE_FORMATS, f as LIVE_PROFILES, g as LIVE_PROFILES_BY_STANDARD, h as LIVE_VALIDATE_FORMATS, i as compactQuery, j as decodeUtf8, k as isPlainObject, l as isProfileAllowedForStandard, m as mergeDeep, p as profilesForStandard, s as sniffContentType, t as toBytes } from './types-
|
|
3
|
+
export { D as DEFAULT_BASE_URL, a as DocumentInput, G as GeneratePreset, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_PRESETS, d as LIVE_GENERATE_STANDARDS, e as LIVE_PARSE_FORMATS, f as LIVE_PROFILES, g as LIVE_PROFILES_BY_STANDARD, h as LIVE_VALIDATE_FORMATS, i as compactQuery, j as decodeUtf8, k as isPlainObject, l as isProfileAllowedForStandard, m as mergeDeep, p as profilesForStandard, s as sniffContentType, t as toBytes } from './types-l-8PFJA8.js';
|
|
4
4
|
|
|
5
5
|
type Operation = 'me' | 'generate' | 'validate' | 'parse' | 'convert';
|
|
6
6
|
/** 'json' => parse the `{ success, data }` envelope; 'binary' => return raw bytes. */
|
|
@@ -22,6 +22,8 @@ interface BuildParams {
|
|
|
22
22
|
rawContentType?: string;
|
|
23
23
|
validateFormat?: string;
|
|
24
24
|
franceCtc?: boolean;
|
|
25
|
+
/** Sent as the `Beliq-Ruleset` header, as given; unset sends no header. */
|
|
26
|
+
ruleset?: string;
|
|
25
27
|
parseFormat?: string;
|
|
26
28
|
sourceFormat?: string;
|
|
27
29
|
targetFormat?: string;
|
|
@@ -42,6 +44,8 @@ interface BuiltRequest {
|
|
|
42
44
|
contentType?: string;
|
|
43
45
|
/** Accept header; set when the caller wants a JSON envelope from an otherwise-binary op. */
|
|
44
46
|
accept?: string;
|
|
47
|
+
/** Further request headers, such as `Beliq-Ruleset` on validate. */
|
|
48
|
+
headers?: Record<string, string>;
|
|
45
49
|
outputKind: OutputKind;
|
|
46
50
|
}
|
|
47
51
|
declare function buildRequest(params: BuildParams): BuiltRequest;
|
package/dist/helpers.js
CHANGED
|
@@ -85,6 +85,10 @@ function buildRequest(params) {
|
|
|
85
85
|
query: withAdvancedQuery(query, params.advanced),
|
|
86
86
|
rawBody: params.rawBody,
|
|
87
87
|
contentType: params.rawContentType ?? "application/xml",
|
|
88
|
+
// No header unless the caller chose one: without it the API runs the
|
|
89
|
+
// organisation's default channel, which a sent `latest` would override.
|
|
90
|
+
// `!= null`: a plain-JS caller's null means unset too, not the string "null".
|
|
91
|
+
...params.ruleset != null ? { headers: { "Beliq-Ruleset": params.ruleset } } : {},
|
|
88
92
|
outputKind: "json"
|
|
89
93
|
};
|
|
90
94
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -138,6 +138,10 @@ function buildRequest(params) {
|
|
|
138
138
|
query: withAdvancedQuery(query, params.advanced),
|
|
139
139
|
rawBody: params.rawBody,
|
|
140
140
|
contentType: params.rawContentType ?? "application/xml",
|
|
141
|
+
// No header unless the caller chose one: without it the API runs the
|
|
142
|
+
// organisation's default channel, which a sent `latest` would override.
|
|
143
|
+
// `!= null`: a plain-JS caller's null means unset too, not the string "null".
|
|
144
|
+
...params.ruleset != null ? { headers: { "Beliq-Ruleset": params.ruleset } } : {},
|
|
141
145
|
outputKind: "json"
|
|
142
146
|
};
|
|
143
147
|
}
|
|
@@ -328,7 +332,7 @@ function retryDelayMs(res, attempt, config) {
|
|
|
328
332
|
}
|
|
329
333
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
330
334
|
async function send(config, req) {
|
|
331
|
-
const headers = { ...authHeaders(config) };
|
|
335
|
+
const headers = { ...req.headers, ...authHeaders(config) };
|
|
332
336
|
if (req.contentType) headers["Content-Type"] = req.contentType;
|
|
333
337
|
if (req.accept) headers["Accept"] = req.accept;
|
|
334
338
|
const body = req.jsonBody !== void 0 ? JSON.stringify(req.jsonBody) : req.rawBody;
|
|
@@ -503,7 +507,8 @@ var Beliq = class {
|
|
|
503
507
|
operation: "validate",
|
|
504
508
|
...this.#rawParams(document, options),
|
|
505
509
|
validateFormat: options.format,
|
|
506
|
-
franceCtc: options.franceCtc
|
|
510
|
+
franceCtc: options.franceCtc,
|
|
511
|
+
ruleset: options.ruleset
|
|
507
512
|
});
|
|
508
513
|
}
|
|
509
514
|
/** Parse a document into a structured EN 16931 invoice. */
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AccountInfo, S as Standard, I as Invoice, n as GenerateProfile, F as FacturxProfile, V as ValidationResult, R as RulesetArtifact, a as DocumentInput, o as ValidateFormat, q as
|
|
1
|
+
import { A as AccountInfo, S as Standard, I as Invoice, n as GenerateProfile, F as FacturxProfile, V as ValidationResult, R as RulesetArtifact, a as DocumentInput, o as ValidateFormat, q as RulesetChannel, r as ParseFormat, u as ParseResult, C as ConvertTargetFormat, v as ConvertSourceFormat, w as ApiErrorCode } from './types-l-8PFJA8.cjs';
|
|
2
2
|
import { PlainObject } from './helpers.cjs';
|
|
3
|
-
export {
|
|
3
|
+
export { x as ApiError, D as DEFAULT_BASE_URL, y as DEFAULT_MAX_RETRIES, z as DEFAULT_RETRY_BUDGET_MS, B as DEFAULT_TIMEOUT_MS, E as GenerateBody, G as GeneratePreset, H as GenerateResponse, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_PRESETS, d as LIVE_GENERATE_STANDARDS, e as LIVE_PARSE_FORMATS, f as LIVE_PROFILES, g as LIVE_PROFILES_BY_STANDARD, h as LIVE_VALIDATE_FORMATS, J as ParseWarning, K as ParseWarningCode, M as Severity, N as ValidationFormat, O as ValidationIssue, l as isProfileAllowedForStandard, p as profilesForStandard } from './types-l-8PFJA8.cjs';
|
|
4
4
|
|
|
5
5
|
interface BeliqOptions {
|
|
6
6
|
/** API key from the beliq dashboard (API Keys). */
|
|
@@ -73,6 +73,22 @@ interface DocumentOptions {
|
|
|
73
73
|
interface ValidateOptions extends DocumentOptions {
|
|
74
74
|
format?: ValidateFormat;
|
|
75
75
|
franceCtc?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The rules to validate against, sent as the `Beliq-Ruleset` header: a channel
|
|
78
|
+
* (`latest` or `previous`), or comma-separated exact pins as
|
|
79
|
+
* `<artifactKey>:<version>`, the keys and versions `GET /v1/rulesets` lists.
|
|
80
|
+
* Left unset, no header is sent, and the API runs the key's organisation
|
|
81
|
+
* default, which is `latest` unless the organisation chose `previous`.
|
|
82
|
+
*
|
|
83
|
+
* The result says what applied: `rulesetChannel` and `rulesetFellBack` which
|
|
84
|
+
* channel, `rulesetArtifacts` and the per-format version fields which rules
|
|
85
|
+
* ran, and `rulesetSunsetsOn` until when a retained ruleset is served. Under
|
|
86
|
+
* exact pins `rulesetChannel` reads `latest`, whatever version a pin ran.
|
|
87
|
+
* The API answers a malformed value with a 400 `VALIDATION_ERROR` before any
|
|
88
|
+
* quota is used, and a pin to a version it no longer serves with a 422
|
|
89
|
+
* `VALIDATION_ERROR`, which uses up a document.
|
|
90
|
+
*/
|
|
91
|
+
ruleset?: RulesetChannel | (string & {});
|
|
76
92
|
}
|
|
77
93
|
interface ParseOptions extends DocumentOptions {
|
|
78
94
|
format?: ParseFormat;
|
|
@@ -177,5 +193,5 @@ declare class BeliqApiError extends Error {
|
|
|
177
193
|
});
|
|
178
194
|
}
|
|
179
195
|
|
|
180
|
-
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, Standard, ValidateFormat, ValidationResult };
|
|
196
|
+
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, RulesetChannel, Standard, ValidateFormat, ValidationResult };
|
|
181
197
|
export type { BeliqOptions, ConvertMeta, ConvertOptions, ConvertResult, DocumentOptions, GenerateInput, GenerateMeta, GenerateResult, LostElement, LostElementsTruncated, ParseOptions, ValidateOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AccountInfo, S as Standard, I as Invoice, n as GenerateProfile, F as FacturxProfile, V as ValidationResult, R as RulesetArtifact, a as DocumentInput, o as ValidateFormat, q as
|
|
1
|
+
import { A as AccountInfo, S as Standard, I as Invoice, n as GenerateProfile, F as FacturxProfile, V as ValidationResult, R as RulesetArtifact, a as DocumentInput, o as ValidateFormat, q as RulesetChannel, r as ParseFormat, u as ParseResult, C as ConvertTargetFormat, v as ConvertSourceFormat, w as ApiErrorCode } from './types-l-8PFJA8.js';
|
|
2
2
|
import { PlainObject } from './helpers.js';
|
|
3
|
-
export {
|
|
3
|
+
export { x as ApiError, D as DEFAULT_BASE_URL, y as DEFAULT_MAX_RETRIES, z as DEFAULT_RETRY_BUDGET_MS, B as DEFAULT_TIMEOUT_MS, E as GenerateBody, G as GeneratePreset, H as GenerateResponse, L as LIVE_CONVERT_SOURCE_FORMATS, b as LIVE_CONVERT_TARGET_FORMATS, c as LIVE_GENERATE_PRESETS, d as LIVE_GENERATE_STANDARDS, e as LIVE_PARSE_FORMATS, f as LIVE_PROFILES, g as LIVE_PROFILES_BY_STANDARD, h as LIVE_VALIDATE_FORMATS, J as ParseWarning, K as ParseWarningCode, M as Severity, N as ValidationFormat, O as ValidationIssue, l as isProfileAllowedForStandard, p as profilesForStandard } from './types-l-8PFJA8.js';
|
|
4
4
|
|
|
5
5
|
interface BeliqOptions {
|
|
6
6
|
/** API key from the beliq dashboard (API Keys). */
|
|
@@ -73,6 +73,22 @@ interface DocumentOptions {
|
|
|
73
73
|
interface ValidateOptions extends DocumentOptions {
|
|
74
74
|
format?: ValidateFormat;
|
|
75
75
|
franceCtc?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The rules to validate against, sent as the `Beliq-Ruleset` header: a channel
|
|
78
|
+
* (`latest` or `previous`), or comma-separated exact pins as
|
|
79
|
+
* `<artifactKey>:<version>`, the keys and versions `GET /v1/rulesets` lists.
|
|
80
|
+
* Left unset, no header is sent, and the API runs the key's organisation
|
|
81
|
+
* default, which is `latest` unless the organisation chose `previous`.
|
|
82
|
+
*
|
|
83
|
+
* The result says what applied: `rulesetChannel` and `rulesetFellBack` which
|
|
84
|
+
* channel, `rulesetArtifacts` and the per-format version fields which rules
|
|
85
|
+
* ran, and `rulesetSunsetsOn` until when a retained ruleset is served. Under
|
|
86
|
+
* exact pins `rulesetChannel` reads `latest`, whatever version a pin ran.
|
|
87
|
+
* The API answers a malformed value with a 400 `VALIDATION_ERROR` before any
|
|
88
|
+
* quota is used, and a pin to a version it no longer serves with a 422
|
|
89
|
+
* `VALIDATION_ERROR`, which uses up a document.
|
|
90
|
+
*/
|
|
91
|
+
ruleset?: RulesetChannel | (string & {});
|
|
76
92
|
}
|
|
77
93
|
interface ParseOptions extends DocumentOptions {
|
|
78
94
|
format?: ParseFormat;
|
|
@@ -177,5 +193,5 @@ declare class BeliqApiError extends Error {
|
|
|
177
193
|
});
|
|
178
194
|
}
|
|
179
195
|
|
|
180
|
-
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, Standard, ValidateFormat, ValidationResult };
|
|
196
|
+
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, RulesetChannel, Standard, ValidateFormat, ValidationResult };
|
|
181
197
|
export type { BeliqOptions, ConvertMeta, ConvertOptions, ConvertResult, DocumentOptions, GenerateInput, GenerateMeta, GenerateResult, LostElement, LostElementsTruncated, ParseOptions, ValidateOptions };
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,10 @@ function buildRequest(params) {
|
|
|
97
97
|
query: withAdvancedQuery(query, params.advanced),
|
|
98
98
|
rawBody: params.rawBody,
|
|
99
99
|
contentType: params.rawContentType ?? "application/xml",
|
|
100
|
+
// No header unless the caller chose one: without it the API runs the
|
|
101
|
+
// organisation's default channel, which a sent `latest` would override.
|
|
102
|
+
// `!= null`: a plain-JS caller's null means unset too, not the string "null".
|
|
103
|
+
...params.ruleset != null ? { headers: { "Beliq-Ruleset": params.ruleset } } : {},
|
|
100
104
|
outputKind: "json"
|
|
101
105
|
};
|
|
102
106
|
}
|
|
@@ -287,7 +291,7 @@ function retryDelayMs(res, attempt, config) {
|
|
|
287
291
|
}
|
|
288
292
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
289
293
|
async function send(config, req) {
|
|
290
|
-
const headers = { ...authHeaders(config) };
|
|
294
|
+
const headers = { ...req.headers, ...authHeaders(config) };
|
|
291
295
|
if (req.contentType) headers["Content-Type"] = req.contentType;
|
|
292
296
|
if (req.accept) headers["Accept"] = req.accept;
|
|
293
297
|
const body = req.jsonBody !== void 0 ? JSON.stringify(req.jsonBody) : req.rawBody;
|
|
@@ -462,7 +466,8 @@ var Beliq = class {
|
|
|
462
466
|
operation: "validate",
|
|
463
467
|
...this.#rawParams(document, options),
|
|
464
468
|
validateFormat: options.format,
|
|
465
|
-
franceCtc: options.franceCtc
|
|
469
|
+
franceCtc: options.franceCtc,
|
|
470
|
+
ruleset: options.ruleset
|
|
466
471
|
});
|
|
467
472
|
}
|
|
468
473
|
/** Parse a document into a structured EN 16931 invoice. */
|
|
@@ -1979,6 +1979,8 @@ type ParseWarning = ParseResult['warnings'][number];
|
|
|
1979
1979
|
type ParseWarningCode = ParseWarning['code'];
|
|
1980
1980
|
/** The JSON-mode generate envelope (Accept: application/json): the seal. */
|
|
1981
1981
|
type GenerateResponse = Json200Data<'generateInvoice'>;
|
|
1982
|
+
/** A ruleset channel: what `rulesetChannel` reports and `Beliq-Ruleset` accepts by name. */
|
|
1983
|
+
type RulesetChannel = NonNullable<ValidationResult['rulesetChannel']>;
|
|
1982
1984
|
/** One row of the ruleset fingerprint (key, version, file hash). */
|
|
1983
1985
|
type RulesetArtifact = NonNullable<ValidationResult['rulesetArtifacts']>[number];
|
|
1984
1986
|
/** The EN 16931 invoice generate accepts, and every option it carries. */
|
|
@@ -1996,5 +1998,5 @@ type ParseFormat = NonNullable<Query<'parseInvoice'>['format']>;
|
|
|
1996
1998
|
type ConvertSourceFormat = NonNullable<Query<'convertInvoice'>['sourceFormat']>;
|
|
1997
1999
|
type ConvertTargetFormat = Query<'convertInvoice'>['targetFormat'];
|
|
1998
2000
|
|
|
1999
|
-
export { DEFAULT_BASE_URL as D, LIVE_CONVERT_SOURCE_FORMATS as L, LIVE_CONVERT_TARGET_FORMATS as b, LIVE_GENERATE_PRESETS as c, LIVE_GENERATE_STANDARDS as d, LIVE_PARSE_FORMATS as e, LIVE_PROFILES as f, LIVE_PROFILES_BY_STANDARD as g, LIVE_VALIDATE_FORMATS as h, compactQuery as i, decodeUtf8 as j, isPlainObject as k, isProfileAllowedForStandard as l, mergeDeep as m, profilesForStandard as p, sniffContentType as s, toBytes as t, DEFAULT_MAX_RETRIES as
|
|
2000
|
-
export type { AccountInfo as A,
|
|
2001
|
+
export { DEFAULT_TIMEOUT_MS as B, DEFAULT_BASE_URL as D, LIVE_CONVERT_SOURCE_FORMATS as L, LIVE_CONVERT_TARGET_FORMATS as b, LIVE_GENERATE_PRESETS as c, LIVE_GENERATE_STANDARDS as d, LIVE_PARSE_FORMATS as e, LIVE_PROFILES as f, LIVE_PROFILES_BY_STANDARD as g, LIVE_VALIDATE_FORMATS as h, compactQuery as i, decodeUtf8 as j, isPlainObject as k, isProfileAllowedForStandard as l, mergeDeep as m, profilesForStandard as p, sniffContentType as s, toBytes as t, DEFAULT_MAX_RETRIES as y, DEFAULT_RETRY_BUDGET_MS as z };
|
|
2002
|
+
export type { AccountInfo as A, ConvertTargetFormat as C, GenerateBody as E, FacturxProfile as F, GeneratePreset as G, GenerateResponse as H, Invoice as I, ParseWarning as J, ParseWarningCode as K, Severity as M, ValidationFormat as N, ValidationIssue as O, PlainObject as P, RulesetArtifact as R, Standard as S, ValidationResult as V, DocumentInput as a, GenerateProfile as n, ValidateFormat as o, RulesetChannel as q, ParseFormat as r, ParseResult as u, ConvertSourceFormat as v, ApiErrorCode as w, ApiError as x };
|
|
@@ -1979,6 +1979,8 @@ type ParseWarning = ParseResult['warnings'][number];
|
|
|
1979
1979
|
type ParseWarningCode = ParseWarning['code'];
|
|
1980
1980
|
/** The JSON-mode generate envelope (Accept: application/json): the seal. */
|
|
1981
1981
|
type GenerateResponse = Json200Data<'generateInvoice'>;
|
|
1982
|
+
/** A ruleset channel: what `rulesetChannel` reports and `Beliq-Ruleset` accepts by name. */
|
|
1983
|
+
type RulesetChannel = NonNullable<ValidationResult['rulesetChannel']>;
|
|
1982
1984
|
/** One row of the ruleset fingerprint (key, version, file hash). */
|
|
1983
1985
|
type RulesetArtifact = NonNullable<ValidationResult['rulesetArtifacts']>[number];
|
|
1984
1986
|
/** The EN 16931 invoice generate accepts, and every option it carries. */
|
|
@@ -1996,5 +1998,5 @@ type ParseFormat = NonNullable<Query<'parseInvoice'>['format']>;
|
|
|
1996
1998
|
type ConvertSourceFormat = NonNullable<Query<'convertInvoice'>['sourceFormat']>;
|
|
1997
1999
|
type ConvertTargetFormat = Query<'convertInvoice'>['targetFormat'];
|
|
1998
2000
|
|
|
1999
|
-
export { DEFAULT_BASE_URL as D, LIVE_CONVERT_SOURCE_FORMATS as L, LIVE_CONVERT_TARGET_FORMATS as b, LIVE_GENERATE_PRESETS as c, LIVE_GENERATE_STANDARDS as d, LIVE_PARSE_FORMATS as e, LIVE_PROFILES as f, LIVE_PROFILES_BY_STANDARD as g, LIVE_VALIDATE_FORMATS as h, compactQuery as i, decodeUtf8 as j, isPlainObject as k, isProfileAllowedForStandard as l, mergeDeep as m, profilesForStandard as p, sniffContentType as s, toBytes as t, DEFAULT_MAX_RETRIES as
|
|
2000
|
-
export type { AccountInfo as A,
|
|
2001
|
+
export { DEFAULT_TIMEOUT_MS as B, DEFAULT_BASE_URL as D, LIVE_CONVERT_SOURCE_FORMATS as L, LIVE_CONVERT_TARGET_FORMATS as b, LIVE_GENERATE_PRESETS as c, LIVE_GENERATE_STANDARDS as d, LIVE_PARSE_FORMATS as e, LIVE_PROFILES as f, LIVE_PROFILES_BY_STANDARD as g, LIVE_VALIDATE_FORMATS as h, compactQuery as i, decodeUtf8 as j, isPlainObject as k, isProfileAllowedForStandard as l, mergeDeep as m, profilesForStandard as p, sniffContentType as s, toBytes as t, DEFAULT_MAX_RETRIES as y, DEFAULT_RETRY_BUDGET_MS as z };
|
|
2002
|
+
export type { AccountInfo as A, ConvertTargetFormat as C, GenerateBody as E, FacturxProfile as F, GeneratePreset as G, GenerateResponse as H, Invoice as I, ParseWarning as J, ParseWarningCode as K, Severity as M, ValidationFormat as N, ValidationIssue as O, PlainObject as P, RulesetArtifact as R, Standard as S, ValidationResult as V, DocumentInput as a, GenerateProfile as n, ValidateFormat as o, RulesetChannel as q, ParseFormat as r, ParseResult as u, ConvertSourceFormat as v, ApiErrorCode as w, ApiError as x };
|
package/package.json
CHANGED