open-index/open-npm huggingface dataset:
npm package: @hicksy/arc-plugin-sandbox-stream
Description: This plugin enables developers to use DynamoDB streams locally in their arc or enhance sandbox environment
Author: Martin Hicks
Latest version: 1.1.0

# arc-plugin-sandbox-stream

This plugin enables developers to use DynamoDB streams locally in their arc or enhance sandbox environment

Note you'll need to running DynamoDB Local and have it configured in architect, [please refer to my guide](https://martinhicks.net/articles/arc-sandbox-table-streams/). 


## v1.1.0 - Breaking change

Previous versions of this plugin invoked the Stream lambda passing `data.Records` as the payload. 

From v1.1.0 onwards, the stream function is now invoked passing the full object returned by `AWS.DynamoDBStreams.getRecords`. Which will return similar to:

```
{
  "Records": [...],
  "NextShardIterator": "arn:aws:dynamodb:ddblocal:000000000000:table/...."
}
```



## Setup 

__1. Add the dependency to your project__

`npm install @hicksy/arc-plugin-sandbox-stream`

__2. Configure your project to use @tables-streams in `.arc` file__

```
@tables
example
  pk *String
  sk **String

@tables-streams
example
```
__3. Add the plugin to arc config__


```
@plugins
hicksy/arc-plugin-sandbox-stream
```
npm package: @hicksy/enhance-csrf
Description: A CSRF component for enhance projects
Author: Martin Hicks
Latest version: 1.0.0

# CSRF component for Enhance projects


### example usage

```
import { createCsrfToken, verifyCsrfToken } from '@hicksy/enhance-csrf/server/csrf.js'

export let get = [createCsrfToken, two]

export let post = [verifyCsrfToken, two]

async function two (req) {
  console.log('hi from two')
  console.log(req)
  
  return { 
    session: req.session,
    json: {test: 'one', csrf_token: req.session.csrf}
  }
}
```
npm package: @hicksy/shared-enhance-components-plugin
Description: A helper plugin to automate the discovery of shared npm installed enhance components within a different enhance project
Author: Martin Hicks
Latest version: 0.5.4

# `enhance-shared-components-plugin`

### setup 

```
npm install @hicksy/shared-enhance-components-plugin
```

Add to .arc file

```
@plugins
hicksy/shared-enhance-components-plugin

@shared-enhance-components-plugin
hicksy/enhance-csrf 'elements'
enhance/form-elements
```

### @shared-enhance-components-plugin pragma

You can either list the npm installed enhance component libraries by their name (excluding @ if it's a scoped package). 
This way supports component libraries that are all exported from an index.js / index.mjs file 

e.g. add the following elements to your project 
`npm install git+https://github.com/enhance-dev/form-elements.git`


Or you can supply a second argument for the directory name in which the individual components exists
This way supports modules that may include components in a secondary folder, as defaul exports within single files


### auto-updates the elements.mjs file

```
import CsrfForm from 'enhance-csrf/elements/CsrfForm.mjs' //automatically inserted by shared-enhance-components-plugin
import CsrfInput from 'enhance-csrf/elements/CsrfInput.mjs' //automatically inserted by shared-enhance-components-plugin
import { CheckBox } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin
import { FieldSet } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin
import { FormElement } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin
import { LinkElement } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin
import { PageContainer } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin
import { SubmitButton } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin
import { TextInput } from '@enhance/form-elements/index.js' //automatically inserted by shared-enhance-components-plugin

let elements = {

  'csrf-form': CsrfForm, //automatically inserted by shared-enhance-components-plugin
  'csrf-input': CsrfInput, //automatically inserted by shared-enhance-components-plugin
  'check-box': CheckBox, //automatically inserted by shared-enhance-components-plugin
  'field-set': FieldSet, //automatically inserted by shared-enhance-components-plugin
  'form-element': FormElement, //automatically inserted by shared-enhance-components-plugin
  'link-element': LinkElement, //automatically inserted by shared-enhance-components-plugin
  'page-container': PageContainer, //automatically inserted by shared-enhance-components-plugin
  'submit-button': SubmitButton, //automatically inserted by shared-enhance-components-plugin
  'text-input': TextInput //automatically inserted by shared-enhance-components-plugin
}

export default elements
```