{"_id":"@anapaya/webscion-poc","_rev":"5-404d8d557c6d073137c97abdb81c6ba4","name":"@anapaya/webscion-poc","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@anapaya/webscion-poc","version":"0.0.1","_id":"@anapaya/webscion-poc@0.0.1","maintainers":[{"name":"jmgomes","email":"joao.gomes@anapaya.net"}],"dist":{"shasum":"21b3232d1173166c91b11f0d9bd906591eda5583","tarball":"https://registry.npmjs.org/@anapaya/webscion-poc/-/webscion-poc-0.0.1.tgz","fileCount":26,"integrity":"sha512-96rxzDg94ST/mNlakBhEn0YVV2OuHrN8bWnQ2UDL6vKQf+An8HcAAZC2GAS8BjW/Ictz/0Z1gz5Jkh7ZWGQ9SQ==","signatures":[{"sig":"MEUCIA4eBlakHj5Nkqarw7JL5RdkiszTEVcoVfKxcR9gzbwGAiEAvjepUH+vAy4xoo9hREIAy4zGGsBDdiDTgvUbMKnHZz0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28844},"main":"./bin/src/index.js","type":"module","_from":"file:anapaya-webscion-poc-0.0.1.tgz","types":"./bin/src/index.d.ts","exports":{".":{"types":"./bin/src/index.d.ts","import":"./bin/src/index.js"},"./worker":{"default":"./bin/src/worker/scion-worker.js"},"./angular":{"types":"./bin/src/angular/index.d.ts","import":"./bin/src/angular/index.js"}},"scripts":{"test":"vitest run","build":"rm -rf bin && tsc -p tsconfig.json && tsc -p tsconfig.worker.json"},"_npmUser":{"name":"jmgomes","email":"joao.gomes@anapaya.net"},"_resolved":"/private/var/folders/1g/dz_mrkj91jlbbyn1pgn4822c0000gn/T/8306afd4a7d78cb273dff9a08867e2a0/anapaya-webscion-poc-0.0.1.tgz","_integrity":"sha512-96rxzDg94ST/mNlakBhEn0YVV2OuHrN8bWnQ2UDL6vKQf+An8HcAAZC2GAS8BjW/Ictz/0Z1gz5Jkh7ZWGQ9SQ==","_npmVersion":"11.6.2","description":"Proof-of-concept npm package that establishes the architecture for the future WebScion SDK, the a browser-based SCION networking stack.","directories":{},"_nodeVersion":"25.1.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"rxjs":"^7.8.0","vitest":"^3.2.1","typescript":"5.8.3","@angular/core":"^20.0.0","@angular/common":"^20.0.0","@angular/compiler":"^20.0.0"},"peerDependencies":{"@angular/core":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0"},"peerDependenciesMeta":{"@angular/core":{"optional":true},"@angular/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/webscion-poc_0.0.1_1776172376997_0.3591103457655451","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@anapaya/webscion-poc","version":"0.0.2","_id":"@anapaya/webscion-poc@0.0.2","maintainers":[{"name":"jmgomes","email":"joao.gomes@anapaya.net"}],"dist":{"shasum":"7bfe6ab9341a6fa5f8ea7f8949476e8b8b58116b","tarball":"https://registry.npmjs.org/@anapaya/webscion-poc/-/webscion-poc-0.0.2.tgz","fileCount":26,"integrity":"sha512-2/nkZanVIijJ+Mlc4dvKFmDjOFEw1T7zOUgGPgcVkwRPmDbg4y37vXR/uOLgTpCJDJPRONswIIIvdrtpoRV9tg==","signatures":[{"sig":"MEYCIQCvXnQiP0gmqXk6wLeCT0OM7kUNEZMai7kc5AtAW7NV2QIhAJBlbWH+Uj3zpAowttIxl1g34eDKU0MbXv4VXc4ahCJZ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29768},"main":"./bin/src/index.js","type":"module","_from":"file:anapaya-webscion-poc-0.0.2.tgz","types":"./bin/src/index.d.ts","exports":{".":{"types":"./bin/src/index.d.ts","import":"./bin/src/index.js"},"./worker":{"default":"./bin/src/worker/scion-worker.js"},"./angular":{"types":"./bin/src/angular/index.d.ts","import":"./bin/src/angular/index.js"}},"scripts":{"test":"vitest run","build":"rm -rf bin && tsc -p tsconfig.json && tsc -p tsconfig.worker.json"},"_npmUser":{"name":"jmgomes","email":"joao.gomes@anapaya.net"},"_resolved":"/private/var/folders/1g/dz_mrkj91jlbbyn1pgn4822c0000gn/T/40e4c1b57d2e4f067a978e090c0c5164/anapaya-webscion-poc-0.0.2.tgz","_integrity":"sha512-2/nkZanVIijJ+Mlc4dvKFmDjOFEw1T7zOUgGPgcVkwRPmDbg4y37vXR/uOLgTpCJDJPRONswIIIvdrtpoRV9tg==","_npmVersion":"11.6.2","description":"Proof-of-concept npm package that establishes the architecture for the future WebScion SDK, the a browser-based SCION networking stack.","directories":{},"_nodeVersion":"25.1.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"rxjs":"^7.8.0","vitest":"^3.2.1","typescript":"5.8.3","@angular/core":"^20.0.0","@angular/common":"^20.0.0","@angular/compiler":"^20.0.0"},"peerDependencies":{"@angular/core":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0","@angular/common":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0"},"peerDependenciesMeta":{"@angular/core":{"optional":true},"@angular/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/webscion-poc_0.0.2_1776338071650_0.13172266303830704","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@anapaya/webscion-poc","version":"0.0.3","_id":"@anapaya/webscion-poc@0.0.3","maintainers":[{"name":"jmgomes","email":"joao.gomes@anapaya.net"}],"dist":{"shasum":"65755a1b4323a89c6921fa55f3dc8bb33120d1ad","tarball":"https://registry.npmjs.org/@anapaya/webscion-poc/-/webscion-poc-0.0.3.tgz","fileCount":26,"integrity":"sha512-m1965bvK0pBQWC6f6wFdfgi0bwjh1WfFtMjKphYtw5oBtz9zPGNmb5kUTqnSL+eLrlc+YktenLQMK+T7GDpSnw==","signatures":[{"sig":"MEYCIQCChWpYcPYB60nznkIA4cdK2a7iHLiP7PUwUaW9fNTXqQIhAOOP4MGyRoICfg6Gfn5NaZLNQ/sp9K3C33dZBaZCDJwM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29948},"main":"./bin/src/index.js","type":"module","_from":"file:anapaya-webscion-poc-0.0.3.tgz","types":"./bin/src/index.d.ts","exports":{".":{"types":"./bin/src/index.d.ts","import":"./bin/src/index.js"},"./worker":{"default":"./bin/src/worker/scion-worker.js"},"./angular":{"types":"./bin/src/angular/index.d.ts","import":"./bin/src/angular/index.js"}},"scripts":{"test":"vitest run","build":"rm -rf bin && tsc -p tsconfig.json && tsc -p tsconfig.worker.json"},"_npmUser":{"name":"jmgomes","email":"joao.gomes@anapaya.net"},"_resolved":"/private/var/folders/1g/dz_mrkj91jlbbyn1pgn4822c0000gn/T/de45d8e25456e460a9e0c30ab73df550/anapaya-webscion-poc-0.0.3.tgz","_integrity":"sha512-m1965bvK0pBQWC6f6wFdfgi0bwjh1WfFtMjKphYtw5oBtz9zPGNmb5kUTqnSL+eLrlc+YktenLQMK+T7GDpSnw==","_npmVersion":"11.6.2","description":"Proof-of-concept npm package that establishes the architecture for the future WebScion SDK, the a browser-based SCION networking stack.","directories":{},"_nodeVersion":"25.1.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"rxjs":"^7.8.0","vitest":"^3.2.1","typescript":"5.8.3","@angular/core":"^20.0.0","@angular/common":"^20.0.0","@angular/compiler":"^20.0.0"},"peerDependencies":{"@angular/core":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0","@angular/common":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0"},"peerDependenciesMeta":{"@angular/core":{"optional":true},"@angular/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/webscion-poc_0.0.3_1776344493970_0.5513795243499346","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@anapaya/webscion-poc","version":"0.0.4","_id":"@anapaya/webscion-poc@0.0.4","maintainers":[{"name":"jmgomes","email":"joao.gomes@anapaya.net"}],"dist":{"shasum":"5ac59fb8601e2f23accf12a294b42d196b4d1e46","tarball":"https://registry.npmjs.org/@anapaya/webscion-poc/-/webscion-poc-0.0.4.tgz","fileCount":26,"integrity":"sha512-j3SKwyDyy4MjNJj50EXQrMJZysqTmlFO7tQy6wfYwq6s2CIOWPdr+wRL18lY42A1Ah2XPFYVFbE3UAYZwLNSMg==","signatures":[{"sig":"MEUCIHlbhVpkv6n/ln/9DdTSkjAfVfehVYi1kb2szWnEn0ewAiEAnSkbu6WO3+yQYLf4cG9IOxrW9dyv62AmZSSvQRz9HQM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29078},"main":"./bin/src/index.js","type":"module","_from":"file:anapaya-webscion-poc-0.0.4.tgz","types":"./bin/src/index.d.ts","exports":{".":{"types":"./bin/src/index.d.ts","import":"./bin/src/index.js"},"./worker":{"default":"./bin/src/worker/scion-worker.js"},"./angular":{"types":"./bin/src/angular/index.d.ts","import":"./bin/src/angular/index.js"}},"scripts":{"test":"vitest run","build":"rm -rf bin && tsc -p tsconfig.json && tsc -p tsconfig.worker.json"},"_npmUser":{"name":"jmgomes","email":"joao.gomes@anapaya.net"},"_resolved":"/private/var/folders/1g/dz_mrkj91jlbbyn1pgn4822c0000gn/T/20fbb9dc6ac45eb9f9ee519544b49d70/anapaya-webscion-poc-0.0.4.tgz","_integrity":"sha512-j3SKwyDyy4MjNJj50EXQrMJZysqTmlFO7tQy6wfYwq6s2CIOWPdr+wRL18lY42A1Ah2XPFYVFbE3UAYZwLNSMg==","_npmVersion":"11.6.2","description":"Proof-of-concept npm package that establishes the architecture for the future WebScion SDK, the a browser-based SCION networking stack.","directories":{},"_nodeVersion":"25.1.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"rxjs":"^7.8.0","vitest":"^3.2.1","typescript":"5.8.3","@angular/core":"^20.0.0","@angular/common":"^20.0.0","@angular/compiler":"^20.0.0"},"peerDependencies":{"@angular/core":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0","@angular/common":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0"},"peerDependenciesMeta":{"@angular/core":{"optional":true},"@angular/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/webscion-poc_0.0.4_1776410944233_0.5489054282947532","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@anapaya/webscion-poc","version":"0.0.5","type":"module","main":"./bin/src/index.js","types":"./bin/src/index.d.ts","exports":{".":{"import":"./bin/src/index.js","types":"./bin/src/index.d.ts"},"./interceptors":{"import":"./bin/src/interceptors/index.js","types":"./bin/src/interceptors/index.d.ts"},"./axios":{"import":"./bin/src/axios/index.js","types":"./bin/src/axios/index.d.ts"},"./angular":{"import":"./bin/src/angular/index.js","types":"./bin/src/angular/index.d.ts"},"./worker":{"default":"./bin/src/worker/scion-worker.js"}},"peerDependencies":{"@angular/core":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0","@angular/common":"^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0","axios":"^1.12.0"},"peerDependenciesMeta":{"@angular/core":{"optional":true},"@angular/common":{"optional":true},"axios":{"optional":true}},"devDependencies":{"@angular/compiler":"^20.0.0","@angular/core":"^20.0.0","@angular/common":"^20.0.0","axios":"^1.12.2","rxjs":"^7.8.0","typescript":"5.8.3","vitest":"^3.2.1"},"publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"scripts":{"build":"rm -rf bin && tsc -p tsconfig.json && tsc -p tsconfig.worker.json","test":"vitest run"},"_id":"@anapaya/webscion-poc@0.0.5","description":"Proof-of-concept npm package that establishes the architecture for the future WebScion SDK, the a browser-based SCION networking stack.","_integrity":"sha512-5W94EpSvaa6DDf7Nrzdjppnk1YKgYuki83BElmpgQpCu7lKHnDlAPabcNEpBtPwG6HxbNQpxy61GcAq7BXaZEw==","_resolved":"/private/var/folders/1g/dz_mrkj91jlbbyn1pgn4822c0000gn/T/504ac0a0d98f6da581e64407e6c8db99/anapaya-webscion-poc-0.0.5.tgz","_from":"file:anapaya-webscion-poc-0.0.5.tgz","_nodeVersion":"25.1.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-5W94EpSvaa6DDf7Nrzdjppnk1YKgYuki83BElmpgQpCu7lKHnDlAPabcNEpBtPwG6HxbNQpxy61GcAq7BXaZEw==","shasum":"ea23973334017ab20dab1702f226105bf85d4605","tarball":"https://registry.npmjs.org/@anapaya/webscion-poc/-/webscion-poc-0.0.5.tgz","fileCount":42,"unpackedSize":58174,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD/N0Y+XVIu2ulpdGYCzCUexPqTuv5bc3Eh24lxbL4NvwIhAOSKsozq8ia5oh2Uh3DgBnXoMSm2uqizrYCb6EkcYxlv"}]},"_npmUser":{"name":"jmgomes","email":"joao.gomes@anapaya.net"},"directories":{},"maintainers":[{"name":"jmgomes","email":"joao.gomes@anapaya.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/webscion-poc_0.0.5_1777464183214_0.5633694478234481"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-14T13:12:56.905Z","modified":"2026-04-29T12:03:03.493Z","0.0.1":"2026-04-14T13:12:57.194Z","0.0.2":"2026-04-16T11:14:31.808Z","0.0.3":"2026-04-16T13:01:34.135Z","0.0.4":"2026-04-17T07:29:04.372Z","0.0.5":"2026-04-29T12:03:03.364Z"},"description":"Proof-of-concept npm package that establishes the architecture for the future WebScion SDK, the a browser-based SCION networking stack.","maintainers":[{"name":"jmgomes","email":"joao.gomes@anapaya.net"}],"readme":"# @anapaya/webscion-poc\n\nProof-of-concept npm package that establishes the architecture for the future WebScion SDK,\nthe a browser-based SCION networking stack.\n\n## Architecture\n\n```text\n┌─────────────────────────────────────────────────────┐\n│  App (Angular/React/Vue/Svelte/Vanilla)             │\n│    ↓ HTTP client integration                         │\n│  ScionStack.fetch()                                 │\n│    ↓ postMessage                                    |\n│  ┌────────────────────────────────────────────────┐ │\n│  │  Web Worker                                    │ │\n│  │                                                │ │\n│  │  Dispatches original request via scion         │ │\n│  │  (not yet implemented)                         │ │\n│  └────────────────────────────────────────────────┘ │\n└─────────────────────────────────────────────────────┘\n```\n\nIn a future iteration, the webworker will select an appropriate path for the request and dispatch it\nvia the SCION network.\n\n## Installation\n\n```bash\nnpm install @anapaya/webscion-poc\n```\n\n> Note: Some imports use a subpath, for example `@anapaya/webscion-poc/angular`.\n> If TypeScript can’t resolve that in your project, set `moduleResolution` to\n> `\"bundler\"` (recommended) or `\"node16\"`/`\"nodenext\"`.\n\n## Usage\n\n> **Important:** Every integration requires Web Worker setup.\n> `ScionStack` always needs `scion-worker.js` to be served at runtime.\n> If the worker URL is not reachable, requests routed through `ScionStack` will fail.\n\nUse `ScionStack` with one of the integrations below.\n\n### Angular: HTTP Interceptor\n\nRegister the SCION interceptor in your `app.config.ts`. It will intercept outgoing\n`HttpClient` requests matching the `match` predicate and route them through the SCION stack:\n\n```ts\nimport { provideHttpClient, withInterceptors } from \"@angular/common/http\";\nimport { ScionStack } from \"@anapaya/webscion-poc\";\nimport { createScionInterceptorFn } from \"@anapaya/webscion-poc/angular\";\n\nconst stack = new ScionStack(\"scion-worker.js\");\nconst scionInterceptor = createScionInterceptorFn({\n  stack,\n  match: (req) => req.url.startsWith(\"https://scion-enabled.example.com/\"),\n});\n\nexport const appConfig = {\n  providers: [\n    provideHttpClient(withInterceptors([scionInterceptor])),\n  ],\n};\n```\n\nThis integration requires the Web Worker setup described below.\n\n### Explicit Guarded Fetch Client\n\nUse `stack.fetch()` directly at the call site:\n\n```ts\nimport { ScionStack } from \"@anapaya/webscion-poc\";\n\nconst stack = new ScionStack(\"scion-worker.js\");\nconst guardedFetch = stack.fetch();\n\nawait guardedFetch(\"/api/echo\", {\n  method: \"POST\",\n  headers: { \"content-type\": \"application/json\" },\n  body: JSON.stringify({ msg: \"hello\" }),\n});\n```\n\nThis integration requires the Web Worker setup described below.\n\n### Global Fetch Interceptor\n\nPatch `globalThis.fetch` and scope interception with `match`:\n\n```ts\nimport { ScionStack } from \"@anapaya/webscion-poc\";\nimport { installScionFetchInterceptor } from \"@anapaya/webscion-poc/interceptors\";\n\nconst uninstall = installScionFetchInterceptor({\n  stack: new ScionStack(\"scion-worker.js\"),\n  match: (request) => new URL(request.url).pathname.startsWith(\"/api/\"),\n});\n\n// call uninstall() when needed\n```\n\nThis integration requires the Web Worker setup described below.\n\n### Axios Interceptor Integration\n\nUse Axios with a SCION-backed interceptor integration:\n\n```ts\nimport axios from \"axios\";\nimport { ScionStack } from \"@anapaya/webscion-poc\";\nimport { createScionAxiosAdapter } from \"@anapaya/webscion-poc/axios\";\n\nconst client = axios.create({\n  adapter: createScionAxiosAdapter({\n    stack: new ScionStack(\"scion-worker.js\"),\n    match: (config) => config.url?.startsWith(\"/api/\") ?? false,\n  }),\n});\n```\n\nThis integration requires the Web Worker setup described below.\n\n### Web Worker Setup (Any Framework/Bundler)\n\nThe `ScionStack` offloads request processing to a web worker. The worker file is shipped\nwith the package and must be made available as a static asset in your app.\n\nYour framework/bundler must expose the worker URL you pass to `new ScionStack(workerUrl)`.\nThe exact mechanism depends on your setup:\n\n- Angular: add worker asset in `angular.json` (`assets`).\n- Vite/Webpack/Rollup/esbuild: copy worker from package output to your static/public output.\n- Custom static servers: add a route that serves `node_modules/@anapaya/webscion-poc/bin/src/worker/scion-worker.js`.\n\nAngular example (assets entry):\n\n```json\n{\n  \"glob\": \"scion-worker.js\",\n  \"input\": \"node_modules/@anapaya/webscion-poc/bin/src/worker\",\n  \"output\": \"/\"\n}\n```\n\nThis makes `scion-worker.js` available at `/scion-worker.js`, matching:\n\n```ts\nnew ScionStack(\"scion-worker.js\");\n```\n\nFull example for the `build` target in `angular.json`:\n\n```json\n\"architect\": {\n  \"build\": {\n    \"options\": {\n      \"assets\": [\n        { \"glob\": \"**/*\", \"input\": \"public\" },\n        {\n          \"glob\": \"scion-worker.js\",\n          \"input\": \"node_modules/@anapaya/webscion-poc/bin/src/worker\",\n          \"output\": \"/\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## Observability & Verification\n\nThe web worker logs diagnostic information for every dispatched request:\n\n```text\n[webscion] #1 POST /api/data | 142 bytes | SHA-256: a1b2c3... | framing: 0.035ms\n```\n\nEach field:\n\n- **`#1`** — monotonic sequence number, proving the worker is stateful across requests\n- **Method and path** — the HTTP method and URL path of the dispatched request\n- **Byte length** — size of the HTTP/1.1 framed representation\n- **SHA-256** — hash of the framed bytes, useful for verification and debugging\n- **Framing duration** — time spent serializing the request to HTTP/1.1 bytes\n\nTo confirm setup for any framework/bundler:\n\n1. Trigger a request through the integration you chose.\n2. Check **Network** for `scion-worker.js` (200/304 are both fine).\n3. Check **Console** for `[webscion]` log lines.\n","readmeFilename":"README.md"}