Beispiel
yocto-queue 1.2.2
Verifiziertes Beispiel für npm yocto-queue 1.2.2. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: Queue initializes empty with size 0…
sha256:259a4c02582cb95ab1c564c1909cb06bb921cdce6c7d750f37de0a2789422374
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-23 |
Fall
HOW- Ziel
- verify pkg:npm/yocto-queue@1.2.2
- Pakete
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-23T16:04:19Z
Contract
- Queue initializes empty with size 0 and peek returning undefined
- enqueue adds items to queue and increments size
- dequeue removes and returns items in FIFO order until empty
- peek returns the next item without removing it
- clear resets queue to empty size 0
- Queue instance is iterable with for...of and spread without mutating queue
- drain yields and removes all items in FIFO order until queue is empty
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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/yocto-queue@1.2.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/yocto-queue@1.2.2
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:c333258b2d1d4a18bc240fc8f8bee2b3e31e4392898788b5e250b566ea8d0392","constraints":{"executionContext":"node"},"contract":["Queue initializes empty with size 0 and peek returning undefined","enqueue adds items to queue and increments size","dequeue removes and returns items in FIFO order until empty","peek returns the next item without removing it","clear resets queue to empty size 0","Queue instance is iterable with for...of and spread without mutating queue","drain yields and removes all items in FIFO order until queue is empty"],"goal":"verify pkg:npm/yocto-queue@1.2.2","kind":"HOW","packages":["pkg:npm/yocto-queue@1.2.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/yocto-queue@1.2.2"],"schemaVersion":1,"subject":"pkg:npm/yocto-queue@1.2.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-yocto-queue",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-yocto-queue",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"yocto-queue": "1.2.2"
}
},
"node_modules/yocto-queue": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz",
"integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==",
"license": "MIT",
"engines": {
"node": ">=12.20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
}
}
}
{
"name": "sample-yocto-queue",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"yocto-queue": "1.2.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/yocto-queue@1.2.2",
"kind": "HOW",
"packages": [
"pkg:npm/yocto-queue@1.2.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import Queue from 'yocto-queue';
/**
* Creates a new Queue instance.
* @returns {Queue} A new empty Queue instance.
*/
export function createQueue() {
return new Queue();
}
/**
* Creates a Queue instance populated with items from an iterable.
* @param {Iterable} items Items to enqueue.
* @returns {Queue} A populated Queue instance.
*/
export function fromIterable(items) {
const queue = new Queue();
for (const item of items) {
queue.enqueue(item);
}
return queue;
}
/**
* Drains all items from a queue into an array.
* @param {Queue} queue The queue to drain.
* @returns {Array} Array of drained items.
*/
export function drainToArray(queue) {
return [...queue.drain()];
}
export { Queue };
export default Queue;
import assert from 'node:assert/strict';
import Queue from 'yocto-queue';
import { createQueue, fromIterable, drainToArray } from '../src/index.mjs';
// 1. Queue initializes empty with size 0 and peek returning undefined
{
const queue = new Queue();
assert.equal(queue.size, 0);
assert.equal(queue.peek(), undefined);
assert.equal(queue.dequeue(), undefined);
const helperQueue = createQueue();
assert.equal(helperQueue.size, 0);
assert.equal(helperQueue.peek(), undefined);
}
// 2. enqueue adds items to queue and increments size
{
const queue = new Queue();
queue.enqueue('item1');
assert.equal(queue.size, 1);
queue.enqueue('item2');
assert.equal(queue.size, 2);
queue.enqueue('item3');
assert.equal(queue.size, 3);
}
// 3. dequeue removes and returns items in FIFO order until empty
{
const queue = new Queue();
queue.enqueue(10);
queue.enqueue(20);
queue.enqueue(30);
assert.equal(queue.dequeue(), 10);
assert.equal(queue.size, 2);
assert.equal(queue.dequeue(), 20);
assert.equal(queue.size, 1);
assert.equal(queue.dequeue(), 30);
assert.equal(queue.size, 0);
assert.equal(queue.dequeue(), undefined);
assert.equal(queue.size, 0);
}
// 4. peek returns the next item without removing it
{
const queue = new Queue();
queue.enqueue('first');
queue.enqueue('second');
assert.equal(queue.peek(), 'first');
assert.equal(queue.size, 2);
assert.equal(queue.peek(), 'first');
assert.equal(queue.dequeue(), 'first');
assert.equal(queue.peek(), 'second');
assert.equal(queue.size, 1);
}
// 5. clear resets queue to empty size 0
{
const queue = new Queue();
queue.enqueue('a');
queue.enqueue('b');
assert.equal(queue.size, 2);
queue.clear();
assert.equal(queue.size, 0);
assert.equal(queue.peek(), undefined);
assert.equal(queue.dequeue(), undefined);
queue.enqueue('c');
assert.equal(queue.size, 1);
assert.equal(queue.dequeue(), 'c');
}
// 6. Queue instance is iterable with for...of and spread without mutating queue
{
const queue = fromIterable(['x', 'y', 'z']);
assert.equal(queue.size, 3);
const collected = [];
for (const item of queue) {
collected.push(item);
}
assert.deepEqual(collected, ['x', 'y', 'z']);
assert.deepEqual([...queue], ['x', 'y', 'z']);
assert.equal(queue.size, 3);
assert.equal(queue.dequeue(), 'x');
assert.equal(queue.size, 2);
}
// 7. drain yields and removes all items in FIFO order until queue is empty
{
const queue = fromIterable(['alpha', 'beta', 'gamma']);
assert.equal(queue.size, 3);
const drained = drainToArray(queue);
assert.deepEqual(drained, ['alpha', 'beta', 'gamma']);
assert.equal(queue.size, 0);
assert.equal(queue.peek(), undefined);
assert.equal(queue.dequeue(), undefined);
}
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym