Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@event-inc/pipelines

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-inc/pipelines

Event Inc is a fully managed event bus lets you send and receive data across mission-critical cloud apps, databases and warehouses.

latest
npmnpm
Version
2.2.0
Version published
Weekly downloads
8
-72.41%
Maintainers
5
Weekly downloads
 
Created
Source

Pipelines

To create sources and destinations, refer to the @event-inc/connections package.

import { 
  createClient,
  createPipeline,
  updatePipeline,
  deletePipeline
} from "@event-inc/pipelines";

const main = async () => {
  const client = createClient(process.env.EVENT_INC_TOKEN, {
    environment: "sandbox" // or "production"
  });

  // Create a pipeline
  const pipeline = await createPipeline(client, {
    label: `Stripe to Elasticsearch`,
    source: {
      key: "SOURCE_KEY",
      events: ["customer.created"], // Events to trigger pipeline
    },
    destination: {
      key: "DESTINATION_KEY",
      action: "index", // Destination action to trigger
    },

    // Extract data to enrich transformation context
    extractors: [
      {
        type: "http",
        label: "customer",
        config: {
          url: "https://api.yourcompanydomain.co",
          method: "GET"
        },
      },
    ],
    transformation: {
      type: "javascript",

      // Transform data before sending it to the destination
      func: function transform(event, context) {
        const body = JSON.parse(event.body);
        // const extractorData = context?.extractorLabel?.data;

        return {
          index: "stripe-customers",
          document: {
            name: body.data.object.email,
          },
        };
      },
    },
    // Pipeline configuration
    settings: {
      startToCloseTimeout: "30 minutes", // Execution window
      retry: {
        maximumAttempts: 10, // Maximum retry attempts within window
      },
    },
  });

  // Update the pipeline
  const updatedPipeline = await updatePipeline(client, {
    key: "SOURCE_KEY",
    active: false
  });

  // Delete the pipeline
  await deletePipeline(client, {
    key: pipeline.key,
  });
}

main();

Keywords

event-inc

FAQs

Package last updated on 18 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts