2.4 KiB
Register Schemas — @suaveplan/bitpacker-compressed
(no submodules)
Purpose
Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-compressed package. Exposes registerBitPackerCompressedSchemas(registry) which converts the package's five public boundary schemas into JSON Schema form and registers them under bitpacker:@suaveplan/bitpacker-compressed at version 1. Re-registration on the same registry is a no-op.
The five schemas covered are: bitPackerCompressionOptions (the open-record adapter options), compressionAdapter (the structural contract every adapter implements), compressionConfig (the { algorithm, options, enabled } config), compressedBitPackerOptions (the CompressedBitPacker constructor bundle), and rleCompressionOptions (the RLE-only level knob).
Features
BITPACKER_COMPRESSED_SUBJECTconstant —"bitpacker:@suaveplan/bitpacker-compressed"BITPACKER_COMPRESSED_SCHEMA_VERSIONconstant —1registerBitPackerCompressedSchemas(registry)— idempotent registration
Usage: Basic Example
import { createRegistry } from "@suaveplan/schema-registry";
import {
BITPACKER_COMPRESSED_SUBJECT,
registerBitPackerCompressedSchemas,
} from "@suaveplan/bitpacker-compressed/register-schemas";
const registry = createRegistry();
registerBitPackerCompressedSchemas(registry);
Usage: Advanced Example
import { createRegistry, SchemaRegistry } from "@suaveplan/schema-registry";
import { registerBitPackerSchemas } from "@suaveplan/bitpacker/register-schemas";
import { registerBitPackerCompressedSchemas } from "@suaveplan/bitpacker-compressed/register-schemas";
const registry = createRegistry();
registerBitPackerSchemas(registry);
registerBitPackerCompressedSchemas(registry);
API Reference
BITPACKER_COMPRESSED_SUBJECT: "bitpacker:@suaveplan/bitpacker-compressed"
Const string.
BITPACKER_COMPRESSED_SCHEMA_VERSION: 1
Const number.
registerBitPackerCompressedSchemas(registry: SchemaRegistry): void
Idempotent registration. Returns without writing if the subject is already present.
Implementation Notes
- Five-key payload. One key per public boundary schema.
unrepresentable: "any". Required becausecompressionAdapterandcompressedBitPackerOptionsusez.customfor the structural contract and registry instance check.