CodeSampleX

Sample

uri-js 4.4.1

Verified sample for npm uri-js 4.4.1. The contract ran on node 22 · linux alpine/x64 · docker and passed: assert parse extracts components from standard URI…

sha256:98ab030db2b75bbb782ec53eafe131ddcd5b56fcc1a595b28a5849d4a64a42f7

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-26

Case

HOW
Goal
verify pkg:npm/uri-js@4.4.1
Packages
Environment
node 22.23.2
Created
2026-08-26T07:58:23Z

Contract

  1. assert parse extracts components from standard URI, mailto, urn:uuid, and wss schemes
  2. assert serialize formats URI and mailto components into standard strings
  3. assert resolve resolves relative reference against base URI
  4. assert normalize canonicalizes URI and removes dot segments
  5. assert equal compares URIs for equivalence under normalization
  6. assert unicodeSupport parses and serializes IRIs with percent-encoding
  7. assert escapeComponent and unescapeComponent encode and decode URI components

Files

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

Download the source artifact (tar.gz)

Source

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 pkg:npm/uri-js@4.4.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/uri-js@4.4.1

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:f6fcacc42fe00117b58276137b90b4321b4aaf3a4401c04b1027beeedccb8ad5","contract":["assert parse extracts components from standard URI, mailto, urn:uuid, and wss schemes","assert serialize formats URI and mailto components into standard strings","assert resolve resolves relative reference against base URI","assert normalize canonicalizes URI and removes dot segments","assert equal compares URIs for equivalence under normalization","assert unicodeSupport parses and serializes IRIs with percent-encoding","assert escapeComponent and unescapeComponent encode and decode URI components"],"goal":"verify pkg:npm/uri-js@4.4.1","kind":"HOW","packages":["pkg:npm/uri-js@4.4.1"],"schemaVersion":1},"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","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/uri-js@4.4.1"],"schemaVersion":1,"subject":"pkg:npm/uri-js@4.4.1","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-uri-js",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-uri-js",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "uri-js": "4.4.1"
      }
    },
    "node_modules/punycode": {
      "version": "2.3.1",
      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/uri-js": {
      "version": "4.4.1",
      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
      "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "punycode": "^2.1.0"
      }
    }
  }
}
package.json
{
  "name": "sample-uri-js",
  "version": "1.0.0",
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "uri-js": "4.4.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/uri-js@4.4.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/uri-js@4.4.1"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const URI = require('uri-js');

// 1. parse decomposes standard URIs and scheme-specific URIs (mailto, urn:uuid, wss)
const httpParsed = URI.parse('https://example.com:8080/path/to/resource?query=val#fragment');
assert.equal(httpParsed.scheme, 'https');
assert.equal(httpParsed.host, 'example.com');
assert.equal(httpParsed.port, 8080);
assert.equal(httpParsed.path, '/path/to/resource');
assert.equal(httpParsed.query, 'query=val');
assert.equal(httpParsed.fragment, 'fragment');

const mailtoParsed = URI.parse('mailto:alice@example.com,bob@example.com?subject=Meeting&body=Hello');
assert.equal(mailtoParsed.scheme, 'mailto');
assert.deepEqual(mailtoParsed.to, ['alice@example.com', 'bob@example.com']);
assert.equal(mailtoParsed.subject, 'Meeting');
assert.equal(mailtoParsed.body, 'Hello');

const urnParsed = URI.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6');
assert.equal(urnParsed.scheme, 'urn');
assert.equal(urnParsed.nid, 'uuid');
assert.equal(urnParsed.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6');

const wsParsed = URI.parse('wss://example.com:8443/chat?room=general');
assert.equal(wsParsed.scheme, 'wss');
assert.equal(wsParsed.host, 'example.com');
assert.equal(wsParsed.port, 8443);
assert.equal(wsParsed.secure, true);
assert.equal(wsParsed.resourceName, '/chat?room=general');

// 2. serialize builds URI strings from components
const serializedHttp = URI.serialize({
  scheme: 'https',
  host: 'example.com',
  port: 8080,
  path: '/path/to/resource',
  query: 'query=val',
  fragment: 'fragment'
});
assert.equal(serializedHttp, 'https://example.com:8080/path/to/resource?query=val#fragment');

const serializedMailto = URI.serialize({
  scheme: 'mailto',
  to: ['alice@example.com'],
  subject: 'Test',
  body: 'Body'
});
assert.equal(serializedMailto, 'mailto:alice@example.com?subject=Test&body=Body');

// 3. resolve resolves relative URI against base URI
assert.equal(URI.resolve('https://example.com/base/index.html', '../other/page.html'), 'https://example.com/other/page.html');
assert.equal(URI.resolve('https://example.com/a/b/c', '/d'), 'https://example.com/d');

// 4. normalize canonicalizes scheme case and removes dot segments
assert.equal(URI.normalize('HTTP://EXAMPLE.COM:80/a/b/../c'), 'http://example.com/a/c');
assert.equal(URI.removeDotSegments('/a/b/c/./../../g'), '/a/g');

// 5. equal compares URIs for equivalence under normalization
assert.equal(URI.equal('HTTP://EXAMPLE.COM:80/a/c', 'http://example.com/a/c'), true);
assert.equal(URI.equal('https://example.com/a', 'https://example.com/b'), false);

// 6. unicodeSupport parses and serializes IRIs with percent-encoding
const iriParsed = URI.parse('https://example.com/d%C3%B6m%C3%A4in?q=%E2%82%AC', { unicodeSupport: true });
assert.equal(iriParsed.path, '/dömäin');
assert.equal(iriParsed.query, 'q=€');

const iriSerialized = URI.serialize({
  scheme: 'https',
  host: 'example.com',
  path: '/dömäin',
  query: 'q=€'
}, { unicodeSupport: true });
assert.equal(iriSerialized, 'https://example.com/d%C3%B6m%C3%A4in?q=%E2%82%AC');

// 7. escapeComponent and unescapeComponent encode and decode URI components
assert.equal(URI.escapeComponent('foo bar/baz'), 'foo%20bar%2Fbaz');
assert.equal(URI.unescapeComponent('foo%20bar%2Fbaz'), 'foo bar/baz');

Origin Seeder

anonymous