@jitsu/protocols 1.3.1-canary.301.20231020113455 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analytics.d.ts +6 -1
- package/errors.d.ts +0 -0
- package/functions.d.ts +38 -17
- package/package.json +1 -1
package/analytics.d.ts
CHANGED
|
@@ -152,7 +152,12 @@ interface AnalyticsContext {
|
|
|
152
152
|
*/
|
|
153
153
|
clientIds?: {
|
|
154
154
|
//Client ID of GA4 property
|
|
155
|
-
ga4?: string;
|
|
155
|
+
//ga4?: string;
|
|
156
|
+
|
|
157
|
+
//from cookies: _fbc - Facebook click ID, _fbp - Facebook browser ID.
|
|
158
|
+
//see https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters
|
|
159
|
+
fbc?: string;
|
|
160
|
+
fbp?: string;
|
|
156
161
|
[key: string]: string;
|
|
157
162
|
};
|
|
158
163
|
|
package/errors.d.ts
ADDED
|
File without changes
|
package/functions.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AnalyticsServerEvent } from "./analytics";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Store set options: ttl in seconds or string representation of duration (e.g. "1d")
|
|
5
|
+
*/
|
|
6
|
+
export type SetOpts = number | string | { ttl: number };
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* A key value store that exposed to a function
|
|
@@ -9,6 +12,7 @@ export interface Store {
|
|
|
9
12
|
get(key: string): Promise<any>;
|
|
10
13
|
del(key: string): Promise<void>;
|
|
11
14
|
set(key: string, value: any, opts?: SetOpts): Promise<void>;
|
|
15
|
+
ttl(key: string): Promise<number>;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
/**
|
|
@@ -77,15 +81,6 @@ export type AnonymousEventsStore = {
|
|
|
77
81
|
evictEvents(collectionName: string, anonymousId: string): Promise<AnalyticsServerEvent[]>;
|
|
78
82
|
};
|
|
79
83
|
|
|
80
|
-
/**
|
|
81
|
-
* Function execution context available for builin functions only
|
|
82
|
-
*/
|
|
83
|
-
export type SystemContext = {
|
|
84
|
-
$system: {
|
|
85
|
-
anonymousEventsStore: AnonymousEventsStore;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
|
|
89
84
|
export type WithConfidence<T> = T & {
|
|
90
85
|
//A value from 0-100 indicating how confident we are in the result
|
|
91
86
|
confidence?: number;
|
|
@@ -154,11 +149,40 @@ export type Geo = {
|
|
|
154
149
|
};
|
|
155
150
|
};
|
|
156
151
|
|
|
152
|
+
export type UserAgent = {
|
|
153
|
+
browser: {
|
|
154
|
+
name: string;
|
|
155
|
+
version: string;
|
|
156
|
+
major: string; //@deprecated
|
|
157
|
+
};
|
|
158
|
+
engine: {
|
|
159
|
+
name: string;
|
|
160
|
+
version: string;
|
|
161
|
+
};
|
|
162
|
+
os: {
|
|
163
|
+
name: string;
|
|
164
|
+
version: string;
|
|
165
|
+
};
|
|
166
|
+
device: {
|
|
167
|
+
model: string;
|
|
168
|
+
type: "console" | "mobile" | "tablet" | "smarttv" | "wearable" | "embedded" | "desktop";
|
|
169
|
+
vendor: string;
|
|
170
|
+
};
|
|
171
|
+
cpu: {
|
|
172
|
+
architecture: string;
|
|
173
|
+
};
|
|
174
|
+
bot?: boolean;
|
|
175
|
+
};
|
|
176
|
+
|
|
157
177
|
export type EventContext = {
|
|
158
178
|
/**
|
|
159
179
|
* Geo data of incoming request
|
|
160
180
|
*/
|
|
161
181
|
geo?: Geo;
|
|
182
|
+
/**
|
|
183
|
+
* Parsed User Agent of incoming request
|
|
184
|
+
*/
|
|
185
|
+
ua?: UserAgent;
|
|
162
186
|
/**
|
|
163
187
|
* Headers of incoming request
|
|
164
188
|
*/
|
|
@@ -166,18 +190,18 @@ export type EventContext = {
|
|
|
166
190
|
/**
|
|
167
191
|
* Source of the incoming event
|
|
168
192
|
*/
|
|
169
|
-
source
|
|
193
|
+
source: {
|
|
170
194
|
id: string;
|
|
171
195
|
name?: string;
|
|
172
196
|
domain?: string;
|
|
173
197
|
};
|
|
174
|
-
destination
|
|
198
|
+
destination: {
|
|
175
199
|
id: string;
|
|
176
200
|
type: string;
|
|
177
201
|
updatedAt: Date;
|
|
178
202
|
hash: string;
|
|
179
203
|
};
|
|
180
|
-
connection
|
|
204
|
+
connection: {
|
|
181
205
|
id: string;
|
|
182
206
|
mode?: string;
|
|
183
207
|
options?: any;
|
|
@@ -193,10 +217,7 @@ export type FunctionConfigContext<P extends AnyProps = AnyProps> = {
|
|
|
193
217
|
/**
|
|
194
218
|
* Parameters for a function
|
|
195
219
|
*/
|
|
196
|
-
export type FullContext<P extends AnyProps = AnyProps> = EventContext &
|
|
197
|
-
FunctionContext &
|
|
198
|
-
FunctionConfigContext<P> &
|
|
199
|
-
(SystemContext | {});
|
|
220
|
+
export type FullContext<P extends AnyProps = AnyProps> = EventContext & FunctionContext & FunctionConfigContext<P>;
|
|
200
221
|
|
|
201
222
|
//equivalent to returning [] from a function
|
|
202
223
|
export type FunctionCommand = "drop";
|