@beliq/sdk 0.7.0 → 0.7.2
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 +34 -0
- package/README.md +27 -7
- 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 +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +7 -2
- package/dist/{types-BjW5SogX.d.cts → types-B-aV1djO.d.cts} +24 -2
- package/dist/{types-BjW5SogX.d.ts → types-B-aV1djO.d.ts} +24 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,40 @@
|
|
|
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.2 - 2026-11-07
|
|
8
|
+
|
|
9
|
+
- `ValidationResult` has `rulesetSupersededOn`, from the API document
|
|
10
|
+
0.26.0: the ISO date the authority made the successor of a ruleset the
|
|
11
|
+
request selected mandatory, when that date is on or before the day of the
|
|
12
|
+
verdict, and the earliest such date when there are several. Each such
|
|
13
|
+
ruleset also adds a `RULESET_SUPERSEDED` warning that names it, its
|
|
14
|
+
version, the successor and the date. `valid` is still the verdict of the
|
|
15
|
+
version that ran. The field is optional, so no code needs to change.
|
|
16
|
+
- The vendored `openapi.json` is document `0.26.0` of the API, up from
|
|
17
|
+
`0.24.0`. Document `0.25.0` added the `x-beliq-idempotent-replay`
|
|
18
|
+
response header on `generate`, `validate`, `parse` and `convert`, which
|
|
19
|
+
the client does not read. The generated types also carry the API's
|
|
20
|
+
description of `subLines`: at most 64 levels deep, a limit beliq set and
|
|
21
|
+
no format rule.
|
|
22
|
+
- The README and the option comments say that beliq does not charge a
|
|
23
|
+
repeat of a charged `generate`, `validate`, `parse` or `convert` request
|
|
24
|
+
again within 15 minutes of the charge, up to 10 repeats, and that every
|
|
25
|
+
retry sends the same request. A `maxRetries` above 10 can be charged again,
|
|
26
|
+
and so can every attempt when beliq cannot read or write its record of
|
|
27
|
+
charged requests. They also say why a `504` and this client's
|
|
28
|
+
own timeout stay unretried: a repeat runs the same document again from
|
|
29
|
+
the start. No code changes.
|
|
30
|
+
|
|
31
|
+
## 0.7.1 - 2026-11-06
|
|
32
|
+
|
|
33
|
+
- `validate` takes a `ruleset` option, sent as the `Beliq-Ruleset` header: a
|
|
34
|
+
channel (`latest` or `previous`) or comma-separated `<artifactKey>:<version>`
|
|
35
|
+
pins. Unset, no header is sent, as before, so an organisation's default
|
|
36
|
+
channel still applies. The new `RulesetChannel` type is the channel names the
|
|
37
|
+
API reports in `rulesetChannel`.
|
|
38
|
+
- `BuiltRequest` from `@beliq/sdk/helpers` has an optional `headers` field, and
|
|
39
|
+
`BuildParams` an optional `ruleset`.
|
|
40
|
+
|
|
7
41
|
## 0.7.0 - 2026-11-06
|
|
8
42
|
|
|
9
43
|
A minor, because a call that meets an outage can now take up to 15 minutes to
|
package/README.md
CHANGED
|
@@ -143,13 +143,20 @@ What a retry costs:
|
|
|
143
143
|
- The unit of an `ENGINE_UNAVAILABLE` is refunded, within the cap that page
|
|
144
144
|
names.
|
|
145
145
|
- A test key's sandbox units are never refunded.
|
|
146
|
-
- A connection lost after the request was sent can mean beliq already
|
|
147
|
-
|
|
148
|
-
request
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
- A connection lost after the request was sent can mean beliq already ran the
|
|
147
|
+
request and charged it. beliq does not charge a repeat of a charged
|
|
148
|
+
`generate`, `validate`, `parse` or `convert` request again within 15 minutes
|
|
149
|
+
of the charge, up to 10 repeats, and every retry sends the same request. The
|
|
150
|
+
15 minutes and the 10 repeats are beliq's own choice; no standard sets them.
|
|
151
|
+
The answer to such a repeat carries `x-beliq-idempotent-replay: true`. A
|
|
152
|
+
`maxRetries` above 10 can be charged again. When beliq cannot read or write
|
|
153
|
+
its record of charged requests, it charges every attempt.
|
|
154
|
+
https://docs.beliq.eu/api-reference/errors/#repeated-requests-are-not-charged-again
|
|
155
|
+
says what makes two requests the same.
|
|
156
|
+
|
|
157
|
+
`504` and this client's own timeout are deliberately **not** retried: both can
|
|
158
|
+
mean the work is still running on beliq's side, and a retry runs the same
|
|
159
|
+
document again from the start, so it would likely run out of time again.
|
|
153
160
|
|
|
154
161
|
A `429` carrying `QUOTA_EXCEEDED` is not retried either. `RATE_LIMITED` and
|
|
155
162
|
`ACCOUNT_THROTTLED` clear on their own, but a spent monthly allowance only returns
|
|
@@ -186,6 +193,19 @@ const ok = createHash('sha256').update(doc.bytes).digest('hex') === doc.sha256;
|
|
|
186
193
|
console.log(doc.validationResult?.valid, doc.meta.rulesetSha256, ok);
|
|
187
194
|
```
|
|
188
195
|
|
|
196
|
+
### Choosing the ruleset
|
|
197
|
+
|
|
198
|
+
`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.
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
const result = await beliq.validate(xml, { ruleset: 'previous' });
|
|
202
|
+
console.log(result.rulesetChannel, result.rulesetFellBack, result.rulesetArtifacts);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
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, `rulesetSunsetsOn` says until when a retained ruleset is served, and `rulesetSupersededOn` from when the authority made the successor of a ruleset the request selected mandatory, with a `RULESET_SUPERSEDED` warning per such ruleset; `valid` is still the verdict of the version that ran. `GET /v1/rulesets` gives each format's `previousChannel`: what `previous` reaches for it today.
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
189
209
|
### Curated option lists
|
|
190
210
|
|
|
191
211
|
`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-B-aV1djO.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-B-aV1djO.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-B-aV1djO.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-B-aV1djO.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-B-aV1djO.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-B-aV1djO.cjs';
|
|
4
4
|
|
|
5
5
|
interface BeliqOptions {
|
|
6
6
|
/** API key from the beliq dashboard (API Keys). */
|
|
@@ -16,8 +16,8 @@ interface BeliqOptions {
|
|
|
16
16
|
* the full Schematron rule set over a document, so a generate or validate can
|
|
17
17
|
* take tens of seconds legitimately. Set well above the latency you expect:
|
|
18
18
|
* a deadline shorter than the server's own means giving up on work that is
|
|
19
|
-
* still running, and this client does not retry its own timeout, since
|
|
20
|
-
*
|
|
19
|
+
* still running, and this client does not retry its own timeout, since a
|
|
20
|
+
* repeat runs the same document again from the start. 0 disables the deadline.
|
|
21
21
|
*/
|
|
22
22
|
timeoutMs?: number;
|
|
23
23
|
/**
|
|
@@ -73,6 +73,25 @@ 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, `rulesetSunsetsOn` until when a retained ruleset is served, and
|
|
86
|
+
* `rulesetSupersededOn` from when the authority made the successor of a
|
|
87
|
+
* selected ruleset mandatory, with a `RULESET_SUPERSEDED` warning per such
|
|
88
|
+
* ruleset. Under exact pins `rulesetChannel` reads `latest`, whatever version
|
|
89
|
+
* a pin ran.
|
|
90
|
+
* The API answers a malformed value with a 400 `VALIDATION_ERROR` before any
|
|
91
|
+
* quota is used, and a pin to a version it no longer serves with a 422
|
|
92
|
+
* `VALIDATION_ERROR`, which uses up a document.
|
|
93
|
+
*/
|
|
94
|
+
ruleset?: RulesetChannel | (string & {});
|
|
76
95
|
}
|
|
77
96
|
interface ParseOptions extends DocumentOptions {
|
|
78
97
|
format?: ParseFormat;
|
|
@@ -177,5 +196,5 @@ declare class BeliqApiError extends Error {
|
|
|
177
196
|
});
|
|
178
197
|
}
|
|
179
198
|
|
|
180
|
-
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, Standard, ValidateFormat, ValidationResult };
|
|
199
|
+
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, RulesetChannel, Standard, ValidateFormat, ValidationResult };
|
|
181
200
|
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-B-aV1djO.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-B-aV1djO.js';
|
|
4
4
|
|
|
5
5
|
interface BeliqOptions {
|
|
6
6
|
/** API key from the beliq dashboard (API Keys). */
|
|
@@ -16,8 +16,8 @@ interface BeliqOptions {
|
|
|
16
16
|
* the full Schematron rule set over a document, so a generate or validate can
|
|
17
17
|
* take tens of seconds legitimately. Set well above the latency you expect:
|
|
18
18
|
* a deadline shorter than the server's own means giving up on work that is
|
|
19
|
-
* still running, and this client does not retry its own timeout, since
|
|
20
|
-
*
|
|
19
|
+
* still running, and this client does not retry its own timeout, since a
|
|
20
|
+
* repeat runs the same document again from the start. 0 disables the deadline.
|
|
21
21
|
*/
|
|
22
22
|
timeoutMs?: number;
|
|
23
23
|
/**
|
|
@@ -73,6 +73,25 @@ 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, `rulesetSunsetsOn` until when a retained ruleset is served, and
|
|
86
|
+
* `rulesetSupersededOn` from when the authority made the successor of a
|
|
87
|
+
* selected ruleset mandatory, with a `RULESET_SUPERSEDED` warning per such
|
|
88
|
+
* ruleset. Under exact pins `rulesetChannel` reads `latest`, whatever version
|
|
89
|
+
* a pin ran.
|
|
90
|
+
* The API answers a malformed value with a 400 `VALIDATION_ERROR` before any
|
|
91
|
+
* quota is used, and a pin to a version it no longer serves with a 422
|
|
92
|
+
* `VALIDATION_ERROR`, which uses up a document.
|
|
93
|
+
*/
|
|
94
|
+
ruleset?: RulesetChannel | (string & {});
|
|
76
95
|
}
|
|
77
96
|
interface ParseOptions extends DocumentOptions {
|
|
78
97
|
format?: ParseFormat;
|
|
@@ -177,5 +196,5 @@ declare class BeliqApiError extends Error {
|
|
|
177
196
|
});
|
|
178
197
|
}
|
|
179
198
|
|
|
180
|
-
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, Standard, ValidateFormat, ValidationResult };
|
|
199
|
+
export { AccountInfo, ApiErrorCode, Beliq, BeliqApiError, ConvertSourceFormat, ConvertTargetFormat, DocumentInput, FacturxProfile, GenerateProfile, Invoice, ParseFormat, ParseResult, RulesetArtifact, RulesetChannel, Standard, ValidateFormat, ValidationResult };
|
|
181
200
|
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. */
|
|
@@ -157,6 +157,7 @@ interface components {
|
|
|
157
157
|
startDate?: string;
|
|
158
158
|
endDate?: string;
|
|
159
159
|
};
|
|
160
|
+
/** @description Lines nested under this line, at most 64 levels deep with the top-level line as level 1. The 64 is Beliq's own limit, not a format rule. A deeper tree is refused with 422 `VALIDATION_ERROR` before the body is checked against this schema, and no quota unit is spent. */
|
|
160
161
|
subLines?: components["schemas"]["InvoiceLine"][];
|
|
161
162
|
};
|
|
162
163
|
};
|
|
@@ -483,6 +484,7 @@ interface operations {
|
|
|
483
484
|
startDate?: string;
|
|
484
485
|
endDate?: string;
|
|
485
486
|
};
|
|
487
|
+
/** @description Lines nested under this line, at most 64 levels deep with the top-level line as level 1. The 64 is Beliq's own limit, not a format rule. A deeper tree is refused with 422 `VALIDATION_ERROR` before the body is checked against this schema, and no quota unit is spent. */
|
|
486
488
|
subLines?: components["schemas"]["InvoiceLine"][];
|
|
487
489
|
}[];
|
|
488
490
|
taxSummary?: {
|
|
@@ -642,6 +644,8 @@ interface operations {
|
|
|
642
644
|
"x-ruleset-artifacts"?: string;
|
|
643
645
|
/** @description How the returned PDF was built: "hybrid" (PDF/A-3 with the XML embedded) or "visualization" (rendered pages only, no XML embedded). */
|
|
644
646
|
"x-pdf-kind"?: string;
|
|
647
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
648
|
+
"x-beliq-idempotent-replay"?: string;
|
|
645
649
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
646
650
|
"x-beliq-livemode"?: string;
|
|
647
651
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -707,6 +711,11 @@ interface operations {
|
|
|
707
711
|
* @description ISO date the retained ruleset serving this request stops being served. Present only when a retained ruleset ran (never on a default request); the earliest date when several ran. After it an exact pin 422s. It bounds the pin, not the channel: `previous` stops reaching the version on this date or on the authority's mandatory date for the successor, whichever comes first.
|
|
708
712
|
*/
|
|
709
713
|
rulesetSunsetsOn?: string;
|
|
714
|
+
/**
|
|
715
|
+
* Format: date
|
|
716
|
+
* @description ISO date the authority made the successor of a ruleset this request selected mandatory, when that date is on or before the day of the verdict; the earliest date when several were. Each such ruleset also adds a `RULESET_SUPERSEDED` warning naming it, its version, the successor and the date. Absent when none was. `valid` is still the verdict of the version that ran.
|
|
717
|
+
*/
|
|
718
|
+
rulesetSupersededOn?: string;
|
|
710
719
|
/** @description Present only when the document sent to `POST /v1/validate` was a PDF: which embedded file the verdict is about, and that the PDF around it was not checked. */
|
|
711
720
|
pdfInput?: {
|
|
712
721
|
/**
|
|
@@ -982,6 +991,8 @@ interface operations {
|
|
|
982
991
|
"x-ruleset-artifacts"?: string;
|
|
983
992
|
/** @description The ruleset selection that actually applied. Set when the request carried a Beliq-Ruleset header, or carried none and the API key's organisation has "previous" as its default channel. Reveals a "previous"→"latest" fallback. */
|
|
984
993
|
"beliq-ruleset-resolved"?: string;
|
|
994
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
995
|
+
"x-beliq-idempotent-replay"?: string;
|
|
985
996
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
986
997
|
"x-beliq-livemode"?: string;
|
|
987
998
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -1040,6 +1051,11 @@ interface operations {
|
|
|
1040
1051
|
* @description ISO date the retained ruleset serving this request stops being served. Present only when a retained ruleset ran (never on a default request); the earliest date when several ran. After it an exact pin 422s. It bounds the pin, not the channel: `previous` stops reaching the version on this date or on the authority's mandatory date for the successor, whichever comes first.
|
|
1041
1052
|
*/
|
|
1042
1053
|
rulesetSunsetsOn?: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* Format: date
|
|
1056
|
+
* @description ISO date the authority made the successor of a ruleset this request selected mandatory, when that date is on or before the day of the verdict; the earliest date when several were. Each such ruleset also adds a `RULESET_SUPERSEDED` warning naming it, its version, the successor and the date. Absent when none was. `valid` is still the verdict of the version that ran.
|
|
1057
|
+
*/
|
|
1058
|
+
rulesetSupersededOn?: string;
|
|
1043
1059
|
/** @description Present only when the document sent to `POST /v1/validate` was a PDF: which embedded file the verdict is about, and that the PDF around it was not checked. */
|
|
1044
1060
|
pdfInput?: {
|
|
1045
1061
|
/**
|
|
@@ -1281,6 +1297,8 @@ interface operations {
|
|
|
1281
1297
|
"x-ruleset-sha256"?: string;
|
|
1282
1298
|
/** @description One-line verdict, e.g. "pass · 0 err · 1 warn". */
|
|
1283
1299
|
"x-validation"?: string;
|
|
1300
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
1301
|
+
"x-beliq-idempotent-replay"?: string;
|
|
1284
1302
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
1285
1303
|
"x-beliq-livemode"?: string;
|
|
1286
1304
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -1589,6 +1607,8 @@ interface operations {
|
|
|
1589
1607
|
"x-output-envelope"?: string;
|
|
1590
1608
|
/** @description Compact JSON naming the ruleset/artifact versions pinned for the produced format. */
|
|
1591
1609
|
"x-version-block"?: string;
|
|
1610
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
1611
|
+
"x-beliq-idempotent-replay"?: string;
|
|
1592
1612
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
1593
1613
|
"x-beliq-livemode"?: string;
|
|
1594
1614
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -1979,6 +1999,8 @@ type ParseWarning = ParseResult['warnings'][number];
|
|
|
1979
1999
|
type ParseWarningCode = ParseWarning['code'];
|
|
1980
2000
|
/** The JSON-mode generate envelope (Accept: application/json): the seal. */
|
|
1981
2001
|
type GenerateResponse = Json200Data<'generateInvoice'>;
|
|
2002
|
+
/** A ruleset channel: what `rulesetChannel` reports and `Beliq-Ruleset` accepts by name. */
|
|
2003
|
+
type RulesetChannel = NonNullable<ValidationResult['rulesetChannel']>;
|
|
1982
2004
|
/** One row of the ruleset fingerprint (key, version, file hash). */
|
|
1983
2005
|
type RulesetArtifact = NonNullable<ValidationResult['rulesetArtifacts']>[number];
|
|
1984
2006
|
/** The EN 16931 invoice generate accepts, and every option it carries. */
|
|
@@ -1996,5 +2018,5 @@ type ParseFormat = NonNullable<Query<'parseInvoice'>['format']>;
|
|
|
1996
2018
|
type ConvertSourceFormat = NonNullable<Query<'convertInvoice'>['sourceFormat']>;
|
|
1997
2019
|
type ConvertTargetFormat = Query<'convertInvoice'>['targetFormat'];
|
|
1998
2020
|
|
|
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,
|
|
2021
|
+
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 };
|
|
2022
|
+
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 };
|
|
@@ -157,6 +157,7 @@ interface components {
|
|
|
157
157
|
startDate?: string;
|
|
158
158
|
endDate?: string;
|
|
159
159
|
};
|
|
160
|
+
/** @description Lines nested under this line, at most 64 levels deep with the top-level line as level 1. The 64 is Beliq's own limit, not a format rule. A deeper tree is refused with 422 `VALIDATION_ERROR` before the body is checked against this schema, and no quota unit is spent. */
|
|
160
161
|
subLines?: components["schemas"]["InvoiceLine"][];
|
|
161
162
|
};
|
|
162
163
|
};
|
|
@@ -483,6 +484,7 @@ interface operations {
|
|
|
483
484
|
startDate?: string;
|
|
484
485
|
endDate?: string;
|
|
485
486
|
};
|
|
487
|
+
/** @description Lines nested under this line, at most 64 levels deep with the top-level line as level 1. The 64 is Beliq's own limit, not a format rule. A deeper tree is refused with 422 `VALIDATION_ERROR` before the body is checked against this schema, and no quota unit is spent. */
|
|
486
488
|
subLines?: components["schemas"]["InvoiceLine"][];
|
|
487
489
|
}[];
|
|
488
490
|
taxSummary?: {
|
|
@@ -642,6 +644,8 @@ interface operations {
|
|
|
642
644
|
"x-ruleset-artifacts"?: string;
|
|
643
645
|
/** @description How the returned PDF was built: "hybrid" (PDF/A-3 with the XML embedded) or "visualization" (rendered pages only, no XML embedded). */
|
|
644
646
|
"x-pdf-kind"?: string;
|
|
647
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
648
|
+
"x-beliq-idempotent-replay"?: string;
|
|
645
649
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
646
650
|
"x-beliq-livemode"?: string;
|
|
647
651
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -707,6 +711,11 @@ interface operations {
|
|
|
707
711
|
* @description ISO date the retained ruleset serving this request stops being served. Present only when a retained ruleset ran (never on a default request); the earliest date when several ran. After it an exact pin 422s. It bounds the pin, not the channel: `previous` stops reaching the version on this date or on the authority's mandatory date for the successor, whichever comes first.
|
|
708
712
|
*/
|
|
709
713
|
rulesetSunsetsOn?: string;
|
|
714
|
+
/**
|
|
715
|
+
* Format: date
|
|
716
|
+
* @description ISO date the authority made the successor of a ruleset this request selected mandatory, when that date is on or before the day of the verdict; the earliest date when several were. Each such ruleset also adds a `RULESET_SUPERSEDED` warning naming it, its version, the successor and the date. Absent when none was. `valid` is still the verdict of the version that ran.
|
|
717
|
+
*/
|
|
718
|
+
rulesetSupersededOn?: string;
|
|
710
719
|
/** @description Present only when the document sent to `POST /v1/validate` was a PDF: which embedded file the verdict is about, and that the PDF around it was not checked. */
|
|
711
720
|
pdfInput?: {
|
|
712
721
|
/**
|
|
@@ -982,6 +991,8 @@ interface operations {
|
|
|
982
991
|
"x-ruleset-artifacts"?: string;
|
|
983
992
|
/** @description The ruleset selection that actually applied. Set when the request carried a Beliq-Ruleset header, or carried none and the API key's organisation has "previous" as its default channel. Reveals a "previous"→"latest" fallback. */
|
|
984
993
|
"beliq-ruleset-resolved"?: string;
|
|
994
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
995
|
+
"x-beliq-idempotent-replay"?: string;
|
|
985
996
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
986
997
|
"x-beliq-livemode"?: string;
|
|
987
998
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -1040,6 +1051,11 @@ interface operations {
|
|
|
1040
1051
|
* @description ISO date the retained ruleset serving this request stops being served. Present only when a retained ruleset ran (never on a default request); the earliest date when several ran. After it an exact pin 422s. It bounds the pin, not the channel: `previous` stops reaching the version on this date or on the authority's mandatory date for the successor, whichever comes first.
|
|
1041
1052
|
*/
|
|
1042
1053
|
rulesetSunsetsOn?: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* Format: date
|
|
1056
|
+
* @description ISO date the authority made the successor of a ruleset this request selected mandatory, when that date is on or before the day of the verdict; the earliest date when several were. Each such ruleset also adds a `RULESET_SUPERSEDED` warning naming it, its version, the successor and the date. Absent when none was. `valid` is still the verdict of the version that ran.
|
|
1057
|
+
*/
|
|
1058
|
+
rulesetSupersededOn?: string;
|
|
1043
1059
|
/** @description Present only when the document sent to `POST /v1/validate` was a PDF: which embedded file the verdict is about, and that the PDF around it was not checked. */
|
|
1044
1060
|
pdfInput?: {
|
|
1045
1061
|
/**
|
|
@@ -1281,6 +1297,8 @@ interface operations {
|
|
|
1281
1297
|
"x-ruleset-sha256"?: string;
|
|
1282
1298
|
/** @description One-line verdict, e.g. "pass · 0 err · 1 warn". */
|
|
1283
1299
|
"x-validation"?: string;
|
|
1300
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
1301
|
+
"x-beliq-idempotent-replay"?: string;
|
|
1284
1302
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
1285
1303
|
"x-beliq-livemode"?: string;
|
|
1286
1304
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -1589,6 +1607,8 @@ interface operations {
|
|
|
1589
1607
|
"x-output-envelope"?: string;
|
|
1590
1608
|
/** @description Compact JSON naming the ruleset/artifact versions pinned for the produced format. */
|
|
1591
1609
|
"x-version-block"?: string;
|
|
1610
|
+
/** @description "true" when this request repeats one your organisation sent in the same mode and was charged for in the last 15 minutes: the same route, query, Content-Type, Accept, ruleset selection and body, and for generate the same stored PDF template. The request was computed again and not charged. One charge covers 10 such repeats; the 11th is charged and starts a new 15 minutes. The window, what makes two requests the same and the cap are a choice Beliq made; no standard sets them. Absent when the request was charged. */
|
|
1611
|
+
"x-beliq-idempotent-replay"?: string;
|
|
1592
1612
|
/** @description "true" for a live key, "false" for a test key. Test-mode documents are watermarked and do not draw on the live monthly quota. */
|
|
1593
1613
|
"x-beliq-livemode"?: string;
|
|
1594
1614
|
/** @description Correlation id for this request. Quote it in a support request; it is the key the API, the engine, and error tracking all record. */
|
|
@@ -1979,6 +1999,8 @@ type ParseWarning = ParseResult['warnings'][number];
|
|
|
1979
1999
|
type ParseWarningCode = ParseWarning['code'];
|
|
1980
2000
|
/** The JSON-mode generate envelope (Accept: application/json): the seal. */
|
|
1981
2001
|
type GenerateResponse = Json200Data<'generateInvoice'>;
|
|
2002
|
+
/** A ruleset channel: what `rulesetChannel` reports and `Beliq-Ruleset` accepts by name. */
|
|
2003
|
+
type RulesetChannel = NonNullable<ValidationResult['rulesetChannel']>;
|
|
1982
2004
|
/** One row of the ruleset fingerprint (key, version, file hash). */
|
|
1983
2005
|
type RulesetArtifact = NonNullable<ValidationResult['rulesetArtifacts']>[number];
|
|
1984
2006
|
/** The EN 16931 invoice generate accepts, and every option it carries. */
|
|
@@ -1996,5 +2018,5 @@ type ParseFormat = NonNullable<Query<'parseInvoice'>['format']>;
|
|
|
1996
2018
|
type ConvertSourceFormat = NonNullable<Query<'convertInvoice'>['sourceFormat']>;
|
|
1997
2019
|
type ConvertTargetFormat = Query<'convertInvoice'>['targetFormat'];
|
|
1998
2020
|
|
|
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,
|
|
2021
|
+
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 };
|
|
2022
|
+
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