@webex/webex-server 2.59.2 → 2.59.3-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,193 +1,193 @@
1
- /*!
2
- * Almost a direct copy of express-session/sessions/memory.js, except the JSON
3
- * serialization/deserialization has been removed.
4
- * https://raw.githubusercontent.com/expressjs/session/master/session/memory.js
5
- * @ignore
6
- */
7
-
8
- /*!
9
- * express-session
10
- * Copyright(c) 2010 Sencha Inc.
11
- * Copyright(c) 2011 TJ Holowaychuk
12
- * Copyright(c) 2015 Douglas Christopher Wilson
13
- * MIT Licensed
14
- */
15
-
16
- // Disable eslint since this is a very lightly modified copy of the built-in
17
- // MemoryStore
18
- /* eslint-disable */
19
-
20
- /**
21
- * Module dependencies.
22
- * @private
23
- */
24
-
25
- import Store from 'express-session/session/store';
26
- import util from 'util';
27
-
28
- /**
29
- * Shim setImmediate for node.js < 0.10
30
- * @private
31
- */
32
-
33
- /* istanbul ignore next */
34
- var defer =
35
- typeof setImmediate === 'function'
36
- ? setImmediate
37
- : function (fn) {
38
- process.nextTick(fn.bind.apply(fn, arguments));
39
- };
40
-
41
- /**
42
- * Module exports.
43
- */
44
-
45
- export default MemoryStore;
46
-
47
- /**
48
- * A session store in memory.
49
- * @public
50
- */
51
-
52
- function MemoryStore() {
53
- Store.call(this);
54
- this.sessions = Object.create(null);
55
- }
56
-
57
- /**
58
- * Inherit from Store.
59
- */
60
-
61
- util.inherits(MemoryStore, Store);
62
-
63
- /**
64
- * Get all active sessions.
65
- *
66
- * @param {function} callback
67
- * @public
68
- */
69
-
70
- MemoryStore.prototype.all = function all(callback) {
71
- var sessionIds = Object.keys(this.sessions);
72
- var sessions = Object.create(null);
73
-
74
- for (var i = 0; i < sessionIds.length; i += 1) {
75
- var sessionId = sessionIds[i];
76
- var session = getSession.call(this, sessionId);
77
-
78
- if (session) {
79
- sessions[sessionId] = session;
80
- }
81
- }
82
-
83
- callback && defer(callback, null, sessions);
84
- };
85
-
86
- /**
87
- * Clear all sessions.
88
- *
89
- * @param {function} callback
90
- * @public
91
- */
92
-
93
- MemoryStore.prototype.clear = function clear(callback) {
94
- this.sessions = Object.create(null);
95
- callback && defer(callback);
96
- };
97
-
98
- /**
99
- * Destroy the session associated with the given session ID.
100
- *
101
- * @param {string} sessionId
102
- * @public
103
- */
104
-
105
- MemoryStore.prototype.destroy = function destroy(sessionId, callback) {
106
- delete this.sessions[sessionId];
107
- callback && defer(callback);
108
- };
109
-
110
- /**
111
- * Fetch session by the given session ID.
112
- *
113
- * @param {string} sessionId
114
- * @param {function} callback
115
- * @public
116
- */
117
-
118
- MemoryStore.prototype.get = function get(sessionId, callback) {
119
- defer(callback, null, getSession.call(this, sessionId));
120
- };
121
-
122
- /**
123
- * Commit the given session associated with the given sessionId to the store.
124
- *
125
- * @param {string} sessionId
126
- * @param {object} session
127
- * @param {function} callback
128
- * @public
129
- */
130
-
131
- /**
132
- * Get number of active sessions.
133
- *
134
- * @param {function} callback
135
- * @public
136
- */
137
-
138
- MemoryStore.prototype.length = function length(callback) {
139
- this.all(function (err, sessions) {
140
- if (err) return callback(err);
141
- callback(null, Object.keys(sessions).length);
142
- });
143
- };
144
-
145
- MemoryStore.prototype.set = function set(sessionId, session, callback) {
146
- this.sessions[sessionId] = session;
147
- callback && defer(callback);
148
- };
149
-
150
- /**
151
- * Touch the given session object associated with the given session ID.
152
- *
153
- * @param {string} sessionId
154
- * @param {object} session
155
- * @param {function} callback
156
- * @public
157
- */
158
-
159
- MemoryStore.prototype.touch = function touch(sessionId, session, callback) {
160
- var currentSession = getSession.call(this, sessionId);
161
-
162
- if (currentSession) {
163
- // update expiration
164
- currentSession.cookie = session.cookie;
165
- this.sessions[sessionId] = currentSession;
166
- }
167
-
168
- callback && defer(callback);
169
- };
170
-
171
- /**
172
- * Get session from the store.
173
- * @private
174
- */
175
-
176
- function getSession(sessionId) {
177
- var sess = this.sessions[sessionId];
178
-
179
- if (!sess) {
180
- return;
181
- }
182
-
183
- var expires =
184
- typeof sess.cookie.expires === 'string' ? new Date(sess.cookie.expires) : sess.cookie.expires;
185
-
186
- // destroy expired session
187
- if (expires && expires <= Date.now()) {
188
- delete this.sessions[sessionId];
189
- return;
190
- }
191
-
192
- return sess;
193
- }
1
+ /*!
2
+ * Almost a direct copy of express-session/sessions/memory.js, except the JSON
3
+ * serialization/deserialization has been removed.
4
+ * https://raw.githubusercontent.com/expressjs/session/master/session/memory.js
5
+ * @ignore
6
+ */
7
+
8
+ /*!
9
+ * express-session
10
+ * Copyright(c) 2010 Sencha Inc.
11
+ * Copyright(c) 2011 TJ Holowaychuk
12
+ * Copyright(c) 2015 Douglas Christopher Wilson
13
+ * MIT Licensed
14
+ */
15
+
16
+ // Disable eslint since this is a very lightly modified copy of the built-in
17
+ // MemoryStore
18
+ /* eslint-disable */
19
+
20
+ /**
21
+ * Module dependencies.
22
+ * @private
23
+ */
24
+
25
+ import Store from 'express-session/session/store';
26
+ import util from 'util';
27
+
28
+ /**
29
+ * Shim setImmediate for node.js < 0.10
30
+ * @private
31
+ */
32
+
33
+ /* istanbul ignore next */
34
+ var defer =
35
+ typeof setImmediate === 'function'
36
+ ? setImmediate
37
+ : function (fn) {
38
+ process.nextTick(fn.bind.apply(fn, arguments));
39
+ };
40
+
41
+ /**
42
+ * Module exports.
43
+ */
44
+
45
+ export default MemoryStore;
46
+
47
+ /**
48
+ * A session store in memory.
49
+ * @public
50
+ */
51
+
52
+ function MemoryStore() {
53
+ Store.call(this);
54
+ this.sessions = Object.create(null);
55
+ }
56
+
57
+ /**
58
+ * Inherit from Store.
59
+ */
60
+
61
+ util.inherits(MemoryStore, Store);
62
+
63
+ /**
64
+ * Get all active sessions.
65
+ *
66
+ * @param {function} callback
67
+ * @public
68
+ */
69
+
70
+ MemoryStore.prototype.all = function all(callback) {
71
+ var sessionIds = Object.keys(this.sessions);
72
+ var sessions = Object.create(null);
73
+
74
+ for (var i = 0; i < sessionIds.length; i += 1) {
75
+ var sessionId = sessionIds[i];
76
+ var session = getSession.call(this, sessionId);
77
+
78
+ if (session) {
79
+ sessions[sessionId] = session;
80
+ }
81
+ }
82
+
83
+ callback && defer(callback, null, sessions);
84
+ };
85
+
86
+ /**
87
+ * Clear all sessions.
88
+ *
89
+ * @param {function} callback
90
+ * @public
91
+ */
92
+
93
+ MemoryStore.prototype.clear = function clear(callback) {
94
+ this.sessions = Object.create(null);
95
+ callback && defer(callback);
96
+ };
97
+
98
+ /**
99
+ * Destroy the session associated with the given session ID.
100
+ *
101
+ * @param {string} sessionId
102
+ * @public
103
+ */
104
+
105
+ MemoryStore.prototype.destroy = function destroy(sessionId, callback) {
106
+ delete this.sessions[sessionId];
107
+ callback && defer(callback);
108
+ };
109
+
110
+ /**
111
+ * Fetch session by the given session ID.
112
+ *
113
+ * @param {string} sessionId
114
+ * @param {function} callback
115
+ * @public
116
+ */
117
+
118
+ MemoryStore.prototype.get = function get(sessionId, callback) {
119
+ defer(callback, null, getSession.call(this, sessionId));
120
+ };
121
+
122
+ /**
123
+ * Commit the given session associated with the given sessionId to the store.
124
+ *
125
+ * @param {string} sessionId
126
+ * @param {object} session
127
+ * @param {function} callback
128
+ * @public
129
+ */
130
+
131
+ /**
132
+ * Get number of active sessions.
133
+ *
134
+ * @param {function} callback
135
+ * @public
136
+ */
137
+
138
+ MemoryStore.prototype.length = function length(callback) {
139
+ this.all(function (err, sessions) {
140
+ if (err) return callback(err);
141
+ callback(null, Object.keys(sessions).length);
142
+ });
143
+ };
144
+
145
+ MemoryStore.prototype.set = function set(sessionId, session, callback) {
146
+ this.sessions[sessionId] = session;
147
+ callback && defer(callback);
148
+ };
149
+
150
+ /**
151
+ * Touch the given session object associated with the given session ID.
152
+ *
153
+ * @param {string} sessionId
154
+ * @param {object} session
155
+ * @param {function} callback
156
+ * @public
157
+ */
158
+
159
+ MemoryStore.prototype.touch = function touch(sessionId, session, callback) {
160
+ var currentSession = getSession.call(this, sessionId);
161
+
162
+ if (currentSession) {
163
+ // update expiration
164
+ currentSession.cookie = session.cookie;
165
+ this.sessions[sessionId] = currentSession;
166
+ }
167
+
168
+ callback && defer(callback);
169
+ };
170
+
171
+ /**
172
+ * Get session from the store.
173
+ * @private
174
+ */
175
+
176
+ function getSession(sessionId) {
177
+ var sess = this.sessions[sessionId];
178
+
179
+ if (!sess) {
180
+ return;
181
+ }
182
+
183
+ var expires =
184
+ typeof sess.cookie.expires === 'string' ? new Date(sess.cookie.expires) : sess.cookie.expires;
185
+
186
+ // destroy expired session
187
+ if (expires && expires <= Date.now()) {
188
+ delete this.sessions[sessionId];
189
+ return;
190
+ }
191
+
192
+ return sess;
193
+ }