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

@objectiv/schema

Package Overview
Dependencies
Maintainers
2
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.26 to 0.0.27-experimental.0

src/generated/contexts.ts

8

package.json
{
"name": "@objectiv/schema",
"version": "0.0.26",
"version": "0.0.27-experimental.0",
"description": "Objectiv TypeScript implementation of the open analytics taxonomy",

@@ -37,8 +37,14 @@ "license": "Apache-2.0",

"tsc": "tsc --noEmit",
"test": "jest --silent",
"test:ci": "jest --silent --ci",
"test:coverage": "jest --silent --coverage",
"depcheck": "npx depcheck"
},
"devDependencies": {
"@objectiv/testing-tools": "^0.0.27-experimental.0",
"jest": "^28.1.3",
"prettier": "^2.7.1",
"ts-jest": "^28.0.7",
"typescript": "^4.7.4"
}
}

154

src/generated/abstracts.ts

@@ -6,64 +6,107 @@ /*

/**
* This is the abstract parent of all Events.
* Inheritance: AbstractEvent
* AbstractContext defines the bare minimum properties for every Context. All Contexts inherit from it.
*/
export interface AbstractEvent {
export interface AbstractContext {
/**
* The location stack is an ordered list (stack), that contains a hierarchy of location contexts that
*deterministically describes where an event took place from global to specific.
*The whole stack (list) is needed to exactly pinpoint where in the UI the event originated.
* An internal unique identifier used to compare instances with the same _type & id.
*/
location_stack: AbstractLocationContext[];
__instance_id: string;
/**
* Global contexts add global / general information about the event. They carry information that is not
*related to where the Event originated (location), such as device, platform or business data.
* An ordered list of the parents of this Context, itself included as the last element.
*/
global_contexts: AbstractGlobalContext[];
_types: Array<string>;
/**
* String containing the name of the event type. (eg. ClickEvent).
* A unique string identifier to be combined with the Context Type (`_type`)
* for Context instance uniqueness.
*/
_type: string;
/**
* Unique identifier for a specific instance of an event. Typically UUID's are a good way of
*implementing this. On the collector side, events should be unique, this means duplicate id's result
*in `not ok` events.
*/
id: string;
/**
* Timestamp indicating when the event was generated.
* A string literal used during serialization. Hardcoded to the Context name.
*/
time: number;
_type:
| 'AbstractGlobalContext'
| 'AbstractLocationContext'
| 'ApplicationContext'
| 'CookieIdContext'
| 'HttpContext'
| 'IdentityContext'
| 'InputValueContext'
| 'LocaleContext'
| 'MarketingContext'
| 'PathContext'
| 'SessionContext'
| 'ContentContext'
| 'ExpandableContext'
| 'InputContext'
| 'MediaPlayerContext'
| 'NavigationContext'
| 'OverlayContext'
| 'PressableContext'
| 'RootLocationContext'
| 'LinkContext';
}
/**
* AbstractContext defines the bare minimum properties for every Context. All Contexts inherit from it.
* Inheritance: AbstractContext
* The abstract parent of all Events.
*/
export interface AbstractContext {
export interface AbstractEvent {
/**
* A unique identifier to discriminate Context instances across Location Stacks.
* An internal unique identifier used to compare instances with the same _type & id.
*/
__instance_id: string;
/**
* A unique string identifier to be combined with the Context Type (`_type`)
*for Context instance uniqueness.
* The version of the Objectiv Taxonomy Schema used to generate this event.
*/
_schema_version?: string;
/**
* An ordered list of the parents of this Event, itself included as the last element.
*/
_types: Array<string>;
/**
* The LocationStack is an ordered list (a stack) containing a hierarchy of LocationContexts, which
* deterministically describes where in the UI of an application an Event took place.
*/
location_stack: Array<AbstractLocationContext>;
/**
* GlobalContexts add global/general information about the state in which an Event happened, such as a
* user's identity and marketing information. They do not carry information related to where the Event
* originated (location), which instead is captured by the LocationStack.
*/
global_contexts: Array<AbstractGlobalContext>;
/**
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type:
| 'InteractiveEvent'
| 'NonInteractiveEvent'
| 'InputChangeEvent'
| 'PressEvent'
| 'ApplicationLoadedEvent'
| 'FailureEvent'
| 'HiddenEvent'
| 'MediaEvent'
| 'SuccessEvent'
| 'VisibleEvent'
| 'MediaLoadEvent'
| 'MediaPauseEvent'
| 'MediaStartEvent'
| 'MediaStopEvent';
/**
* Unique identifier for a specific instance of an event.
*/
id: string;
/**
* A string literal used during serialization. Should always match the Context interface name.
* Timestamp indicating when the event was generated.
*/
_type: string;
time: number;
}
/**
* This is the abstract parent of all Global Contexts. Global contexts add general information to an Event.
* Inheritance: AbstractGlobalContext -> AbstractContext
* The abstract parent of all Global Contexts. Global Contexts capture general data about the state in
* which an Event happened, such as user's identity & marketing information.
*/
export interface AbstractGlobalContext extends AbstractContext {
/**
* An internal discriminator relating entities of the same hierarchical branch.
*/
__global_context: true;

@@ -73,40 +116,11 @@ }

/**
* 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
* The abstract parent of all Location Contexts. Location Contexts describe the exact position in an
* application's UI from where an Event was triggered. A location stack is composed of a hierarchical
* stack of LocationContexts; the order defines the hierarchy.
*/
export interface AbstractLocationContext extends AbstractContext {
/**
* An internal discriminator relating entities of the same hierarchical branch.
*/
__location_context: true;
}
/**
*
* Inheritance: AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface AbstractNonInteractiveEvent extends AbstractEvent {
__non_interactive_event: true;
}
/**
*
* Inheritance: AbstractInteractiveEvent -> AbstractEvent
*/
export interface AbstractInteractiveEvent extends AbstractEvent {
__interactive_event: true;
}
/**
*
* Inheritance: AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface AbstractMediaEvent extends AbstractNonInteractiveEvent {
__media_event: true;
}
/**
*
* Inheritance: AbstractPressableContext -> AbstractLocationContext -> AbstractContext
*/
export interface AbstractPressableContext extends AbstractLocationContext {
__pressable_context: true;
}

@@ -5,52 +5,36 @@ /*

import { AbstractInteractiveEvent, AbstractNonInteractiveEvent, AbstractMediaEvent } from './abstracts';
import { AbstractEvent } from './abstracts';
/**
* The parent of Events that are the direct result of a user interaction, e.g. a button click.
* Inheritance: InteractiveEvent -> AbstractInteractiveEvent -> AbstractEvent
* A NonInteractive event that is emitted after an application (e.g. SPA) has finished loading.
*/
export interface InteractiveEvent extends AbstractInteractiveEvent {
export interface ApplicationLoadedEvent extends NonInteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'InteractiveEvent';
_type: 'ApplicationLoadedEvent';
}
/**
* The parent of Events that are not directly triggered by a user action.
* Inheritance: NonInteractiveEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that is sent when a user action results in an error,
* like an invalid email when sending a form.
*/
export interface NonInteractiveEvent extends AbstractNonInteractiveEvent {
export interface FailureEvent extends NonInteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'NonInteractiveEvent';
}
/**
* A NonInteractive event that is emitted after an application (eg. SPA) has finished loading.
* Inheritance: ApplicationLoadedEvent -> AbstractNonInteractiveEvent -> AbstractEvent
*/
export interface ApplicationLoadedEvent extends AbstractNonInteractiveEvent {
_type: 'FailureEvent';
/**
* Typescript discriminator
* Failure message.
*/
_type: 'ApplicationLoadedEvent';
message: string;
}
/**
* 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
* A NonInteractiveEvent that's emitted after a LocationContext has become invisible.
*/
export interface FailureEvent extends AbstractNonInteractiveEvent {
export interface HiddenEvent extends NonInteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'FailureEvent';
/**
* Failure message.
*/
message: string;
_type: 'HiddenEvent';
}

@@ -60,7 +44,6 @@

* Event triggered when user input is modified.
* Inheritance: InputChangeEvent -> AbstractInteractiveEvent -> AbstractEvent
*/
export interface InputChangeEvent extends AbstractInteractiveEvent {
export interface InputChangeEvent extends InteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/

@@ -71,106 +54,129 @@ _type: 'InputChangeEvent';

/**
* An InteractiveEvent that is sent when a user presses on a pressable element
* (like a link, button, icon).
* Inheritance: PressEvent -> AbstractInteractiveEvent -> AbstractEvent
* The parent of Events that are the direct result of a user interaction, e.g. a button click.
*/
export interface PressEvent extends AbstractInteractiveEvent {
export interface InteractiveEvent extends AbstractEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'PressEvent';
_type: 'InteractiveEvent' | 'InputChangeEvent' | 'PressEvent';
/**
* An internal discriminator relating entities of the same hierarchical branch.
*/
__interactive_event: true;
}
/**
* A NonInteractiveEvent that's emitted after a LocationContext has become invisible.
* Inheritance: HiddenEvent -> 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.
*/
export interface HiddenEvent extends AbstractNonInteractiveEvent {
export interface MediaEvent extends NonInteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'HiddenEvent';
_type: 'MediaEvent' | 'MediaLoadEvent' | 'MediaPauseEvent' | 'MediaStartEvent' | 'MediaStopEvent';
/**
* An internal discriminator relating entities of the same hierarchical branch.
*/
__media_event: true;
}
/**
* A NonInteractiveEvent that's emitted after a section LocationContext has become visible.
* Inheritance: VisibleEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A MediaEvent that's emitted after a media item completes loading.
*/
export interface VisibleEvent extends AbstractNonInteractiveEvent {
export interface MediaLoadEvent extends MediaEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'VisibleEvent';
_type: 'MediaLoadEvent';
}
/**
* A NonInteractiveEvent that is sent when a user action is successfully completed,
* like sending an email form.
* Inheritance: SuccessEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A MediaEvent that's emitted after a media item pauses playback.
*/
export interface SuccessEvent extends AbstractNonInteractiveEvent {
export interface MediaPauseEvent extends MediaEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'SuccessEvent';
_type: 'MediaPauseEvent';
}
/**
* A MediaEvent that's emitted after a media item starts playback.
*/
export interface MediaStartEvent extends MediaEvent {
/**
* Success message.
* A string literal used during serialization. Hardcoded to the Event name.
*/
message: string;
_type: 'MediaStartEvent';
}
/**
* 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
* A MediaEvent that's emitted after a media item stops playback.
*/
export interface MediaEvent extends AbstractMediaEvent {
export interface MediaStopEvent extends MediaEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'MediaEvent';
_type: 'MediaStopEvent';
}
/**
* A MediaEvent that's emitted after a media item completes loading.
* Inheritance: MediaLoadEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* The parent of Events that are not directly triggered by a user action.
*/
export interface MediaLoadEvent extends AbstractMediaEvent {
export interface NonInteractiveEvent extends AbstractEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'MediaLoadEvent';
_type:
| 'NonInteractiveEvent'
| 'ApplicationLoadedEvent'
| 'FailureEvent'
| 'HiddenEvent'
| 'MediaEvent'
| 'SuccessEvent'
| 'VisibleEvent'
| 'MediaLoadEvent'
| 'MediaPauseEvent'
| 'MediaStartEvent'
| 'MediaStopEvent';
/**
* An internal discriminator relating entities of the same hierarchical branch.
*/
__non_interactive_event: true;
}
/**
* A MediaEvent that's emitted after a media item pauses playback.
* Inheritance: MediaPauseEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* An InteractiveEvent that is sent when a user presses on a pressable element
* (like a link, button, icon).
*/
export interface MediaPauseEvent extends AbstractMediaEvent {
export interface PressEvent extends InteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'MediaPauseEvent';
_type: 'PressEvent';
}
/**
* A MediaEvent that's emitted after a media item starts playback.
* Inheritance: MediaStartEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that is sent when a user action is successfully completed,
* like sending an email form.
*/
export interface MediaStartEvent extends AbstractMediaEvent {
export interface SuccessEvent extends NonInteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'MediaStartEvent';
_type: 'SuccessEvent';
/**
* Success message.
*/
message: string;
}
/**
* A MediaEvent that's emitted after a media item stops playback.
* Inheritance: MediaStopEvent -> AbstractMediaEvent -> AbstractNonInteractiveEvent -> AbstractEvent
* A NonInteractiveEvent that's emitted after a section LocationContext has become visible.
*/
export interface MediaStopEvent extends AbstractMediaEvent {
export interface VisibleEvent extends NonInteractiveEvent {
/**
* Typescript discriminator
* A string literal used during serialization. Hardcoded to the Event name.
*/
_type: 'MediaStopEvent';
_type: 'VisibleEvent';
}

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

export * from './abstracts';
export * from './contexts';
export * from './discriminators';
export * from './events';
export * from './global_contexts';
export * from './location_contexts';
export * from './factories';
export * from './names';
export * from './types';

@@ -7,1 +7,2 @@ /*

export * from './static';
export * from './uuidv4';
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