open-index/open-npm huggingface dataset:
npm package: @sqren/redux-request
Description: Redux is great for handling application state but can result in a lot of boilerplate when it comes to data fetching. This component aims to reduce this boilerplate, and help you keep your components stateless.
Author: Søren Louv-Jansen
Latest version: 1.3.0

Redux is great for handling application state but can result in a lot of boilerplate when it comes to data fetching. This component aims to reduce this boilerplate, and help you keep your components stateless.

[Demo on Codepen](https://codepen.io/sqren/pen/ELwoxQ?editors=0010)

### Install

```
npm install @sqren/redux-request
```

### Getting started

```js
import { ReduxRequest, reduxRequestReducer } from '@sqren/redux-request';

// Add reduxRequestReducer to your store
const reducers = combineReducers({ reduxRequest: reduxRequestReducer });
const store = createStore(reducers);

// this method must return a promise
function getData() {
  return fetch(`https://jsonplaceholder.typicode.com/posts/1`).then(response =>
    response.json()
  );
}

// Render ReduxRequest
return (
  <ReduxRequest
    fn={getData}
    id="my-request-id"
    render={({ status, data, error }) => <div>{status}</div>}
  />
);
```

### Run examples locally

```
npm start
```

Open [localhost:6006](http://localhost:6006) in your browser

All examples are located in [https://github.com/sqren/redux-request/tree/master/stories](stories/)

### API

#### args: array

A list of arguments that will be applied to `fn`.

Example: `['a', 'b']`

#### fn: func

A function to fetch data. This must return a promise that resolves with the response. Arguments can be supplied with `args` prop. This will only be invoked on initial mount, and when `args` change.

#### id: string

The identifier used to store the data in redux. If `id` is `selected-user`, the data will be stored in `store.reduxRequest['selected-user']`.
This is useful if you have data you want to display different places in your application. By relying on redux as a cache, `reduxRequest` will only fetch the data once.

#### render: func

A so-called [render-prop](https://reactjs.org/docs/render-props.html) that will be called with the resolved or rejected value of `fn`. The render function is called with an object with these keys `{status, data, error}`

#### selector: func

This takes a selector (eg. from [re-select](https://github.com/reduxjs/reselect)) that will be called with `state, { id }`, where `state` is the entire store state, and `id` is the identifier supplied to `reduxRequest`.
npm package: @sqrls/mindate
Description: A super minimal Date library, inspired by date-fns
Author: just squirrels
Latest version: 0.1.1

# mindate
Super minimal Date library, inspired by [date-fns](https://date-fns.org/).

## Use
Import individual functions, or use default import. Example (TypeScript):

```typescript
import { addDays, unix } from "@sqrls/mindate"

const twentyDaysFromNow = addDays(new Date(), 20);
const secondsSinceEpoch = unix(new Date());
```
npm package: @sqrls/tinyjwt
Description: A tiny JWT signer and validator
Author: just squirrels
Latest version: 0.1.1

# tinyjwt
A little scrappy JWT helper.

## Use
Add keys. Sign or verify. Sorta fits [RFC7519](https://www.rfc-editor.org/rfc/rfc7519). Only supports `sha256`. Example (TypeScript):

```typescript
import { sign, verify } from "@sqrls/tinyjwt"

// Sign with a secret key and key ID
const signedJwt = sign({ sub: "bob", exp: Date.now() + 23, other: "data" }, "super secret", "key id");

// And verify
const contents = tinyjwt.verify(signedJwt, (keyId) => {
    if (keyId === "key id") return "super secret";
});

// If contents are undefined, verification failed
if (!contents) {
    throw new Exception("Invalid!")
}

// Don't care about key IDs? They're optional
const jwt = sign({ sub: "bob", exp: Date.now() + 23, other: "data" }, "super secret");
const contents = verify(jwt, () => "super secret");
```

If either `exp` or `nbf` are present, they are checked and the JWT rejected appropriately.
npm package: @sqrls/tokens
Description: A small helper library to handle token generation, inspired by slugid
Author: just squirrels
Latest version: 0.1.1

# tokens
Absolutely tiny library to handle token generation, inspired by [slugid](github.com/taskcluster/slugid).

## How to use
This library provides two functions: `genToken`, which creates new tokens, and `tokenLength`, which calculates the expected token length. TypeSript:

```typescript
import { genToken, tokenLength } from "@sqrls/tokens"; // or import default

