@slashlab/numerik-js 1.0.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/LICENSE +21 -0
- package/README.md +100 -0
- package/dist/VatEu-BNRumLqo.d.cts +142 -0
- package/dist/VatEu-BNRumLqo.d.ts +142 -0
- package/dist/chunk-3DAGKUXS.js +1210 -0
- package/dist/chunk-3DAGKUXS.js.map +1 -0
- package/dist/index.cjs +1263 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +189 -0
- package/dist/index.d.ts +189 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/zod/index.cjs +1247 -0
- package/dist/zod/index.cjs.map +1 -0
- package/dist/zod/index.d.cts +23 -0
- package/dist/zod/index.d.ts +23 -0
- package/dist/zod/index.js +56 -0
- package/dist/zod/index.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/enums/Gender.ts","../src/enums/RegonType.ts","../src/enums/ValidationFailureReason.ts","../src/exceptions/ValidationException.ts","../src/exceptions/InvalidChecksumException.ts","../src/exceptions/InvalidDateException.ts","../src/exceptions/InvalidFormatException.ts","../src/result/ValidationFailure.ts","../src/result/ValidationResult.ts","../src/value-objects/Iban.ts","../src/value-objects/Nrb.ts","../src/identifiers/NrbIdentifier.ts","../src/identifiers/IbanIdentifier.ts","../src/value-objects/IdCard.ts","../src/identifiers/IdCardIdentifier.ts","../src/value-objects/Krs.ts","../src/identifiers/KrsIdentifier.ts","../src/value-objects/Nip.ts","../src/identifiers/NipIdentifier.ts","../src/value-objects/Passport.ts","../src/identifiers/PassportIdentifier.ts","../src/value-objects/Pesel.ts","../src/identifiers/PeselIdentifier.ts","../src/value-objects/Regon.ts","../src/identifiers/RegonIdentifier.ts","../src/value-objects/VatEu.ts","../src/identifiers/VatEuIdentifier.ts","../src/Numerik.ts"],"sourcesContent":["export type { IdentifierInterface } from './contracts/IdentifierInterface.js'\nexport type { ParserInterface } from './contracts/ParserInterface.js'\nexport type { ValidatorInterface } from './contracts/ValidatorInterface.js'\nexport { Gender } from './enums/Gender.js'\nexport { RegonType } from './enums/RegonType.js'\nexport { ValidationFailureReason } from './enums/ValidationFailureReason.js'\nexport { InvalidChecksumException } from './exceptions/InvalidChecksumException.js'\nexport { InvalidDateException } from './exceptions/InvalidDateException.js'\nexport { InvalidFormatException } from './exceptions/InvalidFormatException.js'\nexport { ValidationException } from './exceptions/ValidationException.js'\nexport { IbanIdentifier } from './identifiers/IbanIdentifier.js'\nexport { IdCardIdentifier } from './identifiers/IdCardIdentifier.js'\nexport { KrsIdentifier } from './identifiers/KrsIdentifier.js'\nexport { NipIdentifier } from './identifiers/NipIdentifier.js'\nexport { NrbIdentifier } from './identifiers/NrbIdentifier.js'\nexport { PassportIdentifier } from './identifiers/PassportIdentifier.js'\nexport { PeselIdentifier } from './identifiers/PeselIdentifier.js'\nexport { RegonIdentifier } from './identifiers/RegonIdentifier.js'\nexport { VatEuIdentifier } from './identifiers/VatEuIdentifier.js'\nexport { Numerik } from './Numerik.js'\nexport { ValidationFailure } from './result/ValidationFailure.js'\nexport { ValidationResult } from './result/ValidationResult.js'\nexport { Iban } from './value-objects/Iban.js'\nexport { IdCard } from './value-objects/IdCard.js'\nexport { Krs } from './value-objects/Krs.js'\nexport { Nip } from './value-objects/Nip.js'\nexport { Nrb } from './value-objects/Nrb.js'\nexport { Passport } from './value-objects/Passport.js'\nexport { Pesel } from './value-objects/Pesel.js'\nexport { Regon } from './value-objects/Regon.js'\nexport { VatEu } from './value-objects/VatEu.js'\n","export enum Gender {\n Male = 'male',\n Female = 'female',\n}\n","export enum RegonType {\n Individual = 'individual',\n LegalEntity = 'legal_entity',\n}\n","export enum ValidationFailureReason {\n // Format\n InvalidLength = 'invalid_length',\n InvalidCharacters = 'invalid_characters',\n InvalidFormat = 'invalid_format',\n\n // Checksum\n InvalidChecksum = 'invalid_checksum',\n\n // Encoded data\n InvalidDate = 'invalid_date',\n FutureDate = 'future_date',\n InvalidMonth = 'invalid_month',\n\n // Semantic\n AllZeros = 'all_zeros',\n AllSameDigit = 'all_same_digit',\n}\n","import type { ValidationResult } from '../result/ValidationResult.js'\n\nexport class ValidationException extends Error {\n constructor(public readonly result: ValidationResult) {\n super(result.getFirstFailure()?.message ?? 'Validation failed')\n this.name = 'ValidationException'\n }\n}\n","import type { ValidationResult } from '../result/ValidationResult.js'\nimport { ValidationException } from './ValidationException.js'\n\nexport class InvalidChecksumException extends ValidationException {\n constructor(result: ValidationResult) {\n super(result)\n this.name = 'InvalidChecksumException'\n }\n}\n","import type { ValidationResult } from '../result/ValidationResult.js'\nimport { ValidationException } from './ValidationException.js'\n\nexport class InvalidDateException extends ValidationException {\n constructor(result: ValidationResult) {\n super(result)\n this.name = 'InvalidDateException'\n }\n}\n","import type { ValidationResult } from '../result/ValidationResult.js'\nimport { ValidationException } from './ValidationException.js'\n\nexport class InvalidFormatException extends ValidationException {\n constructor(result: ValidationResult) {\n super(result)\n this.name = 'InvalidFormatException'\n }\n}\n","import type { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\n\nexport class ValidationFailure {\n constructor(\n public readonly reason: ValidationFailureReason,\n public readonly message: string,\n ) {}\n}\n","import { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { InvalidChecksumException } from '../exceptions/InvalidChecksumException.js'\nimport { InvalidDateException } from '../exceptions/InvalidDateException.js'\nimport { InvalidFormatException } from '../exceptions/InvalidFormatException.js'\nimport type { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationFailure } from './ValidationFailure.js'\n\nexport class ValidationResult {\n public readonly isValid: boolean\n public readonly failures: readonly ValidationFailure[]\n\n constructor(isValid: boolean, failures: ValidationFailure[] = []) {\n this.isValid = isValid\n this.failures = [...failures]\n }\n\n static pass(): ValidationResult {\n return new ValidationResult(true)\n }\n\n static fail(failures: ValidationFailure[]): ValidationResult {\n return new ValidationResult(false, failures)\n }\n\n static failWithReason(\n reason: ValidationFailureReason,\n message: string,\n ): ValidationResult {\n return new ValidationResult(false, [new ValidationFailure(reason, message)])\n }\n\n isFailed(): boolean {\n return !this.isValid\n }\n\n getFailures(): readonly ValidationFailure[] {\n return this.failures\n }\n\n getFirstFailure(): ValidationFailure | null {\n return this.failures[0] ?? null\n }\n\n hasFailureReason(reason: ValidationFailureReason): boolean {\n return this.failures.some((f) => f.reason === reason)\n }\n\n toException(): ValidationException {\n switch (this.getFirstFailure()?.reason) {\n case ValidationFailureReason.InvalidChecksum:\n return new InvalidChecksumException(this)\n case ValidationFailureReason.InvalidDate:\n case ValidationFailureReason.FutureDate:\n case ValidationFailureReason.InvalidMonth:\n return new InvalidDateException(this)\n default:\n return new InvalidFormatException(this)\n }\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class Iban implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getFormatted(): string {\n return this.normalized.match(/.{1,4}/g)?.join(' ') ?? this.normalized\n }\n\n getCountryCode(): string {\n return 'PL'\n }\n\n getNrb(): string {\n return this.normalized.slice(2)\n }\n\n getCheckDigits(): string {\n return this.normalized.slice(2, 4)\n }\n\n getSortCode(): string {\n return this.normalized.slice(4, 12)\n }\n\n getBankCode(): string {\n return this.normalized.slice(4, 7)\n }\n\n getAccountNumber(): string {\n return this.normalized.slice(12, 28)\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class Nrb implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getFormatted(): string {\n const rest = this.normalized.slice(2)\n const grouped = rest.match(/.{1,4}/g)?.join(' ') ?? rest\n return `${this.normalized.slice(0, 2)} ${grouped}`\n }\n\n getIban(): string {\n return `PL${this.normalized}`\n }\n\n getFormattedIban(): string {\n const full = `PL${this.normalized}`\n return full.match(/.{1,4}/g)?.join(' ') ?? full\n }\n\n getCheckDigits(): string {\n return this.normalized.slice(0, 2)\n }\n\n getSortCode(): string {\n return this.normalized.slice(2, 10)\n }\n\n getBankCode(): string {\n return this.normalized.slice(2, 5)\n }\n\n getAccountNumber(): string {\n return this.normalized.slice(10, 26)\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Nrb } from '../value-objects/Nrb.js'\n\nconst DIGITS = 26\nconst MAX_LENGTH = 40\n\nexport class NrbIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 40 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n\n if (normalized.length !== DIGITS) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'NRB must be exactly 26 digits.',\n )\n }\n\n if (!/^\\d+$/.test(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'NRB must contain only digits.',\n )\n }\n\n if (!this.isValidChecksum(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'NRB checksum (MOD-97) does not match.',\n )\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Nrb {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new Nrb(input, this.normalize(input))\n }\n\n tryParse(input: string): Nrb | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n const stripped = input.replace(/[ -]/g, '')\n return stripped.toUpperCase().startsWith('PL')\n ? stripped.slice(2)\n : stripped\n }\n\n private isValidChecksum(normalized: string): boolean {\n const rearranged = `${normalized.slice(2)}2521${normalized.slice(0, 2)}`\n let remainder = 0\n for (const ch of rearranged) {\n remainder = (remainder * 10 + Number(ch)) % 97\n }\n return remainder === 1\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Iban } from '../value-objects/Iban.js'\nimport { NrbIdentifier } from './NrbIdentifier.js'\n\nconst MAX_LENGTH = 40\nconst NRB_DIGITS = 26\n\nexport class IbanIdentifier implements ValidatorInterface, ParserInterface {\n private readonly nrb: NrbIdentifier\n\n constructor(private readonly strict: boolean = true) {\n this.nrb = new NrbIdentifier(strict)\n }\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 40 characters.',\n )\n }\n\n const stripped = this.stripSeparators(input)\n\n if (stripped.length < 2 || stripped.slice(0, 2).toUpperCase() !== 'PL') {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidFormat,\n 'IBAN must start with the PL country prefix.',\n )\n }\n\n const nrbPart = stripped.slice(2)\n\n if (nrbPart.length !== NRB_DIGITS) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'IBAN must contain exactly 26 digits after the PL prefix.',\n )\n }\n\n return this.nrb.validate(nrbPart)\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Iban {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new Iban(input, this.normalize(input))\n }\n\n tryParse(input: string): Iban | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private stripSeparators(input: string): string {\n return input.replace(/[ -]/g, '')\n }\n\n private normalize(input: string): string {\n const stripped = this.stripSeparators(input)\n return `PL${stripped.slice(2)}`\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class IdCard implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getSeries(): string {\n return this.normalized.slice(0, 3)\n }\n\n getSequentialNumber(): string {\n return this.normalized.slice(3, 8)\n }\n\n getCheckDigit(): string {\n return this.normalized.slice(8, 9)\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { IdCard } from '../value-objects/IdCard.js'\n\nconst WEIGHTS = [7, 3, 1, 7, 3, 1, 7, 3] as const\nconst MAX_LENGTH = 32\nconst LENGTH = 9\n\nexport class IdCardIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n\n if (normalized.length !== LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Identity card number must be exactly 9 characters.',\n )\n }\n\n const series = normalized.slice(0, 3)\n\n if (!/^[A-Za-z]{3}$/.test(series)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'Identity card series (first 3 characters) must contain only letters.',\n )\n }\n\n if (series.includes('O') || series.includes('Q')) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidFormat,\n 'Identity card series cannot contain the letters O or Q.',\n )\n }\n\n if (!/^\\d{6}$/.test(normalized.slice(3))) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'Identity card number portion (characters 4–9) must contain only digits.',\n )\n }\n\n if (!this.isValidChecksum(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'Identity card checksum digit does not match.',\n )\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): IdCard {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new IdCard(input, this.normalize(input))\n }\n\n tryParse(input: string): IdCard | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n return input.replace(/[-\\s]/g, '').toUpperCase()\n }\n\n private icaoCharValue(char: string): number {\n const code = char.charCodeAt(0)\n return code >= 48 && code <= 57 ? code - 48 : code - 55\n }\n\n private isValidChecksum(normalized: string): boolean {\n let sum = 0\n for (let i = 0; i < 8; i++) {\n sum += this.icaoCharValue(normalized[i] ?? '') * (WEIGHTS[i] ?? 0)\n }\n return sum % 10 === Number(normalized[8])\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class Krs implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getFormatted(): string {\n return this.normalized.padStart(10, '0')\n }\n\n getNumericValue(): number {\n return Number(this.normalized)\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Krs } from '../value-objects/Krs.js'\n\nconst MAX_LENGTH = 32\nconst MAX_DIGITS = 10\n\nexport class KrsIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n\n if (normalized.length === 0 || normalized.length > MAX_DIGITS) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'KRS must have between 1 and 10 digits.',\n )\n }\n\n if (!/^\\d+$/.test(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'KRS must contain only digits and spaces.',\n )\n }\n\n if (Number(normalized) === 0) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.AllZeros,\n 'KRS cannot be all zeros.',\n )\n }\n\n const padded = normalized.padStart(MAX_DIGITS, '0')\n\n if (this.strict && new Set(padded).size === 1) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.AllSameDigit,\n 'KRS consists of a single repeated digit.',\n )\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Krs {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new Krs(input, this.normalize(input))\n }\n\n tryParse(input: string): Krs | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n return input.replace(/ /g, '')\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class Nip implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getFormatted(): string {\n const n = this.normalized\n return `${n.slice(0, 3)}-${n.slice(3, 6)}-${n.slice(6, 8)}-${n.slice(8, 10)}`\n }\n\n getFormattedAlternative(): string {\n const n = this.normalized\n return `${n.slice(0, 3)}-${n.slice(3, 5)}-${n.slice(5, 7)}-${n.slice(7, 10)}`\n }\n\n getTaxOfficeCode(): string {\n return this.normalized.slice(0, 3)\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Nip } from '../value-objects/Nip.js'\n\nconst WEIGHTS = [6, 5, 7, 2, 3, 4, 5, 6, 7] as const\nconst MAX_LENGTH = 32\nconst DIGITS = 10\n\nexport class NipIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n\n if (normalized.length !== DIGITS) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'NIP must be exactly 10 digits.',\n )\n }\n\n if (!/^\\d+$/.test(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'NIP must contain only digits, hyphens, and spaces.',\n )\n }\n\n if (normalized.startsWith('000')) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidFormat,\n 'NIP tax office code cannot be 000.',\n )\n }\n\n const digits = Array.from(normalized).map(Number)\n const sum = digits\n .slice(0, 9)\n .reduce((acc, d, i) => acc + d * (WEIGHTS[i] ?? 0), 0)\n\n if (sum % 11 !== (digits[9] ?? -1)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'NIP checksum digit does not match.',\n )\n }\n\n if (this.strict && new Set(digits).size === 1) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.AllSameDigit,\n 'NIP consists of a single repeated digit.',\n )\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Nip {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new Nip(input, this.normalize(input))\n }\n\n tryParse(input: string): Nip | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n return input.replace(/[-\\s]/g, '')\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class Passport implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getSeries(): string {\n return this.normalized.slice(0, 2)\n }\n\n getSequentialNumber(): string {\n return this.normalized.slice(2, 8)\n }\n\n getCheckDigit(): string {\n return this.normalized.slice(8, 9)\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Passport } from '../value-objects/Passport.js'\n\nconst WEIGHTS = [7, 3, 1, 7, 3, 1, 7, 3] as const\nconst MAX_LENGTH = 32\nconst LENGTH = 9\n\nexport class PassportIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n\n if (normalized.length !== LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Passport number must be exactly 9 characters.',\n )\n }\n\n if (!/^[A-Za-z]{2}/.test(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'Passport series (first 2 characters) must contain only letters.',\n )\n }\n\n if (!/^\\d{7}$/.test(normalized.slice(2))) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'Passport number portion (characters 3–9) must contain only digits.',\n )\n }\n\n if (!this.isValidChecksum(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'Passport checksum digit does not match.',\n )\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Passport {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new Passport(input, this.normalize(input))\n }\n\n tryParse(input: string): Passport | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n return input.replace(/[-\\s]/g, '').toUpperCase()\n }\n\n private icaoCharValue(char: string): number {\n const code = char.charCodeAt(0)\n return code >= 48 && code <= 57 ? code - 48 : code - 55\n }\n\n private isValidChecksum(normalized: string): boolean {\n let sum = 0\n for (let i = 0; i < 8; i++) {\n sum += this.icaoCharValue(normalized[i] ?? '') * (WEIGHTS[i] ?? 0)\n }\n return sum % 10 === Number(normalized[8])\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\nimport { Gender } from '../enums/Gender.js'\n\nexport class Pesel implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n birthDate: Date,\n private readonly gender: Gender,\n private readonly ordinalNumber: number,\n ) {\n this.birthDate = new Date(birthDate.getTime())\n }\n\n private readonly birthDate: Date\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getBirthDate(): Date {\n return new Date(this.birthDate)\n }\n\n getGender(): Gender {\n return this.gender\n }\n\n getOrdinalNumber(): number {\n return this.ordinalNumber\n }\n\n isMale(): boolean {\n return this.gender === Gender.Male\n }\n\n isFemale(): boolean {\n return this.gender === Gender.Female\n }\n\n getAge(): number {\n const today = new Date()\n const birth = this.birthDate\n let age = today.getFullYear() - birth.getFullYear()\n const m = today.getMonth() - birth.getMonth()\n if (m < 0 || (m === 0 && today.getDate() < birth.getDate())) {\n age--\n }\n return age\n }\n\n isAdult(): boolean {\n return this.getAge() >= 18\n }\n\n getCentury(): number {\n const year = this.birthDate.getFullYear()\n return year - (year % 100)\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { Gender } from '../enums/Gender.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Pesel } from '../value-objects/Pesel.js'\n\nconst WEIGHTS = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3] as const\nconst MAX_LENGTH = 32\nconst DIGITS = 11\n\nexport class PeselIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n\n if (normalized.length !== DIGITS) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'PESEL must be exactly 11 digits.',\n )\n }\n\n if (!/^\\d+$/.test(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'PESEL must contain only digits.',\n )\n }\n\n const digits = Array.from(normalized).map(Number)\n const encodedMonth = (digits[2] ?? 0) * 10 + (digits[3] ?? 0)\n const month = this.decodeMonth(encodedMonth)\n\n if (month === null) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidMonth,\n 'PESEL contains an invalid month encoding.',\n )\n }\n\n const year = this.decodeYear(\n (digits[0] ?? 0) * 10 + (digits[1] ?? 0),\n encodedMonth,\n )\n const day = (digits[4] ?? 0) * 10 + (digits[5] ?? 0)\n\n if (!this.isValidDate(year, month, day)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidDate,\n 'PESEL contains an invalid date.',\n )\n }\n\n const sum = digits\n .slice(0, 10)\n .reduce((acc, d, i) => acc + d * (WEIGHTS[i] ?? 0), 0)\n\n if ((10 - (sum % 10)) % 10 !== (digits[10] ?? -1)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'PESEL checksum digit does not match.',\n )\n }\n\n if (this.strict) {\n const birthDate = new Date(year, month - 1, day)\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n\n if (birthDate > today) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.FutureDate,\n 'PESEL birth date is in the future.',\n )\n }\n\n if (new Set(digits).size === 1) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.AllSameDigit,\n 'PESEL consists of a single repeated digit.',\n )\n }\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Pesel {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n const normalized = this.normalize(input)\n const digits = Array.from(normalized).map(Number)\n const encodedMonth = (digits[2] ?? 0) * 10 + (digits[3] ?? 0)\n const month = this.decodeMonth(encodedMonth) ?? 1\n const year = this.decodeYear(\n (digits[0] ?? 0) * 10 + (digits[1] ?? 0),\n encodedMonth,\n )\n const day = (digits[4] ?? 0) * 10 + (digits[5] ?? 0)\n const birthDate = new Date(year, month - 1, day)\n const gender = (digits[9] ?? 0) % 2 === 1 ? Gender.Male : Gender.Female\n const ordinalNumber =\n (digits[6] ?? 0) * 1000 +\n (digits[7] ?? 0) * 100 +\n (digits[8] ?? 0) * 10 +\n (digits[9] ?? 0)\n\n return new Pesel(input, normalized, birthDate, gender, ordinalNumber)\n }\n\n tryParse(input: string): Pesel | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n return input.replace(/ /g, '')\n }\n\n private decodeMonth(encodedMonth: number): number | null {\n if (encodedMonth >= 1 && encodedMonth <= 12) return encodedMonth\n if (encodedMonth >= 21 && encodedMonth <= 32) return encodedMonth - 20\n if (encodedMonth >= 41 && encodedMonth <= 52) return encodedMonth - 40\n if (encodedMonth >= 61 && encodedMonth <= 72) return encodedMonth - 60\n if (encodedMonth >= 81 && encodedMonth <= 92) return encodedMonth - 80\n return null\n }\n\n private decodeYear(yy: number, encodedMonth: number): number {\n if (encodedMonth >= 81 && encodedMonth <= 92) return 1800 + yy\n if (encodedMonth >= 1 && encodedMonth <= 12) return 1900 + yy\n if (encodedMonth >= 21 && encodedMonth <= 32) return 2000 + yy\n if (encodedMonth >= 41 && encodedMonth <= 52) return 2100 + yy\n return 2200 + yy\n }\n\n private isValidDate(year: number, month: number, day: number): boolean {\n const d = new Date(year, month - 1, day)\n return (\n d.getFullYear() === year &&\n d.getMonth() === month - 1 &&\n d.getDate() === day\n )\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\nimport { RegonType } from '../enums/RegonType.js'\n\nexport class Regon implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n private readonly type: RegonType,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getType(): RegonType {\n return this.type\n }\n\n getBaseRegon(): string {\n return this.normalized.slice(0, 9)\n }\n\n getLocalUnitSuffix(): string | null {\n if (this.type === RegonType.Individual) return null\n return this.normalized.slice(9, 14)\n }\n\n isLocalUnit(): boolean {\n return this.type === RegonType.LegalEntity\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { RegonType } from '../enums/RegonType.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { Regon } from '../value-objects/Regon.js'\n\nconst WEIGHTS_9 = [8, 9, 2, 3, 4, 5, 6, 7] as const\nconst WEIGHTS_14 = [2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8] as const\nconst MAX_LENGTH = 32\nconst DIGITS_9 = 9\nconst DIGITS_14 = 14\n\nexport class RegonIdentifier implements ValidatorInterface, ParserInterface {\n constructor(private readonly strict: boolean = true) {}\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const normalized = this.normalize(input)\n const length = normalized.length\n\n if (length !== DIGITS_9 && length !== DIGITS_14) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'REGON must be exactly 9 or 14 digits.',\n )\n }\n\n if (!/^\\d+$/.test(normalized)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidCharacters,\n 'REGON must contain only digits and spaces.',\n )\n }\n\n const digits = Array.from(normalized).map(Number)\n\n if (!this.isValid9DigitChecksum(digits)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'REGON checksum digit does not match.',\n )\n }\n\n if (length === DIGITS_14 && !this.isValid14DigitChecksum(digits)) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidChecksum,\n 'REGON local unit checksum digit does not match.',\n )\n }\n\n return ValidationResult.pass()\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): Regon {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n const normalized = this.normalize(input)\n const type =\n normalized.length === DIGITS_9\n ? RegonType.Individual\n : RegonType.LegalEntity\n\n return new Regon(input, normalized, type)\n }\n\n tryParse(input: string): Regon | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private normalize(input: string): string {\n return input.replace(/ /g, '')\n }\n\n private isValid9DigitChecksum(digits: number[]): boolean {\n let sum = 0\n for (let i = 0; i < 8; i++) {\n sum += (digits[i] ?? 0) * (WEIGHTS_9[i] ?? 0)\n }\n const checksum = sum % 11\n return (checksum === 10 ? 0 : checksum) === (digits[8] ?? -1)\n }\n\n private isValid14DigitChecksum(digits: number[]): boolean {\n let sum = 0\n for (let i = 0; i < 13; i++) {\n sum += (digits[i] ?? 0) * (WEIGHTS_14[i] ?? 0)\n }\n const checksum = sum % 11\n return (checksum === 10 ? 0 : checksum) === (digits[13] ?? -1)\n }\n}\n","import type { IdentifierInterface } from '../contracts/IdentifierInterface.js'\n\nexport class VatEu implements IdentifierInterface {\n constructor(\n private readonly raw: string,\n private readonly normalized: string,\n ) {}\n\n getRaw(): string {\n return this.raw\n }\n\n getNormalized(): string {\n return this.normalized\n }\n\n toString(): string {\n return this.normalized\n }\n\n getCountryCode(): string {\n return 'PL'\n }\n\n getNip(): string {\n return this.normalized.slice(2)\n }\n\n getFormatted(): string {\n const n = this.getNip()\n return `PL${n.slice(0, 3)}-${n.slice(3, 6)}-${n.slice(6, 8)}-${n.slice(8, 10)}`\n }\n}\n","import type { ParserInterface } from '../contracts/ParserInterface.js'\nimport type { ValidatorInterface } from '../contracts/ValidatorInterface.js'\nimport { ValidationFailureReason } from '../enums/ValidationFailureReason.js'\nimport { ValidationException } from '../exceptions/ValidationException.js'\nimport { ValidationResult } from '../result/ValidationResult.js'\nimport { VatEu } from '../value-objects/VatEu.js'\nimport { NipIdentifier } from './NipIdentifier.js'\n\nconst MAX_LENGTH = 32\nconst NIP_DIGITS = 10\nconst PREFIX = 'PL'\n\nexport class VatEuIdentifier implements ValidatorInterface, ParserInterface {\n private readonly nip: NipIdentifier\n\n constructor(private readonly strict: boolean = true) {\n this.nip = new NipIdentifier(strict)\n }\n\n isStrict(): boolean {\n return this.strict\n }\n\n validate(input: string): ValidationResult {\n if (input.length > MAX_LENGTH) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'Input exceeds maximum length of 32 characters.',\n )\n }\n\n const stripped = this.stripSeparators(input)\n\n if (stripped.length < 2 || stripped.slice(0, 2).toUpperCase() !== PREFIX) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidFormat,\n 'VAT-EU number must start with the PL country prefix.',\n )\n }\n\n const nipPart = stripped.slice(2)\n\n if (nipPart.length !== NIP_DIGITS) {\n return ValidationResult.failWithReason(\n ValidationFailureReason.InvalidLength,\n 'VAT-EU must contain exactly 10 digits after the PL prefix.',\n )\n }\n\n return this.nip.validate(nipPart)\n }\n\n isValid(input: string): boolean {\n return this.validate(input).isValid\n }\n\n parse(input: string): VatEu {\n const result = this.validate(input)\n\n if (result.isFailed()) {\n throw result.toException()\n }\n\n return new VatEu(input, this.normalize(input))\n }\n\n tryParse(input: string): VatEu | null {\n try {\n return this.parse(input)\n } catch (err) {\n if (err instanceof ValidationException) return null\n throw err\n }\n }\n\n private stripSeparators(input: string): string {\n return input.replace(/[-\\s]/g, '')\n }\n\n private normalize(input: string): string {\n const stripped = this.stripSeparators(input)\n return PREFIX + stripped.slice(2)\n }\n}\n","import { IbanIdentifier } from './identifiers/IbanIdentifier.js'\nimport { IdCardIdentifier } from './identifiers/IdCardIdentifier.js'\nimport { KrsIdentifier } from './identifiers/KrsIdentifier.js'\nimport { NipIdentifier } from './identifiers/NipIdentifier.js'\nimport { NrbIdentifier } from './identifiers/NrbIdentifier.js'\nimport { PassportIdentifier } from './identifiers/PassportIdentifier.js'\nimport { PeselIdentifier } from './identifiers/PeselIdentifier.js'\nimport { RegonIdentifier } from './identifiers/RegonIdentifier.js'\nimport { VatEuIdentifier } from './identifiers/VatEuIdentifier.js'\n\nexport const Numerik = {\n // Personal\n pesel: (strict = true) => new PeselIdentifier(strict),\n idCard: (strict = true) => new IdCardIdentifier(strict),\n passport: (strict = true) => new PassportIdentifier(strict),\n\n // Tax & Business\n nip: (strict = true) => new NipIdentifier(strict),\n vatEu: (strict = true) => new VatEuIdentifier(strict),\n regon: (strict = true) => new RegonIdentifier(strict),\n krs: (strict = true) => new KrsIdentifier(strict),\n\n // Banking\n nrb: (strict = true) => new NrbIdentifier(strict),\n iban: (strict = true) => new IbanIdentifier(strict),\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAK,SAAL,kBAAKA,YAAL;AACL,EAAAA,QAAA,UAAO;AACP,EAAAA,QAAA,YAAS;AAFC,SAAAA;AAAA,GAAA;;;ACAL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,iBAAc;AAFJ,SAAAA;AAAA,GAAA;;;ACAL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,mBAAgB;AAChB,EAAAA,yBAAA,uBAAoB;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AAAA,EAClC;AACF;;;ACzEO,IAAM,UAAU;AAAA;AAAA,EAErB,OAAO,CAAC,SAAS,SAAS,IAAI,gBAAgB,MAAM;AAAA,EACpD,QAAQ,CAAC,SAAS,SAAS,IAAI,iBAAiB,MAAM;AAAA,EACtD,UAAU,CAAC,SAAS,SAAS,IAAI,mBAAmB,MAAM;AAAA;AAAA,EAG1D,KAAK,CAAC,SAAS,SAAS,IAAI,cAAc,MAAM;AAAA,EAChD,OAAO,CAAC,SAAS,SAAS,IAAI,gBAAgB,MAAM;AAAA,EACpD,OAAO,CAAC,SAAS,SAAS,IAAI,gBAAgB,MAAM;AAAA,EACpD,KAAK,CAAC,SAAS,SAAS,IAAI,cAAc,MAAM;AAAA;AAAA,EAGhD,KAAK,CAAC,SAAS,SAAS,IAAI,cAAc,MAAM;AAAA,EAChD,MAAM,CAAC,SAAS,SAAS,IAAI,eAAe,MAAM;AACpD;","names":["Gender","RegonType","ValidationFailureReason","MAX_LENGTH","MAX_LENGTH","MAX_LENGTH","WEIGHTS","MAX_LENGTH","DIGITS","WEIGHTS","MAX_LENGTH","LENGTH","WEIGHTS","MAX_LENGTH","DIGITS","MAX_LENGTH","MAX_LENGTH"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { I as IdentifierInterface, a as Iban, b as IdCard, K as Krs, N as Nip, c as Nrb, P as Passport, d as Pesel, R as Regon, V as VatEu } from './VatEu-BNRumLqo.cjs';
|
|
2
|
+
export { G as Gender, e as RegonType } from './VatEu-BNRumLqo.cjs';
|
|
3
|
+
|
|
4
|
+
interface ParserInterface {
|
|
5
|
+
parse(input: string): IdentifierInterface;
|
|
6
|
+
tryParse(input: string): IdentifierInterface | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare enum ValidationFailureReason {
|
|
10
|
+
InvalidLength = "invalid_length",
|
|
11
|
+
InvalidCharacters = "invalid_characters",
|
|
12
|
+
InvalidFormat = "invalid_format",
|
|
13
|
+
InvalidChecksum = "invalid_checksum",
|
|
14
|
+
InvalidDate = "invalid_date",
|
|
15
|
+
FutureDate = "future_date",
|
|
16
|
+
InvalidMonth = "invalid_month",
|
|
17
|
+
AllZeros = "all_zeros",
|
|
18
|
+
AllSameDigit = "all_same_digit"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class ValidationException extends Error {
|
|
22
|
+
readonly result: ValidationResult;
|
|
23
|
+
constructor(result: ValidationResult);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class ValidationFailure {
|
|
27
|
+
readonly reason: ValidationFailureReason;
|
|
28
|
+
readonly message: string;
|
|
29
|
+
constructor(reason: ValidationFailureReason, message: string);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class ValidationResult {
|
|
33
|
+
readonly isValid: boolean;
|
|
34
|
+
readonly failures: readonly ValidationFailure[];
|
|
35
|
+
constructor(isValid: boolean, failures?: ValidationFailure[]);
|
|
36
|
+
static pass(): ValidationResult;
|
|
37
|
+
static fail(failures: ValidationFailure[]): ValidationResult;
|
|
38
|
+
static failWithReason(reason: ValidationFailureReason, message: string): ValidationResult;
|
|
39
|
+
isFailed(): boolean;
|
|
40
|
+
getFailures(): readonly ValidationFailure[];
|
|
41
|
+
getFirstFailure(): ValidationFailure | null;
|
|
42
|
+
hasFailureReason(reason: ValidationFailureReason): boolean;
|
|
43
|
+
toException(): ValidationException;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface ValidatorInterface {
|
|
47
|
+
validate(input: string): ValidationResult;
|
|
48
|
+
isValid(input: string): boolean;
|
|
49
|
+
isStrict(): boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare class InvalidChecksumException extends ValidationException {
|
|
53
|
+
constructor(result: ValidationResult);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class InvalidDateException extends ValidationException {
|
|
57
|
+
constructor(result: ValidationResult);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare class InvalidFormatException extends ValidationException {
|
|
61
|
+
constructor(result: ValidationResult);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class IbanIdentifier implements ValidatorInterface, ParserInterface {
|
|
65
|
+
private readonly strict;
|
|
66
|
+
private readonly nrb;
|
|
67
|
+
constructor(strict?: boolean);
|
|
68
|
+
isStrict(): boolean;
|
|
69
|
+
validate(input: string): ValidationResult;
|
|
70
|
+
isValid(input: string): boolean;
|
|
71
|
+
parse(input: string): Iban;
|
|
72
|
+
tryParse(input: string): Iban | null;
|
|
73
|
+
private stripSeparators;
|
|
74
|
+
private normalize;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare class IdCardIdentifier implements ValidatorInterface, ParserInterface {
|
|
78
|
+
private readonly strict;
|
|
79
|
+
constructor(strict?: boolean);
|
|
80
|
+
isStrict(): boolean;
|
|
81
|
+
validate(input: string): ValidationResult;
|
|
82
|
+
isValid(input: string): boolean;
|
|
83
|
+
parse(input: string): IdCard;
|
|
84
|
+
tryParse(input: string): IdCard | null;
|
|
85
|
+
private normalize;
|
|
86
|
+
private icaoCharValue;
|
|
87
|
+
private isValidChecksum;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare class KrsIdentifier implements ValidatorInterface, ParserInterface {
|
|
91
|
+
private readonly strict;
|
|
92
|
+
constructor(strict?: boolean);
|
|
93
|
+
isStrict(): boolean;
|
|
94
|
+
validate(input: string): ValidationResult;
|
|
95
|
+
isValid(input: string): boolean;
|
|
96
|
+
parse(input: string): Krs;
|
|
97
|
+
tryParse(input: string): Krs | null;
|
|
98
|
+
private normalize;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class NipIdentifier implements ValidatorInterface, ParserInterface {
|
|
102
|
+
private readonly strict;
|
|
103
|
+
constructor(strict?: boolean);
|
|
104
|
+
isStrict(): boolean;
|
|
105
|
+
validate(input: string): ValidationResult;
|
|
106
|
+
isValid(input: string): boolean;
|
|
107
|
+
parse(input: string): Nip;
|
|
108
|
+
tryParse(input: string): Nip | null;
|
|
109
|
+
private normalize;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare class NrbIdentifier implements ValidatorInterface, ParserInterface {
|
|
113
|
+
private readonly strict;
|
|
114
|
+
constructor(strict?: boolean);
|
|
115
|
+
isStrict(): boolean;
|
|
116
|
+
validate(input: string): ValidationResult;
|
|
117
|
+
isValid(input: string): boolean;
|
|
118
|
+
parse(input: string): Nrb;
|
|
119
|
+
tryParse(input: string): Nrb | null;
|
|
120
|
+
private normalize;
|
|
121
|
+
private isValidChecksum;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare class PassportIdentifier implements ValidatorInterface, ParserInterface {
|
|
125
|
+
private readonly strict;
|
|
126
|
+
constructor(strict?: boolean);
|
|
127
|
+
isStrict(): boolean;
|
|
128
|
+
validate(input: string): ValidationResult;
|
|
129
|
+
isValid(input: string): boolean;
|
|
130
|
+
parse(input: string): Passport;
|
|
131
|
+
tryParse(input: string): Passport | null;
|
|
132
|
+
private normalize;
|
|
133
|
+
private icaoCharValue;
|
|
134
|
+
private isValidChecksum;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class PeselIdentifier implements ValidatorInterface, ParserInterface {
|
|
138
|
+
private readonly strict;
|
|
139
|
+
constructor(strict?: boolean);
|
|
140
|
+
isStrict(): boolean;
|
|
141
|
+
validate(input: string): ValidationResult;
|
|
142
|
+
isValid(input: string): boolean;
|
|
143
|
+
parse(input: string): Pesel;
|
|
144
|
+
tryParse(input: string): Pesel | null;
|
|
145
|
+
private normalize;
|
|
146
|
+
private decodeMonth;
|
|
147
|
+
private decodeYear;
|
|
148
|
+
private isValidDate;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare class RegonIdentifier implements ValidatorInterface, ParserInterface {
|
|
152
|
+
private readonly strict;
|
|
153
|
+
constructor(strict?: boolean);
|
|
154
|
+
isStrict(): boolean;
|
|
155
|
+
validate(input: string): ValidationResult;
|
|
156
|
+
isValid(input: string): boolean;
|
|
157
|
+
parse(input: string): Regon;
|
|
158
|
+
tryParse(input: string): Regon | null;
|
|
159
|
+
private normalize;
|
|
160
|
+
private isValid9DigitChecksum;
|
|
161
|
+
private isValid14DigitChecksum;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare class VatEuIdentifier implements ValidatorInterface, ParserInterface {
|
|
165
|
+
private readonly strict;
|
|
166
|
+
private readonly nip;
|
|
167
|
+
constructor(strict?: boolean);
|
|
168
|
+
isStrict(): boolean;
|
|
169
|
+
validate(input: string): ValidationResult;
|
|
170
|
+
isValid(input: string): boolean;
|
|
171
|
+
parse(input: string): VatEu;
|
|
172
|
+
tryParse(input: string): VatEu | null;
|
|
173
|
+
private stripSeparators;
|
|
174
|
+
private normalize;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
declare const Numerik: {
|
|
178
|
+
readonly pesel: (strict?: boolean) => PeselIdentifier;
|
|
179
|
+
readonly idCard: (strict?: boolean) => IdCardIdentifier;
|
|
180
|
+
readonly passport: (strict?: boolean) => PassportIdentifier;
|
|
181
|
+
readonly nip: (strict?: boolean) => NipIdentifier;
|
|
182
|
+
readonly vatEu: (strict?: boolean) => VatEuIdentifier;
|
|
183
|
+
readonly regon: (strict?: boolean) => RegonIdentifier;
|
|
184
|
+
readonly krs: (strict?: boolean) => KrsIdentifier;
|
|
185
|
+
readonly nrb: (strict?: boolean) => NrbIdentifier;
|
|
186
|
+
readonly iban: (strict?: boolean) => IbanIdentifier;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { Iban, IbanIdentifier, IdCard, IdCardIdentifier, IdentifierInterface, InvalidChecksumException, InvalidDateException, InvalidFormatException, Krs, KrsIdentifier, Nip, NipIdentifier, Nrb, NrbIdentifier, Numerik, type ParserInterface, Passport, PassportIdentifier, Pesel, PeselIdentifier, Regon, RegonIdentifier, ValidationException, ValidationFailure, ValidationFailureReason, ValidationResult, type ValidatorInterface, VatEu, VatEuIdentifier };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { I as IdentifierInterface, a as Iban, b as IdCard, K as Krs, N as Nip, c as Nrb, P as Passport, d as Pesel, R as Regon, V as VatEu } from './VatEu-BNRumLqo.js';
|
|
2
|
+
export { G as Gender, e as RegonType } from './VatEu-BNRumLqo.js';
|
|
3
|
+
|
|
4
|
+
interface ParserInterface {
|
|
5
|
+
parse(input: string): IdentifierInterface;
|
|
6
|
+
tryParse(input: string): IdentifierInterface | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare enum ValidationFailureReason {
|
|
10
|
+
InvalidLength = "invalid_length",
|
|
11
|
+
InvalidCharacters = "invalid_characters",
|
|
12
|
+
InvalidFormat = "invalid_format",
|
|
13
|
+
InvalidChecksum = "invalid_checksum",
|
|
14
|
+
InvalidDate = "invalid_date",
|
|
15
|
+
FutureDate = "future_date",
|
|
16
|
+
InvalidMonth = "invalid_month",
|
|
17
|
+
AllZeros = "all_zeros",
|
|
18
|
+
AllSameDigit = "all_same_digit"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class ValidationException extends Error {
|
|
22
|
+
readonly result: ValidationResult;
|
|
23
|
+
constructor(result: ValidationResult);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class ValidationFailure {
|
|
27
|
+
readonly reason: ValidationFailureReason;
|
|
28
|
+
readonly message: string;
|
|
29
|
+
constructor(reason: ValidationFailureReason, message: string);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class ValidationResult {
|
|
33
|
+
readonly isValid: boolean;
|
|
34
|
+
readonly failures: readonly ValidationFailure[];
|
|
35
|
+
constructor(isValid: boolean, failures?: ValidationFailure[]);
|
|
36
|
+
static pass(): ValidationResult;
|
|
37
|
+
static fail(failures: ValidationFailure[]): ValidationResult;
|
|
38
|
+
static failWithReason(reason: ValidationFailureReason, message: string): ValidationResult;
|
|
39
|
+
isFailed(): boolean;
|
|
40
|
+
getFailures(): readonly ValidationFailure[];
|
|
41
|
+
getFirstFailure(): ValidationFailure | null;
|
|
42
|
+
hasFailureReason(reason: ValidationFailureReason): boolean;
|
|
43
|
+
toException(): ValidationException;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface ValidatorInterface {
|
|
47
|
+
validate(input: string): ValidationResult;
|
|
48
|
+
isValid(input: string): boolean;
|
|
49
|
+
isStrict(): boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare class InvalidChecksumException extends ValidationException {
|
|
53
|
+
constructor(result: ValidationResult);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class InvalidDateException extends ValidationException {
|
|
57
|
+
constructor(result: ValidationResult);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare class InvalidFormatException extends ValidationException {
|
|
61
|
+
constructor(result: ValidationResult);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class IbanIdentifier implements ValidatorInterface, ParserInterface {
|
|
65
|
+
private readonly strict;
|
|
66
|
+
private readonly nrb;
|
|
67
|
+
constructor(strict?: boolean);
|
|
68
|
+
isStrict(): boolean;
|
|
69
|
+
validate(input: string): ValidationResult;
|
|
70
|
+
isValid(input: string): boolean;
|
|
71
|
+
parse(input: string): Iban;
|
|
72
|
+
tryParse(input: string): Iban | null;
|
|
73
|
+
private stripSeparators;
|
|
74
|
+
private normalize;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare class IdCardIdentifier implements ValidatorInterface, ParserInterface {
|
|
78
|
+
private readonly strict;
|
|
79
|
+
constructor(strict?: boolean);
|
|
80
|
+
isStrict(): boolean;
|
|
81
|
+
validate(input: string): ValidationResult;
|
|
82
|
+
isValid(input: string): boolean;
|
|
83
|
+
parse(input: string): IdCard;
|
|
84
|
+
tryParse(input: string): IdCard | null;
|
|
85
|
+
private normalize;
|
|
86
|
+
private icaoCharValue;
|
|
87
|
+
private isValidChecksum;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare class KrsIdentifier implements ValidatorInterface, ParserInterface {
|
|
91
|
+
private readonly strict;
|
|
92
|
+
constructor(strict?: boolean);
|
|
93
|
+
isStrict(): boolean;
|
|
94
|
+
validate(input: string): ValidationResult;
|
|
95
|
+
isValid(input: string): boolean;
|
|
96
|
+
parse(input: string): Krs;
|
|
97
|
+
tryParse(input: string): Krs | null;
|
|
98
|
+
private normalize;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class NipIdentifier implements ValidatorInterface, ParserInterface {
|
|
102
|
+
private readonly strict;
|
|
103
|
+
constructor(strict?: boolean);
|
|
104
|
+
isStrict(): boolean;
|
|
105
|
+
validate(input: string): ValidationResult;
|
|
106
|
+
isValid(input: string): boolean;
|
|
107
|
+
parse(input: string): Nip;
|
|
108
|
+
tryParse(input: string): Nip | null;
|
|
109
|
+
private normalize;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare class NrbIdentifier implements ValidatorInterface, ParserInterface {
|
|
113
|
+
private readonly strict;
|
|
114
|
+
constructor(strict?: boolean);
|
|
115
|
+
isStrict(): boolean;
|
|
116
|
+
validate(input: string): ValidationResult;
|
|
117
|
+
isValid(input: string): boolean;
|
|
118
|
+
parse(input: string): Nrb;
|
|
119
|
+
tryParse(input: string): Nrb | null;
|
|
120
|
+
private normalize;
|
|
121
|
+
private isValidChecksum;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare class PassportIdentifier implements ValidatorInterface, ParserInterface {
|
|
125
|
+
private readonly strict;
|
|
126
|
+
constructor(strict?: boolean);
|
|
127
|
+
isStrict(): boolean;
|
|
128
|
+
validate(input: string): ValidationResult;
|
|
129
|
+
isValid(input: string): boolean;
|
|
130
|
+
parse(input: string): Passport;
|
|
131
|
+
tryParse(input: string): Passport | null;
|
|
132
|
+
private normalize;
|
|
133
|
+
private icaoCharValue;
|
|
134
|
+
private isValidChecksum;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class PeselIdentifier implements ValidatorInterface, ParserInterface {
|
|
138
|
+
private readonly strict;
|
|
139
|
+
constructor(strict?: boolean);
|
|
140
|
+
isStrict(): boolean;
|
|
141
|
+
validate(input: string): ValidationResult;
|
|
142
|
+
isValid(input: string): boolean;
|
|
143
|
+
parse(input: string): Pesel;
|
|
144
|
+
tryParse(input: string): Pesel | null;
|
|
145
|
+
private normalize;
|
|
146
|
+
private decodeMonth;
|
|
147
|
+
private decodeYear;
|
|
148
|
+
private isValidDate;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare class RegonIdentifier implements ValidatorInterface, ParserInterface {
|
|
152
|
+
private readonly strict;
|
|
153
|
+
constructor(strict?: boolean);
|
|
154
|
+
isStrict(): boolean;
|
|
155
|
+
validate(input: string): ValidationResult;
|
|
156
|
+
isValid(input: string): boolean;
|
|
157
|
+
parse(input: string): Regon;
|
|
158
|
+
tryParse(input: string): Regon | null;
|
|
159
|
+
private normalize;
|
|
160
|
+
private isValid9DigitChecksum;
|
|
161
|
+
private isValid14DigitChecksum;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare class VatEuIdentifier implements ValidatorInterface, ParserInterface {
|
|
165
|
+
private readonly strict;
|
|
166
|
+
private readonly nip;
|
|
167
|
+
constructor(strict?: boolean);
|
|
168
|
+
isStrict(): boolean;
|
|
169
|
+
validate(input: string): ValidationResult;
|
|
170
|
+
isValid(input: string): boolean;
|
|
171
|
+
parse(input: string): VatEu;
|
|
172
|
+
tryParse(input: string): VatEu | null;
|
|
173
|
+
private stripSeparators;
|
|
174
|
+
private normalize;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
declare const Numerik: {
|
|
178
|
+
readonly pesel: (strict?: boolean) => PeselIdentifier;
|
|
179
|
+
readonly idCard: (strict?: boolean) => IdCardIdentifier;
|
|
180
|
+
readonly passport: (strict?: boolean) => PassportIdentifier;
|
|
181
|
+
readonly nip: (strict?: boolean) => NipIdentifier;
|
|
182
|
+
readonly vatEu: (strict?: boolean) => VatEuIdentifier;
|
|
183
|
+
readonly regon: (strict?: boolean) => RegonIdentifier;
|
|
184
|
+
readonly krs: (strict?: boolean) => KrsIdentifier;
|
|
185
|
+
readonly nrb: (strict?: boolean) => NrbIdentifier;
|
|
186
|
+
readonly iban: (strict?: boolean) => IbanIdentifier;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { Iban, IbanIdentifier, IdCard, IdCardIdentifier, IdentifierInterface, InvalidChecksumException, InvalidDateException, InvalidFormatException, Krs, KrsIdentifier, Nip, NipIdentifier, Nrb, NrbIdentifier, Numerik, type ParserInterface, Passport, PassportIdentifier, Pesel, PeselIdentifier, Regon, RegonIdentifier, ValidationException, ValidationFailure, ValidationFailureReason, ValidationResult, type ValidatorInterface, VatEu, VatEuIdentifier };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Gender,
|
|
3
|
+
Iban,
|
|
4
|
+
IbanIdentifier,
|
|
5
|
+
IdCard,
|
|
6
|
+
IdCardIdentifier,
|
|
7
|
+
InvalidChecksumException,
|
|
8
|
+
InvalidDateException,
|
|
9
|
+
InvalidFormatException,
|
|
10
|
+
Krs,
|
|
11
|
+
KrsIdentifier,
|
|
12
|
+
Nip,
|
|
13
|
+
NipIdentifier,
|
|
14
|
+
Nrb,
|
|
15
|
+
NrbIdentifier,
|
|
16
|
+
Numerik,
|
|
17
|
+
Passport,
|
|
18
|
+
PassportIdentifier,
|
|
19
|
+
Pesel,
|
|
20
|
+
PeselIdentifier,
|
|
21
|
+
Regon,
|
|
22
|
+
RegonIdentifier,
|
|
23
|
+
RegonType,
|
|
24
|
+
ValidationException,
|
|
25
|
+
ValidationFailure,
|
|
26
|
+
ValidationFailureReason,
|
|
27
|
+
ValidationResult,
|
|
28
|
+
VatEu,
|
|
29
|
+
VatEuIdentifier
|
|
30
|
+
} from "./chunk-3DAGKUXS.js";
|
|
31
|
+
export {
|
|
32
|
+
Gender,
|
|
33
|
+
Iban,
|
|
34
|
+
IbanIdentifier,
|
|
35
|
+
IdCard,
|
|
36
|
+
IdCardIdentifier,
|
|
37
|
+
InvalidChecksumException,
|
|
38
|
+
InvalidDateException,
|
|
39
|
+
InvalidFormatException,
|
|
40
|
+
Krs,
|
|
41
|
+
KrsIdentifier,
|
|
42
|
+
Nip,
|
|
43
|
+
NipIdentifier,
|
|
44
|
+
Nrb,
|
|
45
|
+
NrbIdentifier,
|
|
46
|
+
Numerik,
|
|
47
|
+
Passport,
|
|
48
|
+
PassportIdentifier,
|
|
49
|
+
Pesel,
|
|
50
|
+
PeselIdentifier,
|
|
51
|
+
Regon,
|
|
52
|
+
RegonIdentifier,
|
|
53
|
+
RegonType,
|
|
54
|
+
ValidationException,
|
|
55
|
+
ValidationFailure,
|
|
56
|
+
ValidationFailureReason,
|
|
57
|
+
ValidationResult,
|
|
58
|
+
VatEu,
|
|
59
|
+
VatEuIdentifier
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|