@webex/helper-image 3.12.0-webex-services-ready.4 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.repo-context.json +591 -0
- package/.sdd/manifest.json +328 -0
- package/AGENTS.md +218 -0
- package/docs/adr/index.md +34 -0
- package/docs/architecture.md +249 -0
- package/docs/getting-started.md +128 -0
- package/docs/index.md +53 -0
- package/docs/specs/README.md +92 -0
- package/package.json +9 -9
- package/schemas/repo-context.schema.json +796 -0
- package/src/docs/README.md +576 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Architecture
|
|
3
|
+
title: '@webex/helper-image architecture'
|
|
4
|
+
description: Repository-wide boundaries, resources, interactions, dependencies, and cross-cutting architecture.
|
|
5
|
+
tags: [architecture]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: standing-doc
|
|
9
|
+
generated_from: architecture@0.3.0
|
|
10
|
+
generated_by: claude-opus-5
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-09-28T14:57:53Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# @webex/helper-image architecture
|
|
17
|
+
|
|
18
|
+
Canonical repository-wide architecture. This document owns facts that span
|
|
19
|
+
multiple services, packages, modules, applications, or repositories. Link to
|
|
20
|
+
the owning service, module, feature, ADR, or native contract instead of
|
|
21
|
+
duplicating owner-local detail.
|
|
22
|
+
|
|
23
|
+
Related context: [specification registry](specs/README.md) ·
|
|
24
|
+
[repository agent instructions](../AGENTS.md)
|
|
25
|
+
|
|
26
|
+
## Applicability
|
|
27
|
+
|
|
28
|
+
Sections preceded by an `Include if` comment are conditional. Retain a
|
|
29
|
+
conditional section only when repository evidence satisfies its condition.
|
|
30
|
+
Record `Unresolved` while the evidence or developer answer is still missing;
|
|
31
|
+
do not infer an answer from the repository type alone.
|
|
32
|
+
|
|
33
|
+
| Condition ID | Status | Evidence or reason | Owned section |
|
|
34
|
+
| ------------------------------------ | ------ | ------------------ | ----------------------------------- |
|
|
35
|
+
| `repo.owns_datastore` | N/A | No migration, ORM, or database dependency is declared in `package.json` | Repository data and schema |
|
|
36
|
+
| `repo.holds_client_state` | N/A | No store library; every export in `src/index.js` is a stateless function | Client state model |
|
|
37
|
+
| `repo.components_interact` | N/A | One module only; the representative flow below covers all internal calls | Dependency and interaction topology |
|
|
38
|
+
| `repo.domain_data_across_components` | N/A | One module, so no domain data spans resources | Object and data ownership |
|
|
39
|
+
| `repo.caches_data` | N/A | No cache in any path through `src/process-image.js` or `src/index.js` | Caching catalog |
|
|
40
|
+
| `repo.observability_convention` | Applicable | Logger injection is used consistently across `src/detect-filetype.js`, `src/process-image.js`, and `src/process-image.browser.js` | Observability patterns |
|
|
41
|
+
| `repo.deploys_to_infra` | N/A | Published library; `package.json` declares publishing only, with no deployment descriptor | Runtime and infrastructure |
|
|
42
|
+
| `repo.shared_base_libs` | Applicable | Lint, Babel, Jest, and build tooling are inherited via `.eslintrc.js`, `babel.config.js`, `jest.config.js`, and `package.json` | Shared and base libraries |
|
|
43
|
+
| `repo.is_monorepo` | N/A | This specification root is one package and contains no sub-packages | Package map and dependencies |
|
|
44
|
+
| `repo.multi_platform` | Applicable | Separate Node and browser implementations selected by the `browser` field in `package.json` | Platform matrix |
|
|
45
|
+
| `repo.published_package` | Applicable | Published to npm per `package.json` and `README.md` | Release and versioning |
|
|
46
|
+
| `repo.embedded_in_host` | N/A | Consumed as an ordinary library dependency per `package.json`, not mounted into a host | Host integration and theming |
|
|
47
|
+
| `repo.exposes_commands_or_artifacts` | N/A | No CLI or generator; `package.json` declares no `bin`, and the published artifact is covered by release and versioning | Commands and generated artifacts |
|
|
48
|
+
| `repo.cross_repo_deps_material` | Applicable | The Node path requires a host image toolchain and degrades when it is absent, per `src/process-image.js` and `package.json` | Cross-repository topology |
|
|
49
|
+
| `repo.security_arch_warranted` | N/A | No identity flow or token boundary in `src/`; untrusted-input handling is owned by the module spec | Security architecture |
|
|
50
|
+
|
|
51
|
+
## Design overview
|
|
52
|
+
|
|
53
|
+
This package exists to keep image inspection out of the Webex SDK plugins that upload files. Three
|
|
54
|
+
concerns are bundled behind one entry point because they are always used together at an upload
|
|
55
|
+
boundary: determine what a file is, read its EXIF orientation so it can be displayed the right way
|
|
56
|
+
up, and produce a measured thumbnail for it.
|
|
57
|
+
|
|
58
|
+
The defining architectural choice is that one of those three concerns cannot be implemented the same
|
|
59
|
+
way on both targets. In Node, measuring and thumbnailing an image means shelling out to a
|
|
60
|
+
GraphicsMagick or ImageMagick binary; in a browser it means decoding into an `Image`, drawing onto a
|
|
61
|
+
canvas, and reading the canvas back. Rather than branching at runtime, the package ships two files
|
|
62
|
+
and lets the bundler pick one through the `browser` field in `package.json`, so a browser bundle
|
|
63
|
+
never carries the Node toolchain path and Node never carries canvas code. Everything else in the
|
|
64
|
+
package is runtime-neutral and shared.
|
|
65
|
+
|
|
66
|
+
The second shaping decision is that the package owns no state and allocates no infrastructure. It
|
|
67
|
+
takes a file and a logger, and either returns a value or mutates the file object it was handed. That
|
|
68
|
+
is why there is no datastore, cache, client state, or service surface in this architecture.
|
|
69
|
+
|
|
70
|
+
## Resource inventory and responsibilities
|
|
71
|
+
|
|
72
|
+
| Resource | Kind | Responsibility | Owner | Source | Detailed specification |
|
|
73
|
+
| -------- | ------- | -------------- | ----- | ------ | ---------------------- |
|
|
74
|
+
| Image helpers | module | Reads EXIF orientation onto a file, resolves its MIME type, and measures and thumbnails it through separate Node and browser implementations | `@webex/web-client` | `src/index.js` | `src/docs/README.md` |
|
|
75
|
+
|
|
76
|
+
## Interaction and execution flows
|
|
77
|
+
|
|
78
|
+
The representative flow is an SDK plugin preparing a user-selected file for upload: resolve its type,
|
|
79
|
+
then measure and thumbnail it. EXIF orientation is read on a separate path, when a file is downloaded
|
|
80
|
+
or when a client wants orientation metadata attached before display.
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
flowchart LR
|
|
84
|
+
Caller[SDK plugin] --> Detect[detectFileType]
|
|
85
|
+
Detect --> HttpCore[http-core detect]
|
|
86
|
+
Caller --> Process[processImage]
|
|
87
|
+
Process --> Node[Node: gm subprocess]
|
|
88
|
+
Process --> Browser[Browser: canvas + orient]
|
|
89
|
+
Caller --> Update[updateImageOrientation]
|
|
90
|
+
Update --> Exif[readExifData]
|
|
91
|
+
Exif --> Exifr[exifr parse]
|
|
92
|
+
Node --> Result[thumbnail, dimensions, thumbnailDimensions]
|
|
93
|
+
Browser --> Result
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
| From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
|
|
97
|
+
| ---------- | ---------- | ------------------------ | -------- | --------------------------------- |
|
|
98
|
+
| SDK plugin | `detectFileType` | Function call | Resolve a MIME type before upload | Returns an existing `type` or `mimeType` untouched; otherwise sniffs bytes and may resolve `null` when the extension is unknown |
|
|
99
|
+
| `detectFileType` | `@webex/http-core` `detect` | Function call | Magic-byte sniffing | Rejects when the argument is not a Blob, ArrayBuffer, or Uint8Array; generic results fall back to extension lookup |
|
|
100
|
+
| SDK plugin | `processImage` | Function call | Measure and thumbnail | Resolves undefined for non-image input; the Node path also resolves undefined when the host toolchain is missing or the bytes are undecodable |
|
|
101
|
+
| `processImage` (Node) | host GraphicsMagick or ImageMagick | Child process over stdio | Size measurement and thumbnail encoding | EPIPE is treated as a missing binary and logged as a warning, then resolved undefined |
|
|
102
|
+
| `processImage` (browser) | DOM decode and canvas | In-process platform calls | Size measurement and thumbnail encoding | Rejects when the image fails to load |
|
|
103
|
+
| SDK plugin | `updateImageOrientation` | Function call | Attach EXIF orientation before display | Never rejects; a read failure leaves the promise unsettled because no error handler is registered |
|
|
104
|
+
| `readExifData` | `exifr` `parse` | Function call | Read EXIF tags from JPEG bytes | Non-JPEG input and absent EXIF data both leave the file unmodified |
|
|
105
|
+
|
|
106
|
+
Exact per-operation sequences, including the orientation transform table, live in
|
|
107
|
+
[`src/docs/README.md`](../src/docs/README.md).
|
|
108
|
+
|
|
109
|
+
## Dependency topology
|
|
110
|
+
|
|
111
|
+
| Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
|
|
112
|
+
| ---------- | -------- | ------- | ------- | ------------------------------------ |
|
|
113
|
+
| `@webex/http-core` | Internal | Image helpers | Magic-byte MIME sniffing | Workspace-resolved sibling; rejects on unsupported argument types |
|
|
114
|
+
| `exifr` | External | Image helpers | EXIF tag reading, imported as the lite UMD build | Declared in `package.json`; absent EXIF data is tolerated |
|
|
115
|
+
| `gm` | External | Image helpers (Node only) | Wrapper around the host image toolchain | Declared in `package.json`; a missing host binary degrades to an undefined result rather than a rejection |
|
|
116
|
+
| `mime` | External | Image helpers | Extension-to-type lookup fallback | Declared in `package.json`; may return `null` for an unknown extension |
|
|
117
|
+
| `lodash` | External | Image helpers | Dimension picking | Declared in `package.json` |
|
|
118
|
+
| `safe-buffer` | External | Image helpers | Buffer construction from an ArrayBuffer | Declared in `package.json` |
|
|
119
|
+
| DOM platform APIs | Peer | Image helpers (browser only) | FileReader, Blob, Image, canvas, and base64 decoding | Assumed present; there is no feature detection or fallback |
|
|
120
|
+
|
|
121
|
+
There are no dependency cycles and no ordering constraints. Exact versions stay in `package.json`
|
|
122
|
+
rather than being copied here.
|
|
123
|
+
|
|
124
|
+
## Public and consumer surfaces
|
|
125
|
+
|
|
126
|
+
| Surface | Type | Owner | Consumers | Compatibility policy | Source |
|
|
127
|
+
| ------- | ---- | ----- | --------- | -------------------- | ------ |
|
|
128
|
+
| Package export surface (`helper-image-package-api`) | SDK | Image helpers | Webex SDK plugins for conversation share and avatar upload, plus external npm consumers | Published; renaming, removing, or reshaping an export is breaking | `package.json` |
|
|
129
|
+
| Thumbnail result triple (`image-thumbnail-png`) | File | Image helpers | Same consumers | Published; the positional array shape and PNG encoding are the contract | `src/process-image.js` |
|
|
130
|
+
|
|
131
|
+
Both surfaces are `published` in `.sdd/manifest.json`, which remains authoritative for publication
|
|
132
|
+
state and canonical source. The four exported functions are declared in `src/index.js`; the entry
|
|
133
|
+
points and the browser substitution are declared in `package.json`. Per-function behavior, including
|
|
134
|
+
where the two `processImage` implementations differ, is owned by
|
|
135
|
+
[`src/docs/README.md`](../src/docs/README.md).
|
|
136
|
+
|
|
137
|
+
## Cross-cutting architecture
|
|
138
|
+
|
|
139
|
+
### Security
|
|
140
|
+
|
|
141
|
+
- Trust boundaries and identity flow: none. The package performs no authentication or authorization
|
|
142
|
+
and handles no credentials or tokens.
|
|
143
|
+
- Sensitive surfaces and data classes: caller-supplied image bytes, which are untrusted input. In
|
|
144
|
+
Node they are passed to a host image toolchain subprocess through `gm`; in the browser they are
|
|
145
|
+
decoded by the platform and rasterized onto a canvas. The package does not parse image containers
|
|
146
|
+
itself, so container-level parsing risk sits with `exifr`, the platform decoder, and the host
|
|
147
|
+
toolchain.
|
|
148
|
+
- Encryption and secret boundaries: none owned here. Encryption of uploaded bytes happens in the
|
|
149
|
+
consuming SDK plugin after this package returns.
|
|
150
|
+
|
|
151
|
+
### Observability and operations
|
|
152
|
+
|
|
153
|
+
- Logging and correlation: the logger is always injected by the caller rather than imported, so
|
|
154
|
+
package logs are emitted through the host client's logger and inherit its correlation context.
|
|
155
|
+
- Metrics, traces, and audit signals: none. The package emits no metrics, spans, or audit events.
|
|
156
|
+
- Ownership and operational entry points: owned by `@webex/web-client`. There are no dashboards,
|
|
157
|
+
alerts, or runbooks, because the package has no runtime of its own.
|
|
158
|
+
|
|
159
|
+
### Quality attributes
|
|
160
|
+
|
|
161
|
+
As a published SDK dependency, the relevant quality boundaries are compatibility and footprint
|
|
162
|
+
rather than latency or availability:
|
|
163
|
+
|
|
164
|
+
- The export surface in `src/index.js` is the compatibility boundary for external consumers.
|
|
165
|
+
- Browser bundles must not pull in the Node image toolchain path. The `browser` field substitution in
|
|
166
|
+
`package.json` is what enforces that, and it applies to both `src/` and `dist/` paths.
|
|
167
|
+
- Node's floor is declared as `>=18` in `package.json`.
|
|
168
|
+
|
|
169
|
+
## Observability patterns
|
|
170
|
+
|
|
171
|
+
| Signal | Convention or required fields | Propagation or naming rule | Primary evidence |
|
|
172
|
+
| ------- | ----------------------------- | -------------------------- | ---------------- |
|
|
173
|
+
| Logs | The logger is received as a parameter or option, never imported. Messages state the decision taken and the value that drove it, and no image bytes are logged. | Caller-supplied logger, so correlation and level policy are the host client's | `src/detect-filetype.js` |
|
|
174
|
+
| Logs (degradation) | A missing host toolchain is a warning; undecodable or empty input is debug. Both are followed by an undefined result rather than a rejection. | Same injected logger | `src/process-image.js` |
|
|
175
|
+
| Logs (browser) | Avatar sizing and disabled thumbnails are announced at info level before returning | Same injected logger | `src/process-image.browser.js` |
|
|
176
|
+
| Metrics | None emitted | Not applicable | `src/index.js` |
|
|
177
|
+
| Traces | None emitted | Not applicable | `src/index.js` |
|
|
178
|
+
| Audit | None emitted | Not applicable | `src/index.js` |
|
|
179
|
+
|
|
180
|
+
## Shared and base libraries
|
|
181
|
+
|
|
182
|
+
| Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
|
|
183
|
+
| ------- | ------------------------ | --------- | ------------- | ------------------ |
|
|
184
|
+
| `@webex/eslint-config-legacy` | Lint and formatting rules | Image helpers | Workspace-resolved | Extended as the sole root config in `.eslintrc.js` |
|
|
185
|
+
| `@webex/babel-config-legacy` | Transpilation targets | Image helpers | Workspace-resolved | Re-exported unchanged from `babel.config.js` |
|
|
186
|
+
| `@webex/jest-config-legacy` | Jest defaults, including the unit test match pattern | Image helpers | Workspace-resolved | Re-exported unchanged from `jest.config.js` |
|
|
187
|
+
| `@webex/legacy-tools` | Build and test runner (`webex-legacy-tools`) | Image helpers | Workspace-resolved | Drives every build and test script in `package.json` |
|
|
188
|
+
| `@webex/test-helper-chai`, `@webex/test-helper-mocha`, `@webex/test-helper-file` | Assertions, runner gating, and fixture fetching | Unit suite | Workspace-resolved | Used by `test/unit/spec/index.js` |
|
|
189
|
+
|
|
190
|
+
All five are consumed as-is. This package authors no parallel lint, Babel, Jest, or runner
|
|
191
|
+
configuration.
|
|
192
|
+
|
|
193
|
+
## Platform matrix
|
|
194
|
+
|
|
195
|
+
| Platform | Shared versus platform-specific boundary | Entry or build | Support and compatibility constraints |
|
|
196
|
+
| -------- | ---------------------------------------- | -------------- | ------------------------------------- |
|
|
197
|
+
| Node | Shared: the entry, EXIF reading, and MIME detection. Platform-specific: image measurement and thumbnailing. | `src/process-image.js` | Requires a GraphicsMagick or ImageMagick binary on the host; ignores the `isAvatar` option; falls back to `file.type` when no explicit type is passed |
|
|
198
|
+
| Browser | Shared: the same entry, EXIF reading, and MIME detection. Platform-specific: measurement, thumbnailing, and the orientation transform. | `src/process-image.browser.js` | Requires FileReader, Blob, URL.createObjectURL, Image, canvas, and `atob`; honors `isAvatar`; requires an explicit `type` argument |
|
|
199
|
+
|
|
200
|
+
`updateImageOrientation` is shared code that is nonetheless browser-only in practice, because it
|
|
201
|
+
constructs a `FileReader`. The substitution that selects the platform-specific file is declared by
|
|
202
|
+
the `browser` field in `package.json` and covers both the source and built paths. The `process` file
|
|
203
|
+
declares `{browser: true}` for legacy bundlers that resolve `process` to a repository-local module.
|
|
204
|
+
|
|
205
|
+
The behavioral differences between the two implementations are consumer-visible and are enumerated in
|
|
206
|
+
[`src/docs/README.md`](../src/docs/README.md).
|
|
207
|
+
|
|
208
|
+
## Release and versioning
|
|
209
|
+
|
|
210
|
+
| Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
|
|
211
|
+
| -------- | -------------- | --------------- | ------------------ | --------------------------------- |
|
|
212
|
+
| `@webex/helper-image` | Public npm registry, via the `deploy:npm` script in `package.json` | Version and release are coordinated at the workspace level; this package declares no independent version policy | Not declared in this package | No package-level changelog; release notes are produced at the workspace level |
|
|
213
|
+
|
|
214
|
+
The published artifact is the `dist/` output of `build:src`, referenced by `main` in `package.json`.
|
|
215
|
+
`devMain` points at `src/index.js` for workspace-internal development.
|
|
216
|
+
|
|
217
|
+
## Cross-repository topology
|
|
218
|
+
|
|
219
|
+
| Repository or external system | Relationship | Exchanged contract or artifact | Owner | Sequencing constraint |
|
|
220
|
+
| ----------------------------- | ------------ | ------------------------------ | ----- | --------------------- |
|
|
221
|
+
| Host GraphicsMagick or ImageMagick installation | Consumes | Child-process invocation through the `gm` wrapper for size measurement and PNG thumbnail encoding | Host environment, not this repository | Must be installed before the Node thumbnail path can succeed; absence is detected at call time and degrades to an undefined result |
|
|
222
|
+
| `@webex/http-core` | Consumes | Its `detect` export, for magic-byte MIME sniffing | `@webex/web-client` and `@webex/web-sdk` | Must be built before this package's tests run under the workspace build order |
|
|
223
|
+
| Consuming Webex SDK plugins | Provides | The package export surface and the thumbnail result triple | `@webex/web-client` and `@webex/web-sdk` | A breaking export change must land with its consumers |
|
|
224
|
+
| Public npm registry | Provides | The published `@webex/helper-image` package | `@webex/web-client` | Published from the workspace release flow |
|
|
225
|
+
|
|
226
|
+
The host image toolchain is the material cross-boundary dependency: it is not declared by any package
|
|
227
|
+
manifest, it is required only on Node, and its absence changes the result of `processImage` rather
|
|
228
|
+
than failing the call. `src/process-image.js` detects it indirectly, by matching an EPIPE error
|
|
229
|
+
string.
|
|
230
|
+
|
|
231
|
+
## Domain language
|
|
232
|
+
|
|
233
|
+
| Term | Repository-specific meaning | Authoritative source |
|
|
234
|
+
| ---- | --------------------------- | -------------------- |
|
|
235
|
+
| EXIF orientation | An integer from 1 to 8 describing how a JPEG must be rotated or flipped for correct display. Value 1 means no transform is needed. | `src/orient.js` |
|
|
236
|
+
| File | A caller-supplied object carrying image bytes plus loosely typed metadata. It may be a DOM File or Blob, or a plain object; the type may appear as `type` or as `mimeType`, and this package writes orientation results back onto it. | `src/index.js` |
|
|
237
|
+
| Thumbnail dimensions | The computed target size of the thumbnail, which is swapped relative to the file dimensions when the orientation is greater than 4. | `src/process-image.browser.js` |
|
|
238
|
+
| Avatar | An image treated as a profile picture, whose reported dimensions are squared to its larger side. Honored only by the browser implementation. | `src/process-image.browser.js` |
|
|
239
|
+
| Result triple | The positional array `[thumbnail, fileDimensions, thumbnailDimensions]` returned by `processImage`. | `src/process-image.js` |
|
|
240
|
+
|
|
241
|
+
## References and maintenance
|
|
242
|
+
|
|
243
|
+
- Decisions: [adr/](adr/)
|
|
244
|
+
- Instantiated specifications and routing: [specs/README.md](specs/README.md)
|
|
245
|
+
- Repository rules and patterns: inherited from the shared workspace configs listed under
|
|
246
|
+
[Shared and base libraries](#shared-and-base-libraries); this package defines none of its own
|
|
247
|
+
- Update this document in the same change that alters repository boundaries,
|
|
248
|
+
resource ownership, cross-resource interaction, or cross-cutting
|
|
249
|
+
architecture.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Getting Started
|
|
3
|
+
title: Getting started
|
|
4
|
+
description: Local setup, build, run, and test routing for @webex/helper-image.
|
|
5
|
+
tags: [onboarding]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: standing-doc
|
|
9
|
+
generated_from: getting-started@0.3.0
|
|
10
|
+
generated_by: claude-opus-5
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-09-28T14:57:53Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Getting started
|
|
17
|
+
|
|
18
|
+
Onboarding for **@webex/helper-image**. This package is a workspace member of the Webex JavaScript
|
|
19
|
+
SDK, so every command runs from the workspace root through `yarn workspace`, not from the package
|
|
20
|
+
directory.
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
| Tool or access | Version or requirement |
|
|
25
|
+
| -------------- | ---------------------- |
|
|
26
|
+
| Node | `>=18`, declared in `package.json`. The enclosing workspace pins a newer line through its own Node version file, so prefer the workspace's pinned version when the two differ. |
|
|
27
|
+
| Yarn | Yarn workspaces are required, because this package's sibling dependencies use the `workspace:*` protocol in `package.json`. The version is pinned by the enclosing workspace. |
|
|
28
|
+
| GraphicsMagick or ImageMagick | Needed only to exercise the Node thumbnail path in `src/process-image.js` at runtime. Not needed to build or to run this package's own tests, because the active unit cases do not reach that path. Its absence is handled: `processImage` logs a warning and resolves undefined. |
|
|
29
|
+
| Chrome and Firefox | Needed only for the browser test runner, which `@webex/legacy-tools` defaults to those two browsers. |
|
|
30
|
+
| Registry access | None beyond the public npm registry. This package resolves no dependency from an authenticated registry. |
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
yarn install
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Run it once from the workspace root. It installs this package's dependencies together with the
|
|
39
|
+
workspace siblings it depends on.
|
|
40
|
+
|
|
41
|
+
## Build
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yarn workspace @webex/helper-image build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This transpiles `src/` into `dist/` through `@webex/legacy-tools`. There is no separate compile or
|
|
48
|
+
typecheck step: the sources are JavaScript, `package.json` declares no typecheck target, and the
|
|
49
|
+
build produces the published artifact without running tests.
|
|
50
|
+
|
|
51
|
+
## Run
|
|
52
|
+
|
|
53
|
+
This package is a library with no runnable entry point, so there is no run command. To exercise it,
|
|
54
|
+
import it from a consuming package or run the tests below.
|
|
55
|
+
|
|
56
|
+
## Tests
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
yarn workspace @webex/helper-image test:unit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Do not run the package's aggregate `test` script, `yarn workspace @webex/helper-image test`. It chains
|
|
63
|
+
`yarn test:integration`, which `package.json` does not define, so it fails before reaching the browser
|
|
64
|
+
tier. It is recorded in the manifest because the script genuinely exists, but no workflow should select
|
|
65
|
+
it. Run the tiers below individually.
|
|
66
|
+
|
|
67
|
+
Use the table as the repository-level test router. List only tiers that
|
|
68
|
+
actually exist; behavioral intent belongs in the owning module specifications and exact
|
|
69
|
+
cases remain in the repository's native test sources.
|
|
70
|
+
|
|
71
|
+
| Tier | Command | Test location | Framework | External dependencies |
|
|
72
|
+
| ---- | ------- | ------------- | --------- | --------------------- |
|
|
73
|
+
| Unit, Node runner | `yarn workspace @webex/helper-image test:unit` | `test/unit/spec` | Mocha with `@webex/test-helper-chai` assertions and Sinon stubs, run by `@webex/legacy-tools` | None |
|
|
74
|
+
| Unit, browser runner | `yarn workspace @webex/helper-image test:browser` | `test/unit/spec` | The same specs under Karma in a real browser, the only runner that executes the `browserOnly` cases | Chrome and Firefox, the runner's defaults, plus the fixture server that serves the test image |
|
|
75
|
+
| Integration | None | Not applicable | Not applicable | Not applicable |
|
|
76
|
+
| System / E2E | None | Not applicable | Not applicable | Not applicable |
|
|
77
|
+
|
|
78
|
+
This package has one test suite and two runners for it, not two suites. There is no integration or
|
|
79
|
+
end-to-end directory, and the browser runner is deliberately not recorded as an integration tier: it
|
|
80
|
+
executes the same spec file, so labelling it one would misdescribe the suite. The manifest records it
|
|
81
|
+
as the `browser-test` command and names it inside the unit tier's framework description, which is why
|
|
82
|
+
`tests` declares only `unit`.
|
|
83
|
+
|
|
84
|
+
Both tiers execute the same file, `test/unit/spec/index.js`. The runner matters: the suite gates cases
|
|
85
|
+
with `browserOnly` and `nodeOnly`, so the `updateImageOrientation` cases execute only under the
|
|
86
|
+
browser runner. Running just `test:unit` therefore leaves part of the suite unexecuted.
|
|
87
|
+
|
|
88
|
+
- Coverage or quality gate: none. No coverage threshold applies to this package; `package.json`
|
|
89
|
+
declares no coverage script, and the inherited Jest configuration disables coverage collection.
|
|
90
|
+
This was confirmed by the package owner rather than inferred.
|
|
91
|
+
- Enforcement source: not applicable, as no gate exists.
|
|
92
|
+
- Test environment or QA dependencies: none beyond a local browser for the browser runner.
|
|
93
|
+
|
|
94
|
+
`jest.config.js` is present and its inherited test-match pattern would select
|
|
95
|
+
`test/unit/spec/index.js`, but no script in `package.json` invokes Jest. The runners actually used are
|
|
96
|
+
Mocha and Karma, through `@webex/legacy-tools`.
|
|
97
|
+
|
|
98
|
+
## Configuration and secrets
|
|
99
|
+
|
|
100
|
+
- Required configuration: none. The package reads no environment variables and loads no config file.
|
|
101
|
+
- Secret source: not applicable; the package handles no credentials.
|
|
102
|
+
- Package or artifact access: the public npm registry only; no authentication is required to install.
|
|
103
|
+
- Required neighboring repositories or workspace layout: this package must be built inside the SDK
|
|
104
|
+
workspace, because `package.json` resolves `@webex/http-core` and the test helpers through the
|
|
105
|
+
`workspace:*` protocol. Its dependencies are built before it in the workspace's topological order.
|
|
106
|
+
- Platform, simulator, device, or SDK setup: install a local Chrome and Firefox for the browser
|
|
107
|
+
runner. Install GraphicsMagick or ImageMagick only when exercising the Node thumbnail path.
|
|
108
|
+
- Never commit credentials or copy production secrets into a local config.
|
|
109
|
+
|
|
110
|
+
## First-run verification
|
|
111
|
+
|
|
112
|
+
1. Run `yarn install` from the workspace root.
|
|
113
|
+
2. Run `yarn workspace @webex/helper-image build` and confirm `dist/` is produced.
|
|
114
|
+
3. Run `yarn workspace @webex/helper-image test:unit`.
|
|
115
|
+
|
|
116
|
+
Expected result: the build writes transpiled output to `dist/`, and the unit run reports the `orient()`
|
|
117
|
+
suite passing across all eight EXIF orientation values. The `readExifData` cases are reported as
|
|
118
|
+
pending, because they are disabled with `xdescribe` in `test/unit/spec/index.js`, and the
|
|
119
|
+
`updateImageOrientation` cases do not appear at all under the Mocha runner because they are gated to
|
|
120
|
+
the browser.
|
|
121
|
+
|
|
122
|
+
## Next steps
|
|
123
|
+
|
|
124
|
+
- [Repository architecture](architecture.md)
|
|
125
|
+
- Service specification — not applicable; this package has no deployable service
|
|
126
|
+
- [Specification registry](specs/README.md)
|
|
127
|
+
- [Documentation index](index.md)
|
|
128
|
+
- [Module specification for `src/`](../src/docs/README.md)
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
okf_version: '0.1'
|
|
3
|
+
---
|
|
4
|
+
<!-- sdd-generated-metadata
|
|
5
|
+
doc_kind: standing-doc
|
|
6
|
+
generated_from: docs-index@0.3.0
|
|
7
|
+
generated_by: claude-opus-5
|
|
8
|
+
approved_by: rarajes2@cisco.com
|
|
9
|
+
updated_at: 2026-09-28T14:57:53Z
|
|
10
|
+
validation_status: pass-with-warnings
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
# @webex/helper-image documentation
|
|
14
|
+
|
|
15
|
+
Doc map for developers and agents working in this package: a published Webex JavaScript SDK helper
|
|
16
|
+
that reads EXIF orientation onto image files, resolves their MIME type, and measures and thumbnails
|
|
17
|
+
them through separate Node and browser implementations.
|
|
18
|
+
|
|
19
|
+
## Start here
|
|
20
|
+
|
|
21
|
+
- [Getting started](getting-started.md)
|
|
22
|
+
- [Repository architecture](architecture.md)
|
|
23
|
+
- Service specification — not applicable; this package is a published library with no deployable
|
|
24
|
+
service surface
|
|
25
|
+
- API specification — not applicable; the published contract is the package export surface declared
|
|
26
|
+
in `package.json` and `src/index.js`, not an HTTP API
|
|
27
|
+
|
|
28
|
+
## Decisions
|
|
29
|
+
|
|
30
|
+
- [adr/](adr/) — architectural decision records
|
|
31
|
+
|
|
32
|
+
## Specifications and contracts
|
|
33
|
+
|
|
34
|
+
- [architecture.md](architecture.md) — canonical repository-wide architecture
|
|
35
|
+
- Service specification — omitted; see the artifact decisions in `.sdd/manifest.json`
|
|
36
|
+
- [specs/README.md](specs/README.md) — manifest-backed module and contract registry
|
|
37
|
+
- [`src/docs/README.md`](../src/docs/README.md) — the owning specification beside the module's code.
|
|
38
|
+
This package has exactly one module, so this is the only module specification
|
|
39
|
+
- [adr/](adr/) — concrete architectural decisions; blank ADR templates remain under `.sdd/`
|
|
40
|
+
|
|
41
|
+
Use the manifest-linked native source for exact contract details: OpenAPI for published repository
|
|
42
|
+
HTTP APIs, route code for internal HTTP surfaces, and ecosystem-native artifacts for published SDKs.
|
|
43
|
+
Register and link those sources from the architecture index and owning module spec instead of copying
|
|
44
|
+
them into Markdown.
|
|
45
|
+
|
|
46
|
+
## Related repository resources
|
|
47
|
+
|
|
48
|
+
- [`../README.md`](../README.md) — consumer-facing npm readme. Reference-only context, and incomplete:
|
|
49
|
+
it omits `processImage` and `detectFileType` and presents the module-internal `orient` as a package
|
|
50
|
+
export. The module spec is authoritative for the public surface.
|
|
51
|
+
- [`../AGENTS.md`](../AGENTS.md) — agent instructions for this package.
|
|
52
|
+
- Contributing and security reporting are owned at the workspace level rather than per package; the
|
|
53
|
+
consumer readme links the workspace contributing guide.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Reference
|
|
3
|
+
title: Specification registry
|
|
4
|
+
description: Canonical specification registry and change-routing guide.
|
|
5
|
+
tags: [specifications, registry]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: standing-doc
|
|
9
|
+
generated_from: spec-index@0.3.0
|
|
10
|
+
generated_by: claude-opus-5
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-09-28T14:57:53Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Specification registry
|
|
17
|
+
|
|
18
|
+
Use this page to find the canonical repository architecture and every
|
|
19
|
+
instantiated service and module specification plus native contract. Keep technical facts
|
|
20
|
+
in one owning document and use this page only for navigation, ownership,
|
|
21
|
+
status, and change/test routing.
|
|
22
|
+
|
|
23
|
+
Start with the [repository architecture](../architecture.md). No service specification exists: this
|
|
24
|
+
package is a published library with no deployable service surface, recorded as an omitted artifact
|
|
25
|
+
in `.sdd/manifest.json`.
|
|
26
|
+
|
|
27
|
+
## Document roles
|
|
28
|
+
|
|
29
|
+
| Document | Canonical ownership |
|
|
30
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| [Repository architecture](../architecture.md) | Repository boundaries, resource inventory, interactions, dependency topology, and cross-cutting architecture |
|
|
32
|
+
| Service specification | Not applicable — no deployable service in this package |
|
|
33
|
+
| Module specifications | Stable behavior and design at each module's manifest-routed spec; here, `src/docs/README.md` |
|
|
34
|
+
| [ADR](../adr/) | A durable decision, its deciders, rationale, consequences, and supersession lineage |
|
|
35
|
+
|
|
36
|
+
## Instantiated specification registry
|
|
37
|
+
|
|
38
|
+
| Resource | Role | Canonical path | Owner | Status | Last verified |
|
|
39
|
+
| ------------------- | --------------------------- | ---------------------- | -------------------- | ------ | ------------- |
|
|
40
|
+
| Repository | Architecture | `docs/architecture.md` | `@webex/web-client` | Active | 2026-09-28 |
|
|
41
|
+
| Image helpers | Module | `src/docs/README.md` | `@webex/web-client` | Active | 2026-09-28 |
|
|
42
|
+
| Package export surface | Contract (`helper-image-package-api`, published) | `package.json` | `@webex/web-client` | Active | 2026-09-28 |
|
|
43
|
+
| Thumbnail result triple | Contract (`image-thumbnail-png`, published) | `src/process-image.js` | `@webex/web-client` | Active | 2026-09-28 |
|
|
44
|
+
|
|
45
|
+
Contract detail stays in the native sources above and is indexed in
|
|
46
|
+
[`docs/architecture.md`](../architecture.md) under `Public and consumer surfaces`. `.sdd/manifest.json`
|
|
47
|
+
remains authoritative for each contract's publication state and canonical source.
|
|
48
|
+
|
|
49
|
+
### Module registry
|
|
50
|
+
|
|
51
|
+
One row per module in `.sdd/manifest.json`, which stays authoritative; this table is its
|
|
52
|
+
human-readable mirror and the reconciliation surface for `scripts/check_spec_index.py`.
|
|
53
|
+
|
|
54
|
+
| Module | Responsibility | Manifest coverage state | Start here |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| `src/` | Reads EXIF orientation onto a file, resolves its MIME type, and measures and thumbnails it through separate Node and browser implementations | Partial | `src/docs/README.md` |
|
|
57
|
+
|
|
58
|
+
Generator-side field measurement for `src/` is complete: its coverage score is recorded in the module
|
|
59
|
+
spec's `Metadata` table. The module remains `Partial` because semantic validation by an independent
|
|
60
|
+
runtime has not run and no characterization baseline pins the EXIF parsing path, whose unit cases are
|
|
61
|
+
disabled in `test/unit/spec/index.js`.
|
|
62
|
+
|
|
63
|
+
## Change and verification routing
|
|
64
|
+
|
|
65
|
+
| Change affects | Load and update | Verification route |
|
|
66
|
+
| ------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
67
|
+
| Repository boundaries or cross-cutting architecture | `docs/architecture.md` and applicable ADRs | Repository test routing and affected owner specs |
|
|
68
|
+
| A deployable service surface or operating posture | Not applicable — no service spec in this package | Not applicable |
|
|
69
|
+
| A stable code, package, or component boundary | Its module spec | Module tests plus affected contracts |
|
|
70
|
+
| A public API, event, command, package, or file contract | The owning architecture/service/module section plus the native definition | Compatibility and contract tests |
|
|
71
|
+
|
|
72
|
+
Concretely, for this package: any change to an export in `src/index.js`, to the `browser` field in
|
|
73
|
+
`package.json`, or to either `processImage` implementation routes through `src/docs/README.md` and is
|
|
74
|
+
verified by `yarn workspace @webex/helper-image test:unit` plus
|
|
75
|
+
`yarn workspace @webex/helper-image test:browser`.
|
|
76
|
+
|
|
77
|
+
## Module and contract registration
|
|
78
|
+
|
|
79
|
+
Generate each module specification directly at the exact `modules[].canonical_spec` path recorded in
|
|
80
|
+
`.sdd/manifest.json`, which defaults to a `docs/README.md` beside the module's own directory. Never
|
|
81
|
+
copy a visible module starter or reconstruct a path from an example. Register every module and submodule in the Module registry above
|
|
82
|
+
in manifest tree order.
|
|
83
|
+
|
|
84
|
+
Register each contract with a stable identity, `published` or `internal` publication state, canonical
|
|
85
|
+
native source, and owning-module link. A published repository-owned HTTP surface must reuse an
|
|
86
|
+
existing OpenAPI source or populate the selected root `api-specs/openapi.yaml`; route code alone is
|
|
87
|
+
valid only for an internal HTTP surface. Published SDK/package surfaces retain their ecosystem-native
|
|
88
|
+
API artifact and do not require OpenAPI. This page provides navigation and ownership rather than a
|
|
89
|
+
copied contract.
|
|
90
|
+
|
|
91
|
+
This package owns no HTTP surface, so no OpenAPI document applies. Its two published contracts are
|
|
92
|
+
the package export surface and the shape of the `processImage` result, both registered above.
|
package/package.json
CHANGED
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
30
30
|
"@webex/jest-config-legacy": "0.0.0",
|
|
31
31
|
"@webex/legacy-tools": "0.0.0",
|
|
32
|
-
"@webex/test-helper-chai": "3.
|
|
33
|
-
"@webex/test-helper-mocha": "3.
|
|
34
|
-
"@webex/test-helper-mock-webex": "3.
|
|
35
|
-
"@webex/test-helper-test-users": "3.
|
|
32
|
+
"@webex/test-helper-chai": "3.13.0",
|
|
33
|
+
"@webex/test-helper-mocha": "3.13.0",
|
|
34
|
+
"@webex/test-helper-mock-webex": "3.13.0",
|
|
35
|
+
"@webex/test-helper-test-users": "3.13.0",
|
|
36
36
|
"eslint": "^8.24.0",
|
|
37
37
|
"prettier": "^2.7.1",
|
|
38
38
|
"sinon": "^9.2.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@webex/http-core": "3.
|
|
42
|
-
"@webex/test-helper-chai": "3.
|
|
43
|
-
"@webex/test-helper-file": "3.
|
|
44
|
-
"@webex/test-helper-mocha": "3.
|
|
41
|
+
"@webex/http-core": "3.13.0",
|
|
42
|
+
"@webex/test-helper-chai": "3.13.0",
|
|
43
|
+
"@webex/test-helper-file": "3.13.0",
|
|
44
|
+
"@webex/test-helper-mocha": "3.13.0",
|
|
45
45
|
"exifr": "^5.0.3",
|
|
46
46
|
"gm": "^1.23.1",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"test:style": "eslint ./src/**/*.*",
|
|
58
58
|
"test:unit": "webex-legacy-tools test --unit --runner mocha"
|
|
59
59
|
},
|
|
60
|
-
"version": "3.
|
|
60
|
+
"version": "3.13.0"
|
|
61
61
|
}
|