@webex/webex-server 2.59.3-next.1 → 2.59.4
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.
- package/.eslintrc.js +6 -6
- package/README.md +98 -98
- package/babel.config.js +3 -3
- package/bin/webex-server +12 -12
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/memory-store.js +67 -67
- package/dist/memory-store.js.map +1 -1
- package/dist/session.js +12 -12
- package/dist/session.js.map +1 -1
- package/dist/webex.js +2 -2
- package/dist/webex.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +28 -29
- package/process +1 -1
- package/src/config.js +3 -3
- package/src/index.js +68 -68
- package/src/memory-store.js +193 -193
- package/src/session.js +249 -249
- package/src/webex.js +26 -26
- package/test/integration/spec/session.js +242 -242
package/.eslintrc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = config;
|
|
1
|
+
const config = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = config;
|
package/README.md
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
# @webex/webex-server
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
-
|
|
5
|
-
> HTTP frontend to the Cisco Webex JS SDK
|
|
6
|
-
|
|
7
|
-
Why would we put an http server in front of our SDK? Encryption is hard and this lets all of our client test suites (potentially written in languages for which we do not have sdks) do encrypted things without a major time expenditure
|
|
8
|
-
|
|
9
|
-
- [Install](#install)
|
|
10
|
-
- [Usage](#usage)
|
|
11
|
-
- [Contribute](#contribute)
|
|
12
|
-
- [Maintainers](#maintainers)
|
|
13
|
-
- [License](#license)
|
|
14
|
-
|
|
15
|
-
## Install
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install -g @webex/webex-server
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
Start the daemon
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
webex-server
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Create a session (make sure to copy your set cookie header)
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
curl -X POST \
|
|
33
|
-
-H "Content-Type: application/json" \
|
|
34
|
-
-d '{"clientId":"<your client id>","clientSecret":"<your client secret>","redirectUri":"<your redirect_uri>","scope":"<your scopes>"}' \
|
|
35
|
-
http://localhost:3000/api/v1/session
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
(optional) Create a conversation
|
|
39
|
-
|
|
40
|
-
> SDK: webex.internal.conversation.create({comment: 'first comment', displayName: 'title', participants: ['<userId1>', '<userId2>', '<userId3>']})
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
curl -X POST \
|
|
44
|
-
-H "Content-Type: application/json" \
|
|
45
|
-
-H "Cookie: <connect.sid cookie from step one>" \
|
|
46
|
-
-d '[{"comment":"first message","displayName":"title","participants":["userId1","userId2","userId3"]}]'
|
|
47
|
-
-v \
|
|
48
|
-
http://localhost:3000/api/v1/session/invoke/internal/conversation/create
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
(optional) Post a message
|
|
52
|
-
|
|
53
|
-
> SDK: `webex.inernal.conversation.post({url: '<conversation url>', {displayName: 'second comment'}})`
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
curl -X POST \
|
|
57
|
-
-H "Content-Type: application/json" \
|
|
58
|
-
-H "Cookie: <connect.sid cookie from step one>" \
|
|
59
|
-
-d [{"url":"<conversation url>"},{"displayName":"second comment"}]
|
|
60
|
-
-v \
|
|
61
|
-
http://localhost:3000/api/v1/session/invoke/internal/conversation/post
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
(optional) Fetch a conversation
|
|
65
|
-
|
|
66
|
-
> SDK: `webex.internal.conversation.get({url: '<conversation url>'})`
|
|
67
|
-
> SDK: `webex.internal.conversation.get({url: '<conversation url>'})`
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
curl -X POST \
|
|
71
|
-
-H "Content-Type: application/json" \
|
|
72
|
-
-H "Cookie: <connect.sid cookie from step one>" \
|
|
73
|
-
-d [{"url":"<conversation url>"}]
|
|
74
|
-
-v \
|
|
75
|
-
http://localhost:3000/api/v1/session/invoke/internal/conversation/get
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Clean up your session (If you don't do this, you'll have a bunch of long-running web socket connections)
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
curl -X DELETE \
|
|
82
|
-
-H "Content-Type: application/json" \
|
|
83
|
-
-H "Cookie: <connect.sid cookie from step one>" \
|
|
84
|
-
-v \
|
|
85
|
-
http://localhost:3000/api/v1/session
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Maintainers
|
|
89
|
-
|
|
90
|
-
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
91
|
-
|
|
92
|
-
## Contribute
|
|
93
|
-
|
|
94
|
-
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
95
|
-
|
|
96
|
-
## License
|
|
97
|
-
|
|
98
|
-
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
|
1
|
+
# @webex/webex-server
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
> HTTP frontend to the Cisco Webex JS SDK
|
|
6
|
+
|
|
7
|
+
Why would we put an http server in front of our SDK? Encryption is hard and this lets all of our client test suites (potentially written in languages for which we do not have sdks) do encrypted things without a major time expenditure
|
|
8
|
+
|
|
9
|
+
- [Install](#install)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [Contribute](#contribute)
|
|
12
|
+
- [Maintainers](#maintainers)
|
|
13
|
+
- [License](#license)
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @webex/webex-server
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Start the daemon
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
webex-server
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Create a session (make sure to copy your set cookie header)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
curl -X POST \
|
|
33
|
+
-H "Content-Type: application/json" \
|
|
34
|
+
-d '{"clientId":"<your client id>","clientSecret":"<your client secret>","redirectUri":"<your redirect_uri>","scope":"<your scopes>"}' \
|
|
35
|
+
http://localhost:3000/api/v1/session
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
(optional) Create a conversation
|
|
39
|
+
|
|
40
|
+
> SDK: webex.internal.conversation.create({comment: 'first comment', displayName: 'title', participants: ['<userId1>', '<userId2>', '<userId3>']})
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
curl -X POST \
|
|
44
|
+
-H "Content-Type: application/json" \
|
|
45
|
+
-H "Cookie: <connect.sid cookie from step one>" \
|
|
46
|
+
-d '[{"comment":"first message","displayName":"title","participants":["userId1","userId2","userId3"]}]'
|
|
47
|
+
-v \
|
|
48
|
+
http://localhost:3000/api/v1/session/invoke/internal/conversation/create
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
(optional) Post a message
|
|
52
|
+
|
|
53
|
+
> SDK: `webex.inernal.conversation.post({url: '<conversation url>', {displayName: 'second comment'}})`
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
curl -X POST \
|
|
57
|
+
-H "Content-Type: application/json" \
|
|
58
|
+
-H "Cookie: <connect.sid cookie from step one>" \
|
|
59
|
+
-d [{"url":"<conversation url>"},{"displayName":"second comment"}]
|
|
60
|
+
-v \
|
|
61
|
+
http://localhost:3000/api/v1/session/invoke/internal/conversation/post
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(optional) Fetch a conversation
|
|
65
|
+
|
|
66
|
+
> SDK: `webex.internal.conversation.get({url: '<conversation url>'})`
|
|
67
|
+
> SDK: `webex.internal.conversation.get({url: '<conversation url>'})`
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
curl -X POST \
|
|
71
|
+
-H "Content-Type: application/json" \
|
|
72
|
+
-H "Cookie: <connect.sid cookie from step one>" \
|
|
73
|
+
-d [{"url":"<conversation url>"}]
|
|
74
|
+
-v \
|
|
75
|
+
http://localhost:3000/api/v1/session/invoke/internal/conversation/get
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Clean up your session (If you don't do this, you'll have a bunch of long-running web socket connections)
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
curl -X DELETE \
|
|
82
|
+
-H "Content-Type: application/json" \
|
|
83
|
+
-H "Cookie: <connect.sid cookie from step one>" \
|
|
84
|
+
-v \
|
|
85
|
+
http://localhost:3000/api/v1/session
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Maintainers
|
|
89
|
+
|
|
90
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
91
|
+
|
|
92
|
+
## Contribute
|
|
93
|
+
|
|
94
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = babelConfigLegacy;
|
|
1
|
+
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = babelConfigLegacy;
|
package/bin/webex-server
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/* eslint-disable no-console */
|
|
4
|
-
|
|
5
|
-
const app = require(`../dist/index.js`);
|
|
6
|
-
|
|
7
|
-
const port = process.env.PORT || 3000;
|
|
8
|
-
|
|
9
|
-
const server = app.listen(port, () => {
|
|
10
|
-
const address = server.address();
|
|
11
|
-
console.info(`%s listening at http://%s:%s`, `@webex/webex-server`, address.host, address.port);
|
|
12
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
|
|
5
|
+
const app = require(`../dist/index.js`);
|
|
6
|
+
|
|
7
|
+
const port = process.env.PORT || 3000;
|
|
8
|
+
|
|
9
|
+
const server = app.listen(port, () => {
|
|
10
|
+
const address = server.address();
|
|
11
|
+
console.info(`%s listening at http://%s:%s`, `@webex/webex-server`, address.host, address.port);
|
|
12
|
+
});
|
package/dist/config.js
CHANGED
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["config.js"],"sourcesContent":["/*!\
|
|
1
|
+
{"version":3,"names":[],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n"],"mappings":"AAAA;AACA;AACA;AAFA"}
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ var _responseTime = _interopRequireDefault(require("response-time"));
|
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var _webex = _interopRequireDefault(require("./webex"));
|
|
14
14
|
var _session = _interopRequireDefault(require("./session"));
|
|
15
|
-
/*!
|
|
16
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
15
|
+
/*!
|
|
16
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/* eslint-disable no-console */
|
|
@@ -45,7 +45,7 @@ app.use((0, _cors.default)({
|
|
|
45
45
|
app.get('/ping', function (req, res) {
|
|
46
46
|
res.send({
|
|
47
47
|
name: '@webex/webex-server',
|
|
48
|
-
version: "2.59.
|
|
48
|
+
version: "2.59.4",
|
|
49
49
|
'sdk-version': _webex.default.version
|
|
50
50
|
});
|
|
51
51
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compression","_interopRequireDefault","require","_cors","_errorhandler","_express","_morgan","_onFinished","_express2","_responseTime","_uuid","_webex","_session","app","express","use","responseTime","requestId","generator","sequence","concat","uuid","v4","reqHeader","resHeader","morgan","req","res","next","onFinished","console","info","method","toUpperCase","path","statusCode","getHeader","compression","cors","origin","credentials","maxAge","get","send","name","version","Webex","sessionRouter","errorHandler","module","exports"],"sources":["index.js"],"sourcesContent":["/*!\
|
|
1
|
+
{"version":3,"names":["_compression","_interopRequireDefault","require","_cors","_errorhandler","_express","_morgan","_onFinished","_express2","_responseTime","_uuid","_webex","_session","app","express","use","responseTime","requestId","generator","sequence","concat","uuid","v4","reqHeader","resHeader","morgan","req","res","next","onFinished","console","info","method","toUpperCase","path","statusCode","getHeader","compression","cors","origin","credentials","maxAge","get","send","name","version","Webex","sessionRouter","errorHandler","module","exports"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable no-console */\n\nimport compression from 'compression';\nimport cors from 'cors';\nimport errorHandler from 'errorhandler';\nimport express from 'express';\nimport morgan from 'morgan';\nimport onFinished from 'on-finished';\nimport requestId from 'request-id/express';\nimport responseTime from 'response-time';\nimport uuid from 'uuid';\n\nimport Webex from './webex';\nimport sessionRouter from './session';\n\nconst app = express();\n\napp.use(responseTime());\napp.use(\n requestId({\n generator() {\n // TODO get sequence from session data\n const sequence = 0;\n\n return `webex-server_${uuid.v4()}_${sequence}`;\n },\n reqHeader: 'TrackingID',\n resHeader: 'TrackingID',\n })\n);\napp.use(morgan('dev'));\napp.use((req, res, next) => {\n onFinished(res, () => {\n console.info(\n req.method.toUpperCase(),\n req.path,\n res.statusCode,\n res.getHeader('X-Response-Time')\n );\n });\n next();\n});\napp.use(compression());\napp.use(\n cors({\n origin: true,\n credentials: true,\n maxAge: 24 * 60 * 60,\n })\n);\n\napp.get('/ping', (req, res) => {\n res.send({\n name: '@webex/webex-server',\n version: PACKAGE_VERSION,\n 'sdk-version': Webex.version,\n });\n});\n\napp.use('/api/v1', sessionRouter);\n\napp.use(errorHandler());\n\nmodule.exports = app;\n"],"mappings":";;;AAMA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,KAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,IAAAS,MAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,QAAA,GAAAX,sBAAA,CAAAC,OAAA;AAjBA;AACA;AACA;;AAEA;;AAeA,IAAMW,GAAG,GAAG,IAAAC,gBAAO,GAAE;AAErBD,GAAG,CAACE,GAAG,CAAC,IAAAC,qBAAY,GAAE,CAAC;AACvBH,GAAG,CAACE,GAAG,CACL,IAAAE,iBAAS,EAAC;EACRC,SAAS,WAAAA,UAAA,EAAG;IACV;IACA,IAAMC,QAAQ,GAAG,CAAC;IAElB,uBAAAC,MA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("@babel/runtime-corejs2/core-js/objec
|
|
|
12
12
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
13
13
|
var _store = _interopRequireDefault(require("express-session/session/store"));
|
|
14
14
|
var _util = _interopRequireDefault(require("util"));
|
|
15
|
-
/*!
|
|
16
|
-
* Almost a direct copy of express-session/sessions/memory.js, except the JSON
|
|
17
|
-
* serialization/deserialization has been removed.
|
|
18
|
-
* https://raw.githubusercontent.com/expressjs/session/master/session/memory.js
|
|
19
|
-
* @ignore
|
|
15
|
+
/*!
|
|
16
|
+
* Almost a direct copy of express-session/sessions/memory.js, except the JSON
|
|
17
|
+
* serialization/deserialization has been removed.
|
|
18
|
+
* https://raw.githubusercontent.com/expressjs/session/master/session/memory.js
|
|
19
|
+
* @ignore
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
/*!
|
|
23
|
-
* express-session
|
|
24
|
-
* Copyright(c) 2010 Sencha Inc.
|
|
25
|
-
* Copyright(c) 2011 TJ Holowaychuk
|
|
26
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
27
|
-
* MIT Licensed
|
|
22
|
+
/*!
|
|
23
|
+
* express-session
|
|
24
|
+
* Copyright(c) 2010 Sencha Inc.
|
|
25
|
+
* Copyright(c) 2011 TJ Holowaychuk
|
|
26
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
27
|
+
* MIT Licensed
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
// Disable eslint since this is a very lightly modified copy of the built-in
|
|
31
31
|
// MemoryStore
|
|
32
32
|
/* eslint-disable */
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* Module dependencies.
|
|
36
|
-
* @private
|
|
34
|
+
/**
|
|
35
|
+
* Module dependencies.
|
|
36
|
+
* @private
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Shim setImmediate for node.js < 0.10
|
|
41
|
-
* @private
|
|
39
|
+
/**
|
|
40
|
+
* Shim setImmediate for node.js < 0.10
|
|
41
|
+
* @private
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/* istanbul ignore next */
|
|
@@ -46,13 +46,13 @@ var defer = typeof _setImmediate2.default === 'function' ? _setImmediate2.defaul
|
|
|
46
46
|
process.nextTick(fn.bind.apply(fn, arguments));
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Module exports.
|
|
49
|
+
/**
|
|
50
|
+
* Module exports.
|
|
51
51
|
*/
|
|
52
52
|
var _default = MemoryStore;
|
|
53
|
-
/**
|
|
54
|
-
* A session store in memory.
|
|
55
|
-
* @public
|
|
53
|
+
/**
|
|
54
|
+
* A session store in memory.
|
|
55
|
+
* @public
|
|
56
56
|
*/
|
|
57
57
|
exports.default = _default;
|
|
58
58
|
function MemoryStore() {
|
|
@@ -60,17 +60,17 @@ function MemoryStore() {
|
|
|
60
60
|
this.sessions = (0, _create.default)(null);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Inherit from Store.
|
|
63
|
+
/**
|
|
64
|
+
* Inherit from Store.
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
67
|
_util.default.inherits(MemoryStore, _store.default);
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* Get all active sessions.
|
|
71
|
-
*
|
|
72
|
-
* @param {function} callback
|
|
73
|
-
* @public
|
|
69
|
+
/**
|
|
70
|
+
* Get all active sessions.
|
|
71
|
+
*
|
|
72
|
+
* @param {function} callback
|
|
73
|
+
* @public
|
|
74
74
|
*/
|
|
75
75
|
|
|
76
76
|
MemoryStore.prototype.all = function all(callback) {
|
|
@@ -86,11 +86,11 @@ MemoryStore.prototype.all = function all(callback) {
|
|
|
86
86
|
callback && defer(callback, null, sessions);
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
* Clear all sessions.
|
|
91
|
-
*
|
|
92
|
-
* @param {function} callback
|
|
93
|
-
* @public
|
|
89
|
+
/**
|
|
90
|
+
* Clear all sessions.
|
|
91
|
+
*
|
|
92
|
+
* @param {function} callback
|
|
93
|
+
* @public
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
96
|
MemoryStore.prototype.clear = function clear(callback) {
|
|
@@ -98,11 +98,11 @@ MemoryStore.prototype.clear = function clear(callback) {
|
|
|
98
98
|
callback && defer(callback);
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* Destroy the session associated with the given session ID.
|
|
103
|
-
*
|
|
104
|
-
* @param {string} sessionId
|
|
105
|
-
* @public
|
|
101
|
+
/**
|
|
102
|
+
* Destroy the session associated with the given session ID.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} sessionId
|
|
105
|
+
* @public
|
|
106
106
|
*/
|
|
107
107
|
|
|
108
108
|
MemoryStore.prototype.destroy = function destroy(sessionId, callback) {
|
|
@@ -110,32 +110,32 @@ MemoryStore.prototype.destroy = function destroy(sessionId, callback) {
|
|
|
110
110
|
callback && defer(callback);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* Fetch session by the given session ID.
|
|
115
|
-
*
|
|
116
|
-
* @param {string} sessionId
|
|
117
|
-
* @param {function} callback
|
|
118
|
-
* @public
|
|
113
|
+
/**
|
|
114
|
+
* Fetch session by the given session ID.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} sessionId
|
|
117
|
+
* @param {function} callback
|
|
118
|
+
* @public
|
|
119
119
|
*/
|
|
120
120
|
|
|
121
121
|
MemoryStore.prototype.get = function get(sessionId, callback) {
|
|
122
122
|
defer(callback, null, getSession.call(this, sessionId));
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
/**
|
|
126
|
-
* Commit the given session associated with the given sessionId to the store.
|
|
127
|
-
*
|
|
128
|
-
* @param {string} sessionId
|
|
129
|
-
* @param {object} session
|
|
130
|
-
* @param {function} callback
|
|
131
|
-
* @public
|
|
125
|
+
/**
|
|
126
|
+
* Commit the given session associated with the given sessionId to the store.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} sessionId
|
|
129
|
+
* @param {object} session
|
|
130
|
+
* @param {function} callback
|
|
131
|
+
* @public
|
|
132
132
|
*/
|
|
133
133
|
|
|
134
|
-
/**
|
|
135
|
-
* Get number of active sessions.
|
|
136
|
-
*
|
|
137
|
-
* @param {function} callback
|
|
138
|
-
* @public
|
|
134
|
+
/**
|
|
135
|
+
* Get number of active sessions.
|
|
136
|
+
*
|
|
137
|
+
* @param {function} callback
|
|
138
|
+
* @public
|
|
139
139
|
*/
|
|
140
140
|
|
|
141
141
|
MemoryStore.prototype.length = function length(callback) {
|
|
@@ -149,13 +149,13 @@ MemoryStore.prototype.set = function set(sessionId, session, callback) {
|
|
|
149
149
|
callback && defer(callback);
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
/**
|
|
153
|
-
* Touch the given session object associated with the given session ID.
|
|
154
|
-
*
|
|
155
|
-
* @param {string} sessionId
|
|
156
|
-
* @param {object} session
|
|
157
|
-
* @param {function} callback
|
|
158
|
-
* @public
|
|
152
|
+
/**
|
|
153
|
+
* Touch the given session object associated with the given session ID.
|
|
154
|
+
*
|
|
155
|
+
* @param {string} sessionId
|
|
156
|
+
* @param {object} session
|
|
157
|
+
* @param {function} callback
|
|
158
|
+
* @public
|
|
159
159
|
*/
|
|
160
160
|
|
|
161
161
|
MemoryStore.prototype.touch = function touch(sessionId, session, callback) {
|
|
@@ -168,9 +168,9 @@ MemoryStore.prototype.touch = function touch(sessionId, session, callback) {
|
|
|
168
168
|
callback && defer(callback);
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
* Get session from the store.
|
|
173
|
-
* @private
|
|
171
|
+
/**
|
|
172
|
+
* Get session from the store.
|
|
173
|
+
* @private
|
|
174
174
|
*/
|
|
175
175
|
|
|
176
176
|
function getSession(sessionId) {
|
package/dist/memory-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_store","_interopRequireDefault","require","_util","defer","_setImmediate2","default","fn","process","nextTick","bind","apply","arguments","_default","MemoryStore","exports","Store","call","sessions","_create","util","inherits","prototype","all","callback","sessionIds","_keys","i","length","sessionId","session","getSession","clear","destroy","get","err","set","touch","currentSession","cookie","sess","expires","Date","_now"],"sources":["memory-store.js"],"sourcesContent":["/*!\
|
|
1
|
+
{"version":3,"names":["_store","_interopRequireDefault","require","_util","defer","_setImmediate2","default","fn","process","nextTick","bind","apply","arguments","_default","MemoryStore","exports","Store","call","sessions","_create","util","inherits","prototype","all","callback","sessionIds","_keys","i","length","sessionId","session","getSession","clear","destroy","get","err","set","touch","currentSession","cookie","sess","expires","Date","_now"],"sources":["memory-store.js"],"sourcesContent":["/*!\n * Almost a direct copy of express-session/sessions/memory.js, except the JSON\n * serialization/deserialization has been removed.\n * https://raw.githubusercontent.com/expressjs/session/master/session/memory.js\n * @ignore\n */\n\n/*!\n * express-session\n * Copyright(c) 2010 Sencha Inc.\n * Copyright(c) 2011 TJ Holowaychuk\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n// Disable eslint since this is a very lightly modified copy of the built-in\n// MemoryStore\n/* eslint-disable */\n\n/**\n * Module dependencies.\n * @private\n */\n\nimport Store from 'express-session/session/store';\nimport util from 'util';\n\n/**\n * Shim setImmediate for node.js < 0.10\n * @private\n */\n\n/* istanbul ignore next */\nvar defer =\n typeof setImmediate === 'function'\n ? setImmediate\n : function (fn) {\n process.nextTick(fn.bind.apply(fn, arguments));\n };\n\n/**\n * Module exports.\n */\n\nexport default MemoryStore;\n\n/**\n * A session store in memory.\n * @public\n */\n\nfunction MemoryStore() {\n Store.call(this);\n this.sessions = Object.create(null);\n}\n\n/**\n * Inherit from Store.\n */\n\nutil.inherits(MemoryStore, Store);\n\n/**\n * Get all active sessions.\n *\n * @param {function} callback\n * @public\n */\n\nMemoryStore.prototype.all = function all(callback) {\n var sessionIds = Object.keys(this.sessions);\n var sessions = Object.create(null);\n\n for (var i = 0; i < sessionIds.length; i += 1) {\n var sessionId = sessionIds[i];\n var session = getSession.call(this, sessionId);\n\n if (session) {\n sessions[sessionId] = session;\n }\n }\n\n callback && defer(callback, null, sessions);\n};\n\n/**\n * Clear all sessions.\n *\n * @param {function} callback\n * @public\n */\n\nMemoryStore.prototype.clear = function clear(callback) {\n this.sessions = Object.create(null);\n callback && defer(callback);\n};\n\n/**\n * Destroy the session associated with the given session ID.\n *\n * @param {string} sessionId\n * @public\n */\n\nMemoryStore.prototype.destroy = function destroy(sessionId, callback) {\n delete this.sessions[sessionId];\n callback && defer(callback);\n};\n\n/**\n * Fetch session by the given session ID.\n *\n * @param {string} sessionId\n * @param {function} callback\n * @public\n */\n\nMemoryStore.prototype.get = function get(sessionId, callback) {\n defer(callback, null, getSession.call(this, sessionId));\n};\n\n/**\n * Commit the given session associated with the given sessionId to the store.\n *\n * @param {string} sessionId\n * @param {object} session\n * @param {function} callback\n * @public\n */\n\n/**\n * Get number of active sessions.\n *\n * @param {function} callback\n * @public\n */\n\nMemoryStore.prototype.length = function length(callback) {\n this.all(function (err, sessions) {\n if (err) return callback(err);\n callback(null, Object.keys(sessions).length);\n });\n};\n\nMemoryStore.prototype.set = function set(sessionId, session, callback) {\n this.sessions[sessionId] = session;\n callback && defer(callback);\n};\n\n/**\n * Touch the given session object associated with the given session ID.\n *\n * @param {string} sessionId\n * @param {object} session\n * @param {function} callback\n * @public\n */\n\nMemoryStore.prototype.touch = function touch(sessionId, session, callback) {\n var currentSession = getSession.call(this, sessionId);\n\n if (currentSession) {\n // update expiration\n currentSession.cookie = session.cookie;\n this.sessions[sessionId] = currentSession;\n }\n\n callback && defer(callback);\n};\n\n/**\n * Get session from the store.\n * @private\n */\n\nfunction getSession(sessionId) {\n var sess = this.sessions[sessionId];\n\n if (!sess) {\n return;\n }\n\n var expires =\n typeof sess.cookie.expires === 'string' ? new Date(sess.cookie.expires) : sess.cookie.expires;\n\n // destroy expired session\n if (expires && expires <= Date.now()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,OAAO,IAAI,IAAAE,IAAA,CAAArC,OAAA,GAAU,EAAE;IACpC,OAAO,IAAI,CAACY,QAAQ,CAACW,SAAS,CAAC;IAC/B;EACF;EAEA,OAAOW,IAAI;AACb"}
|
package/dist/session.js
CHANGED
|
@@ -16,8 +16,8 @@ var _expressValidator = _interopRequireDefault(require("express-validator"));
|
|
|
16
16
|
var _expressSession = _interopRequireDefault(require("express-session"));
|
|
17
17
|
var _webex = _interopRequireDefault(require("./webex"));
|
|
18
18
|
var _memoryStore = _interopRequireDefault(require("./memory-store"));
|
|
19
|
-
/*!
|
|
20
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
19
|
+
/*!
|
|
20
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/* eslint-disable camelcase */
|
|
@@ -38,9 +38,9 @@ router.use((0, _expressSession.default)({
|
|
|
38
38
|
store: new _memoryStore.default()
|
|
39
39
|
}));
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* Return the details for a given session
|
|
43
|
-
* @type {Function}
|
|
41
|
+
/**
|
|
42
|
+
* Return the details for a given session
|
|
43
|
+
* @type {Function}
|
|
44
44
|
*/
|
|
45
45
|
router.get('/session', function (req, res) {
|
|
46
46
|
var webex = req.session.webex;
|
|
@@ -53,9 +53,9 @@ router.get('/session', function (req, res) {
|
|
|
53
53
|
}).end();
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* Initialize a webex instance, connect it to mercury, and set a session cookie.
|
|
58
|
-
* @type {Function}
|
|
56
|
+
/**
|
|
57
|
+
* Initialize a webex instance, connect it to mercury, and set a session cookie.
|
|
58
|
+
* @type {Function}
|
|
59
59
|
*/
|
|
60
60
|
router.put('/session', function (req, res, next) {
|
|
61
61
|
req.checkBody('clientId').notEmpty();
|
|
@@ -96,8 +96,8 @@ router.put('/session', function (req, res, next) {
|
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
/**
|
|
100
|
-
* Disconnect a webex instance and unregister its device
|
|
99
|
+
/**
|
|
100
|
+
* Disconnect a webex instance and unregister its device
|
|
101
101
|
*/
|
|
102
102
|
router.delete('/session', function (req, res, next) {
|
|
103
103
|
var webex = req.session.webex;
|
|
@@ -156,8 +156,8 @@ router.post('/session/invoke/internal/conversation/share', function (req, res) {
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
* Invoke an sdk method.
|
|
159
|
+
/**
|
|
160
|
+
* Invoke an sdk method.
|
|
161
161
|
*/
|
|
162
162
|
router.post(/^\/session\/invoke\/.*/, function (req, res) {
|
|
163
163
|
console.info('invoke called');
|