@webex/plugin-webhooks 3.13.0-next.4 → 3.13.0-next.6
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 +421 -0
- package/.sdd/manifest.json +357 -0
- package/AGENTS.md +208 -0
- package/dist/webhooks.js +1 -1
- package/docs/adr/0001-retain-product-readme.md +96 -0
- package/docs/adr/index.md +25 -0
- package/docs/architecture.md +234 -0
- package/docs/getting-started.md +117 -0
- package/docs/index.md +42 -0
- package/docs/specs/README.md +68 -0
- package/package.json +9 -9
- package/schemas/repo-context.schema.json +796 -0
- package/src/docs/README.md +313 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Module Spec
|
|
3
|
+
title: 'Webhooks plugin specification'
|
|
4
|
+
description: Responsibilities, boundaries, design, failure modes, and verification for the Webhooks 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-13T02:40:15Z
|
|
13
|
+
validation_status: pass
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Webhooks plugin
|
|
17
|
+
|
|
18
|
+
This source-local document at `src/docs/README.md` owns the stable specification for **the Webhooks
|
|
19
|
+
plugin**: the public plugin `webex.webhooks`. It creates, reads, lists, deletes, and updates Webex
|
|
20
|
+
webhook registrations through the `webhooks` resource of the Webex REST API (catalog service `hydra`).
|
|
21
|
+
Each method sends one request and resolves what the service returns. The plugin only manages
|
|
22
|
+
registrations: the service delivers events to each webhook's `targetUrl` directly, and nothing in this
|
|
23
|
+
package receives them. Ground every claim in package evidence and link to the
|
|
24
|
+
[package architecture](../../docs/architecture.md) instead of repeating broader facts. No service
|
|
25
|
+
specification exists because this package is a library.
|
|
26
|
+
|
|
27
|
+
Related context: [documentation index](../../docs/index.md) ·
|
|
28
|
+
[package agent instructions](../../AGENTS.md)
|
|
29
|
+
|
|
30
|
+
## Metadata
|
|
31
|
+
|
|
32
|
+
| Field | Value |
|
|
33
|
+
| ----------------- | ----- |
|
|
34
|
+
| Owner | @webex/web-sdk |
|
|
35
|
+
| Source path | `src` |
|
|
36
|
+
| Resource kind | package |
|
|
37
|
+
| Status | Draft |
|
|
38
|
+
| Last verified | 2026-11-13 at `c22331c97b` |
|
|
39
|
+
| Module id | `plugin-webhooks` |
|
|
40
|
+
| Parent spec | — |
|
|
41
|
+
| Doc kind | Module spec |
|
|
42
|
+
| Coverage score | 100% assessed 2026-11-13 by the generator — 12 of 12 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/webhooks.js` holds 7 live-service cases, all inside `describe.skip`, that no script runs |
|
|
43
|
+
| Validation status | Pass — independent validation on 2026-11-13; 0 Blocking, 0 warnings; runtime 01a1d2c3-25b2-7a93-a84a-c3d3b83a8df1 |
|
|
44
|
+
|
|
45
|
+
## Applicability
|
|
46
|
+
|
|
47
|
+
| Condition ID | Status | Evidence or reason | Owned section |
|
|
48
|
+
| ------------------------------------ | ---------- | ------------------ | ------------- |
|
|
49
|
+
| `module.has_tiers` | N/A | No tier policy exists in `package.json` or `src/webhooks.js` | Tier |
|
|
50
|
+
| `module.has_ui` | N/A | `src/webhooks.js` returns webhook records; it renders nothing | UI use-case flow |
|
|
51
|
+
| `module.crosses_service_boundaries` | Applicable | `src/webhooks.js` calls the Webex REST API webhooks resource through webex.request | Cross-boundary use-case flow |
|
|
52
|
+
| `module.holds_client_state` | N/A | `src/webhooks.js` sets no instance property and caches no record | Client state model |
|
|
53
|
+
| `module.enforces_domain_rules` | N/A | `src/webhooks.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 |
|
|
54
|
+
| `module.is_concurrent_async` | Applicable | Every method in `src/webhooks.js` returns the promise of a request | Concurrency and reactive flow |
|
|
55
|
+
| `module.owns_persistence` | N/A | Nothing is stored; `src/webhooks.js` resolves what the service returns | Data, schema, and migration discipline |
|
|
56
|
+
| `module.stateful_transitions` | N/A | No entity moves through states in `src/webhooks.js` | State machine |
|
|
57
|
+
| `module.exposes_wire_protocol` | Applicable | The five webhooks requests and the webhook object passed through `src/webhooks.js` | Protocol and wire format |
|
|
58
|
+
| `module.ui_multi_screen` | N/A | No UI | UI flow |
|
|
59
|
+
| `module.large_data_model` | N/A | One shape, the webhook object, typed only by the JSDoc typedef in `src/webhooks.js`; covered under Protocol and wire format | Data model |
|
|
60
|
+
| `module.returns_caller_errors` | Applicable | Request failures reject, and a missing argument throws, in `src/webhooks.js` | Caller-visible failure modes |
|
|
61
|
+
| `module.module_specific_conventions` | Applicable | Every request goes through this.request with service hydra and a webhooks resource path in `src/webhooks.js` | Module-specific rules |
|
|
62
|
+
| `module.published_package` | Applicable | `package.json` names the package @webex/plugin-webhooks and defines deploy:npm | Export stability |
|
|
63
|
+
| `module.embedded_in_host` | N/A | No host theme or embed API | Host integration and theming |
|
|
64
|
+
| `module.has_design_tradeoff` | Applicable | The comment in remove of `src/webhooks.js` records a local 204 workaround that it says belongs in http-core | Key design trade-off |
|
|
65
|
+
| `module.has_submodules` | N/A | The src directory has no child module | Sub-modules |
|
|
66
|
+
|
|
67
|
+
## Evidence register
|
|
68
|
+
|
|
69
|
+
| Evidence | What it establishes |
|
|
70
|
+
| -------- | ------------------- |
|
|
71
|
+
| `src/index.js` | `registerPlugin('webhooks', Webhooks)` with no options; re-exports only the default `Webhooks` |
|
|
72
|
+
| `src/webhooks.js` | `Webhooks` extends `WebexPlugin` with `create`, `get`, `list`, `remove`, and `update`; the `WebhookObject` typedef (`id`, `resource`, `event`, `filter`, `targetUrl`, `name`, `created`); the class JSDoc stating that webhooks notify an app over HTTP when an event occurs; the comment in `remove` on Firefox and 204s. Its JSDoc and that comment are the only recorded rationale |
|
|
73
|
+
| `package.json` | Name, `main` (`dist/index.js`), `devMain` (`src/index.js`), `engines` (`node >=18`), dependencies, peer dependencies on `@webex/plugin-logger` and `@webex/plugin-rooms`, and scripts; `build`, `build:src`, `test:style`, `test:browser`, `deploy:npm`, and `test` exist, and `test:unit` and `test:integration` do not |
|
|
74
|
+
| `test/integration/spec/webhooks.js` | 7 live-service cases inside `describe.skip` (comment `SPARK-413317`): `create`, `get` by id, `list` with and without `max` and paging, `update` of the target URL and of the name, and `remove` followed by a `get` that must reject with `NotFound`; an `after` hook removes every webhook the suite created. No package script runs it (see Verification) |
|
|
75
|
+
| `README.md` | Retained npm page; context only. Its one example, `webex.webhooks.get(id)`, matches the code; see `docs/adr/0001-retain-product-readme.md` |
|
|
76
|
+
| 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` and that `length` is `items.length` |
|
|
77
|
+
| Sibling package http-core, file src/lib/xhr.js | Read for the 204 comment: the browser transport reports an XHR status of 1223 as 204; the http-core spec says nothing about 204 or DELETE bodies, so its code is the referee |
|
|
78
|
+
| 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 `remove` resolves `undefined` on a 204 (MOD-006); the same handling here is covered under Key design trade-off |
|
|
79
|
+
| Sibling package test-helper-chai, file src/assertions/schemas.js | No spec; code read. `isWebhook` asserts `id` is a Hydra id and `resource`, `event`, `filter`, `targetUrl`, and `name` are strings (its `created` check is under Pitfalls and constraints) |
|
|
80
|
+
| Observation, no stated WHY | Behavior the code shows without stating a reason is recorded once, under Pitfalls and constraints or Caller-visible failure modes |
|
|
81
|
+
|
|
82
|
+
## Purpose and boundary
|
|
83
|
+
|
|
84
|
+
- Responsibility: give applications Webex webhook registrations as Hydra records — create, read, list,
|
|
85
|
+
delete, and update.
|
|
86
|
+
- In scope: registration of `webhooks`; the five public methods; turning a webhook object or an id into
|
|
87
|
+
a request path; resolving `undefined` for a 204 delete.
|
|
88
|
+
- Out of scope: receiving, authenticating, or parsing the HTTP POSTs the service sends to `targetUrl`
|
|
89
|
+
(that happens in the caller's own server, outside the SDK); the request pipeline, authorization,
|
|
90
|
+
service-catalog resolution, and paging (`@webex/webex-core`); the rooms, messages, and other resources
|
|
91
|
+
a webhook's `resource` and `filter` name; validating webhook bodies or target URLs; caching webhook
|
|
92
|
+
records; what Hydra stores, accepts, or returns.
|
|
93
|
+
- Consumers: in this repository `webex` (`src/webex.js`) and `webex-node` (`src/webex-node.js`) require
|
|
94
|
+
the package to register it. No file under another package's `src/` or test directory calls
|
|
95
|
+
`webex.webhooks`, and no workspace sample uses it. Applications reach the plugin as `webex.webhooks`.
|
|
96
|
+
|
|
97
|
+
## Structure and key files
|
|
98
|
+
|
|
99
|
+
| Path | Responsibility |
|
|
100
|
+
| ---- | -------------- |
|
|
101
|
+
| `src/index.js` | Registers public plugin `webhooks` and re-exports the class as default |
|
|
102
|
+
| `src/webhooks.js` | `Webhooks` and the `WebhookObject` typedef |
|
|
103
|
+
| `package.json` | Package name, entry points, scripts, dependencies, and peer dependencies |
|
|
104
|
+
| `babel.config.js`, `jest.config.js` | Re-exports of the legacy Babel and Jest configurations; no unit spec uses the Jest one |
|
|
105
|
+
| `.eslintrc.js` | Sets `root: true` and extends `@webex/eslint-config-legacy` |
|
|
106
|
+
| `process` | Package-root file exporting `{browser: true}`; not imported by `src/` |
|
|
107
|
+
| `src/docs/README.md` | This module specification; ignored by the build and by lint |
|
|
108
|
+
| `test/integration/spec/webhooks.js` | Live-service cases inside `describe.skip`; only `test:browser` would load them |
|
|
109
|
+
| dist/ (generated) | Build output of `build:src`; ignored by Git and never edited by hand |
|
|
110
|
+
|
|
111
|
+
## Public surface
|
|
112
|
+
|
|
113
|
+
| Surface | Consumer | Compatibility commitment | Source |
|
|
114
|
+
| ------- | -------- | ------------------------ | ------ |
|
|
115
|
+
| Import side effect: public plugin `webhooks` | `webex`, `webex-node` | First registration of the name wins; reached as `webex.webhooks` | `src/index.js` |
|
|
116
|
+
| `create(webhook)`, `get(webhook)`, `list(options)`, `remove(webhook)`, `update(webhook)` | Applications | Hydra webhook records; `list` resolves a webex-core `Page`; `remove` resolves `undefined` on a 204 | `src/webhooks.js` |
|
|
117
|
+
| Default export `Webhooks` | Hosts that mount the class themselves | The entry exports nothing else | `src/index.js` |
|
|
118
|
+
|
|
119
|
+
The plugin triggers no SDK event; the `event` field of a webhook names the Webex event the service
|
|
120
|
+
watches, not an event of this plugin. Contract ID `webhooks-public-sdk` is indexed in the
|
|
121
|
+
[package architecture](../../docs/architecture.md#public-and-consumer-surfaces) and registered in
|
|
122
|
+
`.sdd/manifest.json`. Export stability is under [Export stability](#export-stability).
|
|
123
|
+
|
|
124
|
+
## Dependencies
|
|
125
|
+
|
|
126
|
+
| Dependency | Why it is required | Failure behavior |
|
|
127
|
+
| ---------- | ------------------ | ---------------- |
|
|
128
|
+
| `@webex/webex-core` plugin host (module spec consulted) | `registerPlugin`, `WebexPlugin` (`webex` and `request`), and `Page` | A request failure rejects the method with a `WebexHttpError` |
|
|
129
|
+
| `@webex/webex-core` services (through `request`) | Resolves `service: 'hydra'` to the catalog URL | A catalog failure rejects the request |
|
|
130
|
+
| `@webex/internal-plugin-device` | Declared in `dependencies`; not imported by `src/`, only by the integration spec | — |
|
|
131
|
+
| `@webex/plugin-rooms`, `@webex/plugin-logger` (peer dependencies) | Imported only by the integration spec, which creates and removes the room its webhooks filter on; `src/` never reaches `webex.rooms` or `webex.logger` | — |
|
|
132
|
+
| Webex REST API webhooks resource (external) | Webhook records; the service also sends the event deliveries to `targetUrl` | Errors propagate |
|
|
133
|
+
|
|
134
|
+
## Requirements
|
|
135
|
+
|
|
136
|
+
| ID | WHAT | WHY | Source evidence | Test or example evidence | Assumptions or gaps | Confidence |
|
|
137
|
+
| -- | ---- | --- | --------------- | ------------------------ | ------------------- | ---------- |
|
|
138
|
+
| `MOD-001` | Importing the package registers `Webhooks` as public plugin `webhooks` with no config or other options. The entry re-exports only the default `Webhooks`. | Applications reach webhooks as `webex.webhooks`, as the README usage shows; the `webex` and `webex-node` bundles require the package for this registration (inferred). | `src/index.js` | `test/integration/spec/webhooks.js` imports the package and calls `webex.webhooks`, but is skipped | WHY inferred | Weak |
|
|
139
|
+
| `MOD-002` | `create(webhook)` sends `POST webhooks` to service `hydra` with `webhook` as the body through `this.request` and resolves the response body. | The class JSDoc: an app registers a webhook to be notified over HTTP when an event occurs, for example a new message in a room; the `create` example expects `id`, `resource`, `event`, `filter`, `targetUrl`, and `name` back. | `src/webhooks.js` | `test/integration/spec/webhooks.js` create case asserts isWebhook (skipped) | — | Present |
|
|
140
|
+
| `MOD-003` | `get(webhook)` takes `webhook.id`, else `webhook` itself, sends `GET webhooks/<id>` to service `hydra` with no query, and resolves `res.body.items` when present, else `res.body`. | The JSDoc: shows details for a webhook, given a webhook or a string. | `src/webhooks.js` | `test/integration/spec/webhooks.js` get case passes the id and compares the result with the created webhook (skipped) | Why `items` is checked is not stated; a body carrying `items` resolves that array instead of a webhook (see Caller-visible failure modes) | Present |
|
|
141
|
+
| `MOD-004` | `list(options)` sends `GET webhooks/` to service `hydra` with `qs: options` and resolves `new Page(res, this.webex)`. | The JSDoc: lists all webhooks; `max` limits the number of webhooks in the response. Paging is the webex-core `Page` (webex-core MOD-054). | `src/webhooks.js` | `test/integration/spec/webhooks.js` list cases, with max 1 paging through next() (skipped) | — | Present |
|
|
142
|
+
| `MOD-005` | `remove(webhook)` takes `webhook.id`, else `webhook`, sends `DELETE webhooks/<id>` to service `hydra`, and resolves `undefined` when the status is 204, else the response body. | The code comment: Firefox has issues with 204s or DELETE, and the handling should move to http-core (see Key design trade-off). | `src/webhooks.js` | `test/integration/spec/webhooks.js` remove case expects a falsy body and a later get rejecting with WebexHttpError.NotFound (skipped) | What a non-204 success body carries is not recorded | Present |
|
|
143
|
+
| `MOD-006` | `update(webhook)` sends `PUT webhooks/<webhook.id>` to service `hydra` with the whole `webhook` as the body and resolves the response body. | The JSDoc: update a webhook; its example changes `targetUrl` on a webhook returned by `create` and sends it back. | `src/webhooks.js` | `test/integration/spec/webhooks.js` update cases change `targetUrl` and `name` and compare the result (skipped) | — | Present |
|
|
144
|
+
|
|
145
|
+
## Design overview
|
|
146
|
+
|
|
147
|
+
`Webhooks` is a `WebexPlugin` with five methods and no state. Each method builds the options of one
|
|
148
|
+
request to the `webhooks` resource of catalog service `hydra` and calls `this.request`, which
|
|
149
|
+
webex-core resolves to a URL, authorizes, and sends. `create`, `get`, and `update` resolve the response
|
|
150
|
+
body (`get` prefers `body.items`); `remove` resolves `undefined` for a 204 and the body otherwise; `list`
|
|
151
|
+
wraps the response in a webex-core `Page`, so the caller pages with `next()` and `previous()`.
|
|
152
|
+
|
|
153
|
+
The plugin adds no validation, no defaults, and no transformation: the caller's object is the body and
|
|
154
|
+
the caller's options are the query. Nothing is cached; every call reaches the service. Once a webhook
|
|
155
|
+
exists, the service sends each matching event to its `targetUrl` without involving the SDK.
|
|
156
|
+
|
|
157
|
+
## Data flow and sequence coverage
|
|
158
|
+
|
|
159
|
+
Call style: in-process method calls on `webex.webhooks`; outbound HTTPS through `webex.request` to
|
|
160
|
+
catalog service `hydra`. All five methods are one request each; `list` is the only one that continues
|
|
161
|
+
past the first response, through `Page`, so it has the diagram.
|
|
162
|
+
|
|
163
|
+
| Operation group | Entry and outcome | Diagram or evidence | Failure and recovery coverage |
|
|
164
|
+
| --------------- | ----------------- | ------------------- | ----------------------------- |
|
|
165
|
+
| Webhook records | `create`, `get`, `update`, `remove`; one Hydra request each, resolving the body, or `undefined` for a 204 `remove` | `src/webhooks.js` | The request error rejects; nothing is retried |
|
|
166
|
+
| Webhook listing | `list`; one Hydra request resolving a `Page`; each `next()` is one more request | Diagram 1; `src/webhooks.js` | The request error rejects; paging errors reject the `next()` promise |
|
|
167
|
+
|
|
168
|
+
Diagram 1 — listing and paging:
|
|
169
|
+
|
|
170
|
+
```mermaid
|
|
171
|
+
sequenceDiagram
|
|
172
|
+
participant C as Caller
|
|
173
|
+
participant W as Webhooks
|
|
174
|
+
participant R as webex-core request
|
|
175
|
+
participant H as Webex REST API webhooks
|
|
176
|
+
C->>W: list({max})
|
|
177
|
+
W->>R: request({service: 'hydra', resource: 'webhooks/', qs})
|
|
178
|
+
R->>H: GET webhooks/?max
|
|
179
|
+
H-->>R: {items} and Link headers
|
|
180
|
+
R-->>W: response
|
|
181
|
+
W-->>C: new Page(res, webex)
|
|
182
|
+
C->>R: page.next() (when hasNext)
|
|
183
|
+
R->>H: GET next link
|
|
184
|
+
H-->>C: new Page
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Class and component relationships
|
|
188
|
+
|
|
189
|
+
```mermaid
|
|
190
|
+
classDiagram
|
|
191
|
+
class WebexPlugin
|
|
192
|
+
class Page
|
|
193
|
+
class Webhooks {
|
|
194
|
+
create(webhook)
|
|
195
|
+
get(webhook)
|
|
196
|
+
list(options)
|
|
197
|
+
remove(webhook)
|
|
198
|
+
update(webhook)
|
|
199
|
+
}
|
|
200
|
+
WebexPlugin <|-- Webhooks
|
|
201
|
+
Webhooks ..> Page : list(options)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Use cases and flows
|
|
205
|
+
|
|
206
|
+
| Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
|
|
207
|
+
| -------- | --------------- | ------------------------- | ---------------------------- | -------- |
|
|
208
|
+
| `UC-001` | Application registering for an event | `create({resource, event, filter, targetUrl, name})` resolves the webhook; the service then POSTs matching events to `targetUrl` | The Hydra error rejects | `src/webhooks.js` |
|
|
209
|
+
| `UC-002` | Application reading one webhook | `get(webhook)` or `get(id)` resolves the webhook | The Hydra error rejects; no argument throws (see Caller-visible failure modes) | `src/webhooks.js` |
|
|
210
|
+
| `UC-003` | Application listing its webhooks | `list({max})` resolves a `Page`; `hasNext()` and `next()` fetch further pages | The request error rejects | `src/webhooks.js` |
|
|
211
|
+
| `UC-004` | Application retargeting or renaming a webhook | `update({...webhook, targetUrl})` resolves the updated webhook | The Hydra error rejects | `src/webhooks.js` |
|
|
212
|
+
| `UC-005` | Application unregistering a webhook | `remove(webhook)` or `remove(id)` resolves `undefined` on 204 | The Hydra error rejects | `src/webhooks.js` |
|
|
213
|
+
|
|
214
|
+
### Cross-boundary use-case flow
|
|
215
|
+
|
|
216
|
+
| Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
|
|
217
|
+
| -------- | ---------------------- | ------------- | ---------------------------- |
|
|
218
|
+
| Webex REST API webhooks resource (`UC-001` to `UC-005`) | 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 |
|
|
219
|
+
|
|
220
|
+
## Concurrency and reactive flow
|
|
221
|
+
|
|
222
|
+
- Execution model: one JavaScript event loop; each method returns the promise of `this.request`,
|
|
223
|
+
apart from the synchronous throw recorded under Caller-visible failure modes.
|
|
224
|
+
- Ordering guarantees: none across calls; each promise settles when its own response arrives.
|
|
225
|
+
- Parallel work: none inside a call. Callers may run calls in parallel; the integration spec's `after`
|
|
226
|
+
hook removes every webhook it created with `Promise.all`.
|
|
227
|
+
- Idempotency and retry: `get` and `list` are reads and safe to repeat; `create` registers a new webhook
|
|
228
|
+
each time; `update` repeats to the same end state on success; a repeated `remove` of the same id
|
|
229
|
+
reaches the service again, which decides the result. Nothing is retried here.
|
|
230
|
+
- Fire-and-forget work: none.
|
|
231
|
+
- Shared-state protection: not needed; the plugin keeps no state.
|
|
232
|
+
|
|
233
|
+
## Protocol and wire format
|
|
234
|
+
|
|
235
|
+
| Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
|
|
236
|
+
| ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
|
|
237
|
+
| `POST <hydra>/webhooks` with the webhook body | Unversioned path under the catalog URL | `create` | Webex REST API | Body is the caller's object as given |
|
|
238
|
+
| `GET <hydra>/webhooks/<id>` | Unversioned | `get` | Webex REST API | The id is interpolated without URL encoding; no query is sent |
|
|
239
|
+
| `GET <hydra>/webhooks/?<options>` | Unversioned | `list` | Webex REST API | Every key of `options` becomes a query parameter; the response is read by `Page` |
|
|
240
|
+
| `DELETE <hydra>/webhooks/<id>` | Unversioned | `remove` | Webex REST API | A 204 resolves `undefined`; any other success resolves the body |
|
|
241
|
+
| `PUT <hydra>/webhooks/<id>` with the webhook body | Unversioned | `update` | Webex REST API | The whole object, `id` included, is the body |
|
|
242
|
+
| Webhook object | — | Webex REST API | Callers | The JSDoc typedef names `id` and `created` (server-generated), `resource`, `event`, `filter`, `targetUrl`, and `name`; the test-helper-chai `isWebhook` assertion expects a Hydra `id` and string `resource`, `event`, `filter`, `targetUrl`, and `name`. Other fields pass through unchanged |
|
|
243
|
+
| Event delivery to `targetUrl` | — | Webex REST API | The caller's server | Not produced or parsed by this package; the JSDoc says only that `targetUrl` receives POST requests for each event |
|
|
244
|
+
|
|
245
|
+
## Caller-visible failure modes
|
|
246
|
+
|
|
247
|
+
| Condition | Signal or result | Caller behavior | Retry or recovery | Evidence |
|
|
248
|
+
| --------- | ---------------- | --------------- | ----------------- | -------- |
|
|
249
|
+
| A Hydra request fails | `create`, `get`, `list`, `remove`, 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/webhooks.js` |
|
|
250
|
+
| `get`, `remove`, 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 webhook object or, for `get` and `remove`, an id | — | `src/webhooks.js` |
|
|
251
|
+
| `get` or `remove` is passed an object without `id` | The object itself is interpolated, so the request goes to `webhooks/[object Object]` and the service error rejects | Pass `{id}` or the id string | — | `src/webhooks.js` |
|
|
252
|
+
| `get` is passed an empty string | The path becomes `webhooks/`, the list path, so `get` resolves the `items` array of the first list page instead of a webhook | Pass a non-empty id | — | `src/webhooks.js` |
|
|
253
|
+
| `remove` is passed an empty string | The request is `DELETE webhooks/`; the service decides the result, which this repository does not record | Pass a non-empty id | — | `src/webhooks.js` |
|
|
254
|
+
| `update` is passed an object without `id` | The request goes to `webhooks/undefined` and the service error rejects | Pass the webhook returned by `create`, `get`, or `list` | — | `src/webhooks.js` |
|
|
255
|
+
| `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/webhooks.js` |
|
|
256
|
+
|
|
257
|
+
## Pitfalls and constraints
|
|
258
|
+
|
|
259
|
+
- JSDoc drift: the `@returns` tags name a `Webhook` type while the typedef is `WebhookObject`; the
|
|
260
|
+
`create` parameter is typed `WebhookObject`, whose `id` and `created` are server-generated; the `get`
|
|
261
|
+
JSDoc does not mention the `items` branch.
|
|
262
|
+
- The `isWebhook` assertion of test-helper-chai does not check `created`: the line is commented out
|
|
263
|
+
("waiting on completion of COLLAB-159"), so no test, even when enabled, pins that field.
|
|
264
|
+
- `test:style` reports no warnings and no errors for `src/`, plus "File ignored" for this
|
|
265
|
+
specification.
|
|
266
|
+
|
|
267
|
+
## Module-specific rules
|
|
268
|
+
|
|
269
|
+
- Do: send every webhook request to service `hydra` through `this.request` so webex-core interceptors
|
|
270
|
+
and the catalog apply.
|
|
271
|
+
- Do: keep `get` and `remove` accepting both a webhook object and an id string; the README uses the id
|
|
272
|
+
form and the integration spec uses both.
|
|
273
|
+
- Do: keep `list` resolving a webex-core `Page`, so callers keep `hasNext()`, `next()`, `length`, and
|
|
274
|
+
iteration.
|
|
275
|
+
- Do: keep `remove` resolving `undefined` on a 204 until the handling moves to http-core (`MOD-005`).
|
|
276
|
+
- Do not: cache webhook records or reshape responses; callers receive what the service returns
|
|
277
|
+
(`MOD-002` to `MOD-006`).
|
|
278
|
+
- Do not: log webhook bodies, target URLs, filters, or ids with `webex.logger`; the plugin logs nothing
|
|
279
|
+
today.
|
|
280
|
+
|
|
281
|
+
## Export stability
|
|
282
|
+
|
|
283
|
+
| Export or entry point | Consumer | Stability | Versioning and deprecation rule | Declaration or API report |
|
|
284
|
+
| --------------------- | -------- | --------- | ------------------------------- | ------------------------- |
|
|
285
|
+
| Import side effect: public plugin `webhooks` | `webex`, `webex-node` | Public | No rule is declared in the package | `src/index.js` |
|
|
286
|
+
| Default export `Webhooks` and its five public methods | Applications | Public | Same | `src/index.js`, `src/webhooks.js` |
|
|
287
|
+
|
|
288
|
+
The build writes JavaScript only; `package.json` has no `types` entry, so no declarations or API
|
|
289
|
+
report are published.
|
|
290
|
+
|
|
291
|
+
## Key design trade-off
|
|
292
|
+
|
|
293
|
+
| Chosen trade-off | Preserved invariant or benefit | Cost or limitation | Decision evidence |
|
|
294
|
+
| ---------------- | ------------------------------ | ------------------ | ----------------- |
|
|
295
|
+
| `remove` maps a 204 to `undefined` itself instead of relying on the transport | Callers get one result for a successful delete in every browser, whatever body the transport reports for a 204 (`MOD-005`) | The code comment says the handling should move to http-core; until it does, the same branch and comment are repeated in plugin-rooms, plugin-memberships, and plugin-messages, and a non-204 success still resolves whatever body the service sent | `src/webhooks.js` comment in remove |
|
|
296
|
+
|
|
297
|
+
## Verification
|
|
298
|
+
|
|
299
|
+
| Requirement or invariant | Test level | Positive evidence | Negative or boundary evidence | Gap |
|
|
300
|
+
| ------------------------ | ---------- | ----------------- | ----------------------------- | --- |
|
|
301
|
+
| `MOD-001` | None run | `test/integration/spec/webhooks.js` (skipped) | None found | No unit case |
|
|
302
|
+
| `MOD-002`, `MOD-003`, `MOD-006` | None run | `test/integration/spec/webhooks.js` create, get, and update cases (skipped) | None found | No unit case; the `items` branch of `get`, the id-or-object argument, the empty-string path, and the missing-argument throw have no case |
|
|
303
|
+
| `MOD-004` | None run | `test/integration/spec/webhooks.js` list cases with paging (skipped) | None found | No unit case for the request options or the `Page` result; the unbounded list case assigns each listed item to the outer `webhook` variable, so its `assert.include` checks the last listed item rather than the webhook it created |
|
|
304
|
+
| `MOD-005` | None run | `test/integration/spec/webhooks.js` remove case (skipped) | Same case: a later get must reject with WebexHttpError.NotFound (skipped) | No unit case for the 204 branch or the non-204 body |
|
|
305
|
+
|
|
306
|
+
The package has no unit tests: `package.json` defines no `test:unit` script and there is no
|
|
307
|
+
`test/unit` directory. The integration spec is wrapped in `describe.skip`, and no package script would
|
|
308
|
+
run it anyway: there is no `test:integration`, and `test:browser` reported 0 tests on 2026-11-13
|
|
309
|
+
because the karma bundle failed to parse `isbot`, while still exiting 0. The aggregate `test` script
|
|
310
|
+
exits 1 at the missing `test:unit`. `build:src` and `test:style` exit 0. A module specification is
|
|
311
|
+
complete only when its public surface, failure modes, and test evidence agree with the implementation.
|
|
312
|
+
Generator-side field measurement is complete (100%, assessed 2026-11-13); independent validation passed on 2026-11-13 (0 Blocking, 0 warnings; runtime 01a1d2c3-25b2-7a93-a84a-c3d3b83a8df1); the module stays Partial until a unit suite and a
|
|
313
|
+
characterization baseline exist.
|