@czagents/shared
Advanced tools
| /** | ||
| * DIČ (Czech VAT ID) validation. | ||
| * | ||
| * Format: "CZ" + 8-10 digits. | ||
| * - For legal entities (IČO-based): "CZ" + 8-digit IČO (MOD11 checksum applies). | ||
| * - For individuals: "CZ" + rodné číslo (9-10 digits, separate MOD11 format). | ||
| * | ||
| * This validator checks format + IČO checksum if 8 digits follow "CZ". | ||
| */ | ||
| export declare function formatDic(input: string): string; | ||
| export declare function isValidDic(input: string): boolean; | ||
| /** Extract IČO from DIČ if it's the legal-entity format (CZ + 8 digits). */ | ||
| export declare function icoFromDic(input: string): string | null; | ||
| //# sourceMappingURL=dic.d.ts.map |
| {"version":3,"file":"dic.d.ts","sourceRoot":"","sources":["../src/dic.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAQjD;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvD"} |
+32
| /** | ||
| * DIČ (Czech VAT ID) validation. | ||
| * | ||
| * Format: "CZ" + 8-10 digits. | ||
| * - For legal entities (IČO-based): "CZ" + 8-digit IČO (MOD11 checksum applies). | ||
| * - For individuals: "CZ" + rodné číslo (9-10 digits, separate MOD11 format). | ||
| * | ||
| * This validator checks format + IČO checksum if 8 digits follow "CZ". | ||
| */ | ||
| import { isValidIco } from './ico.js'; | ||
| export function formatDic(input) { | ||
| return input.trim().toUpperCase().replace(/\s+/g, ''); | ||
| } | ||
| export function isValidDic(input) { | ||
| const dic = formatDic(input); | ||
| if (!/^CZ\d{8,10}$/.test(dic)) | ||
| return false; | ||
| const digits = dic.slice(2); | ||
| // 8-digit tail → validate as IČO | ||
| if (digits.length === 8) | ||
| return isValidIco(digits); | ||
| // 9-10 digit tail → personal rodné číslo, skip strict checksum here (return true on format) | ||
| return true; | ||
| } | ||
| /** Extract IČO from DIČ if it's the legal-entity format (CZ + 8 digits). */ | ||
| export function icoFromDic(input) { | ||
| const dic = formatDic(input); | ||
| if (!/^CZ\d{8}$/.test(dic)) | ||
| return null; | ||
| return dic.slice(2); | ||
| } | ||
| //# sourceMappingURL=dic.js.map |
| {"version":3,"file":"dic.js","sourceRoot":"","sources":["../src/dic.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,iCAAiC;IACjC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IACnD,4FAA4F;IAC5F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC"} |
+1
-0
| export * from './ico.js'; | ||
| export * from './dic.js'; | ||
| export * from './http.js'; | ||
@@ -3,0 +4,0 @@ export * from './rateLimit.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"} |
+1
-0
| export * from './ico.js'; | ||
| export * from './dic.js'; | ||
| export * from './http.js'; | ||
@@ -3,0 +4,0 @@ export * from './rateLimit.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"} |
+5
-3
| { | ||
| "name": "@czagents/shared", | ||
| "version": "0.1.1", | ||
| "version": "0.1.3", | ||
| "description": "Shared utilities for cz-agents MCP servers", | ||
@@ -8,3 +8,5 @@ "type": "module", | ||
| "types": "./dist/index.d.ts", | ||
| "files": ["dist"], | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "exports": { | ||
@@ -24,2 +26,2 @@ ".": { | ||
| } | ||
| } | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
27254
12.06%25
19.05%380
13.77%1
-50%