Skip to Content
Documentation

songstress/manifest

The manifest's types, its validator and the lists it checks against.

It needs no host: it runs in a terminal, on a server and in a browser. See The manifest.

What it exports is the SDK's own record of its public surface, which the SDK's tests hold to the code. Each type's fields, and every description, are read from the SDK's source when the site is built.

ArtistInfoSource · ArtworkSource · Banner · BooleanSetting · CATEGORIES · CLIENT_HOOKS · Category · ClientHook · Command · Contributes · DownloadSource · Engines · Entry · ExtensionId · HOOK_PERMISSIONS · Hooks · HostPattern · HttpsUrl · Icon · Job · KEYWORD_CODES · Keyword · LISTING_FIELDS · LISTING_LICENSES · LISTING_MIN_SCREENSHOTS · LinkPattern · LinkSource · LocalId · LocalNetworkPermission · LocalTarget · LookupSource · MANIFEST_ERROR_CODES · MANIFEST_FILE · MANIFEST_PROFILES · MANIFEST_SCHEMA · MANIFEST_SCHEMA_ID · MAX_MANIFEST_BYTES · MAX_MANIFEST_DEPTH · MAX_THEME_FILE_BYTES · MENU_LOCATIONS · Manifest · ManifestErrorCode · ManifestIssue · ManifestProfile · ManifestResult · MenuItem · MenuItems · Menus · MetadataSource · NetworkPermission · NumberSetting · PANEL_LOCATIONS · PERMISSIONS · PLATFORMS · PROVIDER_KINDS · Page · Panel · PanelLocation · Permission · Permissions · ProviderKind · Quality · RESERVED_PUBLISHERS · Reason · RecommendSource · Route · SERVER_HOOKS · Screenshot · ScriptPath · SearchSource · SecretSetting · SelectSetting · Sentence · ServerHook · Setting · SettingKey · SettingOption · SettingScope · SettingSection · SignIn · Source · SourcesByKind · Sponsor · StatusItem · StringSetting · THEME_APPEARANCES · THEME_FILE_SCHEMA · THEME_FILE_SCHEMA_ID · THEME_TOKENS · Theme · ThemeAppearance · ThemeColor · ThemeColors · ThemeFile · ThemeFileResult · ThemeLook · ThemeToken · Title · UNSAFE_CODE_POINTS · ValidateOptions · Version · VersionRange · View · When · compareVersions · parseManifest · parseRange · parseThemeFile · parseVersion · satisfiesRange · validateManifest

It also exports, as the modules that declare them document them: CatalogType, IconName, MenuLocation, PermissionName, Platform, ProviderGroup, Side.

ArtistInfoSource

A source of words about an artist.

Prop

Type

Refers to LocalId, Title.

ArtworkSource

A source of artist photos and album covers.

Prop

Type

Refers to LocalId, Title.

Banner

A 16:9 image, from 1280 by 720 up to 3840 by 2160 pixels.

Prop

Type

BooleanSetting

A switch.

Prop

Type

Refers to SettingKey, Title, Sentence, SettingSection, SettingScope.

CATEGORIES

Every category a manifest may list, as the schema lists them.

export declare const CATEGORIES: readonly Category[];

Refers to Category.

CLIENT_HOOKS

Every hook the client entry may listen to, as the schema lists them.

export declare const CLIENT_HOOKS: readonly ClientHook[];

Refers to ClientHook.

Category

A category of the official list.

export type Category = "sources" | "lyrics" | "metadata-artwork" | "scrobbling-stats" | "discovery" | "playback-audio" | "visualisers" | "themes" | "social-jam" | "library-tools" | "integrations" | "server-worker";

ClientHook

A hook of the client entry.

export type ClientHook = "onPlay" | "onPause" | "onTrackChange" | "onSeek" | "onVolumeChange" | "onQueueChange" | "onProgress";

Command

A named action the extension's code carries out, run from a menu, a button or another command.

Prop

Type

Refers to LocalId, Title, Side, Sentence, IconName.

Contributes

What the extension adds to Songstress: commands, menus, settings, pages, panels, status items, views, themes, providers, jobs, routes and a sign-in.

Prop

Type

Refers to Command, Menus, Setting, Page, Panel, StatusItem, View, Theme, SourcesByKind, Job, Route, SignIn.

DownloadSource

A source the library can fetch audio from, at the qualities it offers.

Prop

Type

Refers to LocalId, Title, Quality.

Engines

The extension API versions the extension runs on.

Prop

Type

Refers to songstress.

Entry

The extension's code: the bundle that runs on the server, the one that runs in the apps, or both.

Prop

Type

Refers to ScriptPath.

ExtensionId

publisher.name, each part in lowercase letters, digits and single hyphens.

export type ExtensionId = string;

HOOK_PERMISSIONS

The permission each hook needs before it is delivered; null for none. Hearing a member's playback is reading their listening, on either side.

export declare const HOOK_PERMISSIONS: {
    readonly server: Readonly<Record<ServerHook, PermissionName>>;
    readonly client: Readonly<Record<ClientHook, PermissionName | null>>;
};

Refers to ServerHook, PermissionName, ClientHook.

Hooks

The events the extension's code listens to, by side.

Prop

Type

Refers to ServerHook, ClientHook.

HostPattern

A public host by name (api.example.com), or every host under a domain (*.example.com), with an optional port. Never an address, a scheme or a path.

export type HostPattern = string;

HttpsUrl

An https address.

export type HttpsUrl = string;

Icon

A square PNG of 512 by 512 pixels.

Prop

Type

Job

Work the server runs in the background, on a schedule or when code asks, shown in Activity.

Prop

Type

Refers to LocalId, Title.

KEYWORD_CODES

The code each keyword reports when it fails: the contract every reader of the schema keeps, whatever validator it is built on.

export declare const KEYWORD_CODES: {
    readonly type: "SCHEMA_TYPE";
    readonly required: "SCHEMA_REQUIRED";
    readonly additionalProperties: "SCHEMA_UNKNOWN_PROPERTY";
    readonly enum: "SCHEMA_ENUM";
    readonly const: "SCHEMA_CONST";
    readonly pattern: "SCHEMA_PATTERN";
    readonly minLength: "SCHEMA_LENGTH";
    readonly maxLength: "SCHEMA_LENGTH";
    readonly minimum: "SCHEMA_RANGE";
    readonly maximum: "SCHEMA_RANGE";
    readonly exclusiveMinimum: "SCHEMA_RANGE";
    readonly minItems: "SCHEMA_ITEM_COUNT";
    readonly maxItems: "SCHEMA_ITEM_COUNT";
    readonly uniqueItems: "SCHEMA_DUPLICATE_ITEM";
    readonly minProperties: "SCHEMA_PROPERTY_COUNT";
};

Keyword

A tag: lowercase letters and digits, with single dots or hyphens between them.

export type Keyword = string;

LISTING_FIELDS

The fields a listing cannot do without.

export declare const LISTING_FIELDS: readonly [
    "license",
    "repository",
    "categories",
    "icon",
    "screenshots"
];

LISTING_LICENSES

The licences the official list accepts, as SPDX identifiers.

export declare const LISTING_LICENSES: readonly string[];

LISTING_MIN_SCREENSHOTS

The fewest screenshots a listing shows. The schema holds the most (six).

export declare const LISTING_MIN_SCREENSHOTS = 3;

LinkPattern

A host with an optional path that a link must begin with (soundcloud.com, example.com/album/), or an app link's scheme (spotify:). A host also takes links to the hosts under it.

export type LinkPattern = string;

LinkSource

A source that reads a pasted link.

Prop

Type

Refers to LocalId, Title, ProviderGroup, LinkPattern.

LocalId

A name unique among its kind inside one extension: lowercase letters, digits and single hyphens, starting with a letter.

export type LocalId = string;

LocalNetworkPermission

Reaching the user's own network: why, and which targets.

Prop

Type

Refers to Reason, LocalTarget.

LocalTarget

A target on the user's own network: an IPv4 address (192.168.1.20), a block of them (192.168.1.0/24) or a host name (nas.local), the address and the name with an optional port.

export type LocalTarget = string;

LookupSource

A source that opens one track, album, artist or playlist by its id.

Prop

Type

Refers to LocalId, Title, ProviderGroup, CatalogType.

MANIFEST_ERROR_CODES

Every code the validator reports, each with a sentence for people. The codes are the contract; the sentences may be reworded.

