@coveo/relay 0.4.0 → 0.4.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/lib/relay.cjs CHANGED
@@ -3,12 +3,12 @@
3
3
  var crypto = require('crypto');
4
4
 
5
5
  async function callEventApi({ event, config, environment, }) {
6
- const { token, host, organizationId } = config;
6
+ const { url, token } = config;
7
7
  const headers = {
8
8
  "Content-Type": "application/json",
9
9
  Authorization: `Bearer ${token}`,
10
10
  };
11
- const response = await environment.fetch(`${host}/rest/organizations/${organizationId}/events/v1${config.mode == "validate" ? "/validate" : ""}`, {
11
+ const response = await environment.fetch(`${url}${config.mode == "validate" ? "/validate" : ""}`, {
12
12
  method: "POST",
13
13
  body: JSON.stringify([event]),
14
14
  headers,
@@ -207,7 +207,7 @@ function isBrowser() {
207
207
  }
208
208
  }
209
209
 
210
- const version = "0.4.0" ;
210
+ const version = "0.4.1" ;
211
211
 
212
212
  function getEventConfig(config) {
213
213
  const { trackingId } = config;
@@ -294,10 +294,9 @@ function createListenerManager() {
294
294
  };
295
295
  }
296
296
 
297
- function pick({ host, organizationId, token, trackingId, ...rest }) {
297
+ function pick({ url, token, trackingId, ...rest }) {
298
298
  return Object.freeze({
299
- host,
300
- organizationId,
299
+ url,
301
300
  token,
302
301
  trackingId,
303
302
  ...(!!rest.mode && { mode: rest.mode }),
package/lib/relay.js CHANGED
@@ -1,10 +1,10 @@
1
1
  async function callEventApi({ event, config, environment, }) {
2
- const { token, host, organizationId } = config;
2
+ const { url, token } = config;
3
3
  const headers = {
4
4
  "Content-Type": "application/json",
5
5
  Authorization: `Bearer ${token}`,
6
6
  };
7
- const response = await environment.fetch(`${host}/rest/organizations/${organizationId}/events/v1${config.mode == "validate" ? "/validate" : ""}`, {
7
+ const response = await environment.fetch(`${url}${config.mode == "validate" ? "/validate" : ""}`, {
8
8
  method: "POST",
9
9
  body: JSON.stringify([event]),
10
10
  headers,
@@ -211,7 +211,7 @@ function isBrowser() {
211
211
  }
212
212
  }
213
213
 
214
- const version = "0.4.0" ;
214
+ const version = "0.4.1" ;
215
215
 
216
216
  function getEventConfig(config) {
217
217
  const { trackingId } = config;
@@ -298,10 +298,9 @@ function createListenerManager() {
298
298
  };
299
299
  }
300
300
 
301
- function pick({ host, organizationId, token, trackingId, ...rest }) {
301
+ function pick({ url, token, trackingId, ...rest }) {
302
302
  return Object.freeze({
303
- host,
304
- organizationId,
303
+ url,
305
304
  token,
306
305
  trackingId,
307
306
  ...(!!rest.mode && { mode: rest.mode }),
package/lib/relay.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import crypto from 'crypto';
2
2
 
3
3
  async function callEventApi({ event, config, environment, }) {
4
- const { token, host, organizationId } = config;
4
+ const { url, token } = config;
5
5
  const headers = {
6
6
  "Content-Type": "application/json",
7
7
  Authorization: `Bearer ${token}`,
8
8
  };
9
- const response = await environment.fetch(`${host}/rest/organizations/${organizationId}/events/v1${config.mode == "validate" ? "/validate" : ""}`, {
9
+ const response = await environment.fetch(`${url}${config.mode == "validate" ? "/validate" : ""}`, {
10
10
  method: "POST",
11
11
  body: JSON.stringify([event]),
12
12
  headers,
@@ -205,7 +205,7 @@ function isBrowser() {
205
205
  }
206
206
  }
207
207
 
208
- const version = "0.4.0" ;
208
+ const version = "0.4.1" ;
209
209
 
210
210
  function getEventConfig(config) {
211
211
  const { trackingId } = config;
@@ -292,10 +292,9 @@ function createListenerManager() {
292
292
  };
293
293
  }
294
294
 
295
- function pick({ host, organizationId, token, trackingId, ...rest }) {
295
+ function pick({ url, token, trackingId, ...rest }) {
296
296
  return Object.freeze({
297
- host,
298
- organizationId,
297
+ url,
299
298
  token,
300
299
  trackingId,
301
300
  ...(!!rest.mode && { mode: rest.mode }),
@@ -1,7 +1,6 @@
1
1
  export type RelayMode = "emit" | "validate";
2
2
  export interface RelayConfig {
3
- host: string;
4
- organizationId: string;
3
+ url: string;
5
4
  token: string;
6
5
  trackingId: string;
7
6
  mode?: RelayMode;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAkBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAgBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"event-api-caller.d.ts","sourceRoot":"","sources":["../../../src/event-api-call/event-api-caller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC7B;AAED,wBAAsB,YAAY,CAAC,EACjC,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CA0BnC"}
1
+ {"version":3,"file":"event-api-caller.d.ts","sourceRoot":"","sources":["../../../src/event-api-call/event-api-caller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC7B;AAED,wBAAsB,YAAY,CAAC,EACjC,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAwBnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveo/relay",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "A library for sending analytics events using Coveo's Event protocol.",
5
5
  "files": [
6
6
  "lib/**/*"