open-index/open-npm huggingface dataset:
npm package: @kithkin/create-slate-theme
Description: Create a new slate project from an existing slate theme repo
Author: Shopify Inc.
Latest version: 1.0.0-beta.16

[![npm version](https://badge.fury.io/js/create-slate-theme.svg)](https://badge.fury.io/js/create-slate-theme)

# create-slate-theme

The `create-slate-theme` package enables users to create a new Slate project with a single command.

For more information, visit [the documentation website](https://shopify.github.io/slate/docs/create-slate-theme).
npm package: @kitiumai/auth-cli
Description: CLI tools for Kitium Auth
Author: KitiumAI
Latest version: 2.0.0

# @kitium/auth-cli (CLI)

CLI for scaffolding and managing Kitium Auth projects.

## Install

```
npm install -g @kitium/auth-cli
# or use npx
npx @kitium/auth-cli --help
```

## Commands

- init: Initialize a new project
  - Options: `--dir <directory>`, `--template <nextjs|...>`, `--skip-install`
  - Example: `kitium-auth init --dir my-app --template nextjs`

- dev: Start local development dashboard
  - Options: `--port <3001>`, `--host <localhost>`
  - Example: `kitium-auth dev --port 3001`

- add-provider: Add an authentication provider
  - Options: `--provider <google|github|microsoft|email> --client-id <id> --client-secret <secret> --redirect-uri <url>`
  - Example: `kitium-auth add-provider --provider google --client-id ... --client-secret ... --redirect-uri http://localhost:3000/api/auth/callback/google`

- migrate: Run database migrations
  - Options: `--direction <up|down> --target <version>`
  - Example: `kitium-auth migrate --direction up`

## Using with the core package

The CLI scaffolds configs and provider setup that work with `@kitium/auth` and the adapters (`@kitium/auth-postgres`, `@kitium/auth-redis`, `@kitium/auth-stripe`).

## Help

```
kitium-auth --help
```

## License

MIT
npm package: @kitiumai/auth-redis
Description: Redis cache adapter for Kitium Auth
Author: KitiumAI
Latest version: 1.0.1

# @kitium/auth-redis (Redis Cache Adapter)

Redis cache adapter for Kitium Auth core.

- Caches API key verification results and principal resolution
- Simple JSON serialization for values; pluggable TTLs per call

## Install

```
npm install @kitium/auth-redis redis
```

## Usage

```ts
import { AuthCore } from '@kitium/auth'
import { RedisCacheAdapter } from '@kitium/auth-redis'
import { PostgresStorageAdapter } from '@kitium/auth-postgres'

const storage = new PostgresStorageAdapter(process.env.DATABASE_URL!)
const cache = new RedisCacheAdapter(process.env.REDIS_URL!)

const auth = new AuthCore(storage, {
  jwtSecret: process.env.JWT_SECRET!,
  cache
})

await auth.initialize()
```

## Common Operations

```ts
await cache.connect()
await cache.set('key', { foo: 'bar' }, 300)
const value = await cache.get('key')
const exists = await cache.exists('key')
await cache.expire('key', 60)
await cache.del('key')
await cache.disconnect()
```

## With AuthCore

AuthCore uses cache keys like `apikey:<id>` and `principal:<id>` to speed up verification and resolution.

## License

MIT
npm package: @kitiumai/auth-stripe
Description: Stripe billing adapter for Kitium Auth
Author: KitiumAI
Latest version: 1.0.1

# @kitium/auth-stripe (Stripe Billing Adapter)

Stripe billing adapter for Kitium Auth core.

- Create/update customers
- Create/update/cancel subscriptions
- Create checkout/billing portal sessions
- Process webhooks (with signature verification)

## Install

```
npm install @kitium/auth-stripe stripe
```

## Usage

```ts
import { AuthCore } from '@kitium/auth'
import { StripeBillingAdapter } from '@kitium/auth-stripe'
import { PostgresStorageAdapter } from '@kitium/auth-postgres'

const storage = new PostgresStorageAdapter(process.env.DATABASE_URL!)
const billing = new StripeBillingAdapter(
  process.env.STRIPE_SECRET_KEY!,
  process.env.STRIPE_WEBHOOK_SECRET // optional if you process webhooks
)

const auth = new AuthCore(storage, {
  jwtSecret: process.env.JWT_SECRET!,
  billing
})

await auth.initialize()
```

## Customers

```ts
const customer = await billing.createCustomer({ email: 'a@b.com', name: 'Alice' })
const fetched = await billing.getCustomer(customer.id)
await billing.updateCustomer(customer.id, { name: 'Alice B' })
```

## Subscriptions

```ts
const sub = await billing.createSubscription({ customerId: customer.id, productId: 'prod_123' })
const s = await billing.getSubscription(sub.id)
await billing.updateSubscription(sub.id, { metadata: { plan: 'pro' } })
await billing.cancelSubscription(sub.id)
```

## Checkout & Billing Portal

```ts
const checkout = await billing.createCheckoutSession({
  customerId: customer.id,
  productId: 'prod_123',
  successUrl: 'https://your.app/billing/success',
  cancelUrl: 'https://your.app/billing/cancel'
})
// redirect to checkout.url

const portal = await billing.createBillingPortalSession(customer.id, 'https://your.app/account')
// redirect to portal.url
```

## Webhooks

```ts
// Express example
app.post('/api/stripe/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
  try {
    const event = await billing.processWebhook(req.body, req.headers['stripe-signature'] as string)
    // handle event.type
    res.sendStatus(200)
  } catch (e) {
    res.status(400).send('Invalid webhook')
  }
})
```

## License

MIT
npm package: @kitlib/ollama-categorizer
Description: A library to categorize images using the Ollama API
Author: jordyfontoura
Latest version: 0.0.5

# categorizer

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

This project was created using `bun init` in bun v1.0.30. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
npm package: @kitmi/adapters
Description: Jacaranda feature adapters
Author: Rockie Guo
Latest version: 1.1.3

# @kitmi/adapters

## Jacaranda Framework Adapters

`@kitmi/adapters` provides a unified interface for interacting with various components that share similar functionalities but may have different underlying implementations or interfaces. By using this library, developers can switch between different components such as HTTP clients or JavaScript package managers without changing the consuming codebase, making the code more modular and easier to maintain.

## Features

-   **HTTP Client Adapters**: Abstract the differences between various HTTP clients like Fetch API, or SuperAgent, allowing for easy interchangeability.
-   **JS Package Manager Adapters**: Seamlessly switch between package managers like npm, Yarn, or pnpm without altering the workflow scripts.

## Installation

To install `@kitmi/adapters`, run the following command:

```bash
bun install @kitmi/adapters
```

Or if you're using npm:

```bash
npm install @kitmi/adapters
```

## Usage

#### HTTP Client Adapter Example

```javascript
import { superagent, supertest, fetchagent } from '@kitmi/adapters';
import { HttpClient } from '@kitmi/jacaranda';
// Instantiate the adapter with your preferred client
let httpClient = new HttpClient(superagent() /** supertest(), fetchagent() */, 'https://dummyjson.com');
const result = await httpClient.get('/products');
console.log(result);
```

#### JS Package Manager Adapter Example

```javascript
import { packageManagers } from '@kitmi/adapters';

// Instantiate the adapter with your preferred package manager
const pkgManager = packageManagers['npm']; // or 'yarn', 'pnpm'

// Use the adapter to install package and save to package.json
await pkgManager.addPackage_('express');
```

## License

-   MIT
-   Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/algo
Description: Common JavaScript algorithms
Author: Rockie Guo
Latest version: 1.1.1

# @kitmi/algo

## Common JavaScript Algorithms

`@kitmi/algo` is a lightweight JavaScript library for various algorithms and data structures, focusing on graph and tree operations. It provides efficient implementations of Breadth-First Search (BFS), Depth-First Search (DFS), Topological Sorting, Finite State Machines (FSM), and representations for graphs and trees, among other utilities.

## Features

- **Search Algorithms**: 
  - Breadth-First Search (BFS)
  - Depth-First Search (DFS)

- **Structures**:
  - Directed Graph
  - Tree
  - Key Tree
  - Finite State Machine

- **Other Algorithms**:
  - Topo Sorting

## Installation

To install `@kitmi/algo`, run the following command:

```bash
bun install @kitmi/algo
```

Or if you're using npm:

```bash
npm install @kitmi/algo
```

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/config
Description: JavaScript env-aware config system
Author: Rockie Guo
Latest version: 1.3.0

# @kitmi/config

## JavaScript Env-aware Config

`@kitmi/config` provides a simple and flexible way to manage configuration settings for applications across different environments. It supports both JSON and YAML file formats and automatically selects the appropriate configuration based on the current environment.

## Features

-   Environment-aware: Automatically loads configuration files based on the environment setting.
-   Supports JSON and YAML: Seamlessly works with both JSON and YAML configuration files.
-   Easy to use: Provides a straight forward API to access configuration values.
-   Customizable: Allows custom environment variable names and custom configuration file paths.
-   Fallbacks: Supports default configuration for unspecified environments.

## Installation

To install `@kitmi/config`, run the following command:

```bash
bun install @kitmi/config
```

Or if you're using npm:

```bash
npm install @kitmi/config
```

## Usage

1. Create configuration files for your environments, e.g., `config.development.json`, `config.production.json`, `config.default.yaml`.

2. Import the library and use it to access your configuration settings:

```javascript
import ConfigLoader from '@kitmi/config';

const configLoader = ConfigLoader.createEnvAwareJsonLoader(<config path>, 'config', <development|production>);
await configLoader.load_();
```

3. Variables referenced in config

-   Reference to `settings.jwtSecret` node in the same config file.

```json
{
    "jwt": "#!jsv: $this.settings.jwtSecret"
}
```

-   Reference to a env variable using ES string template.

```yaml
dataSource:
    postgres:
        wisley:
            connection: '${env.WISLEY_DB_URL}'
            logStatement: true
```

## License

-   MIT
-   Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/data
Description: Jacaranda Framework Data Access Model
Author: Rockie Guo
Latest version: 0.11.4

# @kitmi/data 

Jacaranda Framework Data Access Layer

This library is the data access layer of the Jacaranda Framework, designed to provide both ORM and non-ORM approaches for database interactions. It encapsulates SQL operations, connection pool management, and routine CRUD (Create, Read, Update, Delete) operations, ensuring efficient and scalable data handling. By offering a flexible and powerful API, @kitmi/data simplifies the complexities of database management, allowing developers to focus on building robust applications without worrying about underlying data access intricacies.

## Docs

- Design

https://kitmi.github.io/jacaranda/data-access-models.html

- Manual

https://kitmi.github.io/jacaranda/data-manual.html


## License

-   MIT
-   Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/feat-ai-kits
Description: AI related utilities
Author: Rockie Guo
Latest version: 0.1.1

# @kitmi/feat-ai-kits

## Jacaranda Framework AI Features

`@kitmi/feat-ai-kits` 

## Features


## Installation

To install `@kitmi/feat-ai-kits`, run the following command:

```bash
bun add @kitmi/feat-ai-kits
```

Or if you're using npm:

```bash
npm install @kitmi/feat-ai-kits
```

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/feat-cipher
Description: Cipher & hash related utilities
Author: Rockie Guo
Latest version: 2.1.0

# @kitmi/feat-cipher

## Jacaranda Framework AI Features

`@kitmi/feat-cipher` 

## Features

- cipher

## Installation

To install `@kitmi/feat-cipher`, run the following command:

```bash
bun add @kitmi/feat-cipher
```

Or if you're using npm:

```bash
npm install @kitmi/feat-cipher
```

## Usage

1. Export the feature in the app module
```js
import cipher from '@kitmi/feat-cipher';

export default {
    cipher
};
```

2. Add the feature into config
```yaml
cipher:
    key: '' # optional
    hashAlgorithm: '' # optional
    # ...
```

3. Use anywhere 
```js
const cipher = app.getService('cipher');
cipher.hash();
```

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/feat-db
Description: Database related utilities
Author: Rockie Guo
Latest version: 0.3.0

# @kitmi/feat-db

## Jacaranda Framework Database Add-on Features

`@kitmi/feat-db`

## Features

-   dbImporter

## Helpers

-   excel
    -   writeExcelTemplate\_
    -   loadExcelFile\_

## Usage

### Features

1. Export the feature in the app module

```js
import { dbImporter } from '@kitmi/feat-db';

export default {
    dbImporter,
};
```

2. Add the feature into config

```yaml
dbImporter:
    service: 'prisma'
```

3. Use anywhere

```js
const dbImporter = app.getService('dbImporter');
await dbImporter.importList_();
// it dbImporter.import_();
```

### Helpers

```js
import { writeExcelTemplate_ } from '@kitmi/feat-db';

export default {
    dbImporter,
};
```

## License

-   MIT
-   Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/feat-devops
Description: Devops related utilities
Latest version: 0.1.1

# @kitmi/feat-devops

## Jacaranda Framework DevOps Feature

`@kitmi/feat-devops`是 Jacaranda 框架的 DevOps 功能模块，提供了与 Git 服务（如 Gitea 和 GitLab）交互的能力。

## Features

- gitea - 提供与 Gitea 服务交互的功能
- gitlab - 提供与 GitLab 服务交互的功能
- devops - 统一入口，可通过配置选择不同的 Git 服务提供商

## License

MIT
npm package: @kitmi/feat-pipeline
Description: A simple pipeline runner service
Author: Rockie Guo
Latest version: 0.1.1

# @kitmi/feat-pipeline

## Jacaranda Framework Pipeline Features

`@kitmi/feat-pipeline` 

## Features


## Installation

To install `@kitmi/feat-pipeline`, run the following command:

```bash
bun add @kitmi/feat-pipeline
```

Or if you're using npm:

```bash
npm install @kitmi/feat-pipeline
```

## Sample

```yaml
pre:
    define:
        hashAlgorithm: 'sha256'

    pathResolve:
        path: '$input.localPath'
        base: '$app.workingPath'

    fileInfo: # get file info, e.g. size, mime, etc.
        file: 'pathResolve'

    hashFile: 
        algorithm: 'define.hashAlgorithm'
        file: 'pathResolve'

    transform: # transform the input value with type cast and modifiers (validator/processor/activator)
        input: '$input.ref'
        type: 'string'
        post:
            - '|pascalCase'
            - '|toLower'

    dbExistUnique: # check if the record exists in the database
        service: 'prisma'
        model: '$env.modelName'
        where:
            ref: '$input.ref'
            checksum: 'hashFile'
                
    formatObjectKey: # format the object key with string template
        task: format
        template: '${$input.remotePath}/${transform}${fileInfo.extName}'

    uploadCloud:
        when: 
            dbExistUnique: false
        file: 'pathResolve'        
        objectKey: 'formatObjectKey'
        contentType: 'fileInfo.mime'        
        service: 'cloudStorage.aws'
        payload:
            publicRead: true

    copy: # copy from input to data
        input: $input
        filter: # filter out the following keys
            - localPath
            - remotePath

    setUrl:        
        when: 
            dbExistUnique: false
        task: fill
        data:
            url: 'uploadCloud.url'

    fill:
        data:
            name: 'fileInfo.fileName'
            fileSize: 'fileInfo.size'
            mimeType: 'fileInfo.mime'
            storedName: 'formatObjectKey'
            checksum: 'hashFile'
```

## Task Development

Task interface

```
```


## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/feat-storage
Description: Jacaranda cloud storage features
Author: Rockie Guo
Latest version: 1.1.2

# @kitmi/feat-storage

## Jacaranda Framework Cloud Storage Features

`@kitmi/feat-storage` 

## Features


## Installation

To install `@kitmi/feat-storage`, run the following command:

```bash
bun add @kitmi/feat-storage
```

Or if you're using npm:

```bash
npm install @kitmi/feat-storage
```

## Usage

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/feat-vision
Description: Computer vision & image processing related utilities
Author: Rockie Guo
Latest version: 2.0.0

# @kitmi/feat-cipher

## Jacaranda Framework AI Features

`@kitmi/feat-cipher` 

## Features

- cipher

## Installation

To install `@kitmi/feat-cipher`, run the following command:

```bash
bun add @kitmi/feat-cipher
```

Or if you're using npm:

```bash
npm install @kitmi/feat-cipher
```

## Usage

1. Export the feature in the app module
```js
import cipher from '@kitmi/feat-cipher';

export default {
    cipher
};
```

2. Add the feature into config
```yaml
cipher:
    key: '' # optional
    hashAlgorithm: '' # optional
    # ...
```

3. Use anywhere 
```js
const cipher = app.getService('cipher');
cipher.hash();
```

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/middlewares
Description: Jacaranda framework common middlewares
Author: Rockie Guo
Latest version: 0.3.3

# @kitmi/middlewares

## Jacaranda Framework Common Middlewares

`@kitmi/middlewares` 

## Features


## Installation

To install `@kitmi/middlewares`, run the following command:

```bash
bun add @kitmi/middlewares
```

Or if you're using npm:

```bash
npm install @kitmi/middlewares
```

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/sys
Description: JavaScript local system utilities
Author: Rockie Guo
Latest version: 1.2.2

# @kitmi/sys

## JavaScript Local System Utilities

`@kitmi/sys` is a small collection of utility functions designed to interact with the local system using JavaScript. It is designed to work with `node.js`/`bun.sh`.

## Features

- cmd helpers: `run_`, `runLive_`, `runSync`
- require from specified location and throw friendly error: `tryRequire`
- fs utils: `isDir`, `isDirEmpty`, fs from fs-extra
- reboot: `reboot`
- eval: `interpolate`, `evaluate`

## Installation

To install `@kitmi/sys`, run the following command:

```bash
bun install @kitmi/sys
```

Or if you're using npm:

```bash
npm install @kitmi/sys
```

## License
- MIT
- Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/types
Description: JavaScript semantic data types
Author: Rockie Guo
Latest version: 1.3.5

# @kitmi/types

## JavaScript Semantic Data Types

`@kitmi/types` defines semantic data types with validation and sanitization.

## Installation

To install `@kitmi/types`, run the following command:

```bash
bun install @kitmi/types
```

Or if you're using npm:

```bash
npm install @kitmi/types
```

## Conventions

### Types

-   any
-   array
-   bigint
-   binary
-   boolean
-   datetime
-   integer
-   number
-   object
-   text

### Type Interface

```
name: "type name",
alias: ["type alias"],
defaultValue: null,

sanitize: (value, meta, i18n, context) => sanitized,
serialize: (value, meta) => string
```

### Common Type Meta

-   {boolean} plain - Keep raw value, don't try to preProcess and type cast before post processing
-   {boolean} optional - No error throw if value is null and default is null
-   {any} default - Default value if value is null
-   {array} enum - An array of values which the value of a enumerable type should be one of it
-   {any} const - The constant value of this field

### Enumerable Types

-   bigint
-   integer
-   number
-   text

### Validation Error

-   message
-   status = 400
-   code = E_INVALID_DATA
-   info = { value, meta, [i18n], [path] }

### Plugins

-   datetimeParser
-   bigintWriter
-   preProcess - [sync/async] (value, meta, opts: { rawValue, i18n, path }) => [ finished, processedValue ] or [ false ]
-   postProcess - [sync/async] (value, meta, opts: { rawValue, i18n, path }) => processedValue

Note: if preProcess or postProcess is async function, sanitize\_ should be called instead of sanitize

See `@kitmi/validators` for semantic validation.

### Notes

-   Object sanitization

Use `keepUnsanitized` for keeping those entries not defined in the object schema.

## License

-   MIT
-   Copyright (c) 2023 KITMI PTY LTD
npm package: @kitmi/utils
Description: A JavaScript utility library for both server and browser
Author: Rockie Guo
Latest version: 1.3.1

# @kitmi/utils

## JavaScript Utility Library

`@kitmi/utils` is a JavaScript utility library delivering consistency, customization, performance, and extra features. It's built on top of lodash, providing a suppliment of functions for manipulating text, URLs, arrays, objects, and names.

## Features

-   \_: universal lodash
-   lang: `sleep_`, `waitUntil_`, `pipeAsync_`, `Box`, `fxargs`, type checks, ...
-   array: `arrayToCsv`, `arrayToObject`, `zipAndFlat`, immutable operations, ...
-   object: `objectToArray`, `pushIntoBucket`, `remap`, `keyAt`, ...
-   collection: `findKey`, `batchAsync_`, `eachAsync_`, async collection operations, ...
-   string
    -   common text processing: `quote`, `unquote`, `unwrap`, ...
    -   naming: `camelCase`, `kebabCase`, `pascalCase`, `snakeCase`
    -   url: `join`, `appendQuery`, `objectToQueryString`, `queryStringToObject`

## Installation

To install `@kitmi/utils`, run the following command:

```bash
bun install @kitmi/utils
```

Or if you're using npm:

```bash
npm install @kitmi/utils
```

## License

-   MIT
-   Copyright (c) 2023 KITMI PTY LTD

## Test helper (not exposed in index)

### test register for adding missing should assertion helpers into chai

Add below lines in `.mocharc.js` after `@babel/register` or `@swc-node/register`

E.g.

```
require('@swc-node/register');
require('@kitmi/utils/testRegister');

(() => {}).should.throw(...);
```

### some difference between should and chai

```
// left: should, right: chai
should.be.true() => should.be.true
should.be.false() => should.be.false
should.be.ok() => should.be.ok
```