# @dasmeta/event-manager-platform-helper

> Event platform helper

Latest version **1.3.4** (published 2025-07-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @dasmeta/event-manager-platform-helper
pnpm add @dasmeta/event-manager-platform-helper
yarn add @dasmeta/event-manager-platform-helper
bun add @dasmeta/event-manager-platform-helper
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2025-07-25 |
| First published | 2022-01-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gevorg Margaryan |
| Maintainers | aram.dasmeta.com, hovhannes.babayan, gevorgmargaryan |

## Links

- npm: https://www.npmjs.com/package/@dasmeta/event-manager-platform-helper
- Repository: git@github.com:dasmeta/event-manager-platform-helper
- npm.io page: https://npm.io/package/@dasmeta/event-manager-platform-helper

## Dependencies (2)

- [mongodb](https://npm.io/package/mongodb.md) ^3.3.2
- [@dasmeta/event-manager-node-api](https://npm.io/package/@dasmeta/event-manager-node-api.md) ^2.2.3

## Recent versions

- 1.3.4 (latest) — 2025-07-25
- 1.3.3-debug6 — 2025-07-25
- 1.3.3-debug5 — 2025-07-25
- 1.3.3-debug4 — 2025-07-25
- 1.3.3-debug3 — 2025-07-25
- 1.3.3-debug2 — 2025-07-25
- 1.3.3-debug1 — 2025-07-25
- 1.3.3 — 2025-04-09
- 1.3.2 — 2023-05-11
- 1.3.1 — 2023-03-22
- 1.3.0 — 2023-01-31
- 1.2.0 — 2022-03-16
- 1.1.0 — 2022-02-24
- 1.0.3 — 2022-02-09
- 1.0.2 — 2022-02-03
- … 2 more at https://npm.io/package/@dasmeta/event-manager-platform-helper/versions

## README

## Installation
`yarn add @dasmeta/event-manager-platform-helper`

## Configuration
### Environment variables

```
DEPLOYER_PLATFORM=gcf

DATABASE_URL_EVENT = mongodb://username:password@localhost:27017/event?authSource=admin
```
## Usage
### Provide environment variable
```javascript
// example1.js

const platformHelper = require('@dasmeta/event-manager-platform-helper')

const doThing = () => {
    console.log('function executed.')
}

const handler = platformHelper.wrapHandler(doThing)
```
```shell
DEPLOYER_PLATFORM=gcf node example1.js
```

### Calling by parameter

```javascript
// example2.js

const platformHelper = require('@dasmeta/event-manager-platform-helper')

const doThing = () => {
    console.log('function executed.')
}

const handler = platformHelper.wrapHandler(doThing, 'gcf')
```
```shell
node example2.js
```

## Development
## Adding new platform adapter
- Copy `src/adapter/platforms/fission.js` to new adapter file eg. `src/adapter/platforms/awsLambda.js`
- Implement the exported functions according to lambda specifications


## Simple function call test
```javascript
const platformHelper = require('@dasmeta/event-manager-platform-helper')

async function test(platform) {
    const log = (...all) => {
        console.log(`${platform}\n`, ...all, "\n");
    }
    const mockHandler = (data, context) => {
        log('function executed.\n', {data, context})
    }

    const wrappedHandler = platformHelper.wrapHandler(mockHandler, platform)

    const event = {
        eventId: 123,
        traceId: 'aabbccddee',
        data: {application: "data"},
        dataSource: "something",
        subscription: ""
    }

    const payloads = {
        gcf: [
            { data: Buffer.from(JSON.stringify(event)).toString('base64')},
            {
                resource: {
                    name: 'some-namespace/some-name'
                }
            }
        ],
        fission: [{
            request: {
                get: (key) => {
                    log(`must get '${key}'`);
                    return `${key} data`
                },
                body: event
            }
        }]
    }

    const rs = await wrappedHandler(...payloads[platform])
    log("rs", rs)
}

test('gcf');
test('fission');

```

---
_Source: https://npm.io/package/@dasmeta/event-manager-platform-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