console.log("Random base64url encoded token:", genToken());
console.log("A small token with 5 bytes (40 bits):", genToken(5));
console.log("A much larger token with 100 bytes (800 bits):", genToken(100));

console.log(`A 30-byte token should have a string length ${tokenLength(30)}`);
```
npm package: @sqrtox/deta
Description: Deta library for JavaScript.
Author: sqrtox
Latest version: 1.1.0

# @sqrtox/deta

## About

Deta library for JavaScript.

```sh-session
npm install @sqrtox/deta
yarn add @sqrtox/deta
pnpm install @sqrtox/deta
```

## Usage
```ts
import { Base } from '@sqrtox/deta';

const PROJECT_KEY = process.env.PROJECT_KEY;

const commentsBase = new Base({
  name: 'comments',
  projectKey: PROJECT_KEY
});

const comment = await commentsBase.get('c0mment1d');
```

```ts
import { Drive } from '@sqrtox/deta';

const PROJECT_KEY = process.env.PROJECT_KEY;

const imagesDrive = new Drive({
  name: 'images',
  projectKey: PROJECT_KEY
});

const file = await imagesDrive.get('path/to/file');
```
npm package: @sqrtthree/axios-use-bearer-token
Description: A Bearer token interceptor for axios
Author: sqrtthree
Latest version: 1.0.0

# axios-use-bearer-token

A Bearer token interceptor for axios.

## Install

```bash
yarn add @sqrtthree/axios-use-bearer-token

# OR use npm:
npm install @sqrtthree/axios-use-bearer-token
```

## How to use

```ts
import useBearerToken from '@sqrtthree/axios-use-bearer-token'

const bearerToken = () => {
  return 'your access token'
}

axios.interceptors.request.use(
  useBearerToken({
    bearerToken,
  })
)
```

### Options

#### `bearerToken: () => string | Promise<string>`

A string or function to return access token string that will be added to request header.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/axios-use-crypto
Description: A crypto interceptor for axios.
Author: sqrtthree
Latest version: 0.1.0

# axios-use-crypto

A crypto interceptor for axios.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/axios-use-crypto-exchange
Description: A crypto exchange interceptor for axios.
Author: sqrtthree
Latest version: 0.1.0

# axios-use-crypto-exchange

A crypto exchange interceptor for axios.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/axios-use-sign
Description: A sign interceptor for axios.
Author: sqrtthree
Latest version: 0.1.0

# axios-use-sign

A sign interceptor for axios.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/beijing-time
Description: Get Beijing time in any timezone.
Author: sqrtthree
Latest version: 0.1.0

# beijing-time

Get Beijing time in any timezone.

## Install

```bash
npm install @sqrtthree/beijing-time
```

## API

### beijingDate(date: Date): BeijingDate

Get Beijing time.

### beijingDay(date: Date): string

Get day string of Beijing time, format: `yyyy-MM-dd`

### beijingToday(): string

Get today of Beijing time, format: `yyyy-MM-dd`

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/debug-output
Description: Proxy console.log with `JSON.stringify` to pretty json data in Vue.
Author: sqrtthree
Latest version: 1.0.0

[![npm](https://img.shields.io/npm/v/@sqrtthree/debug-output)](https://www.npmjs.com/package/@sqrtthree/debug-output)

# debug-output

Proxy console.log with `JSON.stringify` to pretty json data in Vue.

Note: it only run in development env by default.

## How to use

```sh
yarn add @sqrtthree/debug-output

# or use npm
npm install @sqrtthree/debug-output
```

```js
import Vue from 'vue'
import debugOutput from '@sqrtthree/debug-output'

