Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Modules

Index of the platform modules a script can import - twc/secrets, twc/secutix and twc/apple-music - and how modules differ from globals.

Globals such as fetch are always there. Modules are different: they cover capabilities that not every script needs, such as reading a secret or calling Secutix, and they are brought in with an import line at the top of the file. A script file can import only these platform modules: files cannot import each other, so shared helpers are written in the file that uses them.

Available modules

Module
Exports
Purpose

getSecret

Reads a secret of the tenant.

fetch

Calls the Secutix connection of the tenant.

semantics, getArtistId, getAlbumId, getPlaylistId, find, search, lookup

Resolves names to Apple Music catalog IDs.

The obsolete names neo/secrets and neo/secutix still work; see Obsolete neostore names, the catalog of every legacy name. Documentation and new scripts use twc/ everywhere. The prefix neostore is the platform's former name and is kept in technical identifiers.

Importing

An import is a standard ES module import, written before the default export of the file.

import { getSecret } from "twc/secrets";
import { semantics } from "twc/apple-music";

export default function (context) {
  // register handlers
}

The module name is matched exactly, with its prefix, and is case-sensitive. A name that matches no module makes the file fail to load, and a file that fails to load makes all script endpoints of the tenant fail, as described in How scripts run. Imported functions are asynchronous: they are awaited, inside an async function. The editor of the advanced configuration offers completion for the exports of each module.

Modules and globals

Globals, documented on Globals, need no import and are the same everywhere. A module can export a name that is also a global, as twc/secutix does with fetch; the import then replaces the global inside that file, and an alias (import { fetch as secutixFetch } ...) keeps both available.

FAQ

Can a script import a package from npm?

No. Scripts run on the platform's own JavaScript engine, and the available libraries are the globals and modules listed on these pages.

Last updated