open-index/open-npm huggingface dataset:
npm package: @luolapeikko/zod-express-middleware
Description: ExpressJS Zod Validation Middleware
Author: mharj
Latest version: 0.1.0

# @luolapeikko/zod-express-middleware

ExpressJS Zod Validation Middleware

This is a direct replacement for zod-express-middleware module.

- uses ExpressJS error middleware handling and passing ZodError instance to error middleware.
- ZodMiddlewareObject Object builder type for Request validation.
- ZodInferRequest and ZodInferRequestHandler types to build Request or RequestHandler types from type of ZodMiddlewareObject.
- Optionally can use TS satisfies to help build schema object.

## install

```bash
npm i @luolapeikko/zod-express-middleware
```

## usage

```typescript
const demoRequestSchema = {
	params: z.object({
		id: z.string(),
	}),
	query: z.object({
		filter: z.string().optional(),
	}),
	body: z.object({
		name: z.string().min(3).max(255),
		email: z.string().email(),
		password: z.string().min(8).max(255),
	}),
} satisfies ZodMiddlewareObject;

// build RequestHandler type
type DemoRequestHandler = ZodInferRequestHandler<typeof demoRequestSchema>;
// or just Request
type DemoRequest = ZodInferRequest<typeof demoRequestSchema>;

// in router
route.put('/:id', validateRequest(demoRequestSchema), handleDemo);

// in error middleware
export const errorMiddleWare: ErrorRequestHandler = (err, _req, res, next) => {
	if (err instanceof z.ZodError) {
		res.status(400).send(`Validation Error: ${zodErrorToString(err)}`);
	}
	//
};
```

## Extend Request and RequestHandler types with already customized Request type.

```typescript
// build Request type which uses CustomRequest and ZodMiddlewareObject
export type ZodCustomRequest<T extends ZodMiddlewareObject, ResBody = any, Locals extends Record<string, unknown> = Record<string, unknown>> = CustomRequest<
	ZodParamsType<T['params']>,
	ResBody,
	ZodBodyType<T['body']>,
	ZodQueryType<T['query']>,
	Locals
>;

// type DemoRequest = ZodCustomRequest<typeof demoRequestSchema>;

// build RequestHandler type which uses ZodCustomRequest
export type ZodCustomRequestHandler<T extends ZodMiddlewareObject, ResBody = any, Locals extends Record<string, unknown> = Record<string, unknown>> = (
	req: ZodCustomRequest<T, ResBody, Locals & LocalsTokenPayload>,
	res: Response<ResBody, Locals & LocalsTokenPayload>,
	next: NextFunction,
) => void;

// type DemoRequestHandler = ZodCustomRequestHandler<typeof demoRequestSchema>;
```
npm package: @luoluopay/egg-minio
Description: MinIO plugin for Egg.js
Latest version: 1.0.0

# egg-minio

在 Egg.js 中快速使用 MinIO 客户端的插件。

## 安装

```bash
npm i egg-minio
```

## 在 Egg 项目中启用

在 `config/plugin.js` 中添加：

```js
exports.minio = {
  enable: true,
  package: 'egg-minio',
};
```

TypeScript 模板项目可在 `config/plugin.ts` 中这样写：

```ts
import { EggPlugin } from 'egg';

const plugin: EggPlugin = {
  minio: {
    enable: true,
    package: 'egg-minio',
  },
};

export default plugin;
```

## 配置

在 `config/config.default.js` 中添加：

### 单客户端模式

```js
exports.minio = {
  client: {
    endPoint: '127.0.0.1',
    port: 9000,
    useSSL: false,
    accessKey: 'minioadmin',
    secretKey: 'minioadmin',
    region: 'us-east-1',
  },
};
```

TypeScript 模板项目可在 `config/config.default.ts` 中这样写：

```ts
import { EggAppConfig, PowerPartial } from 'egg';

export default () => {
  const config = {} as PowerPartial<EggAppConfig>;

  config.minio = {
    client: {
      endPoint: '127.0.0.1',
      port: 9000,
      useSSL: false,
      accessKey: 'minioadmin',
      secretKey: 'minioadmin',
      region: 'us-east-1',
    },
  };

  return config;
};
```

### 多客户端模式