debugOutput.enable()
```

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/eslint-config-base
Description: A personal ESLint configuration.
Author: sqrtthree
Latest version: 0.3.0

# eslint-config-base

A personal ESLint configuration.

## Usage

Add this package to your project as a dev-dependency:

```bash
npm install -D eslint prettier @sqrtthree/eslint-config-base
```

Then initialize the linter.

```json
{
  "extends": ["@sqrtthree/eslint-config-base"]
}
```

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/eslint-config-node
Description: A personal ESLint configuration for Node.js
Author: sqrtthree
Latest version: 0.3.0

# eslint-config-node

A personal ESLint configuration for Node.js

## Usage

Add this package to your project as a dev-dependency:

```bash
npm install -D eslint prettier jest @sqrtthree/eslint-config-node
```

Then initialize the linter.

```json
{
  "extends": ["@sqrtthree/eslint-config-node"]
}
```

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/eslint-config-ts
Description: A personal ESLint configuration for Node.js and TypeScript.
Author: sqrtthree
Latest version: 0.3.0

# eslint-config-ts

A personal ESLint configuration for Node.js and TypeScript.

## Usage

Add this package to your project as a dev-dependency:

```bash
npm install -D eslint prettier jest typescript @sqrtthree/eslint-config-ts
```

Then initialize the linter.

```json
{
  "extends": ["@sqrtthree/eslint-config-ts"]
}
```

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/koa-crypto
Description: A crypto middleware based on AES.
Author: sqrtthree
Latest version: 0.1.2

# koa-crypto

A crypto middleware based on AES.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/koa-crypto-exchange
Description: A koa exchange middleware based on RSA.
Author: sqrtthree
Latest version: 0.1.0

# koa-crypto-exchange

A exchange middleware based on RSA.

## How to generate key file with openssl:

```bash
# Gen private key:
openssl genrsa -out app_private_key.pem 1024

# Gen public key:
openssl rsa -in app_private_key.pem -pubout -out app_public_key.pem
```

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/koa-jwt
Description: A jwt middleware for Koa
Author: sqrtthree
Latest version: 0.1.0

# koa-jwt

A jwt middleware for Koa

## Install

```bash
npm install @sqrtthree/koa-jwt
```

## Usage

```ts
import * as Koa from 'koa'
import { jwtMiddleware } from '@sqrtthree/koa-jwt'

const app = new Koa()

app.use(
  jwtMiddleware({
    subject: 'identity_authentication',
  })
)
```

## Options

### subject: `string`

Target subject of jwt.

### issuer: `?string`

Target issuer of jwt.

### secret: `?string | (tokenPayload) => Promise<string>`

A string or function containing either the secret for HMAC algorithms.

### stateName: `?string`

Attribute name extended to `ctx.state`, the value is jwt payload. It will be `jwtPayload` by default.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/koa-sign
Description: A signature middleware for Koa.
Author: sqrtthree
Latest version: 0.2.0

# koa-sign

A signature middleware for Koa.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/koa-token
Description: A token middleware for Koa
Author: sqrtthree
Latest version: 0.1.0

# koa-token

A token middleware for Koa

## Install

```bash
npm install @sqrtthree/koa-token
```

## Usage

```ts
import * as Koa from 'koa'
import { tokenMiddleware } from '@sqrtthree/koa-token'

const app = new Koa()

app.use(
  tokenMiddleware({
    token: 'target token',
  })
)
```

## Options

### token: `string | () => string | Promise<string>`

String or function to get target token.
npm package: @sqrtthree/mongoose-helper
Description: Some helper functions for mongoose.
Author: sqrtthree
Latest version: 1.1.1

# mongoose-helper

Some helper functions for mongoose.

## Install

```bash
npm install @sqrtthree/mongoose-helper
```

## Usage

```js
const { makeConnectionURI } = require('@sqrtthree/mongoose-helper')

// Or with esm
import { makeConnectionURI } from '@sqrtthree/mongoose-helper'
```

## API

### `makeConnectionURI(options)`

Format options to standard connection string of the MongoDB. [Connection String URI Format](https://docs.mongodb.com/manual/reference/connection-string/)

#### options.host

The host where the mongod instance is running.

#### options.port?

Optional. The port number where the mongod instance is running.

#### options.extras?

The host (and optional port number) where the mongos instance for a sharded cluster is running.

- For a replica set, specify the hostname(s) of the mongod instance(s) as listed in the replica set configuration.
- For a sharded cluster, specify the hostname(s) of the mongos instance(s).

#### options.database

The authentication database to use if the connection string includes username:password@ authentication credentials but the authSource option is unspecified.

#### options.username?

Optional. Authentication credentials.

#### options.password?

Optional. Authentication credentials.

#### options.options?

Optional. A query string that specifies connection specific options as `<name>=<value>` pairs.

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/mongos
Description: An opinionated mongoose wrapper.
Author: sqrtthree
Latest version: 1.2.0

# mongos

An opinionated mongoose wrapper.

## Install

```bash
npm install @sqrtthree/mongos
```

## Usage

```ts
import Mongos from '@sqrtthree/mongos'

const mongo = new Mongos(dbConfig: DBConfig, config?: Config, connectOptions?: ConnectOptions)

