open-index/open-npm huggingface dataset:
npm package: @splitscript.js/discord
Description: Interact with the discord API in SplitScript.js
Author: ultraviolet
Latest version: 3.2.2

<a href="https://www.npmjs.com/package/@splitscript.js/discord" align="">

![](https://i.imgur.com/L2Jtisg.png)

</a>

<div align="center">

Package for making discord bots

[![install size](https://packagephobia.com/badge?p=@splitscript.js/discord)](https://packagephobia.com/result?p=@splitscript.js/discord) [![downloads](https://img.shields.io/npm/dm/@splitscript.js/discord?color=90ee90&style=flat)](https://www.npmjs.com/package/@splitscript.js/discord)

<a href='https://splitscript.js.org/discord' style='text-decoration:none;'>

<img src='https://i.imgur.com/8PqPYu0.png' alt='docs' height='100px'>

</a>

</div>

## About

This package is part of [SplitScript.js, the everything framework](https://splitscript.js.org)

It is used for building discord bots

## Install

```bash
$ npm i @splitscript.js/discord
```

## Usage

### Listen for events

This authenticates the discord APIs and listens for events from the gateway

```js
import discord from '@splitscript.js/discord'

discord.listen('TOKEN', {
	// Intents get calculated automatically
	intents: ['guild_messages', 'message_content', 'other_intent']
})
```

### Authenticate API requests

You can also use `.login` if you don't want to listen for events, but just want to use the apis

```js
discord.login('TOKEN')
```

### Use the APIs

Most discord APIs should be supported.
You can use them like this:

```ts
await discord.channels.list('A_GUILD_ID')
```

For a full list of APIs, go to [the docs](https://splitscript.js.org/discord)

<div align="center">

![NPM Version](https://img.shields.io/npm/v/%40splitscript.js%2Fdiscord?style=plastic) by [ultraviolet](https://github.com/ultravioletasdf)

</div>
npm package: @splitscript.js/https
Description: Send and listen for HTTPS/HTTP requests
Author: ultraviolet
Latest version: 2.0.1

<a href="#" align="">

![](https://i.imgur.com/37MaHi6.png)

</a>

<div align="center">
<p> Tiny package for sending and receiving <code>https(s)</code> requests </p>

[![install size](https://packagephobia.com/badge?p=@splitscript.js/https)](https://packagephobia.com/result?p=@splitscript.js/https)

[![downloads](https://img.shields.io/npm/dm/@splitscript.js/https?color=90ee90&style=flat)](https://www.npmjs.com/package/@splitscript.js/https)

<a href='https://splitscript.js.org/https' style='text-decoration:none;'>

<img src='https://i.imgur.com/8PqPYu0.png' alt='docs' height='100px'>
</a>

</div>

## About

This package is part of [SplitScript.js, the everything framework](https://splitscript.js.org)

It's a tiny package for sending `http(s)` requests

## Install

```bash
$ npm i @splitscript.js/https
```

## Listen for requests

### Start the server

```ts
import https from '@splitscript.js/https'
https.start({ port: 3000 })
```

### Handle requests

Create a file in functions/http/get

```ts
import { Events } from '@splitscript.js/https'
export default async function ({ req, res }: Events.Get) {
	res.write('<html><body><h1>hello world</h1></body></html>')
	res.end()
}
```

### Parse body

Bodys get parsed automatically

```ts
import { Events } from '@splitscript.js/https'
export default async function ({ req, res, bodyParsed }: Events.Post}) {
    res.end(JSON.stringify(bodyParsed))
}
```

### Raw body

To get the raw body

```ts
import { Events } from '@splitscript.js/https'
export default async function ({ req, res, body }: Events.Post}) {
    res.end(body)
}
```

<div align="center">
<sub><code>v2.0.1</code> | <a href='https://splitscript.js.org/https'>docs</a> </sub>

<sub>by [ultraviolet](https://github.com/ultravioletasdf)</sub>

</div>
npm package: @splitscript.js/scheduler
Description: Schedule events
Author: ultraviolet
Latest version: 1.0.2

<a href="https://www.npmjs.com/package/@splitscript.js/scheduler" align="">

![](https://i.imgur.com/VDZDsa2.png)

</a>

<div align="center">

Package for scheduling events

[![install size](https://packagephobia.com/badge?p=@splitscript.js/scheduler)](https://packagephobia.com/result?p=@splitscript.js/scheduler) [![downloads](https://img.shields.io/npm/dm/@splitscript.js/scheduler?color=90ee90&style=flat)](https://www.npmjs.com/package/@splitscript.js/scheduler)

<a href='https://splitscript.js.org/scheduler' style='text-decoration:none;'>

<img src='https://i.imgur.com/8PqPYu0.png' alt='docs' height='100px'>

</a>

</div>

## About

This package is part of [SplitScript.js, the everything framework](https://splitscript.js.org)

It is used for scheduling events

## Install

```bash
$ npm i '@splitscript.js/scheduler'
```

## Usage

### Times

| unit | ms         | s      |
| :--- | :--------- | :----- |
| s    | 1,000      | 1      |
| m    | 60,000     | 60     |
| h    | 3,600,000  | 3,600  |
| d    | 86,400,000 | 86,400 |

E.g `10m` would mean 600 seconds or 600,000 ms
You can also use decimals, so `0.5m` would be half a minute, or 30 seconds

> ⚠ There is a maximum of `2,147,483,647ms`

### Start scheduling

```js
import scheduler from '@splitscript.js/scheduler'

scheduler.start()
```

### Create a scheduler

Create a file in your functions/scheduler folder like...

```
functions/
	scheduler/
		0.5m - 30 seconds
		1s - every second
		1h - hourly
		1d - daily
```

And export a function:

```ts
export default function () {
	console.log('this is a scheduled event')
}
// or
module.exports = async function () {
	console.log('this is a scheduled event')
}
```

### Schedule once

```ts
import scheduler from '@splitscript.js/scheduler'

scheduler.schedule(time, () => {
	// do someting
})
```

For more, go to [the docs](https://splitscript.js.org/scheduler)

<div align="center">

<sub><code>v1.0.2</code> | by [ultraviolet](https://github.com/ultravioletasdf)</sub>

</div>
npm package: @splitsecond/now
Description: Returns the current ISO 8601 datetime stamp
Author: s14k51
Latest version: 1.0.1

# @splitsecond/now

Returns the current datetime stamp.

`splitsecond` is a simple date manipulation library for Node. This library always returns ISO 8601 datetime stamps in UTC.

# Installation

```bash
npm i -S @splitsecond/now
```

or 

```bash
yarn add @splitsecond/now
```

# Usage

`now(): string`

```javascript
const now = require('@splitsecond/now')

now() // '2020-03-26T20:41:15.791Z'
```
npm package: @splitsecond/parse
Description: Parses a datetime string and returns the parsed string or an empty string if it not parsable
Author: s14k51
Latest version: 1.0.0

# @splitsecond/parse

Parses a datetime string and returns the parsed string or an empty string if it not parsable.

`splitsecond` is a simple date manipulation library for Node. This library always returns ISO 8601 datetime stamps in UTC.

# Installation

```bash
npm i -S @splitsecond/parse
```

or 

```bash
yarn add @splitsecond/parse
```

# Usage

`parse(datetimestamp: string): string`

```javascript
const parse = require('@splitsecond/parse')

parse('03/26/2020 UTC') // '2020-03-26T00:00:00.000Z'
```
npm package: @splitsecond/update
Description: Updates an existing datetime string by adding or subtracting some units
Author: s14k51
Latest version: 1.0.0

# @splitsecond/update

Updates an existing datetime string by adding or subtracting some units.

`splitsecond` is a simple date manipulation library for Node. This library always returns ISO 8601 datetime stamps in UTC.

# Installation

```bash
npm i -S @splitsecond/update
```

or

```bash
yarn add @splitsecond/update
```

# Usage

`update(datetimestamp: string, units: Units): string`

```javascript
const update = require("@splitsecond/update");

// To add, specify the units as positive numbers
update("2020-03-26T20:41:15.791Z", { seconds: 4 });
// '2020-03-26T20:41:19.791Z'

// To subtract, specify them as negative numbers
update("2020-03-26T20:41:15.791Z", { minutes: -3 });
// '2020-03-26T20:38:15.791Z'
```

## Units

```json
{
  "milliseconds": 3,
  "seconds": 4,
  "minutes": -5,
  "hours": 1,
  "days": 1,
  "weeks": 0
}
```
npm package: @splitti/json-schema-to-graphql
Description: [![Build and test](https://github.com/split/json-schema-to-graphql/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/split/json-schema-to-graphql/actions/workflows/main.yml)
Author: Henri Lahtinen
Latest version: 0.2.1

# JSON Schema to GraphQL

[![Build and test](https://github.com/split/json-schema-to-graphql/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/split/json-schema-to-graphql/actions/workflows/main.yml)

This is a tool that compiles `JSON Schema` to `GraphQL` schema output types. It uses awesome [json-schema-to-typescript](https://www.npmjs.com/package/json-schema-to-typescript) under the hood and it's basically custom generator for it, that instead of `TypeScript` outputs `GraphQL` using same `AST`.

## Example

Input:

```json
{
  "title": "Example Schema",
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string"
    },
    "lastName": {
      "type": "string"
    },
    "age": {
      "description": "Age in years",
      "type": "integer",
      "minimum": 0
    },
    "hairColor": {
      "title": "Hair color",
      "enum": ["black", "brown", "blue"],
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": ["firstName", "lastName"]
}
```

Output:

```graphql
type ExampleSchema {
  firstName: String!
  lastName: String!

  """
  Age in years
  """
  age: Int
  hairColor: HairColor
}

enum HairColor {
  black
  brown
  blue
}
```

## Installation

Using Yarn:

```sh
yarn add @splitti/json-schema-to-graphql
```

Or, using NPM:

```sh
npm install @splitti/json-schema-to-graphql --save
```

## CLI Usage

```
json-schema-to-graphql example.json example.graphql
```

Where `example.json` is your `JSON schema` file and `example.graphql` is the output schema is being exported.

## Known limitations and missing features

- There is no unions of scalar values in GraphQL
  - Those would be needed to be wrapped to objects
- There is no string or number literals in the GraphQL
  - Unions of string literals are transformed to enums
- GraphQL doesn't support intersections meaning `allOf` definitions need to be merged
  - Currently has on quite limited support for objects
  - Available merge tools don't seem to maintain object reference equality causing duplicate types.
- There is no support for tuples in GraphQL
  - Currently those are changed to lists when possible
- There is no support for generating input types for now

## Development

This library uses [dts-cli](https://github.com/weiran-zsd/dts-cli) as zero configuration development tool.

Start development watcher with:

```sh
npm run start
```

Run tests with:

```
npm run test
```
npm package: @splittydev/cra-template
Description: SplittyDev's Create React App Template.
Author: Marco Quinten
Latest version: 1.0.1

# cra-template
> SplittyDev's personal and production-ready create-react-app template.

## Tech Stack

- [Jest] as test runner
- [Testing Library] for component testing
- [React Router DOM] for routing
- [Styled Components] for styling
- [Recoil] for state management
- [Recoil Persist] for state persistence and hydration

## Additional Goodies

- Imports relative to `src` are enabled by default:
  ```js
  import MyComponent from 'components/MyComponent'
  import MyPage from 'pages/MyPage'
  ```
- Provides a basic `.editorconfig` file
- Provides a basic routing skeleton in `src/App.js`
- Provides a basic state management skeleton using recoil
- Provides a default `Page` component for consistent page styling

## Project Structure

```
.
├── src
│   ├── components
│   │   └── Page.js
│   ├── pages
│   │   └── HomePage.js
│   ├── state
│   │   ├── index.js
│   │   ├── atoms.js
│   │   └── selectors.js
│   ├── App.js
│   ├── App.test.js
│   ├── index.css
│   ├── index.js
│   ├── reportWebVitals.js
│   └── setupTests.js
├── .editorconfig
├── .gitignore
├── README.md
└── jsconfig.json
```

For more information, please refer to:

- [Getting Started](https://create-react-app.dev/docs/getting-started) – How to create a new app.
- [User Guide](https://create-react-app.dev) – How to develop apps bootstrapped with Create React App.

[Jest]: https://www.npmjs.com/package/jest
[Testing Library]: https://www.npmjs.com/package/@testing-library/react
[React Router DOM]: https://www.npmjs.com/package/react-router-dom
[Styled Components]: https://www.npmjs.com/package/styled-components
[Recoil]: https://www.npmjs.com/package/recoil
[Recoil Persist]: https://www.npmjs.com/package/recoil-persist
npm package: @spliu/zustand-immer
Description: 一个基于 immer Patches 实现 redo undo 功能的 Zustand 中间件
Author: 2531800823@qq.com
Latest version: 1.0.2

# @spliu/zustand-immer

一个基于 Immer 的 patch 特性的轻量级状态管理解决方案，具有撤销/重做功能。受 [zundo](https://github.com/charkour/zundo) 库的启发。

## 核心特点

- 🎯 使用 Immer 的 patch 特性实现高效的状态管理
- ⚡ 只存储状态差异（patches），而不是完整的状态副本
- 🔄 内置撤销/重做功能
- 🎮 轻松集成到现有的 Zustand 存储中
- 📦 小型包大小
- 💪 TypeScript 支持

## 为什么使用 Patches？

与存储完整的状态快照相比，这个库使用 Immer 的 patch 特性来存储状态之间的差异（patches）。这种方法显著减少了内存使用量并提高了性能，特别是在处理大型状态对象时。

## 安装

```bash
npm install @spliu/zustand-immer
# 或
yarn add @spliu/zustand-immer
```

## 基础使用

```tsx
import { zustandPatchUndo } from '@spliu/zustand-immer'
import { create } from 'zustand'

interface Store {
  count: number
  text: string
  increase: () => void
  decrease: () => void
  setText: (text: string) => void
}

const useStore = create<Store>()(
  zustandPatchUndo(set => ({
    count: 0,
    text: '',
    increase: () => set(state => ({ count: state.count + 1 })),
    decrease: () => set(state => ({ count: state.count - 1 })),
    setText: (text: string) => set({ text }),
  })),
)

// 在组件中使用
function MyComponent() {
  const { count, text, increase, decrease, setText } = useStore()
  const { undo, redo, clear, redoStack, undoStack } = useStore.temporal.getState()

  return (
    <>
      <div>
        Redo Stack:
        {JSON.stringify(redoStack)}
      </div>
      <div>
        Undo Stack:
        {JSON.stringify(undoStack)}
      </div>
      <div>
        Count:
        {count}
      </div>
      <div>
        Text:
        {text}
      </div>
      <button onClick={increase}>Increase</button>
      <button onClick={decrease}>Decrease</button>
      <button onClick={() => setText('hello')}>Set Text</button>
      <button onClick={() => undo()}>Undo</button>
      <button onClick={() => redo()}>Redo</button>
      <button onClick={clear}>Clear History</button>
    </>
  )
}
```

## API

### zustandPatchUndo

一个用于增强 Zustand 存储的中间件，添加撤销/重做功能。

### 存储方法

临时存储提供以下方法：

- `undo()`: 撤销到上一个状态
- `redo()`: 应用下一个状态（如果可用）
- `clear()`: 清除撤销/重做历史

### 配置

默认情况下，历史记录限制为 10 个状态。可以通过修改源代码中的 `MAX_HISTORY_LIMIT` 常量来更改此限制。

## 工作原理

1. 当状态发生变化时，Immer 的 `produceWithPatches` 生成 patches 和逆向 patches
2. 只存储这些 patches 在历史栈中，而不是完整的状态副本
3. `undo` 操作应用逆向 patches 来撤销更改
4. `redo` 操作应用正向 patches 来恢复更改
5. 新的状态更改清除 redo 栈以维护线性历史

## 许可证

MIT