@owlmeans/static-resource
v0.1.8
Published
In-memory `Resource<T>` backed by static config data — for read-only data loaded at startup.
Readme
@owlmeans/static-resource
In-memory Resource<T> backed by static config data — for read-only data loaded at startup.
Overview
createStaticResource(alias?, key?)— creates an in-memory resource populated from configappendStaticResource(ctx, alias?, key?)— registers it in the context with agetStaticResourceaccessorStaticResourceAppend— mixin type addinggetStaticResource<T>(alias?)to context- Useful for config-driven lookup tables (e.g., product catalogs, permission sets)
Installation
bun add @owlmeans/static-resourceUsage
import { appendStaticResource } from '@owlmeans/static-resource'
import type { StaticResourceAppend } from '@owlmeans/static-resource'
appendStaticResource<C, T>(context, 'products')
// Access from context
const resource = context.getStaticResource<Product>('products')
const product = await resource.load('product-sku')API
createStaticResource(alias?, key?): Resource<ResourceRecord>
Creates an in-memory resource. key is the config path where data is loaded from.
appendStaticResource<C, T>(ctx, alias?, key?): T & StaticResourceAppend
Registers the static resource and adds getStaticResource to the context.
StaticResourceAppend
Mixin interface: getStaticResource<T>(alias?): Resource<T>
DEFAULT_ALIAS
'static' — default resource alias.
Related Packages
@owlmeans/resource—Resource<T>interface implemented here
Agent guidance
This package ships embedded Claude Code skills and GitHub Copilot instructions under
agent-meta/. After installing your @owlmeans/* packages, run the OwlMeans
agent-skills installer to place them into your project's native locations
(.claude/skills/ and .github/instructions/):
npx @owlmeans/agent-skillsThe embedded files are version-matched to this package release. Do not edit them directly — they are regenerated on each publish. To contribute guidance edits, open a PR against the source monorepo.
