open-index/open-npm huggingface dataset:
npm package: @rocketc/ioc
Description: DI implement of IOC
Author: chenfq95
Latest version: 0.0.1

# RocketC IOC Container

A lightweight dependency injection container based on TypeScript 5.0+ **Stage 3 Decorators**.

## Features

- 🚀 **Native Support**: Built on the latest `accessor` decorator proposal, no `reflect-metadata` required.
- 💎 **Type Safe**: Perfect TypeScript generic support.
- 🔄 **Cycle Detection**: Automatically detects synchronous circular references and throws friendly errors.
- 🛠️ **Lifecycle Management**: Supports both Lazy-loading (default) and Eager-loading.
- 📦 **Container Isolation**: Supports creating multiple independent container instances for better testing and modularity.

## Quick Start

### 1. Define and Register Services

Use the `@register(id)` decorator to register a class to the container.

```typescript
import { register } from '@rocketc/ioc';

export const USER_SERVICE = Symbol('USER_SERVICE');

@register(USER_SERVICE)
export class UserService {
  getUser(id: string) {
    return { id, name: 'Alice' };
  }
}
```

### 2. Inject Dependencies

Use the `@inject(id)` decorator on **`accessor`** properties.

```typescript
import { register, inject } from '@rocketc/ioc';
import { USER_SERVICE, type UserService } from './services';

@register('CONTROLLER')
class UserController {
  // Must use the 'accessor' keyword
  @inject<UserService>(USER_SERVICE)
  accessor userService!: UserService;

  showUser(id: string) {
    console.log(this.userService.getUser(id));
  }
}
```

### 3. Retrieve Instances

```typescript
import { getObject } from '@rocketc/ioc';

const controller = getObject<UserController>('CONTROLLER');
controller.showUser('123');
```

## Advanced Usage

### Eager Loading

By default, objects are initialized lazily. If you need to execute the constructor immediately upon registration:

```typescript
@register('APP_INIT', { eager: true })
class AppInit {
  constructor() {
    console.log('System initializing...');
  }
}
```

### Manual Object Registration

For configuration data or third-party instances, use `registerObject`:

```typescript
import { registerObject } from '@rocketc/ioc';

registerObject('API_CONFIG', {
  baseUrl: 'https://api.example.com',
  timeout: 5000,
});
```

### Create Isolated Containers

In unit tests, you might need a clean container environment:

```typescript
import { createContainer } from '@rocketc/ioc';

const testContainer = createContainer();
testContainer.registerObject('MOCK_SERVICE', mockInstance);
const obj = testContainer.getObject('MOCK_SERVICE');
```

## Precautions

1.  **Constructor Restriction**: Classes decorated with `@register` must have a **no-argument constructor**.
2.  **Property Restriction**: Injection properties must use the `accessor` keyword.
3.  **Circular Dependency**: If `A` and `B` inject each other, avoid accessing the injected property directly within the `constructor`, as it will trigger a circular dependency exception.
npm package: @rocketcamp/material-formbuilder
Description: A form builder component library for Material UI
Latest version: 0.0.10

# material-formbuilder

A form builder component library for Material UI

## Install

```bash
npm install --save @rocketcamp/material-formbuilder
```

## Usage

