@webex/webex-core 3.12.0-next.61 → 3.12.0-next.63

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/AGENTS.md ADDED
@@ -0,0 +1,209 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: agent-entry
3
+ generated_from: agents@0.3.0
4
+ generated_by: claude-code
5
+ approved_by: rsarika@cisco.com
6
+ updated_at: 2026-10-07T13:20:21Z
7
+ validation_status: pass-with-warnings
8
+ -->
9
+
10
+ # AI Agent Instructions
11
+
12
+ Instructions for AI coding assistants working on `@webex/webex-core`, the core library of the Webex JS
13
+ SDK: the plugin host, request interceptors, credentials, service discovery and storage layer.
14
+
15
+ ## Working Method
16
+
17
+ - Read the relevant repository files before editing. Do not edit blind.
18
+ - Understand the task and affected surfaces before writing code.
19
+ - Prefer focused edits over rewriting whole files.
20
+ - Do not invent commands, paths, exports, or behavior. Verify them from repository-local source.
21
+ - Test or validate before declaring done.
22
+ - Keep output concise. If something is uncertain, say so instead of guessing.
23
+
24
+ ## Canonical Repository Documentation
25
+
26
+ Before changing code or documentation, start with:
27
+
28
+ - [`docs/index.md`](docs/index.md) for documentation navigation;
29
+ - [`docs/architecture.md`](docs/architecture.md) for package boundaries, dependencies and the contract index;
30
+ - [`docs/specs/README.md`](docs/specs/README.md) for the manifest-backed module and contract registry;
31
+ - the affected module's manifest-routed specification:
32
+ [`src`](src/docs/README.md), [`src/interceptors`](src/interceptors/docs/README.md),
33
+ [`src/lib/credentials`](src/lib/credentials/docs/README.md),
34
+ [`src/lib/services`](src/lib/services/docs/README.md),
35
+ [`src/lib/services-v2`](src/lib/services-v2/docs/README.md),
36
+ [`src/lib/storage`](src/lib/storage/docs/README.md); and
37
+ - [`docs/adr/index.md`](docs/adr/index.md) for durable decisions. None are registered yet.
38
+
39
+ Follow `.sdd/manifest.json` for each contract's publication state and canonical source. The package
40
+ publishes SDK contracts whose native source is the npm entry point declared in `package.json` and the
41
+ barrel `src/index.js`; there is no OpenAPI document because the package serves no HTTP. The manifest
42
+ remains authoritative for canonical paths and artifact decisions. Dependency packages that have their
43
+ own specifications (`@webex/http-core`, `@webex/common`, `@webex/common-timers`,
44
+ `@webex/storage-adapter-spec`) should be read through those specifications first.
45
+
46
+ ## 1. Commands (Run First)
47
+
48
+ Run every command from the Webex JS SDK workspace root. Use only documented commands.
49
+
50
+ | Task | Command |
51
+ | --- | --- |
52
+ | Install dependencies | `yarn install` |
53
+ | Start dev environment | N/A — the package is a library with no runnable entry point |
54
+ | Run tests | `yarn workspace @webex/webex-core test:unit` |
55
+ | Run linters | `yarn workspace @webex/webex-core test:style` |
56
+ | Build/release artifact | `yarn workspace @webex/webex-core build:src` |
57
+ | Format code | N/A — no package-local format command; Prettier configuration is owned at the workspace root |
58
+ | Integration tests (mocha) | `yarn workspace @webex/webex-core test:integration` |
59
+ | Browser tests (karma) | `yarn workspace @webex/webex-core test:browser` |
60
+ | Run one unit file | `yarn workspace @webex/webex-core test:unit --targets <path relative to test/unit/spec>` |
61
+ | Publish | `yarn workspace @webex/webex-core deploy:npm` |
62
+
63
+ The repository requires Node 22.14 (`nvm install 22.14 && nvm use 22.14`); the package itself declares
64
+ `engines.node >=18`. The aggregate `test` script chains lint, unit, integration and browser tiers, so it
65
+ needs provisioned test users and live services. `build` delegates to `build:src`; no command builds and
66
+ tests together. If a required command is unknown, stop and ask for the exact command.
67
+
68
+ ## 2. Agent Persona and Scope
69
+
70
+ You are the engineering assistant for `@webex/webex-core`, the package every other Webex SDK plugin
71
+ registers into and sends requests through.
72
+
73
+ Primary outcomes:
74
+
75
+ - Deliver production-safe changes with passing tests.
76
+ - Preserve existing behavior unless a change request explicitly requires a behavior change.
77
+ - Keep docs and configuration aligned with code changes.
78
+
79
+ Definition of done:
80
+
81
+ 1. Requested change is implemented.
82
+ 2. Relevant tests/lint/build checks pass locally.
83
+ 3. Updated docs/config cover new behavior.
84
+ 4. PR summary includes risks and rollback notes.
85
+
86
+ ## 3. Repository Knowledge
87
+
88
+ ### Tech Stack
89
+
90
+ | Area | Tooling | Version |
91
+ | --- | --- | --- |
92
+ | Language runtime | Node.js | `>=18` (`package.json` engines) |
93
+ | Language | JavaScript with TypeScript in `src/lib/services-v2` and `src/lib/domains.ts` | `package.json` |
94
+ | Build tool | `@webex/legacy-tools` (`webex-legacy-tools build`) | workspace |
95
+ | Test framework | Jest (unit), Mocha (integration), Karma (browser) | `jest.config.js`, `package.json` |
96
+ | Lint/format | ESLint via `@webex/eslint-config-legacy`; Prettier | `^8.24.0` / `^2.7.1` (`package.json`) |
97
+
98
+ ### Project Map
99
+
100
+ - `src/index.js`: package entry point and export barrel; its import order is load-bearing.
101
+ - `src/webex-core.js`, `src/webex-internal-core.js`: the `WebexCore` class, plugin registration and interceptor-chain assembly.
102
+ - `src/config.js`, `src/credentials-config.js`: default configuration; several defaults read environment variables at import time.
103
+ - `src/interceptors/`: sixteen request/response interceptors. Has its own specification.
104
+ - `src/lib/credentials/`: OAuth token lifecycle. Has its own specification.
105
+ - `src/lib/services/` and `src/lib/interceptors/`: v1 service discovery and its interceptors. Has its own specification.
106
+ - `src/lib/services-v2/`: opt-in v2 service discovery in TypeScript. Has its own specification.
107
+ - `src/lib/storage/`: `@persist` decorators, store factories and the in-memory adapter. Has its own specification.
108
+ - `src/lib/batcher.js`, `src/lib/page.js`, `src/lib/webex-http-error.js`, `src/lib/webex-plugin.js`: shared helpers and plugin base classes.
109
+ - `test/unit/`: Jest unit tests; `test/integration/`: Mocha and Karma tests needing test users and live services.
110
+
111
+ ### Critical Constraints
112
+
113
+ - **Import order in `src/index.js` is load-bearing.** Services and credentials are loaded inside core so they initialize before consumer plugins; do not move them into outside plugins or reorder the imports.
114
+ - **Plugin registration is process-global and first-wins.** A duplicate `registerPlugin` name is silently ignored unless `replace` is set; v2 services only activates through such a replace.
115
+ - **`config.interceptors` replaces the whole interceptor chain**, including interceptors registered by plugins.
116
+ - **Tokens are persisted as plaintext JSON.** Never log tokens or weaken the allow-list that decides which hosts receive a bearer token.
117
+ - **Exported names, event names and config keys are public.** 49 workspace packages declare a dependency on this package; removing or renaming one is a breaking change.
118
+ - **Dependent packages resolve this package through `dist`.** Rebuild with `build:src` before trusting a dependent package's tests.
119
+
120
+ ## 4. Testing Workflow
121
+
122
+ Run checks in this order:
123
+
124
+ 1. `yarn workspace @webex/webex-core test:unit`
125
+ 2. `yarn workspace @webex/webex-core test:style`
126
+ 3. `yarn workspace @webex/webex-core test:integration` (requires provisioned test users and live services)
127
+
128
+ Testing rules:
129
+
130
+ - Add or update tests for every behavior change.
131
+ - Cover failure paths and edge cases, not only happy paths.
132
+ - Do not remove tests to make CI pass.
133
+ - Use sinon for stubs, `assert` from `@webex/test-helper-chai`, and fake timers for time-dependent code.
134
+
135
+ This package defines no coverage threshold; the repository owner confirmed there is no coverage gate
136
+ for it. Do not infer one from a platform or CI default.
137
+
138
+ ## 5. Code Style and Patterns
139
+
140
+ Coding expectations:
141
+
142
+ - Follow repository style rules and static analysis output.
143
+ - Prefer small, composable functions over large procedural blocks.
144
+ - Make error handling explicit at system boundaries.
145
+ - Keep public interfaces stable unless a breaking change is requested.
146
+ - Before adding a literal path, filename, command, workflow identifier, status,
147
+ or other policy value, search the repository for exact and semantically
148
+ equivalent uses. When repeated production values represent one shared
149
+ contract, move them to the narrowest owning shared module or catalog as one
150
+ canonical named constant, enum, or type and update consumers. Keep incidental
151
+ similarities, one-off implementation details, and independent test fixtures
152
+ local.
153
+ - Do not import a default, named, object, or namespace binding and immediately
154
+ re-export it. Consumers should import from the owning module; package barrels
155
+ should use direct named re-exports.
156
+ - Do not write inline runtime `typeof` checks outside descriptively named guard
157
+ implementations. Import and reuse the owning guard instead; TypeScript
158
+ type-position `typeof` queries remain allowed.
159
+
160
+ Pattern example:
161
+
162
+ ```text
163
+ Preferred:
164
+ - Validate external input close to the boundary.
165
+ - Return typed/structured results.
166
+ - Include actionable error messages.
167
+
168
+ Avoid:
169
+ - Passing unvalidated payloads deep into the system.
170
+ - Swallowing exceptions or returning ambiguous null values.
171
+ ```
172
+
173
+ ## 6. Git Workflow
174
+
175
+ - Branch naming: no repository-enforced rule was found; use a short descriptive prefix such as `feature/`, `fix/` or `chore/`
176
+ - Commit format: conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`)
177
+ - Keep commits focused and reversible.
178
+ - Rebase on the target branch before opening PR.
179
+
180
+ PR checklist:
181
+
182
+ - What changed and why.
183
+ - Tests run and results.
184
+ - Risk/impact areas.
185
+ - Rollback approach.
186
+
187
+ ## 7. Boundaries and Escalation
188
+
189
+ ### Always
190
+
191
+ - Prefer existing patterns over introducing new architecture.
192
+ - Keep changes minimal for the requested scope.
193
+ - Call out assumptions and unknowns explicitly.
194
+
195
+ ### Ask First
196
+
197
+ - Adding new dependencies or external services.
198
+ - Large refactors or schema migrations.
199
+ - Security-sensitive changes (auth, token handling, persistence, allowed-domain logic).
200
+ - Any change to exported names, event names, config keys or the interceptor order.
201
+ - Any destructive data or infrastructure operation.
202
+
203
+ ### Never
204
+
205
+ - Commit secrets, keys, or credentials.
206
+ - Bypass required checks by disabling tests or linters.
207
+ - Rewrite history on shared branches.
208
+ - Change unrelated files "while here" without clear need.
209
+ - Edit `.sdd/templates/repo-standards` or `dist` by hand.
@@ -302,7 +302,7 @@ var Batcher = _webexPlugin.default.extend({
302
302
  fingerprintResponse: function fingerprintResponse(item) {
303
303
  throw new Error('fingerprintResponse() must be implemented');
304
304
  },
305
- version: "3.12.0-next.61"
305
+ version: "3.12.0-next.63"
306
306
  });
307
307
  var _default2 = exports.default = Batcher;
308
308
  //# sourceMappingURL=batcher.js.map
@@ -655,7 +655,7 @@ var Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
655
655
  this.refresh();
656
656
  }
657
657
  },
658
- version: "3.12.0-next.61"
658
+ version: "3.12.0-next.63"
659
659
  }, (0, _applyDecoratedDescriptor2.default)(_obj, "getUserToken", [_dec, _dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "getUserToken"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "initialize", [_dec3], (0, _getOwnPropertyDescriptor.default)(_obj, "initialize"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "invalidate", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, "invalidate"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight, _dec5, _dec6], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), _obj));
660
660
  var _default = exports.default = Credentials;
661
661
  //# sourceMappingURL=credentials.js.map
@@ -532,7 +532,7 @@ var Token = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
532
532
  return res.body;
533
533
  });
534
534
  },
535
- version: "3.12.0-next.61"
535
+ version: "3.12.0-next.63"
536
536
  }, (0, _applyDecoratedDescriptor2.default)(_obj, "downscope", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "downscope"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "revoke", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "revoke"), _obj), _obj));
537
537
  var _default = exports.default = Token;
538
538
  //# sourceMappingURL=token.js.map
@@ -1641,7 +1641,7 @@ var Services = _webexPlugin.default.extend({
1641
1641
  }, _callee6);
1642
1642
  })));
1643
1643
  },
1644
- version: "3.12.0-next.61"
1644
+ version: "3.12.0-next.63"
1645
1645
  });
1646
1646
  /* eslint-enable no-underscore-dangle */
1647
1647
  var _default = exports.default = Services;
@@ -1577,7 +1577,7 @@ var Services = _webexPlugin.default.extend({
1577
1577
  }, _callee5);
1578
1578
  })));
1579
1579
  },
1580
- version: "3.12.0-next.61"
1580
+ version: "3.12.0-next.63"
1581
1581
  });
1582
1582
  /* eslint-enable no-underscore-dangle */
1583
1583
  var _default = exports.default = Services;
@@ -57,7 +57,7 @@ var Logger = _webexPlugin.default.extend({
57
57
  info: wrapConsoleMethod('info'),
58
58
  debug: wrapConsoleMethod('debug'),
59
59
  trace: wrapConsoleMethod('trace'),
60
- version: "3.12.0-next.61"
60
+ version: "3.12.0-next.63"
61
61
  });
62
62
  (0, _webexCore.registerPlugin)('logger', Logger);
63
63
  var _default = exports.default = Logger;
@@ -98,7 +98,7 @@ var MAX_FILE_SIZE_IN_MB = 2048;
98
98
  * @class
99
99
  */
100
100
  var WebexCore = _ampersandState.default.extend((_obj = {
101
- version: "3.12.0-next.61",
101
+ version: "3.12.0-next.63",
102
102
  children: {
103
103
  internal: _webexInternalCore.default
104
104
  },
@@ -642,7 +642,7 @@ var WebexCore = _ampersandState.default.extend((_obj = {
642
642
  });
643
643
  }
644
644
  }, (0, _applyDecoratedDescriptor2.default)(_obj, "_uploadPhaseUpload", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, "_uploadPhaseUpload"), _obj), _obj));
645
- WebexCore.version = "3.12.0-next.61";
645
+ WebexCore.version = "3.12.0-next.63";
646
646
  (0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors);
647
647
  (0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors);
648
648
  var _default = exports.default = WebexCore;
@@ -0,0 +1,32 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: standing-doc
3
+ generated_from: adr-index@0.3.0
4
+ generated_by: claude-code
5
+ approved_by: rsarika@cisco.com
6
+ updated_at: 2026-10-07T13:20:21Z
7
+ validation_status: pass-with-warnings
8
+ -->
9
+
10
+ # Architectural decision records
11
+
12
+ Numbered, append-only records of structural decisions affecting `@webex/webex-core` and its
13
+ documentation. Add a concrete ADR (for example, `0001-some-decision.md`) when a decision is
14
+ non-obvious, hard to reverse, or worth explaining to a future contributor. Do not edit an accepted
15
+ decision in place when its outcome changes; supersede it with a new ADR and link both records.
16
+
17
+ ## Index
18
+
19
+ No architectural decisions are registered yet.
20
+
21
+ The package does carry design decisions worth preserving — services and credentials living inside core
22
+ rather than as outside plugins (stated in the header comment of [`src/index.js`](../../src/index.js)), a
23
+ process-global plugin registry, and parallel v1 and v2 service discovery. They are recorded in the
24
+ module specifications' trade-off sections rather than as ADRs, because the code does not identify the
25
+ deciders or decision dates an ADR record requires. Promote any of them to a numbered ADR once that
26
+ provenance is established.
27
+
28
+ Add new entries as ADRs are accepted. Keep this list in numeric order.
29
+
30
+ Each ADR should state its context, decision, alternatives, consequences, and the condition that would
31
+ cause the team to revisit it. Record the deciders, any superseded decision, and the constraint future
32
+ changes must preserve.
@@ -0,0 +1,298 @@
1
+ ---
2
+ type: Architecture
3
+ title: '@webex/webex-core architecture'
4
+ description: Package boundaries, resources, interactions, dependencies, and cross-cutting architecture of @webex/webex-core.
5
+ tags: [architecture]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: architecture@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rsarika@cisco.com
12
+ updated_at: 2026-10-07T13:20:21Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # @webex/webex-core architecture
17
+
18
+ Canonical architecture for the `@webex/webex-core` package. This document owns facts that span its
19
+ modules and its neighbors in the Webex JS SDK workspace. Owner-local detail lives in the module
20
+ specifications linked from the [specification registry](specs/README.md).
21
+
22
+ Related context: [specification registry](specs/README.md) · [agent instructions](../AGENTS.md)
23
+
24
+ ## Applicability
25
+
26
+ | Condition ID | Status | Evidence or reason | Owned section |
27
+ | --- | --- | --- | --- |
28
+ | `repo.owns_datastore` | N/A | The package provisions no datastore; persistence goes through a host-supplied storage adapter (`src/lib/storage/index.js`) | Repository data and schema |
29
+ | `repo.holds_client_state` | Applicable | `WebexCore` is an observable state model holding config, session id and load flags (`src/webex-core.js`), and credentials hold tokens (`src/lib/credentials/credentials.js`) | Client state model |
30
+ | `repo.components_interact` | Applicable | `src/webex-core.js` wires interceptors, credentials, services and storage together | Dependency and interaction topology |
31
+ | `repo.domain_data_across_components` | N/A | No domain object spans resources; each module owns its own state | Object and data ownership |
32
+ | `repo.caches_data` | Applicable | The U2C hostmap is cached in `localStorage` with a TTL (`src/lib/services/services.js`, `src/lib/services-v2/services-v2.ts`) | Caching catalog |
33
+ | `repo.observability_convention` | Applicable | Plugin logger with level precedence (`src/plugins/logger.js`), request events and tracking ids (`src/interceptors/request-event.js`, `src/interceptors/webex-tracking-id.js`) | Observability patterns |
34
+ | `repo.deploys_to_infra` | N/A | A library published to npm; `package.json` declares no container, deployment manifest or start command | Runtime and infrastructure |
35
+ | `repo.shared_base_libs` | Applicable | Lint, babel, jest and build tooling are inherited from the workspace legacy config packages (`.eslintrc.js`, `babel.config.js`, `jest.config.js`) | Shared and base libraries |
36
+ | `repo.is_monorepo` | Applicable | One workspace package among many in the Webex JS SDK yarn workspace (`package.json` `repository.directory`) | Package map and inter-package dependencies |
37
+ | `repo.multi_platform` | Applicable | Runs in Node and browsers; `package.json` declares a `browserify` transform and tests carry `browserOnly`/`nodeOnly` guards | Platform matrix |
38
+ | `repo.published_package` | Applicable | `package.json` declares `main`, `devMain` and `deploy:npm` | Release and versioning |
39
+ | `repo.embedded_in_host` | Applicable | It runs inside host applications that supply storage, config and a network stack | Host integration |
40
+ | `repo.exposes_commands_or_artifacts` | N/A | The only build artifact is the transpiled `dist` of the same exports; no CLI or generator | Commands and generated artifacts |
41
+ | `repo.cross_repo_deps_material` | N/A | Dependencies are workspace packages and npm libraries; no separate repository is required | Cross-repository topology |
42
+ | `repo.security_arch_warranted` | Applicable | It holds OAuth tokens, attaches bearer headers, and persists tokens as plain JSON (`src/lib/credentials/credentials.js`, `src/interceptors/auth.js`) | Security architecture |
43
+
44
+ ## Design overview
45
+
46
+ `@webex/webex-core` is the base of the Webex JS SDK. The default export, `WebexCore`
47
+ (`src/webex-core.js`), is an observable model that owns a process-global plugin registry. Other SDK
48
+ packages register public (`registerPlugin`) and internal (`registerInternalPlugin`) plugins against it,
49
+ and each `WebexCore` instance materializes them as `webex.<name>` and `webex.internal.<name>`.
50
+
51
+ Five modules sit under the root module `src`:
52
+
53
+ - **Interceptors** (`src/interceptors`) form the request pipeline that `WebexCore.request` runs through
54
+ the `@webex/http-core` client: tracking ids, auth with refresh-and-replay, redirects, rate limiting,
55
+ catalog URL validation, timing, events and logging.
56
+ - **Credentials** (`src/lib/credentials`) hold the OAuth supertoken and scoped user tokens and keep them
57
+ usable through refresh, downscope and revoke.
58
+ - **Services** (`src/lib/services`, and the opt-in `src/lib/services-v2`) discover the Webex service
59
+ catalog from U2C, resolve service names and URLs, fail hosts over, and gate `webex.ready`.
60
+ - **Storage** (`src/lib/storage`) provides the `@persist` decorator, store factories and an in-memory
61
+ adapter, with concrete adapters supplied by sibling packages or the host.
62
+
63
+ Services and credentials live in core on purpose: the header comment of `src/index.js` explains that, as
64
+ plugins outside core, they would initialize after credentials and every earlier request would miss the
65
+ federation rules. The same file's import order is therefore load-bearing. Parallel v1 and v2 service
66
+ discovery is kept side by side; v1 is registered by default and v2 only through an explicit
67
+ `registerInternalPlugin(..., {replace: true})`.
68
+
69
+ ## Resource inventory and responsibilities
70
+
71
+ | Resource | Kind | Responsibility | Owner | Source | Detailed specification |
72
+ | --- | --- | --- | --- | --- | --- |
73
+ | Root module | Module | Plugin host, config defaults, plugin base classes, Batcher, Page, WebexHttpError, export surface | Cisco Webex for Developers | `src` | [src/docs/README.md](../src/docs/README.md) |
74
+ | Interceptors | Module | Request/response interceptors | Cisco Webex for Developers | `src/interceptors` | [README](../src/interceptors/docs/README.md) |
75
+ | Credentials | Module | OAuth token lifecycle | Cisco Webex for Developers | `src/lib/credentials` | [README](../src/lib/credentials/docs/README.md) |
76
+ | Services v1 | Module | Service discovery and host selection | Cisco Webex for Developers | `src/lib/services` | [README](../src/lib/services/docs/README.md) |
77
+ | Services v2 | Module | Opt-in v2 service discovery | Cisco Webex for Developers | `src/lib/services-v2` | [README](../src/lib/services-v2/docs/README.md) |
78
+ | Storage | Module | Persistence decorators and store factories | Cisco Webex for Developers | `src/lib/storage` | [README](../src/lib/storage/docs/README.md) |
79
+
80
+ The repository CODEOWNERS entry assigns this package to `@webex/web-client` and `@webex/web-sdk`; the Owner column names the documentation owner, Cisco Webex for Developers.
81
+
82
+ ## Interaction and execution flows
83
+
84
+ ```mermaid
85
+ flowchart LR
86
+ Host[Host app or SDK plugin] -->|webex.request| Core[WebexCore]
87
+ Core --> Pre["Pre interceptors: tracking id, rate limit, catalog URL"]
88
+ Pre --> Mid["Registered interceptors, incl. service and auth"]
89
+ Mid --> Http[http-core request]
90
+ Http -->|HTTP| Net[(Webex services)]
91
+ Mid -->|resolve service URL| Svc[Services]
92
+ Mid -->|bearer token, refresh| Cred[Credentials]
93
+ Cred -->|token endpoints| Idb[(Identity broker)]
94
+ Svc -->|hostmap| U2C[(U2C)]
95
+ Cred -->|persist| Store[Storage adapter]
96
+ Svc -->|cache| LS[(localStorage)]
97
+ ```
98
+
99
+ | From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
100
+ | --- | --- | --- | --- | --- |
101
+ | `WebexCore` | Interceptors | Ordered interceptor chain built at construction | Shape every request and response | `config.interceptors` replaces the whole chain; plugin-registered interceptors are then lost (see root spec) |
102
+ | Auth interceptor | Credentials | Token read and refresh | Attach `Authorization`, replay once after a 401 | Replay is bounded by `maxAuthenticationReplays`; a second 401 rejects |
103
+ | Service interceptor | Services | Name-to-URL resolution | Replace `service:` URIs with real hosts | Resolution failure surfaces as an unknown-service error |
104
+ | Credentials | Identity broker | HTTPS token, revoke and downscope calls | Maintain tokens | OAuth errors map to `grantErrors` classes |
105
+ | Services | U2C | HTTPS catalog fetch | Learn service hosts | Gated by `catalogInitTimeout`; failure marks `initFailed` |
106
+ | Credentials, services | Storage | `@persist` write and rehydrate | Survive restarts | Non-`NotFoundError` read failures can leave startup unfinished (see storage spec) |
107
+
108
+ ## Dependency topology
109
+
110
+ | Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
111
+ | --- | --- | --- | --- | --- |
112
+ | `@webex/http-core` | Internal | Root, interceptors, services | HTTP client and Interceptor base | Workspace version; specified in the http-core module spec |
113
+ | `@webex/common` | Internal | All modules | Exception, Defer, oneFlight and helpers | Workspace version; specified in the common module spec |
114
+ | `@webex/common-timers` | Internal | Credentials | Unref-ing timers and the Timer class | Workspace version; specified in the common-timers module spec |
115
+ | `@webex/storage-adapter-spec` | Internal | Tests of storage | Shared adapter conformance suite | Declared as a runtime dependency but imported only by tests |
116
+ | `@webex/internal-plugin-device` | Internal (dev) | Services, tests | Feature flags and device data consumed by services | Dev dependency only; services call it without a guard (see services spec) |
117
+ | `@webex/plugin-logger` | Internal (dev) | Tests | Logger test support | Code-only dependency: no module spec exists for it |
118
+ | `ampersand-state`, `ampersand-collection`, `ampersand-events` | External | Root, credentials, services, storage | Observable models | Pinned by `package.json` |
119
+ | `lodash`, `uuid`, `crypto-js`, `jsonwebtoken`, `core-decorators` | External | Various | Helpers, tracking ids, hashing, JWT decode, decorators | Pinned by `package.json`; `jsonwebtoken` is used only to decode |
120
+
121
+ Cycles and ordering: services and credentials are imported by `src/index.js` before any consumer can
122
+ register a plugin, and the services module imports the credentials module. Both services plugins read
123
+ the device plugin at runtime, so a host that omits it hits unguarded calls.
124
+
125
+ ## Public and consumer surfaces
126
+
127
+ Exact export names live in [`src/index.js`](../src/index.js) and the owning module specification. 49 workspace packages declare a dependency on this package.
128
+
129
+ | Surface | Type | Owner | Consumers | Compatibility policy | Source |
130
+ | --- | --- | --- | --- | --- | --- |
131
+ | `webex-core-sdk` | SDK | `src` | Every SDK plugin and host application | No deprecation policy is declared in `package.json`; treat export removal as breaking | `package.json` |
132
+ | `webex-core-interceptors` | SDK | `src/interceptors` | `src/webex-core.js` instantiates them; hosts may subclass | No deprecation policy declared; treat removal as breaking | `src/index.js` |
133
+ | `webex-core-credentials` | SDK | `src/lib/credentials` | Authorization plugins, contact-center, metrics, mercury and others | No deprecation policy declared; treat removal as breaking | `src/lib/credentials/index.js` |
134
+ | `webex-core-services` | SDK | `src/lib/services` | Many packages through `internal.services` | No deprecation policy declared; treat removal as breaking | `src/lib/services/index.js` |
135
+ | `webex-core-services-v2` | SDK | `src/lib/services-v2` | No production consumer; opt-in | Work-in-progress per its README; no stability promise | `src/lib/services-v2/index.ts` |
136
+ | `webex-core-storage` | SDK | `src/lib/storage` | Storage adapter packages, user, device and encryption plugins | No deprecation policy declared; treat removal as breaking | `src/lib/storage/index.js` |
137
+
138
+ External contracts the package requires: `http-core-sdk`, `webex-common-js-api`, `common-timers-sdk`,
139
+ `storage-adapter-spec-suite`, the U2C service-discovery API (`u2c-service`), the identity-broker OAuth API
140
+ (`idbroker-oauth-service`) and the ampersand state library. They are registered in
141
+ `.sdd/manifest.json` `contract_catalog`.
142
+
143
+ ## Client state model
144
+
145
+ | State or slice | Owner | Transition triggers | Persistence or reset boundary |
146
+ | --- | --- | --- | --- |
147
+ | `WebexCore` config, session id, `loaded`, `ready` | `src` | Construction, plugin readiness events, `logout` | In memory; `ready` waits for plugin and catalog readiness |
148
+ | Supertoken and user tokens | `src/lib/credentials` | Authorize, refresh, downscope, invalidate, logout | Persisted through `@persist('@')` to the bounded store |
149
+ | Service catalog groups and `ready` flags | `src/lib/services`, `src/lib/services-v2` | Catalog fetch, cache warm, failover | In memory plus a `localStorage` cache with a 24 hour TTL |
150
+ | Interceptor counters (rate limit, tracking sequence, replay) | `src/interceptors` | Each request | In memory only |
151
+ | Per-key load records and the startup stack | `src/lib/storage` | `@persist`/`@waitForValue` activity | Process-global registries |
152
+
153
+ ## Cross-cutting architecture
154
+
155
+ ### Security
156
+
157
+ - Trust boundaries and identity flow: the SDK attaches bearer tokens only to allow-listed hosts
158
+ (`services.validateDomains`, `allowedDomains`) and optionally validates every outbound URL against the
159
+ catalog (`services.validateCatalogUrls`, default off).
160
+ - Sensitive surfaces and data classes: access and refresh tokens, client secrets read from environment
161
+ variables, and plain-text persisted token documents.
162
+ - Encryption and secret boundaries: the package performs no encryption of its own; persisted tokens are
163
+ stored as plaintext JSON through whatever adapter the host configures. Revocation is skipped when no
164
+ client secret is configured, so it does not happen in typical browser builds.
165
+
166
+ ### Observability and operations
167
+
168
+ - Logging and correlation: `webex.logger` with per-level console fallback; `trackingid` headers carry a
169
+ per-instance prefix and sequence number; token refresh logs outside production builds.
170
+ - Metrics, traces, and audit signals: `request:start|success|failure|end` events consumed by the metrics
171
+ plugin, and a service-not-found metric emitted by services.
172
+ - Ownership and operational entry points: there are no dashboards or runbooks in the package.
173
+
174
+ ### Quality attributes
175
+
176
+ Compatibility is the dominant attribute: dozens of workspace packages and external applications import
177
+ this package, so exported names, event names and config keys are treated as public. No coverage gate is
178
+ enforced, and several behaviors named in the module specifications have no test (rate limiting
179
+ positive cases, JWT refresh, startup failure paths).
180
+
181
+ ## Dependency and interaction topology
182
+
183
+ ```mermaid
184
+ flowchart LR
185
+ Root[src root] --> Int[src/interceptors]
186
+ Root --> Cred[src/lib/credentials]
187
+ Root --> Svc[src/lib/services]
188
+ Root --> Svc2[src/lib/services-v2]
189
+ Root --> Sto[src/lib/storage]
190
+ Int --> Cred
191
+ Int --> Svc
192
+ Cred --> Sto
193
+ Svc2 --> Svc
194
+ Svc --> Cred
195
+ ```
196
+
197
+ | From | To | Kind | Purpose | Ordering or failure boundary |
198
+ | --- | --- | --- | --- | --- |
199
+ | `src` | all children | Import and registration | Compose the plugin host | Import order in `src/index.js` is load-bearing |
200
+ | `src/interceptors` | `src/lib/credentials` | Call | Token attach and refresh | Replay bounded by config |
201
+ | `src/interceptors` | `src/lib/services` | Call | Catalog URL validation and service resolution | Fails closed only when validation is enabled |
202
+ | `src/lib/credentials` | `src/lib/storage` | Decorator | Persist tokens | Plaintext; read failures can stall startup |
203
+ | `src/lib/services` | `src/lib/credentials` | Call | Authenticated catalog fetch | Preauth versus postauth groups |
204
+ | `src/lib/services-v2` | `src/lib/services` | Import | Reuses URL-matching helpers from the v1 catalog | v2 cannot be loaded without v1 files |
205
+
206
+ ## Caching catalog
207
+
208
+ | Cache | Owner | Backend | Contents | TTL or bound | Invalidation trigger | Failure behavior |
209
+ | --- | --- | --- | --- | --- | --- | --- |
210
+ | U2C hostmap v1 | `src/lib/services` | `localStorage` key `services.v1.u2cHostMap` | Catalog groups | 24 hours; only when `calling.cacheU2C` is true | `clearCatalogCache`; nothing clears it on logout | Cache miss falls back to a network fetch |
211
+ | U2C hostmap v2 | `src/lib/services-v2` | `localStorage` key `services.v2.u2cHostMap` | Catalog groups | 24 hours; same flag | `clearCatalogCache`, `invalidateCache` | A warm start leaves some name maps empty (see v2 spec) |
212
+ | Plugin bindings | `src/lib/storage` | In-memory registries | Bound store handles per namespace | Process lifetime | None | Shared across instances |
213
+
214
+ ## Observability patterns
215
+
216
+ | Signal | Convention or required fields | Propagation or naming rule | Primary evidence |
217
+ | --- | --- | --- | --- |
218
+ | Logs | Level methods with console fallback; token redaction is limited | `webex.logger` shared by plugins | `src/plugins/logger.js` |
219
+ | Metrics | Request lifecycle events and a service-not-found metric | Event names `request:*` | `src/interceptors/request-event.js`, `src/lib/metrics.js` |
220
+ | Traces | `trackingid` header: prefix, instance uuid and sequence number | Re-sent with a replay suffix | `src/interceptors/webex-tracking-id.js` |
221
+ | Audit | None | N/A | N/A |
222
+
223
+ ## Shared and base libraries
224
+
225
+ | Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
226
+ | --- | --- | --- | --- | --- |
227
+ | `@webex/eslint-config-legacy` | Lint rules | This package | Workspace | Change in the shared package, not here |
228
+ | `@webex/babel-config-legacy` | Transpilation | This package | Workspace | Same |
229
+ | `@webex/jest-config-legacy` | Unit-test config; coverage collection is off | This package | Workspace | Same |
230
+ | `@webex/legacy-tools` | Build and test runners | This package | Workspace | Same |
231
+
232
+ ## Package map and inter-package dependencies
233
+
234
+ | Package | Visibility | Responsibility | Depends on | Consumers |
235
+ | --- | --- | --- | --- | --- |
236
+ | `@webex/webex-core` | Public | Core plugin host and base services | `@webex/common`, `@webex/common-timers`, `@webex/http-core`, `@webex/storage-adapter-spec` | 49 workspace packages |
237
+ | `@webex/http-core` | Public | HTTP client | `@webex/common` | webex-core and others |
238
+ | `@webex/common` | Public | Shared helpers | — | Most packages |
239
+ | `@webex/common-timers` | Public | Timer primitives | — | webex-core and others |
240
+ | `@webex/storage-adapter-spec` | Public | Adapter conformance suite | — | Storage tests |
241
+
242
+ Workspace packages are resolved by yarn workspaces. The two dev-only edges to
243
+ `@webex/internal-plugin-device` and `@webex/plugin-logger` are declared under `devDependencies` in
244
+ `package.json`; the services modules nevertheless read the device plugin at runtime.
245
+
246
+ ## Platform matrix
247
+
248
+ | Platform | Shared versus platform-specific boundary | Entry or build | Support and compatibility constraints |
249
+ | --- | --- | --- | --- |
250
+ | Node.js | Shared code; some interceptors and tests are Node-only | `dist/index.js` from `yarn workspace @webex/webex-core build:src` | `engines.node >=18` |
251
+ | Browser | Shared code; `localStorage` and browser-only interceptor paths | Same bundle through the `browserify` transform | Caches and logout flows assume browser APIs only where guarded |
252
+
253
+ ## Release and versioning
254
+
255
+ | Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
256
+ | --- | --- | --- | --- | --- |
257
+ | `@webex/webex-core` | npm through `deploy:npm` | Managed at the workspace root | None declared in `package.json`; owned at the workspace root | Owned at the workspace root |
258
+
259
+ ## Host integration and theming
260
+
261
+ | Host or integration | Mount or entry contract | Required providers or peers | Theming and accessibility constraints |
262
+ | --- | --- | --- | --- |
263
+ | Browser or Node application | Construct `WebexCore` (usually through the `webex` package) with config and credentials | A storage adapter (memory by default), the device plugin for services, a network stack | N/A — no UI |
264
+
265
+ ## Security architecture
266
+
267
+ ```mermaid
268
+ flowchart LR
269
+ App[Host config and credentials] --> Cred[Credentials]
270
+ Cred -->|bearer token| Auth[Auth interceptor]
271
+ Auth -->|allow-listed hosts only| Net[(Webex services)]
272
+ Cred -->|plaintext JSON| Store[Storage adapter]
273
+ Cat[Service catalog] -->|allowed domains| Auth
274
+ ```
275
+
276
+ Trust boundary: the auth interceptor attaches tokens only to hosts known from the catalog, the
277
+ discovery configuration or `allowedDomains`. Tokens are persisted unencrypted, so the host must treat
278
+ the storage adapter as a secret store. The detailed controls are in the credentials and interceptors
279
+ specifications.
280
+
281
+ ## Domain language
282
+
283
+ | Term | Repository-specific meaning | Authoritative source |
284
+ | --- | --- | --- |
285
+ | Supertoken | The user's top-level token set from which scoped user tokens are downscoped | `src/lib/credentials/credentials.js` |
286
+ | Downscope | Obtaining a token with a reduced scope from the supertoken | `src/lib/credentials/credentials.js` |
287
+ | U2C | The service-discovery API that returns the hostmap | `src/config.js` |
288
+ | Hostmap or catalog | The service-name to host list mapping the services plugins hold | `src/lib/services/service-catalog.js` |
289
+ | Preauth, postauth, signin | Catalog groups collected before login, after login and during sign-in | `src/lib/services/service-catalog.js` |
290
+ | Interceptor | A request/response hook run in a fixed chain | `src/index.js` |
291
+ | Bounded and unbounded storage | The two store instances configured by `storage.boundedAdapter` and `storage.unboundedAdapter` | `src/config.js` |
292
+
293
+ ## References and maintenance
294
+
295
+ - Decisions: [adr/](adr/index.md)
296
+ - Instantiated specifications and routing: [specs/README.md](specs/README.md)
297
+ - Update this document in the same change that alters package boundaries, module ownership,
298
+ cross-module interaction or cross-cutting architecture.