open-index/open-npm huggingface dataset:
npm package: @lurenjs/config
Description: load environment variable for class
Author: vincent.wen
Latest version: 0.0.11

# @lurenjs/config

> @lurenjs/config 是 TypeScript 的库，主要是用来创建用于配置参数的类，参数的值可以从环境变量或者文件中读入。

#### 配置要求

---

ts 的配置文件`tsconfig.json`中的`experimentalDecorators`, `emitDecoratorMetadata`选项需要被启用。`reflect-metadata`是依赖库（peerDependency），如果未安装的话，也需要同时安装。

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

#### 安装

---

##### yarn

`$ yarn add @lurenjs/config reflect-metadata`

##### npm

`$ npm i -S @lurenjs/config reflect-metadata`

#### 使用

---

配置类上需要添加`Configuration`的注解，需要读入环境变量的参数需要添加`InjectEnv`的注解。当该配置类被实例化时，相应的参数会被注入配置环境变量的值。`validate`和`transform`可以对环境变量的值进行验证和转换。

```typescript
@Configuration()
class Foo {
  @InjectEnv('HOST', { default: 'localhost' })
  public host: string;
  @InjectEnv('PORT', {
    transform: (val) => Number.parseInt(val, 10),
  })
  public port: number;
  @InjectEnv('DATABASE', { description: 'database name' })
  public database: string;
}

/**
 * ENV
 *
 * PORT=1234
 * DATABASE=test
 *
 **/

const foo = new Foo()
console.log(foo)
/**
 *  Foo { host: 'localhost', port: 1234, database: 'test' }
 ** /
```

**注意:对于环境变量的注入，Configuaration 的注解并不是必须的，省略的结果是注入的值会定义在 prototype 上，这样会导致 Object.keys()或 Object.getOwnProperites()方法无法遍历对象中的值，如下**

```
import { InjectEnv } from './inject-env';

class Foo {
  @InjectEnv('HOST', { default: 'localhost' })
  host: string;
  @InjectEnv('PORT', {
    transform: (val) => Number(val),
  })
  port: number;
  @InjectEnv('DATABASE', { description: 'database name' })
  database: string;
}

const foo = new Foo();
console.log(foo);
/* Foo {} */

console.log(foo.host, foo.port, foo.database);
/* localhost 1234 db_name */
```

静态属性页可以被注入。

```typescript
import { InjectEnv } from './inject-env';

class Foo {
  @InjectEnv('HOST', { default: 'localhost' })
  static host: string;
  @InjectEnv('PORT', {
    transform: (val) => Number(val),
  })
  static port: number;
  @InjectEnv('DATABASE', { description: 'database name' })
  static database: string;
}

/**
 * ENV
 *
 * HOST=localhost
 * PORT=1234
 * DATABASE= db_name
 *
 **/

console.log(Foo)
/**
 * [class Foo] { host: 'localhost', port: 1234, database: 'db_name' }
 ** /
```

注入的数据来源也可以是文件, 目前支持`json` 和 `yaml` , 默认是`yaml`.

```typescript

 @Configuration({ filepath: './test/config.yml' })
    class Bar {
      @InjectProp()
      zee: number;

      @InjectProp()
      foo: string;

      @InjectProp({ transform: (val) => Number(val) })
      ordinal: number;
    }
    const bar = new Bar();

/**
 * ./test/config.yml
 *
 * foo: bar
 * ordinal: "1"
 * zee: 1
 *
 **/

const bar = new Bar()
/**
 * Bar { zee: 1, foo: 'bar', ordinal: 1 }
 ** /
```
npm package: @luriddd/ton-lite-client
Description: ton-lite-client is a JS library that allows you to get information from TON Blockchain through it's native ADNL protocol.
Author: Whales Corp.
Latest version: 3.0.1

## ton-lite-client

ton-lite-client is a JS library that allows you to get information from TON Blockchain through it's native ADNL protocol.

To get servers list, use official urls:
- Mainnet: https://ton.org/global.config.json
- Testnet: https://ton.org/testnet-global.config.json

Example of getting account state:
```typescript
import { LiteClient, LiteRoundRobinEngine, LiteSingleEngine, LiteEngine } from "ton-lite-client";
import { Address } from "@ton/core";

function intToIP(int: number) {
    var part1 = int & 255;
    var part2 = ((int >> 8) & 255);
    var part3 = ((int >> 16) & 255);
    var part4 = ((int >> 24) & 255);

    return part4 + "." + part3 + "." + part2 + "." + part1;
}

let server = {
    "ip": 1097649206,
    "port": 29296,
    "id": {
        "@type": "pub.ed25519",
        "key": "p2tSiaeSqX978BxE5zLxuTQM06WVDErf5/15QToxMYA="
    }
}

async function main() {
    const engines: LiteEngine[] = [];
    engines.push(new LiteSingleEngine({
        host: `tcp://${intToIP(server.ip)}:${server.port}`,
        publicKey: Buffer.from(server.id.key, 'base64'),
    }));
    const engine: LiteEngine = new LiteRoundRobinEngine(engines);
    const client = new LiteClient({ engine });
    console.log('get master info')
    const master = await client.getMasterchainInfo()
    console.log('master', master)

    const address = Address.parse('kQC2sf_Hy34aMM7n9f9_V-ThHDehjH71LWBETy_JrTirPIHa');
    const accountState = await client.getAccountState(address, master.last)
    console.log('Account state:', accountState)
}

