CodeSampleX

샘플

combined-stream 1.0.8

검증된 샘플 — npm combined-stream 1.0.8. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: CombinedStream.create creates a combined stream with default…

sha256:a7ee5b1675019a6b39b893dd20f0e8483c795078536a161da97ceff6cf5fbb29

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

실행 증거

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

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm

검증 실행 환경

환경 컨트랙트 단계 실행일
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-20

케이스

HOW
목표
verify pkg:npm/combined-stream@1.0.8
패키지
환경
node 22.23.2
생성일
2026-08-20T20:26:29Z

컨트랙트

  1. CombinedStream.create creates a combined stream with default or custom options
  2. CombinedStream.isStreamLike identifies stream-like objects and rejects primitive values
  3. CombinedStream.prototype.append chains and combines string, Buffer, and stream sources sequentially
  4. CombinedStream supports deferred stream resolution via callback functions
  5. CombinedStream.prototype.pipe streams combined data to a destination writable stream
  6. CombinedStream propagates error events from underlying streams
  7. CombinedStream.prototype.destroy resets internal stream state and emits close

파일

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

소스 아티팩트 내려받기 (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/combined-stream@1.0.8
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/combined-stream@1.0.8
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - 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:f9a5ea5c2518e2ee304b19d811f6f21a9b0eb4eae68708a61f51e0f1b3f79890","constraints":{"executionContext":"node"},"contract":["CombinedStream.create creates a combined stream with default or custom options","CombinedStream.isStreamLike identifies stream-like objects and rejects primitive values","CombinedStream.prototype.append chains and combines string, Buffer, and stream sources sequentially","CombinedStream supports deferred stream resolution via callback functions","CombinedStream.prototype.pipe streams combined data to a destination writable stream","CombinedStream propagates error events from underlying streams","CombinedStream.prototype.destroy resets internal stream state and emits close"],"goal":"verify pkg:npm/combined-stream@1.0.8","kind":"HOW","packages":["pkg:npm/combined-stream@1.0.8"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/combined-stream@1.0.8"],"schemaVersion":1,"subject":"pkg:npm/combined-stream@1.0.8","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "combined-stream-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "combined-stream-verification",
      "version": "1.0.0",
      "dependencies": {
        "combined-stream": "1.0.8"
      }
    },
    "node_modules/combined-stream": {
      "version": "1.0.8",
      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
      "license": "MIT",
      "dependencies": {
        "delayed-stream": "~1.0.0"
      },
      "engines": {
        "node": ">= 0.8"
      }
    },
    "node_modules/delayed-stream": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
      "license": "MIT",
      "engines": {
        "node": ">=0.4.0"
      }
    }
  }
}
package.json
{
  "name": "combined-stream-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for combined-stream",
  "dependencies": {
    "combined-stream": "1.0.8"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/combined-stream@1.0.8",
  "kind": "HOW",
  "packages": [
    "pkg:npm/combined-stream@1.0.8"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
const assert = require('node:assert');
const { PassThrough, Writable } = require('node:stream');
const CombinedStream = require('combined-stream');

async function test() {
  // 1. CombinedStream.create creates a combined stream with default or custom options
  const defaultStream = CombinedStream.create();
  assert.strictEqual(defaultStream.maxDataSize, 2097152);
  assert.strictEqual(defaultStream.pauseStreams, true);

  const customStream = CombinedStream.create({ maxDataSize: 1024, pauseStreams: false });
  assert.strictEqual(customStream.maxDataSize, 1024);
  assert.strictEqual(customStream.pauseStreams, false);

  // 2. CombinedStream.isStreamLike identifies stream-like objects and rejects primitive values
  assert.strictEqual(CombinedStream.isStreamLike(new PassThrough()), true);
  assert.strictEqual(CombinedStream.isStreamLike({ pipe: () => {} }), true);
  assert.strictEqual(CombinedStream.isStreamLike('string'), false);
  assert.strictEqual(CombinedStream.isStreamLike(Buffer.from('buf')), false);
  assert.strictEqual(CombinedStream.isStreamLike(123), false);
  assert.strictEqual(CombinedStream.isStreamLike(true), false);
  assert.strictEqual(CombinedStream.isStreamLike(() => {}), false);

  // 3. CombinedStream.prototype.append chains and combines string, Buffer, and stream sources sequentially
  const cs = CombinedStream.create();
  const s1 = new PassThrough();
  const s2 = new PassThrough();
  const res = cs
    .append('header:')
    .append(Buffer.from('body:'))
    .append(s1)
    .append(s2);
  assert.strictEqual(res, cs);

  const chunks = [];
  cs.on('data', chunk => chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)));

  const finished = new Promise(resolve => cs.on('end', resolve));
  cs.resume();

  s1.write('stream1:');
  s1.end();
  s2.write('stream2');
  s2.end();

  await finished;
  assert.strictEqual(Buffer.concat(chunks).toString('utf8'), 'header:body:stream1:stream2');

  // 4. CombinedStream supports deferred stream resolution via callback functions
  const deferredCS = CombinedStream.create();
  deferredCS.append(next => {
    const pt = new PassThrough();
    pt.end('lazy-content');
    next(pt);
  });
  let deferredResult = '';
  deferredCS.on('data', chunk => { deferredResult += chunk.toString(); });
  const deferredFinished = new Promise(resolve => deferredCS.on('end', resolve));
  deferredCS.resume();
  await deferredFinished;
  assert.strictEqual(deferredResult, 'lazy-content');

  // 5. CombinedStream.prototype.pipe streams combined data to a destination writable stream
  const pipeCS = CombinedStream.create();
  pipeCS.append('chunk1-');
  pipeCS.append('chunk2');

  let pipedData = '';
  const dest = new Writable({
    write(chunk, encoding, callback) {
      pipedData += chunk.toString();
      callback();
    }
  });

  await new Promise(resolve => {
    dest.on('finish', resolve);
    pipeCS.pipe(dest);
  });
  assert.strictEqual(pipedData, 'chunk1-chunk2');

  // 6. CombinedStream propagates error events from underlying streams
  const errCS = CombinedStream.create();
  const faultyStream = new PassThrough();
  errCS.append(faultyStream);

  const errPromise = new Promise((resolve) => {
    errCS.on('error', err => resolve(err));
  });
  errCS.resume();

  faultyStream.emit('error', new Error('stream failure'));
  const caughtError = await errPromise;
  assert.strictEqual(caughtError.message, 'stream failure');

  // 7. CombinedStream.prototype.destroy resets internal stream state and emits close
  const destroyCS = CombinedStream.create();
  destroyCS.append('some-data');
  let closeEmitted = false;
  destroyCS.on('close', () => { closeEmitted = true; });
  destroyCS.destroy();
  assert.strictEqual(closeEmitted, true);
  assert.strictEqual(destroyCS.writable, false);

  console.log('Contract passed');
}

test().catch(err => {
  console.error(err);
  process.exit(1);
});

오리진 시더

익명