From a1d6b03ec98abbc073b5b73b631da6ea3eae4eb9 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 27 Mar 2024 15:20:14 +0100 Subject: [node] finished the great typescript rewrite --- nodejs/model/api.ts | 3 +-- nodejs/model/common.ts | 5 +++++ nodejs/model/errors.ts | 8 ++++++++ nodejs/model/market.ts | 19 +++++++++++++++++++ nodejs/model/ship.ts | 8 +++++++- nodejs/model/system.ts | 30 ++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 nodejs/model/common.ts create mode 100644 nodejs/model/errors.ts create mode 100644 nodejs/model/market.ts create mode 100644 nodejs/model/system.ts (limited to 'nodejs/model') diff --git a/nodejs/model/api.ts b/nodejs/model/api.ts index 5092157..69c7ee1 100644 --- a/nodejs/model/api.ts +++ b/nodejs/model/api.ts @@ -1,8 +1,7 @@ export type APIError = { - apiError: 'APIError'; error: string; code: number; - data: any; // TODO + data: unknown; }; export type Meta = { diff --git a/nodejs/model/common.ts b/nodejs/model/common.ts new file mode 100644 index 0000000..1712ad8 --- /dev/null +++ b/nodejs/model/common.ts @@ -0,0 +1,5 @@ +export type CommonThing = { + description: string; + name: string; + symbol: string; +}; diff --git a/nodejs/model/errors.ts b/nodejs/model/errors.ts new file mode 100644 index 0000000..6002ae6 --- /dev/null +++ b/nodejs/model/errors.ts @@ -0,0 +1,8 @@ +export type RateLimitError = { + type: string; + retryAfter: number; + limitBurst: number; + limitPerSecond: number; + remaining: number; + reset: Date; +}; diff --git a/nodejs/model/market.ts b/nodejs/model/market.ts new file mode 100644 index 0000000..1ba70c1 --- /dev/null +++ b/nodejs/model/market.ts @@ -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; + exports: Array; + imports: Array; + //transactions: Array; + tradeGoods: Array; +}; diff --git a/nodejs/model/ship.ts b/nodejs/model/ship.ts index 9aaf601..bf40767 100644 --- a/nodejs/model/ship.ts +++ b/nodejs/model/ship.ts @@ -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; }; diff --git a/nodejs/model/system.ts b/nodejs/model/system.ts new file mode 100644 index 0000000..b90560f --- /dev/null +++ b/nodejs/model/system.ts @@ -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; +}; + +export type Waypoint = { + chart: Chart; + factions: Array<{symbol: string;}>; + isUnderConstruction: boolean; + modifiers: Array; + orbitals: Array<{symbol: string;}>; + orbits: string; + symbol: string; + traits: Array; + type: string; + x: number; + y: number; +}; -- cgit v1.2.3