@getpeppr/sdk 1.1.3 → 1.3.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/core/checksums/de-ust-idnr.d.ts +9 -0
- package/dist/core/checksums/de-ust-idnr.d.ts.map +1 -0
- package/dist/core/checksums/de-ust-idnr.js +27 -0
- package/dist/core/checksums/de-ust-idnr.js.map +1 -0
- package/dist/core/checksums/index.d.ts +4 -0
- package/dist/core/checksums/index.d.ts.map +1 -0
- package/dist/core/checksums/index.js +4 -0
- package/dist/core/checksums/index.js.map +1 -0
- package/dist/core/checksums/luhn.d.ts +12 -0
- package/dist/core/checksums/luhn.d.ts.map +1 -0
- package/dist/core/checksums/luhn.js +42 -0
- package/dist/core/checksums/luhn.js.map +1 -0
- package/dist/core/checksums/mod97.d.ts +8 -0
- package/dist/core/checksums/mod97.d.ts.map +1 -0
- package/dist/core/checksums/mod97.js +14 -0
- package/dist/core/checksums/mod97.js.map +1 -0
- package/dist/core/peppol-icd-codes.d.ts +24 -0
- package/dist/core/peppol-icd-codes.d.ts.map +1 -0
- package/dist/core/peppol-icd-codes.js +54 -0
- package/dist/core/peppol-icd-codes.js.map +1 -0
- package/dist/core/peppol-identifier-rules.d.ts +47 -0
- package/dist/core/peppol-identifier-rules.d.ts.map +1 -0
- package/dist/core/peppol-identifier-rules.js +162 -0
- package/dist/core/peppol-identifier-rules.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* German USt-IdNr (VAT ID) check.
|
|
3
|
+
* Format: "DE" + 9 digits. Check digit algorithm is a modulo-11 variant
|
|
4
|
+
* published by BZSt. Iterate over the 8 payload digits, maintaining
|
|
5
|
+
* a running product/sum: P = ((Sn mod 10) || 10) * 2 mod 11, Sn = (P + d) mod 10.
|
|
6
|
+
* The 9th digit equals (11 - P_final) mod 10.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isValidDeUstIdNr(input: string): boolean;
|
|
9
|
+
//# sourceMappingURL=de-ust-idnr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de-ust-idnr.d.ts","sourceRoot":"","sources":["../../../src/core/checksums/de-ust-idnr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAgBvD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* German USt-IdNr (VAT ID) check.
|
|
3
|
+
* Format: "DE" + 9 digits. Check digit algorithm is a modulo-11 variant
|
|
4
|
+
* published by BZSt. Iterate over the 8 payload digits, maintaining
|
|
5
|
+
* a running product/sum: P = ((Sn mod 10) || 10) * 2 mod 11, Sn = (P + d) mod 10.
|
|
6
|
+
* The 9th digit equals (11 - P_final) mod 10.
|
|
7
|
+
*/
|
|
8
|
+
export function isValidDeUstIdNr(input) {
|
|
9
|
+
if (!/^DE\d{9}$/.test(input))
|
|
10
|
+
return false;
|
|
11
|
+
const digits = input.slice(2);
|
|
12
|
+
// Reject all-zero explicitly.
|
|
13
|
+
if (/^0+$/.test(digits))
|
|
14
|
+
return false;
|
|
15
|
+
let P = 10;
|
|
16
|
+
for (let i = 0; i < 8; i++) {
|
|
17
|
+
const d = digits.charCodeAt(i) - 48;
|
|
18
|
+
let S = (d + P) % 10;
|
|
19
|
+
if (S === 0)
|
|
20
|
+
S = 10;
|
|
21
|
+
P = (2 * S) % 11;
|
|
22
|
+
}
|
|
23
|
+
const expected = (11 - P) % 10;
|
|
24
|
+
const actual = digits.charCodeAt(8) - 48;
|
|
25
|
+
return expected === actual;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=de-ust-idnr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de-ust-idnr.js","sourceRoot":"","sources":["../../../src/core/checksums/de-ust-idnr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAEtC,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC;YAAE,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACzC,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/checksums/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/checksums/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Luhn mod-10 checksum used by French SIREN/SIRET identifiers.
|
|
3
|
+
* Input is checked digits-only: callers must `.trim()` and ensure length.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isValidLuhn(input: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* SIRET-specific Luhn: mainland is standard Luhn over 14 digits.
|
|
8
|
+
* Mayotte (DOM 976) uses a variant where the sum of all 14 digits must be a
|
|
9
|
+
* multiple of 5. We detect Mayotte by SIREN allocation range 356 000 000 – 356 999 999.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isValidLuhnSiret(input: string): boolean;
|
|
12
|
+
//# sourceMappingURL=luhn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luhn.d.ts","sourceRoot":"","sources":["../../../src/core/checksums/luhn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAclD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAgBvD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Luhn mod-10 checksum used by French SIREN/SIRET identifiers.
|
|
3
|
+
* Input is checked digits-only: callers must `.trim()` and ensure length.
|
|
4
|
+
*/
|
|
5
|
+
export function isValidLuhn(input) {
|
|
6
|
+
if (!/^\d+$/.test(input))
|
|
7
|
+
return false;
|
|
8
|
+
let sum = 0;
|
|
9
|
+
let alt = false;
|
|
10
|
+
for (let i = input.length - 1; i >= 0; i--) {
|
|
11
|
+
let n = input.charCodeAt(i) - 48;
|
|
12
|
+
if (alt) {
|
|
13
|
+
n *= 2;
|
|
14
|
+
if (n > 9)
|
|
15
|
+
n -= 9;
|
|
16
|
+
}
|
|
17
|
+
sum += n;
|
|
18
|
+
alt = !alt;
|
|
19
|
+
}
|
|
20
|
+
return sum % 10 === 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SIRET-specific Luhn: mainland is standard Luhn over 14 digits.
|
|
24
|
+
* Mayotte (DOM 976) uses a variant where the sum of all 14 digits must be a
|
|
25
|
+
* multiple of 5. We detect Mayotte by SIREN allocation range 356 000 000 – 356 999 999.
|
|
26
|
+
*/
|
|
27
|
+
export function isValidLuhnSiret(input) {
|
|
28
|
+
if (!/^\d{14}$/.test(input))
|
|
29
|
+
return false;
|
|
30
|
+
const siren = input.slice(0, 9);
|
|
31
|
+
const sirenNum = Number(siren);
|
|
32
|
+
const isMayotte = sirenNum >= 356000000 && sirenNum <= 356999999;
|
|
33
|
+
if (isMayotte) {
|
|
34
|
+
let sum = 0;
|
|
35
|
+
for (let i = 0; i < input.length; i++) {
|
|
36
|
+
sum += input.charCodeAt(i) - 48;
|
|
37
|
+
}
|
|
38
|
+
return sum % 5 === 0;
|
|
39
|
+
}
|
|
40
|
+
return isValidLuhn(input);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=luhn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luhn.js","sourceRoot":"","sources":["../../../src/core/checksums/luhn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAA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;AAC5B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Belgian enterprise number (Crossroads Bank for Enterprises — KBO/BCE).
|
|
3
|
+
*
|
|
4
|
+
* Format: 10 digits, MUST start with 0 or 1.
|
|
5
|
+
* Check: `97 - (first8 mod 97) === last2`
|
|
6
|
+
*/
|
|
7
|
+
export declare function isValidBeEnterpriseMod97(input: string): boolean;
|
|
8
|
+
//# sourceMappingURL=mod97.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod97.d.ts","sourceRoot":"","sources":["../../../src/core/checksums/mod97.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK/D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Belgian enterprise number (Crossroads Bank for Enterprises — KBO/BCE).
|
|
3
|
+
*
|
|
4
|
+
* Format: 10 digits, MUST start with 0 or 1.
|
|
5
|
+
* Check: `97 - (first8 mod 97) === last2`
|
|
6
|
+
*/
|
|
7
|
+
export function isValidBeEnterpriseMod97(input) {
|
|
8
|
+
if (!/^[01]\d{9}$/.test(input))
|
|
9
|
+
return false;
|
|
10
|
+
const head = Number(input.slice(0, 8));
|
|
11
|
+
const check = Number(input.slice(8, 10));
|
|
12
|
+
return 97 - (head % 97) === check;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=mod97.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod97.js","sourceRoot":"","sources":["../../../src/core/checksums/mod97.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa;IACpD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACzC,OAAO,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peppol ICD codes (ISO 6523 Identifier Code Designators).
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the flat list of valid Peppol scheme codes.
|
|
5
|
+
* Used by the gateway mapper to distinguish Peppol identifiers from other
|
|
6
|
+
* types when parsing Storecove responses, and by SDK validators for shape
|
|
7
|
+
* checks.
|
|
8
|
+
*
|
|
9
|
+
* Last verified against Peppol Authority registry: 2026-04-25.
|
|
10
|
+
*
|
|
11
|
+
* If Peppol publishes a new ICD code (or deprecates one), update this list
|
|
12
|
+
* and bump the SDK patch version. All consumers (SDK + console gateway)
|
|
13
|
+
* import from here, so a single change propagates everywhere.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PEPPOL_ICD_CODES: ReadonlySet<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Quick check : is this string a recognized Peppol ICD code?
|
|
18
|
+
*
|
|
19
|
+
* Use to gate parsing logic when reading from external systems whose
|
|
20
|
+
* payloads may contain non-Peppol identifier schemes (e.g., legacy "VAT"
|
|
21
|
+
* literals, country-prefix forms like "be:vat").
|
|
22
|
+
*/
|
|
23
|
+
export declare function isPeppolIcdCode(scheme: string): boolean;
|
|
24
|
+
//# sourceMappingURL=peppol-icd-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peppol-icd-codes.d.ts","sourceRoot":"","sources":["../../src/core/peppol-icd-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CA4B/C,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peppol ICD codes (ISO 6523 Identifier Code Designators).
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the flat list of valid Peppol scheme codes.
|
|
5
|
+
* Used by the gateway mapper to distinguish Peppol identifiers from other
|
|
6
|
+
* types when parsing Storecove responses, and by SDK validators for shape
|
|
7
|
+
* checks.
|
|
8
|
+
*
|
|
9
|
+
* Last verified against Peppol Authority registry: 2026-04-25.
|
|
10
|
+
*
|
|
11
|
+
* If Peppol publishes a new ICD code (or deprecates one), update this list
|
|
12
|
+
* and bump the SDK patch version. All consumers (SDK + console gateway)
|
|
13
|
+
* import from here, so a single change propagates everywhere.
|
|
14
|
+
*/
|
|
15
|
+
export const PEPPOL_ICD_CODES = new Set([
|
|
16
|
+
"0002", "0007", "0009", "0010", "0011", "0012", "0013", "0014", "0015",
|
|
17
|
+
"0016", "0017", "0018", "0019", "0020", "0021", "0022", "0023", "0024",
|
|
18
|
+
"0025", "0026", "0027", "0028", "0029", "0030", "0031", "0032", "0033",
|
|
19
|
+
"0034", "0035", "0036", "0037", "0038", "0039", "0040", "0041", "0042",
|
|
20
|
+
"0043", "0044", "0045", "0046", "0047", "0048", "0049", "0050", "0051",
|
|
21
|
+
"0052", "0053", "0054", "0055", "0056", "0057", "0058", "0059", "0060",
|
|
22
|
+
"0061", "0062", "0063", "0064", "0065", "0066", "0067", "0068", "0069",
|
|
23
|
+
"0070", "0071", "0072", "0073", "0074", "0075", "0076", "0077", "0078",
|
|
24
|
+
"0079", "0080", "0085", "0086", "0087", "0088", "0089", "0090", "0091",
|
|
25
|
+
"0093", "0094", "0095", "0096", "0097", "0098", "0099", "0100", "0101",
|
|
26
|
+
"0102", "0104", "0105", "0106", "0107", "0108", "0109", "0110", "0111",
|
|
27
|
+
"0112", "0113", "0114", "0115", "0116", "0117", "0118", "0119", "0120",
|
|
28
|
+
"0121", "0122", "0123", "0124", "0125", "0126", "0127", "0128", "0129",
|
|
29
|
+
"0130", "0131", "0132", "0133", "0134", "0135", "0136", "0137", "0138",
|
|
30
|
+
"0139", "0140", "0141", "0142", "0143", "0144", "0145", "0146", "0147",
|
|
31
|
+
"0148", "0149", "0150", "0151", "0152", "0153", "0154", "0155", "0156",
|
|
32
|
+
"0157", "0158", "0159", "0160", "0161", "0170", "0171", "0172", "0173",
|
|
33
|
+
"0174", "0175", "0176", "0177", "0178", "0179", "0180", "0183", "0184",
|
|
34
|
+
"0188", "0189", "0190", "0191", "0192", "0193", "0194", "0195", "0196",
|
|
35
|
+
"0198", "0199", "0200", "0201", "0202", "0203", "0204", "0205", "0206",
|
|
36
|
+
"0207", "0208", "0209", "0210", "0211", "0212", "0213", "0214", "0215",
|
|
37
|
+
"0216", "0217", "0218", "0219", "0220", "0221", "0230", "9901", "9910",
|
|
38
|
+
"9913", "9914", "9915", "9918", "9919", "9920", "9922", "9923", "9924",
|
|
39
|
+
"9925", "9926", "9927", "9928", "9929", "9930", "9931", "9932", "9933",
|
|
40
|
+
"9934", "9935", "9936", "9937", "9938", "9939", "9940", "9941", "9942",
|
|
41
|
+
"9943", "9944", "9945", "9946", "9947", "9948", "9949", "9950", "9951",
|
|
42
|
+
"9952", "9953", "9955", "9957",
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Quick check : is this string a recognized Peppol ICD code?
|
|
46
|
+
*
|
|
47
|
+
* Use to gate parsing logic when reading from external systems whose
|
|
48
|
+
* payloads may contain non-Peppol identifier schemes (e.g., legacy "VAT"
|
|
49
|
+
* literals, country-prefix forms like "be:vat").
|
|
50
|
+
*/
|
|
51
|
+
export function isPeppolIcdCode(scheme) {
|
|
52
|
+
return PEPPOL_ICD_CODES.has(scheme);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=peppol-icd-codes.js.map
|
|
@@ -0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ACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAC/B,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peppol Identifier validation rules.
|
|
3
|
+
*
|
|
4
|
+
* Peppol identifiers address businesses on the Peppol network.
|
|
5
|
+
* Each identifier is a (scheme, identifier) tuple where the scheme
|
|
6
|
+
* determines the identifier's format (e.g. "GB:CRN" for UK Companies
|
|
7
|
+
* House, "0225" for French SIREN).
|
|
8
|
+
*
|
|
9
|
+
* This module provides:
|
|
10
|
+
* - SCHEMES_BY_COUNTRY: guided options for the 5 main markets (UK/FR/DE/BE/NL)
|
|
11
|
+
* - validatePeppolIdentifier: format check with fallback support for any scheme
|
|
12
|
+
*/
|
|
13
|
+
export interface SchemeOption {
|
|
14
|
+
/** Peppol scheme code (e.g. "GB:CRN", "0225"). */
|
|
15
|
+
code: string;
|
|
16
|
+
/** Human-readable label shown in the UI. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** One-line description (what the identifier represents). */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Example value to show in placeholder / hint. */
|
|
21
|
+
example: string;
|
|
22
|
+
/** Whether this scheme is the recommended default for the country. */
|
|
23
|
+
recommended?: boolean;
|
|
24
|
+
/** Optional regex to validate the identifier format. */
|
|
25
|
+
pattern?: RegExp;
|
|
26
|
+
/** Short text describing the expected format. */
|
|
27
|
+
formatHint: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const SCHEMES_BY_COUNTRY: Record<string, SchemeOption[]>;
|
|
30
|
+
export interface IdentifierValidationResult {
|
|
31
|
+
valid: boolean;
|
|
32
|
+
error?: string;
|
|
33
|
+
/** True if a country-specific checksum was applied. */
|
|
34
|
+
checksumChecked?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Validate a (scheme, identifier) tuple before submission.
|
|
38
|
+
*
|
|
39
|
+
* - Scheme must match Peppol conventions: 4 digits OR country prefix "XX:YYY".
|
|
40
|
+
* - Identifier must be non-empty, <= 64 chars, with no leading/trailing whitespace.
|
|
41
|
+
* - If the scheme is listed in SCHEMES_BY_COUNTRY with a pattern, the
|
|
42
|
+
* identifier must match that pattern.
|
|
43
|
+
* - If the scheme has a country-specific checksum (FR/DE/BE), the
|
|
44
|
+
* checksum is applied. `checksumChecked` reports whether this ran.
|
|
45
|
+
*/
|
|
46
|
+
export declare function validatePeppolIdentifier(scheme: string, identifier: string): IdentifierValidationResult;
|
|
47
|
+
//# sourceMappingURL=peppol-identifier-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peppol-identifier-rules.d.ts","sourceRoot":"","sources":["../../src/core/peppol-identifier-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAgF7D,CAAC;AAmBF,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,0BAA0B,CA8C5B"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peppol Identifier validation rules.
|
|
3
|
+
*
|
|
4
|
+
* Peppol identifiers address businesses on the Peppol network.
|
|
5
|
+
* Each identifier is a (scheme, identifier) tuple where the scheme
|
|
6
|
+
* determines the identifier's format (e.g. "GB:CRN" for UK Companies
|
|
7
|
+
* House, "0225" for French SIREN).
|
|
8
|
+
*
|
|
9
|
+
* This module provides:
|
|
10
|
+
* - SCHEMES_BY_COUNTRY: guided options for the 5 main markets (UK/FR/DE/BE/NL)
|
|
11
|
+
* - validatePeppolIdentifier: format check with fallback support for any scheme
|
|
12
|
+
*/
|
|
13
|
+
import { isValidLuhn, isValidLuhnSiret, isValidBeEnterpriseMod97, isValidDeUstIdNr, } from "./checksums";
|
|
14
|
+
export const SCHEMES_BY_COUNTRY = {
|
|
15
|
+
GB: [
|
|
16
|
+
{
|
|
17
|
+
code: "GB:CRN",
|
|
18
|
+
label: "Companies House Registration Number",
|
|
19
|
+
description: "UK company registration number issued by Companies House.",
|
|
20
|
+
example: "17035492",
|
|
21
|
+
recommended: true,
|
|
22
|
+
pattern: /^\d{8}$/,
|
|
23
|
+
formatHint: "8 digits",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
code: "GB:VAT",
|
|
27
|
+
label: "VAT Registration Number",
|
|
28
|
+
description: "UK VAT registration number (GB prefix + 9 digits).",
|
|
29
|
+
example: "GB123456789",
|
|
30
|
+
pattern: /^GB\d{9}$/,
|
|
31
|
+
formatHint: "GB followed by 9 digits",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
FR: [
|
|
35
|
+
{
|
|
36
|
+
code: "0225",
|
|
37
|
+
label: "SIREN",
|
|
38
|
+
description: "Système d'identification du répertoire des entreprises (post-2026 official).",
|
|
39
|
+
example: "732829320",
|
|
40
|
+
recommended: true,
|
|
41
|
+
pattern: /^\d{9}$/,
|
|
42
|
+
formatHint: "9 digits",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
code: "0009",
|
|
46
|
+
label: "SIRET (legacy)",
|
|
47
|
+
description: "14-digit SIRET — being replaced by SIREN in Peppol.",
|
|
48
|
+
example: "73282932000074",
|
|
49
|
+
pattern: /^\d{14}$/,
|
|
50
|
+
formatHint: "14 digits",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
DE: [
|
|
54
|
+
{
|
|
55
|
+
code: "9930",
|
|
56
|
+
label: "USt-IdNr",
|
|
57
|
+
description: "German VAT identification number (B2B).",
|
|
58
|
+
example: "DE123456789",
|
|
59
|
+
recommended: true,
|
|
60
|
+
pattern: /^DE\d{9}$/,
|
|
61
|
+
formatHint: "DE followed by 9 digits",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
code: "0204",
|
|
65
|
+
label: "Leitweg-ID",
|
|
66
|
+
description: "German public-sector routing ID (B2G).",
|
|
67
|
+
example: "04011000-12345-67",
|
|
68
|
+
pattern: /^\d{2,12}-\d{4,5}-\d{2}$/,
|
|
69
|
+
formatHint: "XX-YYYYY-ZZ",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
BE: [
|
|
73
|
+
{
|
|
74
|
+
code: "0208",
|
|
75
|
+
label: "Enterprise number",
|
|
76
|
+
description: "Belgian Crossroads Bank for Enterprises (BCE/KBO) number.",
|
|
77
|
+
example: "0123456789",
|
|
78
|
+
recommended: true,
|
|
79
|
+
pattern: /^\d{10}$/,
|
|
80
|
+
formatHint: "10 digits",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
NL: [
|
|
84
|
+
{
|
|
85
|
+
code: "0106",
|
|
86
|
+
label: "KvK number",
|
|
87
|
+
description: "Dutch Chamber of Commerce (Kamer van Koophandel) number.",
|
|
88
|
+
example: "12345678",
|
|
89
|
+
recommended: true,
|
|
90
|
+
pattern: /^\d{8}$/,
|
|
91
|
+
formatHint: "8 digits",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
// Accept both uppercase (canonical Peppol, e.g. `GB:CRN`) and lowercase
|
|
96
|
+
// country-prefix schemes (e.g. the sandbox-only `de:lwid`). Storecove accepts
|
|
97
|
+
// both forms; normalising here would hide the caller's original casing from
|
|
98
|
+
// downstream systems.
|
|
99
|
+
const SCHEME_FORMAT_RE = /^(\d{4}|[A-Za-z]{2}:[A-Za-z]{3,4})$/;
|
|
100
|
+
const PEPPOL_IDENTIFIER_MAX_LENGTH = 64;
|
|
101
|
+
// Map: scheme → checksum validator. Schemes NOT listed here are format-only.
|
|
102
|
+
const CHECKSUM_BY_SCHEME = {
|
|
103
|
+
"0225": isValidLuhn, // FR SIREN
|
|
104
|
+
"0009": isValidLuhnSiret, // FR SIRET
|
|
105
|
+
"9930": isValidDeUstIdNr, // DE USt-IdNr
|
|
106
|
+
"0208": isValidBeEnterpriseMod97, // BE enterprise
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Validate a (scheme, identifier) tuple before submission.
|
|
110
|
+
*
|
|
111
|
+
* - Scheme must match Peppol conventions: 4 digits OR country prefix "XX:YYY".
|
|
112
|
+
* - Identifier must be non-empty, <= 64 chars, with no leading/trailing whitespace.
|
|
113
|
+
* - If the scheme is listed in SCHEMES_BY_COUNTRY with a pattern, the
|
|
114
|
+
* identifier must match that pattern.
|
|
115
|
+
* - If the scheme has a country-specific checksum (FR/DE/BE), the
|
|
116
|
+
* checksum is applied. `checksumChecked` reports whether this ran.
|
|
117
|
+
*/
|
|
118
|
+
export function validatePeppolIdentifier(scheme, identifier) {
|
|
119
|
+
if (!SCHEME_FORMAT_RE.test(scheme)) {
|
|
120
|
+
return {
|
|
121
|
+
valid: false,
|
|
122
|
+
error: "Scheme must be 4 digits (e.g. 0208) or country prefix (e.g. GB:CRN).",
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (!identifier.trim()) {
|
|
126
|
+
return { valid: false, error: "Identifier cannot be empty." };
|
|
127
|
+
}
|
|
128
|
+
if (identifier !== identifier.trim()) {
|
|
129
|
+
return {
|
|
130
|
+
valid: false,
|
|
131
|
+
error: "Identifier must not have leading or trailing whitespace.",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (identifier.length > PEPPOL_IDENTIFIER_MAX_LENGTH) {
|
|
135
|
+
return {
|
|
136
|
+
valid: false,
|
|
137
|
+
error: `Identifier is too long (max ${PEPPOL_IDENTIFIER_MAX_LENGTH} characters).`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const known = Object.values(SCHEMES_BY_COUNTRY)
|
|
141
|
+
.flat()
|
|
142
|
+
.find((s) => s.code === scheme);
|
|
143
|
+
if (known?.pattern && !known.pattern.test(identifier)) {
|
|
144
|
+
return {
|
|
145
|
+
valid: false,
|
|
146
|
+
error: `Format mismatch: expected ${known.formatHint}.`,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const checksum = CHECKSUM_BY_SCHEME[scheme];
|
|
150
|
+
if (checksum) {
|
|
151
|
+
if (!checksum(identifier)) {
|
|
152
|
+
return {
|
|
153
|
+
valid: false,
|
|
154
|
+
error: `Invalid checksum for ${known?.label ?? scheme}.`,
|
|
155
|
+
checksumChecked: true,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return { valid: true, checksumChecked: true };
|
|
159
|
+
}
|
|
160
|
+
return { valid: true, checksumChecked: false };
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=peppol-identifier-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peppol-identifier-rules.js","sourceRoot":"","sources":["../../src/core/peppol-identifier-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAmBrB,MAAM,CAAC,MAAM,kBAAkB,GAAmC;IAChE,EAAE,EAAE;QACF;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,qCAAqC;YAC5C,WAAW,EAAE,2DAA2D;YACxE,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,UAAU;SACvB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,yBAAyB;YAChC,WAAW,EAAE,oDAAoD;YACjE,OAAO,EAAE,aAAa;YACtB,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,yBAAyB;SACtC;KACF;IACD,EAAE,EAAE;QACF;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,8EAA8E;YAC3F,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,UAAU;SACvB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,qDAAqD;YAClE,OAAO,EAAE,g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AAE,KAAK,IAAI,MAAM,GAAG;gBACxD,eAAe,EAAE,IAAI;aACtB,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -35,5 +35,8 @@ export { validateCountryRules } from "./core/country-rules.js";
|
|
|
35
35
|
export type { CountryValidationResult } from "./core/country-rules.js";
|
|
36
36
|
export { getCountryName, getAllCountries, getEasScheme, getAllEasSchemes, resolveUnit, getAllUnits, getVatCategories, getPaymentMeansCodes, } from "./core/code-lists.js";
|
|
37
37
|
export type { EasScheme, VatCategory, PaymentMeansCode } from "./core/code-lists.js";
|
|
38
|
+
export { SCHEMES_BY_COUNTRY, validatePeppolIdentifier, } from "./core/peppol-identifier-rules.js";
|
|
39
|
+
export type { SchemeOption } from "./core/peppol-identifier-rules.js";
|
|
40
|
+
export { PEPPOL_ICD_CODES, isPeppolIcdCode, } from "./core/peppol-icd-codes.js";
|
|
38
41
|
export type { PeppolConfig, PeppolId, CurrencyCode, CountryCode, Party, BuyerParty, InvoiceLine, InvoiceInput, InvoiceTypeCode, CreditNoteInput, Attachment, AllowanceCharge, LineAllowanceCharge, ItemProperty, InvoicePeriod, Delivery, DeliveryAddress, SendResult, ReceivedInvoice, DocumentStatus, ValidationResult, ValidationError, ValidationWarning, WebhookEvent, WebhookEventType, RetryConfig, WaitForOptions, PaginatedResult, PaginationMeta, ListInvoicesOptions, InvoiceSummary, DirectoryEntry, DirectorySearchOptions, DirectorySearchResult, DocumentFormat, ServerValidationResult, ServerValidationMessage, EventEntry, ListEventsOptions, BatchSendOptions, BatchSendResult, InvoiceOperationOptions, RequestLogEntry, ResponseLogEntry, Contact, ContactInput, ListContactsOptions, BankAccount, BankAccountInput, ListBankAccountsOptions, ImportInvoiceOptions, TransportType, Transport, TransportInput, TransportUpdateInput, MarkAsState, MarkAsOptions, InvoiceUpdateInput, InvoiceUpdateLine, } from "./types/invoice.js";
|
|
39
42
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxG,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxG,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BAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -31,4 +31,6 @@ export { validateInvoice } from "./core/validator.js";
|
|
|
31
31
|
export { validateSchematron } from "./core/schematron.js";
|
|
32
32
|
export { validateCountryRules } from "./core/country-rules.js";
|
|
33
33
|
export { getCountryName, getAllCountries, getEasScheme, getAllEasSchemes, resolveUnit, getAllUnits, getVatCategories, getPaymentMeansCodes, } from "./core/code-lists.js";
|
|
34
|
+
export { SCHEMES_BY_COUNTRY, validatePeppolIdentifier, } from "./core/peppol-identifier-rules.js";
|
|
35
|
+
export { PEPPOL_ICD_CODES, isPeppolIcdCode, } from "./core/peppol-icd-codes.js";
|
|
34
36
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,eAAe,GAChB,MAAM,4BAA4B,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpeppr/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"node": ">=18.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"typescript": "^
|
|
56
|
+
"typescript": "^6.0.3",
|
|
57
57
|
"vitest": "^4.1.0",
|
|
58
58
|
"tsx": "^4.19.0",
|
|
59
59
|
"@types/node": "^25.3.0"
|