Sample
neo-async 2.6.2: async.series
Verified sample for npm neo-async 2.6.2: async.series. The contract ran on node 22 · linux debian/x64 · docker and passed: series executes an array of async…
sha256:8f7938a21cf299f53e2290a9923b516b81742693bb895f57f42c0d48d0b81c8f
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-02 |
Case
HOW- Goal
- verify async.series in pkg:npm/neo-async@2.6.2
- Packages
- Symbols
-
- async.series
- Environment
- node 22.23.2
- Created
- 2026-09-02T06:50:12Z
Contract
- series executes an array of async functions in sequential order and returns results array
- series executes an object of named async functions in sequence and returns results object with matching keys
- series short-circuits execution on error and immediately passes error to final callback
- series guarantees sequential execution without running subsequent tasks concurrently
- series handles empty task collection by invoking callback immediately with empty results
- seriesPromise wraps async.series to resolve results in async/await workflows
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Source
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 async.series in pkg:npm/neo-async@2.6.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/neo-async@2.6.2
Demonstrate these symbols/APIs:
- async.series
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:3d58f48c5e0bc110e7d82e3f38bbd17909e2a19a2c4d4d23007e45f223b93212","constraints":{"executionContext":"node"},"contract":["series executes an array of async functions in sequential order and returns results array","series executes an object of named async functions in sequence and returns results object with matching keys","series short-circuits execution on error and immediately passes error to final callback","series guarantees sequential execution without running subsequent tasks concurrently","series handles empty task collection by invoking callback immediately with empty results","seriesPromise wraps async.series to resolve results in async/await workflows"],"goal":"verify async.series in pkg:npm/neo-async@2.6.2","kind":"HOW","packages":["pkg:npm/neo-async@2.6.2"],"schemaVersion":1,"symbols":["async.series"]},"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/neo-async@2.6.2"],"schemaVersion":1,"subject":"pkg:npm/neo-async@2.6.2","symbols":["async.series"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-neo-async-series",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-neo-async-series",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"neo-async": "2.6.2"
}
},
"node_modules/neo-async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"license": "MIT"
}
}
}
{
"name": "sample-neo-async-series",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"neo-async": "2.6.2"
}
}
{
"schemaVersion": 1,
"goal": "verify async.series in pkg:npm/neo-async@2.6.2",
"kind": "HOW",
"packages": [
"pkg:npm/neo-async@2.6.2"
],
"symbols": [
"async.series"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import async from 'neo-async';
const { series } = async;
/**
* Executes an array or object of asynchronous task functions in series.
* Each task receives a callback(err, result).
*
* @param {Array<Function>|Object.<string, Function>} tasks Array or dictionary of async functions.
* @param {Function} [callback] Final callback(err, results).
*/
export function executeSeries(tasks, callback) {
return series(tasks, callback);
}
/**
* Promisified wrapper for async.series to support async/await workflows.
*
* @param {Array<Function>|Object.<string, Function>} tasks Array or dictionary of async functions.
* @returns {Promise<Array<*>|Object.<string, *>>} Resolved results or rejected error.
*/
export function seriesPromise(tasks) {
return new Promise((resolve, reject) => {
series(tasks, (err, results) => {
if (err) {
return reject(err);
}
resolve(results);
});
});
}
export { series };
export default async;
import assert from 'node:assert/strict';
import async from 'neo-async';
import { executeSeries, seriesPromise, series } from '../src/index.mjs';
// 1. series executes an array of async functions in sequential order and returns results array
{
const order = [];
const tasks = [
(callback) => {
setTimeout(() => {
order.push(1);
callback(null, 'step1');
}, 20);
},
(callback) => {
setTimeout(() => {
order.push(2);
callback(null, 'step2');
}, 10);
},
(callback) => {
order.push(3);
callback(null, 'step3');
}
];
const results = await new Promise((resolve, reject) => {
series(tasks, (err, res) => {
if (err) reject(err);
else resolve(res);
});
});
assert.deepEqual(results, ['step1', 'step2', 'step3']);
assert.deepEqual(order, [1, 2, 3]);
}
// 2. series executes an object of named async functions in sequence and returns results object with matching keys
{
const order = [];
const tasks = {
first: (callback) => {
setTimeout(() => {
order.push('first');
callback(null, { id: 100 });
}, 15);
},
second: (callback) => {
order.push('second');
callback(null, { id: 200 });
}
};
const results = await new Promise((resolve, reject) => {
executeSeries(tasks, (err, res) => {
if (err) reject(err);
else resolve(res);
});
});
assert.deepEqual(results, { first: { id: 100 }, second: { id: 200 } });
assert.deepEqual(order, ['first', 'second']);
}
// 3. series short-circuits execution on error and immediately passes error to final callback
{
let thirdTaskRan = false;
const tasks = [
(callback) => {
callback(null, 'ok');
},
(callback) => {
callback(new Error('step 2 failed'));
},
(callback) => {
thirdTaskRan = true;
callback(null, 'unreachable');
}
];
const error = await new Promise((resolve) => {
series(tasks, (err) => {
resolve(err);
});
});
assert.ok(error instanceof Error);
assert.equal(error.message, 'step 2 failed');
assert.equal(thirdTaskRan, false);
}
// 4. series guarantees sequential execution without running subsequent tasks concurrently
{
let activeCount = 0;
let maxActive = 0;
const makeTask = (val) => (callback) => {
activeCount++;
maxActive = Math.max(maxActive, activeCount);
setTimeout(() => {
activeCount--;
callback(null, val);
}, 15);
};
const tasks = [makeTask(1), makeTask(2), makeTask(3)];
const results = await new Promise((resolve, reject) => {
series(tasks, (err, res) => {
if (err) reject(err);
else resolve(res);
});
});
assert.deepEqual(results, [1, 2, 3]);
assert.equal(maxActive, 1);
assert.equal(activeCount, 0);
}
// 5. series handles empty task collection by invoking callback immediately with empty results
{
const emptyArrayResults = await new Promise((resolve, reject) => {
series([], (err, res) => {
if (err) reject(err);
else resolve(res);
});
});
assert.deepEqual(emptyArrayResults, []);
const emptyObjectResults = await new Promise((resolve, reject) => {
series({}, (err, res) => {
if (err) reject(err);
else resolve(res);
});
});
assert.deepEqual(emptyObjectResults, {});
}
// 6. seriesPromise wraps async.series to resolve results in async/await workflows
{
const resArray = await seriesPromise([
(cb) => cb(null, 'a'),
(cb) => cb(null, 'b')
]);
assert.deepEqual(resArray, ['a', 'b']);
const resObj = await seriesPromise({
foo: (cb) => cb(null, 42),
bar: (cb) => cb(null, 99)
});
assert.deepEqual(resObj, { foo: 42, bar: 99 });
await assert.rejects(
async () => {
await seriesPromise([
(cb) => cb(new Error('async rejected'))
]);
},
{
name: 'Error',
message: 'async rejected'
}
);
}
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous