1
0
Fork 0

[node] finished the great typescript rewrite

This commit is contained in:
Julien Dessaux 2024-03-27 15:20:14 +01:00
parent 8107afbd90
commit a1d6b03ec9
Signed by: adyxax
GPG key ID: F92E51B86E07177E
30 changed files with 1019 additions and 359 deletions

View file

@ -1,8 +1,7 @@
export type APIError = {
apiError: 'APIError';
error: string;
code: number;
data: any; // TODO
data: unknown;
};
export type Meta = {

5
nodejs/model/common.ts Normal file
View file

@ -0,0 +1,5 @@
export type CommonThing = {
description: string;
name: string;
symbol: string;
};

8
nodejs/model/errors.ts Normal file
View file

@ -0,0 +1,8 @@
export type RateLimitError = {
type: string;
retryAfter: number;
limitBurst: number;
limitPerSecond: number;
remaining: number;
reset: Date;
};

19
nodejs/model/market.ts Normal file
View file

@ -0,0 +1,19 @@
import { CommonThing } from 'common.ts';
export type TradeGood = CommonThing & {
activity: string;
purchasePrice: number;
sellPrice: number;
supply: string;
tradeVolume: number;
type: string;
};
export type Market = {
symbol: string;
exchange: Array<CommonThing>;
exports: Array<CommonThing>;
imports: Array<CommonThing>;
//transactions: Array<Transaction>;
tradeGoods: Array<TradeGood>;
};

View file

@ -25,6 +25,12 @@ export type Nav = {
waypointSymbol: string;
};
export type Registration = {
factionSymbol: string;
name: string;
role: string;
};
export type Route = {
arrival: Date;
departureTime: Date;
@ -51,6 +57,6 @@ export type Ship = {
// mounts
nav: Nav;
// reactor
// registration
registration: Registration;
symbol: string;
};

30
nodejs/model/system.ts Normal file
View file

@ -0,0 +1,30 @@
import { CommonThing } from 'common.ts';
export type Chart = {
waypointSymbol: string;
submittedBy: string;
submittedOn: Date;
};
export type System = {
symbol: string;
sectorSymbol: string;
type: string;
x: number;
y: number;
waypoints: Array<Waypoint>;
};
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;
};