open-index/open-npm huggingface dataset:
npm package: @j2blasco/ts-crud
Description: CRUD abstraction library for TypeScript
Author: j2blasco
Latest version: 0.1.9

# @j2blasco/ts-crud

CRUD abstraction library for TypeScript. Provides a generic interface for NoSQL-like document databases, with a fake in-memory implementation for testing and development.

## Installation

```bash
npm install @j2blasco/ts-crud
```

## Features

- TypeScript-first CRUD abstraction for NoSQL document databases
- Generic interfaces for collections and documents
- Query constraints (where, array-contains, limit)
- Observable events for write and delete operations
- Fake in-memory database for testing
- **Full Result-based error handling** - All operations return `Result<T, ErrorType>` for robust error handling

## Usage

### Basic Example

```ts
import { createNoSqlDatabaseTesting } from '@j2blasco/ts-crud';

// Create a fake in-memory database instance
const db = createNoSqlDatabaseTesting();

// Write a document
const writeResult = await db.writeDocument(['users', 'user1'], { name: 'Alice', age: 30 });
writeResult.unwrapOrThrow(); // Throws if write failed

// Read a document
const result = await db.readDocument(['users', 'user1']);
if (result.success) {
  console.log(result.value); // { name: 'Alice', age: 30 }
}

// Add to a collection
const addResult = await db.addToCollection(['users'], { name: 'Bob', age: 25 });
const newDocId = addResult.unwrapOrThrow().id; // Get the new document ID or throw if failed

// Query a collection with constraints
const usersResult = await db.readCollection({
  path: ['users'],
  constraints: [
    { type: 'where', field: 'age', operator: '>=', value: 18 },
    { type: 'limit', value: 10 },
  ],
});
const users = usersResult.unwrapOrThrow(); // Get the users array or throw if failed
console.log(users);
```

### Observable Events

```ts
// Listen for write events
const sub = db.onWrite$.subscribe(({ path, before, after }) => {
  console.log('Document written:', path, before, after);
});

// Listen for delete events
const sub2 = db.onDelete$.subscribe(({ path, before }) => {
  console.log('Document deleted:', path, before);
});
```
npm package: @j2blasco/ts-result
Description: Result Monad for TypeScript
Author: j2blasco
Latest version: 0.1.12

# ts-result
A simple typescript result monad implementation for the following abstraction

```ts
export interface Result<TSuccess1, TError1> {
  andThen<TResult extends Result<any, any>>(
    f: (value: TSuccess1) => TResult,
  ): Result<SuccessType<TResult>, TError1 | ErrorType<TResult>>;
  andThenAsync<TResult extends Result<any, any>>(
    f: (value: TSuccess1) => Promise<TResult>,
  ): Promise<Result<SuccessType<TResult>, TError1 | ErrorType<TResult>>>;
  catchError<TResult extends Result<any, any>>(
    f: (error: TError1) => TResult,
  ): Result<TSuccess1 | SuccessType<TResult>, ErrorType<TResult>>;
  catchErrorAsync<TResult extends Result<any, any>>(
    f: (error: TError1) => Promise<TResult>,
  ): Promise<Result<TSuccess1 | SuccessType<TResult>, ErrorType<TResult>>>;
  unwrapOrThrow(errorCallback?: (e: TError1) => void): TSuccess1;
}
```

Fur further details, check [this article](https://medium.com/@j2blasco).
npm package: @j2dotdev/snoots
Description: A modern, fully-featured, strongly-typed reddit api.
Author: thislooksfun
Latest version: 1.0.0-dev.29

# snoots [![Verified on Openbase](https://badges.openbase.com/js/verified/snoots.svg?token=zh8jCN102bomfKH61A6jP1lPivsLI8K7SnqxRbLNChI=)](https://openbase.com/js/snoots?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)

<p align="center">
  <a href="https://github.com/semantic-release/semantic-release"
    ><img
      alt="semantic release"
      src="https://flat.badgen.net/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80/semantic%20release/e10079"
    /></a
  >
  <a href="https://github.com/thislooksfun/snoots/releases/latest"
    ><img
      alt="latest release"
      src="https://flat.badgen.net/github/release/thislooksfun/snoots"
    /></a
  >
  <a href="https://github.com/thislooksfun/snoots/releases"
    ><img
      alt="latest stable release"
      src="https://flat.badgen.net/github/release/thislooksfun/snoots/stable"
    /></a
  >
  <a href="#"
    ><img
      alt="checks status"
      src="https://flat.badgen.net/github/checks/thislooksfun/snoots"
    /></a
  >
  <a href="https://app.codecov.io/gh/thislooksfun/snoots"
    ><img
      alt="coverage"
      src="https://flat.badgen.net/codecov/c/github/thislooksfun/snoots"
    /></a
  >
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/snoots?activeTab=versions"
    ><img
      alt="npm version"
      src="https://flat.badgen.net/npm/v/snoots"
    /></a
  >
  <a href="https://github.com/thislooksfun/snoots/tree/master/types"
    ><img
      alt="npm types"
      src="https://flat.badgen.net/npm/types/snoots"
    /></a
  >
  <a href="https://www.npmjs.com/package/snoots"
    ><img
      alt="weekly npm downloads"
      src="https://flat.badgen.net/npm/dw/snoots"
    /></a
  >
  <a href="https://www.npmjs.com/package/snoots?activeTab=dependents"
    ><img
      alt="npm dependents"
      src="https://flat.badgen.net/npm/dependents/snoots"
    /></a
  >
  <a href="https://github.com/thislooksfun/snoots/blob/master/LICENSE"
    ><img
      alt="license"
      src="https://flat.badgen.net/github/license/thislooksfun/snoots"
    /></a
  >
</p>

A modern, fully-featured, strongly-typed reddit api wrapper.

# :warning: WARNING :warning:

This project is in early alpha. Things can (and likely will) change at any time
for any reason without warning, and large parts of the api are not yet
supported. If you need a stable reddit api today, use [snoowrap][sw].

If you want to help guide the future of the project towards v1.0.0, please check
out [this discussion](https://github.com/thislooksfun/snoots/discussions/4)!

## Installation

```sh
npm i snoots@dev
```

Note: Node 14+ is required.

## Documentation

For detailed instructions on how to use snoots, check out the
[latest documentation][ld].

## Contributing

If you want to help out, please read the [CONTRIBUTING.md][c.md].

<!-- Links -->

[sw]: https://github.com/not-an-aardvark/snoowrap
[ld]: https://thislooks.fun/snoots/docs/latest
[c.md]: https://github.com/thislooksfun/snoots/blob/master/CONTRIBUTING.md