main()
```

By default, LiteClient uses cache for 4 things: blocks, blockHeaders, shards, account states at given block. All caches are LRU maps with capacity of 1000 elements. If your use case needs different caching strategy - you can bring your own map.


For example, you can cap every map at 100 000 elements:
```typescript
const client = new LiteClient({
    engine,
    cacheMap: 100000,
});
```

Or you can cache only account states (not recommended, just example):
```typescript
const client = new LiteClient({
    engine, cacheMap: (kind) => {
        if (kind === 'accounts') {
            return new Map()
        }

        return {
            get(key) { },
            set(key, value) { },
            delete(key: any) { },
            clear() { },
        }
    }
});
```
npm package: @luryy/interfaces-base
Description: Typescript shared interfaces library
Author: luryy
Latest version: 1.0.1

# Typescript Interfaces Shared Example 📦

This module contains an example of a Typescript interface package

> The idea of this module is to sharing interfaces between your applications
> This ensure more consistent contracts between API & Clients

## Using Guide

##### Installation

Install @luryy/interfaces-base

```
npm install -D @luryy/interfaces-base
```

##### Usage

You just need to import defined interfaces at this module

Ex:

```
import { IFoo } from '@luryy/interfaces-base'
```
npm package: @lusai/base-api-layer
Description: A nuxt layer that collecting commonly used server api, utils, etc
Author: lusai
Latest version: 0.0.2

# Base API Server Nuxt Layer

Collect commonly used tools in nuxt layer.

## How to use nuxt layer

1. add to dev dependency

```bash
pnpm add @lusai/base-api-layer
```

2. Add to `nuxt.config.ts`

```ts
defineNuxtConfig({
  extends: [
    '@lusai/base-api-layer'
  ]
})
```

---

## Setup Dev Env

Make sure to install the dependencies:

```bash
pnpm install
```

---
npm package: @lusc/clean-package
Description: Clean `package.json` for publishing. Remove properties that don't need to be in the published package.json, e.g. `devDependencies` or `prettier`.
Author: melusc
Latest version: 3.0.0

# clean-package

Clean `package.json` for publishing. Remove properties that don't need to be in the published package.json, e.g. `devDependencies` or `prettier`.

This tool is intentionally minimal. Use git to restore the original `package.json`.

## Installation

```bash
npm install -D @lusc/clean-package
yarn add -D @lusc/clean-package
```

## Usage

```bash
cd path/to/repo
# package.json is in current directory
clean-package devDependencies scripts.build
# supports nested removal     ^^^^^^^^^^^^^

# Publish
npm publish
[...]

