open-index/open-npm huggingface dataset:
npm package: @originprotocol/origin
Description: ## Introduction
Author: Stan James
Latest version: 0.2.60
Deprecated: WARNING: This project has been renamed to `origin`. Please install with `npm i origin`

# Origin JS Documentation

## Introduction

Welcome to the origin.js documentation! origin.js is a Javascript library for interacting with the Origin protocol.
Using the library you can create new listings from your applications, purchase them, or update them from your own off-chain applications. 

More information can be found at [Origin Platform Readme](/README.md) 

### Warning
This is still an alpha version which will evolve significantly before the main net release. 


## Install 

### NPM
```
npm install @originprotocol/origin --save
```

### Yarn
```
yarn add @originprotocol/origin
```

### Local
For developing on `origin.js`, it is better to link the package rather than installing it. (Otherwise you would need to run `npm build` everytime you made a change to the package.)

In the directory `./packages/contracts/` run:
```
truffle compile
```
This will create the `.json` files for our solidity contracts. 

In the directory `./packages/origin.js` run:
```
npm link
```

Now change tabs (or diectories) to the repo for your DApp (for example, the [Origin demo-dapp](https://github.com/OriginProtocol/demo-dapp)) run:
```
npm link @originprotocol/origin
```
This will create a symlink, direcly linking the dapp to your local `origin.js` package.

Next, you will need to start your local development blockchain. 

In the directory `./packages/contracts/` run:
```
truffle develop
```

Then in the console run:
```
migrate --reset
```



## Import 
```
import { contractService, ipfsService, originService } from '@originprotocol/origin'
```

## IPFS

If you are running a local IPFS daemon then set the following environment variables:

```
export IPFS_DOMAIN=127.0.0.1
export IPFS_API_PORT=5001
export IPFS_GATEWAY_PORT=8080
export IPFS_GATEWAY_PROTOCOL=http
```

Configure your local IPFS daemon with the following settings to avoid CORS errors:

```
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["localhost:*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["GET", "POST", "PUT"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
```

## Troubleshooting

### Python 3

If you have Python 3 installed, you may see this error when installing dependencies:

```
gyp ERR! stack Error: Python executable "/Users/aiham/.pyenv/shims/python" is v3.6.4, which is not supported by gyp.
```

Resolve this by configuring npm to use Python 2 (where python2.7 is a binary accessible from your $PATH):

```
npm config set python python2.7
```

## Tests

When you begin developing, run `npm test` and keep it running while you develop.

View test results in your browser (with MetaMask installed and setup) at http://localhost:8081

Tests are automatically rerun when source or test code is changed.

Run a subset of tests using the `grep` query string parameter, for example: http://localhost:8081/?grep=IpfsService

## Documentation
Needed
npm package: @origins-digital/concurrency-handler
Description: Concurrency package
Author: Origins Digital
Latest version: 1.1.4

# @origins-digital/concurrency-handler

A simple and lightweight concurrency control package for Node.js applications that provides a function for managing concurrent operations.

## Installation

```bash
npm install @origins-digital/concurrency-handler
```

## Features

- Simple concurrency control function
- Automatic lock management
- TTL (Time To Live) configuration for locks
- Context-aware locking

## Usage

### Basic Usage

The `concurrentRequestsHandler` function ensures that only one instance of an operation runs at a time:

```typescript
import { concurrentRequestsHandler } from '@origins-digital/concurrency-handler';

async function updateUser(id: string, data: any) {
  return concurrentRequestsHandler(
    `user:${id}`,
    async () => {
      // This will only execute if no other instance is running
      return userRepository.update(id, data);
    },
    30000, // Lock for 30 seconds (optional)
  );
}
```

### Handler Parameters

The function accepts the following parameters:

```typescript
concurrentRequestsHandler<T>(
  keyOpts: string | Context | (() => string), // Lock key or function that generates the key
  resolver: () => Promise<T>, // The operation to execute
  timeoutMs?: number // Time to live in milliseconds for locks (defaults to 30 seconds)
): Promise<T>
```

### Response Format

The handler returns a promise that resolves to the original operation's result.

## Error Handling

The package uses standard JavaScript Error for error handling in the following scenarios:

- When a lock cannot be acquired
- When the timeout is reached
- When invalid options are provided

## Best Practices

1. Always set appropriate timeout values for locks to prevent deadlocks
2. Use meaningful key patterns that include unique identifiers
3. Monitor lock statistics for performance optimization

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the LICENSE file for details.
npm package: @origins-digital/config
Description: Origins Digital NestJS Config
Author: Origins Digital
Latest version: 2.1.4

# @origins-digital/config

A configuration validation package for NestJS applications that uses Zod for environment variable validation.

> **Zod compatibility**: Compatible with **Zod v4.x**.

## Installation

```bash
npm install @origins-digital/config
```

## Features

- Environment variable validation using Zod schemas
- Type-safe configuration
- Clear error messages for invalid configurations

## Usage

### Basic Usage

```typescript
import { ConfigModule } from '@nestjs/config';
import { validate } from '@origins-digital/config';
import { z } from 'zod';

const envSchema = z.object({
  DATABASE_URL: z.string().url(),
  PORT: z.number().default(3000),
  NODE_ENV: z
    .enum(['development', 'production', 'test'])
    .default('development'),
});

@Module({
  imports: [
    ConfigModule.forRoot({
      validate: validate(envSchema),
    }),
  ],
})
export class AppModule {}
```

### Advanced Usage

You can create complex validation schemas using Zod:

```typescript
import { z } from 'zod';

const envSchema = z.object({
  DATABASE: z.object({
    URL: z.string().url(),
    POOL_SIZE: z.number().default(10),
  }),
  REDIS: z.object({
    HOST: z.string(),
    PORT: z.number(),
    PASSWORD: z.string().optional(),
  }),
  JWT: z.object({
    SECRET: z.string(),
    EXPIRES_IN: z.string().default('1d'),
  }),
});

@Module({
  imports: [
    ConfigModule.forRoot({
      validate: validate(envSchema),
    }),
  ],
})
export class AppModule {}
```

## Error Handling

When validation fails, the package will throw an error with detailed information about which environment variables are invalid:

```
❌ Invalid environment variables: {
  "DATABASE_URL": ["Invalid url"],
  "PORT": ["Expected number, received string"]
}
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.