@typespec/ts-http-runtime 1.0.0-alpha.20231023.3 → 1.0.0-alpha.20231026.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/dist/index.js +2 -58
- package/dist/index.js.map +1 -1
- package/dist-esm/src/util/bytesEncoding.browser.js +35 -7
- package/dist-esm/src/util/bytesEncoding.browser.js.map +1 -1
- package/dist-esm/src/util/bytesEncoding.js +2 -58
- package/dist-esm/src/util/bytesEncoding.js.map +1 -1
- package/dist-esm/src/util/sha256.browser.js +6 -18
- package/dist-esm/src/util/sha256.browser.js.map +1 -1
- package/package.json +1 -1
- package/types/ts-http-runtime.d.ts +1 -1
- package/dist-esm/src/util/base64.browser.js +0 -35
- package/dist-esm/src/util/base64.browser.js.map +0 -1
- package/dist-esm/src/util/hex.js +0 -21
- package/dist-esm/src/util/hex.js.map +0 -1
- package/dist-esm/src/util/utf8.browser.js +0 -26
- package/dist-esm/src/util/utf8.browser.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -2837,14 +2837,7 @@ function objectHasProperty(thing, property) {
|
|
|
2837
2837
|
* @returns a string of the encoded string
|
|
2838
2838
|
*/
|
|
2839
2839
|
function uint8ArrayToString(bytes, format) {
|
|
2840
|
-
|
|
2841
|
-
case "utf-8":
|
|
2842
|
-
return uint8ArrayToUtf8String(bytes);
|
|
2843
|
-
case "base64":
|
|
2844
|
-
return uint8ArrayToBase64(bytes);
|
|
2845
|
-
case "base64url":
|
|
2846
|
-
return uint8ArrayToBase64Url(bytes);
|
|
2847
|
-
}
|
|
2840
|
+
return Buffer.from(bytes).toString(format);
|
|
2848
2841
|
}
|
|
2849
2842
|
/**
|
|
2850
2843
|
* The helper that transforms string to specific character encoded bytes array.
|
|
@@ -2853,56 +2846,7 @@ function uint8ArrayToString(bytes, format) {
|
|
|
2853
2846
|
* @returns a uint8array
|
|
2854
2847
|
*/
|
|
2855
2848
|
function stringToUint8Array(value, format) {
|
|
2856
|
-
|
|
2857
|
-
case "utf-8":
|
|
2858
|
-
return utf8StringToUint8Array(value);
|
|
2859
|
-
case "base64":
|
|
2860
|
-
return base64ToUint8Array(value);
|
|
2861
|
-
case "base64url":
|
|
2862
|
-
return base64UrlToUint8Array(value);
|
|
2863
|
-
}
|
|
2864
|
-
}
|
|
2865
|
-
/**
|
|
2866
|
-
* Decodes a Uint8Array into a Base64 string.
|
|
2867
|
-
* @internal
|
|
2868
|
-
*/
|
|
2869
|
-
function uint8ArrayToBase64(bytes) {
|
|
2870
|
-
return Buffer.from(bytes).toString("base64");
|
|
2871
|
-
}
|
|
2872
|
-
/**
|
|
2873
|
-
* Decodes a Uint8Array into a Base64Url string.
|
|
2874
|
-
* @internal
|
|
2875
|
-
*/
|
|
2876
|
-
function uint8ArrayToBase64Url(bytes) {
|
|
2877
|
-
return Buffer.from(bytes).toString("base64url");
|
|
2878
|
-
}
|
|
2879
|
-
/**
|
|
2880
|
-
* Decodes a Uint8Array into a javascript string.
|
|
2881
|
-
* @internal
|
|
2882
|
-
*/
|
|
2883
|
-
function uint8ArrayToUtf8String(bytes) {
|
|
2884
|
-
return Buffer.from(bytes).toString("utf-8");
|
|
2885
|
-
}
|
|
2886
|
-
/**
|
|
2887
|
-
* Encodes a JavaScript string into a Uint8Array.
|
|
2888
|
-
* @internal
|
|
2889
|
-
*/
|
|
2890
|
-
function utf8StringToUint8Array(value) {
|
|
2891
|
-
return Buffer.from(value);
|
|
2892
|
-
}
|
|
2893
|
-
/**
|
|
2894
|
-
* Encodes a Base64 string into a Uint8Array.
|
|
2895
|
-
* @internal
|
|
2896
|
-
*/
|
|
2897
|
-
function base64ToUint8Array(value) {
|
|
2898
|
-
return Buffer.from(value, "base64");
|
|
2899
|
-
}
|
|
2900
|
-
/**
|
|
2901
|
-
* Encodes a Base64Url string into a Uint8Array.
|
|
2902
|
-
* @internal
|
|
2903
|
-
*/
|
|
2904
|
-
function base64UrlToUint8Array(value) {
|
|
2905
|
-
return Buffer.from(value, "base64url");
|
|
2849
|
+
return Buffer.from(value, format);
|
|
2906
2850
|
}
|
|
2907
2851
|
|
|
2908
2852
|
// Copyright (c) Microsoft Corporation.
|