@webex/plugin-teams 3.13.0-next.3 → 3.13.0-next.5

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.
@@ -0,0 +1,288 @@
1
+ ---
2
+ type: Module Spec
3
+ title: 'Teams plugin specification'
4
+ description: Responsibilities, boundaries, design, failure modes, and verification for the Teams plugin module.
5
+ tags: [module, specification]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: module-spec
9
+ generated_from: module-spec@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rarajes2@cisco.com
12
+ updated_at: 2026-11-12T17:50:28Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # Teams plugin
17
+
18
+ This source-local document at `src/docs/README.md` owns the stable specification for **the Teams
19
+ plugin**: the public plugin `webex.teams`. It creates, reads, lists, and updates Webex teams through the
20
+ `teams` resource of the Webex REST API (catalog service `hydra`). Each method sends one request and
21
+ resolves what the service returns. Ground every claim in package evidence and link to the
22
+ [package architecture](../../docs/architecture.md) instead of repeating broader facts. No service
23
+ specification exists because this package is a library.
24
+
25
+ Related context: [documentation index](../../docs/index.md) ·
26
+ [package agent instructions](../../AGENTS.md)
27
+
28
+ ## Metadata
29
+
30
+ | Field | Value |
31
+ | ----------------- | ----- |
32
+ | Owner | @webex/web-sdk |
33
+ | Source path | `src` |
34
+ | Resource kind | package |
35
+ | Status | Draft |
36
+ | Last verified | 2026-11-12 at `46f5268b3a` |
37
+ | Module id | `plugin-teams` |
38
+ | Parent spec | — |
39
+ | Doc kind | Module spec |
40
+ | Coverage score | 100% assessed 2026-11-12 by the generator — 11 of 11 mandatory fields PRESENT, critical 6 of 6; the package has no unit tests and no `test:unit` script, so no requirement has running test evidence; `test/integration/spec/teams.js` holds 9 live-service cases (2 skipped) that no script runs |
41
+ | Validation status | Pass with warnings — 2026-11-12; validator runtime `01a1d0dc-f5ef-76b0-8766-2a81183f4462`; 0 Blocking, 0 Important, 0 Medium, 1 Minor. Code and spec match; no runnable unit suite, and the integration suite currently runs no cases. |
42
+
43
+ ## Applicability
44
+
45
+ | Condition ID | Status | Evidence or reason | Owned section |
46
+ | ------------------------------------ | ---------- | ------------------ | ------------- |
47
+ | `module.has_tiers` | N/A | No tier policy exists in `package.json` or `src/teams.js` | Tier |
48
+ | `module.has_ui` | N/A | `src/teams.js` returns team records; it renders nothing | UI use-case flow |
49
+ | `module.crosses_service_boundaries` | Applicable | `src/teams.js` calls the Webex REST API teams resource through webex.request | Cross-boundary use-case flow |
50
+ | `module.holds_client_state` | N/A | `src/teams.js` sets no instance property and caches no record | Client state model |
51
+ | `module.enforces_domain_rules` | N/A | `src/teams.js` checks no argument and enforces no rule; it forwards the caller's object to the service, which is the referee | Business rules and invariants |
52
+ | `module.is_concurrent_async` | Applicable | Every method in `src/teams.js` returns the promise of a request | Concurrency and reactive flow |
53
+ | `module.owns_persistence` | N/A | Nothing is stored; `src/teams.js` resolves what the service returns | Data, schema, and migration discipline |
54
+ | `module.stateful_transitions` | N/A | No entity moves through states in `src/teams.js` | State machine |
55
+ | `module.exposes_wire_protocol` | Applicable | The four teams requests and the team object passed through `src/teams.js` | Protocol and wire format |
56
+ | `module.ui_multi_screen` | N/A | No UI | UI flow |
57
+ | `module.large_data_model` | N/A | One shape, the team object, typed only by the JSDoc typedef in `src/teams.js`; covered under Protocol and wire format | Data model |
58
+ | `module.returns_caller_errors` | Applicable | Request failures reject, and a missing argument throws, in `src/teams.js` | Caller-visible failure modes |
59
+ | `module.module_specific_conventions` | Applicable | Every request goes through this.request with service hydra and a teams resource path in `src/teams.js` | Module-specific rules |
60
+ | `module.published_package` | Applicable | `package.json` names the package @webex/plugin-teams and defines deploy:npm | Export stability |
61
+ | `module.embedded_in_host` | N/A | No host theme or embed API | Host integration and theming |
62
+ | `module.has_design_tradeoff` | N/A | Each method in `src/teams.js` is one request; neither code nor comments state a design choice to preserve | Key design trade-off |
63
+ | `module.has_submodules` | N/A | The src directory has no child module | Sub-modules |
64
+
65
+ ## Evidence register
66
+
67
+ | Evidence | What it establishes |
68
+ | -------- | ------------------- |
69
+ | `src/index.js` | `registerPlugin('teams', Teams)` with no options; re-exports only the default `Teams` |
70
+ | `src/teams.js` | `Teams` extends `WebexPlugin` with `create`, `get`, `list`, and `update`; the `TeamObject` typedef (`id`, `name`, `created`). Its JSDoc is the only recorded rationale |
71
+ | `package.json` | Name, `main` (`dist/index.js`), `devMain` (`src/index.js`), `engines` (`node >=16`), dependencies, peer dependencies on `@webex/plugin-logger`, `@webex/plugin-memberships`, and `@webex/plugin-rooms`, and scripts; `build`, `build:src`, `test:style`, `test:browser:broken`, `deploy:npm`, and `test` exist, and `test:unit`, `test:integration`, and `test:browser` do not |
72
+ | `test/integration/spec/teams.js` | 9 live-service cases (2 skipped): `create`, `get` with a team object, `list` with and without `max` and paging, `update` of the name, and rooms created in a team through `webex.rooms` (create skipped, get, a skipped leave-the-general-room case, list); no package script runs it (see Verification) |
73
+ | `README.md` | Retained npm page; context only. Its one example, `webex.teams.get(id)`, matches the code; see `docs/adr/0001-retain-product-readme.md` |
74
+ | Sibling package webex-core, file src/docs/README.md | Module spec consulted, agrees with code. `registerPlugin` keeps the first registration of a name (MOD-013) and adds `webex.<name>` to later instances (MOD-014); a plugin's `this.request({service, resource})` passes through the interceptor chain, and a failure rejects with a `WebexHttpError` carrying the options and body (UC-004, MOD-048); `Page` stores the body `items` and the parsed Link headers, and `next`, `previous`, `hasNext`, and `hasPrevious` follow them (MOD-054, MOD-055). Its file src/lib/page.js was read to confirm the constructor reads `res.body.items` and `res.headers.link` |
75
+ | Sibling package plugin-rooms, file src/docs/README.md | Module spec consulted, for the integration spec only: `create` sends the body as given (MOD-002) and `list` sends every option as a query parameter (MOD-004), so `teamId` reaches the rooms resource |
76
+ | Sibling package test-helper-chai, file src/assertions/schemas.js | No spec; code read. `isTeam` asserts `id` is a Hydra id, `name` a string, and `created` an ISO date; `isTeamRoom` asserts a room that has `teamId` |
77
+ | Observation, no stated WHY | Behavior the code shows without stating a reason is recorded once, under Pitfalls and constraints or Caller-visible failure modes |
78
+
79
+ ## Purpose and boundary
80
+
81
+ - Responsibility: give applications Webex teams as Hydra records — create, read, list, and update.
82
+ - In scope: registration of `teams`; the four public methods; turning a team object or an id into a
83
+ request path.
84
+ - Out of scope: the request pipeline, authorization, service-catalog resolution, and paging
85
+ (`@webex/webex-core`); rooms inside a team (`webex.rooms` with `teamId`, plugin-rooms); team
86
+ membership (plugin-team-memberships); deleting a team, which this plugin does not offer; validating
87
+ team bodies; caching team records; what Hydra stores or returns.
88
+ - Consumers: in this repository `webex` (`src/webex.js`) and `webex-node` (`src/webex-node.js`) require
89
+ the package to register it. No file under another package's `src/` calls `webex.teams`;
90
+ plugin-team-memberships names it only in JSDoc examples, and its integration spec calls it. No
91
+ workspace sample uses it. Applications reach the plugin as `webex.teams`.
92
+
93
+ ## Structure and key files
94
+
95
+ | Path | Responsibility |
96
+ | ---- | -------------- |
97
+ | `src/index.js` | Registers public plugin `teams` and re-exports the class as default |
98
+ | `src/teams.js` | `Teams` and the `TeamObject` typedef |
99
+ | `package.json` | Package name, entry points, scripts, dependencies, and peer dependencies |
100
+ | `babel.config.js`, `jest.config.js` | Re-exports of the legacy Babel and Jest configurations; no unit spec uses the Jest one |
101
+ | `.eslintrc.js` | Sets `root: true` and extends `@webex/eslint-config-legacy` |
102
+ | `process` | Package-root file exporting `{browser: true}`; not imported by `src/` |
103
+ | `src/docs/README.md` | This module specification; ignored by the build and by lint |
104
+ | `test/integration/spec/teams.js` | Live-service cases; only `test:browser:broken` would run them |
105
+ | dist/ (generated) | Build output of `build:src`; ignored by Git and never edited by hand |
106
+
107
+ ## Public surface
108
+
109
+ | Surface | Consumer | Compatibility commitment | Source |
110
+ | ------- | -------- | ------------------------ | ------ |
111
+ | Import side effect: public plugin `teams` | `webex`, `webex-node` | First registration of the name wins; reached as `webex.teams` | `src/index.js` |
112
+ | `create(team)`, `get(team, options)`, `list(options)`, `update(team)` | Applications | Hydra team records; `list` resolves a webex-core `Page` | `src/teams.js` |
113
+ | Default export `Teams` | Hosts that mount the class themselves | The entry exports nothing else | `src/index.js` |
114
+
115
+ The plugin triggers no event. Contract ID `teams-public-sdk` is indexed in the
116
+ [package architecture](../../docs/architecture.md#public-and-consumer-surfaces) and registered in
117
+ `.sdd/manifest.json`. Export stability is under [Export stability](#export-stability).
118
+
119
+ ## Dependencies
120
+
121
+ | Dependency | Why it is required | Failure behavior |
122
+ | ---------- | ------------------ | ---------------- |
123
+ | `@webex/webex-core` plugin host (module spec consulted) | `registerPlugin`, `WebexPlugin` (`webex` and `request`), and `Page` | A request failure rejects the method with a `WebexHttpError` |
124
+ | `@webex/webex-core` services (through `request`) | Resolves `service: 'hydra'` to the catalog URL | A catalog failure rejects the request |
125
+ | `@webex/internal-plugin-device` | Declared in `dependencies`; not imported by `src/`, only by the integration spec | — |
126
+ | `lodash` | Declared in `dependencies`; not imported by `src/`, only by the integration spec (`find`) | — |
127
+ | `@webex/plugin-rooms`, `@webex/plugin-memberships`, `@webex/plugin-logger` (peer dependencies) | Imported only by the integration spec, for rooms in a team and the skipped leave case; `src/` never reaches `webex.rooms`, `webex.memberships`, or `webex.logger` | — |
128
+ | Webex REST API teams resource (external) | Team records | Errors propagate |
129
+
130
+ ## Requirements
131
+
132
+ | ID | WHAT | WHY | Source evidence | Test or example evidence | Assumptions or gaps | Confidence |
133
+ | -- | ---- | --- | --------------- | ------------------------ | ------------------- | ---------- |
134
+ | `MOD-001` | Importing the package registers `Teams` as public plugin `teams` with no config or other options. The entry re-exports only the default `Teams`. | Applications reach teams as `webex.teams`, as the README usage shows; the `webex` and `webex-node` bundles require the package for this registration (inferred). | `src/index.js` | `test/integration/spec/teams.js` imports the package and calls `webex.teams`, but is not run | WHY inferred | Weak |
135
+ | `MOD-002` | `create(team)` sends `POST teams` to service `hydra` with `team` as the body through `this.request` and resolves the response body. | The JSDoc: create a new team; its example expects `id`, `name`, and `created` back. | `src/teams.js` | `test/integration/spec/teams.js` create case asserts `isTeam` (not run) | — | Present |
136
+ | `MOD-003` | `get(team, options)` takes `team.id`, else `team` itself, sends `GET teams/<id>` to service `hydra` with `qs: options`, and resolves `res.body.items` when present, else `res.body`. | The JSDoc: returns a single team, given a `TeamObject` or a string. | `src/teams.js` | `test/integration/spec/teams.js` get case passes `{id}` and compares the result with the created team (not run) | Why `items` is checked is not stated; a body carrying `items` resolves that array instead of a team | Present |
137
+ | `MOD-004` | `list(options)` sends `GET teams/` to service `hydra` with `qs: options` and resolves `new Page(res, this.webex)`. | The JSDoc: list teams; `max` limits the number of teams in the response. Paging is the webex-core `Page` (webex-core MOD-054). | `src/teams.js` | `test/integration/spec/teams.js` list cases, with `max: 1` paging through `next()` (not run) | — | Present |
138
+ | `MOD-005` | `update(team)` sends `PUT teams/<team.id>` to service `hydra` with the whole `team` as the body and resolves the response body. | The JSDoc: update a team; its example changes `name` on a team returned by `create` and sends it back. | `src/teams.js` | `test/integration/spec/teams.js` update case asserts the new name (not run) | — | Present |
139
+
140
+ ## Design overview
141
+
142
+ `Teams` is a `WebexPlugin` with four methods and no state. Each method builds the options of one
143
+ request to the `teams` resource of catalog service `hydra` and calls `this.request`, which webex-core
144
+ resolves to a URL, authorizes, and sends. `create`, `get`, and `update` resolve the response body
145
+ (`get` prefers `body.items`); `list` wraps the response in a webex-core `Page`, so the caller pages with
146
+ `next()` and `previous()`.
147
+
148
+ The plugin adds no validation, no defaults, and no transformation: the caller's object is the body and
149
+ the caller's options are the query. Nothing is cached; every call reaches the service.
150
+
151
+ ## Data flow and sequence coverage
152
+
153
+ Call style: in-process method calls on `webex.teams`; outbound HTTPS through `webex.request` to catalog
154
+ service `hydra`. All four methods are one request each; `list` is the only one that continues past the
155
+ first response, through `Page`, so it has the diagram.
156
+
157
+ | Operation group | Entry and outcome | Diagram or evidence | Failure and recovery coverage |
158
+ | --------------- | ----------------- | ------------------- | ----------------------------- |
159
+ | Team records | `create`, `get`, `update`; one Hydra request each, resolving the body | `src/teams.js` | The request error rejects; nothing is retried |
160
+ | Team listing | `list`; one Hydra request resolving a `Page`; each `next()` is one more request | Diagram 1; `src/teams.js` | The request error rejects; paging errors reject the `next()` promise |
161
+
162
+ Diagram 1 — listing and paging:
163
+
164
+ ```mermaid
165
+ sequenceDiagram
166
+ participant C as Caller
167
+ participant T as Teams
168
+ participant W as webex-core request
169
+ participant H as Webex REST API teams
170
+ C->>T: list({max})
171
+ T->>W: request({service: 'hydra', resource: 'teams/', qs})
172
+ W->>H: GET teams/?max
173
+ H-->>W: {items} and Link headers
174
+ W-->>T: response
175
+ T-->>C: new Page(res, webex)
176
+ C->>W: page.next() (when hasNext)
177
+ W->>H: GET next link
178
+ H-->>C: new Page
179
+ ```
180
+
181
+ ## Class and component relationships
182
+
183
+ ```mermaid
184
+ classDiagram
185
+ class WebexPlugin
186
+ class Page
187
+ class Teams {
188
+ create(team)
189
+ get(team, options)
190
+ list(options)
191
+ update(team)
192
+ }
193
+ WebexPlugin <|-- Teams
194
+ Teams ..> Page : list(options)
195
+ ```
196
+
197
+ ## Use cases and flows
198
+
199
+ | Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
200
+ | -------- | --------------- | ------------------------- | ---------------------------- | -------- |
201
+ | `UC-001` | Application creating and renaming a team | `create({name})` resolves the team; `update({...team, name})` resolves the updated team | The Hydra error rejects | `src/teams.js` |
202
+ | `UC-002` | Application reading one team | `get(team)` or `get(id)` resolves the team | The Hydra error rejects; no argument throws (see Caller-visible failure modes) | `src/teams.js` |
203
+ | `UC-003` | Application listing its teams | `list({max})` resolves a `Page`; `hasNext()` and `next()` fetch further pages | The request error rejects | `src/teams.js` |
204
+
205
+ ### Cross-boundary use-case flow
206
+
207
+ | Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
208
+ | -------- | ---------------------- | ------------- | ---------------------------- |
209
+ | Webex REST API teams resource (`UC-001` to `UC-003`) | HTTPS through `webex.request`, catalog service `hydra`, one per call | Requests under Protocol and wire format | No retry or timeout in this module; webex-core interceptors apply |
210
+
211
+ ## Concurrency and reactive flow
212
+
213
+ - Execution model: one JavaScript event loop; each method returns the promise of `this.request`,
214
+ apart from the synchronous throw recorded under Caller-visible failure modes.
215
+ - Ordering guarantees: none across calls; each promise settles when its own response arrives.
216
+ - Parallel work: none inside a call. Callers may run calls in parallel; the integration spec creates its
217
+ two `list` fixtures one after the other because its paging assertions rely on order.
218
+ - Idempotency and retry: `get` and `list` are reads and safe to repeat; `create` makes a new team each
219
+ time; `update` repeats to the same end state on success. Nothing is retried here.
220
+ - Fire-and-forget work: none.
221
+ - Shared-state protection: not needed; the plugin keeps no state.
222
+
223
+ ## Protocol and wire format
224
+
225
+ | Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
226
+ | ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
227
+ | `POST <hydra>/teams` with the team body | Unversioned path under the catalog URL | `create` | Webex REST API | Body is the caller's object as given |
228
+ | `GET <hydra>/teams/<id>?<options>` | Unversioned | `get` | Webex REST API | The id is interpolated without URL encoding |
229
+ | `GET <hydra>/teams/?<options>` | Unversioned | `list` | Webex REST API | Every key of `options` becomes a query parameter; the response is read by `Page` |
230
+ | `PUT <hydra>/teams/<id>` with the team body | Unversioned | `update` | Webex REST API | The whole object, `id` included, is the body |
231
+ | Team object | — | Webex REST API | Callers | The JSDoc typedef names `id`, `name`, and `created` (server-generated `id` and `created`); the test-helper-chai `isTeam` assertion expects a Hydra `id`, a string `name`, and an ISO `created`. Other fields pass through unchanged |
232
+
233
+ ## Caller-visible failure modes
234
+
235
+ | Condition | Signal or result | Caller behavior | Retry or recovery | Evidence |
236
+ | --------- | ---------------- | --------------- | ----------------- | -------- |
237
+ | A Hydra request fails | `create`, `get`, `list`, or `update` rejects with the webex-core `WebexHttpError`, whose message names the method, service, and resource (webex-core MOD-048) | Handle the error | Call again | `src/teams.js` |
238
+ | `get` or `update` is called with `undefined` or `null` | A `TypeError` is thrown synchronously while reading `id`; no promise is returned and no request is sent | Pass a team object or, for `get`, an id | — | `src/teams.js` |
239
+ | `get` is passed an object without `id` | The object itself is interpolated, so the request goes to `teams/[object Object]` and the service error rejects | Pass `{id}` or the id string | — | `src/teams.js` |
240
+ | `update` is passed an object without `id` | The request goes to `teams/undefined` and the service error rejects | Pass the team returned by `create`, `get`, or `list` | — | `src/teams.js` |
241
+ | `next()` is called on a `Page` with no next link | `Page.next()` requests an undefined URI; webex-core does not specify the result (its Verification lists `next()` without a link as a gap) | Check `hasNext()` before `next()`, as the integration spec does | — | `test/integration/spec/teams.js` |
242
+
243
+ ## Pitfalls and constraints
244
+
245
+ - The integration spec creates teams and leaves each one behind, because the plugin offers no delete
246
+ (see Purpose and boundary).
247
+ - JSDoc drift: the `list` JSDoc types `options.max` as an object and names its example variable
248
+ `createdRooms`; the `get` JSDoc does not describe `options`.
249
+ - `test:style` reports no warnings and no errors for `src/`, plus "File ignored" for this
250
+ specification.
251
+
252
+ ## Module-specific rules
253
+
254
+ - Do: send every team request to service `hydra` through `this.request` so webex-core interceptors
255
+ and the catalog apply.
256
+ - Do: keep `get` accepting both a team object and an id string; the README and the integration spec use
257
+ both forms.
258
+ - Do: keep `list` resolving a webex-core `Page`, so callers keep `hasNext()`, `next()`, and iteration.
259
+ - Do not: cache team records or reshape responses; callers receive what the service returns
260
+ (`MOD-002` to `MOD-005`).
261
+ - Do not: log team names or ids with `webex.logger`; the plugin logs nothing today.
262
+
263
+ ## Export stability
264
+
265
+ | Export or entry point | Consumer | Stability | Versioning and deprecation rule | Declaration or API report |
266
+ | --------------------- | -------- | --------- | ------------------------------- | ------------------------- |
267
+ | Import side effect: public plugin `teams` | `webex`, `webex-node` | Public | No rule is declared in the package | `src/index.js` |
268
+ | Default export `Teams` and its four public methods | Applications | Public | Same | `src/index.js`, `src/teams.js` |
269
+
270
+ The build writes JavaScript only; `package.json` has no `types` entry, so no declarations or API
271
+ report are published.
272
+
273
+ ## Verification
274
+
275
+ | Requirement or invariant | Test level | Positive evidence | Negative or boundary evidence | Gap |
276
+ | ------------------------ | ---------- | ----------------- | ----------------------------- | --- |
277
+ | `MOD-001` | None run | `test/integration/spec/teams.js` (not run) | None found | No unit case |
278
+ | `MOD-002`, `MOD-003`, `MOD-005` | None run | `test/integration/spec/teams.js` create, get, and update cases (not run) | None found | No unit case; the `items` branch of `get`, the id-or-object argument, and the missing-argument throw have no case |
279
+ | `MOD-004` | None run | `test/integration/spec/teams.js` list cases with paging (not run) | None found | No unit case for the request options or the `Page` result |
280
+
281
+ The package has no unit tests: `package.json` defines no `test:unit` script and there is no
282
+ `test/unit` directory. No package script runs `test/integration/spec/teams.js` either: there is no
283
+ `test:integration`, and `test:browser:broken` reported 0 tests on 2026-11-12 because the karma bundle
284
+ failed to parse `isbot`, while still exiting 0. The aggregate `test` script exits 1 at the missing
285
+ `test:unit`. `build:src` and `test:style` exit 0. A module specification is complete only when its
286
+ public surface, failure modes, and test evidence agree with the implementation. Generator-side field
287
+ measurement is complete (100%, assessed 2026-11-12); independent validation passed with warnings on 2026-11-12 (0 Blocking, 0 Important, 0 Medium, 1 Minor); the
288
+ module stays Partial until a unit suite and a characterization baseline exist.