open-index/open-npm huggingface dataset:
npm package: @getalby/pkgzap
Description: View funding information of your dependencies and tip them via lightning
Author: Alby Contributors
Latest version: 1.2.1

<p align="center">
  <img width="100%" src="docs/pkgzap-banner.png">
</p>

# ⚡️ PkgZap

Fetch funding details of all the dependencies used in your project and send satoshis. Uses the metadata provided by package registries to fetch information about each dependency's funding sources.

## 🤙 Usage

```bash
npm install @getalby/pkgzap
```

### `getFundingDetails`

```js
import { getFundingDetails } from "@getalby/pkgzap";

const fundingInfo = getFundingDetails();

console.log(JSON.stringify(fundingInfo, null, 2))
```

This defaults to fetching details in `package.json` of your current directory with a depth of 1. However you can customize this as follows:

```js
const path = "path-to-your/package.json"
const levels = 2 // depth i.e. dependencies of dependencies
const fundingInfo = getFundingDetails(path, levels);

console.log(JSON.stringify(fundingInfo, null, 2))
```

### `fetchFundingInfo`

If you want to fetch the funding data from some arbitrary JSON retrieved from an API or some other source instead of a file, you can use this function

```js
import { fetchFundingInfo } from "@getalby/pkgzap";

const fundingInfo = fetchFundingInfo(packageJsonData); // depth is defaulted to 1

console.log(JSON.stringify(fundingInfo, null, 2))
```

You can also use this method to fetch the funding info from a file:

```js
import { fetchFundingInfo } from "@getalby/pkgzap";

const packageJsonData = await fs.promises.readFile('package.json', 'utf8');
const fundingInfo = fetchFundingInfo(JSON.parse(packageJsonData), 2);

console.log(JSON.stringify(fundingInfo, null, 2))
```

## How to add funding info to your dependencies?

In your `package.json` file, add the following:
```
"funding": {
  "type": "lightning",
  "url": "lightning:satoshi@getalby.com"
}
```
This would help `pkgzap` methods to pick your lightning address when your dependency users boost you!
npm package: @getalby/pkgzap-cli
Description: Boost your project dependencies via lightning ⚡️
Author: Alby Contributors
Latest version: 1.2.2

<p align="center">
  <img width="100%" src="docs/pkgzap-banner.png">
</p>

# ⚡️ PkgZap

Get bitcoin tips from projects using your packages and support devs of your project's dependencies.

## 🫰 How It Works? (For Supporters)

### 1) Run this command in your project's root folder:

```bash
npx @getalby/pkgzap-cli
```

### 2) Connect a Wallet