```js
exports.minio = {
  clients: {
    default: {
      endPoint: '127.0.0.1',
      port: 9000,
      useSSL: false,
      accessKey: 'minioadmin',
      secretKey: 'minioadmin',
      region: 'us-east-1',
    },
    backup: {
      endPoint: '127.0.0.1',
      port: 9001,
      useSSL: false,
      accessKey: 'minioadmin',
      secretKey: 'minioadmin',
      region: 'us-east-1',
    },
  },
};
```

## 使用示例

### Controller 中上传文件

```js
// app/controller/upload.js
'use strict';

const Controller = require('egg').Controller;

class UploadController extends Controller {
  async putObject() {
    const { ctx, app } = this;
    const stream = await ctx.getFileStream();
    const bucketName = 'demo-bucket';
    const objectName = stream.filename;

    await app.minio.putObject(bucketName, objectName, stream);
    ctx.body = { success: true, objectName };
  }
}

module.exports = UploadController;
```

### 多客户端获取方式

```js
const backupClient = app.getMinio('backup');
```

## 挂载到 Application 的属性

- `app.minio`: 默认 MinIO 客户端（单客户端时为唯一客户端；多客户端时为首个客户端）
- `app.minioClients`: 多客户端映射对象（仅多客户端模式下存在）
- `app.getMinio(name)`: 获取指定名称客户端（仅多客户端模式下存在）

安装后 TypeScript 会自动识别 `app.minio`、`app.minioClients` 和 `app.getMinio` 的类型定义。

## License

MIT
npm package: @luomus/label-designer
Description: This Angular library enables users to design their own printable labels. Visuals and the fields for the label can be defined by the users. This was developed natural history museum specimen data in mind, but nothing prevents it from being used for othe
Author: Ville-Matti Riihikoski
Latest version: 19.0.0

# Label Designer

This Angular library enables users to design their own printable labels.
Visuals and the fields for the label can be defined by the users.
This was developed natural history museum specimen data in mind, but nothing prevents
it from being used for other kinds of labels also.

