UNPKG

max-api-or-nah

Version:

Taking an extremely overengineered approach to wrapping the max-api object

109 lines (101 loc) 2.53 kB
/** * MAX-API-OR-NAH? * * THIS FILE IS AUTO GENERATED. DO NOT EDIT MANUALLY */ let Max const noMax = { /** Enum options for the value Node For Max will set on process.env.MAX_ENV */ MAX_ENV: { MAX: 'max', MAX_FOR_LIVE: 'maxforlive', STANDALONE: 'max:standalone', }, /** Predefined generic MaxFunctionSelector types */ MESSAGE_TYPES: { ALL: 'all', BANG: 'bang', DICT: 'dict', NUMBER: 'number', LIST: 'list', }, /** Log Levels used in maxAPI.post */ POST_LEVELS: { ERROR: 'error', INFO: 'info', WARN: 'warn', }, //type MaxFunctionSelector = MESSAGE_TYPES | string //type MaxFunctionHandler = (...args: any[]) //type Anything = string | number | Array<string | number> | JSONObject | JSONArray /* * Register a single handler * Types: * selector MaxFunctionSelector * handler MaxFunctionHandler */ addHandler: (selector, handler) => {}, /* * Register handlers * Types: * handlers Record<MaxFunctionSelector, MaxFunctionHandler> */ addHandlers: (handlers) => {}, /* * Remove a single handler * Types: * selector MaxFunctionSelector * handler MaxFunctionHandler */ removeHandler: (selector, handler) => {}, /* * Remove handlers * Types: * selector MaxFunctionSelector */ removeHandlers: (selector) => {}, /* * Outlet any values * Types: * args array<JSONValue> */ outlet: (args) => Promise.resolve(), /* * Outlet a Bang */ outletBang: () => Promise.resolve(), /* * Post to the Max console. Setting the last argument to a value of maxAPI.POST_LEVELS allows control of the log level * Types: * args Array<Anything | POST_LEVELS> */ post: (args) => Promise.resolve(console.log(args)), /* * Get the value of a dict object * Types: * id string */ getDict: (id) => Promise.resolve({}), /* * Set the value of a dict object * Types: * id string * dict JSONObject */ setDict: (id, dict) => Promise.resolve({}), /* * Partially update the value of a dict object at a given path * Types: * id string * updatePath string * updateValue JSONValue */ updateDict: (id, updatePath, updateValue) => Promise.resolve({}), } try { Max = require('max-api') } catch(e) { Max = noMax process.env.MAX_ENV = "nah" } module.exports = Max