open-index/open-npm huggingface dataset:
npm package: @seegno/react-forms
Description: Manage React form state the easy way and validate with [json-schema](https://json-schema.org/).
Author: Seegno
Latest version: 0.15.4

# Seegno React Forms

Manage React form state the easy way and validate with [json-schema](https://json-schema.org/).

## Installation

```sh
yarn add @seegno/react-forms
```

Make sure you have at least version 16.8 of React:

```sh
yarn add react@^16.8.0
```

## Usage

```js
import { FormProvider, useField } from '@seegno/react-forms';

function Input({ name }) {
  const { onChange, value } = useField(name);

  return (
    <input
      name={name}
      onChange={event => onChange(event.target.value)}
      value={value}
    />
  );
}

function Form() {
  return (
    <FormProvider
      jsonSchema={{
        properties: {
          foo: { type: 'string' }
        },
        type: 'object'
      }}
      onSubmit={values => console.log('submit', values)}
    >
      {({ submit }) => (
        <form onSubmit={submit}>
          <Input name={'foo'} />

          <button type={'submit'}>
            {'Submit'}
          </button>
        </form>
      )}
    </FormProvider>
  );
}
```

## Tests

Run the tests from the root directory:

```sh
yarn test
```

## Contributing & Development

### Contributing

Found a bug or want to suggest something?
Take a look first on the current and closed [issues](https://github.com/seegno/react-forms/issues).
If it is something new, please [submit an issue](https://github.com/seegno/react-forms/issues/new).

### Develop

It will be awesome if you can help us evolve `@seegno/react-forms`.
Want to help?

1. [Fork it](https://github.com/seegno/react-forms).
2. Install the dependencies with `yarn`.
3. Hack away.
4. Run the tests: `yarn test`.
5. Create a [Pull Request](https://github.com/seegno/react-forms/compare).
npm package: @seek/aws-codedeploy-infra
Description: AWS CDK infrastructure for AWS CodeDeploy Hooks
Latest version: 4.1.1

# @seek/aws-codedeploy-infra

[![npm package](https://img.shields.io/npm/v/@seek/aws-codedeploy-infra?labelColor=cb0000&color=5b5b5b)](https://www.npmjs.com/package/@seek/aws-codedeploy-infra)
[![Node.js version](https://img.shields.io/node/v/@seek/aws-codedeploy-infra?labelColor=5fa04e&color=5b5b5b)](https://www.npmjs.com/package/@seek/aws-codedeploy-infra)

[AWS CDK] infrastructure for AWS CodeDeploy Hooks.

[AWS CDK]: https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-typescript.html

## Setup

AWS Lambda hooks can be deployed inline with each application in a self-contained [CloudFormation stack],
however this overhead becomes less desirable as you scale to multiple applications.

[CloudFormation stack]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html

The `HookStack` construct defines a consolidated infrastructure stack that can be deployed once per environment and utilised by multiple applications in the network:

```typescript
import { HookStack } from '@seek/aws-codedeploy-infra';
import { App } from 'aws-cdk-lib';

const app = new App();

new HookStack(app);

app.synth();
```

## Usage

### Lambda function (CDK)

In a CDK stack:

```diff
+ import { LambdaDeployment } from '@seek/aws-codedeploy-infra';
import { aws_lambda_nodejs } from 'aws-cdk-lib';

const lambdaFunction = new aws_lambda_nodejs.NodejsFunction(this, 'Function', {
  // ...
});

+ const lambdaDeployment = new LambdaDeployment(this, 'Deployment', {
+   lambdaFunction,
+ });

- lambdaFunction.addEventSource(source);
+ lambdaDeployment.alias.addEventSource(source);
```

The `LambdaDeployment` construct creates a CodeDeploy application and deployment group for your Lambda function,
and applies an `aws-codedeploy-hooks` tag to enable AWS Lambda hooks to [access these resources].

A `BeforeAllowTraffic` hook is registered to check that an incoming Lambda function version is healthy before cutting traffic over to its `Live` alias [all at once].
The hook invokes the incoming Lambda function version with a "smoke test" payload that looks like so:

```typescript
import assert from 'assert';

export const handler = (event: Event, ctx: Context) => {
  // An empty event object `{}`
  assert.strictEqual(Object.keys(event).length, 0);

  // A context object with a custom user agent prop
  assert.strictEqual(
    typeof ctx.clientContext?.Custom?.['user-agent'],
    'string',
  );
};
```

This payload can be recognised by the [`isLambdaHook`] runtime helper.

[access these resources]: https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html
[all at once]: https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html#deployment-configurations-predefined-lambda
[`isLambdaHook`]: ../hooks/README.md#islambdahook
npm package: @seek/kms-config
Description: Decrypt KMS encrypted values in config files
Latest version: 1.0.0

<a name="module_config"></a>

## config ⇒ <code>Promise</code>
Decrypt [KMS](https://aws.amazon.com/kms/) encrypted values in config files. This tool is optimised for use in node 4.3.2 AWS Lambda functions but should work in any modern node runtime.

### Install
```
npm install --save @seek/kms-config
```

### Usage
The user that is running the lambda will need `kms:Decrypt` permission to the master key used for generating the ciphertext.
*Warning** To reduce KMS overhead you should just call this once and cache the result if possible.

#### myConfig.json
```javascript
{
    "foo" : "bar",
    "kms" { //All the values in this object are expected to be KMS ciphertext 
        "secretToHappiness" : "base64_encoded_ciphertext"
    }
}
```
#### handler.js
```javascript
const myConfig = require('./myConfig')
const config  = require('@seek/kms-config')(myConfig)

config.then(resolved => {
    console.log(resolved.foo) // "bar"
    console.log(resolved.kms.secretToHappiness) // "eat more chocolate"
}).catch(err => {
    console.log(err, "Oh dear perhaps you are missing KMS permissions")
})
...
```

**Returns**: <code>Promise</code> - A promise to the loaded config which will be resolved with all kms values decrypted.  

| Param | Type | Description |
| --- | --- | --- |
| config | <code>Object</code> | A config object which may contain a child `kms` object who's values are KMS ciphertext |
npm package: @seek/splunk-logger
Description: Generates Splunk consumable logs in node 4.3.2 AWS Lambdas.
Latest version: 1.0.0

<a name="Logger"></a>

## Logger
Generates Splunk consumable logs in node 4.3.2 AWS Lambdas.

### Install
```
npm install --save @seek/splunk-logger
```

### Usage
Provides the usual [error](#Logger+error), [warn](#Logger+warn), [info](#Logger+info), and [debug](#Logger+debug)

Log messages are formatted like this where the `name` component will only be used if given in the logger's constructor :
```
name=<name>, level=<level>, msg=<msg>
```

**Kind**: global class  

* [Logger](#Logger)
    * [new Logger([name], [level])](#new_Logger_new)
    * [.setLevel(level)](#Logger+setLevel) ⇒ <code>[Logger](#Logger)</code>
    * [.log(msg, level)](#Logger+log)
    * [.error(msg)](#Logger+error)
    * [.warn(msg)](#Logger+warn)
    * [.info(msg)](#Logger+info)
    * [.debug(msg)](#Logger+debug)

<a name="new_Logger_new"></a>

### new Logger([name], [level])
Create a logger


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [name] | <code>string</code> |  | Optional name to give the logger. This will be added to all log bodies. |
| [level] | <code>string</code> | <code>&quot;info&quot;</code> | Optional minimum level to output. Defaults to `info` |

<a name="Logger+setLevel"></a>

### logger.setLevel(level) ⇒ <code>[Logger](#Logger)</code>
Set the minimum log level to output

**Kind**: instance method of <code>[Logger](#Logger)</code>  
**Returns**: <code>[Logger](#Logger)</code> - this Logger instance  

| Param | Type | Description |
| --- | --- | --- |
| level | <code>string</code> | Should be one of `error`, `warn`, `info`, `debug` |

<a name="Logger+log"></a>

### logger.log(msg, level)
Emit a log message at the given level

**Kind**: instance method of <code>[Logger](#Logger)</code>  

| Param | Type | Description |
| --- | --- | --- |
| msg | <code>\*</code> | Thing to be logged. If given an object literal it will be appended to the log in the format `<code>key1=value1, key2=value2</code>` |
| level | <code>string</code> | log level to be used in `error`, `warn`, `info`, `debug`. Defaults to `info`. |

<a name="Logger+error"></a>

### logger.error(msg)
Emit error level log

**Kind**: instance method of <code>[Logger](#Logger)</code>  

| Param | Type | Description |
| --- | --- | --- |
| msg | <code>\*</code> | Thing to be logged. See [log](log) |

<a name="Logger+warn"></a>

### logger.warn(msg)
Emit warn level log

**Kind**: instance method of <code>[Logger](#Logger)</code>  

| Param | Type | Description |
| --- | --- | --- |
| msg | <code>\*</code> | Thing to be logged. See [log](log) |

<a name="Logger+info"></a>

### logger.info(msg)
Emit info level log

**Kind**: instance method of <code>[Logger](#Logger)</code>  

| Param | Type | Description |
| --- | --- | --- |
| msg | <code>\*</code> | Thing to be logged. See [log](log) |

<a name="Logger+debug"></a>

### logger.debug(msg)
Emit debug level log

**Kind**: instance method of <code>[Logger](#Logger)</code>  

| Param | Type | Description |
| --- | --- | --- |
| msg | <code>\*</code> | Thing to be logged. See [log](log) |