![editor](https://cdn.laji.fi/label-designer/screenshots/editor.png)

## Demo
Running demo can be found [here](https://stackblitz.com/edit/label-designer).

## Getting started
There are few ways you can use this library.
1. [Angular library](https://luomus.github.io/label-designer/additional-documentation/usage/angular-component.html)
2. [Custom element](https://luomus.github.io/label-designer/additional-documentation/usage/custom-html-element.html)
3. [Standalone application](https://luomus.github.io/label-designer/additional-documentation/usage/standalone-app.html)

# Documentation

Read the online documentation [here](https://luomus.github.io/label-designer).

## Contributing
Development is a community effort, and we encourage participation. Please read the [contribution guide](https://luomus.github.io/label-designer/additional-documentation/contributing.html) for details.

Please note that the 'label-designer' project is released with a [Contributor Code of Conduct](https://luomus.github.io/label-designer/additional-documentation/contributor-code-of-conduct.html). By contributing to this project, you agree to abide by its terms.
npm package: @luomus/laji-form-builder
Description: UI for building laji.fi forms
Author: Olli Raitio
Latest version: 1.1.11

# laji-form-builder

This repo is responsible for two things:
* the **server** aka form backend which runs at https://form.laji.fi
* the **client** which is a React component for editing forms. Available as an npm package [`laji-form-builder`](https://www.npmjs.com/package/laji-form-builder).

## Server API

* `/?{lang:fi | en | sv = fi}` UI for selecting/deleting a form
* `/:id?{lang:fi | en | sv = fi}` UI for editing a form

REST JSON API `/api`:
* `/api?{lang?: fi | en | sv}` list forms as JSON
* `/api/:id?{lang?: fi | en | sv, format: json | schema | schema-with-enums = json, expand: true | false = true}` list forms as JSON
* `/api` (`POST`) Create new form entry
* `/api/:id` (`PUT`) Update form entry
* `/api/:id` (`DELETE`) Delete form entry
* `/api/transform?{lang?: fi | en | sv}` (`POST`) Transform BODY from `json` format to `schema` format
* `/api/flush` flushes cache

## Client API

For documentation, see how the server uses the `Builder` component: https://github.com/luomus/laji-form-builder/blob/master/src/server/view/app.tsx

## Development

### Stack

* node
* TypeScript
* express
* React
* playwright (e2e tests)
* supertest (express tests)

Correct node version is selected with `volta` or `nvm use default`.

### Install dependencies
```
npm ci
```

### Configuration

Copy `config.json.example` to `config.json`, and fill the configuration file.

### Development

Start the development server (it's the same as the production server but with hot reload enabled so code changed are reflected upon file changes):
```
npm start
```

### Tests

#### Server

Server is tested without having to run the server. Just run:

```
npm run test:server
```

##### Env variables:

* `MOCK=true`: Field service test API requests are mocked by default.
* `CREATE_MOCKS=false`: Field service test API responses mock are recreated.

#### Client

Server can be running or or not. If it's not running, it will be automatically started.

```
npm run test:client
```

##### Dependencies

To run the tests, you might need to install playwright dependencies:

```
npx playwright install
```

If you run into issues with browser dependencies etc, there's also a dockerized runner:

```
# Run all tests (builds docker image & runs it)
npm run test:docker

# Or if you want to give playwright params, run certain tests etc:
npm run test:docker -- test/client/editor.ts --project chromium
```

### Build

#### Server

To build the server (compiles both `static` and `build`):
```
npm run build:server
```

In production, run the built server with:

```
npm run start:prod
````

#### npm package

To build the npm package (compiles `lib`):
```
npm run build:client
```

### Publishing to npm

Run `npm version {patch,minor,major}`. This will run the linting & front end tests (and halt if they fail), build the client and publish to npm. We follow [semantic versioning](https://docs.npmjs.com/about-semantic-versioning).
npm package: @luomus/leaflet-smooth-wheel-zoom
Description: smooth wheel zoom for leaflet
Author: mutsuyuki
Latest version: 1.0.0

# Leaflet.SmoothWheelZoom
smooth wheel zoom for leaflet

### Usage

```
var map = L.map('map', {
  scrollWheelZoom: false, // disable original zoom function
  smoothWheelZoom: true,  // enable smooth zoom 
  smoothSensitivity: 1,   // zoom speed. default is 1
});
```


![demo](./demo_gif/demo.gif "demo")


### Demo 
[Demo](https://mutsuyuki.github.io/Leaflet.SmoothWheelZoom/)
npm package: @luomus/leaflet-textpath
Description: Shows a text (or a pattern) along a Polyline
Latest version: 1.2.4

Leaflet.TextPath
================

Shows a text along a Polyline.

Check out the [demo](http://makinacorpus.github.com/Leaflet.TextPath/) !

Leaflet versions
-----

The version on the `gh-pages` branch targets Leaflet `1.3.1`.

Usage
-----

For example, show path orientation on mouse over :

```javascript
    var layer = L.polyLine(...);

    layer.on('mouseover', function () {
        this.setText('  ►  ', {repeat: true, attributes: {fill: 'red'}});
    });

    layer.on('mouseout', function () {
        this.setText(null);
    });
```

With a GeoJSON containing lines, it becomes:

```javascript
    L.geoJson(data, {
        onEachFeature: function (feature, layer) {
            layer.setText(feature.properties.label);
        }
    }).addTo(map);

```

### Options

* `repeat` Specifies if the text should be repeated along the polyline (Default: `false`)
* `center` Centers the text according to the polyline's bounding box  (Default: `false`)
* `below` Show text below the path (Default: false)
* `offset` Set an offset to position text relative to the polyline (Default: 0)
* `orientation` Rotate text.  (Default: 0)
    - {orientation: angle} - rotate to a specified angle (e.g. {orientation: 15})
    - {orientation: flip} - filps the text 180deg correction for upside down text placement on west -> east lines
    - {orientation: perpendicular} - places text at right angles to the line.

* `attributes` Object containing the attributes applied to the `text` tag. Check valid attributes [here](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text#Attributes) (Default: `{}`)

Screenshot
----------

![screenshot](https://raw.github.com/makinacorpus/Leaflet.TextPath/gh-pages/screenshot.png)

Credits
-------

The main idea comes from Tom Mac Wright's *[Getting serious about SVG](http://mapbox.com/osmdev/2012/11/20/getting-serious-about-svg/)*


Changelog
---------

### development ###

* Nothing changed yet.

### 1.1.0 ###

* Add the orientation option (#27, thanks @kirkau)

### 1.0.2 ###

* Allow HTTP and HTTPS to access the demo (#39, thanks @sonny89 and @leplatrem)

### 1.0.1 ###

* Fix text centering for vertical lines (#33, #34, #38, thanks @msgoloborodov)

### 1.0.0 ###

**Breaking changes**

* Text is now shown on top by default. Set option ``below`` to true to put the text below the layer.

### 0.2.2 ###

* Fix bug when removing layer whose text was removed (fixes #18) (thanks Victor Gomes)
* Fix path width when using options.center (fixes #17) (thanks Brent Miller).

### 0.2.1 ###

* Fix layer order (fixes #5) (thanks Albin Larsson)

### 0.2.0 ###

* Stay on top after bringToFront
* Clean-up and fix `onAdd` and `onRemove`
* Fire mouse events from underlying text layer (thanks Lewis Christie)

### 0.1.0 ###

* Initial working version



Authors
-------

Many thanks to [all contributors](https://github.com/makinacorpus/Leaflet.TextPath/graphs/contributors) !

[![Makina Corpus](http://depot.makina-corpus.org/public/logo.gif)](http://makinacorpus.com)
npm package: @luomus/parse-prop-types
Description: Parses React prop-types into a readable object
Author: Diego Haz
Latest version: 0.3.0

# parse-prop-types

[![Generated with nod](https://img.shields.io/badge/generator-nod-2196F3.svg?style=flat-square)](https://github.com/diegohaz/nod)
[![NPM version](https://img.shields.io/npm/v/parse-prop-types.svg?style=flat-square)](https://npmjs.org/package/parse-prop-types)
[![Build Status](https://img.shields.io/travis/diegohaz/parse-prop-types/master.svg?style=flat-square)](https://travis-ci.org/diegohaz/parse-prop-types) [![Coverage Status](https://img.shields.io/codecov/c/github/diegohaz/parse-prop-types/master.svg?style=flat-square)](https://codecov.io/gh/diegohaz/parse-prop-types/branch/master)

Parses React `prop-types` into a readable object at runtime.

## Install

    $ npm install --save parse-prop-types

## Usage

```jsx
import React from 'react'
import PropTypes from 'prop-types'
import parsePropTypes from 'parse-prop-types'

const MyComponent = ({ name, show }) => (
  show ? <div>{name}</div> : null
)

MyComponent.propTypes = {
  name: PropTypes.string,
  show: PropTypes.oneOfType([PropTypes.bool, propTypes.string]).isRequired,
}

MyComponent.defaultProps = {
  name: 'Haz',
}

parsePropTypes(MyComponent)
```

The returned object is compatible with [`react-docgen`](https://github.com/reactjs/react-docgen):

```js
{
  name: {
    type: {
      name: 'string',
    },
    required: false,
    defaultValue: {
      value: 'Haz',
    },
  },
  show: {
    type: {
      name: 'oneOfType',
      value: [
        { name: 'bool' },
        { name: 'string' },
      ],
    },
    required: true,
  },
}
```

**IMPORTANT:** To avoid issues reading any component's propTypes, it is recommendable importing this package before defining your components' propTypes or before import any third-party component. Import this package in your entry point file could be a great option.

    // index.js (entry point file)
    import "parse-prop-types";

## Why not [`react-docgen`](https://github.com/reactjs/react-docgen)?

[`react-docgen`](https://github.com/reactjs/react-docgen) reads file contents in order to find prop types definitions. It has some limitations, such as not allowing computed prop types and, in several situations, not being able to parse file contents correctly.

`parse-prop-types`, on the other hand, doesn't deal with file contents. Instead, it parses prop types at runtime by receiving the component object itself.

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [parsePropTypes](#parseproptypes)

### parsePropTypes

**Parameters**

-   `$0` **any** 
    -   `$0.propTypes`   (optional, default `{}`)
    -   `$0.defaultProps`   (optional, default `{}`)

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 

## License

MIT © [Diego Haz](https://github.com/diegohaz)
npm package: @luomus/validate
Description: Declarative validations for JavaScript
Author: Nicklas Ansman
Latest version: 0.11.1

validate.js
===
Validate.js provides a declarative way of validating javascript objects.

For documentation please see [validatejs.org/](http://validatejs.org/).

For issues and feature requests visit the [issue tracker](https://github.com/ansman/validate.js/issues).

Building validate.js
---
### Requirements
  * [node.js](https://nodejs.org/) - Will probably work with most versions
  * [grunt-cli](http://gruntjs.com/using-the-cli)

### Build steps
  1. `git clone git@github.com:ansman/validate.js.git`
  2. `cd validate.js`
  3. `npm install`
  4. `grunt build`

This will build *validate.min.js*, *validate.min.map* and the *docs* folder.

### Continuous testing
You can run continuous testing that runs the tests on file changes by running
`grunt watch` or simply `grunt`.

If you want to just run the tests once you can do that by running `grunt test`.

Build status
---
[![Build Status](https://travis-ci.org/ansman/validate.js.svg?branch=master)](https://travis-ci.org/ansman/validate.js)
[![Coverage Status](https://coveralls.io/repos/ansman/validate.js/badge.svg?branch=master)](https://coveralls.io/r/ansman/validate.js?branch=master)

Contributing
---
Before opening a pull request please make sure your changes follow the
[contribution guidelines](https://github.com/ansman/validate.js/blob/master/CONTRIBUTING.md).

Users of validate.js
---
If your site, library or application uses validate.js and would like to be shown
here please feel free to email <a href="mailto:info@validatejs.org">info@validatejs.org</a>
with the name and optionally a URL to the project and it will be added here.
npm package: @luongtt/auth-api-middleware
Description: This is simple middleware to handle exception of authentication for react app
Author: luongtt
Latest version: 1.0.0

# Auth API Middleware

This is simple package to handle _un-authorized_ (**HTTP 401**) exception 
from API. When exception occurred, `authApiMiddleware` will push all 
failed APIs to a queue and try call `refresh token` handler, then it 
re-calls all the failed APIs again automatically.

### Install:

```shell
npm i @luongtt/api-auth-middleware
```

### To inject middleware:

First, initializing the middleware:

```js
import authApiMiddleware from './middleware';

authApiMiddleware.init({
  maxRetry: 2, // Default: 3
  refreshTokenHandler: (onSuccess, onError) => {
    /*
     * You need refresh API token here
     * When success, call 'onSuccess' to retry all failed API
     * When fail, call 'onError' to abort all failed API
     */
    refreshTokenPromise().then(onSuccess).catch(onError);
  },
});
```

Then, you can inject the middleware to `Axios function` or `fetch` API:

```js
const injectedGet = authApiMiddleware.injectMiddleware(axios.get);

const injectedFetch = authApiMiddleware.injectMiddleware(fetch);

...

injectedGet('https://api.example.com/')
  .then((res) => console.log(res))
  .catch((err) => console.log(err));
```
npm package: @luongtt/create-react-base
Description: This is utility package for create react app base on create-react-app package
Author: luongtt
Latest version: 1.0.1

# Deha React Base

This package is used to create react app with some common dependencies.

To use:
```shell
npx @luongtt/create-react-base {project-name}
```

We use `npx create-react-app` to create the base and install the
**latest versions** of dependencies as below list:

### Dev dependencies:

* Coding convention
  - `eslint`
  - `prettier`
  - `eslint-config-prettier`
  - `eslint-plugin-prettier`
  - `eslint-config-airbnb`

* Tailwindcss
  - `tailwindcss`
  - `postcss`
  - `autoprefixer`

### Dependencies:

* Type checking:
  - `prop-types`

* Router:
  - `react-router-dom`

* Language translator:
  - `react-i18next`
  - `i18next`

* State management:
  - `@reduxjs/toolkit`
  - `react-redux`

* Form management
  - `react-hook-form`

* Material UI:
  - `@mui/material`
  - `@emotion/react`
  - `@emotion/styled`
  - `@mui/icons-material`
  - `@mui/lab`
  - `@mui/base`

The config of eslint, prettier and tailwind is already included, and 
coding conventions follow 
[Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript).

We provide some sample of router, store config, theme switcher and 
lang switcher components. You can view demo in 
[this project](https://gitlab.dehasoft.vn/luongtt/react-toolkit).