@jitsu/js 1.1.2 → 1.2.0

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.
@@ -1,6 +1,6 @@
1
- @jitsu/js:build: cache hit, replaying output 528cebbe5d911d11
1
+ @jitsu/js:build: cache hit, replaying output edacae6711c3e992
2
2
  @jitsu/js:build: 
3
- @jitsu/js:build: > @jitsu/js@0.0.0 build /Users/vklmn/dev2/newjitsu/libs/jitsu-js
3
+ @jitsu/js:build: > @jitsu/js@0.0.0 build /Users/ildarnurislamov/Projects/newjitsu/libs/jitsu-js
4
4
  @jitsu/js:build: > tsc -p . && rollup -c && cp compiled/src/*.d.ts dist
5
5
  @jitsu/js:build: 
6
6
  @jitsu/js:build: 
@@ -20,13 +20,13 @@
20
20
  @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
21
  @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
22
22
  @jitsu/js:build: ...and 1 other occurrence
23
- @jitsu/js:build: compiled/src/destination-plugins/logrocket.js
23
+ @jitsu/js:build: compiled/src/destination-plugins/gtm.js
24
24
  @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25
25
  @jitsu/js:build:  ^
26
26
  @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
27
  @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
28
28
  @jitsu/js:build: ...and 1 other occurrence
29
- @jitsu/js:build: compiled/src/destination-plugins/gtm.js
29
+ @jitsu/js:build: compiled/src/destination-plugins/logrocket.js
30
30
  @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
31
  @jitsu/js:build:  ^
32
32
  @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -47,7 +47,7 @@
47
47
  @jitsu/js:build:  ^
48
48
  @jitsu/js:build: 71: }
49
49
  @jitsu/js:build: 72: catch (e) {
50
- @jitsu/js:build: created dist/web/p.js.txt in 212ms
50
+ @jitsu/js:build: created dist/web/p.js.txt in 221ms
51
51
  @jitsu/js:build: 
52
52
  @jitsu/js:build: ./compiled/src/index.js, ./compiled/src/jitsu.js, ./compiled/src/analytics-plugin.js → dist/jitsu.es.js, dist/jitsu.cjs.js...
53
53
  @jitsu/js:build: (!) "this" has been rewritten to "undefined"
@@ -59,13 +59,13 @@
59
59
  @jitsu/js:build: 3: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60
60
  @jitsu/js:build: 4: return new (P || (P = Promise))(function (resolve, reject) {
61
61
  @jitsu/js:build: ...and 1 other occurrence
62
- @jitsu/js:build: compiled/src/destination-plugins/tag.js
62
+ @jitsu/js:build: compiled/src/destination-plugins/gtm.js
63
63
  @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
64
64
  @jitsu/js:build:  ^
65
65
  @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66
66
  @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
67
67
  @jitsu/js:build: ...and 1 other occurrence
68
- @jitsu/js:build: compiled/src/destination-plugins/gtm.js
68
+ @jitsu/js:build: compiled/src/destination-plugins/tag.js
69
69
  @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
70
70
  @jitsu/js:build:  ^
71
71
  @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -92,4 +92,4 @@
92
92
  @jitsu/js:build:  ^
93
93
  @jitsu/js:build: 71: }
94
94
  @jitsu/js:build: 72: catch (e) {
95
- @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 139ms
95
+ @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 148ms
@@ -1,5 +1,5 @@
1
- @jitsu/js:clean: cache hit, replaying output 87482d9c6faf899c
1
+ @jitsu/js:clean: cache hit, replaying output b68b755cf7d79e69
2
2
  @jitsu/js:clean: 
3
- @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/vklmn/dev2/newjitsu/libs/jitsu-js
3
+ @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/ildarnurislamov/Projects/newjitsu/libs/jitsu-js
4
4
  @jitsu/js:clean: > rm -rf ./dist
5
5
  @jitsu/js:clean: 
package/dist/jitsu.cjs.js CHANGED
@@ -391,10 +391,17 @@ function satisfyDomainFilter(filter, subject) {
391
391
  }
392
392
  function applyFilters(event, creds) {
393
393
  const { hosts = "*", events = "*" } = creds;
394
- const eventsArray = events.split("\n");
395
- return (!!hosts.split("\n").find(hostFilter => { var _a; return satisfyDomainFilter(hostFilter, (_a = event.context) === null || _a === void 0 ? void 0 : _a.host); }) &&
396
- (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
397
- !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event))));
394
+ try {
395
+ const eventsArray = Array.isArray(events) ? events : events.split("\n");
396
+ const hostsArray = Array.isArray(hosts) ? hosts : hosts.split("\n");
397
+ return (!!hostsArray.find(hostFilter => { var _a; return satisfyDomainFilter(hostFilter, (_a = event.context) === null || _a === void 0 ? void 0 : _a.host); }) &&
398
+ (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
399
+ !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event))));
400
+ }
401
+ catch (e) {
402
+ console.warn(`Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}. Values`, events, hosts);
403
+ throw new Error(`Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}`);
404
+ }
398
405
  }
399
406
  const internalDestinationPlugins = {
400
407
  [tagPlugin.id]: tagPlugin,
@@ -506,7 +513,7 @@ const defaultCookie2Key = {
506
513
  const cookieStorage = (cookieDomain, key2cookie) => {
507
514
  return {
508
515
  setItem(key, val) {
509
- const strVal = typeof val === "object" && val !== null ? JSON.stringify(val) : val;
516
+ const strVal = typeof val === "object" && val !== null ? encodeURIComponent(JSON.stringify(val)) : val;
510
517
  const cookieName = key2cookie[key] || key;
511
518
  setCookie(cookieName, strVal, {
512
519
  domain: cookieDomain,
@@ -661,7 +668,7 @@ function adjustPayload(payload, config, storage) {
661
668
  },
662
669
  campaign: parseUtms(query),
663
670
  };
664
- const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)), writeKey: validateWriteKey(config.writeKey), context: deepMerge(context, customContext) });
671
+ const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)), writeKey: maskWriteKey(config.writeKey), context: deepMerge(context, customContext) });
665
672
  delete withContext.meta;
666
673
  delete withContext.options;
667
674
  return withContext;
@@ -734,6 +741,18 @@ function validateWriteKey(writeKey) {
734
741
  }
735
742
  return writeKey;
736
743
  }
744
+ function maskWriteKey(writeKey) {
745
+ if (writeKey) {
746
+ const [id, secret] = writeKey.split(":", 2);
747
+ if (secret) {
748
+ return `${id}:***`;
749
+ }
750
+ else {
751
+ return id;
752
+ }
753
+ }
754
+ return writeKey;
755
+ }
737
756
  function send(method, payload, jitsuConfig, instance, store) {
738
757
  if (jitsuConfig.echoEvents) {
739
758
  console.log(`[JITSU] sending '${method}' event:`, payload);
@@ -749,7 +768,7 @@ function send(method, payload, jitsuConfig, instance, store) {
749
768
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
750
769
  // }
751
770
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
752
- const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": validateWriteKey(jitsuConfig.writeKey) } : {};
771
+ const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": jitsuConfig.writeKey } : {};
753
772
  return fetch(url, {
754
773
  method: "POST",
755
774
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
@@ -817,6 +836,7 @@ const jitsuAnalyticsPlugin = (pluginConfig = {}) => {
817
836
  if (!config.host && !config.echoEvents) {
818
837
  throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true");
819
838
  }
839
+ validateWriteKey(config.writeKey);
820
840
  },
821
841
  page: args => {
822
842
  const { payload, config, instance } = args;
package/dist/jitsu.es.js CHANGED
@@ -389,10 +389,17 @@ function satisfyDomainFilter(filter, subject) {
389
389
  }
390
390
  function applyFilters(event, creds) {
391
391
  const { hosts = "*", events = "*" } = creds;
392
- const eventsArray = events.split("\n");
393
- return (!!hosts.split("\n").find(hostFilter => { var _a; return satisfyDomainFilter(hostFilter, (_a = event.context) === null || _a === void 0 ? void 0 : _a.host); }) &&
394
- (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
395
- !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event))));
392
+ try {
393
+ const eventsArray = Array.isArray(events) ? events : events.split("\n");
394
+ const hostsArray = Array.isArray(hosts) ? hosts : hosts.split("\n");
395
+ return (!!hostsArray.find(hostFilter => { var _a; return satisfyDomainFilter(hostFilter, (_a = event.context) === null || _a === void 0 ? void 0 : _a.host); }) &&
396
+ (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
397
+ !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event))));
398
+ }
399
+ catch (e) {
400
+ console.warn(`Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}. Values`, events, hosts);
401
+ throw new Error(`Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}`);
402
+ }
396
403
  }
397
404
  const internalDestinationPlugins = {
398
405
  [tagPlugin.id]: tagPlugin,
@@ -504,7 +511,7 @@ const defaultCookie2Key = {
504
511
  const cookieStorage = (cookieDomain, key2cookie) => {
505
512
  return {
506
513
  setItem(key, val) {
507
- const strVal = typeof val === "object" && val !== null ? JSON.stringify(val) : val;
514
+ const strVal = typeof val === "object" && val !== null ? encodeURIComponent(JSON.stringify(val)) : val;
508
515
  const cookieName = key2cookie[key] || key;
509
516
  setCookie(cookieName, strVal, {
510
517
  domain: cookieDomain,
@@ -659,7 +666,7 @@ function adjustPayload(payload, config, storage) {
659
666
  },
660
667
  campaign: parseUtms(query),
661
668
  };
662
- const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)), writeKey: validateWriteKey(config.writeKey), context: deepMerge(context, customContext) });
669
+ const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)), writeKey: maskWriteKey(config.writeKey), context: deepMerge(context, customContext) });
663
670
  delete withContext.meta;
664
671
  delete withContext.options;
665
672
  return withContext;
@@ -732,6 +739,18 @@ function validateWriteKey(writeKey) {
732
739
  }
733
740
  return writeKey;
734
741
  }
742
+ function maskWriteKey(writeKey) {
743
+ if (writeKey) {
744
+ const [id, secret] = writeKey.split(":", 2);
745
+ if (secret) {
746
+ return `${id}:***`;
747
+ }
748
+ else {
749
+ return id;
750
+ }
751
+ }
752
+ return writeKey;
753
+ }
735
754
  function send(method, payload, jitsuConfig, instance, store) {
736
755
  if (jitsuConfig.echoEvents) {
737
756
  console.log(`[JITSU] sending '${method}' event:`, payload);
@@ -747,7 +766,7 @@ function send(method, payload, jitsuConfig, instance, store) {
747
766
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
748
767
  // }
749
768
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
750
- const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": validateWriteKey(jitsuConfig.writeKey) } : {};
769
+ const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": jitsuConfig.writeKey } : {};
751
770
  return fetch(url, {
752
771
  method: "POST",
753
772
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
@@ -815,6 +834,7 @@ const jitsuAnalyticsPlugin = (pluginConfig = {}) => {
815
834
  if (!config.host && !config.echoEvents) {
816
835
  throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true");
817
836
  }
837
+ validateWriteKey(config.writeKey);
818
838
  },
819
839
  page: args => {
820
840
  const { payload, config, instance } = args;
package/dist/web/p.js.txt CHANGED
@@ -392,10 +392,17 @@
392
392
  }
393
393
  function applyFilters(event, creds) {
394
394
  const { hosts = "*", events = "*" } = creds;
395
- const eventsArray = events.split("\n");
396
- return (!!hosts.split("\n").find(hostFilter => { var _a; return satisfyDomainFilter(hostFilter, (_a = event.context) === null || _a === void 0 ? void 0 : _a.host); }) &&
397
- (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
398
- !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event))));
395
+ try {
396
+ const eventsArray = Array.isArray(events) ? events : events.split("\n");
397
+ const hostsArray = Array.isArray(hosts) ? hosts : hosts.split("\n");
398
+ return (!!hostsArray.find(hostFilter => { var _a; return satisfyDomainFilter(hostFilter, (_a = event.context) === null || _a === void 0 ? void 0 : _a.host); }) &&
399
+ (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
400
+ !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event))));
401
+ }
402
+ catch (e) {
403
+ console.warn(`Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}. Values`, events, hosts);
404
+ throw new Error(`Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}`);
405
+ }
399
406
  }
400
407
  const internalDestinationPlugins = {
401
408
  [tagPlugin.id]: tagPlugin,
@@ -507,7 +514,7 @@
507
514
  const cookieStorage = (cookieDomain, key2cookie) => {
508
515
  return {
509
516
  setItem(key, val) {
510
- const strVal = typeof val === "object" && val !== null ? JSON.stringify(val) : val;
517
+ const strVal = typeof val === "object" && val !== null ? encodeURIComponent(JSON.stringify(val)) : val;
511
518
  const cookieName = key2cookie[key] || key;
512
519
  setCookie(cookieName, strVal, {
513
520
  domain: cookieDomain,
@@ -662,7 +669,7 @@
662
669
  },
663
670
  campaign: parseUtms(query),
664
671
  };
665
- const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)), writeKey: validateWriteKey(config.writeKey), context: deepMerge(context, customContext) });
672
+ const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)), writeKey: maskWriteKey(config.writeKey), context: deepMerge(context, customContext) });
666
673
  delete withContext.meta;
667
674
  delete withContext.options;
668
675
  return withContext;
@@ -735,6 +742,18 @@
735
742
  }
736
743
  return writeKey;
737
744
  }
745
+ function maskWriteKey(writeKey) {
746
+ if (writeKey) {
747
+ const [id, secret] = writeKey.split(":", 2);
748
+ if (secret) {
749
+ return `${id}:***`;
750
+ }
751
+ else {
752
+ return id;
753
+ }
754
+ }
755
+ return writeKey;
756
+ }
738
757
  function send(method, payload, jitsuConfig, instance, store) {
739
758
  if (jitsuConfig.echoEvents) {
740
759
  console.log(`[JITSU] sending '${method}' event:`, payload);
@@ -750,7 +769,7 @@
750
769
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
751
770
  // }
752
771
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
753
- const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": validateWriteKey(jitsuConfig.writeKey) } : {};
772
+ const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": jitsuConfig.writeKey } : {};
754
773
  return fetch(url, {
755
774
  method: "POST",
756
775
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
@@ -818,6 +837,7 @@
818
837
  if (!config.host && !config.echoEvents) {
819
838
  throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true");
820
839
  }
840
+ validateWriteKey(config.writeKey);
821
841
  },
822
842
  page: args => {
823
843
  const { payload, config, instance } = args;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/js",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "main": "dist/jitsu.cjs.js",
@@ -34,7 +34,7 @@
34
34
  "rollup": "^3.2.5",
35
35
  "ts-jest": "29.0.5",
36
36
  "typescript": "^4.9.5",
37
- "@jitsu/protocols": "1.1.2"
37
+ "@jitsu/protocols": "1.2.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "analytics": "^0.8.1"
@@ -116,7 +116,7 @@ const defaultCookie2Key = {
116
116
  const cookieStorage: StorageFactory = (cookieDomain, key2cookie) => {
117
117
  return {
118
118
  setItem(key: string, val: any) {
119
- const strVal = typeof val === "object" && val !== null ? JSON.stringify(val) : val;
119
+ const strVal = typeof val === "object" && val !== null ? encodeURIComponent(JSON.stringify(val)) : val;
120
120
  const cookieName = key2cookie[key] || key;
121
121
  setCookie(cookieName, strVal, {
122
122
  domain: cookieDomain,
@@ -282,7 +282,7 @@ function adjustPayload(payload: any, config: JitsuOptions, storage: PersistentSt
282
282
  timestamp: new Date().toISOString(),
283
283
  sentAt: new Date().toISOString(),
284
284
  messageId: randomId(properties.path || (parsedUrl && parsedUrl.pathname)),
285
- writeKey: validateWriteKey(config.writeKey),
285
+ writeKey: maskWriteKey(config.writeKey),
286
286
  context: deepMerge(context, customContext),
287
287
  };
288
288
  delete withContext.meta;
@@ -402,6 +402,19 @@ function validateWriteKey(writeKey?: string): string | undefined {
402
402
  }
403
403
  return writeKey;
404
404
  }
405
+
406
+ function maskWriteKey(writeKey?: string): string | undefined {
407
+ if (writeKey) {
408
+ const [id, secret] = writeKey.split(":", 2);
409
+ if (secret) {
410
+ return `${id}:***`;
411
+ } else {
412
+ return id;
413
+ }
414
+ }
415
+ return writeKey;
416
+ }
417
+
405
418
  function send(
406
419
  method,
407
420
  payload,
@@ -428,7 +441,7 @@ function send(
428
441
  // }
429
442
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
430
443
 
431
- const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": validateWriteKey(jitsuConfig.writeKey) } : {};
444
+ const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": jitsuConfig.writeKey } : {};
432
445
 
433
446
  return fetch(url, {
434
447
  method: "POST",
@@ -507,6 +520,7 @@ const jitsuAnalyticsPlugin = (pluginConfig: JitsuOptions = {}): AnalyticsPlugin
507
520
  if (!config.host && !config.echoEvents) {
508
521
  throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true");
509
522
  }
523
+ validateWriteKey(config.writeKey);
510
524
  },
511
525
  page: args => {
512
526
  const { payload, config, instance } = args;
@@ -32,12 +32,24 @@ export function satisfyDomainFilter(filter: string, subject: string | undefined)
32
32
 
33
33
  export function applyFilters(event: AnalyticsClientEvent, creds: CommonDestinationCredentials): boolean {
34
34
  const { hosts = "*", events = "*" } = creds;
35
- const eventsArray = events.split("\n");
36
- return (
37
- !!hosts.split("\n").find(hostFilter => satisfyDomainFilter(hostFilter, event.context?.host)) &&
38
- (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
39
- !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event)))
40
- );
35
+ try {
36
+ const eventsArray = Array.isArray(events) ? events : events.split("\n");
37
+ const hostsArray = Array.isArray(hosts) ? hosts : hosts.split("\n");
38
+ return (
39
+ !!hostsArray.find(hostFilter => satisfyDomainFilter(hostFilter, event.context?.host)) &&
40
+ (!!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.type)) ||
41
+ !!eventsArray.find(eventFilter => satisfyFilter(eventFilter, event.event)))
42
+ );
43
+ } catch (e) {
44
+ console.warn(
45
+ `Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}. Values`,
46
+ events,
47
+ hosts
48
+ );
49
+ throw new Error(
50
+ `Failed to apply filters: ${e.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}`
51
+ );
52
+ }
41
53
  }
42
54
 
43
55
  export const internalDestinationPlugins: Record<string, InternalPlugin<any>> = {