feat: add bun-fullstack agent and update skills
This commit is contained in:
32
.opencode/skills/tech-stack/elysiajs/examples/rename.ts
Normal file
32
.opencode/skills/tech-stack/elysiajs/examples/rename.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Elysia, t } from 'elysia'
|
||||
|
||||
// ? Elysia#83 | Proposal: Standardized way of renaming third party plugin-scoped stuff
|
||||
// this would be a plugin provided by a third party
|
||||
const myPlugin = new Elysia()
|
||||
.decorate('myProperty', 42)
|
||||
.model('salt', t.String())
|
||||
|
||||
new Elysia()
|
||||
.use(
|
||||
myPlugin
|
||||
// map decorator, rename "myProperty" to "renamedProperty"
|
||||
.decorate(({ myProperty, ...decorators }) => ({
|
||||
renamedProperty: myProperty,
|
||||
...decorators
|
||||
}))
|
||||
// map model, rename "salt" to "pepper"
|
||||
.model(({ salt, ...models }) => ({
|
||||
...models,
|
||||
pepper: t.String()
|
||||
}))
|
||||
// Add prefix
|
||||
.prefix('decorator', 'unstable')
|
||||
)
|
||||
.get(
|
||||
'/mapped',
|
||||
({ unstableRenamedProperty }) => unstableRenamedProperty
|
||||
)
|
||||
.post('/pepper', ({ body }) => body, {
|
||||
body: 'pepper',
|
||||
// response: t.String()
|
||||
})
|
||||
Reference in New Issue
Block a user