Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@objectiv/schema

Package Overview
Dependencies
Maintainers
3
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@objectiv/schema - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

7

package.json
{
"name": "@objectiv/schema",
"version": "0.0.1",
"version": "0.0.2",
"description": "Objectiv TypeScript implementation of the open taxonomy for analytics",

@@ -41,7 +41,6 @@ "license": "Apache-2.0",

"devDependencies": {
"depcheck": "^1.4.2",
"prettier": "^2.4.1",
"prettier": "^2.5.1",
"shx": "^0.3.3",
"typescript": "^4.4.4"
"typescript": "^4.5.4"
}
}

@@ -6,5 +6,3 @@ /*

/**
* Events must provide a `name` and optionally can, but most likely will, carry a list of Location and Global
* Contexts. Additionally, every event must have an `ApplicationContext` to be able to distinguish from what
* application the event originated.
* This is the abstract parent of all Events.
* Inheritance: AbstractEvent

@@ -45,9 +43,3 @@ */

/**
* Abstract Contexts define either properties required by Collectors or internal ones for hierarchical
* discrimination purposes.
* All Contexts inherit from AbstractContext. It defines the bare minimum properties every Context must implement.
* For example we never want to mix Location Contexts with Global Contexts and Events may requires specific Contexts
* to be present in their Location Stack. Eg. a NavigationContext instead of a generic SectionContext.
* This ensures that Events are carrying the Contexts they require, making them meaningful and identifiable.
* All Contexts inherit from AbstractContext. It defines the bare minimum properties every Context must implement.
* AbstractContext defines the bare minimum properties for every Context. All Contexts inherit from it.
* Inheritance: AbstractContext

@@ -69,18 +61,15 @@ */

