A Node.js library for interacting with Major Tom
$ npm install majortom-scripting
const mts = require('majortom-scripting');
const script = mts({
host: 'app.majortom.cloud',
token: '<your script token>',
mission: '<optional mission ID>',
});
Instantiates the Major Top Script singleton
options: object
host: string
The host name where your Major Tom instance is runningtoken: string
Your script's unique tokenmission?: string|number
Optionally set the mission ID on instantiation
Retrieve the ID of the mission that this script is interacting with
Retrieve a Satellite object using one of name, database ID, or NORAD ID
input: object
name?: string
The unique satellite name in Major Tomid?: string|number
The Major Tom database ID; can be found in the Major Tom urlnoradId?: string|number
The satellite's NORAD ID
Retrieve the most recent value for a subsystem metric on a Satellite
input: object
system: string|number
Identify the satellite by name or database IDsubsystem: string
The name of the subsystemmetric: string
The name of the subsystem metric
Retrieve all the command definitions for the passed satellite
Create a command object that can be queued and executed later
input: object
system: Satellite
The satellite to commandcommand: string|Command
Either a command object or the command definition type stringfields?: object.<string, number|string>
Optional object for command parameter values; the keys are field names and values are field values for this commandgateway?: string|number|Gateway
Optionally identify the gateway to send this command by name, database ID, or as a Gateway object
Execute the passed command; resolves as soon as the execution command is sent to Major Tom
Retrieve a gateway from Major Tom by either name or id
input: object
name?: string
The unique gateway nameid?: string|number
The database ID of the gateway
Instruct Major Tom to queue the command; resolves the updated Command object
Instruct Major Tom to execute the command; resolves the updated Command object after Major Tom has updated the command state to "completed"
, "failed"
, or "cancelled"
. Optional argument maxWaitTime: number
defaults to 90 seconds.
Executes the passed array of commands in sequence, only proceeding to the next command if the first one resolves to a "completed"
, "failed"
, or "cancelled"
state.
options?: object
Some aspects of the method's behavior can be defined:
maxWaitTime: number
The maximum time to wait for each command to resolve; defaults to 90 secondscontinuePastFailures: boolean
If true, will continue attempting to execute each command even if the command times out or resolves to"failed"
or"cancelled"
Resolves an Array of all queued Command objects for the Satellite
Resolves the list of remote files from the Satellite
Resolves the list of all files staged in Major Tom for uplink to the Satellite
Resolves a list of events in Major Tom related to this system for a given time period
options?: object
hours: number
The number of hours back to search for eventsending: number
The number of hours ago to start searching backtype: string|string[]
One or more event types to include in the resultslevel: string|string[]
One or more event levels to include in the results
For example, submitting an options
object { hours: 10, ending: 5 }
will return any events for the system that occurred betweein 15 hours ago and 5 hours ago.
Retrieves the next available pass for this satellite. If groundStationId
is provided, retrieves the next available pass for this satellite over the identified ground station.
groundStationId?: number|string
The database ID of the ground station to filter for
Retrieves the next pass for the satellite, whether scheduled, available, or in any other state. If groundStationId
is provided, retrieves the next pass in any state for this satellite over the identified ground station.
groundStationId?: number|string
The database ID of the ground station to filter for
Associate the command with a gateway using either the gateway database ID or a Gateway object
Sets the command state to "queued"
Sets the command id
Sets the command's final state
Returns a string representation of the command's important properties, formatted for use by the script library's GQL queries
Returns an object representation of the command's important properties, formatted for use by the script library's GQL mutations
Resolves a list of commands in Major Tom sent through this gateway for a given time period
options?: object
hours: number
The number of hours back to search for commandsending: number
The number of hours ago to start searching backtype: string|string[]
One or more command types to include in the results
For example, submitting an options
object { hours: 10, ending: 5 }
will return any commands sent through this gateway that occurred betweein 15 hours ago and 5 hours ago.