ai 1.1.0 → 2.0.0

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 (340) hide show
  1. package/LICENSE +10 -24
  2. package/dist/ai-stream.d.ts +18 -0
  3. package/dist/ai-stream.js +132 -0
  4. package/dist/ai-stream.mjs +13 -0
  5. package/dist/anthropic-stream.d.ts +5 -0
  6. package/dist/anthropic-stream.js +133 -0
  7. package/dist/anthropic-stream.mjs +8 -0
  8. package/dist/chunk-265FSSO4.mjs +91 -0
  9. package/dist/chunk-2L3ZO4UM.mjs +45 -0
  10. package/dist/chunk-EZJ7FC5E.mjs +33 -0
  11. package/dist/chunk-JGDC3BXD.mjs +22 -0
  12. package/dist/chunk-NK2CVBLI.mjs +38 -0
  13. package/dist/chunk-PEYAHBDF.mjs +43 -0
  14. package/dist/chunk-TJMME6CL.mjs +24 -0
  15. package/dist/huggingface-stream.d.ts +5 -0
  16. package/dist/huggingface-stream.js +121 -0
  17. package/dist/huggingface-stream.mjs +8 -0
  18. package/dist/index.d.ts +131 -0
  19. package/dist/index.js +278 -0
  20. package/dist/index.mjs +35 -0
  21. package/dist/index.test.d.ts +2 -0
  22. package/dist/index.test.js +12 -0
  23. package/dist/index.test.mjs +10 -0
  24. package/dist/langchain-stream.d.ts +12 -0
  25. package/dist/langchain-stream.js +102 -0
  26. package/dist/langchain-stream.mjs +8 -0
  27. package/dist/openai-stream.d.ts +5 -0
  28. package/dist/openai-stream.js +144 -0
  29. package/dist/openai-stream.mjs +8 -0
  30. package/dist/streaming-text-response.d.ts +17 -0
  31. package/dist/streaming-text-response.js +75 -0
  32. package/dist/streaming-text-response.mjs +9 -0
  33. package/package.json +78 -29
  34. package/react/dist/chunk-5PP6W52J.mjs +202 -0
  35. package/react/dist/chunk-6EH3SWMP.mjs +55 -0
  36. package/react/dist/chunk-PW6HSU2N.mjs +154 -0
  37. package/react/dist/index.d.ts +3 -0
  38. package/react/dist/index.js +424 -0
  39. package/react/dist/index.mjs +12 -0
  40. package/react/dist/types-f862f74a.d.ts +123 -0
  41. package/react/dist/use-chat.d.ts +42 -0
  42. package/react/dist/use-chat.js +276 -0
  43. package/react/dist/use-chat.mjs +8 -0
  44. package/react/dist/use-completion.d.ts +47 -0
  45. package/react/dist/use-completion.js +229 -0
  46. package/react/dist/use-completion.mjs +8 -0
  47. package/svelte/dist/chunk-6USBQIV6.mjs +177 -0
  48. package/svelte/dist/chunk-BQ64GHZ3.mjs +136 -0
  49. package/svelte/dist/chunk-CENOSGDG.mjs +493 -0
  50. package/svelte/dist/index.d.ts +4 -0
  51. package/svelte/dist/index.js +808 -0
  52. package/svelte/dist/index.mjs +11 -0
  53. package/svelte/dist/types-f862f74a.d.ts +123 -0
  54. package/svelte/dist/use-chat.d.ts +39 -0
  55. package/svelte/dist/use-chat.js +680 -0
  56. package/svelte/dist/use-chat.mjs +7 -0
  57. package/svelte/dist/use-completion.d.ts +38 -0
  58. package/svelte/dist/use-completion.js +640 -0
  59. package/svelte/dist/use-completion.mjs +7 -0
  60. package/.npmignore +0 -15
  61. package/.travis.yml +0 -4
  62. package/README.md +0 -21
  63. package/bin/ai.js +0 -22
  64. package/index.js +0 -37
  65. package/node_modules/request/.npmignore +0 -2
  66. package/node_modules/request/.travis.yml +0 -12
  67. package/node_modules/request/CHANGELOG.md +0 -954
  68. package/node_modules/request/LICENSE +0 -55
  69. package/node_modules/request/README.md +0 -421
  70. package/node_modules/request/index.js +0 -166
  71. package/node_modules/request/lib/cookies.js +0 -40
  72. package/node_modules/request/lib/copy.js +0 -8
  73. package/node_modules/request/lib/debug.js +0 -7
  74. package/node_modules/request/lib/getSafe.js +0 -34
  75. package/node_modules/request/lib/optional.js +0 -5
  76. package/node_modules/request/node_modules/aws-sign2/LICENSE +0 -55
  77. package/node_modules/request/node_modules/aws-sign2/README.md +0 -4
  78. package/node_modules/request/node_modules/aws-sign2/index.js +0 -202
  79. package/node_modules/request/node_modules/aws-sign2/package.json +0 -47
  80. package/node_modules/request/node_modules/forever-agent/LICENSE +0 -55
  81. package/node_modules/request/node_modules/forever-agent/README.md +0 -4
  82. package/node_modules/request/node_modules/forever-agent/index.js +0 -119
  83. package/node_modules/request/node_modules/forever-agent/package.json +0 -46
  84. package/node_modules/request/node_modules/form-data/License +0 -19
  85. package/node_modules/request/node_modules/form-data/Readme.md +0 -175
  86. package/node_modules/request/node_modules/form-data/lib/form_data.js +0 -351
  87. package/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +0 -3
  88. package/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +0 -19
  89. package/node_modules/request/node_modules/form-data/node_modules/async/README.md +0 -1646
  90. package/node_modules/request/node_modules/form-data/node_modules/async/component.json +0 -11
  91. package/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +0 -1123
  92. package/node_modules/request/node_modules/form-data/node_modules/async/package.json +0 -60
  93. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +0 -19
  94. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +0 -132
  95. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +0 -186
  96. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +0 -2
  97. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +0 -19
  98. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +0 -7
  99. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +0 -154
  100. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +0 -99
  101. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +0 -42
  102. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +0 -6
  103. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +0 -38
  104. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +0 -21
  105. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +0 -14
  106. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +0 -48
  107. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +0 -15
  108. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +0 -18
  109. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +0 -13
  110. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +0 -13
  111. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +0 -7
  112. package/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +0 -61
  113. package/node_modules/request/node_modules/form-data/node_modules/mime/LICENSE +0 -19
  114. package/node_modules/request/node_modules/form-data/node_modules/mime/README.md +0 -66
  115. package/node_modules/request/node_modules/form-data/node_modules/mime/mime.js +0 -114
  116. package/node_modules/request/node_modules/form-data/node_modules/mime/package.json +0 -59
  117. package/node_modules/request/node_modules/form-data/node_modules/mime/test.js +0 -84
  118. package/node_modules/request/node_modules/form-data/node_modules/mime/types/mime.types +0 -1588
  119. package/node_modules/request/node_modules/form-data/node_modules/mime/types/node.types +0 -77
  120. package/node_modules/request/node_modules/form-data/package.json +0 -80
  121. package/node_modules/request/node_modules/hawk/.npmignore +0 -18
  122. package/node_modules/request/node_modules/hawk/.travis.yml +0 -5
  123. package/node_modules/request/node_modules/hawk/LICENSE +0 -24
  124. package/node_modules/request/node_modules/hawk/Makefile +0 -10
  125. package/node_modules/request/node_modules/hawk/README.md +0 -625
  126. package/node_modules/request/node_modules/hawk/example/usage.js +0 -78
  127. package/node_modules/request/node_modules/hawk/images/hawk.png +0 -0
  128. package/node_modules/request/node_modules/hawk/images/logo.png +0 -0
  129. package/node_modules/request/node_modules/hawk/index.js +0 -1
  130. package/node_modules/request/node_modules/hawk/lib/browser.js +0 -507
  131. package/node_modules/request/node_modules/hawk/lib/client.js +0 -371
  132. package/node_modules/request/node_modules/hawk/lib/crypto.js +0 -118
  133. package/node_modules/request/node_modules/hawk/lib/index.js +0 -15
  134. package/node_modules/request/node_modules/hawk/lib/server.js +0 -523
  135. package/node_modules/request/node_modules/hawk/lib/utils.js +0 -183
  136. package/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore +0 -18
  137. package/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml +0 -5
  138. package/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE +0 -24
  139. package/node_modules/request/node_modules/hawk/node_modules/boom/Makefile +0 -11
  140. package/node_modules/request/node_modules/hawk/node_modules/boom/README.md +0 -6
  141. package/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png +0 -0
  142. package/node_modules/request/node_modules/hawk/node_modules/boom/index.js +0 -1
  143. package/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js +0 -207
  144. package/node_modules/request/node_modules/hawk/node_modules/boom/package.json +0 -64
  145. package/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js +0 -245
  146. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore +0 -18
  147. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml +0 -5
  148. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE +0 -24
  149. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile +0 -11
  150. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md +0 -6
  151. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js +0 -1
  152. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js +0 -68
  153. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json +0 -65
  154. package/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js +0 -101
  155. package/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore +0 -18
  156. package/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml +0 -5
  157. package/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE +0 -33
  158. package/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile +0 -10
  159. package/node_modules/request/node_modules/hawk/node_modules/hoek/README.md +0 -436
  160. package/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png +0 -0
  161. package/node_modules/request/node_modules/hawk/node_modules/hoek/index.js +0 -1
  162. package/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js +0 -132
  163. package/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js +0 -585
  164. package/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +0 -70
  165. package/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js +0 -86
  166. package/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js +0 -1078
  167. package/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js +0 -1
  168. package/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js +0 -1
  169. package/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js +0 -1
  170. package/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore +0 -18
  171. package/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml +0 -5
  172. package/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE +0 -24
  173. package/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile +0 -11
  174. package/node_modules/request/node_modules/hawk/node_modules/sntp/README.md +0 -68
  175. package/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js +0 -16
  176. package/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js +0 -25
  177. package/node_modules/request/node_modules/hawk/node_modules/sntp/index.js +0 -1
  178. package/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js +0 -409
  179. package/node_modules/request/node_modules/hawk/node_modules/sntp/package.json +0 -65
  180. package/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js +0 -359
  181. package/node_modules/request/node_modules/hawk/package.json +0 -70
  182. package/node_modules/request/node_modules/hawk/test/browser.js +0 -817
  183. package/node_modules/request/node_modules/hawk/test/client.js +0 -206
  184. package/node_modules/request/node_modules/hawk/test/crypto.js +0 -86
  185. package/node_modules/request/node_modules/hawk/test/index.js +0 -316
  186. package/node_modules/request/node_modules/hawk/test/message.js +0 -246
  187. package/node_modules/request/node_modules/hawk/test/readme.js +0 -98
  188. package/node_modules/request/node_modules/hawk/test/server.js +0 -686
  189. package/node_modules/request/node_modules/hawk/test/uri.js +0 -456
  190. package/node_modules/request/node_modules/hawk/test/utils.js +0 -120
  191. package/node_modules/request/node_modules/http-signature/.dir-locals.el +0 -6
  192. package/node_modules/request/node_modules/http-signature/.npmignore +0 -7
  193. package/node_modules/request/node_modules/http-signature/LICENSE +0 -18
  194. package/node_modules/request/node_modules/http-signature/README.md +0 -75
  195. package/node_modules/request/node_modules/http-signature/http_signing.md +0 -296
  196. package/node_modules/request/node_modules/http-signature/lib/index.js +0 -25
  197. package/node_modules/request/node_modules/http-signature/lib/parser.js +0 -304
  198. package/node_modules/request/node_modules/http-signature/lib/signer.js +0 -179
  199. package/node_modules/request/node_modules/http-signature/lib/util.js +0 -249
  200. package/node_modules/request/node_modules/http-signature/lib/verify.js +0 -42
  201. package/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore +0 -2
  202. package/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE +0 -19
  203. package/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md +0 -50
  204. package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js +0 -13
  205. package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js +0 -27
  206. package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js +0 -267
  207. package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js +0 -36
  208. package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js +0 -317
  209. package/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js +0 -20
  210. package/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +0 -63
  211. package/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js +0 -172
  212. package/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js +0 -296
  213. package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md +0 -126
  214. package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js +0 -196
  215. package/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json +0 -38
  216. package/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG +0 -71
  217. package/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE +0 -24
  218. package/node_modules/request/node_modules/http-signature/node_modules/ctype/README +0 -82
  219. package/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old +0 -298
  220. package/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js +0 -245
  221. package/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js +0 -1485
  222. package/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js +0 -944
  223. package/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype +0 -241
  224. package/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +0 -36
  225. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf +0 -129
  226. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle +0 -839
  227. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json +0 -13
  228. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json +0 -13
  229. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json +0 -104
  230. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json +0 -19
  231. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js +0 -39
  232. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js +0 -14
  233. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js +0 -14
  234. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js +0 -17
  235. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js +0 -18
  236. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js +0 -15
  237. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json +0 -14
  238. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js +0 -767
  239. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js +0 -753
  240. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js +0 -638
  241. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js +0 -101
  242. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js +0 -53
  243. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js +0 -92
  244. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js +0 -451
  245. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js +0 -81
  246. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js +0 -95
  247. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js +0 -156
  248. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js +0 -50
  249. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js +0 -44
  250. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js +0 -42
  251. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js +0 -45
  252. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js +0 -28
  253. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js +0 -128
  254. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js +0 -28
  255. package/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js +0 -31
  256. package/node_modules/request/node_modules/http-signature/package.json +0 -54
  257. package/node_modules/request/node_modules/json-stringify-safe/LICENSE +0 -27
  258. package/node_modules/request/node_modules/json-stringify-safe/README.md +0 -49
  259. package/node_modules/request/node_modules/json-stringify-safe/package.json +0 -51
  260. package/node_modules/request/node_modules/json-stringify-safe/stringify.js +0 -39
  261. package/node_modules/request/node_modules/json-stringify-safe/test.js +0 -128
  262. package/node_modules/request/node_modules/mime-types/.npmignore +0 -14
  263. package/node_modules/request/node_modules/mime-types/.travis.yml +0 -12
  264. package/node_modules/request/node_modules/mime-types/LICENSE +0 -22
  265. package/node_modules/request/node_modules/mime-types/Makefile +0 -9
  266. package/node_modules/request/node_modules/mime-types/README.md +0 -101
  267. package/node_modules/request/node_modules/mime-types/SOURCES.md +0 -17
  268. package/node_modules/request/node_modules/mime-types/component.json +0 -16
  269. package/node_modules/request/node_modules/mime-types/lib/custom.json +0 -27
  270. package/node_modules/request/node_modules/mime-types/lib/index.js +0 -75
  271. package/node_modules/request/node_modules/mime-types/lib/mime.json +0 -3317
  272. package/node_modules/request/node_modules/mime-types/lib/node.json +0 -55
  273. package/node_modules/request/node_modules/mime-types/package.json +0 -69
  274. package/node_modules/request/node_modules/node-uuid/.npmignore +0 -2
  275. package/node_modules/request/node_modules/node-uuid/LICENSE.md +0 -2
  276. package/node_modules/request/node_modules/node-uuid/README.md +0 -207
  277. package/node_modules/request/node_modules/node-uuid/benchmark/README.md +0 -53
  278. package/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +0 -174
  279. package/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +0 -34
  280. package/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +0 -34
  281. package/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +0 -84
  282. package/node_modules/request/node_modules/node-uuid/component.json +0 -18
  283. package/node_modules/request/node_modules/node-uuid/package.json +0 -54
  284. package/node_modules/request/node_modules/node-uuid/test/compare_v1.js +0 -63
  285. package/node_modules/request/node_modules/node-uuid/test/test.html +0 -17
  286. package/node_modules/request/node_modules/node-uuid/test/test.js +0 -228
  287. package/node_modules/request/node_modules/node-uuid/uuid.js +0 -245
  288. package/node_modules/request/node_modules/oauth-sign/LICENSE +0 -55
  289. package/node_modules/request/node_modules/oauth-sign/README.md +0 -4
  290. package/node_modules/request/node_modules/oauth-sign/index.js +0 -43
  291. package/node_modules/request/node_modules/oauth-sign/package.json +0 -49
  292. package/node_modules/request/node_modules/oauth-sign/test.js +0 -49
  293. package/node_modules/request/node_modules/qs/.jshintignore +0 -1
  294. package/node_modules/request/node_modules/qs/.jshintrc +0 -10
  295. package/node_modules/request/node_modules/qs/.npmignore +0 -18
  296. package/node_modules/request/node_modules/qs/.travis.yml +0 -4
  297. package/node_modules/request/node_modules/qs/LICENSE +0 -28
  298. package/node_modules/request/node_modules/qs/Makefile +0 -8
  299. package/node_modules/request/node_modules/qs/Readme.md +0 -120
  300. package/node_modules/request/node_modules/qs/index.js +0 -1
  301. package/node_modules/request/node_modules/qs/lib/index.js +0 -15
  302. package/node_modules/request/node_modules/qs/lib/parse.js +0 -151
  303. package/node_modules/request/node_modules/qs/lib/stringify.js +0 -52
  304. package/node_modules/request/node_modules/qs/lib/utils.js +0 -131
  305. package/node_modules/request/node_modules/qs/package.json +0 -61
  306. package/node_modules/request/node_modules/qs/test/parse.js +0 -236
  307. package/node_modules/request/node_modules/qs/test/stringify.js +0 -123
  308. package/node_modules/request/node_modules/stringstream/.npmignore +0 -15
  309. package/node_modules/request/node_modules/stringstream/.travis.yml +0 -4
  310. package/node_modules/request/node_modules/stringstream/LICENSE.txt +0 -4
  311. package/node_modules/request/node_modules/stringstream/README.md +0 -38
  312. package/node_modules/request/node_modules/stringstream/example.js +0 -27
  313. package/node_modules/request/node_modules/stringstream/package.json +0 -48
  314. package/node_modules/request/node_modules/stringstream/stringstream.js +0 -102
  315. package/node_modules/request/node_modules/tough-cookie/.jshintrc +0 -70
  316. package/node_modules/request/node_modules/tough-cookie/.npmignore +0 -3
  317. package/node_modules/request/node_modules/tough-cookie/.travis.yml +0 -8
  318. package/node_modules/request/node_modules/tough-cookie/LICENSE +0 -78
  319. package/node_modules/request/node_modules/tough-cookie/README.md +0 -412
  320. package/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +0 -239
  321. package/node_modules/request/node_modules/tough-cookie/lib/cookie.js +0 -1107
  322. package/node_modules/request/node_modules/tough-cookie/lib/memstore.js +0 -123
  323. package/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +0 -69
  324. package/node_modules/request/node_modules/tough-cookie/lib/store.js +0 -37
  325. package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/LICENSE-MIT.txt +0 -20
  326. package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/README.md +0 -176
  327. package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/package.json +0 -87
  328. package/node_modules/request/node_modules/tough-cookie/node_modules/punycode/punycode.js +0 -528
  329. package/node_modules/request/node_modules/tough-cookie/package.json +0 -67
  330. package/node_modules/request/node_modules/tough-cookie/public-suffix.txt +0 -5229
  331. package/node_modules/request/node_modules/tough-cookie/test.js +0 -1625
  332. package/node_modules/request/node_modules/tunnel-agent/.jshintrc +0 -5
  333. package/node_modules/request/node_modules/tunnel-agent/LICENSE +0 -55
  334. package/node_modules/request/node_modules/tunnel-agent/README.md +0 -4
  335. package/node_modules/request/node_modules/tunnel-agent/index.js +0 -236
  336. package/node_modules/request/node_modules/tunnel-agent/package.json +0 -46
  337. package/node_modules/request/package.json +0 -77
  338. package/node_modules/request/request.js +0 -1428
  339. package/test/fixtures/github-response.json +0 -1367
  340. package/test/index.js +0 -55
