@typespec/ts-http-runtime 1.0.0-alpha.20240614.3 → 1.0.0-alpha.20240619.3

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.
Files changed (209) hide show
  1. package/dist/browser/logger/log-browser.d.mts.map +1 -1
  2. package/dist/browser/logger/log-browser.mjs.map +1 -1
  3. package/dist/browser/logger/log.common.d.ts +2 -0
  4. package/dist/browser/logger/log.common.d.ts.map +1 -0
  5. package/dist/browser/logger/log.common.js +23 -0
  6. package/dist/browser/logger/log.common.js.map +1 -0
  7. package/dist/browser/logger/log.d.ts +1 -1
  8. package/dist/browser/logger/log.js +1 -20
  9. package/dist/browser/policies/proxyPolicy-browser.d.mts.map +1 -1
  10. package/dist/browser/policies/proxyPolicy-browser.mjs.map +1 -1
  11. package/dist/browser/policies/proxyPolicy.common.d.ts +15 -0
  12. package/dist/browser/policies/proxyPolicy.common.d.ts.map +1 -0
  13. package/dist/browser/policies/proxyPolicy.common.js +24 -0
  14. package/dist/browser/policies/proxyPolicy.common.js.map +1 -0
  15. package/dist/browser/policies/proxyPolicy.d.ts +1 -14
  16. package/dist/browser/policies/proxyPolicy.js +1 -24
  17. package/dist/browser/policies/tracingPolicy.d.ts.map +1 -1
  18. package/dist/browser/policies/tracingPolicy.js +2 -1
  19. package/dist/browser/policies/tracingPolicy.js.map +1 -1
  20. package/dist/browser/policies/userAgentPolicy.js +1 -1
  21. package/dist/browser/policies/userAgentPolicy.js.map +1 -1
  22. package/dist/browser/util/bytesEncoding-browser.d.mts.map +1 -1
  23. package/dist/browser/util/bytesEncoding-browser.mjs.map +1 -1
  24. package/dist/browser/util/bytesEncoding.common.d.ts +61 -0
  25. package/dist/browser/util/bytesEncoding.common.d.ts.map +1 -0
  26. package/dist/browser/util/bytesEncoding.common.js +110 -0
  27. package/dist/browser/util/bytesEncoding.common.js.map +1 -0
  28. package/dist/browser/util/bytesEncoding.d.ts +1 -60
  29. package/dist/browser/util/bytesEncoding.js +1 -107
  30. package/dist/browser/util/concat-browser.d.mts.map +1 -1
  31. package/dist/browser/util/concat-browser.mjs.map +1 -1
  32. package/dist/browser/util/concat.common.d.ts +19 -0
  33. package/dist/browser/util/concat.common.d.ts.map +1 -0
  34. package/dist/browser/util/concat.common.js +45 -0
  35. package/dist/browser/util/concat.common.js.map +1 -0
  36. package/dist/browser/util/concat.d.ts +1 -18
  37. package/dist/browser/util/concat.js +1 -42
  38. package/dist/browser/util/inspect-browser.d.mts.map +1 -1
  39. package/dist/browser/util/inspect-browser.mjs.map +1 -1
  40. package/dist/browser/util/inspect.common.d.ts +2 -0
  41. package/dist/browser/util/inspect.common.d.ts.map +1 -0
  42. package/dist/browser/util/inspect.common.js +4 -0
  43. package/dist/browser/util/inspect.common.js.map +1 -0
  44. package/dist/browser/util/inspect.d.ts +1 -1
  45. package/dist/browser/util/inspect.js +1 -1
  46. package/dist/browser/util/sha256-browser.d.mts.map +1 -1
  47. package/dist/browser/util/sha256-browser.mjs.map +1 -1
  48. package/dist/browser/util/sha256.common.d.ts +14 -0
  49. package/dist/browser/util/sha256.common.d.ts.map +1 -0
  50. package/dist/browser/util/sha256.common.js +49 -0
  51. package/dist/browser/util/sha256.common.js.map +1 -0
  52. package/dist/browser/util/sha256.d.ts +1 -13
  53. package/dist/browser/util/sha256.js +1 -46
  54. package/dist/browser/util/userAgent.d.ts +1 -1
  55. package/dist/browser/util/userAgent.d.ts.map +1 -1
  56. package/dist/browser/util/userAgent.js +2 -2
  57. package/dist/browser/util/userAgent.js.map +1 -1
  58. package/dist/browser/util/userAgentPlatform-browser.d.mts.map +1 -1
  59. package/dist/browser/util/userAgentPlatform-browser.mjs.map +1 -1
  60. package/dist/browser/util/userAgentPlatform.d.ts +1 -1
  61. package/dist/browser/util/userAgentPlatform.js +36 -6
  62. package/dist/commonjs/logger/log.common.d.ts +2 -0
  63. package/dist/commonjs/logger/log.common.d.ts.map +1 -0
  64. package/dist/commonjs/logger/log.common.js +27 -0
  65. package/dist/commonjs/logger/log.common.js.map +1 -0
  66. package/dist/commonjs/policies/proxyPolicy.common.d.ts +15 -0
  67. package/dist/commonjs/policies/proxyPolicy.common.d.ts.map +1 -0
  68. package/dist/commonjs/policies/proxyPolicy.common.js +30 -0
  69. package/dist/commonjs/policies/proxyPolicy.common.js.map +1 -0
  70. package/dist/commonjs/policies/tracingPolicy.d.ts.map +1 -1
  71. package/dist/commonjs/policies/tracingPolicy.js +2 -1
  72. package/dist/commonjs/policies/tracingPolicy.js.map +1 -1
  73. package/dist/commonjs/policies/userAgentPolicy.js +1 -1
  74. package/dist/commonjs/policies/userAgentPolicy.js.map +1 -1
  75. package/dist/commonjs/util/bytesEncoding.common.d.ts +61 -0
  76. package/dist/commonjs/util/bytesEncoding.common.d.ts.map +1 -0
  77. package/dist/commonjs/util/bytesEncoding.common.js +123 -0
  78. package/dist/commonjs/util/bytesEncoding.common.js.map +1 -0
  79. package/dist/commonjs/util/concat.common.d.ts +19 -0
  80. package/dist/commonjs/util/concat.common.d.ts.map +1 -0
  81. package/dist/commonjs/util/concat.common.js +49 -0
  82. package/dist/commonjs/util/concat.common.js.map +1 -0
  83. package/dist/commonjs/util/inspect.common.d.ts +2 -0
  84. package/dist/commonjs/util/inspect.common.d.ts.map +1 -0
  85. package/dist/commonjs/util/inspect.common.js +7 -0
  86. package/dist/commonjs/util/inspect.common.js.map +1 -0
  87. package/dist/commonjs/util/sha256.common.d.ts +14 -0
  88. package/dist/commonjs/util/sha256.common.d.ts.map +1 -0
  89. package/dist/commonjs/util/sha256.common.js +54 -0
  90. package/dist/commonjs/util/sha256.common.js.map +1 -0
  91. package/dist/commonjs/util/userAgent.d.ts +1 -1
  92. package/dist/commonjs/util/userAgent.d.ts.map +1 -1
  93. package/dist/commonjs/util/userAgent.js +2 -2
  94. package/dist/commonjs/util/userAgent.js.map +1 -1
  95. package/dist/commonjs/util/userAgentPlatform.d.ts +1 -1
  96. package/dist/commonjs/util/userAgentPlatform.d.ts.map +1 -1
  97. package/dist/commonjs/util/userAgentPlatform.js +1 -1
  98. package/dist/commonjs/util/userAgentPlatform.js.map +1 -1
  99. package/dist/esm/logger/log.common.d.ts +2 -0
  100. package/dist/esm/logger/log.common.d.ts.map +1 -0
  101. package/dist/esm/logger/log.common.js +23 -0
  102. package/dist/esm/logger/log.common.js.map +1 -0
  103. package/dist/esm/policies/proxyPolicy.common.d.ts +15 -0
  104. package/dist/esm/policies/proxyPolicy.common.d.ts.map +1 -0
  105. package/dist/esm/policies/proxyPolicy.common.js +24 -0
  106. package/dist/esm/policies/proxyPolicy.common.js.map +1 -0
  107. package/dist/esm/policies/tracingPolicy.d.ts.map +1 -1
  108. package/dist/esm/policies/tracingPolicy.js +2 -1
  109. package/dist/esm/policies/tracingPolicy.js.map +1 -1
  110. package/dist/esm/policies/userAgentPolicy.js +1 -1
  111. package/dist/esm/policies/userAgentPolicy.js.map +1 -1
  112. package/dist/esm/util/bytesEncoding.common.d.ts +61 -0
  113. package/dist/esm/util/bytesEncoding.common.d.ts.map +1 -0
  114. package/dist/esm/util/bytesEncoding.common.js +110 -0
  115. package/dist/esm/util/bytesEncoding.common.js.map +1 -0
  116. package/dist/esm/util/concat.common.d.ts +19 -0
  117. package/dist/esm/util/concat.common.d.ts.map +1 -0
  118. package/dist/esm/util/concat.common.js +45 -0
  119. package/dist/esm/util/concat.common.js.map +1 -0
  120. package/dist/esm/util/inspect.common.d.ts +2 -0
  121. package/dist/esm/util/inspect.common.d.ts.map +1 -0
  122. package/dist/esm/util/inspect.common.js +4 -0
  123. package/dist/esm/util/inspect.common.js.map +1 -0
  124. package/dist/esm/util/sha256.common.d.ts +14 -0
  125. package/dist/esm/util/sha256.common.d.ts.map +1 -0
  126. package/dist/esm/util/sha256.common.js +49 -0
  127. package/dist/esm/util/sha256.common.js.map +1 -0
  128. package/dist/esm/util/userAgent.d.ts +1 -1
  129. package/dist/esm/util/userAgent.d.ts.map +1 -1
  130. package/dist/esm/util/userAgent.js +2 -2
  131. package/dist/esm/util/userAgent.js.map +1 -1
  132. package/dist/esm/util/userAgentPlatform.d.ts +1 -1
  133. package/dist/esm/util/userAgentPlatform.d.ts.map +1 -1
  134. package/dist/esm/util/userAgentPlatform.js +1 -1
  135. package/dist/esm/util/userAgentPlatform.js.map +1 -1
  136. package/dist/react-native/logger/log-react-native.d.mts.map +1 -0
  137. package/dist/react-native/logger/log-react-native.mjs.map +1 -0
  138. package/dist/react-native/logger/log.common.d.ts +2 -0
  139. package/dist/react-native/logger/log.common.d.ts.map +1 -0
  140. package/dist/react-native/logger/log.common.js +23 -0
  141. package/dist/react-native/logger/log.common.js.map +1 -0
  142. package/dist/react-native/logger/log.d.ts +2 -2
  143. package/dist/react-native/logger/log.js +2 -7
  144. package/dist/react-native/policies/proxyPolicy-react-native.d.mts.map +1 -0
  145. package/dist/react-native/policies/proxyPolicy-react-native.mjs.map +1 -0
  146. package/dist/react-native/policies/proxyPolicy.common.d.ts +15 -0
  147. package/dist/react-native/policies/proxyPolicy.common.d.ts.map +1 -0
  148. package/dist/react-native/policies/proxyPolicy.common.js +24 -0
  149. package/dist/react-native/policies/proxyPolicy.common.js.map +1 -0
  150. package/dist/react-native/policies/proxyPolicy.d.ts +2 -32
  151. package/dist/react-native/policies/proxyPolicy.js +2 -189
  152. package/dist/react-native/policies/tracingPolicy.d.ts.map +1 -1
  153. package/dist/react-native/policies/tracingPolicy.js +2 -1
  154. package/dist/react-native/policies/tracingPolicy.js.map +1 -1
  155. package/dist/react-native/policies/userAgentPolicy.js +1 -1
  156. package/dist/react-native/policies/userAgentPolicy.js.map +1 -1
  157. package/dist/react-native/util/bytesEncoding-react-native.d.mts.map +1 -0
  158. package/dist/react-native/util/bytesEncoding-react-native.mjs.map +1 -0
  159. package/dist/react-native/util/bytesEncoding.common.d.ts +61 -0
  160. package/dist/react-native/util/bytesEncoding.common.d.ts.map +1 -0
  161. package/dist/react-native/util/bytesEncoding.common.js +110 -0
  162. package/dist/react-native/util/bytesEncoding.common.js.map +1 -0
  163. package/dist/react-native/util/bytesEncoding.d.ts +2 -17
  164. package/dist/react-native/util/bytesEncoding.js +2 -19
  165. package/dist/react-native/util/concat-react-native.d.mts.map +1 -0
  166. package/dist/react-native/util/concat-react-native.mjs.map +1 -0
  167. package/dist/react-native/util/concat.common.d.ts +19 -0
  168. package/dist/react-native/util/concat.common.d.ts.map +1 -0
  169. package/dist/react-native/util/concat.common.js +45 -0
  170. package/dist/react-native/util/concat.common.js.map +1 -0
  171. package/dist/react-native/util/concat.d.ts +2 -18
  172. package/dist/react-native/util/concat.js +2 -86
  173. package/dist/react-native/util/inspect-react-native.d.mts.map +1 -0
  174. package/dist/react-native/util/inspect-react-native.mjs.map +1 -0
  175. package/dist/react-native/util/inspect.common.d.ts +2 -0
  176. package/dist/react-native/util/inspect.common.d.ts.map +1 -0
  177. package/dist/react-native/util/inspect.common.js +4 -0
  178. package/dist/react-native/util/inspect.common.js.map +1 -0
  179. package/dist/react-native/util/inspect.d.ts +2 -2
  180. package/dist/react-native/util/inspect.js +2 -3
  181. package/dist/react-native/util/sha256-react-native.d.mts.map +1 -0
  182. package/dist/react-native/util/sha256-react-native.mjs.map +1 -0
  183. package/dist/react-native/util/sha256.common.d.ts +14 -0
  184. package/dist/react-native/util/sha256.common.d.ts.map +1 -0
  185. package/dist/react-native/util/sha256.common.js +49 -0
  186. package/dist/react-native/util/sha256.common.js.map +1 -0
  187. package/dist/react-native/util/sha256.d.ts +2 -14
  188. package/dist/react-native/util/sha256.js +2 -20
  189. package/dist/react-native/util/userAgent.d.ts +1 -1
  190. package/dist/react-native/util/userAgent.d.ts.map +1 -1
  191. package/dist/react-native/util/userAgent.js +2 -2
  192. package/dist/react-native/util/userAgent.js.map +1 -1
  193. package/dist/react-native/util/userAgentPlatform-react-native.d.mts.map +1 -1
  194. package/dist/react-native/util/userAgentPlatform-react-native.mjs.map +1 -1
  195. package/dist/react-native/util/userAgentPlatform.d.ts +1 -1
  196. package/dist/react-native/util/userAgentPlatform.js +2 -4
  197. package/package.json +2 -2
  198. package/dist/react-native/logger/log.d.ts.map +0 -1
  199. package/dist/react-native/logger/log.js.map +0 -1
  200. package/dist/react-native/policies/proxyPolicy.d.ts.map +0 -1
  201. package/dist/react-native/policies/proxyPolicy.js.map +0 -1
  202. package/dist/react-native/util/bytesEncoding.d.ts.map +0 -1
  203. package/dist/react-native/util/bytesEncoding.js.map +0 -1
  204. package/dist/react-native/util/concat.d.ts.map +0 -1
  205. package/dist/react-native/util/concat.js.map +0 -1
  206. package/dist/react-native/util/inspect.d.ts.map +0 -1
  207. package/dist/react-native/util/inspect.js.map +0 -1
  208. package/dist/react-native/util/sha256.d.ts.map +0 -1
  209. package/dist/react-native/util/sha256.js.map +0 -1
