1.2.0 • Published 1 year ago

metadapter-event v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Metadapter - Event Logging

NPM Version

Metadapter universal adapter for event logging systems like PostHog. Implement interface for event logging and let your user choice which event logging service they utilize.

!IMPORTANT If you have a service you would like to support, please add it and make a pull request. It's super easy! Please refrain from using additional 3rd party libraries as it will make the code too bloated.

Features

  • Metadapter Universal Adapter
  • ✅ Supports PostHog
  • ✅ Supports Skeleton (console logging for prototyping)
  • ✅ Specify adapter or use dynamic config adapter

Installation

npm install metadapter-event

Platforms

The remapping allow remapping values from the payload to additional event properties on your platform.

PlatformTypeConfig
PostHogPostHog{ api_key:string, remapping?: { distinct_id?:string } }
Skeleton (Console for Prototyping)Skeleton{} or undefined

Example Initiation

// sherpa.server.ts
import { Type, EventInterface, PostHog } from "metadapter-event";

// Specify Type w/ Enum
EventInterface(Type.PostHog, { "api_key": "***" });

// Specify Type w/ String
EventInterface(Type["PostHog"], { "api_key": "***" });

// Specify Type w/ Class
PostHog({ "api_key": "***" });

Methods

Add Event

add(event: EventID, payload?:Payload, userID?:string): Promise<void> | void \ Adds an event to the system.

Parameters:

  • event (EventID/string): The ID of the event to be added.
  • payload (Payload/JSON, optional): Additional data associated with the event. Default is undefined.
  • userID (UserID/string, optional): The ID of the user associated with the event. Default is undefined.

Returns:

  • If the function is asynchronous and returns a Promise, it resolves to void.
  • If the function is synchronous, it returns void.
1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.0

1 year ago