open-index/open-npm huggingface dataset:
npm package: @nazaire/account-cache
Description: Solana Account batch loader & cache leveraging the browser's indexedDB.
Author: Nazaire
Latest version: 1.0.1

# @nazaire/account-cache

Solana Account batch loader & cache leveraging the browser's indexedDB.

`AccountCache` will store all account data in an indexedDB database so raw account data can persist across multiple sessions.

Load strategy:

1. Get from in-memory DataLoader cache
2. Load from the browser's indexedDB storage
3. (Batch) fetch the account from an RPC using the provided `Connection`

## Usage

```
const accounts = new AccountCache(cluster, connection, {
  // from @solana/spl-token
  token: (account, pubkey) => unpackAccount(pubkey, account),

  // from @solana/spl-token
  mint: (account, pubkey) => unpackMint(pubkey, account),

   // from @metaplex-foundation/js
  metadata: (account, pubkey) =>
    parseMetadataAccount(Object.assign({ publicKey: pubkey }, account)),
});

const mint = await accounts.load(mintPk, "mint")
const token = await accounts.load(tokenPk, "token")

// utilise batching with concurrent promises

const [mint, token] = await Promise.all([
  accounts.load(mintPk, "mint"),
  accounts.load(tokenPk, "token")
])
```
npm package: @nazaire/account-loader
Description: Solana Account [DataLoader](https://github.com/graphql/dataloader) for batching getAccountInfo requests
Author: Nazaire
Latest version: 1.0.1

# @nazaire/account-loader

Solana Account [DataLoader](https://github.com/graphql/dataloader) for batching getAccountInfo requests

## Usage

### AccountLoader

Uses [DataLoader](https://github.com/graphql/dataloader) to batch getAccountInfo requests into one get getMultipleAccountsInfo request. Out of the box in-memory cache to re-use results from previous requests.
Returns raw account data.

```
const loader = new AccountLoader(connection, {
  // optional DataLoader options

  // for example, disable the in-memory cache with:
  // cache: false

  // see DataLoader for more options
});

const account = await loader.load(publicKey);

const accounts = await loader.loadMany([publicKey1, publicKey2])
```

### ParsedAccountLoader

Extends `AccountLoader` with account parsing functions to simplify reading & parsing raw account data.

```
const loader = new ParsedAccountLoader(connection, {
  // from @solana/spl-token
  token: (account, pubkey) => unpackAccount(pubkey, account),

  // from @solana/spl-token
  mint: (account, pubkey) => unpackMint(pubkey, account),

  // from @metaplex-foundation/js
  metadata: (account, publicKey) =>
    parseMetadataAccount(Object.assign({ publicKey }, account)),
})

const mint = await loader.load(mintPk, "mint")
const token = await loader.load(tokenPk, "token")
```
npm package: @nazaire/resolve-with
Description: Chain related promises together in a **fully typed** graph-like structure. Works quite nicely with [DataLoader](https://www.npmjs.com/package/dataloader)
Author: Nazaire
Latest version: 1.0.2

# @nazaire/resolve-with

Chain related promises together in a **fully typed** graph-like structure. Works quite nicely with [DataLoader](https://www.npmjs.com/package/dataloader)

```sh
npm install --save @nazaire/resolve-with
```


## Example Usage

```
import { resolveWith, resolveManyWith } from "@nazaire/resolve-with";

 let getBookById: (
  id: string
) => Promise<{ id: string; title: string; authorId: string }>;
let getTagsForBook: (
  bookId: string
) => Promise<{ bookId: string; name: string }[]>;
let getAuthorById: (
  id: string
) => Promise<{ id: string; name: string; favouriteBookId: string }>;
let getRelatedBooks: (
  id: string
) => Promise<{ id: string; title: string; authorId: string }[]>;

const bookQuery = (bookId: string) => {
  return resolveWith(getBookById(bookId), {
  
    // 1. new promise using result
    author: (book) => getAuthorById(book.authorId),
    
    // 2. parallel promises just for convenience
    tags: getTagsForBook(bookId),
    
    // 3. complex nested relations
    relatedBooks: resolveManyWith(
      getRelatedBooks(bookId),
      (relatedBook) => ({
        author: resolveWith(getAuthorById(relatedBook.authorId), {
          favouriteBook: (author) => getBookById(author.favouriteBookId),
        }),
      })
    ),
  });
};

const book = await bookQuery("123");

book.value.title; // string
book.author.name; // string
book.tags[0].name; // string
book.relatedBooks[0].value.title; // string
book.relatedBooks[0].author.value.name; // string
book.relatedBooks[0].author.favouriteBook.title; // string
```
npm package: @nazaire/solana-utils
Description: A collection of helpers for working with Solana
Author: Nazaire
Latest version: 1.0.1

# @nazaire/solana-utils

A collection of helpers for working with Solana

## Usage

### createGetConnection

Create a `getConnection` function that resolves the rpc endpoint from default cluster url mappings.

`getConnection` can take a `rateLimitOpts` parameter that implements a [TokenBucket](https://github.com/jhurliman/node-rate-limiter) that will rate limit all outgoing connections. See `limiter` for more options.
```
const { getConnection } = createGetConnection({
  defaultCluster: "devnet",
  clusterUrlDefaults: {
    // localnet: string,
    // testnet: string,

    // (commonly used) set default to env variable
    devnet: process.env.DEVNET_URL,

    "mainnet-beta": "https://ssc-dao.genesysgo.net",
  },
});


// The default connection to use throughout the application
// rate limited to 1 request per second
const connection = getConnection({
  cluster: "devnet",
  commitment: "confirmed",
  rateLimitOpts: {
    bucketSize: 1,
    tokensPerInterval: 1,
    interval: "second",
  },
})
```
npm package: @nazannaurel/showgallery
Description: JavaScript gallery
Author: Dmytro Semenov
Latest version: 5.4.4

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://savelife.in.ua/en/)


PhotoSwipe v5 — JavaScript image gallery and lightbox

**[Demo](https://photoswipe.com)** | **[Documentation](https://photoswipe.com/getting-started/)**

[![Sponsor via OpenCollective](https://img.shields.io/opencollective/all/photoswipe?label=Sponsor%20via%20OpenCollective)](https://opencollective.com/photoswipe)
[![Follow on Twitter](https://img.shields.io/twitter/follow/photoswipe?style=social)](https://twitter.com/intent/user?screen_name=photoswipe)


### Repo structure

- `dist/` - main JS and CSS
- `src/` - source JS and CSS.
  - `src/js/photoswipe.js` - entry for PhotoSwipe Core.
  - `src/js/lightbox/lightbox.js` - entry for PhotoSwipe Lightbox.
- `docs/` - documentation markdown files.
- `demo-docs-website/` - website with documentation, demos and manual tests.
- `build/` - rollup build config.

To build JS and CSS in `dist/` directory, run `npm run build`.

To run the demo website and automatically rebuild files during development, run `npm install` in `demo-docs-website/` and `npm run watch` in the root directory.

### Older versions

Documentation for the old version (v4) can be found [here](https://photoswipe.com/v4-docs/getting-started.html) and [the code for 4.1.3 is here](https://github.com/dimsemenov/PhotoSwipe/tree/v4.1.3).

---

This project is tested with [BrowserStack](https://www.browserstack.com/).