@webex/internal-plugin-board 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/src/config.js CHANGED
@@ -1,44 +1,44 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- export default {
6
- board: {
7
- /**
8
- * Number of contents per batch when adding contents to a channel
9
- * @type {number}
10
- */
11
- numberContentsPerPageForAdd: 150,
12
-
13
- /**
14
- * Number of contents per batch when getting contents from a channel
15
- * @type {number}
16
- */
17
- numberContentsPerPageForGet: 1000,
18
-
19
- /**
20
- * Milliseconds between pings sent up the socket
21
- * @type {number}
22
- */
23
- pingInterval: process.env.MERCURY_PING_INTERVAL || 15000,
24
-
25
- /**
26
- * Milliseconds to wait for a pong before declaring the connection dead
27
- * @type {number}
28
- */
29
- pongTimeout: process.env.MERCURY_PONG_TIMEOUT || 14000,
30
-
31
- /**
32
- * Milliseconds to wait for a close frame before declaring the socket dead and
33
- * discarding it
34
- * @type {[type]}
35
- */
36
- forceCloseDelay: process.env.MERCURY_FORCE_CLOSE_DELAY || 2000,
37
-
38
- /**
39
- * The prefix for board binding when open a new socket connection
40
- * @type {string}
41
- */
42
- mercuryBindingPrefix: 'board.',
43
- },
44
- };
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ export default {
6
+ board: {
7
+ /**
8
+ * Number of contents per batch when adding contents to a channel
9
+ * @type {number}
10
+ */
11
+ numberContentsPerPageForAdd: 150,
12
+
13
+ /**
14
+ * Number of contents per batch when getting contents from a channel
15
+ * @type {number}
16
+ */
17
+ numberContentsPerPageForGet: 1000,
18
+
19
+ /**
20
+ * Milliseconds between pings sent up the socket
21
+ * @type {number}
22
+ */
23
+ pingInterval: process.env.MERCURY_PING_INTERVAL || 15000,
24
+
25
+ /**
26
+ * Milliseconds to wait for a pong before declaring the connection dead
27
+ * @type {number}
28
+ */
29
+ pongTimeout: process.env.MERCURY_PONG_TIMEOUT || 14000,
30
+
31
+ /**
32
+ * Milliseconds to wait for a close frame before declaring the socket dead and
33
+ * discarding it
34
+ * @type {[type]}
35
+ */
36
+ forceCloseDelay: process.env.MERCURY_FORCE_CLOSE_DELAY || 2000,
37
+
38
+ /**
39
+ * The prefix for board binding when open a new socket connection
40
+ * @type {string}
41
+ */
42
+ mercuryBindingPrefix: 'board.',
43
+ },
44
+ };
package/src/index.js CHANGED
@@ -1,105 +1,105 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import '@webex/internal-plugin-mercury';
6
- import '@webex/internal-plugin-encryption';
7
- import '@webex/internal-plugin-conversation';
8
- import '@webex/internal-plugin-feature';
9
-
10
- import {registerInternalPlugin} from '@webex/webex-core';
11
- import {has, get} from 'lodash';
12
-
13
- import Board from './board';
14
- import RealtimeChannel from './realtime-channel';
15
- import config from './config';
16
-
17
- registerInternalPlugin('board', Board, {
18
- config,
19
- payloadTransformer: {
20
- predicates: [
21
- {
22
- name: 'decryptContents',
23
- direction: 'inbound',
24
-
25
- test(ctx, options) {
26
- // we must have items
27
- if (!has(options, 'body.items') || options.body.items.length === 0) {
28
- return Promise.resolve(false);
29
- }
30
-
31
- // we must have a contentId
32
- if (!get(options, 'body.items[0].contentId')) {
33
- return Promise.resolve(false);
34
- }
35
-
36
- // we must have a encryptionKeyUrl
37
- /* istanbul ignore if */
38
- if (!get(options, 'body.items[0].encryptionKeyUrl')) {
39
- return Promise.resolve(false);
40
- }
41
-
42
- // we must have a payload or file
43
- /* istanbul ignore if */
44
- if (!get(options, 'body.items[0].payload') && !get(options, 'body.items[0].file')) {
45
- return Promise.resolve(false);
46
- }
47
-
48
- return Promise.resolve(true);
49
- },
50
-
51
- extract(options) {
52
- return Promise.resolve(options.body);
53
- },
54
- },
55
- {
56
- name: 'encryptChannel',
57
- direction: 'outbound',
58
-
59
- test(ctx, options) {
60
- const service = ctx.webex.internal.services.getServiceFromUrl(options.uri);
61
-
62
- if (service && service.name === 'board' && has(options, 'body.aclUrlLink')) {
63
- return Promise.resolve(true);
64
- }
65
-
66
- return Promise.resolve(false);
67
- },
68
-
69
- extract(options) {
70
- return Promise.resolve(options.body);
71
- },
72
- },
73
- ],
74
- transforms: [
75
- {
76
- name: 'decryptContents',
77
- direction: 'inbound',
78
-
79
- fn(ctx, object) {
80
- return ctx.webex.internal.board.decryptContents(object).then((decryptedContents) => {
81
- object.items = decryptedContents;
82
- });
83
- },
84
- },
85
- {
86
- name: 'encryptChannel',
87
- direciton: 'outbound',
88
- fn(ctx, object) {
89
- return ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => {
90
- const key = keys[0];
91
-
92
- object.defaultEncryptionKeyUrl = key.uri;
93
- object.kmsMessage.keyUris.push(key.uri);
94
-
95
- return ctx.transform('encryptKmsMessage', object);
96
- });
97
- },
98
- },
99
- ],
100
- },
101
- });
102
-
103
- export {default} from './board';
104
- export {config};
105
- export {RealtimeChannel};
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import '@webex/internal-plugin-mercury';
6
+ import '@webex/internal-plugin-encryption';
7
+ import '@webex/internal-plugin-conversation';
8
+ import '@webex/internal-plugin-feature';
9
+
10
+ import {registerInternalPlugin} from '@webex/webex-core';
11
+ import {has, get} from 'lodash';
12
+
13
+ import Board from './board';
14
+ import RealtimeChannel from './realtime-channel';
15
+ import config from './config';
16
+
17
+ registerInternalPlugin('board', Board, {
18
+ config,
19
+ payloadTransformer: {
20
+ predicates: [
21
+ {
22
+ name: 'decryptContents',
23
+ direction: 'inbound',
24
+
25
+ test(ctx, options) {
26
+ // we must have items
27
+ if (!has(options, 'body.items') || options.body.items.length === 0) {
28
+ return Promise.resolve(false);
29
+ }
30
+
31
+ // we must have a contentId
32
+ if (!get(options, 'body.items[0].contentId')) {
33
+ return Promise.resolve(false);
34
+ }
35
+
36
+ // we must have a encryptionKeyUrl
37
+ /* istanbul ignore if */
38
+ if (!get(options, 'body.items[0].encryptionKeyUrl')) {
39
+ return Promise.resolve(false);
40
+ }
41
+
42
+ // we must have a payload or file
43
+ /* istanbul ignore if */
44
+ if (!get(options, 'body.items[0].payload') && !get(options, 'body.items[0].file')) {
45
+ return Promise.resolve(false);
46
+ }
47
+
48
+ return Promise.resolve(true);
49
+ },
50
+
51
+ extract(options) {
52
+ return Promise.resolve(options.body);
53
+ },
54
+ },
55
+ {
56
+ name: 'encryptChannel',
57
+ direction: 'outbound',
58
+
59
+ test(ctx, options) {
60
+ const service = ctx.webex.internal.services.getServiceFromUrl(options.uri);
61
+
62
+ if (service && service.name === 'board' && has(options, 'body.aclUrlLink')) {
63
+ return Promise.resolve(true);
64
+ }
65
+
66
+ return Promise.resolve(false);
67
+ },
68
+
69
+ extract(options) {
70
+ return Promise.resolve(options.body);
71
+ },
72
+ },
73
+ ],
74
+ transforms: [
75
+ {
76
+ name: 'decryptContents',
77
+ direction: 'inbound',
78
+
79
+ fn(ctx, object) {
80
+ return ctx.webex.internal.board.decryptContents(object).then((decryptedContents) => {
81
+ object.items = decryptedContents;
82
+ });
83
+ },
84
+ },
85
+ {
86
+ name: 'encryptChannel',
87
+ direciton: 'outbound',
88
+ fn(ctx, object) {
89
+ return ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => {
90
+ const key = keys[0];
91
+
92
+ object.defaultEncryptionKeyUrl = key.uri;
93
+ object.kmsMessage.keyUris.push(key.uri);
94
+
95
+ return ctx.transform('encryptKmsMessage', object);
96
+ });
97
+ },
98
+ },
99
+ ],
100
+ },
101
+ });
102
+
103
+ export {default} from './board';
104
+ export {config};
105
+ export {RealtimeChannel};
@@ -1,18 +1,18 @@
1
- /** !
2
- *
3
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
4
- * @private
5
- */
6
-
7
- import AmpCollection from 'ampersand-collection';
8
-
9
- import RealtimeChannel from './realtime-channel';
10
-
11
- const RealtimeChannelCollection = AmpCollection.extend({
12
- mainIndex: 'channelId',
13
- model: RealtimeChannel,
14
-
15
- namespace: 'Board',
16
- });
17
-
18
- export default RealtimeChannelCollection;
1
+ /** !
2
+ *
3
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
4
+ * @private
5
+ */
6
+
7
+ import AmpCollection from 'ampersand-collection';
8
+
9
+ import RealtimeChannel from './realtime-channel';
10
+
11
+ const RealtimeChannelCollection = AmpCollection.extend({
12
+ mainIndex: 'channelId',
13
+ model: RealtimeChannel,
14
+
15
+ namespace: 'Board',
16
+ });
17
+
18
+ export default RealtimeChannelCollection;
@@ -1,40 +1,40 @@
1
- /** !
2
- *
3
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
4
- * @private
5
- */
6
-
7
- import {Mercury} from '@webex/internal-plugin-mercury';
8
-
9
- const RealtimeChannel = Mercury.extend({
10
- namespace: 'Board',
11
-
12
- props: {
13
- channelId: {
14
- type: 'string',
15
- required: true,
16
- },
17
- socketUrl: {
18
- type: 'string',
19
- },
20
- binding: {
21
- type: 'string',
22
- },
23
- },
24
-
25
- session: {
26
- isSharingMercury: {
27
- type: 'boolean',
28
- default: false,
29
- },
30
- socket: {
31
- type: 'object',
32
- },
33
- },
34
-
35
- send(data) {
36
- return this.socket.send(data);
37
- },
38
- });
39
-
40
- export default RealtimeChannel;
1
+ /** !
2
+ *
3
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
4
+ * @private
5
+ */
6
+
7
+ import {Mercury} from '@webex/internal-plugin-mercury';
8
+
9
+ const RealtimeChannel = Mercury.extend({
10
+ namespace: 'Board',
11
+
12
+ props: {
13
+ channelId: {
14
+ type: 'string',
15
+ required: true,
16
+ },
17
+ socketUrl: {
18
+ type: 'string',
19
+ },
20
+ binding: {
21
+ type: 'string',
22
+ },
23
+ },
24
+
25
+ session: {
26
+ isSharingMercury: {
27
+ type: 'boolean',
28
+ default: false,
29
+ },
30
+ socket: {
31
+ type: 'object',
32
+ },
33
+ },
34
+
35
+ send(data) {
36
+ return this.socket.send(data);
37
+ },
38
+ });
39
+
40
+ export default RealtimeChannel;