@adonisjs/session 8.0.0-next.0 → 8.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/commands/commands.json +1 -0
  2. package/build/commands/main.d.ts +4 -0
  3. package/build/commands/main.js +36 -0
  4. package/build/commands/make_session_table.d.ts +9 -0
  5. package/build/commands/make_session_table.js +13 -0
  6. package/build/cookie--JOJxrtW.js +31 -0
  7. package/build/database-vbrhCOPd.js +86 -0
  8. package/build/debug-BZVg83L1.js +3 -0
  9. package/build/dynamodb-BFVgTQSf.js +72 -0
  10. package/build/factories/main.js +27 -45
  11. package/build/file-BBU02j4z.js +71 -0
  12. package/build/index.d.ts +1 -0
  13. package/build/index.js +7 -25
  14. package/build/main-kn40V-hF.js +2 -0
  15. package/build/make/migration/sessions.stub +26 -0
  16. package/build/providers/session_provider.d.ts +2 -1
  17. package/build/providers/session_provider.js +34 -48
  18. package/build/redis-D8D9UtiD.js +91 -0
  19. package/build/session-C9DdRahS.js +215 -0
  20. package/build/session-Cb9-DoMh.js +139 -0
  21. package/build/session_collection-CvS5yIq6.js +31 -0
  22. package/build/session_middleware-gegOBxmm.js +27 -0
  23. package/build/src/client.js +38 -7
  24. package/build/src/debug.d.ts +1 -1
  25. package/build/src/define_config.d.ts +14 -6
  26. package/build/src/errors.d.ts +9 -0
  27. package/build/src/plugins/edge.d.ts +5 -1
  28. package/build/src/plugins/edge.js +74 -124
  29. package/build/src/plugins/japa/api_client.js +76 -96
  30. package/build/src/plugins/japa/browser_client.js +58 -81
  31. package/build/src/session.d.ts +12 -0
  32. package/build/src/session_collection.d.ts +81 -0
  33. package/build/src/session_middleware.js +5 -9
  34. package/build/src/stores/database.d.ts +70 -0
  35. package/build/src/stores/memory.d.ts +19 -2
  36. package/build/src/stores/redis.d.ts +15 -2
  37. package/build/src/types.d.ts +62 -8
  38. package/build/src/types.js +1 -0
  39. package/build/values_store-CvR1Sn37.js +78 -0
  40. package/package.json +65 -42
  41. package/build/chunk-DFXWYDMY.js +0 -62
  42. package/build/chunk-HAD4PFFM.js +0 -229
  43. package/build/chunk-MVBWJOEG.js +0 -187
  44. package/build/chunk-SBOMJK4T.js +0 -14
  45. package/build/chunk-SHD6OX52.js +0 -488
  46. package/build/chunk-Y566BNUT.js +0 -113
  47. package/build/cookie-YBBGLCO5.js +0 -88
  48. package/build/dynamodb-PLZABBFD.js +0 -153
  49. package/build/file-CCJ5ESE2.js +0 -151
  50. package/build/redis-NXJWWWVB.js +0 -89
