open-index/open-npm huggingface dataset:
npm package: @galacticsoftware/vue-cli-plugin-netlify-lambda
Description: Vue Cli plugin for adding Netlify Lambda
Author: Netlify
Latest version: 0.2.0

# vue-cli-plugin-netlify-lambda

> netlify-lambda plugin for vue-cli

Sets up [netlify-lambda](https://github.com/netlify/netlify-lambda) for vue-cli projects to build and serve AWS lambda functions.

## Installing in an Already Created Project

```
vue add netlify-lambda
```

## Usage

This ads a `netlify.toml` and a `src/lambda` folder with an example `hello.js` lambda function.

Any js file added in `src/lambda` will be built as a lambda. It will be compiled with webpack and babel and any imports will be bundled (no native dependencies, though).

When deployed to Netlify, the AWS lambda's are reachable under `/.netlify/functions/:name` - ie, the `hello.js` Lambda will be available under `/.netlify/functions/hello`.

The plugin also sets up a proxy and runs the Lambdas locally, to simplify local development.
npm package: @galactiks/astro-integration
Description: Galactiks Astro integration
Author: thegalactiks
Latest version: 0.3.19

# @galactiks/astro-integration

[![npm](https://img.shields.io/npm/v/@galactiks/astro-integration)](https://www.npmjs.com/package/@galactiks/astro-integration)

This Astro integration enables creating [Astro framework](https://astro.build) websites using content from [Galactiks](https://www.galactiks.com).

## Installation

Install the `@galactiks/astro-integration` package into any Astro project using your preferred package manager:

```sh
# npm
npm i @galactiks/astro-integration

# yarn
yarn add @galactiks/astro-integration

# pnpm
pnpm i @galactiks/astro-integration
```

If you run into any issues, [feel free to report them to us on GitHub](https://github.com/thegalactiks/explorer/issues).

## Getting started

Coming soon

## License

MIT © [Galactiks](https://www.galactiks.com)
npm package: @galactiks/config
Description: Reading Galactiks configurations files and get config during website generation
Author: thegalactiks
Latest version: 0.5.0

# @galactiks/config

[![npm](https://img.shields.io/npm/v/@galactiks/config)](https://www.npmjs.com/package/@galactiks/config)

This package allows reading [Galactiks](https://www.galactiks.com) configurations files and get config during website generation.

## Installation

Install the `@galactiks/config` package using your preferred package manager:

```sh
# npm
npm i @galactiks/config

# yarn
yarn add @galactiks/config

# pnpm
pnpm i @galactiks/config
```

If you run into any issues, [feel free to report them to us on GitHub](https://github.com/thegalactiks/explorer/issues).

## Getting started

Coming soon

## License

MIT © [Galactiks](https://www.galactiks.com)
npm package: @galactiks/contentlayer
Description: Galactiks contentlayer configurations
Author: galactiks
Latest version: 0.3.0

# @galactiks/contentlayer

[![npm](https://img.shields.io/npm/v/@galactiks/contentlayer)](https://www.npmjs.com/package/@galactiks/contentlayer)

Contentlayer document types and typings based on [Galactiks](https://www.galactiks.com) content models.

## Installation

If you start a new project, use the [ContentLayer template](https://github.com/thegalactiks/contentlayer-template).

If you have an existing ContentLayer project, install the `@galactiks/contentlayer` package using your preferred package manager:

```sh
# npm
npm i @galactiks/contentlayer

# yarn
yarn add @galactiks/contentlayer

# pnpm
pnpm i @galactiks/contentlayer
```

If you run into any issues, [feel free to report them to us on GitHub](https://github.com/thegalactiks/explorer/issues).

## Getting started

Coming soon

## License

MIT © [Galactiks](https://www.galactiks.com)
npm package: @galactiks/explorer
Description: Ensure Galactiks content model consistence, explore content built with ContentLayer and create dynamically missing pages and fields for SEO purposes
Author: thegalactiks
Latest version: 0.5.0

# @galactiks/explorer

[![npm](https://img.shields.io/npm/v/@galactiks/explorer)](https://www.npmjs.com/package/@galactiks/explorer)

Explorer package ensure content model consistence, explore content built with ContentLayer and create dynamically missing pages and fields for SEO purposes.

## Installation

Install the `@galactiks/explorer` package using your preferred package manager:

```sh
# npm
npm i @galactiks/explorer

# yarn
yarn add @galactiks/explorer

# pnpm
pnpm i @galactiks/explorer
```

If you run into any issues, [feel free to report them to us on GitHub](https://github.com/thegalactiks/explorer/issues).

## Getting started

Coming soon

## License

MIT © [Galactiks](https://www.galactiks.com)
npm package: @galactiks/sitemap
Description: A simple sitemap generator for Galactiks
Author: thegalactiks
Latest version: 0.1.7

# @galactiks/sitemap

[![npm](https://img.shields.io/npm/v/@galactiks/sitemap)](https://www.npmjs.com/package/@galactiks/sitemap)

A simple and easy-to-use sitemap generator for [Galactiks](https://www.galactiks.com).

## Installation

Install the `@galactiks/sitemap` package using your preferred package manager:

```sh
# npm
npm i @galactiks/sitemap

# yarn
yarn add @galactiks/sitemap

# pnpm
pnpm i @galactiks/sitemap
```

If you run into any issues, [feel free to report them to us on GitHub](https://github.com/thegalactiks/explorer/issues).

## Getting started

Coming soon

## License

MIT © [Galactiks](https://www.galactiks.com)
npm package: @galactusdev/ui
Description: Shared React UI component library built on Base UI + Tailwind CSS.
Latest version: 0.0.13

# @galactusdev/ui

Shared React UI component library built on Base UI + Tailwind CSS.

## Installation

```bash
bun add @galactusdev/ui
```

## Setup

### Configure styles

- **Tailwind v4 projects:** Add `@source "../../node_modules/@galactusdev/ui/dist";` to the project's main CSS file (e.g. `globals.css`). Do NOT import the pre-compiled styles — it will conflict with the project's Tailwind output.
- **Non-Tailwind projects:** Add `import "@galactusdev/ui/styles";` to the root layout file.

### Import components

```tsx
import { Button, Card, Dialog } from "@galactusdev/ui";
```

## Theming

Components use CSS custom properties. The consumer app controls the theme by defining variables in `:root` and `.dark`:

```css
:root {
  --primary: oklch(0.55 0.22 25);
  --primary-foreground: oklch(0.98 0 0);
  --background: oklch(1 0 0);
  --foreground: oklch(0.15 0 0);
}
```

Do not hardcode colors in the package — always use CSS variables.

## Development

### Storybook

```bash
bun install
bun run storybook
```

Opens at http://localhost:6006.

### Build

```bash
bun run build
```

Produces `dist/index.js`, `dist/index.d.ts`, and `dist/styles.css`.

### Release

```bash
npm publish --access public
```

Requires `NPM_TOKEN` set in the environment.

### Adding new components

**Primitives** (`src/client/components/ui/`) — exported in the package:

1. Add the component source to `src/client/components/ui/`
2. Export it from `src/index.ts`
3. Run `bun run build` to verify it compiles
4. Add a story in the same directory (`component-name.stories.tsx`)

**Composites** (`src/client/components/composite/`) — internal only, not published:

1. Add the component source to `src/client/components/composite/`
2. Do **not** export it from `src/index.ts`
3. Add a story with `title: "Composite/ComponentName"` in the same directory
npm package: @galactushouse/galactus-hook
Description: Ready-to-use hook library
Author: Galactus House
Latest version: 1.4.0

<img alt="GalactusHook banner" width="100%" src="https://i.ibb.co/0YCQHPG/galactus-hook-banner.png" />

## About

The `galactus-hook` library has a collection of ready-to-use hooks that will help you with your project tasks, in addition to making your code clean and with many fast features.

## Install

Install the `galactus-hook` library:

```shell
npm install @galactushouse/galactus-hook
```

or

```shell
yarn add @galactushouse/galactus-hook
```

## Usage

Import one or more hooks chosen from the library into your component and use them as needed for your project:

```javascript
import { useLocalStorage } from '@galactushouse/galactus-hook'
```

## Hooks documentation

Access the specific documentation for each hook to learn more about its features:

* [useApi](https://github.com/galactushouse/galactus-hook/tree/master/src/useApi#readme)
* [useCookie](https://github.com/galactushouse/galactus-hook/tree/master/src/useCookie#readme)
* [useLocalStorage](https://github.com/galactushouse/galactus-hook/tree/master/src/useLocalStorage#readme)
* [useLocation](https://github.com/galactushouse/galactus-hook/tree/master/src/useLocation#readme)
* [useWindowScroll](https://github.com/galactushouse/galactus-hook/tree/master/src/useWindowScroll#readme)

## Hooks details

| Hook | Functions / Variables | Description |
| --- | --- | --- |
| `useApi` | `getRequest` `postRequest` `putRequest` `patchRequest` `deleteRequest` | Hook with quick and easy functionality for full API consumption. The useApi hook works with the GET, POST, PUT, PATCH and DELETE methods. |
| `useCookie` | `getCookie` `setCookie` `deleteCookie` | Hook with quick and easy functionality to manage cookies for your web applications. |
| `useLocalStorage` | `addLocalStorage` `editLocalStorage` `readLocalStorage` `removeLocalStorage` | Hook with quick and easy functionality to create, edit, access and remove information in the browser's local storage. |
| `useLocation` | `getLocation` `setLocation` | Hook with quick and easy functionality for accessing window.location, giving you full possibilities of reading and changing its properties, generating navigation autonomy for your web application. |
| `useWindowScroll` | `positionX` `positionY` | Hook with quick and easy functionality to access the horizontal and vertical position of the scroll in your application. |

## Contribute

To contribute to the `galactus-hook` project follow the steps mentioned below:

1. Fork the `galactus-hook` project.
2. Clone the project (forked by you).
3. Make changes, create new hooks or documentation (In case you create a new hook, you must also create the documentation of its features in the README.md file in your folder).
4. Record your change in the CHANGELOG.md file following the [standardization](https://keepachangelog.com/en/1.0.0/).
5. Submit your Pull Request (PR) containing your changes.

## Licensed

GalactusHook is [MIT](https://github.com/galactushouse/galactus-hook/blob/master/LICENSE) licensed.
npm package: @galadrim/adonis-prisma
Description: Prisma provider for AdonisJS
Latest version: 0.0.15

# Adonis JS Prisma Adapter

This is an AdonisJS provider for Prisma ORM.

## Getting Started

### Installation

```sh
node ace add @galadrim/adonis-prisma
```

This command will scaffold the config files, providers and create a prisma folder with `prisma.schema` file.

### Post Installation

After installation, you should run the proper commands to migrate your schema and/or generate the Prisma Client :

```sh
  npx prisma generate
```

## Usage

You have two options to use the Prisma Client.

- By destructuring `HttpContext`object :

```javascript
//route.ts

router
  .get('/', async function ({ prisma }: HttpContext) {
    ...
    const posts = await prisma.post.findMany())
    ...
  })
```

- By importing prisma from `@galadrim/adonis-prisma/services` :

```javascript
import prisma from '@galadrim/adonis-prisma/services'
```

### Authentication

First, you should configure the `prisma` service inside `config/prisma.ts` file.

```javascript
export const prismaConfig = defineConfig({
  user: {
    hash: () => hash.use(),
    passwordColumnName: 'password',
    uids: ['email', 'id'],
  },
})
```

The `user` key is the model name you want to use for authentication. Then you can configure it the same way you would with the withAuthFinder mixin from `@adonisjs/lucid`.

- hash: The hash function to use for hashing the password.
- passwordColumnName: The name of the column to store the password.
- uids: The list of columns to use for authentication.

Then,you should install the `@adonisjs/auth` and configure it with `Session` as Auth Guard.
Then, you should replace the `provider` key in the `config/auth.ts` file with this:

```javascript
//config/auth.ts
  import { sessionUserProvider } from '@galadrim/adonis-prisma'
  import { configProvider } from '@adonisjs/core'
  ... other imports

  ...
       user: sessionGuard({
          provider: sessionUserProvider('user'),
          useRememberMeTokens: false,
        }),
```

After that, you can use the provided methods to facilitate the authentication flow. Like, the `@adonisjs/lucid`, there is two methods for authentication

- To verify user credentials, you can use this method : ` const user = await prisma.user.verifyCredentials('email', 'password')`

- The password is automatically hashed via the `@adonisjs/hash` package when creating or updating an user, based on the default hasher configured inside the `config/hash.ts`.

**_NB_**: For now the package doesn't support the `refreshToken` method. I'm working on it.

### Database Seeding

You can define seeders for your DB with the following command :

```sh
node ace make:seeder <name_of_the_seeder>
```

It will create a seeder file inside the `prisma/seeders` directory.

Then, to seed the database you should run :
`node ace prisma:seed` command.
**_NB_**: This command runs all the seeders files inside `prisma/seeders` directory.

## Before leaving...

Credit to [ArthurFranckPat](https://github.com/ArthurFranckPat/adonis-prisma), I used a lot of his work as a base for this package, mainly for the seeder (and this doc)
npm package: @galadrim/adonis-scaffolder
Description: ## Why?
Latest version: 2.0.5

# Galadrim Adonis API Scaffolder

## Why?

Imagine you have to create new projects every week or so, you will then not want to lose time in creating by hand boiler plate files over and over again in order to create CRUDL API for each of your Models (that and writing the same auth API for login, logout, reset password...)

I'm working in a web agency and this package helps me to be faster, use it if you want, if you have questions, I will be happy to help

## Install

- npm `npm i -D @galadrim/adonis-scaffolder`
- yarn `yarn add --dev @galadrim/adonis-scaffolder`

## View package

You must have adonis view package installed and configured

Install:

- npm `npm i @adonisjs/view`
- yarn `yarn add @adonisjs/view`

Configure:

- node ace configure @adonisjs/view

## Config

run `node ace configure @galadrim/adonis-scaffolder`

This will create the files needed for the scaffolder in YOUR code.
This enables you to customise everything the scaffolder do.
Once you have installed this scaffolder, it becomes your code, do whatever you want with it!

## Usage

Imagine you want to create a CRUDL API for your Post model

First, anotate some fields of the Post model

```ts
export default class Post extends BaseModel {
  @column({ isPrimary: true })
  public id: number

  @column(scaffold('string'))
  public name: string

  @column(scaffold('number.nullable'))
  public price: number | null

  @column.dateTime({ autoCreate: true })
  public createdAt: DateTime

  @column.dateTime({ autoCreate: true, autoUpdate: true })
  public updatedAt: DateTime
}
```

Then, you can use the ace command line to scaffold the files:

`node ace scaffold Post`

this will create:

```
CREATE: app/Controllers/Http/posts/PostsController.ts
CREATE: app/Controllers/Http/posts/postSchema.ts
CREATE: app/Controllers/Http/posts/postsList.ts
CREATE: app/Controllers/Http/posts/destroyPost.ts
CREATE: app/Controllers/Http/posts/showPost.ts
CREATE: app/Controllers/Http/posts/storePost.ts
CREATE: app/Controllers/Http/posts/updatePost.ts
```

I don't guarantee that the scaffolder output will be nicely formatted
I advise to run your formatter after generating files

- npm `npm run format`
- yarn `yarn format`

### Further instructions

- once you have scaffolded your API routes for a model you can edit the files created
- don't re run the command as it will overwrite your changes
- this tool is intended to win you some time on boilerplate only, once the files generated, you are on your own 😉

#### Bonus

there is a secret command to generate auth api 🤫

`node ace scaffold auth`
npm package: @galadrim/react-native-recaptchav3
Description: React native component to use the invisible recaptcha v3 from Google
Author: Jeremy Farnault
Latest version: 1.2.1


# react-native-recaptchav3

[![npm](https://img.shields.io/npm/v/@haskkor/react-native-recaptchav3.svg)](https://www.npmjs.com/package/@haskkor/react-native-recaptchav3) [![npm](https://img.shields.io/npm/dt/@haskkor/react-native-recaptchav3.svg)](https://www.npmjs.com/package/@haskkor/react-native-recaptchav3)

_React native component to use the invisible reCAPTCHA v3 from Google_

https://www.google.com/recaptcha/intro/v3.html

## Installation

```
npm install --save @haskkor/react-native-recaptchav3
```
or
```
yarn add @haskkor/react-native-recaptchav3
```

**Note:** React Native Community Webview requires you to link the native dependencies (https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md) 

## Demo

![automatic](https://user-images.githubusercontent.com/10620919/48578194-e1022c80-e97d-11e8-8bb9-6e96a8a25aec.gif)   ![retrybutton](https://user-images.githubusercontent.com/10620919/48578212-ed868500-e97d-11e8-95ab-1d5ec0280b8f.gif)

## Usage

Automatically get a captcha token:

```
import ReCaptchaV3 from '@haskkor/react-native-recaptchav3'

<ReCaptchaV3
  captchaDomain={'https://yourowndomainname.co.nz'}
  siteKey={'yourownsitekey'}
  onReceiveToken={(token: string) => Alert.alert('CAPTCHA', token)}/>
```

One could also use a trigger to request a new token using the reference of the component:

```
import ReCaptchaV3 from '@haskkor/react-native-recaptchav3'

<ReCaptchaV3
  ref={(ref: RecaptchaV3) => this._captchaRef = ref}
  captchaDomain={'https://yourowndomainname.co.nz'}
  siteKey={'yourownsitekey'}
  onReceiveToken={(token: string) => Alert.alert('CAPTCHA', token)}/>

<TouchableOpacity onPress={() => this._captchaRef.refreshToken()}>
  <Text>Retry</Text>
</TouchableOpacity>
```

## Options

| Key | Description | Default | Required | Type |
|---|---|---|---|---|
|**`captchaDomain`**|Your url registered with Google reCAPTCHA|`None`|`true`|`string`|
|**`onReceiveToken`**|The callback used to get the captcha token from the component|`None`|`true`|`(captchaToken: string) => void`|
|**`siteKey`**|The site key provided by Google reCAPTCHA|`None`|`true`|`string`|

## [Changelog](https://github.com/Haskkor/react-native-recaptchav3/blob/master/CHANGELOG.md)

## Contributing

Pull requests are welcome.

## [License](https://github.com/Haskkor/react-native-recaptchav3/blob/master/LICENSE)
npm package: @galadrim/schematics
Description: A custom schematics collection for NestJS (forked from @nestjs/schematics)
Latest version: 1.0.4

# Custom NestJS Schematics

This project is a fork of [NestJS Schematics](https://github.com/nestjs/schematics), the schematic collection for the [NestJS](http://nestjs.com/) framework. This fork includes additional custom schematics aimed at extending the functionality to better fit our specific development needs.

## Additional Schematics

In this fork, we have added two custom schematics:

- `custom-resource`: This schematic generates a new resource with extended configurations and options tailored to our project's architecture and best practices.
- `s3-custom`: This schematic provides templates for integrating Amazon S3 services more seamlessly into our NestJS applications, including customized service modules and controllers.

## Installation

To use these custom schematics, you need to install this package instead of the standard `@nestjs/schematics`. You can install it using npm:

```bash
$ npm i -g @galadrim/schematics
```

## Setup

To use the custom-schematics, you have to put a `nest-cli.json` file in the root of your project with the following content:

```json
{
  "collection": "@galadrim/schematics",
  "sourceRoot": "apps/backend/src",
  "compilerOptions": {
    "deleteOutDir": true
  }
}
```

# Usage

You can now use the custom schematics in the same way as the standard NestJS schematics. For example, to generate a new resource, you can run:

```bash
$ nest g res-custom api/users --no-spec
```
npm package: @galatajs/class-validator
Description: Class-Validator package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/76786120?v=4" width="128" height="128" style="border-radius: 50px; margin-right: 10px;" />
</p>
<h3 align="center">@galatajs/class-validator</h3>
<p align="center">
  Class-Validator package of <code>galatajs</code> framework. 
</p>

### What Is It?

It is a package developed to use `class-validator` in your galatajs projects.
npm package: @galatajs/config
Description: Config package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/config</h3>
<p>Config package of galatajs Framework</p>

### What Is It?

module that allows you to manage your project configuration
npm package: @galatajs/core
Description: core package for galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?v=4" width="128" height="128" style="border-radius: 50px; margin-right: 10px;" />
</p>
<h3 align="center">@galatajs/core</h3>
<p align="center">
  errors, results or more for galatajs framework and you.
</p>

### What Is It?

It contains some core packages for the ``galatajs framework`` to work in certain standards. Although it was developed for the ``galatajs framework``, you can use it if you want. 

You don't have to use ``galatajs`` framework, `@galatajs/core` is a nodejs package.

🔗 [access on npm](https://www.npmjs.com/package/@galatajs/core)

### Installation

```sh
npm install @galatajs/core
```

> or with yarn
>
> ```
> yarn add @galatajs/core
> ```

### Usage Results

```typescript
import { SuccessDataResult } from "@galatajs/core";

export type Product = {
    id: number;
    name: string;
    price: number;
}

const product : Product = {
    id: 1,
    name: "Product 1",
    price: 10
}

const result = new SuccessDataResult<Product>("Product created successfully", product);
console.log(result);
/**
 success: true,
 message: "Product created successfully",
 data: { id: 1, name: "Product 1", price: 10 }
 * */
```

### Usage Errors

```typescript
import {BadRequestError} from "@galatajs/core";

const error = new BadRequestError("Product name is required");
console.log(error);
/**
 success: false,
 message: "Product name is required",
 code: 400
 * */
```

When the framework is completed, the document will be made more detailed.
npm package: @galatajs/cors
Description: Cors plugin of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/cors</h3>
<p align="center">
  Cors plugin of <code>galatajs</code> framework. 
</p>
npm package: @galatajs/decorators
Description: Decorators package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.2

!! Not Ready for Prime Time, Experimental !!

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/decorators</h3>
<p align="center">
  Decorator package of <code>galatajs</code> framework. 
</p>

### Installation

```bash
npm install @galatajs/decorators
```

### Usage

Enable decorators in your `tsconfig.json`:

```json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}
```

Main file

```typescript
import { createApp, App } from "@galatajs/app";
import { createDecoratorApp } from "@galatajs/decorators";
import { mainModule } from "./src/main.module";

const app: App = createApp(mainModule);
app.register(createDecoratorApp());

app.start();
```

In Controller

```typescript
import { Controller, Get } from "@galatajs/decorators";
import { Request, Response } from "@galatajs/http";

@Controller("some")
export class SomeController {
  @Get("test")
  test(req: Request, res: Response) {
    return res.success("test");
  }
}
```

In Module

```typescript
import { createModule, Module } from "@galatajs/app";
import { SomeController } from "./some.controller";

const module: Module = createModule({
  providers: [SomeController],
});
```
npm package: @galatajs/events
Description: Events package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/events</h3>
<p align="center">
  Lifecycle for your schemas at any scale.
</p>

### What Is It?

Server Side Event Package. Do you want to do something in customer service when there is a record in the product table? That's called lifecycle and ``@galatajs/events`` provides it.

You don't have to use ``galatajs`` framework, `@galatajs/events` is a nodejs package.

🔗 [access on npm](https://www.npmjs.com/package/@galatajs/events)

### Installation

```sh
npm install @galatajs/events
```

> or with yarn
>
> ```
> yarn add @galatajs/events
> ```


### Example

Take a look at the example folder for example usage!

### Basic Usage

```typescript

import { createEvent } from "@galatajs/events";

let totalPrice = 0;

const callback = (price : number) : void => {
    totalPrice += price;
}

const onProductAddEvent = createEvent<number>("product-add");

onProductAddEvent.addListener(callback);
onProductAddEvent.publish(10);
onProductAddEvent.publish(20);

console.log(totalPrice); // 30
```

Although this explains the usage, the purpose of the package is more than that, please review the example folder for better usage.
npm package: @galatajs/inject
Description: Dependency Injection packages of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/inject</h3>
<p align="center">
  Dependency Injection package of <code>galatajs</code> framework. 
</p>

### What Is It?

This package is the inject package of the ``galatajs`` framework. 

With this package, you can provide some values that you will reuse to inject later.

You don't have to use ``galatajs`` framework, `@galatajs/inject` is a nodejs package.

### Installation

```sh
npm install @galatajs/inject
```

> or with yarn
>
> ```
> yarn add @galatajs/inject
> ```

### Usage With Global Provider

```typescript
// main.ts
import { provide } from "@galatajs/inject"

const logger = (...msg: any[]) => {
  console.log(...msg);
}

provide("logger", logger);
provide("city", "galatajs")
provide("population", 15600000)
```

```typescript
// anything.ts
import { inject } from "@galatajs/inject"

const logger = inject("logger")
const city = inject("city")
const population = inject("population")

logger("Hello, ", city, " has ", population, " people.")
// Hello, galatajs has 15600000 people.
```

### Usage With Custom Types

```typescript
import { createInjector } from "@galatajs/inject"

type Product = {
  name: string
  price: number
}

const productInjector = createInjector<Product>();

productInjector.provide("product", {
  name: "iPhone X",
  price: 999999
});

const iphoneX = productInjector.inject("product")
```
npm package: @galatajs/mongodb
Description: Mongodb package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/mongodb</h3>
<p align="center">
  MongoDB package of <code>galatajs</code> framework. 
</p>

### What Is It?

A package that allows you use the [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) driver developed by mongodb in the galatajs project.
npm package: @galatajs/redis
Description: Redis package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/redis</h3>
<p align="center">
  Redis module of <code>galatajs</code> framework. 
</p>
npm package: @galatajs/rules
Description: Rule packages of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/rules</h3>
<p align="center">
  Rule package of <code>galatajs</code> framework. 
</p>

### What Is It?

This package is the rule package of the ``galatajs`` framework. It allows you to write and manage business rules in a cleaner way, not nested if conditions.

You don't have to use ```galatajs``` framework, ```@galatajs/rules``` is a nodejs package.

### Installation

```sh
npm install @galatajs/rules
```

> or with yarn
>
> ```sh
> yarn add @galatajs/rules
> ```

### Basic Usage

```typescript
import { createRule } from '@galatajs/rules';

const validateUserType = (user) => {
    return {success: user.type === 'admin', error: 'User type is not admin'};
}

const validateUser = createRule<string>(validateUserType);
```

### Advanced Usage

```typescript
import { createRule } from '@galatajs/rules';
import { ErrorDataResult } from "@galatajs/core"

type Product = {
    name: string;
    price: number;
    stock: number;
}

class ValidationError {
    constructor(public field: string, public message: string) {}
}

const nameValidator = (name: string) => {
    return name.length < 3 ? {success: false, error: new ValidationError('name', 'Name is too short')} : {success: true};
}

const priceNegativeValidator = (price: number) => {
    return price < 0 ? {success: false, error: new ValidationError('price', 'Price is negative')} : {success: true};
}

const priceLimitValidator = (price: number) => {
    return price > 100 ? {success: false, error: new ValidationError('price', 'Price is too high')} : {success: true};
}

const stockValidator = (stock: number) => {
    return stock < 10 ? {success: false, error: new ValidationError('stock', 'Stock is too short')} : {success: true};
}

const productValidatorMiddleware = (req, res, next) => {
    const { name, price, stock } = req.body;
    const result = createRule<ValidationError>()
        .start(nameValidator)
        .and(priceNegativeValidator)
        .or(priceLimitValidator)
        .and(stockValidator)
        .end(name, price, stock);
    next(result.success ? undefined : new ErrorDataResult("Validation Error", result.errors));
}
```

### Usage with waitAll option

It some cases we may wait for all the validations to perform, and sometimes we may want to finish if only one of the validation is false. Set waitAll to false if you want to terminate validation only when a false is returned.
 
```typescript
    const { name, price, stock } = req.body;
    const result = createRule<ValidationError>({waitAll: false}) 
        .start(nameValidator)
        .and(priceNegativeValidator)
        .or(priceLimitValidator)
        .and(stockValidator)
        .end(name, price, stock);
```

So if the first wrong transaction comes in ```priceNegativeValidator```, ```priceLimitValidator``` will not be executed.
npm package: @galatajs/test
Description: Test package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1


<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/test</h3>
<p align="center">
  Test package of <code>galatajs</code> framework. 
</p>

### What Is It?

Test module for galatajsJS. This package has been developed to facilitate testing of modules when using module-based architecture. It is not a testing framework. If that's what you came for, `jest` or `mocha` is recommended.

### Installation

```bash
npm install --save-dev @galatajs/test
```

> or with yarn
> ```bash
> yarn add -D @galatajs/test
> ```

### Example

```typescript
import { createApp, createModule } from "@galatajs/app";
import { createTestApp } from "@galatajs/test";

class ProviderClass {
  greeting() : string {
    return "hello";
  }
}

const mainModule = createModule("main", {
  providers: [
    {
      name: "provider-1",
      value: "provider-1-value",
    },
    ProviderClass
  ]
})

const app = createApp(mainModule);
app.register(createTestApp())

beforeAll(async() => {
  await app.start();
})

describe("app testing", () => {
  it("check provider-1", () => {
    const module = getModule("main");
    const provider = module.getProvider("provider-1");
    expect(provider).toBe("provider-1-value");
  })

  it("check providerClass", () => {
    const module = getModule("main");
    const provider = module.getProvider("providerClass");
    expect(provider.greeting()).toBe("hello");
  })
})

afterAll(() => {
  app.close();
})
```

Note: galatajsJS passes provider names through the `toCamelCase` function. So even though our provider is named `ProviderClass`, we called it `providerClass`.
npm package: @galatajs/typeorm
Description: Typeorm package of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/typeorm</h3>
<p align="center">
  Typeorm package of <code>galatajs</code> framework. 
</p>

### Installation

```bash
npm install @galatajs/typeorm mysql
```

### Usage

Main file

```typescript
import { createApp, App } from "@galatajs/app";
import { createTypeorm } from "@galatajs/typeorm";
import { mainModule } from "./src/main.module"

const app : App = createApp(mainModule)
app.register(createTypeorm({
  /* ... typeorm options */
}))

app.start();
```

In module

```typescript
import { createModule, Module } from "@galatajs/app";
import { registerEntity } from "@galatajs/typeorm";
import { Product } from "./product.entity";

const productModule : Module = createModule("product", {
  imports: [
    registerEntity(Product)
  ]
})
```
npm package: @galatajs/view
Description: Template-engine packages of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/view</h3>
<p align="center">
  Template-engine package of <code>galatajs</code> framework. 
</p>
npm package: @galatajs/ws
Description: Websocket packages of galatajs framework
Author: Sami Salih İBRAHİMBAŞ
Latest version: 0.1.1

<p align="center">
<br>
<img src="https://avatars.githubusercontent.com/u/108695351?s=200&v=4" width="128" height="128">
</p>
<h3 align="center">@galatajs/ws</h3>
<p align="center">
  Websocket package of <code>galatajs</code> framework. 
</p>
npm package: @galaxar/feat-db
Description: Common dbms features
Author: Rockie Guo
Latest version: 1.3.1

# @galaxar/feat-db

Datasource features set

## Features

-   prisma

## Prisma

### Config

```json
{
    "prisma": { modelPath, ttlCacheService, datasources, log }
}
```

### Usage

```js
const prisma = app.getService('prisma');
```

### Prisma helpers

-   $pushQuery - Returns a new where with specified condition merged into where, will merge same keys into an AND array

-   $pushOrQuery - Returns a new where with specified condition merged into where, will merge same keys into an OR array

-   $model - Returns a business logic model from modelPath

```js
//<modulePath>\User.js
class User {
    constructor(prisma) {
        this.model = prisma.user;
    }

    async upsert_(input) {
        const { email, ...others } = input;

        return this.model.upsert({
            where: { email },
            create: input,
            update: others,
        });
    }
}

export default User;
```
Usage
```js
const prisma = app.getService('prisma');
const User = prisma.$model('user');

await User.upsert_({
    email: 'test999@email.com',
    name: 'test999',                
});
```

-   $setupCache(this, entries) - Setup cache (list or map)
    -   $setupCache should be called in the Model's constructor after model is assigned
    -   entries is a map of cache key to { where, type, [mapByKey] } 
    -   Model with $setupCache has the following two methods:
        -   async cache_(key) - fetch data from cache by key, run query if cache missed
        -   resetCache(key)
```js
//<modulePath>\User.js
class User {
    constructor(prisma) {
        this.model = prisma.user;
        prisma.$setupCache(this, {
            'list': { where: {}, type: 'list' },
            'map': { where: {}, type: 'map', mapByKey: 'email' },
        });
    }
}

export default User;
```
Usage
```js
const prisma = app.getService('prisma');
const User = prisma.$model('UserWithCache');

const map = await User.cache_('map');
const list = await User.cache_('list');
```

### Model helpers

-   `retryCreate_(createOptions /* the same as prisma */, dataFactory /* if duplicate, the factory will be call to generate new creation data */)`

```js

const nanoid = app.getService('nanoid');

const session = await LoginSession.retryCreate_(
    {
        data: {
            id: nanoid.next(),
            userId: user.id,
            expiresAt: new Date(expiresAt),
            lastHeartbeat: nowDate,
        },
    },
    (input) => ({
        ...input,
        data: {
            ...input.data,
            id: nanoid.next(),
        },
    })
);
```
npm package: @galaxar/feat-utils
Description: Node common application utility features
Author: Rockie Guo
Latest version: 1.2.3

# @galaxar/feat-uitls

Common utility features to be used @galaxar/app and @galaxar/server

## Features set

-   cipher
    -   hash
    -   symmetric encryption/decryption
    -   asymmetric encryption/decryption

-   imageProcessor

-   threadPool

-   threadWorker

-   ttlMemCache

-   webSocketClient
npm package: @galaxar/jsonv
Description: JSON Validation Syntax
Author: Rockie Guo
Latest version: 1.0.6

# @galaxar/jsonv

JSON Validation Syntax

## Installation

```sh
pnpm install @galaxar/jsonv
```

## Usage that requires special attention

-   `Jvs.match(value, null)` always return true

    It does not mean to match null, which should use `{ $exist: false }` instead.

-   `Jvs.match(value, [ ... ])` means to match all jvs object in the array

    It does not mean the value to be equal to the array, which should use `{ $eq: [ ... ] }` instead.
npm package: @galaxar/jsonx
Description: JSON Expression Syntax
Author: Rockie Guo
Latest version: 1.0.6

# @galaxar/jsonx

JSON Expression

## Installation

```sh
pnpm install @galaxar/jsonx
```

## Init locales

```

```

## Rules

-   Each jxs object can only has one $operator at a level

## Wrong usage

```javascript
// If you want to check if key1 is greater than 2, below usage is wrong
// The first element will return { key1: false } which is treated as true, thus the result will be 'positive'
Jxs.evaluate(
    {
        key1: 1.5,
    },
    {
        $if: [{ key1: { $match: { $gt: 2 } } }, { $value: 'positive' }, { $value: 'non-positive' }],
    }
).should.be.eql('non-positive');

// Correct usage should be
Jxs.evaluate(
    {
        key1: 1.5,
    },
    {
        $if: [{ $match: { key1: { $gt: 2 } } }, { $value: 'positive' }, { $value: 'non-positive' }],
    }
).should.be.eql('non-positive');
```
npm package: @galaxar/server
Description: Node http server application framework
Author: Rockie Guo
Latest version: 1.0.9

# @galaxar/server

Galaxar node.js web server application framework based on @galaxar/app

## Server
A galaxar server is a @galaxar/app with serveral extensions as below.

-	engines
	-	koa (built-in)

-	serverFeatures
	-	features which is only applicable to server

-	appFeatures
	-	features which is applicable to both server and app modules

-	appRouting (one of serverFeatures)
	-	support mounting a whole app module to a route
	-	support mounting app modules in node_modules

-	routing (one of appFeatures)
	-	provide serveral kinds of built-in routers
	-	custom routers can be put under the server (or app)'s routers folder

-	middlewares (one of appFeatures)
	-	use an async middleware factory pattern to initiate middleware instance
	-	support all koa-style middlewares, most of express-style middlewares
	-	support group several middlewares together to become a new middleware by the `middlewareFactory`` feature

## App module
-	A galaxar app module is also a @galaxar/app hosted by a galaxar server. 
-	A app module can be mounted under a specified route in a galaxar server through the `appRouting` feature.

## Project structure

-	`<server root>`
	-	conf			`server.default.json`
	-	server			transpiled files from `src`
	-	src
		-	actions		rule/module router controllers
		-	features	features/services
		-	middlewares	middleware factories
		-	resources	gaml/rest router controllers
		-	index.js	entry file of the server
	-	apps			app modules
		-	conf		`app.default.json`
		-	server		transpiled files from `src`
		-	src			similar to the server source folder except the index.js file
	-	node_modules	packages and packed app modules
	-	...other server-level folders, e.g. prisma

## License

  MIT
npm package: @galaxar/tester
Description: Node application unit test framework
Author: Rockie Guo
Latest version: 1.0.6

## @galaxar/tester

### Features

* Support coverage test of @galaxar/server applicaiton 
* [x] Support allure report
* [x] Support async dump for debugging application hanging issue caused by pending async event
* Support @galaxar/app worker 
* Support JSON Validation Syntax
* [x] Support configurable test case on/off switches
* Support profiling and benchmark
* Support test step and progress record
* Support job pipeline for long-run test

### Interface

gobal object `gxt`

-   `startWorker_(app => {/* test to run */}, options)`: // start a worker

-   `withHttpClient_(serverName?, [authenticator], app => {/* test to run */}, [options])`: // start a worker and create a http client

-   `benchmark_(mapOfMethods, verifier, payload)`: // run benchmark againest several different implementions of the same purposes

-   `step_(name, fn)`: // test step

-   `param(name, value)`: // record param used in a test into test report

-   `attach(name, value)`: // attach object produced during a test into test report
npm package: @galaxar/types
Description: Galaxar Semantic Data Types
Author: Rockie Guo
Latest version: 1.1.3

# Semantic Types

## Conventions

### Type Interface

```
name: "type name",
alias: ["type alias"],
defaultValue: null,

sanitize: (value, meta, i18n, path) => sanitized,
serialize: (value, meta) => string
```

### Common Type Meta

-   {boolean} rawValue - Keep raw value, do not transform
-   {boolean} optional - No error throw if value is null and default is null
-   {any} default = Default value if value is null

### Enumerable Types

-   bigint
-   integer
-   number
-   text

### Validation Error

-   message
-   status = 400
-   code = E_INVALID_DATA
-   info = { value, meta, [i18n], [path] }

### Plugins

-   datetimeParser
-   bigintWriter
-   preProcess - [sync/async] (value, meta, opts: { rawValue, i18n, path }) => [ finished, processedValue ] or [ false ]
-   postProcess - [sync/async] (value, meta, opts: { rawValue, i18n, path }) => processedValue

Note: if preProcess or postProcess is async function, sanitize_ should be called instead of sanitize
npm package: @galaxar/utils
Description: Galaxar JavaScript Utility Library for both Node.js and browser
Author: Rockie Guo
Latest version: 1.0.9

# @galaxar/utils

## test register for adding missing should assertion helpers into chai

Add below lines in `.mocharc.js` after `@babel/register` or `@swc-node/register`

E.g.
```
require('@swc-node/register');
require('@galaxar/utils/testRegister');
```

### some difference between should and chai

```
// left: should, right: chai
should.be.true() => should.be.true
should.be.false() => should.be.false
should.be.ok() => should.be.ok
```