@webex/internal-plugin-board 3.12.0 → 3.13.0-next.10
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/.repo-context.json +477 -0
- package/.sdd/manifest.json +480 -0
- package/AGENTS.md +205 -0
- package/dist/board.js +46 -5
- package/dist/board.js.map +1 -1
- package/dist/realtime.js +1 -1
- package/docs/adr/0001-retain-product-readme.md +92 -0
- package/docs/adr/index.md +25 -0
- package/docs/architecture.md +294 -0
- package/docs/getting-started.md +101 -0
- package/docs/index.md +42 -0
- package/docs/specs/README.md +66 -0
- package/package.json +13 -13
- package/schemas/repo-context.schema.json +796 -0
- package/src/board.js +53 -9
- package/src/docs/README.md +554 -0
- package/test/unit/spec/board.js +167 -3
package/src/board.js
CHANGED
|
@@ -116,14 +116,22 @@ const Board = WebexPlugin.extend({
|
|
|
116
116
|
* @returns {Promise<Board~Channel>}
|
|
117
117
|
*/
|
|
118
118
|
createChannel(conversation, channel) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
const params = {
|
|
120
|
+
method: 'POST',
|
|
121
|
+
resource: '/channels',
|
|
122
|
+
body: this._prepareChannel(conversation, channel),
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const boardServiceUrl = this.getClusterBoardServiceUrl(conversation);
|
|
126
|
+
|
|
127
|
+
if (boardServiceUrl) {
|
|
128
|
+
params.uri = `${boardServiceUrl}${params.resource}`;
|
|
129
|
+
delete params.resource;
|
|
130
|
+
} else {
|
|
131
|
+
params.api = 'board';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return this.webex.request(params).then((res) => res.body);
|
|
127
135
|
},
|
|
128
136
|
|
|
129
137
|
/**
|
|
@@ -464,6 +472,34 @@ const Board = WebexPlugin.extend({
|
|
|
464
472
|
.then((res) => res.body);
|
|
465
473
|
},
|
|
466
474
|
|
|
475
|
+
/**
|
|
476
|
+
* Resolve the board service url co-located with the conversation's ACL cluster.
|
|
477
|
+
* Board data lives in the cluster encoded by the ACL url; hitting the home board
|
|
478
|
+
* cluster instead triggers a cross-cluster 307 the browser cannot follow.
|
|
479
|
+
* @memberof Board.BoardService
|
|
480
|
+
* @param {Conversation~ConversationObject} conversation
|
|
481
|
+
* @returns {string|undefined} board API base url for the conversation's cluster
|
|
482
|
+
*/
|
|
483
|
+
getClusterBoardServiceUrl(conversation = {}) {
|
|
484
|
+
const {aclUrl} = conversation;
|
|
485
|
+
|
|
486
|
+
if (!aclUrl) {
|
|
487
|
+
return undefined;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const {services} = this.webex.internal;
|
|
491
|
+
const clusterId = services.getClusterId(aclUrl);
|
|
492
|
+
|
|
493
|
+
if (!clusterId) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Swap the trailing service token (e.g. `acl-write`) for the board API token.
|
|
498
|
+
const boardClusterId = [...clusterId.split(':').slice(0, -1), 'board'].join(':');
|
|
499
|
+
|
|
500
|
+
return services.getServiceFromClusterId({clusterId: boardClusterId})?.url;
|
|
501
|
+
},
|
|
502
|
+
|
|
467
503
|
/**
|
|
468
504
|
* Gets Channels
|
|
469
505
|
* @memberof Board.BoardService
|
|
@@ -481,7 +517,6 @@ const Board = WebexPlugin.extend({
|
|
|
481
517
|
}
|
|
482
518
|
|
|
483
519
|
const params = {
|
|
484
|
-
api: 'board',
|
|
485
520
|
resource: '/channels',
|
|
486
521
|
qs: {
|
|
487
522
|
aclUrlLink: conversation.aclUrl,
|
|
@@ -490,6 +525,15 @@ const Board = WebexPlugin.extend({
|
|
|
490
525
|
|
|
491
526
|
assign(params.qs, pick(options, 'channelsLimit', 'type'));
|
|
492
527
|
|
|
528
|
+
const boardServiceUrl = this.getClusterBoardServiceUrl(conversation);
|
|
529
|
+
|
|
530
|
+
if (boardServiceUrl) {
|
|
531
|
+
params.uri = `${boardServiceUrl}${params.resource}`;
|
|
532
|
+
delete params.resource;
|
|
533
|
+
} else {
|
|
534
|
+
params.api = 'board';
|
|
535
|
+
}
|
|
536
|
+
|
|
493
537
|
return this.request(params).then((res) => new Page(res, this.webex));
|
|
494
538
|
},
|
|
495
539
|
|