@@ -1,488 +0,0 @@
1
- import {
2
- ReadOnlyValuesStore,
3
- ValuesStore
4
- } from "./chunk-HAD4PFFM.js";
5
- import {
6
- __export,
7
- debug_default
8
- } from "./chunk-SBOMJK4T.js";
9
-
10
- // src/errors.ts
11
- var errors_exports = {};
12
- __export(errors_exports, {
13
- E_SESSION_NOT_MUTABLE: () => E_SESSION_NOT_MUTABLE,
14
- E_SESSION_NOT_READY: () => E_SESSION_NOT_READY
15
- });
16
- import { createError } from "@adonisjs/core/exceptions";
17
- var E_SESSION_NOT_MUTABLE = createError(
18
- "Session store is in readonly mode and cannot be mutated",
19
- "E_SESSION_NOT_MUTABLE",
20
- 500
21
- );
22
- var E_SESSION_NOT_READY = createError(
23
- "Session store has not been initiated. Make sure you have registered the session middleware",
24
- "E_SESSION_NOT_READY",
25
- 500
26
- );
27
-
28
- // src/session.ts
29
- import { randomUUID } from "crypto";
30
- import Macroable from "@poppinss/macroable";
31
- import lodash from "@poppinss/utils/lodash";
32
- var Session = class extends Macroable {
33
- /**
34
- * Creates a new session instance
35
- *
36
- * @param config - Session configuration
37
- * @param storeFactory - Factory function to create session store
38
- * @param emitter - Event emitter service
39
- * @param ctx - HTTP context
40
- */
41
- constructor(config, storeFactory, emitter, ctx) {
42
- super();
43
- this.config = config;
44
- this.#ctx = ctx;
45
- this.#emitter = emitter;
46
- this.#store = storeFactory(ctx, config);
47
- this.#sessionIdFromCookie = ctx.request.cookie(config.cookieName, void 0);
48
- this.#sessionId = this.#sessionIdFromCookie || randomUUID();
49
- }
50
- #store;
51
- #emitter;
52
- #ctx;
53
- #readonly = false;
54
- /**
55
- * Session values store that holds the actual session data
56
- */
57
- #valuesStore;
58
- /**
59
- * Session id that will be committed as a cookie during the response
60
- */
61
- #sessionId;
62
- /**
63
- * Session id read from the cookie during the HTTP request.
64
- * May not exist during the first request or will differ from sessionId during regeneration.
65
- */
66
- #sessionIdFromCookie;
67
- /**
68
- * Store of flash messages that will be written during the HTTP request
69
- */
70
- responseFlashMessages = new ValuesStore({});
71
- /**
72
- * Store of flash messages for the current HTTP request
73
- */
74
- flashMessages = new ValuesStore({});
75
- /**
76
- * The key used for storing flash messages inside the session store
77
- */
78
- flashKey = "__flash__";
79
- /**
80
- * Gets the session id for the current HTTP request
81
- */
82
- get sessionId() {
83
- return this.#sessionId;
84
- }
85
- /**
86
- * Returns true if a fresh session was created during the request
87
- */
88
- get fresh() {
89
- return this.#sessionIdFromCookie === void 0;
90
- }
91
- /**
92
- * Returns true if the session is in readonly state
93
- */
94
- get readonly() {
95
- return this.#readonly;
96
- }
97
- /**
98
- * Returns true if the session store has been initiated
99
- */
100
- get initiated() {
101
- return !!this.#valuesStore;
102
- }
103
- /**
104
- * Returns true if the session id has been re-generated during the current request
105
- */
106
- get hasRegeneratedSession() {
107
- return !!(this.#sessionIdFromCookie && this.#sessionIdFromCookie !== this.#sessionId);
108
- }
109
- /**
110
- * Returns true if the session store is empty
111
- */
112
- get isEmpty() {
113
- return this.#valuesStore?.isEmpty ?? true;
114
- }
115
- /**
116
- * Returns true if the session store has been modified
117
- */
118
- get hasBeenModified() {
119
- return this.#valuesStore?.hasBeenModified ?? false;
120
- }
121
- /**
122
- * Returns the flash messages store for a given mode
123
- *
124
- * @param mode - Access mode ('write' or 'read')
125
- */
126
- #getFlashStore(mode) {
127
- if (!this.#valuesStore) {
128
- throw new E_SESSION_NOT_READY();
129
- }
130
- if (mode === "write" && this.readonly) {
131
- throw new E_SESSION_NOT_MUTABLE();
132
- }
133
- return this.responseFlashMessages;
134
- }
135
- /**
136
- * Returns the store instance for a given mode
137
- *
138
- * @param mode - Access mode ('write' or 'read')
139
- */
140
- #getValuesStore(mode) {
141
- if (!this.#valuesStore) {
142
- throw new E_SESSION_NOT_READY();
143
- }
144
- if (mode === "write" && this.readonly) {
145
- throw new E_SESSION_NOT_MUTABLE();
146
- }
147
- return this.#valuesStore;
148
- }
149
- /**
150
- * Initiates the session store. The method results in a noop when called multiple times.
151
- *
152
- * @param readonly - Whether to initiate the session in readonly mode
153
- *
154
- * @example
155
- * await session.initiate(false) // Read-write mode
156
- * await session.initiate(true) // Readonly mode
157
- */
158
- async initiate(readonly) {
159
- if (this.#valuesStore) {
160
- return;
161
- }
162
- debug_default("initiating session (readonly: %s)", readonly);
163
- this.#readonly = readonly;
164
- const contents = await this.#store.read(this.#sessionId);
165
- this.#valuesStore = new ValuesStore(contents);
166
- if (this.has(this.flashKey)) {
167
- debug_default("reading flash data");
168
- if (this.#readonly) {
169
- this.flashMessages.update(this.get(this.flashKey, null));
170
- } else {
171
- this.flashMessages.update(this.pull(this.flashKey, null));
172
- }
173
- }
174
- if ("view" in this.#ctx) {
175
- this.#ctx.view.share({
176
- session: new ReadOnlyValuesStore(this.#valuesStore.all()),
177
- flashMessages: new ReadOnlyValuesStore(this.flashMessages.all()),
178
- old: function(key, defaultValue) {
179
- return this.flashMessages.get(key, defaultValue);
180
- }
181
- });
182
- }
183
- this.#emitter.emit("session:initiated", { session: this });
184
- }
185
- /**
186
- * Puts a key-value pair to the session data store
187
- *
188
- * @param key - The key to store the value under
189
- * @param value - The value to store
190
- *
191
- * @example
192
- * session.put('username', 'john')
193
- * session.put('user.preferences', { theme: 'dark' })
194
- */
195
- put(key, value) {
196
- this.#getValuesStore("write").set(key, value);
197
- }
198
- /**
199
- * Checks if a key exists inside the datastore
200
- *
201
- * @param key - The key to check for existence
202
- *
203
- * @example
204
- * if (session.has('username')) {
205
- * console.log('User is logged in')
206
- * }
207
- */
208
- has(key) {
209
- return this.#getValuesStore("read").has(key);
210
- }
211
- /**
212
- * Gets the value of a key from the session datastore.
213
- * You can specify a default value to use when key does not exist or has undefined value.
214
- *
215
- * @param key - The key to retrieve
216
- * @param defaultValue - Default value to return if key doesn't exist
217
- *
218
- * @example
219
- * const username = session.get('username', 'guest')
220
- * const preferences = session.get('user.preferences', {})
221
- */
222
- get(key, defaultValue) {
223
- return this.#getValuesStore("read").get(key, defaultValue);
224
- }
225
- /**
226
- * Gets everything from the session store
227
- *
228
- * @example
229
- * const allData = session.all()
230
- * console.log(allData) // { username: 'john', theme: 'dark' }
231
- */
232
- all() {
233
- return this.#getValuesStore("read").all();
234
- }
235
- /**
236
- * Removes a key from the session datastore
237
- *
238
- * @param key - The key to remove
239
- *
240
- * @example
241
- * session.forget('temp_data')
242
- * session.forget('user.cache')
243
- */
244
- forget(key) {
245
- return this.#getValuesStore("write").unset(key);
246
- }
247
- /**
248
- * Reads value for a key from the session datastore and removes it simultaneously
249
- *
250
- * @param key - The key to pull
251
- * @param defaultValue - Default value to return if key doesn't exist
252
- *
253
- * @example
254
- * const message = session.pull('notification', 'No messages')
255
- * // message contains the value, and it's removed from session
256
- */
257
- pull(key, defaultValue) {
258
- return this.#getValuesStore("write").pull(key, defaultValue);
259
- }
260
- /**
261
- * Increments the value of a key inside the session store.
262
- * A new key will be defined if it doesn't exist already with value 1.
263
- *
264
- * @param key - The key to increment
265
- * @param steps - Number of steps to increment (default: 1)
266
- *
267
- * @example
268
- * session.increment('page_views') // Increments by 1
269
- * session.increment('score', 10) // Increments by 10
270
- */
271
- increment(key, steps = 1) {
272
- return this.#getValuesStore("write").increment(key, steps);
273
- }
274
- /**
275
- * Decrements the value of a key inside the session store.
276
- * A new key will be defined if it doesn't exist already with value -1.
277
- *
278
- * @param key - The key to decrement
279
- * @param steps - Number of steps to decrement (default: 1)
280
- *
281
- * @example
282
- * session.decrement('attempts') // Decrements by 1
283
- * session.decrement('credits', 5) // Decrements by 5
284
- */
285
- decrement(key, steps = 1) {
286
- return this.#getValuesStore("write").decrement(key, steps);
287
- }
288
- /**
289
- * Empties the session store
290
- *
291
- * @example
292
- * session.clear() // Removes all session data
293
- */
294
- clear() {
295
- return this.#getValuesStore("write").clear();
296
- }
297
- flash(key, value) {
298
- if (typeof key === "string") {
299
- if (value) {
300
- this.#getFlashStore("write").set(key, value);
301
- }
302
- } else {
303
- this.#getFlashStore("write").merge(key);
304
- }
305
- }
306
- /**
307
- * Flashes errors to the errorsBag. You can read these errors via the "@error" tag.
308
- * Appends new messages to the existing collection.
309
- *
310
- * @param errorsCollection - Collection of error messages
311
- *
312
- * @example
313
- * session.flashErrors({
314
- * general: 'Something went wrong',
315
- * validation: ['Name is required', 'Email is invalid']
316
- * })
317
- */
318
- flashErrors(errorsCollection) {
319
- this.flash({ errorsBag: errorsCollection });
320
- }
321
- /**
322
- * Flashes validation error messages. Make sure the error is an instance of VineJS ValidationException.
323
- * Overrides existing inputErrors.
324
- *
325
- * @param error - HTTP error containing validation messages
326
- *
327
- * @example
328
- * try {
329
- * await request.validate(schema)
330
- * } catch (error) {
331
- * session.flashValidationErrors(error)
332
- * }
333
- */
334
- flashValidationErrors(error, withInput = true) {
335
- const errorsBag = error.messages.reduce((result, message) => {
336
- if (result[message.field]) {
337
- result[message.field].push(message.message);
338
- } else {
339
- result[message.field] = [message.message];
340
- }
341
- return result;
342
- }, {});
343
- if (withInput) {
344
- this.flashExcept(["_csrf", "_method", "password", "password_confirmation"]);
345
- }
346
- let summary = "The form could not be saved. Please check the errors below.";
347
- if ("i18n" in this.#ctx) {
348
- summary = this.#ctx.i18n.t(
349
- `errors.${error.code}`,
350
- {
351
- count: error.messages.length
352
- },
353
- summary
354
- );
355
- }
356
- this.flashErrors({
357
- [String(error.code)]: summary
358
- });
359
- this.flash("inputErrorsBag", errorsBag);
360
- }
361
- /**
362
- * Flashes all form input data to the flash messages store
363
- *
364
- * @example
365
- * session.flashAll() // Flashes all request input for next request
366
- */
367
- flashAll() {
368
- return this.#getFlashStore("write").set("input", this.#ctx.request.original());
369
- }
370
- /**
371
- * Flashes form input data (except some keys) to the flash messages store
372
- *
373
- * @param keys - Array of keys to exclude from flashing
374
- *
375
- * @example
376
- * session.flashExcept(['password', '_csrf'])
377
- */
378
- flashExcept(keys) {
379
- this.#getFlashStore("write").set("input", lodash.omit(this.#ctx.request.original(), keys));
380
- }
381
- /**
382
- * Flashes form input data (only some keys) to the flash messages store
383
- *
384
- * @param keys - Array of keys to include in flashing
385
- *
386
- * @example
387
- * session.flashOnly(['name', 'email'])
388
- */
389
- flashOnly(keys) {
390
- this.#getFlashStore("write").set("input", lodash.pick(this.#ctx.request.original(), keys));
391
- }
392
- /**
393
- * Reflashes messages from the last request in the current response
394
- *
395
- * @example
396
- * session.reflash() // Keep all flash messages for another request
397
- */
398
- reflash() {
399
- this.#getFlashStore("write").set("reflashed", this.flashMessages.all());
400
- }
401
- /**
402
- * Reflashes messages (only some keys) from the last request in the current response
403
- *
404
- * @param keys - Array of keys to reflash
405
- *
406
- * @example
407
- * session.reflashOnly(['success', 'info'])
408
- */
409
- reflashOnly(keys) {
410
- this.#getFlashStore("write").set("reflashed", lodash.pick(this.flashMessages.all(), keys));
411
- }
412
- /**
413
- * Reflashes messages (except some keys) from the last request in the current response
414
- *
415
- * @param keys - Array of keys to exclude from reflashing
416
- *
417
- * @example
418
- * session.reflashExcept(['error', 'warning'])
419
- */
420
- reflashExcept(keys) {
421
- this.#getFlashStore("write").set("reflashed", lodash.omit(this.flashMessages.all(), keys));
422
- }
423
- /**
424
- * Re-generates the session id and migrates data to it
425
- *
426
- * @example
427
- * session.regenerate() // Generates new session ID for security
428
- */
429
- regenerate() {
430
- this.#sessionId = randomUUID();
431
- }
432
- /**
433
- * Commits session changes. No more mutations will be allowed after commit.
434
- *
435
- * @example
436
- * await session.commit() // Save all changes to the session store
437
- */
438
- async commit() {
439
- if (!this.#valuesStore || this.readonly) {
440
- return;
441
- }
442
- if (!this.responseFlashMessages.isEmpty) {
443
- const { input, reflashed, ...others } = this.responseFlashMessages.all();
444
- this.put(this.flashKey, { ...reflashed, ...input, ...others });
445
- }
446
- debug_default("committing session data");
447
- this.#ctx.response.cookie(this.config.cookieName, this.#sessionId, this.config.cookie);
448
- if (this.isEmpty) {
449
- if (this.#sessionIdFromCookie) {
450
- await this.#store.destroy(this.#sessionIdFromCookie);
451
- }
452
- this.#emitter.emit("session:committed", { session: this });
453
- return;
454
- }
455
- if (!this.hasBeenModified) {
456
- if (this.#sessionIdFromCookie && this.#sessionIdFromCookie !== this.#sessionId) {
457
- await this.#store.destroy(this.#sessionIdFromCookie);
458
- await this.#store.write(this.#sessionId, this.#valuesStore.toJSON());
459
- this.#emitter.emit("session:migrated", {
460
- fromSessionId: this.#sessionIdFromCookie,
461
- toSessionId: this.sessionId,
462
- session: this
463
- });
464
- } else {
465
- await this.#store.touch(this.#sessionId);
466
- }
467
- this.#emitter.emit("session:committed", { session: this });
468
- return;
469
- }
470
- if (this.#sessionIdFromCookie && this.#sessionIdFromCookie !== this.#sessionId) {
471
- await this.#store.destroy(this.#sessionIdFromCookie);
472
- await this.#store.write(this.#sessionId, this.#valuesStore.toJSON());
473
- this.#emitter.emit("session:migrated", {
474
- fromSessionId: this.#sessionIdFromCookie,
475
- toSessionId: this.sessionId,
476
- session: this
477
- });
478
- } else {
479
- await this.#store.write(this.#sessionId, this.#valuesStore.toJSON());
480
- }
481
- this.#emitter.emit("session:committed", { session: this });
482
- }
483
- };
484
-
485
- export {
486
- errors_exports,
487
- Session
488
- };
@@ -1,113 +0,0 @@
1
- import {
2
- ValuesStore
3
- } from "./chunk-HAD4PFFM.js";
4
- import {
5
- debug_default
6
- } from "./chunk-SBOMJK4T.js";
7
-
8
- // src/client.ts
9
- import { randomUUID } from "crypto";
10
- var SessionClient = class {
11
- /**
12
- * Internal data store for session values
13
- */
14
- #valuesStore = new ValuesStore({});
15
- /**
16
- * Internal store for flash messages
17
- */
18
- #flashMessagesStore = new ValuesStore({});
19
- /**
20
- * The session store contract for reading and writing session data
21
- */
22
- #store;
23
- /**
24
- * Session key used for storing flash messages
25
- */
26
- flashKey = "__flash__";
27
- /**
28
- * Session ID to use when no explicit session id is defined
29
- */
30
- sessionId = randomUUID();
31
- /**
32
- * Creates a new session client
33
- *
34
- * @param store - Session store contract implementation
35
- */
36
- constructor(store) {
37
- this.#store = store;
38
- }
39
- /**
40
- * Merges session data with existing values
41
- *
42
- * @param values - Session data to merge
43
- *
44
- * @example
45
- * client.merge({ userId: 123, theme: 'dark' })
46
- */
47
- merge(values) {
48
- this.#valuesStore.merge(values);
49
- return this;
50
- }
51
- /**
52
- * Merges flash messages with existing flash data
53
- *
54
- * @param values - Flash message data to merge
55
- *
56
- * @example
57
- * client.flash({ success: 'Operation completed', info: 'Check your email' })
58
- */
59
- flash(values) {
60
- this.#flashMessagesStore.merge(values);
61
- return this;
62
- }
63
- /**
64
- * Commits data to the session store
65
- *
66
- * @example
67
- * await client.commit() // Saves all changes to the store
68
- */
69
- async commit() {
70
- if (!this.#flashMessagesStore.isEmpty) {
71
- this.#valuesStore.set(this.flashKey, this.#flashMessagesStore.toJSON());
72
- }
73
- debug_default("committing session data during api request");
74
- if (!this.#valuesStore.isEmpty) {
75
- this.#store.write(this.sessionId, this.#valuesStore.toJSON());
76
- }
77
- }
78
- /**
79
- * Destroys the session data from the store
80
- *
81
- * @param sessionId - Optional session ID to destroy (defaults to current session)
82
- *
83
- * @example
84
- * await client.destroy() // Destroy current session
85
- * await client.destroy('abc123') // Destroy specific session
86
- */
87
- async destroy(sessionId) {
88
- debug_default("destroying session data during api request");
89
- this.#store.destroy(sessionId || this.sessionId);
90
- }
91
- /**
92
- * Loads session data from the session store
93
- *
94
- * @param sessionId - Optional session ID to load (defaults to current session)
95
- *
96
- * @example
97
- * const { values, flashMessages } = await client.load()
98
- * const data = await client.load('abc123') // Load specific session
99
- */
100
- async load(sessionId) {
101
- const contents = await this.#store.read(sessionId || this.sessionId);
102
- const store = new ValuesStore(contents);
103
- const flashMessages = store.pull(this.flashKey, {});
104
- return {
105
- values: store.all(),
106
- flashMessages
107
- };
108
- }
109
- };
110
-
111
- export {
112
- SessionClient
113
- };
@@ -1,88 +0,0 @@
1
- import {
2
- debug_default
3
- } from "./chunk-SBOMJK4T.js";
4
-
5
- // src/stores/cookie.ts
6
- var CookieStore = class {
7
- /**
8
- * HTTP context for request/response operations
9
- */
10
- #ctx;
11
- /**
12
- * Cookie configuration options
13
- */
14
- #config;
15
- /**
16
- * Creates a new cookie store instance
17
- *
18
- * @param config - Cookie configuration options
19
- * @param ctx - HTTP context
20
- */
21
- constructor(config, ctx) {
22
- this.#config = config;
23
- this.#ctx = ctx;
24
- debug_default("initiating cookie store %O", this.#config);
25
- }
26
- /**
27
- * Reads session value from the encrypted cookie
28
- *
29
- * @param sessionId - Session identifier used as cookie name
30
- *
31
- * @example
32
- * const data = store.read('sess_abc123')
33
- */
34
- read(sessionId) {
35
- debug_default("cookie store: reading session data %s", sessionId);
36
- const cookieValue = this.#ctx.request.encryptedCookie(sessionId);
37
- if (typeof cookieValue !== "object") {
38
- return null;
39
- }
40
- return cookieValue;
41
- }
42
- /**
43
- * Writes session values to an encrypted cookie
44
- *
45
- * @param sessionId - Session identifier used as cookie name
46
- * @param values - Session data to store
47
- *
48
- * @example
49
- * store.write('sess_abc123', { userId: 123, theme: 'dark' })
50
- */
51
- write(sessionId, values) {
52
- debug_default("cookie store: writing session data %s: %O", sessionId, values);
53
- this.#ctx.response.encryptedCookie(sessionId, values, this.#config);
54
- }
55
- /**
56
- * Removes the session cookie from the client
57
- *
58
- * @param sessionId - Session identifier used as cookie name
59
- *
60
- * @example
61
- * store.destroy('sess_abc123')
62
- */
63
- destroy(sessionId) {
64
- debug_default("cookie store: destroying session data %s", sessionId);
65
- if (this.#ctx.request.cookiesList()[sessionId]) {
66
- this.#ctx.response.clearCookie(sessionId);
67
- }
68
- }
69
- /**
70
- * Updates the cookie expiry by rewriting it with existing values
71
- *
72
- * @param sessionId - Session identifier used as cookie name
73
- *
74
- * @example
75
- * store.touch('sess_abc123') // Refreshes cookie expiry
76
- */
77
- touch(sessionId) {
78
- const value = this.read(sessionId);
79
- debug_default("cookie store: touching session data %s", sessionId);
80
- if (!value) {
81
- return;
82
- }
83
- this.write(sessionId, value);
84
- }
85
- };
86
- export {
87
- CookieStore
88
- };