Compare commits

..

10 Commits

Author SHA1 Message Date
github-actions[bot] c681970815 chore(release): v2.19.0 [skip ci] 2026-03-14 17:04:58 +00:00
Ritesh Ghosh b6f5758329 feat: update aniwatch pkg 2026-03-14 22:34:44 +05:30
github-actions[bot] 97980db02e chore(release): v2.18.2 [skip ci] 2025-09-27 19:12:43 +00:00
Ritesh Ghosh d5441a32a4 Merge pull request #158 from shivang2607/build-error-fixed
fix: build error in logger, cache, and logging middleware
2025-09-28 00:42:35 +05:30
Shivang2607 76923dd2df fix: build error in logger, cache, and logging middleware 2025-09-28 00:17:47 +05:30
github-actions[bot] 6c0af0b13b chore(release): v2.18.1 [skip ci] 2025-08-26 03:54:56 +00:00
Ritesh Ghosh 2e87e306be build: update aniwatch pkg 2025-08-26 09:24:26 +05:30
github-actions[bot] e46ba8788a chore(release): v2.18.0 [skip ci] 2025-07-27 11:08:54 +00:00
Ritesh Ghosh 5eb1fc26c7 feat: update aniwatch package 2025-07-27 16:37:55 +05:30
github-actions[bot] 573a6f8a1c chore(release): v2.17.0 [skip ci] 2025-06-17 16:13:05 +00:00
5 changed files with 26 additions and 45 deletions
+18 -30
View File
@@ -1,47 +1,35 @@
# [2.16.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.15.0...v2.16.0) (2025-06-17) # [2.19.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.18.2...v2.19.0) (2026-03-14)
### Features ### Features
* update aniwatch pkg ([89644e2](https://github.com/ghoshRitesh12/aniwatch-api/commit/89644e2d2e4bc652c7062636113ffdcb2bb1df32)) * update aniwatch pkg ([b6f5758](https://github.com/ghoshRitesh12/aniwatch-api/commit/b6f5758329b8fa12de3b7886f59d71707596cd0c))
# [2.15.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.14.5...v2.15.0) (2025-05-25) ## [2.18.2](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.18.1...v2.18.2) (2025-09-27)
### Bug Fixes
* build error in logger, cache, and logging middleware ([76923dd](https://github.com/ghoshRitesh12/aniwatch-api/commit/76923dd2dfefd1eeebd81e4ed87a01101f7a953c))
## [2.18.1](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.18.0...v2.18.1) (2025-08-26)
# [2.18.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.17.0...v2.18.0) (2025-07-27)
### Features ### Features
* add `execGracefulShutdown` method & `Prettify<T>` type ([a3cd5a3](https://github.com/ghoshRitesh12/aniwatch-api/commit/a3cd5a34aada2331e3f9bd56798f1ddb979dbb01)) * update aniwatch package ([5eb1fc2](https://github.com/ghoshRitesh12/aniwatch-api/commit/5eb1fc26c7632a3e7b53e71fd7df89288943b83d))
* add cache response header if caching is enabled ([013196b](https://github.com/ghoshRitesh12/aniwatch-api/commit/013196bd3d5e44aa76b1825f24f9f5186fe7e7c1))
* add deployment env based rate limiters ([f5d7462](https://github.com/ghoshRitesh12/aniwatch-api/commit/f5d74627e8b7f844f58a9dc82e3a79ecd911cc8f))
* add flexible `ANIWATCH_API_DEPLOYMENT_ENV` env and deployment envs ([bd597a6](https://github.com/ghoshRitesh12/aniwatch-api/commit/bd597a6fd71347c9cef687a891a408f40e6cbd93))
* add graceful shutdown and better deployment environment logic ([536b97e](https://github.com/ghoshRitesh12/aniwatch-api/commit/536b97e549675e1f0b035a5139320d6d60780608))
* add graceful shutdown and better deployment environment logic ([b19078e](https://github.com/ghoshRitesh12/aniwatch-api/commit/b19078e29cbd86d46d4ef1c5e5c6e914d1c8cc2f))
* update imp scripts, description & packages ([cdd05c7](https://github.com/ghoshRitesh12/aniwatch-api/commit/cdd05c719ba361cc28acf6c4a7d535c64a70e604))
* update response to include status instead of success for consistency ([74c9ffc](https://github.com/ghoshRitesh12/aniwatch-api/commit/74c9ffcb8f62dcdae6983da490436c39b6b8e558))
## [2.14.5](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.14.4...v2.14.5) (2025-05-11) # [2.17.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.16.0...v2.17.0) (2025-06-17)
### Bug Fixes
* update `ANIWATCH_API_HOSTNAME`§ env example ([d2812d1](https://github.com/ghoshRitesh12/aniwatch-api/commit/d2812d13bf5d285ce294d39a48d01020437f30ab))
## [2.14.4](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.14.3...v2.14.4) (2025-05-11)
### Bug Fixes
* update `ANIWATCH_API_HOSTNAME` env ([1081c7b](https://github.com/ghoshRitesh12/aniwatch-api/commit/1081c7b7bb7305ab5440301ecba8728fe88af90b))
## [2.14.3](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.14.2...v2.14.3) (2025-05-11)
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "aniwatch-api", "name": "aniwatch-api",
"version": "2.16.0", "version": "2.19.0",
"description": "NodeJS API for obtaining anime data from hianimez.to", "description": "NodeJS API for obtaining anime data from hianimez.to",
"main": "dist/src/server.js", "main": "dist/src/server.js",
"type": "module", "type": "module",
@@ -38,18 +38,18 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@hono/node-server": "^1.14.2", "@hono/node-server": "^1.14.2",
"aniwatch": "^2.23.3", "aniwatch": "^2.27.9",
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"envalid": "^8.0.0", "envalid": "^8.0.0",
"hono": "^4.7.10", "hono": "^4.7.10",
"hono-rate-limiter": "^0.4.2", "hono-rate-limiter": "^0.4.2",
"ioredis": "^5.6.1", "ioredis": "^5.6.1",
"pino": "^9.7.0" "pino": "^9.7.0",
"pino-pretty": "^13.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.15.21", "@types/node": "^22.15.21",
"husky": "^9.1.7", "husky": "^9.1.7",
"pino-pretty": "^13.0.0",
"prettier": "^3.5.3", "prettier": "^3.5.3",
"tsx": "^4.19.4", "tsx": "^4.19.4",
"typescript": "^5.8.3", "typescript": "^5.8.3",
-1
View File
@@ -20,7 +20,6 @@ const loggerOptions: LoggerOptions = {
}; };
}, },
}, },
timestamp: pino.stdTimeFunctions.isoTime,
}; };
export const log = pino(loggerOptions); export const log = pino(loggerOptions);
+3 -9
View File
@@ -1,7 +1,7 @@
import { env } from "../config/env.js"; import { env } from "../config/env.js";
import { AniwatchAPICache, cache } from "../config/cache.js"; import { AniwatchAPICache, cache } from "../config/cache.js";
import type { BlankInput } from "hono/types"; import type { BlankInput } from "hono/types";
import type { Context, MiddlewareHandler } from "hono"; import type { Context, MiddlewareHandler, Handler } from "hono";
import type { ServerContext } from "../config/context.js"; import type { ServerContext } from "../config/context.js";
// Define middleware to add Cache-Control header // Define middleware to add Cache-Control header
@@ -41,9 +41,10 @@ export function cacheConfigSetter(keySliceIndex: number): MiddlewareHandler {
}; };
} }
// FIXED: add explicit return type
export function withCache<T, P extends string = string>( export function withCache<T, P extends string = string>(
getData: (c: Context<ServerContext, P, BlankInput>) => Promise<T> getData: (c: Context<ServerContext, P, BlankInput>) => Promise<T>
) { ): Handler<ServerContext, P, BlankInput> {
return async (c: Context<ServerContext, P, BlankInput>) => { return async (c: Context<ServerContext, P, BlankInput>) => {
const cacheConfig = c.get("CACHE_CONFIG"); const cacheConfig = c.get("CACHE_CONFIG");
@@ -56,10 +57,3 @@ export function withCache<T, P extends string = string>(
return c.json({ status: 200, data }, { status: 200 }); return c.json({ status: 200, data }, { status: 200 });
}; };
} }
// export function _withCache<T>(
// context: Context<ServerContext>,
// promise: Promise<T>
// ): MiddlewareHandler {
// return async (c) => {};
// }
+1 -1
View File
@@ -3,7 +3,7 @@ import { logger as honoLogger } from "hono/logger";
import { log } from "../config/logger.js"; import { log } from "../config/logger.js";
export const logging: MiddlewareHandler = honoLogger( export const logging: MiddlewareHandler = honoLogger(
(msg: string, ...rest: string[]) => { (msg: string, ...rest: any[]) => {
log.info(msg, ...rest); log.info(msg, ...rest);
} }
); );