Showing
39 changed files
with
3070 additions
and
2 deletions
.gitignore.txt
0 → 100644
1 | +node_modules | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -4,13 +4,53 @@ const bodyParser = require('body-parser'); | ... | @@ -4,13 +4,53 @@ const bodyParser = require('body-parser'); |
4 | const app = express(); | 4 | const app = express(); |
5 | 5 | ||
6 | app.use(bodyParser.json()); | 6 | app.use(bodyParser.json()); |
7 | -//Home | ||
8 | -app.get('/', (req,res) => res.send('Hello world!')); | ||
9 | 7 | ||
8 | +app.use(session({ | ||
9 | + secret: 'keyboard cat', | ||
10 | + cookie: { maxAge: 60000 }, | ||
11 | + resave: false, | ||
12 | + saveUninitialized: false, | ||
13 | + })); | ||
14 | + | ||
15 | +//Home | ||
16 | +app.get('/', function(req,res){ | ||
17 | + res.send("Home page"); | ||
18 | +}) | ||
10 | //login | 19 | //login |
20 | +app.put('/login',function(req,res){ | ||
21 | + res.send("Login page"); | ||
22 | +}) | ||
11 | //logout | 23 | //logout |
24 | +app.put('/logout',function(req,res){ | ||
25 | + res.send("Logout page"); | ||
26 | +}) | ||
12 | //register | 27 | //register |
28 | +app.post('/register',function(req,res){ | ||
29 | + res.send('register page'); | ||
30 | +}) | ||
13 | //Mapmain | 31 | //Mapmain |
32 | +app.get('/Mapmain',function(req,res){ | ||
33 | + res.send('Mapmain page'); | ||
34 | +}) | ||
35 | +//Read post | ||
36 | +app.get('/Mapmain/posts/:postId',function(req,res){ | ||
37 | + var postId = req.params.postId; | ||
38 | + res.send("Mapmain post page", postId); | ||
39 | +}) | ||
40 | +//Create post | ||
41 | +app.post('/Mapmain/posts',function(req,res){ | ||
42 | + res.send("Mapmain create page"); | ||
43 | +}) | ||
44 | +//Update post | ||
45 | +app.put('/Mapmain/posts/:postId',function(req,res){ | ||
46 | + var postId = req.params.postId; | ||
47 | + res.send("Mapmain update page"); | ||
48 | +}) | ||
49 | +//Delete post | ||
50 | +app.delete('/Mapmain/posts/:postId',function(req,res){ | ||
51 | + var postId = req.params.postId; | ||
52 | + res.send("Mapmain update page"); | ||
53 | +}) | ||
14 | //Mapmain/category/:_category | 54 | //Mapmain/category/:_category |
15 | //Mapmain/post/:_pk | 55 | //Mapmain/post/:_pk |
16 | 56 | ... | ... |
1 | +1.17.1 / 2020-04-16 | ||
2 | +=================== | ||
3 | + | ||
4 | + * Fix internal method wrapping error on failed reloads | ||
5 | + | ||
6 | +1.17.0 / 2019-10-10 | ||
7 | +=================== | ||
8 | + | ||
9 | + * deps: cookie@0.4.0 | ||
10 | + - Add `SameSite=None` support | ||
11 | + * deps: safe-buffer@5.2.0 | ||
12 | + | ||
13 | +1.16.2 / 2019-06-12 | ||
14 | +=================== | ||
15 | + | ||
16 | + * Fix restoring `cookie.originalMaxAge` when store returns `Date` | ||
17 | + * deps: parseurl@~1.3.3 | ||
18 | + | ||
19 | +1.16.1 / 2019-04-11 | ||
20 | +=================== | ||
21 | + | ||
22 | + * Fix error passing `data` option to `Cookie` constructor | ||
23 | + * Fix uncaught error from bad session data | ||
24 | + | ||
25 | +1.16.0 / 2019-04-10 | ||
26 | +=================== | ||
27 | + | ||
28 | + * Catch invalid `cookie.maxAge` value earlier | ||
29 | + * Deprecate setting `cookie.maxAge` to a `Date` object | ||
30 | + * Fix issue where `resave: false` may not save altered sessions | ||
31 | + * Remove `utils-merge` dependency | ||
32 | + * Use `safe-buffer` for improved Buffer API | ||
33 | + * Use `Set-Cookie` as cookie header name for compatibility | ||
34 | + * deps: depd@~2.0.0 | ||
35 | + - Replace internal `eval` usage with `Function` constructor | ||
36 | + - Use instance methods on `process` to check for listeners | ||
37 | + - perf: remove argument reassignment | ||
38 | + * deps: on-headers@~1.0.2 | ||
39 | + - Fix `res.writeHead` patch missing return value | ||
40 | + | ||
41 | +1.15.6 / 2017-09-26 | ||
42 | +=================== | ||
43 | + | ||
44 | + * deps: debug@2.6.9 | ||
45 | + * deps: parseurl@~1.3.2 | ||
46 | + - perf: reduce overhead for full URLs | ||
47 | + - perf: unroll the "fast-path" `RegExp` | ||
48 | + * deps: uid-safe@~2.1.5 | ||
49 | + - perf: remove only trailing `=` | ||
50 | + * deps: utils-merge@1.0.1 | ||
51 | + | ||
52 | +1.15.5 / 2017-08-02 | ||
53 | +=================== | ||
54 | + | ||
55 | + * Fix `TypeError` when `req.url` is an empty string | ||
56 | + * deps: depd@~1.1.1 | ||
57 | + - Remove unnecessary `Buffer` loading | ||
58 | + | ||
59 | +1.15.4 / 2017-07-18 | ||
60 | +=================== | ||
61 | + | ||
62 | + * deps: debug@2.6.8 | ||
63 | + | ||
64 | +1.15.3 / 2017-05-17 | ||
65 | +=================== | ||
66 | + | ||
67 | + * deps: debug@2.6.7 | ||
68 | + - deps: ms@2.0.0 | ||
69 | + | ||
70 | +1.15.2 / 2017-03-26 | ||
71 | +=================== | ||
72 | + | ||
73 | + * deps: debug@2.6.3 | ||
74 | + - Fix `DEBUG_MAX_ARRAY_LENGTH` | ||
75 | + * deps: uid-safe@~2.1.4 | ||
76 | + - Remove `base64-url` dependency | ||
77 | + | ||
78 | +1.15.1 / 2017-02-10 | ||
79 | +=================== | ||
80 | + | ||
81 | + * deps: debug@2.6.1 | ||
82 | + - Fix deprecation messages in WebStorm and other editors | ||
83 | + - Undeprecate `DEBUG_FD` set to `1` or `2` | ||
84 | + | ||
85 | +1.15.0 / 2017-01-22 | ||
86 | +=================== | ||
87 | + | ||
88 | + * Fix detecting modified session when session contains "cookie" property | ||
89 | + * Fix resaving already-saved reloaded session at end of request | ||
90 | + * deps: crc@3.4.4 | ||
91 | + - perf: use `Buffer.from` when available | ||
92 | + * deps: debug@2.6.0 | ||
93 | + - Allow colors in workers | ||
94 | + - Deprecated `DEBUG_FD` environment variable | ||
95 | + - Use same color for same namespace | ||
96 | + - Fix error when running under React Native | ||
97 | + - deps: ms@0.7.2 | ||
98 | + * perf: remove unreachable branch in set-cookie method | ||
99 | + | ||
100 | +1.14.2 / 2016-10-30 | ||
101 | +=================== | ||
102 | + | ||
103 | + * deps: crc@3.4.1 | ||
104 | + - Fix deprecation warning in Node.js 7.x | ||
105 | + * deps: uid-safe@~2.1.3 | ||
106 | + - deps: base64-url@1.3.3 | ||
107 | + | ||
108 | +1.14.1 / 2016-08-24 | ||
109 | +=================== | ||
110 | + | ||
111 | + * Fix not always resetting session max age before session save | ||
112 | + * Fix the cookie `sameSite` option to actually alter the `Set-Cookie` | ||
113 | + * deps: uid-safe@~2.1.2 | ||
114 | + - deps: base64-url@1.3.2 | ||
115 | + | ||
116 | +1.14.0 / 2016-07-01 | ||
117 | +=================== | ||
118 | + | ||
119 | + * Correctly inherit from `EventEmitter` class in `Store` base class | ||
120 | + * Fix issue where `Set-Cookie` `Expires` was not always updated | ||
121 | + * Methods are no longer enumerable on `req.session` object | ||
122 | + * deps: cookie@0.3.1 | ||
123 | + - Add `sameSite` option | ||
124 | + - Improve error message when `encode` is not a function | ||
125 | + - Improve error message when `expires` is not a `Date` | ||
126 | + - perf: enable strict mode | ||
127 | + - perf: use for loop in parse | ||
128 | + - perf: use string concatination for serialization | ||
129 | + * deps: parseurl@~1.3.1 | ||
130 | + - perf: enable strict mode | ||
131 | + * deps: uid-safe@~2.1.1 | ||
132 | + - Use `random-bytes` for byte source | ||
133 | + - deps: base64-url@1.2.2 | ||
134 | + * perf: enable strict mode | ||
135 | + * perf: remove argument reassignment | ||
136 | + | ||
137 | +1.13.0 / 2016-01-10 | ||
138 | +=================== | ||
139 | + | ||
140 | + * Fix `rolling: true` to not set cookie when no session exists | ||
141 | + - Better `saveUninitialized: false` + `rolling: true` behavior | ||
142 | + * deps: crc@3.4.0 | ||
143 | + | ||
144 | +1.12.1 / 2015-10-29 | ||
145 | +=================== | ||
146 | + | ||
147 | + * deps: cookie@0.2.3 | ||
148 | + - Fix cookie `Max-Age` to never be a floating point number | ||
149 | + | ||
150 | +1.12.0 / 2015-10-25 | ||
151 | +=================== | ||
152 | + | ||
153 | + * Support the value `'auto'` in the `cookie.secure` option | ||
154 | + * deps: cookie@0.2.2 | ||
155 | + - Throw on invalid values provided to `serialize` | ||
156 | + * deps: depd@~1.1.0 | ||
157 | + - Enable strict mode in more places | ||
158 | + - Support web browser loading | ||
159 | + * deps: on-headers@~1.0.1 | ||
160 | + - perf: enable strict mode | ||
161 | + | ||
162 | +1.11.3 / 2015-05-22 | ||
163 | +=================== | ||
164 | + | ||
165 | + * deps: cookie@0.1.3 | ||
166 | + - Slight optimizations | ||
167 | + * deps: crc@3.3.0 | ||
168 | + | ||
169 | +1.11.2 / 2015-05-10 | ||
170 | +=================== | ||
171 | + | ||
172 | + * deps: debug@~2.2.0 | ||
173 | + - deps: ms@0.7.1 | ||
174 | + * deps: uid-safe@~2.0.0 | ||
175 | + | ||
176 | +1.11.1 / 2015-04-08 | ||
177 | +=================== | ||
178 | + | ||
179 | + * Fix mutating `options.secret` value | ||
180 | + | ||
181 | +1.11.0 / 2015-04-07 | ||
182 | +=================== | ||
183 | + | ||
184 | + * Support an array in `secret` option for key rotation | ||
185 | + * deps: depd@~1.0.1 | ||
186 | + | ||
187 | +1.10.4 / 2015-03-15 | ||
188 | +=================== | ||
189 | + | ||
190 | + * deps: debug@~2.1.3 | ||
191 | + - Fix high intensity foreground color for bold | ||
192 | + - deps: ms@0.7.0 | ||
193 | + | ||
194 | +1.10.3 / 2015-02-16 | ||
195 | +=================== | ||
196 | + | ||
197 | + * deps: cookie-signature@1.0.6 | ||
198 | + * deps: uid-safe@1.1.0 | ||
199 | + - Use `crypto.randomBytes`, if available | ||
200 | + - deps: base64-url@1.2.1 | ||
201 | + | ||
202 | +1.10.2 / 2015-01-31 | ||
203 | +=================== | ||
204 | + | ||
205 | + * deps: uid-safe@1.0.3 | ||
206 | + - Fix error branch that would throw | ||
207 | + - deps: base64-url@1.2.0 | ||
208 | + | ||
209 | +1.10.1 / 2015-01-08 | ||
210 | +=================== | ||
211 | + | ||
212 | + * deps: uid-safe@1.0.2 | ||
213 | + - Remove dependency on `mz` | ||
214 | + | ||
215 | +1.10.0 / 2015-01-05 | ||
216 | +=================== | ||
217 | + | ||
218 | + * Add `store.touch` interface for session stores | ||
219 | + * Fix `MemoryStore` expiration with `resave: false` | ||
220 | + * deps: debug@~2.1.1 | ||
221 | + | ||
222 | +1.9.3 / 2014-12-02 | ||
223 | +================== | ||
224 | + | ||
225 | + * Fix error when `req.sessionID` contains a non-string value | ||
226 | + | ||
227 | +1.9.2 / 2014-11-22 | ||
228 | +================== | ||
229 | + | ||
230 | + * deps: crc@3.2.1 | ||
231 | + - Minor fixes | ||
232 | + | ||
233 | +1.9.1 / 2014-10-22 | ||
234 | +================== | ||
235 | + | ||
236 | + * Remove unnecessary empty write call | ||
237 | + - Fixes Node.js 0.11.14 behavior change | ||
238 | + - Helps work-around Node.js 0.10.1 zlib bug | ||
239 | + | ||
240 | +1.9.0 / 2014-09-16 | ||
241 | +================== | ||
242 | + | ||
243 | + * deps: debug@~2.1.0 | ||
244 | + - Implement `DEBUG_FD` env variable support | ||
245 | + * deps: depd@~1.0.0 | ||
246 | + | ||
247 | +1.8.2 / 2014-09-15 | ||
248 | +================== | ||
249 | + | ||
250 | + * Use `crc` instead of `buffer-crc32` for speed | ||
251 | + * deps: depd@0.4.5 | ||
252 | + | ||
253 | +1.8.1 / 2014-09-08 | ||
254 | +================== | ||
255 | + | ||
256 | + * Keep `req.session.save` non-enumerable | ||
257 | + * Prevent session prototype methods from being overwritten | ||
258 | + | ||
259 | +1.8.0 / 2014-09-07 | ||
260 | +================== | ||
261 | + | ||
262 | + * Do not resave already-saved session at end of request | ||
263 | + * deps: cookie-signature@1.0.5 | ||
264 | + * deps: debug@~2.0.0 | ||
265 | + | ||
266 | +1.7.6 / 2014-08-18 | ||
267 | +================== | ||
268 | + | ||
269 | + * Fix exception on `res.end(null)` calls | ||
270 | + | ||
271 | +1.7.5 / 2014-08-10 | ||
272 | +================== | ||
273 | + | ||
274 | + * Fix parsing original URL | ||
275 | + * deps: on-headers@~1.0.0 | ||
276 | + * deps: parseurl@~1.3.0 | ||
277 | + | ||
278 | +1.7.4 / 2014-08-05 | ||
279 | +================== | ||
280 | + | ||
281 | + * Fix response end delay for non-chunked responses | ||
282 | + | ||
283 | +1.7.3 / 2014-08-05 | ||
284 | +================== | ||
285 | + | ||
286 | + * Fix `res.end` patch to call correct upstream `res.write` | ||
287 | + | ||
288 | +1.7.2 / 2014-07-27 | ||
289 | +================== | ||
290 | + | ||
291 | + * deps: depd@0.4.4 | ||
292 | + - Work-around v8 generating empty stack traces | ||
293 | + | ||
294 | +1.7.1 / 2014-07-26 | ||
295 | +================== | ||
296 | + | ||
297 | + * deps: depd@0.4.3 | ||
298 | + - Fix exception when global `Error.stackTraceLimit` is too low | ||
299 | + | ||
300 | +1.7.0 / 2014-07-22 | ||
301 | +================== | ||
302 | + | ||
303 | + * Improve session-ending error handling | ||
304 | + - Errors are passed to `next(err)` instead of `console.error` | ||
305 | + * deps: debug@1.0.4 | ||
306 | + * deps: depd@0.4.2 | ||
307 | + - Add `TRACE_DEPRECATION` environment variable | ||
308 | + - Remove non-standard grey color from color output | ||
309 | + - Support `--no-deprecation` argument | ||
310 | + - Support `--trace-deprecation` argument | ||
311 | + | ||
312 | +1.6.5 / 2014-07-11 | ||
313 | +================== | ||
314 | + | ||
315 | + * Do not require `req.originalUrl` | ||
316 | + * deps: debug@1.0.3 | ||
317 | + - Add support for multiple wildcards in namespaces | ||
318 | + | ||
319 | +1.6.4 / 2014-07-07 | ||
320 | +================== | ||
321 | + | ||
322 | + * Fix blank responses for stores with synchronous operations | ||
323 | + | ||
324 | +1.6.3 / 2014-07-04 | ||
325 | +================== | ||
326 | + | ||
327 | + * Fix resave deprecation message | ||
328 | + | ||
329 | +1.6.2 / 2014-07-04 | ||
330 | +================== | ||
331 | + | ||
332 | + * Fix confusing option deprecation messages | ||
333 | + | ||
334 | +1.6.1 / 2014-06-28 | ||
335 | +================== | ||
336 | + | ||
337 | + * Fix saveUninitialized deprecation message | ||
338 | + | ||
339 | +1.6.0 / 2014-06-28 | ||
340 | +================== | ||
341 | + | ||
342 | + * Add deprecation message to undefined `resave` option | ||
343 | + * Add deprecation message to undefined `saveUninitialized` option | ||
344 | + * Fix `res.end` patch to return correct value | ||
345 | + * Fix `res.end` patch to handle multiple `res.end` calls | ||
346 | + * Reject cookies with missing signatures | ||
347 | + | ||
348 | +1.5.2 / 2014-06-26 | ||
349 | +================== | ||
350 | + | ||
351 | + * deps: cookie-signature@1.0.4 | ||
352 | + - fix for timing attacks | ||
353 | + | ||
354 | +1.5.1 / 2014-06-21 | ||
355 | +================== | ||
356 | + | ||
357 | + * Move hard-to-track-down `req.secret` deprecation message | ||
358 | + | ||
359 | +1.5.0 / 2014-06-19 | ||
360 | +================== | ||
361 | + | ||
362 | + * Debug name is now "express-session" | ||
363 | + * Deprecate integration with `cookie-parser` middleware | ||
364 | + * Deprecate looking for secret in `req.secret` | ||
365 | + * Directly read cookies; `cookie-parser` no longer required | ||
366 | + * Directly set cookies; `res.cookie` no longer required | ||
367 | + * Generate session IDs with `uid-safe`, faster and even less collisions | ||
368 | + | ||
369 | +1.4.0 / 2014-06-17 | ||
370 | +================== | ||
371 | + | ||
372 | + * Add `genid` option to generate custom session IDs | ||
373 | + * Add `saveUninitialized` option to control saving uninitialized sessions | ||
374 | + * Add `unset` option to control unsetting `req.session` | ||
375 | + * Generate session IDs with `rand-token` by default; reduce collisions | ||
376 | + * deps: buffer-crc32@0.2.3 | ||
377 | + | ||
378 | +1.3.1 / 2014-06-14 | ||
379 | +================== | ||
380 | + | ||
381 | + * Add description in package for npmjs.org listing | ||
382 | + | ||
383 | +1.3.0 / 2014-06-14 | ||
384 | +================== | ||
385 | + | ||
386 | + * Integrate with express "trust proxy" by default | ||
387 | + * deps: debug@1.0.2 | ||
388 | + | ||
389 | +1.2.1 / 2014-05-27 | ||
390 | +================== | ||
391 | + | ||
392 | + * Fix `resave` such that `resave: true` works | ||
393 | + | ||
394 | +1.2.0 / 2014-05-19 | ||
395 | +================== | ||
396 | + | ||
397 | + * Add `resave` option to control saving unmodified sessions | ||
398 | + | ||
399 | +1.1.0 / 2014-05-12 | ||
400 | +================== | ||
401 | + | ||
402 | + * Add `name` option; replacement for `key` option | ||
403 | + * Use `setImmediate` in MemoryStore for node.js >= 0.10 | ||
404 | + | ||
405 | +1.0.4 / 2014-04-27 | ||
406 | +================== | ||
407 | + | ||
408 | + * deps: debug@0.8.1 | ||
409 | + | ||
410 | +1.0.3 / 2014-04-19 | ||
411 | +================== | ||
412 | + | ||
413 | + * Use `res.cookie()` instead of `res.setHeader()` | ||
414 | + * deps: cookie@0.1.2 | ||
415 | + | ||
416 | +1.0.2 / 2014-02-23 | ||
417 | +================== | ||
418 | + | ||
419 | + * Add missing dependency to `package.json` | ||
420 | + | ||
421 | +1.0.1 / 2014-02-15 | ||
422 | +================== | ||
423 | + | ||
424 | + * Add missing dependencies to `package.json` | ||
425 | + | ||
426 | +1.0.0 / 2014-02-15 | ||
427 | +================== | ||
428 | + | ||
429 | + * Genesis from `connect` |
Mapmory/node_modules/express-session/LICENSE
0 → 100644
1 | +(The MIT License) | ||
2 | + | ||
3 | +Copyright (c) 2010 Sencha Inc. | ||
4 | +Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> | ||
5 | +Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com> | ||
6 | + | ||
7 | +Permission is hereby granted, free of charge, to any person obtaining | ||
8 | +a copy of this software and associated documentation files (the | ||
9 | +'Software'), to deal in the Software without restriction, including | ||
10 | +without limitation the rights to use, copy, modify, merge, publish, | ||
11 | +distribute, sublicense, and/or sell copies of the Software, and to | ||
12 | +permit persons to whom the Software is furnished to do so, subject to | ||
13 | +the following conditions: | ||
14 | + | ||
15 | +The above copyright notice and this permission notice shall be | ||
16 | +included in all copies or substantial portions of the Software. | ||
17 | + | ||
18 | +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
19 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
20 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
21 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
22 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
23 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
24 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +2.0.0 / 2018-10-26 | ||
2 | +================== | ||
3 | + | ||
4 | + * Drop support for Node.js 0.6 | ||
5 | + * Replace internal `eval` usage with `Function` constructor | ||
6 | + * Use instance methods on `process` to check for listeners | ||
7 | + | ||
8 | +1.1.2 / 2018-01-11 | ||
9 | +================== | ||
10 | + | ||
11 | + * perf: remove argument reassignment | ||
12 | + * Support Node.js 0.6 to 9.x | ||
13 | + | ||
14 | +1.1.1 / 2017-07-27 | ||
15 | +================== | ||
16 | + | ||
17 | + * Remove unnecessary `Buffer` loading | ||
18 | + * Support Node.js 0.6 to 8.x | ||
19 | + | ||
20 | +1.1.0 / 2015-09-14 | ||
21 | +================== | ||
22 | + | ||
23 | + * Enable strict mode in more places | ||
24 | + * Support io.js 3.x | ||
25 | + * Support io.js 2.x | ||
26 | + * Support web browser loading | ||
27 | + - Requires bundler like Browserify or webpack | ||
28 | + | ||
29 | +1.0.1 / 2015-04-07 | ||
30 | +================== | ||
31 | + | ||
32 | + * Fix `TypeError`s when under `'use strict'` code | ||
33 | + * Fix useless type name on auto-generated messages | ||
34 | + * Support io.js 1.x | ||
35 | + * Support Node.js 0.12 | ||
36 | + | ||
37 | +1.0.0 / 2014-09-17 | ||
38 | +================== | ||
39 | + | ||
40 | + * No changes | ||
41 | + | ||
42 | +0.4.5 / 2014-09-09 | ||
43 | +================== | ||
44 | + | ||
45 | + * Improve call speed to functions using the function wrapper | ||
46 | + * Support Node.js 0.6 | ||
47 | + | ||
48 | +0.4.4 / 2014-07-27 | ||
49 | +================== | ||
50 | + | ||
51 | + * Work-around v8 generating empty stack traces | ||
52 | + | ||
53 | +0.4.3 / 2014-07-26 | ||
54 | +================== | ||
55 | + | ||
56 | + * Fix exception when global `Error.stackTraceLimit` is too low | ||
57 | + | ||
58 | +0.4.2 / 2014-07-19 | ||
59 | +================== | ||
60 | + | ||
61 | + * Correct call site for wrapped functions and properties | ||
62 | + | ||
63 | +0.4.1 / 2014-07-19 | ||
64 | +================== | ||
65 | + | ||
66 | + * Improve automatic message generation for function properties | ||
67 | + | ||
68 | +0.4.0 / 2014-07-19 | ||
69 | +================== | ||
70 | + | ||
71 | + * Add `TRACE_DEPRECATION` environment variable | ||
72 | + * Remove non-standard grey color from color output | ||
73 | + * Support `--no-deprecation` argument | ||
74 | + * Support `--trace-deprecation` argument | ||
75 | + * Support `deprecate.property(fn, prop, message)` | ||
76 | + | ||
77 | +0.3.0 / 2014-06-16 | ||
78 | +================== | ||
79 | + | ||
80 | + * Add `NO_DEPRECATION` environment variable | ||
81 | + | ||
82 | +0.2.0 / 2014-06-15 | ||
83 | +================== | ||
84 | + | ||
85 | + * Add `deprecate.property(obj, prop, message)` | ||
86 | + * Remove `supports-color` dependency for node.js 0.8 | ||
87 | + | ||
88 | +0.1.0 / 2014-06-15 | ||
89 | +================== | ||
90 | + | ||
91 | + * Add `deprecate.function(fn, message)` | ||
92 | + * Add `process.on('deprecation', fn)` emitter | ||
93 | + * Automatically generate message when omitted from `deprecate()` | ||
94 | + | ||
95 | +0.0.1 / 2014-06-15 | ||
96 | +================== | ||
97 | + | ||
98 | + * Fix warning for dynamic calls at singe call site | ||
99 | + | ||
100 | +0.0.0 / 2014-06-15 | ||
101 | +================== | ||
102 | + | ||
103 | + * Initial implementation |
1 | +(The MIT License) | ||
2 | + | ||
3 | +Copyright (c) 2014-2018 Douglas Christopher Wilson | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining | ||
6 | +a copy of this software and associated documentation files (the | ||
7 | +'Software'), to deal in the Software without restriction, including | ||
8 | +without limitation the rights to use, copy, modify, merge, publish, | ||
9 | +distribute, sublicense, and/or sell copies of the Software, and to | ||
10 | +permit persons to whom the Software is furnished to do so, subject to | ||
11 | +the following conditions: | ||
12 | + | ||
13 | +The above copyright notice and this permission notice shall be | ||
14 | +included in all copies or substantial portions of the Software. | ||
15 | + | ||
16 | +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
17 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
18 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
19 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
20 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
21 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
22 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
1 | +# depd | ||
2 | + | ||
3 | +[![NPM Version][npm-version-image]][npm-url] | ||
4 | +[![NPM Downloads][npm-downloads-image]][npm-url] | ||
5 | +[![Node.js Version][node-image]][node-url] | ||
6 | +[![Linux Build][travis-image]][travis-url] | ||
7 | +[![Windows Build][appveyor-image]][appveyor-url] | ||
8 | +[![Coverage Status][coveralls-image]][coveralls-url] | ||
9 | + | ||
10 | +Deprecate all the things | ||
11 | + | ||
12 | +> With great modules comes great responsibility; mark things deprecated! | ||
13 | + | ||
14 | +## Install | ||
15 | + | ||
16 | +This module is installed directly using `npm`: | ||
17 | + | ||
18 | +```sh | ||
19 | +$ npm install depd | ||
20 | +``` | ||
21 | + | ||
22 | +This module can also be bundled with systems like | ||
23 | +[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/), | ||
24 | +though by default this module will alter it's API to no longer display or | ||
25 | +track deprecations. | ||
26 | + | ||
27 | +## API | ||
28 | + | ||
29 | +<!-- eslint-disable no-unused-vars --> | ||
30 | + | ||
31 | +```js | ||
32 | +var deprecate = require('depd')('my-module') | ||
33 | +``` | ||
34 | + | ||
35 | +This library allows you to display deprecation messages to your users. | ||
36 | +This library goes above and beyond with deprecation warnings by | ||
37 | +introspection of the call stack (but only the bits that it is interested | ||
38 | +in). | ||
39 | + | ||
40 | +Instead of just warning on the first invocation of a deprecated | ||
41 | +function and never again, this module will warn on the first invocation | ||
42 | +of a deprecated function per unique call site, making it ideal to alert | ||
43 | +users of all deprecated uses across the code base, rather than just | ||
44 | +whatever happens to execute first. | ||
45 | + | ||
46 | +The deprecation warnings from this module also include the file and line | ||
47 | +information for the call into the module that the deprecated function was | ||
48 | +in. | ||
49 | + | ||
50 | +**NOTE** this library has a similar interface to the `debug` module, and | ||
51 | +this module uses the calling file to get the boundary for the call stacks, | ||
52 | +so you should always create a new `deprecate` object in each file and not | ||
53 | +within some central file. | ||
54 | + | ||
55 | +### depd(namespace) | ||
56 | + | ||
57 | +Create a new deprecate function that uses the given namespace name in the | ||
58 | +messages and will display the call site prior to the stack entering the | ||
59 | +file this function was called from. It is highly suggested you use the | ||
60 | +name of your module as the namespace. | ||
61 | + | ||
62 | +### deprecate(message) | ||
63 | + | ||
64 | +Call this function from deprecated code to display a deprecation message. | ||
65 | +This message will appear once per unique caller site. Caller site is the | ||
66 | +first call site in the stack in a different file from the caller of this | ||
67 | +function. | ||
68 | + | ||
69 | +If the message is omitted, a message is generated for you based on the site | ||
70 | +of the `deprecate()` call and will display the name of the function called, | ||
71 | +similar to the name displayed in a stack trace. | ||
72 | + | ||
73 | +### deprecate.function(fn, message) | ||
74 | + | ||
75 | +Call this function to wrap a given function in a deprecation message on any | ||
76 | +call to the function. An optional message can be supplied to provide a custom | ||
77 | +message. | ||
78 | + | ||
79 | +### deprecate.property(obj, prop, message) | ||
80 | + | ||
81 | +Call this function to wrap a given property on object in a deprecation message | ||
82 | +on any accessing or setting of the property. An optional message can be supplied | ||
83 | +to provide a custom message. | ||
84 | + | ||
85 | +The method must be called on the object where the property belongs (not | ||
86 | +inherited from the prototype). | ||
87 | + | ||
88 | +If the property is a data descriptor, it will be converted to an accessor | ||
89 | +descriptor in order to display the deprecation message. | ||
90 | + | ||
91 | +### process.on('deprecation', fn) | ||
92 | + | ||
93 | +This module will allow easy capturing of deprecation errors by emitting the | ||
94 | +errors as the type "deprecation" on the global `process`. If there are no | ||
95 | +listeners for this type, the errors are written to STDERR as normal, but if | ||
96 | +there are any listeners, nothing will be written to STDERR and instead only | ||
97 | +emitted. From there, you can write the errors in a different format or to a | ||
98 | +logging source. | ||
99 | + | ||
100 | +The error represents the deprecation and is emitted only once with the same | ||
101 | +rules as writing to STDERR. The error has the following properties: | ||
102 | + | ||
103 | + - `message` - This is the message given by the library | ||
104 | + - `name` - This is always `'DeprecationError'` | ||
105 | + - `namespace` - This is the namespace the deprecation came from | ||
106 | + - `stack` - This is the stack of the call to the deprecated thing | ||
107 | + | ||
108 | +Example `error.stack` output: | ||
109 | + | ||
110 | +``` | ||
111 | +DeprecationError: my-cool-module deprecated oldfunction | ||
112 | + at Object.<anonymous> ([eval]-wrapper:6:22) | ||
113 | + at Module._compile (module.js:456:26) | ||
114 | + at evalScript (node.js:532:25) | ||
115 | + at startup (node.js:80:7) | ||
116 | + at node.js:902:3 | ||
117 | +``` | ||
118 | + | ||
119 | +### process.env.NO_DEPRECATION | ||
120 | + | ||
121 | +As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` | ||
122 | +is provided as a quick solution to silencing deprecation warnings from being | ||
123 | +output. The format of this is similar to that of `DEBUG`: | ||
124 | + | ||
125 | +```sh | ||
126 | +$ NO_DEPRECATION=my-module,othermod node app.js | ||
127 | +``` | ||
128 | + | ||
129 | +This will suppress deprecations from being output for "my-module" and "othermod". | ||
130 | +The value is a list of comma-separated namespaces. To suppress every warning | ||
131 | +across all namespaces, use the value `*` for a namespace. | ||
132 | + | ||
133 | +Providing the argument `--no-deprecation` to the `node` executable will suppress | ||
134 | +all deprecations (only available in Node.js 0.8 or higher). | ||
135 | + | ||
136 | +**NOTE** This will not suppress the deperecations given to any "deprecation" | ||
137 | +event listeners, just the output to STDERR. | ||
138 | + | ||
139 | +### process.env.TRACE_DEPRECATION | ||
140 | + | ||
141 | +As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` | ||
142 | +is provided as a solution to getting more detailed location information in deprecation | ||
143 | +warnings by including the entire stack trace. The format of this is the same as | ||
144 | +`NO_DEPRECATION`: | ||
145 | + | ||
146 | +```sh | ||
147 | +$ TRACE_DEPRECATION=my-module,othermod node app.js | ||
148 | +``` | ||
149 | + | ||
150 | +This will include stack traces for deprecations being output for "my-module" and | ||
151 | +"othermod". The value is a list of comma-separated namespaces. To trace every | ||
152 | +warning across all namespaces, use the value `*` for a namespace. | ||
153 | + | ||
154 | +Providing the argument `--trace-deprecation` to the `node` executable will trace | ||
155 | +all deprecations (only available in Node.js 0.8 or higher). | ||
156 | + | ||
157 | +**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. | ||
158 | + | ||
159 | +## Display | ||
160 | + | ||
161 | +![message](files/message.png) | ||
162 | + | ||
163 | +When a user calls a function in your library that you mark deprecated, they | ||
164 | +will see the following written to STDERR (in the given colors, similar colors | ||
165 | +and layout to the `debug` module): | ||
166 | + | ||
167 | +``` | ||
168 | +bright cyan bright yellow | ||
169 | +| | reset cyan | ||
170 | +| | | | | ||
171 | +▼ ▼ ▼ ▼ | ||
172 | +my-cool-module deprecated oldfunction [eval]-wrapper:6:22 | ||
173 | +▲ ▲ ▲ ▲ | ||
174 | +| | | | | ||
175 | +namespace | | location of mycoolmod.oldfunction() call | ||
176 | + | deprecation message | ||
177 | + the word "deprecated" | ||
178 | +``` | ||
179 | + | ||
180 | +If the user redirects their STDERR to a file or somewhere that does not support | ||
181 | +colors, they see (similar layout to the `debug` module): | ||
182 | + | ||
183 | +``` | ||
184 | +Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 | ||
185 | +▲ ▲ ▲ ▲ ▲ | ||
186 | +| | | | | | ||
187 | +timestamp of message namespace | | location of mycoolmod.oldfunction() call | ||
188 | + | deprecation message | ||
189 | + the word "deprecated" | ||
190 | +``` | ||
191 | + | ||
192 | +## Examples | ||
193 | + | ||
194 | +### Deprecating all calls to a function | ||
195 | + | ||
196 | +This will display a deprecated message about "oldfunction" being deprecated | ||
197 | +from "my-module" on STDERR. | ||
198 | + | ||
199 | +```js | ||
200 | +var deprecate = require('depd')('my-cool-module') | ||
201 | + | ||
202 | +// message automatically derived from function name | ||
203 | +// Object.oldfunction | ||
204 | +exports.oldfunction = deprecate.function(function oldfunction () { | ||
205 | + // all calls to function are deprecated | ||
206 | +}) | ||
207 | + | ||
208 | +// specific message | ||
209 | +exports.oldfunction = deprecate.function(function () { | ||
210 | + // all calls to function are deprecated | ||
211 | +}, 'oldfunction') | ||
212 | +``` | ||
213 | + | ||
214 | +### Conditionally deprecating a function call | ||
215 | + | ||
216 | +This will display a deprecated message about "weirdfunction" being deprecated | ||
217 | +from "my-module" on STDERR when called with less than 2 arguments. | ||
218 | + | ||
219 | +```js | ||
220 | +var deprecate = require('depd')('my-cool-module') | ||
221 | + | ||
222 | +exports.weirdfunction = function () { | ||
223 | + if (arguments.length < 2) { | ||
224 | + // calls with 0 or 1 args are deprecated | ||
225 | + deprecate('weirdfunction args < 2') | ||
226 | + } | ||
227 | +} | ||
228 | +``` | ||
229 | + | ||
230 | +When calling `deprecate` as a function, the warning is counted per call site | ||
231 | +within your own module, so you can display different deprecations depending | ||
232 | +on different situations and the users will still get all the warnings: | ||
233 | + | ||
234 | +```js | ||
235 | +var deprecate = require('depd')('my-cool-module') | ||
236 | + | ||
237 | +exports.weirdfunction = function () { | ||
238 | + if (arguments.length < 2) { | ||
239 | + // calls with 0 or 1 args are deprecated | ||
240 | + deprecate('weirdfunction args < 2') | ||
241 | + } else if (typeof arguments[0] !== 'string') { | ||
242 | + // calls with non-string first argument are deprecated | ||
243 | + deprecate('weirdfunction non-string first arg') | ||
244 | + } | ||
245 | +} | ||
246 | +``` | ||
247 | + | ||
248 | +### Deprecating property access | ||
249 | + | ||
250 | +This will display a deprecated message about "oldprop" being deprecated | ||
251 | +from "my-module" on STDERR when accessed. A deprecation will be displayed | ||
252 | +when setting the value and when getting the value. | ||
253 | + | ||
254 | +```js | ||
255 | +var deprecate = require('depd')('my-cool-module') | ||
256 | + | ||
257 | +exports.oldprop = 'something' | ||
258 | + | ||
259 | +// message automatically derives from property name | ||
260 | +deprecate.property(exports, 'oldprop') | ||
261 | + | ||
262 | +// explicit message | ||
263 | +deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') | ||
264 | +``` | ||
265 | + | ||
266 | +## License | ||
267 | + | ||
268 | +[MIT](LICENSE) | ||
269 | + | ||
270 | +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/nodejs-depd/master?label=windows | ||
271 | +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd | ||
272 | +[coveralls-image]: https://badgen.net/coveralls/c/github/dougwilson/nodejs-depd/master | ||
273 | +[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master | ||
274 | +[node-image]: https://badgen.net/npm/node/depd | ||
275 | +[node-url]: https://nodejs.org/en/download/ | ||
276 | +[npm-downloads-image]: https://badgen.net/npm/dm/depd | ||
277 | +[npm-url]: https://npmjs.org/package/depd | ||
278 | +[npm-version-image]: https://badgen.net/npm/v/depd | ||
279 | +[travis-image]: https://badgen.net/travis/dougwilson/nodejs-depd/master?label=linux | ||
280 | +[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd |
This diff is collapsed. Click to expand it.
1 | +/*! | ||
2 | + * depd | ||
3 | + * Copyright(c) 2015 Douglas Christopher Wilson | ||
4 | + * MIT Licensed | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict' | ||
8 | + | ||
9 | +/** | ||
10 | + * Module exports. | ||
11 | + * @public | ||
12 | + */ | ||
13 | + | ||
14 | +module.exports = depd | ||
15 | + | ||
16 | +/** | ||
17 | + * Create deprecate for namespace in caller. | ||
18 | + */ | ||
19 | + | ||
20 | +function depd (namespace) { | ||
21 | + if (!namespace) { | ||
22 | + throw new TypeError('argument namespace is required') | ||
23 | + } | ||
24 | + | ||
25 | + function deprecate (message) { | ||
26 | + // no-op in browser | ||
27 | + } | ||
28 | + | ||
29 | + deprecate._file = undefined | ||
30 | + deprecate._ignored = true | ||
31 | + deprecate._namespace = namespace | ||
32 | + deprecate._traced = false | ||
33 | + deprecate._warned = Object.create(null) | ||
34 | + | ||
35 | + deprecate.function = wrapfunction | ||
36 | + deprecate.property = wrapproperty | ||
37 | + | ||
38 | + return deprecate | ||
39 | +} | ||
40 | + | ||
41 | +/** | ||
42 | + * Return a wrapped function in a deprecation message. | ||
43 | + * | ||
44 | + * This is a no-op version of the wrapper, which does nothing but call | ||
45 | + * validation. | ||
46 | + */ | ||
47 | + | ||
48 | +function wrapfunction (fn, message) { | ||
49 | + if (typeof fn !== 'function') { | ||
50 | + throw new TypeError('argument fn must be a function') | ||
51 | + } | ||
52 | + | ||
53 | + return fn | ||
54 | +} | ||
55 | + | ||
56 | +/** | ||
57 | + * Wrap property in a deprecation message. | ||
58 | + * | ||
59 | + * This is a no-op version of the wrapper, which does nothing but call | ||
60 | + * validation. | ||
61 | + */ | ||
62 | + | ||
63 | +function wrapproperty (obj, prop, message) { | ||
64 | + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { | ||
65 | + throw new TypeError('argument obj must be object') | ||
66 | + } | ||
67 | + | ||
68 | + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) | ||
69 | + | ||
70 | + if (!descriptor) { | ||
71 | + throw new TypeError('must call property on owner object') | ||
72 | + } | ||
73 | + | ||
74 | + if (!descriptor.configurable) { | ||
75 | + throw new TypeError('property must be configurable') | ||
76 | + } | ||
77 | +} |
1 | +{ | ||
2 | + "_from": "depd@~2.0.0", | ||
3 | + "_id": "depd@2.0.0", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", | ||
6 | + "_location": "/express-session/depd", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "depd@~2.0.0", | ||
12 | + "name": "depd", | ||
13 | + "escapedName": "depd", | ||
14 | + "rawSpec": "~2.0.0", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "~2.0.0" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/express-session" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", | ||
22 | + "_shasum": "b696163cc757560d09cf22cc8fad1571b79e76df", | ||
23 | + "_spec": "depd@~2.0.0", | ||
24 | + "_where": "C:\\Users\\fheld\\Desktop\\khuhub\\mapmory\\Mapmory\\node_modules\\express-session", | ||
25 | + "author": { | ||
26 | + "name": "Douglas Christopher Wilson", | ||
27 | + "email": "doug@somethingdoug.com" | ||
28 | + }, | ||
29 | + "browser": "lib/browser/index.js", | ||
30 | + "bugs": { | ||
31 | + "url": "https://github.com/dougwilson/nodejs-depd/issues" | ||
32 | + }, | ||
33 | + "bundleDependencies": false, | ||
34 | + "deprecated": false, | ||
35 | + "description": "Deprecate all the things", | ||
36 | + "devDependencies": { | ||
37 | + "beautify-benchmark": "0.2.4", | ||
38 | + "benchmark": "2.1.4", | ||
39 | + "eslint": "5.7.0", | ||
40 | + "eslint-config-standard": "12.0.0", | ||
41 | + "eslint-plugin-import": "2.14.0", | ||
42 | + "eslint-plugin-markdown": "1.0.0-beta.7", | ||
43 | + "eslint-plugin-node": "7.0.1", | ||
44 | + "eslint-plugin-promise": "4.0.1", | ||
45 | + "eslint-plugin-standard": "4.0.0", | ||
46 | + "istanbul": "0.4.5", | ||
47 | + "mocha": "5.2.0", | ||
48 | + "safe-buffer": "5.1.2", | ||
49 | + "uid-safe": "2.1.5" | ||
50 | + }, | ||
51 | + "engines": { | ||
52 | + "node": ">= 0.8" | ||
53 | + }, | ||
54 | + "files": [ | ||
55 | + "lib/", | ||
56 | + "History.md", | ||
57 | + "LICENSE", | ||
58 | + "index.js", | ||
59 | + "Readme.md" | ||
60 | + ], | ||
61 | + "homepage": "https://github.com/dougwilson/nodejs-depd#readme", | ||
62 | + "keywords": [ | ||
63 | + "deprecate", | ||
64 | + "deprecated" | ||
65 | + ], | ||
66 | + "license": "MIT", | ||
67 | + "name": "depd", | ||
68 | + "repository": { | ||
69 | + "type": "git", | ||
70 | + "url": "git+https://github.com/dougwilson/nodejs-depd.git" | ||
71 | + }, | ||
72 | + "scripts": { | ||
73 | + "bench": "node benchmark/index.js", | ||
74 | + "lint": "eslint --plugin markdown --ext js,md .", | ||
75 | + "test": "mocha --reporter spec --bail test/", | ||
76 | + "test-ci": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter spec test/ && istanbul report lcovonly text-summary", | ||
77 | + "test-cov": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter dot test/ && istanbul report lcov text-summary" | ||
78 | + }, | ||
79 | + "version": "2.0.0" | ||
80 | +} |
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) Feross Aboukhadijeh | ||
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 | ||
13 | +all 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 | ||
21 | +THE SOFTWARE. |
This diff is collapsed. Click to expand it.
1 | +declare module "safe-buffer" { | ||
2 | + export class Buffer { | ||
3 | + length: number | ||
4 | + write(string: string, offset?: number, length?: number, encoding?: string): number; | ||
5 | + toString(encoding?: string, start?: number, end?: number): string; | ||
6 | + toJSON(): { type: 'Buffer', data: any[] }; | ||
7 | + equals(otherBuffer: Buffer): boolean; | ||
8 | + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; | ||
9 | + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; | ||
10 | + slice(start?: number, end?: number): Buffer; | ||
11 | + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; | ||
12 | + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; | ||
13 | + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; | ||
14 | + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; | ||
15 | + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; | ||
16 | + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; | ||
17 | + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; | ||
18 | + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; | ||
19 | + readUInt8(offset: number, noAssert?: boolean): number; | ||
20 | + readUInt16LE(offset: number, noAssert?: boolean): number; | ||
21 | + readUInt16BE(offset: number, noAssert?: boolean): number; | ||
22 | + readUInt32LE(offset: number, noAssert?: boolean): number; | ||
23 | + readUInt32BE(offset: number, noAssert?: boolean): number; | ||
24 | + readInt8(offset: number, noAssert?: boolean): number; | ||
25 | + readInt16LE(offset: number, noAssert?: boolean): number; | ||
26 | + readInt16BE(offset: number, noAssert?: boolean): number; | ||
27 | + readInt32LE(offset: number, noAssert?: boolean): number; | ||
28 | + readInt32BE(offset: number, noAssert?: boolean): number; | ||
29 | + readFloatLE(offset: number, noAssert?: boolean): number; | ||
30 | + readFloatBE(offset: number, noAssert?: boolean): number; | ||
31 | + readDoubleLE(offset: number, noAssert?: boolean): number; | ||
32 | + readDoubleBE(offset: number, noAssert?: boolean): number; | ||
33 | + swap16(): Buffer; | ||
34 | + swap32(): Buffer; | ||
35 | + swap64(): Buffer; | ||
36 | + writeUInt8(value: number, offset: number, noAssert?: boolean): number; | ||
37 | + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; | ||
38 | + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; | ||
39 | + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; | ||
40 | + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; | ||
41 | + writeInt8(value: number, offset: number, noAssert?: boolean): number; | ||
42 | + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; | ||
43 | + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; | ||
44 | + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; | ||
45 | + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; | ||
46 | + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; | ||
47 | + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; | ||
48 | + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; | ||
49 | + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; | ||
50 | + fill(value: any, offset?: number, end?: number): this; | ||
51 | + indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; | ||
52 | + lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; | ||
53 | + includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; | ||
54 | + | ||
55 | + /** | ||
56 | + * Allocates a new buffer containing the given {str}. | ||
57 | + * | ||
58 | + * @param str String to store in buffer. | ||
59 | + * @param encoding encoding to use, optional. Default is 'utf8' | ||
60 | + */ | ||
61 | + constructor (str: string, encoding?: string); | ||
62 | + /** | ||
63 | + * Allocates a new buffer of {size} octets. | ||
64 | + * | ||
65 | + * @param size count of octets to allocate. | ||
66 | + */ | ||
67 | + constructor (size: number); | ||
68 | + /** | ||
69 | + * Allocates a new buffer containing the given {array} of octets. | ||
70 | + * | ||
71 | + * @param array The octets to store. | ||
72 | + */ | ||
73 | + constructor (array: Uint8Array); | ||
74 | + /** | ||
75 | + * Produces a Buffer backed by the same allocated memory as | ||
76 | + * the given {ArrayBuffer}. | ||
77 | + * | ||
78 | + * | ||
79 | + * @param arrayBuffer The ArrayBuffer with which to share memory. | ||
80 | + */ | ||
81 | + constructor (arrayBuffer: ArrayBuffer); | ||
82 | + /** | ||
83 | + * Allocates a new buffer containing the given {array} of octets. | ||
84 | + * | ||
85 | + * @param array The octets to store. | ||
86 | + */ | ||
87 | + constructor (array: any[]); | ||
88 | + /** | ||
89 | + * Copies the passed {buffer} data onto a new {Buffer} instance. | ||
90 | + * | ||
91 | + * @param buffer The buffer to copy. | ||
92 | + */ | ||
93 | + constructor (buffer: Buffer); | ||
94 | + prototype: Buffer; | ||
95 | + /** | ||
96 | + * Allocates a new Buffer using an {array} of octets. | ||
97 | + * | ||
98 | + * @param array | ||
99 | + */ | ||
100 | + static from(array: any[]): Buffer; | ||
101 | + /** | ||
102 | + * When passed a reference to the .buffer property of a TypedArray instance, | ||
103 | + * the newly created Buffer will share the same allocated memory as the TypedArray. | ||
104 | + * The optional {byteOffset} and {length} arguments specify a memory range | ||
105 | + * within the {arrayBuffer} that will be shared by the Buffer. | ||
106 | + * | ||
107 | + * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() | ||
108 | + * @param byteOffset | ||
109 | + * @param length | ||
110 | + */ | ||
111 | + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; | ||
112 | + /** | ||
113 | + * Copies the passed {buffer} data onto a new Buffer instance. | ||
114 | + * | ||
115 | + * @param buffer | ||
116 | + */ | ||
117 | + static from(buffer: Buffer): Buffer; | ||
118 | + /** | ||
119 | + * Creates a new Buffer containing the given JavaScript string {str}. | ||
120 | + * If provided, the {encoding} parameter identifies the character encoding. | ||
121 | + * If not provided, {encoding} defaults to 'utf8'. | ||
122 | + * | ||
123 | + * @param str | ||
124 | + */ | ||
125 | + static from(str: string, encoding?: string): Buffer; | ||
126 | + /** | ||
127 | + * Returns true if {obj} is a Buffer | ||
128 | + * | ||
129 | + * @param obj object to test. | ||
130 | + */ | ||
131 | + static isBuffer(obj: any): obj is Buffer; | ||
132 | + /** | ||
133 | + * Returns true if {encoding} is a valid encoding argument. | ||
134 | + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' | ||
135 | + * | ||
136 | + * @param encoding string to test. | ||
137 | + */ | ||
138 | + static isEncoding(encoding: string): boolean; | ||
139 | + /** | ||
140 | + * Gives the actual byte length of a string. encoding defaults to 'utf8'. | ||
141 | + * This is not the same as String.prototype.length since that returns the number of characters in a string. | ||
142 | + * | ||
143 | + * @param string string to test. | ||
144 | + * @param encoding encoding used to evaluate (defaults to 'utf8') | ||
145 | + */ | ||
146 | + static byteLength(string: string, encoding?: string): number; | ||
147 | + /** | ||
148 | + * Returns a buffer which is the result of concatenating all the buffers in the list together. | ||
149 | + * | ||
150 | + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. | ||
151 | + * If the list has exactly one item, then the first item of the list is returned. | ||
152 | + * If the list has more than one item, then a new Buffer is created. | ||
153 | + * | ||
154 | + * @param list An array of Buffer objects to concatenate | ||
155 | + * @param totalLength Total length of the buffers when concatenated. | ||
156 | + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. | ||
157 | + */ | ||
158 | + static concat(list: Buffer[], totalLength?: number): Buffer; | ||
159 | + /** | ||
160 | + * The same as buf1.compare(buf2). | ||
161 | + */ | ||
162 | + static compare(buf1: Buffer, buf2: Buffer): number; | ||
163 | + /** | ||
164 | + * Allocates a new buffer of {size} octets. | ||
165 | + * | ||
166 | + * @param size count of octets to allocate. | ||
167 | + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). | ||
168 | + * If parameter is omitted, buffer will be filled with zeros. | ||
169 | + * @param encoding encoding used for call to buf.fill while initalizing | ||
170 | + */ | ||
171 | + static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; | ||
172 | + /** | ||
173 | + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents | ||
174 | + * of the newly created Buffer are unknown and may contain sensitive data. | ||
175 | + * | ||
176 | + * @param size count of octets to allocate | ||
177 | + */ | ||
178 | + static allocUnsafe(size: number): Buffer; | ||
179 | + /** | ||
180 | + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents | ||
181 | + * of the newly created Buffer are unknown and may contain sensitive data. | ||
182 | + * | ||
183 | + * @param size count of octets to allocate | ||
184 | + */ | ||
185 | + static allocUnsafeSlow(size: number): Buffer; | ||
186 | + } | ||
187 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* eslint-disable node/no-deprecated-api */ | ||
2 | +var buffer = require('buffer') | ||
3 | +var Buffer = buffer.Buffer | ||
4 | + | ||
5 | +// alternative to using Object.keys for old browsers | ||
6 | +function copyProps (src, dst) { | ||
7 | + for (var key in src) { | ||
8 | + dst[key] = src[key] | ||
9 | + } | ||
10 | +} | ||
11 | +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { | ||
12 | + module.exports = buffer | ||
13 | +} else { | ||
14 | + // Copy properties from require('buffer') | ||
15 | + copyProps(buffer, exports) | ||
16 | + exports.Buffer = SafeBuffer | ||
17 | +} | ||
18 | + | ||
19 | +function SafeBuffer (arg, encodingOrOffset, length) { | ||
20 | + return Buffer(arg, encodingOrOffset, length) | ||
21 | +} | ||
22 | + | ||
23 | +SafeBuffer.prototype = Object.create(Buffer.prototype) | ||
24 | + | ||
25 | +// Copy static methods from Buffer | ||
26 | +copyProps(Buffer, SafeBuffer) | ||
27 | + | ||
28 | +SafeBuffer.from = function (arg, encodingOrOffset, length) { | ||
29 | + if (typeof arg === 'number') { | ||
30 | + throw new TypeError('Argument must not be a number') | ||
31 | + } | ||
32 | + return Buffer(arg, encodingOrOffset, length) | ||
33 | +} | ||
34 | + | ||
35 | +SafeBuffer.alloc = function (size, fill, encoding) { | ||
36 | + if (typeof size !== 'number') { | ||
37 | + throw new TypeError('Argument must be a number') | ||
38 | + } | ||
39 | + var buf = Buffer(size) | ||
40 | + if (fill !== undefined) { | ||
41 | + if (typeof encoding === 'string') { | ||
42 | + buf.fill(fill, encoding) | ||
43 | + } else { | ||
44 | + buf.fill(fill) | ||
45 | + } | ||
46 | + } else { | ||
47 | + buf.fill(0) | ||
48 | + } | ||
49 | + return buf | ||
50 | +} | ||
51 | + | ||
52 | +SafeBuffer.allocUnsafe = function (size) { | ||
53 | + if (typeof size !== 'number') { | ||
54 | + throw new TypeError('Argument must be a number') | ||
55 | + } | ||
56 | + return Buffer(size) | ||
57 | +} | ||
58 | + | ||
59 | +SafeBuffer.allocUnsafeSlow = function (size) { | ||
60 | + if (typeof size !== 'number') { | ||
61 | + throw new TypeError('Argument must be a number') | ||
62 | + } | ||
63 | + return buffer.SlowBuffer(size) | ||
64 | +} |
1 | +{ | ||
2 | + "_from": "safe-buffer@5.2.0", | ||
3 | + "_id": "safe-buffer@5.2.0", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", | ||
6 | + "_location": "/express-session/safe-buffer", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "version", | ||
10 | + "registry": true, | ||
11 | + "raw": "safe-buffer@5.2.0", | ||
12 | + "name": "safe-buffer", | ||
13 | + "escapedName": "safe-buffer", | ||
14 | + "rawSpec": "5.2.0", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "5.2.0" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/express-session" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", | ||
22 | + "_shasum": "b74daec49b1148f88c64b68d49b1e815c1f2f519", | ||
23 | + "_spec": "safe-buffer@5.2.0", | ||
24 | + "_where": "C:\\Users\\fheld\\Desktop\\khuhub\\mapmory\\Mapmory\\node_modules\\express-session", | ||
25 | + "author": { | ||
26 | + "name": "Feross Aboukhadijeh", | ||
27 | + "email": "feross@feross.org", | ||
28 | + "url": "http://feross.org" | ||
29 | + }, | ||
30 | + "bugs": { | ||
31 | + "url": "https://github.com/feross/safe-buffer/issues" | ||
32 | + }, | ||
33 | + "bundleDependencies": false, | ||
34 | + "deprecated": false, | ||
35 | + "description": "Safer Node.js Buffer API", | ||
36 | + "devDependencies": { | ||
37 | + "standard": "*", | ||
38 | + "tape": "^4.0.0" | ||
39 | + }, | ||
40 | + "homepage": "https://github.com/feross/safe-buffer", | ||
41 | + "keywords": [ | ||
42 | + "buffer", | ||
43 | + "buffer allocate", | ||
44 | + "node security", | ||
45 | + "safe", | ||
46 | + "safe-buffer", | ||
47 | + "security", | ||
48 | + "uninitialized" | ||
49 | + ], | ||
50 | + "license": "MIT", | ||
51 | + "main": "index.js", | ||
52 | + "name": "safe-buffer", | ||
53 | + "repository": { | ||
54 | + "type": "git", | ||
55 | + "url": "git://github.com/feross/safe-buffer.git" | ||
56 | + }, | ||
57 | + "scripts": { | ||
58 | + "test": "standard && tape test/*.js" | ||
59 | + }, | ||
60 | + "types": "index.d.ts", | ||
61 | + "version": "5.2.0" | ||
62 | +} |
1 | +{ | ||
2 | + "_from": "express-session", | ||
3 | + "_id": "express-session@1.17.1", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-UbHwgqjxQZJiWRTMyhvWGvjBQduGCSBDhhZXYenziMFjxst5rMV+aJZ6hKPHZnPyHGsrqRICxtX8jtEbm/z36Q==", | ||
6 | + "_location": "/express-session", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "tag", | ||
10 | + "registry": true, | ||
11 | + "raw": "express-session", | ||
12 | + "name": "express-session", | ||
13 | + "escapedName": "express-session", | ||
14 | + "rawSpec": "", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "latest" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "#USER", | ||
20 | + "/" | ||
21 | + ], | ||
22 | + "_resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.1.tgz", | ||
23 | + "_shasum": "36ecbc7034566d38c8509885c044d461c11bf357", | ||
24 | + "_spec": "express-session", | ||
25 | + "_where": "C:\\Users\\fheld\\Desktop\\khuhub\\mapmory\\Mapmory", | ||
26 | + "author": { | ||
27 | + "name": "TJ Holowaychuk", | ||
28 | + "email": "tj@vision-media.ca", | ||
29 | + "url": "http://tjholowaychuk.com" | ||
30 | + }, | ||
31 | + "bugs": { | ||
32 | + "url": "https://github.com/expressjs/session/issues" | ||
33 | + }, | ||
34 | + "bundleDependencies": false, | ||
35 | + "contributors": [ | ||
36 | + { | ||
37 | + "name": "Douglas Christopher Wilson", | ||
38 | + "email": "doug@somethingdoug.com" | ||
39 | + }, | ||
40 | + { | ||
41 | + "name": "Joe Wagner", | ||
42 | + "email": "njwjs722@gmail.com" | ||
43 | + } | ||
44 | + ], | ||
45 | + "dependencies": { | ||
46 | + "cookie": "0.4.0", | ||
47 | + "cookie-signature": "1.0.6", | ||
48 | + "debug": "2.6.9", | ||
49 | + "depd": "~2.0.0", | ||
50 | + "on-headers": "~1.0.2", | ||
51 | + "parseurl": "~1.3.3", | ||
52 | + "safe-buffer": "5.2.0", | ||
53 | + "uid-safe": "~2.1.5" | ||
54 | + }, | ||
55 | + "deprecated": false, | ||
56 | + "description": "Simple session middleware for Express", | ||
57 | + "devDependencies": { | ||
58 | + "after": "0.8.2", | ||
59 | + "cookie-parser": "1.4.5", | ||
60 | + "eslint": "3.19.0", | ||
61 | + "eslint-plugin-markdown": "1.0.2", | ||
62 | + "express": "4.17.1", | ||
63 | + "mocha": "7.1.1", | ||
64 | + "nyc": "15.0.1", | ||
65 | + "supertest": "4.0.2" | ||
66 | + }, | ||
67 | + "engines": { | ||
68 | + "node": ">= 0.8.0" | ||
69 | + }, | ||
70 | + "files": [ | ||
71 | + "session/", | ||
72 | + "HISTORY.md", | ||
73 | + "LICENSE", | ||
74 | + "index.js" | ||
75 | + ], | ||
76 | + "homepage": "https://github.com/expressjs/session#readme", | ||
77 | + "license": "MIT", | ||
78 | + "name": "express-session", | ||
79 | + "repository": { | ||
80 | + "type": "git", | ||
81 | + "url": "git+https://github.com/expressjs/session.git" | ||
82 | + }, | ||
83 | + "scripts": { | ||
84 | + "lint": "eslint --plugin markdown --ext js,md . && node ./scripts/lint-readme.js", | ||
85 | + "test": "mocha --require test/support/env --check-leaks --bail --no-exit --reporter spec test/", | ||
86 | + "test-cov": "nyc npm test", | ||
87 | + "test-travis": "nyc npm test -- --no-exit", | ||
88 | + "version": "node scripts/version-history.js && git add HISTORY.md" | ||
89 | + }, | ||
90 | + "version": "1.17.1" | ||
91 | +} |
1 | +/*! | ||
2 | + * Connect - session - Cookie | ||
3 | + * Copyright(c) 2010 Sencha Inc. | ||
4 | + * Copyright(c) 2011 TJ Holowaychuk | ||
5 | + * MIT Licensed | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict'; | ||
9 | + | ||
10 | +/** | ||
11 | + * Module dependencies. | ||
12 | + */ | ||
13 | + | ||
14 | +var cookie = require('cookie') | ||
15 | +var deprecate = require('depd')('express-session') | ||
16 | + | ||
17 | +/** | ||
18 | + * Initialize a new `Cookie` with the given `options`. | ||
19 | + * | ||
20 | + * @param {IncomingMessage} req | ||
21 | + * @param {Object} options | ||
22 | + * @api private | ||
23 | + */ | ||
24 | + | ||
25 | +var Cookie = module.exports = function Cookie(options) { | ||
26 | + this.path = '/'; | ||
27 | + this.maxAge = null; | ||
28 | + this.httpOnly = true; | ||
29 | + | ||
30 | + if (options) { | ||
31 | + if (typeof options !== 'object') { | ||
32 | + throw new TypeError('argument options must be a object') | ||
33 | + } | ||
34 | + | ||
35 | + for (var key in options) { | ||
36 | + if (key !== 'data') { | ||
37 | + this[key] = options[key] | ||
38 | + } | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + if (this.originalMaxAge === undefined || this.originalMaxAge === null) { | ||
43 | + this.originalMaxAge = this.maxAge | ||
44 | + } | ||
45 | +}; | ||
46 | + | ||
47 | +/*! | ||
48 | + * Prototype. | ||
49 | + */ | ||
50 | + | ||
51 | +Cookie.prototype = { | ||
52 | + | ||
53 | + /** | ||
54 | + * Set expires `date`. | ||
55 | + * | ||
56 | + * @param {Date} date | ||
57 | + * @api public | ||
58 | + */ | ||
59 | + | ||
60 | + set expires(date) { | ||
61 | + this._expires = date; | ||
62 | + this.originalMaxAge = this.maxAge; | ||
63 | + }, | ||
64 | + | ||
65 | + /** | ||
66 | + * Get expires `date`. | ||
67 | + * | ||
68 | + * @return {Date} | ||
69 | + * @api public | ||
70 | + */ | ||
71 | + | ||
72 | + get expires() { | ||
73 | + return this._expires; | ||
74 | + }, | ||
75 | + | ||
76 | + /** | ||
77 | + * Set expires via max-age in `ms`. | ||
78 | + * | ||
79 | + * @param {Number} ms | ||
80 | + * @api public | ||
81 | + */ | ||
82 | + | ||
83 | + set maxAge(ms) { | ||
84 | + if (ms && typeof ms !== 'number' && !(ms instanceof Date)) { | ||
85 | + throw new TypeError('maxAge must be a number or Date') | ||
86 | + } | ||
87 | + | ||
88 | + if (ms instanceof Date) { | ||
89 | + deprecate('maxAge as Date; pass number of milliseconds instead') | ||
90 | + } | ||
91 | + | ||
92 | + this.expires = typeof ms === 'number' | ||
93 | + ? new Date(Date.now() + ms) | ||
94 | + : ms; | ||
95 | + }, | ||
96 | + | ||
97 | + /** | ||
98 | + * Get expires max-age in `ms`. | ||
99 | + * | ||
100 | + * @return {Number} | ||
101 | + * @api public | ||
102 | + */ | ||
103 | + | ||
104 | + get maxAge() { | ||
105 | + return this.expires instanceof Date | ||
106 | + ? this.expires.valueOf() - Date.now() | ||
107 | + : this.expires; | ||
108 | + }, | ||
109 | + | ||
110 | + /** | ||
111 | + * Return cookie data object. | ||
112 | + * | ||
113 | + * @return {Object} | ||
114 | + * @api private | ||
115 | + */ | ||
116 | + | ||
117 | + get data() { | ||
118 | + return { | ||
119 | + originalMaxAge: this.originalMaxAge | ||
120 | + , expires: this._expires | ||
121 | + , secure: this.secure | ||
122 | + , httpOnly: this.httpOnly | ||
123 | + , domain: this.domain | ||
124 | + , path: this.path | ||
125 | + , sameSite: this.sameSite | ||
126 | + } | ||
127 | + }, | ||
128 | + | ||
129 | + /** | ||
130 | + * Return a serialized cookie string. | ||
131 | + * | ||
132 | + * @return {String} | ||
133 | + * @api public | ||
134 | + */ | ||
135 | + | ||
136 | + serialize: function(name, val){ | ||
137 | + return cookie.serialize(name, val, this.data); | ||
138 | + }, | ||
139 | + | ||
140 | + /** | ||
141 | + * Return JSON representation of this cookie. | ||
142 | + * | ||
143 | + * @return {Object} | ||
144 | + * @api private | ||
145 | + */ | ||
146 | + | ||
147 | + toJSON: function(){ | ||
148 | + return this.data; | ||
149 | + } | ||
150 | +}; |
1 | +/*! | ||
2 | + * express-session | ||
3 | + * Copyright(c) 2010 Sencha Inc. | ||
4 | + * Copyright(c) 2011 TJ Holowaychuk | ||
5 | + * Copyright(c) 2015 Douglas Christopher Wilson | ||
6 | + * MIT Licensed | ||
7 | + */ | ||
8 | + | ||
9 | +'use strict'; | ||
10 | + | ||
11 | +/** | ||
12 | + * Module dependencies. | ||
13 | + * @private | ||
14 | + */ | ||
15 | + | ||
16 | +var Store = require('./store') | ||
17 | +var util = require('util') | ||
18 | + | ||
19 | +/** | ||
20 | + * Shim setImmediate for node.js < 0.10 | ||
21 | + * @private | ||
22 | + */ | ||
23 | + | ||
24 | +/* istanbul ignore next */ | ||
25 | +var defer = typeof setImmediate === 'function' | ||
26 | + ? setImmediate | ||
27 | + : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } | ||
28 | + | ||
29 | +/** | ||
30 | + * Module exports. | ||
31 | + */ | ||
32 | + | ||
33 | +module.exports = MemoryStore | ||
34 | + | ||
35 | +/** | ||
36 | + * A session store in memory. | ||
37 | + * @public | ||
38 | + */ | ||
39 | + | ||
40 | +function MemoryStore() { | ||
41 | + Store.call(this) | ||
42 | + this.sessions = Object.create(null) | ||
43 | +} | ||
44 | + | ||
45 | +/** | ||
46 | + * Inherit from Store. | ||
47 | + */ | ||
48 | + | ||
49 | +util.inherits(MemoryStore, Store) | ||
50 | + | ||
51 | +/** | ||
52 | + * Get all active sessions. | ||
53 | + * | ||
54 | + * @param {function} callback | ||
55 | + * @public | ||
56 | + */ | ||
57 | + | ||
58 | +MemoryStore.prototype.all = function all(callback) { | ||
59 | + var sessionIds = Object.keys(this.sessions) | ||
60 | + var sessions = Object.create(null) | ||
61 | + | ||
62 | + for (var i = 0; i < sessionIds.length; i++) { | ||
63 | + var sessionId = sessionIds[i] | ||
64 | + var session = getSession.call(this, sessionId) | ||
65 | + | ||
66 | + if (session) { | ||
67 | + sessions[sessionId] = session; | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + callback && defer(callback, null, sessions) | ||
72 | +} | ||
73 | + | ||
74 | +/** | ||
75 | + * Clear all sessions. | ||
76 | + * | ||
77 | + * @param {function} callback | ||
78 | + * @public | ||
79 | + */ | ||
80 | + | ||
81 | +MemoryStore.prototype.clear = function clear(callback) { | ||
82 | + this.sessions = Object.create(null) | ||
83 | + callback && defer(callback) | ||
84 | +} | ||
85 | + | ||
86 | +/** | ||
87 | + * Destroy the session associated with the given session ID. | ||
88 | + * | ||
89 | + * @param {string} sessionId | ||
90 | + * @public | ||
91 | + */ | ||
92 | + | ||
93 | +MemoryStore.prototype.destroy = function destroy(sessionId, callback) { | ||
94 | + delete this.sessions[sessionId] | ||
95 | + callback && defer(callback) | ||
96 | +} | ||
97 | + | ||
98 | +/** | ||
99 | + * Fetch session by the given session ID. | ||
100 | + * | ||
101 | + * @param {string} sessionId | ||
102 | + * @param {function} callback | ||
103 | + * @public | ||
104 | + */ | ||
105 | + | ||
106 | +MemoryStore.prototype.get = function get(sessionId, callback) { | ||
107 | + defer(callback, null, getSession.call(this, sessionId)) | ||
108 | +} | ||
109 | + | ||
110 | +/** | ||
111 | + * Commit the given session associated with the given sessionId to the store. | ||
112 | + * | ||
113 | + * @param {string} sessionId | ||
114 | + * @param {object} session | ||
115 | + * @param {function} callback | ||
116 | + * @public | ||
117 | + */ | ||
118 | + | ||
119 | +MemoryStore.prototype.set = function set(sessionId, session, callback) { | ||
120 | + this.sessions[sessionId] = JSON.stringify(session) | ||
121 | + callback && defer(callback) | ||
122 | +} | ||
123 | + | ||
124 | +/** | ||
125 | + * Get number of active sessions. | ||
126 | + * | ||
127 | + * @param {function} callback | ||
128 | + * @public | ||
129 | + */ | ||
130 | + | ||
131 | +MemoryStore.prototype.length = function length(callback) { | ||
132 | + this.all(function (err, sessions) { | ||
133 | + if (err) return callback(err) | ||
134 | + callback(null, Object.keys(sessions).length) | ||
135 | + }) | ||
136 | +} | ||
137 | + | ||
138 | +/** | ||
139 | + * Touch the given session object associated with the given session ID. | ||
140 | + * | ||
141 | + * @param {string} sessionId | ||
142 | + * @param {object} session | ||
143 | + * @param {function} callback | ||
144 | + * @public | ||
145 | + */ | ||
146 | + | ||
147 | +MemoryStore.prototype.touch = function touch(sessionId, session, callback) { | ||
148 | + var currentSession = getSession.call(this, sessionId) | ||
149 | + | ||
150 | + if (currentSession) { | ||
151 | + // update expiration | ||
152 | + currentSession.cookie = session.cookie | ||
153 | + this.sessions[sessionId] = JSON.stringify(currentSession) | ||
154 | + } | ||
155 | + | ||
156 | + callback && defer(callback) | ||
157 | +} | ||
158 | + | ||
159 | +/** | ||
160 | + * Get session from the store. | ||
161 | + * @private | ||
162 | + */ | ||
163 | + | ||
164 | +function getSession(sessionId) { | ||
165 | + var sess = this.sessions[sessionId] | ||
166 | + | ||
167 | + if (!sess) { | ||
168 | + return | ||
169 | + } | ||
170 | + | ||
171 | + // parse | ||
172 | + sess = JSON.parse(sess) | ||
173 | + | ||
174 | + if (sess.cookie) { | ||
175 | + var expires = typeof sess.cookie.expires === 'string' | ||
176 | + ? new Date(sess.cookie.expires) | ||
177 | + : sess.cookie.expires | ||
178 | + | ||
179 | + // destroy expired session | ||
180 | + if (expires && expires <= Date.now()) { | ||
181 | + delete this.sessions[sessionId] | ||
182 | + return | ||
183 | + } | ||
184 | + } | ||
185 | + | ||
186 | + return sess | ||
187 | +} |
1 | +/*! | ||
2 | + * Connect - session - Session | ||
3 | + * Copyright(c) 2010 Sencha Inc. | ||
4 | + * Copyright(c) 2011 TJ Holowaychuk | ||
5 | + * MIT Licensed | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict'; | ||
9 | + | ||
10 | +/** | ||
11 | + * Expose Session. | ||
12 | + */ | ||
13 | + | ||
14 | +module.exports = Session; | ||
15 | + | ||
16 | +/** | ||
17 | + * Create a new `Session` with the given request and `data`. | ||
18 | + * | ||
19 | + * @param {IncomingRequest} req | ||
20 | + * @param {Object} data | ||
21 | + * @api private | ||
22 | + */ | ||
23 | + | ||
24 | +function Session(req, data) { | ||
25 | + Object.defineProperty(this, 'req', { value: req }); | ||
26 | + Object.defineProperty(this, 'id', { value: req.sessionID }); | ||
27 | + | ||
28 | + if (typeof data === 'object' && data !== null) { | ||
29 | + // merge data into this, ignoring prototype properties | ||
30 | + for (var prop in data) { | ||
31 | + if (!(prop in this)) { | ||
32 | + this[prop] = data[prop] | ||
33 | + } | ||
34 | + } | ||
35 | + } | ||
36 | +} | ||
37 | + | ||
38 | +/** | ||
39 | + * Update reset `.cookie.maxAge` to prevent | ||
40 | + * the cookie from expiring when the | ||
41 | + * session is still active. | ||
42 | + * | ||
43 | + * @return {Session} for chaining | ||
44 | + * @api public | ||
45 | + */ | ||
46 | + | ||
47 | +defineMethod(Session.prototype, 'touch', function touch() { | ||
48 | + return this.resetMaxAge(); | ||
49 | +}); | ||
50 | + | ||
51 | +/** | ||
52 | + * Reset `.maxAge` to `.originalMaxAge`. | ||
53 | + * | ||
54 | + * @return {Session} for chaining | ||
55 | + * @api public | ||
56 | + */ | ||
57 | + | ||
58 | +defineMethod(Session.prototype, 'resetMaxAge', function resetMaxAge() { | ||
59 | + this.cookie.maxAge = this.cookie.originalMaxAge; | ||
60 | + return this; | ||
61 | +}); | ||
62 | + | ||
63 | +/** | ||
64 | + * Save the session data with optional callback `fn(err)`. | ||
65 | + * | ||
66 | + * @param {Function} fn | ||
67 | + * @return {Session} for chaining | ||
68 | + * @api public | ||
69 | + */ | ||
70 | + | ||
71 | +defineMethod(Session.prototype, 'save', function save(fn) { | ||
72 | + this.req.sessionStore.set(this.id, this, fn || function(){}); | ||
73 | + return this; | ||
74 | +}); | ||
75 | + | ||
76 | +/** | ||
77 | + * Re-loads the session data _without_ altering | ||
78 | + * the maxAge properties. Invokes the callback `fn(err)`, | ||
79 | + * after which time if no exception has occurred the | ||
80 | + * `req.session` property will be a new `Session` object, | ||
81 | + * although representing the same session. | ||
82 | + * | ||
83 | + * @param {Function} fn | ||
84 | + * @return {Session} for chaining | ||
85 | + * @api public | ||
86 | + */ | ||
87 | + | ||
88 | +defineMethod(Session.prototype, 'reload', function reload(fn) { | ||
89 | + var req = this.req | ||
90 | + var store = this.req.sessionStore | ||
91 | + | ||
92 | + store.get(this.id, function(err, sess){ | ||
93 | + if (err) return fn(err); | ||
94 | + if (!sess) return fn(new Error('failed to load session')); | ||
95 | + store.createSession(req, sess); | ||
96 | + fn(); | ||
97 | + }); | ||
98 | + return this; | ||
99 | +}); | ||
100 | + | ||
101 | +/** | ||
102 | + * Destroy `this` session. | ||
103 | + * | ||
104 | + * @param {Function} fn | ||
105 | + * @return {Session} for chaining | ||
106 | + * @api public | ||
107 | + */ | ||
108 | + | ||
109 | +defineMethod(Session.prototype, 'destroy', function destroy(fn) { | ||
110 | + delete this.req.session; | ||
111 | + this.req.sessionStore.destroy(this.id, fn); | ||
112 | + return this; | ||
113 | +}); | ||
114 | + | ||
115 | +/** | ||
116 | + * Regenerate this request's session. | ||
117 | + * | ||
118 | + * @param {Function} fn | ||
119 | + * @return {Session} for chaining | ||
120 | + * @api public | ||
121 | + */ | ||
122 | + | ||
123 | +defineMethod(Session.prototype, 'regenerate', function regenerate(fn) { | ||
124 | + this.req.sessionStore.regenerate(this.req, fn); | ||
125 | + return this; | ||
126 | +}); | ||
127 | + | ||
128 | +/** | ||
129 | + * Helper function for creating a method on a prototype. | ||
130 | + * | ||
131 | + * @param {Object} obj | ||
132 | + * @param {String} name | ||
133 | + * @param {Function} fn | ||
134 | + * @private | ||
135 | + */ | ||
136 | +function defineMethod(obj, name, fn) { | ||
137 | + Object.defineProperty(obj, name, { | ||
138 | + configurable: true, | ||
139 | + enumerable: false, | ||
140 | + value: fn, | ||
141 | + writable: true | ||
142 | + }); | ||
143 | +}; |
1 | +/*! | ||
2 | + * Connect - session - Store | ||
3 | + * Copyright(c) 2010 Sencha Inc. | ||
4 | + * Copyright(c) 2011 TJ Holowaychuk | ||
5 | + * MIT Licensed | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict'; | ||
9 | + | ||
10 | +/** | ||
11 | + * Module dependencies. | ||
12 | + * @private | ||
13 | + */ | ||
14 | + | ||
15 | +var Cookie = require('./cookie') | ||
16 | +var EventEmitter = require('events').EventEmitter | ||
17 | +var Session = require('./session') | ||
18 | +var util = require('util') | ||
19 | + | ||
20 | +/** | ||
21 | + * Module exports. | ||
22 | + * @public | ||
23 | + */ | ||
24 | + | ||
25 | +module.exports = Store | ||
26 | + | ||
27 | +/** | ||
28 | + * Abstract base class for session stores. | ||
29 | + * @public | ||
30 | + */ | ||
31 | + | ||
32 | +function Store () { | ||
33 | + EventEmitter.call(this) | ||
34 | +} | ||
35 | + | ||
36 | +/** | ||
37 | + * Inherit from EventEmitter. | ||
38 | + */ | ||
39 | + | ||
40 | +util.inherits(Store, EventEmitter) | ||
41 | + | ||
42 | +/** | ||
43 | + * Re-generate the given requests's session. | ||
44 | + * | ||
45 | + * @param {IncomingRequest} req | ||
46 | + * @return {Function} fn | ||
47 | + * @api public | ||
48 | + */ | ||
49 | + | ||
50 | +Store.prototype.regenerate = function(req, fn){ | ||
51 | + var self = this; | ||
52 | + this.destroy(req.sessionID, function(err){ | ||
53 | + self.generate(req); | ||
54 | + fn(err); | ||
55 | + }); | ||
56 | +}; | ||
57 | + | ||
58 | +/** | ||
59 | + * Load a `Session` instance via the given `sid` | ||
60 | + * and invoke the callback `fn(err, sess)`. | ||
61 | + * | ||
62 | + * @param {String} sid | ||
63 | + * @param {Function} fn | ||
64 | + * @api public | ||
65 | + */ | ||
66 | + | ||
67 | +Store.prototype.load = function(sid, fn){ | ||
68 | + var self = this; | ||
69 | + this.get(sid, function(err, sess){ | ||
70 | + if (err) return fn(err); | ||
71 | + if (!sess) return fn(); | ||
72 | + var req = { sessionID: sid, sessionStore: self }; | ||
73 | + fn(null, self.createSession(req, sess)) | ||
74 | + }); | ||
75 | +}; | ||
76 | + | ||
77 | +/** | ||
78 | + * Create session from JSON `sess` data. | ||
79 | + * | ||
80 | + * @param {IncomingRequest} req | ||
81 | + * @param {Object} sess | ||
82 | + * @return {Session} | ||
83 | + * @api private | ||
84 | + */ | ||
85 | + | ||
86 | +Store.prototype.createSession = function(req, sess){ | ||
87 | + var expires = sess.cookie.expires | ||
88 | + var originalMaxAge = sess.cookie.originalMaxAge | ||
89 | + | ||
90 | + sess.cookie = new Cookie(sess.cookie); | ||
91 | + | ||
92 | + if (typeof expires === 'string') { | ||
93 | + // convert expires to a Date object | ||
94 | + sess.cookie.expires = new Date(expires) | ||
95 | + } | ||
96 | + | ||
97 | + // keep originalMaxAge intact | ||
98 | + sess.cookie.originalMaxAge = originalMaxAge | ||
99 | + | ||
100 | + req.session = new Session(req, sess); | ||
101 | + return req.session; | ||
102 | +}; |
Mapmory/node_modules/on-headers/HISTORY.md
0 → 100644
1 | +1.0.2 / 2019-02-21 | ||
2 | +================== | ||
3 | + | ||
4 | + * Fix `res.writeHead` patch missing return value | ||
5 | + | ||
6 | +1.0.1 / 2015-09-29 | ||
7 | +================== | ||
8 | + | ||
9 | + * perf: enable strict mode | ||
10 | + | ||
11 | +1.0.0 / 2014-08-10 | ||
12 | +================== | ||
13 | + | ||
14 | + * Honor `res.statusCode` change in `listener` | ||
15 | + * Move to `jshttp` organization | ||
16 | + * Prevent `arguments`-related de-opt | ||
17 | + | ||
18 | +0.0.0 / 2014-05-13 | ||
19 | +================== | ||
20 | + | ||
21 | + * Initial implementation |
Mapmory/node_modules/on-headers/LICENSE
0 → 100644
1 | +(The MIT License) | ||
2 | + | ||
3 | +Copyright (c) 2014 Douglas Christopher Wilson | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining | ||
6 | +a copy of this software and associated documentation files (the | ||
7 | +'Software'), to deal in the Software without restriction, including | ||
8 | +without limitation the rights to use, copy, modify, merge, publish, | ||
9 | +distribute, sublicense, and/or sell copies of the Software, and to | ||
10 | +permit persons to whom the Software is furnished to do so, subject to | ||
11 | +the following conditions: | ||
12 | + | ||
13 | +The above copyright notice and this permission notice shall be | ||
14 | +included in all copies or substantial portions of the Software. | ||
15 | + | ||
16 | +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
17 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
18 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
19 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
20 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
21 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
22 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Mapmory/node_modules/on-headers/README.md
0 → 100644
1 | +# on-headers | ||
2 | + | ||
3 | +[![NPM Version][npm-version-image]][npm-url] | ||
4 | +[![NPM Downloads][npm-downloads-image]][npm-url] | ||
5 | +[![Node.js Version][node-version-image]][node-version-url] | ||
6 | +[![Build Status][travis-image]][travis-url] | ||
7 | +[![Test Coverage][coveralls-image]][coveralls-url] | ||
8 | + | ||
9 | +Execute a listener when a response is about to write headers. | ||
10 | + | ||
11 | +## Installation | ||
12 | + | ||
13 | +This is a [Node.js](https://nodejs.org/en/) module available through the | ||
14 | +[npm registry](https://www.npmjs.com/). Installation is done using the | ||
15 | +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | ||
16 | + | ||
17 | +```sh | ||
18 | +$ npm install on-headers | ||
19 | +``` | ||
20 | + | ||
21 | +## API | ||
22 | + | ||
23 | +<!-- eslint-disable no-unused-vars --> | ||
24 | + | ||
25 | +```js | ||
26 | +var onHeaders = require('on-headers') | ||
27 | +``` | ||
28 | + | ||
29 | +### onHeaders(res, listener) | ||
30 | + | ||
31 | +This will add the listener `listener` to fire when headers are emitted for `res`. | ||
32 | +The listener is passed the `response` object as it's context (`this`). Headers are | ||
33 | +considered to be emitted only once, right before they are sent to the client. | ||
34 | + | ||
35 | +When this is called multiple times on the same `res`, the `listener`s are fired | ||
36 | +in the reverse order they were added. | ||
37 | + | ||
38 | +## Examples | ||
39 | + | ||
40 | +```js | ||
41 | +var http = require('http') | ||
42 | +var onHeaders = require('on-headers') | ||
43 | + | ||
44 | +http | ||
45 | + .createServer(onRequest) | ||
46 | + .listen(3000) | ||
47 | + | ||
48 | +function addPoweredBy () { | ||
49 | + // set if not set by end of request | ||
50 | + if (!this.getHeader('X-Powered-By')) { | ||
51 | + this.setHeader('X-Powered-By', 'Node.js') | ||
52 | + } | ||
53 | +} | ||
54 | + | ||
55 | +function onRequest (req, res) { | ||
56 | + onHeaders(res, addPoweredBy) | ||
57 | + | ||
58 | + res.setHeader('Content-Type', 'text/plain') | ||
59 | + res.end('hello!') | ||
60 | +} | ||
61 | +``` | ||
62 | + | ||
63 | +## Testing | ||
64 | + | ||
65 | +```sh | ||
66 | +$ npm test | ||
67 | +``` | ||
68 | + | ||
69 | +## License | ||
70 | + | ||
71 | +[MIT](LICENSE) | ||
72 | + | ||
73 | +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-headers/master | ||
74 | +[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master | ||
75 | +[node-version-image]: https://badgen.net/npm/node/on-headers | ||
76 | +[node-version-url]: https://nodejs.org/en/download | ||
77 | +[npm-downloads-image]: https://badgen.net/npm/dm/on-headers | ||
78 | +[npm-url]: https://npmjs.org/package/on-headers | ||
79 | +[npm-version-image]: https://badgen.net/npm/v/on-headers | ||
80 | +[travis-image]: https://badgen.net/travis/jshttp/on-headers/master | ||
81 | +[travis-url]: https://travis-ci.org/jshttp/on-headers |
Mapmory/node_modules/on-headers/index.js
0 → 100644
1 | +/*! | ||
2 | + * on-headers | ||
3 | + * Copyright(c) 2014 Douglas Christopher Wilson | ||
4 | + * MIT Licensed | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict' | ||
8 | + | ||
9 | +/** | ||
10 | + * Module exports. | ||
11 | + * @public | ||
12 | + */ | ||
13 | + | ||
14 | +module.exports = onHeaders | ||
15 | + | ||
16 | +/** | ||
17 | + * Create a replacement writeHead method. | ||
18 | + * | ||
19 | + * @param {function} prevWriteHead | ||
20 | + * @param {function} listener | ||
21 | + * @private | ||
22 | + */ | ||
23 | + | ||
24 | +function createWriteHead (prevWriteHead, listener) { | ||
25 | + var fired = false | ||
26 | + | ||
27 | + // return function with core name and argument list | ||
28 | + return function writeHead (statusCode) { | ||
29 | + // set headers from arguments | ||
30 | + var args = setWriteHeadHeaders.apply(this, arguments) | ||
31 | + | ||
32 | + // fire listener | ||
33 | + if (!fired) { | ||
34 | + fired = true | ||
35 | + listener.call(this) | ||
36 | + | ||
37 | + // pass-along an updated status code | ||
38 | + if (typeof args[0] === 'number' && this.statusCode !== args[0]) { | ||
39 | + args[0] = this.statusCode | ||
40 | + args.length = 1 | ||
41 | + } | ||
42 | + } | ||
43 | + | ||
44 | + return prevWriteHead.apply(this, args) | ||
45 | + } | ||
46 | +} | ||
47 | + | ||
48 | +/** | ||
49 | + * Execute a listener when a response is about to write headers. | ||
50 | + * | ||
51 | + * @param {object} res | ||
52 | + * @return {function} listener | ||
53 | + * @public | ||
54 | + */ | ||
55 | + | ||
56 | +function onHeaders (res, listener) { | ||
57 | + if (!res) { | ||
58 | + throw new TypeError('argument res is required') | ||
59 | + } | ||
60 | + | ||
61 | + if (typeof listener !== 'function') { | ||
62 | + throw new TypeError('argument listener must be a function') | ||
63 | + } | ||
64 | + | ||
65 | + res.writeHead = createWriteHead(res.writeHead, listener) | ||
66 | +} | ||
67 | + | ||
68 | +/** | ||
69 | + * Set headers contained in array on the response object. | ||
70 | + * | ||
71 | + * @param {object} res | ||
72 | + * @param {array} headers | ||
73 | + * @private | ||
74 | + */ | ||
75 | + | ||
76 | +function setHeadersFromArray (res, headers) { | ||
77 | + for (var i = 0; i < headers.length; i++) { | ||
78 | + res.setHeader(headers[i][0], headers[i][1]) | ||
79 | + } | ||
80 | +} | ||
81 | + | ||
82 | +/** | ||
83 | + * Set headers contained in object on the response object. | ||
84 | + * | ||
85 | + * @param {object} res | ||
86 | + * @param {object} headers | ||
87 | + * @private | ||
88 | + */ | ||
89 | + | ||
90 | +function setHeadersFromObject (res, headers) { | ||
91 | + var keys = Object.keys(headers) | ||
92 | + for (var i = 0; i < keys.length; i++) { | ||
93 | + var k = keys[i] | ||
94 | + if (k) res.setHeader(k, headers[k]) | ||
95 | + } | ||
96 | +} | ||
97 | + | ||
98 | +/** | ||
99 | + * Set headers and other properties on the response object. | ||
100 | + * | ||
101 | + * @param {number} statusCode | ||
102 | + * @private | ||
103 | + */ | ||
104 | + | ||
105 | +function setWriteHeadHeaders (statusCode) { | ||
106 | + var length = arguments.length | ||
107 | + var headerIndex = length > 1 && typeof arguments[1] === 'string' | ||
108 | + ? 2 | ||
109 | + : 1 | ||
110 | + | ||
111 | + var headers = length >= headerIndex + 1 | ||
112 | + ? arguments[headerIndex] | ||
113 | + : undefined | ||
114 | + | ||
115 | + this.statusCode = statusCode | ||
116 | + | ||
117 | + if (Array.isArray(headers)) { | ||
118 | + // handle array case | ||
119 | + setHeadersFromArray(this, headers) | ||
120 | + } else if (headers) { | ||
121 | + // handle object case | ||
122 | + setHeadersFromObject(this, headers) | ||
123 | + } | ||
124 | + | ||
125 | + // copy leading arguments | ||
126 | + var args = new Array(Math.min(length, headerIndex)) | ||
127 | + for (var i = 0; i < args.length; i++) { | ||
128 | + args[i] = arguments[i] | ||
129 | + } | ||
130 | + | ||
131 | + return args | ||
132 | +} |
Mapmory/node_modules/on-headers/package.json
0 → 100644
1 | +{ | ||
2 | + "_from": "on-headers@~1.0.2", | ||
3 | + "_id": "on-headers@1.0.2", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", | ||
6 | + "_location": "/on-headers", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "on-headers@~1.0.2", | ||
12 | + "name": "on-headers", | ||
13 | + "escapedName": "on-headers", | ||
14 | + "rawSpec": "~1.0.2", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "~1.0.2" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/express-session" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", | ||
22 | + "_shasum": "772b0ae6aaa525c399e489adfad90c403eb3c28f", | ||
23 | + "_spec": "on-headers@~1.0.2", | ||
24 | + "_where": "C:\\Users\\fheld\\Desktop\\khuhub\\mapmory\\Mapmory\\node_modules\\express-session", | ||
25 | + "author": { | ||
26 | + "name": "Douglas Christopher Wilson", | ||
27 | + "email": "doug@somethingdoug.com" | ||
28 | + }, | ||
29 | + "bugs": { | ||
30 | + "url": "https://github.com/jshttp/on-headers/issues" | ||
31 | + }, | ||
32 | + "bundleDependencies": false, | ||
33 | + "deprecated": false, | ||
34 | + "description": "Execute a listener when a response is about to write headers", | ||
35 | + "devDependencies": { | ||
36 | + "eslint": "5.14.1", | ||
37 | + "eslint-config-standard": "12.0.0", | ||
38 | + "eslint-plugin-import": "2.16.0", | ||
39 | + "eslint-plugin-markdown": "1.0.0", | ||
40 | + "eslint-plugin-node": "8.0.1", | ||
41 | + "eslint-plugin-promise": "4.0.1", | ||
42 | + "eslint-plugin-standard": "4.0.0", | ||
43 | + "istanbul": "0.4.5", | ||
44 | + "mocha": "6.0.1", | ||
45 | + "supertest": "3.4.2" | ||
46 | + }, | ||
47 | + "engines": { | ||
48 | + "node": ">= 0.8" | ||
49 | + }, | ||
50 | + "files": [ | ||
51 | + "LICENSE", | ||
52 | + "HISTORY.md", | ||
53 | + "README.md", | ||
54 | + "index.js" | ||
55 | + ], | ||
56 | + "homepage": "https://github.com/jshttp/on-headers#readme", | ||
57 | + "keywords": [ | ||
58 | + "event", | ||
59 | + "headers", | ||
60 | + "http", | ||
61 | + "onheaders" | ||
62 | + ], | ||
63 | + "license": "MIT", | ||
64 | + "name": "on-headers", | ||
65 | + "repository": { | ||
66 | + "type": "git", | ||
67 | + "url": "git+https://github.com/jshttp/on-headers.git" | ||
68 | + }, | ||
69 | + "scripts": { | ||
70 | + "lint": "eslint --plugin markdown --ext js,md .", | ||
71 | + "test": "mocha --reporter spec --bail --check-leaks test/", | ||
72 | + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", | ||
73 | + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", | ||
74 | + "version": "node scripts/version-history.js && git add HISTORY.md" | ||
75 | + }, | ||
76 | + "version": "1.0.2" | ||
77 | +} |
Mapmory/node_modules/random-bytes/HISTORY.md
0 → 100644
Mapmory/node_modules/random-bytes/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com> | ||
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 | ||
13 | +all 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 | ||
21 | +THE SOFTWARE. |
Mapmory/node_modules/random-bytes/README.md
0 → 100644
1 | +# random-bytes | ||
2 | + | ||
3 | +[![NPM Version][npm-image]][npm-url] | ||
4 | +[![NPM Downloads][downloads-image]][downloads-url] | ||
5 | +[![Node.js Version][node-version-image]][node-version-url] | ||
6 | +[![Build Status][travis-image]][travis-url] | ||
7 | +[![Test Coverage][coveralls-image]][coveralls-url] | ||
8 | + | ||
9 | +Generate strong pseudo-random bytes. | ||
10 | + | ||
11 | +This module is a simple wrapper around the Node.js core `crypto.randomBytes` API, | ||
12 | +with the following additions: | ||
13 | + | ||
14 | + * A `Promise` interface for environments with promises. | ||
15 | + * For Node.js versions that do not wait for the PRNG to be seeded, this module | ||
16 | + will wait a bit. | ||
17 | + | ||
18 | +## Installation | ||
19 | + | ||
20 | +```sh | ||
21 | +$ npm install random-bytes | ||
22 | +``` | ||
23 | + | ||
24 | +## API | ||
25 | + | ||
26 | +```js | ||
27 | +var randomBytes = require('random-bytes') | ||
28 | +``` | ||
29 | + | ||
30 | +### randomBytes(size, callback) | ||
31 | + | ||
32 | +Generates strong pseudo-random bytes. The `size` argument is a number indicating | ||
33 | +the number of bytes to generate. | ||
34 | + | ||
35 | +```js | ||
36 | +randomBytes(12, function (error, bytes) { | ||
37 | + if (error) throw error | ||
38 | + // do something with the bytes | ||
39 | +}) | ||
40 | +``` | ||
41 | + | ||
42 | +### randomBytes(size) | ||
43 | + | ||
44 | +Generates strong pseudo-random bytes and return a `Promise`. The `size` argument is | ||
45 | +a number indicating the number of bytes to generate. | ||
46 | + | ||
47 | +**Note**: To use promises in Node.js _prior to 0.12_, promises must be | ||
48 | +"polyfilled" using `global.Promise = require('bluebird')`. | ||
49 | + | ||
50 | +```js | ||
51 | +randomBytes(18).then(function (string) { | ||
52 | + // do something with the string | ||
53 | +}) | ||
54 | +``` | ||
55 | + | ||
56 | +### randomBytes.sync(size) | ||
57 | + | ||
58 | +A synchronous version of above. | ||
59 | + | ||
60 | +```js | ||
61 | +var bytes = randomBytes.sync(18) | ||
62 | +``` | ||
63 | + | ||
64 | +## License | ||
65 | + | ||
66 | +[MIT](LICENSE) | ||
67 | + | ||
68 | +[npm-image]: https://img.shields.io/npm/v/random-bytes.svg | ||
69 | +[npm-url]: https://npmjs.org/package/random-bytes | ||
70 | +[node-version-image]: https://img.shields.io/node/v/random-bytes.svg | ||
71 | +[node-version-url]: http://nodejs.org/download/ | ||
72 | +[travis-image]: https://img.shields.io/travis/crypto-utils/random-bytes/master.svg | ||
73 | +[travis-url]: https://travis-ci.org/crypto-utils/random-bytes | ||
74 | +[coveralls-image]: https://img.shields.io/coveralls/crypto-utils/random-bytes/master.svg | ||
75 | +[coveralls-url]: https://coveralls.io/r/crypto-utils/random-bytes?branch=master | ||
76 | +[downloads-image]: https://img.shields.io/npm/dm/random-bytes.svg | ||
77 | +[downloads-url]: https://npmjs.org/package/random-bytes |
Mapmory/node_modules/random-bytes/index.js
0 → 100644
1 | +/*! | ||
2 | + * random-bytes | ||
3 | + * Copyright(c) 2016 Douglas Christopher Wilson | ||
4 | + * MIT Licensed | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict' | ||
8 | + | ||
9 | +/** | ||
10 | + * Module dependencies. | ||
11 | + * @private | ||
12 | + */ | ||
13 | + | ||
14 | +var crypto = require('crypto') | ||
15 | + | ||
16 | +/** | ||
17 | + * Module variables. | ||
18 | + * @private | ||
19 | + */ | ||
20 | + | ||
21 | +var generateAttempts = crypto.randomBytes === crypto.pseudoRandomBytes ? 1 : 3 | ||
22 | + | ||
23 | +/** | ||
24 | + * Module exports. | ||
25 | + * @public | ||
26 | + */ | ||
27 | + | ||
28 | +module.exports = randomBytes | ||
29 | +module.exports.sync = randomBytesSync | ||
30 | + | ||
31 | +/** | ||
32 | + * Generates strong pseudo-random bytes. | ||
33 | + * | ||
34 | + * @param {number} size | ||
35 | + * @param {function} [callback] | ||
36 | + * @return {Promise} | ||
37 | + * @public | ||
38 | + */ | ||
39 | + | ||
40 | +function randomBytes(size, callback) { | ||
41 | + // validate callback is a function, if provided | ||
42 | + if (callback !== undefined && typeof callback !== 'function') { | ||
43 | + throw new TypeError('argument callback must be a function') | ||
44 | + } | ||
45 | + | ||
46 | + // require the callback without promises | ||
47 | + if (!callback && !global.Promise) { | ||
48 | + throw new TypeError('argument callback is required') | ||
49 | + } | ||
50 | + | ||
51 | + if (callback) { | ||
52 | + // classic callback style | ||
53 | + return generateRandomBytes(size, generateAttempts, callback) | ||
54 | + } | ||
55 | + | ||
56 | + return new Promise(function executor(resolve, reject) { | ||
57 | + generateRandomBytes(size, generateAttempts, function onRandomBytes(err, str) { | ||
58 | + if (err) return reject(err) | ||
59 | + resolve(str) | ||
60 | + }) | ||
61 | + }) | ||
62 | +} | ||
63 | + | ||
64 | +/** | ||
65 | + * Generates strong pseudo-random bytes sync. | ||
66 | + * | ||
67 | + * @param {number} size | ||
68 | + * @return {Buffer} | ||
69 | + * @public | ||
70 | + */ | ||
71 | + | ||
72 | +function randomBytesSync(size) { | ||
73 | + var err = null | ||
74 | + | ||
75 | + for (var i = 0; i < generateAttempts; i++) { | ||
76 | + try { | ||
77 | + return crypto.randomBytes(size) | ||
78 | + } catch (e) { | ||
79 | + err = e | ||
80 | + } | ||
81 | + } | ||
82 | + | ||
83 | + throw err | ||
84 | +} | ||
85 | + | ||
86 | +/** | ||
87 | + * Generates strong pseudo-random bytes. | ||
88 | + * | ||
89 | + * @param {number} size | ||
90 | + * @param {number} attempts | ||
91 | + * @param {function} callback | ||
92 | + * @private | ||
93 | + */ | ||
94 | + | ||
95 | +function generateRandomBytes(size, attempts, callback) { | ||
96 | + crypto.randomBytes(size, function onRandomBytes(err, buf) { | ||
97 | + if (!err) return callback(null, buf) | ||
98 | + if (!--attempts) return callback(err) | ||
99 | + setTimeout(generateRandomBytes.bind(null, size, attempts, callback), 10) | ||
100 | + }) | ||
101 | +} |
1 | +{ | ||
2 | + "_from": "random-bytes@~1.0.0", | ||
3 | + "_id": "random-bytes@1.0.0", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=", | ||
6 | + "_location": "/random-bytes", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "random-bytes@~1.0.0", | ||
12 | + "name": "random-bytes", | ||
13 | + "escapedName": "random-bytes", | ||
14 | + "rawSpec": "~1.0.0", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "~1.0.0" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/uid-safe" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", | ||
22 | + "_shasum": "4f68a1dc0ae58bd3fb95848c30324db75d64360b", | ||
23 | + "_spec": "random-bytes@~1.0.0", | ||
24 | + "_where": "C:\\Users\\fheld\\Desktop\\khuhub\\mapmory\\Mapmory\\node_modules\\uid-safe", | ||
25 | + "bugs": { | ||
26 | + "url": "https://github.com/crypto-utils/random-bytes/issues" | ||
27 | + }, | ||
28 | + "bundleDependencies": false, | ||
29 | + "contributors": [ | ||
30 | + { | ||
31 | + "name": "Douglas Christopher Wilson", | ||
32 | + "email": "doug@somethingdoug.com" | ||
33 | + } | ||
34 | + ], | ||
35 | + "deprecated": false, | ||
36 | + "description": "URL and cookie safe UIDs", | ||
37 | + "devDependencies": { | ||
38 | + "bluebird": "3.1.1", | ||
39 | + "istanbul": "0.4.2", | ||
40 | + "mocha": "2.3.4", | ||
41 | + "proxyquire": "1.2.0" | ||
42 | + }, | ||
43 | + "engines": { | ||
44 | + "node": ">= 0.8" | ||
45 | + }, | ||
46 | + "files": [ | ||
47 | + "LICENSE", | ||
48 | + "HISTORY.md", | ||
49 | + "README.md", | ||
50 | + "index.js" | ||
51 | + ], | ||
52 | + "homepage": "https://github.com/crypto-utils/random-bytes#readme", | ||
53 | + "keywords": [ | ||
54 | + "bytes", | ||
55 | + "generator", | ||
56 | + "random", | ||
57 | + "safe" | ||
58 | + ], | ||
59 | + "license": "MIT", | ||
60 | + "name": "random-bytes", | ||
61 | + "repository": { | ||
62 | + "type": "git", | ||
63 | + "url": "git+https://github.com/crypto-utils/random-bytes.git" | ||
64 | + }, | ||
65 | + "scripts": { | ||
66 | + "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/", | ||
67 | + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --trace-deprecation --reporter dot --check-leaks test/", | ||
68 | + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --trace-deprecation --reporter spec --check-leaks test/" | ||
69 | + }, | ||
70 | + "version": "1.0.0" | ||
71 | +} |
Mapmory/node_modules/uid-safe/HISTORY.md
0 → 100644
1 | +2.1.5 / 2017-08-02 | ||
2 | +================== | ||
3 | + | ||
4 | + * perf: remove only trailing `=` | ||
5 | + | ||
6 | +2.1.4 / 2017-03-02 | ||
7 | +================== | ||
8 | + | ||
9 | + * Remove `base64-url` dependency | ||
10 | + | ||
11 | +2.1.3 / 2016-10-30 | ||
12 | +================== | ||
13 | + | ||
14 | + * deps: base64-url@1.3.3 | ||
15 | + | ||
16 | +2.1.2 / 2016-08-15 | ||
17 | +================== | ||
18 | + | ||
19 | + * deps: base64-url@1.3.2 | ||
20 | + | ||
21 | +2.1.1 / 2016-05-04 | ||
22 | +================== | ||
23 | + | ||
24 | + * deps: base64-url@1.2.2 | ||
25 | + | ||
26 | +2.1.0 / 2016-01-17 | ||
27 | +================== | ||
28 | + | ||
29 | + * Use `random-bytes` for byte source | ||
30 | + | ||
31 | +2.0.0 / 2015-05-08 | ||
32 | +================== | ||
33 | + | ||
34 | + * Use global `Promise` when returning a promise | ||
35 | + | ||
36 | +1.1.0 / 2015-02-01 | ||
37 | +================== | ||
38 | + | ||
39 | + * Use `crypto.randomBytes`, if available | ||
40 | + * deps: base64-url@1.2.1 | ||
41 | + | ||
42 | +1.0.3 / 2015-01-31 | ||
43 | +================== | ||
44 | + | ||
45 | + * Fix error branch that would throw | ||
46 | + * deps: base64-url@1.2.0 | ||
47 | + | ||
48 | +1.0.2 / 2015-01-08 | ||
49 | +================== | ||
50 | + | ||
51 | + * Remove dependency on `mz` | ||
52 | + | ||
53 | +1.0.1 / 2014-06-18 | ||
54 | +================== | ||
55 | + | ||
56 | + * Remove direct `bluebird` dependency | ||
57 | + | ||
58 | +1.0.0 / 2014-06-18 | ||
59 | +================== | ||
60 | + | ||
61 | + * Initial release |
Mapmory/node_modules/uid-safe/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com> | ||
4 | +Copyright (c) 2015-2017 Douglas Christopher Wilson <doug@somethingdoug.com> | ||
5 | + | ||
6 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | +of this software and associated documentation files (the "Software"), to deal | ||
8 | +in the Software without restriction, including without limitation the rights | ||
9 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
10 | +copies of the Software, and to permit persons to whom the Software is | ||
11 | +furnished to do so, subject to the following conditions: | ||
12 | + | ||
13 | +The above copyright notice and this permission notice shall be included in | ||
14 | +all copies or substantial portions of the Software. | ||
15 | + | ||
16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
22 | +THE SOFTWARE. |
Mapmory/node_modules/uid-safe/README.md
0 → 100644
1 | +# uid-safe | ||
2 | + | ||
3 | +[![NPM Version][npm-image]][npm-url] | ||
4 | +[![NPM Downloads][downloads-image]][downloads-url] | ||
5 | +[![Node.js Version][node-version-image]][node-version-url] | ||
6 | +[![Build Status][travis-image]][travis-url] | ||
7 | +[![Test Coverage][coveralls-image]][coveralls-url] | ||
8 | + | ||
9 | +URL and cookie safe UIDs | ||
10 | + | ||
11 | +Create cryptographically secure UIDs safe for both cookie and URL usage. | ||
12 | +This is in contrast to modules such as [rand-token](https://www.npmjs.com/package/rand-token) | ||
13 | +and [uid2](https://www.npmjs.com/package/uid2) whose UIDs are actually skewed | ||
14 | +due to the use of `%` and unnecessarily truncate the UID. | ||
15 | +Use this if you could still use UIDs with `-` and `_` in them. | ||
16 | + | ||
17 | +## Installation | ||
18 | + | ||
19 | +```sh | ||
20 | +$ npm install uid-safe | ||
21 | +``` | ||
22 | + | ||
23 | +## API | ||
24 | + | ||
25 | +```js | ||
26 | +var uid = require('uid-safe') | ||
27 | +``` | ||
28 | + | ||
29 | +### uid(byteLength, callback) | ||
30 | + | ||
31 | +Asynchronously create a UID with a specific byte length. Because `base64` | ||
32 | +encoding is used underneath, this is not the string length. For example, | ||
33 | +to create a UID of length 24, you want a byte length of 18. | ||
34 | + | ||
35 | +```js | ||
36 | +uid(18, function (err, string) { | ||
37 | + if (err) throw err | ||
38 | + // do something with the string | ||
39 | +}) | ||
40 | +``` | ||
41 | + | ||
42 | +### uid(byteLength) | ||
43 | + | ||
44 | +Asynchronously create a UID with a specific byte length and return a | ||
45 | +`Promise`. | ||
46 | + | ||
47 | +**Note**: To use promises in Node.js _prior to 0.12_, promises must be | ||
48 | +"polyfilled" using `global.Promise = require('bluebird')`. | ||
49 | + | ||
50 | +```js | ||
51 | +uid(18).then(function (string) { | ||
52 | + // do something with the string | ||
53 | +}) | ||
54 | +``` | ||
55 | + | ||
56 | +### uid.sync(byteLength) | ||
57 | + | ||
58 | +A synchronous version of above. | ||
59 | + | ||
60 | +```js | ||
61 | +var string = uid.sync(18) | ||
62 | +``` | ||
63 | + | ||
64 | +## License | ||
65 | + | ||
66 | +[MIT](LICENSE) | ||
67 | + | ||
68 | +[npm-image]: https://img.shields.io/npm/v/uid-safe.svg | ||
69 | +[npm-url]: https://npmjs.org/package/uid-safe | ||
70 | +[node-version-image]: https://img.shields.io/node/v/uid-safe.svg | ||
71 | +[node-version-url]: https://nodejs.org/en/download/ | ||
72 | +[travis-image]: https://img.shields.io/travis/crypto-utils/uid-safe/master.svg | ||
73 | +[travis-url]: https://travis-ci.org/crypto-utils/uid-safe | ||
74 | +[coveralls-image]: https://img.shields.io/coveralls/crypto-utils/uid-safe/master.svg | ||
75 | +[coveralls-url]: https://coveralls.io/r/crypto-utils/uid-safe?branch=master | ||
76 | +[downloads-image]: https://img.shields.io/npm/dm/uid-safe.svg | ||
77 | +[downloads-url]: https://npmjs.org/package/uid-safe |
Mapmory/node_modules/uid-safe/index.js
0 → 100644
1 | +/*! | ||
2 | + * uid-safe | ||
3 | + * Copyright(c) 2014 Jonathan Ong | ||
4 | + * Copyright(c) 2015-2017 Douglas Christopher Wilson | ||
5 | + * MIT Licensed | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict' | ||
9 | + | ||
10 | +/** | ||
11 | + * Module dependencies. | ||
12 | + * @private | ||
13 | + */ | ||
14 | + | ||
15 | +var randomBytes = require('random-bytes') | ||
16 | + | ||
17 | +/** | ||
18 | + * Module variables. | ||
19 | + * @private | ||
20 | + */ | ||
21 | + | ||
22 | +var EQUAL_END_REGEXP = /=+$/ | ||
23 | +var PLUS_GLOBAL_REGEXP = /\+/g | ||
24 | +var SLASH_GLOBAL_REGEXP = /\//g | ||
25 | + | ||
26 | +/** | ||
27 | + * Module exports. | ||
28 | + * @public | ||
29 | + */ | ||
30 | + | ||
31 | +module.exports = uid | ||
32 | +module.exports.sync = uidSync | ||
33 | + | ||
34 | +/** | ||
35 | + * Create a unique ID. | ||
36 | + * | ||
37 | + * @param {number} length | ||
38 | + * @param {function} [callback] | ||
39 | + * @return {Promise} | ||
40 | + * @public | ||
41 | + */ | ||
42 | + | ||
43 | +function uid (length, callback) { | ||
44 | + // validate callback is a function, if provided | ||
45 | + if (callback !== undefined && typeof callback !== 'function') { | ||
46 | + throw new TypeError('argument callback must be a function') | ||
47 | + } | ||
48 | + | ||
49 | + // require the callback without promises | ||
50 | + if (!callback && !global.Promise) { | ||
51 | + throw new TypeError('argument callback is required') | ||
52 | + } | ||
53 | + | ||
54 | + if (callback) { | ||
55 | + // classic callback style | ||
56 | + return generateUid(length, callback) | ||
57 | + } | ||
58 | + | ||
59 | + return new Promise(function executor (resolve, reject) { | ||
60 | + generateUid(length, function onUid (err, str) { | ||
61 | + if (err) return reject(err) | ||
62 | + resolve(str) | ||
63 | + }) | ||
64 | + }) | ||
65 | +} | ||
66 | + | ||
67 | +/** | ||
68 | + * Create a unique ID sync. | ||
69 | + * | ||
70 | + * @param {number} length | ||
71 | + * @return {string} | ||
72 | + * @public | ||
73 | + */ | ||
74 | + | ||
75 | +function uidSync (length) { | ||
76 | + return toString(randomBytes.sync(length)) | ||
77 | +} | ||
78 | + | ||
79 | +/** | ||
80 | + * Generate a unique ID string. | ||
81 | + * | ||
82 | + * @param {number} length | ||
83 | + * @param {function} callback | ||
84 | + * @private | ||
85 | + */ | ||
86 | + | ||
87 | +function generateUid (length, callback) { | ||
88 | + randomBytes(length, function (err, buf) { | ||
89 | + if (err) return callback(err) | ||
90 | + callback(null, toString(buf)) | ||
91 | + }) | ||
92 | +} | ||
93 | + | ||
94 | +/** | ||
95 | + * Change a Buffer into a string. | ||
96 | + * | ||
97 | + * @param {Buffer} buf | ||
98 | + * @return {string} | ||
99 | + * @private | ||
100 | + */ | ||
101 | + | ||
102 | +function toString (buf) { | ||
103 | + return buf.toString('base64') | ||
104 | + .replace(EQUAL_END_REGEXP, '') | ||
105 | + .replace(PLUS_GLOBAL_REGEXP, '-') | ||
106 | + .replace(SLASH_GLOBAL_REGEXP, '_') | ||
107 | +} |
Mapmory/node_modules/uid-safe/package.json
0 → 100644
1 | +{ | ||
2 | + "_from": "uid-safe@~2.1.5", | ||
3 | + "_id": "uid-safe@2.1.5", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", | ||
6 | + "_location": "/uid-safe", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "uid-safe@~2.1.5", | ||
12 | + "name": "uid-safe", | ||
13 | + "escapedName": "uid-safe", | ||
14 | + "rawSpec": "~2.1.5", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "~2.1.5" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/express-session" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", | ||
22 | + "_shasum": "2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a", | ||
23 | + "_spec": "uid-safe@~2.1.5", | ||
24 | + "_where": "C:\\Users\\fheld\\Desktop\\khuhub\\mapmory\\Mapmory\\node_modules\\express-session", | ||
25 | + "bugs": { | ||
26 | + "url": "https://github.com/crypto-utils/uid-safe/issues" | ||
27 | + }, | ||
28 | + "bundleDependencies": false, | ||
29 | + "contributors": [ | ||
30 | + { | ||
31 | + "name": "Douglas Christopher Wilson", | ||
32 | + "email": "doug@somethingdoug.com" | ||
33 | + }, | ||
34 | + { | ||
35 | + "name": "Jonathan Ong", | ||
36 | + "email": "me@jongleberry.com", | ||
37 | + "url": "http://jongleberry.com" | ||
38 | + } | ||
39 | + ], | ||
40 | + "dependencies": { | ||
41 | + "random-bytes": "~1.0.0" | ||
42 | + }, | ||
43 | + "deprecated": false, | ||
44 | + "description": "URL and cookie safe UIDs", | ||
45 | + "devDependencies": { | ||
46 | + "bluebird": "3.5.0", | ||
47 | + "eslint": "3.19.0", | ||
48 | + "eslint-config-standard": "10.2.1", | ||
49 | + "eslint-plugin-import": "2.7.0", | ||
50 | + "eslint-plugin-node": "5.1.1", | ||
51 | + "eslint-plugin-promise": "3.5.0", | ||
52 | + "eslint-plugin-standard": "3.0.1", | ||
53 | + "istanbul": "0.4.5", | ||
54 | + "mocha": "2.5.3" | ||
55 | + }, | ||
56 | + "engines": { | ||
57 | + "node": ">= 0.8" | ||
58 | + }, | ||
59 | + "files": [ | ||
60 | + "LICENSE", | ||
61 | + "HISTORY.md", | ||
62 | + "README.md", | ||
63 | + "index.js" | ||
64 | + ], | ||
65 | + "homepage": "https://github.com/crypto-utils/uid-safe#readme", | ||
66 | + "keywords": [ | ||
67 | + "random", | ||
68 | + "generator", | ||
69 | + "uid", | ||
70 | + "safe" | ||
71 | + ], | ||
72 | + "license": "MIT", | ||
73 | + "name": "uid-safe", | ||
74 | + "repository": { | ||
75 | + "type": "git", | ||
76 | + "url": "git+https://github.com/crypto-utils/uid-safe.git" | ||
77 | + }, | ||
78 | + "scripts": { | ||
79 | + "lint": "eslint .", | ||
80 | + "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/", | ||
81 | + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --trace-deprecation --reporter dot --check-leaks test/", | ||
82 | + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --trace-deprecation --reporter spec --check-leaks test/" | ||
83 | + }, | ||
84 | + "version": "2.1.5" | ||
85 | +} |
... | @@ -148,6 +148,33 @@ | ... | @@ -148,6 +148,33 @@ |
148 | "vary": "~1.1.2" | 148 | "vary": "~1.1.2" |
149 | } | 149 | } |
150 | }, | 150 | }, |
151 | + "express-session": { | ||
152 | + "version": "1.17.1", | ||
153 | + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.1.tgz", | ||
154 | + "integrity": "sha512-UbHwgqjxQZJiWRTMyhvWGvjBQduGCSBDhhZXYenziMFjxst5rMV+aJZ6hKPHZnPyHGsrqRICxtX8jtEbm/z36Q==", | ||
155 | + "requires": { | ||
156 | + "cookie": "0.4.0", | ||
157 | + "cookie-signature": "1.0.6", | ||
158 | + "debug": "2.6.9", | ||
159 | + "depd": "~2.0.0", | ||
160 | + "on-headers": "~1.0.2", | ||
161 | + "parseurl": "~1.3.3", | ||
162 | + "safe-buffer": "5.2.0", | ||
163 | + "uid-safe": "~2.1.5" | ||
164 | + }, | ||
165 | + "dependencies": { | ||
166 | + "depd": { | ||
167 | + "version": "2.0.0", | ||
168 | + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", | ||
169 | + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" | ||
170 | + }, | ||
171 | + "safe-buffer": { | ||
172 | + "version": "5.2.0", | ||
173 | + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", | ||
174 | + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" | ||
175 | + } | ||
176 | + } | ||
177 | + }, | ||
151 | "finalhandler": { | 178 | "finalhandler": { |
152 | "version": "1.1.2", | 179 | "version": "1.1.2", |
153 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", | 180 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", |
... | @@ -269,6 +296,11 @@ | ... | @@ -269,6 +296,11 @@ |
269 | "ee-first": "1.1.1" | 296 | "ee-first": "1.1.1" |
270 | } | 297 | } |
271 | }, | 298 | }, |
299 | + "on-headers": { | ||
300 | + "version": "1.0.2", | ||
301 | + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", | ||
302 | + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" | ||
303 | + }, | ||
272 | "parseurl": { | 304 | "parseurl": { |
273 | "version": "1.3.3", | 305 | "version": "1.3.3", |
274 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", | 306 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", |
... | @@ -298,6 +330,11 @@ | ... | @@ -298,6 +330,11 @@ |
298 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", | 330 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", |
299 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" | 331 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" |
300 | }, | 332 | }, |
333 | + "random-bytes": { | ||
334 | + "version": "1.0.0", | ||
335 | + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", | ||
336 | + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=" | ||
337 | + }, | ||
301 | "range-parser": { | 338 | "range-parser": { |
302 | "version": "1.2.1", | 339 | "version": "1.2.1", |
303 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", | 340 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", |
... | @@ -413,6 +450,14 @@ | ... | @@ -413,6 +450,14 @@ |
413 | "mime-types": "~2.1.24" | 450 | "mime-types": "~2.1.24" |
414 | } | 451 | } |
415 | }, | 452 | }, |
453 | + "uid-safe": { | ||
454 | + "version": "2.1.5", | ||
455 | + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", | ||
456 | + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", | ||
457 | + "requires": { | ||
458 | + "random-bytes": "~1.0.0" | ||
459 | + } | ||
460 | + }, | ||
416 | "unpipe": { | 461 | "unpipe": { |
417 | "version": "1.0.0", | 462 | "version": "1.0.0", |
418 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", | 463 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", | ... | ... |
-
Please register or login to post a comment