open-index/open-npm huggingface dataset:
npm package: @northprint/duckdb-wasm-adapter-react
Description: React hooks for DuckDB WASM adapter
Author: Northprint
Latest version: 0.3.5

# @northprint/duckdb-wasm-adapter-react

React adapter for DuckDB WASM with hooks and components for seamless integration.

## Installation

```bash
npm install @northprint/duckdb-wasm-adapter-react
# or
pnpm add @northprint/duckdb-wasm-adapter-react
# or
yarn add @northprint/duckdb-wasm-adapter-react
```

## Features

- 🪝 **React Hooks** - useQuery, useMutation, useConnection hooks
- 🔄 **Automatic re-rendering** - Reactive data updates
- 🎨 **Component library** - Pre-built data components
- 📊 **Data visualization** - Chart and table components
- ⚡ **Performance optimized** - Memoization and lazy loading
- 🔧 **TypeScript support** - Full type safety

## Quick Start

```tsx
import { DuckDBProvider, useQuery } from '@northprint/duckdb-wasm-adapter-react';

function App() {
  return (
    <DuckDBProvider autoConnect>
      <DataTable />
    </DuckDBProvider>
  );
}

function DataTable() {
  const { data, loading, error } = useQuery('SELECT * FROM users');

  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <table>
      {data?.map(row => (
        <tr key={row.id}>
          <td>{row.name}</td>
          <td>{row.email}</td>
        </tr>
      ))}
    </table>
  );
}
```

## Documentation