@@ -0,0 +1,110 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * The helper that transforms bytes with specific character encoding into string
5
+ * @param bytes - the uint8array bytes
6
+ * @param format - the format we use to encode the byte
7
+ * @returns a string of the encoded string
8
+ */
9
+ export function uint8ArrayToString(bytes, format) {
10
+ switch (format) {
11
+ case "utf-8":
12
+ return uint8ArrayToUtf8String(bytes);
13
+ case "base64":
14
+ return uint8ArrayToBase64(bytes);
15
+ case "base64url":
16
+ return uint8ArrayToBase64Url(bytes);
17
+ case "hex":
18
+ return uint8ArrayToHexString(bytes);
19
+ }
20
+ }
21
+ /**
22
+ * The helper that transforms string to specific character encoded bytes array.
23
+ * @param value - the string to be converted
24
+ * @param format - the format we use to decode the value
25
+ * @returns a uint8array
26
+ */
27
+ export function stringToUint8Array(value, format) {
28
+ switch (format) {
29
+ case "utf-8":
30
+ return utf8StringToUint8Array(value);
31
+ case "base64":
32
+ return base64ToUint8Array(value);
33
+ case "base64url":
34
+ return base64UrlToUint8Array(value);
35
+ case "hex":
36
+ return hexStringToUint8Array(value);
37
+ }
38
+ }
39
+ /**
40
+ * Decodes a Uint8Array into a Base64 string.
41
+ * @internal
42
+ */
43
+ export function uint8ArrayToBase64(bytes) {
44
+ return btoa([...bytes].map((x) => String.fromCharCode(x)).join(""));
45
+ }
46
+ /**
47
+ * Decodes a Uint8Array into a Base64Url string.
48
+ * @internal
49
+ */
50
+ export function uint8ArrayToBase64Url(bytes) {
51
+ return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
52
+ }
53
+ /**
54
+ * Decodes a Uint8Array into a javascript string.
55
+ * @internal
56
+ */
57
+ export function uint8ArrayToUtf8String(bytes) {
58
+ const decoder = new TextDecoder();
59
+ const dataString = decoder.decode(bytes);
60
+ return dataString;
61
+ }
62
+ /**
63
+ * Decodes a Uint8Array into a hex string
64
+ * @internal
65
+ */
66
+ export function uint8ArrayToHexString(bytes) {
67
+ return [...bytes].map((x) => x.toString(16).padStart(2, "0")).join("");
68
+ }
69
+ /**
70
+ * Encodes a JavaScript string into a Uint8Array.
71
+ * @internal
72
+ */
73
+ export function utf8StringToUint8Array(value) {
74
+ return new TextEncoder().encode(value);
75
+ }
76
+ /**
77
+ * Encodes a Base64 string into a Uint8Array.
78
+ * @internal
79
+ */
80
+ export function base64ToUint8Array(value) {
81
+ return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));
82
+ }
83
+ /**
84
+ * Encodes a Base64Url string into a Uint8Array.
85
+ * @internal
86
+ */
87
+ export function base64UrlToUint8Array(value) {
88
+ const base64String = value.replace(/-/g, "+").replace(/_/g, "/");
89
+ return base64ToUint8Array(base64String);
90
+ }
91
+ const hexDigits = new Set("0123456789abcdefABCDEF");
92
+ /**
93
+ * Encodes a hex string into a Uint8Array
94
+ * @internal
95
+ */
96
+ export function hexStringToUint8Array(value) {
97
+ // If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior
98
+ const bytes = new Uint8Array(value.length / 2);
99
+ for (let i = 0; i < value.length / 2; ++i) {
100
+ const highNibble = value[2 * i];
101
+ const lowNibble = value[2 * i + 1];
102
+ if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {
103
+ // Replicate Node Buffer behavior by exiting early when we encounter an invalid byte
104
+ return bytes.slice(0, i);
105
+ }
106
+ bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);
107
+ }
108
+ return bytes;
109
+ }
110
+ //# sourceMappingURL=bytesEncoding.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bytesEncoding.common.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.common.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\ndeclare global {\n // stub these out for the browser\n function btoa(input: string): string;\n function atob(input: string): string;\n}\n\n/** The supported character encoding type */\nexport type EncodingType = \"utf-8\" | \"base64\" | \"base64url\" | \"hex\";\n\n/**\n * The helper that transforms bytes with specific character encoding into string\n * @param bytes - the uint8array bytes\n * @param format - the format we use to encode the byte\n * @returns a string of the encoded string\n */\nexport function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string {\n switch (format) {\n case \"utf-8\":\n return uint8ArrayToUtf8String(bytes);\n case \"base64\":\n return uint8ArrayToBase64(bytes);\n case \"base64url\":\n return uint8ArrayToBase64Url(bytes);\n case \"hex\":\n return uint8ArrayToHexString(bytes);\n }\n}\n\n/**\n * The helper that transforms string to specific character encoded bytes array.\n * @param value - the string to be converted\n * @param format - the format we use to decode the value\n * @returns a uint8array\n */\nexport function stringToUint8Array(value: string, format: EncodingType): Uint8Array {\n switch (format) {\n case \"utf-8\":\n return utf8StringToUint8Array(value);\n case \"base64\":\n return base64ToUint8Array(value);\n case \"base64url\":\n return base64UrlToUint8Array(value);\n case \"hex\":\n return hexStringToUint8Array(value);\n }\n}\n\n/**\n * Decodes a Uint8Array into a Base64 string.\n * @internal\n */\nexport function uint8ArrayToBase64(bytes: Uint8Array): string {\n return btoa([...bytes].map((x) => String.fromCharCode(x)).join(\"\"));\n}\n\n/**\n * Decodes a Uint8Array into a Base64Url string.\n * @internal\n */\nexport function uint8ArrayToBase64Url(bytes: Uint8Array): string {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n\n/**\n * Decodes a Uint8Array into a javascript string.\n * @internal\n */\nexport function uint8ArrayToUtf8String(bytes: Uint8Array): string {\n const decoder = new TextDecoder();\n const dataString = decoder.decode(bytes);\n return dataString;\n}\n\n/**\n * Decodes a Uint8Array into a hex string\n * @internal\n */\nexport function uint8ArrayToHexString(bytes: Uint8Array): string {\n return [...bytes].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Encodes a JavaScript string into a Uint8Array.\n * @internal\n */\nexport function utf8StringToUint8Array(value: string): Uint8Array {\n return new TextEncoder().encode(value);\n}\n\n/**\n * Encodes a Base64 string into a Uint8Array.\n * @internal\n */\nexport function base64ToUint8Array(value: string): Uint8Array {\n return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));\n}\n\n/**\n * Encodes a Base64Url string into a Uint8Array.\n * @internal\n */\nexport function base64UrlToUint8Array(value: string): Uint8Array {\n const base64String = value.replace(/-/g, \"+\").replace(/_/g, \"/\");\n return base64ToUint8Array(base64String);\n}\n\nconst hexDigits = new Set(\"0123456789abcdefABCDEF\");\n\n/**\n * Encodes a hex string into a Uint8Array\n * @internal\n */\nexport function hexStringToUint8Array(value: string): Uint8Array {\n // If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior\n const bytes = new Uint8Array(value.length / 2);\n for (let i = 0; i < value.length / 2; ++i) {\n const highNibble = value[2 * i];\n const lowNibble = value[2 * i + 1];\n if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {\n // Replicate Node Buffer behavior by exiting early when we encounter an invalid byte\n return bytes.slice(0, i);\n }\n\n bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);\n }\n\n return bytes;\n}\n"]}
@@ -1,17 +1,2 @@
1
- /** The supported character encoding type */
2
- export type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
3
- /**
4
- * The helper that transforms bytes with specific character encoding into string
5
- * @param bytes - the uint8array bytes
6
- * @param format - the format we use to encode the byte
7
- * @returns a string of the encoded string
8
- */
9
- export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
10
- /**
11
- * The helper that transforms string to specific character encoded bytes array.
12
- * @param value - the string to be converted
13
- * @param format - the format we use to decode the value
14
- * @returns a uint8array
15
- */
16
- export declare function stringToUint8Array(value: string, format: EncodingType): Uint8Array;
17
- //# sourceMappingURL=bytesEncoding.d.ts.map
1
+ export * from "./bytesEncoding.common.js";
2
+ //# sourceMappingURL=bytesEncoding-react-native.d.mts.map
@@ -1,21 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- /**
4
- * The helper that transforms bytes with specific character encoding into string
5
- * @param bytes - the uint8array bytes
6
- * @param format - the format we use to encode the byte
7
- * @returns a string of the encoded string
8
- */
9
- export function uint8ArrayToString(bytes, format) {
10
- return Buffer.from(bytes).toString(format);
11
- }
12
- /**
13
- * The helper that transforms string to specific character encoded bytes array.
14
- * @param value - the string to be converted
15
- * @param format - the format we use to decode the value
16
- * @returns a uint8array
17
- */
18
- export function stringToUint8Array(value, format) {
19
- return Buffer.from(value, format);
20
- }
21
- //# sourceMappingURL=bytesEncoding.js.map
3
+ export * from "./bytesEncoding.common.js";
4
+ //# sourceMappingURL=bytesEncoding-react-native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concat-react-native.d.mts","sourceRoot":"","sources":["../../../src/util/concat-react-native.mts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concat-react-native.mjs","sourceRoot":"","sources":["../../../src/util/concat-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./concat.common.js\";\n"]}
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /**
3
+ * Accepted binary data types for concat
4
+ *
5
+ * @internal
6
+ */
7
+ type ConcatSource = ReadableStream<Uint8Array> | Blob | Uint8Array;
8
+ /**
9
+ * Utility function that concatenates a set of binary inputs into one combined output.
10
+ *
11
+ * @param sources - array of sources for the concatenation
12
+ * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.
13
+ * In browser, returns a `Blob` representing all the concatenated inputs.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare function concat(sources: (ConcatSource | (() => ConcatSource))[]): Promise<(() => NodeJS.ReadableStream) | Blob>;
18
+ export {};
19
+ //# sourceMappingURL=concat.common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concat.common.d.ts","sourceRoot":"","sources":["../../../src/util/concat.common.ts"],"names":[],"mappings":";AAwCA;;;;GAIG;AACH,KAAK,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,UAAU,CAAC;AAEnE;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,CAAC,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAC,EAAE,GAC/C,OAAO,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAO/C"}
@@ -0,0 +1,45 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { getRawContent } from "./file.js";
4
+ import { isNodeReadableStream, isWebReadableStream } from "./typeGuards.js";
5
+ /**
6
+ * Drain the content of the given ReadableStream into a Blob.
7
+ * The blob's content may end up in memory or on disk dependent on size.
8
+ */
9
+ function drain(stream) {
10
+ return new Response(stream).blob();
11
+ }
12
+ async function toBlobPart(source) {
13
+ if (source instanceof Blob || source instanceof Uint8Array) {
14
+ return source;
15
+ }
16
+ if (isWebReadableStream(source)) {
17
+ return drain(source);
18
+ }
19
+ // If it's not a true Blob, and it's not a Uint8Array, we can assume the source
20
+ // is a fake File created by createFileFromStream and we can get the original stream
21
+ // using getRawContent.
22
+ const rawContent = getRawContent(source);
23
+ // Shouldn't happen but guard for it anyway
24
+ if (isNodeReadableStream(rawContent)) {
25
+ throw new Error("Encountered unexpected type. In the browser, `concat` supports Web ReadableStream, Blob, Uint8Array, and files created using `createFile` only.");
26
+ }
27
+ return toBlobPart(rawContent);
28
+ }
29
+ /**
30
+ * Utility function that concatenates a set of binary inputs into one combined output.
31
+ *
32
+ * @param sources - array of sources for the concatenation
33
+ * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.
34
+ * In browser, returns a `Blob` representing all the concatenated inputs.
35
+ *
36
+ * @internal
37
+ */
38
+ export async function concat(sources) {
39
+ const parts = [];
40
+ for (const source of sources) {
41
+ parts.push(await toBlobPart(typeof source === "function" ? source() : source));
42
+ }
43
+ return new Blob(parts);
44
+ }
45
+ //# sourceMappingURL=concat.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concat.common.js","sourceRoot":"","sources":["../../../src/util/concat.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE5E;;;GAGG;AACH,SAAS,KAAK,CAAC,MAAkC;IAC/C,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC;AAED,KAAK,UAAU,UAAU,CACvB,MAAsD;IAEtD,IAAI,MAAM,YAAY,IAAI,IAAI,MAAM,YAAY,UAAU,EAAE,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,+EAA+E;IAC/E,oFAAoF;IACpF,uBAAuB;IACvB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEzC,2CAA2C;IAC3C,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,iJAAiJ,CAClJ,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AASD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAgD;IAEhD,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getRawContent } from \"./file.js\";\nimport { isNodeReadableStream, isWebReadableStream } from \"./typeGuards.js\";\n\n/**\n * Drain the content of the given ReadableStream into a Blob.\n * The blob's content may end up in memory or on disk dependent on size.\n */\nfunction drain(stream: ReadableStream<Uint8Array>): Promise<Blob> {\n return new Response(stream).blob();\n}\n\nasync function toBlobPart(\n source: ReadableStream<Uint8Array> | Blob | Uint8Array,\n): Promise<BlobPart> {\n if (source instanceof Blob || source instanceof Uint8Array) {\n return source;\n }\n\n if (isWebReadableStream(source)) {\n return drain(source);\n }\n\n // If it's not a true Blob, and it's not a Uint8Array, we can assume the source\n // is a fake File created by createFileFromStream and we can get the original stream\n // using getRawContent.\n const rawContent = getRawContent(source);\n\n // Shouldn't happen but guard for it anyway\n if (isNodeReadableStream(rawContent)) {\n throw new Error(\n \"Encountered unexpected type. In the browser, `concat` supports Web ReadableStream, Blob, Uint8Array, and files created using `createFile` only.\",\n );\n }\n\n return toBlobPart(rawContent);\n}\n\n/**\n * Accepted binary data types for concat\n *\n * @internal\n */\ntype ConcatSource = ReadableStream<Uint8Array> | Blob | Uint8Array;\n\n/**\n * Utility function that concatenates a set of binary inputs into one combined output.\n *\n * @param sources - array of sources for the concatenation\n * @returns - in Node, a (() =\\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.\n * In browser, returns a `Blob` representing all the concatenated inputs.\n *\n * @internal\n */\nexport async function concat(\n sources: (ConcatSource | (() => ConcatSource))[],\n): Promise<(() => NodeJS.ReadableStream) | Blob> {\n const parts = [];\n for (const source of sources) {\n parts.push(await toBlobPart(typeof source === \"function\" ? source() : source));\n }\n\n return new Blob(parts);\n}\n"]}
@@ -1,18 +1,2 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /**
3
- * Accepted binary data types for concat
4
- *
5
- * @internal
6
- */
7
- export type ConcatSource = ReadableStream<Uint8Array> | NodeJS.ReadableStream | Uint8Array | Blob;
8
- /**
9
- * Utility function that concatenates a set of binary inputs into one combined output.
10
- *
11
- * @param sources - array of sources for the concatenation
12
- * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.
13
- * In browser, returns a `Blob` representing all the concatenated inputs.
14
- *
15
- * @internal
16
- */
17
- export declare function concat(sources: (ConcatSource | (() => ConcatSource))[]): Promise<(() => NodeJS.ReadableStream) | Blob>;
18
- //# sourceMappingURL=concat.d.ts.map
1
+ export * from "./concat.common.js";
2
+ //# sourceMappingURL=concat-react-native.d.mts.map
@@ -1,88 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { __asyncGenerator, __asyncValues, __await } from "tslib";
4
- import { Readable } from "stream";
5
- import { isBlob } from "./typeGuards.js";
6
- import { getRawContent } from "./file.js";
7
- function streamAsyncIterator() {
8
- return __asyncGenerator(this, arguments, function* streamAsyncIterator_1() {
9
- const reader = this.getReader();
10
- try {
11
- while (true) {
12
- const { done, value } = yield __await(reader.read());
13
- if (done) {
14
- return yield __await(void 0);
15
- }
16
- yield yield __await(value);
17
- }
18
- }
19
- finally {
20
- reader.releaseLock();
21
- }
22
- });
23
- }
24
- function makeAsyncIterable(webStream) {
25
- if (!webStream[Symbol.asyncIterator]) {
26
- webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream);
27
- }
28
- if (!webStream.values) {
29
- webStream.values = streamAsyncIterator.bind(webStream);
30
- }
31
- }
32
- function ensureNodeStream(stream) {
33
- if (stream instanceof ReadableStream) {
34
- makeAsyncIterable(stream);
35
- return Readable.fromWeb(stream);
36
- }
37
- else {
38
- return stream;
39
- }
40
- }
41
- function toStream(source) {
42
- if (source instanceof Uint8Array) {
43
- return Readable.from(Buffer.from(source));
44
- }
45
- else if (isBlob(source)) {
46
- return toStream(getRawContent(source));
47
- }
48
- else {
49
- return ensureNodeStream(source);
50
- }
51
- }
52
- /**
53
- * Utility function that concatenates a set of binary inputs into one combined output.
54
- *
55
- * @param sources - array of sources for the concatenation
56
- * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.
57
- * In browser, returns a `Blob` representing all the concatenated inputs.
58
- *
59
- * @internal
60
- */
61
- export async function concat(sources) {
62
- return function () {
63
- const streams = sources.map((x) => (typeof x === "function" ? x() : x)).map(toStream);
64
- return Readable.from((function () {
65
- return __asyncGenerator(this, arguments, function* () {
66
- var _a, e_1, _b, _c;
67
- for (const stream of streams) {
68
- try {
69
- for (var _d = true, stream_1 = (e_1 = void 0, __asyncValues(stream)), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
70
- _c = stream_1_1.value;
71
- _d = false;
72
- const chunk = _c;
73
- yield yield __await(chunk);
74
- }
75
- }
76
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
77
- finally {
78
- try {
79
- if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
80
- }
81
- finally { if (e_1) throw e_1.error; }
82
- }
83
- }
84
- });
85
- })());
86
- };
87
- }
88
- //# sourceMappingURL=concat.js.map
3
+ export * from "./concat.common.js";
4
+ //# sourceMappingURL=concat-react-native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-react-native.d.mts","sourceRoot":"","sources":["../../../src/util/inspect-react-native.mts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-react-native.mjs","sourceRoot":"","sources":["../../../src/util/inspect-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,qBAAqB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./inspect.common.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const custom: {};
2
+ //# sourceMappingURL=inspect.common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.common.d.ts","sourceRoot":"","sources":["../../../src/util/inspect.common.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,IAAK,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export const custom = {};
4
+ //# sourceMappingURL=inspect.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.common.js","sourceRoot":"","sources":["../../../src/util/inspect.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const custom = {};\n"]}
@@ -1,2 +1,2 @@
1
- export declare const custom: symbol;
2
- //# sourceMappingURL=inspect.d.ts.map
1
+ export * from "./inspect.common.js";
2
+ //# sourceMappingURL=inspect-react-native.d.mts.map
@@ -1,5 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { inspect } from "node:util";
4
- export const custom = inspect.custom;
5
- //# sourceMappingURL=inspect.js.map
3
+ export * from "./inspect.common.js";
4
+ //# sourceMappingURL=inspect-react-native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256-react-native.d.mts","sourceRoot":"","sources":["../../../src/util/sha256-react-native.mts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256-react-native.mjs","sourceRoot":"","sources":["../../../src/util/sha256-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./sha256.common.js\";\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generates a SHA-256 HMAC signature.
3
+ * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
4
+ * @param stringToSign - The data to be signed.
5
+ * @param encoding - The textual encoding to use for the returned HMAC digest.
6
+ */
7
+ export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
8
+ /**
9
+ * Generates a SHA-256 hash.
10
+ * @param content - The data to be included in the hash.
11
+ * @param encoding - The textual encoding to use for the returned hash.
12
+ */
13
+ export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
14
+ //# sourceMappingURL=sha256.common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.common.d.ts","sourceRoot":"","sources":["../../../src/util/sha256.common.ts"],"names":[],"mappings":"AAmEA;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,GAAG,KAAK,GACzB,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,GAAG,KAAK,GACzB,OAAO,CAAC,MAAM,CAAC,CAKjB"}
@@ -0,0 +1,49 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { stringToUint8Array, uint8ArrayToString } from "./bytesEncoding.js";
4
+ let subtleCrypto;
5
+ /**
6
+ * Returns a cached reference to the Web API crypto.subtle object.
7
+ * @internal
8
+ */
9
+ function getCrypto() {
10
+ if (subtleCrypto) {
11
+ return subtleCrypto;
12
+ }
13
+ if (!self.crypto || !self.crypto.subtle) {
14
+ throw new Error("Your browser environment does not support cryptography functions.");
15
+ }
16
+ subtleCrypto = self.crypto.subtle;
17
+ return subtleCrypto;
18
+ }
19
+ /**
20
+ * Generates a SHA-256 HMAC signature.
21
+ * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
22
+ * @param stringToSign - The data to be signed.
23
+ * @param encoding - The textual encoding to use for the returned HMAC digest.
24
+ */
25
+ export async function computeSha256Hmac(key, stringToSign, encoding) {
26
+ const crypto = getCrypto();
27
+ const keyBytes = stringToUint8Array(key, "base64");
28
+ const stringToSignBytes = stringToUint8Array(stringToSign, "utf-8");
29
+ const cryptoKey = await crypto.importKey("raw", keyBytes, {
30
+ name: "HMAC",
31
+ hash: { name: "SHA-256" },
32
+ }, false, ["sign"]);
33
+ const signature = await crypto.sign({
34
+ name: "HMAC",
35
+ hash: { name: "SHA-256" },
36
+ }, cryptoKey, stringToSignBytes);
37
+ return uint8ArrayToString(new Uint8Array(signature), encoding);
38
+ }
39
+ /**
40
+ * Generates a SHA-256 hash.
41
+ * @param content - The data to be included in the hash.
42
+ * @param encoding - The textual encoding to use for the returned hash.
43
+ */
44
+ export async function computeSha256Hash(content, encoding) {
45
+ const contentBytes = stringToUint8Array(content, "utf-8");
46
+ const digest = await getCrypto().digest({ name: "SHA-256" }, contentBytes);
47
+ return uint8ArrayToString(new Uint8Array(digest), encoding);
48
+ }
49
+ //# sourceMappingURL=sha256.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.common.js","sourceRoot":"","sources":["../../../src/util/sha256.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AA6C5E,IAAI,YAAsC,CAAC;AAE3C;;;GAGG;AACH,SAAS,SAAS;IAChB,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACvF,CAAC;IAED,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAW,EACX,YAAoB,EACpB,QAA0B;IAE1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEpE,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CACtC,KAAK,EACL,QAAQ,EACR;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CACjC;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,EACD,SAAS,EACT,iBAAiB,CAClB,CAAC;IAEF,OAAO,kBAAkB,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAe,EACf,QAA0B;IAE1B,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,YAAY,CAAC,CAAC;IAE3E,OAAO,kBAAkB,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { stringToUint8Array, uint8ArrayToString } from \"./bytesEncoding.js\";\n\n// stubs for browser self.crypto\ninterface JsonWebKey {}\ninterface CryptoKey {}\ntype KeyUsage =\n | \"decrypt\"\n | \"deriveBits\"\n | \"deriveKey\"\n | \"encrypt\"\n | \"sign\"\n | \"unwrapKey\"\n | \"verify\"\n | \"wrapKey\";\ninterface Algorithm {\n name: string;\n}\ninterface SubtleCrypto {\n importKey(\n format: string,\n keyData: JsonWebKey,\n algorithm: HmacImportParams,\n extractable: boolean,\n usage: KeyUsage[],\n ): Promise<CryptoKey>;\n sign(\n algorithm: HmacImportParams,\n key: CryptoKey,\n data: ArrayBufferView | ArrayBuffer,\n ): Promise<ArrayBuffer>;\n digest(algorithm: Algorithm, data: ArrayBufferView | ArrayBuffer): Promise<ArrayBuffer>;\n}\ninterface Crypto {\n readonly subtle: SubtleCrypto;\n getRandomValues<T extends ArrayBufferView | null>(array: T): T;\n}\ndeclare const self: {\n crypto: Crypto;\n};\ninterface HmacImportParams {\n name: string;\n hash: Algorithm;\n length?: number;\n}\n\nlet subtleCrypto: SubtleCrypto | undefined;\n\n/**\n * Returns a cached reference to the Web API crypto.subtle object.\n * @internal\n */\nfunction getCrypto(): SubtleCrypto {\n if (subtleCrypto) {\n return subtleCrypto;\n }\n\n if (!self.crypto || !self.crypto.subtle) {\n throw new Error(\"Your browser environment does not support cryptography functions.\");\n }\n\n subtleCrypto = self.crypto.subtle;\n return subtleCrypto;\n}\n\n/**\n * Generates a SHA-256 HMAC signature.\n * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.\n * @param stringToSign - The data to be signed.\n * @param encoding - The textual encoding to use for the returned HMAC digest.\n */\nexport async function computeSha256Hmac(\n key: string,\n stringToSign: string,\n encoding: \"base64\" | \"hex\",\n): Promise<string> {\n const crypto = getCrypto();\n const keyBytes = stringToUint8Array(key, \"base64\");\n const stringToSignBytes = stringToUint8Array(stringToSign, \"utf-8\");\n\n const cryptoKey = await crypto.importKey(\n \"raw\",\n keyBytes,\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\"],\n );\n const signature = await crypto.sign(\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n cryptoKey,\n stringToSignBytes,\n );\n\n return uint8ArrayToString(new Uint8Array(signature), encoding);\n}\n\n/**\n * Generates a SHA-256 hash.\n * @param content - The data to be included in the hash.\n * @param encoding - The textual encoding to use for the returned hash.\n */\nexport async function computeSha256Hash(\n content: string,\n encoding: \"base64\" | \"hex\",\n): Promise<string> {\n const contentBytes = stringToUint8Array(content, \"utf-8\");\n const digest = await getCrypto().digest({ name: \"SHA-256\" }, contentBytes);\n\n return uint8ArrayToString(new Uint8Array(digest), encoding);\n}\n"]}
@@ -1,14 +1,2 @@
1
- /**
2
- * Generates a SHA-256 HMAC signature.
3
- * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
4
- * @param stringToSign - The data to be signed.
5
- * @param encoding - The textual encoding to use for the returned HMAC digest.
6
- */
7
- export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
8
- /**
9
- * Generates a SHA-256 hash.
10
- * @param content - The data to be included in the hash.
11
- * @param encoding - The textual encoding to use for the returned hash.
12
- */
13
- export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
14
- //# sourceMappingURL=sha256.d.ts.map
1
+ export * from "./sha256.common.js";
2
+ //# sourceMappingURL=sha256-react-native.d.mts.map
@@ -1,22 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { createHash, createHmac } from "node:crypto";
4
- /**
5
- * Generates a SHA-256 HMAC signature.
6
- * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
7
- * @param stringToSign - The data to be signed.
8
- * @param encoding - The textual encoding to use for the returned HMAC digest.
9
- */
10
- export async function computeSha256Hmac(key, stringToSign, encoding) {
11
- const decodedKey = Buffer.from(key, "base64");
12
- return createHmac("sha256", decodedKey).update(stringToSign).digest(encoding);
13
- }
14
- /**
15
- * Generates a SHA-256 hash.
16
- * @param content - The data to be included in the hash.
17
- * @param encoding - The textual encoding to use for the returned hash.
18
- */
19
- export async function computeSha256Hash(content, encoding) {
20
- return createHash("sha256").update(content).digest(encoding);
21
- }
22
- //# sourceMappingURL=sha256.js.map
3
+ export * from "./sha256.common.js";
4
+ //# sourceMappingURL=sha256-react-native.mjs.map
@@ -5,5 +5,5 @@ export declare function getUserAgentHeaderName(): string;
5
5
  /**
6
6
  * @internal
7
7
  */
