Пример
undici-types 8.3.0: version
Проверенный пример — npm undici-types 8.3.0: version. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден: undici-types package.json declares…
sha256:c774bbcf46f4af3f73fec6bf351d76ecb7099991f0a35354470869b243249fa4
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux 24 · ubuntu · glibc 2.39 x64 npm
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| 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-27 |
Кейс
HOW- Цель
- verify undici-types.version in pkg:npm/undici-types@8.3.0
- Пакеты
- Символы
-
- undici-types.version
- Создан
- 2026-08-27T11:30:38Z
Контракт
- undici-types package.json declares name undici-types and version 8.3.0
- undici-types package.json specifies types entry point index.d.ts
- undici-types package.json specifies files pattern including *.d.ts
- undici-types index.d.ts declares default export Undici and namespace Undici
- undici-types index.d.ts exports client and agent types Dispatcher, Pool, BalancedPool, RoundRobinPool, Client, Agent, and H2CClient
- undici-types index.d.ts exports request helpers and connection functions request, stream, pipeline, connect, upgrade, and buildConnector
- undici-types index.d.ts exports global dispatcher management functions setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, and getGlobalOrigin
- undici-types index.d.ts exports global installation function install
- undici-types declaration files exist on disk for all core modules including dispatcher, client, pool, agent, fetch, errors, cache, cookies, formdata, eventsource, websocket, and diagnostics-channel
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Исходный код
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 undici-types.version in pkg:npm/undici-types@8.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/undici-types@8.3.0
Demonstrate these symbols/APIs:
- undici-types.version
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:7bc0423f37279d02616b935b957832ec2b8443df7f2a79e06f42a74388d24493","contract":["undici-types package.json declares name undici-types and version 8.3.0","undici-types package.json specifies types entry point index.d.ts","undici-types package.json specifies files pattern including *.d.ts","undici-types index.d.ts declares default export Undici and namespace Undici","undici-types index.d.ts exports client and agent types Dispatcher, Pool, BalancedPool, RoundRobinPool, Client, Agent, and H2CClient","undici-types index.d.ts exports request helpers and connection functions request, stream, pipeline, connect, upgrade, and buildConnector","undici-types index.d.ts exports global dispatcher management functions setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, and getGlobalOrigin","undici-types index.d.ts exports global installation function install","undici-types declaration files exist on disk for all core modules including dispatcher, client, pool, agent, fetch, errors, cache, cookies, formdata, eventsource, websocket, and diagnostics-channel"],"goal":"verify undici-types.version in pkg:npm/undici-types@8.3.0","kind":"HOW","packages":["pkg:npm/undici-types@8.3.0"],"schemaVersion":1,"symbols":["undici-types.version"]},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/undici-types@8.3.0"],"schemaVersion":1,"subject":"pkg:npm/undici-types@8.3.0","symbols":["undici-types.version"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-undici-types-version",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-undici-types-version",
"version": "1.0.0",
"license": "MIT-0",
"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-undici-types-version",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for undici-types.version",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"undici-types": "8.3.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify undici-types.version in pkg:npm/undici-types@8.3.0",
"kind": "HOW",
"packages": [
"pkg:npm/undici-types@8.3.0"
],
"symbols": [
"undici-types.version"
]
}
const fs = require('node:fs');
const path = require('node:path');
/**
* Returns package metadata from undici-types package.json.
* @returns {object} The parsed package.json object
*/
function getPackageMetadata() {
const pkgJsonPath = require.resolve('undici-types/package.json');
const raw = fs.readFileSync(pkgJsonPath, 'utf8');
return JSON.parse(raw);
}
/**
* Resolves the absolute path to a file inside the undici-types package.
* @param {string} [subPath='index.d.ts'] - Relative path within undici-types
* @returns {string} Absolute file path
*/
function resolvePackagePath(subPath = 'index.d.ts') {
const pkgJsonPath = require.resolve('undici-types/package.json');
const pkgDir = path.dirname(pkgJsonPath);
return path.join(pkgDir, subPath);
}
/**
* Reads the text content of a declaration file from undici-types.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} Text content of the declaration file
*/
function readDeclarationFile(subPath = 'index.d.ts') {
const filePath = resolvePackagePath(subPath);
return fs.readFileSync(filePath, 'utf8');
}
/**
* Verifies version metadata and core exports from undici-types.
* @returns {object} Validation summary
*/
function verifyPackageVersionAndExports() {
const pkg = getPackageMetadata();
const indexContent = readDeclarationFile('index.d.ts');
return {
packageName: pkg.name,
packageVersion: pkg.version,
typesEntry: pkg.types,
filesPattern: pkg.files,
hasDefaultExport: indexContent.includes('export default Undici'),
hasNamespace: indexContent.includes('declare namespace Undici'),
hasInstallExport: indexContent.includes('globalThisInstall as install'),
hasDispatcher: indexContent.includes('Dispatcher'),
hasClient: indexContent.includes('Client'),
hasPool: indexContent.includes('Pool'),
hasBalancedPool: indexContent.includes('BalancedPool'),
hasRoundRobinPool: indexContent.includes('RoundRobinPool'),
hasAgent: indexContent.includes('Agent'),
hasH2CClient: indexContent.includes('H2CClient'),
hasRequest: indexContent.includes('request'),
hasStream: indexContent.includes('stream'),
hasPipeline: indexContent.includes('pipeline'),
hasConnect: indexContent.includes('connect'),
hasUpgrade: indexContent.includes('upgrade'),
hasSetGlobalDispatcher: indexContent.includes('setGlobalDispatcher'),
hasGetGlobalDispatcher: indexContent.includes('getGlobalDispatcher'),
hasSetGlobalOrigin: indexContent.includes('setGlobalOrigin'),
hasGetGlobalOrigin: indexContent.includes('getGlobalOrigin')
};
}
module.exports = {
getPackageMetadata,
resolvePackagePath,
readDeclarationFile,
verifyPackageVersionAndExports
};
const assert = require('node:assert');
const fs = require('node:fs');
const {
getPackageMetadata,
resolvePackagePath,
readDeclarationFile,
verifyPackageVersionAndExports
} = require('../src/index.js');
// 1. Verify undici-types package.json declares name "undici-types" and version "8.3.0"
const pkg = getPackageMetadata();
assert.strictEqual(pkg.name, 'undici-types', 'Package name must be undici-types');
assert.strictEqual(pkg.version, '8.3.0', 'Package version must be 8.3.0');
// 2. Verify undici-types package.json specifies types entry point index.d.ts
assert.strictEqual(pkg.types, 'index.d.ts', 'Types entry point must be index.d.ts');
// 3. Verify undici-types package.json specifies files pattern including *.d.ts
assert.ok(Array.isArray(pkg.files), 'files must be an array');
assert.ok(pkg.files.includes('*.d.ts'), 'files must include *.d.ts pattern');
// 4. Verify undici-types index.d.ts declares default export Undici and namespace Undici
const indexContent = readDeclarationFile('index.d.ts');
assert.strictEqual(indexContent.includes('export default Undici'), true, 'index.d.ts must export default Undici');
assert.strictEqual(indexContent.includes('declare namespace Undici'), true, 'index.d.ts must declare namespace Undici');
// 5. Verify undici-types index.d.ts exports client and agent types Dispatcher, Pool, BalancedPool, RoundRobinPool, Client, Agent, and H2CClient
assert.strictEqual(indexContent.includes('Dispatcher,'), true, 'index.d.ts must export Dispatcher');
assert.strictEqual(indexContent.includes('Pool,'), true, 'index.d.ts must export Pool');
assert.strictEqual(indexContent.includes('BalancedPool,'), true, 'index.d.ts must export BalancedPool');
assert.strictEqual(indexContent.includes('RoundRobinPool,'), true, 'index.d.ts must export RoundRobinPool');
assert.strictEqual(indexContent.includes('Client,'), true, 'index.d.ts must export Client');
assert.strictEqual(indexContent.includes('Agent,'), true, 'index.d.ts must export Agent');
assert.strictEqual(indexContent.includes('H2CClient,'), true, 'index.d.ts must export H2CClient');
// 6. Verify undici-types index.d.ts exports request helpers and connection functions request, stream, pipeline, connect, upgrade, and buildConnector
assert.strictEqual(indexContent.includes('request,'), true, 'index.d.ts must export request');
assert.strictEqual(indexContent.includes('stream,'), true, 'index.d.ts must export stream');
assert.strictEqual(indexContent.includes('pipeline,'), true, 'index.d.ts must export pipeline');
assert.strictEqual(indexContent.includes('connect,'), true, 'index.d.ts must export connect');
assert.strictEqual(indexContent.includes('upgrade,'), true, 'index.d.ts must export upgrade');
assert.strictEqual(indexContent.includes('buildConnector,'), true, 'index.d.ts must export buildConnector');
// 7. Verify undici-types index.d.ts exports global dispatcher management functions setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, and getGlobalOrigin
assert.strictEqual(indexContent.includes('setGlobalDispatcher,'), true, 'index.d.ts must export setGlobalDispatcher');
assert.strictEqual(indexContent.includes('getGlobalDispatcher,'), true, 'index.d.ts must export getGlobalDispatcher');
assert.strictEqual(indexContent.includes('setGlobalOrigin,'), true, 'index.d.ts must export setGlobalOrigin');
assert.strictEqual(indexContent.includes('getGlobalOrigin,'), true, 'index.d.ts must export getGlobalOrigin');
// 8. Verify undici-types index.d.ts exports global installation function install
assert.strictEqual(indexContent.includes('globalThisInstall as install'), true, 'index.d.ts must export install function');
// 9. Verify undici-types declaration files exist on disk for all core modules
const expectedDeclarationFiles = [
'index.d.ts',
'dispatcher.d.ts',
'client.d.ts',
'pool.d.ts',
'balanced-pool.d.ts',
'round-robin-pool.d.ts',
'agent.d.ts',
'h2c-client.d.ts',
'api.d.ts',
'connector.d.ts',
'errors.d.ts',
'fetch.d.ts',
'formdata.d.ts',
'cookies.d.ts',
'eventsource.d.ts',
'websocket.d.ts',
'cache.d.ts',
'cache-interceptor.d.ts',
'diagnostics-channel.d.ts',
'global-dispatcher.d.ts',
'global-origin.d.ts',
'mock-agent.d.ts',
'mock-client.d.ts',
'mock-pool.d.ts',
'proxy-agent.d.ts',
'socks5-proxy-agent.d.ts',
'env-http-proxy-agent.d.ts',
'retry-agent.d.ts',
'retry-handler.d.ts',
'snapshot-agent.d.ts'
];
for (const declFile of expectedDeclarationFiles) {
const fullPath = resolvePackagePath(declFile);
assert.strictEqual(fs.existsSync(fullPath), true, `Declaration file ${declFile} must exist`);
}
// 10. Verify helper validation summary
const summary = verifyPackageVersionAndExports();
assert.strictEqual(summary.packageName, 'undici-types');
assert.strictEqual(summary.packageVersion, '8.3.0');
assert.strictEqual(summary.typesEntry, 'index.d.ts');
assert.strictEqual(summary.hasDefaultExport, true);
assert.strictEqual(summary.hasNamespace, true);
assert.strictEqual(summary.hasInstallExport, true);
assert.strictEqual(summary.hasDispatcher, true);
assert.strictEqual(summary.hasClient, true);
assert.strictEqual(summary.hasPool, true);
assert.strictEqual(summary.hasAgent, true);
assert.strictEqual(summary.hasRequest, true);
assert.strictEqual(summary.hasStream, true);
assert.strictEqual(summary.hasPipeline, true);
assert.strictEqual(summary.hasConnect, true);
assert.strictEqual(summary.hasUpgrade, true);
assert.strictEqual(summary.hasSetGlobalDispatcher, true);
assert.strictEqual(summary.hasGetGlobalDispatcher, true);
assert.strictEqual(summary.hasSetGlobalOrigin, true);
assert.strictEqual(summary.hasGetGlobalOrigin, true);
console.log('All undici-types.version contract checks passed successfully.');
Исходный сидер
аноним