/**
* This is the abstract parent of all location contexts. LocationContexts are used to populate Trackers or Events
* `location_stack` properties. A Location Stack is meant to describe accurately where an Event originated in the
* UI Eg. Sections, Menus, etc.
* Inheritance: AbstractLocationContext -> AbstractContext
* This is the abstract parent of all Global Contexts. Global contexts add general information to an Event.
* Inheritance: AbstractGlobalContext -> AbstractContext
*/
export abstract class AbstractLocationContext extends AbstractContext {
readonly __location_context = true;
export abstract class AbstractGlobalContext extends AbstractContext {
readonly __global_context = true;
}
/**
* Global_contexts are used to populate Trackers or Events `global_contexts` properties. They carry information
* that is not related to where the Event originated, such as device, platform or business data.
* Inheritance: AbstractGlobalContext -> AbstractContext
* AbstractLocationContext are the abstract parents of all Location Contexts. Location Contexts are meant to describe where an event originated from in the visual UI.
* Inheritance: AbstractLocationContext -> AbstractContext
*/
export abstract class AbstractGlobalContext extends AbstractContext {
readonly __global_context = true;
export abstract class AbstractLocationContext extends AbstractContext {
readonly __location_context = true;
}

@@ -98,10 +87,2 @@

*
* Inheritance: AbstractVideoEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export abstract class AbstractVideoEvent extends AbstractNonInteractiveEvent {
readonly __video_event = true;
}
/**
*
* Inheritance: AbstractInteractiveEvent -> AbstractEvent

@@ -115,6 +96,6 @@ */

*
* Inheritance: AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* Inheritance: AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export abstract class AbstractSectionContext extends AbstractLocationContext {
readonly __section_context = true;
export abstract class AbstractMediaEvent extends AbstractNonInteractiveEvent {
readonly __media_event = true;
}

@@ -124,19 +105,6 @@

*
* Inheritance: AbstractItemContext -> AbstractLocationContext -> AbstractContext
* Inheritance: AbstractPressableContext -> AbstractLocationContext -> AbstractContext
*/
export abstract class AbstractItemContext extends AbstractLocationContext {
readonly __item_context = true;
export abstract class AbstractPressableContext extends AbstractLocationContext {
readonly __pressable_context = true;
}
/**
*
* Inheritance: AbstractActionContext -> AbstractItemContext -> AbstractLocationContext -> AbstractContext
*/
export abstract class AbstractActionContext extends AbstractItemContext {
readonly __action_context = true;
/**
* The text of the interactive element or, for visuals, a string describing it
*/
text: string;
}

@@ -5,187 +5,170 @@ /*

import { AbstractNonInteractiveEvent, AbstractVideoEvent, AbstractInteractiveEvent } from './abstracts';
import { AbstractInteractiveEvent, AbstractNonInteractiveEvent, AbstractMediaEvent } from './abstracts';
/**
* Non interactive events, are events that are not (directly) triggered by an interaction. For example:
* Consider the following flow of events:
* 1. press play in a video player -> ButtonEvent -> interactive
* 2. Videoplayer starting playback -> MediaStartEvent -> non-interactive
* Inheritance: NonInteractiveEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* The parent of Events that are the direct result of a user interaction, e.g. a button click.
* Inheritance: InteractiveEvent -> AbstractInteractiveEvent -> AbstractEvent
*/
export interface NonInteractiveEvent extends AbstractNonInteractiveEvent {
export interface InteractiveEvent extends AbstractInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'NonInteractiveEvent';
readonly _type: 'InteractiveEvent';
}
/**
* A non interactive event, that would be emitted when an action completes successfully, e.g. a form that
* is posted.
* Inheritance: CompletedEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* The parent of Events that are not directly triggered by a user action.
* Inheritance: NonInteractiveEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface CompletedEvent extends AbstractNonInteractiveEvent {
export interface NonInteractiveEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'CompletedEvent';
readonly _type: 'NonInteractiveEvent';
}
/**
* A non interactive event, that would be emitted when an action fails or is aborted, e.g. a form that
* is posted, but not successfully.
* Inheritance: AbortedEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractive event that is emitted after an application (eg. SPA) has finished loading.
* Inheritance: ApplicationLoadedEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface AbortedEvent extends AbstractNonInteractiveEvent {
export interface ApplicationLoadedEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'AbortedEvent';
readonly _type: 'ApplicationLoadedEvent';
}
/**
* A non interactive event that is emitted after a document finishes loading. It should provide a
* `WebDocumentContext` which should describe the state (eg. URL) of the event.
* NOTE: with SPA's this probably only happens once, as page (re)loads don't happen after the initial page load
* Inheritance: DocumentLoadedEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that is sent when a user action results in a error,
* like an invalid email when sending a form.
* Inheritance: FailureEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface DocumentLoadedEvent extends AbstractNonInteractiveEvent {
export interface FailureEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'DocumentLoadedEvent';
}
readonly _type: 'FailureEvent';
/**
* non interactive event that is emitted when the URL of a page has changed. Also contains a `WebDocumentContext`
* that details the change.
* Inheritance: URLChangeEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface URLChangeEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
* Failure message.
*/
readonly _type: 'URLChangeEvent';
message: string;
}
/**
* non interactive event that is emitted after an application (eg. SPA) has finished loading.
* Contains a `SectionContext`
* Inheritance: ApplicationLoadedEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* Event triggered when user input is modified.
* Inheritance: InputChangeEvent -> AbstractInteractiveEvent -> AbstractEvent
*/
export interface ApplicationLoadedEvent extends AbstractNonInteractiveEvent {
export interface InputChangeEvent extends AbstractInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'ApplicationLoadedEvent';
readonly _type: 'InputChangeEvent';
}
/**
* Non interactive event, emitted after a section (`SectionContext`) has become visible.
* Inheritance: SectionVisibleEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* An InteractiveEvent that is sent when a user presses on a pressable element
* (like a link, button, icon).
* Inheritance: PressEvent -> AbstractInteractiveEvent -> AbstractEvent
*/
export interface SectionVisibleEvent extends AbstractNonInteractiveEvent {
export interface PressEvent extends AbstractInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'SectionVisibleEvent';
readonly _type: 'PressEvent';
}
/**
* Non interactive event, emitted after a section (`SectionContext`) has become invisible.
* Inheritance: SectionHiddenEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that's emitted after a LocationContext has become invisible.
* Inheritance: HiddenEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface SectionHiddenEvent extends AbstractNonInteractiveEvent {
export interface HiddenEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'SectionHiddenEvent';
readonly _type: 'HiddenEvent';
}
/**
* Family of non interactive events triggered by a video player
* Inheritance: VideoEvent -> AbstractVideoEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that's emitted after a section LocationContext has become visible.
* Inheritance: VisibleEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface VideoEvent extends AbstractVideoEvent {
export interface VisibleEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'VideoEvent';
readonly _type: 'VisibleEvent';
}
/**
* Event emitted after a video completes loading.
* Inheritance: VideoLoadEvent -> AbstractVideoEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that is sent when a user action is successfully completed,
* like sending an email form.
* Inheritance: SuccessEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface VideoLoadEvent extends AbstractVideoEvent {
export interface SuccessEvent extends AbstractNonInteractiveEvent {
/**
* Typescript discriminator
*/
readonly _type: 'VideoLoadEvent';
}
readonly _type: 'SuccessEvent';
/**
* Event emitted after a video starts playback.
* Inheritance: VideoStartEvent -> AbstractVideoEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface VideoStartEvent extends AbstractVideoEvent {
/**
* Typescript discriminator
* Success message.
*/
readonly _type: 'VideoStartEvent';
message: string;
}
/**
* Event emitted after a video stops playback.
* Inheritance: VideoStopEvent -> AbstractVideoEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* The parent of non-interactive events that are triggered by a media player.
* It requires a MediaPlayerContext to detail the origin of the event.
* Inheritance: MediaEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface VideoStopEvent extends AbstractVideoEvent {
export interface MediaEvent extends AbstractMediaEvent {
/**
* Typescript discriminator
*/
readonly _type: 'VideoStopEvent';
readonly _type: 'MediaEvent';
}
/**
* Event emitted after a video pauses playback (toggle).
* Inheritance: VideoPauseEvent -> AbstractVideoEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A MediaEvent that's emitted after a media item completes loading.
* Inheritance: MediaLoadEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface VideoPauseEvent extends AbstractVideoEvent {
export interface MediaLoadEvent extends AbstractMediaEvent {
/**
* Typescript discriminator
*/
readonly _type: 'VideoPauseEvent';
readonly _type: 'MediaLoadEvent';
}
/**
* Events that are the direct result of a user interaction. Eg. a Button Click
* Inheritance: InteractiveEvent -> AbstractInteractiveEvent -> AbstractEvent
* A MediaEvent that's emitted after a media item pauses playback.
* Inheritance: MediaPauseEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface InteractiveEvent extends AbstractInteractiveEvent {
export interface MediaPauseEvent extends AbstractMediaEvent {
/**
* Typescript discriminator
*/
readonly _type: 'InteractiveEvent';
readonly _type: 'MediaPauseEvent';
}
/**
* Event triggered by a user clicking on an element
* Inheritance: ClickEvent -> AbstractInteractiveEvent -> AbstractEvent
* A MediaEvent that's emitted after a media item starts playback.
* Inheritance: MediaStartEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface ClickEvent extends AbstractInteractiveEvent {
export interface MediaStartEvent extends AbstractMediaEvent {
/**
* Typescript discriminator
*/
readonly _type: 'ClickEvent';
readonly _type: 'MediaStartEvent';
}
/**
* Event triggered when user input is modified.
* Inheritance: InputChangeEvent -> AbstractInteractiveEvent -> AbstractEvent
* A MediaEvent that's emitted after a media item stops playback.
* Inheritance: MediaStopEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface InputChangeEvent extends AbstractInteractiveEvent {
export interface MediaStopEvent extends AbstractMediaEvent {
/**
* Typescript discriminator
*/
readonly _type: 'InputChangeEvent';
readonly _type: 'MediaStopEvent';
}

