{"_id":"@effect.healthcare/messenger","_rev":"5-0d520735f13d505cea13f4003a7a4464","name":"@effect.healthcare/messenger","dist-tags":{"latest":"0.5.0"},"versions":{"0.3.1":{"name":"@effect.healthcare/messenger","version":"0.3.1","keywords":["web component"],"author":{"name":"Scalable.Software"},"license":"CC-BY-NC-SA-4.0","_id":"@effect.healthcare/messenger@0.3.1","maintainers":[{"name":"effect.healthcare.administrator","email":"administrator@effect.healthcare"},{"name":"effect.healthcare.development","email":"development@effect.healthcare"},{"name":"solution.architect","email":"Solution.Architect@Scalable.Software"}],"homepage":"https://github.com/effect-healthcare/messenger#readme","bugs":{"url":"https://github.com/effect-healthcare/messenger/issues"},"dist":{"shasum":"26c36138e2b1a6e2199ce4727ce8805422032683","tarball":"https://registry.npmjs.org/@effect.healthcare/messenger/-/messenger-0.3.1.tgz","fileCount":33,"integrity":"sha512-vV2Auz6V2Vep2ghbfMND77LjtKkRQ4YA2bO6Enj5RLTgh0PSmh5+curyyMYajyl6FUwGzcv8oB3OgaKvXf5vIQ==","signatures":[{"sig":"MEUCIBTof9wM7XgIY8HLQGm35qD6924cV3HDAfbGv+sROd47AiEAjr2majTrjtz/KpvGGBQrLqDb3wYKIl4j/5QKZ02f/xI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":325937},"types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js"}},"gitHead":"5a0ca748ed0f7f2b48d7bfaad62592b2cf4b1bbe","scripts":{"test":"karma start","build":"tsc --project tsconfig.build.json","serve":"web-dev-server","pretest":"npm run clean.test && tsc --project tsconfig.test.json","document":"npx typedoc --tsconfig tsconfig.test.json","posttest":"npm run clean.test","prebuild":"node ./tasks/clean.build.mjs","preserve":"npm run build","postbuild":"node ./tasks/copy.build.mjs","clean.test":"node ./tasks/clean.test.mjs","prepublish":"npm run build"},"_npmUser":{"name":"solution.architect","email":"Solution.Architect@Scalable.Software"},"repository":{"url":"git+https://github.com/effect-healthcare/messenger.git","type":"git"},"_npmVersion":"11.13.0","description":"Azure Pub Sub Messenger Web Component","directories":{},"_nodeVersion":"24.16.0","dependencies":{"@scalable.software/component":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"karma":"^6.4.3","jasmine":"^5.1.0","typedoc":"^0.28.19","typescript":"^6.0.3","@types/node":"^26.0.1","karma-jasmine":"^5.1.0","@types/jasmine":"^5.1.4","@web/dev-server":"^0.4.6","karma-spec-reporter":"^0.0.36","karma-chrome-launcher":"^3.2.0","typedoc-plugin-merge-modules":"^7.0.0","karma-coverage-istanbul-reporter":"^3.0.3","karma-coverage-istanbul-instrumenter":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/messenger_0.3.1_1782573222362_0.5424587726783314","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@effect.healthcare/messenger","version":"0.4.1","keywords":["web component"],"author":{"name":"Scalable.Software"},"license":"CC-BY-NC-SA-4.0","_id":"@effect.healthcare/messenger@0.4.1","maintainers":[{"name":"effect.healthcare.administrator","email":"administrator@effect.healthcare"},{"name":"effect.healthcare.development","email":"development@effect.healthcare"},{"name":"solution.architect","email":"Solution.Architect@Scalable.Software"}],"homepage":"https://github.com/effect-healthcare/messenger#readme","bugs":{"url":"https://github.com/effect-healthcare/messenger/issues"},"dist":{"shasum":"d6190b20c13f0f8e740846926115bd22efa650ef","tarball":"https://registry.npmjs.org/@effect.healthcare/messenger/-/messenger-0.4.1.tgz","fileCount":29,"integrity":"sha512-bXoJsiAgc5xlxUv9Ob5wrw9UnM4D+jjhBrU+XqbA9wV0wO5X86s7uSIFUijH6dOHd8MiDsiY5JeUkgDvPjhsAA==","signatures":[{"sig":"MEQCIG+bzUSkvJtCD+vcSVoZAWB+IijldOOXXC95lXC0T0frAiBs6y3LSkoYnCGi4uF7/vLZaYZVCgmhnQ6XTkVxzZJj4g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":320067},"types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js"}},"gitHead":"b30f748f7857ab1e9709fc3cb029cbdfa060710c","scripts":{"test":"karma start","build":"tsc --project tsconfig.build.json","serve":"web-dev-server","pretest":"npm run clean.test && tsc --project tsconfig.test.json","document":"npx typedoc --tsconfig tsconfig.test.json","posttest":"npm run clean.test","prebuild":"node ./tasks/clean.build.mjs","preserve":"npm run build","postbuild":"node ./tasks/copy.build.mjs","clean.test":"node ./tasks/clean.test.mjs","prepublish":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:82ac1e67-f75d-4f5d-a90b-1aea6ba8b4a7"}},"repository":{"url":"git+https://github.com/effect-healthcare/messenger.git","type":"git"},"_npmVersion":"11.13.0","description":"Azure Pub Sub Messenger Web Component","directories":{},"_nodeVersion":"24.17.0","dependencies":{"@scalable.software/component":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"karma":"^6.4.3","jasmine":"^5.1.0","typedoc":"^0.28.19","typescript":"^6.0.3","@types/node":"^26.0.1","karma-jasmine":"^5.1.0","@types/jasmine":"^5.1.4","@web/dev-server":"^0.4.6","karma-spec-reporter":"^0.0.36","karma-chrome-launcher":"^3.2.0","typedoc-plugin-merge-modules":"^7.0.0","karma-coverage-istanbul-reporter":"^3.0.3","karma-coverage-istanbul-instrumenter":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/messenger_0.4.1_1782647457518_0.3183373440137267","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@effect.healthcare/messenger","version":"0.4.2","keywords":["web component"],"author":{"name":"Scalable.Software"},"license":"CC-BY-NC-SA-4.0","_id":"@effect.healthcare/messenger@0.4.2","maintainers":[{"name":"effect.healthcare.administrator","email":"administrator@effect.healthcare"},{"name":"effect.healthcare.development","email":"development@effect.healthcare"},{"name":"solution.architect","email":"Solution.Architect@Scalable.Software"}],"homepage":"https://github.com/effect-healthcare/messenger#readme","bugs":{"url":"https://github.com/effect-healthcare/messenger/issues"},"dist":{"shasum":"d4aa0de94f865aeda610364332fc84cb480d0ffc","tarball":"https://registry.npmjs.org/@effect.healthcare/messenger/-/messenger-0.4.2.tgz","fileCount":29,"integrity":"sha512-/rX8Y4IpFNG2RyJgqsFkNVVtzDWO8EZDSPO+3rDQXvE2W/8yFogH4tyXjzICgzbF6N7oMRlPWBYFjFwjqOL8yg==","signatures":[{"sig":"MEYCIQCCsP9XKmY5FDNPsD6KwsqsYaXIjrZtW33u69DeypuLuQIhAKISxZ3+BgLxWOuNNpFOSEWUYFse6mnylZlLJhtVv8Au","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":320073},"types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js"}},"gitHead":"89befbbeb04c4d4222d10dbd480568c1bd1eb4be","scripts":{"test":"karma start","build":"tsc --project tsconfig.build.json","serve":"web-dev-server","pretest":"npm run clean.test && tsc --project tsconfig.test.json","document":"npx typedoc --tsconfig tsconfig.test.json","posttest":"npm run clean.test","prebuild":"node ./tasks/clean.build.mjs","preserve":"npm run build","postbuild":"node ./tasks/copy.build.mjs","clean.test":"node ./tasks/clean.test.mjs","prepublish":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:82ac1e67-f75d-4f5d-a90b-1aea6ba8b4a7"}},"repository":{"url":"git+https://github.com/effect-healthcare/messenger.git","type":"git"},"_npmVersion":"11.13.0","description":"Azure Pub Sub Messenger Web Component","directories":{},"_nodeVersion":"24.17.0","dependencies":{"@scalable.software/component":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"karma":"^6.4.3","jasmine":"^5.1.0","typedoc":"^0.28.19","typescript":"^6.0.3","@types/node":"^26.0.1","karma-jasmine":"^5.1.0","@types/jasmine":"^5.1.4","@web/dev-server":"^0.4.6","karma-spec-reporter":"^0.0.36","karma-chrome-launcher":"^3.2.0","typedoc-plugin-merge-modules":"^7.0.0","karma-coverage-istanbul-reporter":"^3.0.3","karma-coverage-istanbul-instrumenter":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/messenger_0.4.2_1782674408396_0.15889742706608656","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@effect.healthcare/messenger","version":"0.5.0","description":"Azure Pub Sub Messenger Web Component","keywords":["web component"],"exports":{".":{"import":"./dist/index.js"}},"types":"dist/index.d.ts","scripts":{"clean.test":"node ./tasks/clean.test.mjs","pretest":"npm run clean.test && tsc --project tsconfig.test.json","test":"karma start","posttest":"npm run clean.test","prebuild":"node ./tasks/clean.build.mjs","build":"tsc --project tsconfig.build.json","postbuild":"node ./tasks/copy.build.mjs","preserve":"npm run build","serve":"web-dev-server","document":"npx typedoc --tsconfig tsconfig.test.json","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/effect-healthcare/messenger.git"},"author":{"name":"Scalable.Software"},"license":"CC-BY-NC-SA-4.0","bugs":{"url":"https://github.com/effect-healthcare/messenger/issues"},"homepage":"https://github.com/effect-healthcare/messenger#readme","devDependencies":{"@types/jasmine":"^5.1.4","@types/node":"^26.0.1","@web/dev-server":"^0.4.6","jasmine":"^5.1.0","karma":"^6.4.3","karma-chrome-launcher":"^3.2.0","karma-coverage-istanbul-instrumenter":"^1.0.4","karma-coverage-istanbul-reporter":"^3.0.3","karma-jasmine":"^5.1.0","karma-spec-reporter":"^0.0.36","typedoc":"^0.28.19","typedoc-plugin-merge-modules":"^7.0.0","typescript":"^6.0.3"},"dependencies":{"@scalable.software/component":"^0.3.0"},"gitHead":"c31b23fc4f0d86f55aa0e84e0f5b85428ab69c16","_id":"@effect.healthcare/messenger@0.5.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-2DsovPiQDkIcvYzf476iiqU5lZaP5e5uA8VTm7ZnHCLM/B1oofOAhSr3KKq3Se8ATadA8kZ0sLoy2iFEPfbLdA==","shasum":"d8109a9ae2233366c45dd07d721ed29dcb40ad70","tarball":"https://registry.npmjs.org/@effect.healthcare/messenger/-/messenger-0.5.0.tgz","fileCount":29,"unpackedSize":322681,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCGJkpr4DDwk6pfZjWLdhVMQ0gwBi82Kj5UfqcCmIRDXwIhAI8oQ9Ku4oz9CEujxqr/ajmMo336m39MnUYvMrBBM4xF"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:82ac1e67-f75d-4f5d-a90b-1aea6ba8b4a7"}},"directories":{},"maintainers":[{"name":"effect.healthcare.administrator","email":"administrator@effect.healthcare"},{"name":"effect.healthcare.development","email":"development@effect.healthcare"},{"name":"solution.architect","email":"Solution.Architect@Scalable.Software"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/messenger_0.5.0_1787067388179_0.9425776063328715"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-27T15:13:42.318Z","modified":"2026-08-18T15:36:29.074Z","0.3.1":"2026-06-27T15:13:42.548Z","0.4.1":"2026-06-28T11:50:57.653Z","0.4.2":"2026-06-28T19:20:08.544Z","0.5.0":"2026-08-18T15:36:28.343Z"},"bugs":{"url":"https://github.com/effect-healthcare/messenger/issues"},"author":{"name":"Scalable.Software"},"license":"CC-BY-NC-SA-4.0","homepage":"https://github.com/effect-healthcare/messenger#readme","keywords":["web component"],"repository":{"type":"git","url":"git+https://github.com/effect-healthcare/messenger.git"},"description":"Azure Pub Sub Messenger Web Component","maintainers":[{"name":"effect.healthcare.administrator","email":"administrator@effect.healthcare"},{"name":"effect.healthcare.development","email":"development@effect.healthcare"},{"name":"solution.architect","email":"Solution.Architect@Scalable.Software"}],"readme":"![License: CC BY-NC-SA 4.0](https://flat.badgen.net/static/license/CC-BY-NC-SA-4.0/green)\n\n# Messenger\n\n`@effect.healthcare/messenger` (`<app-messenger>`) is a **headless** web component that bridges your application to an Azure Web PubSub hub. It authenticates with the session token in local storage, negotiates a short‑lived client access URL, opens a live connection, and dispatches inbound master‑data‑change notifications as a semantic DOM event.\n\nIt renders nothing — no template, no styles. You configure it, bind an event, and call `connect()`.\n\n> This foundation is **receive‑only**; outbound collaboration messaging is a future capability.\n\n## Overview\n\n```js\nimport { Messenger } from \"@effect.healthcare/messenger\";\n\n// Register the element\ncustomElements.define(Messenger.Tag, Messenger);\n\n// Get the instance (or place <app-messenger> in your HTML)\nconst messenger = await Messenger.get();\n\n// Bind the event you care about\nmessenger.onmasterdatachange = (event) =>\n  console.log(\"master data changed at\", event.detail.datetime);\n\n// Configure the negotiate endpoint, then connect\nmessenger.endpoint = \"https://your-api/realtime/master-data/negotiate\";\nawait messenger.connect();\n```\n\n### 1. Configuration\n\nTwo inputs drive the messenger:\n\n- **`endpoint`** — the negotiate URL of the hub. It is an attribute‑backed state, so set it either as a property or as an attribute:\n\n  ```html\n  <app-messenger endpoint=\"https://your-api/realtime/master-data/negotiate\"></app-messenger>\n  ```\n\n  ```js\n  messenger.endpoint = \"https://your-api/realtime/master-data/negotiate\";\n  ```\n\n- **Session token** — read **fresh on every connect attempt** from local storage under the key **`app-license.session`**. Your application (e.g. the License component) must have written it before connecting. The messenger never logs in itself.\n\n### 2. Binding to `onmasterdatachange`\n\nThe messenger dispatches **`onmasterdatachange`** whenever the server signals a master‑data change. The payload carries the receipt time:\n\n```js\nmessenger.onmasterdatachange = (event) => {\n  const { datetime } = event.detail; // ISO-8601 timestamp\n  // re-sync your application data here\n};\n```\n\nAssigning a handler replaces the previous one; assign `null` to remove it.\n\n### 3. Connecting\n\n```js\nawait messenger.connect(); // negotiates + opens the live connection\nmessenger.disconnect();    // closes the connection\n```\n\n`connect()` is a **no‑op** unless both an `endpoint` and a session token are available, or when already connecting/connected — so it is safe to call repeatedly.\n\n### Connection lifecycle events\n\nObserve the live status if you need to coordinate around it. Each `event.detail.connection` is one of `connecting` | `connected` | `disconnected`:\n\n| Event | Fires when |\n| --- | --- |\n| `onconnecting` | a connection attempt starts |\n| `onconnected` | the live connection opens |\n| `ondisconnected` | the connection closes |\n| `onendpointchange` | the `endpoint` changes (`event.detail.endpoint`) |\n\n## Development\n\n```bash\nnpm install        # install dependencies\nnpm test           # run the suite (coverage in ./coverage, report in ./report)\nnpm run document   # generate API docs into ./docs\n```\n\n## License\n\n> This software and its documentation are released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0). This means you are free to share, copy, distribute, and transmit the work, and to adapt it, but only under the following conditions:\n>\n> Attribution: You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).\n>\n> NonCommercial: You may not use this material for commercial purposes.\n>\n> ShareAlike: If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.\n>\n> For more details, please visit the full [license agreement](https://creativecommons.org/licenses/by-nc-sa/4.0/).\n","readmeFilename":"README.md"}