Skip to content

Commit

Permalink
Merge branch 'master' into make-v19
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed Apr 25, 2024
2 parents e02ea03 + 738efae commit 3aca212
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 56 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,21 @@

## Version 18

### v18.3.0

- Changed default behaviour when using built-in logger while omitting its `color` option in config:
- Automatically detecting the terminal color support by default.

### v18.2.0

- Supporting Node 22;
- Featuring `zod-sockets` for implementing subscriptions on your API:
- I have developed an additional pluggable library, Zod Sockets, which has similar principles and capabilities, but
uses the websocket transport and Socket.IO protocol, so that the user of a client application could subscribe to
subsequent updates initiated by the server.
- Check out an [example of the synergy between two libraries](https://github.com/RobinTail/zod-sockets#subscriptions)
and the [Demo Chat application](https://github.com/RobinTail/chat).

### v18.1.0

- Optimization for `zod` 3.23:
Expand Down
2 changes: 1 addition & 1 deletion example/example.documentation.yaml
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: Example API
version: 18.1.0
version: 18.3.0
paths:
/v1/user/retrieve:
get:
Expand Down
10 changes: 4 additions & 6 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "express-zod-api",
"version": "18.1.0",
"version": "18.3.0",
"description": "A Typescript library to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.",
"license": "MIT",
"repository": {
Expand All @@ -25,15 +25,13 @@
"build:docs": "tsx example/generate-documentation.ts",
"build:client": "tsx example/generate-client.ts",
"build:license": "tsx tools/license.ts",
"test": "yarn test:types && yarn test:unit && yarn test:badge",
"pretest": "tsc --noEmit",
"test": "vitest run --coverage tests/unit tests/system",
"posttest": "make-coverage-badge --output-path coverage.svg",
"test:cjs": "yarn --cwd tests/cjs && vitest run -r tests/cjs",
"test:esm": "yarn --cwd tests/esm && vitest run -r tests/esm",
"test:952": "yarn --cwd tests/issue952 && yarn --cwd tests/issue952 test",
"test:compat": "yarn --cwd tests/compat && yarn --cwd tests/compat test",
"test:u": "yarn test:unit -u && yarn test:badge",
"test:types": "tsc --noEmit",
"test:unit": "vitest run --coverage tests/unit tests/system",
"test:badge": "make-coverage-badge --output-path coverage.svg",
"bench": "vitest bench --run tests/bench",
"lint": "eslint src example tests tools && yarn prettier *.md --check",
"mdfix": "prettier *.md --write",
Expand Down
4 changes: 2 additions & 2 deletions src/logger.ts
Expand Up @@ -25,7 +25,7 @@ export interface BuiltinLoggerConfig {
level: "silent" | "warn" | "debug";
/**
* @desc Enables colors on printed severity and inspected entities
* @default false
* @default Ansis::isSupported()
* */
color?: boolean;
/**
Expand Down Expand Up @@ -63,7 +63,7 @@ export const isBuiltinLoggerConfig = (
* */
export const createLogger = ({
level,
color = false,
color = new Ansis().isSupported(),
depth = 2,
}: BuiltinLoggerConfig): AbstractLogger => {
const styles: Record<keyof AbstractLogger, Ansis> = {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/logger.spec.ts
Expand Up @@ -43,7 +43,7 @@ describe("Logger", () => {
});

test("Should create warn logger", () => {
const { logger, logSpy } = makeLogger({ level: "warn" });
const { logger, logSpy } = makeLogger({ level: "warn", color: false });
logger.warn("testing warn message", { withMeta: true });
expect(logSpy.mock.calls).toMatchSnapshot();
});
Expand Down
92 changes: 46 additions & 46 deletions yarn.lock
Expand Up @@ -956,9 +956,9 @@
integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==

"@vitest/coverage-istanbul@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@vitest/coverage-istanbul/-/coverage-istanbul-1.5.0.tgz#0b84c302f3f5c5cbe28706d497cc835551b9858b"
integrity sha512-mEbVTIAPKhMkszO0lwOwWiG8Cvkj7rdMgdmCNUDnmcSZYUWGIqM8+4O1bcQ1WMHkejpcwvED5oU6ZFm3syVb6A==
version "1.5.2"
resolved "https://registry.yarnpkg.com/@vitest/coverage-istanbul/-/coverage-istanbul-1.5.2.tgz#b41625ea46f3751f5b013fa7647a0b42d6746d7d"
integrity sha512-YGC+QSWOL8cQ2HQaTEFttmG9v3DGLy7lMZIGdqjtTgaW6omW17/uZPxuh6m2t69T0rFLqImduVthm5o/gYYWTQ==
dependencies:
debug "^4.3.4"
istanbul-lib-coverage "^3.2.2"
Expand All @@ -970,44 +970,44 @@
picocolors "^1.0.0"
test-exclude "^6.0.0"

"@vitest/expect@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.5.0.tgz#961190510a2723bd4abf5540bcec0a4dfd59ef14"
integrity sha512-0pzuCI6KYi2SIC3LQezmxujU9RK/vwC1U9R0rLuGlNGcOuDWxqWKu6nUdFsX9tH1WU0SXtAxToOsEjeUn1s3hA==
"@vitest/expect@1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.5.2.tgz#04d1c0c94ca264e32fe43f564b04528f352a6083"
integrity sha512-rf7MTD1WCoDlN3FfYJ9Llfp0PbdtOMZ3FIF0AVkDnKbp3oiMW1c8AmvRZBcqbAhDUAvF52e9zx4WQM1r3oraVA==
dependencies:
"@vitest/spy" "1.5.0"
"@vitest/utils" "1.5.0"
"@vitest/spy" "1.5.2"
"@vitest/utils" "1.5.2"
chai "^4.3.10"

"@vitest/runner@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.5.0.tgz#1f7cb78ee4064e73e53d503a19c1b211c03dfe0c"
integrity sha512-7HWwdxXP5yDoe7DTpbif9l6ZmDwCzcSIK38kTSIt6CFEpMjX4EpCgT6wUmS0xTXqMI6E/ONmfgRKmaujpabjZQ==
"@vitest/runner@1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.5.2.tgz#acc9677aaca5c548e3a2746d97eb443c687f0d6f"
integrity sha512-7IJ7sJhMZrqx7HIEpv3WrMYcq8ZNz9L6alo81Y6f8hV5mIE6yVZsFoivLZmr0D777klm1ReqonE9LyChdcmw6g==
dependencies:
"@vitest/utils" "1.5.0"
"@vitest/utils" "1.5.2"
p-limit "^5.0.0"
pathe "^1.1.1"

"@vitest/snapshot@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.5.0.tgz#cd2d611fd556968ce8fb6b356a09b4593c525947"
integrity sha512-qpv3fSEuNrhAO3FpH6YYRdaECnnRjg9VxbhdtPwPRnzSfHVXnNzzrpX4cJxqiwgRMo7uRMWDFBlsBq4Cr+rO3A==
"@vitest/snapshot@1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.5.2.tgz#d6f8a5d0da451e1c4dc211fcede600becf4851ed"
integrity sha512-CTEp/lTYos8fuCc9+Z55Ga5NVPKUgExritjF5VY7heRFUfheoAqBneUlvXSUJHUZPjnPmyZA96yLRJDP1QATFQ==
dependencies:
magic-string "^0.30.5"
pathe "^1.1.1"
pretty-format "^29.7.0"

"@vitest/spy@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.5.0.tgz#1369a1bec47f46f18eccfa45f1e8fbb9b5e15e77"
integrity sha512-vu6vi6ew5N5MMHJjD5PoakMRKYdmIrNJmyfkhRpQt5d9Ewhw9nZ5Aqynbi3N61bvk9UvZ5UysMT6ayIrZ8GA9w==
"@vitest/spy@1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.5.2.tgz#6b439a933b64522edbb8da878fa5b5b6361140ef"
integrity sha512-xCcPvI8JpCtgikT9nLpHPL1/81AYqZy1GCy4+MCHBE7xi8jgsYkULpW5hrx5PGLgOQjUpb6fd15lqcriJ40tfQ==
dependencies:
tinyspy "^2.2.0"

"@vitest/utils@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.5.0.tgz#90c9951f4516f6d595da24876b58e615f6c99863"
integrity sha512-BDU0GNL8MWkRkSRdNFvCUCAVOeHaUlVJ9Tx0TYBZyXaaOTmGtUFObzchCivIBrIwKzvZA7A9sCejVhXM2aY98A==
"@vitest/utils@1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.5.2.tgz#6a314daa8400a242b5509908cd8977a7bd66ef65"
integrity sha512-sWOmyofuXLJ85VvXNsroZur7mOJGiQeM0JN3/0D1uU8U9bGFM69X1iqHaRXl6R8BwaLY6yPCogP257zxTzkUdA==
dependencies:
diff-sequences "^29.6.3"
estree-walker "^3.0.3"
Expand Down Expand Up @@ -1094,9 +1094,9 @@ ansi-styles@^6.1.0:
integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==

ansis@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/ansis/-/ansis-3.1.1.tgz#3e155f10362575dbfe1c298295a8d8fe4ebe140f"
integrity sha512-91DBlFEMcOgzaHhMQP4SaknYUZ3zKfroLfAQT4rHBdJW1lFgDeFQphtkDQ7jOtutDObROmDxQ/6an/j5D1Bprw==
version "3.2.0"
resolved "https://registry.yarnpkg.com/ansis/-/ansis-3.2.0.tgz#0e050c5be94784f32ffdac4b84fccba064aeae4b"
integrity sha512-Yk3BkHH9U7oPyCN3gL5Tc7CpahG/+UFv/6UG03C311Vy9lzRmA5uoxDTpU9CO3rGHL6KzJz/pdDeXZCZ5Mu/Sg==

any-promise@^1.0.0:
version "1.3.0"
Expand Down Expand Up @@ -4400,9 +4400,9 @@ tsup@^8.0.0:
tree-kill "^1.2.2"

tsx@^4.6.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.7.2.tgz#a108b1a6e16876cd4c9a4b4ba263f2a07f9cf562"
integrity sha512-BCNd4kz6fz12fyrgCTEdZHGJ9fWTGeUzXmQysh0RVocDY3h4frk05ZNCXSy4kIenF7y/QnrdiVpTsyNRn6vlAw==
version "4.7.3"
resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.7.3.tgz#c32f3f5cb928708a5c6becf617e432b395999242"
integrity sha512-+fQnMqIp/jxZEXLcj6WzYy9FhcS5/Dfk8y4AtzJ6ejKcKqmfTF8Gso/jtrzDggCF2zTU20gJa6n8XqPYwDAUYQ==
dependencies:
esbuild "~0.19.10"
get-tsconfig "^4.7.2"
Expand Down Expand Up @@ -4585,10 +4585,10 @@ vary@^1, vary@~1.1.2:
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

vite-node@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.5.0.tgz#7f74dadfecb15bca016c5ce5ef85e5cc4b82abf2"
integrity sha512-tV8h6gMj6vPzVCa7l+VGq9lwoJjW8Y79vst8QZZGiuRAfijU+EEWuc0kFpmndQrWhMMhet1jdSF+40KSZUqIIw==
vite-node@1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.5.2.tgz#9e5fb28bd8bc68fe36e94f9156c3ae67796c002a"
integrity sha512-Y8p91kz9zU+bWtF7HGt6DVw2JbhyuB2RlZix3FPYAYmUyZ3n7iTp8eSyLyY6sxtPegvxQtmlTMhfPhUfCUF93A==
dependencies:
cac "^6.7.14"
debug "^4.3.4"
Expand All @@ -4608,15 +4608,15 @@ vite@^5.0.0:
fsevents "~2.3.3"

vitest@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.5.0.tgz#6ebb396bd358650011a9c96c18fa614b668365c1"
integrity sha512-d8UKgR0m2kjdxDWX6911uwxout6GHS0XaGH1cksSIVVG8kRlE7G7aBw7myKQCvDI5dT4j7ZMa+l706BIORMDLw==
dependencies:
"@vitest/expect" "1.5.0"
"@vitest/runner" "1.5.0"
"@vitest/snapshot" "1.5.0"
"@vitest/spy" "1.5.0"
"@vitest/utils" "1.5.0"
version "1.5.2"
resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.5.2.tgz#bec4f413de40257d6be76183980273f6411068d0"
integrity sha512-l9gwIkq16ug3xY7BxHwcBQovLZG75zZL0PlsiYQbf76Rz6QGs54416UWMtC0jXeihvHvcHrf2ROEjkQRVpoZYw==
dependencies:
"@vitest/expect" "1.5.2"
"@vitest/runner" "1.5.2"
"@vitest/snapshot" "1.5.2"
"@vitest/spy" "1.5.2"
"@vitest/utils" "1.5.2"
acorn-walk "^8.3.2"
chai "^4.3.10"
debug "^4.3.4"
Expand All @@ -4630,7 +4630,7 @@ vitest@^1.5.0:
tinybench "^2.5.1"
tinypool "^0.8.3"
vite "^5.0.0"
vite-node "1.5.0"
vite-node "1.5.2"
why-is-node-running "^2.2.2"

webidl-conversions@^4.0.2:
Expand Down

0 comments on commit 3aca212

Please sign in to comment.