Sample
bluebird 3.7.2: map
Verified sample for npm bluebird 3.7.2: map. The contract ran on node 22 · linux alpine/x64 · docker and passed: assert Promise.map maps an array…
sha256:0364f8f0aea296d22976321469f0542c0e996843bfc85d90b16aa28df599451b
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
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-30 |
Case
HOW- Goal
- verify bluebird.map in pkg:npm/bluebird@3.7.2
- Packages
- Symbols
-
- bluebird.map
- Created
- 2026-08-30T17:22:06Z
Contract
- assert Promise.map maps an array asynchronously and preserves result order
- assert Promise.map limits concurrent execution when concurrency option is specified
- assert Promise.map accepts a Promise that resolves to an iterable array
- assert Promise.map rejects when mapper throws or returns a rejected Promise
- assert Promise.map rejects with TypeError when concurrency option is not a number
Files
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- 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 bluebird.map in pkg:npm/bluebird@3.7.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bluebird@3.7.2
Demonstrate these symbols/APIs:
- bluebird.map
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:a4cc710b3bac37b3c2008c4ad314f529d633e1762a3e09bf3dee188f6d02d61e","contract":["assert Promise.map maps an array asynchronously and preserves result order","assert Promise.map limits concurrent execution when concurrency option is specified","assert Promise.map accepts a Promise that resolves to an iterable array","assert Promise.map rejects when mapper throws or returns a rejected Promise","assert Promise.map rejects with TypeError when concurrency option is not a number"],"goal":"verify bluebird.map in pkg:npm/bluebird@3.7.2","kind":"HOW","packages":["pkg:npm/bluebird@3.7.2"],"schemaVersion":1,"symbols":["bluebird.map"]},"contractCommand":["node","test/contract.mjs"],"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/bluebird@3.7.2"],"schemaVersion":1,"subject":"pkg:npm/bluebird@3.7.2","symbols":["bluebird.map"],"verifierAdapter":"node-typescript@1"}
import Promise from 'bluebird';
/**
* Maps an array or promise of an array through a mapper function with optional concurrency limit.
* @template T, U
* @param {Iterable<T>|Promise<Iterable<T>>} items
* @param {(item: T, index: number, length: number) => U|Promise<U>} mapper
* @param {{ concurrency?: number }} [options]
* @returns {Promise<U[]>}
*/
export async function mapItems(items, mapper, options) {
return Promise.map(items, mapper, options);
}
export default Promise;
{
"name": "sample-bluebird-map",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bluebird-map",
"version": "1.0.0",
"dependencies": {
"bluebird": "3.7.2"
}
},
"node_modules/bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"license": "MIT"
}
}
}
{
"name": "sample-bluebird-map",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"bluebird": "3.7.2"
}
}
{
"schemaVersion": 1,
"goal": "verify bluebird.map in pkg:npm/bluebird@3.7.2",
"kind": "HOW",
"packages": [
"pkg:npm/bluebird@3.7.2"
],
"symbols": [
"bluebird.map"
]
}
import assert from 'node:assert/strict';
import Promise, { mapItems } from '../index.mjs';
// 1. assert Promise.map maps an array asynchronously and preserves result order
{
const input = [1, 2, 3, 4, 5];
const delays = [50, 10, 40, 20, 30];
const result = await Promise.map(input, async (num, index) => {
await Promise.delay(delays[index]);
return num * 2;
});
assert.deepStrictEqual(result, [2, 4, 6, 8, 10]);
const helperResult = await mapItems(input, async (num) => num * 10);
assert.deepStrictEqual(helperResult, [10, 20, 30, 40, 50]);
}
// 2. assert Promise.map limits concurrent execution when concurrency option is specified
{
const concurrencyLimit = 2;
let activeCount = 0;
let maxActiveCount = 0;
const items = [1, 2, 3, 4, 5, 6];
const result = await Promise.map(
items,
async (item) => {
activeCount++;
if (activeCount > maxActiveCount) {
maxActiveCount = activeCount;
}
await Promise.delay(25);
activeCount--;
return item * 3;
},
{ concurrency: concurrencyLimit }
);
assert.strictEqual(maxActiveCount, concurrencyLimit);
assert.strictEqual(activeCount, 0);
assert.deepStrictEqual(result, [3, 6, 9, 12, 15, 18]);
}
// 3. assert Promise.map accepts a Promise that resolves to an iterable array
{
const inputPromise = Promise.delay(10).then(() => ['alpha', 'beta', 'gamma']);
const result = await Promise.map(inputPromise, async (str) => str.toUpperCase());
assert.deepStrictEqual(result, ['ALPHA', 'BETA', 'GAMMA']);
}
// 4. assert Promise.map rejects when mapper throws or returns a rejected Promise
{
let syncErr = null;
try {
await Promise.map([10, 20, 30], (val) => {
if (val === 10) throw new Error('sync error in mapper');
return val;
});
} catch (err) {
syncErr = err;
}
assert.ok(syncErr !== null);
assert.strictEqual(syncErr.message, 'sync error in mapper');
let asyncErr = null;
try {
await Promise.map([10, 20, 30], async (val) => {
if (val === 10) throw new Error('async error in mapper');
return val;
});
} catch (err) {
asyncErr = err;
}
assert.ok(asyncErr !== null);
assert.strictEqual(asyncErr.message, 'async error in mapper');
}
// 5. assert Promise.map rejects with TypeError when concurrency option is not a number
{
let typeErr = null;
try {
await Promise.map([1, 2, 3], (x) => x, { concurrency: 'invalid' });
} catch (err) {
typeErr = err;
}
assert.ok(typeErr instanceof TypeError);
assert.match(typeErr.message, /concurrency/);
}
console.log('All contracts passed successfully.');
Origin Seeder
anonymous