{"_id":"@armindoflores/obr-ext-core","_rev":"5-2ca081d4f872c8d2ffc1ca2c4950c8db","name":"@armindoflores/obr-ext-core","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@armindoflores/obr-ext-core","version":"0.0.1","author":{"name":"Armindo Flores"},"license":"MIT","_id":"@armindoflores/obr-ext-core@0.0.1","maintainers":[{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"}],"homepage":"https://github.com/ArmindoFlores/obr-ext-core#readme","bugs":{"url":"https://github.com/ArmindoFlores/obr-ext-core/issues"},"dist":{"shasum":"e445e22538bcc940f09164d8e66dd327f7f27d04","tarball":"https://registry.npmjs.org/@armindoflores/obr-ext-core/-/obr-ext-core-0.0.1.tgz","fileCount":27,"integrity":"sha512-3eAtB/Bnyab5+V+aNWqu7e0h//RIq1iui75MeVqbDUxrvxcd2ADGs9IeH/G9w7pRjbevwFeyD4fN9YMdG1UFHw==","signatures":[{"sig":"MEYCIQCtLPR3VwR+blthiFkJW1x/vxwIXNvCAWeBtFS2pjwqjQIhALRXUbv9wtAujAmgr1c+SuaWcmj0uTxfXZyS04wet6kq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18852},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./types":{"types":"./dist/types.d.ts"},"./utils":{"types":"./dist/utils.d.ts","import":"./dist/utils.js"}},"gitHead":"8138152c3d0f9ef44753acbc1e2ced6b8ecc075e","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"},"repository":{"url":"git+ssh://git@github.com/ArmindoFlores/obr-ext-core.git","type":"git"},"_npmVersion":"11.12.1","description":"Base package to create Owlbear Rodeo extension APIs using the broadcast feature","directories":{},"_nodeVersion":"22.22.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.3.0","prettier":"^3.8.3","typescript":"^6.0.3","@owlbear-rodeo/sdk":"^3.1.0"},"peerDependencies":{"@owlbear-rodeo/sdk":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/obr-ext-core_0.0.1_1778668542093_0.8811447636557923","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@armindoflores/obr-ext-core","version":"0.0.2","author":{"name":"Armindo Flores"},"license":"MIT","_id":"@armindoflores/obr-ext-core@0.0.2","maintainers":[{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"}],"homepage":"https://github.com/ArmindoFlores/obr-ext-core#readme","bugs":{"url":"https://github.com/ArmindoFlores/obr-ext-core/issues"},"dist":{"shasum":"eb3d92741ea362101b27f686836411cafdcb155d","tarball":"https://registry.npmjs.org/@armindoflores/obr-ext-core/-/obr-ext-core-0.0.2.tgz","fileCount":27,"integrity":"sha512-vouyvJbHcQuMz9KjsN5bhYgYFj2KTrJNmeGHsdg6b4mzfm/XsYc2YpyPQkJABrIzLhEyQPJZBRvHO3HDtqkb1g==","signatures":[{"sig":"MEUCIQC8gVvDdYbaHp6V5CnRhGmSU4pt4gFi+g8RHAgixq1CPgIgFZGDtt6bRPR6UX+DdtS9OGv8m/q0Rsu1TyVHuR4hH9U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19416},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./types":{"types":"./dist/types.d.ts"},"./utils":{"types":"./dist/utils.d.ts","import":"./dist/utils.js"}},"gitHead":"fd1c80a2707fdd3c9408f0c18082061b62d8c1e0","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"},"repository":{"url":"git+ssh://git@github.com/ArmindoFlores/obr-ext-core.git","type":"git"},"_npmVersion":"11.12.1","description":"Base package to create Owlbear Rodeo extension APIs using the broadcast feature","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.3.0","prettier":"^3.8.3","typescript":"^6.0.3","@owlbear-rodeo/sdk":"^3.1.0"},"peerDependencies":{"@owlbear-rodeo/sdk":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/obr-ext-core_0.0.2_1778752170308_0.7107297101868071","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@armindoflores/obr-ext-core","version":"0.0.3","author":{"name":"Armindo Flores"},"license":"MIT","_id":"@armindoflores/obr-ext-core@0.0.3","maintainers":[{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"}],"homepage":"https://github.com/ArmindoFlores/obr-ext-core#readme","bugs":{"url":"https://github.com/ArmindoFlores/obr-ext-core/issues"},"dist":{"shasum":"7f4fa28132caf4713704356939bf2447a6708e75","tarball":"https://registry.npmjs.org/@armindoflores/obr-ext-core/-/obr-ext-core-0.0.3.tgz","fileCount":27,"integrity":"sha512-RiAPSX72VZqA+l0yX8NM29ZBH0RlTgMQtnn7hgUNd3upkDZtiSHvvCQ2ESncIPhGWT3hGC9XMPn7GAQxyldlQg==","signatures":[{"sig":"MEUCIAJQyrVr0OwWuawHySjf/hCO3YFDs6QwXJMqJiwmhK5nAiEA/UubYy/X6mn7mvcQED24mXR1z00fE65lFv5EoOh1RMY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@armindoflores%2fobr-ext-core@0.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":20816},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./types":{"types":"./dist/types.d.ts"},"./utils":{"types":"./dist/utils.d.ts","import":"./dist/utils.js"}},"gitHead":"b8fe1e34cc64143b34c245ea88bf71016d5baec0","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:578166c5-caf6-43ed-8968-d777793f233c"}},"repository":{"url":"git+ssh://git@github.com/ArmindoFlores/obr-ext-core.git","type":"git"},"_npmVersion":"11.13.0","description":"Base package to create Owlbear Rodeo extension APIs using the broadcast feature","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.3.0","prettier":"^3.8.3","typescript":"^6.0.3","@owlbear-rodeo/sdk":"^3.1.0"},"peerDependencies":{"@owlbear-rodeo/sdk":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/obr-ext-core_0.0.3_1781871245412_0.18386483617246996","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@armindoflores/obr-ext-core","version":"0.0.4","author":{"name":"Armindo Flores"},"license":"MIT","_id":"@armindoflores/obr-ext-core@0.0.4","maintainers":[{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"}],"homepage":"https://github.com/ArmindoFlores/obr-ext-core#readme","bugs":{"url":"https://github.com/ArmindoFlores/obr-ext-core/issues"},"dist":{"shasum":"700bbb1628142a3d8c5d131a66ae9c2a1f885dff","tarball":"https://registry.npmjs.org/@armindoflores/obr-ext-core/-/obr-ext-core-0.0.4.tgz","fileCount":27,"integrity":"sha512-8RbQo/kY/YQPGQFDEi1UvBdmM+s7rNtpmiJ6KP36mjk0k8iNNdNz2t4rZjnH50wtb4pek+2jc6Bf9BCXy4VUlA==","signatures":[{"sig":"MEUCIQDUAXJRQI2KW8Alp/OQcbmkysCdd1HwrKptj/u77RuB/wIgPCUiSON6VOjO7wqibWJRYx70wHlU4KtnDktu6mF/efI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@armindoflores%2fobr-ext-core@0.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":23012},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./types":{"types":"./dist/types.d.ts"},"./utils":{"types":"./dist/utils.d.ts","import":"./dist/utils.js"}},"gitHead":"a1b0c417f2968ddee6877de08039f997d23d2c70","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:578166c5-caf6-43ed-8968-d777793f233c"}},"repository":{"url":"git+ssh://git@github.com/ArmindoFlores/obr-ext-core.git","type":"git"},"_npmVersion":"11.13.0","description":"Base package to create Owlbear Rodeo extension APIs using the broadcast feature","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.3.0","prettier":"^3.8.3","typescript":"^6.0.3","@owlbear-rodeo/sdk":"^3.1.0"},"peerDependencies":{"@owlbear-rodeo/sdk":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/obr-ext-core_0.0.4_1781879221656_0.417765669304762","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@armindoflores/obr-ext-core","version":"0.0.5","description":"Base package to create Owlbear Rodeo extension APIs using the broadcast feature","homepage":"https://github.com/ArmindoFlores/obr-ext-core#readme","bugs":{"url":"https://github.com/ArmindoFlores/obr-ext-core/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/ArmindoFlores/obr-ext-core.git"},"license":"MIT","author":{"name":"Armindo Flores"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"./utils":{"import":"./dist/utils.js","types":"./dist/utils.d.ts"},"./types":{"types":"./dist/types.d.ts"}},"scripts":{"build":"tsc","test":"echo \"Error: no test specified\" && exit 1"},"devDependencies":{"@owlbear-rodeo/sdk":"^3.1.0","eslint":"^10.3.0","prettier":"^3.8.3","typescript":"^6.0.3"},"peerDependencies":{"@owlbear-rodeo/sdk":"^3.1.0"},"gitHead":"9c83c4721d977e0535b9b29acaa341efff15afba","_id":"@armindoflores/obr-ext-core@0.0.5","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-yDQ4Kr6px+J4M94uORpgPJxfks44hPX58FL+jYAcdd7sDuMufXeVkoqm0NZwxSV7A540XcuTKR+eNTPftpFiYQ==","shasum":"b407423240ed243c1213a9f095322d203212e4c0","tarball":"https://registry.npmjs.org/@armindoflores/obr-ext-core/-/obr-ext-core-0.0.5.tgz","fileCount":27,"unpackedSize":23515,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@armindoflores%2fobr-ext-core@0.0.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDWx0lX6WzQdd0MM/4TkTHhjcAIDCS5XaBbvs0qnVAIHwIgZ82DaUEkHQA01wYh0tRTbHEZSC88vu0h3JZnGUBF0ZY="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:578166c5-caf6-43ed-8968-d777793f233c"}},"directories":{},"maintainers":[{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/obr-ext-core_0.0.5_1781881729549_0.579569861129394"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T10:35:41.975Z","modified":"2026-06-19T15:08:49.961Z","0.0.1":"2026-05-13T10:35:42.236Z","0.0.2":"2026-05-14T09:49:30.455Z","0.0.3":"2026-06-19T12:14:05.660Z","0.0.4":"2026-06-19T14:27:01.806Z","0.0.5":"2026-06-19T15:08:49.687Z"},"bugs":{"url":"https://github.com/ArmindoFlores/obr-ext-core/issues"},"author":{"name":"Armindo Flores"},"license":"MIT","homepage":"https://github.com/ArmindoFlores/obr-ext-core#readme","repository":{"type":"git","url":"git+ssh://git@github.com/ArmindoFlores/obr-ext-core.git"},"description":"Base package to create Owlbear Rodeo extension APIs using the broadcast feature","maintainers":[{"name":"armindoflores","email":"francisco.rodrigues0908@gmail.com"}],"readme":"# obr-ext-core\n\nA lightweight TypeScript library for building typed request/response APIs on top of [Owlbear Rodeo's](https://owlbear.rodeo) broadcast channel feature.\n\n## Requirements\n\nThis library requires [`@owlbear-rodeo/sdk`](https://www.npmjs.com/package/@owlbear-rodeo/sdk) to be installed in your project.\n\n```sh\nnpm install @owlbear-rodeo/sdk\n```\n\n## Installation\n\n```sh\nnpm install @armindoflores/obr-ext-core\n```\n\n## Overview\n\nThis library lets you define a typed message registry and use it to build a type-safe communication between an extension's client and handler sides over OBR broadcast channels.\n\nThe two main classes are:\n\n- `ClientAPI` - sends requests and waits for a matching response\n- `APIHandler` - listens for incoming requests, dispatches them to registered handlers, and sends back responses\n\n## Usage\n\n### 1. Define your message registry\n\nStart by defining your request/response message pairs and grouping them into a registry type.\n\n```typescript\nimport type { MessageBase } from \"@armindoflores/obr-ext-core\";\n\ninterface MessagePathfind extends MessageBase {\n    type: \"PATHFIND\";\n    from: { x: number; y: number };\n    to:   { x: number; y: number };\n}\n\ninterface MessagePathfindResponse extends MessageBase {\n    type: \"PATHFIND\";\n    distance: number;\n    path: { x: number; y: number }[];\n}\n\ntype MyRegistry = {\n    PATHFIND: {\n        request:  MessagePathfind;\n        response: MessagePathfindResponse;\n    };\n};\n```\n\nEach key in the registry maps a message type to its `request` and `response` shapes. Both must extend `MessageBase` (which requires an `id: string` and `type: string`).\n\n### 2. Set up the handler\nThe handler will be responsible for processing messages sent by clients. It can define a number of handlers and respond to each message type.\n\n```typescript\nimport { APIHandler } from \"@armindoflores/obr-ext-core\";\n\nconst handler = new APIHandler<MyRegistry>(\"com.example.ext/response\", \"com.example.ext/request\");\n\nhandler.setHandler(\"PATHFIND\", (message) => {\n    // message is typed as MessagePathfind\n    const path = computePath(message.from, message.to);\n    return {\n        // no need to include the id, that is done automatically\n        type: \"PATHFIND\",\n        distance: path.distance,\n        path: path.points,\n    };\n});\n\n// To actually enable listening for messages\nOBR.onReady(() => {\n    handler.register();\n});\n```\n\n### 3. Send requests\n```typescript\nimport { ClientAPI, isErrorMessage } from \"@armindoflores/obr-ext-core\";\n\nconst client = new ClientAPI<MyRegistry>(\"com.example.ext/request\", \"com.example.ext/response\");\n\nconst result = await client.request({\n    id: \"something\",  // optional, will default to a random ID\n    type: \"PATHFIND\",\n    from: { x: 0, y: 0 },\n    to:   { x: 5, y: 5 },\n});\n\nif (isErrorMessage(result)) {\n    console.error(\"Request failed:\", result.error);\n} else {\n    // result is typed as MessagePathfindResponse\n    console.log(\"Distance:\", result.distance);\n    console.log(\"Path:\", result.path);\n}\n```\n","readmeFilename":"README.md"}