@stone-js/resources
v0.8.15
Published
Framework-agnostic API resources for Stone.js. Shape what your domain exposes — sparse fieldsets, conditional fields, includes and envelopes — decoupled from controllers, the same on backend and frontend.
Downloads
1,897
Maintainers
Readme
Stone.js · Resources
Framework-agnostic API resources for Stone.js. Shape what your domain exposes — sparse fieldsets, conditional fields, includes and envelopes — decoupled from controllers, the same on backend and frontend.
Part of Stone.js, the reference implementation of the Continuum Architecture: write your domain once, and the context (runtime, protocol, caller) applies to it at run time.
Install
npm i @stone-js/resourcesUsage
import { defineResource, only } from '@stone-js/resources'
// Shape what your domain exposes: hide internals, support sparse fieldsets.
export const TaskResource = defineResource((task) => ({
id: task.id,
title: task.title,
createdAt: task.createdAt
}))
// only(...) / except(...) drive sparse fieldsets from the request.Documentation
Full documentation: stonejs.dev/docs/extensions/resources.
License
MIT © Evens Pierre ("Mr. Stone") and the Stone.js contributors.
