screeps-connectivity 0.7.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fb4ab0a: Add a read-only Market section — all orders, my orders, and history — matching the vanilla client.
8
+
9
+ ### Patch Changes
10
+
11
+ - 620f551: Add Power Creeps pages — list, create, and per-creep power upgrades — from the Overview page.
12
+
3
13
  ## 0.7.0
4
14
 
5
15
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screeps-connectivity",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "repository": {
@@ -15,6 +15,10 @@ import type {
15
15
  ApiGameTickResponse,
16
16
  RoomHistoryChunk,
17
17
  ApiRoomDecorationsResponse,
18
+ ApiMarketOrdersIndexResponse,
19
+ ApiMarketOrdersResponse,
20
+ ApiMarketMyOrdersResponse,
21
+ ApiMarketStatsResponse,
18
22
  } from '../../types/api.js'
19
23
  import { createPowerCreepsEndpoints, type PowerCreepsEndpoints } from './power-creeps.js'
20
24
 
@@ -49,10 +53,10 @@ export interface GameEndpoints {
49
53
  removeInvader(id: string): Promise<{ ok: number }>
50
54
  powerCreeps: PowerCreepsEndpoints
51
55
  market: {
52
- ordersIndex(shard?: string | null): Promise<unknown>
53
- myOrders(): Promise<unknown>
54
- orders(resourceType: string, shard?: string | null): Promise<unknown>
55
- stats(resourceType: string, shard?: string | null): Promise<unknown>
56
+ ordersIndex(shard?: string | null): Promise<ApiMarketOrdersIndexResponse>
57
+ myOrders(): Promise<ApiMarketMyOrdersResponse>
58
+ orders(resourceType: string, shard?: string | null): Promise<ApiMarketOrdersResponse>
59
+ stats(resourceType: string, shard?: string | null): Promise<ApiMarketStatsResponse>
56
60
  }
57
61
  shards: {
58
62
  info(): Promise<ApiShardsInfoResponse>
package/src/index.ts CHANGED
@@ -40,7 +40,7 @@ export type {
40
40
 
41
41
  export { fetchServerVersion, fetchAuthModInfo, checkUsername, checkEmail, registerUser, getServerFeature, getScreepsmodAuth } from './http/fetchServerVersion.js'
42
42
  export type { ApiAuthModInfoResponse } from './http/fetchServerVersion.js'
43
- export type { RoomHistoryChunk, ApiRoomDecorationsResponse, ApiRoomDecorationItem, ApiRoomDecorationDef, ApiRoomDecorationGraphic, ApiRoomDecorationActive, ApiUserOverviewResponse, ApiUserOverviewTotals, ApiUserRoomsResponse } from './types/api.js'
43
+ export type { RoomHistoryChunk, ApiRoomDecorationsResponse, ApiRoomDecorationItem, ApiRoomDecorationDef, ApiRoomDecorationGraphic, ApiRoomDecorationActive, ApiUserOverviewResponse, ApiUserOverviewTotals, ApiUserRoomsResponse, ApiUserMoneyHistoryResponse, ApiMarketOrder, ApiMarketOrdersIndexResponse, ApiMarketOrdersResponse, ApiMarketMyOrdersResponse, ApiMarketStat, ApiMarketStatsResponse, ApiPowerCreep, ApiPowerCreepsListResponse } from './types/api.js'
44
44
  export { ROOM_DECORATIONS_MOCK } from './mocks/roomDecorations.js'
45
45
 
46
46
  export { badgeToSvg } from './badge/index.js'
package/src/types/api.ts CHANGED
@@ -245,6 +245,8 @@ export interface ApiUserFindResponse {
245
245
  export interface ApiUserMoneyHistoryResponse {
246
246
  ok: number
247
247
  page: number
248
+ // True when an older page exists; drives the History "Older" pager.
249
+ hasMore?: boolean
248
250
  list: Array<{
249
251
  _id: string
250
252
  date: string
@@ -252,10 +254,64 @@ export interface ApiUserMoneyHistoryResponse {
252
254
  type: string
253
255
  balance: number
254
256
  change: number
257
+ // Shard the transaction occurred on (official multi-shard servers only).
258
+ shard?: string
255
259
  market?: unknown
256
260
  }>
257
261
  }
258
262
 
263
+ // Market — a single order from game/market/orders (public) or my-orders (own).
264
+ // `active`/`totalAmount` are returned only for your own orders. `range` is not
265
+ // part of the API response — the client computes it as the room distance to a
266
+ // chosen target room.
267
+ export interface ApiMarketOrder {
268
+ _id: string
269
+ type: 'sell' | 'buy'
270
+ resourceType: string
271
+ price: number
272
+ amount: number
273
+ remainingAmount: number
274
+ /** Original order size — own orders only. */
275
+ totalAmount?: number
276
+ /** Whether the order is currently funded/stocked — own orders only. */
277
+ active?: boolean
278
+ /** Source/target room; absent for token and other roomless orders. */
279
+ roomName?: string
280
+ created?: number
281
+ }
282
+
283
+ export interface ApiMarketOrdersIndexResponse {
284
+ ok: number
285
+ // One entry per resource type that has open orders; `_id` is the resource type.
286
+ list: Array<{ _id: string; count: number }>
287
+ }
288
+
289
+ export interface ApiMarketOrdersResponse {
290
+ ok: number
291
+ list: ApiMarketOrder[]
292
+ }
293
+
294
+ // Own orders: multi-shard servers return `shards` keyed by shard name;
295
+ // single-shard servers return a flat `list` instead.
296
+ export interface ApiMarketMyOrdersResponse {
297
+ ok: number
298
+ shards?: Record<string, ApiMarketOrder[]>
299
+ list?: ApiMarketOrder[]
300
+ }
301
+
302
+ export interface ApiMarketStat {
303
+ date: string
304
+ transactions: number
305
+ volume: number
306
+ avgPrice: number
307
+ stddevPrice: number
308
+ }
309
+
310
+ export interface ApiMarketStatsResponse {
311
+ ok: number
312
+ stats: ApiMarketStat[]
313
+ }
314
+
259
315
  export interface ApiUserMessage {
260
316
  _id: string
261
317
  date: string