export declare const MANIFEST_ERROR_CODES: {
    MANIFEST_TOO_LARGE: string;
    MANIFEST_TOO_DEEP: string;
    JSON_INVALID: string;
    JSON_DUPLICATE_KEY: string;
    THEME_FILE_TOO_LARGE: string;
    SCHEMA_TYPE: string;
    SCHEMA_REQUIRED: string;
    SCHEMA_UNKNOWN_PROPERTY: string;
    SCHEMA_ENUM: string;
    SCHEMA_CONST: string;
    SCHEMA_PATTERN: string;
    SCHEMA_LENGTH: string;
    SCHEMA_RANGE: string;
    SCHEMA_ITEM_COUNT: string;
    SCHEMA_DUPLICATE_ITEM: string;
    SCHEMA_PROPERTY_COUNT: string;
    TEXT_UNSAFE: string;
    ID_RESERVED: string;
    VERSION_INVALID: string;
    ENGINE_RANGE_INVALID: string;
    ENGINE_UNSUPPORTED: string;
    PATH_OUTSIDE_PACKAGE: string;
    BANNER_NOT_16_9: string;
    ENTRY_REQUIRED: string;
    ENTRY_UNUSED: string;
    PERMISSION_REQUIRED: string;
    PERMISSION_UNUSED: string;
    NETWORK_LOCAL_NOT_PRIVATE: string;
    DUPLICATE_ID: string;
    MENU_COMMAND_UNKNOWN: string;
    ROUTE_DUPLICATE: string;
    LINK_PATTERN_TOO_BROAD: string;
    PROVIDER_PLAY_NEEDS_SEARCH: string;
    PROVIDER_MISMATCH: string;
    SETTING_DEFAULT_INVALID: string;
    SETTING_RANGE_INVALID: string;
    SETTING_OPTION_DUPLICATE: string;
    THEME_LOOKS: string;
    THEME_COLOR: string;
    THEME_COLOR_ALPHA: string;
    WHEN_INVALID: string;
    WHEN_KEY_UNKNOWN: string;
    LISTING_FIELD_REQUIRED: string;
    LISTING_LICENSE: string;
    LISTING_REPOSITORY: string;
    LISTING_SCREENSHOTS: string;
};

MANIFEST_FILE

The name of the manifest file, at the root of an extension's package.

export declare const MANIFEST_FILE = "songstress.json";

Refers to songstress.

MANIFEST_PROFILES

The validator's profiles: install, what a server takes from a link or a file, and listing, what a listing asks on top.

export declare const MANIFEST_PROFILES: readonly ManifestProfile[];

Refers to ManifestProfile.

MANIFEST_SCHEMA

The manifest's JSON Schema (draft 2020-12).

export declare const MANIFEST_SCHEMA: SchemaNode;

MANIFEST_SCHEMA_ID

The address the schema is published at, and its $id.

export declare const MANIFEST_SCHEMA_ID: string;

MAX_MANIFEST_BYTES

The largest manifest read, in bytes of UTF-8.

export declare const MAX_MANIFEST_BYTES: number;

MAX_MANIFEST_DEPTH

The deepest nesting of objects and lists read.

export declare const MAX_MANIFEST_DEPTH = 16;

MAX_THEME_FILE_BYTES

The most a theme file may hold, in bytes.

export declare const MAX_THEME_FILE_BYTES: number;

MENU_LOCATIONS

Every place a menu item may stand.

export declare const MENU_LOCATIONS: readonly MenuLocation[];

Refers to MenuLocation.

Manifest

The songstress.json file at the root of an extension's package: what the extension is, how it is listed, the code it ships, the permissions it asks for and everything it adds to Songstress.

Prop

Type

Refers to ExtensionId, Engines, HttpsUrl, Sponsor, Category, Keyword, Platform, Icon, Banner, Screenshot, Entry, Hooks, Permissions, Contributes.

ManifestErrorCode

A stable problem code.

export type ManifestErrorCode = keyof typeof MANIFEST_ERROR_CODES;

Refers to MANIFEST_ERROR_CODES.

ManifestIssue

One problem: its code, where it is, and a sentence for a person. Only the code and the pointer are part of the specification; the sentence may be reworded.

Prop

Type

Refers to ManifestErrorCode.

ManifestProfile

What a manifest is held to: what a server takes from a file or a link ("install"), or what the official list asks on top ("listing").

