@beliq/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -215,6 +215,11 @@ var LIVE_CONVERT_TARGET_FORMATS = [
215
215
 
216
216
  // src/transport.ts
217
217
  var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 502, 503]);
218
+ var QUOTA_EXHAUSTED_CODE = "QUOTA_EXCEEDED";
219
+ function isRetryable(status, code) {
220
+ if (!RETRYABLE_STATUSES.has(status)) return false;
221
+ return !(status === 429 && code === QUOTA_EXHAUSTED_CODE);
222
+ }
218
223
  var MAX_RETRY_AFTER_MS = 3e4;
219
224
  var BACKOFF_BASE_MS = 500;
220
225
  function authHeaders(config) {
@@ -262,12 +267,13 @@ async function send(config, req) {
262
267
  });
263
268
  const bytes = new Uint8Array(await res.arrayBuffer());
264
269
  if (res.ok) return { status: res.status, headers: res.headers, bytes };
265
- lastError = errorFromResponse(res.status, bytes);
266
- if (!RETRYABLE_STATUSES.has(res.status) || attempt === config.maxRetries) {
267
- throw lastError;
270
+ const apiError = errorFromResponse(res.status, bytes);
271
+ lastError = apiError;
272
+ if (!isRetryable(apiError.status, apiError.code) || attempt === config.maxRetries) {
273
+ throw apiError;
268
274
  }
269
275
  } catch (err) {
270
- if (err instanceof BeliqApiError && !RETRYABLE_STATUSES.has(err.status)) throw err;
276
+ if (err instanceof BeliqApiError && !isRetryable(err.status, err.code)) throw err;
271
277
  if (controller.signal.aborted) {
272
278
  throw new BeliqApiError(
273
279
  `beliq: request to ${req.path} exceeded ${config.timeoutMs}ms`,
@@ -0,0 +1,64 @@
1
+ {
2
+ "number": "INV-2026-001",
3
+ "issueDate": "2026-01-15",
4
+ "currencyCode": "EUR",
5
+ "buyerReference": "04011000-12345-06",
6
+ "seller": {
7
+ "name": "Seller GmbH",
8
+ "vatId": "DE123456789",
9
+ "contactName": "Anna Muster",
10
+ "email": "billing@seller.example",
11
+ "phone": "+49 30 1234567",
12
+ "address": {
13
+ "street": "Hauptstr. 1",
14
+ "city": "Berlin",
15
+ "postalCode": "10115",
16
+ "countryCode": "DE"
17
+ },
18
+ "peppol": {
19
+ "schemeId": "9930",
20
+ "id": "DE123456789"
21
+ }
22
+ },
23
+ "buyer": {
24
+ "name": "Buyer GmbH",
25
+ "email": "ap@buyer.example",
26
+ "address": {
27
+ "street": "Marktweg 2",
28
+ "city": "Munich",
29
+ "postalCode": "80331",
30
+ "countryCode": "DE"
31
+ },
32
+ "vatId": "DE987654321",
33
+ "peppol": {
34
+ "schemeId": "9930",
35
+ "id": "DE987654321"
36
+ }
37
+ },
38
+ "lines": [
39
+ {
40
+ "description": "Consulting",
41
+ "quantity": 10,
42
+ "unitCode": "HUR",
43
+ "unitPrice": 100,
44
+ "lineTotal": 1000,
45
+ "vatRate": 19,
46
+ "vatCategoryCode": "S"
47
+ }
48
+ ],
49
+ "taxSummary": [
50
+ {
51
+ "vatCategoryCode": "S",
52
+ "vatRate": 19,
53
+ "taxableAmount": 1000,
54
+ "taxAmount": 190
55
+ }
56
+ ],
57
+ "paymentMeans": {
58
+ "typeCode": "58",
59
+ "iban": "DE89370400440532013000"
60
+ },
61
+ "totalNetAmount": 1000,
62
+ "totalTaxAmount": 190,
63
+ "totalGrossAmount": 1190
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beliq/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Official beliq SDK: generate, validate, parse, and convert EU-compliant e-invoices (XRechnung, ZUGFeRD, Factur-X, Peppol BIS) against authority-pinned, drift-checked rules.",
5
5
  "keywords": [
6
6
  "beliq",
@@ -54,7 +54,8 @@
54
54
  }
55
55
  },
56
56
  "files": [
57
- "dist"
57
+ "dist",
58
+ "examples"
58
59
  ],
59
60
  "publishConfig": {
60
61
  "access": "public",
@@ -69,6 +70,7 @@
69
70
  "typecheck": "tsc --noEmit",
70
71
  "lint": "eslint src test",
71
72
  "lint:fix": "eslint src test --fix",
73
+ "scrub:check": "bash scripts/scrub-check.sh",
72
74
  "sync:spec": "node scripts/sync-spec.mjs",
73
75
  "gen:types": "node scripts/gen-types.mjs",
74
76
  "openapi:check": "node scripts/gen-types.mjs --check",
@@ -81,7 +83,7 @@
81
83
  "dependencies": {},
82
84
  "overrides": {
83
85
  "esbuild": "^0.28.1",
84
- "js-yaml": "^4.3.1"
86
+ "js-yaml": "^4.3.2"
85
87
  },
86
88
  "devDependencies": {
87
89
  "@eslint/js": "^10.0.0",