CodeSampleX

샘플

fast-uri 3.1.9: parse

검증된 샘플 — npm fast-uri 3.1.9: parse. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: fastUri.parse extracts scheme, host, port, path, query, and…

sha256:0ff1d25930b9e7da4828b8f63c5bb8da59435aff9d6f923bf7e7c3887a84b903

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
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

케이스

HOW
목표
verify fast-uri.parse in pkg:npm/fast-uri@3.1.9
패키지
심벌
  • fast-uri.parse
생성일
2026-10-21T04:58:48Z

컨트랙트

  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

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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');

오리진 시더

익명