Securely connect any [NWC wallet](https://nwc.dev/) from the options.

### 3) Choose Amount and Pay

Enter desired total amount you want to split among all supported dependencies and enjoy the sats flowing!

## 🧑‍💻 How It Works? (For Developers)

### 1) Add wallet info to `package.json`

As a package developer you only have to add your lightning address to your `package.json` file:

```json
"funding": {
  "type": "lightning",
  "url": "lightning:yourname@getalby.com"
}
```

### 2) Publish Package

Push your latest version to npm like you always do using `npm publish`.

### 3) That’s it! You’re fundable.

People can now tip your package!

# 🧐 Troubleshooting

If you run into the following error:
```
file:///Users/satoshi/your-project/node_modules/pkgzap-cli/bin/index.js:12
global.crypto = crypto;
              ^

TypeError: Cannot set property crypto of #<Object> which has only a getter
    at file:///Users/satoshi/Coding/your-project/node_modules/pkgzap-cli/bin/index.js:12:15
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:518:24)
    at async loadESM (node:internal/process/esm_loader:102:5)
    at async handleMainPromise (node:internal/modules/run_main:66:12)
```

Make sure you're NOT using Node.js v19 as `pkgzap-cli` is not supported in node versions >19.
npm package: @getanthill/datastore-admin
Description: Datastore Admin UI
Author: Gilles Rasigade
Latest version: 0.0.23

# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm init svelte@next

# create a new project in my-app
npm init svelte@next my-app
```

> Note: the `@next` is temporary

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:

```bash
npm run build
```

> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
npm package: @getanthill/event-source
Description: Event-sourced data store handling library
Author: Gilles Rasigade
Latest version: 0.16.0

# `getanthill` Event-Source

[![pipeline](https://gitlab.com/getanthill/event-source/badges/master/pipeline.svg?ignore_skipped=true)](https://gitlab.com/getanthill/event-source/-/commits/master) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fevent-source&metric=alert_status)](https://sonarcloud.io/dashboard?id=getanthill%2Fevent-source)

[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fevent-source&metric=coverage)](https://sonarcloud.io/dashboard?id=getanthill%2Fevent-source) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fevent-source&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=getanthill%2Fevent-source)

## Getting Started

### Install the package

```shell
npm install -S @getanthill/event-source
```

### Define your class

The following will be extended with the [Event-Source](https://martinfowler.com/eaaDev/EventSourcing.html)
functionalities.

```ts
// src/models/Users.ts
import { EventSourcedFactory } from '@getanthill/event-source';

/**
 * This is the main reducer for your events.
 * > f(state_{i}, event) = state_{i+1}
 */
const reducer = (state, event) => {
  if (event.type === 'CREATED') {
    return {
      firstname: event.firstname,
    };
  }

  return state;
};

export default class Users extends EventSourced('users', reducer) {
  /**
   * Create a new user
   * @param {string} firstname The user firstname
   * @return {Promise<object>} Updated state
   */
  create(firstname) {
    return this.handle(() => [
      {
        type: 'CREATED',
        firstname,
      },
    ]);
  }
}
```

### Use your Event-Sourced class

```ts
// src/business/users.ts
import Users from '../models/Users';

/**
 * Create a user
 *
 * @param {object} db MongoDb connection
 * @param {string} firstname User firstname
 * @return {Promise<object>} State after success
 */
function createUser(db, firstname) {
  const user = new Users(db, 1); // 1 = correlation_id

  return user.create('John');
}
```

In your database, we will now have access to the events in the collection
`users_events`:

```mongo
db.users_events.find().pretty();
```

```json
{
  "type": "CREATED",
  "correlation_id": 1,
  "version": 0,
  "firstname": "John",
  "created_at": "2020-11-01T06:05:43.210Z"
}
```

and also the final resulting state of your object:

```mongo
db.users.find().pretty();
```

```json
{
  "correlation_id": 1,
  "version": 0,
  "firstname": "John"
}
```

## Conclusion

Now that you are able to have a fully Event-Source featured class, you can
read further on what is possible to create with this library and how to custom
a bit some features such as the `correlation_id` naming.
npm package: @getanthill/mongodb-connector
Description: MongoDB connector
Author: Gilles Rasigade
Latest version: 1.6.1

# `@getanthill/mongodb-connector`

> forked from `chpr-mongodb`

## Installation

```bash
npm install @getanthill/mongodb-connector
```

## Usage

This library supports both CommonJS and ESM (ES Modules) imports:

### ESM (ES Modules)
```javascript
import { MongoDbConnector, mongodb, ObjectId } from '@getanthill/mongodb-connector';
// or
import MongoDbConnector from '@getanthill/mongodb-connector';
```

### CommonJS
```javascript
const { MongoDbConnector, mongodb, ObjectId } = require('@getanthill/mongodb-connector');
// or
const MongoDbConnector = require('@getanthill/mongodb-connector').default;
```

## Compatibility

- ✅ **ESM Projects** - Full support for ES Module imports
- ✅ **CommonJS Projects** - Full support for require() statements
- ✅ **TypeScript** - Includes TypeScript definitions
- ✅ **Node.js 16+** - Compatible with modern Node.js versions

The library automatically provides the correct module format based on how it's imported.
npm package: @getanthill/sec
Description: Anthill project security package
Author: Gilles Rasigade
Latest version: 0.7.0

# `getanthill` Security Layer

[![pipeline](https://gitlab.com/getanthill/sec/badges/master/pipeline.svg)](https://gitlab.com/getanthill/sec/-/commits/master) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fsec&metric=alert_status)](https://sonarcloud.io/dashboard?id=getanthill%2Fsec)

[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fsec&metric=coverage)](https://sonarcloud.io/dashboard?id=getanthill%2Fsec) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fsec&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=getanthill%2Fsec) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=getanthill%2Fsec&metric=security_rating)](https://sonarcloud.io/dashboard?id=getanthill%2Fsec)

## Getting Started

First, you need install the package:

```shell
npm install -S @getanthill/sec
```

Then, your client can follow the steps to register or signin a
user to your app, then activate MFA validation.

```typescript
// 1. Signin part:
const tokens = auth.getTokens(email, password);

// 2. MFA Setup part: (only on registration)
// Master key generation #keep-it-secret-keep-it-safe
const masterKey = otp.generateMasterKey();
// Secret key generation from Master key
const secretKey = otp.generateSecretFromMaster(masterKey);

// Validate MFA:
const isValid = otp.verify('123456', secretKey);

// Create the store:
const store = new Store(tokens.encryption, secretKey);

// Manage your data as always:
store.data = { hello: 'world' }; // Always encrypted data
```

## Roadmap

- [x] Implements the Data Privacy Security Layer by default described here:
      https://hacks.mozilla.org/2018/11/firefox-sync-privacy/
- [x] Implements TOTP
- [ ] Implements the QRCode generation part