ru.Bee 1.3.3 → 1.4.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 (180) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rubee +36 -4
  3. data/lib/app/views/app.tsx +27 -0
  4. data/lib/app/views/index.html +47 -0
  5. data/lib/app/views/layout.erb +3 -3
  6. data/lib/app/views/utils/redirectToBackend.tsx +9 -0
  7. data/lib/app/views/welcome_show.erb +1 -1
  8. data/lib/config/base_configuration.rb +9 -0
  9. data/lib/config/routes.rb +1 -0
  10. data/lib/esbuild.config.js +33 -0
  11. data/lib/js/app.js +13 -0
  12. data/lib/js/app.js.map +7 -0
  13. data/lib/js/bundle.js +26157 -0
  14. data/lib/js/bundle.js.map +7 -0
  15. data/lib/node_modules/@types/cookie/LICENSE +21 -0
  16. data/lib/node_modules/@types/cookie/README.md +15 -0
  17. data/lib/node_modules/@types/cookie/index.d.ts +154 -0
  18. data/lib/node_modules/@types/cookie/package.json +30 -0
  19. data/lib/node_modules/cookie/LICENSE +24 -0
  20. data/lib/node_modules/cookie/README.md +248 -0
  21. data/lib/node_modules/cookie/dist/index.d.ts +114 -0
  22. data/lib/node_modules/cookie/dist/index.js +239 -0
  23. data/lib/node_modules/cookie/dist/index.js.map +1 -0
  24. data/lib/node_modules/cookie/package.json +42 -0
  25. data/lib/node_modules/js-tokens/CHANGELOG.md +151 -0
  26. data/lib/node_modules/js-tokens/LICENSE +21 -0
  27. data/lib/node_modules/js-tokens/README.md +240 -0
  28. data/lib/node_modules/js-tokens/index.js +23 -0
  29. data/lib/node_modules/js-tokens/package.json +30 -0
  30. data/lib/node_modules/loose-envify/LICENSE +21 -0
  31. data/lib/node_modules/loose-envify/README.md +45 -0
  32. data/lib/node_modules/loose-envify/cli.js +16 -0
  33. data/lib/node_modules/loose-envify/custom.js +4 -0
  34. data/lib/node_modules/loose-envify/index.js +3 -0
  35. data/lib/node_modules/loose-envify/loose-envify.js +36 -0
  36. data/lib/node_modules/loose-envify/package.json +36 -0
  37. data/lib/node_modules/loose-envify/replace.js +65 -0
  38. data/lib/node_modules/react/LICENSE +21 -0
  39. data/lib/node_modules/react/README.md +37 -0
  40. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1315 -0
  41. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
  42. data/lib/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
  43. data/lib/node_modules/react/cjs/react-jsx-runtime.development.js +1333 -0
  44. data/lib/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
  45. data/lib/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
  46. data/lib/node_modules/react/cjs/react.development.js +2740 -0
  47. data/lib/node_modules/react/cjs/react.production.min.js +26 -0
  48. data/lib/node_modules/react/cjs/react.shared-subset.development.js +20 -0
  49. data/lib/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
  50. data/lib/node_modules/react/index.js +7 -0
  51. data/lib/node_modules/react/jsx-dev-runtime.js +7 -0
  52. data/lib/node_modules/react/jsx-runtime.js +7 -0
  53. data/lib/node_modules/react/package.json +47 -0
  54. data/lib/node_modules/react/react.shared-subset.js +7 -0
  55. data/lib/node_modules/react/umd/react.development.js +3343 -0
  56. data/lib/node_modules/react/umd/react.production.min.js +31 -0
  57. data/lib/node_modules/react/umd/react.profiling.min.js +31 -0
  58. data/lib/node_modules/react-dom/LICENSE +21 -0
  59. data/lib/node_modules/react-dom/README.md +60 -0
  60. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7029 -0
  61. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
  62. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7093 -0
  63. data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
  64. data/lib/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7014 -0
  65. data/lib/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
  66. data/lib/node_modules/react-dom/cjs/react-dom-server.node.development.js +7070 -0
  67. data/lib/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
  68. data/lib/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1763 -0
  69. data/lib/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
  70. data/lib/node_modules/react-dom/cjs/react-dom.development.js +29923 -0
  71. data/lib/node_modules/react-dom/cjs/react-dom.production.min.js +322 -0
  72. data/lib/node_modules/react-dom/cjs/react-dom.profiling.min.js +366 -0
  73. data/lib/node_modules/react-dom/client.js +25 -0
  74. data/lib/node_modules/react-dom/index.js +38 -0
  75. data/lib/node_modules/react-dom/package.json +62 -0
  76. data/lib/node_modules/react-dom/profiling.js +38 -0
  77. data/lib/node_modules/react-dom/server.browser.js +17 -0
  78. data/lib/node_modules/react-dom/server.js +3 -0
  79. data/lib/node_modules/react-dom/server.node.js +17 -0
  80. data/lib/node_modules/react-dom/test-utils.js +7 -0
  81. data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7026 -0
  82. data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
  83. data/lib/node_modules/react-dom/umd/react-dom-server.browser.development.js +7011 -0
  84. data/lib/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
  85. data/lib/node_modules/react-dom/umd/react-dom-test-utils.development.js +1759 -0
  86. data/lib/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
  87. data/lib/node_modules/react-dom/umd/react-dom.development.js +29924 -0
  88. data/lib/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
  89. data/lib/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
  90. data/lib/node_modules/react-router/CHANGELOG.md +1526 -0
  91. data/lib/node_modules/react-router/LICENSE.md +23 -0
  92. data/lib/node_modules/react-router/README.md +7 -0
  93. data/lib/node_modules/react-router/dist/development/chunk-KNED5TY2.mjs +10476 -0
  94. data/lib/node_modules/react-router/dist/development/dom-export.d.mts +23 -0
  95. data/lib/node_modules/react-router/dist/development/dom-export.d.ts +23 -0
  96. data/lib/node_modules/react-router/dist/development/dom-export.js +6111 -0
  97. data/lib/node_modules/react-router/dist/development/dom-export.mjs +234 -0
  98. data/lib/node_modules/react-router/dist/development/fog-of-war-1hWhK5ey.d.mts +1690 -0
  99. data/lib/node_modules/react-router/dist/development/fog-of-war-oa9CGk10.d.ts +1690 -0
  100. data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.mts +21 -0
  101. data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.ts +21 -0
  102. data/lib/node_modules/react-router/dist/development/index.d.mts +841 -0
  103. data/lib/node_modules/react-router/dist/development/index.d.ts +841 -0
  104. data/lib/node_modules/react-router/dist/development/index.js +10624 -0
  105. data/lib/node_modules/react-router/dist/development/index.mjs +242 -0
  106. data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.mts +209 -0
  107. data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.ts +209 -0
  108. data/lib/node_modules/react-router/dist/development/lib/types/route-module.js +28 -0
  109. data/lib/node_modules/react-router/dist/development/lib/types/route-module.mjs +10 -0
  110. data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.mts +1716 -0
  111. data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.ts +1716 -0
  112. data/lib/node_modules/react-router/dist/production/chunk-ZIM7OIE3.mjs +10476 -0
  113. data/lib/node_modules/react-router/dist/production/dom-export.d.mts +23 -0
  114. data/lib/node_modules/react-router/dist/production/dom-export.d.ts +23 -0
  115. data/lib/node_modules/react-router/dist/production/dom-export.js +6111 -0
  116. data/lib/node_modules/react-router/dist/production/dom-export.mjs +234 -0
  117. data/lib/node_modules/react-router/dist/production/fog-of-war-1hWhK5ey.d.mts +1690 -0
  118. data/lib/node_modules/react-router/dist/production/fog-of-war-oa9CGk10.d.ts +1690 -0
  119. data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.mts +21 -0
  120. data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.ts +21 -0
  121. data/lib/node_modules/react-router/dist/production/index.d.mts +841 -0
  122. data/lib/node_modules/react-router/dist/production/index.d.ts +841 -0
  123. data/lib/node_modules/react-router/dist/production/index.js +10624 -0
  124. data/lib/node_modules/react-router/dist/production/index.mjs +242 -0
  125. data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.mts +209 -0
  126. data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.ts +209 -0
  127. data/lib/node_modules/react-router/dist/production/lib/types/route-module.js +28 -0
  128. data/lib/node_modules/react-router/dist/production/lib/types/route-module.mjs +10 -0
  129. data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.mts +1716 -0
  130. data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.ts +1716 -0
  131. data/lib/node_modules/react-router/package.json +116 -0
  132. data/lib/node_modules/react-router-dom/LICENSE.md +23 -0
  133. data/lib/node_modules/react-router-dom/README.md +6 -0
  134. data/lib/node_modules/react-router-dom/dist/index.d.mts +2 -0
  135. data/lib/node_modules/react-router-dom/dist/index.d.ts +2 -0
  136. data/lib/node_modules/react-router-dom/dist/index.js +45 -0
  137. data/lib/node_modules/react-router-dom/dist/index.mjs +18 -0
  138. data/lib/node_modules/react-router-dom/package.json +82 -0
  139. data/lib/node_modules/scheduler/LICENSE +21 -0
  140. data/lib/node_modules/scheduler/README.md +9 -0
  141. data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
  142. data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
  143. data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
  144. data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
  145. data/lib/node_modules/scheduler/cjs/scheduler.development.js +634 -0
  146. data/lib/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
  147. data/lib/node_modules/scheduler/index.js +7 -0
  148. data/lib/node_modules/scheduler/package.json +36 -0
  149. data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
  150. data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
  151. data/lib/node_modules/scheduler/umd/scheduler.development.js +152 -0
  152. data/lib/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
  153. data/lib/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
  154. data/lib/node_modules/scheduler/unstable_mock.js +7 -0
  155. data/lib/node_modules/scheduler/unstable_post_task.js +7 -0
  156. data/lib/node_modules/set-cookie-parser/LICENSE +21 -0
  157. data/lib/node_modules/set-cookie-parser/README.md +202 -0
  158. data/lib/node_modules/set-cookie-parser/lib/set-cookie.js +224 -0
  159. data/lib/node_modules/set-cookie-parser/package.json +45 -0
  160. data/lib/node_modules/turbo-stream/LICENSE +7 -0
  161. data/lib/node_modules/turbo-stream/README.md +31 -0
  162. data/lib/node_modules/turbo-stream/dist/flatten.d.ts +2 -0
  163. data/lib/node_modules/turbo-stream/dist/flatten.js +203 -0
  164. data/lib/node_modules/turbo-stream/dist/turbo-stream.d.ts +13 -0
  165. data/lib/node_modules/turbo-stream/dist/turbo-stream.js +207 -0
  166. data/lib/node_modules/turbo-stream/dist/turbo-stream.mjs +673 -0
  167. data/lib/node_modules/turbo-stream/dist/unflatten.d.ts +2 -0
  168. data/lib/node_modules/turbo-stream/dist/unflatten.js +243 -0
  169. data/lib/node_modules/turbo-stream/dist/utils.d.ts +44 -0
  170. data/lib/node_modules/turbo-stream/dist/utils.js +55 -0
  171. data/lib/node_modules/turbo-stream/package.json +50 -0
  172. data/lib/package-lock.json +133 -0
  173. data/lib/package.json +12 -0
  174. data/lib/rubee/controllers/base_controller.rb +14 -0
  175. data/lib/rubee.rb +58 -19
  176. data/lib/tests/rubeeapp_test.rb +17 -0
  177. data/lib/tests/test.db +0 -0
  178. data/lib/tests/user_model_test.rb +1 -0
  179. data/readme.md +104 -2
  180. metadata +170 -3
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
@@ -0,0 +1,15 @@
1
+ # Installation
2
+ > `npm install --save @types/cookie`
3
+
4
+ # Summary
5
+ This package contains type definitions for cookie (https://github.com/jshttp/cookie).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie.
9
+
10
+ ### Additional Details
11
+ * Last updated: Sun, 26 Nov 2023 22:07:01 GMT
12
+ * Dependencies: none
13
+
14
+ # Credits
15
+ These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Basic HTTP cookie parser and serializer for HTTP servers.
3
+ */
4
+
5
+ /**
6
+ * Additional serialization options
7
+ */
8
+ export interface CookieSerializeOptions {
9
+ /**
10
+ * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no
11
+ * domain is set, and most clients will consider the cookie to apply to only
12
+ * the current domain.
13
+ */
14
+ domain?: string | undefined;
15
+
16
+ /**
17
+ * Specifies a function that will be used to encode a cookie's value. Since
18
+ * value of a cookie has a limited character set (and must be a simple
19
+ * string), this function can be used to encode a value into a string suited
20
+ * for a cookie's value.
21
+ *
22
+ * The default function is the global `encodeURIComponent`, which will
23
+ * encode a JavaScript string into UTF-8 byte sequences and then URL-encode
24
+ * any that fall outside of the cookie range.
25
+ */
26
+ encode?(value: string): string;
27
+
28
+ /**
29
+ * Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default,
30
+ * no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
31
+ * it on a condition like exiting a web browser application.
32
+ *
33
+ * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
34
+ * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
35
+ * possible not all clients by obey this, so if both are set, they should
36
+ * point to the same date and time.
37
+ */
38
+ expires?: Date | undefined;
39
+ /**
40
+ * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}.
41
+ * When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
42
+ * default, the `HttpOnly` attribute is not set.
43
+ *
44
+ * *Note* be careful when setting this to true, as compliant clients will
45
+ * not allow client-side JavaScript to see the cookie in `document.cookie`.
46
+ */
47
+ httpOnly?: boolean | undefined;
48
+ /**
49
+ * Specifies the number (in seconds) to be the value for the `Max-Age`
50
+ * `Set-Cookie` attribute. The given number will be converted to an integer
51
+ * by rounding down. By default, no maximum age is set.
52
+ *
53
+ * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
54
+ * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
55
+ * possible not all clients by obey this, so if both are set, they should
56
+ * point to the same date and time.
57
+ */
58
+ maxAge?: number | undefined;
59
+ /**
60
+ * Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
61
+ * attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
62
+ * `Partitioned` attribute is not set.
63
+ *
64
+ * **note** This is an attribute that has not yet been fully standardized, and may change in the future.
65
+ * This also means many clients may ignore this attribute until they understand it.
66
+ *
67
+ * More information about can be found in [the proposal](https://github.com/privacycg/CHIPS)
68
+ */
69
+ partitioned?: boolean | undefined;
70
+ /**
71
+ * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
72
+ * By default, the path is considered the "default path".
73
+ */
74
+ path?: string | undefined;
75
+ /**
76
+ * Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
77
+ *
78
+ * - `'low'` will set the `Priority` attribute to `Low`.
79
+ * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
80
+ * - `'high'` will set the `Priority` attribute to `High`.
81
+ *
82
+ * More information about the different priority levels can be found in
83
+ * [the specification][rfc-west-cookie-priority-00-4.1].
84
+ *
85
+ * **note** This is an attribute that has not yet been fully standardized, and may change in the future.
86
+ * This also means many clients may ignore this attribute until they understand it.
87
+ */
88
+ priority?: "low" | "medium" | "high" | undefined;
89
+ /**
90
+ * Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
91
+ *
92
+ * - `true` will set the `SameSite` attribute to `Strict` for strict same
93
+ * site enforcement.
94
+ * - `false` will not set the `SameSite` attribute.
95
+ * - `'lax'` will set the `SameSite` attribute to Lax for lax same site
96
+ * enforcement.
97
+ * - `'strict'` will set the `SameSite` attribute to Strict for strict same
98
+ * site enforcement.
99
+ * - `'none'` will set the SameSite attribute to None for an explicit
100
+ * cross-site cookie.
101
+ *
102
+ * More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
103
+ *
104
+ * *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
105
+ */
106
+ sameSite?: true | false | "lax" | "strict" | "none" | undefined;
107
+ /**
108
+ * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the
109
+ * `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
110
+ *
111
+ * *Note* be careful when setting this to `true`, as compliant clients will
112
+ * not send the cookie back to the server in the future if the browser does
113
+ * not have an HTTPS connection.
114
+ */
115
+ secure?: boolean | undefined;
116
+ }
117
+
118
+ /**
119
+ * Additional parsing options
120
+ */
121
+ export interface CookieParseOptions {
122
+ /**
123
+ * Specifies a function that will be used to decode a cookie's value. Since
124
+ * the value of a cookie has a limited character set (and must be a simple
125
+ * string), this function can be used to decode a previously-encoded cookie
126
+ * value into a JavaScript string or other object.
127
+ *
128
+ * The default function is the global `decodeURIComponent`, which will decode
129
+ * any URL-encoded sequences into their byte representations.
130
+ *
131
+ * *Note* if an error is thrown from this function, the original, non-decoded
132
+ * cookie value will be returned as the cookie's value.
133
+ */
134
+ decode?(value: string): string;
135
+ }
136
+
137
+ /**
138
+ * Parse an HTTP Cookie header string and returning an object of all cookie
139
+ * name-value pairs.
140
+ *
141
+ * @param str the string representing a `Cookie` header value
142
+ * @param [options] object containing parsing options
143
+ */
144
+ export function parse(str: string, options?: CookieParseOptions): Record<string, string>;
145
+
146
+ /**
147
+ * Serialize a cookie name-value pair into a `Set-Cookie` header string.
148
+ *
149
+ * @param name the name for the cookie
150
+ * @param value value to set the cookie to
151
+ * @param [options] object containing serialization options
152
+ * @throws {TypeError} when `maxAge` options is invalid
153
+ */
154
+ export function serialize(name: string, value: string, options?: CookieSerializeOptions): string;
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@types/cookie",
3
+ "version": "0.6.0",
4
+ "description": "TypeScript definitions for cookie",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie",
6
+ "license": "MIT",
7
+ "contributors": [
8
+ {
9
+ "name": "Pine Mizune",
10
+ "githubUsername": "pine",
11
+ "url": "https://github.com/pine"
12
+ },
13
+ {
14
+ "name": "Piotr Błażejewicz",
15
+ "githubUsername": "peterblazejewicz",
16
+ "url": "https://github.com/peterblazejewicz"
17
+ }
18
+ ],
19
+ "main": "",
20
+ "types": "index.d.ts",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24
+ "directory": "types/cookie"
25
+ },
26
+ "scripts": {},
27
+ "dependencies": {},
28
+ "typesPublisherContentHash": "0fbdf9c886fb40c8dc7677b8b7d0f9e02ac5235e163d90244a4fb9004736a575",
29
+ "typeScriptVersion": "4.5"
30
+ }
@@ -0,0 +1,24 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
4
+ Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
@@ -0,0 +1,248 @@
1
+ # cookie
2
+
3
+ [![NPM Version][npm-version-image]][npm-url]
4
+ [![NPM Downloads][npm-downloads-image]][npm-url]
5
+ [![Build Status][ci-image]][ci-url]
6
+ [![Coverage Status][coverage-image]][coverage-url]
7
+
8
+ Basic HTTP cookie parser and serializer for HTTP servers.
9
+
10
+ ## Installation
11
+
12
+ ```sh
13
+ $ npm install cookie
14
+ ```
15
+
16
+ ## API
17
+
18
+ ```js
19
+ const cookie = require("cookie");
20
+ // import * as cookie from 'cookie';
21
+ ```
22
+
23
+ ### cookie.parse(str, options)
24
+
25
+ Parse a HTTP `Cookie` header string and returning an object of all cookie name-value pairs.
26
+ The `str` argument is the string representing a `Cookie` header value and `options` is an
27
+ optional object containing additional parsing options.
28
+
29
+ ```js
30
+ const cookies = cookie.parse("foo=bar; equation=E%3Dmc%5E2");
31
+ // { foo: 'bar', equation: 'E=mc^2' }
32
+ ```
33
+
34
+ #### Options
35
+
36
+ `cookie.parse` accepts these properties in the options object.
37
+
38
+ ##### decode
39
+
40
+ Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
41
+ Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
42
+ a previously-encoded cookie value into a JavaScript string.
43
+
44
+ The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
45
+ is thrown it will return the cookie's original value. If you provide your own encode/decode
46
+ scheme you must ensure errors are appropriately handled.
47
+
48
+ ### cookie.serialize(name, value, options)
49
+
50
+ Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the
51
+ name for the cookie, the `value` argument is the value to set the cookie to, and the `options`
52
+ argument is an optional object containing additional serialization options.
53
+
54
+ ```js
55
+ const setCookie = cookie.serialize("foo", "bar");
56
+ // foo=bar
57
+ ```
58
+
59
+ #### Options
60
+
61
+ `cookie.serialize` accepts these properties in the options object.
62
+
63
+ ##### encode
64
+
65
+ Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
66
+ Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
67
+ a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
68
+
69
+ The default function is the global `encodeURIComponent`.
70
+
71
+ ##### maxAge
72
+
73
+ Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
74
+
75
+ The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
76
+ `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
77
+ so if both are set, they should point to the same date and time.
78
+
79
+ ##### expires
80
+
81
+ Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
82
+ When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
83
+
84
+ The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
85
+ `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
86
+ so if both are set, they should point to the same date and time.
87
+
88
+ ##### domain
89
+
90
+ Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
91
+ When no domain is set clients consider the cookie to apply to the current domain only.
92
+
93
+ ##### path
94
+
95
+ Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
96
+ When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
97
+
98
+ ##### httpOnly
99
+
100
+ Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
101
+ When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
102
+
103
+ ##### secure
104
+
105
+ Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
106
+ When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
107
+
108
+ ##### partitioned
109
+
110
+ Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
111
+ When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
112
+
113
+ This is an attribute that has not yet been fully standardized, and may change in the future.
114
+ This also means clients may ignore this attribute until they understand it. More information
115
+ about can be found in [the proposal](https://github.com/privacycg/CHIPS).
116
+
117
+ ##### priority
118
+
119
+ Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
120
+
121
+ - `'low'` will set the `Priority` attribute to `Low`.
122
+ - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
123
+ - `'high'` will set the `Priority` attribute to `High`.
124
+
125
+ More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
126
+
127
+ ##### sameSite
128
+
129
+ Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
130
+
131
+ - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
132
+ - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
133
+ - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
134
+ - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
135
+
136
+ More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
137
+
138
+ ## Example
139
+
140
+ The following example uses this module in conjunction with the Node.js core HTTP server
141
+ to prompt a user for their name and display it back on future visits.
142
+
143
+ ```js
144
+ var cookie = require("cookie");
145
+ var escapeHtml = require("escape-html");
146
+ var http = require("http");
147
+ var url = require("url");
148
+
149
+ function onRequest(req, res) {
150
+ // Parse the query string
151
+ var query = url.parse(req.url, true, true).query;
152
+
153
+ if (query && query.name) {
154
+ // Set a new cookie with the name
155
+ res.setHeader(
156
+ "Set-Cookie",
157
+ cookie.serialize("name", String(query.name), {
158
+ httpOnly: true,
159
+ maxAge: 60 * 60 * 24 * 7, // 1 week
160
+ }),
161
+ );
162
+
163
+ // Redirect back after setting cookie
164
+ res.statusCode = 302;
165
+ res.setHeader("Location", req.headers.referer || "/");
166
+ res.end();
167
+ return;
168
+ }
169
+
170
+ // Parse the cookies on the request
171
+ var cookies = cookie.parse(req.headers.cookie || "");
172
+
173
+ // Get the visitor name set in the cookie
174
+ var name = cookies.name;
175
+
176
+ res.setHeader("Content-Type", "text/html; charset=UTF-8");
177
+
178
+ if (name) {
179
+ res.write("<p>Welcome back, <b>" + escapeHtml(name) + "</b>!</p>");
180
+ } else {
181
+ res.write("<p>Hello, new visitor!</p>");
182
+ }
183
+
184
+ res.write('<form method="GET">');
185
+ res.write(
186
+ '<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">',
187
+ );
188
+ res.end("</form>");
189
+ }
190
+
191
+ http.createServer(onRequest).listen(3000);
192
+ ```
193
+
194
+ ## Testing
195
+
196
+ ```sh
197
+ npm test
198
+ ```
199
+
200
+ ## Benchmark
201
+
202
+ ```sh
203
+ npm run bench
204
+ ```
205
+
206
+ ```
207
+ name hz min max mean p75 p99 p995 p999 rme samples
208
+ · simple 8,566,313.09 0.0000 0.3694 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.64% 4283157 fastest
209
+ · decode 3,834,348.85 0.0001 0.2465 0.0003 0.0003 0.0003 0.0004 0.0006 ±0.38% 1917175
210
+ · unquote 8,315,355.96 0.0000 0.3824 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.72% 4157880
211
+ · duplicates 1,944,765.97 0.0004 0.2959 0.0005 0.0005 0.0006 0.0006 0.0008 ±0.24% 972384
212
+ · 10 cookies 675,345.67 0.0012 0.4328 0.0015 0.0015 0.0019 0.0020 0.0058 ±0.75% 337673
213
+ · 100 cookies 61,040.71 0.0152 0.4092 0.0164 0.0160 0.0196 0.0228 0.2260 ±0.71% 30521 slowest
214
+ ✓ parse top-sites (15) 22945ms
215
+ name hz min max mean p75 p99 p995 p999 rme samples
216
+ · parse accounts.google.com 7,164,349.17 0.0000 0.0929 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.09% 3582184
217
+ · parse apple.com 7,817,686.84 0.0000 0.6048 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.05% 3908844
218
+ · parse cloudflare.com 7,189,841.70 0.0000 0.0390 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3594921
219
+ · parse docs.google.com 7,051,765.61 0.0000 0.0296 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3525883
220
+ · parse drive.google.com 7,349,104.77 0.0000 0.0368 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.05% 3674553
221
+ · parse en.wikipedia.org 1,929,909.49 0.0004 0.3598 0.0005 0.0005 0.0007 0.0007 0.0012 ±0.16% 964955
222
+ · parse linkedin.com 2,225,658.01 0.0003 0.0595 0.0004 0.0005 0.0005 0.0005 0.0006 ±0.06% 1112830
223
+ · parse maps.google.com 4,423,511.68 0.0001 0.0942 0.0002 0.0003 0.0003 0.0003 0.0005 ±0.08% 2211756
224
+ · parse microsoft.com 3,387,601.88 0.0002 0.0725 0.0003 0.0003 0.0004 0.0004 0.0005 ±0.09% 1693801
225
+ · parse play.google.com 7,375,980.86 0.0000 0.1994 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.12% 3687991
226
+ · parse support.google.com 4,912,267.94 0.0001 2.8958 0.0002 0.0002 0.0003 0.0003 0.0005 ±1.28% 2456134
227
+ · parse www.google.com 3,443,035.87 0.0002 0.2783 0.0003 0.0003 0.0004 0.0004 0.0007 ±0.51% 1721518
228
+ · parse youtu.be 1,910,492.87 0.0004 0.3490 0.0005 0.0005 0.0007 0.0007 0.0011 ±0.46% 955247
229
+ · parse youtube.com 1,895,082.62 0.0004 0.7454 0.0005 0.0005 0.0006 0.0007 0.0013 ±0.64% 947542 slowest
230
+ · parse example.com 21,582,835.27 0.0000 0.1095 0.0000 0.0000 0.0001 0.0001 0.0001 ±0.13% 10791418
231
+ ```
232
+
233
+ ## References
234
+
235
+ - [RFC 6265: HTTP State Management Mechanism](https://tools.ietf.org/html/rfc6265)
236
+ - [Same-site Cookies](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7)
237
+
238
+ ## License
239
+
240
+ [MIT](LICENSE)
241
+
242
+ [ci-image]: https://img.shields.io/github/actions/workflow/status/jshttp/cookie/ci.yml
243
+ [ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml?query=branch%3Amaster
244
+ [coverage-image]: https://img.shields.io/codecov/c/github/jshttp/cookie/master
245
+ [coverage-url]: https://app.codecov.io/gh/jshttp/cookie
246
+ [npm-downloads-image]: https://img.shields.io/npm/dm/cookie
247
+ [npm-url]: https://npmjs.org/package/cookie
248
+ [npm-version-image]: https://img.shields.io/npm/v/cookie
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Parse options.
3
+ */
4
+ export interface ParseOptions {
5
+ /**
6
+ * Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
7
+ * Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
8
+ * a previously-encoded cookie value into a JavaScript string.
9
+ *
10
+ * The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
11
+ * is thrown it will return the cookie's original value. If you provide your own encode/decode
12
+ * scheme you must ensure errors are appropriately handled.
13
+ *
14
+ * @default decode
15
+ */
16
+ decode?: (str: string) => string | undefined;
17
+ }
18
+ /**
19
+ * Parse a cookie header.
20
+ *
21
+ * Parse the given cookie header string into an object
22
+ * The object has the various cookies as keys(names) => values
23
+ */
24
+ export declare function parse(str: string, options?: ParseOptions): Record<string, string | undefined>;
25
+ /**
26
+ * Serialize options.
27
+ */
28
+ export interface SerializeOptions {
29
+ /**
30
+ * Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
31
+ * Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
32
+ * a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
33
+ *
34
+ * @default encodeURIComponent
35
+ */
36
+ encode?: (str: string) => string;
37
+ /**
38
+ * Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
39
+ *
40
+ * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
41
+ * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
42
+ * so if both are set, they should point to the same date and time.
43
+ */
44
+ maxAge?: number;
45
+ /**
46
+ * Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
47
+ * When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
48
+ *
49
+ * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
50
+ * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
51
+ * so if both are set, they should point to the same date and time.
52
+ */
53
+ expires?: Date;
54
+ /**
55
+ * Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
56
+ * When no domain is set clients consider the cookie to apply to the current domain only.
57
+ */
58
+ domain?: string;
59
+ /**
60
+ * Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
61
+ * When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
62
+ */
63
+ path?: string;
64
+ /**
65
+ * Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
66
+ * When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
67
+ */
68
+ httpOnly?: boolean;
69
+ /**
70
+ * Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
71
+ * When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
72
+ */
73
+ secure?: boolean;
74
+ /**
75
+ * Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
76
+ * When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
77
+ *
78
+ * This is an attribute that has not yet been fully standardized, and may change in the future.
79
+ * This also means clients may ignore this attribute until they understand it. More information
80
+ * about can be found in [the proposal](https://github.com/privacycg/CHIPS).
81
+ */
82
+ partitioned?: boolean;
83
+ /**
84
+ * Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
85
+ *
86
+ * - `'low'` will set the `Priority` attribute to `Low`.
87
+ * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
88
+ * - `'high'` will set the `Priority` attribute to `High`.
89
+ *
90
+ * More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
91
+ */
92
+ priority?: "low" | "medium" | "high";
93
+ /**
94
+ * Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
95
+ *
96
+ * - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
97
+ * - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
98
+ * - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
99
+ * - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
100
+ *
101
+ * More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
102
+ */
103
+ sameSite?: boolean | "lax" | "strict" | "none";
104
+ }
105
+ /**
106
+ * Serialize data into a cookie header.
107
+ *
108
+ * Serialize a name value pair into a cookie string suitable for
109
+ * http headers. An optional options object specifies cookie parameters.
110
+ *
111
+ * serialize('foo', 'bar', { httpOnly: true })
112
+ * => "foo=bar; httpOnly"
113
+ */
114
+ export declare function serialize(name: string, val: string, options?: SerializeOptions): string;