From 5c41454d610810608a851947ea42426d81248060 Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 22:45:21 +0200 Subject: [PATCH 1/8] chore: setup modern toolchain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace Gulp/Browserify/Mocha with tsup/Vitest/Biome. package.json v2.0.0, ESM+CJS dual exports, Node 20+. tsconfig.json strict, ES2022 target. Assisted-by: đŸ€– claude-opus-4-6@default --- .gitignore | 38 +- biome.json | 20 + package-lock.json | 3021 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 65 +- tsconfig.json | 22 + tsup.config.ts | 31 + vitest.config.ts | 21 + 7 files changed, 3172 insertions(+), 46 deletions(-) create mode 100644 biome.json create mode 100644 package-lock.json create mode 100644 tsconfig.json create mode 100644 tsup.config.ts create mode 100644 vitest.config.ts diff --git a/.gitignore b/.gitignore index f647d78..a260ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,28 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Coverage +coverage/ + # Logs -logs *.log # Runtime data -pids *.pid *.seed -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript +# OS files +.DS_Store +Thumbs.db -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release +# IDE +.idea/ +.vscode/ +*.swp +*.swo -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules -target/ +# Temp +.ai/ diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..9d8c7b1 --- /dev/null +++ b/biome.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json", + "organizeImports": { + "enabled": true + }, + "formatter": { + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 100 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "files": { + "ignore": ["dist", "coverage", "node_modules"] + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1caa569 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3021 @@ +{ + "name": "eid.js", + "version": "2.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "eid.js", + "version": "2.0.0", + "license": "Apache-2.0", + "devDependencies": { + "@biomejs/biome": "~1.9.0", + "@vitest/coverage-v8": "~3.2.0", + "tsup": "~8.5.0", + "typescript": "~5.8.0", + "vitest": "~3.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@biomejs/biome": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "dev": true, + "hasInstallScript": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.9.4", + "@biomejs/cli-darwin-x64": "1.9.4", + "@biomejs/cli-linux-arm64": "1.9.4", + "@biomejs/cli-linux-arm64-musl": "1.9.4", + "@biomejs/cli-linux-x64": "1.9.4", + "@biomejs/cli-linux-x64-musl": "1.9.4", + "@biomejs/cli-win32-arm64": "1.9.4", + "@biomejs/cli-win32-x64": "1.9.4" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz", + "integrity": "sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz", + "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz", + "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz", + "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz", + "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz", + "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz", + "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz", + "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz", + "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz", + "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz", + "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz", + "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz", + "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz", + "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz", + "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz", + "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz", + "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz", + "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz", + "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz", + "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz", + "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz", + "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz", + "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz", + "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz", + "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz", + "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vitest/coverage-v8": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-3.2.7.tgz", + "integrity": "sha512-NEGWJS2XNu2PfRLQwOO3CTKj1tTETxNBdk454vDxVBhxJYhPaA/eS0nAI0c+1El1P7a60z8+i+ZrQoGESweGKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.3.0", + "@bcoe/v8-coverage": "^1.0.2", + "ast-v8-to-istanbul": "^0.3.3", + "debug": "^4.4.1", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-lib-source-maps": "^5.0.6", + "istanbul-reports": "^3.1.7", + "magic-string": "^0.30.17", + "magicast": "^0.3.5", + "std-env": "^3.9.0", + "test-exclude": "^7.0.1", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@vitest/browser": "3.2.7", + "vitest": "3.2.7" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.7.tgz", + "integrity": "sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/spy": "3.2.7", + "@vitest/utils": "3.2.7", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.7.tgz", + "integrity": "sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.2.7", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.7.tgz", + "integrity": "sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.7.tgz", + "integrity": "sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.2.7", + "pathe": "^2.0.3", + "strip-literal": "^3.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.7.tgz", + "integrity": "sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.7", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.7.tgz", + "integrity": "sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^4.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.7.tgz", + "integrity": "sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.7", + "loupe": "^3.1.4", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/ast-v8-to-istanbul": { + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-0.3.12.tgz", + "integrity": "sha512-BRRC8VRZY2R4Z4lFIL35MwNXmwVqBityvOIwETtsCSwvjl0IdgFsy9NhdaA6j74nUdtJJlIypeRhpDam19Wq3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.31", + "estree-walker": "^3.0.3", + "js-tokens": "^10.0.0" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz", + "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/bundle-require": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.18" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chai": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz", + "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/check-error": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz", + "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.2.tgz", + "integrity": "sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", + "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.23", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/js-tokens": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz", + "integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/loupe": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", + "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/magicast": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", + "source-map-js": "^1.2.0" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mlly": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz", + "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.16.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.3" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", + "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/postcss": { + "version": "8.5.19", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.19.tgz", + "integrity": "sha512-Mz8SaolMd8nB+G13WkORcxQKHZ/NE4xXevtkJHVuG+guo9/wYKlIMTKAqGdEmYOXR2ijPjTYNHssizdaVSUNdQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/rollup": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", + "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.62.2", + "@rollup/rollup-android-arm64": "4.62.2", + "@rollup/rollup-darwin-arm64": "4.62.2", + "@rollup/rollup-darwin-x64": "4.62.2", + "@rollup/rollup-freebsd-arm64": "4.62.2", + "@rollup/rollup-freebsd-x64": "4.62.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.2", + "@rollup/rollup-linux-arm-musleabihf": "4.62.2", + "@rollup/rollup-linux-arm64-gnu": "4.62.2", + "@rollup/rollup-linux-arm64-musl": "4.62.2", + "@rollup/rollup-linux-loong64-gnu": "4.62.2", + "@rollup/rollup-linux-loong64-musl": "4.62.2", + "@rollup/rollup-linux-ppc64-gnu": "4.62.2", + "@rollup/rollup-linux-ppc64-musl": "4.62.2", + "@rollup/rollup-linux-riscv64-gnu": "4.62.2", + "@rollup/rollup-linux-riscv64-musl": "4.62.2", + "@rollup/rollup-linux-s390x-gnu": "4.62.2", + "@rollup/rollup-linux-x64-gnu": "4.62.2", + "@rollup/rollup-linux-x64-musl": "4.62.2", + "@rollup/rollup-openbsd-x64": "4.62.2", + "@rollup/rollup-openharmony-arm64": "4.62.2", + "@rollup/rollup-win32-arm64-msvc": "4.62.2", + "@rollup/rollup-win32-ia32-msvc": "4.62.2", + "@rollup/rollup-win32-x64-gnu": "4.62.2", + "@rollup/rollup-win32-x64-msvc": "4.62.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-literal": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.1.0.tgz", + "integrity": "sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.2.tgz", + "integrity": "sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^10.4.1", + "minimatch": "^10.2.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinypool": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", + "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.4.tgz", + "integrity": "sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tsup": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz", + "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^5.1.0", + "cac": "^6.7.14", + "chokidar": "^4.0.3", + "consola": "^3.4.0", + "debug": "^4.4.0", + "esbuild": "^0.27.0", + "fix-dts-default-cjs-exports": "^1.0.0", + "joycon": "^3.1.1", + "picocolors": "^1.1.1", + "postcss-load-config": "^6.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.34.8", + "source-map": "^0.7.6", + "sucrase": "^3.35.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.11", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz", + "integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.1", + "es-module-lexer": "^1.7.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vitest": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.7.tgz", + "integrity": "sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/expect": "3.2.7", + "@vitest/mocker": "3.2.7", + "@vitest/pretty-format": "^3.2.7", + "@vitest/runner": "3.2.7", + "@vitest/snapshot": "3.2.7", + "@vitest/spy": "3.2.7", + "@vitest/utils": "3.2.7", + "chai": "^5.2.0", + "debug": "^4.4.1", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "picomatch": "^4.0.2", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.14", + "tinypool": "^1.1.1", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", + "vite-node": "3.2.4", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.2.7", + "@vitest/ui": "3.2.7", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + } + } +} diff --git a/package.json b/package.json index 66d189c..828634e 100644 --- a/package.json +++ b/package.json @@ -1,34 +1,45 @@ { "name": "eid.js", - "version": "1.0.3-SNAPSHOT", + "version": "2.0.0", "description": "EID Runtime Exceptions and Utilities for JS", - "main": "lib/eid.js", - "directories": { - "lib": "./lib" + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "unpkg": "./dist/index.global.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + }, + "./package.json": "./package.json" }, - "dependencies": {}, - "devDependencies": { - "browserify": "^13.0.0", - "expect.js": "^0.3.1", - "globby": "^4.0.0", - "gulp": "^3.9.0", - "gulp-coverage": "^0.3.38", - "gulp-coveralls": "^0.1.4", - "gulp-eslint": "^1.1.1", - "gulp-mocha": "^2.2.0", - "gulp-serve": "^1.2.0", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.5.1", - "gulp-util": "^3.0.7", - "through2": "^2.0.0", - "vinyl-buffer": "^1.0.0", - "vinyl-source-stream": "^1.1.0" + "files": [ + "dist" + ], + "engines": { + "node": ">=20" }, "scripts": { - "clean": "gulp clean", - "test": "gulp test", - "build": "gulp build", - "serve": "gulp serve" + "build": "tsup", + "test": "vitest run", + "test:watch": "vitest", + "test:coverage": "vitest run --coverage", + "lint": "biome check src/", + "lint:fix": "biome check --write src/", + "format": "biome format --write src/", + "prepublishOnly": "npm run lint && npm run test && npm run build", + "clean": "rm -rf dist coverage" + }, + "dependencies": {}, + "devDependencies": { + "@biomejs/biome": "~1.9.0", + "@vitest/coverage-v8": "~3.2.0", + "tsup": "~8.5.0", + "typescript": "~5.8.0", + "vitest": "~3.2.0" }, "repository": { "type": "git", @@ -36,12 +47,12 @@ }, "keywords": [ "debug", - "expection", + "exception", "preconditions", "quality", "qa" ], - "author": "Krzysztof Suszynski ", + "author": "Krzysztof Suszynski ", "license": "Apache-2.0", "bugs": { "url": "https://github.com/wavesoftware/javascript-eid-exceptions/issues" diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a70f347 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "bundler", + "lib": ["ES2022"], + "strict": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "dist", + "rootDir": "src", + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "resolveJsonModule": true, + "types": ["vitest/globals"] + }, + "include": ["src"], + "exclude": ["node_modules", "dist", "src/**/*.test.ts"] +} diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..2ae2585 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,31 @@ +import { defineConfig } from "tsup"; + +export default defineConfig([ + { + entry: ["src/index.ts"], + format: ["esm", "cjs"], + dts: true, + sourcemap: true, + target: "es2022", + outDir: "dist", + clean: true, + splitting: false, + outExtension({ format }) { + if (format === "cjs") { + return { js: ".cjs", dts: ".d.cts" }; + } + return { js: ".mjs", dts: ".d.ts" }; + }, + }, + { + entry: ["src/index.ts"], + format: ["iife"], + globalName: "Eid", + outDir: "dist", + minify: true, + target: "es2020", + outExtension() { + return { js: ".global.js" }; + }, + }, +]); diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..7e7984c --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + include: ["src/**/*.test.ts"], + coverage: { + provider: "v8", + include: ["src/**/*.ts"], + exclude: ["**/*.test.ts", "**/*.d.ts", "src/index.ts"], + reporter: ["text", "lcov", "html"], + reportsDirectory: "./coverage", + thresholds: { + lines: 98, + functions: 98, + branches: 98, + statements: 98, + }, + }, + }, +}); From 6455f1654ff1d60ac9982ff31f11b38c53a03efa Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 22:45:27 +0200 Subject: [PATCH 2/8] refactor: migrate source to TypeScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eid, exceptions, preconditions rewritten as typed classes. ES2022 Error.cause support in all exception constructors. tryToExecute preserves original error as cause. Assisted-by: đŸ€– claude-opus-4-6@default --- src/eid.ts | 201 +++++++++++++++++++++++++++++++++++++++++++ src/exceptions.ts | 131 ++++++++++++++++++++++++++++ src/index.ts | 49 +++++++++++ src/preconditions.ts | 171 ++++++++++++++++++++++++++++++++++++ 4 files changed, 552 insertions(+) create mode 100644 src/eid.ts create mode 100644 src/exceptions.ts create mode 100644 src/index.ts create mode 100644 src/preconditions.ts diff --git a/src/eid.ts b/src/eid.ts new file mode 100644 index 0000000..e0e4ba6 --- /dev/null +++ b/src/eid.ts @@ -0,0 +1,201 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface UniqIdGenerator { + generateUniqId(): string; +} + +class JFormatter { + private readonly template: string; + + constructor(template: string) { + this.template = template; + } + + format(args: unknown[]): string { + const regex = /%s/; + const reducer = (p: string, c: unknown): string => p.replace(regex, String(c)); + return args.reduce(reducer, this.template) as string; + } +} + +class MathRandom { + private static readonly LONG_MAX = 2 ** 53 - 1; + private static readonly LONG_MIN = -1 * 2 ** 53; + + nextLong(): number { + return this.nextNumber(MathRandom.LONG_MIN, MathRandom.LONG_MAX); + } + + nextInt(max: number): number { + return this.nextNumber(0, max); + } + + nextNumber(min: number, max: number): number { + return Math.floor(Math.random() * (max - min + 1)) + min; + } +} + +class StdUniqIdGenerator implements UniqIdGenerator { + private static readonly BASE36 = 36; + private static readonly INTEGER_MAX_VALUE = 2 ** 31; + private static readonly MIN_6_CHAR_HASH = 60466177; // for '100001' in base36 + + private readonly padding: string; + private readonly generator: MathRandom; + + constructor() { + this.generator = new MathRandom(); + this.padding = this.generator + .nextNumber(StdUniqIdGenerator.MIN_6_CHAR_HASH, StdUniqIdGenerator.INTEGER_MAX_VALUE) + .toString(StdUniqIdGenerator.BASE36); + } + + generateUniqId(): string { + const first = Math.abs(this.generator.nextLong() + 1); + const second = Math.abs(this.generator.nextInt(StdUniqIdGenerator.INTEGER_MAX_VALUE)); + const calc = first + second; + const hash = (Math.abs(calc) % StdUniqIdGenerator.INTEGER_MAX_VALUE).toString( + StdUniqIdGenerator.BASE36, + ); + return String(this.padding + hash).slice(-6); + } +} + +const DEFAULT_FORMAT = "[%s]<%s>"; +const DEFAULT_REF_FORMAT = "[%s|%s]<%s>"; +const DEFAULT_MESSAGE_FORMAT = "%s => %s"; +const DEFAULT_UNIQ_ID_GENERATOR: UniqIdGenerator = new StdUniqIdGenerator(); + +const FORMAT_NUM_SPEC = 2; +const REF_FORMAT_NUM_SPEC = 3; +const MESSAGE_FORMAT_NUM_SPEC = 2; + +interface EidState { + format: string; + refFormat: string; + messageFormat: string; + uniqIdGenerator: UniqIdGenerator; +} + +const EidInternal: EidState = { + format: DEFAULT_FORMAT, + refFormat: DEFAULT_REF_FORMAT, + messageFormat: DEFAULT_MESSAGE_FORMAT, + uniqIdGenerator: DEFAULT_UNIQ_ID_GENERATOR, +}; + +function validateFormat(format: string | null | undefined, numSpecifiers: number): void { + if (format === null || format === undefined) { + throw new TypeError("Format can't be null, but just received one"); + } + const specifiers: string[] = []; + for (let i = 0; i < numSpecifiers; i++) { + specifiers.push(`${i}-test-id`); + } + const formatted = new JFormatter(format).format(specifiers); + for (const specifier of specifiers) { + if (formatted.indexOf(specifier) === -1) { + throw new TypeError( + `Given format contains to little format specifiers, expected ${numSpecifiers} but given "${format}"`, + ); + } + } +} + +/** + * Exception identifier for all Eid Runtime Exceptions. + * + * This class shouldn't be used in any public API or library. It is designed + * to be used for in-house development of end user applications which will + * report Bugs in standardized error pages or post them to issue tracker. + */ +export class Eid { + static readonly DEFAULT_FORMAT: string = DEFAULT_FORMAT; + static readonly DEFAULT_REF_FORMAT: string = DEFAULT_REF_FORMAT; + static readonly DEFAULT_MESSAGE_FORMAT: string = DEFAULT_MESSAGE_FORMAT; + static readonly DEFAULT_UNIQ_ID_GENERATOR: UniqIdGenerator = DEFAULT_UNIQ_ID_GENERATOR; + + private readonly id: string; + private readonly ref: string; + private readonly uniq: string; + + constructor(id: string, ref?: string | null) { + this.id = id; + this.ref = ref === null || ref === undefined ? "" : ref; + this.uniq = EidInternal.uniqIdGenerator.generateUniqId(); + } + + toString(): string { + if (this.ref === "") { + return new JFormatter(EidInternal.format).format([this.id, this.uniq]); + } + return new JFormatter(EidInternal.refFormat).format([this.id, this.ref, this.uniq]); + } + + getId(): string { + return this.id; + } + + getRef(): string { + return this.ref; + } + + getUniq(): string { + return this.uniq; + } + + makeLogMessage(logMessageFormat: string, ...params: unknown[]): string { + const message = new JFormatter(logMessageFormat).format(params); + return new JFormatter(Eid.getMessageFormat()).format([this.toString(), message]); + } + + static setFormat(format: string): string { + validateFormat(format, FORMAT_NUM_SPEC); + const previously = EidInternal.format; + EidInternal.format = format; + return previously; + } + + static setRefFormat(refFormat: string): string { + validateFormat(refFormat, REF_FORMAT_NUM_SPEC); + const previously = EidInternal.refFormat; + EidInternal.refFormat = refFormat; + return previously; + } + + static setMessageFormat(format: string): string { + validateFormat(format, MESSAGE_FORMAT_NUM_SPEC); + const oldFormat = EidInternal.messageFormat; + EidInternal.messageFormat = format; + return oldFormat; + } + + static getMessageFormat(): string { + return EidInternal.messageFormat; + } + + static setUniqIdGenerator(uniqIdGenerator: UniqIdGenerator): UniqIdGenerator { + if (uniqIdGenerator === null || uniqIdGenerator === undefined) { + throw new TypeError("Unique ID generator can't be null, but given one"); + } + const previous = EidInternal.uniqIdGenerator; + EidInternal.uniqIdGenerator = uniqIdGenerator; + return previous; + } +} + +export default Eid; diff --git a/src/exceptions.ts b/src/exceptions.ts new file mode 100644 index 0000000..e5bbe23 --- /dev/null +++ b/src/exceptions.ts @@ -0,0 +1,131 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Eid } from "./eid"; + +function prepareMessage(eid: Eid, message: string | undefined): string { + return message !== undefined ? `${eid} ${message}` : String(eid); +} + +function validateEid(eid: string | Eid | undefined): Eid { + if (eid === undefined) { + throw new TypeError( + "You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined", + ); + } + if (!(eid instanceof Eid)) { + return new Eid(String(eid)); + } + return eid; +} + +interface ErrorWithCaptureStackTrace { + captureStackTrace?(targetObject: object, constructorOpt?: unknown): void; +} + +function correctStackTrace(target: Error, ctor: unknown): void { + const ErrorCtor = Error as unknown as ErrorWithCaptureStackTrace; + if (typeof ErrorCtor.captureStackTrace === "function") { + ErrorCtor.captureStackTrace(target, ctor); + } /* v8 ignore start -- legacy fallback for environments without Error.captureStackTrace */ else { + const stringified = target.toString(); + let st: string = new Error().stack ?? stringified; + if (typeof st !== "string") { + st = stringified; + } + if (st.indexOf(stringified) < 0) { + st = st.replace(/^(?:Error\n)?/, `${stringified}\n`).trim(); + } + target.stack = st; + } /* v8 ignore stop */ +} + +/** + * Baseline of all Eid runtime exception classes. + * + * This class shouldn't be used in any public API or library. It is designed + * to be used for in-house development of end user applications which will + * report Bugs in standardized error pages or post them to issue tracker. + */ +export class EidRuntimeException extends Error { + readonly eid: Eid; + + constructor(eid: string | Eid | undefined, message?: string, cause?: unknown) { + const checkedEid = validateEid(eid); + const fullMessage = prepareMessage(checkedEid, message); + super(fullMessage, cause !== undefined ? { cause } : undefined); + Object.setPrototypeOf(this, new.target.prototype); + this.name = "EidRuntimeException"; + this.eid = checkedEid; + correctStackTrace(this, EidRuntimeException); + } +} + +/** + * Eid version of NullPointerException. + * + * This class shouldn't be used in any public API or library. + */ +export class EidNullPointerException extends EidRuntimeException { + constructor(eid: string | Eid | undefined, message?: string, cause?: unknown) { + super(eid, message, cause); + Object.setPrototypeOf(this, new.target.prototype); + this.name = "EidNullPointerException"; + correctStackTrace(this, EidNullPointerException); + } +} + +/** + * Eid version of IllegalArgumentException. + * + * This class shouldn't be used in any public API or library. + */ +export class EidIllegalArgumentException extends EidRuntimeException { + constructor(eid: string | Eid | undefined, message?: string, cause?: unknown) { + super(eid, message, cause); + Object.setPrototypeOf(this, new.target.prototype); + this.name = "EidIllegalArgumentException"; + correctStackTrace(this, EidIllegalArgumentException); + } +} + +/** + * Eid version of IllegalStateException. + * + * This class shouldn't be used in any public API or library. + */ +export class EidIllegalStateException extends EidRuntimeException { + constructor(eid: string | Eid | undefined, message?: string, cause?: unknown) { + super(eid, message, cause); + Object.setPrototypeOf(this, new.target.prototype); + this.name = "EidIllegalStateException"; + correctStackTrace(this, EidIllegalStateException); + } +} + +/** + * Eid version of IndexOutOfBoundsException. + * + * This class shouldn't be used in any public API or library. + */ +export class EidIndexOutOfBoundsException extends EidRuntimeException { + constructor(eid: string | Eid | undefined, message?: string, cause?: unknown) { + super(eid, message, cause); + Object.setPrototypeOf(this, new.target.prototype); + this.name = "EidIndexOutOfBoundsException"; + correctStackTrace(this, EidIndexOutOfBoundsException); + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..5d969a1 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { Eid } from "./eid"; +export type { UniqIdGenerator } from "./eid"; +export { + EidRuntimeException, + EidNullPointerException, + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, +} from "./exceptions"; +export { EidPreconditions } from "./preconditions"; + +import { Eid } from "./eid"; +import { + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, + EidNullPointerException, + EidRuntimeException, +} from "./exceptions"; +import { EidPreconditions } from "./preconditions"; + +// Backward compatibility: attach preconditions and exceptions to Eid +const preconditions = EidPreconditions; +const exceptions = { + EidRuntimeException, + EidNullPointerException, + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, +}; + +export { preconditions, exceptions }; +export default Eid; diff --git a/src/preconditions.ts b/src/preconditions.ts new file mode 100644 index 0000000..80ba175 --- /dev/null +++ b/src/preconditions.ts @@ -0,0 +1,171 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Eid } from "./eid"; +import { + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, + EidNullPointerException, + EidRuntimeException, +} from "./exceptions"; + +function isNullike(reference: unknown): reference is null | undefined { + return reference === null || reference === undefined; +} + +function checkNotNullEid(candidate: unknown): string | Eid { + if (isNullike(candidate)) { + throw new TypeError("Pass not-null Eid to EidPreconditions first!"); + } + return candidate as string | Eid; +} + +function ensureEid(candidate: string | Eid | null | undefined): Eid { + const checked = checkNotNullEid(candidate); + if (!(checked instanceof Eid)) { + return new Eid(String(checked)); + } + return checked; +} + +function isIndexAndSizeIllegal(index: number, size: number): boolean { + return index < 0 || index > size; +} + +function isSizeIllegal(size: number): boolean { + return size < 0; +} + +/** + * Static convenience methods that help a method or constructor check whether + * it was invoked correctly (whether its preconditions have been met). + * + * This class shouldn't be used in any public API or library. It is designed + * to be used for in-house development of end user applications which will + * report Bugs in standardized error pages or post them to issue tracker. + */ +export class EidPreconditions { + /* v8 ignore next 3 -- private constructor for static-only class */ + private constructor() { + // static-only class + } + + /** + * Ensures that an object reference passed as a parameter to the calling + * method is not null-like (null or undefined). + */ + static checkNotNullable( + reference: T | null | undefined, + eid: string | Eid, + message?: string, + ): T { + const checkedEid = ensureEid(eid); + if (isNullike(reference)) { + throw new EidNullPointerException(checkedEid, message); + } + return reference; + } + + /** + * Ensures that an object reference passed as a parameter to the calling + * method is not null. + */ + static checkNotNull(reference: T | null, eid: string | Eid, message?: string): T { + const checkedEid = ensureEid(eid); + if (reference === null) { + throw new EidNullPointerException(checkedEid, message); + } + return reference; + } + + /** + * Ensures that an object reference passed as a parameter to the calling + * method is not undefined. + */ + static checkNotUndefined(reference: T | undefined, eid: string | Eid, message?: string): T { + const checkedEid = ensureEid(eid); + if (reference === undefined) { + throw new EidNullPointerException(checkedEid, message); + } + return reference; + } + + /** + * Ensures the truth of an expression involving one or more parameters to + * the calling method. + */ + static checkArgument( + expression: boolean | null | undefined, + eid: string | Eid, + message?: string, + ): void { + const checkedEid = ensureEid(eid); + if (!EidPreconditions.checkNotNullable(expression, checkedEid)) { + throw new EidIllegalArgumentException(checkedEid, message); + } + } + + /** + * Ensures the truth of an expression involving the state of the calling + * instance, but not involving any parameters to the calling method. + */ + static checkState( + expression: boolean | null | undefined, + eid: string | Eid, + message?: string, + ): void { + const checkedEid = ensureEid(eid); + if (!EidPreconditions.checkNotNullable(expression, checkedEid)) { + throw new EidIllegalStateException(checkedEid, message); + } + } + + /** + * Ensures that index specifies a valid element in an array, list or string + * of size size. An element index may range from zero, inclusive, to size, + * exclusive. + */ + static checkElementIndex( + index: number, + size: number, + eid: string | Eid, + message?: string, + ): number { + const checkedEid = ensureEid(eid); + if (isSizeIllegal(size)) { + throw new EidIllegalArgumentException(checkedEid, message); + } + if (isIndexAndSizeIllegal(index, size)) { + throw new EidIndexOutOfBoundsException(checkedEid, message); + } + return index; + } + + /** + * Tries to execute code in given unsafe supplier code block, and if + * exception is thrown, it will get rethrown as an EidRuntimeException + * with eid given as argument. + */ + static tryToExecute(supplier: () => R, eid: string | Eid): R { + const checkedEid = ensureEid(eid); + try { + return EidPreconditions.checkNotNullable(supplier, checkedEid)(); + } catch (throwable) { + throw new EidRuntimeException(checkedEid, String(throwable), throwable); + } + } +} From 071d8548fa37f0e2128a286783d5caf1ace1a6fa Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 22:45:32 +0200 Subject: [PATCH 3/8] refactor: migrate tests to Vitest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 59 tests, 100% coverage. Mocha+expect.js replaced with Vitest. Added cause chaining tests for exceptions and tryToExecute. Assisted-by: đŸ€– claude-opus-4-6@default --- src/__tests__/eid.test.ts | 187 ++++++++++++++++++++++ src/__tests__/exceptions.test.ts | 201 +++++++++++++++++++++++ src/__tests__/preconditions.test.ts | 238 ++++++++++++++++++++++++++++ 3 files changed, 626 insertions(+) create mode 100644 src/__tests__/eid.test.ts create mode 100644 src/__tests__/exceptions.test.ts create mode 100644 src/__tests__/preconditions.test.ts diff --git a/src/__tests__/eid.test.ts b/src/__tests__/eid.test.ts new file mode 100644 index 0000000..1635c52 --- /dev/null +++ b/src/__tests__/eid.test.ts @@ -0,0 +1,187 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { afterEach, describe, expect, it } from "vitest"; +import { Eid } from "../eid"; + +describe("Eid", () => { + describe(".setFormat()", () => { + afterEach(() => { + Eid.setFormat(Eid.DEFAULT_FORMAT); + }); + + it("should set a valid new format and return last", () => { + const fmt = "{%s-%s}"; + let prev = Eid.setFormat(fmt); + expect(prev).toEqual(Eid.DEFAULT_FORMAT); + + prev = Eid.setFormat(fmt); + expect(prev).toEqual(fmt); + }); + + it("should throw error on null", () => { + const fn = () => { + Eid.setFormat(null as unknown as string); + }; + expect(fn).toThrow(TypeError); + expect(fn).toThrow("Format can't be null, but just received one"); + }); + + it("should throw error on invalid format", () => { + const fn = () => { + Eid.setFormat("%s -->"); + }; + expect(fn).toThrow(TypeError); + expect(fn).toThrow( + /Given format contains to little format specifiers, expected 2 but given "%s -->"/, + ); + }); + }); + + describe(".setRefFormat()", () => { + afterEach(() => { + Eid.setRefFormat(Eid.DEFAULT_REF_FORMAT); + }); + + it("should set a valid new ref format and return last", () => { + const fmt = "%s:%s --> %s"; + const prev = Eid.setRefFormat(fmt); + expect(prev).toEqual(Eid.DEFAULT_REF_FORMAT); + }); + }); + + describe(".setMessageFormat()", () => { + afterEach(() => { + Eid.setMessageFormat(Eid.DEFAULT_MESSAGE_FORMAT); + }); + + it("should set a valid new message format and return last", () => { + const fmt = "%s --> %s"; + const prev = Eid.setMessageFormat(fmt); + expect(prev).toEqual(Eid.DEFAULT_MESSAGE_FORMAT); + }); + }); + + describe(".getMessageFormat()", () => { + it("should return original actually set message format", () => { + const fmt = Eid.getMessageFormat(); + expect(fmt).toEqual(Eid.DEFAULT_MESSAGE_FORMAT); + }); + }); + + describe(".setUniqIdGenerator()", () => { + afterEach(() => { + Eid.setUniqIdGenerator(Eid.DEFAULT_UNIQ_ID_GENERATOR); + }); + + it("should throw error if given null", () => { + const fn = () => { + Eid.setUniqIdGenerator(null as unknown as { generateUniqId(): string }); + }; + expect(fn).toThrow(TypeError); + expect(fn).toThrow(/^Unique ID generator can't be null, but given one$/); + }); + + it("should set properly if given correct implementation", () => { + const gen = { + generateUniqId: () => "5", // just like SONY here :-) + }; + const prev = Eid.setUniqIdGenerator(gen); + expect(prev).toBe(Eid.DEFAULT_UNIQ_ID_GENERATOR); + const eid = new Eid("20160110:221413"); + expect(eid.toString()).toEqual("[20160110:221413]<5>"); + }); + }); + + describe(".DEFAULT_MESSAGE_FORMAT", () => { + it('should be equal "%s => %s"', () => { + expect(Eid.DEFAULT_MESSAGE_FORMAT).toEqual("%s => %s"); + }); + }); + + describe(".DEFAULT_FORMAT", () => { + it('should be equal "[%s]<%s>"', () => { + expect(Eid.DEFAULT_FORMAT).toEqual("[%s]<%s>"); + }); + }); + + describe(".DEFAULT_REF_FORMAT", () => { + it('should be equal "[%s|%s]<%s>"', () => { + expect(Eid.DEFAULT_REF_FORMAT).toEqual("[%s|%s]<%s>"); + }); + }); + + describe(".DEFAULT_UNIQ_ID_GENERATOR", () => { + it("should be instance of UniqIdGenerator", () => { + expect(Eid.DEFAULT_UNIQ_ID_GENERATOR.generateUniqId()).toMatch(/^[a-z0-9]{6}$/); + }); + }); + + describe("#toString()", () => { + describe("without ref number", () => { + const subject = new Eid("20160110:214452"); + it("should print object with eid and uniq id", () => { + expect(subject.toString()).toMatch(/^\[20160110:214452\]<[a-z0-9]{6}>$/); + }); + }); + + describe("with ref number", () => { + const subject = new Eid("20160110:214944", "ORA-1029"); + it("should print object with eid, ref and uniq id", () => { + expect(subject.toString()).toMatch(/^\[20160110:214944\|ORA-1029\]<[a-z0-9]{6}>$/); + }); + }); + }); + + describe("#makeLogMessage()", () => { + const eid = new Eid("20160110:215138"); + const messageFormat = "My test object is: %s"; + const testObject = { + a: 67, + toString() { + return JSON.stringify(this); + }, + }; + + it('should print log message as: [20160110:215138] => My test object is: {"a":67}', () => { + expect(eid.makeLogMessage(messageFormat, testObject)).toMatch( + /^\[20160110:215138\]<[a-z0-9]{6}> => My test object is: {"a":67}$/, + ); + }); + }); + + describe('given a eid == new Eid("20160110:220223", "EX-556")', () => { + const eid = new Eid("20160110:220223", "EX-556"); + + describe("#getId()", () => { + it("should return 20160110:220223 as id", () => { + expect(eid.getId()).toBe("20160110:220223"); + }); + }); + + describe("#getRef()", () => { + it("should return EX-556 as ref", () => { + expect(eid.getRef()).toBe("EX-556"); + }); + }); + + describe("#getUniq()", () => { + it("should return xxxxxx as uniq id", () => { + expect(eid.getUniq()).toMatch(/^[a-z0-9]{6}$/); + }); + }); + }); +}); diff --git a/src/__tests__/exceptions.test.ts b/src/__tests__/exceptions.test.ts new file mode 100644 index 0000000..a3dd0a1 --- /dev/null +++ b/src/__tests__/exceptions.test.ts @@ -0,0 +1,201 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, expect, it } from "vitest"; +import { + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, + EidNullPointerException, + EidRuntimeException, +} from "../exceptions"; + +describe("EidRuntimeException", () => { + const ex = new EidRuntimeException("20160110:230223", "A null pointer occured!"); + + it("should contain proper message", () => { + expect(ex.toString()).toMatch( + /EidRuntimeException: \[20160110:230223\]<[a-z0-9]+> A null pointer occured!/, + ); + }); + + it("should contain a stack trace", () => { + expect(ex.stack).toBeTruthy(); + }); + + it("should inherits Error", () => { + expect(ex instanceof Error).toBe(true); + }); + + it("should not inherits TypeError or other types of Eid*Exception", () => { + expect(ex instanceof TypeError).toBe(false); + expect(ex instanceof EidIllegalStateException).toBe(false); + expect(ex instanceof EidIllegalArgumentException).toBe(false); + expect(ex instanceof EidIndexOutOfBoundsException).toBe(false); + expect(ex instanceof EidNullPointerException).toBe(false); + }); + + describe("construction without passing eid object", () => { + it("should fail with TypeError", () => { + let caught: unknown; + try { + new EidRuntimeException(undefined); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(TypeError); + expect((caught as TypeError).message).toEqual( + "You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined", + ); + }); + }); +}); + +describe("EidNullPointerException", () => { + const ex = new EidNullPointerException("20160110:223238", "A null pointer occured!"); + + it("should contain proper message", () => { + expect(ex.toString()).toMatch( + /EidNullPointerException: \[20160110:223238\]<[a-z0-9]+> A null pointer occured!/, + ); + }); + + it("should contain a stack trace", () => { + expect(ex.stack).toBeTruthy(); + }); + + it("should inherits Error and EidRuntimeException", () => { + expect(ex instanceof EidNullPointerException).toBe(true); + expect(ex instanceof Error).toBe(true); + expect(ex instanceof EidRuntimeException).toBe(true); + }); + + it("should not inherits TypeError or other types of Eid*Exception", () => { + expect(ex instanceof TypeError).toBe(false); + expect(ex instanceof EidIllegalStateException).toBe(false); + expect(ex instanceof EidIllegalArgumentException).toBe(false); + expect(ex instanceof EidIndexOutOfBoundsException).toBe(false); + }); +}); + +describe("EidIllegalArgumentException", () => { + const ex = new EidIllegalArgumentException("20160110:230031", "A null pointer occured!"); + + it("should contain proper message", () => { + expect(ex.toString()).toMatch( + /EidIllegalArgumentException: \[20160110:230031\]<[a-z0-9]+> A null pointer occured!/, + ); + }); + + it("should contain a stack trace", () => { + expect(ex.stack).toBeTruthy(); + }); + + it("should inherits Error and EidRuntimeException", () => { + expect(ex instanceof Error).toBe(true); + expect(ex instanceof EidRuntimeException).toBe(true); + expect(ex instanceof EidIllegalArgumentException).toBe(true); + }); + + it("should not inherits TypeError or other types of Eid*Exception", () => { + expect(ex instanceof TypeError).toBe(false); + expect(ex instanceof EidIllegalStateException).toBe(false); + expect(ex instanceof EidNullPointerException).toBe(false); + expect(ex instanceof EidIndexOutOfBoundsException).toBe(false); + }); +}); + +describe("EidIllegalStateException", () => { + const ex = new EidIllegalStateException("20160110:230112", "Illegal state!"); + const regex = /EidIllegalStateException: \[20160110:230112\]<[a-z0-9]+> Illegal state!/; + + it("should contain proper message", () => { + expect(ex.toString()).toMatch(regex); + }); + + it("should contain a stack trace", () => { + expect(ex.stack).toBeTruthy(); + expect(ex.stack).toMatch(regex); + }); + + it("should inherits Error and EidRuntimeException", () => { + expect(ex instanceof Error).toBe(true); + expect(ex instanceof EidRuntimeException).toBe(true); + expect(ex instanceof EidIllegalStateException).toBe(true); + }); + + it("should not inherits TypeError or other types of Eid*Exception", () => { + expect(ex instanceof TypeError).toBe(false); + expect(ex instanceof EidIllegalArgumentException).toBe(false); + expect(ex instanceof EidNullPointerException).toBe(false); + expect(ex instanceof EidIndexOutOfBoundsException).toBe(false); + }); +}); + +describe("EidIndexOutOfBoundsException", () => { + const ex = new EidIndexOutOfBoundsException("20160110:230140", "Index is out of bounds!"); + const regex = + /EidIndexOutOfBoundsException: \[20160110:230140\]<[a-z0-9]+> Index is out of bounds!/; + + it("should contain proper message", () => { + expect(ex.toString()).toMatch(regex); + }); + + it("should contain a stack trace", () => { + expect(ex.stack).toBeTruthy(); + expect(ex.stack).toMatch(regex); + }); + + it("should inherits Error and EidRuntimeException", () => { + expect(ex instanceof Error).toBe(true); + expect(ex instanceof EidRuntimeException).toBe(true); + expect(ex instanceof EidIndexOutOfBoundsException).toBe(true); + }); + + it("should not inherits TypeError or other types of Eid*Exception", () => { + expect(ex instanceof TypeError).toBe(false); + expect(ex instanceof EidIllegalArgumentException).toBe(false); + expect(ex instanceof EidIllegalStateException).toBe(false); + expect(ex instanceof EidNullPointerException).toBe(false); + }); +}); + +describe("cause support", () => { + it("should store cause when provided to EidRuntimeException", () => { + const originalError = new TypeError("original failure"); + const ex = new EidRuntimeException("20260714:100000", "wrapped", originalError); + expect(ex.cause).toBe(originalError); + expect(ex.message).toMatch(/wrapped/); + }); + + it("should have undefined cause when not provided", () => { + const ex = new EidRuntimeException("20260714:100001", "no cause"); + expect(ex.cause).toBeUndefined(); + }); + + it("should propagate cause through subclasses", () => { + const cause = new RangeError("out of range"); + const ex = new EidIllegalStateException("20260714:100002", "state error", cause); + expect(ex.cause).toBe(cause); + expect(ex).toBeInstanceOf(EidRuntimeException); + expect(ex).toBeInstanceOf(Error); + }); + + it("should accept non-Error cause values", () => { + const ex = new EidRuntimeException("20260714:100003", "string cause", "a string cause"); + expect(ex.cause).toBe("a string cause"); + }); +}); diff --git a/src/__tests__/preconditions.test.ts b/src/__tests__/preconditions.test.ts new file mode 100644 index 0000000..2a65d62 --- /dev/null +++ b/src/__tests__/preconditions.test.ts @@ -0,0 +1,238 @@ +/* + * Copyright 2016 Wave Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, expect, it } from "vitest"; +import { Eid } from "../eid"; +import { + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, + EidNullPointerException, + EidRuntimeException, +} from "../exceptions"; +import { EidPreconditions } from "../preconditions"; + +describe("EidPreconditions", () => { + const eid = "20160111:004403"; + const eidRegex = /20160111:004403/; + + describe(".checkNotNullable()", () => { + describe("giving a null value", () => { + it("should throw EidNullPointerException", () => { + let caught: unknown; + try { + EidPreconditions.checkNotNullable(null, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidNullPointerException); + expect(caught).not.toBeInstanceOf(TypeError); + expect(String(caught)).toMatch(eidRegex); + expect((caught as EidNullPointerException).message).toMatch(eidRegex); + }); + }); + + describe("giving a undefined value", () => { + it("should throw EidNullPointerException", () => { + let caught: unknown; + try { + EidPreconditions.checkNotNullable(undefined, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidNullPointerException); + expect(caught).not.toBeInstanceOf(TypeError); + expect(String(caught)).toMatch(eidRegex); + expect((caught as EidNullPointerException).message).toMatch(eidRegex); + }); + }); + + describe("giving a string value", () => { + it("should return original value", () => { + const given = "YjdlYjExZGQ0MzY3YjIxO"; + const result = EidPreconditions.checkNotNullable(given, eid); + expect(result).toBe(given); + }); + }); + }); + + describe(".checkNotNull()", () => { + describe("giving a null value", () => { + it("should throw EidNullPointerException", () => { + let caught: unknown; + try { + EidPreconditions.checkNotNull(null, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidNullPointerException); + expect(caught).not.toBeInstanceOf(TypeError); + expect(String(caught)).toMatch(eidRegex); + expect((caught as EidNullPointerException).message).toMatch(eidRegex); + }); + }); + + describe("giving a string value", () => { + it("should return original value", () => { + const given = "YjdlYjExZGQ0MzY3YjIxO"; + const result = EidPreconditions.checkNotNull(given, eid); + expect(result).toBe(given); + }); + }); + }); + + describe(".checkNotUndefined()", () => { + describe("giving a undefined value", () => { + it("should throw EidNullPointerException", () => { + let caught: unknown; + try { + EidPreconditions.checkNotUndefined(undefined, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidNullPointerException); + expect(caught).not.toBeInstanceOf(TypeError); + expect(String(caught)).toMatch(eidRegex); + expect((caught as EidNullPointerException).message).toMatch(eidRegex); + }); + }); + + describe("giving a string value", () => { + it("should return original value", () => { + const given = "YjdlYjExZGQ0MzY3YjIxO"; + const result = EidPreconditions.checkNotUndefined(given, eid); + expect(result).toBe(given); + }); + }); + }); + + describe(".checkArgument()", () => { + describe("giving an Eid object", () => { + const eidObject = new Eid(eid); + it("should run without errors", () => { + const fn = () => { + EidPreconditions.checkArgument(true, eidObject); + }; + expect(fn).not.toThrow(); + }); + }); + + describe("giving a nullable value", () => { + it("should throw TypeError", () => { + let caught: unknown; + try { + EidPreconditions.checkArgument(true, undefined as unknown as string); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(TypeError); + expect(String(caught)).toMatch(/Pass not-null Eid to EidPreconditions first!/); + }); + }); + + describe("giving a falsy value", () => { + it("should throw EidIllegalArgumentException", () => { + let caught: unknown; + try { + EidPreconditions.checkArgument(false, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidIllegalArgumentException); + expect(String(caught)).toMatch(eidRegex); + }); + }); + }); + + describe(".checkState()", () => { + describe("giving a falsy value", () => { + it("should throw EidIllegalStateException", () => { + let caught: unknown; + try { + EidPreconditions.checkState(false, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidIllegalStateException); + expect(String(caught)).toMatch(eidRegex); + }); + }); + }); + + describe(".checkElementIndex()", () => { + describe("giving a invalid size of -6", () => { + it("should throw EidIllegalArgumentException", () => { + let caught: unknown; + try { + EidPreconditions.checkElementIndex(0, -6, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidIllegalArgumentException); + expect(String(caught)).toMatch(eidRegex); + }); + }); + + describe("giving a invalid index value of 6, and size of 2", () => { + it("should throw EidIndexOutOfBoundsException", () => { + let caught: unknown; + try { + EidPreconditions.checkElementIndex(6, 2, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidIndexOutOfBoundsException); + expect(String(caught)).toMatch(eidRegex); + }); + }); + + describe("giving a valid index of 2 and size of 5", () => { + it("should return index of 2", () => { + const result = EidPreconditions.checkElementIndex(2, 5, eid); + expect(result).toBe(2); + }); + }); + }); + + describe(".tryToExecute()", () => { + describe("giving a valid supplier function", () => { + it("should return supplier value", () => { + const fn = () => 6; + const result = EidPreconditions.tryToExecute(fn, eid); + expect(result).toBe(6); + }); + }); + + describe("giving a supplier that throws TypeError function", () => { + it("should throw EidRuntimeException with original error as cause", () => { + const originalError = new TypeError("invalid type!"); + const fn = () => { + throw originalError; + }; + let caught: unknown; + try { + EidPreconditions.tryToExecute(fn, eid); + } catch (e) { + caught = e; + } + expect(caught).toBeInstanceOf(EidRuntimeException); + expect(String(caught)).toMatch(eidRegex); + expect(String(caught)).toMatch(/invalid type!/); + expect((caught as EidRuntimeException).cause).toBe(originalError); + }); + }); + }); +}); From 74f69747c034893bb84887554108a45c10ea1933 Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 22:45:36 +0200 Subject: [PATCH 4/8] ci: replace Travis with GitHub Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node 20+22 matrix, lint/test/build jobs. Concurrency control, timeout protection. Assisted-by: đŸ€– claude-opus-4-6@default --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f440184 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: [master, develop] + pull_request: + branches: [master, develop] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npx biome check src/ + + test: + name: Test (Node ${{ matrix.node-version }}) + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + matrix: + node-version: [20, 22] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - run: npm ci + - run: npm run test:coverage + + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 5 + needs: [lint, test] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npm run build From 6b883c20aa27dff7d317f189a8b0d94baa745471 Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 22:45:45 +0200 Subject: [PATCH 5/8] chore: remove legacy files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop gulp/, bower.json, .travis.yml, dist/, gulpfile.js. Drop old lib/ and test/ (replaced by src/). Assisted-by: đŸ€– claude-opus-4-6@default --- .travis.yml | 13 - bower.json | 29 - dist/browser/index.html | 122 ---- dist/browser/toplevel/eid.js | 795 --------------------------- dist/browser/toplevel/eid.min.js | 2 - dist/browser/toplevel/eid.min.js.map | 1 - gulp/build.js | 46 -- gulp/build/toplevel.js | 20 - gulp/clean.js | 25 - gulp/config.js | 19 - gulp/serve.js | 7 - gulp/tests.js | 74 --- gulpfile.js | 22 - lib/eid.js | 26 - lib/eid/eid.js | 258 --------- lib/eid/exceptions.js | 200 ------- lib/eid/preconditions.js | 279 ---------- test/eid.js | 170 ------ test/eid/exceptions.js | 138 ----- test/eid/preconditions.js | 223 -------- 20 files changed, 2469 deletions(-) delete mode 100644 .travis.yml delete mode 100644 bower.json delete mode 100644 dist/browser/index.html delete mode 100644 dist/browser/toplevel/eid.js delete mode 100644 dist/browser/toplevel/eid.min.js delete mode 100644 dist/browser/toplevel/eid.min.js.map delete mode 100644 gulp/build.js delete mode 100644 gulp/build/toplevel.js delete mode 100644 gulp/clean.js delete mode 100644 gulp/config.js delete mode 100644 gulp/serve.js delete mode 100644 gulp/tests.js delete mode 100644 gulpfile.js delete mode 100644 lib/eid.js delete mode 100644 lib/eid/eid.js delete mode 100644 lib/eid/exceptions.js delete mode 100644 lib/eid/preconditions.js delete mode 100644 test/eid.js delete mode 100644 test/eid/exceptions.js delete mode 100644 test/eid/preconditions.js diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7649ca7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -language: node_js -sudo: false -cache: - directories: - - node_modules -node_js: - - "4.1" - - "4.0" - - "0.12" - - "0.11" - - "0.10" - - "iojs" diff --git a/bower.json b/bower.json deleted file mode 100644 index 93123db..0000000 --- a/bower.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "eid.js", - "description": "EID Runtime Exceptions and Utilities for JS", - "main": "dist/browser/toplevel/eid.min.js", - "authors": [ - "Krzysztof Suszynski " - ], - "license": "Apache-2.0", - "keywords": [ - "debug", - "expection", - "preconditions", - "quality", - "qa" - ], - "homepage": "https://github.com/wavesoftware/javascript-eid-exceptions", - "moduleType": [ - "globals" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests", - "gulp", - "target" - ] -} diff --git a/dist/browser/index.html b/dist/browser/index.html deleted file mode 100644 index f639a1e..0000000 --- a/dist/browser/index.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - ExceptionID.js - manual test page - - - - - - - -

