サンプル
statuses 2.0.1: message
検証済みサンプル — npm statuses 2.0.1: message. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: statuses.message is an object mapping HTTP status codes…
sha256:4fb3b990b20c43e8af39803f882451455036a608fe31c852c25711448a4826ad
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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 statuses.message in pkg:npm/statuses@2.0.1
- パッケージ
- シンボル
-
- statuses.message
- 環境
- node 22.23.2
- 作成日
- 2026-09-06T20:39:41Z
コントラクト
- statuses.message is an object mapping HTTP status codes to standard message strings
- statuses.message allows lookup by numeric status code or string representation
- statuses.message maps informational 1xx status codes to messages
- statuses.message maps successful 2xx status codes to messages
- statuses.message maps redirection 3xx status codes to messages
- statuses.message maps client error 4xx status codes to messages
- statuses.message maps server error 5xx status codes to messages
- statuses.message returns undefined for unknown or unassigned status codes
- every entry in statuses.message has a status code key and a non-empty string message
ファイル
- PROMPT.md
- csx.json
- index.js
- 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 statuses.message in pkg:npm/statuses@2.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/statuses@2.0.1
Demonstrate these symbols/APIs:
- statuses.message
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:871bc2755e86a0a9c3ed1f57dde1787fc0929228e4edd9075af33bd00038fee3","constraints":{"executionContext":"node"},"contract":["statuses.message is an object mapping HTTP status codes to standard message strings","statuses.message allows lookup by numeric status code or string representation","statuses.message maps informational 1xx status codes to messages","statuses.message maps successful 2xx status codes to messages","statuses.message maps redirection 3xx status codes to messages","statuses.message maps client error 4xx status codes to messages","statuses.message maps server error 5xx status codes to messages","statuses.message returns undefined for unknown or unassigned status codes","every entry in statuses.message has a status code key and a non-empty string message"],"goal":"verify statuses.message in pkg:npm/statuses@2.0.1","kind":"HOW","packages":["pkg:npm/statuses@2.0.1"],"schemaVersion":1,"symbols":["statuses.message"]},"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/statuses@2.0.1"],"schemaVersion":1,"subject":"pkg:npm/statuses@2.0.1","symbols":["statuses.message"],"verifierAdapter":"node-typescript@1"}
const statuses = require('statuses');
/**
* Direct reference to the status code to message map.
*/
const message = statuses.message;
/**
* Retrieve status message by numeric or string status code.
* @param {number|string} code
* @returns {string|undefined}
*/
function getStatusMessage(code) {
if (typeof code !== 'number' && typeof code !== 'string') {
return undefined;
}
return message[code];
}
/**
* Check whether a status code exists in statuses.message.
* @param {number|string} code
* @returns {boolean}
*/
function hasStatusCode(code) {
if (typeof code !== 'number' && typeof code !== 'string') {
return false;
}
return Object.prototype.hasOwnProperty.call(message, code);
}
module.exports = {
statuses,
message,
getStatusMessage,
hasStatusCode,
};
{
"name": "sample-statuses-message",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-statuses-message",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"statuses": "2.0.1"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
}
}
}
{
"name": "sample-statuses-message",
"version": "1.0.0",
"description": "Minimal clean-room sample verifying statuses.message in statuses",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"statuses": "2.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify statuses.message in pkg:npm/statuses@2.0.1",
"kind": "HOW",
"packages": [
"pkg:npm/statuses@2.0.1"
],
"symbols": [
"statuses.message"
]
}
import assert from 'node:assert';
import statuses from 'statuses';
import {
message,
getStatusMessage,
hasStatusCode,
} from '../index.js';
// 1. statuses.message is an object mapping HTTP status codes to standard message strings
assert.strictEqual(typeof statuses.message, 'object', 'statuses.message must be an object');
assert.strictEqual(message, statuses.message, 'exported message must reference statuses.message');
assert.strictEqual(statuses.message[200], 'OK', 'statuses.message[200] must be "OK"');
assert.strictEqual(statuses.message[404], 'Not Found', 'statuses.message[404] must be "Not Found"');
assert.strictEqual(getStatusMessage(200), 'OK', 'getStatusMessage(200) must return "OK"');
// 2. statuses.message allows lookup by numeric status code or string representation
assert.strictEqual(statuses.message[200], 'OK', 'numeric lookup 200 must be "OK"');
assert.strictEqual(statuses.message['200'], 'OK', 'string lookup "200" must be "OK"');
assert.strictEqual(getStatusMessage('404'), 'Not Found', 'getStatusMessage("404") must return "Not Found"');
assert.strictEqual(hasStatusCode(200), true, 'hasStatusCode(200) must be true');
assert.strictEqual(hasStatusCode('200'), true, 'hasStatusCode("200") must be true');
assert.strictEqual(hasStatusCode(999), false, 'hasStatusCode(999) must be false');
// 3. statuses.message maps informational 1xx status codes to messages
assert.strictEqual(statuses.message[100], 'Continue', '100 must map to Continue');
assert.strictEqual(statuses.message[101], 'Switching Protocols', '101 must map to Switching Protocols');
// 4. statuses.message maps successful 2xx status codes to messages
assert.strictEqual(statuses.message[200], 'OK', '200 must map to OK');
assert.strictEqual(statuses.message[201], 'Created', '201 must map to Created');
assert.strictEqual(statuses.message[202], 'Accepted', '202 must map to Accepted');
assert.strictEqual(statuses.message[204], 'No Content', '204 must map to No Content');
// 5. statuses.message maps redirection 3xx status codes to messages
assert.strictEqual(statuses.message[300], 'Multiple Choices', '300 must map to Multiple Choices');
assert.strictEqual(statuses.message[301], 'Moved Permanently', '301 must map to Moved Permanently');
assert.strictEqual(statuses.message[302], 'Found', '302 must map to Found');
assert.strictEqual(statuses.message[303], 'See Other', '303 must map to See Other');
assert.strictEqual(statuses.message[304], 'Not Modified', '304 must map to Not Modified');
// 6. statuses.message maps client error 4xx status codes to messages
assert.strictEqual(statuses.message[400], 'Bad Request', '400 must map to Bad Request');
assert.strictEqual(statuses.message[401], 'Unauthorized', '401 must map to Unauthorized');
assert.strictEqual(statuses.message[403], 'Forbidden', '403 must map to Forbidden');
assert.strictEqual(statuses.message[404], 'Not Found', '404 must map to Not Found');
assert.strictEqual(statuses.message[405], 'Method Not Allowed', '405 must map to Method Not Allowed');
// 7. statuses.message maps server error 5xx status codes to messages
assert.strictEqual(statuses.message[500], 'Internal Server Error', '500 must map to Internal Server Error');
assert.strictEqual(statuses.message[501], 'Not Implemented', '501 must map to Not Implemented');
assert.strictEqual(statuses.message[502], 'Bad Gateway', '502 must map to Bad Gateway');
assert.strictEqual(statuses.message[503], 'Service Unavailable', '503 must map to Service Unavailable');
assert.strictEqual(statuses.message[504], 'Gateway Timeout', '504 must map to Gateway Timeout');
// 8. statuses.message returns undefined for unknown or unassigned status codes
assert.strictEqual(statuses.message[999], undefined, 'code 999 must return undefined');
assert.strictEqual(statuses.message['999'], undefined, 'string "999" must return undefined');
assert.strictEqual(getStatusMessage(1234), undefined, 'getStatusMessage(1234) must return undefined');
// 9. every entry in statuses.message has a status code key and a non-empty string message
const entries = Object.entries(statuses.message);
assert(entries.length > 0, 'statuses.message must contain entries');
for (const [codeStr, msg] of entries) {
const codeNum = Number(codeStr);
assert(Number.isInteger(codeNum), `Key "${codeStr}" must be a numeric status code`);
assert(codeNum >= 100 && codeNum <= 599, `Status code ${codeNum} must be in range 100-599`);
assert.strictEqual(typeof msg, 'string', `Message for ${codeNum} must be a string`);
assert(msg.length > 0, `Message for ${codeNum} must not be empty`);
}
console.log('All statuses.message contract assertions passed.');
オリジンシーダー
匿名