open-index/open-npm huggingface dataset:
npm package: @prepress/automation-sdk
Description: Workflow Connect SDK. A TypeScript/JavaScript SDK for interacting with the Workflow Public API.
Author: Gernot Lausegger
Latest version: 0.5.9

# Workflow Connect | Automation SDK
The **Automation SDK** provides an interface to the PPD Workflow **Automation API**. Additional to the Automation API, this tool provides seamless integration of the **FileWarehouse API** which is required for **Print Item** handling.

## Installation

```bash
npm install @prepress/automation-sdk
```

## Usage
This **SDK** includes callables for <code>ESM</code> and <code>CommonJS</code> builds.
```javascript
import { WFCAutomationSdk } from '@prepress/automation-sdk';

// Construct a SDK instance
const sdk = new WFCAutomationSdk({
    username: '<USERNAME>',                     // Your workflow user account to authenticate
    password: '<PASSWORD>',                     // The users passwoed
    apiBaseUrl: 'http://localhost:8081/pms',    // The running workflow instance
    httpTimeout: 30000                          // Optionally, set a global HTTP timeout
});

// Make an Automation API request
// Here we load a list of all available "Product Definitions"
const logProductDefinitions = async () => {
    const definitions = await sdk.listProductDefinitions();
    console.log('Product Definitions', definitions);
};

// Execute async function
logProductDefinitions();

```
npm package: @preprio/n8n-nodes-prepr
Description: N8n community node package for Prepr CMS
Author: Prepr Development
Latest version: 0.1.4

# n8n-nodes-prepr

This is an n8n community node. It lets you use Prepr in your n8n workflows.

Prepr is a headless content management platform that lets you model, manage, and personalize content for websites and apps.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

