@lwrjs/shared-utils 0.6.0 → 0.6.4

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.
@@ -184,18 +184,18 @@ function slugify(name) {
184
184
  lower: true
185
185
  });
186
186
  }
187
- function getModuleUriPrefix({apiVersion, bundle, format, compat}, {locale, environment} = {}) {
187
+ function getModuleUriPrefix({apiVersion, bundle, format, compat, basePath}, {locale, environment} = {}) {
188
188
  const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : "";
189
189
  const environmentPart = environment ? `/${ENVIRONMENT_SIGIL}/${environment}` : "";
190
190
  if (bundle) {
191
- return `/${apiVersion}/bundle/${format}${localePart}${environmentPart}/bi/0/module/mi/`;
191
+ return `${basePath}/${apiVersion}/bundle/${format}${localePart}${environmentPart}/bi/0/module/mi/`;
192
192
  } else {
193
- return `/${apiVersion}/module/${format}/${compat}${localePart}${environmentPart}/mi/`;
193
+ return `${basePath}/${apiVersion}/module/${format}/${compat}${localePart}${environmentPart}/mi/`;
194
194
  }
195
195
  }
196
- function getMappingUriPrefix({apiVersion, format, compat}, {locale} = {}) {
196
+ function getMappingUriPrefix({apiVersion, format, compat, basePath}, {locale} = {}) {
197
197
  const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : "";
198
- return `/${apiVersion}/mapping/${format}/${compat}${localePart}/mp/`;
198
+ return `${basePath}/${apiVersion}/mapping/${format}/${compat}${localePart}/mp/`;
199
199
  }
200
200
  var REGEX_URL_SCHEMA_PREFIX = /^(https?|\/\/)/;
201
201
  function isExternalUrl(url) {
@@ -40,18 +40,18 @@ function getClientBootstrapConfigurationUri(routeInfo, runtimeEnvironment, runti
40
40
  return `${configUrlPrefix}/${encodeUrl}${signatureSegment}${CONFIG_SUFFIX}`;
41
41
  }
42
42
  function getClientBootstrapConfigurationUriPrefix(routeInfo, runtimeEnvironment, runtimeParams) {
43
- const {apiVersion, format} = runtimeEnvironment;
43
+ const {apiVersion, format, basePath} = runtimeEnvironment;
44
44
  const {id} = routeInfo;
45
45
  const locale = runtimeParams?.locale;
46
46
  const environment = runtimeParams?.environment;
47
47
  if (locale && environment) {
48
- return `/${apiVersion}/application/${format}/l/${locale}/e/${environment}/ai/${id}/configuration/ci`;
48
+ return `${basePath}/${apiVersion}/application/${format}/l/${locale}/e/${environment}/ai/${id}/configuration/ci`;
49
49
  } else if (locale) {
50
- return `/${apiVersion}/application/${format}/l/${locale}/ai/${id}/configuration/ci`;
50
+ return `${basePath}/${apiVersion}/application/${format}/l/${locale}/ai/${id}/configuration/ci`;
51
51
  } else if (environment) {
52
- return `/${apiVersion}/application/${format}/e/${environment}/ai/${id}/configuration/ci`;
52
+ return `${basePath}/${apiVersion}/application/${format}/e/${environment}/ai/${id}/configuration/ci`;
53
53
  } else {
54
- return `/${apiVersion}/application/${format}/ai/${id}/configuration/ci`;
54
+ return `${basePath}/${apiVersion}/application/${format}/ai/${id}/configuration/ci`;
55
55
  }
56
56
  }
57
57
  function removeClientBootstrapConfigurationSuffix(url) {
@@ -148,13 +148,13 @@ export declare function slugify(name: string): string;
148
148
  * @param param0 - URI props from the Runtime Environment
149
149
  * @param param1 - URI props from the Runtime Params
150
150
  */
151
- export declare function getModuleUriPrefix({ apiVersion, bundle, format, compat }: RuntimeEnvironment, { locale, environment }?: RuntimeParams): string;
151
+ export declare function getModuleUriPrefix({ apiVersion, bundle, format, compat, basePath }: RuntimeEnvironment, { locale, environment }?: RuntimeParams): string;
152
152
  /**
153
153
  * Create a URI Mapping API URI prefix, stopping where the specifiers would be (at "mp/")
154
154
  * @param param0 - URI props from the Runtime Environment
155
155
  * @param param1 - URI props from the Runtime Params
156
156
  */
157
- export declare function getMappingUriPrefix({ apiVersion, format, compat }: RuntimeEnvironment, { locale }?: RuntimeParams): string;
157
+ export declare function getMappingUriPrefix({ apiVersion, format, compat, basePath }: RuntimeEnvironment, { locale }?: RuntimeParams): string;
158
158
  export { getCacheKeyFromJson };
159
159
  export declare function isExternalUrl(url: string): boolean;
160
160
  export declare function isBundleDefinition(definition: ModuleDefinition | BundleDefinition): definition is BundleDefinition;
@@ -240,14 +240,14 @@ export function slugify(name) {
240
240
  * @param param0 - URI props from the Runtime Environment
241
241
  * @param param1 - URI props from the Runtime Params
242
242
  */
243
- export function getModuleUriPrefix({ apiVersion, bundle, format, compat }, { locale, environment } = {}) {
243
+ export function getModuleUriPrefix({ apiVersion, bundle, format, compat, basePath }, { locale, environment } = {}) {
244
244
  const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : '';
245
245
  const environmentPart = environment ? `/${ENVIRONMENT_SIGIL}/${environment}` : '';
246
246
  if (bundle) {
247
- return `/${apiVersion}/bundle/${format}${localePart}${environmentPart}/bi/0/module/mi/`;
247
+ return `${basePath}/${apiVersion}/bundle/${format}${localePart}${environmentPart}/bi/0/module/mi/`;
248
248
  }
249
249
  else {
250
- return `/${apiVersion}/module/${format}/${compat}${localePart}${environmentPart}/mi/`;
250
+ return `${basePath}/${apiVersion}/module/${format}/${compat}${localePart}${environmentPart}/mi/`;
251
251
  }
252
252
  }
253
253
  /**
@@ -255,9 +255,9 @@ export function getModuleUriPrefix({ apiVersion, bundle, format, compat }, { loc
255
255
  * @param param0 - URI props from the Runtime Environment
256
256
  * @param param1 - URI props from the Runtime Params
257
257
  */
258
- export function getMappingUriPrefix({ apiVersion, format, compat }, { locale } = {}) {
258
+ export function getMappingUriPrefix({ apiVersion, format, compat, basePath }, { locale } = {}) {
259
259
  const localePart = locale ? `/${LOCALE_SIGIL}/${locale}` : '';
260
- return `/${apiVersion}/mapping/${format}/${compat}${localePart}/mp/`;
260
+ return `${basePath}/${apiVersion}/mapping/${format}/${compat}${localePart}/mp/`;
261
261
  }
262
262
  export { getCacheKeyFromJson };
263
263
  const REGEX_URL_SCHEMA_PREFIX = /^(https?|\/\/)/;
@@ -2,10 +2,10 @@ import { RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
2
2
  export declare function getClientBootstrapConfigurationUri(routeInfo: {
3
3
  id: string;
4
4
  url: string;
5
- }, runtimeEnvironment: Required<Pick<RuntimeEnvironment, 'apiVersion' | 'format'>>, runtimeParams?: RuntimeParams, signature?: string): string;
5
+ }, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, signature?: string): string;
6
6
  export declare function getClientBootstrapConfigurationUriPrefix(routeInfo: {
7
7
  id: string;
8
- }, runtimeEnvironment: Required<Pick<RuntimeEnvironment, 'apiVersion' | 'format'>>, runtimeParams?: RuntimeParams): string;
8
+ }, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams): string;
9
9
  /**
10
10
  * Remove the suffix from config
11
11
  */
package/build/es/urls.js CHANGED
@@ -8,21 +8,21 @@ export function getClientBootstrapConfigurationUri(routeInfo, runtimeEnvironment
8
8
  return `${configUrlPrefix}/${encodeUrl}${signatureSegment}${CONFIG_SUFFIX}`;
9
9
  }
10
10
  export function getClientBootstrapConfigurationUriPrefix(routeInfo, runtimeEnvironment, runtimeParams) {
11
- const { apiVersion, format } = runtimeEnvironment;
11
+ const { apiVersion, format, basePath } = runtimeEnvironment;
12
12
  const { id } = routeInfo;
13
13
  const locale = runtimeParams?.locale;
14
14
  const environment = runtimeParams?.environment;
15
15
  if (locale && environment) {
16
- return `/${apiVersion}/application/${format}/l/${locale}/e/${environment}/ai/${id}/configuration/ci`;
16
+ return `${basePath}/${apiVersion}/application/${format}/l/${locale}/e/${environment}/ai/${id}/configuration/ci`;
17
17
  }
18
18
  else if (locale) {
19
- return `/${apiVersion}/application/${format}/l/${locale}/ai/${id}/configuration/ci`;
19
+ return `${basePath}/${apiVersion}/application/${format}/l/${locale}/ai/${id}/configuration/ci`;
20
20
  }
21
21
  else if (environment) {
22
- return `/${apiVersion}/application/${format}/e/${environment}/ai/${id}/configuration/ci`;
22
+ return `${basePath}/${apiVersion}/application/${format}/e/${environment}/ai/${id}/configuration/ci`;
23
23
  }
24
24
  else {
25
- return `/${apiVersion}/application/${format}/ai/${id}/configuration/ci`;
25
+ return `${basePath}/${apiVersion}/application/${format}/ai/${id}/configuration/ci`;
26
26
  }
27
27
  }
28
28
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.6.0",
7
+ "version": "0.6.4",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -43,13 +43,13 @@
43
43
  "slugify": "^1.4.5"
44
44
  },
45
45
  "devDependencies": {
46
- "@lwrjs/diagnostics": "0.6.0",
47
- "@lwrjs/types": "0.6.0",
46
+ "@lwrjs/diagnostics": "0.6.4",
47
+ "@lwrjs/types": "0.6.4",
48
48
  "@types/mime-types": "2.1.1",
49
49
  "@types/path-to-regexp": "^1.7.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=14.15.4 <17"
53
53
  },
54
- "gitHead": "31769655f0155ad7e54cf37bccdf72d0baaf44ab"
54
+ "gitHead": "80b73fe4558dc3db0afcdbe80eb17f5a1464e34e"
55
55
  }