{"id":49410,"library":"sp-schema","title":"Streamplace Schema (sp-schema)","description":"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.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install sp-schema","lang":"bash","label":"npm"},{"cmd":"yarn add sp-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add sp-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CJS require() will fail.","wrong":"const Manifest = require('sp-schema').Manifest","symbol":"Manifest","correct":"import { Manifest } from 'sp-schema'"},{"note":"Type-only import is preferred for runtime efficiency.","wrong":"import { StreamMetadata } from 'sp-schema'","symbol":"StreamMetadata","correct":"import type { StreamMetadata } from 'sp-schema'"},{"note":"Default export is the main schema object.","wrong":"import { default as schema } from 'sp-schema'","symbol":"default (schema object)","correct":"import schema from 'sp-schema'"}],"quickstart":{"code":"import schema from 'sp-schema';\n\n// Access a specific schema definition\nconst manifestSchema = schema.definitions.Manifest;\n\n// Use with a JSON Schema validator\nimport Ajv from 'ajv';\nconst ajv = new Ajv();\nconst validate = ajv.compile(manifestSchema);\n\nconst manifest = {\n  streamId: 'abc123',\n  segments: [{ duration: 10, uri: 'seg-001.ts' }]\n};\n\nif (validate(manifest)) {\n  console.log('Valid manifest');\n} else {\n  console.error('Invalid:', validate.errors);\n}","lang":"typescript","description":"Shows importing the default schema object, accessing a specific definition, and validating data with Ajv."},"warnings":[{"fix":"Pin to exact version and expect to update frequently.","message":"This package is pre-1.0 and API may change without major version bump.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use import syntax or set { type: 'module' } in your package.json.","message":"Package uses ESM only; CommonJS require() will throw an error.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Use `Manifest` instead of `StreamManifest`.","message":"The `Manifest` type was renamed in v0.2.0 from `StreamManifest`.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Use `import { Manifest } from 'sp-schema'` for the TypeScript type.","message":"Default export is the schema object, not a single type; if you need a specific type, import it as a named export.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"search_vec":"'api':60 'cadenc':35 'chang':65 'consum':49 'core':38 'data':39 'defin':37 'definit':16 'earli':25 'early-stag':24 'general':57 'intend':55 'intern':29 'javascript':68 'json':14 'manifest':44 'may':64 'messag':47 'metadata':43 'network':46 'notic':67 'packag':27,53 'primarili':48 'protocol':20 'provid':10 'public':58 'publish':21 'regular':33 'releas':34 'schema':2,5,8,15 'sp':4,7 'sp-schema':3,6 'stage':26 'stream':42 'streamplac':1,19,52 'structur':40 'type':12 'typescript':11 'unstabl':62 'use':30,59 'v0.2.0':9 'without':66","created_at":"2026-06-07T17:01:38.681700+00:00","updated_at":"2026-06-07T17:01:38.681700+00:00","problems":[{"fix":"Switch to ESM (use import) or dynamic import: const spSchema = await import('sp-schema');","cause":"Package is ESM-only but consuming code uses CommonJS require().","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/sp-schema/index.js from /path/to/file.js not supported."},{"fix":"Access properties directly: spSchema.SomeType instead of spSchema().","cause":"Default export is an object, not a function; code expects a function call.","error":"TypeError: sp_schema_1.default is not a function"},{"fix":"Ensure sp-schema is installed and check if types are included. If not, declare module: declare module 'sp-schema';","cause":"TypeScript cannot resolve types; @types/sp-schema is missing or package.json types field incorrect.","error":"Cannot find module 'sp-schema' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"sp-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}