@@ -1,371 +0,0 @@
1
- // Load modules
2
-
3
- var Url = require('url');
4
- var Hoek = require('hoek');
5
- var Cryptiles = require('cryptiles');
6
- var Crypto = require('./crypto');
7
- var Utils = require('./utils');
8
-
9
-
10
- // Declare internals
11
-
12
- var internals = {};
13
-
14
-
15
- // Generate an Authorization header for a given request
16
-
17
- /*
18
- uri: 'http://example.com/resource?a=b' or object from Url.parse()
19
- method: HTTP verb (e.g. 'GET', 'POST')
20
- options: {
21
-
22
- // Required
23
-
24
- credentials: {
25
- id: 'dh37fgj492je',
26
- key: 'aoijedoaijsdlaksjdl',
27
- algorithm: 'sha256' // 'sha1', 'sha256'
28
- },
29
-
30
- // Optional
31
-
32
- ext: 'application-specific', // Application specific data sent via the ext attribute
33
- timestamp: Date.now(), // A pre-calculated timestamp
34
- nonce: '2334f34f', // A pre-generated nonce
35
- localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
36
- payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
37
- contentType: 'application/json', // Payload content-type (ignored if hash provided)
38
- hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash
39
- app: '24s23423f34dx', // Oz application id
40
- dlg: '234sz34tww3sd' // Oz delegated-by application id
41
- }
42
- */
43
-
44
- exports.header = function (uri, method, options) {
45
-
46
- var result = {
47
- field: '',
48
- artifacts: {}
49
- };
50
-
51
- // Validate inputs
52
-
53
- if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') ||
54
- !method || typeof method !== 'string' ||
55
- !options || typeof options !== 'object') {
56
-
57
- result.err = 'Invalid argument type';
58
- return result;
59
- }
60
-
61
- // Application time
62
-
63
- var timestamp = options.timestamp || Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
64
-
65
- // Validate credentials
66
-
67
- var credentials = options.credentials;
68
- if (!credentials ||
69
- !credentials.id ||
70
- !credentials.key ||
71
- !credentials.algorithm) {
72
-
73
- result.err = 'Invalid credential object';
74
- return result;
75
- }
76
-
77
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
78
- result.err = 'Unknown algorithm';
79
- return result;
80
- }
81
-
82
- // Parse URI
83
-
84
- if (typeof uri === 'string') {
85
- uri = Url.parse(uri);
86
- }
87
-
88
- // Calculate signature
89
-
90
- var artifacts = {
91
- ts: timestamp,
92
- nonce: options.nonce || Cryptiles.randomString(6),
93
- method: method,
94
- resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
95
- host: uri.hostname,
96
- port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
97
- hash: options.hash,
98
- ext: options.ext,
99
- app: options.app,
100
- dlg: options.dlg
101
- };
102
-
103
- result.artifacts = artifacts;
104
-
105
- // Calculate payload hash
106
-
107
- if (!artifacts.hash &&
108
- options.hasOwnProperty('payload')) {
109
-
110
- artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
111
- }
112
-
113
- var mac = Crypto.calculateMac('header', credentials, artifacts);
114
-
115
- // Construct header
116
-
117
- var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed
118
- var header = 'Hawk id="' + credentials.id +
119
- '", ts="' + artifacts.ts +
120
- '", nonce="' + artifacts.nonce +
121
- (artifacts.hash ? '", hash="' + artifacts.hash : '') +
122
- (hasExt ? '", ext="' + Utils.escapeHeaderAttribute(artifacts.ext) : '') +
123
- '", mac="' + mac + '"';
124
-
125
- if (artifacts.app) {
126
- header += ', app="' + artifacts.app +
127
- (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
128
- }
129
-
130
- result.field = header;
131
-
132
- return result;
133
- };
134
-
135
-
136
- // Validate server response
137
-
138
- /*
139
- res: node's response object
140
- artifacts: object recieved from header().artifacts
141
- options: {
142
- payload: optional payload received
143
- required: specifies if a Server-Authorization header is required. Defaults to 'false'
144
- }
145
- */
146
-
147
- exports.authenticate = function (res, credentials, artifacts, options) {
148
-
149
- artifacts = Hoek.clone(artifacts);
150
- options = options || {};
151
-
152
- if (res.headers['www-authenticate']) {
153
-
154
- // Parse HTTP WWW-Authenticate header
155
-
156
- var attributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']);
157
- if (attributes instanceof Error) {
158
- return false;
159
- }
160
-
161
- // Validate server timestamp (not used to update clock since it is done via the SNPT client)
162
-
163
- if (attributes.ts) {
164
- var tsm = Crypto.calculateTsMac(attributes.ts, credentials);
165
- if (tsm !== attributes.tsm) {
166
- return false;
167
- }
168
- }
169
- }
170
-
171
- // Parse HTTP Server-Authorization header
172
-
173
- if (!res.headers['server-authorization'] &&
174
- !options.required) {
175
-
176
- return true;
177
- }
178
-
179
- var attributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']);
180
- if (attributes instanceof Error) {
181
- return false;
182
- }
183
-
184
- artifacts.ext = attributes.ext;
185
- artifacts.hash = attributes.hash;
186
-
187
- var mac = Crypto.calculateMac('response', credentials, artifacts);
188
- if (mac !== attributes.mac) {
189
- return false;
190
- }
191
-
192
- if (!options.hasOwnProperty('payload')) {
193
- return true;
194
- }
195
-
196
- if (!attributes.hash) {
197
- return false;
198
- }
199
-
200
- var calculatedHash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, res.headers['content-type']);
201
- return (calculatedHash === attributes.hash);
202
- };
203
-
204
-
205
- // Generate a bewit value for a given URI
206
-
207
- /*
208
- * credentials is an object with the following keys: 'id, 'key', 'algorithm'.
209
- * options is an object with the following optional keys: 'ext', 'localtimeOffsetMsec'
210
- */
211
- /*
212
- uri: 'http://example.com/resource?a=b' or object from Url.parse()
213
- options: {
214
-
215
- // Required
216
-
217
- credentials: {
218
- id: 'dh37fgj492je',
219
- key: 'aoijedoaijsdlaksjdl',
220
- algorithm: 'sha256' // 'sha1', 'sha256'
221
- },
222
- ttlSec: 60 * 60, // TTL in seconds
223
-
224
- // Optional
225
-
226
- ext: 'application-specific', // Application specific data sent via the ext attribute
227
- localtimeOffsetMsec: 400 // Time offset to sync with server time
228
- };
229
- */
230
-
231
- exports.getBewit = function (uri, options) {
232
-
233
- // Validate inputs
234
-
235
- if (!uri ||
236
- (typeof uri !== 'string' && typeof uri !== 'object') ||
237
- !options ||
238
- typeof options !== 'object' ||
239
- !options.ttlSec) {
240
-
241
- return '';
242
- }
243
-
244
- options.ext = (options.ext === null || options.ext === undefined ? '' : options.ext); // Zero is valid value
245
-
246
- // Application time
247
-
248
- var now = Utils.now() + (options.localtimeOffsetMsec || 0);
249
-
250
- // Validate credentials
251
-
252
- var credentials = options.credentials;
253
- if (!credentials ||
254
- !credentials.id ||
255
- !credentials.key ||
256
- !credentials.algorithm) {
257
-
258
- return '';
259
- }
260
-
261
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
262
- return '';
263
- }
264
-
265
- // Parse URI
266
-
267
- if (typeof uri === 'string') {
268
- uri = Url.parse(uri);
269
- }
270
-
271
- // Calculate signature
272
-
273
- var exp = Math.floor(now / 1000) + options.ttlSec;
274
- var mac = Crypto.calculateMac('bewit', credentials, {
275
- ts: exp,
276
- nonce: '',
277
- method: 'GET',
278
- resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
279
- host: uri.hostname,
280
- port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
281
- ext: options.ext
282
- });
283
-
284
- // Construct bewit: id\exp\mac\ext
285
-
286
- var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext;
287
- return Utils.base64urlEncode(bewit);
288
- };
289
-
290
-
291
- // Generate an authorization string for a message
292
-
293
- /*
294
- host: 'example.com',
295
- port: 8000,
296
- message: '{"some":"payload"}', // UTF-8 encoded string for body hash generation
297
- options: {
298
-
299
- // Required
300
-
301
- credentials: {
302
- id: 'dh37fgj492je',
303
- key: 'aoijedoaijsdlaksjdl',
304
- algorithm: 'sha256' // 'sha1', 'sha256'
305
- },
306
-
307
- // Optional
308
-
309
- timestamp: Date.now(), // A pre-calculated timestamp
310
- nonce: '2334f34f', // A pre-generated nonce
311
- localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
312
- }
313
- */
314
-
315
- exports.message = function (host, port, message, options) {
316
-
317
- // Validate inputs
318
-
319
- if (!host || typeof host !== 'string' ||
320
- !port || typeof port !== 'number' ||
321
- message === null || message === undefined || typeof message !== 'string' ||
322
- !options || typeof options !== 'object') {
323
-
324
- return null;
325
- }
326
-
327
- // Application time
328
-
329
- var timestamp = options.timestamp || Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
330
-
331
- // Validate credentials
332
-
333
- var credentials = options.credentials;
334
- if (!credentials ||
335
- !credentials.id ||
336
- !credentials.key ||
337
- !credentials.algorithm) {
338
-
339
- // Invalid credential object
340
- return null;
341
- }
342
-
343
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
344
- return null;
345
- }
346
-
347
- // Calculate signature
348
-
349
- var artifacts = {
350
- ts: timestamp,
351
- nonce: options.nonce || Cryptiles.randomString(6),
352
- host: host,
353
- port: port,
354
- hash: Crypto.calculatePayloadHash(message, credentials.algorithm)
355
- };
356
-
357
- // Construct authorization
358
-
359
- var result = {
360
- id: credentials.id,
361
- ts: artifacts.ts,
362
- nonce: artifacts.nonce,
363
- hash: artifacts.hash,
364
- mac: Crypto.calculateMac('message', credentials, artifacts)
365
- };
366
-
367
- return result;
368
- };
369
-
370
-
371
-
@@ -1,118 +0,0 @@
1
- // Load modules
2
-
3
- var Crypto = require('crypto');
4
- var Url = require('url');
5
- var Utils = require('./utils');
6
-
7
-
8
- // Declare internals
9
-
10
- var internals = {};
11
-
12
-
13
- // MAC normalization format version
14
-
15
- exports.headerVersion = '1'; // Prevent comparison of mac values generated with different normalized string formats
16
-
17
-
18
- // Supported HMAC algorithms
19
-
20
- exports.algorithms = ['sha1', 'sha256'];
21
-
22
-
23
- // Calculate the request MAC
24
-
25
- /*
26
- type: 'header', // 'header', 'bewit', 'response'
27
- credentials: {
28
- key: 'aoijedoaijsdlaksjdl',
29
- algorithm: 'sha256' // 'sha1', 'sha256'
30
- },
31
- options: {
32
- method: 'GET',
33
- resource: '/resource?a=1&b=2',
34
- host: 'example.com',
35
- port: 8080,
36
- ts: 1357718381034,
37
- nonce: 'd3d345f',
38
- hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=',
39
- ext: 'app-specific-data',
40
- app: 'hf48hd83qwkj', // Application id (Oz)
41
- dlg: 'd8djwekds9cj' // Delegated by application id (Oz), requires options.app
42
- }
43
- */
44
-
45
- exports.calculateMac = function (type, credentials, options) {
46
-
47
- var normalized = exports.generateNormalizedString(type, options);
48
-
49
- var hmac = Crypto.createHmac(credentials.algorithm, credentials.key).update(normalized);
50
- var digest = hmac.digest('base64');
51
- return digest;
52
- };
53
-
54
-
55
- exports.generateNormalizedString = function (type, options) {
56
-
57
- var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' +
58
- options.ts + '\n' +
59
- options.nonce + '\n' +
60
- (options.method || '').toUpperCase() + '\n' +
61
- (options.resource || '') + '\n' +
62
- options.host.toLowerCase() + '\n' +
63
- options.port + '\n' +
64
- (options.hash || '') + '\n';
65
-
66
- if (options.ext) {
67
- normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n');
68
- }
69
-
70
- normalized += '\n';
71
-
72
- if (options.app) {
73
- normalized += options.app + '\n' +
74
- (options.dlg || '') + '\n';
75
- }
76
-
77
- return normalized;
78
- };
79
-
80
-
81
- exports.calculatePayloadHash = function (payload, algorithm, contentType) {
82
-
83
- var hash = exports.initializePayloadHash(algorithm, contentType);
84
- hash.update(payload || '');
85
- return exports.finalizePayloadHash(hash);
86
- };
87
-
88
-
89
- exports.initializePayloadHash = function (algorithm, contentType) {
90
-
91
- var hash = Crypto.createHash(algorithm);
92
- hash.update('hawk.' + exports.headerVersion + '.payload\n');
93
- hash.update(Utils.parseContentType(contentType) + '\n');
94
- return hash;
95
- };
96
-
97
-
98
- exports.finalizePayloadHash = function (hash) {
99
-
100
- hash.update('\n');
101
- return hash.digest('base64');
102
- };
103
-
104
-
105
- exports.calculateTsMac = function (ts, credentials) {
106
-
107
- var hmac = Crypto.createHmac(credentials.algorithm, credentials.key);
108
- hmac.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n');
109
- return hmac.digest('base64');
110
- };
111
-
112
-
113
- exports.timestampMessage = function (credentials, localtimeOffsetMsec) {
114
-
115
- var now = Math.floor((Utils.now() + (localtimeOffsetMsec || 0)) / 1000);
116
- var tsm = exports.calculateTsMac(now, credentials);
117
- return { ts: now, tsm: tsm };
118
- };
@@ -1,15 +0,0 @@
1
- // Export sub-modules
2
-
3
- exports.error = exports.Error = require('boom');
4
- exports.sntp = require('sntp');
5
-
6
- exports.server = require('./server');
7
- exports.client = require('./client');
8
- exports.crypto = require('./crypto');
9
- exports.utils = require('./utils');
10
-
11
- exports.uri = {
12
- authenticate: exports.server.authenticateBewit,
13
- getBewit: exports.client.getBewit
14
- };
15
-