0.0.1-master.20190830205058 • Published 3 years ago

@atomist/sdm-pack-event-relay v0.0.1-master.20190830205058

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
3 years ago

@atomist/sdm-pack-event-relay

This extension pack allows an SDM to function as an event relay between event sources and Cortex. Reasons for doing this include air-gapped services and needing to "scrub" data from outbound payloads.

An example configuration for a relay configuration:

 const bitbucketRelay: EventRelayer<BitbucketTestData> = {
     name: "bitbucketRelay",
     test: payload => !!payload.body.actor && !!payload.body.date && !!payload.body.eventKey,
     processor: async payload => {
         (payload.body as any)["x-bitbucket-type"] = payload.headers["x-event-key"];
         return {body: payload.body, headers: payload.headers};
     },
     targetEvent: {
         eventType: "public",
         eventTarget: sdm.configuration.sdm.git.webhookdest,
         headers: (ctx, payload) => {
             payload.headers = addAtomistSignatureHeader(
                 sdm.configuration.sdm.git.key,
                 payload.body,
                 payload.headers as HttpClientOptions["headers"],
             );
             return payload.headers as HttpClientOptions["headers"];
         },
     },
 };

sdm.addExtensionPacks(
    eventRelaySupport({
        eventRelayers: [
            bitbucketRelay,
        ],
    }),
);

See the EventRelayer interface for details on creating EventRelayer(s). For details on the extension pack configuration, see the eventRelaySupport type documentation.

Getting started

See the Developer Quick Start to jump straight to creating an SDM.

Contributing

Contributions to this project from community members are encouraged and appreciated. Please review the Contributing Guidelines for more information. Also see the Development section in this document.

Code of conduct

This project is governed by the Code of Conduct. You are expected to act in accordance with this code by participating. Please report any unacceptable behavior to code-of-conduct@atomist.com.

Documentation

Please see docs.atomist.com for developer documentation.

Connect

Follow @atomist and The Composition blog related to SDM.

Support

General support questions should be discussed in the #support channel in the Atomist community Slack workspace.

If you find a problem, please create an issue.

Development

You will need to install Node.js to build and test this project.

Build and test

Install dependencies.

$ npm install

Use the build package script to compile, test, lint, and build the documentation.

$ npm run build

Release

Releases are handled via the Atomist SDM. Just press the 'Approve' button in the Atomist dashboard or Slack.


Created by Atomist. Need Help? Join our Slack workspace.