[Installation](#installation)  
[Operations](#operations)  
[Credentials](#credentials)
[Compatibility](#compatibility)  
[Usage](#usage)  
[Resources](#resources)  
[Version history](#version-history)

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

## Operations

- Create content items
- Update content items
- Assign content items to users
- Publish content items
- Unpublish content items
- Delete content items

## Credentials

To use this node, you must create a Prepr Access Token.

- Get your API access token from Prepr
- Your token must include the following scopes: GraphQL, content_items, content_items_publish, and content_items_delete
- The token should be associated with a Prepr user account that has sufficient permissions

## Compatibility

- Requires n8n version 1.35.0 or higher
- Tested with n8n versions 1.35.0 - 1.64.3
- Requires a Prepr Access Token with version 2025.05.02 or higher

## Usage

This node allows dynamic creation, updating, and deletion of content via the Prepr API. It also supports workflows with:

- Use the `Model` and `Locale` options to target specific content types
- Use the `Workflow Stage` and `Publish On` fields to control lifecycle and scheduling
- You can load available models and fields from the API schema automatically
- When creating/updating items, field values should follow [Prepr API field specification](https://docs.prepr.io/mutation-api/content-items-create-update-and-destroy#field-types)

## Resources

* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
* [Prepr developer docs](https://docs.prepr.io)

## Version history

- v0.1.0: Initial release with content item create/update/publish/unpublish support

## Support

If you got any questions about the community node; contact the Prepr support team to get assistance.

[![npm version](https://img.shields.io/npm/v/@preprio/n8n-nodes-prepr.svg)](https://www.npmjs.com/package/@preprio/n8n-nodes-prepr)
npm package: @preprio/nuxtjs-sdk
Description: The official Prepr SDK for Nuxt.js
Latest version: 1.1.2

# Prepr SDK for Nuxt.js

This is the official Prepr SDK for Nuxt.js. It provided a standardized way for your team to communicate with the Prepr REST API.

## Getting started

### Installation

Getting started is simple. Scaffoled a Nuxt.js project

`npx create-nuxt-app prepr-demo`

And navigate to your new site

`cd prepr-demo`

Once you've done that, you can simply install the module by running

`npm i @preprio/nuxtjs-sdk`

### Configuration

Okay, now we can register the module inside `nuxt.config.js` and modify the default settings.
Add your access token in the token field of the configuration and add the modules and prepr section.

```js
// nuxt.config.js

export default {

  modules: [
    '@preprio/nuxtjs-sdk'
  ],

  // Prepr API Configuration
  prepr: {
    token: 'db126-EXAMPLE-2fd2ce2feee70b0846-EXAMPLE-16842bc97b36b89191b',
    baseUrl: 'https://cdn.prepr.io',
    timeout: 4000,
    userId: null,
  },
}
```

## Usage

Cool. We have the module working. Now, time for some action. We now have global access to the `$prepr` function, how we can access the `$prepr` function depends on the context. Here are two examples.

```js
<script>
// Example with `asyncData`

export default {
  async asyncData({ $prepr, params }) {
    const { id } = params
    const publication = await $prepr
      .path(`/publications/${id}`)
      .query('...')
      .fetch();

    return {
      publication,
    }
  },
}
</script>
```

```js
<script>
// Example with `fetch`

export default {
  data() {
    return {
      publication: {}
    }
  },

  async fetch() {
    const { id } = this.params
    const publication = await this.$prepr
      .path(`/publications/${id}`)
      .query('...')
      .fetch()

    this.publication = publication
  },
}
</script>
```

## More info

Want to know all available methods? Read more at [@preprio/nodejs-sdk](https://prepr.dev/docs/technologies/v1/introduction-node) or join us on [Slack](https://slack.prepr.io).
npm package: @preprio/vuejs-sdk
Description: The official Prepr SDK for Vue.js
Latest version: 1.1.1

# Prepr SDK for Vue.js

This is the official Prepr SDK for Vue.js. It provided a standardized way for your team to communicate with the Prepr API.

## Getting started

### Installation

Getting started is simple. Scaffoled a Vue.js project.

`npx create-vue-app prepr-demo`

And navigate to your new site.

`cd prepr-demo`

Once you've done that, you can simply install the plugin by running.

`npm i @preprio/vuejs-sdk`

### Configuration

Okay, now we can register the plugin inside `src/index.js` and modify the default settings.

```js
// src/index.js

import Vue from 'vue'
import App from './components/App.vue'
import { PreprPlugin } from '@preprio/vuejs-sdk'

Vue.use(PreprPlugin, {
  token: null,
  baseUrl: 'https://cdn.prepr.io',
  timeout: 4000,
  userId: null,
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  render: h => h(App),
})
```

By default, the base url will be `https://cdn.prepr.io` and the timeout before the request fails `4000` ms. The two values are not required. However. The `token` is required in order to make API calls. You can obtain the API token from the Prepr Dashboard.

## Usage

Let's make that plugin do some work.

```js
<script>
export default {
  data() {
    return {
      publications: {}
    }
  },

  async mounted() {
    const publication = await $prepr
      .path(`/publications/${id}`)
      .query('...')
      .fetch();

    this.publications = publications
  },
}
</script>
```

By default, Vue.js doesn't ship with a router. To resolve data based on route parameters, we suggest using [Vue Router](https://router.vuejs.org/). You can install Vue Router easily by running `npm install vue-router` in your project or `vue add router` if you're using [Vue CLI](https://cli.vuejs.org/). Now you should be able to access data by id or slug.

```js
<script>
export default {
  data() {
    return {
      publication: {}
    }
  },

  async mounted() {
    const id = $route.params.id

    const publication = await this.$prepr
      .path(`/publications/${id}`)
      .fetch()

    this.publication = publication
  },
}
</script>
```

## More info

Want to know all available methods? Read more at [@preprio/nodejs-sdk](https://prepr.dev/docs/technologies/v1/introduction-node) or join us on [Slack](https://slack.prepr.io).
npm package: @prepsmith/material-xlsx-transformer
Description: Transform the Exam Material Data JSON to SmithSupply format XLSX file.
Author: prepsmith team
Latest version: 1.2.1

# @prepsmith/material-xlsx-transform

Transform the Exam Material Data JSON to SmithSupply format XLSX file.

## Install dependencies

```bash
$ yarn install
```

## Run demo

```bash
$ yarn demo
```

## Dump material data from db

example:

```bash
# ssh forward postgres server port to local host
$ ssh -NL 127.0.0.1:5432:10.23.49.163:5432 ubuntu@120.132.6.226 -vv

# in another terminal session to dump data
$ psql -h 127.0.0.1 -U root -P "footer=off" -P "tuples_only" ems_staging -c "select name, material_data from exams" > material_dump.txt
```

## Generate XLSX files from dump data

example:

```bash
$ node batch.js /Users/michael/material_dump.txt
```
npm package: @prequest/cache
Description: 缓存器。
Author: xdoer
Latest version: 1.5.2

# @prequest/cache

缓存器。

## 安装

```bash
npm install @prequest/cache
```

## 使用

下面的示例表示在一分钟内，发起的相同的路径的 GET 请求，都只会调用一次接口，响应相同的数据。

```ts
import { create } from '@prequest/xhr'
import createCacheAdapter from '@prequest/cache'

const cache = createCacheAdapter({
  ttl: 60000,
  getCacheKey: opt => opt.path,
  verifyRequest: opt => !opt.method || opt.method === 'GET',
  verifyResponse: res => {
    if (res.status === 200) return res.data
    throw 'http error'
  },
})

const prequest = create({ useCache: true }, cache)
```

## 配置项

| Option Name    | Type                  | Default                                      | Required | Meaning                      |
| -------------- | --------------------- | -------------------------------------------- | -------- | ---------------------------- |
| ttl            | number                | 60000                                        | false    | 默认一分钟缓存失效           |
| getCacheKey    | (opt: any) => string  | (opt) => opt.path                            | false    | 默认以请求路径作为缓存的 key |
| verifyRequest  | (opt: any) => boolean | opt => !opt.method \|\| opt.method === 'GET' | false    | 默认 GET 请求才会缓存        |
| verifyResponse | (res: any) => any     | res => res                                   | false    | 默认 GET 请求才会缓存        |

同时，发起请求时，设置 `useCache` 为 `true`，且 `verifyRequest` 校验通过，则会缓存请求数据。
npm package: @prequest/cancel-token
Description: 取消请求。
Author: xdoer
Latest version: 1.5.2

# @prequest/cancel-token

取消请求。

## 安装

```bash
npm install @prequest/cancel-token
```

## 使用

对于业务开发者来说，如何利用 cancelToken 取消请求？

```ts
import { prequest } from '@prequest/xhr'
import CancelToken from '@prequest/cancel-token'

const source = CancelToken.source()

prequest.request({
  path: '/api',
  cancelToken: source.token,
})

source.cancel()
```

你也可以初始化一个请求实例，在页面或组件卸载时，取消所有请求

```ts
import { create } from '@prequest/xhr'
import CancelToken from '@prequest/cancel-token'

const source = CancelToken.source()

const prequest = create({ cancelToken: source.token })

useEffect(() => {
  prequest('/api1')
  prequest('/api2')
  prequest('/api3')
  prequest('/api4')

  return () => {
    source.cancel()
  }
}, [])
```

!> 注意：CancelToken 是一次性的，即取消请求之后，再发起请求，会被直接取消。如果有类似需求，建议在调用完取消后，再为 source 重新赋值一个　`CancelToken.source`。

## 集成到请求库

对于库开发者，如何将 CancelToken 集成到请求库中?

首先需要设计将 `cancelToken` 作为可选参数

```ts
import CancelToken from '@prequest/cancel-token'

interface Request {
  cancelToken?: CancelToken
}
```

其次在 `adapter` 函数中，处理 cancelToken.

```ts
function adapter(opt) {
  const { cancelToken } = opt

  return new Promise((resolve, reject) => {
    if (cancelToken) {
      cancelToken.promise.then(() => {
        // 调用原生请求的方法，取消请求。一般用于请求内核提供了取消请求方法的情况下
        nativeRequest.abort()

        reject(new Error('cancel'))
      })
    }
  })

  // ...some code
}
```
npm package: @prequest/error-retry
Description: 错误重试中间件
Author: xdoer
Latest version: 1.5.2

# @prequest/error-retry

错误重试中间件

## 安装

```bash
npm install @prequest/error-retry
```

## 使用

### 创建请求实例

```ts
import { create } from '@prequest/xhr'
import errorRetryMiddleware from '@prequest/error-retry'

const prequest = create()
```

### 创建中间件

```ts
import { prequest } from '@prequest/xhr'
import errorRetryMiddleware from '@prequest/error-retry'

const middleware = errorRetryMiddleware({
  // 错误重试次数
  retryCount: 2,

  // opt 为 Request 类型，通过该函数，你可以控制那些接口需要错误重试
  retryControl(opt, e) {
    const { method, path } = opt

    // 如果是具体某个错误，则不进行重试
    if (e.message === 'internal error') return false

    // api 路径不进行错误重试
    if (path === '/api') return false

    // 只有 get 方法才进行错误重试
    return method === 'GET'
  },
})

prequest.use(middleware)
```

### 单一控制

注册错误重试中间件后，每一个请求也可以单独配置错误请求次数

```ts
prequest('/api', { errorRetry: 1 })
```

## 配置项

| Option Name  | Type                                   | Default                                   | Required | Meaning                               |
| ------------ | -------------------------------------- | ----------------------------------------- | -------- | ------------------------------------- |
| retryCount   | number                                 | 1                                         | false    | 错误重试次数                          |
| retryControl | (opt: RequestOpt, e: Error) => boolean | (opt: RequestOpt) => opt.method === 'GET' | false    | 重试策略，默认 get 请求会进行错误重试 |
npm package: @prequest/fetch
Description: 基于 fetch API 的请求库
Author: xdoer
Latest version: 1.5.2

# @prequest/fetch

基于 fetch API 的请求库

## 安装

```bash
npm install @prequest/fetch
```

## 使用

由于在不同平台上使用基本一致，所以基本使用文档，请查阅 [这里](https://pre-quest.vercel.app/#/usage)

## 参数

| Option Name        | Type                                       | Default | Required | Meaning        | Example                 |
| ------------------ | ------------------------------------------ | ------- | -------- | -------------- | ----------------------- |
| path               | string                                     | none    | Y        | 接口路径       | /api                    |
| method             | string                                     | GET     | N        | 请求方式       | post                    |
| baseURL            | string                                     | none    | N        | 服务器地址     | 'http://localhost:3000' |
| cancelToken        | CancelToken                                | none    | N        | 取消请求       |                         |
| params             | object                                     | none    | N        | url 参数       | { id: 10}               |
| data               | object                                     | none    | N        | 请求头传输数据 | { id: 10}               |
| responseType       | json \| text \| arraybuffer \|...          | none    | N        | 响应的数据类型 | json                    |
| headers            | object                                     | none    | N        | 请求头         | { token: 'aaaaa'}       |
| onDownloadProgress | ({ loaded: number, total: number}) => void | none    | N        | 下载进度       |                         |

其他 fetch 原生支持的参数也支持传入

!> 参数中提供了 `CancelToken` 来取消请求。不建议自己使用 abortController 来取消请求，因为当你调用 AbortController.abort() 时，不确定内部是否执行到 fetch 中间件。

!> responseType 进行配置后，程序会自动解析 response, 输出的直接是 data 数据。若要得到相应头，HTTP 响应状态码等信息，需要手动解析 response
npm package: @prequest/interceptor
Description: 拦截器中间件。
Author: xdoer
Latest version: 1.5.2

# @prequest/interceptor

拦截器中间件。

中间件模型可以更好的完成修改请求和拦截响应的需求，但为了方便习惯使用 axios 的用户，提供此中间件。

## 安装

```bash
npm install @prequest/interceptor
```

## 使用

```ts
import { prequest } from '@prequest/xhr'
import interceptorMiddleware from '@prequest/interceptor'

const interceptor = new InterceptorMiddleware()

// 修改请求参数
interceptor.request.use(
  request => {
    if (!request.path) throw new Error('can not find path')

    request.path = '/prefix' + request.path

    // 注意要将 request 参数返回
    return request
  },
  error => {
    console.log('modify request path fail', error)
    throw error
  }
)

// 修改响应
interceptor.response.use(
  response => {
    if (response.statusCode === 500) throw new Error('internal error')

    response.data = JSON.parse(response.data)

    // 注意要将 response 返回
    return response
  },
  error => {
    // 如果是某个错误
    if (error.message === 'internal error') {
      // 要进行什么操作

      return
    }

    // 否则将错误继续抛出
    throw error
  }
)

prequest.use(interceptor.run)
```
npm package: @prequest/jsonp
Description: jsonp 请求
Author: xdoer
Latest version: 1.5.2

# @prequest/jsonp

jsonp 请求

## 安装

```bash
npm install @prequest/jsonp
```

## 使用

由于在不同平台上使用基本一致，所以基本使用文档，请查阅 [这里](https://pre-quest.vercel.app/#/usage)

```tsx
import { prequest } from '@prequest/jsonp'

prequest('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su', {
  params: {
    wd: '哈哈',
  },
  callbackParamName: 'fn',
}).then(res => {
  console.log(res)
})
```

## 请求配置项

| Option Name       | Type        | Default  | Required | Meaning                       |
| ----------------- | ----------- | -------- | -------- | ----------------------------- |
| path              | string      | none     | Y        | server interface path         |
| baseURL           | string      | none     | N        | base server interface address |
| cancelToken       | CancelToken | none     | N        | cancel a request              |
| params            | object      | none     | N        | url parameters                |
| callbackParamName | string      | callback | N        | callback name                 |
npm package: @prequest/lock
Description: 请求锁提供了一种方案，用来处理 token 刷新、登录校验的场景。
Author: xdoer
Latest version: 1.5.2

# @prequest/lock

请求锁提供了一种方案，用来处理 token 刷新、登录校验的场景。

## 安装

```bash
npm install @prequest/lock
```

## 使用

与错误重试中间件一起使用、进行 token 失效刷新或重新登录

首先，为请求添加 token 校验

```ts
import { prequest, create } from '@prequest/xhr'
import Lock from '@prequest/lock'

const lock = new Lock({
  getValue() {
    return localStorage.getItem('token')
  },
  setValue(token) {
    localStorage.setItem('token', token)
  },
  clearValue() {
    localStorage.removeItem('token')
  },
})
const wrapper = Lock.createLockWrapper(lock)

// 添加 token
prequest.use(async (ctx, next) => {
  const token = await wrapper(getToken)
  ctx.request.headers = ctx.request.headers || {}
  ctx.request.headers['Authorization'] = `bearer ${token}`
  await next()
})

// 创建一个获取 token、不走中间件的实例
const tokenRequest = create()

function getToken() {
  return tokenRequest('http://localhost:3000/token').then(res => res.data.token)
}
```

或者，你不想创建新的请求 Token 实例的话，你可以设计传参，跳过添加 token 的步骤

```ts
import Lock from '@prequest/lock'
import { prequest, create } from '@prequest/xhr'

const lock = new Lock({ ... })

const wrapper = Lock.createLockWrapper(lock)

// 添加 token
prequest.use(async (ctx, next) => {
  if (ctx.request.skipTokenCheck) return next()

  const token = await wrapper(getToken)
  ctx.request.headers = ctx.request.headers || {}
  ctx.request.headers['Authorization'] = `bearer ${token}`
  await next()
})

function getToken() {
  // 传参跳过 token 添加
  return prequest('/token', { skipTokenCheck: true })
}
```

接着，添加错误重试机制

```ts
import { prequest, create } from '@prequest/xhr'
import ErrorRetryMiddleware from '@prequest/error-retry'

const errorRetryMiddleware = ErrorRetryMiddleware({
  retryCount: 2,
  retryControl(opt, e) {
    // 捕获到抛出的 token 失效异常，则进行错误重试
    if ((e.message = 'token is expired')) {
      // 清除 token 值，会重新请求 token 接口，获取最新 token 值
      lock.clear()

      // 进行错误重试
      return true

      // 或者直接重定向到登录页
      location.href = '/login'
      return false
    }
  },
})
// 注意，错误重试中间件要注册位置要先于抛出异常的中间件
prequest.use(errorRetryMiddleware)

// 认证失败、错误重试
prequest.use(async (ctx, next) => {
  await next()
  if (ctx.response.statusCode === '401') {
    throw new Error('token is expired')
  }
})
```

## 配置项

| Option Name | Type                          | Default | Required | Meaning |
| ----------- | ----------------------------- | ------- | -------- | ------- |
| getValue    | () => Promise\<any\>          |         | true     | 获取值  |
| setValue    | (opt: any) => Promise\<void\> |         | true     | 存储值  |
| clearValue  | () => Promise\<void\>         |         | true     | 清除值  |

有些平台获取 storage 的方式是异步的，因而这里设计成了异步调用
npm package: @prequest/node
Description: 代码移植自 [axios](https://github.com/axios/axios/blob/e9965bfafc/lib/adapters/http.js)，传参与响应与 axios 一致
Author: xdoer
Latest version: 1.5.2

# @prequest/node

代码移植自 [axios](https://github.com/axios/axios/blob/e9965bfafc/lib/adapters/http.js)，传参与响应与 axios 一致

## 安装

```bash
npm install @prequest/node
```

## 使用

由于在不同平台上使用基本一致，所以基本使用文档，请查阅 [这里](https://pre-quest.vercel.app/#/usage)

## 参数

| Option Name      | Type                              | Default | Required | Meaning                   | Example                 |
| ---------------- | --------------------------------- | ------- | -------- | ------------------------- | ----------------------- |
| path             | string                            | none    | Y        | 接口路径                  | /api                    |
| method           | string                            | GET     | N        | 请求方式                  | post                    |
| baseURL          | string                            | none    | N        | 服务器地址                | 'http://localhost:3000' |
| timeout          | number                            | none    | N        | 请求超时                  | 5000                    |
| params           | object                            | none    | N        | url 参数                  | { id: 10}               |
| data             | object                            | none    | N        | 请求头传输数据            | { id: 10}               |
| responseType     | json \| text \| arraybuffer \|... | none    | N        | 响应的数据类型            | json                    |
| headers          | object                            | none    | N        | 请求头                    | { token: 'aaaaa'}       |
| cancelToken      | CancelToken                       | none    | N        | 取消请求                  |                         |
| responseEncoding | BufferEncoding                    | utf-8   | N        | 解码响应的编码            |                         |
| socketPath       | string                            | none    | N        | 使用的 UNIX 套接字        | '/var/run/docker.sock'  |
| auth             | Auth                              | none    | N        | HTTP 认证                 |                         |
| proxy            | Proxy                             | none    | N        | 代理请求                  |                         |
| httpAgent        | http.agent                        | none    | N        | 自定义请求                |                         |
| httpsAgent       | https.agent                       | none    | N        | 自定义请求                |                         |
| maxRedirects     | number                            | none    | N        | 重定向次数                |                         |
| maxBodyLength    | number                            | none    | N        | http 请求内容的最大字节数 |                         |
npm package: @prequest/response-types-server
Description: Restful-API 响应的 JSON 数据的 TypeScript 类型生成器
Author: xdoer
Latest version: 1.5.2

# @prequest/response-types-server

Restful-API 响应的 JSON 数据的 TypeScript 类型生成器

## 前言

在前端项目中，没有 fs 等 API，导致不能在运行时，动态生成 Restful-API 响应的 JSON 数据的类型文件。

因而我尝试开发了 [@prequest/response-types-generator](https://github.com/xdoer/PreQuest/tree/main/packages/response-types-generator)，它根据配置，可以发起请求和解析响应，最后生成类型文件。但缺点也很明显，需要将要项目中请求的接口一个一个配置到配置文件中。普通的 Get 请求还好说，但对于 Post 请求，一些复杂的传参，也不是很好处理。

本项目解决了上述问题。原理非常简单，首先开启一个 Http Server，然后在前端项目的请求库中间件中，将请求的参数和响应结果，通过一个新的请求实例，发送到 Http Server 中，Http Server 根据传参，利用 fs API 向指定目录生成类型文件即可。

项目分为两部分 [@prequest/response-types-server](https://github.com/xdoer/PreQuest/blob/main/packages/response-types-server) 与 [@prequest/response-types-client](https://github.com/xdoer/PreQuest/blob/main/packages/response-types-client)

## 安装

```bash
npm install @prequest/response-types-server
```

## 使用

### 开启服务器

```ts
import server from '@prequest/response-types-server'

// 默认开启的端口为 10086
server()

// 你可以通过传参指定端口
server({ port: 10010 })
```

### 生成类型文件

HTTP Server 只接收 POST 与 OPTIONS 请求，当 HTTP Body 传输的数据满足下列参数列表，则会向指定目录输出类型文件

| 参数          | 类型    | 含义               |
| ------------- | ------- | ------------------ |
| outPutDir     | string  | 类型文件输出目录   |
| outPutName    | string  | 文件名称           |
| overwrite     | boolean | 文件可复写         |
| data          | Json    | 要解析的 Json 数据 |
| interfaceName | string  | 导出的接口名称     |

### 响应

HTTP Server 只接收到请求后，会返回下列内容

| 参数      | 类型     | 含义                                                             |
| --------- | -------- | ---------------------------------------------------------------- |
| status    | boolean  | 操作成功与否                                                     |
| timestamp | number   | 时间戳                                                           |
| error     | Error    | 错误信息                                                         |
| data      | string[] | 生成的类型文件列表。前端可根据这个列表，判断是否需要再次发起请求 |
npm package: @prequest/timeout
Description: 超时中间件。对于不支持设置超时时间的请求内核，你可以安装超时中间件来获得超时响应失败的能力。
Author: xdoer
Latest version: 1.5.2

# @prequest/timeout

超时中间件。对于不支持设置超时时间的请求内核，你可以安装超时中间件来获得超时响应失败的能力。

> 对于一些本不支持设置超时时间的请求内核以及 Fetch 来说，没有办法真正的在超时之后，取消请求。只能使用超时抛异常的方式来满足需求。

## 安装

```bash
npm install @prequest/timeout
```

## 使用

```ts
import { create, PreQuest } from '@prequest/xhr'
import timeout from '@prequest/timeout'

PreQuest.use(timeout)

PreQuest.defaults.timeout = 1000

const prequest = create({ timeout: 6000 })

prequest('/api', { timeout: 1000 })
```
npm package: @prequest/uploader
Description: 针对多文件、大文件上传提供了一种便捷的方法，来控制同时进行的任务数量、和文件的切片上传。
Author: xdoer
Latest version: 1.5.2

# @prequest/uploader

针对多文件、大文件上传提供了一种便捷的方法，来控制同时进行的任务数量、和文件的切片上传。

## 安装

```bash
npm install @prequest/uploader
```

## 使用

下面演示了一个 60M 的文件，切片成了 6 份，进行 6 次 HTTP 请求，其中队列中同时上传的任务有 3 个。

```tsx
import Uploader from '@prequest/uploader'
import { prequest } from '@prequest/xhr'

const Upload = () => {
  const [fileList, setFileList] = useState<File[]>([])
  const uploader = useRef<Uploader | null>(null)

  useEffect(() => {
    uploader.current = new Uploader({
      chipSize: 10 * 1024 * 1024, // 切片大小,10M
      poolLimit: 3, // 同时进行的任务数量
      customFormData(formData, { idx, file, chunk }) {
        // 要上传数据的 formData
        formData.append('name', file.name)
        formData.append('index', `${idx}`)
        formData.append('chunk', chunk)
        return formData
      },
      request(formData, { idx, file, chunk }) {
        // 上传过程
        return prequest.post('/upload', {
          data: formData,
          onUploadProgress(e) {
            console.log(`${file.name} 的第${idx}个分片，已上传:${e.loaded}`)
          },
        })
      },
    })
  }, [])

  async function onSubmit() {
    try {
      // 上传任务
      await uploader.current.upload(fileList)
    } catch (e) {
      console.log('上传文件失败')
    }
  }

  return (
    <div>
      <input type="file" onChange={e => setFileList(e.target.files)} />
      <button onClick={onSubmit}>上传</button>
    </div>
  )
}
```

## 参数

### 配置参数

| 名称           | 类型                                                             | 默认                                                   | 必填 | 含义                  |
| -------------- | ---------------------------------------------------------------- | ------------------------------------------------------ | ---- | --------------------- |
| chipSize       | number                                                           | 10 \* 1024 \* 1024                                     | 否   | 切片大小              |
| poolLimit      | number                                                           | 3                                                      | 否   | 同时上传的任务数量    |
| customFormData | (formData: FormData, opt: CallbackOption) => FormData            | 默认会将 name, index, chunk 三个字段添加到 formData 中 | 否   | 定义要上传的 formData |
| request        | (formData: FormData, opt: CallbackOption) => Promise\<Response\> |                                                        | 是   | 定义要上传的请求方法  |

### CallbackOption

| 名称  | 类型   | 含义       |
| ----- | ------ | ---------- |
| idx   | number | 切片的索引 |
| chunk | Blob   | 切片文件   |
| file  | File   | 原始文件   |
npm package: @prequest/wrapper
Description: 一个可以赋予你定义的请求方法 PreQuest 能力的包装器。
Author: xdoer
Latest version: 1.5.2

# 包装器

一个可以赋予你定义的请求方法 PreQuest 能力的包装器。

## 简介

当我们基于 Fetch、XMLHttpRequest 和其他一些原生请求 API 定义一个请求方法，并在项目中大量使用。那么将其切换到 PreQuest 的代价是相对高昂的，这个项目可以很方便的、不侵入的将 PreQuest 的能力赋予到你的请求方法上。

## 安装

```bash
npm install @prequest/wrapper
```

## 使用

### 定义请求方法

```ts
function ajax(params) {
  const { path, method, baseURL, ...rest } = params

  // ...some code
}
```

### 包装器包装

```ts
import { wrapper } from '@prequest/wrapper'

const ajax = wrapper(function(params) {
  const { path, method, baseURL, ...rest } = params

  // some code
})
```

### Enjoy it

你可以像往常一样使用你的方法

```ts
ajax({ path: 'http://localhost:1000/api', method: 'GET', params: { a: 'aaa' } })
```

使用 PreQuest 能力

```ts
ajax('http://localhost:1000/api', { method: 'GET', params: { a: 'aaa' } })

ajax.get('http://localhost:1000/api', { params: { a: 'aaa' } })

ajax.use(async (ctx, next) => {
  console.log(ctx.request)
  await next()
  console.log(ctx.response)
})
```

创建实例

```ts
const instance = ajax.create({ baseURL: 'http://localhost:1000' })

instance.get('/api', { params: { a: 'aaa' } })

instance.use(async (ctx, next) => {
  console.log(ctx.request)
  await next()
  console.log(ctx.response)
})
```

全局配置

```ts
import { PreQuest } from '@prequest/wrapper'

PreQuest.defaults.baseURL = 'http://localhost:1000'

PreQuest.use(async (ctx, next) => {
  console.log(ctx.request)
  await next()
  console.log(ctx.response)
})
```

## 注意

你定义的方法必须满足几个条件。

### 只有一个参数

`wrapper` 的回调函数只支持一个参数，这意味着你只能传入一个对象。

```ts
// 不支持
function ajax(path, method, opt)

// 支持
function ajax({ path, method, opt })
```

### 混入参数

如果你通过别名的方式调用请求，PreQuest 会向你的参数中混入 `path` 和 `method` 参数。

```ts
// 混入 `{ path : http://localhost:1000/api }`
ajax('http://localhost:1000/api')

// 混入 `{ path : http://localhost:1000/api, method: post }`
ajax.post('http://localhost:1000/api')

// 混入 `{ path : /api, method: get }`
ajax.get('/api')
```
npm package: @prequest/xhr
Description: 一个基于 XMLHttpRequest 的请求库
Author: xdoer
Latest version: 1.5.2

# @prequest/xhr

一个基于 XMLHttpRequest 的请求库

## 安装

```bash
npm install @prequest/xhr
```

## 使用

由于在不同平台上使用基本一致，所以基本使用文档，请查阅 [这里](https://pre-quest.vercel.app/#/usage)

### 获取原生请求实例

```ts
import { prequest } from '@prequest/xhr'

prequest.post('/api', {
  getNativeRequestInstance(xhr) {
    // 仅做示例，推荐使用 cancelToken 取消请求
    xhr.abort()
  },
})
```

## 参数

| Option Name              | Type                                       | Default | Required | Meaning          | Example                 |
| ------------------------ | ------------------------------------------ | ------- | -------- | ---------------- | ----------------------- |
| path                     | string                                     | none    | Y        | 接口路径         | /api                    |
| method                   | string                                     | GET     | N        | 请求方式         | post                    |
| baseURL                  | string                                     | none    | N        | 服务器地址       | 'http://localhost:3000' |
| getNativeRequestInstance | (value: Promise\<NativeInstance\>) => void | none    | N        | 获取原生请求实例 |                         |
| cancelToken              | CancelToken                                | none    | N        | 取消请求         |                         |
| timeout                  | number                                     | none    | N        | 请求超时         | 5000                    |
| params                   | object                                     | none    | N        | url 参数         | { id: 10}               |
| data                     | object                                     | none    | N        | 请求头传输数据   | { id: 10}               |
| responseType             | json \| text \| arraybuffer \|...          | none    | N        | 响应的数据类型   | json                    |
| headers                  | object                                     | none    | N        | 请求头           | { token: 'aaaaa'}       |
| withCredentials          | boolean                                    | none    | N        | 认证             |                         |
| onDownloadProgress       | (e) => void                                | none    | N        | 下载进度         |                         |
| onUploadProgress         | (e) => void                                | none    | N        | 上传进度         |                         |
npm package: @prerak20/envguard
Description: TypeScript-first environment variable validation library
Latest version: 0.1.0

# envguard

TypeScript-first environment variable validation with runtime safety and static inference.

## Installation

```bash
npm install @prerak20/envguard
```

## Why envguard?

- Runtime validation for production safety
- Strong static type inference from schema definitions
- Chainable builder API focused on environment variables
- Helpful error output (`expected`, `actual`, `reason`)
- `.env.example` generation from the same schema
- ESM + CJS package output
- Zero external runtime dependencies

## Example

```ts
import { boolean, defineEnv, enumType, number, string } from "@prerak20/envguard";

const env = defineEnv({
  PORT: number().min(1000).max(9999).default(3000),
  NODE_ENV: enumType(["development", "production"]),
  DATABASE_URL: string().url(),
  ENABLE_LOGS: boolean().default(false)
});

// env.PORT -> number
// env.NODE_ENV -> "development" | "production"
// env.DATABASE_URL -> string
// env.ENABLE_LOGS -> boolean
```

## Comparison vs zod

`envguard` is intentionally narrower than [zod](https://zod.dev/):

- Optimized for environment variable workflows
- Smaller API surface for env parsing tasks
- Built-in `.env.example` generation
- No runtime dependencies

Use zod when you need broad JSON/object/domain validation across app boundaries. Use `envguard` when env validation is the primary concern.

## API Docs

### `defineEnv(schema, source?)`

- `schema`: object mapping env keys to schema builders
- `source` (optional): custom object, defaults to `process.env`
- returns parsed + validated object with inferred TypeScript types
- throws `EnvValidationError` when validation fails

### `string()`

- `.min(length)`
- `.max(length)`
- `.regex(pattern)`
- `.url()`
- `.optional()`
- `.default(value)`

### `number()`

- `.min(value)`
- `.max(value)`
- `.integer()`
- `.optional()`
- `.default(value)`

### `boolean()`

- `.optional()`
- `.default(value)`

### `enumType(values)`

- accepts a non-empty tuple/list of strings
- output type is inferred as a union of those string literals
- `.optional()`
- `.default(value)`

### `generateExample(schema)`

Returns a formatted `.env.example` string from the provided schema.

## Examples

### Custom source object

```ts
import { defineEnv, number } from "@prerak20/envguard";

const env = defineEnv(
  {
    PORT: number().default(3000)
  },
  {
    PORT: "8080"
  }
);
```

### Error output

```txt
envguard validation failed:
1. PORT
   expected: number >= 1000
   actual: 500
   reason: number is below minimum
```

### Generate `.env.example`

```ts
import { boolean, enumType, generateExample, number, string } from "@prerak20/envguard";

const example = generateExample({
  PORT: number().default(3000),
  NODE_ENV: enumType(["development", "production"]),
  DATABASE_URL: string().url(),
  ENABLE_LOGS: boolean().default(false)
});
```
npm package: @prerender-kit/tools
Description: Common tools for add single page application pre-rendering process into webpack build lifecycle or CI application release lifecycle
Author: Anton Frolov
Latest version: 1.0.1

# @prerender-kit/tools

Common tools for add single page application pre-rendering process into webpack build lifecycle or CI application release lifecycle.

All documentation see on: https://github.com/frolant/prerender-kit
npm package: @prerenderer/renderer-jsdom
Description: A renderer for @prerenderer/prerenderer that uses JSDOM to prerender pages.
Author: Adrien Foulon
Latest version: 1.1.9

This package is part of the `@prerenderer` monorepo, for a full documentation head over to https://github.com/Tofandel/prerenderer#prerendererrenderer-jsdom-options
npm package: @prerenderer/renderer-puppeteer
Description: A renderer for @prerenderer/prerenderer that uses puppeteer to prerender pages.
Author: Adrien Foulon
Latest version: 1.2.4

This package is part of the `@prerenderer` monorepo, for a full documentation head over to https://github.com/Tofandel/prerenderer#prerendererrenderer-puppeteer-options
npm package: @prerenderer/rollup-plugin
Description: Flexible, framework-agnostic static site generation for apps built with rollup or vite.
Author: Adrien Foulon
Latest version: 0.3.12

# @prerenderer/rollup-plugin

This package is part of the `@prerenderer` monorepo, for the rest of the documentation head over to https://github.com/Tofandel/prerenderer#prerendererwebpack-plugin-options

### Requirements
This plugin is for rollup (or vite), it's fairly recent and for now should be treated as experimental, don't hesitate to report any issue you encounter to help make this plugin better
It was written based on the webpack-plugin, thus works similarly and has the same options

### Installation
`npm i -D @prerenderer/rollup-plugin @prerenderer/renderer-puppeteer`
or
`npm i -D @prerenderer/rollup-plugin @prerenderer/renderer-jsdom`

### Basic Usage (`vite.config.js`)
```js
import { defineConfig } from 'vite'
import prerender from '@prerenderer/rollup-plugin'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [prerender({
    routes: ['/'],
    renderer: '@prerenderer/renderer-puppeteer',
    rendererOptions: {
        renderAfterDocumentEvent: 'custom-render-trigger',
    },
    postProcess (renderedRoute) {
      // Replace all http with https urls and localhost to your site url
      renderedRoute.html = renderedRoute.html.replace(
        /http:/ig,
        'https:',
      ).replace(
        /(https:\/\/)?(localhost|127\.0\.0\.1):\d*/ig,
        (process.env.CI_ENVIRONMENT_URL || ''),
      );
    },
  })],
  resolve: {
    alias: {
      '@': path.resolve(root, './src'),
    },
  },
})

```

Don't forget to trigger the custom event you set in `renderAfterDocumentEvent` in your app when the page is ready to be renderer (Eg: onMounted for vue)

```js
document.dispatchEvent(new Event('custom-render-trigger'))
```
npm package: @preritagrawal/react-native-samplelibrary
Description: test
Author: Prerit Agrawal
Latest version: 0.1.0

# react-native-samplelibrary

demo project of samplelibrary

## Installation

```sh
npm install react-native-samplelibrary
```

## Usage

```js
import { multiply } from 'react-native-samplelibrary';

// ...

const result = await multiply(3, 7);
```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
npm package: @pres/components
Description: Core components for pres
Author: Hoyeung Wong
Latest version: 0.4.0

# @pres/components

[![npm version][badge-npm-version]][url-npm]
[![npm download monthly][badge-npm-download-monthly]][url-npm]
[![npm download total][badge-npm-download-total]][url-npm]
[![npm dependents][badge-npm-dependents]][url-github]
[![npm license][badge-npm-license]][url-npm]
[![pp install size][badge-pp-install-size]][url-pp]
[![github commit last][badge-github-last-commit]][url-github]
[![github commit total][badge-github-commit-count]][url-github]

[//]: <> (Shields)

[badge-npm-version]: https://flat.badgen.net/npm/v/@pres/cluster-fork

[badge-npm-download-monthly]: https://flat.badgen.net/npm/dm/@pres/cluster-fork

[badge-npm-download-total]:https://flat.badgen.net/npm/dt/@pres/cluster-fork

[badge-npm-dependents]: https://flat.badgen.net/npm/dependents/@pres/cluster-fork

[badge-npm-license]: https://flat.badgen.net/npm/license/@pres/cluster-fork

[badge-pp-install-size]: https://flat.badgen.net/packagephobia/install/@pres/cluster-fork

[badge-github-last-commit]: https://flat.badgen.net/github/last-commit/hoyeungw/pres

[badge-github-commit-count]: https://flat.badgen.net/github/commits/hoyeungw/pres

[//]: <> (Link)

[url-npm]: https://npmjs.org/package/@pres/cluster-fork

[url-pp]: https://packagephobia.now.sh/result?p=@pres/cluster-fork

[url-github]: https://github.com/hoyeungw/pres

##### Fork cluster with configs

#### Install

```console
$ npm install @pres/cluster-fork
```

#### Usage

```js
import { Signaler } from '@pres/components'
Signaler.register(instance,process,)
```

#### Meta

[LICENSE (MIT)](LICENSE)
npm package: @pres/components-chart
Description: chart components for pres
Author: Hoyeung Wong
Latest version: 0.4.0

# @pres/components-chart

[![npm version][badge-npm-version]][url-npm]
[![npm download monthly][badge-npm-download-monthly]][url-npm]
[![npm download total][badge-npm-download-total]][url-npm]
[![npm dependents][badge-npm-dependents]][url-github]
[![npm license][badge-npm-license]][url-npm]
[![pp install size][badge-pp-install-size]][url-pp]
[![github commit last][badge-github-last-commit]][url-github]
[![github commit total][badge-github-commit-count]][url-github]

[//]: <> (Shields)

[badge-npm-version]: https://flat.badgen.net/npm/v/@pres/components-chart

[badge-npm-download-monthly]: https://flat.badgen.net/npm/dm/@pres/components-chart

[badge-npm-download-total]:https://flat.badgen.net/npm/dt/@pres/components-chart

[badge-npm-dependents]: https://flat.badgen.net/npm/dependents/@pres/components-chart

[badge-npm-license]: https://flat.badgen.net/npm/license/@pres/components-chart

[badge-pp-install-size]: https://flat.badgen.net/packagephobia/install/@pres/components-chart

[badge-github-last-commit]: https://flat.badgen.net/github/last-commit/hoyeungw/pres

[badge-github-commit-count]: https://flat.badgen.net/github/commits/hoyeungw/pres

[//]: <> (Link)

[url-npm]: https://npmjs.org/package/@pres/components-chart

[url-pp]: https://packagephobia.now.sh/result?p=@pres/components-chart

[url-github]: https://github.com/hoyeungw/pres

##### Fork cluster with configs

#### Install

```console
$ npm install @pres/components-chart
```

#### Usage

```js
import { Signaler } from '@pres/components-chart'

Signaler.register(instance, process,)
```

#### Meta

[LICENSE (MIT)](LICENSE)
npm package: @pres/components-core
Description: Core components for pres
Author: Hoyeung Wong
Latest version: 0.4.0

# @pres/components-core

[![npm version][badge-npm-version]][url-npm]
[![npm download monthly][badge-npm-download-monthly]][url-npm]
[![npm download total][badge-npm-download-total]][url-npm]
[![npm dependents][badge-npm-dependents]][url-github]
[![npm license][badge-npm-license]][url-npm]
[![pp install size][badge-pp-install-size]][url-pp]
[![github commit last][badge-github-last-commit]][url-github]
[![github commit total][badge-github-commit-count]][url-github]

[//]: <> (Shields)

[badge-npm-version]: https://flat.badgen.net/npm/v/@pres/components-core

[badge-npm-download-monthly]: https://flat.badgen.net/npm/dm/@pres/components-core

[badge-npm-download-total]:https://flat.badgen.net/npm/dt/@pres/components-core

[badge-npm-dependents]: https://flat.badgen.net/npm/dependents/@pres/components-core

[badge-npm-license]: https://flat.badgen.net/npm/license/@pres/components-core

[badge-pp-install-size]: https://flat.badgen.net/packagephobia/install/@pres/components-core

[badge-github-last-commit]: https://flat.badgen.net/github/last-commit/hoyeungw/pres

[badge-github-commit-count]: https://flat.badgen.net/github/commits/hoyeungw/pres

[//]: <> (Link)

[url-npm]: https://npmjs.org/package/@pres/components-core

[url-pp]: https://packagephobia.now.sh/result?p=@pres/components-core

[url-github]: https://github.com/hoyeungw/pres

##### Fork cluster with configs

#### Install

```console
$ npm install @pres/components-core
```

#### Usage

```js
import { Signaler } from '@pres/components-core'
Signaler.register(instance,process,)
```

#### Meta

[LICENSE (MIT)](LICENSE)
npm package: @pres/components-data
Description: Core components for pres
Author: Hoyeung Wong
Latest version: 0.4.0

# @pres/components-data

[![npm version][badge-npm-version]][url-npm]
[![npm download monthly][badge-npm-download-monthly]][url-npm]
[![npm download total][badge-npm-download-total]][url-npm]
[![npm dependents][badge-npm-dependents]][url-github]
[![npm license][badge-npm-license]][url-npm]
[![pp install size][badge-pp-install-size]][url-pp]
[![github commit last][badge-github-last-commit]][url-github]
[![github commit total][badge-github-commit-count]][url-github]

[//]: <> (Shields)

[badge-npm-version]: https://flat.badgen.net/npm/v/@pres/components-data

[badge-npm-download-monthly]: https://flat.badgen.net/npm/dm/@pres/components-data

[badge-npm-download-total]:https://flat.badgen.net/npm/dt/@pres/components-data

[badge-npm-dependents]: https://flat.badgen.net/npm/dependents/@pres/components-data

[badge-npm-license]: https://flat.badgen.net/npm/license/@pres/components-data

[badge-pp-install-size]: https://flat.badgen.net/packagephobia/install/@pres/components-data

[badge-github-last-commit]: https://flat.badgen.net/github/last-commit/hoyeungw/pres

[badge-github-commit-count]: https://flat.badgen.net/github/commits/hoyeungw/pres

[//]: <> (Link)

[url-npm]: https://npmjs.org/package/@pres/components-data

[url-pp]: https://packagephobia.now.sh/result?p=@pres/components-data

[url-github]: https://github.com/hoyeungw/pres

##### Fork cluster with configs

#### Install

```console
$ npm install @pres/components-data
```

#### Usage

```js
import { Signaler } from '@pres/components-data'
Signaler.register(instance,process,)
```

#### Meta

[LICENSE (MIT)](LICENSE)
npm package: @pres/components-form
Description: Core components for pres
Author: Hoyeung Wong
Latest version: 0.4.0

# @pres/components-form

[![npm version][badge-npm-version]][url-npm]
[![npm download monthly][badge-npm-download-monthly]][url-npm]
[![npm download total][badge-npm-download-total]][url-npm]
[![npm dependents][badge-npm-dependents]][url-github]
[![npm license][badge-npm-license]][url-npm]
[![pp install size][badge-pp-install-size]][url-pp]
[![github commit last][badge-github-last-commit]][url-github]
[![github commit total][badge-github-commit-count]][url-github]

[//]: <> (Shields)

[badge-npm-version]: https://flat.badgen.net/npm/v/@pres/components-form

[badge-npm-download-monthly]: https://flat.badgen.net/npm/dm/@pres/components-form

[badge-npm-download-total]:https://flat.badgen.net/npm/dt/@pres/components-form

[badge-npm-dependents]: https://flat.badgen.net/npm/dependents/@pres/components-form

[badge-npm-license]: https://flat.badgen.net/npm/license/@pres/components-form

[badge-pp-install-size]: https://flat.badgen.net/packagephobia/install/@pres/components-form

[badge-github-last-commit]: https://flat.badgen.net/github/last-commit/hoyeungw/pres

[badge-github-commit-count]: https://flat.badgen.net/github/commits/hoyeungw/pres

[//]: <> (Link)

[url-npm]: https://npmjs.org/package/@pres/components-form

[url-pp]: https://packagephobia.now.sh/result?p=@pres/components-form

[url-github]: https://github.com/hoyeungw/pres

##### Fork cluster with configs

#### Install

```console
$ npm install @pres/components-form
```

#### Usage

```js
import { Signaler } from '@pres/components-form'
Signaler.register(instance,process,)
```

#### Meta

[LICENSE (MIT)](LICENSE)