open-index/open-npm huggingface dataset:
npm package: @ocubist/error-alchemy
Description: A powerful Node.js error-handling-framework with custom error types for easy debugging, enhanced error management, strong zod-support and useful quality-of-life-functionality for asserting and validating values.
Author: ocubist
Latest version: 0.9.3

# Error Alchemy

## Description

Error Alchemy is a sophisticated error-handling framework designed for robust error management in TypeScript applications. It provides a flexible and powerful toolkit for creating custom errors, handling error transmutation, and ensuring detailed error logging and resolution. The library leverages `Zod` schemas extensively to ensure advanced type-safety and comprehensive type inference.

## Installation

To install Error Alchemy, use npm or yarn:

```bash
npm install @ocubist/error-alchemy
# or
yarn add @ocubist/error-alchemy
```

## Usage

### Basic Example

```ts
import { useErrorAlchemy } from "@ocubist/error-alchemy";
import { z } from "zod";

// Define your Zod schemas
const errorPropsSchema = z.object({
  name: z.string(),
  message: z.string(),
});

// Initialize the Error Alchemy toolkit
const { craftMysticError, craftErrorTransmuter } = useErrorAlchemy(
  "MyModule",
  "ExampleContext"
);

// Craft a custom error
const MyCustomError = craftMysticError({
  name: "MyCustomError",
  errorCode: "CUSTOM_ERROR",
  severity: "critical",
});

// Create a transmuter for the custom error
const transmuter = craftErrorTransmuter(
  (err) => err instanceof Error,
  (err) => new MyCustomError({ message: err.message, origin: err })
);

// Use the transmuter in your application
try {
  throw new Error("Something went wrong!");
} catch (error) {
  const customError = transmuter.execute(error);
  console.error("Handled error:", customError);
}
```

### Advanced Example with Error Synthesizer

```ts
import { useErrorAlchemy } from "@ocubist/error-alchemy";
import { z } from "zod";

// Define your Zod schemas
const errorPropsSchema = z.object({
  name: z.string(),
  message: z.string(),
});

// Initialize the Error Alchemy toolkit
const { craftErrorSynthesizer, craftMysticError, craftErrorTransmuter } =
  useErrorAlchemy("MyModule", "ExampleContext");

// Craft a custom error
const MyCustomError = craftMysticError({
  name: "MyCustomError",
  errorCode: "CUSTOM_ERROR",
  severity: "critical",
});

// Create a transmuter for the custom error
const transmuter = craftErrorTransmuter(
  (err) => err instanceof Error,
  (err) => new MyCustomError({ message: err.message, origin: err })
);

// Create an error synthesizer
const synthesizer = craftErrorSynthesizer([transmuter]);

// Use the synthesizer in your application
try {
  throw new Error("Something went wrong!");
} catch (error) {
  const synthesizedError = synthesizer.synthesize(error);
  console.error("Handled synthesized error:", synthesizedError);
}
```

## API Documentation

