Пример
fast-uri 3.1.4: serialize
Проверенный пример — npm fast-uri 3.1.4: serialize. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: fastUri.serialize serializes complete…
sha256:81173c994bf36436208baf9b6aeb30e62354369848dffe49a8ff20c11d9b12c9
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
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-09-17 |
Кейс
HOW- Цель
- verify fast-uri.serialize in pkg:npm/fast-uri@3.1.4
- Пакеты
- Символы
-
- fast-uri.serialize
- Создан
- 2026-09-17T04:09:29Z
Контракт
- fastUri.serialize serializes complete URIComponent with scheme, host, port, path, query and fragment
- fastUri.serialize serializes minimal hierarchical URI components
- fastUri.serialize serializes relative URI references and query-only or fragment-only components
- fastUri.serialize formats IPv6 host references with brackets
- fastUri.serialize percent-encodes illegal path characters according to RFC 3986
- fastUri.serialize round-trips parsed URI strings through parse and serialize
- fastUri.serialize handles empty component by returning empty string
Файлы
- 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 fast-uri.serialize in pkg:npm/fast-uri@3.1.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/fast-uri@3.1.4
Demonstrate these symbols/APIs:
- fast-uri.serialize
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:c2801b6c49607e20fcfad9042979edbef7ccce0acb2a9fb1aef5f184b1e951a7","contract":["fastUri.serialize serializes complete URIComponent with scheme, host, port, path, query and fragment","fastUri.serialize serializes minimal hierarchical URI components","fastUri.serialize serializes relative URI references and query-only or fragment-only components","fastUri.serialize formats IPv6 host references with brackets","fastUri.serialize percent-encodes illegal path characters according to RFC 3986","fastUri.serialize round-trips parsed URI strings through parse and serialize","fastUri.serialize handles empty component by returning empty string"],"goal":"verify fast-uri.serialize in pkg:npm/fast-uri@3.1.4","kind":"HOW","packages":["pkg:npm/fast-uri@3.1.4"],"schemaVersion":1,"symbols":["fast-uri.serialize"]},"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.4"],"schemaVersion":1,"subject":"pkg:npm/fast-uri@3.1.4","symbols":["fast-uri.serialize"],"verifierAdapter":"node-typescript@1"}
const fastUri = require('fast-uri');
/**
* Serializes a parsed URIComponent object into an RFC 3986 URI string.
*
* @param {Object} component - Parsed URI component object.
* @param {Object} [options] - Optional serialization options.
* @returns {string} The serialized URI string.
*/
function serializeUri(component, options) {
return fastUri.serialize(component, options);
}
module.exports = {
serializeUri,
serialize: fastUri.serialize,
fastUri,
};
{
"name": "fast-uri-serialize-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "fast-uri-serialize-verification",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"fast-uri": "3.1.4"
}
},
"node_modules/fast-uri": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.4.tgz",
"integrity": "sha512-8JnbkQ4juDyvYs4mgFGQqg4yCYtFDtUtmp2QIQq11ZZe5CFQ5wcqm1rqDgAh/QdMySuBnPzMUiJUNZG5N/AiQw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "BSD-3-Clause"
}
}
}
{
"name": "fast-uri-serialize-verification",
"version": "1.0.0",
"description": "Clean-room verification of fast-uri.serialize in pkg:npm/fast-uri@3.1.4",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"fast-uri": "3.1.4"
}
}
{
"schemaVersion": 1,
"goal": "verify fast-uri.serialize in pkg:npm/fast-uri@3.1.4",
"kind": "HOW",
"packages": [
"pkg:npm/fast-uri@3.1.4"
],
"symbols": [
"fast-uri.serialize"
]
}
import assert from 'node:assert';
import fastUri from 'fast-uri';
import { serializeUri, serialize } from '../index.js';
// 1. fastUri.serialize serializes complete URIComponent with scheme, host, port, path, query and fragment
const fullUri = fastUri.serialize({
scheme: 'https',
host: 'example.com',
port: 8080,
path: '/api/v1/resource',
query: 'key=value&foo=bar',
fragment: 'section1'
});
assert.strictEqual(
fullUri,
'https://example.com:8080/api/v1/resource?key=value&foo=bar#section1',
'fastUri.serialize serializes complete URIComponent with scheme, host, port, path, query and fragment'
);
assert.strictEqual(
serializeUri({
scheme: 'https',
host: 'example.com',
port: 8080,
path: '/api/v1/resource',
query: 'key=value&foo=bar',
fragment: 'section1'
}),
fullUri
);
// 2. fastUri.serialize serializes minimal hierarchical URI components
const minimalUri = fastUri.serialize({
scheme: 'http',
host: 'example.com',
path: '/test'
});
assert.strictEqual(
minimalUri,
'http://example.com/test',
'fastUri.serialize serializes minimal hierarchical URI components'
);
// 3. fastUri.serialize serializes relative URI references and query-only or fragment-only components
const relUri = fastUri.serialize({ path: 'foo/bar' });
assert.strictEqual(
relUri,
'foo/bar',
'fastUri.serialize serializes relative URI references'
);
const queryFrag = fastUri.serialize({ query: 'q=search', fragment: 'top' });
assert.strictEqual(
queryFrag,
'?q=search#top',
'fastUri.serialize serializes query-only or fragment-only components'
);
// 4. fastUri.serialize formats IPv6 host references with brackets
const ipv6Uri = fastUri.serialize({ scheme: 'http', host: '::1', port: 8080, path: '/' });
assert.strictEqual(
ipv6Uri,
'http://[::1]:8080/',
'fastUri.serialize formats IPv6 host references with brackets'
);
// 5. fastUri.serialize percent-encodes illegal path characters according to RFC 3986
const encodedUri = fastUri.serialize({ scheme: 'http', host: 'example.com', path: '/hello world' });
assert.strictEqual(
encodedUri,
'http://example.com/hello%20world',
'fastUri.serialize percent-encodes illegal path characters according to RFC 3986'
);
// 6. fastUri.serialize round-trips parsed URI strings through parse and serialize
const original = 'https://example.com:8443/items?limit=10#details';
const roundTrip = fastUri.serialize(fastUri.parse(original));
assert.strictEqual(
roundTrip,
original,
'fastUri.serialize round-trips parsed URI strings through parse and serialize'
);
// 7. fastUri.serialize handles empty component by returning empty string
assert.strictEqual(
fastUri.serialize({}),
'',
'fastUri.serialize handles empty component by returning empty string'
);
console.log('Contract passed');
Исходный сидер
аноним