@tmakit/core
v0.1.0
Published
Shared foundation for tmakit: SDK-agnostic bridge protocol types, event map and transport adapters
Maintainers
Readme
@tmakit/core
The SDK-agnostic mock engine and bridge-protocol types that power
tma-devtools and
@tmakit/testing.
Part of tmakit. Pure TypeScript, no React,
tree-shakeable. Reach for this directly only when building your own tooling — most apps
use tma-devtools / @tmakit/testing instead.
Install
npm i @tmakit/coreWhat it does
The bridge is injected (never imported), so a single mock works for an app built on any SDK sharing the Telegram protocol:
import { mockTelegramEnv, emitEvent } from '@telegram-apps/bridge'; // or @tma.js/bridge
import { createMock } from '@tmakit/core';
const mock = createMock({
bridge: { mockTelegramEnv, emitEvent },
defaults: { platform: 'ios', version: '8.0' },
});
mock.logger.subscribe((entries) => { /* live "network tab" for the bridge */ });
mock.emit('theme_changed', { theme_params: {} }); // push an event into the app
mock.requests.pending(); // stateful async flows to resolvecreateMock handles:
- Interception + logging of every outgoing
postEvent(normalizing the differingonEventsignatures of@telegram-apps/bridgeand@tma.js/bridge). - Auto-responses to instant request events (
request_theme→theme_changed, etc.). - Pending requests for stateful flows (popup, invoice, QR, clipboard, biometry) via a
RequestManager. - In-memory CloudStorage simulation, so storage works end-to-end in dev.
Also exported
isMethodSupported(method, version)+compareVersions+METHOD_MIN_VERSION— the changelog-sourced version map used for feature-gating.- Protocol types:
BridgeCall,BridgeLogEntry,MockLaunchParams,BridgePort, …
License
MIT