mongo.connection.model('User', userSchema)
```

## Options

### DBConfig: `Object`

The Object will be formatted to [Standard Connection String Format](https://docs.mongodb.com/manual/reference/connection-string/#standard-connection-string-format) string with [sqrthree/mongoose-helper](https://github.com/sqrthree/mongoose-helper#makeconnectionurioptions).

### Config.lazyConnect: `boolean`

By default, When a new Mongos instance is created, it will connect to MongoDB server automatically. If you want to keep the instance disconnected until call `connect` manually, you can pass the lazyConnect option to the `true`.

### Config.logger: `Object`

A logger used to output event messages.

### ConnectOptions

See [mongoosejs.com/docs/connections.html#options](https://mongoosejs.com/docs/connections.html#options) to get more details.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/pagination
Description: Some helpers about pagination.
Author: sqrtthree
Latest version: 1.0.3

# pagination

[![npm](https://img.shields.io/npm/v/@sqrtthree/pagination.svg?style=?style=flat&logo=appveyor)](https://www.npmjs.com/package/@sqrtthree/pagination)

Some helpers about pagination.

### Install

```sh
yarn add @sqrtthree/pagination

# OR use npm
npm install @sqrtthree/pagination
```

### How to usage

#### paginate(data, options?: {page?: boolean, offset?: boolean, maxPerPage?: number, maxLimit?: number })

@return { page: number = 1, perPage: number = 10, offset: number = 0, limit: number = 10 }

#### paginateWithCursor(data, options?: { maxLimit?: number })

@return { cursor: string | number, limit: number = 10 }

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/prettier-config
Description: An opinionated Prettier config.
Author: sqrtthree
Latest version: 2.0.1

# prettier-config

My personal Prettier configuration, more details are [prettier.io#sharing-configurations](https://prettier.io/docs/en/configuration.html#sharing-configurations).

## How to use?

### 1. Install package.

```sh
yarn add @sqrtthree/prettier-config -D
# OR npm install @sqrtthree/prettier-config -D
```

### 2. Config to use it.

Add the following configuration to your `package.json`:

```json
{
  "name": "YOUR_NAME",
  "version": "YOUR_VERSION",
  "prettier": "@sqrtthree/prettier-config"
}
```

OR config it in `.prettierrc`:

```
"@sqrtthree/prettier-config"
```
npm package: @sqrtthree/sms
Description: Ali Cloud sms api for Node.js
Author: sqrtthree
Latest version: 1.0.0

# sms

Ali Cloud sms api for Node.js

## Install

```bash
npm install @sqrtthree/sms
```

## Usage

```ts
import SmsService from '@sqrtthree/sms'

const sms = new SmsService('id', 'key', 'sign name', {
  debug: true,
  mock: true,
})

sms.sendSms(templateCode: string, phoneNumbers: string | string[], templateParams?: Record<string, string | number>, options?: Record<string, string>)

