@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.
- 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 +29 -28
- 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/dist/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fs","_interopRequireDefault","require","_util","_bodyParser","_express","_expressValidator","_expressSession","_webex","_memoryStore","router","express","Router","_default","exports","default","use","bodyParser","json","validator","session","resave","saveUninitialized","secret","store","MemoryStore","get","req","res","webex","status","end","send","serialize","put","next","checkBody","notEmpty","getValidationResult","then","result","isEmpty","console","info","array","concat","param","WebexCore","credentials","body","user","token","config","client_id","clientId","client_secret","clientSecret","redirect_uri","redirectUri","scope","internal","mercury","connect","catch","err","error","delete","disconnect","destroy","err2","post","message","share","conversation","makeShare","files","forEach","fileJson","file","fs","readFileSync","path","name","displayName","add","util","inspect","reason","log","toString","upstreamStatusCode","statusCode","upstreamResponse","invokePath","url","substr","indexOf","keypath","split","method","_get2","join","methodName","pop","context","label","_apply"],"sources":["session.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport fs from 'fs';\nimport util from 'util';\n\nimport bodyParser from 'body-parser';\nimport express from 'express';\nimport validator from 'express-validator';\nimport session from 'express-session';\nimport {get} from 'lodash';\n\nimport WebexCore from './webex';\nimport MemoryStore from './memory-store';\n\n/* eslint-disable camelcase */\n/* eslint-disable no-console */\n// express induces more callbacks than usual\n/* eslint-disable max-nested-callbacks */\n\n// eslint-disable-next-line\nconst router = express.Router();\n\nexport default router;\n\nrouter.use(bodyParser.json());\nrouter.use(validator());\nrouter.use(\n session({\n resave: true,\n saveUninitialized: true,\n secret: 'keyboardcat',\n store: new MemoryStore(),\n })\n);\n\n/**\n * Return the details for a given session\n * @type {Function}\n */\nrouter.get('/session', (req, res) => {\n const {webex} = req.session;\n\n if (!webex) {\n res.status(404).end();\n\n return;\n }\n\n res\n .status(200)\n .send({\n webex: webex.serialize(),\n })\n .end();\n});\n\n/**\n * Initialize a webex instance, connect it to mercury, and set a session cookie.\n * @type {Function}\n */\nrouter.put('/session', (req, res, next) => {\n req.checkBody('clientId').notEmpty();\n req.checkBody('clientSecret').notEmpty();\n req.checkBody('redirectUri').notEmpty();\n req.checkBody('scope').notEmpty();\n req.checkBody('user').notEmpty();\n req.checkBody('user.token').notEmpty();\n req.checkBody('user.token.access_token').notEmpty();\n req.checkBody('user.token.token_type').notEmpty();\n req.checkBody('user.token.expires_in').notEmpty();\n\n req.getValidationResult().then((result) => {\n if (!result.isEmpty()) {\n console.info(result.array());\n res.status(400).send(`${result.array()[0].param} is missing`);\n\n return;\n }\n const webex = new WebexCore({\n credentials: req.body.user.token,\n config: {\n credentials: {\n client_id: req.body.clientId,\n client_secret: req.body.clientSecret,\n redirect_uri: req.body.redirectUri,\n scope: req.body.scope,\n },\n },\n });\n\n req.session.webex = webex;\n\n webex.internal.mercury\n .connect()\n .then(() => res.status(200).send({webex}).end())\n .catch((err) => {\n console.error(err);\n next(err);\n });\n });\n});\n\n/**\n * Disconnect a webex instance and unregister its device\n */\nrouter.delete('/session', (req, res, next) => {\n const {webex} = req.session;\n\n if (!webex) {\n res\n .status(404)\n .send({\n err: 'no webex instance found for session',\n })\n .end();\n\n return;\n }\n\n webex.internal.mercury\n .disconnect()\n .then(() => {\n req.session.destroy((err) => {\n if (err) {\n next(err);\n\n return;\n }\n\n res.status(204).end();\n });\n })\n .catch((err) => {\n req.session.destroy((err2) => {\n if (err2) {\n next(err2);\n\n return;\n }\n next(err);\n });\n });\n});\n\nrouter.post('/session/invoke/internal/conversation/share', (req, res) => {\n console.info('invoke conversation share called');\n const {webex} = req.session;\n\n if (!webex) {\n console.info('invoke: No session found - did you forget to hit /session?');\n res\n .status(404)\n .send({\n message: 'No session found - did you forget to hit /session?',\n })\n .end();\n\n return;\n }\n\n const share = webex.internal.conversation.makeShare(req.body[0]);\n\n req.body[1].files.forEach((fileJson) => {\n const file = fs.readFileSync(fileJson.path); // eslint-disable-line no-sync\n\n file.name = fileJson.displayName;\n share.add(file);\n });\n\n console.info('invoke: invoking \"conversation.share\" with arguments\\n', util.inspect(req.body));\n webex.internal.conversation\n .share(req.body[0], share)\n .then((result) => {\n res.status(200).send(result).end();\n })\n .catch((reason) => {\n console.log(reason);\n res\n .status(400)\n .send({\n message: 'An error occured while processing your request',\n error: reason.toString(),\n upstreamStatusCode: reason.statusCode,\n upstreamResponse: reason.body,\n })\n .end();\n });\n});\n\n/**\n * Invoke an sdk method.\n */\nrouter.post(/^\\/session\\/invoke\\/.*/, (req, res) => {\n console.info('invoke called');\n const {webex} = req.session;\n\n if (!webex) {\n console.info('invoke: No session found - did you forget to hit /session?');\n res\n .status(404)\n .send({\n message: 'No session found - did you forget to hit /session?',\n })\n .end();\n\n return;\n }\n\n const invokePath = req.url.substr(req.url.indexOf('invoke') + 7);\n const keypath = invokePath.split('/');\n\n const method = get(webex, keypath.join('.'));\n\n console.info(111, method, keypath);\n const methodName = keypath.pop();\n\n console.info(222, methodName);\n\n let context = get(webex, keypath.join('.'));\n\n if (!context) {\n context = webex;\n }\n\n console.info(333, context);\n\n const label = `webex.${keypath.join('.')}.${methodName}()`;\n\n console.info(`invoke: invoking \"${label}\" with arguments\\n`, util.inspect(req.body));\n Reflect.apply(method, context, req.body)\n .then((result) => {\n console.info(`invoke: successfully invoked \"${label}\"`);\n res.status(200).send(result).end();\n })\n .catch((reason) => {\n console.error({req, err: reason}, `invoke: \"${label}\" failed with error`);\n res\n .status(502)\n .send({\n message: 'An error occured while processing your request',\n error: reason.toString(),\n upstreamStatusCode: reason.statusCode,\n upstreamResponse: reason.body,\n })\n .end();\n });\n});\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAGA,IAAAM,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,YAAA,GAAAR,sBAAA,CAAAC,OAAA;AAdA;AACA;AACA;;AAcA;AACA;AACA;AACA;;AAEA;AACA,IAAMQ,MAAM,GAAGC,gBAAO,CAACC,MAAM,EAAE;AAAC,IAAAC,QAAA,GAEjBH,MAAM;AAAAI,OAAA,CAAAC,OAAA,GAAAF,QAAA;AAErBH,MAAM,CAACM,GAAG,CAACC,mBAAU,CAACC,IAAI,EAAE,CAAC;AAC7BR,MAAM,CAACM,GAAG,CAAC,IAAAG,yBAAS,GAAE,CAAC;AACvBT,MAAM,CAACM,GAAG,CACR,IAAAI,uBAAO,EAAC;EACNC,MAAM,EAAE,IAAI;EACZC,iBAAiB,EAAE,IAAI;EACvBC,MAAM,EAAE,aAAa;EACrBC,KAAK,EAAE,IAAIC,oBAAW;AACxB,CAAC,CAAC,CACH;;AAED;AACA;AACA;AACA;AACAf,MAAM,CAACgB,GAAG,CAAC,UAAU,EAAE,UAACC,GAAG,EAAEC,GAAG,EAAK;EACnC,IAAOC,KAAK,GAAIF,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;IACvD7E,GAAG,CAACE,MAAM,CAAC,GAAG,CAAC,CAACE,IAAI,CAACQ,MAAM,CAAC,CAACT,GAAG,EAAE;EACpC,CAAC,CAAC,CACDgC,KAAK,CAAC,UAACwB,MAAM,EAAK;IACjB7C,OAAO,CAACuB,KAAK,CAAC;MAACtC,GAAG,EAAHA,GAAG;MAAEqC,GAAG,EAAEuB;IAAM,CAAC,eAAA1C,MAAA,CAAc4D,KAAK,0BAAsB;IACzE7E,GAAG,CACAE,MAAM,CAAC,GAAG,CAAC,CACXE,IAAI,CAAC;MACJuC,OAAO,EAAE,gDAAgD;MACzDN,KAAK,EAAEsB,MAAM,CAACE,QAAQ,EAAE;MACxBC,kBAAkB,EAAEH,MAAM,CAACI,UAAU;MACrCC,gBAAgB,EAAEL,MAAM,CAACtC;IAC3B,CAAC,CAAC,CACDlB,GAAG,EAAE;EACV,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_fs","_interopRequireDefault","require","_util","_bodyParser","_express","_expressValidator","_expressSession","_webex","_memoryStore","router","express","Router","_default","exports","default","use","bodyParser","json","validator","session","resave","saveUninitialized","secret","store","MemoryStore","get","req","res","webex","status","end","send","serialize","put","next","checkBody","notEmpty","getValidationResult","then","result","isEmpty","console","info","array","concat","param","WebexCore","credentials","body","user","token","config","client_id","clientId","client_secret","clientSecret","redirect_uri","redirectUri","scope","internal","mercury","connect","catch","err","error","delete","disconnect","destroy","err2","post","message","share","conversation","makeShare","files","forEach","fileJson","file","fs","readFileSync","path","name","displayName","add","util","inspect","reason","log","toString","upstreamStatusCode","statusCode","upstreamResponse","invokePath","url","substr","indexOf","keypath","split","method","_get2","join","methodName","pop","context","label","_apply"],"sources":["session.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport fs from 'fs';\r\nimport util from 'util';\r\n\r\nimport bodyParser from 'body-parser';\r\nimport express from 'express';\r\nimport validator from 'express-validator';\r\nimport session from 'express-session';\r\nimport {get} from 'lodash';\r\n\r\nimport WebexCore from './webex';\r\nimport MemoryStore from './memory-store';\r\n\r\n/* eslint-disable camelcase */\r\n/* eslint-disable no-console */\r\n// express induces more callbacks than usual\r\n/* eslint-disable max-nested-callbacks */\r\n\r\n// eslint-disable-next-line\r\nconst router = express.Router();\r\n\r\nexport default router;\r\n\r\nrouter.use(bodyParser.json());\r\nrouter.use(validator());\r\nrouter.use(\r\n session({\r\n resave: true,\r\n saveUninitialized: true,\r\n secret: 'keyboardcat',\r\n store: new MemoryStore(),\r\n })\r\n);\r\n\r\n/**\r\n * Return the details for a given session\r\n * @type {Function}\r\n */\r\nrouter.get('/session', (req, res) => {\r\n const {webex} = req.session;\r\n\r\n if (!webex) {\r\n res.status(404).end();\r\n\r\n return;\r\n }\r\n\r\n res\r\n .status(200)\r\n .send({\r\n webex: webex.serialize(),\r\n })\r\n .end();\r\n});\r\n\r\n/**\r\n * Initialize a webex instance, connect it to mercury, and set a session cookie.\r\n * @type {Function}\r\n */\r\nrouter.put('/session', (req, res, next) => {\r\n req.checkBody('clientId').notEmpty();\r\n req.checkBody('clientSecret').notEmpty();\r\n req.checkBody('redirectUri').notEmpty();\r\n req.checkBody('scope').notEmpty();\r\n req.checkBody('user').notEmpty();\r\n req.checkBody('user.token').notEmpty();\r\n req.checkBody('user.token.access_token').notEmpty();\r\n req.checkBody('user.token.token_type').notEmpty();\r\n req.checkBody('user.token.expires_in').notEmpty();\r\n\r\n req.getValidationResult().then((result) => {\r\n if (!result.isEmpty()) {\r\n console.info(result.array());\r\n res.status(400).send(`${result.array()[0].param} is missing`);\r\n\r\n return;\r\n }\r\n const webex = new WebexCore({\r\n credentials: req.body.user.token,\r\n config: {\r\n credentials: {\r\n client_id: req.body.clientId,\r\n client_secret: req.body.clientSecret,\r\n redirect_uri: req.body.redirectUri,\r\n scope: req.body.scope,\r\n },\r\n },\r\n });\r\n\r\n req.session.webex = webex;\r\n\r\n webex.internal.mercury\r\n .connect()\r\n .then(() => res.status(200).send({webex}).end())\r\n .catch((err) => {\r\n console.error(err);\r\n next(err);\r\n });\r\n });\r\n});\r\n\r\n/**\r\n * Disconnect a webex instance and unregister its device\r\n */\r\nrouter.delete('/session', (req, res, next) => {\r\n const {webex} = req.session;\r\n\r\n if (!webex) {\r\n res\r\n .status(404)\r\n .send({\r\n err: 'no webex instance found for session',\r\n })\r\n .end();\r\n\r\n return;\r\n }\r\n\r\n webex.internal.mercury\r\n .disconnect()\r\n .then(() => {\r\n req.session.destroy((err) => {\r\n if (err) {\r\n next(err);\r\n\r\n return;\r\n }\r\n\r\n res.status(204).end();\r\n });\r\n })\r\n .catch((err) => {\r\n req.session.destroy((err2) => {\r\n if (err2) {\r\n next(err2);\r\n\r\n return;\r\n }\r\n next(err);\r\n });\r\n });\r\n});\r\n\r\nrouter.post('/session/invoke/internal/conversation/share', (req, res) => {\r\n console.info('invoke conversation share called');\r\n const {webex} = req.session;\r\n\r\n if (!webex) {\r\n console.info('invoke: No session found - did you forget to hit /session?');\r\n res\r\n .status(404)\r\n .send({\r\n message: 'No session found - did you forget to hit /session?',\r\n })\r\n .end();\r\n\r\n return;\r\n }\r\n\r\n const share = webex.internal.conversation.makeShare(req.body[0]);\r\n\r\n req.body[1].files.forEach((fileJson) => {\r\n const file = fs.readFileSync(fileJson.path); // eslint-disable-line no-sync\r\n\r\n file.name = fileJson.displayName;\r\n share.add(file);\r\n });\r\n\r\n console.info('invoke: invoking \"conversation.share\" with arguments\\n', util.inspect(req.body));\r\n webex.internal.conversation\r\n .share(req.body[0], share)\r\n .then((result) => {\r\n res.status(200).send(result).end();\r\n })\r\n .catch((reason) => {\r\n console.log(reason);\r\n res\r\n .status(400)\r\n .send({\r\n message: 'An error occured while processing your request',\r\n error: reason.toString(),\r\n upstreamStatusCode: reason.statusCode,\r\n upstreamResponse: reason.body,\r\n })\r\n .end();\r\n });\r\n});\r\n\r\n/**\r\n * Invoke an sdk method.\r\n */\r\nrouter.post(/^\\/session\\/invoke\\/.*/, (req, res) => {\r\n console.info('invoke called');\r\n const {webex} = req.session;\r\n\r\n if (!webex) {\r\n console.info('invoke: No session found - did you forget to hit /session?');\r\n res\r\n .status(404)\r\n .send({\r\n message: 'No session found - did you forget to hit /session?',\r\n })\r\n .end();\r\n\r\n return;\r\n }\r\n\r\n const invokePath = req.url.substr(req.url.indexOf('invoke') + 7);\r\n const keypath = invokePath.split('/');\r\n\r\n const method = get(webex, keypath.join('.'));\r\n\r\n console.info(111, method, keypath);\r\n const methodName = keypath.pop();\r\n\r\n console.info(222, methodName);\r\n\r\n let context = get(webex, keypath.join('.'));\r\n\r\n if (!context) {\r\n context = webex;\r\n }\r\n\r\n console.info(333, context);\r\n\r\n const label = `webex.${keypath.join('.')}.${methodName}()`;\r\n\r\n console.info(`invoke: invoking \"${label}\" with arguments\\n`, util.inspect(req.body));\r\n Reflect.apply(method, context, req.body)\r\n .then((result) => {\r\n console.info(`invoke: successfully invoked \"${label}\"`);\r\n res.status(200).send(result).end();\r\n })\r\n .catch((reason) => {\r\n console.error({req, err: reason}, `invoke: \"${label}\" failed with error`);\r\n res\r\n .status(502)\r\n .send({\r\n message: 'An error occured while processing your request',\r\n error: reason.toString(),\r\n upstreamStatusCode: reason.statusCode,\r\n upstreamResponse: reason.body,\r\n })\r\n .end();\r\n });\r\n});\r\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAGA,IAAAM,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,YAAA,GAAAR,sBAAA,CAAAC,OAAA;AAdA;AACA;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|
require("@webex/internal-plugin-user");
|
|
25
25
|
require("@webex/internal-plugin-device");
|
|
26
26
|
var _webexCore = _interopRequireDefault(require("@webex/webex-core"));
|
|
27
|
-
/*!
|
|
28
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
27
|
+
/*!
|
|
28
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
29
29
|
*/
|
|
30
30
|
var _default = _webexCore.default;
|
|
31
31
|
exports.default = _default;
|
package/dist/webex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_webexCore","_interopRequireDefault","_default","WebexCore","exports","default"],"sources":["webex.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@babel/polyfill';\n\nimport '@webex/plugin-authorization-node';\nimport '@webex/internal-plugin-avatar';\nimport '@webex/internal-plugin-board';\nimport '@webex/internal-plugin-calendar';\nimport '@webex/internal-plugin-conversation';\nimport '@webex/internal-plugin-encryption';\nimport '@webex/internal-plugin-feature';\nimport '@webex/internal-plugin-flag';\nimport '@webex/plugin-logger';\nimport '@webex/internal-plugin-mercury';\nimport '@webex/internal-plugin-metrics';\nimport '@webex/internal-plugin-search';\nimport '@webex/internal-plugin-support';\nimport '@webex/internal-plugin-team';\nimport '@webex/internal-plugin-user';\nimport '@webex/internal-plugin-device';\n\nimport WebexCore from '@webex/webex-core';\n\nexport default WebexCore;\n"],"mappings":";;;;;;;;AAIAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAvBA;AACA;AACA;AAFA,IAAAG,QAAA,GAyBeC,kBAAS;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
1
|
+
{"version":3,"names":["require","_webexCore","_interopRequireDefault","_default","WebexCore","exports","default"],"sources":["webex.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport '@babel/polyfill';\r\n\r\nimport '@webex/plugin-authorization-node';\r\nimport '@webex/internal-plugin-avatar';\r\nimport '@webex/internal-plugin-board';\r\nimport '@webex/internal-plugin-calendar';\r\nimport '@webex/internal-plugin-conversation';\r\nimport '@webex/internal-plugin-encryption';\r\nimport '@webex/internal-plugin-feature';\r\nimport '@webex/internal-plugin-flag';\r\nimport '@webex/plugin-logger';\r\nimport '@webex/internal-plugin-mercury';\r\nimport '@webex/internal-plugin-metrics';\r\nimport '@webex/internal-plugin-search';\r\nimport '@webex/internal-plugin-support';\r\nimport '@webex/internal-plugin-team';\r\nimport '@webex/internal-plugin-user';\r\nimport '@webex/internal-plugin-device';\r\n\r\nimport WebexCore from '@webex/webex-core';\r\n\r\nexport default WebexCore;\r\n"],"mappings":";;;;;;;;AAIAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAvBA;AACA;AACA;AAFA,IAAAG,QAAA,GAyBeC,kBAAS;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const config = require('@webex/jest-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = config;
|
|
1
|
+
const config = require('@webex/jest-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/webex-server",
|
|
3
|
-
"version": "2.59.2",
|
|
4
3
|
"description": ".",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"contributors": [
|
|
@@ -34,35 +33,35 @@
|
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@babel/core": "^7.17.10",
|
|
36
35
|
"@babel/polyfill": "^7.12.1",
|
|
37
|
-
"@webex/babel-config-legacy": "
|
|
38
|
-
"@webex/eslint-config-legacy": "
|
|
39
|
-
"@webex/jest-config-legacy": "
|
|
40
|
-
"@webex/legacy-tools": "
|
|
41
|
-
"@webex/test-helper-chai": "2.59.
|
|
42
|
-
"@webex/test-helper-mocha": "2.59.
|
|
43
|
-
"@webex/test-helper-mock-webex": "2.59.
|
|
44
|
-
"@webex/test-helper-test-users": "2.59.
|
|
36
|
+
"@webex/babel-config-legacy": "^0.0.0",
|
|
37
|
+
"@webex/eslint-config-legacy": "^0.0.0",
|
|
38
|
+
"@webex/jest-config-legacy": "^0.0.0",
|
|
39
|
+
"@webex/legacy-tools": "^0.0.0",
|
|
40
|
+
"@webex/test-helper-chai": "^2.59.3-next.1",
|
|
41
|
+
"@webex/test-helper-mocha": "^2.59.3-next.1",
|
|
42
|
+
"@webex/test-helper-mock-webex": "^2.59.3-next.1",
|
|
43
|
+
"@webex/test-helper-test-users": "^2.59.3-next.1",
|
|
45
44
|
"eslint": "^8.24.0",
|
|
46
45
|
"prettier": "^2.7.1"
|
|
47
46
|
},
|
|
48
47
|
"dependencies": {
|
|
49
|
-
"@webex/internal-plugin-avatar": "2.59.
|
|
50
|
-
"@webex/internal-plugin-board": "2.59.
|
|
51
|
-
"@webex/internal-plugin-calendar": "2.59.
|
|
52
|
-
"@webex/internal-plugin-conversation": "2.59.
|
|
53
|
-
"@webex/internal-plugin-device": "2.59.
|
|
54
|
-
"@webex/internal-plugin-encryption": "2.59.
|
|
55
|
-
"@webex/internal-plugin-feature": "2.59.
|
|
56
|
-
"@webex/internal-plugin-flag": "2.59.
|
|
57
|
-
"@webex/internal-plugin-mercury": "2.59.
|
|
58
|
-
"@webex/internal-plugin-metrics": "2.59.
|
|
59
|
-
"@webex/internal-plugin-search": "2.59.
|
|
60
|
-
"@webex/internal-plugin-support": "2.59.
|
|
61
|
-
"@webex/internal-plugin-team": "2.59.
|
|
62
|
-
"@webex/internal-plugin-user": "2.59.
|
|
63
|
-
"@webex/plugin-authorization-node": "2.59.
|
|
64
|
-
"@webex/plugin-logger": "2.59.
|
|
65
|
-
"@webex/webex-core": "2.59.
|
|
48
|
+
"@webex/internal-plugin-avatar": "^2.59.3-next.1",
|
|
49
|
+
"@webex/internal-plugin-board": "^2.59.3-next.1",
|
|
50
|
+
"@webex/internal-plugin-calendar": "^2.59.3-next.1",
|
|
51
|
+
"@webex/internal-plugin-conversation": "^2.59.3-next.1",
|
|
52
|
+
"@webex/internal-plugin-device": "^2.59.3-next.1",
|
|
53
|
+
"@webex/internal-plugin-encryption": "^2.59.3-next.1",
|
|
54
|
+
"@webex/internal-plugin-feature": "^2.59.3-next.1",
|
|
55
|
+
"@webex/internal-plugin-flag": "^2.59.3-next.1",
|
|
56
|
+
"@webex/internal-plugin-mercury": "^2.59.3-next.1",
|
|
57
|
+
"@webex/internal-plugin-metrics": "^2.59.3-next.1",
|
|
58
|
+
"@webex/internal-plugin-search": "^2.59.3-next.1",
|
|
59
|
+
"@webex/internal-plugin-support": "^2.59.3-next.1",
|
|
60
|
+
"@webex/internal-plugin-team": "^2.59.3-next.1",
|
|
61
|
+
"@webex/internal-plugin-user": "^2.59.3-next.1",
|
|
62
|
+
"@webex/plugin-authorization-node": "^2.59.3-next.1",
|
|
63
|
+
"@webex/plugin-logger": "^2.59.3-next.1",
|
|
64
|
+
"@webex/webex-core": "^2.59.3-next.1",
|
|
66
65
|
"body-parser": "^1.19.0",
|
|
67
66
|
"compression": "^1.7.4",
|
|
68
67
|
"cors": "^2.8.5",
|
|
@@ -81,10 +80,12 @@
|
|
|
81
80
|
"scripts": {
|
|
82
81
|
"build": "yarn build:src",
|
|
83
82
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
83
|
+
"deploy:npm": "yarn npm publish",
|
|
84
84
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
85
85
|
"test:browser:broken": "webex-legacy-tools test --integration --unit --runner karma",
|
|
86
86
|
"test:integration:broken": "webex-legacy-tools test --integration --runner mocha",
|
|
87
87
|
"test:style": "eslint ./src/**/*.*",
|
|
88
88
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
89
|
-
}
|
|
90
|
-
|
|
89
|
+
},
|
|
90
|
+
"version": "2.59.3-next.1"
|
|
91
|
+
}
|
package/process
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {browser: true};
|
|
1
|
+
module.exports = {browser: true};
|
package/src/config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
package/src/index.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-console */
|
|
6
|
-
|
|
7
|
-
import compression from 'compression';
|
|
8
|
-
import cors from 'cors';
|
|
9
|
-
import errorHandler from 'errorhandler';
|
|
10
|
-
import express from 'express';
|
|
11
|
-
import morgan from 'morgan';
|
|
12
|
-
import onFinished from 'on-finished';
|
|
13
|
-
import requestId from 'request-id/express';
|
|
14
|
-
import responseTime from 'response-time';
|
|
15
|
-
import uuid from 'uuid';
|
|
16
|
-
|
|
17
|
-
import Webex from './webex';
|
|
18
|
-
import sessionRouter from './session';
|
|
19
|
-
|
|
20
|
-
const app = express();
|
|
21
|
-
|
|
22
|
-
app.use(responseTime());
|
|
23
|
-
app.use(
|
|
24
|
-
requestId({
|
|
25
|
-
generator() {
|
|
26
|
-
// TODO get sequence from session data
|
|
27
|
-
const sequence = 0;
|
|
28
|
-
|
|
29
|
-
return `webex-server_${uuid.v4()}_${sequence}`;
|
|
30
|
-
},
|
|
31
|
-
reqHeader: 'TrackingID',
|
|
32
|
-
resHeader: 'TrackingID',
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
app.use(morgan('dev'));
|
|
36
|
-
app.use((req, res, next) => {
|
|
37
|
-
onFinished(res, () => {
|
|
38
|
-
console.info(
|
|
39
|
-
req.method.toUpperCase(),
|
|
40
|
-
req.path,
|
|
41
|
-
res.statusCode,
|
|
42
|
-
res.getHeader('X-Response-Time')
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
next();
|
|
46
|
-
});
|
|
47
|
-
app.use(compression());
|
|
48
|
-
app.use(
|
|
49
|
-
cors({
|
|
50
|
-
origin: true,
|
|
51
|
-
credentials: true,
|
|
52
|
-
maxAge: 24 * 60 * 60,
|
|
53
|
-
})
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
app.get('/ping', (req, res) => {
|
|
57
|
-
res.send({
|
|
58
|
-
name: '@webex/webex-server',
|
|
59
|
-
version: PACKAGE_VERSION,
|
|
60
|
-
'sdk-version': Webex.version,
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
app.use('/api/v1', sessionRouter);
|
|
65
|
-
|
|
66
|
-
app.use(errorHandler());
|
|
67
|
-
|
|
68
|
-
module.exports = app;
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable no-console */
|
|
6
|
+
|
|
7
|
+
import compression from 'compression';
|
|
8
|
+
import cors from 'cors';
|
|
9
|
+
import errorHandler from 'errorhandler';
|
|
10
|
+
import express from 'express';
|
|
11
|
+
import morgan from 'morgan';
|
|
12
|
+
import onFinished from 'on-finished';
|
|
13
|
+
import requestId from 'request-id/express';
|
|
14
|
+
import responseTime from 'response-time';
|
|
15
|
+
import uuid from 'uuid';
|
|
16
|
+
|
|
17
|
+
import Webex from './webex';
|
|
18
|
+
import sessionRouter from './session';
|
|
19
|
+
|
|
20
|
+
const app = express();
|
|
21
|
+
|
|
22
|
+
app.use(responseTime());
|
|
23
|
+
app.use(
|
|
24
|
+
requestId({
|
|
25
|
+
generator() {
|
|
26
|
+
// TODO get sequence from session data
|
|
27
|
+
const sequence = 0;
|
|
28
|
+
|
|
29
|
+
return `webex-server_${uuid.v4()}_${sequence}`;
|
|
30
|
+
},
|
|
31
|
+
reqHeader: 'TrackingID',
|
|
32
|
+
resHeader: 'TrackingID',
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
app.use(morgan('dev'));
|
|
36
|
+
app.use((req, res, next) => {
|
|
37
|
+
onFinished(res, () => {
|
|
38
|
+
console.info(
|
|
39
|
+
req.method.toUpperCase(),
|
|
40
|
+
req.path,
|
|
41
|
+
res.statusCode,
|
|
42
|
+
res.getHeader('X-Response-Time')
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
next();
|
|
46
|
+
});
|
|
47
|
+
app.use(compression());
|
|
48
|
+
app.use(
|
|
49
|
+
cors({
|
|
50
|
+
origin: true,
|
|
51
|
+
credentials: true,
|
|
52
|
+
maxAge: 24 * 60 * 60,
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
app.get('/ping', (req, res) => {
|
|
57
|
+
res.send({
|
|
58
|
+
name: '@webex/webex-server',
|
|
59
|
+
version: PACKAGE_VERSION,
|
|
60
|
+
'sdk-version': Webex.version,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
app.use('/api/v1', sessionRouter);
|
|
65
|
+
|
|
66
|
+
app.use(errorHandler());
|
|
67
|
+
|
|
68
|
+
module.exports = app;
|