@florent-uzio/custody 2.6.2 → 2.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.
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
export declare const getHostname: (input: string) => string;
|
|
6
6
|
/**
|
|
7
7
|
* Replace path parameters in a URL template with actual values.
|
|
8
|
+
* Values are percent-encoded before substitution.
|
|
8
9
|
*
|
|
9
10
|
* @param urlTemplate - URL template with placeholders like "{domainId}", "{intentId}"
|
|
10
11
|
* @param params - Object containing parameter values to replace
|
|
11
|
-
* @returns URL with all placeholders replaced with
|
|
12
|
+
* @returns URL with all placeholders replaced with percent-encoded values
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
15
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/helpers/url/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,WAKxC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/helpers/url/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,WAKxC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACzE,aAAa,MAAM,EACnB,QAAQ,CAAC,KACR,MAeF,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC/F,aAAa,CAAC,EACd,QAAQ,CAAC,KACR,MAEF,CAAA"}
|
package/dist/helpers/url/url.js
CHANGED
|
@@ -8,10 +8,11 @@ export const getHostname = (input) => {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Replace path parameters in a URL template with actual values.
|
|
11
|
+
* Values are percent-encoded before substitution.
|
|
11
12
|
*
|
|
12
13
|
* @param urlTemplate - URL template with placeholders like "{domainId}", "{intentId}"
|
|
13
14
|
* @param params - Object containing parameter values to replace
|
|
14
|
-
* @returns URL with all placeholders replaced with
|
|
15
|
+
* @returns URL with all placeholders replaced with percent-encoded values
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
17
18
|
* ```typescript
|
|
@@ -28,7 +29,7 @@ export const replacePathParams = (urlTemplate, params) => {
|
|
|
28
29
|
for (const [key, value] of Object.entries(params)) {
|
|
29
30
|
const placeholder = `{${key}}`;
|
|
30
31
|
if (result.includes(placeholder)) {
|
|
31
|
-
result = result.replace(new RegExp(placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), String(value));
|
|
32
|
+
result = result.replace(new RegExp(placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), encodeURIComponent(String(value)));
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/helpers/url/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;IAC3C,MAAM,UAAU,GACd,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE,CAAA;IAE1F,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAA;AACrC,CAAC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/helpers/url/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAA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