export type ManifestProfile = 'install' | 'listing';

ManifestResult

A manifest that passed, typed; or every problem found in it.

export type ManifestResult = {
    valid: true;
    manifest: Manifest;
    issues: [
    ];
} | {
    valid: false;
    issues: ManifestIssue[];
};

Refers to Manifest, ManifestIssue.

MenuItem

One menu item: a command, and when it shows.

Prop

Type

Refers to LocalId, When.

MenuItems

The items an extension adds to one menu.

export type MenuItems = MenuItem[];

Refers to MenuItem.

Menus

Where the extension's commands appear, by menu.

Prop

Type

Refers to MenuItems.

MetadataSource

A source of facts about artists, releases and tracks.

Prop

Type

Refers to LocalId, Title, ProviderGroup.

NetworkPermission

Reaching public hosts: why, and which hosts.

Prop

Type

Refers to Reason, HostPattern.

NumberSetting

A number.

Prop

Type

Refers to SettingKey, Title, Sentence, SettingSection, SettingScope.

PANEL_LOCATIONS

Every screen a panel may be drawn in.

export declare const PANEL_LOCATIONS: readonly PanelLocation[];

Refers to PanelLocation.

PERMISSIONS

Every permission a manifest may ask for.

export declare const PERMISSIONS: readonly PermissionName[];

Refers to PermissionName.

PLATFORMS

The apps an extension's interface and client code may work in.

export declare const PLATFORMS: readonly Platform[];

Refers to Platform.

PROVIDER_KINDS

Every kind of provider a manifest may declare.

export declare const PROVIDER_KINDS: readonly ProviderKind[];

Refers to ProviderKind.

Page

A page the apps draw from a tree of Songstress's own blocks, built by the extension's code.

Prop

Type

Refers to LocalId, Title, Side, IconName, When.

Panel

A section the extension's code builds inside one of Songstress's own screens.

Prop

Type

Refers to LocalId, Title, PanelLocation, Side, When.

PanelLocation

The Songstress screen a panel is drawn in: the player's now-playing view, Home, an artist's page, an album's page or a playlist's page.

export type PanelLocation = "now-playing" | "home" | "artist" | "album" | "playlist";

Permission

A permission with nothing more to name than why it is asked for.

Prop

Type

Refers to Reason.

Permissions

What the extension may do, each with the reason it gives.

Prop

Type

Refers to NetworkPermission, LocalNetworkPermission, Permission.

ProviderKind

A kind of provider, as contributes.providers keys it.

export type ProviderKind = keyof SourcesByKind;

Refers to SourcesByKind.

Quality

One quality a download source offers.

Prop

Type

Refers to LocalId, Title.

RESERVED_PUBLISHERS

Publisher names no extension may take: the namespaces of the extension API and the first part of each permission. An id such as "player.radio" would read as part of Songstress itself.

export declare const RESERVED_PUBLISHERS: readonly string[];

Reason

Why the extension needs this, in words the person granting it will read.

export type Reason = string;

RecommendSource

A source of recommendations.

Prop

Type

Refers to LocalId, Title.

Route

An HTTP route under the extension's own prefix on the server.

Prop

Type

Refers to LocalId.

SERVER_HOOKS

Every hook the server entry may listen to, as the schema lists them.

export declare const SERVER_HOOKS: readonly ServerHook[];

Refers to ServerHook.

Screenshot

One capture, with the size it really has.

Prop

Type

Refers to Platform.

ScriptPath

One JavaScript file, from the package root.

export type ScriptPath = string;

SearchSource

A source that answers a search.

Prop

Type

Refers to LocalId, Title, ProviderGroup, CatalogType.

SecretSetting

A password, key or token. Songstress seals it, never shows it again and never sends it to an app. A device cannot keep one.

Prop

Type

Refers to SettingKey, Title, Sentence, SettingSection.

SelectSetting

One choice from a list.

Prop

Type

Refers to SettingKey, Title, Sentence, SettingSection, SettingScope, SettingOption.

Sentence

A sentence or two, on one line.

export type Sentence = string;

ServerHook

A hook of the server entry.

export type ServerHook = "onPlay" | "onScrobble" | "onFavorite" | "onPlaylistChange" | "onLibraryChange" | "onScanComplete";

Setting