For the full API documentation, please visit the [Error Alchemy Documentation](https://ocubist.github.io/error-alchemy/).

## License

Error Alchemy is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more information.
npm package: @ocubist/event-handler
Description: For personal usage
Author: ocubist
Latest version: 0.2.3

# Event Handler

## Description

The Event Handler library provides a robust and efficient way to manage custom events in JavaScript applications. It supports registering persistent (`on`) and one-time (`once`) event listeners, emitting events, and removing listeners. This library is optimized for performance and can handle a large number of listeners efficiently.

## Installation

To install the Event Handler, use npm or yarn:

```bash
npm install @ocubist/event-handler
# or
yarn add @ocubist/event-handler
```

## Usage

### Basic Example

```typescript
import { useEventHandler } from "@ocubist/event-handler";

const eventName = "myEvent";
const eventHandler = useEventHandler(eventName);

// Define a listener function
const listener = (data) => {
  console.log("Event data:", data);
};

// Register the listener using `on`
eventHandler.on(listener);

// Emit the event with some data
eventHandler.emit({ message: "Hello, world!" });
// Output: "Event data: { message: 'Hello, world!' }"

// Remove the listener
eventHandler.off(listener);

// Verify listener count
console.log(eventHandler.listenerCount()); // 0
```

### Advanced Example with POST Request

```typescript
import { useEventHandler } from "@ocubist/event-handler";

const eventName = "dataReceived";
const eventHandler = useEventHandler(eventName);

// Define a listener function to handle data
const dataListener = async (data) => {
  try {
    const response = await fetch("https://example.com/api/data", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(data),
    });
    const result = await response.json();
    console.log("POST response:", result);
  } catch (error) {
    console.error("Error posting data:", error);
  }
};

// Register the listener using `once`
eventHandler.once(dataListener);

// Emit the event with data to be sent in the POST request
eventHandler.emit({ key: "value" });
// The listener will send a POST request to "https://example.com/api/data" with the data
```

## API Documentation

[Docs](https://ocubist.github.io/event-handler/)

## License

The Event Handler is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more information.
npm package: @ocubist/file-stream-manager
Description: DESCRIPTION
Author: ocubist
Latest version: 0.5.1

# File Stream Manager

## Description

The File Stream Manager provides a comprehensive set of utilities for managing file streams in Node.js environments. It allows for opening, reading, writing, flushing, and closing file streams, along with managing subscriptions and tracking usage counts. This package is particularly useful for applications requiring robust file management, such as logging systems, data processing pipelines, or any scenario where efficient and controlled file I/O operations are crucial.

### Key Functions:

- `useFileStreamManager`: A wrapper function that provides a unified interface for managing file streams.
  - `open`: Opens the file stream.
  - `close`: Closes the file stream.
  - `write`: Writes data to the file stream.
  - `read`: Reads data from the file stream.
  - `flush`: Flushes the file stream.
  - `subscribe`: Subscribes to the file stream.
  - `unsubscribe`: Unsubscribes from the file stream.
  - `getUsageCount`: Retrieves the usage count for the file stream.
  - `isFileStreamOpen`: Checks if the file stream is currently open.
- `getOpenFileStreams`: Retrieves a list of all currently open file streams by their file paths.
- `forceCloseOfAllFileStreams`: Forces the closure of all active file streams, typically used for cleanup or shutdown processes.

## Installation

To install the File Stream Manager, use npm or yarn:

```bash
npm install @ocubist/file-stream-manager
# or
yarn add @ocubist/file-stream-manager
```

## Usage

### Basic Example

Here's a basic example demonstrating how to use the `useFileStreamManager` to open, write, and close a file stream:

```typescript
import { useFileStreamManager } from "@ocubist/file-stream-manager";

const filePath = "./example.txt";
const fileManager = useFileStreamManager(filePath);

(async () => {
  await fileManager.open();
  fileManager.write("Hello, world!");
  fileManager.flush();
  const content = await fileManager.read();
  console.log(content); // Should output: Hello, world!
  await fileManager.close();
})();
```

### Advanced Example with POST Request

Here’s an advanced example showing how you might use the `useFileStreamManager` in combination with a POST request handler to log data into a file:

```typescript
import { useFileStreamManager } from "@ocubist/file-stream-manager";
import express from "express";

const app = express();
const filePath = "./log.txt";
const fileManager = useFileStreamManager(filePath);

app.use(express.json());

app.post("/log", async (req, res) => {
  try {
    await fileManager.open();
    fileManager.write(JSON.stringify(req.body) + "\n");
    fileManager.flush();
    res.status(200).send("Logged");
  } catch (error) {
    res.status(500).send("Failed to log");
  } finally {
    await fileManager.close();
  }
});

app.listen(3000, () => console.log("Server running on port 3000"));
```

## API Documentation

[Docs](https://ocubist.github.io/file-stream-manager/)

## License

The File Stream Manager is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more information.
npm package: @ocubist/lib
Description: A collection of libraries for personal usage.
Author: ocubist
Latest version: 0.1.1

# Lib

For personal usage.

## Installation

Install via `npm install @ocubist/lib@latest`

### Commands to update

```powershell
npm install @ocubist/error-handler@latest
npm install @ocubist/logger@latest
npm install @ocubist/utils@latest
```

## License

This project is licensed under the MIT License - see the [License](./LICENSE.md) for details.
npm package: @ocubist/singleton-manager
Description: A simple but effective Singleton-Manager.
Author: ocubist
Latest version: 0.6.1

# Singleton Manager

## Description

A simple but effective Singleton-Manager.

## Installation

To install the Singleton Manager, use npm or yarn:

```bash
npm install @ocubist/singleton-manager
# or
yarn add @ocubist/singleton-manager
```

## Usage

### Basic Example

```typescript
import { useSingleton } from "@ocubist/singleton-manager";

// Create a singleton manager for "myGroup"
const singletonManager = useSingleton("myGroup");

// Define a singleton
singletonManager.setSingleton("mySingleton", { value: 42 });

// Retrieve the singleton
const mySingleton = singletonManager.getSingleton<{ value: number }>(
  "mySingleton"
);
console.log(mySingleton.value); // Output: 42

// Check if a singleton exists
const exists = singletonManager.hasSingleton("mySingleton");
console.log(exists); // Output: true

// Remove a singleton
singletonManager.removeSingleton("mySingleton");
```

### Advanced Example with POST Request

```typescript
import { useSingleton } from "@ocubist/singleton-manager";
import axios from "axios";

// Create a singleton manager for "apiGroup"
const apiSingletonManager = useSingleton("apiGroup");

// Function to make a POST request
const postRequest = async (url: string, data: object) => {
  const response = await axios.post(url, data);
  return response.data;
};

// Define and store a singleton for the POST request function
apiSingletonManager.setSingleton("postRequest", postRequest);

// Retrieve and use the singleton to make a POST request
const postFunction =
  apiSingletonManager.getSingleton<(url: string, data: object) => Promise<any>>(
    "postRequest"
  );

postFunction("https://example.com/api", { key: "value" })
  .then((response) => console.log(response))
  .catch((error) => console.error(error));
```

## API Documentation

[Docs](https://ocubist.github.io/singleton-manager/)

## License

The Singleton Manager is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more information.
npm package: @ocubist/utils
Description: For personal usage
Author: ocubist
Latest version: 0.6.2

# Utils

## Description

The `@ocubist/utils` package is a collection of utility functions designed to simplify common tasks in Node.js and browser environments. It includes functions for ANSI color support, UUID validation and generation, environment detection, and more.

## Installation

To install the Utils, use npm or yarn:

```bash
npm install @ocubist/utils
# or
yarn add @ocubist/utils
```

## API Documentation

[Docs](https://ocubist.github.io/utils/)

## License

The Utils is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for more information.
npm package: @ocular-d/typos-bin
Description: Binary wrapper for typos — a spell checker for source code
Author: svx
Latest version: 1.45.0

# @ocular-d/typos-bin

> Binary wrapper for [typos](https://github.com/crate-ci/typos) — a fast, low false-positive spell checker for source code

Effortlessly add typos to any npm, pnpm, or Yarn project without a separate Rust or system installation.

## Install

```sh
npm install --save-dev @ocular-d/typos-bin
```

```sh
pnpm add --save-dev @ocular-d/typos-bin
```

```sh
yarn add --dev @ocular-d/typos-bin
```

The correct typos binary for your platform is automatically downloaded during install.

**Supported platforms:** macOS (arm64, x64), Linux (arm64, x64)

## Usage

### CLI

```sh
# via npx
npx typos .

# via npm exec
npm exec typos -- --format json .
```

### npm scripts

```json
{
  "scripts": {
    "lint:spell": "typos .",
    "lint:spell:fix": "typos --write-changes ."
  }
}
```

### JavaScript API

```js
import { execFile } from 'node:child_process';
import typosPath from '@ocular-d/typos-bin';

execFile(typosPath, ['--version'], (error, stdout) => {
  if (error) throw error;
  console.log(stdout); // typos 1.43.5
});
```

## Configuration options

Options can be set in three ways (listed by priority, highest first):

### Environment variables

```sh
TYPOS_BIN_VERSION=1.42.0          # use a specific typos version
TYPOS_BIN_DOWNLOAD_REPO=https://… # use a custom mirror (proxy/corporate network)
```

### `.npmrc`

```ini
typos_bin_version=1.42.0
typos_bin_download_repo=https://mirror.example.com
```

### `package.json`

```json
{
  "typos-bin": {
    "version": "1.42.0",
    "downloadRepo": "https://mirror.example.com"
  }
}
```

> **Note:** After changing any option, re-run your package manager install to re-download the binary.

### Options

| Option | Default | Description |
|--------|---------|-------------|
| `version` | bundled version | Specific typos version to download |
| `downloadRepo` | `https://github.com` | Base URL for binary downloads (useful behind corporate proxies) |

## Troubleshooting

### Binary not found after install

If you see `The typos binary was not found`, your install was likely run with `--ignore-scripts`. Re-run without that flag:

```sh
npm install
```

## License

MIT
npm package: @ocular-d/vale-bin
Description: Vale wrapper
Author: ocular-d
Latest version: 2.29.6

<!-- PROJECT LOGO -->

<br />
<p align="center">
  <h1 align="center">vale-bin</h1>

  <p align="center">
    NPM wrapper for vale
    <br />
    <a href="https://github.com/ocular-d/vale-bin"><strong>Explore the docs »</strong></a>
    <br />
    <br />
    <a href="https://github.com/ocular-d/vale-bin/issues">Report Bug</a>
    ·
    <a href="https://github.com/ocular-d/vale-bin/issues">Request Feature</a>
  </p>
</p>

<!-- TABLE OF CONTENTS -->

## Table of Contents

- [About the Project](#about)
- [Install](#install)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
- [Credits](#credits)

## About

NPM wrapper for [vale](https://github.com/errata-ai/vale "Link to vale on GitHub").

## Install

```sh
npm install --save @ocular-d/vale-bin
```

## Usage

```sh
./node_modules/.bin/vale -h
vale - A command-line linter for prose.

Usage:	vale [options] [input...]
	vale myfile.md myfile1.md mydir1
	vale --output=JSON [input...]
```

```sh
./node_modules/.bin/vale docs
```

## Contributing

We are a community effort, and everybody is most welcome to participate!

Be it filing bugs, formulating enhancements, creating pull requests, or any other means of contribution, we encourage contributions from everyone.

## License

Distributed under the [MIT](https://choosealicense.com/licenses/mit/ "Link to license") license.

## Credits

- [David Offerman](https://github.com/davidofferman "Link to GitHub of David"), code is based on [hugo-bin](https://github.com/davidofferman/hugo-bin "Link to hugo-bin on GitHub")
- [Onna](https://onna.com "Link to Onna")
- [Anh Le](https://github.com/Haizzz "Link to Anh Le on GitHub")
- [Andrée Hansson](https://github.com/peol "Link to Andrée Hansson on GitHub")
- [ Maia Teegarden ](https://github.com/padmaia "Link to Maia Teegarden on GitHub")
npm package: @ocular-interactive/cordova-plugin-ios-camerastream
Description: cordova plugin to stream iOS camera to webapp
Author: Ocular - Bert Huys
Latest version: 0.0.4

# cordova-plugin-ios-camerastream
Plugin made by combining multiple other plugins. Made for iOS because it doesn't support webRTC in wkWebview (yet).

##(Re)start the stream (camera, fps)
Start the "back" or "front" camera with fps

```cordova.iosStream.startCapture('back', 30);```

##Pause the current stream
Pauses the current stream

```cordova.iosStream.pause();```

##Process capture data
Returns the stream as base64

```
cordova.iosStream.capture = function(data){
    //do something here for example:
    image.src = data;
}
```
npm package: @ocupop/4p-common
Description: Common utilities &amp; components shared across the 4p project
Author: cdnicoll
Latest version: 0.0.17
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# 4p-common
## Install
```bash
npm install --save @ocupop/4p-common
```

## Commands
  `yarn start`: rolls up the `src` directory and watches for changes
  
  `yarn test`: Tests the components using jest

  `yarn build`: Compiles the components for distribution


## Components
### Fields
Formik Fields:
- AddressInput
- CreateSelect
- CurrencyInput
- ... @TODO add the rest and link to

## Usage
@TODO This needs to be updated with examples
```jsx
import React, { Component } from 'react'

import MyComponent from '4p-common'

class Example extends Component {
  render () {
    return (
      <MyComponent />
    )
  }
}
```

## Developing
### ./
Where our common components will be setup and created. You'll want to run `yarn start` to roll the changes each time there are updates to them

You can either develop within the `/example` directory which links to the repo within it's package file.

It's also possible to run run `yarn link:common` which allows us to work in another project. (Note, if it fails make sure to run `yarn` within the `link/` directory

### Example
```bash
## 4p-common project
4p-common [feature/webpack] % yarn link:common
yarn run v1.17.3
$ node -r esm ./link/setup.js
? What do you want to do (Use arrow keys)
❯ Link Project
  Unlink Porject
```

---

### example/
A sandbox within this project to develop against. We pull components in from the `src/` directory and demonstrate how they're used. To develop, within this directory run `yarn start` to start the application. Note that the root level component directory needs to be watching for component changes.

The 4P-Common component is simply [linked](https://docs.npmjs.com/cli/link.html) and pulls in changes.


## Publishing
```
$ npm login <login with ocupop creds>
# [ ] Make sure to push changes to git first
# [ ] Make sure to bump the version number
$ npm publish
```
npm package: @ocupop/eslint-config
Description: Ocupop's default ESLint configuration for React and standard JavaScript projects.
Author: Ocupop
Latest version: 0.2.1

# Ocupop Linter Config [@ocupop/eslint-config](https://www.npmjs.com/package/@ocupop/eslint-config)

Installs a lint package to be used within projects.

## Getting Started
### Install
npm
```
npm install @ocupop/eslint-config@latest --save-dev
```
yarn
```
yarn add --dev @ocupop/eslint-config@latest
```

### Project Setup
Add `.eslintrc` file within the root of your project
```javascript
module.exports = {
  extends: [
    "eslint:recommended",
    "@ocupop/eslint-config",
  ],
  parserOptions: {
    ecmaVersion: 12,
    sourceType: "module",
  },
  env: {
    browser: true,
    node: true,
    es6: true,
  },
  rules: {
    // You can add additional project-specific rules here
  },
};
```

## Developing
### To Link:
1. Run `yarn link` within this project
2. Navigate to the project where you want to test the package.
3. Link the globally symlinked package to your project by running:
```
yarn link @ocupop/eslint-config
```
5. Update your ESLint configuration file in the test project
   - See Setup instructions 

### To Unlink:
1. In your project directory, run:
```
yarn unlink @ocupop/eslint-config
```
2. In your package directory, run:
```
yarn unlink
```

## Publishing
```
$ npm login <login with ocupop creds>
# [ ] Make sure to push changes to git first
# [ ] Make sure to bump the version number
$ npm publish
```
npm package: @ocupop/ocubits-dev
Description: Bits of reusable code for Ocupop projects
Author: Ocupop
Latest version: 0.1.4

# OcuBits
Reusable code developed by Ocupop.

## How to Contribute

Write directions for developing in Storybook:

## How to Publish
--

Bumping versions we're using [Semantic Versioning](https://semver.org/)
```
npm version patch
# Bumps the patch number like 0.0.0 -> 0.0.1

npm version minor
# Bumps the patch number like 0.0.x -> 0.1.0

npm version major
# Bumps the patch number like 0.x.y -> 1.0.0
```

## Useful Links
- [formik](https://formik.org/)
- [Building an NPM package](https://onderonur.netlify.app/blog/creating-a-typescript-library-with-vite/)
- [Linking/Unlinking Package](https://javascript.plainenglish.io/test-your-library-locally-with-npm-link-a5aa79d07270)

## Other Ocupop Packages
- [eslint-config](https://github.com/ocupop/eslint-config)
npm package: @ocupop/ocuponents-fields
Description: Ocuponents set of fields used for formik
Author: Ocupop
Latest version: 0.0.5

# Ocuponents - Fields
Set of formik fields developed by Ocupop.

## How to Contribute
### Link
Within this project run:
```
npm link
```

This will link the local package until you unlink it, or restart your machine.

Within a project you're working on, run
```
npm link @ocupop/ocuponents-fields
```

This will have two effects:
- `npm install` will be run
- link the package to the project under development.

Do work within this repository and run `npm build` to see the resulting changes 

Each time you make changes run `yarn build` to rebuild the package

### Unlink

To unlink you can either restart your computer, or simply run
```
npm unlink @ocupop/ocuponents-fields
```

## How to Publish
--

Bumping versions we're using [Semantic Versioning](https://semver.org/) 
```
npm version patch
# Bumps the patch number like 0.0.0 -> 0.0.1

npm version minor
# Bumps the patch number like 0.0.x -> 0.1.0

npm version major
# Bumps the patch number like 0.x.y -> 1.0.0
```

## Useful Links
- [formik](https://formik.org/)
- [Building an NPM package](https://onderonur.netlify.app/blog/creating-a-typescript-library-with-vite/)
- [Linking/Unlinking Package](https://javascript.plainenglish.io/test-your-library-locally-with-npm-link-a5aa79d07270)

## Other Ocupop Packages
- [eslint-config](https://github.com/ocupop/eslint-config)
npm package: @ocupop/prettier-config
Description: CLI For adding prettier config to a project
Author: cody@ocupop.com
Latest version: 0.0.3
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Ocupop Prettier Config
Sets up prettier config within `npx` across projects

## Setup
Run the following `npx` command to install prettier

```
npx @ocupop/prettier-config
```

### Options
```
  --version        Show version number                                 [boolean]
  -h, --help       Show help                                           [boolean]
  --remove, --rm   Remove prettier from application   [boolean] [default: false]
  --upgrade, --up  Upgrade prettier config            [boolean] [default: false]
  ```

## Using
### Files
Once installed, the package will add two new files:
`prettier.config.js` where we can add addtional config [options](https://prettier.io/docs/en/options.html) per project, and `.prettierignore` in which we can ignore files/directories when using prettier.

### Scripts
Within `package.json` two new scrips are installed.
```
$ yarn checkFormat  # will run prettier and validate files
$ yarn format       # formats all files (with specified extensions) 
```

### Prettier Extension
By default we do not require that the pretty extension be installed. Simply running `yarn format` will run prettier within our code base. However a step up, we can install the [prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) which will help format as you develop.

With it installed you can setup (under settings) `"editor.formatOnSave": true` which will format your files each save. You can also run `Format Document` from your command pallet

## Publishing
```
$ npm login <login with ocupop creds>
# [ ] Make sure to push changes to git first
# [ ] Make sure to bump the version number
$ npm publish
```
npm package: @ocupop/setup-eslint
Description: Sets up [Ocupops Eslint](https://github.com/ocupop/eslint-config) config within `npx`. This will set you up with a `.eslintrc` file that extends [@ocupop/eslint-config](https://www.npmjs.com/package/@ocupop/eslint-config)
Author: dev@ocupop.com
Latest version: 0.0.7

# Ocupop Linter Setup [@ocupop/setup-eslint](https://www.npmjs.com/package/@ocupop/setup-eslint)

Sets up [Ocupops Eslint](https://github.com/ocupop/eslint-config) config within `npx`. This will set you up with a `.eslintrc` file that extends [@ocupop/eslint-config](https://www.npmjs.com/package/@ocupop/eslint-config)

## Setup
Run the following `npx` command to install ESLint

```
npx @ocupop/setup-eslint
```

### Options
```
  --version        Show version number                                 [boolean]
  -h, --help       Show help                                           [boolean]
  --remove, --rm   Remove eslint from application   [boolean] [default: false]
  --upgrade, --up  Upgrade eslint config            [boolean] [default: false]
  ```

## Using
### Files
Once installed, the package will add a new file `.eslintrc` where we can add additional [rules](https://eslint.org/docs/rules/), or override [rules](https://eslint.org/docs/rules/) values.

### Scripts
Within `package.json` two new scrips are installed.
```
$ yarn lint       # will run eslint and validate files
$ yarn checkLint  # formats all files (with specified extensions) 
```

### ESLint Extension
By default we do not require that the eslint extension be installed. Simply running `yarn lint` will run eslint within our code base. We can install the [eslint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) which will help format and point out errors as you develop.

## Publishing
```
$ npm login <login with ocupop creds>
# [ ] Make sure to push changes to git first
# [ ] Make sure to bump the version number
$ npm publish
```
npm package: @ocusell/playground-link
Description: Build deep-link URLs to the Rulesetta Playground for debugging RCP-019 validation rules
Latest version: 0.3.0

# @ocusell/playground-link

Build deep-link URLs to the Rulesetta Playground for debugging RCP-019 validation rules with prefilled data.

## Install

```bash
npm install @ocusell/playground-link
```

## Usage

```typescript
import { createPlaygroundUrl } from "@ocusell/playground-link";

const url = createPlaygroundUrl("http://localhost:3000/playground", {
  expression: "PropertyType = 'RESI' .AND. ListPrice > 0",
  action: "REJECT",
  data: {
    PropertyType: "RESI",
    ListPrice: 250000,
    Status: "Active",
  },
  previousData: {
    PropertyType: null,
    ListPrice: 100000,
  },
  meta: {
    ruleId: "R-42",
    fieldName: "ListPrice",
    errorText: "ListPrice must be greater than zero",
  },
});

// Open the playground with everything prefilled
window.open(url, "_blank");
```

The playground opens with the expression, action, data, and previous data already loaded. If `meta` is provided, a context bar is shown with the rule ID, field name, and error text.

## API

### `createPlaygroundUrl(baseUrl, state)`

Returns a full URL string (`https://host/play#<encoded>`) pointing to the playground with the given state encoded in the URL fragment.

| Parameter | Type | Description |
|---|---|---|
| `baseUrl` | `string` | Base URL of the Rulesetta server (e.g. `http://localhost:3000/playground`) |
| `state` | `PlaygroundState` | State to prefill in the playground |

### `encodeFragment(state)`

Encodes a `PlaygroundState` into a base64url fragment string (without the `#` prefix).

### `parsePlaygroundFragment(fragment)`

Decodes a fragment string back into a `PlaygroundState`. Returns `null` if the fragment is invalid. Accepts fragments with or without a leading `#`.

### `PlaygroundState`

```typescript
interface PlaygroundState {
  expression: string;
  action: string;
  data: Record<string, unknown>;
  previousData?: Record<string, unknown>;
  fieldName?: string;
  autoTidy?: boolean;
  meta?: {
    ruleId?: string;
    fieldName?: string;
    errorText?: string;
    warningText?: string;
    description?: string;
  };
}
```

## How It Works

The state is JSON-serialized and base64-encoded into the URL fragment (`#`). Since fragments are never sent to the server, there is no persistence, no server-side storage, and no data leakage in server logs. The playground's client-side JavaScript decodes the fragment on page load and populates the editors.
npm package: @ocvlabs/smart-assets
Description: Solidity Contract for Creating "Digital Asset as a Smart Contract"
Author: OnChainVision Labs
Latest version: 0.0.28

# smart-assets

OnChainVision SmartAsset Library is a suite of Solidity contracts and codecs for creating and developing "Digital Assets as Smart Contracts," a.k.a. "Smart Assets."

## Overview

### Installation

#### Hardhat (npm)

```bash
npm install @ocvlabs/smart-assets
```

### Usage

Once installed, you can use the contracts by importing them and play around with your smart-asset:

```solidity
pragma solidity ^0.8.19;

import {SmartAsset, ISmartAsset} from "@ocvlabs/smart-assets/contracts/smart-asset/SmartAsset.sol";

contract SimpleSmartAssetRegistry {
    address public _assetAddress;
    address public _creatorAddress;

    constructor(address creatorAddress) {
        _creatorAddress = creatorAddress;
    }

    function createSmartAsset(
        string memory assetName, // your asset name
        string memory assetData, // could be text or anything
        string memory assetType, // (e.g. image, script, markup)
        bool isEncoded // tell if already encoded as base64
    ) public returns (address assetAddress) {
        // deploy asset as smart contract
        SmartAsset asset = new SmartAsset(
            address(this),
            _creatorAddress,
            assetName,
            assetData,
            assetType,
            isEncoded
        );
        // record asset address
        _assetAddress = address(asset);
        return assetAddress;
    }

    function viewSmartAsset(
        address assetAddress
    ) public view returns (string memory assetData) {
        assetData = ISmartAsset(assetAddress).viewAsset();
    }
}
```

_If you prefer not to code, you can use our [Smart Asset Deployer](https://smart-deployer.ocvlabs.com) or [Interactive Asset Builder](https://builder.ocvlabs.com) for secure and straightforward digital asset creation and deployment of smart interactive assets._

## License

OnChainVision Contracts is released under the [MIT License](LICENSE).
npm package: @ocxp/client
Description: TypeScript client for OCXP protocol - auto-generated from OpenAPI spec
Latest version: 0.2.9

# @ocxp/client

TypeScript client for the OCXP (Open Context Exchange Protocol).

This package is auto-generated from the OpenAPI specification and provides type-safe access to the OCXP API.

## Installation

```bash
npm install @ocxp/client
```

## Usage

```typescript
import { Client } from '@ocxp/client';

// Create a client instance
const client = new Client({
  baseUrl: 'http://localhost:8000'
});

// Example: List projects
const { data: projects } = await client.GET('/ocxp/project');
console.log(projects);

// Example: Get a specific project
const { data: project } = await client.GET('/ocxp/project/{project_id}', {
  params: {
    path: {
      project_id: 'my-project-id'
    }
  }
});

// Example: Create a new mission
const { data: mission } = await client.POST('/ocxp/mission', {
  body: {
    name: 'My Mission',
    description: 'Mission description',
    project_id: 'my-project-id'
  }
});
```

## Features

- **Type-safe**: Full TypeScript support with auto-generated types from OpenAPI spec
- **Zod validation**: Runtime type validation using Zod schemas
- **Fetch-based**: Uses modern Fetch API for HTTP requests
- **Tree-shakeable**: ESM and CJS bundles for optimal bundle size

## API Coverage

The client provides access to all OCXP API endpoints:

- **Projects**: Create, list, update, and delete projects
- **Missions**: Manage missions and their lifecycle
- **Context**: Store and retrieve context documents
- **Memos**: Add feedback and annotations to documents
- **Repositories**: Connect and manage code repositories
- **Databases**: Configure database connections

## Documentation

For full API documentation, see the [OpenAPI specification](openapi.json) included in this package.

## Development

This package is auto-generated using [@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts).

### Regenerating the Client

If you need to regenerate the client from an updated OpenAPI spec:

```bash
npm run generate
npm run build
```

### Building

```bash
npm run build
```

### Testing

```bash
npm run test
```

## License

MIT

## Contributing

This is an auto-generated package. Please report issues or suggest improvements to the OCXP OpenAPI specification.

## Support

For questions or support, please open an issue on the [GitHub repository](https://github.com/OCXP/client-ts/issues).
npm package: @ocyrusjs/bitset
Description: High-performance, memory-efficient BitSet using Uint32Array.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/bitset 🌑

> **High-performance, memory-efficient BitSet using Uint32Array.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Memory Efficient:** Uses `Uint32Array` to store bits, consuming 32x less memory than a boolean array.
- **Fast Access:** Uses bitwise operations for $O(1)$ set, get, and toggle.
- **High Performance Count:** Implements a high-speed Hamming weight (popcount) algorithm for counting set bits.
- **Zero-Dependency:** Small and self-contained.

## 🚀 Performance

| Operation | Ops/sec |
| :--- | :--- |
| **`BitSet.get`** | **33.9M** |
| **`BitSet.set`** | **32.3M** |
| **`BitSet.count` (1024 bits)** | **14.9M** |

## 📦 Installation

```bash
npm install @ocyrusjs/bitset
```

## 🛠️ Usage

```typescript
import { BitSet } from '@ocyrusjs/bitset';

const bits = new BitSet(1024);

bits.set(100);
bits.set(200);

console.log(bits.get(100)); // true
console.log(bits.count());  // 2

bits.toggle(100);
console.log(bits.get(100)); // false
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/clamp
Description: High-performance number clamping.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/clamp 🌑

> **High-performance number clamping.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Blazing Fast:** 1.3x faster than native `Math.min(Math.max())`.
- **Zero-Allocation:** Minimal branching logic.

## 🚀 Performance

- **`clamp`**: ~25M ops/sec

## 📦 Installation

```bash
npm install @ocyrusjs/clamp
```

## 🛠️ Usage

```typescript
import { clamp } from '@ocyrusjs/clamp';

clamp(10, 0, 5); // 5
clamp(-5, 0, 10); // 0
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/debounce
Description: High-performance, minimal debounce utility.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/debounce 🌑

> **High-performance, minimal debounce utility.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Minimal:** Lightweight implementation with low overhead.
- **Cancelable:** Support for `.cancel()` to stop execution.

## 📦 Installation

```bash
npm install @ocyrusjs/debounce
```

## 🛠️ Usage

```typescript
import { debounce } from '@ocyrusjs/debounce';

const log = debounce(() => console.log('Debounced!'), 100);
log();
log.cancel();
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/event-emitter
Description: High-performance, zero-allocation-on-emit event emitter.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/event-emitter 🌑

> **High-performance, zero-allocation-on-emit event emitter.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Zero-Allocation Emit:** Optimized to avoid any object or array allocation during event emission.
- **Arg-Specific Optimizations:** Dedicated paths for 0-3 arguments to eliminate `arguments` or `...args` overhead.
- **Fast Removal:** Uses unordered removal (swap-and-pop) for listener deletion, keeping the operations $O(1)$ where possible.
- **Minimal Footprint:** Under 1KB gzipped.

## 🚀 Performance

| Method | Ops/sec | Comparison |
| :--- | :--- | :--- |
| **`ocyrus/EventEmitter`** | **23.0M** | **Parity** |
| `node:events` | 23.2M | Parity |

*Note: While raw ops/sec matches Node's optimized native emitter, Ocyrus ensures zero garbage collection overhead in non-Node environments (like Browsers or Edge).*

## 📦 Installation

```bash
npm install @ocyrusjs/event-emitter
```

## 🛠️ Usage

```typescript
import { EventEmitter } from '@ocyrusjs/event-emitter';

const ee = new EventEmitter();

ee.on('data', (payload) => {
  console.log('Received:', payload);
});

ee.emit('data', { hello: 'world' });
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/fast-clone
Description: High-performance, zero-allocation deep clone utility for JavaScript objects.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/fast-clone 🌑

> **High-performance, zero-allocation deep clone utility for JavaScript.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Blazing Fast:** Up to 8.5x faster than native `structuredClone`.
- **Lightweight:** Tiny bundle size (under 1KB).
- **Zero-Allocation Path:** Optimized for speed and minimal GC pressure.
- **Support:** Handles primitives, nested objects, and arrays.

## 🚀 Performance

| Method | Ops/sec | Comparison |
| :--- | :--- | :--- |
| **`fastClone`** | **4.7M** | **Fastest** |
| `lodash/cloneDeep` | 1.0M | 4.4x slower |
| `structuredClone` | 0.5M | 8.5x slower |

## 📦 Installation

```bash
npm install @ocyrusjs/fast-clone
```

## 🛠️ Usage

```typescript
import { fastClone } from '@ocyrusjs/fast-clone';

const obj = { user: { id: 1, settings: { theme: 'dark' } } };
const copy = fastClone(obj);

console.log(copy !== obj); // true
console.log(copy.user.settings !== obj.user.settings); // true
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/is-plain-object
Description: High-performance check for plain objects.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/is-plain-object 🌑

> **High-performance check for plain objects.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Blazing Fast:** 4.5x faster than `lodash/isPlainObject`.
- **Accurate:** Correctly identifies objects created via `{}`, `new Object()`, or `Object.create(null)`.

## 🚀 Performance

- **`isPlainObject`**: ~24M ops/sec

## 📦 Installation

```bash
npm install @ocyrusjs/is-plain-object
```

## 🛠️ Usage

```typescript
import { isPlainObject } from '@ocyrusjs/is-plain-object';

isPlainObject({}); // true
isPlainObject(new Object()); // true
isPlainObject([]); // false
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/lru
Description: Blazing fast, zero-dependency LRU cache using Map insertion order.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/lru 🌑

> **Blazing fast, zero-dependency LRU cache using Map insertion order.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Map-Based:** Leverages the native `Map`'s insertion order for high-performance O(1) eviction.
- **Auto-Eviction:** Automatically removes the Least Recently Used item when the capacity is reached.
- **Refresh on Access:** Updates item priority on `get()` and `set()`.
- **Tiny:** Zero dependencies and minimal code size.

## 🚀 Performance

- **`get` (hit):** ~1.0M ops/sec
- **`set` (with eviction):** ~1.8M ops/sec

## 📦 Installation

```bash
npm install @ocyrusjs/lru
```

## 🛠️ Usage

```typescript
import { LRU } from '@ocyrusjs/lru';

const cache = new LRU<string, number>(100);

cache.set('key', 1);
cache.get('key'); // 1

// When 101st item is added, the oldest item is evicted.
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/memo
Description: Blazing fast memoization with multi-argument support and zero-allocation key paths.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/memo 🌑

> **High-performance memoization with multi-argument support and zero-allocation key paths.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Multi-Argument Support:** Automatically handles multiple arguments using a high-efficiency cache tree (nested Maps).
- **Fast Path:** Optimized for single-argument calls to match native function performance.
- **Max Size:** Configurable cache size to prevent memory leaks.
- **Zero-Allocation:** Uses existing argument references as keys, avoiding stringification or array creation.

## 🚀 Performance

| Method | Ops/sec | Comparison |
| :--- | :--- | :--- |
| **`ocyrus/memoize`** | **30.0M** | **Fastest** |
| `lodash/memoize` | 26.1M | 1.15x slower |

## 📦 Installation

```bash
npm install @ocyrusjs/memo
```

## 🛠️ Usage

### Basic Memoization
```typescript
import { memoize } from '@ocyrusjs/memo';

const expensive = memoize((a, b) => {
  console.log('Computing...');
  return a + b;
});

expensive(1, 2); // 'Computing...'
expensive(1, 2); // (Returns cached result)
```

### With Max Cache Size
```typescript
const memo = memoize(fn, { maxSize: 500 });
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/pool
Description: Simple, high-performance object pooling to prevent GC pressure.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/pool 🌑

> **Simple, high-performance object pooling to prevent Garbage Collection pressure.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **GC Prevention:** Recycles long-lived objects to prevent the JS engine from triggering frequent Garbage Collection.
- **Factory Based:** Define how objects are created and reset.
- **Fast Path:** $O(1)$ acquire and release.
- **High Volume:** Capable of handling millions of cycles per second.

## 🚀 Performance

| Operation | Ops/sec | Comparison |
| :--- | :--- | :--- |
| **`Pool.acquire + release`** | **31.4M** | **Zero GC** |
| `new Object()` | 33.6M | Generates Garbage |

## 📦 Installation

```bash
npm install @ocyrusjs/pool
```

## 🛠️ Usage

```typescript
import { Pool } from '@ocyrusjs/pool';

interface Vector { x: number; y: number; }

const vectorPool = new Pool<Vector>(
  () => ({ x: 0, y: 0 }), // Factory
  (obj) => { obj.x = 0; obj.y = 0; } // Optional Reset
);

// High frequency usage
for (let i = 0; i < 1000000; i++) {
  const v = vectorPool.acquire();
  v.x = i;
  vectorPool.release(v); // Ready for next iteration, no allocation!
}
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/retry
Description: Lightweight, zero-dependency retry logic with exponential backoff and jitter.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/retry 🌑

> **High-performance, zero-dependency retry logic with exponential backoff and jitter.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Fast Path Optimization:** Zero allocations on successful first attempts (11.2M ops/sec).
- **Flexible Backoff:** Exponential backoff with configurable factor and jitter.
- **Modern:** Supports `AbortSignal` for cancellation.
- **Lightweight:** Minimal bundle footprint.

## 🚀 Performance

- **Fast Path:** 11.2M operations per second when no retry is needed.

## 📦 Installation

```bash
npm install @ocyrusjs/retry
```

## 🛠️ Usage

```typescript
import { retry } from '@ocyrusjs/retry';

const data = await retry(async () => {
  const res = await fetch('https://api.example.com');
  if (!res.ok) throw new Error('API Error');
  return res.json();
}, {
  retries: 5,
  minTimeout: 1000,
  maxTimeout: 30000,
  jitter: true,
  onRetry: (error, attempt) => {
    console.warn(`Retry attempt ${attempt} due to: ${error.message}`);
  }
});
```

## License

MIT © Nishith Patel
npm package: @ocyrusjs/throttle
Description: High-performance, minimal throttle utility.
Author: Nishith Patel
Latest version: 1.0.0

# @ocyrusjs/throttle 🌑

> **High-performance, minimal throttle utility.**

Part of the [Ocyrus](https://github.com/pnishith/ocyrus) suite.

## ✨ Features

- **Fast:** 1.2x faster than `lodash/throttle`.
- **Minimal:** Lightweight implementation.

## 📦 Installation

```bash
npm install @ocyrusjs/throttle
```

## 🛠️ Usage

```typescript
import { throttle } from '@ocyrusjs/throttle';

const log = throttle(() => console.log('Throttled!'), 100);
log();
```

## License

MIT © Nishith Patel
npm package: @ocyss/swr-openapi
Description: Generate SWR hooks from OpenAPI schemas
Author: Hunter Tunnicliff
Latest version: 5.1.4

<p align="center">
  <h1 align="center">swr-openapi</h1>
</p>

<p align="center">Generate <a href="https://swr.vercel.app"><code>swr</code></a> hooks using <a href="https://swagger.io/specification/">OpenAPI</a> schemas</p>

<p align="center">
  <a aria-label="npm" href="https://www.npmjs.com/package/swr-openapi">
    <img alt="npm" src="https://img.shields.io/npm/v/swr-openapi.svg?style=for-the-badge&labelColor=000000">
  </a>
  <a aria-label="license" href="https://github.com/openapi-ts/openapi-typescript/blob/main/packages/swr-openapi/LICENSE">
    <img alt="license" src="https://img.shields.io/github/license/openapi-ts/openapi-typescript.svg?style=for-the-badge&labelColor=000000">
  </a>
</p>

## Setup

```sh
npm install swr-openapi swr openapi-fetch
```

Follow [openapi-typescript](https://openapi-ts.dev/) directions to generate TypeScript definitions for each service being used.

Here is an example of types being generated for a service via the command line:

```sh
npx openapi-typescript "https://sandwiches.example/openapi/json" --output ./types/sandwich-schema.ts
```

## Basic Usage

Initialize an [openapi-fetch](https://openapi-ts.dev/openapi-fetch/) client and create any desired hooks.

```ts
// sandwich-api.ts
import createClient from "openapi-fetch";
import { createQueryHook } from "swr-openapi";
import type { paths as SandwichPaths } from "./types/sandwich-schema";

const client = createClient<SandwichPaths>(/* ... */);

const useSandwiches = createQueryHook(client, "sandwich-api");

const { data, error, isLoading, isValidating, mutate } = useSandwiches(
  "/sandwich/{id}", // <- Fully typed paths!
  {
    params: {
      path: {
        id: "123", // <- Fully typed params!
      },
    },
  },
);
```

## 📓 Docs

[View Docs](https://openapi-ts.dev/swr-openapi)