@jitsu/jitsu-types
Advanced tools
Comparing version 0.0.3 to 0.0.7
{ | ||
"name": "@jitsu/jitsu-types", | ||
"version": "0.0.3", | ||
"version": "0.0.7", | ||
"main": "build/index.js", | ||
@@ -10,3 +10,4 @@ "scripts": { | ||
"@types/jest": "^27.0.3" | ||
} | ||
}, | ||
"gitHead": "2de279a04e34505caa6427869ba1074e3ece44e4" | ||
} |
@@ -1,3 +0,3 @@ | ||
import {JitsuEvent} from "./event"; | ||
import {ConfigurationParameter} from "./parameters"; | ||
import { JitsuEvent } from "./event" | ||
import { ConfigurationParameter } from "./parameters" | ||
@@ -9,48 +9,50 @@ /** | ||
export declare type JitsuContext = { | ||
/** | ||
* Unique Id of configured destination instance on Jitsu server | ||
*/ | ||
destinationId: string | ||
/** | ||
* Destination type id | ||
*/ | ||
destinationType: string | ||
/** | ||
* Values set for <b>configurationParameters</b> during destination instance setup | ||
*/ | ||
[key: string]: any | ||
/** | ||
* Unique Id of configured destination instance on Jitsu server | ||
*/ | ||
destinationId: string | ||
/** | ||
* Destination type id | ||
*/ | ||
destinationType: string | ||
/** | ||
* Values set for <b>configurationParameters</b> during destination instance setup | ||
*/ | ||
[key: string]: any | ||
} | ||
export declare type DestinationMessage = { | ||
url: string | ||
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | ||
headers?: {[key: string]: string} | ||
body: any | ||
url: string | ||
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | ||
headers?: { [key: string]: string } | ||
body: any | ||
} | ||
export declare type DestinationAdapter = (event: JitsuEvent, context: JitsuContext, ...extraArgs: any[]) => DestinationMessage[] | DestinationMessage | null; | ||
export declare type DestinationAdapter = ( | ||
event: JitsuEvent, | ||
context: JitsuContext, | ||
...extraArgs: any[] | ||
) => DestinationMessage[] | DestinationMessage | null | ||
export declare type DestinationDescriptor = { | ||
/** | ||
* Destination type id | ||
*/ | ||
type: string | ||
/** | ||
* Destination display name | ||
*/ | ||
displayName: string | ||
/** | ||
* Description. Can contain HTML | ||
*/ | ||
description: string | ||
/** | ||
* Can be either URL to PNG or SVG image or HTML string containing SVG | ||
*/ | ||
icon?: string | ||
/** | ||
* List of configuration parameters | ||
*/ | ||
configurationParameters: ConfigurationParameter[] | ||
} | ||
/** | ||
* Destination type id | ||
*/ | ||
type: string | ||
/** | ||
* Destination display name | ||
*/ | ||
displayName: string | ||
/** | ||
* Description. Can contain HTML | ||
*/ | ||
description: string | ||
/** | ||
* Can be either URL to PNG or SVG image or HTML string containing SVG | ||
*/ | ||
icon?: string | ||
/** | ||
* List of configuration parameters | ||
*/ | ||
configurationParameters: ConfigurationParameter[] | ||
} |
@@ -5,6 +5,6 @@ /** | ||
export interface UserProperties { | ||
anonymous_id?: string //anonymous is (cookie or ls based), | ||
id?: string //user id (non anonymous). If not set, first known id (from propName below) will be used | ||
email?: string //user email | ||
[propName: string]: any //any other forms of ids | ||
anonymous_id?: string //anonymous is (cookie or ls based), | ||
id?: string //user id (non anonymous). If not set, first known id (from propName below) will be used | ||
email?: string //user email | ||
[propName: string]: any //any other forms of ids | ||
} | ||
@@ -16,7 +16,7 @@ | ||
export interface Location { | ||
country?: string | ||
region?: string | ||
city?: string | ||
latitude?: number | ||
longitude?: number | ||
country?: string | ||
region?: string | ||
city?: string | ||
latitude?: number | ||
longitude?: number | ||
} | ||
@@ -28,10 +28,10 @@ | ||
export interface UserAgent { | ||
ua_family?: string | ||
ua_version?: string | ||
os_family?: string | ||
os_version?: string | ||
device_family?: string | ||
device_brand?: string | ||
device_model?: string | ||
bot?: boolean | ||
ua_family?: string | ||
ua_version?: string | ||
os_family?: string | ||
os_version?: string | ||
device_family?: string | ||
device_brand?: string | ||
device_model?: string | ||
bot?: boolean | ||
} | ||
@@ -43,16 +43,16 @@ | ||
export type ThirdpartyIds = { | ||
[id: string]: string | ||
[id: string]: string | ||
} | ||
export type Conversion = { | ||
//The purpose of this set is mainly to mimic GA's set of parameters | ||
//(see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters) | ||
//The purpose of this set is mainly to mimic GA's set of parameters | ||
//(see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters) | ||
transaction_id?: string | number //id of transaction | ||
affiliation?: string | number //affiliation id | ||
revenue?: number //revenue | ||
currency?: string //currency | ||
shipping_cost?: number //shipping cost | ||
tax?: number //tax cost | ||
[propName: string]: any | ||
transaction_id?: string | number //id of transaction | ||
affiliation?: string | number //affiliation id | ||
revenue?: number //revenue | ||
currency?: string //currency | ||
shipping_cost?: number //shipping cost | ||
tax?: number //tax cost | ||
[propName: string]: any | ||
} | ||
@@ -64,36 +64,36 @@ | ||
export type JitsuEvent = { | ||
event_type: string //event type | ||
source_ip?: string //IP address. Do not set this field on a client side, it will be rewritten on the server | ||
anon_ip?: string //First 3 octets of an IP address. Same as IP - will be set on a server | ||
api_key?: string //JS api key | ||
src?: string //Event source | ||
event_type: string //event type | ||
source_ip?: string //IP address. Do not set this field on a client side, it will be rewritten on the server | ||
anon_ip?: string //First 3 octets of an IP address. Same as IP - will be set on a server | ||
api_key?: string //JS api key | ||
src?: string //Event source | ||
event_id?: string //unique event id or empty string for generating id on the backend side | ||
user?: UserProperties //user properties | ||
ids?: ThirdpartyIds //user ids from external systems | ||
location?: Location //Location data. Enriched by Jitsu server. | ||
parsed_ua?: UserAgent //UserAgent data. Parsed by Jitsu server | ||
user_agent?: string //user | ||
utc_time?: string //current UTC time in ISO 8601 | ||
local_tz_offset?: number //local timezone offset (in minutes) | ||
referer?: string //document referer | ||
url?: string //current url | ||
page_title?: string //page title | ||
//see UTM_TYPES for all supported utm tags | ||
doc_path?: string //document path | ||
doc_host?: string //document host | ||
doc_search?: string //document search string | ||
screen_resolution?: string //screen resolution | ||
vp_size?: string //viewport size | ||
user_language?: string //user language | ||
event_id?: string //unique event id or empty string for generating id on the backend side | ||
user?: UserProperties //user properties | ||
ids?: ThirdpartyIds //user ids from external systems | ||
location?: Location //Location data. Enriched by Jitsu server. | ||
parsed_ua?: UserAgent //UserAgent data. Parsed by Jitsu server | ||
user_agent?: string //user | ||
utc_time?: string //current UTC time in ISO 8601 | ||
local_tz_offset?: number //local timezone offset (in minutes) | ||
referer?: string //document referer | ||
url?: string //current url | ||
page_title?: string //page title | ||
//see UTM_TYPES for all supported utm tags | ||
doc_path?: string //document path | ||
doc_host?: string //document host | ||
doc_search?: string //document search string | ||
screen_resolution?: string //screen resolution | ||
vp_size?: string //viewport size | ||
user_language?: string //user language | ||
doc_encoding?: string | ||
doc_encoding?: string | ||
utm?: Record<string, string> //utm tags (without utm prefix, e.g key will be "source", not utm_source. See | ||
click_id?: Record<string, string> //all external click ids (passed through URL). See CLICK_IDS for supported all supported click ids | ||
utm?: Record<string, string> //utm tags (without utm prefix, e.g key will be "source", not utm_source. See | ||
click_id?: Record<string, string> //all external click ids (passed through URL). See CLICK_IDS for supported all supported click ids | ||
conversion?: Conversion | ||
src_payload?: any | ||
conversion?: Conversion | ||
src_payload?: any | ||
[propName: string]: any | ||
[propName: string]: any | ||
} |
@@ -1,10 +0,17 @@ | ||
import {JitsuEvent} from "./event"; | ||
import {JitsuContext, DestinationMessage} from "./destination"; | ||
import { JitsuEvent } from "./event" | ||
import { JitsuContext, DestinationMessage } from "./destination" | ||
type DestinatioTestParams = { | ||
name: string | ||
context: JitsuContext | ||
transform: ($: JitsuEvent, context: JitsuContext) => DestinationMessage[] | DestinationMessage | null | ||
event: JitsuEvent | ||
expectedResult: DestinationMessage[] | DestinationMessage | null | ||
} | ||
export function testDestination({name, context, transform, event,expectedResult}:{name: string, context: JitsuContext, transform: ($: JitsuEvent, context: JitsuContext) => DestinationMessage[] | DestinationMessage | null, event: JitsuEvent, expectedResult: DestinationMessage[] | DestinationMessage | null}) { | ||
test(name, () => { | ||
const result = transform(event, context) | ||
expect(result).toEqual(expectedResult); | ||
}) | ||
} | ||
export function testDestination({ name, context, transform, event, expectedResult }: DestinatioTestParams) { | ||
test(name, () => { | ||
const result = transform(event, context) | ||
expect(result).toEqual(expectedResult) | ||
}) | ||
} |
export type ConfigurationParameter = { | ||
/** | ||
* Id (corresponds to key in yaml config) | ||
*/ | ||
id: string | ||
/** | ||
* Type of parameter | ||
*/ | ||
type: "string" | "int" | "json" | "boolean" | "password" | ||
/** | ||
* Display name (for UI) | ||
*/ | ||
displayName: string | ||
/** | ||
* Flag describes required/optional nature of the field. IF empty - field is optional | ||
* Either constant or function of current config | ||
*/ | ||
required: boolean | ||
/** | ||
* Default value (should be displayed by default) | ||
*/ | ||
defaultValue?: any | ||
/** | ||
* Text of documentation hint in UI. Can contain HTML | ||
*/ | ||
documentation?: string | ||
} | ||
/** | ||
* Id (corresponds to key in yaml config) | ||
*/ | ||
id: string | ||
/** | ||
* Type of parameter | ||
*/ | ||
type: "string" | "int" | "json" | "boolean" | "password" | ||
/** | ||
* Display name (for UI) | ||
*/ | ||
displayName: string | ||
/** | ||
* Flag describes required/optional nature of the field. IF empty - field is optional | ||
* Either constant or function of current config | ||
*/ | ||
required: boolean | ||
/** | ||
* Default value (should be displayed by default) | ||
*/ | ||
defaultValue?: any | ||
/** | ||
* Text of documentation hint in UI. Can contain HTML | ||
*/ | ||
documentation?: string | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
6876
0
190
1