ExceptionID.js - showcase

- -

Code:

-

-    var EidRuntimeException = Eid.exceptions.EidRuntimeException;
-    try {
-      // Example entity objects
-      var users = [];
-      for (var i = 0; i < 5; i++) {
-        var user = { id: 67112 - i };
-        user.toString = function() { return '[User id=' + this.id + ']'; };
-        users.push(user);
-      }
-
-      // logging support
-      for (var i = 0; i < users.length; i++) {
-        var user = users[i];
-        var eid = new Eid('20160111:223928', 'WJS-17');
-        log.debug(eid.makeLogMessage('An entity: %s', user));
-        log.debug(eid.makeLogMessage('%s has even ID: %s', user, user.id % 2 === 0));
-      }
-
-      // preconditions!
-      var EidPreconditions = Eid.preconditions;
-      EidPreconditions.checkArgument(true, '20160111:223749');
-      EidPreconditions.checkState(false, '20160111:224215', 'A extra message');
-    } catch(e) {
-      // Top level of your application
-      log.error(e.stack);
-      if (e instanceof EidRuntimeException) {
-        // or better save your exceptions!
-        logGateway.put(e, inspectable({eid: e.eid}));
-      }
-    }
-    
-

Console:

-

-    
-  
-
diff --git a/dist/browser/toplevel/eid.js b/dist/browser/toplevel/eid.js
deleted file mode 100644
index 04bafdf..0000000
--- a/dist/browser/toplevel/eid.js
+++ /dev/null
@@ -1,795 +0,0 @@
-(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;oThis class shouldn't be used in any public API or library. It is designed to be used for in-house development
- * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.
- * 

- * Exception identifier for all Eid Runtime Exceptions. - * @constructor - * @param {string} id - the exception id, must be unique developer inserted string, from date - * @param {string} ref - an optional reference - */ -function Eid(id, ref) { - var uniq = EidInternal.uniqIdGenerator.generateUniqId(); - ref = (ref === null || ref == undefined) ? "" : ref; - - /** - * Makes a log message from this EID object - *

- *

This method is for convenience of usage of EID in logging. You can use it like this: - *

- *

-   * log.debug(new Eid("20151025:202129").makeLogMessage("A request: %s", request));
-   * 
- * @param {string} logMessageFormat - a log message format as accepted by {@link String#format(String, Object...)} - * @param {Object...} parameters - a parameters for logMessageFormat to by passed to {@link String#format(String, Object...)} - * @return {string} a formatted message - */ - this.makeLogMessage = function(logMessageFormat) { - var parameters = []; - for (var i = 1; i < arguments.length; i++) { - parameters.push(arguments[i]); - } - var message = new JFormatter(logMessageFormat).format(parameters); - return new JFormatter(Eid.getMessageFormat()).format(this.toString(), message); - } - - /** - * Standard to string method - */ - this.toString = function() { - if ("" === ref) { - return new JFormatter(EidInternal.format).format(id, uniq); - } - return new JFormatter(EidInternal.refFormat).format(id, ref, uniq); - } - - /** - * Getter for constant Exception ID - * - * @return {string} ID of exception - */ - this.getId = function() { - return id; - } - - /** - * Get custom ref passed to Exception ID - * - * @return {string} ID of exception - */ - this.getRef = function() { - return ref; - } - - /** - * Gets unique generated string for this instance of Eid - * - * @return {string} a unique string - */ - this.getUniq = function() { - return uniq; - } -} - -function MathRandom() { - var LONG_MAX = Math.pow(2, 53) - 1; - var LONG_MIN = -1 * Math.pow(2, 53); - this.nextLong = function() { - return this.nextNumber(LONG_MIN, LONG_MAX); - }; - this.nextInt = function(max) { - return this.nextNumber(0, max); - }; - this.nextNumber = function(min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; - }; -} - -function StdUniqIdGenerator() { - var BASE36 = 36; - var INTEGER_MAX_VALUE = Math.pow(2, 31); - var MIN_6_CHAR_HASH = 60466177; // for '100001' in base64 - var generator = new MathRandom(); - var padding = generator.nextNumber(MIN_6_CHAR_HASH, INTEGER_MAX_VALUE).toString(BASE36); - this.generateUniqId = function() { - var first = Math.abs(generator.nextLong() + 1); - var second = Math.abs(generator.nextInt(INTEGER_MAX_VALUE)); - var calc = first + second; - var hash = (Math.abs(calc) % INTEGER_MAX_VALUE).toString(BASE36); - return String(padding + hash).slice(-6); // pad output string to six chars using random padding - }; -} - -var DEFAULT_FORMAT = "[%s]<%s>"; -var DEFAULT_REF_FORMAT = "[%s|%s]<%s>"; -var DEFAULT_MESSAGE_FORMAT = "%s => %s"; -var DEFAULT_UNIQ_ID_GENERATOR = new StdUniqIdGenerator(); - -Object.defineProperty(Eid, "DEFAULT_FORMAT", { - get: function() { return DEFAULT_FORMAT; } -}); -Object.defineProperty(Eid, "DEFAULT_MESSAGE_FORMAT", { - get: function() { return DEFAULT_MESSAGE_FORMAT; } -}); -Object.defineProperty(Eid, "DEFAULT_REF_FORMAT", { - get: function() { return DEFAULT_REF_FORMAT; } -}); -Object.defineProperty(Eid, "DEFAULT_UNIQ_ID_GENERATOR", { - get: function() { return DEFAULT_UNIQ_ID_GENERATOR; } -}); - -var FORMAT_NUM_SPEC = 2; -var REF_FORMAT_NUM_SPEC = 3; -var MESSAGE_FORMAT_NUM_SPEC = 2; - -var EidInternal = { - messageFormat: DEFAULT_MESSAGE_FORMAT, - uniqIdGenerator: DEFAULT_UNIQ_ID_GENERATOR, - format: DEFAULT_FORMAT, - refFormat: DEFAULT_REF_FORMAT -}; - -var validateFormat = function(format, numSpecifiers) { - if (format === null || format === undefined) { - throw new TypeError("Format can't be null, but just received one"); - } - var specifiers = []; - for (var i = 0; i < numSpecifiers; i++) { - specifiers.push(i + "-test-id"); - } - var formatted = new JFormatter(format).format(specifiers); - for (var specifier in specifiers) { - if (formatted.indexOf(specifier) === -1) { - throw new TypeError("Given format contains to little format specifiers, " + - "expected " + numSpecifiers + " but given \"" + format + "\""); - } - } -}; - -/** - * Sets the actual unique ID generator that will be used to generate IDs for all Eid objects. It will return previously used - * generator. - * - * @param {UniqIdGenerator} uniqIdGenerator - new instance of unique ID generator - * @return {UniqIdGenerator} a previously used unique ID generator - * @throws {TypeError} if given generator was null - */ -Eid.setUniqIdGenerator = function(uniqIdGenerator) { - if (uniqIdGenerator === null || uniqIdGenerator === undefined) { - throw new TypeError("Unique ID generator can't be null, but given one"); - } - var previous = EidInternal.uniqIdGenerator; - EidInternal.uniqIdGenerator = uniqIdGenerator; - return previous; -}; - -/** - * Sets the actual format that will be used in {@link #toString()} method. It will return previously used format. - * - * @param {string} format - a format compliant with {@link String#format(String, Object...)} with 2 object arguments - * @return {string} a previously used format - * @throws {TypeError} if given format hasn't got two format specifiers "%s", or if given format was - * null - */ -Eid.setFormat = function(format) { - validateFormat(format, FORMAT_NUM_SPEC); - var previously = EidInternal.format; - EidInternal.format = format; - return previously; -}; - -/** - * Sets the actual format that will be used in {@link #toString()} method - * - * @param {string} refFormat - a format compliant with {@link String#format(String, Object...)} with 3 object arguments - * @return {string} a previously used format - * @throws {TypeError} if given format hasn't got tree format specifiers "%s", or if given format was - * null - */ -Eid.setRefFormat = function(refFormat) { - validateFormat(refFormat, REF_FORMAT_NUM_SPEC); - var previously = EidInternal.refFormat; - EidInternal.refFormat = refFormat; - return previously; -}; - -/** - * Sets a format that will be used for all Eid exceptions when printing a detail message. - *

- * Format must be non-null and contain two format specifiers "%s" - * - * @param {string} format - a format that will be used, must be non-null and contain two format specifiers "%s" - * @return {string} previously used format - * @throws {TypeError} if given format hasn't got two format specifiers "%s", or if given format was - * null - */ -Eid.setMessageFormat = function(format) { - validateFormat(format, MESSAGE_FORMAT_NUM_SPEC); - var oldFormat = EidInternal.messageFormat; - EidInternal.messageFormat = format; - return oldFormat; -}; - -/** - * Gets actually set message format - * - * @return {string} actually setted message format - */ -Eid.getMessageFormat = function() { - return EidInternal.messageFormat; -}; - -module.exports = Eid; - -})(module); - -},{}],4:[function(require,module,exports){ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(exports) { - 'use strict'; - - var Eid = require('./eid'); - - var prepareMessage = function(eid, message) { - return message !== undefined ? (eid + " " + message) : eid; - }; - - var validateEid = function(eid) { - if (eid === undefined) { - throw new TypeError('You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined'); - } - if (!(eid instanceof Eid)) { - eid = new Eid(eid.toString()); - } - return eid; - }; - - var CorrectStackTrace = { - modern: function(target, constructor) { - Error.captureStackTrace(target, constructor); - }, - fixLegancyStackTrace: function(stack, stringified) { - var st = stack; - if (typeof(stack) !== 'string') { - // On IE the stack field is empty so setting to toString() :-/ - st = stringified; - } - // Hands down, if all fails, just replace Error with nice Eid string - if (st.indexOf(stringified) < 0) { - st = st.replace(/^(?:Error\n)?/, stringified + "\n").trim(); - } - return st; - }, - legancy: function(target, constructor, exceptionConstructor) { - // Hacks for IE an Edge - var stringified = target.toString(); - // try to fetch stacktrace from JS standard Error - var st = (new exceptionConstructor()).stack; - target.stack = CorrectStackTrace.fixLegancyStackTrace(st, stringified); - } - }; - CorrectStackTrace.fixLegancyStackTrace('Error\n'); - CorrectStackTrace.legancy({}, null, Object); - - var correctStackTrace = function(target, constructor) { - var handler = typeof(Error.captureStackTrace) === 'function' ? - CorrectStackTrace.modern : CorrectStackTrace.legancy; - handler(target, constructor, Error); - }; - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This exception class is baseline of all Eid runtime exception classes. It is designed to ease of use and provide strict ID for - * given Exception usage. This approach speed up development of large application and helps support teams to by giving the both - * static and random ID for each possible unpredicted bug. - *

- * This is best to use with tools and plugins like - * EidGenerator for Netbeans IDE - *

- * For convenience use {@link eid.Preconditions} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @author Krzysztof SuszyƄski - */ - function EidRuntimeException(eid, message) { - eid = validateEid(eid); - message = prepareMessage(eid, message); - var tmp = Error.apply(this, [message]); - tmp.name = this.name = 'EidRuntimeException'; - this.message = tmp.message; - this.eid = eid; - correctStackTrace(this, EidRuntimeException); - - return this; - } - EidRuntimeException.prototype = Object.create(Error.prototype, { - constructor: { value: EidRuntimeException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This id Eid version of {@link NullPointerException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see NullPointerException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidNullPointerException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidNullPointerException'; - correctStackTrace(this, EidNullPointerException); - return this; - } - EidNullPointerException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidNullPointerException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This is Eid version of {@link IllegalArgumentException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see IllegalArgumentException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidIllegalArgumentException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidIllegalArgumentException'; - correctStackTrace(this, EidIllegalArgumentException); - return this; - } - EidIllegalArgumentException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidIllegalArgumentException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This id Eid version of {@link IllegalStateException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see IllegalStateException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidIllegalStateException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidIllegalStateException'; - correctStackTrace(this, EidIllegalStateException); - return this; - } - EidIllegalStateException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidIllegalStateException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This id Eid version of {@link IndexOutOfBoundsException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see IndexOutOfBoundsException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidIndexOutOfBoundsException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidIndexOutOfBoundsException'; - correctStackTrace(this, EidIndexOutOfBoundsException); - return this; - } - EidIndexOutOfBoundsException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidIndexOutOfBoundsException } - }); - - exports.EidRuntimeException = EidRuntimeException; - exports.EidNullPointerException = EidNullPointerException; - exports.EidIllegalArgumentException = EidIllegalArgumentException; - exports.EidIllegalStateException = EidIllegalStateException; - exports.EidIndexOutOfBoundsException = EidIndexOutOfBoundsException; - -})(exports); - -},{"./eid":3}],5:[function(require,module,exports){ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(module) { -'use strict'; - -var Eid = require('./eid'); -var EidRuntimeException = require('./exceptions').EidRuntimeException; -var EidNullPointerException = require('./exceptions').EidNullPointerException; -var EidIllegalArgumentException = require('./exceptions').EidIllegalArgumentException; -var EidIllegalStateException = require('./exceptions').EidIllegalStateException; -var EidIndexOutOfBoundsException = require('./exceptions').EidIndexOutOfBoundsException; - -/** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * Static convenience methods that help a method or constructor check whether it was invoked correctly (whether its - * preconditions - * have been met). These methods generally accept a {@code boolean} expression which is expected to be {@code true} (or in the - * case of {@code - * checkNotNull}, an object reference which is expected to be non-null). When {@code false} (or {@code null}) is passed instead, - * the {@code EidPreconditions} method throws an unchecked exception, which helps the calling method communicate to its - * caller that - * that caller has made a mistake. - *

- * Each method accepts a EID String or {@link Eid} object, which is designed to ease of use and provide strict ID for given - * Exception usage. This approach speed up development of large application and helps support teams to by giving the both static - * and random ID for each possible unpredicted bug. - *

- * This is best to use with tools and plugins like - * EidGenerator for Netbeans IDE - *

- * Example: - *

   {@code
- *
- *   /**
- *    * Returns the positive square root of the given value.
- *    *
- *    * @throws EidIllegalArgumentException if the value is negative
- *    *}{@code /
- *   public static double sqrt(double value) {
- *     EidPreconditions.checkArgument(value >= 0.0, "20150718:012333");
- *     // calculate the square root
- *   }
- *
- *   void exampleBadCaller() {
- *     double d = sqrt(-1.0);
- *   }
- * }
- *

- * In this example, {@code checkArgument} throws an {@code EidIllegalArgumentException} to indicate that {@code exampleBadCaller} - * made an error in its call to {@code sqrt}. Exception, when it will be printed will contain user given Eid and also - * Randomly generated ID. Those fields can be displayed to user on error page on posted directly to issue tracker. - *

- * Example: - *

- *

- *
- * {@code
- *   // Main application class for ex.: http servlet
- *    try {
- *        performRequest(request, response);
- *    } catch (EidRuntimeException ex) {
- *        issuesTracker.put(ex);
- *        throw ex;
- *    }
- * }
- *

- *

- *

Functional try to execute blocks

- *

- *

- * Using functional blocks to handle operations, that are intended to operate properly, simplify the code and makes it more - * readable. It's also good way to deal with untested, uncovered {@code catch} blocks. It's easy and gives developers nice way of - * dealing with countless operations that suppose to work as intended. - *

- *

- * Example: - *


- *
- *     InputStream is = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {
- *        {@literal @}Override
- *         public InputStream get() throws IOException {
- *             return this.getClass().getClassLoader()
- *                 .getResourceAsStream("project.properties");
- *         }
- *     }, "20150718:121521");
- * 
- * - * @constructor - * @author Krzysztof SuszyƄski - * @since 0.1.0 (idea imported from Guava Library and COI code) - */ -function EidPreconditions() {} - -function isNullike(reference) { - return reference === null || reference === undefined; -} - -function checkNotNull(reference) { - if (isNullike(reference)) { - throw new TypeError("Pass not-null Eid to EidPreconditions first!"); - } - return reference; -} - -function ensureEid(candidate) { - candidate = checkNotNull(candidate); - var eid; - if (!(candidate instanceof Eid)) { - eid = new Eid(candidate + ''); - } else { - eid = candidate; - } - return eid; -} - -/** - * Ensures that an object reference passed as a parameter to the calling method is not null-like. - * - * @param {Object} reference - an object reference - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - message for produced exception - * @return {Object} the non-null reference that was validated - * @throws {EidNullPointerException} if {@code reference} is null-like - */ -EidPreconditions.checkNotNullable = function(reference, eid, message) { - var checkedEid = ensureEid(eid); - if (isNullike(reference)) { - throw new EidNullPointerException(checkedEid, message); - } - return reference; -}; - -/** - * Ensures that an object reference passed as a parameter to the calling method is not null. - * - * @param {Object} reference - an object reference - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - message for produced exception - * @return {Object} the non-null reference that was validated - * @throws {EidNullPointerException} if {@code reference} is null-like - */ -EidPreconditions.checkNotNull = function(reference, eid, message) { - var checkedEid = ensureEid(eid); - if (reference === null) { - throw new EidNullPointerException(checkedEid, message); - } - return reference; -}; - -/** - * Ensures that an object reference passed as a parameter to the calling method is not undefined. - * - * @param {Object} reference - an object reference - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - message for produced exception - * @return {Object} the non-null reference that was validated - * @throws {EidNullPointerException} if {@code reference} is null-like - */ -EidPreconditions.checkNotUndefined = function(reference, eid, message) { - var checkedEid = ensureEid(eid); - if (reference === undefined) { - throw new EidNullPointerException(checkedEid, message); - } - return reference; -}; - -/** - * Ensures the truth of an expression involving one or more parameters to the calling method. - * - * @param {boolean} expression - a boolean expression - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - optional message for generated exception - * @throws {EidIllegalArgumentException} if {@code expression} is false - * @throws {EidNullPointerException} if {@code expression} is null - */ -EidPreconditions.checkArgument = function(expression, eid, message) { - var checkedEid = ensureEid(eid); - if (!EidPreconditions.checkNotNullable(expression, checkedEid)) { - throw new EidIllegalArgumentException(checkedEid, message) - } -}; - -/** - * Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the - * calling method. - * - * @param {boolean} expression - a boolean expression - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - optional message for generated exception - * @throws {EidIllegalStateException} if {@code expression} is false - * @throws {EidNullPointerException} if {@code expression} is null - */ -EidPreconditions.checkState = function(expression, eid, message) { - var checkedEid = ensureEid(eid); - if (!EidPreconditions.checkNotNullable(expression, checkedEid)) { - throw new EidIllegalStateException(checkedEid, message); - } -}; - -function isIndexAndSizeIllegal(index, size) { - return index < 0 || index > size; -} - -function isSizeIllegal(size) { - return size < 0; -} - -/** - * Ensures that {@code index} specifies a valid element in an array, list or string of size {@code size}. An element - * index may range from zero, inclusive, to {@code size}, exclusive. - * - * @param {number} index - a user-supplied index identifying an element of an array, list or string - * @param {numer} size - the size of that array, list or string - * @param {string|Eid} eid - the text to use to describe this index in an error message - * @param {string} message - optional message for generated exception - * @return {number} the value of {@code index} - * @throws {EidIndexOutOfBoundsException} if {@code index} is negative or is not less than {@code size} - * @throws {EidIllegalArgumentException} if {@code size} is negative - */ -EidPreconditions.checkElementIndex = function(index, size, eid, message) { - var checkedEid = ensureEid(eid); - if (isSizeIllegal(size)) { - throw new EidIllegalArgumentException(checkedEid, message); - } - if (isIndexAndSizeIllegal(index, size)) { - throw new EidIndexOutOfBoundsException(checkedEid, message); - } - return index; -}; - -/** - * Tries to execute code in given unsafe supplier code block, and if exception is thrown, it will gets rethrown as a - * {@link EidRuntimeException} with eid given as a argument. This is because this exception is threaded as a software bug! - *

- * Example: - *


- *
- * Document doc = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {
- *    {@literal @}Override
- *     public Document get() throws IOException {
- *          DocumentBuilder docBuilder = ...
- *          return docBuilder.parse(new InputSource(reader));
- *     }
- * }, new Eid("20150718:121521"));
- * 
- * - * @param return type - * @param supplier unsafe supplier code to be executed within a try-catch block - * @param eid unique developer identifier from date for ex.: "20150716:123200" - * @return A block of code return type, if exception is not thrown - * @throws EidRuntimeException if code block thrown any exception, which in that case is wrapped in EidRuntimeException - */ -EidPreconditions.tryToExecute = function(supplier, eid) { - var checkedEid = ensureEid(eid); - try { - return EidPreconditions.checkNotNullable(supplier, checkedEid).apply(); - } catch (throwable) { - throw new EidRuntimeException(checkedEid, throwable); - } -}; - -module.exports = EidPreconditions; -})(module); - -},{"./eid":3,"./exceptions":4}]},{},[1]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJndWxwL2J1aWxkL3RvcGxldmVsLmpzIiwibGliL2VpZC5qcyIsImxpYi9laWQvZWlkLmpzIiwibGliL2VpZC9leGNlcHRpb25zLmpzIiwibGliL2VpZC9wcmVjb25kaXRpb25zLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQ3BCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FDMUJBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU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V4Y2VwdGlvbiBpcyBub3QgdGhyb3duXG4gKiBAdGhyb3dzIEVpZFJ1bnRpbWVFeGNlcHRpb24gaWYgY29kZSBibG9jayB0aHJvd24gYW55IGV4Y2VwdGlvbiwgd2hpY2ggaW4gdGhhdCBjYXNlIGlzIHdyYXBwZWQgaW4gRWlkUnVudGltZUV4Y2VwdGlvblxuICovXG5FaWRQcmVjb25kaXRpb25zLnRyeVRvRXhlY3V0ZSA9IGZ1bmN0aW9uKHN1cHBsaWVyLCBlaWQpIHtcbiAgdmFyIGNoZWNrZWRFaWQgPSBlbnN1cmVFaWQoZWlkKTtcbiAgdHJ5IHtcbiAgICByZXR1cm4gRWlkUHJlY29uZGl0aW9ucy5jaGVja05vdE51bGxhYmxlKHN1cHBsaWVyLCBjaGVja2VkRWlkKS5hcHBseSgpO1xuICB9IGNhdGNoICh0aHJvd2FibGUpIHtcbiAgICB0aHJvdyBuZXcgRWlkUnVudGltZUV4Y2VwdGlvbihjaGVja2VkRWlkLCB0aHJvd2FibGUpO1xuICB9XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IEVpZFByZWNvbmRpdGlvbnM7XG59KShtb2R1bGUpO1xuIl19 diff --git a/dist/browser/toplevel/eid.min.js b/dist/browser/toplevel/eid.min.js deleted file mode 100644 index 2bcc27a..0000000 --- a/dist/browser/toplevel/eid.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function t(e,n,r){function o(u,c){if(!n[u]){if(!e[u]){var a="function"==typeof require&&require;if(!c&&a)return a(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var f=n[u]={exports:{}};e[u][0].call(f.exports,function(t){var n=e[u][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;uo;o++)r.push(o+"-test-id");var i=new e(t).format(r);for(var u in r)if(-1===i.indexOf(u))throw new TypeError("Given format contains to little format specifiers, expected "+n+' but given "'+t+'"')};n.setUniqIdGenerator=function(t){if(null===t||void 0===t)throw new TypeError("Unique ID generator can't be null, but given one");var e=l.uniqIdGenerator;return l.uniqIdGenerator=t,e},n.setFormat=function(t){d(t,s);var e=l.format;return l.format=t,e},n.setRefFormat=function(t){d(t,f);var e=l.refFormat;return l.refFormat=t,e},n.setMessageFormat=function(t){d(t,p);var e=l.messageFormat;return l.messageFormat=t,e},n.getMessageFormat=function(){return l.messageFormat},t.exports=n}(e)},{}],4:[function(t,e,n){!function(e){"use strict";function n(t,e){t=s(t),e=a(t,e);var r=Error.apply(this,[e]);return r.name=this.name="EidRuntimeException",this.message=r.message,this.eid=t,p(this,n),this}function r(t,e){var o=n.apply(this,[t,e]);return o.name=this.name="EidNullPointerException",p(this,r),this}function o(t,e){var r=n.apply(this,[t,e]);return r.name=this.name="EidIllegalArgumentException",p(this,o),this}function i(t,e){var r=n.apply(this,[t,e]);return r.name=this.name="EidIllegalStateException",p(this,i),this}function u(t,e){var r=n.apply(this,[t,e]);return r.name=this.name="EidIndexOutOfBoundsException",p(this,u),this}var c=t("./eid"),a=function(t,e){return void 0!==e?t+" "+e:t},s=function(t){if(void 0===t)throw new TypeError("You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined");return t instanceof c||(t=new c(t.toString())),t},f={modern:function(t,e){Error.captureStackTrace(t,e)},fixLegancyStackTrace:function(t,e){var n=t;return"string"!=typeof t&&(n=e),n.indexOf(e)<0&&(n=n.replace(/^(?:Error\n)?/,e+"\n").trim()),n},legancy:function(t,e,n){var r=t.toString(),o=(new n).stack;t.stack=f.fixLegancyStackTrace(o,r)}};f.fixLegancyStackTrace("Error\n"),f.legancy({},null,Object);var p=function(t,e){var n="function"==typeof Error.captureStackTrace?f.modern:f.legancy;n(t,e,Error)};n.prototype=Object.create(Error.prototype,{constructor:{value:n}}),r.prototype=Object.create(n.prototype,{constructor:{value:r}}),o.prototype=Object.create(n.prototype,{constructor:{value:o}}),i.prototype=Object.create(n.prototype,{constructor:{value:i}}),u.prototype=Object.create(n.prototype,{constructor:{value:u}}),e.EidRuntimeException=n,e.EidNullPointerException=r,e.EidIllegalArgumentException=o,e.EidIllegalStateException=i,e.EidIndexOutOfBoundsException=u}(n)},{"./eid":3}],5:[function(t,e,n){!function(e){"use strict";function n(){}function r(t){return null===t||void 0===t}function o(t){if(r(t))throw new TypeError("Pass not-null Eid to EidPreconditions first!");return t}function i(t){t=o(t);var e;return e=t instanceof a?t:new a(t+"")}function u(t,e){return 0>t||t>e}function c(t){return 0>t}var a=t("./eid"),s=t("./exceptions").EidRuntimeException,f=t("./exceptions").EidNullPointerException,p=t("./exceptions").EidIllegalArgumentException,l=t("./exceptions").EidIllegalStateException,d=t("./exceptions").EidIndexOutOfBoundsException;n.checkNotNullable=function(t,e,n){var o=i(e);if(r(t))throw new f(o,n);return t},n.checkNotNull=function(t,e,n){var r=i(e);if(null===t)throw new f(r,n);return t},n.checkNotUndefined=function(t,e,n){var r=i(e);if(void 0===t)throw new f(r,n);return t},n.checkArgument=function(t,e,r){var o=i(e);if(!n.checkNotNullable(t,o))throw new p(o,r)},n.checkState=function(t,e,r){var o=i(e);if(!n.checkNotNullable(t,o))throw new l(o,r)},n.checkElementIndex=function(t,e,n,r){var o=i(n);if(c(e))throw new p(o,r);if(u(t,e))throw new d(o,r);return t},n.tryToExecute=function(t,e){var r=i(e);try{return n.checkNotNullable(t,r).apply()}catch(o){throw new s(r,o)}},e.exports=n}(e)},{"./eid":3,"./exceptions":4}]},{},[1]); -//# sourceMappingURL=eid.min.js.map diff --git a/dist/browser/toplevel/eid.min.js.map b/dist/browser/toplevel/eid.min.js.map deleted file mode 100644 index 865ec26..0000000 --- a/dist/browser/toplevel/eid.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["node_modules/browser-pack/_prelude.js","gulp/build/toplevel.js","eid.min.js","lib/eid.js","lib/eid/eid.js","lib/eid/exceptions.js","lib/eid/preconditions.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","wnd","Eid","window","../../lib/eid",2,"preconditions","exceptions","./eid/eid","./eid/exceptions","./eid/preconditions",3,"JFormatter","format","this","arr","args","arguments","push","regex","_r","p","c","replace","reduce","id","ref","uniq","EidInternal","uniqIdGenerator","generateUniqId","undefined","makeLogMessage","logMessageFormat","parameters","message","getMessageFormat","toString","refFormat","getId","getRef","getUniq","MathRandom","LONG_MAX","Math","pow","LONG_MIN","nextLong","nextNumber","nextInt","max","min","floor","random","StdUniqIdGenerator","BASE36","INTEGER_MAX_VALUE","MIN_6_CHAR_HASH","generator","padding","first","abs","second","calc","hash","String","slice","DEFAULT_FORMAT","DEFAULT_REF_FORMAT","DEFAULT_MESSAGE_FORMAT","DEFAULT_UNIQ_ID_GENERATOR","Object","defineProperty","get","FORMAT_NUM_SPEC","REF_FORMAT_NUM_SPEC","MESSAGE_FORMAT_NUM_SPEC","messageFormat","validateFormat","numSpecifiers","TypeError","specifiers","formatted","specifier","indexOf","setUniqIdGenerator","previous","setFormat","previously","setRefFormat","setMessageFormat","oldFormat",4,"EidRuntimeException","eid","validateEid","prepareMessage","tmp","apply","name","correctStackTrace","EidNullPointerException","EidIllegalArgumentException","EidIllegalStateException","EidIndexOutOfBoundsException","CorrectStackTrace","modern","target","constructor","captureStackTrace","fixLegancyStackTrace","stack","stringified","st","trim","legancy","exceptionConstructor","handler","prototype","create","value","./eid",5,"EidPreconditions","isNullike","reference","checkNotNull","ensureEid","candidate","isIndexAndSizeIllegal","index","size","isSizeIllegal","checkNotNullable","checkedEid","checkNotUndefined","checkArgument","expression","checkState","checkElementIndex","tryToExecute","supplier","throwable","./exceptions"],"mappings":"CAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAA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A+B,EAAAnG,IAwBAwF,EAAAgB,kBAAA,SAAAT,EAAAC,EAAArC,EAAA3D,GACA,GAAAmG,GAAAP,EAAAjC,EACA,IAAAsC,EAAAD,GACA,KAAA,IAAA7B,GAAAgC,EAAAnG,EAEA,IAAA8F,EAAAC,EAAAC,GACA,KAAA,IAAA3B,GAAA8B,EAAAnG,EAEA,OAAA+F,IAyBAP,EAAAiB,aAAA,SAAAC,EAAA/C,GACA,GAAAwC,GAAAP,EAAAjC,EACA,KACA,MAAA6B,GAAAU,iBAAAQ,EAAAP,GAAApC,QACA,MAAA4C,GACA,KAAA,IAAAjD,GAAAyC,EAAAQ,KAIA9I,EAAAJ,QAAA+H,GACA3H,KJmgBGyH,QAAQ,EAAEsB,eAAe,SAAS","file":"eid.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;oThis class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * Exception identifier for all Eid Runtime Exceptions.\n * @constructor\n * @param {string} id - the exception id, must be unique developer inserted string, from date\n * @param {string} ref - an optional reference\n */\nfunction Eid(id, ref) {\n var uniq = EidInternal.uniqIdGenerator.generateUniqId();\n ref = (ref === null || ref == undefined) ? \"\" : ref;\n\n /**\n * Makes a log message from this EID object\n *

\n *

This method is for convenience of usage of EID in logging. You can use it like this:\n *

\n *

\n   * log.debug(new Eid(\"20151025:202129\").makeLogMessage(\"A request: %s\", request));\n   * 
\n * @param {string} logMessageFormat - a log message format as accepted by {@link String#format(String, Object...)}\n * @param {Object...} parameters - a parameters for logMessageFormat to by passed to {@link String#format(String, Object...)}\n * @return {string} a formatted message\n */\n this.makeLogMessage = function(logMessageFormat) {\n var parameters = [];\n for (var i = 1; i < arguments.length; i++) {\n parameters.push(arguments[i]);\n }\n var message = new JFormatter(logMessageFormat).format(parameters);\n return new JFormatter(Eid.getMessageFormat()).format(this.toString(), message);\n }\n\n /**\n * Standard to string method\n */\n this.toString = function() {\n if (\"\" === ref) {\n return new JFormatter(EidInternal.format).format(id, uniq);\n }\n return new JFormatter(EidInternal.refFormat).format(id, ref, uniq);\n }\n\n /**\n * Getter for constant Exception ID\n *\n * @return {string} ID of exception\n */\n this.getId = function() {\n return id;\n }\n\n /**\n * Get custom ref passed to Exception ID\n *\n * @return {string} ID of exception\n */\n this.getRef = function() {\n return ref;\n }\n\n /**\n * Gets unique generated string for this instance of Eid\n *\n * @return {string} a unique string\n */\n this.getUniq = function() {\n return uniq;\n }\n}\n\nfunction MathRandom() {\n var LONG_MAX = Math.pow(2, 53) - 1;\n var LONG_MIN = -1 * Math.pow(2, 53);\n this.nextLong = function() {\n return this.nextNumber(LONG_MIN, LONG_MAX);\n };\n this.nextInt = function(max) {\n return this.nextNumber(0, max);\n };\n this.nextNumber = function(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n };\n}\n\nfunction StdUniqIdGenerator() {\n var BASE36 = 36;\n var INTEGER_MAX_VALUE = Math.pow(2, 31);\n var MIN_6_CHAR_HASH = 60466177; // for '100001' in base64\n var generator = new MathRandom();\n var padding = generator.nextNumber(MIN_6_CHAR_HASH, INTEGER_MAX_VALUE).toString(BASE36);\n this.generateUniqId = function() {\n var first = Math.abs(generator.nextLong() + 1);\n var second = Math.abs(generator.nextInt(INTEGER_MAX_VALUE));\n var calc = first + second;\n var hash = (Math.abs(calc) % INTEGER_MAX_VALUE).toString(BASE36);\n return String(padding + hash).slice(-6); // pad output string to six chars using random padding\n };\n}\n\nvar DEFAULT_FORMAT = \"[%s]<%s>\";\nvar DEFAULT_REF_FORMAT = \"[%s|%s]<%s>\";\nvar DEFAULT_MESSAGE_FORMAT = \"%s => %s\";\nvar DEFAULT_UNIQ_ID_GENERATOR = new StdUniqIdGenerator();\n\nObject.defineProperty(Eid, \"DEFAULT_FORMAT\", {\n get: function() { return DEFAULT_FORMAT; }\n});\nObject.defineProperty(Eid, \"DEFAULT_MESSAGE_FORMAT\", {\n get: function() { return DEFAULT_MESSAGE_FORMAT; }\n});\nObject.defineProperty(Eid, \"DEFAULT_REF_FORMAT\", {\n get: function() { return DEFAULT_REF_FORMAT; }\n});\nObject.defineProperty(Eid, \"DEFAULT_UNIQ_ID_GENERATOR\", {\n get: function() { return DEFAULT_UNIQ_ID_GENERATOR; }\n});\n\nvar FORMAT_NUM_SPEC = 2;\nvar REF_FORMAT_NUM_SPEC = 3;\nvar MESSAGE_FORMAT_NUM_SPEC = 2;\n\nvar EidInternal = {\n messageFormat: DEFAULT_MESSAGE_FORMAT,\n uniqIdGenerator: DEFAULT_UNIQ_ID_GENERATOR,\n format: DEFAULT_FORMAT,\n refFormat: DEFAULT_REF_FORMAT\n};\n\nvar validateFormat = function(format, numSpecifiers) {\n if (format === null || format === undefined) {\n throw new TypeError(\"Format can't be null, but just received one\");\n }\n var specifiers = [];\n for (var i = 0; i < numSpecifiers; i++) {\n specifiers.push(i + \"-test-id\");\n }\n var formatted = new JFormatter(format).format(specifiers);\n for (var specifier in specifiers) {\n if (formatted.indexOf(specifier) === -1) {\n throw new TypeError(\"Given format contains to little format specifiers, \" +\n \"expected \" + numSpecifiers + \" but given \\\"\" + format + \"\\\"\");\n }\n }\n};\n\n/**\n * Sets the actual unique ID generator that will be used to generate IDs for all Eid objects. It will return previously used\n * generator.\n *\n * @param {UniqIdGenerator} uniqIdGenerator - new instance of unique ID generator\n * @return {UniqIdGenerator} a previously used unique ID generator\n * @throws {TypeError} if given generator was null\n */\nEid.setUniqIdGenerator = function(uniqIdGenerator) {\n if (uniqIdGenerator === null || uniqIdGenerator === undefined) {\n throw new TypeError(\"Unique ID generator can't be null, but given one\");\n }\n var previous = EidInternal.uniqIdGenerator;\n EidInternal.uniqIdGenerator = uniqIdGenerator;\n return previous;\n};\n\n/**\n * Sets the actual format that will be used in {@link #toString()} method. It will return previously used format.\n *\n * @param {string} format - a format compliant with {@link String#format(String, Object...)} with 2 object arguments\n * @return {string} a previously used format\n * @throws {TypeError} if given format hasn't got two format specifiers \"%s\", or if given format was\n * null\n */\nEid.setFormat = function(format) {\n validateFormat(format, FORMAT_NUM_SPEC);\n var previously = EidInternal.format;\n EidInternal.format = format;\n return previously;\n};\n\n/**\n * Sets the actual format that will be used in {@link #toString()} method\n *\n * @param {string} refFormat - a format compliant with {@link String#format(String, Object...)} with 3 object arguments\n * @return {string} a previously used format\n * @throws {TypeError} if given format hasn't got tree format specifiers \"%s\", or if given format was\n * null\n */\nEid.setRefFormat = function(refFormat) {\n validateFormat(refFormat, REF_FORMAT_NUM_SPEC);\n var previously = EidInternal.refFormat;\n EidInternal.refFormat = refFormat;\n return previously;\n};\n\n/**\n * Sets a format that will be used for all Eid exceptions when printing a detail message.\n *

\n * Format must be non-null and contain two format specifiers \"%s\"\n *\n * @param {string} format - a format that will be used, must be non-null and contain two format specifiers \"%s\"\n * @return {string} previously used format\n * @throws {TypeError} if given format hasn't got two format specifiers \"%s\", or if given format was\n * null\n */\nEid.setMessageFormat = function(format) {\n validateFormat(format, MESSAGE_FORMAT_NUM_SPEC);\n var oldFormat = EidInternal.messageFormat;\n EidInternal.messageFormat = format;\n return oldFormat;\n};\n\n/**\n * Gets actually set message format\n *\n * @return {string} actually setted message format\n */\nEid.getMessageFormat = function() {\n return EidInternal.messageFormat;\n};\n\nmodule.exports = Eid;\n\n})(module);\n\n},{}],4:[function(require,module,exports){\n/*\n * Copyright 2016 Wave Software\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(exports) {\n 'use strict';\n\n var Eid = require('./eid');\n\n var prepareMessage = function(eid, message) {\n return message !== undefined ? (eid + \" \" + message) : eid;\n };\n\n var validateEid = function(eid) {\n if (eid === undefined) {\n throw new TypeError('You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined');\n }\n if (!(eid instanceof Eid)) {\n eid = new Eid(eid.toString());\n }\n return eid;\n };\n\n var CorrectStackTrace = {\n modern: function(target, constructor) {\n Error.captureStackTrace(target, constructor);\n },\n fixLegancyStackTrace: function(stack, stringified) {\n var st = stack;\n if (typeof(stack) !== 'string') {\n // On IE the stack field is empty so setting to toString() :-/\n st = stringified;\n }\n // Hands down, if all fails, just replace Error with nice Eid string\n if (st.indexOf(stringified) < 0) {\n st = st.replace(/^(?:Error\\n)?/, stringified + \"\\n\").trim();\n }\n return st;\n },\n legancy: function(target, constructor, exceptionConstructor) {\n // Hacks for IE an Edge\n var stringified = target.toString();\n // try to fetch stacktrace from JS standard Error\n var st = (new exceptionConstructor()).stack;\n target.stack = CorrectStackTrace.fixLegancyStackTrace(st, stringified);\n }\n };\n CorrectStackTrace.fixLegancyStackTrace('Error\\n');\n CorrectStackTrace.legancy({}, null, Object);\n\n var correctStackTrace = function(target, constructor) {\n var handler = typeof(Error.captureStackTrace) === 'function' ?\n CorrectStackTrace.modern : CorrectStackTrace.legancy;\n handler(target, constructor, Error);\n };\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This exception class is baseline of all Eid runtime exception classes. It is designed to ease of use and provide strict ID for\n * given Exception usage. This approach speed up development of large application and helps support teams to by giving the both\n * static and random ID for each possible unpredicted bug.\n *

\n * This is best to use with tools and plugins like\n * EidGenerator for Netbeans IDE\n *

\n * For convenience use {@link eid.Preconditions}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @author Krzysztof SuszyƄski \n */\n function EidRuntimeException(eid, message) {\n eid = validateEid(eid);\n message = prepareMessage(eid, message);\n var tmp = Error.apply(this, [message]);\n tmp.name = this.name = 'EidRuntimeException';\n this.message = tmp.message;\n this.eid = eid;\n correctStackTrace(this, EidRuntimeException);\n\n return this;\n }\n EidRuntimeException.prototype = Object.create(Error.prototype, {\n constructor: { value: EidRuntimeException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This id Eid version of {@link NullPointerException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see NullPointerException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidNullPointerException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidNullPointerException';\n correctStackTrace(this, EidNullPointerException);\n return this;\n }\n EidNullPointerException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidNullPointerException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This is Eid version of {@link IllegalArgumentException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see IllegalArgumentException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidIllegalArgumentException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidIllegalArgumentException';\n correctStackTrace(this, EidIllegalArgumentException);\n return this;\n }\n EidIllegalArgumentException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidIllegalArgumentException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This id Eid version of {@link IllegalStateException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see IllegalStateException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidIllegalStateException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidIllegalStateException';\n correctStackTrace(this, EidIllegalStateException);\n return this;\n }\n EidIllegalStateException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidIllegalStateException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This id Eid version of {@link IndexOutOfBoundsException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see IndexOutOfBoundsException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidIndexOutOfBoundsException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidIndexOutOfBoundsException';\n correctStackTrace(this, EidIndexOutOfBoundsException);\n return this;\n }\n EidIndexOutOfBoundsException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidIndexOutOfBoundsException }\n });\n\n exports.EidRuntimeException = EidRuntimeException;\n exports.EidNullPointerException = EidNullPointerException;\n exports.EidIllegalArgumentException = EidIllegalArgumentException;\n exports.EidIllegalStateException = EidIllegalStateException;\n exports.EidIndexOutOfBoundsException = EidIndexOutOfBoundsException;\n\n})(exports);\n\n},{\"./eid\":3}],5:[function(require,module,exports){\n/*\n * Copyright 2016 Wave Software\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(module) {\n'use strict';\n\nvar Eid = require('./eid');\nvar EidRuntimeException = require('./exceptions').EidRuntimeException;\nvar EidNullPointerException = require('./exceptions').EidNullPointerException;\nvar EidIllegalArgumentException = require('./exceptions').EidIllegalArgumentException;\nvar EidIllegalStateException = require('./exceptions').EidIllegalStateException;\nvar EidIndexOutOfBoundsException = require('./exceptions').EidIndexOutOfBoundsException;\n\n/**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * Static convenience methods that help a method or constructor check whether it was invoked correctly (whether its\n * preconditions\n * have been met). These methods generally accept a {@code boolean} expression which is expected to be {@code true} (or in the\n * case of {@code\n * checkNotNull}, an object reference which is expected to be non-null). When {@code false} (or {@code null}) is passed instead,\n * the {@code EidPreconditions} method throws an unchecked exception, which helps the calling method communicate to its\n * caller that\n * that caller has made a mistake.\n *

\n * Each method accepts a EID String or {@link Eid} object, which is designed to ease of use and provide strict ID for given\n * Exception usage. This approach speed up development of large application and helps support teams to by giving the both static\n * and random ID for each possible unpredicted bug.\n *

\n * This is best to use with tools and plugins like\n * EidGenerator for Netbeans IDE\n *

\n * Example:\n *

   {@code\n *\n *   /**\n *    * Returns the positive square root of the given value.\n *    *\n *    * @throws EidIllegalArgumentException if the value is negative\n *    *}{@code /\n *   public static double sqrt(double value) {\n *     EidPreconditions.checkArgument(value >= 0.0, \"20150718:012333\");\n *     // calculate the square root\n *   }\n *\n *   void exampleBadCaller() {\n *     double d = sqrt(-1.0);\n *   }\n * }
\n *

\n * In this example, {@code checkArgument} throws an {@code EidIllegalArgumentException} to indicate that {@code exampleBadCaller}\n * made an error in its call to {@code sqrt}. Exception, when it will be printed will contain user given Eid and also\n * Randomly generated ID. Those fields can be displayed to user on error page on posted directly to issue tracker.\n *

\n * Example:\n *

\n *

\n *\n * {@code\n *   // Main application class for ex.: http servlet\n *    try {\n *        performRequest(request, response);\n *    } catch (EidRuntimeException ex) {\n *        issuesTracker.put(ex);\n *        throw ex;\n *    }\n * }
\n *

\n *

\n *

Functional try to execute blocks

\n *

\n *

\n * Using functional blocks to handle operations, that are intended to operate properly, simplify the code and makes it more\n * readable. It's also good way to deal with untested, uncovered {@code catch} blocks. It's easy and gives developers nice way of\n * dealing with countless operations that suppose to work as intended.\n *

\n *

\n * Example:\n *

\n *\n *     InputStream is = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {\n *        {@literal @}Override\n *         public InputStream get() throws IOException {\n *             return this.getClass().getClassLoader()\n *                 .getResourceAsStream(\"project.properties\");\n *         }\n *     }, \"20150718:121521\");\n * 
\n *\n * @constructor\n * @author Krzysztof SuszyƄski \n * @since 0.1.0 (idea imported from Guava Library and COI code)\n */\nfunction EidPreconditions() {}\n\nfunction isNullike(reference) {\n return reference === null || reference === undefined;\n}\n\nfunction checkNotNull(reference) {\n if (isNullike(reference)) {\n throw new TypeError(\"Pass not-null Eid to EidPreconditions first!\");\n }\n return reference;\n}\n\nfunction ensureEid(candidate) {\n candidate = checkNotNull(candidate);\n var eid;\n if (!(candidate instanceof Eid)) {\n eid = new Eid(candidate + '');\n } else {\n eid = candidate;\n }\n return eid;\n}\n\n/**\n * Ensures that an object reference passed as a parameter to the calling method is not null-like.\n *\n * @param {Object} reference - an object reference\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - message for produced exception\n * @return {Object} the non-null reference that was validated\n * @throws {EidNullPointerException} if {@code reference} is null-like\n */\nEidPreconditions.checkNotNullable = function(reference, eid, message) {\n var checkedEid = ensureEid(eid);\n if (isNullike(reference)) {\n throw new EidNullPointerException(checkedEid, message);\n }\n return reference;\n};\n\n/**\n * Ensures that an object reference passed as a parameter to the calling method is not null.\n *\n * @param {Object} reference - an object reference\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - message for produced exception\n * @return {Object} the non-null reference that was validated\n * @throws {EidNullPointerException} if {@code reference} is null-like\n */\nEidPreconditions.checkNotNull = function(reference, eid, message) {\n var checkedEid = ensureEid(eid);\n if (reference === null) {\n throw new EidNullPointerException(checkedEid, message);\n }\n return reference;\n};\n\n/**\n * Ensures that an object reference passed as a parameter to the calling method is not undefined.\n *\n * @param {Object} reference - an object reference\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - message for produced exception\n * @return {Object} the non-null reference that was validated\n * @throws {EidNullPointerException} if {@code reference} is null-like\n */\nEidPreconditions.checkNotUndefined = function(reference, eid, message) {\n var checkedEid = ensureEid(eid);\n if (reference === undefined) {\n throw new EidNullPointerException(checkedEid, message);\n }\n return reference;\n};\n\n/**\n * Ensures the truth of an expression involving one or more parameters to the calling method.\n *\n * @param {boolean} expression - a boolean expression\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - optional message for generated exception\n * @throws {EidIllegalArgumentException} if {@code expression} is false\n * @throws {EidNullPointerException} if {@code expression} is null\n */\nEidPreconditions.checkArgument = function(expression, eid, message) {\n var checkedEid = ensureEid(eid);\n if (!EidPreconditions.checkNotNullable(expression, checkedEid)) {\n throw new EidIllegalArgumentException(checkedEid, message)\n }\n};\n\n/**\n * Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the\n * calling method.\n *\n * @param {boolean} expression - a boolean expression\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - optional message for generated exception\n * @throws {EidIllegalStateException} if {@code expression} is false\n * @throws {EidNullPointerException} if {@code expression} is null\n */\nEidPreconditions.checkState = function(expression, eid, message) {\n var checkedEid = ensureEid(eid);\n if (!EidPreconditions.checkNotNullable(expression, checkedEid)) {\n throw new EidIllegalStateException(checkedEid, message);\n }\n};\n\nfunction isIndexAndSizeIllegal(index, size) {\n return index < 0 || index > size;\n}\n\nfunction isSizeIllegal(size) {\n return size < 0;\n}\n\n/**\n * Ensures that {@code index} specifies a valid element in an array, list or string of size {@code size}. An element\n * index may range from zero, inclusive, to {@code size}, exclusive.\n *\n * @param {number} index - a user-supplied index identifying an element of an array, list or string\n * @param {numer} size - the size of that array, list or string\n * @param {string|Eid} eid - the text to use to describe this index in an error message\n * @param {string} message - optional message for generated exception\n * @return {number} the value of {@code index}\n * @throws {EidIndexOutOfBoundsException} if {@code index} is negative or is not less than {@code size}\n * @throws {EidIllegalArgumentException} if {@code size} is negative\n */\nEidPreconditions.checkElementIndex = function(index, size, eid, message) {\n var checkedEid = ensureEid(eid);\n if (isSizeIllegal(size)) {\n throw new EidIllegalArgumentException(checkedEid, message);\n }\n if (isIndexAndSizeIllegal(index, size)) {\n throw new EidIndexOutOfBoundsException(checkedEid, message);\n }\n return index;\n};\n\n/**\n * Tries to execute code in given unsafe supplier code block, and if exception is thrown, it will gets rethrown as a\n * {@link EidRuntimeException} with eid given as a argument. This is because this exception is threaded as a software bug!\n *

\n * Example:\n *

\n *\n * Document doc = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {\n *    {@literal @}Override\n *     public Document get() throws IOException {\n *          DocumentBuilder docBuilder = ...\n *          return docBuilder.parse(new InputSource(reader));\n *     }\n * }, new Eid(\"20150718:121521\"));\n * 
\n *\n * @param return type\n * @param supplier unsafe supplier code to be executed within a try-catch block\n * @param eid unique developer identifier from date for ex.: \"20150716:123200\"\n * @return A block of code return type, if exception is not thrown\n * @throws EidRuntimeException if code block thrown any exception, which in that case is wrapped in EidRuntimeException\n */\nEidPreconditions.tryToExecute = function(supplier, eid) {\n var checkedEid = ensureEid(eid);\n try {\n return EidPreconditions.checkNotNullable(supplier, checkedEid).apply();\n } catch (throwable) {\n throw new EidRuntimeException(checkedEid, throwable);\n }\n};\n\nmodule.exports = EidPreconditions;\n})(module);\n\n},{\"./eid\":3,\"./exceptions\":4}]},{},[1])\n\n","/*\n * Copyright 2016 Wave Software\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(module) {\n'use strict';\n\nvar Eid = require('./eid/eid');\nEid.preconditions = require('./eid/preconditions');\nEid.exceptions = require('./eid/exceptions');\n\nmodule.exports = Eid;\n\n})(module);\n","/*\n * Copyright 2016 Wave Software\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(module) {\n'use strict';\n\nfunction JFormatter(format) {\n this.format = function(arr) {\n var args = [];\n if (arguments.length === 1 && typeof(arr) === 'object') {\n args = arr;\n } else {\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n }\n var regex = /%s/;\n var _r = function(p,c) { return p.replace(regex, c); }\n return args.reduce(_r, format);\n };\n}\n\n/**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * Exception identifier for all Eid Runtime Exceptions.\n * @constructor\n * @param {string} id - the exception id, must be unique developer inserted string, from date\n * @param {string} ref - an optional reference\n */\nfunction Eid(id, ref) {\n var uniq = EidInternal.uniqIdGenerator.generateUniqId();\n ref = (ref === null || ref == undefined) ? \"\" : ref;\n\n /**\n * Makes a log message from this EID object\n *

\n *

This method is for convenience of usage of EID in logging. You can use it like this:\n *

\n *

\n   * log.debug(new Eid(\"20151025:202129\").makeLogMessage(\"A request: %s\", request));\n   * 
\n * @param {string} logMessageFormat - a log message format as accepted by {@link String#format(String, Object...)}\n * @param {Object...} parameters - a parameters for logMessageFormat to by passed to {@link String#format(String, Object...)}\n * @return {string} a formatted message\n */\n this.makeLogMessage = function(logMessageFormat) {\n var parameters = [];\n for (var i = 1; i < arguments.length; i++) {\n parameters.push(arguments[i]);\n }\n var message = new JFormatter(logMessageFormat).format(parameters);\n return new JFormatter(Eid.getMessageFormat()).format(this.toString(), message);\n }\n\n /**\n * Standard to string method\n */\n this.toString = function() {\n if (\"\" === ref) {\n return new JFormatter(EidInternal.format).format(id, uniq);\n }\n return new JFormatter(EidInternal.refFormat).format(id, ref, uniq);\n }\n\n /**\n * Getter for constant Exception ID\n *\n * @return {string} ID of exception\n */\n this.getId = function() {\n return id;\n }\n\n /**\n * Get custom ref passed to Exception ID\n *\n * @return {string} ID of exception\n */\n this.getRef = function() {\n return ref;\n }\n\n /**\n * Gets unique generated string for this instance of Eid\n *\n * @return {string} a unique string\n */\n this.getUniq = function() {\n return uniq;\n }\n}\n\nfunction MathRandom() {\n var LONG_MAX = Math.pow(2, 53) - 1;\n var LONG_MIN = -1 * Math.pow(2, 53);\n this.nextLong = function() {\n return this.nextNumber(LONG_MIN, LONG_MAX);\n };\n this.nextInt = function(max) {\n return this.nextNumber(0, max);\n };\n this.nextNumber = function(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n };\n}\n\nfunction StdUniqIdGenerator() {\n var BASE36 = 36;\n var INTEGER_MAX_VALUE = Math.pow(2, 31);\n var MIN_6_CHAR_HASH = 60466177; // for '100001' in base64\n var generator = new MathRandom();\n var padding = generator.nextNumber(MIN_6_CHAR_HASH, INTEGER_MAX_VALUE).toString(BASE36);\n this.generateUniqId = function() {\n var first = Math.abs(generator.nextLong() + 1);\n var second = Math.abs(generator.nextInt(INTEGER_MAX_VALUE));\n var calc = first + second;\n var hash = (Math.abs(calc) % INTEGER_MAX_VALUE).toString(BASE36);\n return String(padding + hash).slice(-6); // pad output string to six chars using random padding\n };\n}\n\nvar DEFAULT_FORMAT = \"[%s]<%s>\";\nvar DEFAULT_REF_FORMAT = \"[%s|%s]<%s>\";\nvar DEFAULT_MESSAGE_FORMAT = \"%s => %s\";\nvar DEFAULT_UNIQ_ID_GENERATOR = new StdUniqIdGenerator();\n\nObject.defineProperty(Eid, \"DEFAULT_FORMAT\", {\n get: function() { return DEFAULT_FORMAT; }\n});\nObject.defineProperty(Eid, \"DEFAULT_MESSAGE_FORMAT\", {\n get: function() { return DEFAULT_MESSAGE_FORMAT; }\n});\nObject.defineProperty(Eid, \"DEFAULT_REF_FORMAT\", {\n get: function() { return DEFAULT_REF_FORMAT; }\n});\nObject.defineProperty(Eid, \"DEFAULT_UNIQ_ID_GENERATOR\", {\n get: function() { return DEFAULT_UNIQ_ID_GENERATOR; }\n});\n\nvar FORMAT_NUM_SPEC = 2;\nvar REF_FORMAT_NUM_SPEC = 3;\nvar MESSAGE_FORMAT_NUM_SPEC = 2;\n\nvar EidInternal = {\n messageFormat: DEFAULT_MESSAGE_FORMAT,\n uniqIdGenerator: DEFAULT_UNIQ_ID_GENERATOR,\n format: DEFAULT_FORMAT,\n refFormat: DEFAULT_REF_FORMAT\n};\n\nvar validateFormat = function(format, numSpecifiers) {\n if (format === null || format === undefined) {\n throw new TypeError(\"Format can't be null, but just received one\");\n }\n var specifiers = [];\n for (var i = 0; i < numSpecifiers; i++) {\n specifiers.push(i + \"-test-id\");\n }\n var formatted = new JFormatter(format).format(specifiers);\n for (var specifier in specifiers) {\n if (formatted.indexOf(specifier) === -1) {\n throw new TypeError(\"Given format contains to little format specifiers, \" +\n \"expected \" + numSpecifiers + \" but given \\\"\" + format + \"\\\"\");\n }\n }\n};\n\n/**\n * Sets the actual unique ID generator that will be used to generate IDs for all Eid objects. It will return previously used\n * generator.\n *\n * @param {UniqIdGenerator} uniqIdGenerator - new instance of unique ID generator\n * @return {UniqIdGenerator} a previously used unique ID generator\n * @throws {TypeError} if given generator was null\n */\nEid.setUniqIdGenerator = function(uniqIdGenerator) {\n if (uniqIdGenerator === null || uniqIdGenerator === undefined) {\n throw new TypeError(\"Unique ID generator can't be null, but given one\");\n }\n var previous = EidInternal.uniqIdGenerator;\n EidInternal.uniqIdGenerator = uniqIdGenerator;\n return previous;\n};\n\n/**\n * Sets the actual format that will be used in {@link #toString()} method. It will return previously used format.\n *\n * @param {string} format - a format compliant with {@link String#format(String, Object...)} with 2 object arguments\n * @return {string} a previously used format\n * @throws {TypeError} if given format hasn't got two format specifiers \"%s\", or if given format was\n * null\n */\nEid.setFormat = function(format) {\n validateFormat(format, FORMAT_NUM_SPEC);\n var previously = EidInternal.format;\n EidInternal.format = format;\n return previously;\n};\n\n/**\n * Sets the actual format that will be used in {@link #toString()} method\n *\n * @param {string} refFormat - a format compliant with {@link String#format(String, Object...)} with 3 object arguments\n * @return {string} a previously used format\n * @throws {TypeError} if given format hasn't got tree format specifiers \"%s\", or if given format was\n * null\n */\nEid.setRefFormat = function(refFormat) {\n validateFormat(refFormat, REF_FORMAT_NUM_SPEC);\n var previously = EidInternal.refFormat;\n EidInternal.refFormat = refFormat;\n return previously;\n};\n\n/**\n * Sets a format that will be used for all Eid exceptions when printing a detail message.\n *

\n * Format must be non-null and contain two format specifiers \"%s\"\n *\n * @param {string} format - a format that will be used, must be non-null and contain two format specifiers \"%s\"\n * @return {string} previously used format\n * @throws {TypeError} if given format hasn't got two format specifiers \"%s\", or if given format was\n * null\n */\nEid.setMessageFormat = function(format) {\n validateFormat(format, MESSAGE_FORMAT_NUM_SPEC);\n var oldFormat = EidInternal.messageFormat;\n EidInternal.messageFormat = format;\n return oldFormat;\n};\n\n/**\n * Gets actually set message format\n *\n * @return {string} actually setted message format\n */\nEid.getMessageFormat = function() {\n return EidInternal.messageFormat;\n};\n\nmodule.exports = Eid;\n\n})(module);\n","/*\n * Copyright 2016 Wave Software\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(exports) {\n 'use strict';\n\n var Eid = require('./eid');\n\n var prepareMessage = function(eid, message) {\n return message !== undefined ? (eid + \" \" + message) : eid;\n };\n\n var validateEid = function(eid) {\n if (eid === undefined) {\n throw new TypeError('You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined');\n }\n if (!(eid instanceof Eid)) {\n eid = new Eid(eid.toString());\n }\n return eid;\n };\n\n var CorrectStackTrace = {\n modern: function(target, constructor) {\n Error.captureStackTrace(target, constructor);\n },\n fixLegancyStackTrace: function(stack, stringified) {\n var st = stack;\n if (typeof(stack) !== 'string') {\n // On IE the stack field is empty so setting to toString() :-/\n st = stringified;\n }\n // Hands down, if all fails, just replace Error with nice Eid string\n if (st.indexOf(stringified) < 0) {\n st = st.replace(/^(?:Error\\n)?/, stringified + \"\\n\").trim();\n }\n return st;\n },\n legancy: function(target, constructor, exceptionConstructor) {\n // Hacks for IE an Edge\n var stringified = target.toString();\n // try to fetch stacktrace from JS standard Error\n var st = (new exceptionConstructor()).stack;\n target.stack = CorrectStackTrace.fixLegancyStackTrace(st, stringified);\n }\n };\n CorrectStackTrace.fixLegancyStackTrace('Error\\n');\n CorrectStackTrace.legancy({}, null, Object);\n\n var correctStackTrace = function(target, constructor) {\n var handler = typeof(Error.captureStackTrace) === 'function' ?\n CorrectStackTrace.modern : CorrectStackTrace.legancy;\n handler(target, constructor, Error);\n };\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This exception class is baseline of all Eid runtime exception classes. It is designed to ease of use and provide strict ID for\n * given Exception usage. This approach speed up development of large application and helps support teams to by giving the both\n * static and random ID for each possible unpredicted bug.\n *

\n * This is best to use with tools and plugins like\n * EidGenerator for Netbeans IDE\n *

\n * For convenience use {@link eid.Preconditions}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @author Krzysztof SuszyƄski \n */\n function EidRuntimeException(eid, message) {\n eid = validateEid(eid);\n message = prepareMessage(eid, message);\n var tmp = Error.apply(this, [message]);\n tmp.name = this.name = 'EidRuntimeException';\n this.message = tmp.message;\n this.eid = eid;\n correctStackTrace(this, EidRuntimeException);\n\n return this;\n }\n EidRuntimeException.prototype = Object.create(Error.prototype, {\n constructor: { value: EidRuntimeException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This id Eid version of {@link NullPointerException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see NullPointerException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidNullPointerException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidNullPointerException';\n correctStackTrace(this, EidNullPointerException);\n return this;\n }\n EidNullPointerException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidNullPointerException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This is Eid version of {@link IllegalArgumentException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see IllegalArgumentException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidIllegalArgumentException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidIllegalArgumentException';\n correctStackTrace(this, EidIllegalArgumentException);\n return this;\n }\n EidIllegalArgumentException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidIllegalArgumentException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This id Eid version of {@link IllegalStateException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see IllegalStateException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidIllegalStateException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidIllegalStateException';\n correctStackTrace(this, EidIllegalStateException);\n return this;\n }\n EidIllegalStateException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidIllegalStateException }\n });\n\n /**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * This id Eid version of {@link IndexOutOfBoundsException}\n *\n * @constructor\n * @param {string} eid - an exception Id, should be generated\n * @param {string} message - an message for the exception\n * @see IndexOutOfBoundsException\n * @see EidRuntimeException\n * @author Krzysztof SuszyƄski \n */\n function EidIndexOutOfBoundsException(eid, message) {\n var tmp = EidRuntimeException.apply(this, [eid, message]);\n tmp.name = this.name = 'EidIndexOutOfBoundsException';\n correctStackTrace(this, EidIndexOutOfBoundsException);\n return this;\n }\n EidIndexOutOfBoundsException.prototype = Object.create(EidRuntimeException.prototype, {\n constructor: { value: EidIndexOutOfBoundsException }\n });\n\n exports.EidRuntimeException = EidRuntimeException;\n exports.EidNullPointerException = EidNullPointerException;\n exports.EidIllegalArgumentException = EidIllegalArgumentException;\n exports.EidIllegalStateException = EidIllegalStateException;\n exports.EidIndexOutOfBoundsException = EidIndexOutOfBoundsException;\n\n})(exports);\n","/*\n * Copyright 2016 Wave Software\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(module) {\n'use strict';\n\nvar Eid = require('./eid');\nvar EidRuntimeException = require('./exceptions').EidRuntimeException;\nvar EidNullPointerException = require('./exceptions').EidNullPointerException;\nvar EidIllegalArgumentException = require('./exceptions').EidIllegalArgumentException;\nvar EidIllegalStateException = require('./exceptions').EidIllegalStateException;\nvar EidIndexOutOfBoundsException = require('./exceptions').EidIndexOutOfBoundsException;\n\n/**\n * This class shouldn't be used in any public API or library. It is designed to be used for in-house development\n * of end user applications which will report Bugs in standardized error pages or post them to issue tracker.\n *

\n * Static convenience methods that help a method or constructor check whether it was invoked correctly (whether its\n * preconditions\n * have been met). These methods generally accept a {@code boolean} expression which is expected to be {@code true} (or in the\n * case of {@code\n * checkNotNull}, an object reference which is expected to be non-null). When {@code false} (or {@code null}) is passed instead,\n * the {@code EidPreconditions} method throws an unchecked exception, which helps the calling method communicate to its\n * caller that\n * that caller has made a mistake.\n *

\n * Each method accepts a EID String or {@link Eid} object, which is designed to ease of use and provide strict ID for given\n * Exception usage. This approach speed up development of large application and helps support teams to by giving the both static\n * and random ID for each possible unpredicted bug.\n *

\n * This is best to use with tools and plugins like\n * EidGenerator for Netbeans IDE\n *

\n * Example:\n *

   {@code\n *\n *   /**\n *    * Returns the positive square root of the given value.\n *    *\n *    * @throws EidIllegalArgumentException if the value is negative\n *    *}{@code /\n *   public static double sqrt(double value) {\n *     EidPreconditions.checkArgument(value >= 0.0, \"20150718:012333\");\n *     // calculate the square root\n *   }\n *\n *   void exampleBadCaller() {\n *     double d = sqrt(-1.0);\n *   }\n * }
\n *

\n * In this example, {@code checkArgument} throws an {@code EidIllegalArgumentException} to indicate that {@code exampleBadCaller}\n * made an error in its call to {@code sqrt}. Exception, when it will be printed will contain user given Eid and also\n * Randomly generated ID. Those fields can be displayed to user on error page on posted directly to issue tracker.\n *

\n * Example:\n *

\n *

\n *\n * {@code\n *   // Main application class for ex.: http servlet\n *    try {\n *        performRequest(request, response);\n *    } catch (EidRuntimeException ex) {\n *        issuesTracker.put(ex);\n *        throw ex;\n *    }\n * }
\n *

\n *

\n *

Functional try to execute blocks

\n *

\n *

\n * Using functional blocks to handle operations, that are intended to operate properly, simplify the code and makes it more\n * readable. It's also good way to deal with untested, uncovered {@code catch} blocks. It's easy and gives developers nice way of\n * dealing with countless operations that suppose to work as intended.\n *

\n *

\n * Example:\n *

\n *\n *     InputStream is = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {\n *        {@literal @}Override\n *         public InputStream get() throws IOException {\n *             return this.getClass().getClassLoader()\n *                 .getResourceAsStream(\"project.properties\");\n *         }\n *     }, \"20150718:121521\");\n * 
\n *\n * @constructor\n * @author Krzysztof SuszyƄski \n * @since 0.1.0 (idea imported from Guava Library and COI code)\n */\nfunction EidPreconditions() {}\n\nfunction isNullike(reference) {\n return reference === null || reference === undefined;\n}\n\nfunction checkNotNull(reference) {\n if (isNullike(reference)) {\n throw new TypeError(\"Pass not-null Eid to EidPreconditions first!\");\n }\n return reference;\n}\n\nfunction ensureEid(candidate) {\n candidate = checkNotNull(candidate);\n var eid;\n if (!(candidate instanceof Eid)) {\n eid = new Eid(candidate + '');\n } else {\n eid = candidate;\n }\n return eid;\n}\n\n/**\n * Ensures that an object reference passed as a parameter to the calling method is not null-like.\n *\n * @param {Object} reference - an object reference\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - message for produced exception\n * @return {Object} the non-null reference that was validated\n * @throws {EidNullPointerException} if {@code reference} is null-like\n */\nEidPreconditions.checkNotNullable = function(reference, eid, message) {\n var checkedEid = ensureEid(eid);\n if (isNullike(reference)) {\n throw new EidNullPointerException(checkedEid, message);\n }\n return reference;\n};\n\n/**\n * Ensures that an object reference passed as a parameter to the calling method is not null.\n *\n * @param {Object} reference - an object reference\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - message for produced exception\n * @return {Object} the non-null reference that was validated\n * @throws {EidNullPointerException} if {@code reference} is null-like\n */\nEidPreconditions.checkNotNull = function(reference, eid, message) {\n var checkedEid = ensureEid(eid);\n if (reference === null) {\n throw new EidNullPointerException(checkedEid, message);\n }\n return reference;\n};\n\n/**\n * Ensures that an object reference passed as a parameter to the calling method is not undefined.\n *\n * @param {Object} reference - an object reference\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - message for produced exception\n * @return {Object} the non-null reference that was validated\n * @throws {EidNullPointerException} if {@code reference} is null-like\n */\nEidPreconditions.checkNotUndefined = function(reference, eid, message) {\n var checkedEid = ensureEid(eid);\n if (reference === undefined) {\n throw new EidNullPointerException(checkedEid, message);\n }\n return reference;\n};\n\n/**\n * Ensures the truth of an expression involving one or more parameters to the calling method.\n *\n * @param {boolean} expression - a boolean expression\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - optional message for generated exception\n * @throws {EidIllegalArgumentException} if {@code expression} is false\n * @throws {EidNullPointerException} if {@code expression} is null\n */\nEidPreconditions.checkArgument = function(expression, eid, message) {\n var checkedEid = ensureEid(eid);\n if (!EidPreconditions.checkNotNullable(expression, checkedEid)) {\n throw new EidIllegalArgumentException(checkedEid, message)\n }\n};\n\n/**\n * Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the\n * calling method.\n *\n * @param {boolean} expression - a boolean expression\n * @param {string|Eid} eid - the exception ID to use if the check fails\n * @param {string} message - optional message for generated exception\n * @throws {EidIllegalStateException} if {@code expression} is false\n * @throws {EidNullPointerException} if {@code expression} is null\n */\nEidPreconditions.checkState = function(expression, eid, message) {\n var checkedEid = ensureEid(eid);\n if (!EidPreconditions.checkNotNullable(expression, checkedEid)) {\n throw new EidIllegalStateException(checkedEid, message);\n }\n};\n\nfunction isIndexAndSizeIllegal(index, size) {\n return index < 0 || index > size;\n}\n\nfunction isSizeIllegal(size) {\n return size < 0;\n}\n\n/**\n * Ensures that {@code index} specifies a valid element in an array, list or string of size {@code size}. An element\n * index may range from zero, inclusive, to {@code size}, exclusive.\n *\n * @param {number} index - a user-supplied index identifying an element of an array, list or string\n * @param {numer} size - the size of that array, list or string\n * @param {string|Eid} eid - the text to use to describe this index in an error message\n * @param {string} message - optional message for generated exception\n * @return {number} the value of {@code index}\n * @throws {EidIndexOutOfBoundsException} if {@code index} is negative or is not less than {@code size}\n * @throws {EidIllegalArgumentException} if {@code size} is negative\n */\nEidPreconditions.checkElementIndex = function(index, size, eid, message) {\n var checkedEid = ensureEid(eid);\n if (isSizeIllegal(size)) {\n throw new EidIllegalArgumentException(checkedEid, message);\n }\n if (isIndexAndSizeIllegal(index, size)) {\n throw new EidIndexOutOfBoundsException(checkedEid, message);\n }\n return index;\n};\n\n/**\n * Tries to execute code in given unsafe supplier code block, and if exception is thrown, it will gets rethrown as a\n * {@link EidRuntimeException} with eid given as a argument. This is because this exception is threaded as a software bug!\n *

\n * Example:\n *

\n *\n * Document doc = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {\n *    {@literal @}Override\n *     public Document get() throws IOException {\n *          DocumentBuilder docBuilder = ...\n *          return docBuilder.parse(new InputSource(reader));\n *     }\n * }, new Eid(\"20150718:121521\"));\n * 
\n *\n * @param return type\n * @param supplier unsafe supplier code to be executed within a try-catch block\n * @param eid unique developer identifier from date for ex.: \"20150716:123200\"\n * @return A block of code return type, if exception is not thrown\n * @throws EidRuntimeException if code block thrown any exception, which in that case is wrapped in EidRuntimeException\n */\nEidPreconditions.tryToExecute = function(supplier, eid) {\n var checkedEid = ensureEid(eid);\n try {\n return EidPreconditions.checkNotNullable(supplier, checkedEid).apply();\n } catch (throwable) {\n throw new EidRuntimeException(checkedEid, throwable);\n }\n};\n\nmodule.exports = EidPreconditions;\n})(module);\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/gulp/build.js b/gulp/build.js deleted file mode 100644 index 00ef952..0000000 --- a/gulp/build.js +++ /dev/null @@ -1,46 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var gulp = require('gulp'); -var browserify = require('browserify'); -var source = require('vinyl-source-stream'); -var buffer = require('vinyl-buffer'); -var uglify = require('gulp-uglify'); -var sourcemaps = require('gulp-sourcemaps'); -var gutil = require('gulp-util'); -var config = require('./config'); - -var toplevel = 'gulp/build/toplevel.js'; - -module.exports = { - browserify: function() { - // set up the browserify instance on a task basis - var b = browserify({ - entries: toplevel, - debug: true - }); - - return b.bundle() - .pipe(source('eid.js')) - .pipe(buffer()) - .on('error', gutil.log) - .pipe(gulp.dest(config.dist + '/browser/toplevel')); - }, - minified: function() { - // set up the browserify instance on a task basis - var b = browserify({ - entries: toplevel, - debug: true - }); - - return b.bundle() - .pipe(source('eid.min.js')) - .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) - // Add transformation tasks to the pipeline here. - .pipe(uglify()) - .on('error', gutil.log) - .pipe(sourcemaps.write('./')) - .pipe(gulp.dest(config.dist + '/browser/toplevel')); - } -}; diff --git a/gulp/build/toplevel.js b/gulp/build/toplevel.js deleted file mode 100644 index 2f7474b..0000000 --- a/gulp/build/toplevel.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(wnd) { - 'use strict'; - wnd.Eid = require('../../lib/eid'); -})(window); diff --git a/gulp/clean.js b/gulp/clean.js deleted file mode 100644 index a7cd7f9..0000000 --- a/gulp/clean.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var fs = require('fs'); -var config = require('./config'); - -var deleteFolderRecursive = function(path) { - var files = []; - if( fs.existsSync(path) ) { - files = fs.readdirSync(path); - files.forEach(function(file,index){ - var curPath = path + "/" + file; - if(fs.lstatSync(curPath).isDirectory()) { // recurse - deleteFolderRecursive(curPath); - } else { // delete file - fs.unlinkSync(curPath); - } - }); - fs.rmdirSync(path); - } -}; - -module.exports = function() { - deleteFolderRecursive(config.target); -}; diff --git a/gulp/config.js b/gulp/config.js deleted file mode 100644 index 1ed0e07..0000000 --- a/gulp/config.js +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var directory = { - lib: 'lib', - test: 'test', - target: 'target', - dist: 'dist' -}; - -module.exports = { - sources: [ directory.lib + '/**/*.js' ], - testSources: [ directory.test + '/**/*.js' ], - lib: directory.lib, - test: directory.test, - target: directory.target, - dist: directory.dist, - ceverageMin: 98 -}; diff --git a/gulp/serve.js b/gulp/serve.js deleted file mode 100644 index 4295446..0000000 --- a/gulp/serve.js +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var serve = require('gulp-serve'); -var config = require('./config'); - -module.exports = serve(config.dist + '/browser'); diff --git a/gulp/tests.js b/gulp/tests.js deleted file mode 100644 index 9ebdffb..0000000 --- a/gulp/tests.js +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var gulp = require('gulp'); -var eslint = require('gulp-eslint'); -var mocha = require('gulp-mocha'); -var cover = require('gulp-coverage'); -var coveralls = require('gulp-coveralls'); -var config = require('./config'); - -module.exports = { - lint: function () { - return gulp.src(config.sources) - .pipe(eslint({ - extends: 'eslint:recommended', - rules: { - strict: 2 - }, - env: { - node: true, - browser: true - } - })) - .pipe(eslint.format()) - .pipe(eslint.failAfterError()); - }, - specs: function (done) { - var prependToAll = function(path, globs) { - var ret = []; - for (var i = 0; i < globs.length; i++) { - var value = globs[i]; - ret.push(path + '/' + value); - } - return ret; - }; - var fs = require('fs'); - var target = config.target; - if (!fs.existsSync(target)) { - fs.mkdirSync(target); - } - var pwd = process.cwd(); - process.chdir(target); - var testSrc = prependToAll('..', config.testSources); - var src = prependToAll('..', config.sources); - var stream = gulp.src(testSrc, { read: false }) - .pipe(cover.instrument({ - pattern: src - })) - .pipe(mocha()) - .pipe(cover.gather()); - - if (process.env.TRAVIS == 'true') { - stream = stream.pipe(cover.format([ - { reporter: 'lcov' } - ])) - .pipe(coveralls()); - } else { - stream = stream.pipe(cover.format([ - { reporter: 'html' }, - { reporter: 'json' }, - { reporter: 'lcov' } - ])) - .pipe(gulp.dest('reports')); - } - return stream.pipe(cover.enforce({ - statements: config.ceverageMin, - blocks: config.ceverageMin, - lines: config.ceverageMin, - })) - .on('end', function() { - process.chdir(pwd); - }); - } -}; diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index beedc28..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable no-var, strict, prefer-arrow-callback */ -'use strict'; - -var gulp = require('gulp'); - -var tests = require('./gulp/tests'); -var build = require('./gulp/build'); -var clean = require('./gulp/clean'); -var serve = require('./gulp/serve'); - -gulp.task('clean', clean); -gulp.task('lint', tests.lint); -gulp.task('specs', ['lint'], tests.specs); -gulp.task('test', ['lint', 'specs']); -gulp.task('watch', function() { - gulp.watch(sources.concat(testSources), ['test']); -}); -gulp.task('build-browser', ['test'], build.browserify); -gulp.task('build-minified', ['test'], build.minified); -gulp.task('serve', serve); -gulp.task('build', ['build-browser', 'build-minified']); -gulp.task('default', ['test', 'build']); diff --git a/lib/eid.js b/lib/eid.js deleted file mode 100644 index eaad486..0000000 --- a/lib/eid.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(module) { -'use strict'; - -var Eid = require('./eid/eid'); -Eid.preconditions = require('./eid/preconditions'); -Eid.exceptions = require('./eid/exceptions'); - -module.exports = Eid; - -})(module); diff --git a/lib/eid/eid.js b/lib/eid/eid.js deleted file mode 100644 index c1f2f1e..0000000 --- a/lib/eid/eid.js +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(module) { -'use strict'; - -function JFormatter(format) { - this.format = function(arr) { - var args = []; - if (arguments.length === 1 && typeof(arr) === 'object') { - args = arr; - } else { - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - } - var regex = /%s/; - var _r = function(p,c) { return p.replace(regex, c); } - return args.reduce(_r, format); - }; -} - -/** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * Exception identifier for all Eid Runtime Exceptions. - * @constructor - * @param {string} id - the exception id, must be unique developer inserted string, from date - * @param {string} ref - an optional reference - */ -function Eid(id, ref) { - var uniq = EidInternal.uniqIdGenerator.generateUniqId(); - ref = (ref === null || ref == undefined) ? "" : ref; - - /** - * Makes a log message from this EID object - *

- *

This method is for convenience of usage of EID in logging. You can use it like this: - *

- *

-   * log.debug(new Eid("20151025:202129").makeLogMessage("A request: %s", request));
-   * 
- * @param {string} logMessageFormat - a log message format as accepted by {@link String#format(String, Object...)} - * @param {Object...} parameters - a parameters for logMessageFormat to by passed to {@link String#format(String, Object...)} - * @return {string} a formatted message - */ - this.makeLogMessage = function(logMessageFormat) { - var parameters = []; - for (var i = 1; i < arguments.length; i++) { - parameters.push(arguments[i]); - } - var message = new JFormatter(logMessageFormat).format(parameters); - return new JFormatter(Eid.getMessageFormat()).format(this.toString(), message); - } - - /** - * Standard to string method - */ - this.toString = function() { - if ("" === ref) { - return new JFormatter(EidInternal.format).format(id, uniq); - } - return new JFormatter(EidInternal.refFormat).format(id, ref, uniq); - } - - /** - * Getter for constant Exception ID - * - * @return {string} ID of exception - */ - this.getId = function() { - return id; - } - - /** - * Get custom ref passed to Exception ID - * - * @return {string} ID of exception - */ - this.getRef = function() { - return ref; - } - - /** - * Gets unique generated string for this instance of Eid - * - * @return {string} a unique string - */ - this.getUniq = function() { - return uniq; - } -} - -function MathRandom() { - var LONG_MAX = Math.pow(2, 53) - 1; - var LONG_MIN = -1 * Math.pow(2, 53); - this.nextLong = function() { - return this.nextNumber(LONG_MIN, LONG_MAX); - }; - this.nextInt = function(max) { - return this.nextNumber(0, max); - }; - this.nextNumber = function(min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; - }; -} - -function StdUniqIdGenerator() { - var BASE36 = 36; - var INTEGER_MAX_VALUE = Math.pow(2, 31); - var MIN_6_CHAR_HASH = 60466177; // for '100001' in base64 - var generator = new MathRandom(); - var padding = generator.nextNumber(MIN_6_CHAR_HASH, INTEGER_MAX_VALUE).toString(BASE36); - this.generateUniqId = function() { - var first = Math.abs(generator.nextLong() + 1); - var second = Math.abs(generator.nextInt(INTEGER_MAX_VALUE)); - var calc = first + second; - var hash = (Math.abs(calc) % INTEGER_MAX_VALUE).toString(BASE36); - return String(padding + hash).slice(-6); // pad output string to six chars using random padding - }; -} - -var DEFAULT_FORMAT = "[%s]<%s>"; -var DEFAULT_REF_FORMAT = "[%s|%s]<%s>"; -var DEFAULT_MESSAGE_FORMAT = "%s => %s"; -var DEFAULT_UNIQ_ID_GENERATOR = new StdUniqIdGenerator(); - -Object.defineProperty(Eid, "DEFAULT_FORMAT", { - get: function() { return DEFAULT_FORMAT; } -}); -Object.defineProperty(Eid, "DEFAULT_MESSAGE_FORMAT", { - get: function() { return DEFAULT_MESSAGE_FORMAT; } -}); -Object.defineProperty(Eid, "DEFAULT_REF_FORMAT", { - get: function() { return DEFAULT_REF_FORMAT; } -}); -Object.defineProperty(Eid, "DEFAULT_UNIQ_ID_GENERATOR", { - get: function() { return DEFAULT_UNIQ_ID_GENERATOR; } -}); - -var FORMAT_NUM_SPEC = 2; -var REF_FORMAT_NUM_SPEC = 3; -var MESSAGE_FORMAT_NUM_SPEC = 2; - -var EidInternal = { - messageFormat: DEFAULT_MESSAGE_FORMAT, - uniqIdGenerator: DEFAULT_UNIQ_ID_GENERATOR, - format: DEFAULT_FORMAT, - refFormat: DEFAULT_REF_FORMAT -}; - -var validateFormat = function(format, numSpecifiers) { - if (format === null || format === undefined) { - throw new TypeError("Format can't be null, but just received one"); - } - var specifiers = []; - for (var i = 0; i < numSpecifiers; i++) { - specifiers.push(i + "-test-id"); - } - var formatted = new JFormatter(format).format(specifiers); - for (var specifier in specifiers) { - if (formatted.indexOf(specifier) === -1) { - throw new TypeError("Given format contains to little format specifiers, " + - "expected " + numSpecifiers + " but given \"" + format + "\""); - } - } -}; - -/** - * Sets the actual unique ID generator that will be used to generate IDs for all Eid objects. It will return previously used - * generator. - * - * @param {UniqIdGenerator} uniqIdGenerator - new instance of unique ID generator - * @return {UniqIdGenerator} a previously used unique ID generator - * @throws {TypeError} if given generator was null - */ -Eid.setUniqIdGenerator = function(uniqIdGenerator) { - if (uniqIdGenerator === null || uniqIdGenerator === undefined) { - throw new TypeError("Unique ID generator can't be null, but given one"); - } - var previous = EidInternal.uniqIdGenerator; - EidInternal.uniqIdGenerator = uniqIdGenerator; - return previous; -}; - -/** - * Sets the actual format that will be used in {@link #toString()} method. It will return previously used format. - * - * @param {string} format - a format compliant with {@link String#format(String, Object...)} with 2 object arguments - * @return {string} a previously used format - * @throws {TypeError} if given format hasn't got two format specifiers "%s", or if given format was - * null - */ -Eid.setFormat = function(format) { - validateFormat(format, FORMAT_NUM_SPEC); - var previously = EidInternal.format; - EidInternal.format = format; - return previously; -}; - -/** - * Sets the actual format that will be used in {@link #toString()} method - * - * @param {string} refFormat - a format compliant with {@link String#format(String, Object...)} with 3 object arguments - * @return {string} a previously used format - * @throws {TypeError} if given format hasn't got tree format specifiers "%s", or if given format was - * null - */ -Eid.setRefFormat = function(refFormat) { - validateFormat(refFormat, REF_FORMAT_NUM_SPEC); - var previously = EidInternal.refFormat; - EidInternal.refFormat = refFormat; - return previously; -}; - -/** - * Sets a format that will be used for all Eid exceptions when printing a detail message. - *

- * Format must be non-null and contain two format specifiers "%s" - * - * @param {string} format - a format that will be used, must be non-null and contain two format specifiers "%s" - * @return {string} previously used format - * @throws {TypeError} if given format hasn't got two format specifiers "%s", or if given format was - * null - */ -Eid.setMessageFormat = function(format) { - validateFormat(format, MESSAGE_FORMAT_NUM_SPEC); - var oldFormat = EidInternal.messageFormat; - EidInternal.messageFormat = format; - return oldFormat; -}; - -/** - * Gets actually set message format - * - * @return {string} actually setted message format - */ -Eid.getMessageFormat = function() { - return EidInternal.messageFormat; -}; - -module.exports = Eid; - -})(module); diff --git a/lib/eid/exceptions.js b/lib/eid/exceptions.js deleted file mode 100644 index 71b917d..0000000 --- a/lib/eid/exceptions.js +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(exports) { - 'use strict'; - - var Eid = require('./eid'); - - var prepareMessage = function(eid, message) { - return message !== undefined ? (eid + " " + message) : eid; - }; - - var validateEid = function(eid) { - if (eid === undefined) { - throw new TypeError('You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined'); - } - if (!(eid instanceof Eid)) { - eid = new Eid(eid.toString()); - } - return eid; - }; - - var CorrectStackTrace = { - modern: function(target, constructor) { - Error.captureStackTrace(target, constructor); - }, - fixLegancyStackTrace: function(stack, stringified) { - var st = stack; - if (typeof(stack) !== 'string') { - // On IE the stack field is empty so setting to toString() :-/ - st = stringified; - } - // Hands down, if all fails, just replace Error with nice Eid string - if (st.indexOf(stringified) < 0) { - st = st.replace(/^(?:Error\n)?/, stringified + "\n").trim(); - } - return st; - }, - legancy: function(target, constructor, exceptionConstructor) { - // Hacks for IE an Edge - var stringified = target.toString(); - // try to fetch stacktrace from JS standard Error - var st = (new exceptionConstructor()).stack; - target.stack = CorrectStackTrace.fixLegancyStackTrace(st, stringified); - } - }; - CorrectStackTrace.fixLegancyStackTrace('Error\n'); - CorrectStackTrace.legancy({}, null, Object); - - var correctStackTrace = function(target, constructor) { - var handler = typeof(Error.captureStackTrace) === 'function' ? - CorrectStackTrace.modern : CorrectStackTrace.legancy; - handler(target, constructor, Error); - }; - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This exception class is baseline of all Eid runtime exception classes. It is designed to ease of use and provide strict ID for - * given Exception usage. This approach speed up development of large application and helps support teams to by giving the both - * static and random ID for each possible unpredicted bug. - *

- * This is best to use with tools and plugins like - * EidGenerator for Netbeans IDE - *

- * For convenience use {@link eid.Preconditions} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @author Krzysztof SuszyƄski - */ - function EidRuntimeException(eid, message) { - eid = validateEid(eid); - message = prepareMessage(eid, message); - var tmp = Error.apply(this, [message]); - tmp.name = this.name = 'EidRuntimeException'; - this.message = tmp.message; - this.eid = eid; - correctStackTrace(this, EidRuntimeException); - - return this; - } - EidRuntimeException.prototype = Object.create(Error.prototype, { - constructor: { value: EidRuntimeException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This id Eid version of {@link NullPointerException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see NullPointerException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidNullPointerException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidNullPointerException'; - correctStackTrace(this, EidNullPointerException); - return this; - } - EidNullPointerException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidNullPointerException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This is Eid version of {@link IllegalArgumentException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see IllegalArgumentException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidIllegalArgumentException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidIllegalArgumentException'; - correctStackTrace(this, EidIllegalArgumentException); - return this; - } - EidIllegalArgumentException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidIllegalArgumentException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This id Eid version of {@link IllegalStateException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see IllegalStateException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidIllegalStateException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidIllegalStateException'; - correctStackTrace(this, EidIllegalStateException); - return this; - } - EidIllegalStateException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidIllegalStateException } - }); - - /** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * This id Eid version of {@link IndexOutOfBoundsException} - * - * @constructor - * @param {string} eid - an exception Id, should be generated - * @param {string} message - an message for the exception - * @see IndexOutOfBoundsException - * @see EidRuntimeException - * @author Krzysztof SuszyƄski - */ - function EidIndexOutOfBoundsException(eid, message) { - var tmp = EidRuntimeException.apply(this, [eid, message]); - tmp.name = this.name = 'EidIndexOutOfBoundsException'; - correctStackTrace(this, EidIndexOutOfBoundsException); - return this; - } - EidIndexOutOfBoundsException.prototype = Object.create(EidRuntimeException.prototype, { - constructor: { value: EidIndexOutOfBoundsException } - }); - - exports.EidRuntimeException = EidRuntimeException; - exports.EidNullPointerException = EidNullPointerException; - exports.EidIllegalArgumentException = EidIllegalArgumentException; - exports.EidIllegalStateException = EidIllegalStateException; - exports.EidIndexOutOfBoundsException = EidIndexOutOfBoundsException; - -})(exports); diff --git a/lib/eid/preconditions.js b/lib/eid/preconditions.js deleted file mode 100644 index 5762f94..0000000 --- a/lib/eid/preconditions.js +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function(module) { -'use strict'; - -var Eid = require('./eid'); -var EidRuntimeException = require('./exceptions').EidRuntimeException; -var EidNullPointerException = require('./exceptions').EidNullPointerException; -var EidIllegalArgumentException = require('./exceptions').EidIllegalArgumentException; -var EidIllegalStateException = require('./exceptions').EidIllegalStateException; -var EidIndexOutOfBoundsException = require('./exceptions').EidIndexOutOfBoundsException; - -/** - * This class shouldn't be used in any public API or library. It is designed to be used for in-house development - * of end user applications which will report Bugs in standardized error pages or post them to issue tracker. - *

- * Static convenience methods that help a method or constructor check whether it was invoked correctly (whether its - * preconditions - * have been met). These methods generally accept a {@code boolean} expression which is expected to be {@code true} (or in the - * case of {@code - * checkNotNull}, an object reference which is expected to be non-null). When {@code false} (or {@code null}) is passed instead, - * the {@code EidPreconditions} method throws an unchecked exception, which helps the calling method communicate to its - * caller that - * that caller has made a mistake. - *

- * Each method accepts a EID String or {@link Eid} object, which is designed to ease of use and provide strict ID for given - * Exception usage. This approach speed up development of large application and helps support teams to by giving the both static - * and random ID for each possible unpredicted bug. - *

- * This is best to use with tools and plugins like - * EidGenerator for Netbeans IDE - *

- * Example: - *

   {@code
- *
- *   /**
- *    * Returns the positive square root of the given value.
- *    *
- *    * @throws EidIllegalArgumentException if the value is negative
- *    *}{@code /
- *   public static double sqrt(double value) {
- *     EidPreconditions.checkArgument(value >= 0.0, "20150718:012333");
- *     // calculate the square root
- *   }
- *
- *   void exampleBadCaller() {
- *     double d = sqrt(-1.0);
- *   }
- * }
- *

- * In this example, {@code checkArgument} throws an {@code EidIllegalArgumentException} to indicate that {@code exampleBadCaller} - * made an error in its call to {@code sqrt}. Exception, when it will be printed will contain user given Eid and also - * Randomly generated ID. Those fields can be displayed to user on error page on posted directly to issue tracker. - *

- * Example: - *

- *

- *
- * {@code
- *   // Main application class for ex.: http servlet
- *    try {
- *        performRequest(request, response);
- *    } catch (EidRuntimeException ex) {
- *        issuesTracker.put(ex);
- *        throw ex;
- *    }
- * }
- *

- *

- *

Functional try to execute blocks

- *

- *

- * Using functional blocks to handle operations, that are intended to operate properly, simplify the code and makes it more - * readable. It's also good way to deal with untested, uncovered {@code catch} blocks. It's easy and gives developers nice way of - * dealing with countless operations that suppose to work as intended. - *

- *

- * Example: - *


- *
- *     InputStream is = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {
- *        {@literal @}Override
- *         public InputStream get() throws IOException {
- *             return this.getClass().getClassLoader()
- *                 .getResourceAsStream("project.properties");
- *         }
- *     }, "20150718:121521");
- * 
- * - * @constructor - * @author Krzysztof SuszyƄski - * @since 0.1.0 (idea imported from Guava Library and COI code) - */ -function EidPreconditions() {} - -function isNullike(reference) { - return reference === null || reference === undefined; -} - -function checkNotNull(reference) { - if (isNullike(reference)) { - throw new TypeError("Pass not-null Eid to EidPreconditions first!"); - } - return reference; -} - -function ensureEid(candidate) { - candidate = checkNotNull(candidate); - var eid; - if (!(candidate instanceof Eid)) { - eid = new Eid(candidate + ''); - } else { - eid = candidate; - } - return eid; -} - -/** - * Ensures that an object reference passed as a parameter to the calling method is not null-like. - * - * @param {Object} reference - an object reference - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - message for produced exception - * @return {Object} the non-null reference that was validated - * @throws {EidNullPointerException} if {@code reference} is null-like - */ -EidPreconditions.checkNotNullable = function(reference, eid, message) { - var checkedEid = ensureEid(eid); - if (isNullike(reference)) { - throw new EidNullPointerException(checkedEid, message); - } - return reference; -}; - -/** - * Ensures that an object reference passed as a parameter to the calling method is not null. - * - * @param {Object} reference - an object reference - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - message for produced exception - * @return {Object} the non-null reference that was validated - * @throws {EidNullPointerException} if {@code reference} is null-like - */ -EidPreconditions.checkNotNull = function(reference, eid, message) { - var checkedEid = ensureEid(eid); - if (reference === null) { - throw new EidNullPointerException(checkedEid, message); - } - return reference; -}; - -/** - * Ensures that an object reference passed as a parameter to the calling method is not undefined. - * - * @param {Object} reference - an object reference - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - message for produced exception - * @return {Object} the non-null reference that was validated - * @throws {EidNullPointerException} if {@code reference} is null-like - */ -EidPreconditions.checkNotUndefined = function(reference, eid, message) { - var checkedEid = ensureEid(eid); - if (reference === undefined) { - throw new EidNullPointerException(checkedEid, message); - } - return reference; -}; - -/** - * Ensures the truth of an expression involving one or more parameters to the calling method. - * - * @param {boolean} expression - a boolean expression - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - optional message for generated exception - * @throws {EidIllegalArgumentException} if {@code expression} is false - * @throws {EidNullPointerException} if {@code expression} is null - */ -EidPreconditions.checkArgument = function(expression, eid, message) { - var checkedEid = ensureEid(eid); - if (!EidPreconditions.checkNotNullable(expression, checkedEid)) { - throw new EidIllegalArgumentException(checkedEid, message) - } -}; - -/** - * Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the - * calling method. - * - * @param {boolean} expression - a boolean expression - * @param {string|Eid} eid - the exception ID to use if the check fails - * @param {string} message - optional message for generated exception - * @throws {EidIllegalStateException} if {@code expression} is false - * @throws {EidNullPointerException} if {@code expression} is null - */ -EidPreconditions.checkState = function(expression, eid, message) { - var checkedEid = ensureEid(eid); - if (!EidPreconditions.checkNotNullable(expression, checkedEid)) { - throw new EidIllegalStateException(checkedEid, message); - } -}; - -function isIndexAndSizeIllegal(index, size) { - return index < 0 || index > size; -} - -function isSizeIllegal(size) { - return size < 0; -} - -/** - * Ensures that {@code index} specifies a valid element in an array, list or string of size {@code size}. An element - * index may range from zero, inclusive, to {@code size}, exclusive. - * - * @param {number} index - a user-supplied index identifying an element of an array, list or string - * @param {numer} size - the size of that array, list or string - * @param {string|Eid} eid - the text to use to describe this index in an error message - * @param {string} message - optional message for generated exception - * @return {number} the value of {@code index} - * @throws {EidIndexOutOfBoundsException} if {@code index} is negative or is not less than {@code size} - * @throws {EidIllegalArgumentException} if {@code size} is negative - */ -EidPreconditions.checkElementIndex = function(index, size, eid, message) { - var checkedEid = ensureEid(eid); - if (isSizeIllegal(size)) { - throw new EidIllegalArgumentException(checkedEid, message); - } - if (isIndexAndSizeIllegal(index, size)) { - throw new EidIndexOutOfBoundsException(checkedEid, message); - } - return index; -}; - -/** - * Tries to execute code in given unsafe supplier code block, and if exception is thrown, it will gets rethrown as a - * {@link EidRuntimeException} with eid given as a argument. This is because this exception is threaded as a software bug! - *

- * Example: - *


- *
- * Document doc = EidPreconditions.tryToExecute({@code new UnsafeSupplier}() {
- *    {@literal @}Override
- *     public Document get() throws IOException {
- *          DocumentBuilder docBuilder = ...
- *          return docBuilder.parse(new InputSource(reader));
- *     }
- * }, new Eid("20150718:121521"));
- * 
- * - * @param return type - * @param supplier unsafe supplier code to be executed within a try-catch block - * @param eid unique developer identifier from date for ex.: "20150716:123200" - * @return A block of code return type, if exception is not thrown - * @throws EidRuntimeException if code block thrown any exception, which in that case is wrapped in EidRuntimeException - */ -EidPreconditions.tryToExecute = function(supplier, eid) { - var checkedEid = ensureEid(eid); - try { - return EidPreconditions.checkNotNullable(supplier, checkedEid).apply(); - } catch (throwable) { - throw new EidRuntimeException(checkedEid, throwable); - } -}; - -module.exports = EidPreconditions; -})(module); diff --git a/test/eid.js b/test/eid.js deleted file mode 100644 index 93e6660..0000000 --- a/test/eid.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var Eid = require('../lib/eid'); -var expect = require('expect.js'); - -describe('Eid', function() { - describe('.setFormat()', function () { - afterEach(function() { - Eid.setFormat(Eid.DEFAULT_FORMAT); - }); - it('should set a valid new format and return last', function() { - var fmt = "{%s-%s}"; - var prev = Eid.setFormat(fmt); - expect(prev).to.eql(Eid.DEFAULT_FORMAT); - - prev = Eid.setFormat(fmt); - expect(prev).to.eql(fmt); - }); - it('should throw error on null', function() { - var fn = function() { - Eid.setFormat(null); - }; - expect(fn).to.throwError(TypeError, 'Format can\'t be null, but just received one'); - }); - it('should throw error on invalid format', function() { - var fn = function() { - Eid.setFormat("%s -->"); - }; - expect(fn).to.throwError(TypeError); - expect(fn).to.throwError(/Given format contains to little format specifiers, expected 2 but given "\%s \-\-\>"/); - }); - }); - - describe('.setRefFormat()', function() { - afterEach(function() { - Eid.setRefFormat(Eid.DEFAULT_REF_FORMAT); - }); - it('should set a valid new ref format and return last', function() { - var fmt = "%s:%s --> %s"; - var prev = Eid.setRefFormat(fmt); - expect(prev).to.eql(Eid.DEFAULT_REF_FORMAT); - }); - }); - - describe('.setMessageFormat()', function() { - afterEach(function() { - Eid.setMessageFormat(Eid.DEFAULT_MESSAGE_FORMAT); - }); - it('should set a valid new message format and return last', function() { - var fmt = "%s --> %s"; - var prev = Eid.setMessageFormat(fmt); - expect(prev).to.eql(Eid.DEFAULT_MESSAGE_FORMAT); - }); - }); - - describe('.getMessageFormat()', function() { - it('should return original actually set message format', function() { - var fmt = Eid.getMessageFormat(); - expect(fmt).to.eql(Eid.DEFAULT_MESSAGE_FORMAT); - }) - }); - - describe('.setUniqIdGenerator()', function() { - afterEach(function() { - Eid.setUniqIdGenerator(Eid.DEFAULT_UNIQ_ID_GENERATOR); - }); - it('should throw error if given null', function() { - var fn = function() { - Eid.setUniqIdGenerator(null); - } - expect(fn).to.throwException(TypeError); - expect(fn).to.throwException(/^Unique ID generator can't be null, but given one$/); - }); - it('should set properlly if given correct implementation', function() { - var gen = { - generateUniqId: function() { - return 5; // just like SONY here :-) - } - }; - var prev = Eid.setUniqIdGenerator(gen); - expect(prev).to.be(Eid.DEFAULT_UNIQ_ID_GENERATOR); - var eid = new Eid('20160110:221413'); - expect(eid.toString()).to.eql('[20160110:221413]<5>'); - }); - }); - - describe('.DEFAULT_MESSAGE_FORMAT', function() { - it('should be equal "%s => %s"', function() { - expect(Eid.DEFAULT_MESSAGE_FORMAT).to.eql("%s => %s"); - }); - }); - - describe('.DEFAULT_FORMAT', function() { - it('should be equal "[%s]<%s>"', function() { - expect(Eid.DEFAULT_FORMAT).to.eql("[%s]<%s>"); - }); - }); - - describe('.DEFAULT_REF_FORMAT', function() { - it('should be equal "[%s|%s]<%s>"', function() { - expect(Eid.DEFAULT_REF_FORMAT).to.eql("[%s|%s]<%s>"); - }); - }); - - describe('.DEFAULT_UNIQ_ID_GENERATOR', function() { - it('should be instance of UniqIdGenerator', function() { - expect(Eid.DEFAULT_UNIQ_ID_GENERATOR.generateUniqId()).to.match(/^[a-z0-9]{6}$/); - }); - }); - - describe('#toString()', function() { - describe('without ref number', function() { - var subject = new Eid('20160110:214452'); - it('should print object with eid and uniq id', function() { - expect(subject.toString()).to.match(/^\[20160110:214452]\<[a-z0-9]{6}\>$/); - }); - }); - describe('with ref number', function() { - var subject = new Eid('20160110:214944', 'ORA-1029'); - it('should print object with eid, ref and uniq id', function() { - expect(subject.toString()).to.match(/^\[20160110:214944\|ORA-1029\]\<[a-z0-9]{6}\>$/); - }); - }); - }); - - describe('#makeLogMessage()', function() { - var eid = new Eid('20160110:215138'); - var messageFormat = "My test object is: %s"; - var testObject = { 'a': 67 }; - testObject.toString = function() { - return JSON.stringify(this); - }; - it('should print log message as: [20160110:215138] => My test object is: {"a":67}', function() { - expect(eid.makeLogMessage(messageFormat, testObject)).to.match(/^\[20160110:215138\]\<[a-z0-9]{6}\> => My test object is: {"a":67}$/); - }); - }); - - describe('given a eid == new Eid("20160110:220223", "EX-556")', function() { - var eid = new Eid('20160110:220223', 'EX-556'); - describe('#getId()', function() { - it('should return 20160110:220223 as id', function() { - expect(eid.getId()).to.be('20160110:220223'); - }); - }); - describe('#getRef()', function() { - it('should return EX-556 as ref', function() { - expect(eid.getRef()).to.be('EX-556'); - }); - }); - describe('#getUniq()', function() { - it('should return xxxxxx as uniq id', function() { - expect(eid.getUniq()).to.match(/^[a-z0-9]{6}$/); - }); - }); - }); -}); diff --git a/test/eid/exceptions.js b/test/eid/exceptions.js deleted file mode 100644 index a66279b..0000000 --- a/test/eid/exceptions.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var expect = require('expect.js'); -var EidRuntimeException = require('../../lib/eid/exceptions').EidRuntimeException; -var EidNullPointerException = require('../../lib/eid/exceptions').EidNullPointerException; -var EidIllegalArgumentException = require('../../lib/eid/exceptions').EidIllegalArgumentException; -var EidIllegalStateException = require('../../lib/eid/exceptions').EidIllegalStateException; -var EidIndexOutOfBoundsException = require('../../lib/eid/exceptions').EidIndexOutOfBoundsException; - -describe('EidRuntimeException', function() { - var ex = new EidRuntimeException('20160110:230223', 'A null pointer occured!'); - it('should contain proper message', function() { - expect(ex.toString()).to.match(/EidRuntimeException: \[20160110:230223\]\<[a-z0-9]+\> A null pointer occured!/); - }); - it('should contain a stack trace', function() { - expect(ex.stack).to.not.empty(); - }); - it('should inherits Error', function() { - expect(ex instanceof Error).to.be.ok(); - }); - it('should not inherits TypeError or other types of Eid*Exception', function() { - expect(ex instanceof TypeError).not.to.be.ok(); - expect(ex instanceof EidIllegalStateException).not.to.be.ok(); - expect(ex instanceof EidIllegalArgumentException).not.to.be.ok(); - expect(ex instanceof EidIndexOutOfBoundsException).not.to.be.ok(); - expect(ex instanceof EidNullPointerException).not.to.be.ok(); - }); - describe('construction without passing eid object', function() { - it('should fail with TypeError', function() { - expect(function() { new EidRuntimeException() }).to.throwException(function(e) { - expect(e.message).to.eql('You need to provide an valid Eid number to EidRuntimeExceptions, but given undefined'); - expect(e).to.be.a(TypeError); - }); - }); - }); -}); - -describe('EidNullPointerException', function() { - var ex = new EidNullPointerException('20160110:223238', 'A null pointer occured!'); - it('should contain proper message', function() { - expect(ex.toString()).to.match(/EidNullPointerException: \[20160110:223238\]\<[a-z0-9]+\> A null pointer occured!/); - }); - it('should contain a stack trace', function() { - expect(ex.stack).to.not.empty(); - }); - it('should inherits Error and EidRuntimeException', function() { - expect(ex instanceof EidNullPointerException).to.be.ok(); - expect(ex instanceof Error).to.be.ok(); - expect(ex instanceof EidRuntimeException).to.be.ok(); - }); - it('should not inherits TypeError or other types of Eid*Exception', function() { - expect(ex instanceof TypeError).not.to.be.ok(); - expect(ex instanceof EidIllegalStateException).not.to.be.ok(); - expect(ex instanceof EidIllegalArgumentException).not.to.be.ok(); - expect(ex instanceof EidIndexOutOfBoundsException).not.to.be.ok(); - }); -}); - -describe('EidIllegalArgumentException', function() { - var ex = new EidIllegalArgumentException('20160110:230031', 'A null pointer occured!'); - it('should contain proper message', function() { - expect(ex.toString()).to.match(/EidIllegalArgumentException: \[20160110:230031\]\<[a-z0-9]+\> A null pointer occured!/); - }); - it('should contain a stack trace', function() { - expect(ex.stack).to.not.empty(); - }); - it('should inherits Error and EidRuntimeException', function() { - expect(ex instanceof Error).to.be.ok(); - expect(ex instanceof EidRuntimeException).to.be.ok(); - expect(ex instanceof EidIllegalArgumentException).to.be.ok(); - }); - it('should not inherits TypeError or other types of Eid*Exception', function() { - expect(ex instanceof TypeError).not.to.be.ok(); - expect(ex instanceof EidIllegalStateException).not.to.be.ok(); - expect(ex instanceof EidNullPointerException).not.to.be.ok(); - expect(ex instanceof EidIndexOutOfBoundsException).not.to.be.ok(); - }); -}); - -describe('EidIllegalStateException', function() { - var ex = new EidIllegalStateException('20160110:230112', 'Illegal state!'); - var regex = /EidIllegalStateException: \[20160110:230112\]\<[a-z0-9]+\> Illegal state!/; - it('should contain proper message', function() { - expect(ex.toString()).to.match(regex); - }); - it('should contain a stack trace', function() { - expect(ex.stack).to.not.empty(); - expect(ex.stack).to.match(regex); - }); - it('should inherits Error and EidRuntimeException', function() { - expect(ex instanceof Error).to.be.ok(); - expect(ex instanceof EidRuntimeException).to.be.ok(); - expect(ex instanceof EidIllegalStateException).to.be.ok(); - }); - it('should not inherits TypeError or other types of Eid*Exception', function() { - expect(ex instanceof TypeError).not.to.be.ok(); - expect(ex instanceof EidIllegalArgumentException).not.to.be.ok(); - expect(ex instanceof EidNullPointerException).not.to.be.ok(); - expect(ex instanceof EidIndexOutOfBoundsException).not.to.be.ok(); - }); -}); - -describe('EidIndexOutOfBoundsException', function() { - var ex = new EidIndexOutOfBoundsException('20160110:230140', 'Index is out of bounds!'); - var regex = /EidIndexOutOfBoundsException: \[20160110:230140\]\<[a-z0-9]+\> Index is out of bounds!/; - it('should contain proper message', function() { - expect(ex.toString()).to.match(regex); - }); - it('should contain a stack trace', function() { - expect(ex.stack).to.not.empty(); - expect(ex.stack).to.match(regex); - }); - it('should inherits Error and EidRuntimeException', function() { - expect(ex instanceof Error).to.be.ok(); - expect(ex instanceof EidRuntimeException).to.be.ok(); - expect(ex instanceof EidIndexOutOfBoundsException).to.be.ok(); - }); - it('should not inherits TypeError or other types of Eid*Exception', function() { - expect(ex instanceof TypeError).not.to.be.ok(); - expect(ex instanceof EidIllegalArgumentException).not.to.be.ok(); - expect(ex instanceof EidIllegalStateException).not.to.be.ok(); - expect(ex instanceof EidNullPointerException).not.to.be.ok(); - }); -}); diff --git a/test/eid/preconditions.js b/test/eid/preconditions.js deleted file mode 100644 index 08f5819..0000000 --- a/test/eid/preconditions.js +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2016 Wave Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var EidPreconditions = require('../../lib/eid/preconditions'); -var EidNullPointerException = require('../../lib/eid/exceptions').EidNullPointerException; -var EidIllegalArgumentException = require('../../lib/eid/exceptions').EidIllegalArgumentException; -var EidIllegalStateException = require('../../lib/eid/exceptions').EidIllegalStateException; -var EidIndexOutOfBoundsException = require('../../lib/eid/exceptions').EidIndexOutOfBoundsException; -var EidRuntimeException = require('../../lib/eid/exceptions').EidRuntimeException; -var Eid = require('../../lib/eid'); -var expect = require('expect.js'); - -describe('EidPreconditions', function() { - var eid = '20160111:004403'; - var eidRegex = /20160111:004403/; - - describe('.checkNotNullable()', function() { - describe('giving a null value', function() { - it('should throw EidNullPointerException', function() { - var fn = function() { - EidPreconditions.checkNotNullable(null, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e.message).to.match(eidRegex); - expect(e).to.be.a(EidNullPointerException); - expect(e).not.to.be.a(TypeError); - }); - }); - }); - describe('giving a undefined value', function() { - it('should throw EidNullPointerException', function() { - var fn = function() { - EidPreconditions.checkNotNullable(undefined, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e.message).to.match(eidRegex); - expect(e).to.be.a(EidNullPointerException); - expect(e).not.to.be.a(TypeError); - }); - }); - }); - describe('giving a string value', function() { - it('should return original value', function() { - var given = 'YjdlYjExZGQ0MzY3YjIxO'; - var result = EidPreconditions.checkNotNullable(given, eid); - expect(result).to.be(given); - }); - }); - }); - - - describe('.checkNotNull()', function() { - describe('giving a null value', function() { - it('should throw EidNullPointerException', function() { - var fn = function() { - EidPreconditions.checkNotNull(null, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e.message).to.match(eidRegex); - expect(e).to.be.a(EidNullPointerException); - expect(e).not.to.be.a(TypeError); - }); - }); - }); - describe('giving a string value', function() { - it('should return original value', function() { - var given = 'YjdlYjExZGQ0MzY3YjIxO'; - var result = EidPreconditions.checkNotNull(given, eid); - expect(result).to.be(given); - }); - }); - }); - - - describe('.checkNotUndefined()', function() { - describe('giving a undefined value', function() { - it('should throw EidNullPointerException', function() { - var fn = function() { - EidPreconditions.checkNotUndefined(undefined, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e.message).to.match(eidRegex); - expect(e).to.be.a(EidNullPointerException); - expect(e).not.to.be.a(TypeError); - }); - }); - }); - describe('giving a string value', function() { - it('should return original value', function() { - var given = 'YjdlYjExZGQ0MzY3YjIxO'; - var result = EidPreconditions.checkNotUndefined(given, eid); - expect(result).to.be(given); - }); - }); - }); - - - describe('.checkArgument()', function() { - describe('giving an Eid object', function() { - var eidObject = new Eid(eid); - it('should run without errors', function() { - var fn = function() { - EidPreconditions.checkArgument(true, eidObject); - }; - expect(fn).not.to.throwException(); - }); - }); - describe('giving a nullable value', function() { - it('should throw TypeError', function() { - var fn = function() { - EidPreconditions.checkArgument(true, undefined); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(/Pass not-null Eid to EidPreconditions first!/); - expect(e).to.be.a(TypeError); - }); - }); - }); - describe('giving a falsy value', function() { - it('should throw EidIllegalArgumentException', function() { - var fn = function() { - EidPreconditions.checkArgument(false, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e).to.be.a(EidIllegalArgumentException); - }); - }); - }); - }); - - - describe('.checkState()', function() { - describe('giving a falsy value', function() { - it('should throw EidIllegalStateException', function() { - var fn = function() { - EidPreconditions.checkState(false, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e).to.be.a(EidIllegalStateException); - }); - }); - }); - }); - - - describe('.checkElementIndex()', function() { - describe('giving a invalid size of -6', function() { - it('should throw EidIllegalArgumentException', function() { - var fn = function() { - EidPreconditions.checkElementIndex(0, -6, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e).to.be.a(EidIllegalArgumentException); - }); - }); - }); - describe('giving a invalid index value of 6, and size of 2', function() { - it('should throw EidIndexOutOfBoundsException', function() { - var fn = function() { - EidPreconditions.checkElementIndex(6, 2, eid); - }; - expect(fn).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e).to.be.a(EidIndexOutOfBoundsException); - }); - }); - }); - describe('giving a valid index of 2 and size of 5', function() { - it('should return index of 2', function() { - var result = EidPreconditions.checkElementIndex(2, 5, eid); - expect(result).to.be(2); - }); - }); - }); - - - describe('.tryToExecute()', function() { - describe('giving a valid supplier function', function() { - it('should return supplier value', function() { - var fn = function() { - return 6; - }; - var result = EidPreconditions.tryToExecute(fn, eid); - expect(result).to.be(6); - }); - }); - describe('giving a supplier that throws TypeError function', function() { - it('should throw EidRuntimeException', function() { - var fn = function() { - throw new TypeError('invalid type!'); - }; - var testClousure = function() { - EidPreconditions.tryToExecute(fn, eid); - }; - expect(testClousure).to.throwException(function(e) { - expect(e.toString()).to.match(eidRegex); - expect(e.toString()).to.match(/invalid type!/); - expect(e).to.be.a(EidRuntimeException); - }); - }); - }); - }); -}); From 80f34b5ab22039d9397446051ab5055ca7d71185 Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 22:45:50 +0200 Subject: [PATCH 6/8] docs: update README for v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Defensive programming framing, ESM/CJS/browser examples. Error.cause docs, rewritten EidPreconditions section. Drop Bower, update badges to GitHub Actions. Assisted-by: đŸ€– claude-opus-4-6@default --- README.md | 222 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 122 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 62e263f..d104808 100644 --- a/README.md +++ b/README.md @@ -1,185 +1,207 @@ -# EID Runtime Exceptions and Utilities for Javascript +# EID Runtime Exceptions and Utilities for JavaScript/TypeScript -[![Build Status](https://travis-ci.org/wavesoftware/javascript-eid-exceptions.svg?branch=master)](https://travis-ci.org/wavesoftware/javascript-eid-exceptions) [![Coverage Status](https://coveralls.io/repos/wavesoftware/javascript-eid-exceptions/badge.svg?branch=master&service=github)](https://coveralls.io/github/wavesoftware/javascript-eid-exceptions?branch=master) [![npm](https://img.shields.io/npm/v/eid.js.svg)](https://www.npmjs.com/package/eid.js) [![Bower](https://img.shields.io/bower/v/eid.js.svg)]() +[![CI](https://github.com/wavesoftware/javascript-eid-exceptions/actions/workflows/ci.yml/badge.svg)](https://github.com/wavesoftware/javascript-eid-exceptions/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/eid.js.svg)](https://www.npmjs.com/package/eid.js) -This small library holds a set of exceptions and utilities that implements idea of fast, reusable, error codes that can be simply thrown fast in case of unpredictable and unrecoverable application failure. It is meant to be used for application bugs. +A small, zero-dependency library for [defensive programming](https://en.wikipedia.org/wiki/Defensive_programming) in JavaScript and TypeScript. It provides reusable Exception IDs (EIDs), precondition checks, and standardized error handling for fail-fast detection of programming errors. -## Idea +Instead of writing ad-hoc validation with generic `Error` messages, you assign a unique, permanent ID to each check site. When a bug reaches production, the ID links the error page (or log entry) directly to the line of code that failed. -The idea is to use a set of simple runtime exceptions. They should always take the Exception ID (Eid) object in the making. This eid object will then be reported when displaying or logging that exception. It can also be viewed on the professional fatal error window of the application as a bug reference. EidRuntimeExceptions contains also additional unique ID to distinguish each single exception from others with same Eid. This approach simplifies the management of exceptions in the application and allows developers to focus on functionalities rather than coming up with the correct statement for the exception. +## How it works -This approach is best to use with tools and plugins like: +Every exception takes an `Eid` object that combines two identifiers: - * [EidGenerator for Netbeans IDE](http://plugins.netbeans.org/plugin/53137/exception-id-eid-generator) - * [Generating Exception Id number in Intellij IDEA with Live Templates](https://github.com/wavesoftware/java-eid-exceptions/wiki/Generating%20Exception%20Id%20number%20in%20Intellij%20IDEA%20with%20Live%20Templates) +- A **static ID** (e.g. `"20260714:120000"`) -- a permanent label inserted by the developer at the throw site. +- A **unique ID** (e.g. ``) -- generated at runtime to distinguish individual occurrences. -Example: +When the exception is logged or displayed on an error page, both IDs appear together. Support teams search by the static ID to find the code path, and by the unique ID to pinpoint the exact occurrence. -```js -var cause = 'A extra message'; -throw new EidIllegalStateException("20150721:100554", cause); +```typescript +import { EidIllegalStateException } from "eid.js"; + +throw new EidIllegalStateException("20260714:120000", "An extra message"); ``` -Example log: +Output: ``` -ERROR 2016-01-11T22:48:42.445 EidIllegalStateException: [20150721:100554] A extra message - Error - at http://localhost:3000/browser/toplevel/eid.min.js:1:3959 - at Object.i.3.../eid (http://localhost:3000/browser/toplevel/eid.min.js:1:4211) - at r (http://localhost:3000/browser/toplevel/eid.min.js:1:254) - at http://localhost:3000/browser/toplevel/eid.min.js:1:305 - at http://localhost:3000/browser/toplevel/eid.min.js:1:536 - at Object.i.1.../../lib/eid (http://localhost:3000/browser/toplevel/eid.min.js:1:974) - at r (http://localhost:3000/browser/toplevel/eid.min.js:1:254) - at t (http://localhost:3000/browser/toplevel/eid.min.js:1:421) - at http://localhost:3000/browser/toplevel/eid.min.js:1:438 +EidIllegalStateException: [20260714:120000] An extra message + at Object. (/app/src/service.ts:42:11) ``` +Static IDs can be generated using [Live Templates in IntelliJ IDEA](https://github.com/wavesoftware/java-eid-exceptions/wiki/Generating%20Exception%20Id%20number%20in%20Intellij%20IDEA%20with%20Live%20Templates). -## Caution +## Intended use -This classes shouldn't be used in any public API or library. It is designed to be used for in-house development of end user applications which will report bugs in standardized error pages or post them to issue tracker. +This library is not intended for public APIs or shared libraries. It is designed for in-house, end-user applications that report bugs through standardized error pages or issue trackers. -## NPM +## Installation ```bash -npm install eid.js --save +npm install eid.js ``` -## Bower +### ESM (recommended) -```bash -bower install eid.js --save +```typescript +import { Eid, EidPreconditions, EidIllegalStateException } from "eid.js"; ``` -### `EidPreconditions` class +### CommonJS + +```javascript +const { Eid, EidPreconditions, EidIllegalStateException } = require("eid.js"); +``` -#### General use +### Browser (IIFE) -`EidPreconditions` class consists static methods that help to use Eid in a method or constructor. This is solely for convenience purposes. Use them to check whether method or constructor was invoked correctly (whether its preconditions have been met). These methods generally accept a `boolean` expression which is expected to be `true` (or in the case of `checkNotNull`, an object reference which is expected to be non-null). When `false` (or `null`) is passed instead, the `EidPreconditions` method throws an unchecked exception, which helps the calling method communicate to its caller that that caller has made a mistake. +```html + + +``` -Each method accepts a EID string or Eid object, which is designed to ease of use and provide strict ID for given exception usage. This approach speed up development of large application and helps support teams by giving both static and random ID for each possible bug that could occur. +## Error cause support -Each example uses static import: +All Eid exceptions support the standard ES2022 `Error.cause` property, preserving the original error and its full stack trace: -```js -// nodejs -var EidPreconditions = require('eid.js').preconditions; +```typescript +import { EidRuntimeException } from "eid.js"; -// browser using bower using toplevel version -var EidPreconditions = window.Eid.preconditions; +try { + riskyOperation(); +} catch (err) { + throw new EidRuntimeException("20260714:120000", "operation failed", err); + // The original error is available via .cause +} ``` -#### `checkArgument` method +`tryToExecute` chains the caught error as `cause` automatically: -`checkArgument` method should be used to check argument of the method, and validate it in technical terms (not business terms). +```typescript +import { EidPreconditions } from "eid.js"; -Example: - -```js -// [..] -function sqrt(value) { - checkArgument(value >= 0.0, "20150718:012333"); - // if ok, calculate the square root -} +const result = EidPreconditions.tryToExecute(() => { + return JSON.parse(untrustedInput); +}, "20260714:120100"); +// If JSON.parse throws, the SyntaxError is available via .cause ``` -In this example, `checkArgument` throws an `EidIllegalArgumentException` to indicate that developer made an error in its call to `sqrt`. +## `EidPreconditions` -#### `checkState` method +A collection of static methods for validating preconditions. Each method accepts an EID string (or an `Eid` object) and throws a typed Eid exception when the check fails. -`checkState` method should be used to check state of the class in given moment, and validate it in technical terms (not business terms). +### `checkArgument` -Example: +Validates a method argument in technical terms (not business rules). -```js -checkState(a >= 3.14 && b < 0., "20150721:115016"); +```typescript +import { EidPreconditions } from "eid.js"; + +function sqrt(value: number): number { + EidPreconditions.checkArgument(value >= 0.0, "20150718:012333"); + return Math.sqrt(value); +} ``` -#### `checkNotNull` method +Throws `EidIllegalArgumentException` if `value` is negative. -`checkNotNull` method should be used to check if given non null argument is actually `null` +### `checkState` -Example: +Validates the internal state of an object at a given moment. -```js -var nonNullUserName = checkNotNull(userName, "20150721:115515"); +```typescript +EidPreconditions.checkState(a >= 3.14 && b < 0, "20150721:115016"); ``` -#### `checkElementIndex` method +### `checkNotNull` -`checkElementIndex` method can be used to test parameters of an array, before being used +Ensures that a reference is not `null`. -```js -checkElementIndex(index, list.length, "20150721:115749"); +```typescript +const nonNullUserName = EidPreconditions.checkNotNull(userName, "20150721:115515"); ``` -#### Formatted message support +### `checkElementIndex` + +Validates that an index is within bounds of an array or list. + +```typescript +EidPreconditions.checkElementIndex(index, list.length, "20150721:115749"); +``` -There have been added additional `message` to method descriptors for `checkArgument`, `checkState`, `checkNotNull` and `checkElementIndex` method. Those method's parameter can sometimes be used to pass additional information to exceptions that will be displayed in log files. +### Optional message -For example: +All check methods accept an optional `message` parameter with additional context for the exception: -```js -checkState(transation.isValid(), "20151119:120238", "Invalid transaction: " + transaction); +```typescript +EidPreconditions.checkState( + transaction.isValid(), + "20151119:120238", + `Invalid transaction: ${transaction}` +); ``` -Will produce output similar to; +Output: ``` -EidIllegalStateException: [20151119:120238] => Invalid transaction: +EidIllegalStateException: [20151119:120238] Invalid transaction: ``` -#### Functional try to execute blocks +### `tryToExecute` -You can use functional blocks to handle operations, that are intended to operate properly. This approach simplify the code and makes it more readable. It's also good way to deal with untested, uncovered `catch` blocks. It's easy and gives developers nice way of dealing with countless operations that suppose to work as intended. +Wraps a block of code that is expected to succeed. If it throws, the error is re-thrown as an `EidRuntimeException` with the original error preserved as `cause`. -Example: +```typescript +import { EidPreconditions } from "eid.js"; +import { readFileSync } from "node:fs"; -```js -var content = EidPreconditions.tryToExecute(function() { - var fs = require('fs'); - return fs.readFileSync('project.properties'); +const content = EidPreconditions.tryToExecute(() => { + return readFileSync("project.properties", "utf-8"); }, "20150718:121521"); ``` -#### Logging +### Logging + +The `Eid` object provides a `makeLogMessage` method for structured log output. Use `%s` as a format specifier: -Eid object can also be useful in logging. That are `makeLogMessage` method provided to do that. Message formatting is done using equivalent of Java's `String.format(String, Object[])` method. -For example: +```typescript +import { Eid } from "eid.js"; -```js log.debug(new Eid("20151119:121814").makeLogMessage("REST request received: %s", request)); ``` -will unfold to something similar to: +Output: ``` -2017-01-08T16:45:34,334 DEBUG [20151119:121814] REST request received: flow=ShowLastTransactions step=Confirm> +[20151119:121814] => REST request received: > ``` -###Contributing +## Contributing Contributions are welcome! -To contribute, follow the standard [git flow](http://danielkummer.github.io/git-flow-cheatsheet/) of: +1. Fork the repository +2. Create a feature branch (`git checkout -b feature/my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin feature/my-new-feature`) +5. Open a Pull Request -1. Fork it -1. Create your feature branch (`git checkout -b feature/my-new-feature`) -1. Commit your changes (`git commit -am 'Add some feature'`) -1. Push to the branch (`git push origin feature/my-new-feature`) -1. Create new Pull Request - -Even if you can't contribute code, if you have an idea for an improvement please open an [issue](https://github.com/wavesoftware/javascript-eid-exceptions/issues). +If you have an idea for an improvement, please open an [issue](https://github.com/wavesoftware/javascript-eid-exceptions/issues). ## Requirements -* NodeJS >= 0.10 -* Any modern browser, supported by browserify. - +* Node.js >= 20 +* TypeScript >= 5.0 (optional, types are included) -### Releases +## Releases +- 2.0.0 + - Full rewrite to TypeScript + - ESM + CommonJS + IIFE browser bundle + - ES2022 `Error.cause` support + - Vitest test suite, Biome linting, GitHub Actions CI + - Dropped: Bower, Gulp, Travis CI, Node < 20 - 1.0.0 - - initial release - - library ported from Java version + - Initial release + - Library ported from Java version From 6ff6dfb80b3bad84bb289524f4db2354d13cd9d9 Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 23:07:33 +0200 Subject: [PATCH 7/8] fix: address review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI: add permissions: contents: read, persist-credentials: false. package.json: nested types in exports for CJS/ESM, add typecheck script. eid.ts: fix %s injection in JFormatter (single-pass replace). preconditions.ts: fix off-by-one in checkElementIndex (index >= size). index.ts: remove misleading backward compat block. Assisted-by: đŸ€– claude-opus-4-6@default --- .github/workflows/ci.yml | 9 +++++++++ package.json | 14 ++++++++++---- src/eid.ts | 7 ++++--- src/index.ts | 11 ----------- src/preconditions.ts | 2 +- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f440184..068bcfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [master, develop] +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -17,6 +20,8 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-node@v4 with: node-version: 22 @@ -33,6 +38,8 @@ jobs: node-version: [20, 22] steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} @@ -47,6 +54,8 @@ jobs: needs: [lint, test] steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-node@v4 with: node-version: 22 diff --git a/package.json b/package.json index 828634e..f579abf 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,14 @@ "unpkg": "./dist/index.global.js", "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.mjs", - "require": "./dist/index.cjs", + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + }, "default": "./dist/index.mjs" }, "./package.json": "./package.json" @@ -24,13 +29,14 @@ }, "scripts": { "build": "tsup", + "typecheck": "tsc --noEmit", "test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage", "lint": "biome check src/", "lint:fix": "biome check --write src/", "format": "biome format --write src/", - "prepublishOnly": "npm run lint && npm run test && npm run build", + "prepublishOnly": "npm run typecheck && npm run lint && npm run test && npm run build", "clean": "rm -rf dist coverage" }, "dependencies": {}, diff --git a/src/eid.ts b/src/eid.ts index e0e4ba6..4973938 100644 --- a/src/eid.ts +++ b/src/eid.ts @@ -26,9 +26,10 @@ class JFormatter { } format(args: unknown[]): string { - const regex = /%s/; - const reducer = (p: string, c: unknown): string => p.replace(regex, String(c)); - return args.reduce(reducer, this.template) as string; + let i = 0; + return this.template.replace(/%s/g, () => { + return i < args.length ? String(args[i++]) : "%s"; + }); } } diff --git a/src/index.ts b/src/index.ts index 5d969a1..814c65a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,15 +35,4 @@ import { } from "./exceptions"; import { EidPreconditions } from "./preconditions"; -// Backward compatibility: attach preconditions and exceptions to Eid -const preconditions = EidPreconditions; -const exceptions = { - EidRuntimeException, - EidNullPointerException, - EidIllegalArgumentException, - EidIllegalStateException, - EidIndexOutOfBoundsException, -}; - -export { preconditions, exceptions }; export default Eid; diff --git a/src/preconditions.ts b/src/preconditions.ts index 80ba175..4bd6a79 100644 --- a/src/preconditions.ts +++ b/src/preconditions.ts @@ -43,7 +43,7 @@ function ensureEid(candidate: string | Eid | null | undefined): Eid { } function isIndexAndSizeIllegal(index: number, size: number): boolean { - return index < 0 || index > size; + return index < 0 || index >= size; } function isSizeIllegal(size: number): boolean { From 1eb301735bdb39d9a03510e294ba7f8992723149 Mon Sep 17 00:00:00 2001 From: Chris Suszynski Date: Tue, 14 Jul 2026 23:08:31 +0200 Subject: [PATCH 8/8] fix: restore Eid.preconditions and Eid.exceptions for backward compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attach preconditions and exceptions as static properties on Eid class. Legacy consumers using Eid.preconditions.checkNotNull() still work. Assisted-by: đŸ€– claude-opus-4-6@default --- src/index.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/index.ts b/src/index.ts index 814c65a..15ef109 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,4 +35,31 @@ import { } from "./exceptions"; import { EidPreconditions } from "./preconditions"; +interface EidExceptions { + EidRuntimeException: typeof EidRuntimeException; + EidNullPointerException: typeof EidNullPointerException; + EidIllegalArgumentException: typeof EidIllegalArgumentException; + EidIllegalStateException: typeof EidIllegalStateException; + EidIndexOutOfBoundsException: typeof EidIndexOutOfBoundsException; +} + +declare module "./eid" { + interface Eid { + constructor: typeof Eid; + } + namespace Eid { + let preconditions: typeof EidPreconditions; + let exceptions: EidExceptions; + } +} + +Eid.preconditions = EidPreconditions; +Eid.exceptions = { + EidRuntimeException, + EidNullPointerException, + EidIllegalArgumentException, + EidIllegalStateException, + EidIndexOutOfBoundsException, +}; + export default Eid;