@mockarty/types
v0.1.0
Published
TypeScript declarations for Mockarty perfengine scripts — re-exports @types/k6 and declares the 20 require-able Mockarty modules (mockarty/http, core, grpc, soap, ws, sse, kafka, rabbitmq, mcp, encoding, data, faker, sql, redis, crypto, html, metrics, exe
Maintainers
Readme
@mockarty/types
TypeScript declarations for Mockarty perfengine scripts. Gives you IDE autocomplete (VS Code, WebStorm, Vim-LSP) for both standard k6 modules and Mockarty's own extensions in a single package.
What's inside
The package is two layers:
@types/k6is a runtime dependency, so every standard k6 module (k6/http,k6/ws,k6/grpc,k6/data,k6/encoding,k6/crypto,k6/metrics,k6/html,k6/execution,k6/timers,k6/experimental/browser) keeps working under its original name. Mockarty's perfengine mapsk6/*imports to its ownmockarty/*modules at load time — your script keeps the standard k6 import paths.The 20 Mockarty perfengine modules, declared as ambient declarations under
mockarty/*. Each k6 import name maps to the matching module, so you can write either import path.| Module | Purpose | | --------------------- | -------------------------------------------------------- | |
mockarty/http| HTTP client (get/post/…/batch, JSON helpers) | |mockarty/core|check/sleep/group/fail/randomSeed| |mockarty/grpc| gRPC client driven by server reflection | |mockarty/soap| SOAP-over-HTTPcall()| |mockarty/ws| Synchronous WebSocket client | |mockarty/sse| Server-Sent Events client (buffered) | |mockarty/kafka| Kafka producer / consumer | |mockarty/rabbitmq| RabbitMQ (AMQP) publish / consume | |mockarty/mcp| MCP (Model Context Protocol) client over SSE | |mockarty/encoding| JSON + base64 helpers | |mockarty/data|SharedArray— dataset shared read-only across VUs | |mockarty/faker| Synthetic data generators | |mockarty/sql| SQL client (open/connect,query/exec) | |mockarty/redis| Synchronous Redis client ({ value, error }results) | |mockarty/crypto| Hashing + HMAC + base64 | |mockarty/html| Parse HTML, query with a jQuery-style Selection | |mockarty/metrics|Counter/Gauge/Rate/Trendconstructors | |mockarty/execution| Runtime state (instance/vu/scenario/test) | |mockarty/timers|setTimeout/setInterval(+ clear) | |mockarty/allure| Allure annotations (step,feature,severity, …) |Plus the
mockartyglobal (mockarty.version,mockarty.cliMode,mockarty.namespace) and the top-levelallurebinding.
Install
npm i --save-dev @mockarty/types// tsconfig.json
{
"compilerOptions": {
"types": ["@mockarty/types"]
}
}mockarty-cli init adds both lines for you.
Quick example
import http from "k6/http";
import { check, sleep } from "k6";
import * as faker from "mockarty/faker";
import * as Allure from "mockarty/allure";
export const options = {
scenarios: {
smoke: { executor: "constant-vus", vus: 5, duration: "30s" },
},
thresholds: { http_req_duration: ["p(95)<500"] },
};
export default function (): void {
Allure.feature("signup");
const res = http.post(
"https://api.example.com/signup",
JSON.stringify({ email: faker.email() }),
{ headers: { "Content-Type": "application/json" } },
);
check(res, {
"status is 201": (r) => r.status === 201,
});
sleep(1);
}More examples in examples/.
IDE integration
VS Code
Works out of the box once @mockarty/types is in devDependencies and
listed in tsconfig.json. No extension required.
WebStorm / IntelliJ
Same — pick up the types from the tsconfig.json. Mark
node_modules/@mockarty as a library root if hints don't show up.
Vim / Neovim / Helix (LSP)
Install typescript-language-server (npm) or tsserver. The LSP picks
up @mockarty/types from package.json automatically.
Air-gapped
@mockarty/types is also published as a .tgz tarball on
https://mockarty.ru/download/types/ for environments that can't reach
npmjs.com. Drop it into a local registry (Verdaccio, Nexus) or install
the tarball directly:
npm i --save-dev /path/to/mockarty-types-X.Y.Z.tgzmockarty-cli init --offline unpacks an embedded copy of the bundle
into your project's node_modules without touching the network.
License
MIT — same as @types/k6. See LICENSE.
The Mockarty product itself ships under the Mockarty Software License Agreement; this types-only package is intentionally MIT so it can be freely included in any TypeScript toolchain.
Versioning
The package version tracks the Mockarty platform release it targets.
X.Y.Z of @mockarty/types is the type surface for Mockarty X.Y.Z
runtime — newer releases may add modules, but the public type surface is
backward-compatible inside a major version.
See CHANGELOG.md.
Publishing
The npm publish workflow lives at
.github/workflows/types-publish.yml. It is currently a skeleton —
publishing requires the @mockarty organisation on npmjs.com and an
automation token in the NPM_PUBLISH_TOKEN GitHub secret. Owner
sets these up in a separate sysop session; see the workflow file for
the step-by-step.
