@jitsu/protocols 1.9.9-canary.990.20241015090416 → 1.9.10
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/functions.d.ts +3 -6
- package/package.json +1 -1
- package/profile.d.ts +18 -9
package/functions.d.ts
CHANGED
|
@@ -66,11 +66,12 @@ export type FunctionLogger<Sync extends boolean = false> = {
|
|
|
66
66
|
debug: (message: string, ...args: any[]) => void | Promise<void>;
|
|
67
67
|
error: (message: string, ...args: any[]) => void | Promise<void>;
|
|
68
68
|
};
|
|
69
|
-
export type FunctionContext = {
|
|
69
|
+
export type FunctionContext<P extends AnyProps = AnyProps> = {
|
|
70
70
|
log: FunctionLogger;
|
|
71
71
|
fetch: FetchType;
|
|
72
72
|
store: TTLStore;
|
|
73
73
|
metrics?: Metrics;
|
|
74
|
+
props: P;
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
export type PrivacyOpts = {
|
|
@@ -165,14 +166,10 @@ export type EventContext = {
|
|
|
165
166
|
retries?: number;
|
|
166
167
|
};
|
|
167
168
|
|
|
168
|
-
export type FunctionConfigContext<P extends AnyProps = AnyProps> = {
|
|
169
|
-
props: P;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
169
|
/**
|
|
173
170
|
* Parameters for a function
|
|
174
171
|
*/
|
|
175
|
-
export type FullContext<P extends AnyProps = AnyProps> = EventContext & FunctionContext
|
|
172
|
+
export type FullContext<P extends AnyProps = AnyProps> = EventContext & FunctionContext<P>;
|
|
176
173
|
|
|
177
174
|
//equivalent to returning [] from a function
|
|
178
175
|
export type FunctionCommand = "drop";
|
package/package.json
CHANGED
package/profile.d.ts
CHANGED
|
@@ -2,15 +2,24 @@ import { FunctionContext } from "./functions";
|
|
|
2
2
|
import { AnalyticsServerEvent } from "./analytics";
|
|
3
3
|
|
|
4
4
|
export type ProfileResult = {
|
|
5
|
-
|
|
5
|
+
traits: Record<string, any>;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export type ProfileUser = {
|
|
9
|
+
id?: string;
|
|
10
|
+
anonymousId?: string;
|
|
11
|
+
traits: Record<string, any>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ProfileBuilderContext = {
|
|
15
|
+
profileBuilder: {
|
|
16
|
+
id: string;
|
|
17
|
+
version: number;
|
|
15
18
|
};
|
|
16
|
-
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ProfileFunction = (
|
|
22
|
+
events: Iterable<AnalyticsServerEvent>,
|
|
23
|
+
user: ProfileUser,
|
|
24
|
+
context: FunctionContext & ProfileBuilderContext
|
|
25
|
+
) => Promise<ProfileResult | undefined>;
|