One setting. Its type decides the control Songstress draws and what else it may say.

export type Setting = StringSetting | SecretSetting | NumberSetting | BooleanSetting | SelectSetting;

Refers to StringSetting, SecretSetting, NumberSetting, BooleanSetting, SelectSetting.

SettingKey

A setting's name as code reads it: letters and digits, starting with a lowercase letter.

export type SettingKey = string;

SettingOption

One choice of a select setting.

Prop

Type

Refers to Title.

SettingScope

Who a setting belongs to: the whole server (the admin sets it), each member, or each device.

export type SettingScope = "server" | "user" | "device";

SettingSection

The heading a setting is drawn under, with the others that name it.

export type SettingSection = string;

SignIn

An account at a service the extension signs in to, for the server or for each member.

Prop

Type

Refers to Title.

Source

A source that answers beside Songstress's own.

Prop

Type

Refers to LocalId, Title.

SourcesByKind

The extension's sources, by what they answer. Each kind is a provider contract the code registers.

Prop

Type

Refers to SearchSource, LookupSource, LinkSource, Source, MetadataSource, ArtworkSource, ArtistInfoSource, RecommendSource, DownloadSource.

Sponsor

Where people can support the extension's author.

Prop

Type

Refers to HttpsUrl.

StatusItem

An item in the player: an icon and a few words the extension's code keeps current.

Prop

Type

Refers to LocalId, Title, Side, IconName, When.

StringSetting

A line of text.

Prop

Type

Refers to SettingKey, Title, Sentence, SettingSection, SettingScope.

THEME_APPEARANCES

A theme's appearances: dark, light or both.

export declare const THEME_APPEARANCES: readonly ThemeAppearance[];

Refers to ThemeAppearance.

THEME_FILE_SCHEMA

A theme file's JSON Schema (draft 2020-12): the looks of one theme, which a manifest's theme names by its path. Its definitions are the manifest schema's own (the theme tokens).

export declare const THEME_FILE_SCHEMA: SchemaNode;

THEME_FILE_SCHEMA_ID

The address the theme file's schema is published at, and its $id.

export declare const THEME_FILE_SCHEMA_ID: string;

THEME_TOKENS

Every colour token a theme's look may set, in the order the specification lists them.

export declare const THEME_TOKENS: readonly [
    "background",
    "surface",
    "surface.raised",
    "surface.hover",
    "sidebar",
    "border",
    "text",
    "text.muted",
    "text.faint",
    "accent",
    "accent.fill",
    "accent.fill.pressed",
    "accent.onFill",
    "success",
    "warning",
    "danger",
    "info"
];

Theme

One theme the picker lists: a dark look, a light one, or both, written here or in a theme file.

Prop

Type

Refers to LocalId, Title, ThemeLook.

ThemeAppearance

The looks a theme has, as its appearance names them.

export type ThemeAppearance = Theme['appearance'];

Refers to Theme.

ThemeColor

A colour: #RGB, #RGBA, #RRGGBB or #RRGGBBAA, or rgb(), rgba(), hsl() or hsla() as CSS writes them, the name in lower case (SPEC.md, section 12, "Colours"). Only border and surface.hover may be translucent.

export type ThemeColor = string;

ThemeColors

Colour tokens by name (SPEC.md, section 12). What a look leaves out, an app fills in.

Prop

Type

Refers to ThemeColor.

ThemeFile

A theme file, which a theme names by its path: its looks, as the manifest would write them (schema/theme.v1.json).

Prop

Type

Refers to ThemeLook.

ThemeFileResult

A theme file that passed, typed; or every problem found in it.

export type ThemeFileResult = {
    valid: true;
    file: ThemeFile;
    issues: [
    ];
} | {
    valid: false;
    issues: ManifestIssue[];
};

Refers to ThemeFile, ManifestIssue.

ThemeLook

A theme's look, dark or light: its colours, a seed for what they leave out, and the glow behind the stage.

Prop

Type

Refers to ThemeColor, ThemeColors.

ThemeToken

A colour token a theme's look may set.

export type ThemeToken = (typeof THEME_TOKENS)[number];

Refers to THEME_TOKENS.

Title

A short label, on one line.

export type Title = string;

UNSAFE_CODE_POINTS