@@ -8,3 +8,3 @@ /*

/**
* Global context containing the origin (application id) of the event
* A GlobalContext describing in which app the event happens, like a website or iOS app.
* Inheritance: ApplicationContext -> AbstractGlobalContext -> AbstractContext

@@ -20,18 +20,2 @@ */

/**
* Generic global context to encapsulate any errors
* Inheritance: ErrorContext -> AbstractGlobalContext -> AbstractContext
*/
export interface ErrorContext extends AbstractGlobalContext {
/**
* Typescript discriminator
*/
readonly _type: 'ErrorContext';
/**
* Error message
*/
message: string;
}
/**
* Global context with information needed to reconstruct a user session.

@@ -53,19 +37,3 @@ * Inheritance: CookieIdContext -> AbstractGlobalContext -> AbstractContext

/**
* Context with meta info pertaining to the current session.
* Inheritance: SessionContext -> AbstractGlobalContext -> AbstractContext
*/
export interface SessionContext extends AbstractGlobalContext {
/**
* Typescript discriminator
*/
readonly _type: 'SessionContext';
/**
* Hit counter relative to the current session, this event originated in.
*/
hit_number: number;
}
/**
* Global context with meta information about the agent that sent the event.
* A GlobalContext describing meta information about the agent that sent the event.
* Inheritance: HttpContext -> AbstractGlobalContext -> AbstractContext

@@ -94,1 +62,28 @@ */

}
/**
* A GlobalContext describing the path where the user is when an event is sent.
* Inheritance: PathContext -> AbstractGlobalContext -> AbstractContext
*/
export interface PathContext extends AbstractGlobalContext {
/**
* Typescript discriminator
*/
readonly _type: 'PathContext';
}
/**
* A GlobalContext describing meta information about the current session.
* Inheritance: SessionContext -> AbstractGlobalContext -> AbstractContext
*/
export interface SessionContext extends AbstractGlobalContext {
/**
* Typescript discriminator
*/
readonly _type: 'SessionContext';
/**
* Hit counter relative to the current session, this event originated in.
*/
hit_number: number;
}

