Skip to content

Releases: GamanJS/gaman

@gaman/[email protected]

27 Aug 08:19

Choose a tag to compare

@gaman/[email protected]

31 Jul 06:11

Choose a tag to compare

What`s Changed

  • in module *.block.ts, field dependecies: {} and services: {} be one in bindings: {}
  • in index.ts to register integration like app.registerIntegration() now change to module *.block.ts in field includes: []
  • in module *.block.ts to register middleware or block childerns now change into field includes: []

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]

31 Jul 05:57

Choose a tag to compare

What`s Changed

  • now if you execute npx gaman make:block user/admin/role, user/admin/admin.block.ts will be the parent block role.block.ts.
  • new command npx gaman make:module <name> this will create 3 important files such as Block, Routes, and Service.

Full Changelog: https://github.com/7TogkID/gaman/compare/v1.0.12...@gaman/[email protected]

v1.0.12

28 Jul 17:38

Choose a tag to compare

Introduction

Now yes, right in version 1.0.12 GamanJS has changed completely!

In the project, you will find three important file modules:

  1. main.block.ts main module of the application
  2. main.routes.ts main routes of the application
  3. main.service.ts main service of the application
Workflow Module GamanJS drawio (4)

Now gaman has 3 important packages such as @gaman/core, @gaman/common and @gaman/cli

What`s Changed

  • @gaman/core the core of the application
  • @gaman/common This function is used to store utilities, constants, types, etc.
  • @gaman/cli new command gaman make:block, gaman make:routes, gaman make:service, gaman make:integration, gaman make:middleware

Create your first project

npx create-gaman@latest

Full Changelog: v1.0.4...v1.0.12

v1.0.4

23 Jul 17:33

Choose a tag to compare

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, Res and next()
  • delete @gaman/cli, because now built in gaman
  • imports are now not one in gaman, now they are like: gaman/block, gaman/tree, gaman/integration etc.

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

23 Jul 15:07
cc4b11a

Choose a tag to compare

Full Changelog: v1.0.2...v1.0.3

v1.0.2

23 Jul 15:01

Choose a tag to compare

What`s Changed

  • fix: import {...} from "gaman" undefined

Full Changelog: v1.0.1...v1.0.2

v1.0.1

23 Jul 14:18

Choose a tag to compare

What`s Changed ?

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) or ctx.request.inputs(name)
  • shortcut for get many and single field as file from formdata by (ctx.file(name) and ctx.files(name)) or (ctx.request.file(name) and ctx.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!"}) or return ctx.response.text("OK!")

Contributors

@angga7togk

Full Changelog: v1.0.0...v1.0.1

v1.0.0

21 Jul 15:01
9c206e0

Choose a tag to compare

🚀 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: false or 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"   matches

Session 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/corsgaman/cors
  • @gaman/ejsgaman/ejs
  • @gaman/basic-authgaman/basic-auth
  • @gaman/nunjucksgaman/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/* to gaman/*

📈 Improvements

  • Enhanced route matching accuracy
  • Better session management capabilities
  • Streamlined package architecture
  • Improved developer experience

[email protected]

25 Jun 13:50

Choose a tag to compare

Release Notes: v0.0.21

Patch Changes

In this release, significant updates and enhancements have been implemented:

Key Features

  1. WebSocket Block

    • Now you can define WebSocket functionality directly in a block using the new websocket property.
    • 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.
  2. Middleware Enhancements

    • Middleware can now be included at the block level using the includes property.
    • 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();
      });
  3. Logging Improvements

    • Enhanced logging with detailed information such as:
      • Response time in milliseconds.
      • Status codes.
      • Path accessed.
    • This makes debugging and performance tracking easier.

image

  1. New Built-in Packages
    • Added built-in middleware packages:
      • cors: For Cross-Origin Resource Sharing configuration.
      • basic-auth: For HTTP Basic Authentication.

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}`);
      },
    };
  },
});