サンプル
pump 3.0.4
検証済みサンプル — npm pump 3.0.4. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: pump throws Error when fewer than two streams are provided
sha256:eb6aeac4edccdcbb8f0695c85355496257cb56af5e87be78b67049b328bac748
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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/pump@3.0.4
- パッケージ
- 作成日
- 2026-08-23T13:25:32Z
コントラクト
- pump throws Error when fewer than two streams are provided
- pump pipes data from readable stream through transform stream to writable stream and invokes callback on success
- pump accepts an array of streams and completes data piping successfully
- pump invokes callback with error and destroys downstream writable stream when upstream readable stream emits an error
- pump invokes callback with error and destroys upstream readable stream when downstream writable stream emits an error
- pump destroys all streams in the pipeline when an intermediate transform stream emits an error
- pump returns the destination stream from the pipeline
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- 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/pump@3.0.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pump@3.0.4
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:d3c34f9b7c348d9c5b897a2faca80a49a626db1e15fec96a29ab0579b571eaa9","contract":["pump throws Error when fewer than two streams are provided","pump pipes data from readable stream through transform stream to writable stream and invokes callback on success","pump accepts an array of streams and completes data piping successfully","pump invokes callback with error and destroys downstream writable stream when upstream readable stream emits an error","pump invokes callback with error and destroys upstream readable stream when downstream writable stream emits an error","pump destroys all streams in the pipeline when an intermediate transform stream emits an error","pump returns the destination stream from the pipeline"],"goal":"verify pkg:npm/pump@3.0.4","kind":"HOW","packages":["pkg:npm/pump@3.0.4"],"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/pump@3.0.4"],"schemaVersion":1,"subject":"pkg:npm/pump@3.0.4","verifierAdapter":"node-typescript@1"}
{
"name": "csx-sample-pump",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "csx-sample-pump",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"pump": "3.0.4"
}
},
"node_modules/end-of-stream": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
"license": "MIT",
"dependencies": {
"once": "^1.4.0"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/pump": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
"integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
"license": "MIT",
"dependencies": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"license": "ISC"
}
}
}
{
"name": "csx-sample-pump",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for pump",
"main": "test/contract.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"pump": "3.0.4"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/pump@3.0.4",
"kind": "HOW",
"packages": [
"pkg:npm/pump@3.0.4"
]
}
const assert = require('node:assert/strict');
const { Readable, Writable, Transform, PassThrough } = require('node:stream');
const pump = require('pump');
async function runContract() {
// 1. pump throws Error when fewer than two streams are provided
{
assert.throws(
() => pump(),
/^Error: pump requires two streams per minimum$/,
'pump() without arguments should throw Error'
);
assert.throws(
() => pump(new PassThrough()),
/^Error: pump requires two streams per minimum$/,
'pump(singleStream) should throw Error'
);
assert.throws(
() => pump([new PassThrough()]),
/^Error: pump requires two streams per minimum$/,
'pump([singleStream]) should throw Error'
);
}
// 2. pump pipes data from readable stream through transform stream to writable stream and invokes callback on success
await new Promise((resolve, reject) => {
const chunks = [];
const source = Readable.from(['hello', ' ', 'world']);
const uppercase = new Transform({
transform(chunk, encoding, callback) {
callback(null, chunk.toString().toUpperCase());
}
});
const destination = new Writable({
write(chunk, encoding, callback) {
chunks.push(chunk.toString());
callback();
}
});
pump(source, uppercase, destination, (err) => {
try {
assert.ifError(err);
assert.equal(chunks.join(''), 'HELLO WORLD');
resolve();
} catch (e) {
reject(e);
}
});
});
// 3. pump accepts an array of streams and completes data piping successfully
await new Promise((resolve, reject) => {
const received = [];
const source = Readable.from(['item1', 'item2', 'item3']);
const destination = new Writable({
write(chunk, encoding, callback) {
received.push(chunk.toString());
callback();
}
});
pump([source, destination], (err) => {
try {
assert.ifError(err);
assert.deepEqual(received, ['item1', 'item2', 'item3']);
resolve();
} catch (e) {
reject(e);
}
});
});
// 4. pump invokes callback with error and destroys downstream writable stream when upstream readable stream emits an error
await new Promise((resolve, reject) => {
const source = new PassThrough();
const destination = new PassThrough();
let destDestroyed = false;
destination.on('close', () => {
destDestroyed = true;
});
pump(source, destination, (err) => {
try {
assert(err, 'Expected error in callback');
assert.equal(err.message, 'source failed');
assert.equal(destination.destroyed || destDestroyed, true, 'Destination should be destroyed');
resolve();
} catch (e) {
reject(e);
}
});
source.destroy(new Error('source failed'));
});
// 5. pump invokes callback with error and destroys upstream readable stream when downstream writable stream emits an error
await new Promise((resolve, reject) => {
const source = new PassThrough();
const destination = new PassThrough();
let sourceDestroyed = false;
source.on('close', () => {
sourceDestroyed = true;
});
pump(source, destination, (err) => {
try {
assert(err, 'Expected error in callback');
assert.equal(err.message, 'destination failed');
assert.equal(source.destroyed || sourceDestroyed, true, 'Source should be destroyed');
resolve();
} catch (e) {
reject(e);
}
});
destination.destroy(new Error('destination failed'));
});
// 6. pump destroys all streams in the pipeline when an intermediate transform stream emits an error
await new Promise((resolve, reject) => {
const source = new PassThrough();
const transform = new PassThrough();
const destination = new PassThrough();
pump(source, transform, destination, (err) => {
try {
assert(err, 'Expected error in callback');
assert.equal(err.message, 'transform failed');
assert.equal(source.destroyed, true, 'Source should be destroyed');
assert.equal(destination.destroyed, true, 'Destination should be destroyed');
resolve();
} catch (e) {
reject(e);
}
});
transform.destroy(new Error('transform failed'));
});
// 7. pump returns the destination stream from the pipeline
{
const source = new PassThrough();
const destination = new PassThrough();
const result = pump(source, destination);
assert.strictEqual(result, destination, 'pump should return the last stream');
}
console.log('All pump contract assertions passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
オリジンシーダー
匿名