sms.sendBatchSms(templateCode: string, phoneNumbers: string[], templateParams?: Record<string, string | number>[], options?: Record<string, string>)
```

See [help.aliyun.com/document_detail/102715.html](https://help.aliyun.com/document_detail/102715.html) to get more details.

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/tsconfig
Description: Shared TypeScript config for my projects.
Author: sqrtthree
Latest version: 3.1.1

[![npm](https://img.shields.io/npm/v/@sqrtthree/tsconfig)](https://www.npmjs.com/package/@sqrtthree/tsconfig)

# tsconfig

Shared [TypeScript config](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends) for my Node.js projects. The configuration is now distributed to be compatible with [TypeScript 5.0](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/) or newer.

## Install

```sh
yarn add --dev @sqrtthree/tsconfig
```

Or use npm:

```sh
npm install --save-dev @sqrtthree/tsconfig
```

## Usage

For example in your `tsconfig.json`:

```json
{
  "extends": "@sqrtthree/tsconfig",
  "compilerOptions": {
    "rootDir": "./src",
    "outDir": "./dist"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}
```

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/value-filter
Description: Filter object data with value.
Author: sqrtthree
Latest version: 1.0.0

# value-filter

[![npm](https://img.shields.io/npm/v/@sqrtthree/value-filter.svg?style=?style=flat&logo=appveyor)](https://www.npmjs.com/package/@sqrtthree/value-filter)

Filter object data with value.

### Install

```sh
yarn add @sqrtthree/value-filter

# OR use npm
npm install @sqrtthree/value-filter
```

### How to usage

#### valueFilter(obj, omit?= string | number | boolean | null | (string | number | boolean | null)[] )

if omit is missing, all keys with truth-value are returned.

#### valueFilterWith(obj, filter: (val: string) => boolean)

Iterates over elements of obj, returning a subset of the received object which all elements predicate returns truthy for.

---

> [sqrtthree.com](http://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/vue-global-registration
Description: Register global Vue components with require.context.
Author: sqrtthree
Latest version: 2.0.0

[![npm](https://img.shields.io/npm/v/@sqrtthree/vue-global-registration)](https://www.npmjs.com/package/@sqrtthree/vue-global-registration)

# vue-global-registration

Register global Vue components with require.context.

## How to use

```sh
yarn add @sqrtthree/vue-global-registration

# or use npm
npm install @sqrtthree/vue-global-registration
```

```js
import Vue from 'vue'
import globalRegistration from '@sqrtthree/vue-global-registration'

Vue.use(
  globalRegistration(
    require.context('./components', true, /[a-zA-Z]\w+\.(vue|js)$/)
  )
))
```

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/wechatpay
Description: 微信支付 APIv3 的 Node.js Library
Author: sqrtthree
Latest version: 0.2.1

# wechatpay

微信支付 APIv3 的 Node.js Library

---

> [sqrtthree.com](https://sqrtthree.com/) &nbsp;&middot;&nbsp;
> GitHub [@sqrthree](https://github.com/sqrthree) &nbsp;&middot;&nbsp;
> Twitter [@sqrtthree](https://twitter.com/sqrtthree)
npm package: @sqrtthree/wrapped-jwt
Description: ## Install
Author: sqrtthree
Latest version: 0.4.1

# wrapped-jwt

## Install

```bash
npm install @sqrtthree/wrapped-jwt
```

## API

By Default, it will load `app.name` as default value of issuer, `app.keys` as default value of secret with [node-config](https://github.com/lorenwest/node-config).

### `signToken(payload: Record<string, any>, subject?: string, options?: SignTokenOptions): Promise<string>`

Sign a jwt token.

### `parseToken<T>(token: string, subject?: string, issuer?: string, options?: VerifyTokenOptions): Promise<T>`

Parse and verify jwt token.

### `parseTokenWithoutVerify<T>(token: string): T`

Parse jwt token without verify.

### `verifyToken(token: string, subject?: string, issuer?: string, options?: VerifyTokenOptions): Promise<void>`

Verify jwt token if is valid. it will throw an error if the token is invalid.
npm package: @sqts/core
Description: Type-safe SQL queries for TypeScript
Latest version: 0.1.0

# SQTS

> Under heavy development. See https://github.com/Floffah/sqts for more information

ORMs (drizzle, prisma, etc) are often the best choice for developers wanting type-safety with their databases, but sometimes you can't use them. Maybe you can't ship the migrations due to some constraint, maybe you need a self-contained bundle or binary, maybe you just want ownership of the queries.

SQTS is a way to keep your SQL type safe without an ORM.

Define your migrations or schema as normal SQL files, write your queries in .sqts files, and get type safety and autocompletion in your editor. SQTS will parse your SQL, extract the types, and generate TypeScript code that you can import and use in your application.

## Config

SQTS requires `sqts.config.*` at compile time (unless overridden programmatically):

```ts
import { defineConfig } from "@sqts/core/config";

export default defineConfig({
    executor: {
        module: "@sqts/core/adapters/bun-sqlite",
    },
});
```

The configured module must export a named async `execute(query, params, meta?)` function.

## Example

```sql
-- migrations/001-create-users.sql

CREATE TABLE IF NOT EXISTS users (
     id SERIAL PRIMARY KEY,
     name TEXT NOT NULL,
     email TEXT NOT NULL UNIQUE
);
```

```sql
-- operations.sqts

GetUser => SELECT * FROM users WHERE id = $id;
```

With this, in your configured output folder (default is `.sqts`) you'll get generated model types and this function signature:
```ts
export async function GetUser(params: { id: number; }): Promise<User[]>;
```

## Adapter: bun:sqlite

Create an executor file somewhere in your project:

```ts
// src/db.ts
import { executorWithBunSqlite } from "@sqts/core/adapters/bun-sqlite";
import { Database } from "bun:sqlite";

