CodeSampleX

샘플

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:1d8d83e2a9dfa46e0ec9221025b5252233942fd9cea5b6594b3728bb338c90fd

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
2
빌드한 서명 키
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@1
2026-08-21
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
패키지
환경
node 22.23.2
생성일
2026-08-21T03:24:42Z

컨트랙트

  1. package manifest specifies index.d.ts type declarations and files field
  2. declares Dispatcher base class with dispatch, request, stream, pipeline, connect, and compose methods
  3. declares Client, Pool, BalancedPool, and Agent classes extending Dispatcher
  4. declares high-level request, stream, pipeline, connect, and upgrade API functions
  5. declares fetch, Headers, Request, Response, FormData, File, and FileReader web standards declarations
  6. 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

소스 아티팩트 내려받기 (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 pkg:npm/undici-types@6.21.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/undici-types@6.21.0
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.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.
csx.json
{"case":{"caseId":"case:sha256:5ed3b4c413573333bbd9e39b61c8daae0204abf84e56bc3c9c4e6d00602b55b0","constraints":{"executionContext":"node"},"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","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@6.21.0"],"schemaVersion":1,"subject":"pkg:npm/undici-types@6.21.0","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": "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"
    }
  }
}
package.json
{
  "name": "sample-undici-types",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "undici-types": "6.21.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/undici-types@6.21.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/undici-types@6.21.0"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
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.');

오리진 시더

익명