CodeSampleX

Ejemplo

fast-uri 3.1.9: parse

Muestra verificada para npm fast-uri 3.1.9: parse. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó: fastUri.parse extracts scheme, host…

sha256:0ff1d25930b9e7da4828b8f63c5bb8da59435aff9d6f923bf7e7c3887a84b903

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 linux 24 · ubuntu · glibc 2.39 x64 npm

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-10-21

Caso

HOW
Objetivo
verify fast-uri.parse in pkg:npm/fast-uri@3.1.9
Paquetes
Símbolos
  • fast-uri.parse
Creado
2026-10-21T04:58:48Z

Contrato

  1. fastUri.parse extracts scheme, host, port, path, query, and fragment from an absolute URI
  2. fastUri.parse extracts userinfo and host from network-path authority
  3. fastUri.parse parses relative path and query without scheme or host
  4. fastUri.parse parses IPv6 host and port
  5. fastUri.parse parses URN scheme with nid and nss
  6. fastUri.parse parses URN UUID scheme with uuid property
  7. fastUri.parse parses empty string as same-document reference with empty path
  8. fastUri.parse sets error property on malformed URI authority

Archivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Descargar el artefacto de código fuente (tar.gz)

Código fuente

PROMPT.md
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 fast-uri.parse in pkg:npm/fast-uri@3.1.9
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/fast-uri@3.1.9
Demonstrate these symbols/APIs:
  - fast-uri.parse

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.
csx.json
{"case":{"caseId":"case:sha256:4d0398b08984496abb031934933f79b814feea95c1da6bed1777d35f5104f8ed","contract":["fastUri.parse extracts scheme, host, port, path, query, and fragment from an absolute URI","fastUri.parse extracts userinfo and host from network-path authority","fastUri.parse parses relative path and query without scheme or host","fastUri.parse parses IPv6 host and port","fastUri.parse parses URN scheme with nid and nss","fastUri.parse parses URN UUID scheme with uuid property","fastUri.parse parses empty string as same-document reference with empty path","fastUri.parse sets error property on malformed URI authority"],"goal":"verify fast-uri.parse in pkg:npm/fast-uri@3.1.9","kind":"HOW","packages":["pkg:npm/fast-uri@3.1.9"],"schemaVersion":1,"symbols":["fast-uri.parse"]},"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/fast-uri@3.1.9"],"schemaVersion":1,"subject":"pkg:npm/fast-uri@3.1.9","symbols":["fast-uri.parse"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "fast-uri-parse-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "fast-uri-parse-verification",
      "version": "1.0.0",
      "dependencies": {
        "fast-uri": "3.1.9"
      }
    },
    "node_modules/fast-uri": {
      "version": "3.1.9",
      "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
      "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
      "funding": [
        {
          "type": "github",
          "url": "https://github.com/sponsors/fastify"
        },
        {
          "type": "opencollective",
          "url": "https://opencollective.com/fastify"
        }
      ],
      "license": "BSD-3-Clause"
    }
  }
}
package.json
{
  "name": "fast-uri-parse-verification",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of fast-uri.parse",
  "dependencies": {
    "fast-uri": "3.1.9"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify fast-uri.parse in pkg:npm/fast-uri@3.1.9",
  "kind": "HOW",
  "packages": [
    "pkg:npm/fast-uri@3.1.9"
  ],
  "symbols": [
    "fast-uri.parse"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import uri from 'fast-uri';

// 1. fastUri.parse extracts scheme, host, port, path, query, and fragment from an absolute URI
const full = uri.parse('https://example.com:8080/api/v1/resource?filter=active&sort=desc#section-2');
assert.strictEqual(full.scheme, 'https');
assert.strictEqual(full.host, 'example.com');
assert.strictEqual(full.port, 8080);
assert.strictEqual(full.path, '/api/v1/resource');
assert.strictEqual(full.query, 'filter=active&sort=desc');
assert.strictEqual(full.fragment, 'section-2');
assert.strictEqual(full.reference, 'uri');

// 2. fastUri.parse extracts userinfo and host from network-path authority
const auth = uri.parse('//user:info@example.com/assets/app.js');
assert.strictEqual(auth.scheme, undefined);
assert.strictEqual(auth.userinfo, 'user:info');
assert.strictEqual(auth.host, 'example.com');
assert.strictEqual(auth.path, '/assets/app.js');
assert.strictEqual(auth.reference, 'relative');

// 3. fastUri.parse parses relative path and query without scheme or host
const rel = uri.parse('/search?q=test#top');
assert.strictEqual(rel.scheme, undefined);
assert.strictEqual(rel.userinfo, undefined);
assert.strictEqual(rel.host, undefined);
assert.strictEqual(rel.port, undefined);
assert.strictEqual(rel.path, '/search');
assert.strictEqual(rel.query, 'q=test');
assert.strictEqual(rel.fragment, 'top');
assert.strictEqual(rel.reference, 'relative');

// 4. fastUri.parse parses IPv6 host and port
const v6 = uri.parse('http://[2001:db8::1]:8080/status');
assert.strictEqual(v6.scheme, 'http');
assert.strictEqual(v6.host, '2001:db8::1');
assert.strictEqual(v6.port, 8080);
assert.strictEqual(v6.path, '/status');

// 5. fastUri.parse parses URN scheme with nid and nss
const urn = uri.parse('urn:isbn:0451450523');
assert.strictEqual(urn.scheme, 'urn');
assert.strictEqual(urn.nid, 'isbn');
assert.strictEqual(urn.nss, '0451450523');
assert.strictEqual(urn.reference, 'absolute');

// 6. fastUri.parse parses URN UUID scheme with uuid property
const uuidUrn = uri.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6');
assert.strictEqual(uuidUrn.scheme, 'urn');
assert.strictEqual(uuidUrn.nid, 'uuid');
assert.strictEqual(uuidUrn.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6');

// 7. fastUri.parse parses empty string as same-document reference with empty path
const empty = uri.parse('');
assert.strictEqual(empty.scheme, undefined);
assert.strictEqual(empty.path, '');
assert.strictEqual(empty.reference, 'same-document');

// 8. fastUri.parse sets error property on malformed URI authority
const malformed = uri.parse('http://example.com:notaport/');
assert.strictEqual(typeof malformed.error, 'string');
assert.ok(malformed.error.length > 0);

console.log('Contract passed');

Seeder de origen

anónimo