open-index/open-npm huggingface dataset:
npm package: @sundawning/autumn-js-0-1-40-patch-3
Description: Autumn JS Library
Author: John Yeo
Latest version: 0.1.40

# Autumn JS Library

`autumn-js` is a JavaScript/TypeScript library for interacting with the Autumn pricing and billing platform. This package provides both a server-side SDK for the Autumn API and a React package for client-side implementation.

## Installation

```bash
npm install autumn-js
```

## Docs
To learn how to use `autumn-js`, visit our documentation [here](https://docs.useautumn.com)
npm package: @sundawning/cesium-log-camera-view
Description: 在 Cesium 场景里打印当前视角
Author: sundawning
Latest version: 1.0.3

在 Cesium 场景里打印当前视角

# 安装

```sh
pnpm add @sundawning/cesium-log-camera-view
```

# 使用

```html
<script
  type="text/javascript"
  src="./node_modules/@sundawning/cesium-log-camera-view/index.js"
></script>
<script type="text/javascript">
  // 已经加载Cesium依赖，已经使用Cesium.Viewer创建了viewer
  Cesium.Plugins.SunDawning.log_camera_view(viewer);
</script>
```

# 使用打印的视角来设置视角

```js
viewer.camera.setView({
  destination: {
    x: -1580047.61070081,
    y: 5523168.041837127,
    z: 2775941.753210669,
  },
  orientation: {
    heading: 0.46157737888432493,
    pitch: -0.5245022100302306,
    roll: 0.0002878732439342002,
  },
});
```

# 一个测试页面

2022-06-10 12:45:19

```sh
pnpm run test
# http://127.0.0.1:8080
```

![](./screenshot.png)
npm package: @sundawning/child-process-exec-with-log
Description: 异步执行命令，并输出到主进程里。
Author: sundawning
Latest version: 1.0.1

异步执行命令，并输出到主进程里。

2022-06-06 09:15:51

# 安装

```sh
pnpm add @sundawning/child-process-exec-with-log
```

# 使用

```js
const exec = require("@sundawning/child-process-exec-with-log");
// "C:\Users\SunDawning\Downloads\ngrok-v3-stable-windows-amd64\ngrok.exe"
exec(
  "c:/users/sundawning/downloads/ngrok-v3-stable-windows-amd64/ngrok http 3000"
);
```

```
[6/6/2022, 9:19:30 AM] 执行命令 c:/users/sundawning/downloads/ngrok-v3-stable-windows-amd64/ngrok http 3000
The system cannot find the path specified.
```
npm package: @sundawning/chrome-extensions-sync-local-storage
Description: 从一个网站获取所有LocalStorage（复制），并将其设置到另一个网站（粘贴），即 LocalStorage同步。
Author: sundawning
Latest version: 1.0.2

从一个网站获取所有 LocalStorage（复制），并将其设置到另一个网站（粘贴），即 LocalStorage 同步。

2022-08-05 10:05:55

# 安装

```sh
pnpm add @sundawning/chrome-extensions-sync-local-storage
```

# 使用

1. chrome://extensions/
2. 开发者模式（右上角）
3. 加载已解压的扩展程序
4. node_modules/@sundawning/chrome-extensions-sync-local-storage/dist
npm package: @sundawning/console-log-timestamp
Description: 打印，不同于console.log，带有时间戳。
Author: sundawning
Latest version: 1.0.0

打印，不同于 console.log，带有时间戳。

2022-06-05 19:33:11

# 安装

```sh
pnpm add @sundawning/console-log-timestamp
```

# 使用

```js
const log = require("@sundawning/console-log-timestamp");
log("Hello");
```

```
[2022/6/5 19:32:49] Hello
```
npm package: @sundawning/cpolar-api
Description: cpolar的API，https://www.cpolar.com/
Author: sundawning
Latest version: 2.0.4

cpolar 的 API，https://www.cpolar.com/

2022-10-27 09:48:45

# 安装

```sh
pnpm add @sundawning/cpolar-api
```

# 使用

```js
const cpolar = require("@sundawning/cpolar-api");
cpolar.untilGetURL({
  email: "YOUR_EMAIL",
  password: "YOUR_PASSWORD",
  timeout: 10 * 1000,
});
```

将打印出：

```
POST /login，出现302时，不跳转，拿到cookie
(node:4456) ExperimentalWarning: The Fetch API is an experimental featur
e. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
AxiosHeaders {
  server: 'nginx',
  date: 'Sat, 29 Oct 2022 08:35:47 GMT',
  'content-length': '0',
  connection: 'close',
  location: '/get-started',
  'set-cookie': [
    'session=c7e708c3-9767-456f-c6a6-f6c9e5ef4c45; Path=/; Domain=dashbo
ard.cpolar.com; Expires=Sat, 07 Sep 2047 17:00:05 GMT; Max-Age=784455858
; HttpOnly; SameSite=Lax'
  ],
  'x-frame-options': 'SAMEORIGIN',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'referrer-policy': 'no-referrer-when-downgrade',
  'content-security-policy': "default-src * data: 'unsafe-eval' 'unsafe-
inline'",
  [Symbol(defaults)]: null
}
cookie session=c7e708c3-9767-456f-c6a6-f6c9e5ef4c45
data [
  { public_url: 'tcp://3.tcp.vip.cpolar.cn:11164', proto: 'tcp' },
  { public_url: 'http://1c52a264.r3.vip.cpolar.cn', proto: 'http' },
  { public_url: 'https://1c52a264.r3.vip.cpolar.cn', proto: 'https' }
]
url https://1c52a264.r3.vip.cpolar.cn
```

# 全局安装

2022-11-24 11:09:04

```sh
pnpm add -g @sundawning/cpolar-api
```

查看使用说明：

```sh
cpolar-api --help
```
npm package: @sundawning/freenom-url-forwarding
Description: 将freenom域名重定向到URL，相当于在freenom里给域名设置URL Forwarding。
Author: sundawning
Latest version: 1.0.3

将 freenom 域名重定向到 URL，相当于在 freenom 里给域名设置 URL Forwarding。

2022-07-30 15:20:03

# 安装

```sh
pnpm add @sundawning/freenom-url-forwarding
```

# 使用

## redirect

```js
const FreenomURLForwarding = require("@sundawning/freenom-url-forwarding");
FreenomURLForwarding.redirect({
  username: "username",
  password: "password",
  domain: "domain",
  url: "https://www.bing.com/",
});
```

将打印出：

```
1. GET https://my.freenom.com/clientarea.php 获取set-cookie [ 'WHMCSZH5eHTGhfvzP=h35tgk7r0qog; path=/; HttpOnly' ]
2. 302重定向 GET https://my.freenom.com/clientarea.php，带上cookie请求，获取token 778a5fddba9cc63561d201b3
(node:8616) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
3. POST https://my.freenom.com/dologin.php，带上cookie、token、账号和密码，content-type: application/x-www-form-urlencoded，获取新的cookie [
  'WHMCSZH5eHTGhfvzP=tbb5039ciq; path=/; HttpOnly',
  'WHMCSUser=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; httponly'
]
domains [
  {
    domain: 'domain',
    registration: '2022-07-30',
    expiry: '2023-07-30',
    status: 'Active',
    type: 'Free',
    id: 'id'
  }
]
59108cb3e65e02973a2
https://www.bing.com/
域名重定向到 domain => https://www.bing.com/
```

## untilRedirect

每隔 10 秒轮询一次，直到重定向成功：

```js
const FreenomURLForwarding = require("@sundawning/freenom-url-forwarding");
FreenomURLForwarding.untilRedirect({
  username: "username",
  password: "password",
  domain: "domain",
  url: "https://www.bing.com/",
  timeout: "10*1000",
});
```
npm package: @sundawning/get-port
Description: 查找可用的端口
Author: sundawning
Latest version: 1.0.0

查找可用的端口

2022-06-05 21:27:36

# 安装

```sh
pnpm add @sundawning/get-port
```

# 使用

```js
const get_port = require("@sundawning/get-port");
const log = require("@sundawning/console-log-timestamp");
index();
async function index() {
  const port_0 = await get_port();
  log("查找到可用端口", port_0);
  const port_1 = await get_port({ port: port_0 + 1 });
  log("查找到可用端口", port_1);
}
```

```
[2022/6/5 21:29:42] 查找到可用端口 8000
[2022/6/5 21:29:43] 查找到可用端口 8001
```
npm package: @sundawning/get-random-int
Description: 生成min和max之间的随机整数
Author: sundawning
Latest version: 1.0.0

生成 min 和 max 之间的随机整数

2022-06-05 19:38:58

# 安装

```sh
pnpm add @sundawning/get-random-int
```

# 使用

```js
const log = require("@sundawning/console-log-timestamp");
const get_random_int = require("@sundawning/get-random-int");
log(get_random_int({ min: 10 }));
log(get_random_int({ max: 100 }));
log(get_random_int({ min: 20, max: 100 }));
```

```
[2022/6/5 19:41:33] 10
[2022/6/5 19:41:33] 50
[2022/6/5 19:41:33] 95
```
npm package: @sundawning/get-random-port
Description: 获取随机可用的端口
Author: sundawning
Latest version: 1.0.0

获取随机可用的端口

2022-06-05 21:38:15

# 安装

```sh
pnpm add @sundawning/get-random-port
```

# 使用

```js
const get_random_port = require("@sundawning/get-random-port");
const log = require("@sundawning/console-log-timestamp");
index();
async function index() {
  log(await get_random_port());
  log(await get_random_port());
}
```

```
[2022/6/5 21:36:04] 5294
[2022/6/5 21:36:04] 57796
```
npm package: @sundawning/json-data-sqlite-database-converter
Description: JSON数据与SQLite表相互转换
Author: sundawning
Latest version: 1.0.1

JSON 数据与 SQLite 表相互转换

2022-09-04 12:32:01

# 安装

```sh
pnpm add @sundawning/json-data-sqlite-database-converter
```

# 使用

```js
const sqlite = require("sqlite");
const sqlite3 = require("sqlite3");
const {
  JSONDataToSQLiteTable,
  SQLiteTableToJSONData,
} = require("@sundawning/json-data-sqlite-database-converter");
async function index() {
  // 新增数据库
  const sqlite_database = await sqlite.open({
    filename: require("path").resolve(__dirname, "./database.db"),
    driver: sqlite3.Database,
  });
  // 表名
  const table_name = "hello";
  // 第一条数据
  console.log(
    await JSONDataToSQLiteTable(
      [
        {
          key: 0,
          createTime: 1662265343067,
          title: "title",
        },
      ],
      sqlite_database,
      table_name
    )
  );
  // 第二条数据
  console.log(
    await JSONDataToSQLiteTable(
      [
        {
          key: 1,
          updateTime: 1662265346056,
          content: "content",
          deleted: true,
        },
      ],
      sqlite_database,
      table_name
    )
  );
  // 新增数据（每执行一次将会新增数据）
  console.log(
    await JSONDataToSQLiteTable(
      [
        {
          updateTime: 1662265346056,
          content: "content",
          deleted: true,
        },
      ],
      sqlite_database,
      table_name
    )
  );
  // 转换为JSON
  console.log(await SQLiteTableToJSONData(sqlite_database, table_name));
}
index();
```

首次执行时：

```js
0
1
2
[
  { key: 0, createTime: "1662265343067", title: "title" },
  {
    key: 1,
    updateTime: "1662265346056",
    content: "content",
    deleted: "true",
  },
  {
    key: 2,
    updateTime: "1662265346056",
    content: "content",
    deleted: "true",
  },
];
```

第二次执行时：

```js
undefined
undefined
3
[
  { key: 0, createTime: "1662265343067", title: "title" },
  {
    key: 1,
    updateTime: "1662265346056",
    content: "content",
    deleted: "true",
  },
  {
    key: 2,
    updateTime: "1662265346056",
    content: "content",
    deleted: "true",
  },
  {
    key: 3,
    updateTime: "1662265346056",
    content: "content",
    deleted: "true",
  },
];
```
npm package: @sundawning/koa-post-data-parser
Description: koa处理post请求
Author: sundawning
Latest version: 1.0.0

koa 处理 post 请求

2022-09-03 21:09:23

# 安装

```sh
pnpm add @sundawning/koa-post-data-parser
```

# 使用

启动 HTTP Server：

```js
const Koa = require("koa");
const app = new Koa();
app.listen(28080);
const parse = require("@sundawning/koa-post-data-parser");
app.use(async function (context) {
  const { method, url } = context;
  // POST
  if (method === "POST") {
    // /hello
    if (url.startsWith("/hello")) {
      const body = await parse(context);
      console.log("body", body);
      const json = JSON.parse(body);
      console.log("json", json);
      context.response.body = json;
      return;
    }
    return;
  }
});
```

以 POST 方式发送数据：

```
POST http://localhost:28080/hello
Content-Type: application/json; charset=utf-8
{
    "name": "jobsimi"
}
```

Response：

```
{
    "name": "jobsimi"
}
```

在 HTTP Server 里打印出的内容：

```
body {
    "name": "jobsimi"
}
json { name: 'jobsimi' }
```
npm package: @sundawning/koa-sqlite-restful-api
Description: 使用 Koa 来启动 HTTP 服务器，使用 SQLite 作为数据库，来提供 RESTful API。
Author: sundawning
Latest version: 1.0.2

使用 Koa 来启动 HTTP 服务器，使用 SQLite 作为数据库，来提供 RESTful API。

2022-09-09 21:48:08

# 安装

```sh
pnpm add @sundawning/koa-sqlite-restful-api
```

# 使用

```js
const KoaSQLiteRESTfulAPI = require("@sundawning/koa-sqlite-restful-api");
const path = require("path");
KoaSQLiteRESTfulAPI.start({
  koa: {
    port: 8080,
  },
  sqlite: {
    filename: path.resolve(__dirname, "./database.db"),
    table_name: "todos",
  },
});
```

执行后将启动服务器并打印出：

```
app.listen(8080)
```

- Koa 接口服务器的地址为：http://localhost:8080
- SQLite 数据库文件在 database.db

## POST /api/todos

POST http://localhost:8080/api/todos

```json
{
  "title": "title",
  "content": "content"
}
```

将打印出：

```
[2022/9/9 21:48:42] POST /api/todos PostmanRuntime/7.29.2
[2022/9/9 21:48:42] post_data {
    "title": "title",
    "content": "content"
}
```

并返回：

```json
{
  "key": 1,
  "title": "title",
  "content": "content"
}
```

## GET /api/todos?current=1&pageSize=10

GET http://localhost:8080/api/todos?current=1&pageSize=10

打印出：

```
[2022/9/9 21:51:59] GET /api/todos?current=1&pageSize=10 PostmanRuntime/7.29.2
```

返回：

```json
{
  "pagination": {
    "current": 1,
    "pageSize": 10,
    "pageTotal": 1,
    "total": 1
  },
  "dataSource": [
    {
      "key": 1,
      "title": "title",
      "content": "content"
    }
  ]
}
```

## GET /api/todos/:key

GET http://localhost:8080/api/todos/1

打印出：

```
[2022/9/9 21:53:05] GET /api/todos/1 PostmanRuntime/7.29.2
```

返回：

```json
{
  "key": 1,
  "title": "title",
  "content": "content"
}
```

## PATCH /api/todos/:key

DELETE http://localhost:8080/api/todos/1

```json
{
  "content": "_content",
  "deleted": true
}
```

打印出：

```
[2022/9/9 21:56:09] PATCH /api/todos/1 PostmanRuntime/7.29.2
[2022/9/9 21:56:09] post_data {
    "content": "_content",
    "deleted": true
}
```

返回：

```json
{
  "key": 1,
  "title": "title",
  "content": "_content",
  "deleted": "true"
}
```

## DELETE /api/todos/:key

DELETE http://localhost:8080/api/todos/1

打印出：

```
[2022/9/9 22:00:16] DELETE /api/todos/1 PostmanRuntime/7.29.2
```

返回状态码 204
npm package: @sundawning/ngrok-api-with-axios
Description: 使用axios来使用ngrok的API，https://ngrok.com/docs/api#api-tunnels-list
Author: sundawning
Latest version: 1.0.0

ngrok-api-with-axios 使用 axios 来使用 ngrok 的 API，https://ngrok.com/docs/api#api-tunnels-list

2022-10-26 16:54:05

# 安装

```sh
pnpm add @sundawning/ngrok-api-with-axios
```

# 使用

```js
const ngrok = require("@sundawning/ngrok-api-with-axios");
ngrok.untilGetURL({
  API_KEY: "YOUR_API_KEY",
  filter: function ({ region, proto }) {
    return region === "jp" && proto === "https";
  },
  timeout: 10 * 1000,
});
```

将打印出：

```
data {
  tunnels: [
    {
      id: 'tn_2GeYNYfyAs8LL3xBRZD8bKqexcZ',
      public_url: 'tcp://0.tcp.ap.ngrok.io:15642',
      started_at: '2022-10-26T02:14:36Z',
      proto: 'tcp',
      region: 'ap',
      tunnel_session: [Object],
      endpoint: [Object],
      forwards_to: ''
    },
    {
      id: 'tn_2GeYNYWsp3Is6B5PgBMcWquYDWW',
      public_url: 'http://5459-120-229-49-179.jp.ngrok.io',
      started_at: '2022-10-26T02:14:36Z',
      proto: 'http',
      region: 'jp',
      tunnel_session: [Object],
      endpoint: [Object],
      forwards_to: ''
    },
    {
      id: 'tn_2GeYNUla9w07AJW67patzzDODB8',
      public_url: 'https://5459-120-229-49-179.jp.ngrok.io',
      started_at: '2022-10-26T02:14:36Z',
      proto: 'https',
      region: 'jp',
      tunnel_session: [Object],
      endpoint: [Object],
      forwards_to: ''
    }
  ],
  uri: 'https://api.ngrok.com/tunnels',
  next_page_uri: null
}
url https://5459-120-229-49-179.jp.ngrok.io
```
npm package: @sundawning/ngrok-freenom-redirect
Description: 启动ngrok后获取网址并将设置为freenom域名的重定向网址
Author: sundawning
Latest version: 1.0.0

启动 ngrok 后获取网址并将设置为 freenom 域名的重定向网址

2022-09-09 14:03:06

# 安装

```sh
pnpm add @sundawning/ngrok-freenom-redirect
```

# 使用

```js
const NgrokFreenom = require("@sundawning/ngrok-freenom-redirect");
NgrokFreenom.start({
  ngrok: {
    token: "token",
    port: 8080,
  },
  freenom: {
    username: "username",
    password: "password",
    domain: "domain",
  },
});
```

```
启动ngrok内网穿透服务器 http 8080 => https://2363-183-240-6-199.eu.ngrok.io
1. GET https://my.freenom.com/clientarea.php 获取set-cookie [ 'WHMCSZH5eHTGhfvzP=sl6h0m; path=/; HttpOnly' ]
2. 302重定向 GET https://my.freenom.com/clientarea.php，带上cookie请求，获取token
11df1efc9235009b75364580
3. POST https://my.freenom.com/dologin.php，带上cookie、token、账号和密码，content-type: application/x-www-form-urlencoded，获取新的cookie [
  'WHMCSZH5eHTGhfvzP=gadq3vbk; path=/; HttpOnly',
  'WHMCSUser=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; httponly'
]
domains [
  {
    domain: 'domain',
    registration: '2022-07-30',
    expiry: '2023-07-30',
    status: 'Active',
    type: 'Free',
    id: 'id'
  }
]
676dbc9dd1d8e3
https://2363-183-240-6-199.eu.ngrok.io
域名重定向到 domain => https://2363-183-240-6-199.eu.ngrok.io
```
npm package: @sundawning/ngrok-random-region
Description: 使用随机的地区来启动ngrok内网穿透服务器
Author: sundawning
Latest version: 1.0.0

使用随机的地区来启动 ngrok 内网穿透服务器

2022-09-08 21:38:26

# 安装

```sh
pnpm add @sundawning/ngrok-random-region
```

# 使用

```js
const NgrokRandomRegion = require("@sundawning/ngrok-random-region");
NgrokRandomRegion.start({
  token: "token",
});
```

打印出并一直处于运行中：

```
启动ngrok内网穿透服务器 http 8080 =>  https://63a0-120-229-49-9.ngrok.io
```

停止后再次执行：

```
启动ngrok内网穿透服务器 http 8080 => https://c7e0-120-229-49-9.eu.ngrok.io
```
npm package: @sundawning/node-options-openssl-legacy-provider
Description: 在node 17、node 18和node 19里需要设置NODE_OPTIONS=--openssl-legacy-provider
Author: sundawning
Latest version: 1.0.3

在 node 17、node 18 和 node 19 里需要设置
NODE_OPTIONS=--openssl-legacy-provider
但在 node 16 里不需要设置，解决
Error: error:0308010C:digital envelope routines::unsupported
问题。

2022-06-07 15:06:41

# 安装

```sh
pnpm add @sundawning/node-options-openssl-legacy-provider
```

# 使用

譬如对于 Umi 项目，创建 start.js 并用 node start.js 来替换 start 命令：

```js
const node_options_openssl_legacy_provider = require("@sundawning/node-options-openssl-legacy-provider");
const log = require("@sundawning/console-log-timestamp");
log(`cross-env ${node_options_openssl_legacy_provider()} umi dev`);
```

在 Node 18 下输出：

```
[6/7/2022, 3:09:10 PM] cross-env NODE_OPTIONS=--openssl-legacy-provider umi dev
```

在 Node 16 下输出：

```
[6/7/2022, 3:09:10 PM] cross-env  umi dev
```
npm package: @sundawning/pm2-async
Description: 将pm2的操作转为async
Author: sundawning
Latest version: 1.0.0

将 pm2 的操作转为 async

2022-09-08 22:08:38

# 安装

```sh
pnpm add @sundawning/pm2-async
```

# 使用

```js
const pm2 = require("@sundawning/pm2-async");
async function index() {
  await pm2.connect();
  console.log("list", await pm2.list());
  await pm2.disconnect();
}
index();
```

将打印出：

```
list [
  {
    pid: 12812,
    name: 'index',
    pm2_env: {
      kill_retry_time: 100,
      windowsHide: true,
      ...
      unstable_restarts: 0,
      version: '1.0.0',
      node_version: '18.0.0',
      versioning: [Object],
      exit_code: 0
    },
    pm_id: 0,
    monit: { memory: 43708416, cpu: 0 }
  }
]
```
npm package: @sundawning/pm2-koa-sqlite-restful-api
Description: 使用pm2来运行@sundawning/koa-sqlite-restful-api
Author: sundawning
Latest version: 1.0.1

使用 pm2 来运行@sundawning/koa-sqlite-restful-api

2022-09-10 11:15:18

# 安装

```sh
pnpm add @sundawning/pm2-koa-sqlite-restful-api @sundawning/koa-sqlite-restful-api
```

# 使用

```js
const PM2KoaSQLiteRESTfulAPI = require("@sundawning/pm2-koa-sqlite-restful-api");
const path = require("path");
PM2KoaSQLiteRESTfulAPI.start({
  pm2: { cwd: __dirname },
  koa: {
    port: 8080,
  },
  sqlite: {
    filename: path.resolve(__dirname, "./database.db"),
    table_name: "todos",
  },
});
```

第一次执行：

```
正在运行 []
启动 nginxTODOSServer
{
  script: 'pm2-koa-sqlite-restful-api\
i\\.temporary\\nginxTODOSServer.js',
  name: 'nginxTODOSServer',
  cwd: 'pm2-koa-sqlite-restful-api',

  args: undefined,
  env: { io: undefined },
  username: 'username',
  merge_logs: true
}
```

会在当前目录 cwd 下创建“.temporary/nginxTODOSServer.js”临时文件和“database.db”数据库文件。

第二次执行时:

```
正在运行 [ 'nginxTODOSServer' ]
```
npm package: @sundawning/pm2-start-javascript
Description: 使用pm2来运行一段javascript文本
Author: sundawning
Latest version: 1.0.3

使用 pm2 来运行一段 javascript 文本

2022-09-10 09:48:12

# 安装

```sh
pnpm add @sundawning/pm2-start-javascript
```

# 使用

```js
const pm2 = require("@sundanwing/pm2-start-javascript");
pm2.start({
  name: "hello",
  javascript: `require("child_process").exec("npx http-server");`,
});
```

将在当前目录 cwd 创建“.temporary/hello.js”文件，内容是 javascript 文本，并在 pm2 里运行且名称是“hello”。
npm package: @sundawning/pm2-start-js-file
Description: 使用pm2启动.js文件，不重复启动。
Author: sundawning
Latest version: 1.0.0

使用 pm2 启动.js 文件，不重复启动。

2022-09-08 22:36:27

# 安装

```sh
pnpm add @sundawning/pm2-start-js-file
```

# 使用

```js
const pm2 = require("@sundawning/pm2-start-js-file");
const path = require("path");
pm2.start({
  name: "pm2-start-js-file",
  script: path.resolve(__dirname, "./server.js"),
});
```

首次执行时：

```
正在运行 []
启动 pm2-start-js-file
{
  script: '\\@sundawning\\pm2-start-js-file\\server.js',
  name: 'pm2-start-js-file',
  cwd: undefined,
  args: undefined,
  env: { io: undefined },
  username: 'username',
  merge_logs: true
}
```

再次执行时：

```
正在运行 [ 'pm2-start-js-file' ]
```
npm package: @sundawning/sqlite-base64
Description: SQLite BASE64编码与解码
Author: sundawning
Latest version: 1.0.2

SQLite BASE64 编码与解码

2022-09-05 09:28:07

# 安装

```sh
pnpm add @sundawning/sqlite-base64
```

# 使用

```js
const {
  encode,
  decode,
  encodeRow,
  decodeRow,
} = require("@sundawning/sqlite-base64");
{
  const _encode = encode("拼");
  console.log(`encode("拼")`, _encode);
  console.log(`decode(${_encode})`, decode(_encode));
}
{
  const _encode = encodeRow({ 拼: "音" });
  console.log(`encodeRow({ 拼: "音" })`, _encode);
  console.log(`decodeRow(${JSON.stringify(_encode)})`, decodeRow(_encode));
}
```

执行时：

```js
encode("拼") JUU2JThCJUJD
decode(JUU2JThCJUJD) 拼
encodeRow({ 拼: "音" }) { JUU2JThCJUJD: 'JUU5JTlGJUIz' }
decodeRow({"JUU2JThCJUJD":"JUU5JTlGJUIz"}) { '拼': '音' }
```
npm package: @sundawning/sqlite-database
Description: SQLite数据库
Author: sundawning
Latest version: 1.0.20

SQLite 数据库

2022-09-04 16:53:56

# 安装

```sh
pnpm add @sundawning/sqlite-database
```

# 使用

```js
const {
  create,
  selects,
  select,
  insert,
  update,
  remove,
  total,
  selectPage,
} = require("@sundawning/sqlite-database");
const path = require("path");
async function index() {
  const database = await create({
    filename: path.resolve(__dirname, "./database.db"),
  }); // 新增数据库
  const table_name = "hello"; // // 表名
  // 新增数据
  const key = await insert({
    database,
    table_name,
    row: { createTime: 1662265343067, title: "title" },
  });
  await insert({
    database,
    table_name,
    row: { deleted: true },
  });
  console.log("key", key);
  console.log("selects", await selects({ database, table_name })); // 查询
  console.log("total", await total({ database, table_name }));
  console.log(
    "selectPage",
    await selectPage({ database, table_name, pageSize: 1, current: 1 })
  ); // 分页查询
  await select({ database, table_name, key }); // 查询
  await update({
    database,
    table_name,
    key,
    row: { title: "content", status: "DONE" },
  }); // 修改
  await update({
    database,
    table_name,
    key,
    row: { KEY: "KEY" },
  }); // 修改“KEY”，会被忽略，因为已经存在key，列名不区分大小写。
  console.log("selects", await selects({ database, table_name })); // 查询
  await remove({ database, table_name, key }); // 删除
  console.log("selects", await selects({ database, table_name })); // 查询
  console.log("total", await total({ database, table_name }));
}
index();
```

首次执行时：

```js
key 1
selects [
  { key: 1, createTime: '1662265343067', title: 'title' },
  { key: 2, deleted: 'true' }
]
total 2
selectPage [ { key: 1, createTime: '1662265343067', title: 'title' } ]
selects [
  {
    key: 1,
    createTime: '1662265343067',
    title: 'content',
    status: 'DONE'
  },
  { key: 2, deleted: 'true' }
]
selects [ { key: 2, deleted: 'true' } ]
total 1
```

第二次执行时：

```js
key 3
selects [
  { key: 2, deleted: 'true' },
  { key: 3, createTime: '1662265343067', title: 'title' },
  { key: 4, deleted: 'true' }
]
total 3
selectPage [ { key: 2, deleted: 'true' } ]
selects [
  { key: 2, deleted: 'true' },
  {
    key: 3,
    createTime: '1662265343067',
    title: 'content',
    status: 'DONE'
  },
  { key: 4, deleted: 'true' }
]
selects [ { key: 2, deleted: 'true' }, { key: 4, deleted: 'true' } ]
total 2
```
npm package: @sundawning/sqlite-database-server
Description: SQLite 数据库服务器，用一堆 SQLite 格式的文件来搭建服务器，以HTTP的方式来管理数据库。
Author: sundawning
Latest version: 1.0.1

SQLite 数据库服务器，用一堆 SQLite 格式的文件来搭建服务器，以 HTTP 的方式来管理数据库。

2022-09-21 20:19:25

# 安装

```sh
pnpm add @sundawning/sqlite-database-server
```

# 使用

启动服务器：

```js
const SQLiteServer = require("@sudnawning/sqlite-database-server");
SQLiteServer.start({
  port: 1234,
});
```

可以处理如下请求：

- POST /api/databases/:database_name

## POST /api/databases/:database_name

查询 hello 数据库的所有表名：

POST /api/databases/hello

Content-Type: application/json

```json
{
  "sql": "SELECT * FROM sqlite_master WHERE type = 'table'"
}
```

会返回：

```json
[
  {
    "type": "table",
    "name": "table_1",
    "tbl_name": "table_1",
    "rootpage": 2,
    "sql": "CREATE TABLE table_1 ( key INTEGER PRIMARY KEY AUTOINCREMENT )"
  },
  {
    "type": "table",
    "name": "sqlite_sequence",
    "tbl_name": "sqlite_sequence",
    "rootpage": 3,
    "sql": "CREATE TABLE sqlite_sequence(name,seq)"
  }
]
```

# 命令行

## 安装

```sh
pnpm add -g @sundawning/sqlite-database-server
```

## 使用

参数与包在代码里的参数保持一致，在命令行中以“--”开头即可。

比如 28080 端口，数据库文件夹在“./files”（默认是“./databases”）：

```sh
sundawning-sqlite-database-server --port 28080 --databases_directory ./files
```
npm package: @sundawning/with-mute-console-log
Description: 让console.log失效
Author: sundawning
Latest version: 1.0.0

让 console.log 失效

2022-07-29 21:53:20

# 安装

```sh
pnpm add @sundawning/with-mute-console-log
```

# 使用

```js
const with_mute_console_log = require("@sundawning/with-mute-console-log");
const log = require("@sundawning/console-log-timestamp");
log("with_mute_console_log");
with_mute_console_log(log, "with_mute_console_log");
```

```
[2022/7/29 21:53:42] with_mute_console_log
[2022/7/29 21:53:42]
```
npm package: @sunday-sky/vite-plugin-mpa
Description: The vite plugin for multi-page application
Author: Roc
Latest version: 1.0.1

# Vite-plugin-mpa

## Description

This plugin provides true MPA functionality for Vite, eliminating various limitations of Vite MP.

**No matter where your entry files/template files are located, you can access pages through the root route, making it perfect for embedded page development.**

```plaintext
http://localhost:5173/index.html
http://localhost:5173/about.html
...
```

🙅🏻‍♀️: ~~No need to search everywhere for your MPA page addresses.~~

Try the [demo](https://codesandbox.io/p/devbox/2lrppj).

## Features

- True **MPA**.
- Load pages on demand - no matter how many pages you have, only the current page will be loaded.
- Support for reusing template files.
- Support for 404 pages.
- Support for `vue`, `react`...and all frameworks supported by Vite.

## Docs

More docs see [vite-plugin-mpa docs](https://moonlit.vip/vite-plugin-mpa).
npm package: @sunday9787/load-script
Description: 异步加载script
Author: Sunday9787
Latest version: 1.0.0

# @sunday9787/load-script

> 异步加载script

## Install

Using npm:

```sh
npm install @sunday9787/load-script --save
```

or using yarn:

```sh
yarn add @sunday9787/load-script --dev
```

## example

```js
var loadScript = new LoadScript()
loadScript.load('./js/moduleA.js').then(() => {
  fnA('A js 已加载完毕')
})

loadScript.load('./js/moduleB.js').then(() => {
  fnA('B js 已加载完毕')
})
```
npm package: @sunday9787/log
Description: 美化log
Author: Sunday9787
Latest version: 1.1.0

# @sunday9787/log

> 美化log日志输出

## Install

Using npm:

```sh
npm install @sunday9787/log --save
```

or using yarn:

```sh
yarn add @sunday9787/log --dev
```

## Example

特殊类型日志

```js
log('develop', 'env')
log('win32', 'platform')
log('1.0.1', 'version')
log(new Date().toISOString(), 'build')
log('1.0.2', 'build', ['#2196f3', '#e91e63'])
```

![特殊类型日志](./images/20210812144411.png)

自定义 日志输出

```js
log({ label: 'this', message: 'window' }, ['red', '#9c27b0'])
```

![特殊类型日志](./images/20210812144424.png)
npm package: @sundaycrafts/postmark
Description: Unofficial Node.js client library for the Postmark HTTP API - https://www.postmarkapp.com
Author: Igor Balos
Latest version: 3.0.20

<a href="https://postmarkapp.com">
    <img src="https://github.com/ActiveCampaign/postmark.js/raw/main/postmark.png" alt="Postmark Logo" title="Postmark" width="120" height="120" align="right">
</a>



# Postmark Node.js Library
[![Build Status](https://circleci.com/gh/ActiveCampaign/postmark.js.svg?style=shield)](https://circleci.com/gh/ActiveCampaign/postmark.js)
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://www.opensource.org/licenses/MIT)
[![npm version](https://badge.fury.io/js/postmark.svg)](https://badge.fury.io/js/postmark)

Send emails with the greatest of ease! [Postmark](http://www.postmarkapp.com) allows you to send your application's emails with high delivery rates, including bounce/spam processing and detailed statistics.
In addition, Postmark can parse incoming emails which are forwarded back to your application.

Now your node.js application can send emails through [Postmark](http://www.postmarkapp.com).
As the official Node.js library for Postmark, postmark.js has support for the entire REST API.

## Usage

Please see the [wiki](https://github.com/ActiveCampaign/postmark.js/wiki) for quick start tutorial and detailed instructions about sending email at our [documentation page](https://ActiveCampaign.github.io/postmark.js/). 
For details about Postmark API in general, please check out [Postmark developer docs](https://postmarkapp.com/developer).

### Installation

Installing `postmark` javascript library is super simple. Use the following command in your terminal:

```bash
npm install postmark
```

## Migrating from older versions of the library

Please see [wiki](https://github.com/ActiveCampaign/postmark.js/wiki/Migrating-from-older-version) for more details.

## Issues & Comments

Feel free to contact us if you encounter any issues with the library or Postmark API. 
Please leave all comments, bugs, requests and issues on the Issues page.

## License

The Postmark JavaScript Library is licensed under the **MIT** license. Please refer to the [LICENSE](https://github.com/ActiveCampaign/postmark.js/blob/main/LICENSE) for more information.
npm package: @sundayempire/raygun4reactnative
Description: Raygun React Native SDK
Author: MindscapeHQ
Latest version: 1.1.1-beta-8

<p align="center">
    <a href="https://raygun.com/" target="_blank" align="center">
        <img src="https://brandfolder.com/raygun/logo/raygun-primary-logo.png" width="500">
    </a>
    <br/>
    <h1>Raygun SDK for React Native</h1>
</p>

## Requirements

- `react-native >= 0.60.0`

## Installation and Usage

To install the package:

```sh
npm install --save @sundayempire/raygun4reactnative
# OR
yarn add @sundayempire/raygun4reactnative
```

### Additional step - iOS

Since our SDK supports native crashes, we need to link the SDK to your native projects.

```sh
cd ios && pod install
# OR
npx pod-install ios
```

### Additional step - Android

#### **android/app/src/main/AndroidManifest.xml**

Modify the app's **android/app/src/main/AndroidManifest.xml** to include the following line to enable the background Crash Reporting Service

```
<application ...>
    ...
    <service
        android:name="com.raygun.raygun4android.services.CrashReportingPostService"
        android:exported="false"
        android:permission="android.permission.BIND_JOB_SERVICE"
        android:process=":crashreportingpostservice"
    />
    ...
</application>
```

### How to use it:

```javascript
import RaygunClient from 'raygun4reactnative';

RaygunClient.init({
  //RaygunClientOptions
  apiKey: YOUR_RAYGUN_APIKEY,
  version: YOUR_APP_VERSION,
  enableNativeCrashReporting: true,
  enableRUM: true,
  onBeforeSend: null
});
```
npm package: @sundaysf/tunnel
Description: Tunnel SDK for exposing local servers to the internet
Author: Sundays Framework
Latest version: 1.0.0

# @sundaysf/tunnel

A tunneling SDK that exposes your local servers to the internet, similar to ngrok.

## Installation

```bash
npm install -g @sundaysf/tunnel
```

## Getting Started

### 1. Get an API Key

First, you need to get an API key from the Dolphin Tunnel dashboard:

1. Go to http://localhost:3000
2. Sign up or log in
3. Navigate to Dashboard > API Tokens
4. Create a new API token
5. Copy the token (it will only be shown once!)

### 2. Authenticate

Set up your API key with the `stun` CLI:

```bash
stun auth YOUR_API_KEY
```

This saves your API key locally for future use.

### 3. Create a Tunnel

Now you can create tunnels to expose your local servers:

```bash
stun http 3000
```

This will create a tunnel from a public URL to your local server running on port 3000.

## CLI Commands

### Authentication

```bash
# Set your API key
stun auth YOUR_API_KEY

# Check current user
stun whoami

# Log out (clear credentials)
stun logout
```

### Tunnel Management

```bash
# Create HTTP tunnel
stun http 3000

# With custom subdomain
stun http 3000 -s myapp

# Forward to specific host
stun http 3000 -h 192.168.1.100

# List all your tunnels
stun list
```

### Configuration

```bash
# Show current configuration
stun config --show

# Set custom server URL
stun config --set-server https://api.example.com

# Reset all configuration
stun config --reset
```

## Command Options

- `http <port>` - Start an HTTP tunnel to the specified port
- `-s, --subdomain <subdomain>` - Request a specific subdomain
- `-h, --host <host>` - Local host to forward to (default: localhost)
- `-t, --token <token>` - API token for authentication

## Programmatic Usage

```javascript
const { TunnelClient } = require('@sundaysf/tunnel');

const client = new TunnelClient({
  serverUrl: 'https://api.tunnel.dolphintech.io',
  apiToken: 'your-api-token'
});

async function startTunnel() {
  const tunnel = await client.connect({
    port: 3000,
    host: 'localhost',
    subdomain: 'myapp',
    protocol: 'http'
  });

  console.log(`Tunnel URL: ${tunnel.url}`);

  tunnel.on('request', (req) => {
    console.log(`${req.method} ${req.path}`);
  });

  tunnel.on('error', (error) => {
    console.error('Tunnel error:', error);
  });
}

startTunnel();
```

## Features

- Fast WebSocket-based tunneling
- Custom subdomain support
- Real-time request logging
- Automatic reconnection
- Request/response forwarding
- Support for various content types

## License

MIT
npm package: @sundeepnarang/unzip-wrapper
Description: Wrapper for native unzip UNIX binary
Author: Sundeep Narang
Latest version: 0.1.5

unzip-wrapper
=============
This package wraps the native 'unzip' binary on *NIX machines.

### Usage:

```
unzip(archivePath, [options], [callback]);
```

### Example:

```
var unzip = require('unzip-wrapper');
unzip('/path/to/file.zip', {fix: true}, function(err) {
    if (err) {
        console.log(err.message);
        return;
    }

    console.log('Unzipping done!');
});
```

You can also pass options:

```
var options = {
    fix: true,
    target: '/path/to/target/dir'
};
unzip('/path/to/file.zip', options);
```

The following options are available:

* `fix` -- Whether to check for and attempt to fix any errors with the archive. Defaults to false.
* `target` -- The target directory. Defaults to the archive's directory.
npm package: @sunder/kit
Description: Sunder/Cloudflare Worker building blocks for APIs and websites
Author: Guido Zuidhof
Latest version: 0.2.0

# kit

[![CI](https://github.com/SunderJS/kit/workflows/CI/badge.svg)](https://github.com/SunderJS/kit/actions)
[![NPM badge](https://img.shields.io/npm/v/@sunder/kit)](https://www.npmjs.com/package/@sunder/kit)

Kit is a library of building blocks and utilities for Cloudflare Workers (CFW).

Functionality can be individually imported, so you can pick the parts you need without increasing your bundle size too much.

A few of the included modules are [**Sunder framework**](https://github.com/sunder/sunder)-specific, these are marked with 〽️. All others modules should be easy to use in any CFW project.

## What's included

### 👨‍💻 Session management
* 🍪 A cookie-based authentication system for keeping users logged in securely. By being backed by [Workers KV](https://developers.cloudflare.com/workers/runtime-apis/kv) (or any other database) you can associate arbitrary data with a session, so there is little excuse for using JWT instead.

### 🕵️‍♀️ Crypto & Encoding/Decoding
* 🔏 Random token generation (cryptographically sound), use this to generate post IDs, user IDs or even secrets such as API tokens.
* 📦 Base64 encoding and decoding (RFC 3548 compliant)
* 🏷 [Base-X](https://www.npmjs.com/package/base-x) encoding and decoding, which can be used for encoding data or random IDs with a given alphabet. Example alphabets:
    * **Base 58** `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz` (does not contain `Il0O` for easier human copying)
    * **Base 62**
    `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` (base64 without special characters)
    * **Base 36**
    `0123456789abcdefghijklmnopqrstuvwxyz` (all lowercase, useful for case-insensitive systems)
    
    > Warning: these encodings are not RFC3548 compliant. The padding is different, base-x uses Bitcoin's padding scheme.

### 🔌 Plug-and-play middlewares

* 🗂 **Static file serving** ([Cloudflare Sites](https://developers.cloudflare.com/workers/platform/sites)) 〽️
* 🐛 **Error logging** through [Sentry](https://sentry.io). 〽️

## Installation
```
npm i @sunder/kit
```

## Documentation
👷‍♀️  Guides and long-form docs are to-do, use the Typescript typings as your guide for now.

The docs will live on [sunderjs.com](https://sunderjs.com).

## License
[MIT](./LICENSE)
npm package: @sunderb/sonic-pi-js-api
Description: A JavaScript API to initiate and interface with the Sonic Pi server
Author: SunderB
Latest version: 0.0.3

# sonic-pi-js-api
An experimental JavaScript API to start and interact with the Sonic Pi server. Compatible with Sonic Pi v4.x.

[![npm (scoped)](https://img.shields.io/npm/v/@sunderb/sonic-pi-js-api)](https://www.npmjs.com/package/@sunderb/sonic-pi-js-api)


## 📖 Documentation
Documentation is available online at https://sunderb.me/sonic-pi-js-api/latest/


## ✨ Features
| Feature | Implemented? |
| --- | --- |
| **Booting** | |
| Boot and initialise the server    | ✅ Yes | 
| Shutdown the server               | ✅ Yes | 
| **Basic commands** |  |
| Run code                          | ✅ Yes | 
| Stop all jobs                     | ✅ Yes |
| **Buffers/workspaces** | | 
| Load workspaces                   | 🚧 Partial |
| Save workspaces                   | ✅ Yes (untested) | 
| Save and play buffer              | ✅ Yes (untested) | 
| Buffer new line and indent        | ✅ Yes (untested) |
| **Recordings** | |
| Start recording                   | ❌ No |
| Stop recording                    | ❌ No |
| **Logging** | |
| Handle and emit log messages      | ✅ Yes | 
| Handle and emit errors            | 🚧 Partial |
| **Options & IO** | |
| Main volume                       | ✅ Yes |
| Safe mode                         | ❌ No |
| External synths                   | ✅ Yes |
| MIDI options                      | 🚧 Partial |
| Link                              | ❌ No |

## Attributions
* Heavily based on on the [official C++ Sonic Pi API](https://github.com/sonic-pi-net/sonic-pi/tree/dev/app/api) (although not a fully exact copy) - MIT License

### Dependencies
* [node-osc](https://github.com/MylesBorins/node-osc) - LGPL 3.0 or later
* [jsdoc](https://github.com/jsdoc/jsdoc) (development only) - Apache 2.0 License

## License
This package is licensed under the MIT License. See [LICENSE.md](LICENSE.md) for the full license.