샘플
undici-types 7.18.2
검증된 샘플 — npm undici-types 7.18.2. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: undici-types package.json declares type definitions entry point…
sha256:2c7f87f11a86804b242228352661fed99013c9af857ca0c2804fe138f6a2b6ea
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-23 |
케이스
HOW- 목표
- verify pkg:npm/undici-types@7.18.2
- 생성일
- 2026-08-23T13:31:51Z
컨트랙트
- undici-types package.json declares type definitions entry point index.d.ts and version 7.18.2
- undici-types index.d.ts exports Dispatcher, Client, Pool, Agent, fetch, and Undici namespace
- undici-types dispatcher.d.ts declares Dispatcher class with dispatch, request, stream, pipeline, connect, upgrade, close, and destroy methods
- undici-types client.d.ts, pool.d.ts, and agent.d.ts declare Client, Pool, and Agent classes extending Dispatcher
- undici-types fetch.d.ts declares fetch function, Headers, Request, and Response types
- undici-types errors.d.ts declares UndiciError and error hierarchy
- undici-types cache-interceptor.d.ts declares MemoryCacheStore and SqliteCacheStore classes
파일
- 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 pkg:npm/undici-types@7.18.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/undici-types@7.18.2
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:e1424fb6f33c2cca0f5ab8a279b58405f2361668577adbf090b411f271747f6e","contract":["undici-types package.json declares type definitions entry point index.d.ts and version 7.18.2","undici-types index.d.ts exports Dispatcher, Client, Pool, Agent, fetch, and Undici namespace","undici-types dispatcher.d.ts declares Dispatcher class with dispatch, request, stream, pipeline, connect, upgrade, close, and destroy methods","undici-types client.d.ts, pool.d.ts, and agent.d.ts declare Client, Pool, and Agent classes extending Dispatcher","undici-types fetch.d.ts declares fetch function, Headers, Request, and Response types","undici-types errors.d.ts declares UndiciError and error hierarchy","undici-types cache-interceptor.d.ts declares MemoryCacheStore and SqliteCacheStore classes"],"goal":"verify pkg:npm/undici-types@7.18.2","kind":"HOW","packages":["pkg:npm/undici-types@7.18.2"],"schemaVersion":1},"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@7.18.2"],"schemaVersion":1,"subject":"pkg:npm/undici-types@7.18.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-undici-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-undici-types",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"undici-types": "7.18.2"
}
},
"node_modules/undici-types": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"license": "MIT"
}
}
}
{
"name": "sample-undici-types",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for undici-types",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"undici-types": "7.18.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/undici-types@7.18.2",
"kind": "HOW",
"packages": [
"pkg:npm/undici-types@7.18.2"
]
}
const fs = require('node:fs');
const path = require('node:path');
/**
* Resolves the path to the undici-types package or a declaration file within it.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} Absolute path to the declaration file
*/
function getDeclarationPath(subPath = 'index.d.ts') {
const pkgJsonPath = require.resolve('undici-types/package.json');
const pkgDir = path.dirname(pkgJsonPath);
return path.join(pkgDir, subPath);
}
/**
* Loads the text content of a declaration file from undici-types.
* @param {string} [subPath='index.d.ts'] - Relative declaration file path
* @returns {string} The text content of the declaration file
*/
function loadDeclarationContent(subPath = 'index.d.ts') {
const declPath = getDeclarationPath(subPath);
return fs.readFileSync(declPath, 'utf8');
}
/**
* Validates that the undici-types declaration files define expected TypeScript constructs and signatures.
* @returns {object} Summary of discovered type definitions
*/
function inspectTypeDefinitions() {
const indexContent = loadDeclarationContent('index.d.ts');
const dispatcherContent = loadDeclarationContent('dispatcher.d.ts');
const clientContent = loadDeclarationContent('client.d.ts');
const poolContent = loadDeclarationContent('pool.d.ts');
const fetchContent = loadDeclarationContent('fetch.d.ts');
const errorsContent = loadDeclarationContent('errors.d.ts');
const agentContent = loadDeclarationContent('agent.d.ts');
const cacheInterceptorContent = loadDeclarationContent('cache-interceptor.d.ts');
return {
indexHasDefaultExport: indexContent.includes('export default Undici'),
indexHasNamespace: indexContent.includes('declare namespace Undici'),
indexHasDispatcherExport: indexContent.includes('Dispatcher'),
indexHasClientExport: indexContent.includes('Client'),
indexHasPoolExport: indexContent.includes('Pool'),
indexHasAgentExport: indexContent.includes('Agent'),
dispatcherHasClass: dispatcherContent.includes('declare class Dispatcher extends EventEmitter'),
dispatcherHasDispatch: dispatcherContent.includes('dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean'),
dispatcherHasRequest: dispatcherContent.includes('request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>'),
dispatcherHasClose: dispatcherContent.includes('close (): Promise<void>'),
dispatcherHasDestroy: dispatcherContent.includes('destroy (): Promise<void>'),
clientExtendsDispatcher: clientContent.includes('class Client extends Dispatcher'),
poolExtendsDispatcher: poolContent.includes('class Pool extends Dispatcher'),
agentExtendsDispatcher: agentContent.includes('class Agent extends Dispatcher'),
fetchHasFunction: fetchContent.includes('export declare function fetch ('),
fetchHasHeaders: fetchContent.includes('export declare class Headers'),
fetchHasRequest: fetchContent.includes('export declare class Request extends BodyMixin'),
fetchHasResponse: fetchContent.includes('export declare class Response extends BodyMixin'),
errorsHasUndiciError: errorsContent.includes('class UndiciError extends Error'),
cacheInterceptorHasStores: cacheInterceptorContent.includes('class MemoryCacheStore') && cacheInterceptorContent.includes('class SqliteCacheStore')
};
}
module.exports = {
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
};
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const {
getDeclarationPath,
loadDeclarationContent,
inspectTypeDefinitions
} = require('../src/index.js');
// 1. Verify package manifest exports and metadata
const pkgJson = require('undici-types/package.json');
assert.strictEqual(pkgJson.name, 'undici-types', 'package name should match undici-types');
assert.strictEqual(pkgJson.version, '7.18.2', 'package version should match 7.18.2');
assert.strictEqual(pkgJson.types, 'index.d.ts', 'package types entry should point to index.d.ts');
// 2. Verify declaration files existence
const indexDeclPath = getDeclarationPath('index.d.ts');
assert.strictEqual(fs.existsSync(indexDeclPath), true, 'index.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('dispatcher.d.ts')), true, 'dispatcher.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('client.d.ts')), true, 'client.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('pool.d.ts')), true, 'pool.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('agent.d.ts')), true, 'agent.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('fetch.d.ts')), true, 'fetch.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('errors.d.ts')), true, 'errors.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('cache-interceptor.d.ts')), true, 'cache-interceptor.d.ts should exist on disk');
assert.strictEqual(fs.existsSync(getDeclarationPath('global-dispatcher.d.ts')), true, 'global-dispatcher.d.ts should exist on disk');
// 3. Verify index.d.ts structure and exports
const indexContent = loadDeclarationContent('index.d.ts');
assert.strictEqual(typeof indexContent, 'string', 'index.d.ts content should be a string');
assert.strictEqual(indexContent.includes('export default Undici'), true, 'index.d.ts should have default export Undici');
assert.strictEqual(indexContent.includes('declare namespace Undici'), true, 'index.d.ts should declare namespace Undici');
assert.strictEqual(indexContent.includes('export * from \'./fetch\''), true, 'index.d.ts should re-export fetch');
assert.strictEqual(indexContent.includes('export * from \'./cookies\''), true, 'index.d.ts should re-export cookies');
assert.strictEqual(indexContent.includes('export * from \'./formdata\''), true, 'index.d.ts should re-export formdata');
assert.strictEqual(indexContent.includes('export * from \'./websocket\''), true, 'index.d.ts should re-export websocket');
// 4. Verify dispatcher.d.ts declarations
const dispatcherContent = loadDeclarationContent('dispatcher.d.ts');
assert.strictEqual(dispatcherContent.includes('declare class Dispatcher extends EventEmitter'), true, 'Dispatcher must extend EventEmitter');
assert.strictEqual(dispatcherContent.includes('dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean'), true, 'Dispatcher must declare dispatch');
assert.strictEqual(dispatcherContent.includes('request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>'), true, 'Dispatcher must declare request');
assert.strictEqual(dispatcherContent.includes('connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>'), true, 'Dispatcher must declare connect');
assert.strictEqual(dispatcherContent.includes('pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex'), true, 'Dispatcher must declare pipeline');
assert.strictEqual(dispatcherContent.includes('stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>'), true, 'Dispatcher must declare stream');
assert.strictEqual(dispatcherContent.includes('upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>'), true, 'Dispatcher must declare upgrade');
assert.strictEqual(dispatcherContent.includes('close (): Promise<void>'), true, 'Dispatcher must declare close');
assert.strictEqual(dispatcherContent.includes('destroy (): Promise<void>'), true, 'Dispatcher must declare destroy');
// 5. Verify client, pool, and agent declarations extending Dispatcher
const clientContent = loadDeclarationContent('client.d.ts');
assert.strictEqual(clientContent.includes('class Client extends Dispatcher'), true, 'Client must extend Dispatcher');
const poolContent = loadDeclarationContent('pool.d.ts');
assert.strictEqual(poolContent.includes('class Pool extends Dispatcher'), true, 'Pool must extend Dispatcher');
const agentContent = loadDeclarationContent('agent.d.ts');
assert.strictEqual(agentContent.includes('class Agent extends Dispatcher'), true, 'Agent must extend Dispatcher');
// 6. Verify fetch.d.ts declarations
const fetchContent = loadDeclarationContent('fetch.d.ts');
assert.strictEqual(fetchContent.includes('export declare function fetch ('), true, 'fetch.d.ts must declare fetch function');
assert.strictEqual(fetchContent.includes('export declare class Headers'), true, 'fetch.d.ts must declare Headers class');
assert.strictEqual(fetchContent.includes('export declare class Request extends BodyMixin'), true, 'fetch.d.ts must declare Request class');
assert.strictEqual(fetchContent.includes('export declare class Response extends BodyMixin'), true, 'fetch.d.ts must declare Response class');
// 7. Verify errors.d.ts declarations
const errorsContent = loadDeclarationContent('errors.d.ts');
assert.strictEqual(errorsContent.includes('declare namespace Errors'), true, 'errors.d.ts must declare Errors namespace');
assert.strictEqual(errorsContent.includes('export class UndiciError extends Error'), true, 'errors.d.ts must declare UndiciError');
assert.strictEqual(errorsContent.includes('export class ConnectTimeoutError extends UndiciError'), true, 'errors.d.ts must declare ConnectTimeoutError');
assert.strictEqual(errorsContent.includes('export class HeadersTimeoutError extends UndiciError'), true, 'errors.d.ts must declare HeadersTimeoutError');
assert.strictEqual(errorsContent.includes('export class BodyTimeoutError extends UndiciError'), true, 'errors.d.ts must declare BodyTimeoutError');
assert.strictEqual(errorsContent.includes('export class InvalidArgumentError extends UndiciError'), true, 'errors.d.ts must declare InvalidArgumentError');
assert.strictEqual(errorsContent.includes('export class RequestAbortedError extends UndiciError'), true, 'errors.d.ts must declare RequestAbortedError');
// 8. Verify cache-interceptor.d.ts declarations
const cacheInterceptorContent = loadDeclarationContent('cache-interceptor.d.ts');
assert.strictEqual(cacheInterceptorContent.includes('export interface CacheStore'), true, 'cache-interceptor.d.ts must declare CacheStore');
assert.strictEqual(cacheInterceptorContent.includes('export class MemoryCacheStore implements CacheStore'), true, 'cache-interceptor.d.ts must declare MemoryCacheStore');
assert.strictEqual(cacheInterceptorContent.includes('export class SqliteCacheStore implements CacheStore'), true, 'cache-interceptor.d.ts must declare SqliteCacheStore');
// 9. Verify helper inspection module
const inspection = inspectTypeDefinitions();
assert.strictEqual(inspection.indexHasDefaultExport, true, 'inspection should confirm default export');
assert.strictEqual(inspection.indexHasNamespace, true, 'inspection should confirm namespace');
assert.strictEqual(inspection.indexHasDispatcherExport, true, 'inspection should confirm Dispatcher export');
assert.strictEqual(inspection.indexHasClientExport, true, 'inspection should confirm Client export');
assert.strictEqual(inspection.indexHasPoolExport, true, 'inspection should confirm Pool export');
assert.strictEqual(inspection.indexHasAgentExport, true, 'inspection should confirm Agent export');
assert.strictEqual(inspection.dispatcherHasClass, true, 'inspection should confirm Dispatcher class');
assert.strictEqual(inspection.dispatcherHasDispatch, true, 'inspection should confirm dispatch method');
assert.strictEqual(inspection.dispatcherHasRequest, true, 'inspection should confirm request method');
assert.strictEqual(inspection.dispatcherHasClose, true, 'inspection should confirm close method');
assert.strictEqual(inspection.dispatcherHasDestroy, true, 'inspection should confirm destroy method');
assert.strictEqual(inspection.clientExtendsDispatcher, true, 'inspection should confirm Client extends Dispatcher');
assert.strictEqual(inspection.poolExtendsDispatcher, true, 'inspection should confirm Pool extends Dispatcher');
assert.strictEqual(inspection.agentExtendsDispatcher, true, 'inspection should confirm Agent extends Dispatcher');
assert.strictEqual(inspection.fetchHasFunction, true, 'inspection should confirm fetch function');
assert.strictEqual(inspection.fetchHasHeaders, true, 'inspection should confirm Headers class');
assert.strictEqual(inspection.fetchHasRequest, true, 'inspection should confirm Request class');
assert.strictEqual(inspection.fetchHasResponse, true, 'inspection should confirm Response class');
assert.strictEqual(inspection.errorsHasUndiciError, true, 'inspection should confirm UndiciError');
assert.strictEqual(inspection.cacheInterceptorHasStores, true, 'inspection should confirm CacheStore implementations');
console.log('Contract tests passed successfully.');
오리진 시더
익명