@empathyco/x-adapter-platform 1.1.0-alpha.17 → 1.1.0-alpha.18
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.
|
@@ -67,14 +67,22 @@ function getConfigServiceUrl(from) {
|
|
|
67
67
|
exports.getConfigServiceUrl = getConfigServiceUrl;
|
|
68
68
|
/**
|
|
69
69
|
* Returns the default headers for the endpoint adapters.
|
|
70
|
+
* This function is SSR-friendly and will always include the x-origin header.
|
|
71
|
+
* In a browser environment, it uses location.origin; otherwise, it uses a fallback string.
|
|
70
72
|
*
|
|
71
73
|
* @returns The default headers object.
|
|
72
74
|
* @public
|
|
73
75
|
*/
|
|
74
76
|
function getDefaultHeaders() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
const headers = {};
|
|
78
|
+
// Add x-origin header with location.origin if in browser, otherwise use fallback
|
|
79
|
+
if (typeof window !== 'undefined' && typeof location !== 'undefined') {
|
|
80
|
+
headers['x-origin'] = location.origin;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
headers['x-origin'] = 'non-browser';
|
|
84
|
+
}
|
|
85
|
+
return headers;
|
|
78
86
|
}
|
|
79
87
|
exports.getDefaultHeaders = getDefaultHeaders;
|
|
80
88
|
//# 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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AAC;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"]}
|
|
@@ -60,13 +60,21 @@ export function getConfigServiceUrl(from) {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Returns the default headers for the endpoint adapters.
|
|
63
|
+
* This function is SSR-friendly and will always include the x-origin header.
|
|
64
|
+
* In a browser environment, it uses location.origin; otherwise, it uses a fallback string.
|
|
63
65
|
*
|
|
64
66
|
* @returns The default headers object.
|
|
65
67
|
* @public
|
|
66
68
|
*/
|
|
67
69
|
export function getDefaultHeaders() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
const headers = {};
|
|
71
|
+
// Add x-origin header with location.origin if in browser, otherwise use fallback
|
|
72
|
+
if (typeof window !== 'undefined' && typeof location !== 'undefined') {
|
|
73
|
+
headers['x-origin'] = location.origin;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
headers['x-origin'] = 'non-browser';
|
|
77
|
+
}
|
|
78
|
+
return headers;
|
|
71
79
|
}
|
|
72
80
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/utils.ts"],"names":[],"mappings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,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"]}
|
|
@@ -41,6 +41,8 @@ export declare function getSemanticsServiceUrl(from: ExtraParamsRequest): string
|
|
|
41
41
|
export declare function getConfigServiceUrl(from: ExtraParamsRequest): string;
|
|
42
42
|
/**
|
|
43
43
|
* Returns the default headers for the endpoint adapters.
|
|
44
|
+
* This function is SSR-friendly and will always include the x-origin header.
|
|
45
|
+
* In a browser environment, it uses location.origin; otherwise, it uses a fallback string.
|
|
44
46
|
*
|
|
45
47
|
* @returns The default headers object.
|
|
46
48
|
* @public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-adapter-platform",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.18",
|
|
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",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "558d522cf94c5dcecee09689de8aea5b2d16cbfe"
|
|
67
67
|
}
|