@beliq/sdk 0.5.1 → 0.6.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/CHANGELOG.md +58 -0
- package/README.md +15 -4
- package/dist/helpers.cjs +69 -3
- package/dist/helpers.d.cts +42 -3
- package/dist/helpers.d.ts +42 -3
- package/dist/helpers.js +59 -2
- package/dist/index.cjs +22 -13
- package/dist/index.d.cts +30 -1838
- package/dist/index.d.ts +30 -1838
- package/dist/index.js +22 -13
- package/dist/types-Bc3c79Ss.d.cts +1986 -0
- package/dist/types-Bc3c79Ss.d.ts +1986 -0
- package/package.json +5 -5
- package/dist/constants-DFGl_MXW.d.cts +0 -94
- package/dist/constants-DFGl_MXW.d.ts +0 -94
package/dist/index.js
CHANGED
|
@@ -206,7 +206,15 @@ function isProfileAllowedForStandard(standard, profile) {
|
|
|
206
206
|
const allowed = profilesForStandard(standard);
|
|
207
207
|
return allowed.length === 0 || allowed.includes(profile);
|
|
208
208
|
}
|
|
209
|
-
var LIVE_VALIDATE_FORMATS = [
|
|
209
|
+
var LIVE_VALIDATE_FORMATS = [
|
|
210
|
+
"auto",
|
|
211
|
+
"cii",
|
|
212
|
+
"ubl",
|
|
213
|
+
"fatturapa",
|
|
214
|
+
"facturae",
|
|
215
|
+
"eslog",
|
|
216
|
+
"poland_ksef_fa3"
|
|
217
|
+
];
|
|
210
218
|
var LIVE_PARSE_FORMATS = ["auto", "cii", "ubl"];
|
|
211
219
|
var LIVE_CONVERT_SOURCE_FORMATS = [
|
|
212
220
|
"auto",
|
|
@@ -326,6 +334,16 @@ function parseRulesetArtifacts(headers) {
|
|
|
326
334
|
return void 0;
|
|
327
335
|
}
|
|
328
336
|
}
|
|
337
|
+
function parseLostElements(headers) {
|
|
338
|
+
const raw = headers.get("x-lost-elements");
|
|
339
|
+
if (!raw) return void 0;
|
|
340
|
+
try {
|
|
341
|
+
const parsed = JSON.parse(raw);
|
|
342
|
+
return Array.isArray(parsed) ? parsed : void 0;
|
|
343
|
+
} catch {
|
|
344
|
+
return void 0;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
329
347
|
function generateMeta(headers) {
|
|
330
348
|
return {
|
|
331
349
|
schematronVersion: headers.get("x-schematron-version") ?? void 0,
|
|
@@ -337,22 +355,13 @@ function generateMeta(headers) {
|
|
|
337
355
|
};
|
|
338
356
|
}
|
|
339
357
|
function convertMeta(headers) {
|
|
340
|
-
let lostElements;
|
|
341
|
-
const lostRaw = headers.get("x-lost-elements");
|
|
342
|
-
if (lostRaw) {
|
|
343
|
-
try {
|
|
344
|
-
const parsed = JSON.parse(lostRaw);
|
|
345
|
-
if (Array.isArray(parsed)) lostElements = parsed.map(String);
|
|
346
|
-
} catch {
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
358
|
const countRaw = headers.get("x-lost-elements-count");
|
|
350
359
|
return {
|
|
351
360
|
sourceFormat: headers.get("x-source-format") ?? void 0,
|
|
352
361
|
targetFormat: headers.get("x-target-format") ?? void 0,
|
|
353
362
|
profileDetected: headers.get("x-profile-detected") ?? void 0,
|
|
354
363
|
lostElementsCount: countRaw != null ? Number(countRaw) : void 0,
|
|
355
|
-
lostElements,
|
|
364
|
+
lostElements: parseLostElements(headers),
|
|
356
365
|
conversionTools: headers.get("x-conversion-tools") ?? void 0,
|
|
357
366
|
livemode: livemodeHeader(headers)
|
|
358
367
|
};
|
|
@@ -385,7 +394,7 @@ var Beliq = class {
|
|
|
385
394
|
async me() {
|
|
386
395
|
return this.#json({ operation: "me" });
|
|
387
396
|
}
|
|
388
|
-
/** Generate
|
|
397
|
+
/** Generate an e-invoice from an EN 16931 object. */
|
|
389
398
|
async generate(input) {
|
|
390
399
|
const res = await send(
|
|
391
400
|
this.#config,
|
|
@@ -420,7 +429,7 @@ var Beliq = class {
|
|
|
420
429
|
meta
|
|
421
430
|
};
|
|
422
431
|
}
|
|
423
|
-
/** Validate a document
|
|
432
|
+
/** Validate a document. The result names the rules that ran and, in `verificationBadgeLabel` when the API states one, the check depth. */
|
|
424
433
|
async validate(document, options = {}) {
|
|
425
434
|
return this.#json({
|
|
426
435
|
operation: "validate",
|