Releases: GamanJS/gaman
@gaman/[email protected]
Full Breaking Changes
Please learn back to https://gaman.7togk.id/
and join WhatsApp Channel https://whatsapp.com/channel/0029VbB0keR7z4kgczdSZ33s
Full Changelog: https://github.com/7TogkID/gaman/compare/@gaman/[email protected]...@gaman/[email protected]
@gaman/[email protected]
What`s Changed
- in module
*.block.ts, fielddependecies: {}andservices: {}be one inbindings: {} - in
index.tsto register integration likeapp.registerIntegration()now change to module*.block.tsin fieldincludes: [] - in module
*.block.tsto register middleware or block childerns now change into fieldincludes: []
Full Changelog: https://github.com/7TogkID/gaman/compare/v1.0.12...@gaman/[email protected]
Difference
*.block.ts before
export default defineBlock({
path: '/blog',
routes: [blogRoutes],
includes: [blogMiddleware] // just middlewares
blocks: [otherBlock] // just block childerns
dependencies: { // just dependencies
prisma: new PrismaClient()
},
services: { // just services
blogService: blogService
}
});*.block.ts after
export default defineBlock({
path: '/blog',
routes: [blogRoutes],
includes: [ // all in one
blogMiddleware, // (MIDDLEWARE)
apiIntegration, // (INTEGRATION)
otherBlock // other block like user.block.ts or something
]
bindings: { // all in one
prisma: new PrismaClient(), // dependency
blogService: blogService // service
},
});@gaman/[email protected]
What`s Changed
- now if you execute
npx gaman make:block user/admin/role,user/admin/admin.block.tswill be the parent blockrole.block.ts. - new command
npx gaman make:module <name>this will create 3 important files such asBlock,Routes, andService.
Full Changelog: https://github.com/7TogkID/gaman/compare/v1.0.12...@gaman/[email protected]
v1.0.12
Introduction
Now yes, right in version 1.0.12 GamanJS has changed completely!
In the project, you will find three important file modules:
- main.block.ts
main module of the application - main.routes.ts
main routes of the application - main.service.ts
main service of the application
Now gaman has 3 important packages such as @gaman/core, @gaman/common and @gaman/cli
What`s Changed
@gaman/corethe core of the application@gaman/commonThis function is used to store utilities, constants, types, etc.@gaman/clinew commandgaman make:block,gaman make:routes,gaman make:service,gaman make:integration,gaman make:middleware
Create your first project
npx create-gaman@latestFull Changelog: v1.0.4...v1.0.12
v1.0.4
What`s Changed
Shortcut send response without import, use r or Res
Example:
{
"/": (ctx) => {
return r.json({message: "OK!"});
},
"/user": (ctx) => {
return Res.text("OK!"):
}
}New Updates
- globals variable:
r,Resandnext() - delete
@gaman/cli, because now built in gaman - imports are now not one in
gaman, now they are like:gaman/block,gaman/tree,gaman/integrationetc.
detail imports:
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/cjs/index.js"
},
"./nunjucks": {
"types": "./dist/integration/nunjucks/index.d.ts",
"import": "./dist/integration/nunjucks/index.js",
"require": "./dist/cjs/integration/nunjucks/index.js"
},
"./ejs": {
"types": "./dist/integration/ejs/index.d.ts",
"import": "./dist/integration/ejs/index.js",
"require": "./dist/cjs/integration/ejs/index.js"
},
"./static": {
"types": "./dist/integration/static/index.d.ts",
"import": "./dist/integration/static/index.js",
"require": "./dist/cjs/integration/static/index.js"
},
"./session": {
"types": "./dist/integration/session/index.d.ts",
"import": "./dist/integration/session/index.js",
"require": "./dist/cjs/integration/session/index.js"
},
"./integration": {
"types": "./dist/integration/index.d.ts",
"import": "./dist/integration/index.js",
"require": "./dist/cjs/integration/index.js"
},
"./cors": {
"types": "./dist/middleware/cors/index.d.ts",
"import": "./dist/middleware/cors/index.js",
"require": "./dist/cjs/middleware/cors/index.js"
},
"./basic-auth": {
"types": "./dist/middleware/basic-auth/index.d.ts",
"import": "./dist/middleware/basic-auth/index.js",
"require": "./dist/cjs/middleware/basic-auth/index.js"
},
"./middleware": {
"types": "./dist/middleware/index.d.ts",
"import": "./dist/middleware/index.js",
"require": "./dist/cjs/middleware/index.js"
},
"./utils": {
"types": "./dist/utils/index.d.ts",
"import": "./dist/utils/index.js",
"require": "./dist/cjs/utils/index.js"
},
"./file": {
"types": "./dist/context/formdata/file/index.d.ts",
"import": "./dist/context/formdata/file/index.js",
"require": "./dist/cjs/context/formdata/file/index.js"
},
"./formdata": {
"types": "./dist/context/formdata/index.d.ts",
"import": "./dist/context/formdata/index.js",
"require": "./dist/cjs/context/formdata/index.js"
},
"./cookies": {
"types": "./dist/context/cookies/index.d.ts",
"import": "./dist/context/cookies/index.js",
"require": "./dist/cjs/context/cookies/index.js"
},
"./exception": {
"types": "./dist/error/index.d.ts",
"import": "./dist/error/index.js",
"require": "./dist/cjs/error/index.js"
},
"./headers": {
"types": "./dist/headers/index.d.ts",
"import": "./dist/headers/index.js",
"require": "./dist/cjs/headers/index.js"
},
"./tree": {
"types": "./dist/tree/index.d.ts",
"import": "./dist/tree/index.js",
"require": "./dist/cjs/tree/index.js"
},
"./block": {
"types": "./dist/block/index.d.ts",
"import": "./dist/block/index.js",
"require": "./dist/cjs/block/index.js"
},
"./response": {
"types": "./dist/response.d.ts",
"import": "./dist/response.js",
"require": "./dist/cjs/response.js"
},
"./next": {
"types": "./dist/next.d.ts",
"import": "./dist/next.js",
"require": "./dist/cjs/next.js"
},
"./types": {
"types": "./dist/types.d.ts",
"import": "./dist/types.js",
"require": "./dist/cjs/types.js"
},
"./base": {
"types": "./dist/gaman-base.d.ts",
"import": "./dist/gaman-base.js",
"require": "./dist/cjs/gaman-base.js"
}
},Full Changelog: v1.0.3...v1.0.4
v1.0.3
Full Changelog: v1.0.2...v1.0.3
v1.0.2
v1.0.1
What`s Changed ?
- Change FormData File, and feature additions by @angga7togk in #17
Bug Fixed
- fix on
fromData.getAll, not get all data!
New Update
- new silent options for
Logger, implementation:gaman.serv( { server: { slient: true } } ) - shortcut get many field as string from formdata by
ctx.inputs(name)orctx.request.inputs(name) - shortcut for get many and single field as file from formdata by (
ctx.file(name)andctx.files(name)) or (ctx.request.file(name)andctx.request.files(name)) ctx.json()now supported content type'application/x-www-form-urlencoded'- send Response by context, like
return ctx.res.json({message: "OK!"})orreturn ctx.response.text("OK!")
Contributors
Full Changelog: v1.0.0...v1.0.1
v1.0.0
🚀 GamanJS Release Notes
⚠️ Node.js Version Requirement
Important: This version of GamanJS requires Node.js >= v18.20.8. Please update your Node.js installation if you're using an older version.
🐛 Bug Fixes
Fixed Method Route Responsiveness Issue
Fixed a critical issue where method routes were not responding correctly to different HTTP methods.
Before (Broken):
routes: {
"/": {
GET: () => "OK",
POST: () => "OK (POST)"
}
}Previously, making a POST request would incorrectly execute the GET handler instead of the POST handler. This has been resolved.
Now (Fixed): All HTTP methods now correctly route to their respective handlers.
✨ New Features
Strict Route Matching
Introduced strict route matching functionality for more precise URL handling.
defineBlock({
strict: true
})strict: true- Routes must match exactly, including trailing slashes (e.g.,/dashboard/user/requires the trailing slash)strict: falseor omitted - Flexible matching, works with or without trailing slashes
Examples:
// Strict mode - must include trailing slash
"/dashboard/user/" ✅ matches
"/dashboard/user" ❌ doesn't match
// Non-strict mode - both work
"/dashboard/user/" ✅ matches
"/dashboard/user" ✅ matchesSession Helper Context Support
Added comprehensive session management with pluggable storage drivers.
New Session API:
// Set session data
await ctx.session.set('user_id', '12345');
await ctx.session.set('user_data', { name: 'John', role: 'admin' });
// Get session data
const userId = await ctx.session.get('user_id');
const userData = await ctx.session.get('user_data');
// Check if session exists
const hasUser = await ctx.session.has('user_id');
// Delete session data
await ctx.session.delete('user_id');Supported Storage Drivers:
- cookies - Stateless signed cookies (default)
- memory - In-memory storage for development
- file - File-based storage
- redis - Redis storage for production
- sql - SQLite database storage
- mongodb - MongoDB NoSQL storage
Usage Example:
import { session } from 'gaman/integrations';
// Basic setup with cookies
integrations: [session()]
// With Redis
integrations: [session({
driver: { type: 'redis', url: 'redis://localhost:6379' },
secret: 'your-secret-key',
maxAge: 3600
})]For more details, see merge tag [#13](../../pull/13).
📦 Package Consolidation
Deprecated Standalone Packages
The following standalone packages have been deprecated and are now built into GamanJS core:
@gaman/cors→gaman/cors@gaman/ejs→gaman/ejs@gaman/basic-auth→gaman/basic-auth@gaman/nunjucks→gaman/nunjucks- And other
@gaman/*packages
Migration Guide:
// OLD - Deprecated
import cors from '@gaman/cors';
import ejs from '@gaman/ejs';
import basicAuth from '@gaman/basic-auth';
// NEW - Built-in
import cors from 'gaman/cors';
import ejs from 'gaman/ejs';
import basicAuth from 'gaman/basic-auth';Benefits:
- ✅ Reduced dependency management
- ✅ Better version compatibility
- ✅ Simplified installation process
- ✅ Faster startup times
🔄 Breaking Changes
- Node.js Version: Minimum required version is now v18.20.8
- Package Imports: Update import statements from
@gaman/*togaman/*
📈 Improvements
- Enhanced route matching accuracy
- Better session management capabilities
- Streamlined package architecture
- Improved developer experience
[email protected]
Release Notes: v0.0.21
Patch Changes
In this release, significant updates and enhancements have been implemented:
Key Features
-
WebSocket Block
- Now you can define WebSocket functionality directly in a block using the new
websocketproperty. - Example:
import { defineBlock } from "gaman"; export default defineBlock({ path: "/ws", websocket: (ctx) => { return { onMessage: (message) => { ctx.send(`Received: ${message}`); }, }; }, });
- Supports events like
onOpen,onClose,onMessage,onError, and more.
- Now you can define WebSocket functionality directly in a block using the new
-
Middleware Enhancements
- Middleware can now be included at the block level using the
includesproperty. - Example:
import { defineBlock, cors } from "gaman"; export default defineBlock({ path: "/api", includes: [cors({ origin: "*" })], routes: { "/example": (ctx) => { return Response.json({ message: "CORS enabled!" }); }, }, });
- Custom middleware is supported via
defineMiddleware.import { defineMiddleware, next } from "gaman"; export default defineMiddleware((ctx) => { console.log("Custom middleware executed"); return next(); });
- Middleware can now be included at the block level using the
-
Logging Improvements
- Enhanced logging with detailed information such as:
- Response time in milliseconds.
- Status codes.
- Path accessed.
- This makes debugging and performance tracking easier.
- Enhanced logging with detailed information such as:
- New Built-in Packages
- Added built-in middleware packages:
cors: For Cross-Origin Resource Sharing configuration.basic-auth: For HTTP Basic Authentication.
- Added built-in middleware packages:
Example Usage
WebSocket
Define WebSocket in a block:
import { defineBlock } from "gaman";
export default defineBlock({
path: "/chat",
websocket: (ctx) => {
return {
onMessage: (message) => {
ctx.send(`You said: ${message}`);
},
};
},
});