For full documentation, visit [https://northprint.github.io/duckdb-wasm-adapter-component/](https://northprint.github.io/duckdb-wasm-adapter-component/)

## License

MIT
npm package: @northprint/duckdb-wasm-adapter-vue
Description: Vue composables for DuckDB WASM adapter
Author: Northprint
Latest version: 0.3.5

# @northprint/duckdb-wasm-adapter-vue

Vue 3 adapter for DuckDB WASM with composables and plugin support.

## Installation

```bash
npm install @northprint/duckdb-wasm-adapter-vue
# or
pnpm add @northprint/duckdb-wasm-adapter-vue
# or
yarn add @northprint/duckdb-wasm-adapter-vue
```

## Features

- 🎯 **Vue 3 Composables** - useQuery, useMutation, useConnection
- 🔌 **Plugin system** - Easy global configuration
- 🔄 **Reactive data** - Automatic reactivity with Vue's system
- 📊 **Component library** - Pre-built Vue components
- ⚡ **Performance optimized** - Efficient reactivity
- 🔧 **TypeScript support** - Full type safety

## Quick Start

```vue
<template>
  <div>
    <div v-if="loading">Loading...</div>
    <div v-else-if="error">Error: {{ error.message }}</div>
    <table v-else>
      <tr v-for="row in data" :key="row.id">
        <td>{{ row.name }}</td>
        <td>{{ row.email }}</td>
      </tr>
    </table>
  </div>
</template>

<script setup>
import { useQuery } from '@northprint/duckdb-wasm-adapter-vue';

const { data, loading, error } = useQuery('SELECT * FROM users');
</script>
```

## Plugin Setup

```javascript
// main.js
import { createApp } from 'vue';
import { DuckDBPlugin } from '@northprint/duckdb-wasm-adapter-vue';
import App from './App.vue';

const app = createApp(App);

app.use(DuckDBPlugin, {
  autoConnect: true,
  config: {
    worker: true
  }
});

app.mount('#app');
```

## Documentation

For full documentation, visit [https://northprint.github.io/duckdb-wasm-adapter-component/](https://northprint.github.io/duckdb-wasm-adapter-component/)

## License

MIT
npm package: @northrelay/sdk
Description: Official TypeScript/JavaScript SDK for NorthRelay Platform API
Author: NorthRelay
Latest version: 1.5.1

# @northrelay/sdk

Official TypeScript/JavaScript SDK for the [NorthRelay](https://northrelay.ca) email infrastructure platform.

## Installation

```bash
npm install @northrelay/sdk
```

## Quick Start

```typescript
import { NorthRelayClient } from '@northrelay/sdk';

const client = new NorthRelayClient({
  apiKey: 'nr_live_your_api_key',
});

// Send an email
const result = await client.emails.send({
  from: { email: 'hello@yourdomain.com', name: 'Your App' },
  to: [{ email: 'user@example.com' }],
  content: {
    subject: 'Welcome!',
    html: '<h1>Hello {{name}}</h1>',
  },
  variables: { name: 'World' },
});

console.log(result.data.messageId);
```

## Resources

| Resource | Description |
|----------|-------------|
| `client.emails` | Send emails, track events, manage batches |
| `client.templates` | Create/update email templates with Handlebars |
| `client.campaigns` | Campaign lifecycle (draft, submit, send) |
| `client.contacts` | Contact management and lists |
| `client.domains` | Domain verification and DNS records |
| `client.webhooks` | Webhook endpoints, deliveries, failures, health |
| `client.apiKeys` | API key management |
| `client.analytics` | Query analytics, heatmaps, geographic data |
| `client.metrics` | Delivery metrics and summaries |
| `client.suppressions` | Global suppression list |
| `client.suppressionGroups` | Category-based suppression groups |
| `client.subusers` | Subuser management and permissions |
| `client.identity` | Sender identities, profile, subscription |
| `client.ipPools` | IP pool management |
| `client.ips` | Dedicated IP management and warmup |
| `client.brandTheme` | Brand theme customization |
| `client.inbox` | Inbox sender address management |
| `client.events` | Email event querying |

## Webhook Verification

Verify incoming webhook signatures using the standalone export:

```typescript
import { verifyWebhookSignature } from '@northrelay/sdk/webhooks';

const isValid = verifyWebhookSignature(
  rawBody,                                      // Request body as string
  request.headers['x-northrelay-signature'],     // Signature header
  'whsec_your_webhook_secret'                    // Your webhook secret
);
```

## Configuration

```typescript
const client = new NorthRelayClient({
  apiKey: 'nr_live_xxx',     // Required
  baseUrl: 'https://app.northrelay.ca',  // Optional (default)
  timeout: 30000,            // Request timeout in ms (default: 30000)
  maxRetries: 3,             // Retry count for failed requests (default: 3)
  retryDelay: 1000,          // Base delay between retries in ms (default: 1000)
});
```

## Error Handling

```typescript
import { NorthRelayClient, RateLimitError, ValidationError } from '@northrelay/sdk';

try {
  await client.emails.send(/* ... */);
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log('Rate limited, retry after:', error.retryAfter);
  } else if (error instanceof ValidationError) {
    console.log('Validation failed:', error.message);
  }
}
```

## License

MIT
npm package: @northscaler/cassandra-test-support
Description: Cassandra Node.js Development Test Support Library
Latest version: 0.2.0-rc.3

# `cassandra-test-support`

Handy-dandy Cassandra integration testing utility that starts a local Docker container running Cassandra if you're not running in a CI/CD pipeline.
This allows you to run integration tests locally in a manner similar to how they'd be run in the CI/CD pipeline. 
This module does nothing when running in a CI build pipeline, because Cassandra should be configured as part of the build via something like [`.gitlab-ci.yml`'s `services`](https://docs.gitlab.com/ee/ci/yaml/#services) element.

This package is intended to be installed in your project in `devDependencies`.

Your application must install its desired version of [`cassandra-driver`](https://www.npmjs.com/package/cassandra-driver).

> NOTE: requires a Unix-y shell (`/usr/bin/env sh`) to be available.
>This is not designed to run on Windows; PRs/MRs welcome.

Usage:
```javascript
const cassandraConnect = require('@northscaler/cassandra-test-support')

const client = await cassandraConnect()

// now you can client.execute() CQL statements
```

## Configuration

The default configuration is pretty conventional, with the sole exception of the default port that Cassandra will listen on for clients.
Instead of `9042`, which might already be in use on developers' machines when they run integration tests, the default configuration uses `19042`.
It is a `TODO` to search for an available port.

>NOTE: This module detects when it's running in a CI/CD pipeline by seeing if the environment variable `CI` is of nonzero length.

### Environment variables

The following environment variables can be set to configure the docker container:
* CASSANDRA_TEST_SUPPORT_TAG: The tag of the [`cassandra` Docker image](https://hub.docker.com/_/cassandra)  or custom image to use, default `latest`
* CASSANDRA_TEST_SUPPORT_PORT: visible client port on `localhost` to map to container port, default is content of `cassandra/default-cassandra-test-port`
* CASSANDRA_TEST_SUPPORT_CONTAINER: name of container, default is content of file `cassandra/default-cassandra-test-container`
* CASSANDRA_TEST_SUPPORT_CONTAINER_PORT: cassandra client port in container, default `9042`
* CASSANDRA_TEST_SUPPORT_IMAGE: docker image name, default `cassandra`
npm package: @northscaler/elasticsearch-test-support
Description: Elasticsearch Node.js Development Test Support Library
Latest version: 0.1.0-pre.2

# `elasticsearch-test-support`

Handy-dandy Elasticsearch integration testing utility that starts a local Docker container running Elasticsearch if you're not running in a CI/CD pipeline.
This allows you to run integration tests locally in a manner similar to how they'd be run in the CI/CD pipeline. 
This module does nothing when running in a CI build pipeline, because Elasticsearch should be configured as part of the build via something like [`.gitlab-ci.yml`'s `services`](https://docs.gitlab.com/ee/ci/yaml/#services) element.

This package is intended to be installed in your project in `devDependencies`.

Your application must install its desired version of [`@elastic/elasticsearch`](https://www.npmjs.com/package/@elastic/elasticsearch).

> NOTE: requires a Unix-y shell (`/usr/bin/env sh`) to be available.
>This is not designed to run on Windows; PRs/MRs welcome.

Usage:
```javascript
const elasticsearchConnect = require('@northscaler/elasticsearch-test-support')

const client = await elasticsearchConnect()

// now you can use the elasticsearch client
```

## Configuration

The default configuration is pretty conventional, with the sole exception of the default port that Elasticsearch will listen on for clients.
Instead of `9200`, which might already be in use on developers' machines when they run integration tests, the default configuration uses `19200`.
It is a `TODO` to search for an available port.

>NOTE: This module detects when it's running in a CI/CD pipeline by seeing if the environment variable `CI` is of nonzero length.

### Environment variables

The following environment variables can be set to configure the docker container:
* ELASTICSEARCH_TEST_SUPPORT_TAG: The tag of the [`elasticsearch` Docker image](https://hub.docker.com/r/bitnami/elasticsearch) or custom image to use, default `latest`
* ELASTICSEARCH_TEST_SUPPORT_PORT: visible client port on `localhost` to map to container port, default is content of `elasticsearch/default-elasticsearch-test-port`
* ELASTICSEARCH_TEST_SUPPORT_CONTAINER: name of container, default is content of file `elasticsearch/default-elasticsearch-test-container`
* ELASTICSEARCH_TEST_SUPPORT_CONTAINER_PORT: elasticsearch client port in container, default `9200`
* ELASTICSEARCH_TEST_SUPPORT_IMAGE: docker image name, default `bitnami/elasticsearch`
npm package: @northscaler/google-pubsub-test-support
Description: Google PubSub Test Support Library
Latest version: 0.1.0-pre.5

# `google-pubsub-test-support`

Handy-dandy Google PubSub integration testing utility that starts a [local Docker container](https://github.com/marcelcorso/gcloud-pubsub-emulator) running the [Google PubSub emulator](https://cloud.google.com/pubsub/docs/emulator) if you're not running in a CI/CD pipeline.
This allows you to run integration tests locally in a manner similar to how they'd be run in the CI/CD pipeline.
This module does nothing when running in a CI build pipeline, because Google PubSub should be configured as part of the build via something like [`.gitlab-ci.yml`'s `services`](https://docs.gitlab.com/ee/ci/yaml/#services) element.

This package is intended to be installed in your project in `devDependencies`.

Your application must install its desired version of [Google PubSub](https://www.npmjs.com/package/@google-cloud/pubsub).

> NOTE: requires Docker & a Unix-y shell (`/usr/bin/env sh`) to be available.
> This is not designed to run on Windows; PRs/MRs welcome.

See [src/test/integration/google-pubsub/google-pubsub.spec.js] for usage, but it's basically
```javascript
const googlePubSubConnect = require('google-pubsub-test-support')

// one PubSub instance per unique project name will be returned
const pubsubs = await googlePubSubConnect({ projects: ['project1', 'project2']})

// now you can use any of the PubSub instances
const pubsub1 = pubsubs.project1
const pubsub2 = pubsubs.project2
```

## Configuration

The default configuration is pretty conventional, with the sole exception of the default port that Google PubSub will listen on for clients.
Instead of `8661`, which might already be in use on developers' machines when they run integration tests, the default configuration uses `18661`.
It is a `TODO` to search for an available port.

>NOTE: This module detects when it's running in a CI/CD pipeline by seeing if the environment variable `CI` is of nonzero length.

### Environment variables

The following environment variables can be set to configure it:
* GOOGLE_PUBSUB_TEST_SUPPORT_TAG: The tag of the [Google PubSub Emulator Docker image](https://github.com/marcelcorso/gcloud-pubsub-emulator) or custom image to use, default "latest"
* GOOGLE_PUBSUB_TEST_SUPPORT_PORT: visible client port on `localhost` to map to container port, default is content of `google-pubsub/default-google-pubsub-test-port`
* GOOGLE_PUBSUB_TEST_SUPPORT_CONTAINER: name of container, default is content of file `google-pubsub/default-google-pubsub-test-container`
* GOOGLE_PUBSUB_TEST_SUPPORT_CONTAINER_PORT: Google PubSub emulator client port in container, default `8681`
* GOOGLE_PUBSUB_TEST_SUPPORT_IMAGE: docker image name, default `messagebird/gcloud-pubsub-emulator`
npm package: @northscaler/mongo-test-support
Description: Mongo Node.js Development Test Support Library
Latest version: 1.3.0

# `mongo-test-support`

Handy-dandy Mongo integration testing utility that starts a local Docker container running Mongo if you're not running in a CI/CD pipeline.
This allows you to run integration tests locally in a manner similar to how they'd be run in the CI/CD pipeline. 
This module does nothing when running in a CI build pipeline, because Mongo should be configured as part of the build via something like [`.gitlab-ci.yml`'s `services`](https://docs.gitlab.com/ee/ci/yaml/#services) element.

This package is intended to be installed in your project in `devDependencies`.

Your application must install its desired versions of [`mongodb`](https://www.npmjs.com/package/mongodb) and/or [mongoose](https://www.npmjs.com/package/mongoose).

> NOTE: requires a Unix-y shell (`/usr/bin/env sh`) to be available.
>This is not designed to run on Windows; PRs/MRs welcome.

Usage:
```javascript
const { mongoConnect } = require('@northscaler/mongo-test-support')

const db = await mongoConnect()

// now you can do db.createCollection(), etc
// db.client is mongo client
```

Usage to work in both local environment & CI pipeline:
```javascript
const { mongoConnect } = require('@northscaler/mongo-test-support')
const db = await mongoConnect(process.env.CI_COMMIT_SHA ? { host: 'mongo', port: 27017 } : undefined)
```

You can also drop collections:
```javascript
const { dropCollections } = require('@northscaler/mongo-test-support')
await dropCollections({db}) // drops all collections
await dropCollections({db, names: ['foos', 'bars']}) // drops named collections
await dropCollections({db, names: []}) // no collections dropped
```

## Configuration

The default configuration is pretty conventional, with the sole exception of the default port that Mongo will listen on for clients.
Instead of `27017`, which might already be in use on developers' machines when they run integration tests, the default configuration uses `37017`.
It is a `TODO` to search for an available port.

>NOTE: This module detects when it's running in a CI/CD pipeline by seeing if the environment variable `CI_COMMIT_SHA` or `GITHUB_SHA` is of nonzero length.

### Environment variables

The following environment variables can be set to configure the docker container:
* MONGO_TEST_SUPPORT_TAG: The tag of the [`mongo` Docker image](https://hub.docker.com/_/mongo)  or custom image to use, default `latest`
* MONGO_TEST_SUPPORT_PORT: visible client port on `localhost` to map to container port, default is content of `mongo/default-mongo-test-port`
* MONGO_TEST_SUPPORT_CONTAINER: name of container, default is content of file `mongo/default-mongo-test-container`
* MONGO_TEST_SUPPORT_CONTAINER_PORT: mongo client port in container, default `9042`
* MONGO_TEST_SUPPORT_IMAGE: docker image name, default `mongo`
npm package: @northscaler/mosquitto-test-support
Description: Mosquitto Node.js Development Test Support Library
Latest version: 0.0.0-pre.0

# `mosquitto-test-support`

Handy-dandy Mosquitto integration testing utility that starts a local Docker container running mosquitto if you're not running in a CI/CD pipeline.
This allows you to run integration tests locally in a manner similar to how they'd be run in the CI/CD pipeline. 
This module does nothing when running in a CI build pipeline, because Mosquitto should be configured as part of the build via something like [`.gitlab-ci.yml`'s `services`](https://docs.gitlab.com/ee/ci/yaml/#services) element.

This package is intended to be installed in your project in `devDependencies`.

Your application must install its desired versions of [`mqtt`](https://www.npmjs.com/package/mqtt).

> NOTE: requires a Unix-y shell (`/usr/bin/env sh`) to be available.
>This is not designed to run on Windows; PRs/MRs welcome.

Usage:
```javascript
const { mosquittoConnect } = require('@northscaler/mosquitto-test-support')

const client = await mosquittoConnect()
```

Usage to work in both local environment & CI pipeline:
```javascript
const { mosquittoConnect } =  require('@northscaler/mosquitto-test-support')
const client = await mosquittoConnect(process.env.CI_COMMIT_SHA ? { host: 'mosquitto', port: 1883 } : undefined)
```

## Configuration

The default configuration is pretty conventional, with the sole exception of the default port that mosquitto will listen on for clients.
Instead of `1883`, which might already be in use on developers' machines when they run integration tests, the default configuration uses `2883`.
It is a `TODO` to search for an available port.

>NOTE: This module detects when it's running in a CI/CD pipeline by seeing if the environment variable `CI_COMMIT_SHA` or `GITHUB_SHA` is of nonzero length.

### Environment variables

The following environment variables can be set to configure the docker container:
* MOSQUITTO_TEST_SUPPORT_TAG: The tag of the [`eclipse-mosquitto` Docker image](https://hub.docker.com/_/eclipse-mosquitto)  or custom image to use, default `latest`
* MOSQUITTO_TEST_SUPPORT_PORT: visible client port on `localhost` to map to container port, default is content of `mosquitto/default-mosquitto-test-port`
* MOSQUITTO_TEST_SUPPORT_CONTAINER: name of container, default is content of file `mosquitto/default-mosquitto-test-container`
* MOSQUITTO_TEST_SUPPORT_CONTAINER_PORT: mosquitto client port in container, default `9042`
* MOSQUITTO_TEST_SUPPORT_IMAGE: docker image name, default `mosquitto`
npm package: @northscaler/property-decorator
Description: Provides enriched properties in classes
Latest version: 0.2.0

# `@northscaler/property-decorator`
Provides behaviorially-rich public properties based on non-public backing properties on JavaScript classes.

## Overview
Using this decorator avoids a lot of boilerplate code.
You no longer have to manually write:
* `get` method
* `set` method
* `_testSetXxx` method
* `_doSetXxx` method
* `withXxx` method

## TL;DR
When you write this:
```javascript
const property = require('@northscaler/property-decorator')

class MyClass {
  @property()
  _foo
}
```
The decorator defines the equivalent of the following on `MyClass`: 
```javascript
class MyClass {
  _foo
  
  get foo() {                                // getter
    return this._foo
  }
  set foo(value) {                           // validating/scrubbing setter
    this._doSetFoo(this._testSetFoo(value))
  }
  _testSetFoo(value) {                       // validates/scrubs value
    return value
  }
  _doSetFoo(value) {                         // actually sets backing property
    this._foo = value
  }
  withFoo(value) {                           // fluent builder pattern method
    this.foo = value
    return this
  }
}
```
Now, you can use `MyClass` like this:
```javascript
const it = new MyClass().withFoo(1) // demonstrates builder pattern
console.log(it.foo) // logs 1

it.foo = 2
console.log(it.foo) // logs 2
```

## Configuration
This decorator depends on currently experimental features of ECMAScript:
* decorators
* class properties

Make sure your project configures Babel plugins similar to the following:
```javascript
"plugins": [
  [
    "@babel/plugin-proposal-decorators",
    {
      "legacy": true
    }
  ],
  [
    "@babel/plugin-proposal-class-properties",
    {
      "loose": false
    }
  ]
]
```
You can copy them straight out of this module's `package.json` if you want to.

## Best practices
The idea is that the decorator takes care of the boilerplate and you take care of the important bits.
That usually boils down to providing your own method that validates and possibly scrubs the incoming value passed into to a mutator.

For example, if you only want property `_foo` to contain even integers:
```javascript
const property = require('@northscaler/property-decorator')

class MyClass {
  @property()
  _foo

  _testSetFoo(value) {
    const n = parseInt(value)
    if (isNaN(n) || n !== parseFloat(value) || n % 2 !== 0) {
      throw new Error('given value is not an even integer')
    }
    return n // return scrubbed value
  }
}
```
npm package: @northscaler/reflector
Description: JavaScript reflection for mere mortals
Latest version: 0.1.3

# `@northscaler/reflector`
JavaScript's reflection for mere mortals.

## Overview
This module leverages the fact that in the post-ES6 world, people use the `class` keyword.
The primary export of this module is a class called `Reflector`, that essentially extends JavaScript's native `Reflect` class, to make getting information about classes from a class-based frame of mind a little bit more intuitive.
It also allows you to add a `class` property to `Object.prototype` if you like doing that sort of stuff.

## TL;DR
```javascript
'use strict'

const Reflector = require('@northscaler/reflector')

class Sup {
  go () { return 'sup gone' }
}

class Sub extends Sup {
  go () { return 'sub gone'}

  stop () { return 'stop' }
}

const sup = new Sup()
const sub = new Sub()

const SupClass = Reflector.getClassOf(sup)
console.log(SupClass.name) // logs Sup

const SubClass = Reflector.getClassOf(sub)
console.log(SubClass.name) // logs Sub

console.log(Reflector.getClassOf(sub) === Sub) // logs true 

console.log(Reflector.getSuperclassOf(Sub) === Sup) // logs true 

console.log(Reflector.getAllMethodDescriptors(Sub))
// logs { own: <Sub methods>, super: { own: <Sup methods>, super: { own: <Object methods> } } }

// ...and lots more, including all Reflect methods
```

## Add `class` property to `Object.prototype`

If you like monkeying with metastuff, this library allows you to add a `class` property to `Object.prototype`.
This allows you to succinctly get the class of any object.

```javascript
const defineObjectPrototypeClassProperty = require('../../main/Object.prototype.class')

defineObjectPrototypeClassProperty()

class It {hello () { return 'hello' }}

const it = new It()

console.log(it.class === It) // logs true
```

You can also _set_ the class of an object.
```javascript
const plain = {}

plain.class = It

console.log(plain.hello()) // logs hello
```

See the tests in `test/unit/Object.prototype.class.spec.js` for more information.
npm package: @northscaler/string-support
Description: Convenient string utilities
Latest version: 3.3.1

# `string-support`
This package contains various string utilities.

## Snake & Camel Case Conversions
> NOTE: These string utilities are deprecated in favor of lodash's [snakeCase](https://lodash.com/docs/4.17.15#snakeCase) and [camelCase](https://lodash.com/docs/4.17.15#camelCase) functions.
> These will no longer be maintained and users are encouraged to port to the aforelinked lodash methods.

### Camel case to snake
* `toSnake(camel, upper = false)`: converts camel case to snake, lower case by default
* `toUpperSnake(camel)`: converts camel case to upper case snake
* `toLowerSnake(camel)`: converts camel case to lower case snake

### Snake to camel case
* `toCamel(snake, upper = true)`: converts snake to camel case, leading upper by default
* `toUpperCamel(snake)`: converts snake to leading upper camel case
* `toLowerCamel(snake)`: converts snake to leading lower camel case
npm package: @northscaler/ymlx
Description: Command-line YAML processing tool
Latest version: 1.0.1

Command-line YAML processing tool

## Features

* Plain JavaScript to manipulate document(s)

## Install

```
$ npm install -g ymlx
```

## Usage

Pipe into `ymlx` any YAML and anonymous function for reducing it.

```
$ cat my.yaml | ymlx [code ...]
```

### Anonymous function

Use an anonymous function as reducer which gets YAML as an object and processes it:
```
$ echo 'foo: [bar: value]' | ymlx 'x => x.foo[0].bar'
value
```

### `this` Binding

If you don't pass anonymous function `param => ...`, code will be automatically transformed into anonymous function.
And you can get access to YAML by `this` keyword:
```
$ echo 'foo: [bar: value]' | ymlx 'this.foo[0].bar'
value
```

#### Multiple Documents

You can pass a YAML file with multiple documents (using the `---` separator), and your commands will be applied to each document.

```yaml
# test.yml
---
foo:
- bar: value
---
foo:
- bar: another
```

```
$ cat test.yml | ymlx 'this.foo[0].bar'
---
value
---
another
```

### Chain

You can pass any number of anonymous functions for reducing JSON:
```
$ echo 'foo: [bar: value]' | ymlx 'x => x.foo' 'this[0]' 'this.bar'
value
```

### Generator

If passed code contains `yield` keyword, [generator expression](https://github.com/sebmarkbage/ecmascript-generator-expression)
will be used:
```
$ curl ... | ymlx 'for (let user of this) if (user.login.startsWith("a")) yield user'
```

Access to YAML through `this` keyword:
```yaml
# test.yml
- a
- b
```

```
$ cat test.yml | ymlx 'yield* this'
- a
- b
```

```
$ cat test.yml | ymlx 'yield* this; yield "c";'
- a
- b
- c
```

### Update

You can update existing YAML using spread operator:

```
$ echo 'count: 0' | ymlx '{...this, count: 1}'
count: 1
```

### Use npm package

Use any npm package by installing globally or in the current working directory:
```
$ npm install lodash # -g if you want
$ cat 'count: 0' | ymlx 'require("lodash").keys(this)'
- count
```

### Formatting
```
$ echo '[1,2,3]' | ymlx 'this.reduce((a,n) => a += n.toString(), "concat: ")'
'concat: 123'
```

## Inspiration

`ymlx` was inspired by [`fx`](https://github.com/antonmedv/fx)

## Related

* [jq](https://github.com/stedolan/jq) – cli JSON processor on C
* [jsawk](https://github.com/micha/jsawk) – like awk, but for JSON
* [json](https://github.com/trentm/json) – another JSON manipulating cli library
* [jl](https://github.com/chrisdone/jl) – functional sed for JSON on Haskell

## License

MIT
npm package: @northslope/vilya
Description: Message passing layer for WebSockets
Author: James Kavanaugh
Latest version: 3.5.4

# Vilya

## Description

Vilya is an abstraction layer for network messages, which handles the connection, control messages, serialization, and schema validation. Currently, vilya supports [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) and [Ajv](https://ajv.js.org) for serialization and schema validation.

> **Note:** We used Vilya for a project, but it is no longer being actively developed.

## Installation

`npm install @northslope/vilya`

## Usage

### Server side (Node.js)
```typescript
import MessageSchema, { MessageType } from './schema';
import WebSocket from 'ws';
import { WebSocketConnection, buildSerializer } from '@northslope/vilya';

// Use ws package to listen for websocket connections
const wss = new WebSocket.Server({ port: 8080 });
wss.on("connection", (newSocket: WebSocket) => {

  // Build the serializer and parser
  const { serializePacket, parsePacket } =
    buildSerializer<Message>(MessageSchema);

  // Create a vilya WebSocketConnection
  const socketConnection = new WebSocketConnection<MessageType>({
        ws: newSocket,
        serialize: serializePacket,
        parse,
      });

  socketConn.addMessageListener((message) => {
    console.log(message);
  });

  socketConn.addCloseListener(() => {
    console.log("Connection closed");
  });
```

### Client side (Browser or Node.js)
```typescript
import MessageSchema, { MessageType } from './schema';
import WebSocketConnection from '@northslope/vilya';

// Build the serializer and parser
const { serializePacket, parsePacket } =
  buildSerializer<Message>(MessageSchema);

// Create the vilya WebSocketConnection object
const socketConnection = new WebSocketConnection<MessageType>({
  serialize: (message) => JSON.stringify(message),
  parse: (message) => JSON.parse(message),
});

// add a message listener
socketConnection.addMessageListener((message) => {
  console.log(message);
});

// add a close listener
socketConnection.addCloseListener(() => {
  console.log("Connection closed");
});

// connect to the server
socketConnection.connect("ws://localhost:8080");
```

## What does vilya mean?

It's nerd stuff. Vilya is one of the elven rings of power from J.R.R. Tolkien literature. Vilya is the ring of air that was owned by Elrond, which apparently helped Elrond conceal Rivendell. Vilya conceals the complexity of message passing through abstraction and encapsulation.