The code points TEXT_UNSAFE refuses in a manifest's text, as ranges: Unicode's default ignorable code points, less the joiners, marks and selectors that scripts and emoji need.

export declare const UNSAFE_CODE_POINTS: readonly (readonly [
    from: number,
    to: number
])[];

ValidateOptions

How a manifest is checked: the profile, and the extension API version of the host that is checking.

Prop

Type

Refers to ManifestProfile.

Version

A parsed semantic version.

Prop

Type

VersionRange

A parsed range: every version from from on, before before when there is one; or from alone when exact.

Prop

Type

Refers to Version.

View

A free-form page: the extension's own HTML, opened in a sandboxed frame.

Prop

Type

Refers to LocalId, Title, IconName.

When

A condition on what the app knows (SPEC.md section 10): keys such as platform, admin, signedIn, playing, favorite and setting.<key>, joined with !, &&, || and parentheses, and compared with == and != to 'text', true, false or a number. The item shows only while it holds.

export type When = string;

compareVersions

-1 when a comes before b, 1 when after, 0 when they rank the same.

export declare function compareVersions(a: Version, b: Version): number;
ParameterTypeDescription
aVersionA version.
bVersionThe version to hold it against.

Returns number: -1, 0 or 1, for sorting.

Refers to Version.

parseManifest

Reads and checks a manifest from its text, or from its bytes as they are on disk. Prefer the bytes: only they can show a file that is not UTF-8.

export declare function parseManifest(input: string | Uint8Array, options?: ValidateOptions): ManifestResult;
ParameterTypeDescription
inputstring | Uint8ArrayThe manifest's bytes, or its text.
options?ValidateOptionsWhich checks to run (profile), and the API version of the host that is checking (apiVersion).

Returns ManifestResult: The manifest when it is valid; else every issue found.

Example
import { parseManifest } from 'songstress/manifest'

declare const bytes: Uint8Array // the file's bytes, as read from disk

const result = parseManifest(bytes, { profile: 'install' })
if (result.valid) console.log(result.manifest.id)
else for (const issue of result.issues) console.log(issue.code, issue.pointer, issue.message)

Refers to ValidateOptions, ManifestResult.

parseRange

text as a range, or null when the grammar above does not take it.

export declare function parseRange(text: string): VersionRange | null;
ParameterTypeDescription
textstringA range as a manifest writes it: ^1.2.0, ~1.2.0, >=1.2.0, >=1.2.0 <2.0.0 or one exact version.

Returns VersionRange | null: The range, or null.

Refers to VersionRange.

parseThemeFile

Reads and checks a theme file from its bytes (or its text), for a theme whose appearance is the one given: the file holds exactly the looks that names. Prefer the bytes: only they can show a file that is not UTF-8.

export declare function parseThemeFile(input: string | Uint8Array, appearance: ThemeAppearance): ThemeFileResult;
ParameterTypeDescription
inputstring | Uint8ArrayThe theme file's bytes, or its text.
appearanceThemeAppearanceThe appearance the manifest gives the theme.

Returns ThemeFileResult: The theme's looks when the file is valid; else every issue found.

Refers to ThemeAppearance, ThemeFileResult.

parseVersion

text as a version, or null when it is not one.

export declare function parseVersion(text: string): Version | null;
ParameterTypeDescription
textstringA version as major.minor.patch.

Returns Version | null: The version, or null.

Refers to Version.

satisfiesRange

Whether version lies inside range.

export declare function satisfiesRange(version: Version, range: VersionRange): boolean;
ParameterTypeDescription
versionVersionThe version to test.
rangeVersionRangeThe range, from parseRange.

Returns boolean: True when the range takes the version.

Example
import { parseRange, parseVersion, satisfiesRange } from 'songstress/manifest'

const range = parseRange('^0.1.0')
const version = parseVersion('0.1.8')
if (range && version) console.log(satisfiesRange(version, range)) // true

Refers to Version, VersionRange.

validateManifest

Checks a manifest that is already a JSON value.

export declare function validateManifest(value: unknown, options?: ValidateOptions): ManifestResult;
ParameterTypeDescription
valueunknownThe parsed manifest.
options?ValidateOptionsWhich checks to run (profile), and the API version of the host that is checking (apiVersion).

Returns ManifestResult: The manifest when it is valid; else every issue found.

Refers to ValidateOptions, ManifestResult.