@streamline-pulse/formkrafter-core 0.25.0 → 0.27.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.
@@ -0,0 +1,30 @@
1
+ /**
2
+ * National identifier checks. Each format is a published rule, not a guess:
3
+ * - `fr-nir`: French social security number, 13 digits + 2-digit key
4
+ * (97 - number mod 97), Corsica departments 2A / 2B handled.
5
+ * - `bj-npi`: Benin personal identification number, 10 digits.
6
+ * - `digits-<n>`: exactly n digits, for registries without a public key.
7
+ * Spaces and dots are ignored on input; the stored value keeps what was typed.
8
+ */
9
+ export type IdentityFormat = "fr-nir" | "bj-npi" | "fr-siren" | "fr-siret" | "bj-ifu" | "iban" | `digits-${number}`;
10
+ export declare function checkFrNir(value: string): boolean;
11
+ export declare function checkBjNpi(value: string): boolean;
12
+ export declare function checkDigits(value: string, length: number): boolean;
13
+ /** Luhn checksum over a string of digits (SIREN, SIRET, card numbers). */
14
+ export declare function checkLuhn(digits: string): boolean;
15
+ /** French company number: 9 digits with a Luhn key. */
16
+ export declare function checkFrSiren(value: string): boolean;
17
+ /** French establishment number: 14 digits with a Luhn key. */
18
+ export declare function checkFrSiret(value: string): boolean;
19
+ /** Benin tax identifier (IFU): 13 digits. */
20
+ export declare function checkBjIfu(value: string): boolean;
21
+ /** IBAN: country code, two check digits, 11 to 30 alphanumerics, ISO 7064 mod 97-10. */
22
+ export declare function checkIban(value: string): boolean;
23
+ /** True when `value` satisfies `format`; unknown formats accept any non-empty value. */
24
+ export declare function checkIdentity(format: string, value: string): boolean;
25
+ export declare const IDENTITY_FORMATS: {
26
+ id: string;
27
+ label: string;
28
+ }[];
29
+ /** Groups an IBAN by four characters for display. */
30
+ export declare const formatIban: (value: string) => string;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Machine-readable zone of travel documents (ICAO 9303): TD3 passports
3
+ * (2 lines of 44) and TD1 identity cards (3 lines of 30). The parser reads the
4
+ * fields, verifies every check digit and reports what failed, so a form can
5
+ * refuse a misread zone instead of storing wrong data.
6
+ */
7
+ export interface MrzResult {
8
+ raw: string;
9
+ format: "TD1" | "TD3";
10
+ documentType: string;
11
+ issuingCountry: string;
12
+ documentNumber: string;
13
+ nationality: string;
14
+ surname: string;
15
+ givenNames: string;
16
+ /** ISO date, century guessed from the field: birth in the past, expiry in the future. */
17
+ birthDate: string | null;
18
+ sex: "M" | "F" | "X";
19
+ expiryDate: string | null;
20
+ optional: string;
21
+ valid: boolean;
22
+ /** Names of the fields whose check digit does not match. */
23
+ errors: string[];
24
+ }
25
+ /** ICAO 9303 check digit: weights 7-3-1, modulo 10. */
26
+ export declare function mrzCheckDigit(field: string): number;
27
+ /** Splits pasted text into MRZ lines: uppercase, `<` filler, no spaces. */
28
+ export declare function mrzLines(text: string): string[];
29
+ export declare function parseMrz(text: string): MrzResult | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamline-pulse/formkrafter-core",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "description": "Framework-agnostic core for FormKrafter: form specs, RFC 6902 ops with undo/redo, Ajv validation, sandboxed rules engine and injectable services",
5
5
  "license": "MIT",
6
6
  "type": "module",