const db = new Database(":memory:"); // or path to your database file

export const execute = executorWithBunSqlite(db);
```

Then point to it in your config:

```ts
import { defineConfig } from "@sqts/core/config";

export default defineConfig({
    executor: {
        module: "@/db",
    },
});
```

## Custom adapters

For this to work you should set up path aliases, for example point `@/*` to `./src/*` in your `tsconfig.json`. Then you can create your own adapter module:

```ts
// src/adapters/my-adapter.ts
import { defineExecutor } from "@sqts/core";

export const execute = defineExecutor(async (query, params, meta) => {
    // do something with the query and params, return results
    // see src/adapters/bun-sqlite.ts for an example implementation
});
```

Then update your sqts.config.ts:

```ts
import { defineConfig } from "@sqts/core/config";

export default defineConfig({
    executor: {
        module: "@/adapters/my-adapter",
    },
});
```
npm package: @squadai/cli
Description: Squad AI CLI - Product strategy management for AI agents and humans
Latest version: 0.3.0

# @squadai/cli

Command-line interface for [Squad AI](https://meetsquad.ai) — manage product strategy (goals, opportunities, solutions, feedback, insights) from your terminal or AI agent workflows.

## Install

```bash
npm install -g @squadai/cli
```

Requires Node.js 22+.

## Quick start

```bash
squad auth login          # Opens browser for OAuth2 login
squad workspace list      # List available workspaces
squad workspace select <orgId> <workspaceId>
```

## Commands

| Command | Description |
|---------|-------------|
| `squad auth login\|logout\|status` | Authenticate via OAuth2 PKCE |
| `squad workspace list\|select\|get\|update\|summary` | Manage workspaces |
| `squad opportunity list\|get\|create\|update\|delete` | Track problem statements |
| `squad solution list\|get\|create\|update\|delete` | Define and manage solutions |
| `squad goal list\|get\|create\|update\|delete` | Set business objectives |
| `squad feedback list\|get\|create\|delete` | Capture customer feedback |
| `squad insight list\|get\|create\|delete` | Record insights |
| `squad knowledge list\|get\|create\|delete` | Manage knowledge base |
| `squad search <query>` | Semantic search across workspace |
| `squad view strategy-context [--type --id]` | Entity in strategy hierarchy |
| `squad view roadmap` | Solutions by horizon (Now/Next/Later) |
| `squad opportunity generate-solutions <id>` | AI-generated solutions |
| `squad solution prioritise --solution-ids <ids>` | AI-powered prioritisation |

All commands support `--format json|table`.

## Configuration

Config is stored in `~/.config/squad/` (respects `XDG_CONFIG_HOME`):

- `auth.json` — OAuth tokens
- `client.json` — Registered OAuth client IDs
- `workspace.json` — Selected workspace per environment

Override auth with `SQUAD_TOKEN` env var. Select environment with `SQUAD_ENV`.

## Development

```bash
yarn install
yarn build    # Build to dist/cli.js
yarn dev      # Watch mode
```

Lint and format:

```bash
yarn format       # Check (Biome)
yarn format:fix   # Auto-fix
yarn knip         # Dead code detection (Knip)
```

Regenerate the API client from the OpenAPI spec:

```bash
yarn openapi:squad
```

### Smoke tests

```bash
./scripts/smoke-test.sh <org-id> <workspace-id>
```

## Architecture

```
src/
├── cli.ts              # Entry point (Commander.js)
├── commands/           # Command modules (auth, workspace, opportunity, etc.)
└── lib/
    ├── auth/           # OAuth2 PKCE flow + token storage
    ├── clients/        # API client with auth middleware
    ├── openapi/        # Generated TypeScript Fetch client
    ├── config.ts       # Environment config
    ├── context.ts      # Auth + workspace context resolution
    ├── errors.ts       # Error handling
    └── output.ts       # JSON/table formatting
```

## License

MIT
npm package: @squadbase/mcp
Description: MCP Toolbox Launcher - spawn MCP servers without dependency explosion
Latest version: 0.0.4

# @squadbase/mcp

MCP Toolbox Launcher - a lightweight CLI that spawns MCP server packages on demand without installing their dependencies directly.

## Why Use the Launcher?

Instead of bundling all database/cloud SDKs into a single package, each MCP server is a separate npm package. The launcher dynamically spawns only the server you need via `npx`, keeping dependencies isolated and install times fast.

## Installation

```bash
# No installation needed - use npx
npx -y @squadbase/mcp <server>

# Or install globally
npm install -g @squadbase/mcp
mcp <server>
```

## Usage

```bash
# Show help
mcp --help

# Run Databricks server
mcp databricks

# Run Redshift server
mcp redshift

# Pass arguments to server
mcp databricks --help
```

## Available Servers

| Server | Package | Description |
|--------|---------|-------------|
| `databricks` | `@squadbase/mcp-databricks` | Databricks SQL & Unity Catalog |
| `redshift` | `@squadbase/mcp-redshift` | Amazon Redshift |

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `MCP_TOOLBOX_SCOPE` | npm scope for server packages | `@squadbase` |
| `MCP_TOOLBOX_VERSION` | Pin server package version | (latest) |

### Examples

**Custom npm scope:**
```bash
MCP_TOOLBOX_SCOPE="@acme" mcp databricks
# Spawns: npx -y @acme/mcp-databricks
```

**Pinned version:**
```bash
MCP_TOOLBOX_VERSION="0.2.1" mcp databricks
# Spawns: npx -y @squadbase/mcp-databricks@0.2.1
```

## MCP Client Configuration

Add to your `mcp.json` for stdio-based clients:

```json
{
  "mcpServers": {
    "databricks": {
      "command": "npx",
      "args": ["-y", "@squadbase/mcp", "databricks"],
      "env": {
        "DATABRICKS_HOST": "your-workspace.cloud.databricks.com",
        "DATABRICKS_TOKEN": "your-token",
        "DATABRICKS_HTTP_PATH": "/sql/1.0/warehouses/abc123def456"
      }
    },
    "redshift": {
      "command": "npx",
      "args": ["-y", "@squadbase/mcp", "redshift"],
      "env": {
        "REDSHIFT_HOST": "your-cluster.region.redshift.amazonaws.com",
        "REDSHIFT_PORT": "5439",
        "REDSHIFT_DATABASE": "dev",
        "REDSHIFT_USERNAME": "admin",
        "REDSHIFT_PASSWORD": "your-password"
      }
    }
  }
}
```

## How It Works

When you run `mcp databricks`, the launcher:

1. Validates that "databricks" is a known server
2. Builds the package name: `@squadbase/mcp-databricks`
3. Spawns: `npx -y @squadbase/mcp-databricks`
4. Inherits stdio and forwards the exit code

The launcher itself has **no dependencies** on MCP SDK or any database/cloud SDKs.

## License

MIT
npm package: @squadbase/react
Description: React SDK for Squadbase - A package for handling client-side operations in Squadbase applications with React.
Author: Squadbase
Latest version: 0.0.1

# @squadbase/react

React SDK for Squadbase - A package for handling client-side operations in Squadbase applications with React.

## Installation

```bash
npm install @squadbase/react
# or
yarn add @squadbase/react
# or
pnpm add @squadbase/react
```

## Features

### User Session

```typescript
import { SquadbaseProvider, useUser } from "@squadbase/react";

// Wrap your app with SquadbaseProvider
function App() {
  return (
    <SquadbaseProvider projectId="your-project-id">
      <UserProfile />
    </SquadbaseProvider>
  );
}

// Use the useUser hook in your components
function UserProfile() {
  const user = useUser();

  if (user.status === "pending") {
    return <div>Loading...</div>;
  }

  if (user.status === "error") {
    return <div>Error: {user.error}</div>;
  }

  return (
    <div>
      <h1>Welcome, {user.data.firstName}!</h1>
      <p>Email: {user.data.email}</p>
    </div>
  );
}
```

### Local Development

For local development, you can provide a mock user:

```typescript
<SquadbaseProvider
  projectId="your-project-id"
  mockUser={{
    username: "test-user",
    email: "test@example.com",
    firstName: "Test",
    lastName: "User",
    iconUrl: null,
    roles: ["user"],
  }}
>
  <App />
</SquadbaseProvider>
```

## API Reference

### `SquadbaseProvider`

A React context provider that wraps your application and provides access to the Squadbase client.

#### Props

- `projectId` (string): Your Squadbase project ID
- `mockUser` (optional): Mock user object for local development

### `useUser()`

A React hook that returns the current authenticated user.

#### Returns

```typescript
type QueryResult<User, string> = {
  status: "pending" | "success" | "error";
  data?: User;
  error?: string;
};
```

## License

MIT