open-index/open-npm huggingface dataset:
npm package: @kaoscript/source-generator
Description: Generate source code from AST.
Author: Baptiste Augrain
Latest version: 0.1.0

[@kaoscript/source-generator](https://github.com/kaoscript/source-generator)
=================================================================

[![kaoscript](https://img.shields.io/badge/language-kaoscript-orange.svg)](https://github.com/kaoscript/kaoscript)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![NPM Version](https://img.shields.io/npm/v/@kaoscript/source-generator.svg?colorB=green)](https://www.npmjs.com/package/@kaoscript/source-generator)
[![Dependency Status](https://badges.depfu.com/badges/0276bd7a8ad854891c7b38b406107a90/overview.svg)](https://depfu.com/github/kaoscript/source-generator)
[![Build Status](https://travis-ci.org/kaoscript/source-generator.svg?branch=master)](https://travis-ci.org/kaoscript/source-generator)
[![CircleCI](https://circleci.com/gh/kaoscript/source-generator/tree/master.svg?style=shield)](https://circleci.com/gh/kaoscript/parser/tree/source-generator)
[![Coverage Status](https://img.shields.io/coveralls/kaoscript/source-generator/master.svg)](https://coveralls.io/github/kaoscript/source-generator)

Generate source code from AST.

License
-------

[MIT](http://www.opensource.org/licenses/mit-license.php) &copy; Baptiste Augrain
npm package: @kaoscript/source-writer
Description: Helpers to write source code.
Author: Baptiste Augrain
Latest version: 0.2.0

[@kaoscript/source-writer](https://github.com/kaoscript/source-writer)
=================================================================

[![kaoscript](https://img.shields.io/badge/language-kaoscript-orange.svg)](https://github.com/kaoscript/kaoscript)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
![Dependencies](https://img.shields.io/david/kaoscript/source-writer.svg)

Helpers to write source code.

License
-------

[MIT](http://www.opensource.org/licenses/mit-license.php) &copy; Baptiste Augrain
npm package: @kaoscript/target-commons
Description: commons targets for kaoscript compiler
Author: Baptiste Augrain
Latest version: 0.2.0

[@kaoscript/target-commons](https://github.com/kaoscript/target-commons)
=================================================================

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
![Dependencies](https://img.shields.io/david/kaoscript/target-commons.svg)

commons targets for [kaoscript](https://github.com/kaoscript/kaoscript) compiler

License
-------

Copyright &copy; 2016 Baptiste Augrain

Licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
npm package: @kaoscript/test-import
Description: mockup package to test import
Author: Baptiste Augrain
Latest version: 0.2.2

[@kaoscript/test-import](https://github.com/kaoscript/test-import)
=================================================================

[![kaoscript](https://img.shields.io/badge/language-kaoscript-orange.svg)](https://github.com/kaoscript/kaoscript)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![NPM Version](https://img.shields.io/npm/v/@kaoscript/test-import.svg?colorB=green)](https://www.npmjs.com/package/@kaoscript/test-import)

mockup package to test import

License
-------

Copyright &copy; 2016 Baptiste Augrain

Licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
npm package: @kaoscript/util
Description: Utilities for kaoscript
Author: Baptiste Augrain
Latest version: 0.1.1

[@kaoscript/util](https://github.com/kaoscript/util)
=================================================================

[![kaoscript](https://img.shields.io/badge/language-kaoscript-orange.svg)](https://github.com/kaoscript/kaoscript)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
![Dependencies](https://img.shields.io/david/kaoscript/util.svg)

Utilities for the compiler [kaoscript](https://github.com/kaoscript/kaoscript)

License
-------

[MIT](http://www.opensource.org/licenses/mit-license.php) &copy; Baptiste Augrain
npm package: @kaoscript/webpack-loader
Description: kaoscript loader module for webpack
Author: Baptiste Augrain
Latest version: 0.3.0

[@kaoscript/webpack-loader](https://github.com/kaoscript/webpack-loader)
=================================================================

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
![Dependencies](https://img.shields.io/david/kaoscript/webpack-loader.svg)

[kaoscript](https://github.com/kaoscript/kaoscript) loader module for [webpack](https://webpack.github.io/)

Usage
-----

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

Recommended configuration
-------------------------

### ES6 Browsers

``` javascript
{
	module: {
		loaders: [
			{
				test: /\.ks$/,
				loader: '@kaoscript/webpack-loader?target=es6'
			}
		]
	},
	resolve: {
		extensions: ['', '.js', '.ks']
	}
}
```

### ES5 Browsers

``` javascript
{
	module: {
		loaders: [
			{
				test: /\.ks$/,
				loader: '@kaoscript/webpack-loader?target=es5'
			}
		]
	},
	resolve: {
		extensions: ['', '.js', '.ks']
	}
}
```

License
-------

Copyright &copy; 2016 Baptiste Augrain

Licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
npm package: @kaosdlanor/vue-reactivity
Description: A simple Vue 3 reactivity library
Author: Daniel Olivier
Latest version: 1.0.2

# vue-reactivity

A library used to simplify or empower Vue 3 data reactivity

## Installation

Install with npm:

```bash
npm i @kaosdlanor/vue-reactivity
```

## Overview

Currently this module only exports the method `useScopePerKey()` which can be used to react to changes in an object in a more fine-grained manner
npm package: @kaotypr/liblog
Description: Configurable logging utility for JavaScript/TypeScript libraries with scope-based logging control
Author: kao
Latest version: 1.1.4

# @kaotypr/liblog
A lightweight and configurable logging utility for JavaScript/TypeScript libraries with scope-based logging control.

## Installation
```bash
npm install @kaotypr/liblog
```

## Usage
```typescript
import { createLiblog, LiblogConfig } from '@kaotypr/liblog';

// Initialize with scopes
type Scopes = 'api' | 'auth';
const config = new LiblogConfig<Scopes>();

// Create loggers
const defaultLog = createLiblog(config);
const apiLog = createLiblog(config, { scope: 'api' });
const authLog = createLiblog(config, { 
  scope: 'auth',
  scopePrefix: (scope) => `${scope.toUpperCase()} >>` // Custom prefix
});

// Enable logging for specific scopes
config.set(['api', 'auth'], {
  info: true,
  error: true
});

// Use loggers
defaultLog.debug('Debug message');  // No output, as default is false for all scopes
apiLog.info('Request received');    // [api]: Request received
authLog.error('Login failed');      // AUTH >> Login failed

// Configure log level config from the logger
apiLog.config.set({ info: false });
```

## Features
- Scope-based logging with TypeScript support
- Configurable log levels: verbose, info, warning, error, dir, table
- Customizable scope prefixes
- Global and instance-level configuration

## Documentation
For detailed documentation and examples, visit our [documentation](https://github.com/kaotypr/liblog/blob/main/DOCS.md).

## License
MIT
npm package: @kaotypr/ll
Description: A super lightweight logger library focused on supporting debugging. Zero dependencies, customizable log levels, and a clean, simple API for console output formatting.
Author: Adhitya Yosua Sanjaya Andaria
Latest version: 0.0.3

# @kaotypr/ll

A super lightweight logger library focused on supporting debugging. Zero dependencies, customizable log levels, and a clean, simple API for console output formatting.

## Installation

```bash
npm install @kaotypr/ll
```

## Quick Start

```typescript
import { Logger, LogLevel } from '@kaotypr/ll'

const logger = new Logger({
  level: LogLevel.info,    // Set minimum log level
  timestamps: true,        // Enable timestamps
  prefix: '[MyApp]'        // Add custom prefix
})

logger.info('Server started')
// Output: [2024-03-14T12:00:00.000Z] [MyApp] Server started

logger.configure({
  timestamps: false,
  prefix: 'LL: ',
})

logger.box('Welcome to MyApp!')
// Output:
// ┌──────────────────────────────────────────────────────┐
// │              LL: Welcome to MyApp!                   │
// └──────────────────────────────────────────────────────┘
```

For detailed usage and API documentation, see [DOCS.md](https://github.com/kaotypr/ll/blob/main/DOCS.md)
npm package: @kaoyaya/fe-eolinker-api-generator
Description: eolinker-api-generator
Author: ltinyho
Latest version: 1.6.5

eolinker接口api代码生成
查看test/test.js 


// 生成的xhr
```js
function createEntity({ name, stock, cost, categoryID, storehose }) {
  return xhr({
    method: 'post',
    headers:{"Content-Type":"multipart/form-data"},
    url: `/api/order/entity/create`,
    data: { name, stock, cost, categoryID, storehose },
    custom:arguments[1] // 自定义参数
  })
}
```

readline-sync必须要在terminal或者shell中run api
不然会报无法监听TYY的错误

```
手写实现存在异步问题
// function tipsToContinue() {
//   const rl = readline.createInterface({
//     input: process.stdin,
//     output: process.stdout,
//   });
//   showTip = false;
//   rl.question('当前代码中含有要使用nuxtMode模式生成的接口，是否继续?(Y/N)', function (answer) {
//     if (answer.toLowerCase() === 'y') {
//       rl.close();
//     } else if (answer.toLowerCase() === 'n') {
//       process.exit(0);
//     }
//   });
//   // close事件监听,不加close，则不会结束
//   rl.on('close', function () {
//     // 结束程序
//     process.exit(1);
//   });
// }
```
npm package: @kaoyaya/miniprogram_package
Description: 小程序自定义组件开发模板：
Latest version: 1.0.28

# miniprogram-custom-component

小程序自定义组件开发模板：

* 支持使用 less 语法编写 wxss 文件
* 使用 webpack 构建 js
* 支持自定义组件单元测试
* 支持 eslint
* 支持多入口构建

## 使用

* 使用[命令行工具](https://github.com/wechat-miniprogram/miniprogram-cli)进行初始化
* 直接从 github 上 clone 下来

## 开发

1. 安装依赖：

```
npm install
```

2. 执行命令：

```
npm run dev
```

默认会在包根目录下生成 miniprogram\_dev 目录，src 中的源代码会被构建并生成到 miniprogram\_dev/components 目录下。如果需要监听文件变化动态构建，则可以执行命令：

```
npm run watch
```

> ps: 如果 minirpogram\_dev 目录下已存在小程序 demo，执行`npm run dev`则不会再将 tools 下的 demo 拷贝到此目录下。而执行`npm run watch`则会监听 tools 目录下的 demo 变动并进行拷贝。

3. 生成的 miniprogram\_dev 目录是一个小程序项目目录，以此目录作为小程序项目目录在开发者工具中打开即可查看自定义组件被使用的效果。

4. 进阶：

* 如果有额外的构建需求，可自行修改 tools 目录中的构建脚本。
* 内置支持 webpack、less 语法、sourcemap 等功能，默认关闭。如若需要可以自行修改 tools/config.js 配置文件中相关配置。
* 内置支持多入口构建，如若需要可自行调整 tools/config.js 配置文件的 entry 字段。
* 默认开启 eslint，可自行调整规则或在 tools/config.js 中注释掉 eslint-loader 行来关闭此功能。

## 发布

> ps: 发布前得确保已经执行构建，小程序 npm 包只有构建出来的目录是真正被使用到的。

1. 如果还没有 npm 帐号，可以到[ npm 官网](https://www.npmjs.com/)注册一个 npm 帐号。
2. 在本地登录 npm 帐号，在本地执行：

```
npm adduser
```

或者

```
npm login
```

3. 在已完成编写的 npm 包根目录下执行：

```
npm publish
```

到此，npm 包就成功发布到 npm 平台了。

> PS：一些开发者在开发过程中可能修改过 npm 的源，所以当进行登录或发布时需要注意要将源切回 npm 的源。

## 目录结构

以下为推荐使用的目录结构，如果有必要开发者也可以自行做一些调整:

```
|--miniprogram_dev // 开发环境构建目录
|--miniprogram_dist // 生产环境构建目录
|--src // 源码
|   |--components // 通用自定义组件
|   |--images // 图片资源
|   |
|   |--xxx.js/xxx.wxml/xxx.json/xxx.wxss // 暴露的 js 模块/自定义组件入口文件
|
|--test // 测试用例
|--tools // 构建相关代码
|   |--demo // demo 小程序目录，开发环境下会被拷贝生成到 miniprogram_dev 目录中
|   |--config.js // 构建相关配置文件
|
|--gulpfile.js
```

> PS：对外暴露的 js 模块/自定义组件请放在 src 目录下，不宜放置在过深的目录。另外新增的暴露模块需要在 tools/config.js 的 entry 字段中补充，不然不会进行构建。

## 测试

* 执行测试用例：

```
npm run test
```

* 执行测试用例并进入 node inspect 调试：

```
npm run test-debug
```

* 检测覆盖率：

```
npm run coverage
```

测试用例放在 test 目录下，使用 **miniprogram-simulate** 工具集进行测试，[点击此处查看](https://github.com/wechat-miniprogram/miniprogram-simulate/blob/master/README.md)使用方法。在测试中可能需要变更或调整工具集中的一些方法，可在 test/utils 下自行实现。

## 其他命令

* 清空 miniprogram_dist 目录：

```
npm run clean
```

* 清空 miniprogam_dev 目录：

```
npm run clean-dev
```
npm package: @kapaai/react-sdk
Description: [![npm version](https://img.shields.io/npm/v/@kapaai/react-sdk.svg)](https://www.npmjs.com/package/@kapaai/react-sdk) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
Latest version: 0.9.6

# Kapa React SDK

[![npm version](https://img.shields.io/npm/v/@kapaai/react-sdk.svg)](https://www.npmjs.com/package/@kapaai/react-sdk)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

> Build AI-powered chat interfaces that answer questions from your knowledge base.

## What is Kapa.ai?

[kapa.ai](https://kapa.ai) is a platform that turns your documentation, knowledge base, and support content into an AI assistant. It enables your users to get instant, accurate answers drawn directly from your own content.

## SDK Overview

This React SDK allows you to easily integrate Kapa-powered chat functionality into your React applications. Add a few components to your app and give your users the ability to chat with an AI that knows your product.

## Quick Links

- [📚 Official Documentation](https://docs.kapa.ai/dev/sdk/)
- [💻 Demo Repository](https://github.com/kapa-ai/react-sdk-demo)

## Installation

```bash
npm install @kapaai/react-sdk
```

## Basic Usage

```jsx
import { KapaProvider, useChat } from "@kapaai/react-sdk";

// Wrap your app with the provider
function App() {
  return (
    <KapaProvider integrationId="your-integration-id">
      <YourChatInterface />
    </KapaProvider>
  );
}

// Use the hook in your components
function YourChatInterface() {
  const { conversation, submitQuery, isGeneratingAnswer } = useChat();

  // Build your chat UI...
}
```

For detailed usage instructions and API reference, see the [official documentation](https://docs.kapa.ai/dev/sdk/).
npm package: @kapable/sdk
Description: TypeScript client SDK for the Kapable platform API
Author: Kapable
Latest version: 0.1.0

# @kapable/sdk

Official TypeScript SDK for the [Kapable](https://kapable.dev) platform.

## Installation

```bash
npm install @kapable/sdk
# or
bun add @kapable/sdk
```

## Quick Start

```typescript
import { KapableClient } from '@kapable/sdk';

const client = new KapableClient({
  baseUrl: 'https://api.kapable.dev',
  apiKey: 'your-api-key',
});

// List projects
const projects = await client.projects.list();

// Query data
const rows = await client.data.query('my-project', 'users', {
  limit: 10,
  orderBy: 'created_at',
  order: 'desc',
});

// Manage feature toggles
const toggle = await client.toggles.evaluate('my-project', 'new-checkout');
```

## Features

- Full TypeScript support with complete type definitions
- Dual ESM/CJS module support
- Built-in error handling with retry support
- All Kapable API endpoints covered

## API Reference

See the [Kapable Documentation](https://developer.kapable.dev) for full API reference.

## License

MIT
npm package: @kapeboi/number-formatter
Description: Number formatter (NPM package test really... shh)
Author: Dom Walker
Latest version: 0.0.2

Number Formatter
[![Build Status](https://travis-ci.org/domwlkr/number-formatter.svg?branch=master)](https://travis-ci.org/domwlkr/number-formatter)
[![Coverage Status](https://coveralls.io/repos/github/domwlkr/number-formatter/badge.svg?branch=master)](https://coveralls.io/github/domwlkr/number-formatter?branch=master)
=========

A small library that adds commas to numbers

## Installation

    `npm install @kapeboi/number-fromatter`

## Usage

        var numFormatter = require('@kapeboi/number-formatter');

        var fromattedNum = numFormatter(35666);

    Output should be `35,666`

## Tests

    `npm test`

## Contibution

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
npm package: @kaperskyguru/adonis-cache
Description: Adonis Cache Package
Author: Solomon Eseme
Latest version: 2.1.1

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

## Table of contents

- [Adonis Cache](#adonis-cache)
  - [Installation](#installation)
  - [Usage](#usage)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Adonis Cache

> Cache provider for AdonisJS 5

[![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]

This packages makes it seamless to implement any Caching strategy in AdonisJS 5 applications.

## Installation

Install the package using either npm or yarn:

```bash
npm i @kaperskyguru/adonis-cache
# or
yarn add @kaperskyguru/adonis-cache
```

Then, configure the package using the `invoke` command:

```bash
node ace invoke @kaperskyguru/adonis-cache
```

This package works exactly the way Laravel Cache package works with ease of use and effortless to set up.

```txt
// .env

CACHE_DRIVER=file // defaults to FILE

```

## Usage

```ts
import Cache from '@ioc:Kaperskyguru/Adonis-cache'

let posts = await Cache.remember('_posts_', 60, async function () {
  return await Post.all()
})
```

## Available Methods

- **_Cache.has(name: string):_** Checks if specified name is already Cached.
- **_Cache.get(name: string):_** Retrieves a Cached content by name.
- **_Cache.set(name: string, data: any, duration: number):_** Cached a particular content with assigned name.
- **_Cache.delete(name: string):_** Deletes a Cache by name.
- **_Cache.update(name: string, data: any, duration: number):_** Updates a Cache by name.
- **_Cache.remember(name: string, duration: number, callback: Function):_** Caches content with duration.
- **_Cache.rememberForever(name: string, callback: Function):_** Caches content without duration.
- **_Cache.many(keys: Array<string>):_** Retrieves all cached content specified into an array.
- **_Cache.setMany(data: object, minutes: number):_** Caches many content mapped by name at once.

Currently adding more, have any contribution? send a PR.

This package is built as a similarity to [`laravel-cache`](https://laravel.com/docs/8.x/cache). You can learn more about the methods available there.

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]: "typescript"
[npm-url]: https://www.npmjs.com/package/@kaperskyguru/adonis-cache 'npm'
[license-url]: LICENSE.md 'license'
npm package: @kapeta/blockctl
Description: Kapeta Command Line Utility
Author: Henrik Hofmeister
Latest version: 0.1.5

# Kapeta command line utility

Introduces using kapeta through blockctl commands. 

The purpose of ```blockctl``` is to make it simple to automate things 
either locally or on servers - 
as well as giving people comfortable with terminals a way to quickly perform
certain actions.

## Install / Update:
```bash
npm i @kapeta/blockctl -g
``` 

## Use:
```bash
blockctl help
``` 

## Remove
```bash
npm remove @kapeta/blockctl -g
``` 

## Structure
The tool itself is built up of a series of "commands". Each command is
its own module except for a few built-in core commands. 

### Installing or updating commands
It uses the NPM registry to install and update commands - and to install a new command
you can simply do 
```bash
blockctl install you-npm-command-module
```
or the short version
```bash
blockctl i you-npm-command-module
```

Upgrading is similar - simply write:
```bash
blockctl upgrade you-npm-command-module
```

### Extending
To implement a command for blockctl we use
[@kapeta/blockctl-command](https://github.com/kapetacom/blockctl-command)
and the module must then be published as an NPM module for blockctl to install it

**blockctl** expects a ```command``` property in the ```package.json``` file
of the command. This command property should contain the *name* of your command -
e.g.
```json
{
  "name": "@kapeta/blockctl-command-codegen",
  "command": "codegen",
  ...
} 
```

Typically you'd want to not publish and download all the time during development. 
for that purpose you can navigate to the folder in which you are developing a command 
and run 
```bash
blockctl link [command-name]
```
The optional "command-name" parameter is to override what is in the 
```package.json``` file as mentioned before - or if nothing is there to 
specify one.

blockctl will then create a symlink - very similar to 
how ```npm link``` works - which allows it to find your local version of
the command.
npm package: @kapeta/blockctl-command
Description: SDK for making commands for the kapeta CLI utility
Author: Henrik Hofmeister
Latest version: 0.0.9

### Command SDK for Kapeta command line utility

Provides a simple wrapper around the commander module to ensure consistency
in the kapeta CLI

#### Example use:
```javascript
const KapetaCommand = require('@kapeta/blockctl-command');
const packageData = require('./package');

// Create the subsection command object.
// This is made available through "blockctl mysubsection"
const command = new KapetaCommand('mysubsection', packageData.version);

// Add handler for sub command - See commander docs for more
// $: blockctl subsection subcommand
command.program()
    .command('subcommand')  
    .action(() => doSomething());
                
//Tell the kapeta command to parse arguments and run actions
command.start();
```
npm package: @kapeta/blockctl-command-registry
Description: Push and pull from Kapeta registry
Latest version: 0.0.36

# blockctl "registry" command

Enabled pushing, cloning, and pull image from kapeta registry

## Auto-versioning
The registry command automatically calculates the next semantic version whenever you push. 
This is done by comparing the block versions and the logic is as follows:
- If nothing is added, updated or removed in your kapeta.yml it will increment the patch version
- If nothing is updated or removed - but some things have been added in your kapeta.yml it will increment the minor version
- If anything is updated or removed in your kapeta.yml it will increment the major version

## Versioning validation
If you disable auto-versioning (```--auto-versioning false``) the command will still verify your version and perform 
the following checks:
- Ensure the version does not exist
- Verify your new version against the latest version - to make sure it follows proper semantic versioning (See auto-versioning paragraph for logic)    

## Configuration
The registry command has its own registry file in ```~/.blockctl/registry.yml```. The configuration
determines what kapeta and docker registry to use.

Example configuration can be seen below:
```yaml
registry:
  url: https://registry.kapeta.com
  organisationId: my-company
  docker:
    registry: my-private-docker-repo.com
```

The above configuration will result in all docker images being prefixed with ```my-private-docker-repo.com/my-company/```. 
E.g. for a block named ```users``` the docker image would be named ```my-private-docker-repo.com/my-company/users```. 

---

To use the default docker registry (DockerHub) omit the docker registry configuration:
```yaml
registry:
  url: https://registry.kapeta.com
  organisationId: my-company
```

```organisationId``` is used as part of the naming for docker images - this should be equivalent to your
DockerHub organisation name.
npm package: @kapeta/codegen
Description: Kapeta code generator module
Author: Henrik Hofmeister
Latest version: 1.6.1

# Kapeta Code generator module

Uses code generator targets to generate code for blocks in any language and framework

Currently only able to generate code for "Block YML" using BlockCodeGenerator, but could easily be extended to handle more types

The library pulls together the different parts involved in code generation:

1. Loading code generation targets (languages)
1. Actually generating the code
1. Writing it to files

## Basic usage

```javascript
//Create a code generator for a block YML structure
//This will load the correct codegen-target based on the configuration in the YML
const codeGenerator = new BlockCodeGenerator(blockYML);

//Generate the code itself - output will contain file names, content and
//file permissions
const output = await codeGenerator.generate();

//Code writer takes the generated output and writes it to disk
//Base dir is the is prepended to all paths
const writer = new CodeWriter(baseDir);

//Will perform the actual writes to disk
writer.write(output);
```

## Language Targets

Language targets is what defines how a particular data structure should be expressed in a given language / framework / context

This library uses a "Target Registry" to contain information about what language targets are available.

The **default** target registry is available as "registry" in the export from this library. If you register targets to this registry it will automatically be picked up by the rest of the code generation framework

```javascript
const { registry } = require('@kapeta/codegen');
```

To register a language target we do this:

```javascript
registry.register('target-identifier', TargetClass);
```

TargetClass is expected to extend `Target` which is found in the `@kapeta/codegen-target` module: https://github.com/kapetacom/codegen-target/blob/master/src/Target.js

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
npm package: @kapeta/electron-ide-opener
Description: Electron IDE opener - extracted from Github Desktop
Author: Kapeta
Latest version: 1.1.0

# electron-ide-opener
Small library for detecting and opening a file or folder in local IDEs.

Meant to be used in Electron apps, but can be used in any Node.js app.

This is a copy / extract from [Github Desktop](https://github.com/desktop/desktop/tree/development/app/src/lib/editors)

## Install

```
npm install --save @kapeta/electron-ide-opener
```

## Usage

Using ESM:
```js
import { getAvailableEditors, findEditorOrDefault } from '@kapeta/electron-ide-opener';

const editors = await getAvailableEditors();
const vsCode = findEditorOrDefault('Visual Studio Code');
const defaultEditor = findEditorOrDefault(null);
```

Using CJS:
```js
const { getAvailableEditors, findEditorOrDefault } = require('@kapeta/electron-ide-opener');

const editors = await getAvailableEditors();
const vsCode = findEditorOrDefault('Visual Studio Code');
const defaultEditor = findEditorOrDefault(null);
```
npm package: @kapeta/eslint-config
Description: Shared ESLint config
Latest version: 0.7.0

# Shared ESLint configuration for React projects written in TypeScript

This [ESLint](https://eslint.org/) configuration is tailored for projects written in [TypeScript](https://www.typescriptlang.org/) and [React](https://reactjs.org/). It deactivates all formatting rules of ESLint to let [Prettier](https://prettier.io/) be in charge of formatting.

## Integrate into new project

1. Install this package as a devDependency

    ```sh
    # with Yarn
    $ yarn add -D @kapeta/eslint-config

    # with npm
    $ npm i -D @kapeta/eslint-config

    # with pnpm
    $ pnpm add -D @kapeta/eslint-config
    ```

2. Install peer dependencies of this package in your project as devDependencies

    You can make use of the tool [install-peerdeps](https://github.com/nathanhleung/install-peerdeps):

    ```sh
    # with Yarn
    $ yarn dlx install-peerdeps --dev @kapeta/eslint-config

    # with npm
    $ npx install-peerdeps --dev @kapeta/eslint-config

    #with pnpm
    $ pnpm dlx install-peerdeps --dev @kapeta/eslint-config
    ```

3. Use ESLint config in your project

    Create a `tsconfig.eslint.json` file in project root with the following content:

    ```json
    {
        "extends": "./tsconfig.json",
        "include": [
            ".eslintrc.js"
            // Add other files that should be linted (probably the same as in tsconfig.json)
        ]
    }
    ```

    Create a `.eslintrc.js` file in project root with the following content:

    ```js
    module.exports = {
        extends: ['@kapeta/eslint-config'],
        env: {
            node: true,
        },
        parserOptions: {
            project: `${__dirname}/tsconfig.eslint.json`,
            tsconfigRootDir: __dirname,
        },
    };
    ```
npm package: @kapeta/kap
Description: Kapeta Command Line Utility
Author: Kapeta
Latest version: 0.2.30

# Kapeta command line utility

Introduces using kapeta through command line commands. 

The purpose of ```kap``` is to make it simple to automate things 
either locally or on servers - 
as well as giving people comfortable with terminals a way to quickly perform
certain actions.

## Install / Update:
```bash
npm i @kapeta/kap -g
``` 

## Use:
```bash
kap help
``` 

## Remove
```bash
npm remove @kapeta/kap -g
``` 

## Structure
The tool itself is built up of a series of "commands". Each command is
its own module except for a few built-in core commands. 

### Installing or updating commands
It uses the NPM registry to install and update commands - and to install a new command
you can simply do 
```bash
kap install you-npm-command-module
```
or the short version
```bash
kap i you-npm-command-module
```

Upgrading is similar - simply write:
```bash
kap upgrade you-npm-command-module
```

### Extending
To implement a command for kap we use
[@kapeta/kap-command](https://github.com/kapetacom/cli-kap-command)
and the module must then be published as an NPM module for kap to install it

**kap** expects a ```command``` property in the ```package.json``` file
of the command. This command property should contain the *name* of your command -
e.g.
```json
{
  "name": "@kapeta/kap-command-codegen",
  "command": "codegen",
  ...
} 
```

Typically you'd want to not publish and download all the time during development. 
for that purpose you can navigate to the folder in which you are developing a command 
and run 
```bash
kap link [command-name]
```
The optional "command-name" parameter is to override what is in the 
```package.json``` file as mentioned before - or if nothing is there to 
specify one.    

kap will then create a symlink - very similar to 
how ```npm link``` works - which allows it to find your local version of
the command.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
npm package: @kapeta/kap-codegen
Description: Command for generating code from kapeta YML files
Author: Kapeta
Latest version: 1.3.14

# Codegen command for kap tool

Allows generating code via command line. 

Use via ```kap``` - e.g. ```kap codegen```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
npm package: @kapeta/kap-command
Description: SDK for making commands for the kapeta CLI utility
Author: Henrik Hofmeister
Latest version: 1.0.0

### Command SDK for Kapeta command line utility

Provides a simple wrapper around the commander module to ensure consistency
in the kapeta CLI

#### Example use:
```javascript
const KapetaCommand = require('@kapeta/kap-command');
const packageData = require('./package');

// Create the subsection command object.
// This is made available through "kap mysubsection"
const command = new KapetaCommand('mysubsection', packageData.version);

// Add handler for sub command - See commander docs for more
// $: kap subsection subcommand
command.program()
    .command('subcommand')  
    .action(() => doSomething());
                
//Tell the kapeta command to parse arguments and run actions
command.start();
```
npm package: @kapeta/kap-config
Description: Maps kapeta env vars to dotenv and/or config files
Author: Kapeta
Latest version: 1.1.1

# Codegen command for kap tool

Allows generating code via command line.

Use via `kap` - e.g. `kap codegen`

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
npm package: @kapeta/kap-registry
Description: Push and pull from Kapeta registry
Author: Kapeta
Latest version: 1.6.13

# kap "registry" command

Enabled pushing, cloning, and pull image from kapeta registry

## Auto-versioning

The registry command automatically calculates the next semantic version whenever you push.
This is done by comparing the block versions and the logic is as follows:

- If nothing is added, updated or removed in your kapeta.yml it will increment the patch version
- If nothing is updated or removed - but some things have been added in your kapeta.yml it will increment the minor version
- If anything is updated or removed in your kapeta.yml it will increment the major version

## Versioning validation

If you disable auto-versioning (``--auto-versioning false`) the command will still verify your version and perform
the following checks:

- Ensure the version does not exist
- Verify your new version against the latest version - to make sure it follows proper semantic versioning (See auto-versioning paragraph for logic)

## Configuration

The registry command has its own registry file in `~/.kapeta/registry.yml`. The configuration
determines what kapeta and docker registry to use.

Example configuration can be seen below:

```yaml
registry:
  url: https://registry.kapeta.com
  organisationId: my-company
  docker:
    registry: my-private-docker-repo.com
```

The above configuration will result in all docker images being prefixed with `my-private-docker-repo.com/my-company/`.
E.g. for a block named `users` the docker image would be named `my-private-docker-repo.com/my-company/users`.

---

To use the default docker registry (DockerHub) omit the docker registry configuration:

```yaml
registry:
  url: https://registry.kapeta.com
  organisationId: my-company
```

`organisationId` is used as part of the naming for docker images - this should be equivalent to your
DockerHub organisation name.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
npm package: @kapeta/prettier-config
Description: Shared Prettier config
Latest version: 0.6.2

# Shared Prettier configuration

This shared [Prettier](https://prettier.io/) configuration changes some of the default [options](https://prettier.io/docs/en/options.html).

## Integrate into new project

1.  Install this package as a devDependency

    ```sh
    # with Yarn
    $ yarn add -D @kapeta/prettier-config

    # with npm
    $ npm i -D @kapeta/prettier-config

    # with pnpm
    $ pnpm add -D @kapeta/prettier-config
    ```

2.  Install peer dependencies of this package in your project as devDependencies

    You can make use of the tool [install-peerdeps](https://github.com/nathanhleung/install-peerdeps):

    ```sh
    # with Yarn
    $ yarn dlx install-peerdeps --dev @kapeta/prettier-config

    # with npm
    $ npx install-peerdeps --dev @kapeta/prettier-config

    # with pnpm
    $ pnpm dlx install-peerdeps --dev @kapeta/prettier-config
    ```

3.  Use Prettier config in your project

    Simply add the following line to your `package.json` file:

    ```
    "prettier": "@kapeta/prettier-config"`
    ```

    Or alternatively create a `.prettierrc` file in project root with the following content:

    ```
    "@kapeta/prettier-config"
    ```
npm package: @kapeta/schemas
Description: Contains the schemas for all core kapeta types.
Latest version: 3.7.2

# @kapeta/schemas

Schemas and type definitions for core kapeta types.

## Usage

Runtime schema validation:

```ts
import { validateSchema } from "@kapeta/schemas";

const errors = await validateSchema("core/plan", maybeValidPlan);

console.log(errors);
```

Compile time validation and autocomplete:

```ts
import type { Plan } from "@kapeta/schemas";
```
npm package: @kapeta/sdk-config
Description: Config API for Kapeta SDK
Author: Kapeta
Latest version: 2.4.1

# Kapeta Config API

## Description

Small library used to get configuration for kapeta instances.

Configuration will be provided by a "ConfigProvider" - which is determined by the environment in which the kapeta instance is running.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
npm package: @kapeta/sdk-nosql-mongodb
Description: MongoDB NoSQL SDK for Kapeta
Author: Kapeta
Latest version: 2.2.0

# NodeJS Mongo support for the Kapeta project

Creates a client using Prisma and connects to a MongoDB database.

Is meant to be used with Kapeta and resources defined in a NodeJS Kapeta block.

Uses Prisma to make it simple to work with MongoDB from Kapeta - and
adds support for DB migrations.

Also exposes a CLI tool called ```kap-mongodb-url``` that can be used
to generate a Mongo database URL from within a Kapeta block - for a given environment.

To learn more about Kapeta, visit [kapeta.com](https://kapeta.com).

## Usage

This library exposes a class and function that can be used to create a client. 

Normal usage is generated using Kapeta - but it can also be used directly.

### `createMongoDBClient`
Async function that creates a client using Prisma and connects to a MongoDB database

### `MongoDB`
Class that creates a client using Prisma and connects to a MongoDB database. 
It will auto-initialize once the configuration provider is ready.
npm package: @kapeta/sdk-rabbitmq
Description: RabbitMQ client for Kapeta SDK
Author: Kapeta
Latest version: 1.0.6

# Kapeta NodeJS RabbitMQ Client

This provides a RabbitMQ client for use with Kapeta.

It wraps the amqplib API and provides a simple interface for consumer and publishing messages via RabbitMQ within Kapeta.
npm package: @kapeta/sdk-rest-client
Description: REST client for Kapeta SDK
Author: Kapeta
Latest version: 3.3.0

# Kapeta NodeJS REST Client

This provides a REST client for use with Kapeta.

It wraps the NodeJS `fetch` API and provides a simple interface for making requests within Kapeta.

The specific REST clients are generated by Kapeta and will extend the RestClient class in this package.

## Usage

The RestClient class is not meant to be used directly - you should use the generated subclasses.

They will however all have the same interface which is documented here.

### Making requests

Normally you will make a request by calling the generated method on the client - however you can also make a request directly by calling the `$create` or `$execute` method on the client directly.

`client.$create` will return a Request object which you can then modify before sending it with `request.call()`.

`client.$execute` will send the request immediately.

### Headers

You can configure headers on 3 levels which you can see below.

In addition to the withHeader method there are also a few convenience methods for common headers:

-   `withContentType(contentType:string)`: Sets the Content-Type header
-   `withAuthorization(authorization:string)`: Sets the Authorization header
-   `withBearerToken(token:string)`: Sets the Authorization header with a Bearer token

#### Per request

Sets headers for this request only

```typescript
const response = await client.someMethodRequest().withHeader('X-Some-Header', 'some-value').call();
```

#### Per client

Sets headers for all requests made by this client.

**Note** the "$" in front of the method name. This is to avoid name collisions with the generated methods.

```typescript
const client = new SomeClient().$withHeader('X-Some-Header', 'some-value');
const response = await client.someMethod();
```

#### Globally:

Sets headers for all requests made by all clients

```typescript
RestClient.setDefaultHeader('X-Some-Header', 'some-value');
const client = new SomeClient();
const response = await client.someMethod();
```

### Timeouts

To configure the request timeout you have an option to do so on 3 levels:

#### Per request

```typescript
const response = await client
    .someMethodRequest()
    .withTimeout(1000) // Set timeout to 1 second
    .call();
```

#### Per client

```typescript
const client = new SomeClient().$withTimeout(1000); // Set timeout to 1 second
const response = await client.someMethod();
```

#### Globally:

```typescript
RestClient.setDefaultTimeout(1000); // Set timeout to 1 second
const client = new SomeClient();
const response = await client.someMethod();
```
npm package: @kapeta/sdk-server
Description: Express server for Kapeta SDK
Author: Kapeta
Latest version: 4.0.6

# Kapeta NodeJS Server

This provides an HTTP server for Kapeta blocks.

It wraps the express server and provides plumbing for the blocks.

The Server class is implemented in [index.ts](index.ts).

## Features

### Frontend
Serves the frontend assets for the block when applicable.

Uses webpack to build the frontend assets and serves them from memory in dev mode - with hot reloading.
Will serve the assets from the dist folder in production mode.

See the ```Server.configureFrontend()``` method for details.

The webpack server is implemented in [src/webpack.ts](src/webpack.ts).

#### Templates
The templates are managed via [express template engine](https://expressjs.com/en/guide/using-template-engines.html).
In short, express needs to know where the views live, and which renderer to use.

Make sure to include all parameters in the template, otherwise the block will not work as expected.

```typescript
// Set up webpack middleware and render methods
const DIST_DIR = Path.resolve(__dirname, "../dist");
const webpackConfig = require("../webpack.development.config");
server.configureFrontend(DIST_DIR, webpackConfig);

// Set up templating
const hbs = createHandlebars({
    extname: '.hbs',
    defaultLayout: false,
    helpers: {
        // Recommended helper to serialize values in handlebars
        toJSON: (obj: any) => JSON.stringify(obj),
    },
});
server.express().engine('hbs', hbs.engine);
server.express().set('views', Path.resolve(__dirname, "../templates"));
server.express().set('view engine', 'hbs');

server.get('/', async (req, res, next) => {
    // render the main template e.g. templates/main.hbs
    await res.renderPage('main');
});
```

Template parameters include:

- `baseURL` usually sets the HTML [base tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) in the template
- `scripts` is a list of `<script>` tags to load the app JS bundle.
- `styles` is a list of `<style>` tags to load the app CSS bundle.

### Healthcheck
The server provides a standard Kapeta healthcheck endpoint at `/.kapeta/health`.

You can disable this using the `disableHealthcheck` option.

You can also override the default health check by subclassing the Server and overriding the `configureHealthCheck` method.

### Catch-all Handler

Will add a catch-all route that will return a 418 for any request that does not match a route.

This makes it easier to determine if a request is not being handled by the server.

You can disable the catch-all route using the `disableCatchAll` option.

You can also override the default catch all by subclassing the Server and overriding the `configureCatchAll` method.

### Error handling

The server will catch any errors thrown by the routes and return a consistent response.
If the error contains a "statusCode" property it will be used as the response status code.

You can disable this using the `disableErrorHandling` option.

You can also override the default error handling by subclassing the Server and overriding the `configureErrorHandler` method.
npm package: @kapeta/sdk-sqldb-postgresql
Description: Kapeta SDK for PostgreSQL
Author: Kapeta
Latest version: 2.1.0

# NodeJS Postgres support for Kapeta

Creates a client using Prisma and connects to a Postgres database.

Is meant to be used with Kapeta and resources defined in a NodeJS Kapeta block.

Uses Prisma to make it simple to work with Postgres from Kapeta - and 
add support for DB migrations.

Also exposes a CLI tool called ```kap-postgres-url``` that can be used
to generate a PG database URL from within a Kapeta block - for a given environment.

To learn more about Kapeta, visit [kapeta.com](https://kapeta.com).

## Usage

This library exposes a class and function that can be used to create a client.

Normal usage is generated using Kapeta - but it can also be used directly.

### `createPostgresDBClient`
Async function that creates a client using Prisma and connects to a Postgres database

### `PostgresDB`
Class that creates a client using Prisma and connects to a Postgres database.
It will auto-initialize once the configuration provider is ready.
npm package: @kapeta/sdk-web-microfrontend-frame
Description: Minimalist microfrontend building blocks for web applications using iframes
Author: Kapeta
Latest version: 1.0.4

# Library for handling microfrontend using Iframes

Specifically for handling navigation between microfrontends using Iframes.

This will handle syncing the url from a parent frame to a child frame and vice versa.

The core functionality is implemented in vanilla javascript - with a single React wrapper at the moment.

## Usage
The react wrapper uses react-router-dom to handle the routing.

### Parent
Use the FrameRouter component to wrap the routes that you want to be rendered in the iframe.
The frame router is essentially a BrowserRouter from ```react-router-dom@v6```
```tsx
import { FrameRouter, FragmentFrame } from '@kapeta/sdk-web-microfrontend-frame';
import { Routes, Route } from 'react-router-dom';

export const App = () => {
  return (
    <FrameRouter>
        <Routes>
          <Route path="/users">
              {/* 
              topPath: Must match the path in the parent that navigates to the FragmentFrame
              basePath: The path to the microfrontend proxy on the parent 
              */}
            <FragmentFrame basePath={'/fragments/users'} topPath={'/users'} />
          </Route>
          <Route path="/todo/*">
            <FragmentFrame basePath={'/fragments/todo'} topPath={'/todo'} />
          </Route>
        </Routes>
    </FrameRouter>
  );
};

```


### Child
The child also uses FrameRouter. Let's assume this example is "users". 

```tsx
import { FrameRouter } from '@kapeta/sdk-web-microfrontend-frame';
import { Routes, Route, Link } from 'react-router-dom';

export const App = () => {
  return (
    <FrameRouter>
        <Routes>
          <Route path="/">
              User home page. This will be loaded when the parent visits "/users"
          </Route>
          <Route path="/settings">
              User settings. This will be loaded when the parent visits "/users/settings"
              <Link to="/">This will send the parent back to "/users"</Link>
          </Route>
        </Routes>
    </FrameRouter>
  );
};

```