@@ -5,153 +5,108 @@ /*

import { AbstractSectionContext, AbstractItemContext, AbstractActionContext } from './abstracts';
import { AbstractLocationContext, AbstractPressableContext } from './abstracts';
/**
* SectionContexts are special LocationContexts representing a logical area of the UI or the system.
* They can be often reasoned about as being containers of other LocationContexts but not the direct targets of
* Events.
* Inheritance: SectionContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* A Location Context that describes an element that accepts user input, i.e. a form field.
* Inheritance: InputContext -> AbstractLocationContext -> AbstractContext
*/
export interface SectionContext extends AbstractSectionContext {
export interface InputContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'SectionContext';
readonly _type: 'InputContext';
}
/**
* global context about a web document. Should at least contain the current URL.
* Inheritance: WebDocumentContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* An Location Context that describes an interactive element (like a link, button, icon),
* that the user can press and will trigger an Interactive Event.
* Inheritance: PressableContext -> AbstractPressableContext -> AbstractLocationContext -> AbstractContext
*/
export interface WebDocumentContext extends AbstractSectionContext {
export interface PressableContext extends AbstractPressableContext {
/**
* Typescript discriminator
*/
readonly _type: 'WebDocumentContext';
/**
* Property containing a (valid) URL
*/
url: string;
readonly _type: 'PressableContext';
}
/**
* SectionContext for a screen
* Inheritance: ScreenContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* A PressableContext that contains an href.
* Inheritance: LinkContext -> AbstractPressableContext -> AbstractLocationContext -> AbstractContext
*/
export interface ScreenContext extends AbstractSectionContext {
export interface LinkContext extends AbstractPressableContext {
/**
* Typescript discriminator
*/
readonly _type: 'ScreenContext';
readonly _type: 'LinkContext';
/**
* name of the screen
* URL (href) the link points to.
*/
screen: string;
href: string;
}
/**
* A `SectionContext` that is expandable.
* Inheritance: ExpandableSectionContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* A Location Context that uniquely represents the top-level UI location of the user.
* Inheritance: RootLocationContext -> AbstractLocationContext -> AbstractContext
*/
export interface ExpandableSectionContext extends AbstractSectionContext {
export interface RootLocationContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'ExpandableSectionContext';
readonly _type: 'RootLocationContext';
}
/**
* A `SectionContext` containing a media player.
* Inheritance: MediaPlayerContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* A Location Context that describes a section of the UI that can expand & collapse.
* Inheritance: ExpandableContext -> AbstractLocationContext -> AbstractContext
*/
export interface MediaPlayerContext extends AbstractSectionContext {
export interface ExpandableContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'MediaPlayerContext';
readonly _type: 'ExpandableContext';
}
/**
* A `SectionContext` containing navigational elements, for example a menu.
* Inheritance: NavigationContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* A Location Context that describes a section of the UI containing a media player.
* Inheritance: MediaPlayerContext -> AbstractLocationContext -> AbstractContext
*/
export interface NavigationContext extends AbstractSectionContext {
export interface MediaPlayerContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'NavigationContext';
readonly _type: 'MediaPlayerContext';
}
/**
* A `SectionContext` that is an overlay
* Inheritance: OverlayContext -> AbstractSectionContext -> AbstractLocationContext -> AbstractContext
* A Location Context that describes a section of the UI containing navigational elements, for example a menu.
* Inheritance: NavigationContext -> AbstractLocationContext -> AbstractContext
*/
export interface OverlayContext extends AbstractSectionContext {
export interface NavigationContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'OverlayContext';
readonly _type: 'NavigationContext';
}
/**
* ItemContexts are special LocationContexts representing interactive elements of the UI or targets in a system.
* These elements may trigger both Interactive and Non-Interactive Events. Eg. an Input field or a Button.
* Inheritance: ItemContext -> AbstractItemContext -> AbstractLocationContext -> AbstractContext
* A Location Context that describes a section of the UI that represents an overlay, i.e. a Modal.
* .
* Inheritance: OverlayContext -> AbstractLocationContext -> AbstractContext
*/
export interface ItemContext extends AbstractItemContext {
export interface OverlayContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'ItemContext';
readonly _type: 'OverlayContext';
}
/**
* A location context, representing user input. For example, a form field, like input.
* Inheritance: InputContext -> AbstractItemContext -> AbstractLocationContext -> AbstractContext
* A Location Context that describes a logical section of the UI that contains other Location Contexts. Enabling Data Science to analyze this section specifically.
* Inheritance: ContentContext -> AbstractLocationContext -> AbstractContext
*/
export interface InputContext extends AbstractItemContext {
export interface ContentContext extends AbstractLocationContext {
/**
* Typescript discriminator
*/
readonly _type: 'InputContext';
readonly _type: 'ContentContext';
}
/**
* ActionContexts are a more specific version of ItemContext specifically meant to describe actionable Items.
* These represent interactive elements that will trigger an Interactive Event. Eg. A Button or Link.
* Inheritance: ActionContext -> AbstractActionContext -> AbstractItemContext -> AbstractLocationContext -> AbstractContext
*/
export interface ActionContext extends AbstractActionContext {
/**
* Typescript discriminator
*/
readonly _type: 'ActionContext';
}
/**
* interactive element, representing a button.
* Inheritance: ButtonContext -> AbstractActionContext -> AbstractItemContext -> AbstractLocationContext -> AbstractContext
*/
export interface ButtonContext extends AbstractActionContext {
/**
* Typescript discriminator
*/
readonly _type: 'ButtonContext';
}
/**
* interactive element, representing a (hyper) link.
* Inheritance: LinkContext -> AbstractActionContext -> AbstractItemContext -> AbstractLocationContext -> AbstractContext
*/
export interface LinkContext extends AbstractActionContext {
/**
* Typescript discriminator
*/
readonly _type: 'LinkContext';
/**
* URL (href) the link points to
*/
href: string;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc