@empathyco/x-adapter-platform 1.1.0-alpha.20 → 1.1.0-alpha.21

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,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultHeaders = exports.getConfigServiceUrl = exports.getSemanticsServiceUrl = exports.getBeaconServiceUrl = exports.getSearchServiceUrl = void 0;
3
+ exports.getSearchServiceUrl = getSearchServiceUrl;
4
+ exports.getBeaconServiceUrl = getBeaconServiceUrl;
5
+ exports.getSemanticsServiceUrl = getSemanticsServiceUrl;
6
+ exports.getConfigServiceUrl = getConfigServiceUrl;
7
+ exports.getDefaultHeaders = getDefaultHeaders;
4
8
  /**
5
9
  * Gets the Search service URL for the given request.
6
10
  *
@@ -16,7 +20,6 @@ function getSearchServiceUrl(from) {
16
20
  ? 'https://search.internal.test.empathy.co'
17
21
  : 'https://api.{extraParams.env(.)}empathy.co/search/v1';
18
22
  }
19
- exports.getSearchServiceUrl = getSearchServiceUrl;
20
23
  /**
21
24
  * Gets the Beacon service URL for the given request.
22
25
  *
@@ -32,7 +35,6 @@ function getBeaconServiceUrl(from) {
32
35
  ? 'https://beacon-api.internal.test.empathy.co'
33
36
  : 'https://api.{extraParams.env(.)}empathy.co';
34
37
  }
35
- exports.getBeaconServiceUrl = getBeaconServiceUrl;
36
38
  /**
37
39
  * Gets the Semantics service URL for the given request.
38
40
  *
@@ -48,7 +50,6 @@ function getSemanticsServiceUrl(from) {
48
50
  ? 'https://semantics-api.internal.test.empathy.co'
49
51
  : 'https://api.{extraParams.env(.)}empathy.co/semantics-api';
50
52
  }
51
- exports.getSemanticsServiceUrl = getSemanticsServiceUrl;
52
53
  /**
53
54
  * Gets the Config service URL for the given request.
54
55
  *
@@ -64,7 +65,6 @@ function getConfigServiceUrl(from) {
64
65
  ? 'https://config-service.internal.test.empathy.co'
65
66
  : 'https://api.{extraParams.env(.)}empathy.co/config/v1';
66
67
  }
67
- exports.getConfigServiceUrl = getConfigServiceUrl;
68
68
  /**
69
69
  * Returns the default headers for the endpoint adapters.
70
70
  * This function is SSR-friendly and will always include the x-origin header.
@@ -84,5 +84,4 @@ function getDefaultHeaders() {
84
84
  }
85
85
  return headers;
86
86
  }
87
- exports.getDefaultHeaders = getDefaultHeaders;
88
87
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/utils.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAJD,kDAIC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,6CAA6C;QAC/C,CAAC,CAAC,4CAA4C,CAAA;AAClD,CAAC;AAJD,kDAIC;AAED;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,IAAwB;;IAC7D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,0DAA0D,CAAA;AAChE,CAAC;AAJD,wDAIC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,iDAAiD;QACnD,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAJD,kDAIC;AAED;;;;;;;GAOG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,iFAAiF;IACjF,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACpE,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;KACtC;SAAM;QACL,OAAO,CAAC,UAAU,CAAC,GAAG,aAAa,CAAA;KACpC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAXD,8CAWC","sourcesContent":["import type { ExtraParamsRequest } from '@empathyco/x-types'\n\n/**\n * Gets the Search service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSearchServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://search.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/search/v1'\n}\n\n/**\n * Gets the Beacon service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getBeaconServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://beacon-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co'\n}\n\n/**\n * Gets the Semantics service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSemanticsServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://semantics-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/semantics-api'\n}\n\n/**\n * Gets the Config service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getConfigServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://config-service.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/config/v1'\n}\n\n/**\n * Returns the default headers for the endpoint adapters.\n * This function is SSR-friendly and will always include the x-origin header.\n * In a browser environment, it uses location.origin; otherwise, it uses a fallback string.\n *\n * @returns The default headers object.\n * @public\n */\nexport function getDefaultHeaders(): Record<string, string> {\n const headers: Record<string, string> = {}\n\n // Add x-origin header with location.origin if in browser, otherwise use fallback\n if (typeof window !== 'undefined' && typeof location !== 'undefined') {\n headers['x-origin'] = location.origin\n } else {\n headers['x-origin'] = 'non-browser'\n }\n\n return headers\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/utils.ts"],"names":[],"mappings":";;AAWA,kDAIC;AAWD,kDAIC;AAWD,wDAIC;AAWD,kDAIC;AAUD,8CAWC;AA/ED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,6CAA6C;QAC/C,CAAC,CAAC,4CAA4C,CAAA;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,IAAwB;;IAC7D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,0DAA0D,CAAA;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,iDAAiD;QACnD,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,iFAAiF;IACjF,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACrE,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,UAAU,CAAC,GAAG,aAAa,CAAA;IACrC,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import type { ExtraParamsRequest } from '@empathyco/x-types'\n\n/**\n * Gets the Search service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSearchServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://search.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/search/v1'\n}\n\n/**\n * Gets the Beacon service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getBeaconServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://beacon-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co'\n}\n\n/**\n * Gets the Semantics service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSemanticsServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://semantics-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/semantics-api'\n}\n\n/**\n * Gets the Config service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getConfigServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://config-service.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/config/v1'\n}\n\n/**\n * Returns the default headers for the endpoint adapters.\n * This function is SSR-friendly and will always include the x-origin header.\n * In a browser environment, it uses location.origin; otherwise, it uses a fallback string.\n *\n * @returns The default headers object.\n * @public\n */\nexport function getDefaultHeaders(): Record<string, string> {\n const headers: Record<string, string> = {}\n\n // Add x-origin header with location.origin if in browser, otherwise use fallback\n if (typeof window !== 'undefined' && typeof location !== 'undefined') {\n headers['x-origin'] = location.origin\n } else {\n headers['x-origin'] = 'non-browser'\n }\n\n return headers\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractUrlParameters = exports.getDisplayTaggingInfoFromUrl = exports.getTaggingInfoFromUrl = void 0;
3
+ exports.getTaggingInfoFromUrl = getTaggingInfoFromUrl;
4
+ exports.getDisplayTaggingInfoFromUrl = getDisplayTaggingInfoFromUrl;
5
+ exports.extractUrlParameters = extractUrlParameters;
4
6
  /**
5
7
  * Extracts the tagging info from a URL.
6
8
  *
@@ -20,7 +22,6 @@ function getTaggingInfoFromUrl(taggingUrl) {
20
22
  },
21
23
  };
22
24
  }
23
- exports.getTaggingInfoFromUrl = getTaggingInfoFromUrl;
24
25
  /**
25
26
  * Generates the displayClick tagging info.
26
27
  *
@@ -37,7 +38,6 @@ function getDisplayTaggingInfoFromUrl(displayTaggingUrl) {
37
38
  delete displayTaggingParams.q;
38
39
  return displayTagging;
39
40
  }
40
- exports.getDisplayTaggingInfoFromUrl = getDisplayTaggingInfoFromUrl;
41
41
  /**
42
42
  * Returns the base url path and an object with the query parameters.
43
43
  *
@@ -76,5 +76,4 @@ function extractUrlParameters(url) {
76
76
  };
77
77
  }
78
78
  }
79
- exports.extractUrlParameters = extractUrlParameters;
80
79
  //# sourceMappingURL=url.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA;IACxD,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AM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAA;QACD,yDAAyD;KAC1D;IAAC,OAAO,MAAM,EAAE;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QAChC,OAAO;YACL,GAAG;SACJ,CAAA;KACF;AACH,CAAC;AA5BD,oDA4BC","sourcesContent":["import type { TaggingRequest } from '@empathyco/x-types'\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl)\n return {\n url,\n params: {\n ...params,\n follow: false,\n },\n }\n}\n\n/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getDisplayTaggingInfoFromUrl(displayTaggingUrl: string): TaggingRequest {\n const displayTagging = getTaggingInfoFromUrl(displayTaggingUrl)\n const displayTaggingParams = displayTagging.params\n\n displayTaggingParams.displayId = displayTaggingParams.q ?? 'no_query'\n delete displayTaggingParams.q\n\n return displayTagging\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string\n params?: Record<string, string[] | string>\n} {\n const searchParams = new Map<string, string | string[]>()\n try {\n const urlObject = new URL(url)\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key)\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value])\n } else if (param) {\n searchParams.set(key, [param, value])\n } else {\n searchParams.set(key, value)\n }\n })\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams),\n }\n // eslint-disable-next-line unused-imports/no-unused-vars\n } catch (_error) {\n console.warn('Invalid url', url)\n return {\n url,\n }\n }\n}\n"]}
1
+ {"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AE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;YACvC,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YAC9B,CAAC;QACH,CAAC,CAAC,CAAA;QACF,OAAO;YACL,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAA;QACD,yDAAyD;IAC3D,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QAChC,OAAO;YACL,GAAG;SACJ,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { TaggingRequest } from '@empathyco/x-types'\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl)\n return {\n url,\n params: {\n ...params,\n follow: false,\n },\n }\n}\n\n/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getDisplayTaggingInfoFromUrl(displayTaggingUrl: string): TaggingRequest {\n const displayTagging = getTaggingInfoFromUrl(displayTaggingUrl)\n const displayTaggingParams = displayTagging.params\n\n displayTaggingParams.displayId = displayTaggingParams.q ?? 'no_query'\n delete displayTaggingParams.q\n\n return displayTagging\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string\n params?: Record<string, string[] | string>\n} {\n const searchParams = new Map<string, string | string[]>()\n try {\n const urlObject = new URL(url)\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key)\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value])\n } else if (param) {\n searchParams.set(key, [param, value])\n } else {\n searchParams.set(key, value)\n }\n })\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams),\n }\n // eslint-disable-next-line unused-imports/no-unused-vars\n } catch (_error) {\n console.warn('Invalid url', url)\n return {\n url,\n }\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFacetConfig = void 0;
3
+ exports.getFacetConfig = getFacetConfig;
4
4
  const editable_number_filter_schema_1 = require("../models/filters/editable-number-filter.schema");
5
5
  const hierarchical_filter_schema_1 = require("../models/filters/hierarchical-filter.schema");
6
6
  const number_filter_schema_1 = require("../models/filters/number-filter.schema");
@@ -35,5 +35,4 @@ function getFacetConfig(type) {
35
35
  };
36
36
  return (_a = typeConfigs[type]) !== null && _a !== void 0 ? _a : typeConfigs.value;
37
37
  }
38
- exports.getFacetConfig = getFacetConfig;
39
38
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/schemas/facets/utils.ts"],"names":[],"mappings":";;;AAEA,mGAA4F;AAC5F,6FAAuF;AACvF,iFAA2E;AAC3E,iFAA2E;AAE3E;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,IAAuB;;IACpD,MAAM,WAAW,GAA2C;QAC1D,KAAK,EAAE;YACL,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,yCAAkB;SAC3B;QACD,YAAY,EAAE;YACZ,SAAS,EAAE,mBAAmB;YAC9B,MAAM,EAAE,qDAAwB;SACjC;QACD,KAAK,EAAE;YACL,SAAS,EAAE,kBAAkB;YAC7B,MAAM,EAAE,yCAAkB;SAC3B;QACD,gBAAgB,EAAE;YAChB,SAAS,EAAE,0BAA0B;YACrC,MAAM,EAAE,0DAA0B;SACnC;KACF,CAAA;IACD,OAAO,MAAA,WAAW,CAAC,IAAI,CAAC,mCAAI,WAAW,CAAC,KAAK,CAAA;AAC/C,CAAC;AApBD,wCAoBC","sourcesContent":["import type { PlatformFacetType } from '../../types/models/facet.model'\nimport type { FacetConfig } from './types'\nimport { editableNumberFilterSchema } from '../models/filters/editable-number-filter.schema'\nimport { hierarchicalFilterSchema } from '../models/filters/hierarchical-filter.schema'\nimport { numberFilterSchema } from '../models/filters/number-filter.schema'\nimport { simpleFilterSchema } from '../models/filters/simple-filter.schema'\n\n/**\n * Returns the facet's config.\n *\n * @param type - The facet type to resolve the configuration.\n * @returns The facet's config.\n *\n * @public\n */\nexport function getFacetConfig(type: PlatformFacetType): FacetConfig {\n const typeConfigs: Record<PlatformFacetType, FacetConfig> = {\n value: {\n modelName: 'SimpleFacet',\n schema: simpleFilterSchema,\n },\n hierarchical: {\n modelName: 'HierarchicalFacet',\n schema: hierarchicalFilterSchema,\n },\n range: {\n modelName: 'NumberRangeFacet',\n schema: numberFilterSchema,\n },\n 'editable-range': {\n modelName: 'EditableNumberRangeFacet',\n schema: editableNumberFilterSchema,\n },\n }\n return typeConfigs[type] ?? typeConfigs.value\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/schemas/facets/utils.ts"],"names":[],"mappings":";;AAeA,wCAoBC;AAjCD,mGAA4F;AAC5F,6FAAuF;AACvF,iFAA2E;AAC3E,iFAA2E;AAE3E;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,IAAuB;;IACpD,MAAM,WAAW,GAA2C;QAC1D,KAAK,EAAE;YACL,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,yCAAkB;SAC3B;QACD,YAAY,EAAE;YACZ,SAAS,EAAE,mBAAmB;YAC9B,MAAM,EAAE,qDAAwB;SACjC;QACD,KAAK,EAAE;YACL,SAAS,EAAE,kBAAkB;YAC7B,MAAM,EAAE,yCAAkB;SAC3B;QACD,gBAAgB,EAAE;YAChB,SAAS,EAAE,0BAA0B;YACrC,MAAM,EAAE,0DAA0B;SACnC;KACF,CAAA;IACD,OAAO,MAAA,WAAW,CAAC,IAAI,CAAC,mCAAI,WAAW,CAAC,KAAK,CAAA;AAC/C,CAAC","sourcesContent":["import type { PlatformFacetType } from '../../types/models/facet.model'\nimport type { FacetConfig } from './types'\nimport { editableNumberFilterSchema } from '../models/filters/editable-number-filter.schema'\nimport { hierarchicalFilterSchema } from '../models/filters/hierarchical-filter.schema'\nimport { numberFilterSchema } from '../models/filters/number-filter.schema'\nimport { simpleFilterSchema } from '../models/filters/simple-filter.schema'\n\n/**\n * Returns the facet's config.\n *\n * @param type - The facet type to resolve the configuration.\n * @returns The facet's config.\n *\n * @public\n */\nexport function getFacetConfig(type: PlatformFacetType): FacetConfig {\n const typeConfigs: Record<PlatformFacetType, FacetConfig> = {\n value: {\n modelName: 'SimpleFacet',\n schema: simpleFilterSchema,\n },\n hierarchical: {\n modelName: 'HierarchicalFacet',\n schema: hierarchicalFilterSchema,\n },\n range: {\n modelName: 'NumberRangeFacet',\n schema: numberFilterSchema,\n },\n 'editable-range': {\n modelName: 'EditableNumberRangeFacet',\n schema: editableNumberFilterSchema,\n },\n }\n return typeConfigs[type] ?? typeConfigs.value\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,6CAA6C;QAC/C,CAAC,CAAC,4CAA4C,CAAA;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAwB;;IAC7D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,0DAA0D,CAAA;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,iDAAiD;QACnD,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,iFAAiF;IACjF,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACpE,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;KACtC;SAAM;QACL,OAAO,CAAC,UAAU,CAAC,GAAG,aAAa,CAAA;KACpC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import type { ExtraParamsRequest } from '@empathyco/x-types'\n\n/**\n * Gets the Search service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSearchServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://search.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/search/v1'\n}\n\n/**\n * Gets the Beacon service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getBeaconServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://beacon-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co'\n}\n\n/**\n * Gets the Semantics service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSemanticsServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://semantics-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/semantics-api'\n}\n\n/**\n * Gets the Config service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getConfigServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://config-service.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/config/v1'\n}\n\n/**\n * Returns the default headers for the endpoint adapters.\n * This function is SSR-friendly and will always include the x-origin header.\n * In a browser environment, it uses location.origin; otherwise, it uses a fallback string.\n *\n * @returns The default headers object.\n * @public\n */\nexport function getDefaultHeaders(): Record<string, string> {\n const headers: Record<string, string> = {}\n\n // Add x-origin header with location.origin if in browser, otherwise use fallback\n if (typeof window !== 'undefined' && typeof location !== 'undefined') {\n headers['x-origin'] = location.origin\n } else {\n headers['x-origin'] = 'non-browser'\n }\n\n return headers\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,6CAA6C;QAC/C,CAAC,CAAC,4CAA4C,CAAA;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAwB;;IAC7D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,0DAA0D,CAAA;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,MAAK,MAAM;QACrC,CAAC,CAAC,iDAAiD;QACnD,CAAC,CAAC,sDAAsD,CAAA;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,iFAAiF;IACjF,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACrE,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,UAAU,CAAC,GAAG,aAAa,CAAA;IACrC,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import type { ExtraParamsRequest } from '@empathyco/x-types'\n\n/**\n * Gets the Search service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSearchServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://search.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/search/v1'\n}\n\n/**\n * Gets the Beacon service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getBeaconServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://beacon-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co'\n}\n\n/**\n * Gets the Semantics service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getSemanticsServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://semantics-api.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/semantics-api'\n}\n\n/**\n * Gets the Config service URL for the given request.\n *\n * @param from - The request.\n *\n * @returns The service URL.\n *\n * @internal\n */\nexport function getConfigServiceUrl(from: ExtraParamsRequest): string {\n return from.extraParams?.env === 'test'\n ? 'https://config-service.internal.test.empathy.co'\n : 'https://api.{extraParams.env(.)}empathy.co/config/v1'\n}\n\n/**\n * Returns the default headers for the endpoint adapters.\n * This function is SSR-friendly and will always include the x-origin header.\n * In a browser environment, it uses location.origin; otherwise, it uses a fallback string.\n *\n * @returns The default headers object.\n * @public\n */\nexport function getDefaultHeaders(): Record<string, string> {\n const headers: Record<string, string> = {}\n\n // Add x-origin header with location.origin if in browser, otherwise use fallback\n if (typeof window !== 'undefined' && typeof location !== 'undefined') {\n headers['x-origin'] = location.origin\n } else {\n headers['x-origin'] = 'non-browser'\n }\n\n return headers\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA;IACxD,OAAO;QACL,GAAG;QACH,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;SACd;KACF,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,iBAAyB;;IACpE,MAAM,cAAc,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,CAAA;IAC/D,MAAM,oBAAoB,GAAG,cAAc,CAAC,MAAM,CAAA;IAElD,oBAAoB,CAAC,SAAS,GAAG,MAAA,oBAAoB,CAAC,CAAC,mCAAI,UAAU,CAAA;IACrE,OAAO,oBAAoB,CAAC,CAAC,CAAA;IAE7B,OAAO,cAAc,CAAA;AACvB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAI9C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAA;IACzD,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;QAC9B,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACnC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;aACzC;iBAAM,IAAI,KAAK,EAAE;gBAChB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;aACtC;iBAAM;gBACL,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;aAC7B;QACH,CAAC,CAAC,CAAA;QACF,OAAO;YACL,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAA;QACD,yDAAyD;KAC1D;IAAC,OAAO,MAAM,EAAE;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QAChC,OAAO;YACL,GAAG;SACJ,CAAA;KACF;AACH,CAAC","sourcesContent":["import type { TaggingRequest } from '@empathyco/x-types'\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl)\n return {\n url,\n params: {\n ...params,\n follow: false,\n },\n }\n}\n\n/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getDisplayTaggingInfoFromUrl(displayTaggingUrl: string): TaggingRequest {\n const displayTagging = getTaggingInfoFromUrl(displayTaggingUrl)\n const displayTaggingParams = displayTagging.params\n\n displayTaggingParams.displayId = displayTaggingParams.q ?? 'no_query'\n delete displayTaggingParams.q\n\n return displayTagging\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string\n params?: Record<string, string[] | string>\n} {\n const searchParams = new Map<string, string | string[]>()\n try {\n const urlObject = new URL(url)\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key)\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value])\n } else if (param) {\n searchParams.set(key, [param, value])\n } else {\n searchParams.set(key, value)\n }\n })\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams),\n }\n // eslint-disable-next-line unused-imports/no-unused-vars\n } catch (_error) {\n console.warn('Invalid url', url)\n return {\n url,\n }\n }\n}\n"]}
1
+ {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAA;IACxD,OAAO;QACL,GAAG;QACH,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;SACd;KACF,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,iBAAyB;;IACpE,MAAM,cAA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GAAG,CAAC,CAAA;QAChC,OAAO;YACL,GAAG;SACJ,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { TaggingRequest } from '@empathyco/x-types'\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl)\n return {\n url,\n params: {\n ...params,\n follow: false,\n },\n }\n}\n\n/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getDisplayTaggingInfoFromUrl(displayTaggingUrl: string): TaggingRequest {\n const displayTagging = getTaggingInfoFromUrl(displayTaggingUrl)\n const displayTaggingParams = displayTagging.params\n\n displayTaggingParams.displayId = displayTaggingParams.q ?? 'no_query'\n delete displayTaggingParams.q\n\n return displayTagging\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string\n params?: Record<string, string[] | string>\n} {\n const searchParams = new Map<string, string | string[]>()\n try {\n const urlObject = new URL(url)\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key)\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value])\n } else if (param) {\n searchParams.set(key, [param, value])\n } else {\n searchParams.set(key, value)\n }\n })\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams),\n }\n // eslint-disable-next-line unused-imports/no-unused-vars\n } catch (_error) {\n console.warn('Invalid url', url)\n return {\n url,\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-adapter-platform",
3
- "version": "1.1.0-alpha.20",
3
+ "version": "1.1.0-alpha.21",
4
4
  "description": "A search client for the Empathy Platform API",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -45,9 +45,9 @@
45
45
  "prepublishOnly": "pnpm run build"
46
46
  },
47
47
  "dependencies": {
48
- "@empathyco/x-adapter": "^8.1.0-alpha.5",
49
- "@empathyco/x-types": "^10.1.0-alpha.15",
50
- "@empathyco/x-utils": "^1.0.3-alpha.5",
48
+ "@empathyco/x-adapter": "^8.1.0-alpha.6",
49
+ "@empathyco/x-types": "^10.1.0-alpha.16",
50
+ "@empathyco/x-utils": "^1.0.3-alpha.6",
51
51
  "tslib": "~2.6.0"
52
52
  },
53
53
  "devDependencies": {
@@ -58,10 +58,10 @@
58
58
  "jest": "27.5.0",
59
59
  "rimraf": "3.0.2",
60
60
  "ts-jest": "27.1.0",
61
- "typescript": "4.9.4"
61
+ "typescript": "5.8.3"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "559195de30ac702b16f4a12b04002cb7e56f34bb"
66
+ "gitHead": "34cf2da4d594e0e65548e3d3a375fc01ba1bf483"
67
67
  }