Repository navigation
Releases
v1.6.0
What's changed
Check whether a translation exists
I18nService has a new has(key, locale?) method. It tells you whether t() would find a translation for the key, in the requested locale or in the fallback locale, instead of returning the key itself. Use it when a message is optional and you want to fall back to another one:
const pendingKey = `bouncer.steps.${step.name}.pending`;
const message = this.i18n.has(pendingKey) ? this.i18n.t(pendingKey) : this.i18n.t("bouncer.checking");Warnings for missing translations
When t() finds no translation for a key in any locale, it still returns the key itself, but it now also logs a warning:
Missing translation "bouncer.steps.queue.pending" for locale "pl", showing the key instead
The warning is logged once per key and locale, so it doesn't flood the console. has() never triggers it, as checking whether a translation exists isn't an error. A key that is missing only in the requested locale but present in the fallback locale isn't reported either, since t() still finds a translation for it.
Full Changelog: https://github.com/bytium-labs/bytium-core/commits/v1.6.0
v1.5.0
What's changed
Unified handler source
@Source() now always gives you a string. FiveM reports the source as a number for players and the server console, but as a string when no player is behind the invocation, so the same parameter used to change type depending on what triggered the handler. bytium-core now converts every source to a string without changing its value:
| Triggered by | @Source() |
@RawSource() |
|---|---|---|
| a player | "12" |
12 |
| the server console | "0" |
0 |
a plain emit from any resource, FiveM for GTA V Enhanced |
"script" |
"script" |
a plain emit from any resource, other FiveM builds |
"" |
"" |
@Command("kick")
kick(@Source() source: string) {
if (Number(source) > 0) {
DropPlayer(source, "Kicked");
}
}The string form fits the player natives directly, as they all take the source as a string.
New @RawSource()
The new @RawSource() parameter decorator gives you the source exactly as FiveM provided it, for the rare case where you need the original value. It is available wherever @Source() is.
Other changes
- The server-side
@OnEventcontext type now includessource. - Correlation logs now include every source as a string, including
"script". Before, they dropped any source that wasn't a numb EventBusService.emitNet()andinvokeNetCallback()take the target as a string. Use"-1"to reach every player.
Breaking change
@Source() used to return a number for players and the console. Code that compares it with === against numbers (source === 0) or keys maps by numeric sources must switch to strings or use Number(source). Code that only logs the source or passes it to natives keeps working unchanged.
Full Changelog: https://github.com/bytium-labs/bytium-core/commits/v1.5.0
v1.4.0
What's changed
Version requirements for external resources
Resources can now declare which versions of an external resource they work with, the same way you pin dependencies in package.json:
@BytiumResource({
modules: [ShopsModule],
imports: [{ name: "ext-inventory", version: "^1.3.0" }],
})
class ShopsResource {}On startup bytium-core checks the range against the version in the external resource's fxmanifest.lua:
- Version outside the range: the resource refuses to start and the error names the required range and the running version.
- No
versionin the fxmanifest (or an unreadable one): a warning is logged and the resource starts. - Unsupported range syntax: startup fails during validation, before anything is resolved.
Supported ranges are an exact version (1.3.0), ^1.3.0, ~1.3.0, >=1.3.0 and wildcards (1.x, 1.3.x, x). Plain string imports keep working and mean no version requirement, so existing resources need no changes.
Full Changelog: https://github.com/bytium-labs/bytium-core/commits/v1.4.0
v1.3.0
What's changed
-
feat(common): open invocation context - InvocationContext.current()/assign()/scoped() facade with flow-wide and per-line buckets, reserved and boundary bucket names, framework transport fields renamed to __bytiumMetadata/__bytiumHandlerArgs
-
feat(common): boundary log lines - every handler invocation logs an INFO entry line (Executing @Command/@OnEvent/@Cron/@Callback/@transferable...) and returning boundaries add a -> done|error (Xms) line with a response bucket; @tick and @OnConsoleOutput excluded
-
feat(common): handler args logging - bytium-core:logHandlerArgs convar (OFF/ERRORS/ALL), args captured post-pipes as a masked snapshot (mask-before-cap, class-instance placeholders, 1 kB cap), @sensitive() param decorator and sensitive(schema, paths) wrapper with typed schema paths
-
feat(common): error decomposition in JSON logs - stack moves inside error (breaking vs 1.2.0 log shape), own error fields and the cause chain are serialized, ValidationPipe scrubs received values in logged errors while the 400 response stays complete
-
feat(http): request logging - bytium-core:logHttpRequests convar (LEAN/META/FULL) with logHttpMaskHeaders/logHttpMaskKeys, RequestLogBuilder masks headers, keys, query, url and body (schema + @sensitive + operator lists), parses urlencoded, placeholders binaries, omits empty bodies; 4xx logged at INFO
-
feat(common): local @callback correlation - invokeCallback appends the correlation envelope so server-to-server callback handlers inherit the invoking flow's correlationId; net callbacks still mint a fresh id (client envelope is untrusted)
-
feat(common,http): logBoundaryExclude convar - comma-separated boundary types whose happy-path lines are suppressed per scope (global or per resource); error lines always remain; the manager is type-opaque so common stays HTTP-agnostic
-
refactor(common,http,http-multipart): machines out of utils - HandlerArgsSerializer, CronExpressionParser + CronSchedule (cron.utils split), ErrorSerializer and SerializedErrorInterface moved to core, MultipartParser replaces the public parseMultipart export (breaking), correlation envelope moved to invocation, duplicated tokenName deduped into getTokenName
-
refactor(common): TransferableMarshaler moved to core/marshalers with the instanceOfTransferable guard exported from the decorator
-
refactor(test): typed jest.spyOn(globalThis, ...) native mocking everywhere (no global casts), SetHttpHandler defined in the testing jest setup, http-multipart typed with @citizenfx/server, internal subpath jest mappers for shared and invocation
Full Changelog: https://github.com/bytium-labs/bytium-core/commits/v1.3.0
v1.2.0
What's changed
- feat(common): error cause chaining - BytiumException accepts ErrorOptions, the cause renders in pretty (Caused by:) and JSON (error.cause + chained stack) logs and in devMode serialization, but never crosses a resource boundary in production
Full Changelog: https://github.com/bytium-labs/bytium-core/commits/v1.2.0
v1.1.0
What's changed
-
feat(common): @transferable cross-resource error marshaling
-
feat(logger): logFormat convar (PRETTY/JSON) with structured error fields
-
feat(common): correlationId invocation context (ALS) propagated through the event bus and Transferable calls
-
fix(common): Transferable proxy hardening (accessors, method identity, non-Transferable exports)
Full Changelog: https://github.com/bytium-labs/bytium-core/commits/v1.1.0