burnrate 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +507 -0
- package/dist/cli/format.d.ts +13 -0
- package/dist/cli/format.js +319 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +1121 -0
- package/dist/cli/setup.d.ts +8 -0
- package/dist/cli/setup.js +143 -0
- package/dist/core/async-engine.d.ts +411 -0
- package/dist/core/async-engine.js +2274 -0
- package/dist/core/async-worldgen.d.ts +19 -0
- package/dist/core/async-worldgen.js +221 -0
- package/dist/core/engine.d.ts +154 -0
- package/dist/core/engine.js +1104 -0
- package/dist/core/pathfinding.d.ts +38 -0
- package/dist/core/pathfinding.js +146 -0
- package/dist/core/types.d.ts +489 -0
- package/dist/core/types.js +359 -0
- package/dist/core/worldgen.d.ts +22 -0
- package/dist/core/worldgen.js +292 -0
- package/dist/db/database.d.ts +83 -0
- package/dist/db/database.js +829 -0
- package/dist/db/turso-database.d.ts +177 -0
- package/dist/db/turso-database.js +1586 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +1877 -0
- package/dist/server/api.d.ts +8 -0
- package/dist/server/api.js +1234 -0
- package/dist/server/async-tick-server.d.ts +5 -0
- package/dist/server/async-tick-server.js +63 -0
- package/dist/server/errors.d.ts +78 -0
- package/dist/server/errors.js +156 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +134 -0
- package/dist/server/tick-server.d.ts +9 -0
- package/dist/server/tick-server.js +114 -0
- package/dist/server/validation.d.ts +194 -0
- package/dist/server/validation.js +114 -0
- package/package.json +65 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BURNRATE Database Layer
|
|
3
|
+
* SQLite-based persistence for game state
|
|
4
|
+
*/
|
|
5
|
+
import { Zone, Route, Player, Faction, Shipment, Unit, MarketOrder, Contract, IntelReport, GameEvent, FactionRank } from '../core/types.js';
|
|
6
|
+
export declare class GameDatabase {
|
|
7
|
+
private db;
|
|
8
|
+
constructor(dbPath?: string);
|
|
9
|
+
private initSchema;
|
|
10
|
+
getCurrentTick(): number;
|
|
11
|
+
incrementTick(): number;
|
|
12
|
+
getSeasonInfo(): {
|
|
13
|
+
seasonNumber: number;
|
|
14
|
+
seasonWeek: number;
|
|
15
|
+
};
|
|
16
|
+
createZone(zone: Omit<Zone, 'id'>): Zone;
|
|
17
|
+
getZone(id: string): Zone | null;
|
|
18
|
+
getAllZones(): Zone[];
|
|
19
|
+
updateZone(id: string, updates: Partial<Zone>): void;
|
|
20
|
+
private rowToZone;
|
|
21
|
+
createRoute(route: Omit<Route, 'id'>): Route;
|
|
22
|
+
getRoute(id: string): Route | null;
|
|
23
|
+
getRoutesBetween(fromZoneId: string, toZoneId: string): Route[];
|
|
24
|
+
getRoutesFromZone(zoneId: string): Route[];
|
|
25
|
+
getAllRoutes(): Route[];
|
|
26
|
+
private rowToRoute;
|
|
27
|
+
createPlayer(name: string, startingZoneId: string): Player;
|
|
28
|
+
getPlayer(id: string): Player | null;
|
|
29
|
+
getPlayerByName(name: string): Player | null;
|
|
30
|
+
getAllPlayers(): Player[];
|
|
31
|
+
updatePlayer(id: string, updates: Partial<Player>): void;
|
|
32
|
+
private rowToPlayer;
|
|
33
|
+
createFaction(name: string, tag: string, founderId: string): Faction;
|
|
34
|
+
getFaction(id: string): Faction | null;
|
|
35
|
+
getAllFactions(): Faction[];
|
|
36
|
+
private rowToFaction;
|
|
37
|
+
addFactionMember(factionId: string, playerId: string, rank?: FactionRank): void;
|
|
38
|
+
removeFactionMember(factionId: string, playerId: string): void;
|
|
39
|
+
updateFactionMemberRank(factionId: string, playerId: string, rank: FactionRank): void;
|
|
40
|
+
createShipment(shipment: Omit<Shipment, 'id'>): Shipment;
|
|
41
|
+
getShipment(id: string): Shipment | null;
|
|
42
|
+
getActiveShipments(): Shipment[];
|
|
43
|
+
getPlayerShipments(playerId: string): Shipment[];
|
|
44
|
+
updateShipment(id: string, updates: Partial<Shipment>): void;
|
|
45
|
+
private rowToShipment;
|
|
46
|
+
createOrder(order: Omit<MarketOrder, 'id'>): MarketOrder;
|
|
47
|
+
getOrder(id: string): MarketOrder | null;
|
|
48
|
+
getOrdersForZone(zoneId: string, resource?: string): MarketOrder[];
|
|
49
|
+
updateOrder(id: string, quantity: number): void;
|
|
50
|
+
deleteOrder(id: string): void;
|
|
51
|
+
private rowToOrder;
|
|
52
|
+
recordEvent(event: Omit<GameEvent, 'id'>): GameEvent;
|
|
53
|
+
getEvents(options?: {
|
|
54
|
+
limit?: number;
|
|
55
|
+
offset?: number;
|
|
56
|
+
type?: string;
|
|
57
|
+
actorId?: string;
|
|
58
|
+
sincesTick?: number;
|
|
59
|
+
}): GameEvent[];
|
|
60
|
+
createContract(contract: Omit<Contract, 'id'>): Contract;
|
|
61
|
+
getContract(id: string): Contract | null;
|
|
62
|
+
getOpenContracts(zoneId?: string): Contract[];
|
|
63
|
+
updateContract(id: string, updates: {
|
|
64
|
+
status?: string;
|
|
65
|
+
acceptedBy?: string;
|
|
66
|
+
}): void;
|
|
67
|
+
private rowToContract;
|
|
68
|
+
createUnit(unit: Omit<Unit, 'id'>): Unit;
|
|
69
|
+
getUnit(id: string): Unit | null;
|
|
70
|
+
getPlayerUnits(playerId: string): Unit[];
|
|
71
|
+
updateUnit(id: string, updates: Partial<Unit>): void;
|
|
72
|
+
deleteUnit(id: string): void;
|
|
73
|
+
private rowToUnit;
|
|
74
|
+
getUnitsForSaleAtZone(zoneId: string): Unit[];
|
|
75
|
+
createIntel(intel: Omit<IntelReport, 'id'>): IntelReport;
|
|
76
|
+
getPlayerIntel(playerId: string, limit?: number): IntelReport[];
|
|
77
|
+
getFactionIntel(factionId: string, limit?: number): IntelReport[];
|
|
78
|
+
getLatestIntelForTarget(targetType: 'zone' | 'route', targetId: string, factionId?: string): IntelReport | null;
|
|
79
|
+
private rowToIntel;
|
|
80
|
+
close(): void;
|
|
81
|
+
/** Run arbitrary SQL (for testing/migrations) */
|
|
82
|
+
exec(sql: string): void;
|
|
83
|
+
}
|