サンプル
undici-types 6.21.0
検証済みサンプル — npm undici-types 6.21.0. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: package manifest specifies index.d.ts type declarations and…
sha256:a27d1695b53a6623d54a19af9146444822263b6a41c1749915ef356803fcf08b
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 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 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-08 |
ケース
HOW- ゴール
- verify pkg:npm/undici-types@6.21.0
- パッケージ
- 作成日
- 2026-08-23T07:07:41Z
コントラクト
- package manifest specifies index.d.ts type declarations and files field
- declares Dispatcher base class with dispatch, request, stream, pipeline, connect, and compose methods
- declares Client, Pool, BalancedPool, and Agent classes extending Dispatcher
- declares high-level request, stream, pipeline, connect, and upgrade API functions
- declares fetch, Headers, Request, Response, FormData, File, and FileReader web standards declarations
- declares Errors namespace with UndiciError base class and specific error subtypes
ファイル
- 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/undici-types@6.21.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/undici-types@6.21.0
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:f2720aa946c27b20cc2e60091b8dea4ed845633aebf19dd04cf1950db563d121","contract":["package manifest specifies index.d.ts type declarations and files field","declares Dispatcher base class with dispatch, request, stream, pipeline, connect, and compose methods","declares Client, Pool, BalancedPool, and Agent classes extending Dispatcher","declares high-level request, stream, pipeline, connect, and upgrade API functions","declares fetch, Headers, Request, Response, FormData, File, and FileReader web standards declarations","declares Errors namespace with UndiciError base class and specific error subtypes"],"goal":"verify pkg:npm/undici-types@6.21.0","kind":"HOW","packages":["pkg:npm/undici-types@6.21.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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@6.21.0"],"schemaVersion":1,"subject":"pkg:npm/undici-types@6.21.0","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": "6.21.0"
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"license": "MIT"
}
}
}
{
"name": "sample-undici-types",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"undici-types": "6.21.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/undici-types@6.21.0",
"kind": "HOW",
"packages": [
"pkg:npm/undici-types@6.21.0"
]
}
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 undici-types package manifest and verify type declaration entry points
const pkgPath = require.resolve('undici-types/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, 'undici-types', 'Package name must be undici-types');
assert.equal(pkg.version, '6.21.0', 'Package version must be 6.21.0');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.ok(Array.isArray(pkg.files) && pkg.files.includes('*.d.ts'), 'Package files must include *.d.ts');
const typesDir = path.dirname(pkgPath);
const indexDts = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
const dispatcherDts = fs.readFileSync(path.join(typesDir, 'dispatcher.d.ts'), 'utf8');
const clientDts = fs.readFileSync(path.join(typesDir, 'client.d.ts'), 'utf8');
const poolDts = fs.readFileSync(path.join(typesDir, 'pool.d.ts'), 'utf8');
const agentDts = fs.readFileSync(path.join(typesDir, 'agent.d.ts'), 'utf8');
const apiDts = fs.readFileSync(path.join(typesDir, 'api.d.ts'), 'utf8');
const fetchDts = fs.readFileSync(path.join(typesDir, 'fetch.d.ts'), 'utf8');
const errorsDts = fs.readFileSync(path.join(typesDir, 'errors.d.ts'), 'utf8');
// 2. Verify Dispatcher base class declaration and methods
assert.ok(
dispatcherDts.includes('declare class Dispatcher extends EventEmitter'),
'Dispatcher class must extend EventEmitter'
);
assert.ok(
dispatcherDts.includes('dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;') &&
dispatcherDts.includes('request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;') &&
dispatcherDts.includes('stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;') &&
dispatcherDts.includes('pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;') &&
dispatcherDts.includes('connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;') &&
dispatcherDts.includes('compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;'),
'Dispatcher must declare dispatch, request, stream, pipeline, connect, and compose methods'
);
// 3. Verify Client, Pool, BalancedPool, and Agent classes extending Dispatcher
assert.ok(
clientDts.includes('export class Client extends Dispatcher') &&
clientDts.includes('constructor(url: string | URL, options?: Client.Options);'),
'Client class must extend Dispatcher'
);
assert.ok(
poolDts.includes('declare class Pool extends Dispatcher') &&
poolDts.includes('constructor(url: string | URL, options?: Pool.Options)'),
'Pool class must extend Dispatcher'
);
assert.ok(
agentDts.includes('declare class Agent extends Dispatcher') &&
agentDts.includes('constructor(opts?: Agent.Options)'),
'Agent class must extend Dispatcher'
);
assert.ok(
indexDts.includes('export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent'),
'index.d.ts must export Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, and Agent'
);
// 4. Verify high-level request, stream, pipeline, connect, and upgrade API functions
assert.ok(
apiDts.includes('declare function request(') &&
apiDts.includes('declare function stream(') &&
apiDts.includes('declare function pipeline(') &&
apiDts.includes('declare function connect(') &&
apiDts.includes('declare function upgrade('),
'api.d.ts must declare request, stream, pipeline, connect, and upgrade functions'
);
// 5. Verify fetch, Headers, Request, Response, FormData, File, and FileReader web standards declarations
assert.ok(
fetchDts.includes('export declare function fetch (') &&
fetchDts.includes('export type RequestInfo = string | URL | Request') &&
fetchDts.includes('export class BodyMixin'),
'fetch.d.ts must declare fetch function, RequestInfo, and BodyMixin'
);
assert.ok(
indexDts.includes("export * from './fetch'") &&
indexDts.includes("export * from './formdata'") &&
indexDts.includes("export * from './file'") &&
indexDts.includes("export * from './filereader'"),
'index.d.ts must re-export fetch, formdata, file, and filereader types'
);
// 6. Verify Errors namespace with UndiciError and error subtypes
assert.ok(
errorsDts.includes('export class UndiciError extends Error') &&
errorsDts.includes('export class ConnectTimeoutError extends UndiciError') &&
errorsDts.includes('export class HeadersTimeoutError extends UndiciError') &&
errorsDts.includes('export class BodyTimeoutError extends UndiciError') &&
errorsDts.includes('export class ResponseStatusCodeError extends UndiciError'),
'errors.d.ts must declare UndiciError and specific error subtypes'
);
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名