Пример
@types/keyv 3.1.4
Проверенный пример — npm @types/keyv 3.1.4. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден: package manifest specifies index.d.ts type…
sha256:9ad15e70509f001eeb32e62afa47cd985f267fd7d90980fa22eec56f6242d5db
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
Кейс
HOW- Цель
- verify pkg:npm/%40types/keyv@3.1.4
- Пакеты
- Окружение
- node 22.23.2
- Создан
- 2026-08-23T13:55:42Z
Контракт
- package manifest specifies index.d.ts type declarations and TypeScript version
- declares Keyv class extending EventEmitter with generic value and options types
- declares get, set, delete, and clear core storage methods on Keyv class
- declares Keyv namespace with Options, DeserializedData, and Store interfaces
- exports Keyv as CommonJS module declaration
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Исходный код
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/%40types/keyv@3.1.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/keyv@3.1.4
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:b7e61aeeb0153d29e43bd9c67916926eaa62b33fc5582f328feea54652c38f8b","contract":["package manifest specifies index.d.ts type declarations and TypeScript version","declares Keyv class extending EventEmitter with generic value and options types","declares get, set, delete, and clear core storage methods on Keyv class","declares Keyv namespace with Options, DeserializedData, and Store interfaces","exports Keyv as CommonJS module declaration"],"goal":"verify pkg:npm/%40types/keyv@3.1.4","kind":"HOW","packages":["pkg:npm/%40types/keyv@3.1.4"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40types/keyv@3.1.4"],"schemaVersion":1,"subject":"pkg:npm/%40types/keyv@3.1.4","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-keyv",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-keyv",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/keyv": "3.1.4"
}
},
"node_modules/@types/keyv": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz",
"integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "26.2.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz",
"integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==",
"license": "MIT",
"dependencies": {
"undici-types": "~8.3.0"
}
},
"node_modules/undici-types": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
"integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
"license": "MIT"
}
}
}
{
"name": "sample-types-keyv",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/keyv": "3.1.4"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40types/keyv@3.1.4",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/keyv@3.1.4"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Resolve @types/keyv package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/keyv/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/keyv', 'Package name must be @types/keyv');
assert.equal(pkg.version, '3.1.4', 'Package version must be 3.1.4');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '3.9', 'TypeScript version must be 3.9');
const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify Keyv class, inheritance, options, and constructor declarations
assert.ok(
dtsContent.includes("declare class Keyv<TValue = any, TOpts extends { [key: string]: any } = {}> extends EventEmitter"),
'Keyv class must be declared extending EventEmitter with generic parameters'
);
assert.ok(
dtsContent.includes("opts: WithRequiredProperties<") &&
dtsContent.includes("'deserialize' | 'namespace' | 'serialize' | 'store' | 'uri'") &&
dtsContent.includes("> &\n TOpts;"),
'opts property must require core properties and merge TOpts'
);
assert.ok(
dtsContent.includes("constructor(opts?: Keyv.Options<TValue> & TOpts);") &&
dtsContent.includes("constructor(uri?: string, opts?: Keyv.Options<TValue> & TOpts);"),
'constructor overloads must be declared'
);
// 3. Verify core storage methods: get, set, delete, clear
assert.ok(
dtsContent.includes("get<TRaw extends boolean = false>(key: string, options?: { raw?: TRaw }):") &&
dtsContent.includes("Promise<(TRaw extends false") &&
dtsContent.includes(": Keyv.DeserializedData<TValue>) | undefined>;"),
'get method must support raw and parsed return types'
);
assert.ok(
dtsContent.includes("set(key: string, value: TValue, ttl?: number): Promise<true>;"),
'set method must accept key, value, and ttl returning Promise<true>'
);
assert.ok(
dtsContent.includes("delete(key: string): Promise<boolean>;"),
'delete method must accept key returning Promise<boolean>'
);
assert.ok(
dtsContent.includes("clear(): Promise<void>;"),
'clear method must return Promise<void>'
);
// 4. Verify Keyv namespace interfaces: Options, DeserializedData, Store
assert.ok(
dtsContent.includes("declare namespace Keyv {") &&
dtsContent.includes("interface Options<TValue> {") &&
dtsContent.includes("namespace?: string | undefined;") &&
dtsContent.includes("serialize?: ((data: DeserializedData<TValue>) => string) | undefined;") &&
dtsContent.includes("deserialize?: ((data: string) => DeserializedData<TValue> | undefined) | undefined;") &&
dtsContent.includes("uri?: string | undefined;") &&
dtsContent.includes("store?: Store<TValue> | undefined;") &&
dtsContent.includes("ttl?: number | undefined;") &&
dtsContent.includes("adapter?: 'redis' | 'mongodb' | 'mongo' | 'sqlite' | 'postgresql' | 'postgres' | 'mysql' | undefined;"),
'Keyv.Options interface must declare all configuration properties'
);
assert.ok(
dtsContent.includes("interface DeserializedData<TValue> {") &&
dtsContent.includes("value: TValue; expires: number | null;"),
'Keyv.DeserializedData interface must declare value and expires'
);
assert.ok(
dtsContent.includes("interface Store<TValue> {") &&
dtsContent.includes("get(key: string): TValue | Promise<TValue | undefined> | undefined;") &&
dtsContent.includes("set(key: string, value: TValue, ttl?: number): any;") &&
dtsContent.includes("delete(key: string): boolean | Promise<boolean>;") &&
dtsContent.includes("clear(): void | Promise<void>;"),
'Keyv.Store interface must declare get, set, delete, and clear methods'
);
// 5. Verify CommonJS export
assert.ok(
dtsContent.includes("export = Keyv;"),
'CommonJS export = Keyv declaration must be present'
);
console.log('Contract tests passed successfully.');
Исходный сидер
аноним