@discordkit/core
v4.0.1
Published
Core utility functions for Discordkit
Downloads
319
Readme
Runtime helpers and shared validation primitives that power @discordkit/client.
📦 Installation
@discordkit/core is installed automatically as a dependency of @discordkit/client. Install it directly when you want the composition helpers without the endpoint surface:
npm install --save-dev @discordkit/core valibot
# or
yarn add -D @discordkit/core valibotWhat's inside
- Composition helpers —
toValidated,toProcedure,toQuery. Wrap any Fetcher with runtime validation, build tRPC procedures, or produce react-query queryFns. Designed to be called at the consumer site rather than pre-wired per endpoint. - Session management —
DiscordSessionand the defaultdiscordinstance: token storage, base URL configuration, header construction, anonymous-request opt-out. - Request layer —
get/post/patch/put/remove/multipartlow-level helpers + theFetcher<S, R, C>capability-aware type used by every endpoint in@discordkit/client. - Validation primitives — schema typing helpers (
schema<T>,partialSchema,pickFields,omitFields,requiredFields,variantSchema),boundedString,boundedInteger,snowflake,timestamp,datauri,fileUpload, etc. Build your own schemas without re-deriving them. @__NO_SIDE_EFFECTS__annotations andsideEffects: false— every export is tree-shake-friendly. Consumer bundles only pay for what they actually import.
Usage
See the @discordkit/client README for the full usage walkthrough — every example there relies on @discordkit/core for the actual composition.
📣 Acknowledgements
Endpoint documentation taken from Discord's Official API docs.
🥂 License
Released under the MIT license © Drake Costa.
