@webex/internal-plugin-calendar 3.13.0-next.8 → 3.13.0-next.9

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,525 @@
1
+ ---
2
+ type: Module Spec
3
+ title: 'Calendar plugin specification'
4
+ description: Responsibilities, boundaries, design, invariants, and verification for the internal calendar 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-12T08:24:55Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # Calendar plugin
17
+
18
+ This source-local document at `src/docs/README.md` owns the stable specification for **the calendar
19
+ plugin**: the internal `webex.internal.calendar` plugin that lists and syncs a user's calendar
20
+ meetings from the Webex calendar service, keeps them in an in-memory collection updated by Mercury
21
+ calendar events, reads meeting notes, participants, and scheduler data, creates, updates, and deletes
22
+ calendar events with KMS-encrypted payloads, and runs free-busy lookups whose answer arrives over
23
+ Mercury. 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-12 at `ecd5af12a1` |
39
+ | Module id | `internal-plugin-calendar` |
40
+ | Parent spec | — |
41
+ | Doc kind | Module spec |
42
+ | Coverage score | 93.3% assessed 2026-11-12 — 14 of 15 mandatory fields PRESENT, critical 8 of 8; test strategy is WEAK because the payload transformer, `getFreeBusy` and the free-busy event, `getByType`, `processMeetingEvent`, the participants fetch in `list`, attendee encryption, and the failure paths of `register` have no unit case, and the only integration spec is `describe.skip` |
43
+ | Validation status | Pass with warnings — 0 Blocking, 1 Important; validator runtime 01a1cec9-0225-7283-9212-f70c182f1a3e; 2026-11-12 |
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 this package or its `package.json` | Tier |
50
+ | `module.has_ui` | N/A | `src/calendar.js` makes requests and emits events; nothing is rendered | UI use-case flow |
51
+ | `module.crosses_service_boundaries` | Applicable | `src/calendar.js` calls the calendar service over HTTPS, listens to Mercury calendar events, and requests KMS keys through the encryption plugin | Cross-boundary use-case flow |
52
+ | `module.holds_client_state` | Applicable | The meeting collection in `src/collection.js`, plus the registered flag, the rpcEventRequests map, and the cached encryptionKeyUrl in `src/calendar.js` and `src/calendar.encrypt.helper.js` | Client state model |
53
+ | `module.enforces_domain_rules` | Applicable | The schedulerData exclusion in the transformer predicates (`src/index.js`), the free-busy encryption rule (`src/calendar.encrypt.helper.js`), the getByType key list and the derived end time (`src/calendar.js`, `src/util.js`) | Business rules and invariants |
54
+ | `module.is_concurrent_async` | Applicable | Parallel field encryption and decryption in the helpers, and the free-busy request that resolves from a later Mercury event in `src/calendar.js` | Concurrency and reactive flow |
55
+ | `module.owns_persistence` | N/A | Nothing is written to storage; meetings live in the calendar service and in memory (`src/collection.js`) | Data, schema, and migration discipline |
56
+ | `module.stateful_transitions` | N/A | The only state flag is registered in `src/calendar.js`, a two-value flag covered under Client state model | State machine |
57
+ | `module.exposes_wire_protocol` | Applicable | The calendar REST requests in `src/calendar.js` and the Mercury event envelopes it reads | Protocol and wire format |
58
+ | `module.ui_multi_screen` | N/A | No UI | UI flow |
59
+ | `module.large_data_model` | N/A | Meeting objects are server-owned shapes passed through `src/calendar.js`; the module defines no entity types | Data model |
60
+ | `module.returns_caller_errors` | Applicable | Rejections and the synchronous throw of getByType in `src/calendar.js` | Caller-visible failure modes |
61
+ | `module.module_specific_conventions` | Applicable | The Calendar config namespace, the calendar: event names in `src/constants.js`, and the calendar-> log prefix in `src/calendar.js` | Module-specific rules |
62
+ | `module.published_package` | Applicable | `package.json` names the package @webex/internal-plugin-calendar 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 | Transformer-based decryption for reads versus explicit helper decryption for scheduler data and free-busy, and the request-then-event free-busy design in `src/index.js` and `src/calendar.js` | 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` | Side-effect imports of the device, encryption, and conversation plugins; `registerInternalPlugin('calendar', Calendar, {config, payloadTransformer})` with five inbound predicates (`transformMeetingNotes`, `transformMeetingParticipants`, `transformMeetingArray`, and `transformMeeting` twice) and four transforms; exports default `Calendar` only |
72
+ | `src/calendar.js` | The `Calendar` plugin (`WebexPlugin.extend`, namespace `Calendar`): `register`, `unregister`, Mercury event handling, `syncCalendar`, `list`, `getByType`, `getAll`, `processMeetingEvent`, notes and participants reads, create, update, delete, `getSchedulerData`, `getFreeBusy`. Its JSDoc is the main recorded rationale |
73
+ | `src/collection.js` | `CalendarCollection`, a module-level object holding meetings keyed by `id`, with `get`, `getBy`, `set`, `setAll`, `getAll`, `remove`, `reset` |
74
+ | `src/util.js` | `calculateEndTime` adds `endTime` from `start` and `durationMinutes`; its comment gives the reason |
75
+ | `src/calendar.encrypt.helper.js` | Encryption of create and update payloads and of free-busy emails, and the lazy creation of one KMS unbound key cached on the plugin |
76
+ | `src/calendar.decrypt.helper.js` | Decryption of scheduler-data responses and free-busy responses with `encryption.decryptText` |
77
+ | `src/config.js` | `webex.config.calendar` defaults `fromDate` and `toDate` |
78
+ | `src/constants.js` | Event names `calendar:registered`, `calendar:unregistered`, `calendar:create`, `calendar:update`, `calendar:delete`, and the collection namespace `CALENDAR` |
79
+ | `package.json` | Name, `main` (`dist/index.js`), `devMain` (`src/index.js`), `engines` (`node >=18`), dependencies, and scripts; the aggregate `test` script calls an undefined `test:integration` |
80
+ | `process` | Package-root module exporting `{browser: true}`; nothing in `src/` imports it and no package script names it |
81
+ | `test/unit/spec/calendar.js` | Unit cases for `register`, `unregister`, the create, update, and delete events, `syncCalendar`, `list`, `getNotes`, `getParticipants`, `getNotesByUrl`, `getSchedulerData`, and create, update, and delete requests. It imports the package by name, so it loads `dist/` |
82
+ | `test/unit/spec/calendar.encrypt.helper.js` | Unit cases for free-busy email encryption with and without `emails` |
83
+ | `test/unit/spec/calendar.decrypt.helper.js` | Unit cases for scheduler-data and free-busy decryption, including the early returns |
84
+ | `test/unit/spec/utils.js` | Unit case for `calculateEndTime` |
85
+ | `test/integration/spec/calendar.js` | Live-service cases for `list`, Mercury create events, `getNotes`, and `getParticipants`; the whole file is `describe.skip` |
86
+ | `README.md` | Retained npm page; context only. Its usage block is the placeholder `webex.internal.calendar.WHATEVER`; see `docs/adr/0001-retain-product-readme.md` |
87
+ | Sibling package webex-core, file src/docs/README.md | Module spec consulted. `registerInternalPlugin` merges `config` and concatenates `payloadTransformer` predicates and transforms into the default config (MOD-008); `canAuthorize` is proxied from credentials (MOD-015); `transform(direction, object)` runs predicates whose direction matches and applies named transforms (MOD-037); `WebexPlugin.config` is the lowercased namespace key of `webex.config` (MOD-044); `WebexPlugin.logger` is `webex.logger` (MOD-045) |
88
+ | Sibling package webex-core, file src/interceptors/docs/README.md | Module spec consulted. `PayloadTransformerInterceptor` runs `transform('inbound', response)` on every response unless `options.disableTransform` is set, and a transform rejection fails the request (INT-018) |
89
+ | Sibling package internal-plugin-mercury, file src/docs/README.md | Module spec consulted. `connect()` registers the device when needed and resolves when online (MOD-002); envelopes are emitted as `event:<eventType>` (MOD-009); `disconnect()` closes the socket (MOD-011) |
90
+ | Sibling package internal-plugin-device, file src/docs/README.md | Module spec consulted. `register()` on a registered device refreshes it (MOD-005); `unregister()` deletes the registration and clears local state (MOD-011) |
91
+ | Sibling package common, file src/docs/README.md | Module spec consulted. `base64.encode` is base64url encoding over `urlsafe-base64` (the `base64` row of its public surface) |
92
+ | Sibling package internal-plugin-conversation, files src/decryption-transforms.js, src/conversation.js, src/config.js | Source consulted (no spec). The inbound `decryptTextProp` transform decrypts one field and, on failure, logs a warning and writes `decryptionFailureMessage` ('This message cannot be decrypted') instead of rejecting. `Conversation.initialize` appends these transforms on webex `ready` only when `conversation.includeDecryptionTransforms` is true (the default) |
93
+ | Sibling package internal-plugin-encryption, files src/encryption.js, src/kms.js, src/index.js | Source consulted (no spec). `encryptText(key, plaintext)` and `decryptText(key, ciphertext)` resolve JWE strings; `kms.createUnboundKeys({count})` resolves an array of keys with `uri`. Its `src/index.js` imports `@webex/internal-plugin-mercury`, which is how `webex.internal.mercury` exists for this package |
94
+ | Sibling package eslint-config-legacy, file static/ignore-patterns.js | Source consulted. `docs/**` and `*.md` are ignored, so this specification is not linted; no source file of this package is on the decorator list |
95
+ | Generator observation in a temporary unit case under Node 22.14 (not committed) | Two `MockWebex` instances share one `rpcEventRequests` array and one meeting collection; `encryptCalendarEventRequest` resolves while an attendee `email` is still plaintext |
96
+ | `src/calendar.js`, `src/calendar.encrypt.helper.js` | The four operation groups that the extension subsections under Data flow and sequence coverage (Register and receive events, Sync meetings, Write an event, Free-busy) each diagram once; every subsection maps to one row of that section's inventory table |
97
+ | Observation, no stated WHY | `list` calls `this.webex.request` while the others call `this.request`; the JSDoc event-name mismatch and the unused free-busy `reject` are recorded under Pitfalls and constraints |
98
+
99
+ ## Purpose and boundary
100
+
101
+ - Responsibility: give first-party clients a calendar API on `webex.internal.calendar`. That means
102
+ registering for Mercury calendar events and keeping an in-memory meeting collection current from
103
+ them; listing and syncing meetings for a date window; reading notes, participants, and scheduler
104
+ data; creating, updating, and deleting calendar events with encrypted payloads; and asking for
105
+ free-busy status, whose answer arrives as a Mercury event.
106
+ - In scope: every method of `Calendar`; the collection and end-time helper; the encrypt and decrypt
107
+ helpers; the calendar `payloadTransformer` predicates and transforms; the calendar REST request
108
+ shapes and the Mercury calendar event shapes this module reads; the `webex.config.calendar` defaults.
109
+ - Out of scope: KMS key creation and JWE cryptography (the encryption plugin); the `decryptTextProp`
110
+ transform and its failure substitution (the conversation plugin); socket lifecycle and envelope
111
+ routing (the mercury plugin); device registration (the device plugin); the request pipeline and the
112
+ transform engine (webex-core); rendering meetings and joining them (the host client and the meetings
113
+ plugin).
114
+ - Consumers: `webex`, `webex-node`, `@webex/webex-server`, and `@webex/recipe-private-web-client`,
115
+ which import this package for its side effect, and first-party clients that call
116
+ `webex.internal.calendar`.
117
+
118
+ ## Structure and key files
119
+
120
+ | Path | Responsibility |
121
+ | ---- | -------------- |
122
+ | `src/index.js` | Imports three sibling plugins, registers internal plugin `calendar` with `config` and the payload transformer, and re-exports `Calendar` as default |
123
+ | `src/calendar.js` | The `Calendar` plugin, built with `WebexPlugin.extend` in namespace `Calendar` |
124
+ | `src/collection.js` | The module-level meeting collection |
125
+ | `src/util.js` | `calculateEndTime` |
126
+ | `src/calendar.encrypt.helper.js` | Request-payload encryption and the cached KMS key |
127
+ | `src/calendar.decrypt.helper.js` | Scheduler-data and free-busy response decryption |
128
+ | `src/config.js` | `webex.config.calendar` defaults |
129
+ | `src/constants.js` | Event names and the collection namespace |
130
+ | `process` | Package-root file exporting `{browser: true}`; not imported by `src/` |
131
+ | `package.json` | Package name, entry points, scripts, and dependencies |
132
+ | `babel.config.js`, `jest.config.js` | Re-exports of the legacy Babel and Jest configurations |
133
+ | `.eslintrc.js` | Sets `root: true` and extends `@webex/eslint-config-legacy` |
134
+ | `src/docs/README.md` | This module specification; ignored by the build and by lint |
135
+ | `test/unit/spec/calendar.js`, `test/unit/spec/calendar.encrypt.helper.js`, `test/unit/spec/calendar.decrypt.helper.js`, `test/unit/spec/utils.js` | Unit specs run by Jest through `webex-legacy-tools` (28 cases) |
136
+ | `test/integration/spec/calendar.js` | Live-service spec run only by `test:browser` (karma); the whole file is skipped |
137
+ | dist/ (generated) | Build output of `build:src`; ignored by Git and never edited by hand |
138
+
139
+ ## Public surface
140
+
141
+ | Surface | Consumer | Compatibility commitment | Source |
142
+ | ------- | -------- | ------------------------ | ------ |
143
+ | Import side effect: internal plugins `device`, `encryption`, `conversation`, and `calendar`, plus the calendar payload transformer | `webex`, `webex-node`, `@webex/webex-server`, `@webex/recipe-private-web-client` | First registration of a name wins | `src/index.js` |
144
+ | Default export `Calendar` | Unit specs and packages that build on the class | No versioning rule is declared; the README states the plugin does not strictly follow semver | `src/index.js` |
145
+ | Lifecycle methods `register`, `unregister` and the `registered` flag | First-party clients | Both are no-ops when already in the target state | `src/calendar.js` |
146
+ | Collection methods `syncCalendar`, `getAll`, `getByType` | First-party clients | Items carry a derived `endTime` | `src/calendar.js`, `src/collection.js` |
147
+ | Read methods `list`, `getNotes`, `getNotesByUrl`, `getParticipants`, `getSchedulerData`, `processMeetingEvent` | First-party clients | `list` resolves the items array; the others resolve the whole response or the event | `src/calendar.js` |
148
+ | Write methods `createCalendarEvent`, `updateCalendarEvent`, `deleteCalendarEvent` | First-party clients | Resolve the whole response; the caller's `data` object is encrypted in place | `src/calendar.js` |
149
+ | `getFreeBusy(data, query)` | First-party clients | Resolves from a later Mercury event matched by `data.requestId` | `src/calendar.js` |
150
+ | Plugin events `calendar:registered`, `calendar:unregistered`, `calendar:create`, `calendar:update`, `calendar:delete` | First-party clients through `webex.internal.calendar.on` | Names in `src/constants.js` | `src/constants.js`, `src/calendar.js` |
151
+ | `webex.config.calendar` keys `fromDate`, `toDate` | Integrators through `Webex.init` config | Defaults under Requirements `MOD-002` | `src/config.js` |
152
+
153
+ Methods prefixed with `_` (`_handleCreate`, `_handleUpdate`, `_handleDelete`, `_handleFreeBusy`) and
154
+ `listenForEvents`, `stopListeningForEvents` are marked `@private` in their JSDoc. Contract ID
155
+ `calendar-internal-sdk` is indexed in the
156
+ [package architecture](../../docs/architecture.md#public-and-consumer-surfaces) and registered in
157
+ `.sdd/manifest.json`. Export stability is under [Export stability](#export-stability).
158
+
159
+ ## Dependencies
160
+
161
+ | Dependency | Why it is required | Failure behavior |
162
+ | ---------- | ------------------ | ---------------- |
163
+ | `@webex/webex-core` plugin host (module spec consulted) | `WebexPlugin`, `registerInternalPlugin`, `this.request`, `this.webex.request`, `this.webex.transform`, namespaced `config`, `logger`, `canAuthorize`, and the payload transformer interceptor | Request rejections propagate; an inbound transform rejection fails the request |
164
+ | `@webex/internal-plugin-mercury` (module spec consulted; not declared in `package.json`, registered because the encryption plugin imports it) | `connect`, `disconnect`, `on`, `off` and the `event:calendar.*` events | `connect()` rejections reject `register` |
165
+ | `@webex/internal-plugin-device` (module spec consulted) | `register` and `unregister` around the Mercury connection | Rejections propagate from `register` and `unregister` |
166
+ | `@webex/internal-plugin-encryption` (code consulted; no spec) | `encryptText`, `decryptText`, `kms.createUnboundKeys` | Rejections propagate, except inside `decryptTextProp` |
167
+ | `@webex/internal-plugin-conversation` (code consulted; no spec) | The `decryptTextProp` transform that every calendar transform calls | A field that fails to decrypt becomes 'This message cannot be decrypted'. The transform is appended only on webex `ready`, and not at all while `conversation.includeDecryptionTransforms` is false |
168
+ | `@webex/common` (module spec consulted; not declared in `package.json`, resolved through the workspace) | `base64.encode` for event ids in resource paths | Not applicable |
169
+ | Calendar service (external) | Meetings, notes, scheduler data, event writes, free-busy | HTTP errors propagate |
170
+ | `lodash` | `has` in predicates, `find` in the collection, `isArray` in the encrypt helper | Not applicable |
171
+ | `uuid` | Declared in `package.json` dependencies but imported only by `test/integration/spec/calendar.js` | Not applicable |
172
+
173
+ ## Requirements
174
+
175
+ | ID | WHAT | WHY | Source evidence | Test or example evidence | Assumptions or gaps | Confidence |
176
+ | -- | ---- | --- | --------------- | ------------------------ | ------------------- | ---------- |
177
+ | `MOD-001` | Importing the package imports the device, encryption, and conversation plugins, then registers internal plugin `calendar` with the package config and the payload transformer. It exports `Calendar` as default and nothing else. | The calendar needs device registration, Mercury, KMS, and the conversation decrypt transform on every instance, so it pulls those plugins in rather than relying on the host's import order. | `src/index.js` | `test/unit/spec/calendar.js` imports the package by name | The unit specs mount `Calendar` through MockWebex children, so `registerInternalPlugin` and the transformer registration are not exercised | Present |
178
+ | `MOD-002` | `webex.config.calendar` defaults `fromDate` to now minus one day and `toDate` to now plus seven days, both computed once when `src/config.js` is first evaluated. `syncCalendar()` without arguments uses them. | The `syncCalendar` JSDoc: defaults to 1 day before and 7 days ahead. | `src/config.js`, `src/calendar.js` | None found | The window is fixed at module load, so a long-lived page syncs a stale window | Weak |
179
+ | `MOD-003` | `register()` rejects `Error('SDK cannot authorize')` when `webex.canAuthorize` is false and resolves at once when `registered` is true. Otherwise it calls `device.register()`, then `mercury.connect()`, subscribes to six Mercury events (`MOD-005`, `MOD-015`), triggers `calendar:registered`, and sets `registered` true. A failure is logged as `calendar->register#ERROR` and rejected unchanged. | The JSDoc: explicitly sets up the plugin by registering the device, connecting to Mercury, and listening for calendar events. | `src/calendar.js` | `test/unit/spec/calendar.js` "on calendar register call mercury registration", "should trigger `calendar:register` event" | The cannot-authorize, already-registered, and failure paths have no case | Present |
180
+ | `MOD-004` | `unregister()` resolves at once when `registered` is false. Otherwise it calls `mercury.off(name)` for the six event names, then `mercury.disconnect()`, then `device.unregister()`, triggers `calendar:unregistered`, and sets `registered` false. | The JSDoc: explicitly tears down the plugin by deregistering the device, disconnecting from Mercury, and stopping the calendar listeners. | `src/calendar.js` | `test/unit/spec/calendar.js` "#unregister()" cases | Teardown side effects beyond calendar are under Pitfalls and constraints | Present |
181
+ | `MOD-005` | Mercury `event:calendar.meeting.create` and `event:calendar.meeting.create.minimal` store `data.calendarMeetingExternal` in the collection and trigger `calendar:create` with the stored item; the two `update` variants do the same and trigger `calendar:update`; `event:calendar.meeting.delete` removes the item by `calendarMeetingExternal.id` and triggers `calendar:delete` with the removed item. | The JSDoc of the handlers: trigger after the collection updates, so listeners read the current item. | `src/calendar.js`, `src/collection.js` | `test/unit/spec/calendar.js` "trigger `calendar:update` event", "trigger `calendar:create` event", "trigger `calendar:delete` event" | The `.minimal` variants have no case. Items are stored as received, without decryption; a delete for an unknown id triggers with `undefined` | Present |
182
+ | `MOD-006` | The collection keys items by `id` and stores a copy with `endTime = new Date(start + durationMinutes * 60000)`. `getAll()` returns every stored item; `getByType(key, value)` returns the first item whose `key` equals `value` for `spaceURI`, `spaceMeetURL`, or `conversationId` and throws `Error('key must be one of, spaceURI, spaceMeetURL, or conversationId')` for any other key; a falsy value returns `null`. | The `src/util.js` comment: store the end time on the item so clients display start and end without calculating. The key list limits lookups to the fields that identify a meeting's space. | `src/collection.js`, `src/util.js`, `src/calendar.js` | `test/unit/spec/utils.js` "return the end time for meeting"; `test/unit/spec/calendar.js` "#syncCalendar()" reads `getAll` | `getByType` has no case. A missing `start` or `durationMinutes` yields an invalid `endTime` | Present |
183
+ | `MOD-007` | `list(options)` GETs service `calendar`, resource `calendarEvents`, with `qs` = `options` (default `{}`). For every returned item without `encryptedParticipants` it GETs the item's `participantsUrl` and copies `body.encryptedParticipants` onto the item; it resolves the items array after all those requests settle. | The JSDoc: retrieve meetings for a time range. Participants are fetched separately when the list omits them, so every listed meeting carries participants. | `src/calendar.js` | `test/unit/spec/calendar.js` "#list()" cases | Every fixture already has `encryptedParticipants`, so the participants fetch has no case; one failed fetch rejects the whole list | Present |
184
+ | `MOD-008` | `syncCalendar(options)` calls `list({fromDate, toDate})`, stores every item in the collection, and resolves `getAll()`, which includes items from earlier syncs and events. | The JSDoc: retrieve calendars for the request window, then serve them from the collection. | `src/calendar.js`, `src/collection.js` | `test/unit/spec/calendar.js` "should sync from calendar service" | Items outside the new window are never evicted | Present |
185
+ | `MOD-009` | `getNotes(id)` GETs service `calendar`, resource `calendarEvents/<base64url(id)>/notes`; `getNotesByUrl(url)` and `getParticipants(url)` GET `uri`. All three resolve the whole response. | The JSDoc: fetch notes or participants of one meeting, by id or by the URL the meeting object carries. | `src/calendar.js` | `test/unit/spec/calendar.js` "#getNotes()", "#getParticipants()", "#getNotesByUrl()" | Decryption is left to `MOD-010` and `MOD-011` | Present |
186
+ | `MOD-010` | Five inbound predicates select payloads: `transformMeetingNotes` when the body has `encryptedNotes`, `transformMeetingParticipants` when it has `encryptedParticipants`, and `transformMeeting` when it has `seriesId`, each skipped when the response options are service `calendar`, method `GET`, resource `schedulerData`; `transformMeetingArray` when `body.items[0].seriesId` exists, extracting `body.items`; and `transformMeeting` when the object has `calendarMeetingExternal`, extracting it. | Inbound transforms let every read path return plaintext without explicit calls. The schedulerData exclusion keeps those responses for `getSchedulerData`, which decrypts them itself (`MOD-014`); no comment states this, it is read from the code. | `src/index.js`, `src/calendar.js` | `test/integration/spec/calendar.js` (skipped) | No unit case. Only the first list item is inspected | Weak |
187
+ | `MOD-011` | The transforms require `encryptionKeyUrl` and call `decryptTextProp` in parallel. `transformMeeting` decrypts `encryptedSubject`, `encryptedLocation`, `encryptedNotes`, `webexURI`, `webexURL`, `spaceMeetURL`, `spaceURI`, `spaceURL`, the `encryptedOrganizer` and every `encryptedParticipants` entry's `encryptedEmailAddress` and `encryptedName`, and `meetingJoinInfo.meetingJoinURI` and `meetingJoinURL`. `transformMeetingNotes` decrypts `encryptedNotes`; `transformMeetingParticipants` decrypts the participant fields; `transformMeetingArray` applies `transformMeeting` to each item. Fields keep their names after decryption. | Meeting text is stored encrypted under the meeting's key, and these are the fields that carry user content or join links. | `src/index.js` | `test/integration/spec/calendar.js` (skipped) | No unit case. A field that fails to decrypt becomes the conversation `decryptionFailureMessage` rather than rejecting | Weak |
188
+ | `MOD-012` | `processMeetingEvent(event)` runs `webex.transform('inbound', event)` and resolves the same event, so an event carrying `calendarMeetingExternal` has that meeting decrypted in place. | The JSDoc: decrypt an encrypted incoming calendar event. Mercury handlers store events without decrypting (`MOD-005`). | `src/calendar.js`, `src/index.js` | None found | No caller in this repository and no test | Weak |
189
+ | `MOD-013` | `createCalendarEvent(data, query)` POSTs to `calendarEvents/sync`; `updateCalendarEvent(id, data, query)` PATCHes `calendarEvents/<base64url(id)>/sync`; both first encrypt `data` in place. `deleteCalendarEvent(id, query)` DELETEs `calendarEvents/<base64url(id)>/sync`. All use service `calendar`, `qs` = `query` or `{}`, and resolve the whole response. Encryption creates one KMS unbound key when the plugin has no `encryptionKeyUrl`, caches its `uri` on the plugin, sets `data.encryptionKeyUrl` to it (replacing a caller value), and encrypts `subject`, `notes`, and `webexOptions`, plus `displayName` and `email` of each `attendees` entry. | The JSDoc: create, update, or delete a calendar event; the payload carries its key URL so the service and other clients can decrypt it. | `src/calendar.js`, `src/calendar.encrypt.helper.js` | `test/unit/spec/calendar.js` "#createCalendarEvent()", "#updateCalendarEvent()", "#deleteCalendarEvent()" | Attendee encryption is started but not awaited (see Pitfalls). The cases assert `body: data` against the same mutated object, so they do not check ciphertext | Weak |
190
+ | `MOD-014` | `getSchedulerData(query)` GETs service `calendar`, resource `schedulerData`, with `qs` = `query` or `{}`, decrypts the body with `decryptSchedulerDataResponse`, and resolves the whole response. When the body has `encryptionKeyUrl`, that helper decrypts the same top-level fields, organizer, participants, and `meetingJoinInfo` as `MOD-011`, plus `encryptedEmail` and `encryptedDisplayName` of every `encryptedScheduleFor` entry, with `encryption.decryptText` directly. | The typedef: scheduler data serves scheduling, including schedule-on-behalf (`organizerCIUserId`), so the `encryptedScheduleFor` map must be decrypted too, which the transforms do not do. | `src/calendar.js`, `src/calendar.decrypt.helper.js` | `test/unit/spec/calendar.js` "#getSchedulerData()"; `test/unit/spec/calendar.decrypt.helper.js` "#decryptSchedulerDataResponse" cases | The `getSchedulerData` case has no `encryptionKeyUrl`, so the call path skips decryption; one failed field rejects the call | Present |
191
+ | `MOD-015` | `getFreeBusy(data, query)` encrypts each entry of `data.emails` with the cached or newly created key and sets `data.encryptionKeyUrl` only when `data.emails` is an array; otherwise the body is sent as given. It POSTs `data` to service `calendar`, resource `freebusy`, then resolves only when Mercury `event:calendar.free_busy` delivers a `calendarFreeBusyScheduleResponse` whose `requestId` equals `data.requestId`. That response is decrypted (each `calendarFreeBusyItems[].email`), loses `encryptionKeyUrl`, and is the resolved value; the pending entry is deleted. | The `encryptFreeBusyRequest` JSDoc: the calendar service validates that the key URL and the sensitive data are both present, and returns 400 otherwise, so a request without emails must carry neither. The answer is produced asynchronously and pushed over Mercury. | `src/calendar.js`, `src/calendar.encrypt.helper.js`, `src/calendar.decrypt.helper.js` | `test/unit/spec/calendar.encrypt.helper.js` both cases; `test/unit/spec/calendar.decrypt.helper.js` "#decryptFreeBusyResponse" cases | `getFreeBusy` and `_handleFreeBusy` have no case. Pending and duplicate-`requestId` behavior is under Concurrency and reactive flow and Caller-visible failure modes | Weak |
192
+
193
+ ## Design overview
194
+
195
+ `Calendar` extends `WebexPlugin` in namespace `Calendar`, so `this.config` is `webex.config.calendar`.
196
+ It is mostly a request builder for the calendar service, with one piece of local state: a meeting
197
+ collection that `syncCalendar` fills from `list` and that Mercury create, update, and delete events
198
+ keep current after `register()`.
199
+
200
+ Encryption runs in two styles. Reads that pass through the SDK request pipeline are decrypted by the
201
+ inbound payload transformer registered in `src/index.js`, which delegates each field to the
202
+ conversation plugin's `decryptTextProp`. Scheduler data and free-busy answers are decrypted by
203
+ `src/calendar.decrypt.helper.js`, because scheduler data carries a schedule-on-behalf map the
204
+ transforms do not handle and free-busy answers arrive over Mercury, not as HTTP responses. Writes call
205
+ `src/calendar.encrypt.helper.js` explicitly, with one KMS key created on first use and reused by the
206
+ plugin instance afterwards.
207
+
208
+ `getFreeBusy` is a request-then-event exchange: the POST only starts the lookup, and the result comes
209
+ back as a Mercury event matched by the caller's `requestId`.
210
+
211
+ ## Data flow and sequence coverage
212
+
213
+ Call style: in-process calls on `webex.internal.calendar`; outbound HTTPS through `webex.request`;
214
+ inbound Mercury events. Four operation groups differ in actors, ordering, or outcome, and each has a
215
+ diagram. Single-request reads (`getNotes`, `getNotesByUrl`, `getParticipants`) and
216
+ `deleteCalendarEvent` follow the same request-and-resolve-response shape and are covered by
217
+ Requirements.
218
+
219
+ | Operation group | Entry and outcome | Diagram or evidence | Failure and recovery coverage |
220
+ | --------------- | ----------------- | ------------------- | ----------------------------- |
221
+ | Register and receive events | `register` subscribes; Mercury events update the collection and trigger plugin events | Register diagram; `src/calendar.js` | Cannot-authorize and connect failures reject |
222
+ | Sync meetings | `syncCalendar` lists, fetches missing participants, stores, and resolves the collection | Sync diagram; `src/calendar.js`, `src/index.js` | Any failed request rejects |
223
+ | Write an event | `createCalendarEvent` or `updateCalendarEvent` encrypts, then sends | Write diagram; `src/calendar.encrypt.helper.js` | KMS or request rejection propagates |
224
+ | Free-busy | `getFreeBusy` POSTs, then resolves from `event:calendar.free_busy` | Free-busy diagram; `src/calendar.js` | No timeout; an unmatched event is logged and ignored |
225
+
226
+ ### Register and receive events
227
+
228
+ ```mermaid
229
+ sequenceDiagram
230
+ participant Client as First-party client
231
+ participant Cal as Calendar
232
+ participant Dev as webex.internal.device
233
+ participant Merc as webex.internal.mercury
234
+ participant Coll as CalendarCollection
235
+ Client->>Cal: register()
236
+ alt webex.canAuthorize false
237
+ Cal-->>Client: reject SDK cannot authorize
238
+ else already registered
239
+ Cal-->>Client: resolve
240
+ else
241
+ Cal->>Dev: register()
242
+ Cal->>Merc: connect()
243
+ Cal->>Merc: on six event:calendar.* names
244
+ Cal-->>Client: calendar:registered, registered true
245
+ end
246
+ Merc-->>Cal: event:calendar.meeting.create or update
247
+ Cal->>Coll: set(calendarMeetingExternal) with endTime
248
+ Cal-->>Client: calendar:create or calendar:update with item
249
+ Merc-->>Cal: event:calendar.meeting.delete
250
+ Cal->>Coll: remove(id)
251
+ Cal-->>Client: calendar:delete with removed item
252
+ ```
253
+
254
+ ### Sync meetings
255
+
256
+ ```mermaid
257
+ sequenceDiagram
258
+ participant Client as First-party client
259
+ participant Cal as Calendar
260
+ participant PT as payload transformer
261
+ participant CS as calendar service
262
+ participant Coll as CalendarCollection
263
+ Client->>Cal: syncCalendar({fromDate, toDate})
264
+ Cal->>CS: GET calendarEvents?fromDate&toDate
265
+ CS-->>PT: items with seriesId
266
+ PT->>PT: transformMeetingArray, decryptTextProp per field
267
+ PT-->>Cal: decrypted items
268
+ loop each item without encryptedParticipants
269
+ Cal->>CS: GET participantsUrl
270
+ CS-->>PT: encryptedParticipants
271
+ PT-->>Cal: decrypted when encryptionKeyUrl is present
272
+ end
273
+ Cal->>Coll: setAll(items)
274
+ Cal-->>Client: getAll()
275
+ ```
276
+
277
+ ### Write an event
278
+
279
+ ```mermaid
280
+ sequenceDiagram
281
+ participant Client as First-party client
282
+ participant Cal as Calendar
283
+ participant Enc as webex.internal.encryption
284
+ participant CS as calendar service
285
+ Client->>Cal: createCalendarEvent(data, query)
286
+ alt no cached encryptionKeyUrl
287
+ Cal->>Enc: kms.createUnboundKeys count 1
288
+ Enc-->>Cal: key, uri cached on the plugin
289
+ end
290
+ Cal->>Cal: data.encryptionKeyUrl set
291
+ Cal->>Enc: encryptText subject, notes, webexOptions
292
+ Cal-->>Enc: attendee encryptText started, not awaited
293
+ Cal->>CS: POST calendarEvents/sync with data
294
+ CS-->>Client: response
295
+ ```
296
+
297
+ ### Free-busy
298
+
299
+ ```mermaid
300
+ sequenceDiagram
301
+ participant Client as First-party client
302
+ participant Cal as Calendar
303
+ participant Enc as webex.internal.encryption
304
+ participant CS as calendar service
305
+ participant Merc as webex.internal.mercury
306
+ Client->>Cal: getFreeBusy({requestId, emails, ...}, query)
307
+ opt emails is an array
308
+ Cal->>Enc: encryptText each email, encryptionKeyUrl set
309
+ end
310
+ Cal->>CS: POST freebusy
311
+ CS-->>Cal: acknowledgement
312
+ Cal->>Cal: rpcEventRequests[requestId] = resolver
313
+ Merc-->>Cal: event:calendar.free_busy
314
+ Cal->>Enc: decryptText each calendarFreeBusyItems email
315
+ alt requestId is pending
316
+ Cal-->>Client: resolve calendarFreeBusyScheduleResponse
317
+ else
318
+ Cal->>Cal: log receive other requests
319
+ end
320
+ ```
321
+
322
+ ## Class and component relationships
323
+
324
+ ```mermaid
325
+ classDiagram
326
+ class WebexPlugin
327
+ class Calendar {
328
+ namespace Calendar
329
+ registered
330
+ rpcEventRequests
331
+ register()
332
+ unregister()
333
+ syncCalendar()
334
+ list()
335
+ getSchedulerData()
336
+ createCalendarEvent()
337
+ getFreeBusy()
338
+ }
339
+ class CalendarCollection {
340
+ items
341
+ set()
342
+ getBy()
343
+ getAll()
344
+ remove()
345
+ }
346
+ class CalendarUtil {
347
+ calculateEndTime()
348
+ }
349
+ class EncryptHelper {
350
+ encryptCalendarEventRequest()
351
+ encryptFreeBusyRequest()
352
+ }
353
+ class DecryptHelper {
354
+ decryptSchedulerDataResponse()
355
+ decryptFreeBusyResponse()
356
+ }
357
+ WebexPlugin <|-- Calendar
358
+ Calendar ..> CalendarCollection : module singleton
359
+ CalendarCollection ..> CalendarUtil
360
+ Calendar ..> EncryptHelper
361
+ Calendar ..> DecryptHelper
362
+ ```
363
+
364
+ `Calendar` reaches device, mercury, and encryption through `this.webex.internal` at call time. The
365
+ helpers take the plugin as their `ctx` argument, so the cached `encryptionKeyUrl` lives on the plugin.
366
+
367
+ ## Use cases and flows
368
+
369
+ | Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
370
+ | -------- | --------------- | ------------------------- | ---------------------------- | -------- |
371
+ | `UC-001` | Client showing upcoming meetings | `register`, then `syncCalendar`, then `getAll` and the `calendar:*` events | Cannot-authorize rejects; items are kept until replaced or deleted | `src/calendar.js`, `test/unit/spec/calendar.js` |
372
+ | `UC-002` | Client opening a meeting's space | `getByType('spaceURI', uri)` or `conversationId` | Another key throws | `src/calendar.js` |
373
+ | `UC-003` | Client reading meeting detail | `getNotes`, `getNotesByUrl`, `getParticipants` | HTTP errors propagate | `src/calendar.js`, `test/unit/spec/calendar.js` |
374
+ | `UC-004` | Client scheduling a meeting | `getSchedulerData`, then `createCalendarEvent` or `updateCalendarEvent`, or `deleteCalendarEvent` | KMS or HTTP errors propagate | `src/calendar.js`, `src/calendar.encrypt.helper.js` |
375
+ | `UC-005` | Client checking attendee availability | `getFreeBusy` after `register` | Never settles without a matching Mercury event | `src/calendar.js` |
376
+
377
+ ### Cross-boundary use-case flow
378
+
379
+ | Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
380
+ | -------- | ---------------------- | ------------- | ---------------------------- |
381
+ | Calendar service (`UC-001` to `UC-005`) | HTTPS through `webex.request` with catalog service `calendar`, or the meeting's own URLs | Request shapes under Protocol and wire format | No plugin-local retry; webex-core interceptors apply |
382
+ | KMS through the encryption plugin (`UC-004`, `UC-005`) | In-process calls that send KMS requests | Key URI cached per plugin instance | Rejections propagate |
383
+ | Mercury (`UC-001`, `UC-005`) | Web socket events after `register` | `calendarMeetingExternal` and `calendarFreeBusyScheduleResponse` envelopes | Reconnect is Mercury's; events missed while offline are not replayed by this module |
384
+
385
+ ## Client state model
386
+
387
+ | State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
388
+ | -------------- | ----- | ------------- | ------------------- | ----------------------------- |
389
+ | `CalendarCollection.items` | `src/collection.js` module-level object | `{}` | `syncCalendar`, Mercury create, update, and delete events | In memory for the JavaScript module, so every SDK instance in the process shares the same meetings; `reset()` exists but nothing calls it |
390
+ | `registered` | Calendar | `false` | `true` after a successful `register`, `false` after `unregister` | In memory per instance |
391
+ | `rpcEventRequests` | Calendar prototype (declared in the `WebexPlugin.extend` body) | `[]` used as a map | Entry added by `getFreeBusy`, removed by the matching free-busy event | In memory, so every SDK instance in the process shares the same pending free-busy requests |
392
+ | `encryptionKeyUrl` | Calendar instance | unset | Set by the first create, update, or free-busy call with emails | In memory for the instance; never rotated |
393
+
394
+ ## Business rules and invariants
395
+
396
+ | ID | Invariant | WHY | Enforcement source | Test evidence |
397
+ | -- | --------- | --- | ------------------ | ------------- |
398
+ | `INV-001` | `subject`, `notes`, `webexOptions`, and free-busy `emails` are KMS-encrypted in place before the request is sent, and the payload carries the key's `encryptionKeyUrl`. | The calendar service stores and checks ciphertext under the named key. | `src/calendar.encrypt.helper.js`, `src/calendar.js` | `test/unit/spec/calendar.encrypt.helper.js` |
399
+ | `INV-002` | A free-busy payload carries `encryptionKeyUrl` only when it carries an `emails` array. | The `encryptFreeBusyRequest` JSDoc: the service returns 400 unless both are present together. | `src/calendar.encrypt.helper.js` | `test/unit/spec/calendar.encrypt.helper.js` "not include emails" |
400
+ | `INV-003` | A scheduler-data response is decrypted once, by `decryptSchedulerDataResponse`, and never by the meeting predicates. | Double decryption would fail on plaintext; read from the predicate exclusions and the explicit helper call. | `src/index.js`, `src/calendar.js` | `test/unit/spec/calendar.decrypt.helper.js` |
401
+ | `INV-004` | Every stored meeting has `endTime` derived from `start` and `durationMinutes`. | The `src/util.js` comment: clients display start and end without calculating. | `src/collection.js`, `src/util.js` | `test/unit/spec/utils.js` |
402
+ | `INV-005` | `register` while registered and `unregister` while unregistered do nothing and resolve. | The JSDoc log messages: already registered, already unregistered. | `src/calendar.js` | None found |
403
+
404
+ ## Concurrency and reactive flow
405
+
406
+ - Execution model: single event loop; every public method returns a promise except `getAll` and
407
+ `getByType`.
408
+ - Ordering guarantees: field encryption and decryption run in parallel inside one call. `list`
409
+ fetches missing participants in parallel and resolves after all of them. Mercury events are applied
410
+ to the collection in arrival order, and the plugin event fires after the collection change.
411
+ - Idempotency and retry: `register` checks `registered` before its async chain and sets it only at the
412
+ end, so two overlapping `register` calls both subscribe and each Mercury event is then handled twice.
413
+ No plugin-local retry exists.
414
+ - Shared-state protection: none for the process-wide state under Client state model. A second
415
+ `getFreeBusy` with the same `requestId` replaces the first resolver, which then never settles.
416
+ - Blocking restrictions: none in this module; the pending `getFreeBusy` outcomes are under
417
+ Caller-visible failure modes.
418
+
419
+ ## Protocol and wire format
420
+
421
+ | Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
422
+ | ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
423
+ | `GET calendarEvents?fromDate=&toDate=` response `{items: [meeting]}` | Unversioned | `list` | Calendar service, then `transformMeetingArray` | Items carry `seriesId`, `encryptionKeyUrl`, `participantsUrl` |
424
+ | `GET <participantsUrl>` response `{encryptedParticipants}` | Unversioned | `getParticipants`, `list` | Calendar service | Decrypted by `transformMeetingParticipants` when `encryptionKeyUrl` is present |
425
+ | `GET calendarEvents/<base64url(id)>/notes`, `GET <notesUrl>` response `{encryptedNotes, encryptionKeyUrl}` | Unversioned | `getNotes`, `getNotesByUrl` | Calendar service | Decrypted by `transformMeetingNotes` |
426
+ | `POST calendarEvents/sync`, `PATCH calendarEvents/<base64url(id)>/sync` body `{encryptionKeyUrl, subject, notes, webexOptions, attendees: [{displayName, email}], ...}` | Unversioned | `createCalendarEvent`, `updateCalendarEvent` | Calendar service | Text fields are ciphertext |
427
+ | `DELETE calendarEvents/<base64url(id)>/sync` | Unversioned | `deleteCalendarEvent` | Calendar service | `qs` passed through |
428
+ | `GET schedulerData?siteName=&id=&clientMeetingId=&scheduleTemplateId=&sessionTypeId=&organizerCIUserId=&usmPreference=&webexMeetingId=&eventId=&icalUid=&thirdPartyType=` response with the meeting fields and `encryptedScheduleFor` map | Unversioned | `getSchedulerData` | Calendar service, then `decryptSchedulerDataResponse` | Query keys from the `QuerySchedulerDataOptions` typedef |
429
+ | `POST freebusy` body `{requestId, emails, encryptionKeyUrl, ...}` | Unversioned | `getFreeBusy` | Calendar service | `encryptionKeyUrl` only with `emails` (`INV-002`) |
430
+ | Mercury `calendar.meeting.create`, `.create.minimal`, `.update`, `.update.minimal`, `.delete` with `data.calendarMeetingExternal` | Unversioned | Calendar service through Mercury | `_handleCreate`, `_handleUpdate`, `_handleDelete` | Keyed by `calendarMeetingExternal.id` |
431
+ | Mercury `calendar.free_busy` with `data.calendarFreeBusyScheduleResponse {requestId, encryptionKeyUrl, calendarFreeBusyItems: [{email, ...}]}` | Unversioned | Calendar service through Mercury | `_handleFreeBusy` | Matched by `requestId` |
432
+
433
+ ## Caller-visible failure modes
434
+
435
+ | Condition | Signal or result | Caller behavior | Retry or recovery | Evidence |
436
+ | --------- | ---------------- | --------------- | ----------------- | -------- |
437
+ | `register` before the SDK can authorize | Rejected `Error` `SDK cannot authorize`, logged | Authorize first | Call again | `src/calendar.js` |
438
+ | Device registration or Mercury connect fails in `register` | The original rejection, logged as `calendar->register#ERROR` | Handle the error; `registered` stays false | Call again | `src/calendar.js` |
439
+ | `getByType` with another key | Synchronous `Error` `key must be one of, spaceURI, spaceMeetURL, or conversationId` | Use one of the three keys | None | `src/calendar.js` |
440
+ | Calendar service request fails | The `webex.request` rejection, unchanged | Handle the HTTP error | Caller may retry | `src/calendar.js` |
441
+ | A participants fetch inside `list` fails | `list` and `syncCalendar` reject | Retry the list | Caller may retry | `src/calendar.js` |
442
+ | KMS key creation or encryption fails | The encryption plugin's rejection; the request is not sent | Handle as an encryption error | Caller may retry | `src/calendar.encrypt.helper.js` |
443
+ | A scheduler-data field fails to decrypt | `getSchedulerData` rejects | Handle as an encryption error | Caller may retry | `src/calendar.decrypt.helper.js` |
444
+ | A meeting field fails to decrypt in a transform | The field reads 'This message cannot be decrypted'; no rejection | Treat that string as a decryption failure | None | `src/index.js`; sibling package internal-plugin-conversation, file src/decryption-transforms.js |
445
+ | No matching free-busy event arrives | `getFreeBusy` stays pending | Apply a caller-side timeout | Call again with a new `requestId` | `src/calendar.js` |
446
+ | A free-busy event fails to decrypt | Unhandled rejection; the pending `getFreeBusy` never settles | Apply a caller-side timeout | None | `src/calendar.js` |
447
+
448
+ ## Pitfalls and constraints
449
+
450
+ - `encryptCalendarEventRequest` passes the attendee promises to `Promise.all` as one nested array, so
451
+ it does not wait for them. It resolves, and `createCalendarEvent` or `updateCalendarEvent` builds the
452
+ request, while attendee `displayName` and `email` may still be plaintext. A temporary unit case under
453
+ Node 22.14 showed `email` unchanged at the moment the helper resolved.
454
+ - Two SDK instances in one process share meetings and pending free-busy requests; see Client state
455
+ model.
456
+ - `unregister` calls `mercury.off(name)` with no callback, which removes every listener on those six
457
+ event names, including listeners another component added. It then disconnects Mercury and
458
+ unregisters the device for the whole SDK instance.
459
+ - Before reading the text of a meeting delivered by Mercury (`MOD-005`), call `processMeetingEvent`
460
+ (`MOD-012`) or re-sync.
461
+ - The event JSDoc in `src/calendar.js` names `calendar:meeting:create`, `calendar:meeting:update`, and
462
+ `calendar:meeting:delete`; the emitted names are `calendar:create`, `calendar:update`, and
463
+ `calendar:delete` from `src/constants.js`.
464
+ - `getFreeBusy` stores a `reject` that is never called, and its `.catch` only rethrows.
465
+ - `package.json` `test` runs `yarn test:integration`, which is not defined, so the aggregate `test`
466
+ script fails at that step. The integration spec runs only through `test:browser` (karma) and is
467
+ skipped.
468
+ - The unit specs import `@webex/internal-plugin-calendar` by name, which loads `dist/`. Run
469
+ `build:src` before `test:unit`, or the tests run against stale output.
470
+
471
+ ## Module-specific rules
472
+
473
+ - Do: encrypt every user-content field with the plugin's `encryptionKeyUrl` before it leaves the
474
+ client, and send that URL with the payload (`INV-001`).
475
+ - Do: send `encryptionKeyUrl` with a free-busy request only together with `emails` (`INV-002`).
476
+ - Do: keep the schedulerData exclusion in the three meeting predicates while `getSchedulerData`
477
+ decrypts explicitly (`INV-003`).
478
+ - Do: emit plugin events with the names in `src/constants.js`, after the collection changes.
479
+ - Do: log through `this.logger` with the `calendar->` or `webex.internal.calendar -` prefix, and never
480
+ log decrypted meeting content, emails, or keys (`src/calendar.js`).
481
+ - Do not: change `getByType` keys or the derived `endTime` without updating consumers (`MOD-006`).
482
+
483
+ ## Export stability
484
+
485
+ | Export or entry point | Consumer | Stability | Versioning and deprecation rule | Declaration or API report |
486
+ | --------------------- | -------- | --------- | ------------------------------- | ------------------------- |
487
+ | Default export `Calendar` | Packages building on the class; unit specs | Internal | The README says internal plugins do not strictly follow semver; no deprecation rule is declared | `src/index.js` |
488
+ | Import side effect: internal plugin `calendar` and its payload transformer | `webex`, `webex-node`, `@webex/webex-server`, `@webex/recipe-private-web-client` | Internal | Same | `src/index.js`, `package.json` |
489
+ | Plugin API `webex.internal.calendar.*` and its `calendar:*` events | First-party clients | Internal | Same | `src/calendar.js`, `src/constants.js` |
490
+
491
+ No TypeScript declaration or API report is shipped; `package.json` has no `types` field and the
492
+ source is JavaScript.
493
+
494
+ ## Key design trade-off
495
+
496
+ | Chosen trade-off | Preserved invariant or benefit | Cost or limitation | Decision evidence |
497
+ | ---------------- | ------------------------------ | ------------------ | ----------------- |
498
+ | Transformer-based decryption for meeting reads | Every read path returns plaintext without explicit calls | Decryption failures become a placeholder string; Mercury events bypass it | `src/index.js` |
499
+ | Explicit helper decryption for scheduler data and free-busy | The schedule-on-behalf map and Mercury-delivered answers are decrypted | Two decryption paths with different failure behavior (`INV-003`) | `src/calendar.js`, `src/calendar.decrypt.helper.js` |
500
+ | Free-busy as POST plus Mercury event | The service can answer asynchronously | Callers depend on `register` and on Mercury delivery for completion (`MOD-015`) | `src/calendar.js` |
501
+ | One KMS key per plugin instance, created lazily | One KMS round trip for all writes | Every event written by the instance shares one key, never rotated | `src/calendar.encrypt.helper.js` |
502
+ | A module-level meeting collection | Simple lookup by any field | Process-wide and never evicted (Client state model) | `src/collection.js` |
503
+
504
+ ## Verification
505
+
506
+ | Requirement or invariant | Test level | Positive evidence | Negative or boundary evidence | Gap |
507
+ | ------------------------ | ---------- | ----------------- | ----------------------------- | --- |
508
+ | `MOD-001` | Unit | `test/unit/spec/calendar.js` imports the package by name | None found | Registration and transformer options not exercised |
509
+ | `MOD-002` | None | None found | None found | No test of the default window |
510
+ | `MOD-003`, `INV-005` | Unit | `test/unit/spec/calendar.js` "#register()" cases | None found | Cannot-authorize, already-registered, and failure paths untested |
511
+ | `MOD-004` | Unit | `test/unit/spec/calendar.js` "#unregister()" cases | None found | Already-unregistered path untested |
512
+ | `MOD-005` | Unit | `test/unit/spec/calendar.js` "Events" cases | None found | `.minimal` variants and unknown-id delete untested |
513
+ | `MOD-006`, `INV-004` | Unit | `test/unit/spec/utils.js` "return the end time for meeting" | None found | `getByType` and its throw untested |
514
+ | `MOD-007`, `MOD-008` | Unit | `test/unit/spec/calendar.js` "#list()", "#syncCalendar()" | None found | Participants fetch path untested |
515
+ | `MOD-009` | Unit | `test/unit/spec/calendar.js` "#getNotes()", "#getParticipants()", "#getNotesByUrl()" | None found | None |
516
+ | `MOD-010`, `MOD-011`, `MOD-012` | Integration | `test/integration/spec/calendar.js` (skipped) | None found | No unit case for any predicate, transform, or `processMeetingEvent` |
517
+ | `MOD-013`, `INV-001` | Unit | `test/unit/spec/calendar.js` create, update, and delete cases | None found | Ciphertext not asserted; attendee path and the unawaited encryption untested |
518
+ | `MOD-014`, `INV-003` | Unit | `test/unit/spec/calendar.decrypt.helper.js` scheduler-data cases; `test/unit/spec/calendar.js` "#getSchedulerData()" | `test/unit/spec/calendar.decrypt.helper.js` early-return cases | Call path with `encryptionKeyUrl` untested |
519
+ | `MOD-015`, `INV-002` | Unit | `test/unit/spec/calendar.encrypt.helper.js`, `test/unit/spec/calendar.decrypt.helper.js` free-busy cases | `test/unit/spec/calendar.encrypt.helper.js` "not include emails" | `getFreeBusy` and the free-busy event untested |
520
+
521
+ Coverage gaps are recorded above. The 28 unit cases in four suites pass under Node 22.14 after
522
+ `build:src`. The integration spec needs live Webex services and test users and is skipped, so it is
523
+ not routine coverage evidence. Generator-side field measurement is complete (93.3%, assessed
524
+ 2026-11-12). Independent validation passed with warnings on 2026-11-12 (runtime 01a1cec9-0225-7283-9212-f70c182f1a3e); the conformance report has zero Blocking findings. The module-map confirmation is recorded in the approved file-touch plan. A
525
+ characterization baseline and promotion past Partial also remain pending.