Ejemplo
@sinclair/typebox 0.27.12: Type.Object
Muestra verificada para npm @sinclair/typebox 0.27.12: Type.Object. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:6d62719ce9a80eb4bcd72ad0dc44b631f001053e01726b959f0cf11940c97c54
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12
- Paquetes
- Símbolos
-
- Type.Object
- Entorno
- node 22.23.2
- Creado
- 2026-09-02T14:30:05Z
Contrato
- Type.Object creates an object schema with properties and required list
- Type.Object excludes optional properties from the required list
- Type.Object supports additionalProperties constraint option
- Type.Object supports schema metadata options including title and description
- Type.Object supports nested object schema compositions
Archivos
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Código fuente
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 Type.Object in pkg:npm/%40sinclair/typebox@0.27.12
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40sinclair/typebox@0.27.12
Demonstrate these symbols/APIs:
- Type.Object
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:e679dcece10406afdfacfc448d6f6fbf9166c1c07b74d798f2088b39301c4aa3","constraints":{"executionContext":"node"},"contract":["Type.Object creates an object schema with properties and required list","Type.Object excludes optional properties from the required list","Type.Object supports additionalProperties constraint option","Type.Object supports schema metadata options including title and description","Type.Object supports nested object schema compositions"],"goal":"verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12","kind":"HOW","packages":["pkg:npm/%40sinclair/typebox@0.27.12"],"schemaVersion":1,"symbols":["Type.Object"]},"contractCommand":["node","test/contract.cjs"],"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/%40sinclair/typebox@0.27.12"],"schemaVersion":1,"subject":"pkg:npm/%40sinclair/typebox@0.27.12","symbols":["Type.Object"],"verifierAdapter":"node-typescript@1"}
const { Type } = require('@sinclair/typebox');
/**
* Creates an object schema representing a user profile with nested settings.
*/
function createUserSchema(options = {}) {
return Type.Object(
{
id: Type.Number({ minimum: 1 }),
username: Type.String({ minLength: 3 }),
bio: Type.Optional(Type.String()),
settings: Type.Object({
theme: Type.String(),
notifications: Type.Boolean()
})
},
options
);
}
module.exports = {
Type,
createUserSchema
};
{
"name": "sample-typebox-object",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-typebox-object",
"version": "1.0.0",
"dependencies": {
"@sinclair/typebox": "0.27.12"
}
},
"node_modules/@sinclair/typebox": {
"version": "0.27.12",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.12.tgz",
"integrity": "sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g==",
"license": "MIT"
}
}
}
{
"name": "sample-typebox-object",
"version": "1.0.0",
"private": true,
"description": "Clean-room sample verifying Type.Object in @sinclair/typebox@0.27.12",
"main": "index.js",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"@sinclair/typebox": "0.27.12"
}
}
{
"schemaVersion": 1,
"goal": "verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12",
"kind": "HOW",
"packages": [
"pkg:npm/%40sinclair/typebox@0.27.12"
],
"symbols": [
"Type.Object"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const assert = require('node:assert');
const { Type, createUserSchema } = require('../index.js');
// Assertion 1: Type.Object creates an object schema with properties and required list
const baseObject = Type.Object({
id: Type.Number(),
name: Type.String()
});
assert.strictEqual(baseObject.type, 'object');
assert.ok(baseObject.properties.id);
assert.strictEqual(baseObject.properties.id.type, 'number');
assert.ok(baseObject.properties.name);
assert.strictEqual(baseObject.properties.name.type, 'string');
assert.deepStrictEqual(baseObject.required, ['id', 'name']);
// Assertion 2: Type.Object excludes optional properties from the required list
const objectWithOptional = Type.Object({
id: Type.Number(),
nickname: Type.Optional(Type.String())
});
assert.strictEqual(objectWithOptional.type, 'object');
assert.ok(objectWithOptional.properties.nickname);
assert.deepStrictEqual(objectWithOptional.required, ['id']);
// Assertion 3: Type.Object supports additionalProperties constraint option
const closedObject = Type.Object(
{
key: Type.String()
},
{ additionalProperties: false }
);
assert.strictEqual(closedObject.type, 'object');
assert.strictEqual(closedObject.additionalProperties, false);
// Assertion 4: Type.Object supports schema metadata options including title and description
const documentedObject = Type.Object(
{
title: Type.String()
},
{
title: 'DocumentedEntity',
description: 'An entity with documentation metadata'
}
);
assert.strictEqual(documentedObject.type, 'object');
assert.strictEqual(documentedObject.title, 'DocumentedEntity');
assert.strictEqual(documentedObject.description, 'An entity with documentation metadata');
// Assertion 5: Type.Object supports nested object schema compositions
const userSchema = createUserSchema({ additionalProperties: false });
assert.strictEqual(userSchema.type, 'object');
assert.strictEqual(userSchema.additionalProperties, false);
assert.deepStrictEqual(userSchema.required, ['id', 'username', 'settings']);
assert.strictEqual(userSchema.properties.id.type, 'number');
assert.strictEqual(userSchema.properties.username.type, 'string');
assert.strictEqual(userSchema.properties.settings.type, 'object');
assert.deepStrictEqual(userSchema.properties.settings.required, ['theme', 'notifications']);
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo