webex-node 3.8.0-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/README.md +80 -0
- package/babel.config.js +3 -0
- package/dist/config-storage.js +19 -0
- package/dist/config-storage.js.map +1 -0
- package/dist/config-storage.shim.js +18 -0
- package/dist/config-storage.shim.js.map +1 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/webex-node.js +71 -0
- package/dist/webex-node.js.map +1 -0
- package/jest.config.js +3 -0
- package/package.json +69 -0
- package/src/config-storage.js +12 -0
- package/src/config.js +22 -0
- package/src/index.js +23 -0
- package/src/webex-node.js +75 -0
- package/test/unit/spec/webex-node.test.js +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# webex-node
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
# The Cisco Webex JS SDK for Node.js
|
|
6
|
+
|
|
7
|
+
> Upgrading from CiscoSpark to Webex?
|
|
8
|
+
>
|
|
9
|
+
> - [Follow this short guide.](../../../UPGRADING.md)
|
|
10
|
+
> - [Read why this is more than just a rebrand.](https://developer.webex.com/blog/the-new-cisco-webex-for-developers-is-here---what-developers-need-to-know-from-our-rebrand)
|
|
11
|
+
|
|
12
|
+
- [Webex](#webex)
|
|
13
|
+
- [The Cisco Webex JS SDK](#the-cisco-webex-js-sdk)
|
|
14
|
+
- [Install](#install)
|
|
15
|
+
- [Usage](#usage)
|
|
16
|
+
- [_A note on browser usage_](#a-note-on-browser-usage)
|
|
17
|
+
- [_Still using `webex/env` or `ciscospark/env`?_](#still-using-webexenv-or-ciscosparkenv)
|
|
18
|
+
- [API](#api)
|
|
19
|
+
- [Maintainers](#maintainers)
|
|
20
|
+
- [Contribute](#contribute)
|
|
21
|
+
- [License](#license)
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install --save webex-node
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
To use the SDK, you will need Cisco Webex credentials. If you do not already have a Cisco Webex account, visit
|
|
32
|
+
[Cisco Webex for Developers](https://developer.webex.com/) to create your account and retrieve your **_access token_**.
|
|
33
|
+
|
|
34
|
+
See [the detailed docs](https://webex.github.io/webex-js-sdk/) for more usage examples.
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
const Webex = require(`webex-node`);
|
|
38
|
+
const webex = Webex.init({
|
|
39
|
+
credentials: {
|
|
40
|
+
access_token: <your webex access token>
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Create a room with the title "My First Room"
|
|
45
|
+
// Add Alice and Bob to the room
|
|
46
|
+
// Send a **Hi Everyone** message to the room
|
|
47
|
+
webex.rooms.create({ title: `My First Room` }).then(room => {
|
|
48
|
+
return Promise.all([
|
|
49
|
+
webex.memberships.create({
|
|
50
|
+
roomId: room.id,
|
|
51
|
+
personEmail: `alice@example.com`
|
|
52
|
+
}),
|
|
53
|
+
webex.memberships.create({
|
|
54
|
+
roomId: room.id,
|
|
55
|
+
personEmail: `bob@example.com`
|
|
56
|
+
})
|
|
57
|
+
]).then(() =>
|
|
58
|
+
webex.messages.create({
|
|
59
|
+
markdown: `**Hi Everyone**`,
|
|
60
|
+
roomId: room.id
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### _A note on browser usage_
|
|
67
|
+
|
|
68
|
+
This package is not meant to be used on browsers.
|
|
69
|
+
|
|
70
|
+
## Maintainers
|
|
71
|
+
|
|
72
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
73
|
+
|
|
74
|
+
## Contribute
|
|
75
|
+
|
|
76
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
© 2016-2025 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _webexCore = _interopRequireDefault(require("@webex/webex-core"));
|
|
10
|
+
/*!
|
|
11
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var MemoryStoreAdapter = _webexCore.default.MemoryStoreAdapter;
|
|
15
|
+
var _default = exports.default = {
|
|
16
|
+
boundedAdapter: MemoryStoreAdapter,
|
|
17
|
+
unboundedAdapter: MemoryStoreAdapter
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=config-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_webexCore","_interopRequireDefault","require","MemoryStoreAdapter","WebexCore","_default","exports","default","boundedAdapter","unboundedAdapter"],"sources":["config-storage.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport WebexCore from '@webex/webex-core';\n\nconst {MemoryStoreAdapter} = WebexCore;\n\nexport default {\n boundedAdapter: MemoryStoreAdapter,\n unboundedAdapter: MemoryStoreAdapter,\n};\n"],"mappings":";;;;;;;;AAIA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA,IAAOC,kBAAkB,GAAIC,kBAAS,CAA/BD,kBAAkB;AAAc,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExB;EACbC,cAAc,EAAEL,kBAAkB;EAClCM,gBAAgB,EAAEN;AACpB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _webexCore = require("@webex/webex-core");
|
|
10
|
+
var _storageAdapterLocalStorage = _interopRequireDefault(require("@webex/storage-adapter-local-storage"));
|
|
11
|
+
/*!
|
|
12
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
13
|
+
*/
|
|
14
|
+
var _default = exports.default = {
|
|
15
|
+
boundedAdapter: new _storageAdapterLocalStorage.default('webex'),
|
|
16
|
+
unboundedAdapter: _webexCore.MemoryStoreAdapter
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=config-storage.shim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_storageAdapterLocalStorage","_interopRequireDefault","_default","exports","default","boundedAdapter","LocalStorageStoreAdapter","unboundedAdapter","MemoryStoreAdapter"],"sources":["config-storage.shim.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {MemoryStoreAdapter} from '@webex/webex-core';\nimport LocalStorageStoreAdapter from '@webex/storage-adapter-local-storage';\n\nexport default {\n boundedAdapter: new LocalStorageStoreAdapter('webex'),\n unboundedAdapter: MemoryStoreAdapter,\n};\n"],"mappings":";;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAC,sBAAA,CAAAF,OAAA;AALA;AACA;AACA;AAFA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAOe;EACbC,cAAc,EAAE,IAAIC,mCAAwB,CAAC,OAAO,CAAC;EACrDC,gBAAgB,EAAEC;AACpB,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _configStorage = _interopRequireDefault(require("./config-storage.js"));
|
|
10
|
+
/*!
|
|
11
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line import/extensions
|
|
14
|
+
var _default = exports.default = {
|
|
15
|
+
hydra: process.env.HYDRA_SERVICE_URL || 'https://webexapis.com/v1',
|
|
16
|
+
hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://webexapis.com/v1',
|
|
17
|
+
credentials: {
|
|
18
|
+
clientType: 'confidential'
|
|
19
|
+
},
|
|
20
|
+
device: {
|
|
21
|
+
validateDomains: true,
|
|
22
|
+
ephemeral: true
|
|
23
|
+
},
|
|
24
|
+
storage: {
|
|
25
|
+
boundedAdapter: _configStorage.default,
|
|
26
|
+
unboundedAdapter: _configStorage.default
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configStorage","_interopRequireDefault","require","_default","exports","default","hydra","process","env","HYDRA_SERVICE_URL","hydraServiceUrl","credentials","clientType","device","validateDomains","ephemeral","storage","boundedAdapter","storageConfig","unboundedAdapter"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.\n */\n\n// eslint-disable-next-line import/extensions\nimport storageConfig from './config-storage.js';\n\nexport default {\n hydra: process.env.HYDRA_SERVICE_URL || 'https://webexapis.com/v1',\n hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://webexapis.com/v1',\n credentials: {\n clientType: 'confidential',\n },\n device: {\n validateDomains: true,\n ephemeral: true,\n },\n storage: {\n boundedAdapter: storageConfig,\n unboundedAdapter: storageConfig,\n },\n};\n"],"mappings":";;;;;;;;AAKA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AALA;AACA;AACA;AAEA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGe;EACbC,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,0BAA0B;EAClEC,eAAe,EAAEH,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,0BAA0B;EAC5EE,WAAW,EAAE;IACXC,UAAU,EAAE;EACd,CAAC;EACDC,MAAM,EAAE;IACNC,eAAe,EAAE,IAAI;IACrBC,SAAS,EAAE;EACb,CAAC;EACDC,OAAO,EAAE;IACPC,cAAc,EAAEC,sBAAa;IAC7BC,gBAAgB,EAAED;EACpB;AACF,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* istanbul ignore else */
|
|
8
|
+
if (!global._babelPolyfill) {
|
|
9
|
+
/* eslint global-require: [0] */
|
|
10
|
+
require('@babel/polyfill');
|
|
11
|
+
}
|
|
12
|
+
module.exports = require('./webex-node');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The date and time, specified in ISO 8601 extended offset date/time
|
|
16
|
+
* format (e.g. `2015-10-18T14:26:16+00:00`).
|
|
17
|
+
*
|
|
18
|
+
* @typedef {string} isoDate
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* An email address, as a string.
|
|
23
|
+
* @typedef {string} email
|
|
24
|
+
*/
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["global","_babelPolyfill","require","module","exports"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* istanbul ignore else */\nif (!global._babelPolyfill) {\n /* eslint global-require: [0] */\n require('@babel/polyfill');\n}\n\nmodule.exports = require('./webex-node');\n\n/**\n * The date and time, specified in ISO 8601 extended offset date/time\n * format (e.g. `2015-10-18T14:26:16+00:00`).\n *\n * @typedef {string} isoDate\n */\n\n/**\n * An email address, as a string.\n * @typedef {string} email\n */\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA,IAAI,CAACA,MAAM,CAACC,cAAc,EAAE;EAC1B;EACAC,OAAO,CAAC,iBAAiB,CAAC;AAC5B;AAEAC,MAAM,CAACC,OAAO,GAAGF,OAAO,CAAC,cAAc,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Note: this file is written using commonjs instead of import/export to
|
|
8
|
+
// simplify consumption by those less familiar with the current state of
|
|
9
|
+
// JavaScript modularization
|
|
10
|
+
|
|
11
|
+
/* eslint camelcase: [0] */
|
|
12
|
+
|
|
13
|
+
require('@webex/plugin-authorization');
|
|
14
|
+
require('@webex/internal-plugin-calendar');
|
|
15
|
+
require('@webex/internal-plugin-device');
|
|
16
|
+
require('@webex/internal-plugin-presence');
|
|
17
|
+
require('@webex/internal-plugin-support');
|
|
18
|
+
require('@webex/internal-plugin-llm');
|
|
19
|
+
require('@webex/plugin-attachment-actions');
|
|
20
|
+
require('@webex/plugin-device-manager');
|
|
21
|
+
require('@webex/plugin-logger');
|
|
22
|
+
require('@webex/plugin-messages');
|
|
23
|
+
require('@webex/plugin-memberships');
|
|
24
|
+
require('@webex/plugin-people');
|
|
25
|
+
require('@webex/plugin-rooms');
|
|
26
|
+
require('@webex/plugin-teams');
|
|
27
|
+
require('@webex/plugin-team-memberships');
|
|
28
|
+
require('@webex/plugin-webhooks');
|
|
29
|
+
var merge = require('lodash/merge');
|
|
30
|
+
var WebexCore = require('@webex/webex-core').default;
|
|
31
|
+
var config = require('./config');
|
|
32
|
+
var WebexNode = WebexCore.extend({
|
|
33
|
+
webex: true,
|
|
34
|
+
version: "3.8.0-next.1"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a new {@link Webex} instance
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <caption>Create a new WebexNode instance configured for your OAuth client</caption>
|
|
42
|
+
* const webex = WebexNode.init({
|
|
43
|
+
* config: {
|
|
44
|
+
* credentials: {
|
|
45
|
+
* authorizationString: `<AUTHORIZATION URL FROM DEVELOPER PORTAL>`
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* <caption>Create a new WebexNode instance configured for a Bot</caption>
|
|
52
|
+
* const webex = WebexNode.init({
|
|
53
|
+
* credentials: `<BOT TOKEN FROM DEVELOPER PORTAL>`
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} attrs
|
|
58
|
+
* @param {Object} attrs.config (optional)
|
|
59
|
+
* @memberof Webex
|
|
60
|
+
* @returns {Webex}
|
|
61
|
+
*/
|
|
62
|
+
WebexNode.init = function init() {
|
|
63
|
+
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
64
|
+
attrs.config = merge({
|
|
65
|
+
sdkType: 'webex-node'
|
|
66
|
+
}, config, attrs.config); // eslint-disable-line no-param-reassign
|
|
67
|
+
|
|
68
|
+
return new WebexNode(attrs);
|
|
69
|
+
};
|
|
70
|
+
module.exports = WebexNode;
|
|
71
|
+
//# sourceMappingURL=webex-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["require","merge","WebexCore","default","config","WebexNode","extend","webex","version","init","attrs","arguments","length","undefined","sdkType","module","exports"],"sources":["webex-node.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n// Note: this file is written using commonjs instead of import/export to\n// simplify consumption by those less familiar with the current state of\n// JavaScript modularization\n\n/* eslint camelcase: [0] */\n\nrequire('@webex/plugin-authorization');\nrequire('@webex/internal-plugin-calendar');\nrequire('@webex/internal-plugin-device');\nrequire('@webex/internal-plugin-presence');\nrequire('@webex/internal-plugin-support');\nrequire('@webex/internal-plugin-llm');\nrequire('@webex/plugin-attachment-actions');\nrequire('@webex/plugin-device-manager');\nrequire('@webex/plugin-logger');\nrequire('@webex/plugin-messages');\nrequire('@webex/plugin-memberships');\nrequire('@webex/plugin-people');\nrequire('@webex/plugin-rooms');\nrequire('@webex/plugin-teams');\nrequire('@webex/plugin-team-memberships');\nrequire('@webex/plugin-webhooks');\n\nconst merge = require('lodash/merge');\nconst WebexCore = require('@webex/webex-core').default;\n\nconst config = require('./config');\n\nconst WebexNode = WebexCore.extend({\n webex: true,\n version: PACKAGE_VERSION,\n});\n\n/**\n * Create a new {@link Webex} instance\n *\n * @example\n * <caption>Create a new WebexNode instance configured for your OAuth client</caption>\n * const webex = WebexNode.init({\n * config: {\n * credentials: {\n * authorizationString: `<AUTHORIZATION URL FROM DEVELOPER PORTAL>`\n * }\n * }\n * });\n *\n * @example\n * <caption>Create a new WebexNode instance configured for a Bot</caption>\n * const webex = WebexNode.init({\n * credentials: `<BOT TOKEN FROM DEVELOPER PORTAL>`\n * });\n *\n *\n * @param {Object} attrs\n * @param {Object} attrs.config (optional)\n * @memberof Webex\n * @returns {Webex}\n */\nWebexNode.init = function init(attrs = {}) {\n attrs.config = merge(\n {\n sdkType: 'webex-node',\n },\n config,\n attrs.config\n ); // eslint-disable-line no-param-reassign\n\n return new WebexNode(attrs);\n};\n\nmodule.exports = WebexNode;\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEAA,OAAO,CAAC,6BAA6B,CAAC;AACtCA,OAAO,CAAC,iCAAiC,CAAC;AAC1CA,OAAO,CAAC,+BAA+B,CAAC;AACxCA,OAAO,CAAC,iCAAiC,CAAC;AAC1CA,OAAO,CAAC,gCAAgC,CAAC;AACzCA,OAAO,CAAC,4BAA4B,CAAC;AACrCA,OAAO,CAAC,kCAAkC,CAAC;AAC3CA,OAAO,CAAC,8BAA8B,CAAC;AACvCA,OAAO,CAAC,sBAAsB,CAAC;AAC/BA,OAAO,CAAC,wBAAwB,CAAC;AACjCA,OAAO,CAAC,2BAA2B,CAAC;AACpCA,OAAO,CAAC,sBAAsB,CAAC;AAC/BA,OAAO,CAAC,qBAAqB,CAAC;AAC9BA,OAAO,CAAC,qBAAqB,CAAC;AAC9BA,OAAO,CAAC,gCAAgC,CAAC;AACzCA,OAAO,CAAC,wBAAwB,CAAC;AAEjC,IAAMC,KAAK,GAAGD,OAAO,CAAC,cAAc,CAAC;AACrC,IAAME,SAAS,GAAGF,OAAO,CAAC,mBAAmB,CAAC,CAACG,OAAO;AAEtD,IAAMC,MAAM,GAAGJ,OAAO,CAAC,UAAU,CAAC;AAElC,IAAMK,SAAS,GAAGH,SAAS,CAACI,MAAM,CAAC;EACjCC,KAAK,EAAE,IAAI;EACXC,OAAO;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAH,SAAS,CAACI,IAAI,GAAG,SAASA,IAAIA,CAAA,EAAa;EAAA,IAAZC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACvCD,KAAK,CAACN,MAAM,GAAGH,KAAK,CAClB;IACEa,OAAO,EAAE;EACX,CAAC,EACDV,MAAM,EACNM,KAAK,CAACN,MACR,CAAC,CAAC,CAAC;;EAEH,OAAO,IAAIC,SAAS,CAACK,KAAK,CAAC;AAC7B,CAAC;AAEDK,MAAM,CAACC,OAAO,GAAGX,SAAS"}
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webex-node",
|
|
3
|
+
"description": "NodeJS SDK for Cisco Webex",
|
|
4
|
+
"license": "https://github.com/webex/webex-js-sdk/blob/next/LICENSE.md",
|
|
5
|
+
"contributors": [
|
|
6
|
+
"Sreekanth Narayanan <sreenara@cisco.com>"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js",
|
|
11
|
+
"./package": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"devMain": "src/index.js",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/webex/webex-js-sdk.git",
|
|
17
|
+
"directory": "packages/webex-node"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=16"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "yarn build:src",
|
|
24
|
+
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
25
|
+
"test": "yarn test:style && yarn test:unit",
|
|
26
|
+
"test:style": "eslint ./src/**/*.*",
|
|
27
|
+
"test:unit": "webex-legacy-tools test --unit --runner jest",
|
|
28
|
+
"deploy:npm": "yarn npm publish"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@webex/babel-config-legacy": "0.0.0",
|
|
32
|
+
"@webex/eslint-config-legacy": "0.0.0",
|
|
33
|
+
"@webex/jest-config-legacy": "0.0.0",
|
|
34
|
+
"@webex/legacy-tools": "0.0.0",
|
|
35
|
+
"@webex/test-helper-chai": "3.8.0-next.11",
|
|
36
|
+
"@webex/test-helper-file": "3.8.0-next.11",
|
|
37
|
+
"@webex/test-helper-mocha": "3.8.0-next.11",
|
|
38
|
+
"@webex/test-helper-mock-webex": "3.8.0-next.11",
|
|
39
|
+
"@webex/test-helper-test-users": "3.8.0-next.11",
|
|
40
|
+
"eslint": "^8.24.0",
|
|
41
|
+
"sinon": "^9.2.4"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@babel/polyfill": "^7.12.1",
|
|
45
|
+
"@babel/runtime-corejs2": "^7.14.8",
|
|
46
|
+
"@webex/common": "3.8.0-next.11",
|
|
47
|
+
"@webex/internal-plugin-calendar": "3.8.0-next.12",
|
|
48
|
+
"@webex/internal-plugin-device": "3.8.0-next.11",
|
|
49
|
+
"@webex/internal-plugin-llm": "3.8.0-next.13",
|
|
50
|
+
"@webex/internal-plugin-presence": "3.8.0-next.12",
|
|
51
|
+
"@webex/internal-plugin-support": "3.8.0-next.12",
|
|
52
|
+
"@webex/internal-plugin-voicea": "3.8.0-next.22",
|
|
53
|
+
"@webex/plugin-attachment-actions": "3.8.0-next.12",
|
|
54
|
+
"@webex/plugin-authorization": "3.8.0-next.12",
|
|
55
|
+
"@webex/plugin-device-manager": "3.8.0-next.13",
|
|
56
|
+
"@webex/plugin-logger": "3.8.0-next.11",
|
|
57
|
+
"@webex/plugin-memberships": "3.8.0-next.12",
|
|
58
|
+
"@webex/plugin-messages": "3.8.0-next.12",
|
|
59
|
+
"@webex/plugin-people": "3.8.0-next.12",
|
|
60
|
+
"@webex/plugin-rooms": "3.8.0-next.12",
|
|
61
|
+
"@webex/plugin-team-memberships": "3.8.0-next.12",
|
|
62
|
+
"@webex/plugin-teams": "3.8.0-next.12",
|
|
63
|
+
"@webex/plugin-webhooks": "3.8.0-next.12",
|
|
64
|
+
"@webex/storage-adapter-local-storage": "3.8.0-next.11",
|
|
65
|
+
"@webex/webex-core": "3.8.0-next.11",
|
|
66
|
+
"lodash": "^4.17.21"
|
|
67
|
+
},
|
|
68
|
+
"version": "3.8.0-next.1"
|
|
69
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import WebexCore from '@webex/webex-core';
|
|
6
|
+
|
|
7
|
+
const {MemoryStoreAdapter} = WebexCore;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
boundedAdapter: MemoryStoreAdapter,
|
|
11
|
+
unboundedAdapter: MemoryStoreAdapter,
|
|
12
|
+
};
|
package/src/config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/extensions
|
|
6
|
+
import storageConfig from './config-storage.js';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
hydra: process.env.HYDRA_SERVICE_URL || 'https://webexapis.com/v1',
|
|
10
|
+
hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://webexapis.com/v1',
|
|
11
|
+
credentials: {
|
|
12
|
+
clientType: 'confidential',
|
|
13
|
+
},
|
|
14
|
+
device: {
|
|
15
|
+
validateDomains: true,
|
|
16
|
+
ephemeral: true,
|
|
17
|
+
},
|
|
18
|
+
storage: {
|
|
19
|
+
boundedAdapter: storageConfig,
|
|
20
|
+
unboundedAdapter: storageConfig,
|
|
21
|
+
},
|
|
22
|
+
};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* istanbul ignore else */
|
|
6
|
+
if (!global._babelPolyfill) {
|
|
7
|
+
/* eslint global-require: [0] */
|
|
8
|
+
require('@babel/polyfill');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = require('./webex-node');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The date and time, specified in ISO 8601 extended offset date/time
|
|
15
|
+
* format (e.g. `2015-10-18T14:26:16+00:00`).
|
|
16
|
+
*
|
|
17
|
+
* @typedef {string} isoDate
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An email address, as a string.
|
|
22
|
+
* @typedef {string} email
|
|
23
|
+
*/
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Note: this file is written using commonjs instead of import/export to
|
|
6
|
+
// simplify consumption by those less familiar with the current state of
|
|
7
|
+
// JavaScript modularization
|
|
8
|
+
|
|
9
|
+
/* eslint camelcase: [0] */
|
|
10
|
+
|
|
11
|
+
require('@webex/plugin-authorization');
|
|
12
|
+
require('@webex/internal-plugin-calendar');
|
|
13
|
+
require('@webex/internal-plugin-device');
|
|
14
|
+
require('@webex/internal-plugin-presence');
|
|
15
|
+
require('@webex/internal-plugin-support');
|
|
16
|
+
require('@webex/internal-plugin-llm');
|
|
17
|
+
require('@webex/plugin-attachment-actions');
|
|
18
|
+
require('@webex/plugin-device-manager');
|
|
19
|
+
require('@webex/plugin-logger');
|
|
20
|
+
require('@webex/plugin-messages');
|
|
21
|
+
require('@webex/plugin-memberships');
|
|
22
|
+
require('@webex/plugin-people');
|
|
23
|
+
require('@webex/plugin-rooms');
|
|
24
|
+
require('@webex/plugin-teams');
|
|
25
|
+
require('@webex/plugin-team-memberships');
|
|
26
|
+
require('@webex/plugin-webhooks');
|
|
27
|
+
|
|
28
|
+
const merge = require('lodash/merge');
|
|
29
|
+
const WebexCore = require('@webex/webex-core').default;
|
|
30
|
+
|
|
31
|
+
const config = require('./config');
|
|
32
|
+
|
|
33
|
+
const WebexNode = WebexCore.extend({
|
|
34
|
+
webex: true,
|
|
35
|
+
version: PACKAGE_VERSION,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new {@link Webex} instance
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <caption>Create a new WebexNode instance configured for your OAuth client</caption>
|
|
43
|
+
* const webex = WebexNode.init({
|
|
44
|
+
* config: {
|
|
45
|
+
* credentials: {
|
|
46
|
+
* authorizationString: `<AUTHORIZATION URL FROM DEVELOPER PORTAL>`
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* <caption>Create a new WebexNode instance configured for a Bot</caption>
|
|
53
|
+
* const webex = WebexNode.init({
|
|
54
|
+
* credentials: `<BOT TOKEN FROM DEVELOPER PORTAL>`
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} attrs
|
|
59
|
+
* @param {Object} attrs.config (optional)
|
|
60
|
+
* @memberof Webex
|
|
61
|
+
* @returns {Webex}
|
|
62
|
+
*/
|
|
63
|
+
WebexNode.init = function init(attrs = {}) {
|
|
64
|
+
attrs.config = merge(
|
|
65
|
+
{
|
|
66
|
+
sdkType: 'webex-node',
|
|
67
|
+
},
|
|
68
|
+
config,
|
|
69
|
+
attrs.config
|
|
70
|
+
); // eslint-disable-line no-param-reassign
|
|
71
|
+
|
|
72
|
+
return new WebexNode(attrs);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
module.exports = WebexNode;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import WebexNode from '../../../src/webex-node';
|
|
2
|
+
// const defaultConfig = require('../../../src/config'); // Use if you need to inspect config defaults
|
|
3
|
+
|
|
4
|
+
describe('WebexNode', () => {
|
|
5
|
+
describe('init()', () => {
|
|
6
|
+
it('should create an instance of WebexNode with default configuration', () => {
|
|
7
|
+
const instance = WebexNode.init();
|
|
8
|
+
expect(typeof instance).toBe('object');
|
|
9
|
+
// Verify that the expected property exists; adjust as appropriate if your implementation differs.
|
|
10
|
+
expect(instance.webex).toBe(true);
|
|
11
|
+
expect(instance.config).toBeInstanceOf(Object);
|
|
12
|
+
expect(instance.config.sdkType).toBe('webex-node');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should merge user provided config with the default configuration', () => {
|
|
16
|
+
const customConfig = {foo: 'bar'};
|
|
17
|
+
const instance = WebexNode.init({config: customConfig});
|
|
18
|
+
expect(instance.config).toBeInstanceOf(Object);
|
|
19
|
+
// The default value should still be present.
|
|
20
|
+
expect(instance.config.sdkType).toBe('webex-node');
|
|
21
|
+
// The custom config property must be merged.
|
|
22
|
+
expect(instance.config.foo).toBe('bar');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should override default config with user provided configuration', () => {
|
|
26
|
+
const customConfig = {sdkType: 'custom-node', extra: 'value'};
|
|
27
|
+
const instance = WebexNode.init({config: customConfig});
|
|
28
|
+
expect(instance.config).toBeInstanceOf(Object);
|
|
29
|
+
// Since custom config should override default for matching keys.
|
|
30
|
+
expect(instance.config.sdkType).toBe('custom-node');
|
|
31
|
+
expect(instance.config.extra).toBe('value');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('fedramp', () => {
|
|
36
|
+
let webex;
|
|
37
|
+
|
|
38
|
+
const fedramp = {
|
|
39
|
+
hydra: 'https://api-usgov.webex.com/v1',
|
|
40
|
+
u2c: 'https://u2c.gov.ciscospark.com/u2c/api/v1',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
it('is set false by default', () => {
|
|
44
|
+
webex = new WebexNode();
|
|
45
|
+
expect(webex.config.fedramp).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('sets correct services when fedramp is true', () => {
|
|
49
|
+
webex = WebexNode.init({
|
|
50
|
+
config: {
|
|
51
|
+
fedramp: true,
|
|
52
|
+
},
|
|
53
|
+
credentials: {
|
|
54
|
+
access_token: process.env.token,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
expect(webex.config).toHaveProperty('fedramp');
|
|
59
|
+
expect(webex.config.fedramp).toBe(true);
|
|
60
|
+
expect(webex.config.services).toHaveProperty('discovery');
|
|
61
|
+
expect(webex.config.services.discovery.hydra).toBe(fedramp.hydra);
|
|
62
|
+
expect(webex.config.services.discovery.u2c).toBe(fedramp.u2c);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|