Beispiel
eventsource 3.0.7: EventSource
Verifiziertes Beispiel für npm eventsource 3.0.7: EventSource. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:757ec10e71189f8ba907377d075863dded73f939403805700c8de05d5f96eecf
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-26 |
Fall
HOW- Ziel
- verify pkg:npm/eventsource@3.0.7
- Pakete
- Symbole
-
- EventSource
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-26T08:27:50Z
Contract
- EventSource exposes readyState constants CONNECTING (0), OPEN (1), and CLOSED (2)
- EventSource initializes with CONNECTING readyState, the target URL, and default options
- EventSource connects to an SSE endpoint and dispatches open event with readyState OPEN
- EventSource receives and parses standard message events with event.data
- EventSource receives and dispatches custom named events via addEventListener
- EventSource.close() terminates the connection and transitions readyState to CLOSED
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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/eventsource@3.0.7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/eventsource@3.0.7
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.
{"case":{"caseId":"case:sha256:27b05d1f2852da43248c77d69324a8d2e072a9a19283d39763f468e5fcb9b5c6","constraints":{"executionContext":"node"},"contract":["EventSource exposes readyState constants CONNECTING (0), OPEN (1), and CLOSED (2)","EventSource initializes with CONNECTING readyState, the target URL, and default options","EventSource connects to an SSE endpoint and dispatches open event with readyState OPEN","EventSource receives and parses standard message events with event.data","EventSource receives and dispatches custom named events via addEventListener","EventSource.close() terminates the connection and transitions readyState to CLOSED"],"goal":"verify pkg:npm/eventsource@3.0.7","kind":"HOW","packages":["pkg:npm/eventsource@3.0.7"],"schemaVersion":1,"symbols":["EventSource"]},"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/eventsource@3.0.7"],"schemaVersion":1,"subject":"pkg:npm/eventsource@3.0.7","symbols":["EventSource"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-eventsource-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-eventsource-verify",
"version": "1.0.0",
"dependencies": {
"eventsource": "3.0.7"
}
},
"node_modules/eventsource": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz",
"integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==",
"license": "MIT",
"dependencies": {
"eventsource-parser": "^3.0.1"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/eventsource-parser": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.1.tgz",
"integrity": "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
}
}
}
}
{
"name": "sample-eventsource-verify",
"version": "1.0.0",
"private": true,
"dependencies": {
"eventsource": "3.0.7"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/eventsource@3.0.7",
"kind": "HOW",
"packages": [
"pkg:npm/eventsource@3.0.7"
],
"symbols": [
"EventSource"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import http from 'node:http';
import { EventSource } from 'eventsource';
// 1. EventSource exposes readyState constants CONNECTING (0), OPEN (1), and CLOSED (2)
{
assert.equal(EventSource.CONNECTING, 0);
assert.equal(EventSource.OPEN, 1);
assert.equal(EventSource.CLOSED, 2);
}
// Helper to run offline HTTP SSE server for network contracts
async function createTestServer() {
const server = http.createServer((req, res) => {
res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
});
res.write('event: custom-event\ndata: payload-data\n\n');
res.write('data: line1\ndata: line2\n\n');
});
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
const port = server.address().port;
const url = `http://127.0.0.1:${port}/sse`;
return { server, url };
}
const { server, url } = await createTestServer();
try {
// 2. EventSource initializes with CONNECTING readyState, the target URL, and default options
const es = new EventSource(url);
assert.equal(es.readyState, EventSource.CONNECTING);
assert.equal(es.url, url);
assert.equal(es.withCredentials, false);
assert.equal(es.CONNECTING, 0);
assert.equal(es.OPEN, 1);
assert.equal(es.CLOSED, 2);
const receivedCustomEvents = [];
const receivedMessages = [];
await new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Test timed out waiting for SSE events'));
}, 5000);
// 3. EventSource connects to an SSE endpoint and dispatches open event with readyState OPEN
es.addEventListener('open', () => {
assert.equal(es.readyState, EventSource.OPEN);
});
// 5. EventSource receives and dispatches custom named events via addEventListener
es.addEventListener('custom-event', (event) => {
receivedCustomEvents.push(event.data);
});
// 4. EventSource receives and parses standard message events with event.data
es.addEventListener('message', (event) => {
receivedMessages.push(event.data);
if (receivedCustomEvents.length === 1 && receivedMessages.length === 1) {
clearTimeout(timeout);
resolve();
}
});
es.addEventListener('error', (err) => {
clearTimeout(timeout);
reject(err);
});
});
assert.deepEqual(receivedCustomEvents, ['payload-data']);
assert.deepEqual(receivedMessages, ['line1\nline2']);
// 6. EventSource.close() terminates the connection and transitions readyState to CLOSED
es.close();
assert.equal(es.readyState, EventSource.CLOSED);
} finally {
await new Promise((resolve) => server.close(resolve));
}
Ursprungs-Seeder
anonym