Files
punktfunk-plugin-rom-manager/plugin/package.json
T
enricobuehler 94f18e38b4
CI / publish (push) Successful in 22s
CI / build (push) Successful in 34s
fix: the API emitted undefined optionals as null, and the UI couldn't decode them (v0.3.2)
`Schema.optional(X)` means `X | undefined`, and the plain Schema encoder omits a
present-but-undefined key — but the HttpApi RESPONSE path serialises it as
`null`, which `X | undefined` then refuses when the client decodes it. Two
user-visible failures shipped in 0.3.1:

  - GET /api/status on a never-synced host returned `"lastSync":null`, so the
    Overview page could not decode its own status — i.e. every fresh install
    until the first successful sync.
  - POST /api/detect on a box with any emulator installed returned
    `"contested":null` / `"appId":null`, so the Emulators page's Detect button
    could not decode the result. It only looked fine because a value that has
    round-tripped through cache.json has those keys ABSENT rather than present
    -and-undefined, and absent keys encode correctly.

Nothing on this wire is `undefined` any more. EngineStatus.{lastSync,lastReport,
detectedAt} are `Schema.NullOr` and the engine sends explicit nulls. The
DetectedEmulator fields use `Schema.optional(Schema.NullOr(...))` instead —
tolerant of absent, undefined and null — because they also live in cache.json,
and requiring them would fail the whole cache decode on upgrade and silently
discard every art verdict.

plugin/test/wire.test.ts pins it: it drives the real makeApi handler stack
through toWebHandler and decodes the bytes with the shared contract schemas.
Against the old schema all five of its assertions fail; a unit test of either
side in isolation passes while the product is broken.

Also: the SSE feed now emits the current status on subscribe rather than only on
the next engine transition, so a freshly-opened console page is correct
immediately instead of stale until something happens.
2026-07-20 23:36:01 +02:00

54 lines
1.5 KiB
JSON

{
"name": "@punktfunk/plugin-rom-manager",
"version": "0.3.2",
"private": false,
"type": "module",
"description": "Punktfunk plugin: scans ROM directories, maps them to emulators, and reconciles them into the host game library as a provider \u2014 with a console-hosted web UI. The reference plugin built on @punktfunk/plugin-kit.",
"license": "MIT OR Apache-2.0",
"homepage": "https://git.unom.io/unom/punktfunk-plugin-rom-manager",
"repository": {
"type": "git",
"url": "https://git.unom.io/unom/punktfunk-plugin-rom-manager.git"
},
"keywords": [
"punktfunk",
"plugin",
"roms",
"emulators",
"retroarch",
"game-streaming"
],
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./types/index.d.ts",
"bin": {
"punktfunk-plugin-rom-manager": "./dist/cli.js"
},
"files": [
"dist",
"types"
],
"publishConfig": {
"registry": "https://git.unom.io/api/packages/unom/npm/"
},
"scripts": {
"typecheck": "tsc --noEmit",
"test": "bun test",
"build": "bun build src/index.ts src/cli.ts --target=bun --outdir dist --external effect --external '@punktfunk/*'",
"build:ui": "cd ../ui && bun run build",
"build:all": "bun run build && bun run build:ui",
"dev": "bun src/dev.ts",
"prepublishOnly": "bun run build:all"
},
"dependencies": {
"@punktfunk/host": "^0.1.2",
"@punktfunk/plugin-kit": "^0.1.4",
"effect": "^4.0.0-beta.99"
},
"devDependencies": {
"@rom-manager/contract": "workspace:*",
"@types/bun": "^1.3.0",
"typescript": "^5.9.3"
}
}