@effect.healthcare/messenger 0.5.0 → 0.6.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/README.md +2 -0
- package/dist/messenger.d.ts +9 -2
- package/dist/messenger.js +17 -10
- package/package.json +7 -2
- package/.claude/CLAUDE.md +0 -88
- package/.claude/context/composition.md +0 -921
- package/.claude/context/data.md +0 -1036
- package/.claude/context/event.md +0 -686
- package/.claude/context/gesture.md +0 -614
- package/.claude/context/operation.md +0 -596
- package/.claude/context/state.md +0 -864
- package/.claude/context/testing.md +0 -876
- package/.claude/context/validation.md +0 -350
- package/.claude/context/workflow.md +0 -608
- package/.claude/settings.json +0 -7
- package/.mcp.json +0 -12
- package/dist/.gitkeep +0 -1
- package/src/index.ts +0 -19
- package/src/messenger.meta.ts +0 -139
- package/src/messenger.ts +0 -403
- package/src/messenger.validation.ts +0 -23
- package/web-dev-server.config.mjs +0 -8
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ It renders nothing — no template, no styles. You configure it, bind an event,
|
|
|
8
8
|
|
|
9
9
|
> This foundation is **receive‑only**; outbound collaboration messaging is a future capability.
|
|
10
10
|
|
|
11
|
+
The messenger is built on `@scalable.software/component` `^0.5.0`. The API, the events and their `detail` are unchanged. A host that serves the base component through an import map must serve `^0.5.0`.
|
|
12
|
+
|
|
11
13
|
## Overview
|
|
12
14
|
|
|
13
15
|
```js
|
package/dist/messenger.d.ts
CHANGED
|
@@ -169,12 +169,19 @@ export declare class Messenger extends Component {
|
|
|
169
169
|
*/
|
|
170
170
|
protected _addEventListeners: () => void;
|
|
171
171
|
/**
|
|
172
|
-
* Called by the disconnectedCallback prototypical method
|
|
173
|
-
* connection so a removed element does not keep a socket open.
|
|
172
|
+
* Called by the disconnectedCallback prototypical method
|
|
174
173
|
* @category Configuration
|
|
175
174
|
* @hidden
|
|
176
175
|
*/
|
|
177
176
|
protected _removeEventListeners: () => void;
|
|
177
|
+
/**
|
|
178
|
+
* Called by the disconnectedCallback prototypical method, after
|
|
179
|
+
* `_removeEventListeners`. Closes the live connection so a removed element
|
|
180
|
+
* does not keep a socket open.
|
|
181
|
+
* @category Configuration
|
|
182
|
+
* @hidden
|
|
183
|
+
*/
|
|
184
|
+
protected _dispose: () => void;
|
|
178
185
|
/**
|
|
179
186
|
* Negotiates a short-lived Web PubSub client access URL from the path,
|
|
180
187
|
* authenticating the request with the session token.
|
package/dist/messenger.js
CHANGED
|
@@ -88,13 +88,13 @@ export class Messenger extends Component {
|
|
|
88
88
|
this._connection = connection;
|
|
89
89
|
this.setAttribute(Attributes.CONNECTION, connection);
|
|
90
90
|
// Dispatch
|
|
91
|
-
const
|
|
91
|
+
const detail = { connection };
|
|
92
92
|
connection === Connection.CONNECTING &&
|
|
93
|
-
this.
|
|
93
|
+
this._dispatch(Event.ON_CONNECTING, detail);
|
|
94
94
|
connection === Connection.CONNECTED &&
|
|
95
|
-
this.
|
|
95
|
+
this._dispatch(Event.ON_CONNECTED, detail);
|
|
96
96
|
connection === Connection.DISCONNECTED &&
|
|
97
|
-
this.
|
|
97
|
+
this._dispatch(Event.ON_DISCONNECTED, detail);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* The negotiate request path. When absent the messenger stays disconnected.
|
|
@@ -117,7 +117,7 @@ export class Messenger extends Component {
|
|
|
117
117
|
? this.removeAttribute(Attributes.PATH)
|
|
118
118
|
: this.setAttribute(Attributes.PATH, path);
|
|
119
119
|
// Dispatch
|
|
120
|
-
this.
|
|
120
|
+
this._dispatch(Event.ON_PATH_CHANGE, { path });
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* The session token, read fresh from local storage on every access — never
|
|
@@ -285,12 +285,19 @@ export class Messenger extends Component {
|
|
|
285
285
|
*/
|
|
286
286
|
_addEventListeners = () => { };
|
|
287
287
|
/**
|
|
288
|
-
* Called by the disconnectedCallback prototypical method
|
|
289
|
-
* connection so a removed element does not keep a socket open.
|
|
288
|
+
* Called by the disconnectedCallback prototypical method
|
|
290
289
|
* @category Configuration
|
|
291
290
|
* @hidden
|
|
292
291
|
*/
|
|
293
|
-
_removeEventListeners = () =>
|
|
292
|
+
_removeEventListeners = () => { };
|
|
293
|
+
/**
|
|
294
|
+
* Called by the disconnectedCallback prototypical method, after
|
|
295
|
+
* `_removeEventListeners`. Closes the live connection so a removed element
|
|
296
|
+
* does not keep a socket open.
|
|
297
|
+
* @category Configuration
|
|
298
|
+
* @hidden
|
|
299
|
+
*/
|
|
300
|
+
_dispose = () => this.disconnect();
|
|
294
301
|
/**
|
|
295
302
|
* Negotiates a short-lived Web PubSub client access URL from the path,
|
|
296
303
|
* authenticating the request with the session token.
|
|
@@ -328,8 +335,8 @@ export class Messenger extends Component {
|
|
|
328
335
|
_handleMessage = (event) => {
|
|
329
336
|
const message = JSON.parse(event.data);
|
|
330
337
|
message.data?.type === Message.MASTER_DATA_CHANGED &&
|
|
331
|
-
this.
|
|
332
|
-
|
|
338
|
+
this._dispatch(Event.ON_MASTERDATACHANGE, {
|
|
339
|
+
datetime: new Date().toISOString(),
|
|
333
340
|
});
|
|
334
341
|
};
|
|
335
342
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect.healthcare/messenger",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Azure Pub Sub Messenger Web Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web component"
|
|
7
7
|
],
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"!dist/.gitkeep"
|
|
11
|
+
],
|
|
8
12
|
"exports": {
|
|
9
13
|
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
10
15
|
"import": "./dist/index.js"
|
|
11
16
|
}
|
|
12
17
|
},
|
|
@@ -50,6 +55,6 @@
|
|
|
50
55
|
"typescript": "^6.0.3"
|
|
51
56
|
},
|
|
52
57
|
"dependencies": {
|
|
53
|
-
"@scalable.software/component": "^0.
|
|
58
|
+
"@scalable.software/component": "^0.5.0"
|
|
54
59
|
}
|
|
55
60
|
}
|
package/.claude/CLAUDE.md
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# Web Component
|
|
2
|
-
|
|
3
|
-
A web component built on the `@scalable.software/component` framework. The policies in `.claude/context/` govern how component specifications are transformed into solid implementations.
|
|
4
|
-
|
|
5
|
-
## How This Project Works
|
|
6
|
-
|
|
7
|
-
Every component is developed through a specification-driven, test-first pipeline. The specification declares the public contract; the implementation honors it; the tests verify it; the commit history records the transformation.
|
|
8
|
-
|
|
9
|
-
When working on a component, translate the specification into an implementation that conforms to all applicable policies — without inventing structure, behavior, or vocabulary the specification does not declare.
|
|
10
|
-
|
|
11
|
-
## Translation Pipeline
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
<component>.specifications.json ← source of truth
|
|
15
|
-
│
|
|
16
|
-
├─→ <component>.meta.ts vocabulary + value-domain types
|
|
17
|
-
├─→ <component>.validation.ts Validate class — runtime enforcement
|
|
18
|
-
├─→ <component>.ts state, operations, events, gestures
|
|
19
|
-
├─→ <component>.template.html realized composition
|
|
20
|
-
└─→ <component>.style.css realized presentation
|
|
21
|
-
|
|
22
|
-
verified by:
|
|
23
|
-
test/unit/<component>.meta.test.ts — vocabulary tests
|
|
24
|
-
test/unit/<component>.validation.test.ts — validator tests
|
|
25
|
-
test/unit/<component>.test.ts — component behavioral tests
|
|
26
|
-
|
|
27
|
-
recorded by:
|
|
28
|
-
FAIL/PASS commit pairs, policy-ordered, one prefix per commit
|
|
29
|
-
DOCUMENTATION → FEATURE closes each feature branch
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Names predictably transform across layers. A state named `visibility` in the specification becomes `Attributes.VISIBILITY` + `State.VISIBILITY` in metadata, `Validate.visibility` in validation, `get visibility()`/`set visibility(...)` on the class, `state(State.VISIBILITY, ...)` in tests, and `STATE: ...` in commits.
|
|
33
|
-
|
|
34
|
-
## Implementation Order
|
|
35
|
-
|
|
36
|
-
Within any behavioral feature, work proceeds top-down through the policy hierarchy:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
COMPOSITION → STATE → VALIDATION → OPERATION → EVENT → STYLE → GESTURE → DOCUMENTATION → FEATURE
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Each layer depends on the layers above. CSS-only features collapse to `STYLE → FEATURE`. See `@context/workflow.md` for the full sequence and per-layer commit format.
|
|
43
|
-
|
|
44
|
-
## Implementation Policies
|
|
45
|
-
|
|
46
|
-
Each policy file opens with a **How to Read This Policy** rubric that classifies its rules as one of three strengths:
|
|
47
|
-
|
|
48
|
-
- **Principles** — non-negotiable; derived from framework correctness or TDD discipline.
|
|
49
|
-
- **Templates** — invariant skeletons with explicit variation points based on declared classification (e.g., attribute-backed vs non-attribute, readonly vs writable, payload-bearing vs payload-free).
|
|
50
|
-
- **Conventions** — canonical defaults that keep implementations readable across components.
|
|
51
|
-
|
|
52
|
-
When a new component's shape conflicts with a rule, classify the rule before reconciling: a principle conflict is a defect; a template conflict means a variation point needs to be made explicit; a convention conflict is a documented deviation.
|
|
53
|
-
|
|
54
|
-
### Specification-driven (per component)
|
|
55
|
-
|
|
56
|
-
@context/composition.md — structural parts and cached references
|
|
57
|
-
@context/data.md — canonical component-owned content
|
|
58
|
-
@context/state.md — runtime mode, visibility, status, persistence
|
|
59
|
-
@context/operation.md — public imperative actions
|
|
60
|
-
@context/event.md — observable semantic outcomes
|
|
61
|
-
@context/gesture.md — interaction inputs
|
|
62
|
-
@context/validation.md — runtime enforcement of declared value domains
|
|
63
|
-
|
|
64
|
-
### Cross-cutting (every component)
|
|
65
|
-
|
|
66
|
-
@context/testing.md — test file structure, BDD vocabulary, coverage contracts
|
|
67
|
-
@context/workflow.md — branching, commit sequencing, TDD discipline
|
|
68
|
-
|
|
69
|
-
## Working Principles
|
|
70
|
-
|
|
71
|
-
- **Test first.** Every behavioral change starts with a failing test. The FAIL commit precedes the PASS commit. No exceptions.
|
|
72
|
-
- **One feature per branch.** Behavioral work is never committed directly to main.
|
|
73
|
-
- **One concern per commit.** Every commit message begins with a canonical prefix.
|
|
74
|
-
- **Trace names across layers.** A specification name reappears unchanged — modulo standard transformations — in metadata, validation, class API, tests, and commits.
|
|
75
|
-
- **Specification is authoritative.** Implementations do not invent structure, behavior, or vocabulary the specification does not declare. If a component's shape does not fit a policy rule, examine the policy's variation points — do not bypass them.
|
|
76
|
-
|
|
77
|
-
## Running the Demo in a Browser (chrome-devtools MCP)
|
|
78
|
-
|
|
79
|
-
For advanced testing or debugging, the live web component can be served and driven through the `chrome-devtools` MCP. This gives access to the rendered component, its shadow DOM, the console, and DOM manipulation.
|
|
80
|
-
|
|
81
|
-
1. **Start the dev server** — `npm run serve`. The `preserve` hook builds first (`src/` → `dist/`), and `web-dev-server.config.mjs` is auto-loaded (`rootDir: "."`, `port: 3000`, `watch: true`). Run it in the background. The server serves the repo root because the demo loads `../importmap` and `./dist` via the import map. Port 3000 is the origin the backend CORS-whitelists, so do not change it.
|
|
82
|
-
2. **Navigate the controlled browser** — `mcp__chrome-devtools__navigate_page` to `http://localhost:3000/demo/index.html`. Always use the explicit `/demo/index.html` path; the demo uses relative asset paths and will not resolve at `/`.
|
|
83
|
-
3. **Verify** — `mcp__chrome-devtools__evaluate_script` to inspect the component (e.g. `customElements.get("app-messenger")` is defined; the base framework exposes the shadow root as `el.root`); `mcp__chrome-devtools__list_console_messages` to check for errors.
|
|
84
|
-
4. **Clean up when done** — navigate the page to `about:blank` (the MCP keeps one page alive, so the last page cannot be closed), then stop the dev server process on port 3000.
|
|
85
|
-
|
|
86
|
-
Notes:
|
|
87
|
-
- MCP tool schemas must be loaded via `ToolSearch` (`select:<name>`) before first use each session.
|
|
88
|
-
- If a stale server already holds port 3000, the new one fails to bind — kill the straggler rather than letting it drift to another port.
|