샘플
bluebird 3.7.2: resolve
검증된 샘플 — npm bluebird 3.7.2: resolve. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: assert Promise.resolve resolves primitive and object values…
sha256:011b481c29f17f1222e7480a6e2c8c6d582803b2f33f0715244c036314498859
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-06 |
케이스
HOW- 목표
- verify bluebird.resolve in pkg:npm/bluebird@3.7.2
- 패키지
- 심벌
-
- bluebird.resolve
- 환경
- node 22.23.2
- 생성일
- 2026-09-06T18:25:40Z
컨트랙트
- assert Promise.resolve resolves primitive and object values into a Bluebird Promise instance
- assert Promise.resolve called without arguments resolves to undefined
- assert Promise.resolve preserves identity when given an existing Bluebird Promise
- assert Promise.resolve unwraps native promises and foreign thenables into Bluebird Promise instances
- assert Promise.resolve propagates rejections and errors from assimilated thenables and promises
- assert Promise.resolve produces an immediately fulfilled promise with synchronous inspection capabilities
- assert resolveValue, resolveAll, and assimilateThenable helper functions produce resolved Bluebird promises
파일
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
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.resolve 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.resolve
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:50eb02b5f292c38923fd86e11f10293f57aa84863d3a8eadd8c553926762c843","contract":["assert Promise.resolve resolves primitive and object values into a Bluebird Promise instance","assert Promise.resolve called without arguments resolves to undefined","assert Promise.resolve preserves identity when given an existing Bluebird Promise","assert Promise.resolve unwraps native promises and foreign thenables into Bluebird Promise instances","assert Promise.resolve propagates rejections and errors from assimilated thenables and promises","assert Promise.resolve produces an immediately fulfilled promise with synchronous inspection capabilities","assert resolveValue, resolveAll, and assimilateThenable helper functions produce resolved Bluebird promises"],"goal":"verify bluebird.resolve in pkg:npm/bluebird@3.7.2","kind":"HOW","packages":["pkg:npm/bluebird@3.7.2"],"schemaVersion":1,"symbols":["bluebird.resolve"]},"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/bluebird@3.7.2"],"schemaVersion":1,"subject":"pkg:npm/bluebird@3.7.2","symbols":["bluebird.resolve"],"verifierAdapter":"node-typescript@1"}
import Promise from 'bluebird';
/**
* Resolves a value, existing promise, or thenable into a Bluebird promise.
*
* @param {any} [value] - Value, Promise, or thenable to resolve.
* @returns {Promise<any>} A Bluebird promise resolved with the value.
*/
export function resolveValue(value) {
return Promise.resolve(value);
}
/**
* Resolves an array of values, promises, or thenables into Bluebird promises.
*
* @param {Array<any>} items - Array of items to resolve.
* @returns {Array<Promise<any>>} Array of Bluebird promises.
*/
export function resolveAll(items) {
return items.map((item) => Promise.resolve(item));
}
/**
* Unwraps or converts a foreign thenable into a Bluebird promise.
*
* @param {PromiseLike<any>} thenable - A foreign thenable.
* @returns {Promise<any>} An assimilated Bluebird promise.
*/
export function assimilateThenable(thenable) {
return Promise.resolve(thenable);
}
export { Promise };
export default Promise;
{
"name": "sample-bluebird-resolve",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bluebird-resolve",
"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-resolve",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"bluebird": "3.7.2"
}
}
{
"schemaVersion": 1,
"goal": "verify bluebird.resolve in pkg:npm/bluebird@3.7.2",
"kind": "HOW",
"packages": [
"pkg:npm/bluebird@3.7.2"
],
"symbols": [
"bluebird.resolve"
]
}
import assert from 'node:assert/strict';
import Promise, { resolveValue, resolveAll, assimilateThenable } from '../index.mjs';
async function testAll() {
// 1. Export verification
assert.strictEqual(typeof Promise, 'function', 'Promise export must be a function');
assert.strictEqual(typeof Promise.resolve, 'function', 'Promise.resolve must be a function');
assert.strictEqual(typeof resolveValue, 'function', 'resolveValue helper must be a function');
assert.strictEqual(typeof resolveAll, 'function', 'resolveAll helper must be a function');
assert.strictEqual(typeof assimilateThenable, 'function', 'assimilateThenable helper must be a function');
// 2. Resolving primitive values
{
const pNumber = Promise.resolve(42);
assert.ok(pNumber instanceof Promise, 'Promise.resolve(number) must return a Bluebird Promise');
assert.strictEqual(await pNumber, 42, 'Promise.resolve(42) must resolve to 42');
const pString = Promise.resolve('hello world');
assert.ok(pString instanceof Promise, 'Promise.resolve(string) must return a Bluebird Promise');
assert.strictEqual(await pString, 'hello world', 'Promise.resolve(string) must resolve to string value');
const pBool = Promise.resolve(true);
assert.ok(pBool instanceof Promise, 'Promise.resolve(boolean) must return a Bluebird Promise');
assert.strictEqual(await pBool, true, 'Promise.resolve(boolean) must resolve to boolean value');
const pNull = Promise.resolve(null);
assert.ok(pNull instanceof Promise, 'Promise.resolve(null) must return a Bluebird Promise');
assert.strictEqual(await pNull, null, 'Promise.resolve(null) must resolve to null');
const pObj = Promise.resolve({ key: 'value' });
assert.ok(pObj instanceof Promise, 'Promise.resolve(object) must return a Bluebird Promise');
assert.deepStrictEqual(await pObj, { key: 'value' }, 'Promise.resolve(object) must resolve to deep equal object');
}
// 3. Resolving undefined / no argument
{
const pUndefined = Promise.resolve();
assert.ok(pUndefined instanceof Promise, 'Promise.resolve() must return a Bluebird Promise');
assert.strictEqual(await pUndefined, undefined, 'Promise.resolve() without args must resolve to undefined');
const pExplicitUndefined = Promise.resolve(undefined);
assert.ok(pExplicitUndefined instanceof Promise, 'Promise.resolve(undefined) must return a Bluebird Promise');
assert.strictEqual(await pExplicitUndefined, undefined, 'Promise.resolve(undefined) must resolve to undefined');
}
// 4. Identity when given an existing Bluebird Promise
{
const original = new Promise((resolve) => resolve('sample'));
const resolved = Promise.resolve(original);
assert.strictEqual(resolved, original, 'Promise.resolve must return the exact same instance if given a Bluebird Promise');
assert.strictEqual(await resolved, 'sample', 'resolved promise must yield the expected value');
}
// 5. Unwrapping / assimilating native promises and foreign thenables
{
// Native Promise
const nativePromise = global.Promise.resolve('from native');
const assimilatedNative = Promise.resolve(nativePromise);
assert.ok(assimilatedNative instanceof Promise, 'assimilated native promise must be an instance of Bluebird Promise');
assert.notStrictEqual(assimilatedNative, nativePromise, 'assimilated native promise must not be identical to native promise');
assert.strictEqual(await assimilatedNative, 'from native', 'assimilated native promise must resolve with native resolved value');
// Custom thenable
let thenCalled = false;
const customThenable = {
then(onFulfilled) {
thenCalled = true;
onFulfilled('from custom thenable');
}
};
const assimilatedThenable = Promise.resolve(customThenable);
assert.ok(assimilatedThenable instanceof Promise, 'assimilated thenable must be a Bluebird Promise');
assert.strictEqual(await assimilatedThenable, 'from custom thenable', 'assimilated thenable must resolve with thenable value');
assert.strictEqual(thenCalled, true, 'then method must have been invoked');
}
// 6. Propagation of errors and rejections from thenables
{
// Rejected native promise
const rejectedNative = global.Promise.reject(new Error('native failure'));
await assert.rejects(
async () => {
await Promise.resolve(rejectedNative);
},
{
name: 'Error',
message: 'native failure'
},
'Promise.resolve must propagate native rejection'
);
// Rejected custom thenable
const rejectedThenable = {
then(onFulfilled, onRejected) {
onRejected(new Error('thenable rejection'));
}
};
await assert.rejects(
async () => {
await Promise.resolve(rejectedThenable);
},
{
name: 'Error',
message: 'thenable rejection'
},
'Promise.resolve must propagate custom thenable rejection'
);
// Exception thrown in then method
const throwingThenable = {
then() {
throw new Error('thrown from thenable');
}
};
await assert.rejects(
async () => {
await Promise.resolve(throwingThenable);
},
{
name: 'Error',
message: 'thrown from thenable'
},
'Promise.resolve must propagate thrown exceptions during thenable assimilation'
);
}
// 7. Synchronous inspection capabilities on resolved Bluebird Promise
{
const syncP = Promise.resolve('inspection-test');
assert.strictEqual(syncP.isFulfilled(), true, 'synchronously resolved promise should be fulfilled');
assert.strictEqual(syncP.isPending(), false, 'synchronously resolved promise should not be pending');
assert.strictEqual(syncP.isRejected(), false, 'synchronously resolved promise should not be rejected');
assert.strictEqual(syncP.value(), 'inspection-test', 'synchronously resolved promise value() returns payload');
}
// 8. Helper functions verification
{
const single = await resolveValue(999);
assert.strictEqual(single, 999, 'resolveValue helper should resolve single value');
const multi = await Promise.all(resolveAll([1, 2, 3]));
assert.deepStrictEqual(multi, [1, 2, 3], 'resolveAll helper should resolve all values');
const thenable = { then(res) { res('assimilated'); } };
const assimilated = await assimilateThenable(thenable);
assert.strictEqual(assimilated, 'assimilated', 'assimilateThenable helper should unwrap thenable');
}
console.log('All bluebird.resolve contract assertions passed.');
}
testAll().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
오리진 시더
익명