ai 1.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-GT4HKF2X.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,528 +0,0 @@
1
- /*! http://mths.be/punycode v1.3.1 by @mathias */
2
- ;(function(root) {
3
-
4
- /** Detect free variables */
5
- var freeExports = typeof exports == 'object' && exports &&
6
- !exports.nodeType && exports;
7
- var freeModule = typeof module == 'object' && module &&
8
- !module.nodeType && module;
9
- var freeGlobal = typeof global == 'object' && global;
10
- if (
11
- freeGlobal.global === freeGlobal ||
12
- freeGlobal.window === freeGlobal ||
13
- freeGlobal.self === freeGlobal
14
- ) {
15
- root = freeGlobal;
16
- }
17
-
18
- /**
19
- * The `punycode` object.
20
- * @name punycode
21
- * @type Object
22
- */
23
- var punycode,
24
-
25
- /** Highest positive signed 32-bit float value */
26
- maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
27
-
28
- /** Bootstring parameters */
29
- base = 36,
30
- tMin = 1,
31
- tMax = 26,
32
- skew = 38,
33
- damp = 700,
34
- initialBias = 72,
35
- initialN = 128, // 0x80
36
- delimiter = '-', // '\x2D'
37
-
38
- /** Regular expressions */
39
- regexPunycode = /^xn--/,
40
- regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
41
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
42
-
43
- /** Error messages */
44
- errors = {
45
- 'overflow': 'Overflow: input needs wider integers to process',
46
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
47
- 'invalid-input': 'Invalid input'
48
- },
49
-
50
- /** Convenience shortcuts */
51
- baseMinusTMin = base - tMin,
52
- floor = Math.floor,
53
- stringFromCharCode = String.fromCharCode,
54
-
55
- /** Temporary variable */
56
- key;
57
-
58
- /*--------------------------------------------------------------------------*/
59
-
60
- /**
61
- * A generic error utility function.
62
- * @private
63
- * @param {String} type The error type.
64
- * @returns {Error} Throws a `RangeError` with the applicable error message.
65
- */
66
- function error(type) {
67
- throw RangeError(errors[type]);
68
- }
69
-
70
- /**
71
- * A generic `Array#map` utility function.
72
- * @private
73
- * @param {Array} array The array to iterate over.
74
- * @param {Function} callback The function that gets called for every array
75
- * item.
76
- * @returns {Array} A new array of values returned by the callback function.
77
- */
78
- function map(array, fn) {
79
- var length = array.length;
80
- var result = [];
81
- while (length--) {
82
- result[length] = fn(array[length]);
83
- }
84
- return result;
85
- }
86
-
87
- /**
88
- * A simple `Array#map`-like wrapper to work with domain name strings or email
89
- * addresses.
90
- * @private
91
- * @param {String} domain The domain name or email address.
92
- * @param {Function} callback The function that gets called for every
93
- * character.
94
- * @returns {Array} A new string of characters returned by the callback
95
- * function.
96
- */
97
- function mapDomain(string, fn) {
98
- var parts = string.split('@');
99
- var result = '';
100
- if (parts.length > 1) {
101
- // In email addresses, only the domain name should be punycoded. Leave
102
- // the local part (i.e. everything up to `@`) intact.
103
- result = parts[0] + '@';
104
- string = parts[1];
105
- }
106
- var labels = string.split(regexSeparators);
107
- var encoded = map(labels, fn).join('.');
108
- return result + encoded;
109
- }
110
-
111
- /**
112
- * Creates an array containing the numeric code points of each Unicode
113
- * character in the string. While JavaScript uses UCS-2 internally,
114
- * this function will convert a pair of surrogate halves (each of which
115
- * UCS-2 exposes as separate characters) into a single code point,
116
- * matching UTF-16.
117
- * @see `punycode.ucs2.encode`
118
- * @see <http://mathiasbynens.be/notes/javascript-encoding>
119
- * @memberOf punycode.ucs2
120
- * @name decode
121
- * @param {String} string The Unicode input string (UCS-2).
122
- * @returns {Array} The new array of code points.
123
- */
124
- function ucs2decode(string) {
125
- var output = [],
126
- counter = 0,
127
- length = string.length,
128
- value,
129
- extra;
130
- while (counter < length) {
131
- value = string.charCodeAt(counter++);
132
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
133
- // high surrogate, and there is a next character
134
- extra = string.charCodeAt(counter++);
135
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
136
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
137
- } else {
138
- // unmatched surrogate; only append this code unit, in case the next
139
- // code unit is the high surrogate of a surrogate pair
140
- output.push(value);
141
- counter--;
142
- }
143
- } else {
144
- output.push(value);
145
- }
146
- }
147
- return output;
148
- }
149
-
150
- /**
151
- * Creates a string based on an array of numeric code points.
152
- * @see `punycode.ucs2.decode`
153
- * @memberOf punycode.ucs2
154
- * @name encode
155
- * @param {Array} codePoints The array of numeric code points.
156
- * @returns {String} The new Unicode string (UCS-2).
157
- */
158
- function ucs2encode(array) {
159
- return map(array, function(value) {
160
- var output = '';
161
- if (value > 0xFFFF) {
162
- value -= 0x10000;
163
- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
164
- value = 0xDC00 | value & 0x3FF;
165
- }
166
- output += stringFromCharCode(value);
167
- return output;
168
- }).join('');
169
- }
170
-
171
- /**
172
- * Converts a basic code point into a digit/integer.
173
- * @see `digitToBasic()`
174
- * @private
175
- * @param {Number} codePoint The basic numeric code point value.
176
- * @returns {Number} The numeric value of a basic code point (for use in
177
- * representing integers) in the range `0` to `base - 1`, or `base` if
178
- * the code point does not represent a value.
179
- */
180
- function basicToDigit(codePoint) {
181
- if (codePoint - 48 < 10) {
182
- return codePoint - 22;
183
- }
184
- if (codePoint - 65 < 26) {
185
- return codePoint - 65;
186
- }
187
- if (codePoint - 97 < 26) {
188
- return codePoint - 97;
189
- }
190
- return base;
191
- }
192
-
193
- /**
194
- * Converts a digit/integer into a basic code point.
195
- * @see `basicToDigit()`
196
- * @private
197
- * @param {Number} digit The numeric value of a basic code point.
198
- * @returns {Number} The basic code point whose value (when used for
199
- * representing integers) is `digit`, which needs to be in the range
200
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
201
- * used; else, the lowercase form is used. The behavior is undefined
202
- * if `flag` is non-zero and `digit` has no uppercase form.
203
- */
204
- function digitToBasic(digit, flag) {
205
- // 0..25 map to ASCII a..z or A..Z
206
- // 26..35 map to ASCII 0..9
207
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
208
- }
209
-
210
- /**
211
- * Bias adaptation function as per section 3.4 of RFC 3492.
212
- * http://tools.ietf.org/html/rfc3492#section-3.4
213
- * @private
214
- */
215
- function adapt(delta, numPoints, firstTime) {
216
- var k = 0;
217
- delta = firstTime ? floor(delta / damp) : delta >> 1;
218
- delta += floor(delta / numPoints);
219
- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
220
- delta = floor(delta / baseMinusTMin);
221
- }
222
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
223
- }
224
-
225
- /**
226
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
227
- * symbols.
228
- * @memberOf punycode
229
- * @param {String} input The Punycode string of ASCII-only symbols.
230
- * @returns {String} The resulting string of Unicode symbols.
231
- */
232
- function decode(input) {
233
- // Don't use UCS-2
234
- var output = [],
235
- inputLength = input.length,
236
- out,
237
- i = 0,
238
- n = initialN,
239
- bias = initialBias,
240
- basic,
241
- j,
242
- index,
243
- oldi,
244
- w,
245
- k,
246
- digit,
247
- t,
248
- /** Cached calculation results */
249
- baseMinusT;
250
-
251
- // Handle the basic code points: let `basic` be the number of input code
252
- // points before the last delimiter, or `0` if there is none, then copy
253
- // the first basic code points to the output.
254
-
255
- basic = input.lastIndexOf(delimiter);
256
- if (basic < 0) {
257
- basic = 0;
258
- }
259
-
260
- for (j = 0; j < basic; ++j) {
261
- // if it's not a basic code point
262
- if (input.charCodeAt(j) >= 0x80) {
263
- error('not-basic');
264
- }
265
- output.push(input.charCodeAt(j));
266
- }
267
-
268
- // Main decoding loop: start just after the last delimiter if any basic code
269
- // points were copied; start at the beginning otherwise.
270
-
271
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
272
-
273
- // `index` is the index of the next character to be consumed.
274
- // Decode a generalized variable-length integer into `delta`,
275
- // which gets added to `i`. The overflow checking is easier
276
- // if we increase `i` as we go, then subtract off its starting
277
- // value at the end to obtain `delta`.
278
- for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
279
-
280
- if (index >= inputLength) {
281
- error('invalid-input');
282
- }
283
-
284
- digit = basicToDigit(input.charCodeAt(index++));
285
-
286
- if (digit >= base || digit > floor((maxInt - i) / w)) {
287
- error('overflow');
288
- }
289
-
290
- i += digit * w;
291
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
292
-
293
- if (digit < t) {
294
- break;
295
- }
296
-
297
- baseMinusT = base - t;
298
- if (w > floor(maxInt / baseMinusT)) {
299
- error('overflow');
300
- }
301
-
302
- w *= baseMinusT;
303
-
304
- }
305
-
306
- out = output.length + 1;
307
- bias = adapt(i - oldi, out, oldi == 0);
308
-
309
- // `i` was supposed to wrap around from `out` to `0`,
310
- // incrementing `n` each time, so we'll fix that now:
311
- if (floor(i / out) > maxInt - n) {
312
- error('overflow');
313
- }
314
-
315
- n += floor(i / out);
316
- i %= out;
317
-
318
- // Insert `n` at position `i` of the output
319
- output.splice(i++, 0, n);
320
-
321
- }
322
-
323
- return ucs2encode(output);
324
- }
325
-
326
- /**
327
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
328
- * Punycode string of ASCII-only symbols.
329
- * @memberOf punycode
330
- * @param {String} input The string of Unicode symbols.
331
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
332
- */
333
- function encode(input) {
334
- var n,
335
- delta,
336
- handledCPCount,
337
- basicLength,
338
- bias,
339
- j,
340
- m,
341
- q,
342
- k,
343
- t,
344
- currentValue,
345
- output = [],
346
- /** `inputLength` will hold the number of code points in `input`. */
347
- inputLength,
348
- /** Cached calculation results */
349
- handledCPCountPlusOne,
350
- baseMinusT,
351
- qMinusT;
352
-
353
- // Convert the input in UCS-2 to Unicode
354
- input = ucs2decode(input);
355
-
356
- // Cache the length
357
- inputLength = input.length;
358
-
359
- // Initialize the state
360
- n = initialN;
361
- delta = 0;
362
- bias = initialBias;
363
-
364
- // Handle the basic code points
365
- for (j = 0; j < inputLength; ++j) {
366
- currentValue = input[j];
367
- if (currentValue < 0x80) {
368
- output.push(stringFromCharCode(currentValue));
369
- }
370
- }
371
-
372
- handledCPCount = basicLength = output.length;
373
-
374
- // `handledCPCount` is the number of code points that have been handled;
375
- // `basicLength` is the number of basic code points.
376
-
377
- // Finish the basic string - if it is not empty - with a delimiter
378
- if (basicLength) {
379
- output.push(delimiter);
380
- }
381
-
382
- // Main encoding loop:
383
- while (handledCPCount < inputLength) {
384
-
385
- // All non-basic code points < n have been handled already. Find the next
386
- // larger one:
387
- for (m = maxInt, j = 0; j < inputLength; ++j) {
388
- currentValue = input[j];
389
- if (currentValue >= n && currentValue < m) {
390
- m = currentValue;
391
- }
392
- }
393
-
394
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
395
- // but guard against overflow
396
- handledCPCountPlusOne = handledCPCount + 1;
397
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
398
- error('overflow');
399
- }
400
-
401
- delta += (m - n) * handledCPCountPlusOne;
402
- n = m;
403
-
404
- for (j = 0; j < inputLength; ++j) {
405
- currentValue = input[j];
406
-
407
- if (currentValue < n && ++delta > maxInt) {
408
- error('overflow');
409
- }
410
-
411
- if (currentValue == n) {
412
- // Represent delta as a generalized variable-length integer
413
- for (q = delta, k = base; /* no condition */; k += base) {
414
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
415
- if (q < t) {
416
- break;
417
- }
418
- qMinusT = q - t;
419
- baseMinusT = base - t;
420
- output.push(
421
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
422
- );
423
- q = floor(qMinusT / baseMinusT);
424
- }
425
-
426
- output.push(stringFromCharCode(digitToBasic(q, 0)));
427
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
428
- delta = 0;
429
- ++handledCPCount;
430
- }
431
- }
432
-
433
- ++delta;
434
- ++n;
435
-
436
- }
437
- return output.join('');
438
- }
439
-
440
- /**
441
- * Converts a Punycode string representing a domain name or an email address
442
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
443
- * it doesn't matter if you call it on a string that has already been
444
- * converted to Unicode.
445
- * @memberOf punycode
446
- * @param {String} input The Punycoded domain name or email address to
447
- * convert to Unicode.
448
- * @returns {String} The Unicode representation of the given Punycode
449
- * string.
450
- */
451
- function toUnicode(input) {
452
- return mapDomain(input, function(string) {
453
- return regexPunycode.test(string)
454
- ? decode(string.slice(4).toLowerCase())
455
- : string;
456
- });
457
- }
458
-
459
- /**
460
- * Converts a Unicode string representing a domain name or an email address to
461
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
462
- * i.e. it doesn't matter if you call it with a domain that's already in
463
- * ASCII.
464
- * @memberOf punycode
465
- * @param {String} input The domain name or email address to convert, as a
466
- * Unicode string.
467
- * @returns {String} The Punycode representation of the given domain name or
468
- * email address.
469
- */
470
- function toASCII(input) {
471
- return mapDomain(input, function(string) {
472
- return regexNonASCII.test(string)
473
- ? 'xn--' + encode(string)
474
- : string;
475
- });
476
- }
477
-
478
- /*--------------------------------------------------------------------------*/
479
-
480
- /** Define the public API */
481
- punycode = {
482
- /**
483
- * A string representing the current Punycode.js version number.
484
- * @memberOf punycode
485
- * @type String
486
- */
487
- 'version': '1.3.1',
488
- /**
489
- * An object of methods to convert from JavaScript's internal character
490
- * representation (UCS-2) to Unicode code points, and back.
491
- * @see <http://mathiasbynens.be/notes/javascript-encoding>
492
- * @memberOf punycode
493
- * @type Object
494
- */
495
- 'ucs2': {
496
- 'decode': ucs2decode,
497
- 'encode': ucs2encode
498
- },
499
- 'decode': decode,
500
- 'encode': encode,
501
- 'toASCII': toASCII,
502
- 'toUnicode': toUnicode
503
- };
504
-
505
- /** Expose `punycode` */
506
- // Some AMD build optimizers, like r.js, check for specific condition patterns
507
- // like the following:
508
- if (
509
- typeof define == 'function' &&
510
- typeof define.amd == 'object' &&
511
- define.amd
512
- ) {
513
- define('punycode', function() {
514
- return punycode;
515
- });
516
- } else if (freeExports && freeModule) {
517
- if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
518
- freeModule.exports = punycode;
519
- } else { // in Narwhal or RingoJS v0.7.0-
520
- for (key in punycode) {
521
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
522
- }
523
- }
524
- } else { // in Rhino or a web browser
525
- root.punycode = punycode;
526
- }
527
-
528
- }(this));
@@ -1,67 +0,0 @@
1
- {
2
- "author": {
3
- "name": "GoInstant Inc., a salesforce.com company"
4
- },
5
- "license": "MIT",
6
- "name": "tough-cookie",
7
- "description": "RFC6265 Cookies and Cookie Jar for node.js",
8
- "keywords": [
9
- "HTTP",
10
- "cookie",
11
- "cookies",
12
- "set-cookie",
13
- "cookiejar",
14
- "jar",
15
- "RFC6265",
16
- "RFC2965"
17
- ],
18
- "version": "0.12.1",
19
- "homepage": "https://github.com/goinstant/tough-cookie",
20
- "repository": {
21
- "type": "git",
22
- "url": "git://github.com/goinstant/tough-cookie.git"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/goinstant/tough-cookie/issues"
26
- },
27
- "main": "./lib/cookie",
28
- "scripts": {
29
- "test": "vows test.js"
30
- },
31
- "engines": {
32
- "node": ">=0.4.12"
33
- },
34
- "dependencies": {
35
- "punycode": ">=0.2.0"
36
- },
37
- "devDependencies": {
38
- "vows": "0.7.0",
39
- "async": ">=0.1.12"
40
- },
41
- "readme": "[RFC6265](http://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n![Tough Cookie](http://www.goinstant.com.s3.amazonaws.com/tough-cookie.jpg)\n\n[![Build Status](https://travis-ci.org/goinstant/node-cookie.png?branch=master)](https://travis-ci.org/goinstant/node-cookie)\n\n[![NPM Stats](https://nodei.co/npm/tough-cookie.png?downloads=true&stars=true)](https://npmjs.org/package/tough-cookie)\n![NPM Downloads](https://nodei.co/npm-dl/tough-cookie.png?months=9)\n\n# Synopsis\n\n``` javascript\nvar tough = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'\nvar Cookie = tough.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new tough.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nRequires `punycode`, which should get installed automatically for you. Note that node.js v0.6.2+ bundles punycode by default.\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n# API\n\ntough\n=====\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\nparseDate(string[,strict])\n-----------------\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. If strict is set to true then leading/trailing non-seperator characters around the time part will cause the parsing to fail (e.g. \"Thu, 01 Jan 1970 00:00:010 GMT\" has an extra trailing zero but Chrome, an assumedly RFC-compliant browser, treats this as valid).\n\nformatDate(date)\n----------------\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\ncanonicalDomain(str)\n--------------------\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\ndomainMatch(str,domStr[,canonicalize=true])\n-------------------------------------------\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not.\n\ndefaultPath(path)\n-----------------\n\nGiven a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\npathMatch(reqPath,cookiePath)\n-----------------------------\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\nparse(header[,strict=false])\n----------------------------\n\nalias for `Cookie.parse(header[,strict])`\n\nfromJSON(string)\n----------------\n\nalias for `Cookie.fromJSON(string)`\n\ngetPublicSuffix(hostname)\n-------------------------\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site.\n\ncookieCompare(a,b)\n------------------\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). Longest `.path`s go first, then sorted oldest to youngest.\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\npermuteDomain(domain)\n---------------------\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n\npermutePath(path)\n-----------------\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\nCookie\n======\n\nCookie.parse(header[,strict=false])\n-----------------------------------\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. If in strict mode, returns `undefined` if the cookie doesn't follow the guidelines in section 4 of RFC6265. Generally speaking, strict mode can be used to validate your own generated Set-Cookie headers, but acting as a client you want to be lenient and leave strict mode off.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(function (c) { return (Cookie.parse(c)); });\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\nCookie.fromJSON(string)\n-----------------------\n\nConvert a JSON string to a `Cookie` object. Does a `JSON.parse()` and converts the `.created`, `.lastAccessed` and `.expires` properties into `Date` objects.\n\nProperties\n==========\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n\nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _created_ - `Date` - when this cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\nConstruction([{options}])\n------------\n\nReceives an options object that can contain any Cookie properties, uses the default for unspecified properties.\n\n.toString()\n-----------\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n.cookieString()\n---------------\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n.setExpires(String)\n-------------------\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n.setMaxAge(number)\n-------------------\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n.expiryTime([now=Date.now()])\n-----------------------------\n\n.expiryDate([now=Date.now()])\n-----------------------------\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.created` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n.TTL([now=Date.now()])\n---------\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n.canonicalizedDoman()\n---------------------\n\n.cdomain()\n----------\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n.validate()\n-----------\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\nCookieJar\n=========\n\nConstruction([store = new MemoryCookieStore()][, rejectPublicSuffixes])\n------------\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\n\nAttributes\n----------\n\n * _rejectPublicSuffixes_ - boolean - reject cookies with domains like \"com\" and \"co.uk\" (default: `true`)\n\nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))\n-------------------------------------------------------------------\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.created`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _strict_ - boolean - default `false` - perform extra checks\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. CookieStore errors aren't ignored by this option.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n.setCookieSync(cookieOrString, currentUrl, [{options}])\n-------------------------------------------------------\n\nSynchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n.storeCookie(cookie, [{options},] cb(err,cookie))\n-------------------------------------------------\n\n__REMOVED__ removed in lieu of the CookieStore API below\n\n.getCookies(currentUrl, [{options},] cb(err,cookies))\n-----------------------------------------------------\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the CookieStore `fetchCookies` function (the default MemoryCookieStore supports it).\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n.getCookiesSync(currentUrl, [{options}])\n----------------------------------------\n\nSynchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n.getCookieString(...)\n---------------------\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n.getCookieStringSync(...)\n-------------------------\n\nSynchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n.getSetCookieStrings(...)\n-------------------------\n\nReturns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.\n\n.getSetCookieStringsSync(...)\n-----------------------------\n\nSynchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\nStore\n=====\n\nBase class for CookieJar stores.\n\n# CookieStore API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nStores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`. Stores are asynchronous by default, but if `store.synchronous` is set, then the `*Sync` methods on the CookieJar can be used.\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\nstore.findCookie(domain, path, key, cb(err,cookie))\n---------------------------------------------------\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\nstore.findCookies(domain, path, cb(err,cookies))\n------------------------------------------------\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\nstore.putCookie(cookie, cb(err))\n--------------------------------\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\nstore.updateCookie(oldCookie, newCookie, cb(err))\n-------------------------------------------------\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects and `.created` will always be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are sorted (or selected for deletion).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\nstore.removeCookie(domain, path, key, cb(err))\n----------------------------------------------\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\nstore.removeCookies(domain, path, cb(err))\n------------------------------------------\n\nRemoves matching cookies from the store. The `path` paramter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n# TODO\n\n * _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()`\n * the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891\n * better tests for `validate()`?\n\n# Copyright and License\n\n(tl;dr: MIT with some MPL/1.1)\n\nCopyright 2012- GoInstant, Inc. and other contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\nPortions may be licensed under different licenses (in particular public-suffix.txt is MPL/1.1); please read the LICENSE file for full details.\n",
42
- "readmeFilename": "README.md",
43
- "_id": "tough-cookie@0.12.1",
44
- "dist": {
45
- "shasum": "8220c7e21abd5b13d96804254bd5a81ebf2c7d62",
46
- "tarball": "http://registry.npmjs.org/tough-cookie/-/tough-cookie-0.12.1.tgz"
47
- },
48
- "_from": "tough-cookie@>=0.12.0",
49
- "_npmVersion": "1.3.11",
50
- "_npmUser": {
51
- "name": "goinstant",
52
- "email": "support@goinstant.com"
53
- },
54
- "maintainers": [
55
- {
56
- "name": "jstash",
57
- "email": "jeremy@goinstant.com"
58
- },
59
- {
60
- "name": "goinstant",
61
- "email": "services@goinstant.com"
62
- }
63
- ],
64
- "directories": {},
65
- "_shasum": "8220c7e21abd5b13d96804254bd5a81ebf2c7d62",
66
- "_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-0.12.1.tgz"
67
- }