summaryrefslogtreecommitdiff
path: root/nodejs/lib/types.ts
blob: a8e748ce0bd4ec0bf9fd741be36c76e62a4ddf88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
export type Agent = {
	accountId: string;
	credits: number;
	headquarters: string;
	shipCount: number;
	startingFaction: string;
	symbol: string;
};

export type CommonThing = {
	description: string;
	name: string;
	symbol: string;
};

export type Cargo = {
	capacity: number;
	units: number;
	inventory: Array<Inventory>;
};

// Custom type, not from space traders api
export type CargoManifest = {
	[key: string]: number;
};

export type Chart = {
	waypointSymbol: string;
	submittedBy: string;
	submittedOn: Date;
};

export type Contract = {
	id: string;
	factionSymbol: string;
	type: string;
	terms: {
		deadline: Date;
		payment: {
			onAccepted: number;
			onFulfilled: number;
		},
		deliver: Array<{
			tradeSymbol: string;
			destinationSymbol: string;
			unitsRequired: number;
			unitsFulfilled: number;
		}>;
	};
	accepted: boolean;
	fulfilled: boolean;
	expiration: Date;
	deadlineToAccept: Date;
};

export type Cooldown = {
	shipSymbol: string;
	totalSeconds: number;
	remainingSeconds: number;
};

export type Consummed = {
	amount: number;
	timestamp: Date;
};

export type Fuel = {
	capacity: number;
	consummed: Consummed;
	current: number;
};

export type Inventory = CommonThing & {
	units: number;
};

export type Market = {
	symbol: string;
	exchange: Array<CommonThing>;
	exports: Array<CommonThing>;
	imports: Array<CommonThing>;
	//transactions: Array<Transaction>;
	tradeGoods: Array<TradeGood>;
};

export type Nav = {
	flightMode: string;
	route: Route;
	status: string;
	systemSymbol: string;
	waypointSymbol: string;
};

export type Registration = {
	factionSymbol: string;
	name: string;
	role: string;
};

export type Route = {
	arrival: Date;
	departureTime: Date;
	destination: RouteEndpoint;
	origin: RouteEndpoint;
};

export type RouteEndpoint = {
	type: string;
	symbol: string;
	systemSymbol: string;
	x: number;
	y: number;
};

export type System = {
	symbol: string;
	sectorSymbol: string;
	type: string;
	x: number;
	y: number;
	waypoints: Array<Waypoint>;
};

export type TradeGood = CommonThing & {
	activity: string;
	purchasePrice: number;
	sellPrice: number;
	supply: string;
	tradeVolume: number;
	type: string;
};

export type Waypoint = {
	chart: Chart;
	factions: Array<{symbol: string;}>;
	isUnderConstruction: boolean;
	modifiers: Array<CommonThing>;
	orbitals: Array<{symbol: string;}>;
	orbits: string;
	symbol: string;
	traits: Array<CommonThing>;
	type: string;
	x: number;
	y: number;
};