Files
Maurice 95f9f031c4 feat(plugins): cut entity results down to a published field list
The entity reads of the plugin RPC surface handed plugins whatever their
query produced, mostly SELECT t.*, with credentials stripped by a denylist
(withoutFeedToken). Every column a migration added reached every plugin
holding the read grant, and renaming one was an unversioned break of a
published API.

protocol/output-contract.ts now states, for every wire method, what its
result is: rows of one of the nine entities the SDK types (trip, place,
day, reservation, packingItem, tripFile, budgetItem, assignment, user), a
value the host builds itself, or a read model passed on as the REST route
returns it. The router applies it to each result on the way out, so an
entity row keeps exactly the fields plugins received when the list was
drawn, in the same order and with the same values, minus the trip's
feed_token (listMine, create and update used to carry it as null). The
table is keyed by every method, so a new one does not compile without an
entry.

output-contract.schema.test.ts holds the lists to the migrated schema: a
new column on a whole-row table fails until it is published or withheld,
and each entity method is called on the real services to prove the
contract drops nothing but the withheld fields.

gen:plugin-facts publishes the lists to the SDK as PLUGIN_ENTITY_FIELDS
and PLUGIN_METHOD_RESULT, and the SDK's entity interfaces are type-checked
against them. Place.day_id, which no read ever delivered, is deprecated
rather than removed. KNOWN_ADDONS is generated from ADDON_IDS as well,
which adds the dawarich, roadtrip and tours ids the hand-kept copy lacked.
The SDK goes to 1.9.0, and its README and the plugin wiki pages describe
what a ctx call returns.
2026-10-08 18:41:01 +02:00

91 lines
2.2 KiB
JSON

{
"name": "trek-plugin-sdk",
"version": "1.9.0",
"description": "SDK for building TREK plugins: types, definePlugin, a mock host, manifest validation, and the create-trek-plugin / trek-plugin CLIs.",
"type": "module",
"license": "MIT",
"author": "mauriceboe",
"maintainers": [
{
"name": "mauriceboe",
"url": "https://github.com/mauriceboe"
},
{
"name": "jubnl",
"url": "https://github.com/jubnl"
}
],
"homepage": "https://github.com/liketrek/TREK/wiki/Plugin-Development",
"repository": {
"type": "git",
"url": "git+https://github.com/liketrek/TREK.git",
"directory": "plugin-sdk"
},
"bugs": {
"url": "https://github.com/liketrek/TREK/issues"
},
"engines": {
"node": ">=18"
},
"publishConfig": {
"access": "public"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
},
"./testing": {
"import": {
"types": "./dist/mock-host.d.ts",
"default": "./dist/mock-host.js"
},
"require": {
"types": "./dist/cjs/mock-host.d.ts",
"default": "./dist/cjs/mock-host.js"
}
}
},
"bin": {
"trek-plugin-sdk": "./dist/cli/trek-plugin.js",
"trek-plugin": "./dist/cli/trek-plugin.js",
"create-trek-plugin": "./dist/cli/create.js"
},
"files": [
"dist"
],
"dependencies": {
"@clack/prompts": "^1.8.1",
"semver": "^7.8.5",
"update-notifier": "^7.3.1"
},
"scripts": {
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/finish-cjs.mjs",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"prepublishOnly": "npm run build && npm test"
},
"devDependencies": {
"@types/node": "^22.20.4",
"@types/semver": "^7.8.0",
"@types/update-notifier": "^6.0.8",
"@vitest/coverage-v8": "^4.1.11",
"typescript": "^5.9.3",
"vitest": "^4.1.11"
},
"keywords": [
"trek",
"plugin",
"sdk"
]
}