# After publish, if necessary
git checkout HEAD -- package.json
```

See my [publish.yml](https://github.com/melusc/clean-package/blob/main/.github/workflows/publish.yml#L22) Github Actions workflow to see how I use this package.

## Options

### Sort

By default, the keys of the clean `package.json` will be sorted. Use `--no-sort` to disable this behaviour.

### Dry-run

Use `--dry-run` or `-n` to check how `package.json` will be modified. The cleaned `package.json` will be printed to stdout instead.

### Indent

By default, tabs are used for indentation. Use `--indent` to overwrite this.

### Package

By default, the `package.json` in the current directory is modified. Pass a different directory to `--package` or `-p` if the `package.json` isn't found in the current directory.

If the file to be modified isn't called `package.json` pass the path to the file to `--package` and it will just as well.

## Library

`@lusc/clean-package` can be used as a library too. Simply import it as so:

```typescript
import {cleanPackage} from '@lusc/clean-package';
```

### Typing

```typescript
function cleanPackage(options: {
	// Path to package.json or the directory containing it
	// required
	packageJson: string | URL;

	// Keys to remove from package.json
	// e.g. `keys: [['devDependencies'], ['scripts']]`
	// Supports nested keys, e.g. [['scripts', 'test']] -> delete packageJson.scripts.test
	// required
	keys: string[][];

	// Indentation to use. Same usage as with `JSON.stringify`
	// default `\t`
	indent?: string | number;

	// Sort keys (sorts deeply)
	// default true
	sort?: boolean;

	// Don't write result to file
	// default false
	dryRun?: boolean;

	// Why a string? Ensure that the returned result is identical
	// to the written result, namely the sorting and indentation
}): Promise<string>;
```

## Prior Art

[clean-package](https://github.com/roydukkey/clean-package) by [roydukkey](https://github.com/roydukkey)
npm package: @lusc/cli-interval
Description: Run a command at a given interval, and aggregate its output
Author: melusc
Latest version: 7.0.0

# interval

Repeat a command at a given interval, and aggregate its output.

[![NPM](https://img.shields.io/npm/v/@lusc/cli-interval.svg?style=flat)](https://npmjs.org/package/@lusc/cli-interval)
[![License](https://img.shields.io/npm/l/@lusc/cli-interval.svg?style=flat)](https://github.com/melusc/cli-interval)

```bash
npm install -g @lusc/cli-interval
```

The following example outputs "Hello" to `stdout` every second.

```bash
$ interval -t 1s "echo Hello"
Hello
Hello
# ...
```

The command can also be passed as multiple arguments.

```bash
interval -t 1s "node index.js"
# same as
interval -t 1s "node" "index.js"
```

It aggregates both `stdout` and `stderr` over time, and pipes them into its respective outputs.

It waits for the command to finish, waits the specified delay and runs the command again.

## Arguments

- `-h`, `--help` print the command usage and exit
- `-v`, `--version` print the version and exit
- `-t`, `--interval` specify the interval at which to run the command, e.g.
  - `-t 100` every 100 milliseconds
  - `-t 5s` every 5 seconds
  - `-t 2m` every 2 minutes
  - `-t 1h` every hour
  - Accepts any value that [ms](https://github.com/vercel/ms) can parse.

---

This is a fork of [Tabcorp/cli-interval](https://github.com/Tabcorp/cli-interval).
npm package: @lusc/eslint-config
Description: This is a collection of useful eslint configs and plugins. It is meant to be used mainly with TypeScript and ESM. Inspired by [xo](https://github.com/xojs/xo).
Author: lusc
Latest version: 10.0.0

# @lusc/eslint-config

This is a collection of useful eslint configs and plugins.
It is meant to be used mainly with TypeScript and ESM.
Inspired by [xo](https://github.com/xojs/xo).

Use at your own risk!
This config is primarily intended to be used by me and my projects.
Any changes are likely breaking changes so any version bump can be breaking for you.
npm package: @lusc/json-dts
Description: Convert json to typescript dts
Author: lusc
Latest version: 7.0.0

# @lusc/json-dts

Convert JSON to TypeScript definitions (.d.ts).

## Install

```sh
npm install @lusc/json-dts

# or using yarn
yarn add @lusc/json-dts
```

## Usage

```js
import {jsonDts} from '@lusc/json-dts';

jsonDts({key: 'value'});
/*
type T0 = {
	key: string;
};
*/

jsonDts({key: {nested_key: 'value'}});
/*
type Key = {
	nested_key: string;
};

type T0 = {
	key: Key;
};
*/

jsonDts({key: true}, {name: 'data'});
/*
type Data = {
	key: boolean
}
*/
```

## API

### jsonDts(input, options?)

#### input

Anything that can be represented as JSON.

Has to be parsed JSON.

#### options.name?

Type: `string`

By default the the root item is called `T0`. This can be used to override that.

#### options.filter?

Type: `string[] | (path: string[]) => boolean`

This option can be used to filter entries from the output. Filtered entries will have type `any`.

For each key (including indices of arrays) found in `input`:

- If the filter is an array, it filters all keys found in that array.
- Otherwise it passes the path the function and filters that key if the function returns `false`.

```ts
jsonDts(
  {
    a: 1,
    b: 'b',
  },
  {
    filter: ['a'],
  },
);
// returns
type T0 = {
  a: any;
  b: string;
};

jsonDts(
  {
    a: {
      b: 'b',
      c: 1,
    },
  },
  {
    filter(path: string[]) {
      // Filter *.b
      return path?.[1] !== 'b';
    },
  },
);
// returns
type A = {
  b: any;
  c: number;
};

type T0 = {
  a: A;
};
```
npm package: @luseefor/synthex-core
Description: Framework-agnostic layout and command engine for Synthex UI.
Latest version: 1.1.0

# @luseefor/synthex-core

Framework-agnostic layout and command engine used by Synthex UI.

## Install

```sh
npm install @luseefor/synthex-core
```

## Includes

- serializable layout tree types
- reducer-driven state transitions
- command execution and history
- validation and serialization helpers
npm package: @luseefor/synthex-react-web
Description: React DOM adapter for rendering Synthex layout engine workspaces.
Latest version: 1.1.0

# @luseefor/synthex-react-web

React DOM adapter for rendering the Synthex layout engine on the web.

## Install

```sh
npm install @luseefor/synthex-core @luseefor/synthex-react-web
```

## Includes

- `LayoutRenderer`
- `SplitView`
- `TabView`
- `useSynthex`

This package is intentionally web-only and does not include design-system components.