샘플
tslib 2.9.1: __awaiter
검증된 샘플 — npm tslib 2.9.1: __awaiter. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: require('tslib').__awaiter is exported as a function in…
sha256:8ff69536cb426afd1a6b53f914442d4c591abd31cca6d103e9cc3ff11b9442d0
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-11-28 |
케이스
HOW- 목표
- verify tslib.__awaiter in pkg:npm/tslib@2.9.1
- 패키지
- 심벌
-
- tslib.__awaiter
- 환경
- node 22.23.2
- 생성일
- 2026-11-28T01:05:38Z
컨트랙트
- require('tslib').__awaiter is exported as a function in CommonJS on Node 22
- __awaiter binds thisArg and passes _arguments (defaulting to empty when undefined) while awaiting both plain values and Promises in generator yield order
- __awaiter defaults P to global Promise when undefined and returns an instance of a custom Promise subclass when P is provided, adopting existing P instances directly
- rejected yielded promises are thrown into the generator so try/catch inside the generator can recover and resolve
- uncaught errors thrown before or after a yield and unhandled yielded rejections reject the returned Promise instead of throwing synchronously
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
소스
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 tslib.__awaiter in pkg:npm/tslib@2.9.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/tslib@2.9.1
Demonstrate these symbols/APIs:
- tslib.__awaiter
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:7b96e7f9505a8f5629a3b1fd55bd209007a1c9ad69e66c5848ef96e01143de4c","constraints":{"executionContext":"node"},"contract":["require('tslib').__awaiter is exported as a function in CommonJS on Node 22","__awaiter binds thisArg and passes _arguments (defaulting to empty when undefined) while awaiting both plain values and Promises in generator yield order","__awaiter defaults P to global Promise when undefined and returns an instance of a custom Promise subclass when P is provided, adopting existing P instances directly","rejected yielded promises are thrown into the generator so try/catch inside the generator can recover and resolve","uncaught errors thrown before or after a yield and unhandled yielded rejections reject the returned Promise instead of throwing synchronously"],"goal":"verify tslib.__awaiter in pkg:npm/tslib@2.9.1","kind":"HOW","packages":["pkg:npm/tslib@2.9.1"],"schemaVersion":1,"symbols":["tslib.__awaiter"]},"contractCommand":["node","test/contract.js"],"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/tslib@2.9.1"],"schemaVersion":1,"subject":"pkg:npm/tslib@2.9.1","symbols":["tslib.__awaiter"],"verifierAdapter":"node-typescript@1"}
{
"name": "tslib-awaiter-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "tslib-awaiter-sample",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"tslib": "2.9.1"
}
},
"node_modules/tslib": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz",
"integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==",
"license": "0BSD"
}
}
}
{
"name": "tslib-awaiter-sample",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"tslib": "2.9.1"
}
}
{
"schemaVersion": 1,
"goal": "verify tslib.__awaiter in pkg:npm/tslib@2.9.1",
"kind": "HOW",
"packages": [
"pkg:npm/tslib@2.9.1"
],
"symbols": [
"tslib.__awaiter"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
"use strict";
const { __awaiter } = require("tslib");
function runSequence(thisArg, args, steps, PromiseCtor) {
return __awaiter(thisArg, args, PromiseCtor, function* () {
const receivedArgs = Array.prototype.slice.call(arguments);
const results = [];
for (const step of steps) {
results.push(yield step());
}
return {
receiver: this,
args: receivedArgs,
results,
};
});
}
function runWithRecovery(promise, fallbackPrefix) {
return __awaiter(void 0, void 0, void 0, function* () {
try {
return yield promise;
} catch (err) {
return `${fallbackPrefix}:${err.message}`;
}
});
}
function runFailingAfterYield(message) {
return __awaiter(void 0, void 0, void 0, function* () {
yield Promise.resolve("ok");
throw new Error(message);
});
}
function runImmediateThrow(message) {
return __awaiter(void 0, void 0, void 0, function* () {
throw new Error(message);
});
}
module.exports = {
runSequence,
runWithRecovery,
runFailingAfterYield,
runImmediateThrow,
};
"use strict";
const assert = require("node:assert/strict");
const tslib = require("tslib");
const {
runSequence,
runWithRecovery,
runFailingAfterYield,
runImmediateThrow,
} = require("../src/index.js");
class TrackedPromise extends Promise {
constructor(executor) {
super(executor);
TrackedPromise.constructions += 1;
}
}
TrackedPromise.constructions = 0;
async function main() {
// 1. CommonJS export check
assert.equal(typeof tslib.__awaiter, "function");
// 2. thisArg binding, _arguments forwarding, and sequential awaiting of plain values and Promises
const receiver = { id: "ctx-1" };
const order = [];
const defaultPromise = runSequence(
receiver,
["alpha", 2],
[
() => {
order.push("plain");
return 10;
},
() =>
new Promise((resolve) => {
setImmediate(() => {
order.push("async");
resolve(20);
});
}),
() => {
order.push("resolved");
return Promise.resolve(30);
},
],
void 0
);
assert.equal(defaultPromise instanceof Promise, true);
assert.equal(defaultPromise instanceof TrackedPromise, false);
const seqResult = await defaultPromise;
assert.equal(seqResult.receiver, receiver);
assert.deepEqual(seqResult.args, ["alpha", 2]);
assert.deepEqual(seqResult.results, [10, 20, 30]);
assert.deepEqual(order, ["plain", "async", "resolved"]);
// 2b. Omitted _arguments defaults to empty argument list
const emptyArgsResult = await runSequence(
receiver,
void 0,
[() => "single"],
void 0
);
assert.equal(emptyArgsResult.receiver, receiver);
assert.deepEqual(emptyArgsResult.args, []);
assert.deepEqual(emptyArgsResult.results, ["single"]);
// 3. Custom Promise constructor P is used and existing instances of P are adopted directly
const existingTracked = TrackedPromise.resolve("already-tracked");
let syncThenCalled = false;
const origThen = existingTracked.then.bind(existingTracked);
existingTracked.then = function (onFulfilled, onRejected) {
syncThenCalled = true;
return origThen(onFulfilled, onRejected);
};
TrackedPromise.constructions = 0;
const adoptedPromise = tslib.__awaiter(
receiver,
void 0,
TrackedPromise,
function* () {
return [this.id, yield existingTracked];
}
);
assert.equal(syncThenCalled, true);
assert.equal(adoptedPromise instanceof TrackedPromise, true);
const adoptedConstructions = TrackedPromise.constructions;
assert.deepEqual(await adoptedPromise, ["ctx-1", "already-tracked"]);
TrackedPromise.constructions = 0;
const wrappedPromise = tslib.__awaiter(
receiver,
void 0,
TrackedPromise,
function* () {
return [this.id, yield "plain-wrapped"];
}
);
assert.equal(wrappedPromise instanceof TrackedPromise, true);
const wrappedConstructions = TrackedPromise.constructions;
assert.deepEqual(await wrappedPromise, ["ctx-1", "plain-wrapped"]);
// Plain value requires one additional TrackedPromise construction in adopt()
assert.equal(wrappedConstructions, adoptedConstructions + 1);
// 4. Rejected yielded promise enters generator catch block for recovery
const recovered = await runWithRecovery(
Promise.reject(new Error("boom")),
"recovered"
);
assert.equal(recovered, "recovered:boom");
// 5. Uncaught throws (after yield and before first yield) and unhandled yielded rejections reject the Promise
let pAfterYield;
assert.doesNotThrow(() => {
pAfterYield = runFailingAfterYield("after-yield");
});
await assert.rejects(pAfterYield, { name: "Error", message: "after-yield" });
let pImmediate;
assert.doesNotThrow(() => {
pImmediate = runImmediateThrow("before-yield");
});
await assert.rejects(pImmediate, { name: "Error", message: "before-yield" });
let pUnhandledYield;
assert.doesNotThrow(() => {
pUnhandledYield = tslib.__awaiter(void 0, void 0, void 0, function* () {
yield Promise.reject(new Error("unhandled-yield"));
});
});
await assert.rejects(pUnhandledYield, {
name: "Error",
message: "unhandled-yield",
});
}
main().catch((err) => {
console.error(err);
process.exitCode = 1;
});
오리진 시더
익명