Registry / storage / sp-schema

sp-schema

JSON →
library0.2.0jsnpmunverified

sp-schema v0.2.0 provides TypeScript types and JSON Schema definitions for the Streamplace protocol. Published as an early-stage package for internal use, with no regular release cadence. It defines core data structures for stream metadata, manifests, and network messages. Primarily consumed by other Streamplace packages. Not intended for general public use; API is unstable and may change without notice.

npm install sp-schema
INSTALL
IMPORT
SIG · SP-SCHEMA
S
sp-schema
storagejavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Manifest
✓ import { Manifest } from 'sp-schema'
✗ const Manifest = require('sp-schema').Manifest
Package is ESM-only; CJS require() will fail.
StreamMetadata
✓ import type { StreamMetadata } from 'sp-schema'
✗ import { StreamMetadata } from 'sp-schema'
Type-only import is preferred for runtime efficiency.
default (schema object)
✓ import schema from 'sp-schema'
✗ import { default as schema } from 'sp-schema'
Default export is the main schema object.

Shows importing the default schema object, accessing a specific definition, and validating data with Ajv.

import schema from 'sp-schema'; // Access a specific schema definition const manifestSchema = schema.definitions.Manifest; // Use with a JSON Schema validator import Ajv from 'ajv'; const ajv = new Ajv(); const validate = ajv.compile(manifestSchema); const manifest = { streamId: 'abc123', segments: [{ duration: 10, uri: 'seg-001.ts' }] }; if (validate(manifest)) { console.log('Valid manifest'); } else { console.error('Invalid:', validate.errors); }
Debug
Known issues
breakingThis package is pre-1.0 and API may change without major version bump.
fix
Pin to exact version and expect to update frequently.
affects: <1.0.0
gotchaPackage uses ESM only; CommonJS require() will throw an error.
fix
Use import syntax or set { type: 'module' } in your package.json.
affects: >=0.2.0
deprecatedThe `Manifest` type was renamed in v0.2.0 from `StreamManifest`.
fix
Use `Manifest` instead of `StreamManifest`.
affects: >=0.2.0
gotchaDefault export is the schema object, not a single type; if you need a specific type, import it as a named export.
fix
Use `import { Manifest } from 'sp-schema'` for the TypeScript type.
affects: >=0.2.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/sp-schema/index.js from /path/to/file.js not supported.
Package is ESM-only but consuming code uses CommonJS require().
fix
Switch to ESM (use import) or dynamic import: const spSchema = await import('sp-schema');
TypeError: sp_schema_1.default is not a function
Default export is an object, not a function; code expects a function call.
fix
Access properties directly: spSchema.SomeType instead of spSchema().
Cannot find module 'sp-schema' or its corresponding type declarations.
TypeScript cannot resolve types; @types/sp-schema is missing or package.json types field incorrect.
fix
Ensure sp-schema is installed and check if types are included. If not, declare module: declare module 'sp-schema';
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
sp-schema — npm install sp-schema · libregistry