![alt text](https://brief.kz/usage.jpg)

```jsx
import React from "react";
import FormBuilder from "@rocketcamp/material-formbuilder";

function RegistrationPage() {
  const handleSubmit = (data) => {
    // data in FormData format
  };
  return (
    <FormBuilder
      disabled={isLoading}
      fields={[
        {
          name: "firstname",
          label: "First name",
          width: 1 / 2,
          required: true,
        },
        {
          name: "lastname",
          label: "Last name",
          width: 1 / 2,
          required: true,
        },
        {
          name: "email",
          label: "Email",
          type: "email",
          required: true,
          helper:
            "Ensure the registered email address matches that used to shop online",
          error: "Email is not valid",
        },
        {
          name: "password",
          label: "Password",
          type: "password",
          required: true,
          helper:
            "One alpabetic, one special character or number, length between 8-20 characters",
        },
        {
          name: "agree",
          type: "checkbox",
          required: true,
          label: "Checkbox label",
        },
      ]}
      handleSubmit={handleSubmit}
    />
  );
}
export default RegisterPage;
```

## API

The `FormBuilder` component accepts the following properties:

- `disabled` (boolean): Disables all form fields when set to `true`.
- `fields` (array): An array of field configurations. Each field configuration object should have the following properties:
  - `name` (string): The name of the field.
  - `label` (string): The label text for the field.
  - `width` (number): The width of the field as a fraction (e.g., `1/2` for 50% width).
  - `required` (boolean): Specifies whether the field is required or not.
  - `type` (string, default: "text"): The type of the field. Valid types include:
    - `"text"`: Text input field.
    - `"email"`: Email input field.
    - `"password"`: Password input field.
    - `"integer"`: Number input field.
    - `"checkbox"`: Checkbox field.
    - `"select"`: Select field.
    - Custom types: You can define custom types to extend the functionality of the library.
  - `helper` (string): Helper text to provide additional information or instructions for the field.
  - `error` (string): Error message to display for the field when validation fails.
- `handleSubmit` (function): A callback function that is called when the form is submitted. It receives the form data in FormData format as an argument.

Note: You can customize and extend the field types based on your requirements, add custom types, and enhance the functionality of the library as needed.
npm package: @rocketclimb/tw-utils
Description: Tailwind utils package for rocketclimb plugins
Author: rocketclimb
Latest version: 0.0.2

# tw-utils

![npm](https://img.shields.io/npm/v/tw-utils)
![License](https://img.shields.io/github/license/rocketclimb/tw-utils)
![Build](https://github.com/rocketclimb/tw-utils/actions/workflows/push.yml/badge.svg)

## Overview

`tw-utils` is a utility library designed to assist in parsing Tailwind CSS configurations on creating Tailwind plugins.

## Features

- Parse Tailwind CSS configuration files easily.
- Parse extend configuration merging with default or base configuration

## Installation

To install `tw-utils`, use npm or yarn:

```sh
npm install tw-utils

# or

yarn add tw-utils
```

## Usage

Parsing Tailwind Config
You can use tw-utils to parse your Tailwind CSS configuration file. Here’s an example:

```typescript
import { configResolver } from "./config-resolver";
// config is the Tailwind helper for looking up values in the user’s Tailwind configuration as documented at https://tailwindcss.com/docs/plugins
configResolver("path", config);
```

### Resolver options

```typescript
export type ResolverOptions<T> = {
  rootPath?: string; // change the intial path for the lookup
  defaultConfig?: T; // add default configuration
};
```

## License

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
npm package: @rocketflag/node-sdk
Description: The Node SDK for the RocketFlag service.
Author: RocketFlag Developers
Latest version: 1.1.1

# Rocketflag Node.js SDK

This is the official Node.js SDK for [Rocketflag](https://rocketflag.app), a feature flag and A/B testing platform. This SDK allows you to easily integrate Rocketflag
into your Javascript Web Apps or Node.js applications, enabling you to control feature rollouts, perform A/B tests, and manage your features
effectively.

## Installation

```bash
npm install @rocketflag/node-sdk
```

## Basic Usage

### Setup

```js
import createRocketflagClient from "@rocketflag/node-sdk";

const rocketflag = createRocketflagClient(); // Uses default API URL and version

// Optionally you can configure which version of the API you want to use
const rocketflag = createRocketflagClient("v2", "https://your-api-domain.com");
```

### Get a flag

```js
try {
  const flag = await rocketflag.getFlag("IFldMzqP5jtv9wAL");
  // Do something with the flag result. For example in React, you may want to set state.
  setSignUpsEnabled(flag.enabled);
} catch (error) {
  console.error("Something went wrong fetching the flag", error);
}
```

## Advanced Usage

### Getting a flag details with cohorts

```js
const flag = await rocketflag.getFlag("IFldMzqP5jtv9wAL", {
  cohort: "<cohort-identifier>",
});
```

## Error Handling

The SDK can throw the following errors:

- `APIError`: This error is thrown when the API returns a non-ok response. The error object contains the status code and status text of the response.
- `InvalidResponseError`: This error is thrown when the API returns an invalid response. This can happen if the response is not valid JSON or if it doesn't match the expected format.
- `NetworkError`: This error is thrown when there is a network error, such as a failed connection.

```js
import { APIError, InvalidResponseError, NetworkError } from "@rocketflag/node-sdk/errors";

try {
  const flag = await rocketflag.getFlag("IFldMzqP5jtv9wAL");
  // ...
} catch (error) {
  if (error instanceof APIError) {
    console.error(`API Error: ${error.status} ${error.statusText}`);
  } else if (error instanceof InvalidResponseError) {
    console.error(`Invalid Response Error: ${error.message}`);
  } else if (error instanceof NetworkError) {
    console.error(`Network Error: ${error.message}`);
  } else {
    console.error("An unknown error occurred", error);
  }
}
```

## Response

The response from the API on a flag will be one of three possibilities.

1. A `200` with the Flag object

   ```json
   {
     "name": "The user-created flag name",
     "enabled": true,
     "id": "asklWQQZdslhfsszZWkj"
   }
   ```

1. A `404` not found status code.
   > A 404 indicates that the flag ID you've provided in your request is not valid and cannot be found.
1. A `500` internal server error.
   > These should be extremely rare, but trying again may help. In short something has gone wrong retrieving flag data. 500's trigger internal alerts on Rocketflag, so it's likely it's already being looked into.