• Joined on 2026-07-12

@eyny/contracts (2.1.0)

Published 2026-09-11 14:58:40 +00:00 by admin

Installation

@eyny:registry=https://git.qqww.one/api/packages/admin/npm/
npm install @eyny/contracts@2.1.0
"@eyny/contracts": "2.1.0"

About this package

@eyny/contracts

Versioned Eyny service and storage contracts. Each subpath exports its source document, named Ajv validators, assertion helpers, and TypeScript types.

2.1.0

Adds @eyny/contracts/content-resources and the matching C# Eyny.Contracts.ContentResourceCodec. Existing Web, Worker and Dashboard HTTP contracts remain compatible. The Worker service now lives in Eynyweb; its logical eynyworker identity and worker-v1 responses are unchanged.

Downloads are stored as { "schemaVersion": 1, "groups": [{ "links": [{ "url": "...", "remark": "PC" }] }], "unlinkedRemarks": [] }. Group boundaries and link order are authoritative. A group must have at least one link; remarks can be empty, and even a group whose first remark is empty remains independent. unlinkedRemarks is available only when there are no groups. Images are a JSON array of non-empty, single-line URL strings.

fromLegacyDownloadResources pairs original line positions, removes terminal URL blank lines, fills missing remarks with empty slots, and rejects excess meaningful remarks when links exist. Only this conversion infers groups using the old Worker's trimmed empty/none/无 marker rule. Marker values become empty strings; other remark text is preserved. No-link records retain only meaningful notes in unlinkedRemarks. Embedded blank URL lines are rejected because silently removing them can break pairing.

parseDownloadResources and parseImageUrls strictly validate JSON text, UTF-8 buffers, or decoded values. They never fall back to legacy text or swallow malformed JSON. Download JSON uses the schema in schemas/content-resources-v1.schema.json; parsers remove empty entries in unlinkedRemarks. SQL NULL should be mapped explicitly to an empty resource document or image array by the application.

flattenDownloadResources returns aligned string arrays. toLegacyDownloadResources joins them with LF and retains empty remark positions for old external APIs. This is a compatibility projection: it cannot encode every explicit group boundary and must not be used to reconstruct stored JSON. fromLegacyImageUrls converts legacy image lines. Shared fixtures in fixtures/content-resources/v1-cases.json are exercised by both TypeScript and C# tests.

Build a local consumer artifact with npm pack --workspace @eyny/contracts --pack-destination <directory>. The 2.1.0 migration uses a vendored tarball in Eynyweb; publishing to a registry is a separate action.

2.0.0

Removed Web download-state fields and endpoints, the review request's auditDataSource, and the retired download-store-v1.2 entry point, schema, fixtures and C# models. Review no longer depends on a server download flag. Inherited revisions remain read-only.

The worker-v1 and dashboard contracts were unchanged. The range-download package remains supported for the Worker embedded in Eynyweb and other transfer consumers. The original 2.0.0 removal required coordinated deployment of Web, Audit Client, Builder and Worker, as documented in Eynyweb.

Dependencies

Dependencies

ID Version
ajv ^8.17.1
Details
npm
2026-09-11 14:58:40 +00:00
2
UNLICENSED
45 KiB
Assets (1)
Versions (5) View all
2.2.0 2026-10-15
2.1.0 2026-09-11
2.0.0 2026-09-09
1.1.0 2026-08-11
1.0.0 2026-08-11