CodeSampleX

サンプル

undici-types 8.3.0: types

検証済みサンプル — npm undici-types 8.3.0: types. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: undici-types package.json declares type definitions…

sha256:e291880c9c94e553433ec5cff5d41456712b74bb0d7c45272d1e680d9219c977

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 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-27

ケース

HOW
ゴール
verify undici-types.types in pkg:npm/undici-types@8.3.0
パッケージ
シンボル
  • undici-types.types
環境
node 22.23.2
作成日
2026-08-27T11:28:22Z

コントラクト

  1. undici-types package.json declares type definitions entry point index.d.ts and version 8.3.0
  2. undici-types index.d.ts exports core HTTP client types and classes including Dispatcher, Client, Pool, and Agent
  3. undici-types index.d.ts re-exports Web standard type definitions for fetch, Headers, Request, Response, and FormData
  4. undici-types index.d.ts exports global dispatcher and origin configuration functions and interceptors
  5. undici-types index.d.ts exports default Undici namespace containing typed client and utility constructors
  6. undici-types dispatcher.d.ts declares Dispatcher class with dispatch, request, stream, pipeline, and lifecycle methods

ファイル

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

ソースアーティファクトをダウンロード (tar.gz)

ソース

PROMPT.md
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.types 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.types

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.
csx.json
{"case":{"caseId":"case:sha256:784d3a07ae2339e00e3b7e751785ade4aaca70a54ca104674f284d298057c539","contract":["undici-types package.json declares type definitions entry point index.d.ts and version 8.3.0","undici-types index.d.ts exports core HTTP client types and classes including Dispatcher, Client, Pool, and Agent","undici-types index.d.ts re-exports Web standard type definitions for fetch, Headers, Request, Response, and FormData","undici-types index.d.ts exports global dispatcher and origin configuration functions and interceptors","undici-types index.d.ts exports default Undici namespace containing typed client and utility constructors","undici-types dispatcher.d.ts declares Dispatcher class with dispatch, request, stream, pipeline, and lifecycle methods"],"goal":"verify undici-types.types in pkg:npm/undici-types@8.3.0","kind":"HOW","packages":["pkg:npm/undici-types@8.3.0"],"schemaVersion":1,"symbols":["undici-types.types"]},"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/undici-types@8.3.0"],"schemaVersion":1,"subject":"pkg:npm/undici-types@8.3.0","symbols":["undici-types.types"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "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": "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"
    }
  }
}
package.json
{
  "name": "sample-undici-types",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "undici-types": "8.3.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify undici-types.types in pkg:npm/undici-types@8.3.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/undici-types@8.3.0"
  ],
  "symbols": [
    "undici-types.types"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);

// 1. undici-types package.json declares type definitions entry point index.d.ts and version 8.3.0
const pkgJsonPath = require.resolve('undici-types/package.json');
assert.ok(fs.existsSync(pkgJsonPath));
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
assert.equal(pkgJson.name, 'undici-types');
assert.equal(pkgJson.version, '8.3.0');
assert.equal(pkgJson.types, 'index.d.ts');

const pkgDir = path.dirname(pkgJsonPath);

// 2. undici-types index.d.ts exports core HTTP client types and classes including Dispatcher, Client, Pool, and Agent
const indexDtsPath = path.join(pkgDir, 'index.d.ts');
assert.ok(fs.existsSync(indexDtsPath));
const indexDts = fs.readFileSync(indexDtsPath, 'utf8');

assert.ok(indexDts.includes("import Dispatcher from './dispatcher'"));
assert.ok(indexDts.includes("import Pool from './pool'"));
assert.ok(indexDts.includes("import Client from './client'"));
assert.ok(indexDts.includes("import Agent from './agent'"));
assert.ok(indexDts.includes("export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, Dispatcher1Wrapper, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }"));

// 3. undici-types index.d.ts re-exports Web standard type definitions for fetch, Headers, Request, Response, and FormData
assert.ok(indexDts.includes("export * from './fetch'"));
assert.ok(indexDts.includes("export * from './formdata'"));
assert.ok(indexDts.includes("export * from './websocket'"));
assert.ok(indexDts.includes("export * from './eventsource'"));
assert.ok(indexDts.includes("export * from './cookies'"));

const fetchDtsPath = path.join(pkgDir, 'fetch.d.ts');
assert.ok(fs.existsSync(fetchDtsPath));
const fetchDts = fs.readFileSync(fetchDtsPath, 'utf8');
assert.ok(fetchDts.includes('export declare function fetch ('));
assert.ok(fetchDts.includes('export class BodyMixin {'));

// 4. undici-types index.d.ts exports global dispatcher and origin configuration functions and interceptors
assert.ok(indexDts.includes("import { setGlobalDispatcher, getGlobalDispatcher } from './global-dispatcher'"));
assert.ok(indexDts.includes("import { setGlobalOrigin, getGlobalOrigin } from './global-origin'"));
assert.ok(indexDts.includes("import interceptors from './interceptors'"));

// 5. undici-types index.d.ts exports default Undici namespace containing typed client and utility constructors
assert.ok(indexDts.includes('export default Undici'));
assert.ok(indexDts.includes('declare namespace Undici {'));
assert.ok(indexDts.includes("const Dispatcher: typeof import('./dispatcher').default"));
assert.ok(indexDts.includes("const Pool: typeof import('./pool').default"));
assert.ok(indexDts.includes("const Client: typeof import('./client').default"));
assert.ok(indexDts.includes("const fetch: typeof import('./fetch').fetch"));

// 6. undici-types dispatcher.d.ts declares Dispatcher class with dispatch, request, stream, pipeline, and lifecycle methods
const dispatcherDtsPath = path.join(pkgDir, 'dispatcher.d.ts');
assert.ok(fs.existsSync(dispatcherDtsPath));
const dispatcherDts = fs.readFileSync(dispatcherDtsPath, 'utf8');

assert.ok(dispatcherDts.includes('declare class Dispatcher extends EventEmitter {'));
assert.ok(dispatcherDts.includes('dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean'));
assert.ok(dispatcherDts.includes('request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void'));
assert.ok(dispatcherDts.includes('stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void'));
assert.ok(dispatcherDts.includes('pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex'));
assert.ok(dispatcherDts.includes('close (callback: () => void): void'));
assert.ok(dispatcherDts.includes('destroy (err: Error | null, callback: () => void): void'));

console.log('All contract tests passed.');

オリジンシーダー

匿名