@jitsu/protocols 1.9.0-canary.583.20240115215752 → 1.9.1-canary.777.20240418125312

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 CHANGED
@@ -222,6 +222,9 @@ interface AnalyticsContext {
222
222
  clientId: string;
223
223
  sessionIds?: any;
224
224
  };
225
+ firebase?: {
226
+ appInstanceId: string;
227
+ };
225
228
  //from cookies: _fbc - Facebook click ID, _fbp - Facebook browser ID.
226
229
  //see https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters
227
230
  fbc?: string;
package/functions.d.ts CHANGED
@@ -37,12 +37,6 @@ export interface TTLStore extends Store {
37
37
  getWithTTL(key: string): Promise<{ value: any; ttl: number } | undefined>;
38
38
  }
39
39
 
40
- /**
41
- * Store for incoming events, destination results and function log messages
42
- */
43
- export interface EventsStore {
44
- log(connectionId: string, error: boolean, msg: Record<string, any>): void;
45
- }
46
40
  /**
47
41
  * A special properties that user can set on an event to define how
48
42
  * event will be processed further
@@ -59,23 +53,23 @@ export type AnyProps = Record<string, any>;
59
53
 
60
54
  export type FetchResponse = Response;
61
55
 
62
- export type FetchType = (url: string, opts?: FetchOpts, logToRedis?: boolean) => Promise<FetchResponse>;
56
+ export type FetchType = (url: string, opts?: FetchOpts, extras?: any) => Promise<FetchResponse>;
63
57
 
64
58
  export type FetchOpts = {
65
59
  method?: string;
66
60
  headers?: Record<string, string>;
67
- body?: string;
61
+ body?: string | Buffer;
68
62
  };
69
- export type FunctionLogger = {
70
- info: (message: string, ...args: any[]) => void;
71
- warn: (message: string, ...args: any[]) => void;
72
- debug: (message: string, ...args: any[]) => void;
73
- error: (message: string, ...args: any[]) => void;
63
+ export type FunctionLogger<Sync extends boolean = false> = {
64
+ info: (message: string, ...args: any[]) => void | Promise<void>;
65
+ warn: (message: string, ...args: any[]) => void | Promise<void>;
66
+ debug: (message: string, ...args: any[]) => void | Promise<void>;
67
+ error: (message: string, ...args: any[]) => void | Promise<void>;
74
68
  };
75
69
  export type FunctionContext = {
76
70
  log: FunctionLogger;
77
71
  fetch: FetchType;
78
- store: Store;
72
+ store: TTLStore;
79
73
  metrics?: Metrics;
80
74
  };
81
75
 
@@ -164,6 +158,9 @@ export type EventContext = {
164
158
  mode?: string;
165
159
  options?: any;
166
160
  };
161
+ workspace: {
162
+ id: string;
163
+ };
167
164
  // number of retries attempted
168
165
  retries?: number;
169
166
  };
@@ -182,6 +179,19 @@ export type FunctionCommand = "drop";
182
179
 
183
180
  export type FuncReturn = AnyEvent[] | AnyEvent | null | undefined | FunctionCommand | false;
184
181
 
182
+ export type SyncFunction<
183
+ Dest extends AnyProps = AnyProps,
184
+ Cred extends AnyProps = AnyProps,
185
+ SyncProps extends AnyProps = AnyProps
186
+ > = (p: {
187
+ source: { package: string; credentials: Cred; syncProps: SyncProps };
188
+ destination: Dest;
189
+ ctx: {
190
+ log: FunctionLogger;
191
+ store: Store;
192
+ };
193
+ }) => Promise<void>;
194
+
185
195
  export interface JitsuFunction<E extends AnyEvent = AnyEvent, P extends AnyProps = AnyProps> {
186
196
  (event: E, ctx: FullContext<P>): Promise<FuncReturn> | FuncReturn;
187
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/protocols",
3
- "version": "1.9.0-canary.583.20240115215752",
3
+ "version": "1.9.1-canary.777.20240418125312",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "publishConfig": {