8
- export declare function getUserAgentValue(prefix?: string): string;
8
+ export declare function getUserAgentValue(prefix?: string): Promise<string>;
9
9
  //# sourceMappingURL=userAgent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userAgent.d.ts","sourceRoot":"","sources":["../../../src/util/userAgent.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAOzD"}
1
+ {"version":3,"file":"userAgent.d.ts","sourceRoot":"","sources":["../../../src/util/userAgent.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOxE"}
@@ -19,10 +19,10 @@ export function getUserAgentHeaderName() {
19
19
  /**
20
20
  * @internal
21
21
  */
22
- export function getUserAgentValue(prefix) {
22
+ export async function getUserAgentValue(prefix) {
23
23
  const runtimeInfo = new Map();
24
24
  runtimeInfo.set("ts-http-runtime", SDK_VERSION);
25
- setPlatformSpecificData(runtimeInfo);
25
+ await setPlatformSpecificData(runtimeInfo);
26
26
  const defaultAgent = getUserAgentString(runtimeInfo);
27
27
  const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent;
28
28
  return userAgentValue;
@@ -1 +1 @@
1
- {"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../../src/util/userAgent.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,SAAS,kBAAkB,CAAC,aAAkC;IAC5D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,aAAa,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,WAAW,CAAC,GAAG,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAChD,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAC3E,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getHeaderName, setPlatformSpecificData } from \"./userAgentPlatform.js\";\nimport { SDK_VERSION } from \"../constants.js\";\n\nfunction getUserAgentString(telemetryInfo: Map<string, string>): string {\n const parts: string[] = [];\n for (const [key, value] of telemetryInfo) {\n const token = value ? `${key}/${value}` : key;\n parts.push(token);\n }\n return parts.join(\" \");\n}\n\n/**\n * @internal\n */\nexport function getUserAgentHeaderName(): string {\n return getHeaderName();\n}\n\n/**\n * @internal\n */\nexport function getUserAgentValue(prefix?: string): string {\n const runtimeInfo = new Map<string, string>();\n runtimeInfo.set(\"ts-http-runtime\", SDK_VERSION);\n setPlatformSpecificData(runtimeInfo);\n const defaultAgent = getUserAgentString(runtimeInfo);\n const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent;\n return userAgentValue;\n}\n"]}
1
+ {"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../../src/util/userAgent.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,SAAS,kBAAkB,CAAC,aAAkC;IAC5D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,aAAa,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAe;IACrD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,WAAW,CAAC,GAAG,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAChD,MAAM,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAC3E,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getHeaderName, setPlatformSpecificData } from \"./userAgentPlatform.js\";\nimport { SDK_VERSION } from \"../constants.js\";\n\nfunction getUserAgentString(telemetryInfo: Map<string, string>): string {\n const parts: string[] = [];\n for (const [key, value] of telemetryInfo) {\n const token = value ? `${key}/${value}` : key;\n parts.push(token);\n }\n return parts.join(\" \");\n}\n\n/**\n * @internal\n */\nexport function getUserAgentHeaderName(): string {\n return getHeaderName();\n}\n\n/**\n * @internal\n */\nexport async function getUserAgentValue(prefix?: string): Promise<string> {\n const runtimeInfo = new Map<string, string>();\n runtimeInfo.set(\"ts-http-runtime\", SDK_VERSION);\n await setPlatformSpecificData(runtimeInfo);\n const defaultAgent = getUserAgentString(runtimeInfo);\n const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent;\n return userAgentValue;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"userAgentPlatform-react-native.d.mts","sourceRoot":"","sources":["../../../src/util/userAgentPlatform-react-native.mts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAMtE"}
1
+ {"version":3,"file":"userAgentPlatform-react-native.d.mts","sourceRoot":"","sources":["../../../src/util/userAgentPlatform-react-native.mts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"userAgentPlatform-react-native.mjs","sourceRoot":"","sources":["../../../src/util/userAgentPlatform-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,6DAA6D;AAC7D,gBAAgB;AAChB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAwB;;IAC9D,IAAI,MAAA,QAAQ,CAAC,SAAS,0CAAE,kBAAkB,EAAE,CAAC;QAC3C,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC;QACtE,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n/* @ts-ignore */\nconst { Platform } = await import(\"react-native\");\n\n/**\n * @internal\n */\nexport function getHeaderName(): string {\n return \"x-ms-useragent\";\n}\n\n/**\n * @internal\n */\nexport function setPlatformSpecificData(map: Map<string, string>): void {\n if (Platform.constants?.reactNativeVersion) {\n const { major, minor, patch } = Platform.constants.reactNativeVersion;\n map.set(\"react-native\", `${major}.${minor}.${patch}`);\n }\n map.set(\"OS\", `${Platform.OS}-${Platform.Version}`);\n}\n"]}
1
+ {"version":3,"file":"userAgentPlatform-react-native.mjs","sourceRoot":"","sources":["../../../src/util/userAgentPlatform-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,GAAwB;;IACpE,IAAI,MAAA,QAAQ,CAAC,SAAS,0CAAE,kBAAkB,EAAE,CAAC;QAC3C,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC;QACtE,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Platform } from \"react-native\";\n\n/**\n * @internal\n */\nexport function getHeaderName(): string {\n return \"x-ms-useragent\";\n}\n\n/**\n * @internal\n */\nexport async function setPlatformSpecificData(map: Map<string, string>): Promise<void> {\n if (Platform.constants?.reactNativeVersion) {\n const { major, minor, patch } = Platform.constants.reactNativeVersion;\n map.set(\"react-native\", `${major}.${minor}.${patch}`);\n }\n map.set(\"OS\", `${Platform.OS}-${Platform.Version}`);\n}\n"]}
@@ -5,5 +5,5 @@ export declare function getHeaderName(): string;
5
5
  /**
6
6
  * @internal
7
7
  */
8
- export declare function setPlatformSpecificData(map: Map<string, string>): void;
8
+ export declare function setPlatformSpecificData(map: Map<string, string>): Promise<void>;
9
9
  //# sourceMappingURL=userAgentPlatform-react-native.d.mts.map
@@ -1,8 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
- /* @ts-ignore */
5
- const { Platform } = await import("react-native");
3
+ import { Platform } from "react-native";
6
4
  /**
7
5
  * @internal
8
6
  */
@@ -12,7 +10,7 @@ export function getHeaderName() {
12
10
  /**
13
11
  * @internal
14
12
  */
15
- export function setPlatformSpecificData(map) {
13
+ export async function setPlatformSpecificData(map) {
16
14
  var _a;
17
15
  if ((_a = Platform.constants) === null || _a === void 0 ? void 0 : _a.reactNativeVersion) {
18
16
  const { major, minor, patch } = Platform.constants.reactNativeVersion;