@diffenderfer-games/hub 0.0.0-stage → 2.0.0-next.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 +138 -2
- package/dist/auto.d.ts +36 -0
- package/dist/auto.d.ts.map +1 -0
- package/dist/auto.js +27 -0
- package/dist/auto.js.map +1 -0
- package/dist/daily.d.ts +2 -0
- package/dist/daily.js +1 -0
- package/dist/doctor/cli.mjs +238 -0
- package/dist/doctor/cli.mjs.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +6 -0
- package/dist/input.d.ts +2 -0
- package/dist/input.js +3 -0
- package/dist/mp.d.ts +4 -0
- package/dist/mp.js +1 -0
- package/dist/race.d.ts +4 -0
- package/dist/race.js +1 -0
- package/dist/rooms.d.ts +4 -0
- package/dist/rooms.js +1 -0
- package/dist/shared/bridge.js +209 -0
- package/dist/shared/bridge.js.map +1 -0
- package/dist/shared/client-version.gen.js +7 -0
- package/dist/shared/client-version.gen.js.map +1 -0
- package/dist/shared/daily.d.ts +123 -0
- package/dist/shared/daily.d.ts.map +1 -0
- package/dist/shared/daily.js +191 -0
- package/dist/shared/daily.js.map +1 -0
- package/dist/shared/dom.js +48 -0
- package/dist/shared/dom.js.map +1 -0
- package/dist/shared/globals.js +97 -0
- package/dist/shared/globals.js.map +1 -0
- package/dist/shared/index.d.ts +706 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/input.d.ts +730 -0
- package/dist/shared/input.d.ts.map +1 -0
- package/dist/shared/input.js +2718 -0
- package/dist/shared/input.js.map +1 -0
- package/dist/shared/latest-state.js +17 -0
- package/dist/shared/latest-state.js.map +1 -0
- package/dist/shared/mp.d.ts +9 -0
- package/dist/shared/mp.d.ts.map +1 -0
- package/dist/shared/mp.js +30 -0
- package/dist/shared/mp.js.map +1 -0
- package/dist/shared/multiplayer-types.d.ts +47 -0
- package/dist/shared/multiplayer-types.d.ts.map +1 -0
- package/dist/shared/page-stack.js +207 -0
- package/dist/shared/page-stack.js.map +1 -0
- package/dist/shared/race-types.d.ts +126 -0
- package/dist/shared/race-types.d.ts.map +1 -0
- package/dist/shared/race.d.ts +9 -0
- package/dist/shared/race.d.ts.map +1 -0
- package/dist/shared/race.js +53 -0
- package/dist/shared/race.js.map +1 -0
- package/dist/shared/room-types.d.ts +125 -0
- package/dist/shared/room-types.d.ts.map +1 -0
- package/dist/shared/rooms.d.ts +9 -0
- package/dist/shared/rooms.d.ts.map +1 -0
- package/dist/shared/rooms.js +62 -0
- package/dist/shared/rooms.js.map +1 -0
- package/dist/shared/runtime-opener.js +84 -0
- package/dist/shared/runtime-opener.js.map +1 -0
- package/dist/shared/social.d.ts +148 -0
- package/dist/shared/social.d.ts.map +1 -0
- package/dist/shared/social.js +73 -0
- package/dist/shared/social.js.map +1 -0
- package/dist/shared/src.js +2164 -0
- package/dist/shared/src.js.map +1 -0
- package/dist/shared/wire-types.d.ts +51 -0
- package/dist/shared/wire-types.d.ts.map +1 -0
- package/dist/social.d.ts +6 -0
- package/dist/social.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +0 -0
- package/package.json +87 -4
- package/src/auto.ts +39 -0
- package/src/core/connection.ts +299 -0
- package/src/core/errors.ts +147 -0
- package/src/core/game-data.ts +38 -0
- package/src/core/hub-economy.ts +179 -0
- package/src/core/hub-progress.ts +205 -0
- package/src/core/hub.ts +131 -0
- package/src/core/menu-control.ts +61 -0
- package/src/core/offline/events.ts +50 -0
- package/src/core/offline/favorites.ts +21 -0
- package/src/core/offline/local-store.ts +261 -0
- package/src/core/offline/queue.ts +171 -0
- package/src/core/page.ts +74 -0
- package/src/core/rest/endpoint-types.ts +22 -0
- package/src/core/rest/rest-client.ts +152 -0
- package/src/core/rest/routes.gen.ts +90 -0
- package/src/core/storage/json-guards.ts +74 -0
- package/src/core/storage/key-value.ts +66 -0
- package/src/core/ticket.ts +43 -0
- package/src/core/types.ts +134 -0
- package/src/core/version/client-version.gen.ts +3 -0
- package/src/core/version/hub-version.ts +62 -0
- package/src/core/version/semver.ts +97 -0
- package/src/daily/daily-system.ts +161 -0
- package/src/daily/page-daily.ts +36 -0
- package/src/daily/types.ts +67 -0
- package/src/daily.ts +10 -0
- package/src/doctor/checks.ts +76 -0
- package/src/doctor/cli.ts +106 -0
- package/src/doctor/tsconfig.json +12 -0
- package/src/globals.ts +110 -0
- package/src/index.ts +50 -0
- package/src/input/device-state.ts +146 -0
- package/src/input/edges.ts +55 -0
- package/src/input/gamepad.ts +61 -0
- package/src/input/input-events.ts +32 -0
- package/src/input/input-registry.ts +164 -0
- package/src/input/input-system.ts +393 -0
- package/src/input/legacy-controls.ts +64 -0
- package/src/input/nav-state.ts +191 -0
- package/src/input/navigator.ts +171 -0
- package/src/input/on-screen-controls.ts +101 -0
- package/src/input/page-control.ts +43 -0
- package/src/input/page-input.ts +193 -0
- package/src/input/player-remaps.ts +77 -0
- package/src/input/source-values.ts +116 -0
- package/src/input/spatial.ts +47 -0
- package/src/input/types.ts +331 -0
- package/src/input/zero-config.ts +177 -0
- package/src/input.ts +22 -0
- package/src/mp.ts +10 -0
- package/src/overlay/controls-panel.ts +163 -0
- package/src/overlay/dom.ts +46 -0
- package/src/overlay/layout-clusters.ts +162 -0
- package/src/overlay/layout-geometry.ts +136 -0
- package/src/overlay/layout.ts +203 -0
- package/src/overlay/listener-scope.ts +23 -0
- package/src/overlay/on-screen-keyboard.ts +137 -0
- package/src/overlay/overlay.ts +208 -0
- package/src/overlay/styles.ts +54 -0
- package/src/overlay/virtual-controls.ts +262 -0
- package/src/race.ts +10 -0
- package/src/realtime/bridge.ts +121 -0
- package/src/realtime/cross-bundle.ts +29 -0
- package/src/realtime/fallback-notice.ts +48 -0
- package/src/realtime/hub-link.ts +65 -0
- package/src/realtime/latest-state.ts +33 -0
- package/src/realtime/multiplayer-forwarder.ts +28 -0
- package/src/realtime/multiplayer-types.ts +52 -0
- package/src/realtime/page-runtime.ts +60 -0
- package/src/realtime/race-forwarder.ts +59 -0
- package/src/realtime/race-types.ts +132 -0
- package/src/realtime/room-types.ts +125 -0
- package/src/realtime/rooms-forwarder.ts +79 -0
- package/src/realtime/runtime-api.ts +49 -0
- package/src/realtime/runtime-opener.ts +61 -0
- package/src/realtime/social-forwarder.ts +72 -0
- package/src/realtime/social-types.ts +78 -0
- package/src/realtime/types.ts +53 -0
- package/src/realtime/wire-types.ts +72 -0
- package/src/rooms.ts +10 -0
- package/src/social.ts +18 -0
- package/src/types.ts +13 -0
- package/src/uistack/page-stack.ts +45 -0
- package/src/uistack/play-suspension.ts +82 -0
- package/src/uistack/types.ts +76 -0
- package/src/uistack/ui-stack.ts +144 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Philip Diffenderfer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,139 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @diffenderfer-games/hub
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The client library for games on [diffenderfer.games](https://diffenderfer.games):
|
|
4
|
+
accounts, saves, stats, leaderboards, inventory and trades, daily challenges,
|
|
5
|
+
the input system (keyboard, touch and gamepad), and the social, multiplayer,
|
|
6
|
+
rooms and race namespaces. It is typed from the hub's wire contract
|
|
7
|
+
(`@diffenderfer-games/hub-contract`), ships ES modules with `.d.ts` files, and
|
|
8
|
+
carries no zod at runtime.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @diffenderfer-games/hub
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
ESM only, for browsers (ES2020: Safari 14+, current Chrome, Edge and Firefox).
|
|
17
|
+
Node 20+ for the `hub-doctor` command.
|
|
18
|
+
|
|
19
|
+
## Use
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { hub } from '@diffenderfer-games/hub';
|
|
23
|
+
|
|
24
|
+
const { user } = await hub.me();
|
|
25
|
+
await hub.ensureGuest(); // a guest account, so progress saves without a sign-in
|
|
26
|
+
await hub.putSave('auto', { level: 7, gold: 120 });
|
|
27
|
+
await hub.submitScore('highscore', 9001, { title: 'High Score' });
|
|
28
|
+
hub.recordPlay();
|
|
29
|
+
|
|
30
|
+
hub.input.define({ groups: { play: { inputs: { jump: { keys: [' '], gamepad: { button: 0 } } } } } });
|
|
31
|
+
hub.input.enable('play');
|
|
32
|
+
hub.daily.define({ play: (challenge) => startLevel(challenge.seed) });
|
|
33
|
+
hub.overlay.autoPause({ pause, resume });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
In a game the host serves, the slug and the API base are read from the page.
|
|
37
|
+
For anything else, create a client yourself:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { createHub } from '@diffenderfer-games/hub';
|
|
41
|
+
|
|
42
|
+
const demo = createHub({ slug: 'my-game', apiBase: '/_api', offline: 'auto' });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A game's own JSON is typed by the game: `hub.getSave<MySave>('auto')`,
|
|
46
|
+
`hub.putSave<MySave>('auto', save)`, `hub.getProfile<MyProfile>()`.
|
|
47
|
+
|
|
48
|
+
## Entry points
|
|
49
|
+
|
|
50
|
+
| Import | What it has |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `@diffenderfer-games/hub` | `hub`, `createHub`, `Hub`, the errors, every client type, and the input and daily exports |
|
|
53
|
+
| `@diffenderfer-games/hub/input` | `getInput`, `InputSystem`, the on-screen control layout, `getUiStack` |
|
|
54
|
+
| `@diffenderfer-games/hub/daily` | `getDaily`, `DailySystem` |
|
|
55
|
+
| `@diffenderfer-games/hub/race`, `/social`, `/mp`, `/rooms` | one namespace each (`race`, `social` with `presence` and `notify`, `mp`, `rooms`) |
|
|
56
|
+
| `@diffenderfer-games/hub/types` | type-only: every contract type (requests, replies, entities, error codes, socket ops and events, the `game.*` manifest) |
|
|
57
|
+
| `@diffenderfer-games/hub/auto` | everything above, and it sets `window.HubSDK` (what `/_hub/hub.js` is built from) |
|
|
58
|
+
|
|
59
|
+
The namespaces also hang off `hub` (`hub.input`, `hub.daily`, `hub.race`,
|
|
60
|
+
`hub.social`, `hub.presence`, `hub.notify`, `hub.mp`, `hub.rooms`,
|
|
61
|
+
`hub.overlay`, `hub.menu`), created on first use.
|
|
62
|
+
|
|
63
|
+
## Errors
|
|
64
|
+
|
|
65
|
+
Every call rejects with a `HubError` when it fails. `status` is the HTTP
|
|
66
|
+
status, or `undefined` when the hub could not be reached (`isOffline`).
|
|
67
|
+
`code`, `reason`, `hint` and `retryAfterMs` come from the hub's error body.
|
|
68
|
+
|
|
69
|
+
- `ContentRejectedError`: the safety filter refused some text (HTTP 422).
|
|
70
|
+
Keep the player's draft and show `hint`.
|
|
71
|
+
- `OfflineError`: an action that needs the hub was tried offline.
|
|
72
|
+
- `code: 'unsupported_by_hub'`: the hub does not have this call yet (the game
|
|
73
|
+
uses a newer client than the deployed hub). Deploy the hub first.
|
|
74
|
+
|
|
75
|
+
The analytics calls (`recordPlay`, `heartbeat`, `event`) never throw.
|
|
76
|
+
|
|
77
|
+
## Offline
|
|
78
|
+
|
|
79
|
+
With `offline: 'auto'` (the default), reads fall back to a cache in
|
|
80
|
+
`localStorage` when the hub can't be reached, and writes (saves, stats,
|
|
81
|
+
scores, profile) apply to the cache at once and are queued. The queue replays
|
|
82
|
+
in order when the connection returns; `hub.sync()` replays it on demand,
|
|
83
|
+
`hub.pending()` counts what waits, and `hub.onStatus(listener)` reports
|
|
84
|
+
changes. `hub.prefetchAll()` warms the cache for every game in one request.
|
|
85
|
+
`offline: 'always'` never touches the network (develop without a hub);
|
|
86
|
+
`offline: 'never'` always throws instead.
|
|
87
|
+
|
|
88
|
+
The cache and queue use the same `localStorage` keys as the old vendored
|
|
89
|
+
client, so a game that switches to this package keeps its players' queued
|
|
90
|
+
progress.
|
|
91
|
+
|
|
92
|
+
## Games without a build step
|
|
93
|
+
|
|
94
|
+
Keep `import('/_hub/hub.js')` or `window.HubSDK.hub`: the host serves a
|
|
95
|
+
bundle of this package's `./auto` entry, at the version the host was built
|
|
96
|
+
with. Install the package as a dev dependency only if you want editor types:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
/** @type {import('@diffenderfer-games/hub').Hub} */
|
|
100
|
+
const hub = window.HubSDK.hub;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Versions
|
|
104
|
+
|
|
105
|
+
The client sends its version as `x-hub-client`. `hub.hubVersion()` reads the
|
|
106
|
+
hub's `GET /_api/version` (`{ server, contract, supported, deprecated }`) once
|
|
107
|
+
per page, and `hub.clientSupport()` says whether this client is `supported`,
|
|
108
|
+
`deprecated` or `unsupported` (`unknown` on a hub from before versioning).
|
|
109
|
+
|
|
110
|
+
The hub supports the current major and the previous one. Update with
|
|
111
|
+
`npm update @diffenderfer-games/hub`.
|
|
112
|
+
|
|
113
|
+
## hub-doctor
|
|
114
|
+
|
|
115
|
+
Run it in a game's folder, in CI and before pushing:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
npx hub-doctor # checks against https://diffenderfer.games
|
|
119
|
+
npx hub-doctor --offline # skip the version check
|
|
120
|
+
npx hub-doctor --hub http://localhost:8080 --dir ../my-game --json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
It fails when the installed client is outside the hub's `supported` range or
|
|
124
|
+
the `package.json` `game.*` block does not match the manifest schema, and it
|
|
125
|
+
warns when the client is deprecated or a vendored `src/hub/` copy (or
|
|
126
|
+
`scripts/sync-hub.mjs`) is still around.
|
|
127
|
+
|
|
128
|
+
## Moving from the vendored copy
|
|
129
|
+
|
|
130
|
+
1. `npm install @diffenderfer-games/hub`.
|
|
131
|
+
2. Change `from './hub/hub'` (or `'./hub'`) to `from '@diffenderfer-games/hub'`.
|
|
132
|
+
3. Delete `src/hub/` and `scripts/sync-hub.mjs`.
|
|
133
|
+
4. Add `npx hub-doctor` to the game's CI.
|
|
134
|
+
|
|
135
|
+
Every method name is unchanged.
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT
|
package/dist/auto.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { a as RaceResultPlayer, c as RoomChatLine, d as RoomStateChange, f as SchemaOutput, i as RaceRecordPlayer, l as RoomMessage, m as Snapshot, n as Notice, o as RaceStatusEvent, p as ServerEvents, r as RaceHistory, s as RealtimeErrorShape, t as InviteCreated, u as RoomSeat } from "./shared/wire-types.js";
|
|
2
|
+
import { _ as DailyStatus, a as isDailySystem, c as DailyAll, d as DailyCompletionMeta, f as DailyDefinition, g as DailyStartResponse, h as DailyHost, i as getDaily, l as DailyChallenge, m as DailyGameStatus, n as DailyCompletions, o as DAILY_START_EVENT, p as DailyEventDetail, r as DAILY_SINGLETON_API, s as DailySystem, t as DailyCompletion, u as DailyCompleteResponse } from "./shared/daily.js";
|
|
3
|
+
import { $ as VirtualControlType, A as AxisSide, B as InputReading, C as parseInputOverrides, D as isPageInputControl, E as PageInputControl, F as InputConfig, G as NavElement, H as MenuBridge, I as InputDef, J as NavTarget, K as NavElementKind, L as InputEvents, M as EdgeOffsets, N as GamepadMapping, O as Anchor, P as GroupDef, Q as Vector, R as InputHost, S as isInputSystem, T as InputSystemOptions, U as MouseMapping, V as InputSource, W as NavBlurEvent, X as Rect, Y as NavigableDef, Z as TouchMapping, _ as boxesTouch, a as OverlayEdge, b as InputOptions, c as OverlayReason, d as LayoutOptions, et as VirtualDef, f as layoutControls, g as LayoutItem, h as LayoutBox, i as AutoPauseOptions, j as DraggedSpot, k as AxisDef, l as UiStack, m as Insets, n as getUiStack, nt as VirtualOverride, o as OverlayEvent, p as Overlay, q as NavFocusEvent, r as isUiStack, s as OverlayListener, t as UI_STACK_VERSION, tt as VirtualInputs, u as UiStackHandoff, v as controlSize, w as InputSystem, x as getInput, y as INPUT_SINGLETON_API, z as InputOverrides } from "./shared/input.js";
|
|
4
|
+
import { a as JoinInfoEvent, i as InviteResult, n as HubMpApi, r as InviteOptions, t as BusyOptions } from "./shared/multiplayer-types.js";
|
|
5
|
+
import { o as multiplayerForwarder } from "./shared/mp.js";
|
|
6
|
+
import { a as RoomEvents, c as RoomSendOptions, i as RoomCreateOptions, l as RoomState, n as HubRoomsApi, o as RoomListOptions, r as JoinOptions, s as RoomSelf, t as HubRoom, u as RoomStateOptions } from "./shared/room-types.js";
|
|
7
|
+
import { a as RaceHistoryQuery, c as RaceRuntimeApi, i as RaceEvents, l as RaceStart, n as RaceCreateOptions, o as RaceHistoryViewOptions, r as RaceDefinition, s as RaceHudPlace, t as HubRaceApi } from "./shared/race-types.js";
|
|
8
|
+
import { f as raceForwarder } from "./shared/race.js";
|
|
9
|
+
import { n as roomsForwarder } from "./shared/rooms.js";
|
|
10
|
+
import { $ as HubNotifyApi, A as RacerState, B as SuggestionStatus, C as RaceRecord, D as RaceStats, E as RaceState, F as ReportReason, G as REALTIME_READY_EVENT, H as isRealtimeApi, I as RoomInfo, J as RealtimeHubLink, K as REALTIME_SINGLETON_API, L as SocialConfig, M as Relation, N as ReportInput, O as Racer, P as ReportKind, Q as socialForwarder, R as SocialMe, S as RaceParams, T as RaceStatValue, U as REALTIME_FAILED_EVENT, V as findRealtimeApi, W as REALTIME_FEATURE_VERSION, X as notifyForwarder, Y as linkRealtimeToHub, Z as presenceForwarder, _ as PlayerLite, a as ErrorBody, at as SocialEvents, b as PresenceKind, c as JoinInfo, d as Message, et as HubPresenceApi, f as MessagesPage, g as PlayerCard, h as Party, i as Counts, it as SocialCounts, j as RecentPlayer, k as RacerResult, l as Launch, m as NotifyPrefs, n as ChatMode, nt as OpenInviteOptions, o as FriendEntry, p as NotifyChange, q as RealtimeApi, r as Conversation, rt as PlayerRef, s as Invite, t as Audience, tt as HubSocialApi, u as LaunchTicket, v as Presence, w as RaceResult, x as RaceOutcome, y as PresenceInput, z as Suggestion } from "./shared/social.js";
|
|
11
|
+
import { $ as SubmitScoreResult, A as BoardWithTop, B as Json, C as CLIENT_VERSION_HEADER, D as QueuedScoreOptions, E as QueueOpInput, F as GlobalAnalytics, G as Profile, H as LeaderboardResult, I as HubOptions, J as SaveMeta, K as ProfileSummary, L as HubStatus, M as GameInfo, N as GameLeaderboards, O as BufferedEvent, P as GameRecords, Q as SubmitScoreOptions, R as Inventory, S as SyncResult, T as QueueOp, U as MeResponse, V as LeaderboardEntry, W as Metrics, X as SortDir, Y as SnapshotResponse, Z as Stats, _ as TradeNoteOptions, a as HubErrorDetails, b as StatResult, c as Hub, d as ClientSupport, et as User, f as HubMenuControl, g as TradeListOptions, h as TradeId, i as HubErrorCode, it as GamePayload, j as GameAnalytics, k as Board, l as createHub, m as TradeBundle, n as ContentRejectedError, nt as EndpointName, o as OfflineError, p as GrantBundle, q as Save, r as HubError, rt as EndpointReply, s as UNSUPPORTED_BY_HUB, t as HUB_CLIENT_VERSION, tt as EndpointFields, u as hub, v as AuthResponse, w as ProfilePatch, x as SyncConflict, y as ProfileUpdate, z as InventorySnapshot } from "./shared/index.js";
|
|
12
|
+
//#region src/auto.d.ts
|
|
13
|
+
/** What `window.HubSDK` holds. */
|
|
14
|
+
export interface HubSdkGlobal {
|
|
15
|
+
/** The page's client. */
|
|
16
|
+
readonly hub: Hub;
|
|
17
|
+
/** Create another client. */
|
|
18
|
+
readonly createHub: typeof createHub;
|
|
19
|
+
/** The client class. */
|
|
20
|
+
readonly Hub: typeof Hub;
|
|
21
|
+
/** The base error class. */
|
|
22
|
+
readonly HubError: typeof HubError;
|
|
23
|
+
/** The offline error class. */
|
|
24
|
+
readonly OfflineError: typeof OfflineError;
|
|
25
|
+
/** The content-rejected error class. */
|
|
26
|
+
readonly ContentRejectedError: typeof ContentRejectedError;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface Window {
|
|
30
|
+
/** The hub client for games without a build step (installed by `@diffenderfer-games/hub/auto`). */
|
|
31
|
+
HubSDK?: HubSdkGlobal;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { type Anchor, type Audience, type AuthResponse, type AutoPauseOptions, type AxisDef, type AxisSide, type Board, type BoardWithTop, type BufferedEvent, type BusyOptions, CLIENT_VERSION_HEADER, type ChatMode, type ClientSupport, ContentRejectedError, type Conversation, type Counts, DAILY_SINGLETON_API, DAILY_START_EVENT, type DailyAll, type DailyChallenge, type DailyCompleteResponse, type DailyCompletion, type DailyCompletionMeta, type DailyCompletions, type DailyDefinition, type DailyEventDetail, type DailyGameStatus, type DailyHost, type DailyStartResponse, type DailyStatus, DailySystem, type DraggedSpot, type EdgeOffsets, type EndpointFields, type EndpointName, type EndpointReply, type ErrorBody, type FriendEntry, type GameAnalytics, type GameInfo, type GameLeaderboards, type GamePayload, type GameRecords, type GamepadMapping, type GlobalAnalytics, type GrantBundle, type GroupDef, HUB_CLIENT_VERSION, Hub, HubError, type HubErrorCode, type HubErrorDetails, type HubMenuControl, type HubMpApi, type HubNotifyApi, type HubOptions, type HubPresenceApi, type HubRaceApi, type HubRoom, type HubRoomsApi, type HubSocialApi, type HubStatus, INPUT_SINGLETON_API, type InputConfig, type InputDef, type InputEvents, type InputHost, type InputOptions, type InputOverrides, type InputReading, type InputSource, InputSystem, type InputSystemOptions, type Insets, type Inventory, type InventorySnapshot, type Invite, type InviteCreated, type InviteOptions, type InviteResult, type JoinInfo, type JoinInfoEvent, type JoinOptions, type Json, type Launch, type LaunchTicket, type LayoutBox, type LayoutItem, type LayoutOptions, type LeaderboardEntry, type LeaderboardResult, type MeResponse, type MenuBridge, type Message, type MessagesPage, type Metrics, type MouseMapping, type NavBlurEvent, type NavElement, type NavElementKind, type NavFocusEvent, type NavTarget, type NavigableDef, type Notice, type NotifyChange, type NotifyPrefs, OfflineError, type OpenInviteOptions, Overlay, type OverlayEdge, type OverlayEvent, type OverlayListener, type OverlayReason, type PageInputControl, type Party, type PlayerCard, type PlayerLite, type PlayerRef, type Presence, type PresenceInput, type PresenceKind, type Profile, type ProfilePatch, type ProfileSummary, type ProfileUpdate, type QueueOp, type QueueOpInput, type QueuedScoreOptions, type REALTIME_FAILED_EVENT, type REALTIME_FEATURE_VERSION, type REALTIME_READY_EVENT, type REALTIME_SINGLETON_API, type RaceCreateOptions, type RaceDefinition, type RaceEvents, type RaceHistory, type RaceHistoryQuery, type RaceHistoryViewOptions, type RaceHudPlace, type RaceOutcome, type RaceParams, type RaceRecord, type RaceRecordPlayer, type RaceResult, type RaceResultPlayer, type RaceRuntimeApi, type RaceStart, type RaceStatValue, type RaceState, type RaceStats, type RaceStatusEvent, type Racer, type RacerResult, type RacerState, type RealtimeApi, type RealtimeErrorShape, type RealtimeHubLink, type RecentPlayer, type Rect, type Relation, type ReportInput, type ReportKind, type ReportReason, type RoomChatLine, type RoomCreateOptions, type RoomEvents, type RoomInfo, type RoomListOptions, type RoomMessage, type RoomSeat, type RoomSelf, type RoomSendOptions, type RoomState, type RoomStateChange, type RoomStateOptions, type Save, type SaveMeta, type SchemaOutput, type ServerEvents, type Snapshot, type SnapshotResponse, type SocialConfig, type SocialCounts, type SocialEvents, type SocialMe, type SortDir, type StatResult, type Stats, type SubmitScoreOptions, type SubmitScoreResult, type Suggestion, type SuggestionStatus, type SyncConflict, type SyncResult, type TouchMapping, type TradeBundle, type TradeId, type TradeListOptions, type TradeNoteOptions, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, type UiStack, type UiStackHandoff, type User, type Vector, type VirtualControlType, type VirtualDef, type VirtualInputs, type VirtualOverride, boxesTouch, controlSize, createHub, type findRealtimeApi, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, type isRealtimeApi, isUiStack, layoutControls, type linkRealtimeToHub, type multiplayerForwarder as mp, type notifyForwarder as notify, parseInputOverrides, type presenceForwarder as presence, type raceForwarder as race, type roomsForwarder as rooms, type socialForwarder as social };
|
|
36
|
+
//# sourceMappingURL=auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.d.ts","names":[],"sources":["../src/auto.ts"],"mappings":";;;;;;;;;;;;;iBAciB;;WAEN,KAAK;;WAEL,kBAAkB;;WAElB,YAAY;;WAEZ,iBAAiB;;WAEjB,qBAAqB;;WAErB,6BAA6B;;QAGhC;YACI;;IAER,SAAS"}
|
package/dist/auto.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { a as DailySystem, i as DAILY_START_EVENT, n as getDaily, r as isDailySystem, t as DAILY_SINGLETON_API } from "./shared/daily.js";
|
|
2
|
+
import { t as HUB_CLIENT_VERSION } from "./shared/client-version.gen.js";
|
|
3
|
+
import { a as isPageInputControl, c as layoutControls, i as parseInputOverrides, l as boxesTouch, n as getInput, o as InputSystem, r as isInputSystem, s as Overlay, t as INPUT_SINGLETON_API, u as controlSize } from "./shared/input.js";
|
|
4
|
+
import { n as isUiStack, r as UI_STACK_VERSION, t as getUiStack } from "./shared/page-stack.js";
|
|
5
|
+
import { a as ContentRejectedError, c as UNSUPPORTED_BY_HUB, i as CLIENT_VERSION_HEADER, n as createHub, o as HubError, r as hub, s as OfflineError, t as Hub } from "./shared/src.js";
|
|
6
|
+
//#region src/auto.ts
|
|
7
|
+
/**
|
|
8
|
+
* `@diffenderfer-games/hub/auto`: everything the main entry exports, plus a
|
|
9
|
+
* side effect: it installs `window.HubSDK` (`{ hub, createHub, Hub, HubError,
|
|
10
|
+
* OfflineError, ContentRejectedError }`), exactly as the v1 `/_hub/hub.js`
|
|
11
|
+
* did. The host builds `/_hub/hub.js` from this entry, for games without a
|
|
12
|
+
* build step (`import('/_hub/hub.js')` or `window.HubSDK.hub`).
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
if (typeof window !== "undefined") window.HubSDK = {
|
|
17
|
+
hub,
|
|
18
|
+
createHub,
|
|
19
|
+
Hub,
|
|
20
|
+
HubError,
|
|
21
|
+
OfflineError,
|
|
22
|
+
ContentRejectedError
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CLIENT_VERSION_HEADER, ContentRejectedError, DAILY_SINGLETON_API, DAILY_START_EVENT, DailySystem, HUB_CLIENT_VERSION, Hub, HubError, INPUT_SINGLETON_API, InputSystem, OfflineError, Overlay, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, boxesTouch, controlSize, createHub, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=auto.js.map
|
package/dist/auto.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.js","names":[],"sources":["../src/auto.ts"],"mappings":";;;;;;;;;;;;;;;AAoCA,IAAI,OAAO,WAAW,aACpB,OAAO,SAAS;CAAE;CAAK;CAAW;CAAK;CAAU;CAAc;AAAqB"}
|
package/dist/daily.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as DailyStatus, a as isDailySystem, c as DailyAll, d as DailyCompletionMeta, f as DailyDefinition, g as DailyStartResponse, h as DailyHost, i as getDaily, l as DailyChallenge, m as DailyGameStatus, n as DailyCompletions, o as DAILY_START_EVENT, p as DailyEventDetail, r as DAILY_SINGLETON_API, s as DailySystem, t as DailyCompletion, u as DailyCompleteResponse } from "./shared/daily.js";
|
|
2
|
+
export { DAILY_SINGLETON_API, DAILY_START_EVENT, type DailyAll, type DailyChallenge, type DailyCompleteResponse, type DailyCompletion, type DailyCompletionMeta, type DailyCompletions, type DailyDefinition, type DailyEventDetail, type DailyGameStatus, type DailyHost, type DailyStartResponse, type DailyStatus, DailySystem, getDaily, isDailySystem };
|
package/dist/daily.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as DAILY_SINGLETON_API, i as DAILY_START_EVENT, a as DailySystem, n as getDaily, r as isDailySystem } from "./shared/daily.js";
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import { GamePackageJson, HubVersion } from "@diffenderfer-games/hub-contract";
|
|
6
|
+
//#region src/core/version/client-version.gen.ts
|
|
7
|
+
/** This client's package version, sent as `x-hub-client` on REST calls and `client` in `hello`. */
|
|
8
|
+
const HUB_CLIENT_VERSION = "2.0.0-next.0";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/core/version/semver.ts
|
|
11
|
+
const VERSION_PATTERN = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
12
|
+
/** Parse a version (`2`, `2.1`, `2.1.0`, `2.1.0-next.3`); `undefined` when it is not one. */
|
|
13
|
+
function parseVersion(text) {
|
|
14
|
+
const match = VERSION_PATTERN.exec(text.trim());
|
|
15
|
+
if (match === null) return;
|
|
16
|
+
const [, major = "0", minor = "0", patch = "0", prerelease] = match;
|
|
17
|
+
return {
|
|
18
|
+
release: [
|
|
19
|
+
Number(major),
|
|
20
|
+
Number(minor),
|
|
21
|
+
Number(patch)
|
|
22
|
+
],
|
|
23
|
+
prerelease: prerelease === void 0 ? [] : prerelease.split(".")
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Compare two prerelease identifiers: numbers by value and before words, words as text. */
|
|
27
|
+
function compareIdentifiers(first, second) {
|
|
28
|
+
const isFirstNumeric = /^\d+$/.test(first);
|
|
29
|
+
const isSecondNumeric = /^\d+$/.test(second);
|
|
30
|
+
if (isFirstNumeric && isSecondNumeric) return Number(first) - Number(second);
|
|
31
|
+
if (isFirstNumeric !== isSecondNumeric) return isFirstNumeric ? -1 : 1;
|
|
32
|
+
return first < second ? -1 : first > second ? 1 : 0;
|
|
33
|
+
}
|
|
34
|
+
/** Negative when `first` is older, positive when newer, 0 when equal. */
|
|
35
|
+
function compareVersions(first, second) {
|
|
36
|
+
for (let i = 0; i < 3; i += 1) {
|
|
37
|
+
const difference = (first.release[i] ?? 0) - (second.release[i] ?? 0);
|
|
38
|
+
if (difference !== 0) return difference;
|
|
39
|
+
}
|
|
40
|
+
if (first.prerelease.length === 0 || second.prerelease.length === 0) return second.prerelease.length - first.prerelease.length;
|
|
41
|
+
const length = Math.max(first.prerelease.length, second.prerelease.length);
|
|
42
|
+
for (let i = 0; i < length; i += 1) {
|
|
43
|
+
const firstIdentifier = first.prerelease[i];
|
|
44
|
+
const secondIdentifier = second.prerelease[i];
|
|
45
|
+
if (firstIdentifier === void 0 || secondIdentifier === void 0) return firstIdentifier === void 0 ? -1 : 1;
|
|
46
|
+
const difference = compareIdentifiers(firstIdentifier, secondIdentifier);
|
|
47
|
+
if (difference !== 0) return difference;
|
|
48
|
+
}
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const COMPARATOR_PATTERN = /^(>=|<=|>|<|=)?\s*(.+)$/;
|
|
52
|
+
/** Whether `version` meets one comparator (`>=2.0.0`); a malformed comparator never holds. */
|
|
53
|
+
function meetsComparator(version, comparator) {
|
|
54
|
+
const match = COMPARATOR_PATTERN.exec(comparator);
|
|
55
|
+
const bound = match?.[2] === void 0 ? void 0 : parseVersion(match[2]);
|
|
56
|
+
if (match === null || bound === void 0) return false;
|
|
57
|
+
const order = compareVersions(version, bound);
|
|
58
|
+
switch (match[1]) {
|
|
59
|
+
case ">=": return order >= 0;
|
|
60
|
+
case "<=": return order <= 0;
|
|
61
|
+
case ">": return order > 0;
|
|
62
|
+
case "<": return order < 0;
|
|
63
|
+
default: return order === 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Whether `versionText` is in `range`; a malformed version or empty range never is. */
|
|
67
|
+
function satisfiesRange(versionText, range) {
|
|
68
|
+
const version = parseVersion(versionText);
|
|
69
|
+
if (version === void 0) return false;
|
|
70
|
+
return range.split("||").some((alternative) => {
|
|
71
|
+
const comparators = alternative.trim().split(/\s+/).filter((comparator) => comparator !== "");
|
|
72
|
+
return comparators.length > 0 && comparators.every((comparator) => meetsComparator(version, comparator));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/core/version/hub-version.ts
|
|
77
|
+
/** How `version` fares against a hub's answer (`null`: a hub from before versioning). */
|
|
78
|
+
function clientSupport(hubVersion, version = HUB_CLIENT_VERSION) {
|
|
79
|
+
if (hubVersion === null) return "unknown";
|
|
80
|
+
if (!satisfiesRange(version, hubVersion.supported)) return "unsupported";
|
|
81
|
+
return satisfiesRange(version, hubVersion.deprecated) ? "deprecated" : "supported";
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/doctor/checks.ts
|
|
85
|
+
/**
|
|
86
|
+
* The checks `hub-doctor` runs on a game (plan §4.3.7). Each returns
|
|
87
|
+
* findings; an `error` finding fails the run (and the game's CI).
|
|
88
|
+
*/
|
|
89
|
+
/** The fix for an old or unsupported client. */
|
|
90
|
+
const UPDATE_FIX = "run `npm update @diffenderfer-games/hub`";
|
|
91
|
+
/**
|
|
92
|
+
* The installed client against the hub's `/_api/version`: outside
|
|
93
|
+
* `supported` is an error, `deprecated` a warning. `null` (a hub from before
|
|
94
|
+
* versioning) and an unreachable hub are only reported.
|
|
95
|
+
*/
|
|
96
|
+
function checkClientVersion(installedVersion, hubVersion) {
|
|
97
|
+
if (hubVersion instanceof Error) return [{
|
|
98
|
+
level: "warning",
|
|
99
|
+
check: "version",
|
|
100
|
+
message: `could not read the hub's version (${hubVersion.message}); the client version was not checked`
|
|
101
|
+
}];
|
|
102
|
+
switch (clientSupport(hubVersion, installedVersion)) {
|
|
103
|
+
case "unsupported": return [{
|
|
104
|
+
level: "error",
|
|
105
|
+
check: "version",
|
|
106
|
+
message: `@diffenderfer-games/hub ${installedVersion} is not supported by the hub (supported: ${hubVersion?.supported ?? "?"}): ${UPDATE_FIX}`
|
|
107
|
+
}];
|
|
108
|
+
case "deprecated": return [{
|
|
109
|
+
level: "warning",
|
|
110
|
+
check: "version",
|
|
111
|
+
message: `@diffenderfer-games/hub ${installedVersion} is deprecated (deprecated: ${hubVersion?.deprecated ?? "?"}): ${UPDATE_FIX}`
|
|
112
|
+
}];
|
|
113
|
+
case "unknown": return [{
|
|
114
|
+
level: "info",
|
|
115
|
+
check: "version",
|
|
116
|
+
message: "the hub predates versioning (no /_api/version); the client version was not checked"
|
|
117
|
+
}];
|
|
118
|
+
case "supported": return [{
|
|
119
|
+
level: "info",
|
|
120
|
+
check: "version",
|
|
121
|
+
message: `@diffenderfer-games/hub ${installedVersion} is supported (hub ${hubVersion?.server ?? "?"})`
|
|
122
|
+
}];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** Leftovers of the v1 vendored client, relative to the game's folder. */
|
|
126
|
+
const VENDORED_LEFTOVERS = [
|
|
127
|
+
"src/hub/hub.ts",
|
|
128
|
+
"src/hub/input.ts",
|
|
129
|
+
"client/src/hub/hub.ts",
|
|
130
|
+
"scripts/sync-hub.mjs"
|
|
131
|
+
];
|
|
132
|
+
/** A stale vendored `src/hub/` copy or its sync script (the package replaces both). */
|
|
133
|
+
function checkVendoredCopies(gameDir) {
|
|
134
|
+
return VENDORED_LEFTOVERS.filter((leftover) => existsSync(join(gameDir, leftover))).map((leftover) => ({
|
|
135
|
+
level: "warning",
|
|
136
|
+
check: "vendored",
|
|
137
|
+
message: `${leftover} is a vendored copy of the v1 client: import from '@diffenderfer-games/hub' instead and delete it`
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
/** The `package.json` `game.*` block against the contract's manifest schema. */
|
|
141
|
+
function checkManifest(packageJson) {
|
|
142
|
+
const parsed = GamePackageJson.safeParse(packageJson);
|
|
143
|
+
if (parsed.success) return [{
|
|
144
|
+
level: "info",
|
|
145
|
+
check: "manifest",
|
|
146
|
+
message: `the game.* block is valid (${parsed.data.game.type})`
|
|
147
|
+
}];
|
|
148
|
+
return parsed.error.issues.map((issue) => ({
|
|
149
|
+
level: "error",
|
|
150
|
+
check: "manifest",
|
|
151
|
+
message: `${issue.path.length === 0 ? "(package.json)" : issue.path.join(".")}: ${issue.message}`
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/doctor/cli.ts
|
|
156
|
+
/**
|
|
157
|
+
* `hub-doctor`: checks a game against the hub (plan §4.3.7). Run it in a
|
|
158
|
+
* game's folder, in CI and before pushing:
|
|
159
|
+
*
|
|
160
|
+
* ```sh
|
|
161
|
+
* npx hub-doctor [--dir <game folder>] [--hub <url>] [--offline] [--json]
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* - the installed `@diffenderfer-games/hub` against the hub's
|
|
165
|
+
* `/_api/version` (`--hub`, default `https://diffenderfer.games`): outside
|
|
166
|
+
* `supported` fails, `deprecated` warns (`--offline` skips this check);
|
|
167
|
+
* - a stale vendored `src/hub/` copy or `scripts/sync-hub.mjs` warns;
|
|
168
|
+
* - the `package.json` `game.*` block must match the contract's schema.
|
|
169
|
+
*
|
|
170
|
+
* Exits 1 when any check fails.
|
|
171
|
+
*/
|
|
172
|
+
const DEFAULT_HUB_URL = "https://diffenderfer.games";
|
|
173
|
+
function readOptions() {
|
|
174
|
+
const { values } = parseArgs({ options: {
|
|
175
|
+
dir: { type: "string" },
|
|
176
|
+
hub: { type: "string" },
|
|
177
|
+
offline: {
|
|
178
|
+
type: "boolean",
|
|
179
|
+
default: false
|
|
180
|
+
},
|
|
181
|
+
json: {
|
|
182
|
+
type: "boolean",
|
|
183
|
+
default: false
|
|
184
|
+
}
|
|
185
|
+
} });
|
|
186
|
+
return {
|
|
187
|
+
gameDir: resolve(values.dir ?? "."),
|
|
188
|
+
hubUrl: values.hub ?? DEFAULT_HUB_URL,
|
|
189
|
+
isOffline: values.offline,
|
|
190
|
+
isJson: values.json
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function readJsonFile(path) {
|
|
194
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
195
|
+
}
|
|
196
|
+
/** The client version the game has installed (its `node_modules` copy), else this doctor's own. */
|
|
197
|
+
function installedClientVersion(gameDir) {
|
|
198
|
+
try {
|
|
199
|
+
const installed = readJsonFile(join(gameDir, "node_modules", "@diffenderfer-games", "hub", "package.json"));
|
|
200
|
+
if (typeof installed === "object" && installed !== null && "version" in installed && typeof installed.version === "string") return installed.version;
|
|
201
|
+
} catch {}
|
|
202
|
+
return HUB_CLIENT_VERSION;
|
|
203
|
+
}
|
|
204
|
+
/** The hub's `/_api/version`: `null` for a hub without it, an `Error` when unreachable. */
|
|
205
|
+
async function fetchHubVersion(hubUrl) {
|
|
206
|
+
try {
|
|
207
|
+
const response = await fetch(new URL("/_api/version", hubUrl));
|
|
208
|
+
if (response.status === 404) return null;
|
|
209
|
+
if (!response.ok) return /* @__PURE__ */ new Error(`HTTP ${String(response.status)}`);
|
|
210
|
+
return HubVersion.parse(await response.json());
|
|
211
|
+
} catch (failure) {
|
|
212
|
+
return failure instanceof Error ? failure : new Error(String(failure));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function runDoctor(options) {
|
|
216
|
+
const findings = [];
|
|
217
|
+
if (!options.isOffline) findings.push(...checkClientVersion(installedClientVersion(options.gameDir), await fetchHubVersion(options.hubUrl)));
|
|
218
|
+
findings.push(...checkVendoredCopies(options.gameDir));
|
|
219
|
+
try {
|
|
220
|
+
findings.push(...checkManifest(readJsonFile(join(options.gameDir, "package.json"))));
|
|
221
|
+
} catch (failure) {
|
|
222
|
+
findings.push({
|
|
223
|
+
level: "error",
|
|
224
|
+
check: "manifest",
|
|
225
|
+
message: `could not read package.json: ${failure instanceof Error ? failure.message : String(failure)}`
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return findings;
|
|
229
|
+
}
|
|
230
|
+
const options = readOptions();
|
|
231
|
+
const findings = await runDoctor(options);
|
|
232
|
+
if (options.isJson) process.stdout.write(`${JSON.stringify({ findings }, null, 2)}\n`);
|
|
233
|
+
else for (const finding of findings) process.stdout.write(`${finding.level.padEnd(7)} ${finding.check}: ${finding.message}\n`);
|
|
234
|
+
process.exitCode = findings.some((finding) => finding.level === "error") ? 1 : 0;
|
|
235
|
+
//#endregion
|
|
236
|
+
export {};
|
|
237
|
+
|
|
238
|
+
//# sourceMappingURL=cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../../src/core/version/client-version.gen.ts","../../src/core/version/semver.ts","../../src/core/version/hub-version.ts","../../src/doctor/checks.ts","../../src/doctor/cli.ts"],"mappings":";;;;;;;AAEA,MAAa,qBAAqB;;;ACclC,MAAM,kBAAkB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ACrF,SAAS,SAAS;EAChB,SAAS,KAAK;GAAE,OAAO;GAAS,OAAO;GAAY,SAAS,gCAAgC,mBAAmB,QAAQ,QAAQ,UAAU,OAAO,OAAO;EAAI,CAAC;CAC9J;CACA,OAAO;AACT;AAEA,MAAM,UAAU,YAAY;AAC5B,MAAM,WAAW,MAAM,UAAU,OAAO;AACxC,IAAI,QAAQ,QACV,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,GAAG;KAEjE,KAAK,MAAM,WAAW,UACpB,QAAQ,OAAO,MAAM,GAAG,QAAQ,MAAM,OAAO,CAAC,EAAE,GAAG,QAAQ,MAAM,IAAI,QAAQ,QAAQ,GAAG;AAG5F,QAAQ,WAAW,SAAS,MAAM,YAAY,QAAQ,UAAU,OAAO,IAAI,IAAI"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as RaceResultPlayer, c as RoomChatLine, d as RoomStateChange, f as SchemaOutput, i as RaceRecordPlayer, l as RoomMessage, m as Snapshot, n as Notice, o as RaceStatusEvent, p as ServerEvents, r as RaceHistory, s as RealtimeErrorShape, t as InviteCreated, u as RoomSeat } from "./shared/wire-types.js";
|
|
2
|
+
import { _ as DailyStatus, a as isDailySystem, c as DailyAll, d as DailyCompletionMeta, f as DailyDefinition, g as DailyStartResponse, h as DailyHost, i as getDaily, l as DailyChallenge, m as DailyGameStatus, n as DailyCompletions, o as DAILY_START_EVENT, p as DailyEventDetail, r as DAILY_SINGLETON_API, s as DailySystem, t as DailyCompletion, u as DailyCompleteResponse } from "./shared/daily.js";
|
|
3
|
+
import { $ as VirtualControlType, A as AxisSide, B as InputReading, C as parseInputOverrides, D as isPageInputControl, E as PageInputControl, F as InputConfig, G as NavElement, H as MenuBridge, I as InputDef, J as NavTarget, K as NavElementKind, L as InputEvents, M as EdgeOffsets, N as GamepadMapping, O as Anchor, P as GroupDef, Q as Vector, R as InputHost, S as isInputSystem, T as InputSystemOptions, U as MouseMapping, V as InputSource, W as NavBlurEvent, X as Rect, Y as NavigableDef, Z as TouchMapping, _ as boxesTouch, a as OverlayEdge, b as InputOptions, c as OverlayReason, d as LayoutOptions, et as VirtualDef, f as layoutControls, g as LayoutItem, h as LayoutBox, i as AutoPauseOptions, j as DraggedSpot, k as AxisDef, l as UiStack, m as Insets, n as getUiStack, nt as VirtualOverride, o as OverlayEvent, p as Overlay, q as NavFocusEvent, r as isUiStack, s as OverlayListener, t as UI_STACK_VERSION, tt as VirtualInputs, u as UiStackHandoff, v as controlSize, w as InputSystem, x as getInput, y as INPUT_SINGLETON_API, z as InputOverrides } from "./shared/input.js";
|
|
4
|
+
import { a as JoinInfoEvent, i as InviteResult, n as HubMpApi, r as InviteOptions, t as BusyOptions } from "./shared/multiplayer-types.js";
|
|
5
|
+
import { o as multiplayerForwarder } from "./shared/mp.js";
|
|
6
|
+
import { a as RoomEvents, c as RoomSendOptions, i as RoomCreateOptions, l as RoomState, n as HubRoomsApi, o as RoomListOptions, r as JoinOptions, s as RoomSelf, t as HubRoom, u as RoomStateOptions } from "./shared/room-types.js";
|
|
7
|
+
import { a as RaceHistoryQuery, c as RaceRuntimeApi, i as RaceEvents, l as RaceStart, n as RaceCreateOptions, o as RaceHistoryViewOptions, r as RaceDefinition, s as RaceHudPlace, t as HubRaceApi } from "./shared/race-types.js";
|
|
8
|
+
import { f as raceForwarder } from "./shared/race.js";
|
|
9
|
+
import { n as roomsForwarder } from "./shared/rooms.js";
|
|
10
|
+
import { $ as HubNotifyApi, A as RacerState, B as SuggestionStatus, C as RaceRecord, D as RaceStats, E as RaceState, F as ReportReason, G as REALTIME_READY_EVENT, H as isRealtimeApi, I as RoomInfo, J as RealtimeHubLink, K as REALTIME_SINGLETON_API, L as SocialConfig, M as Relation, N as ReportInput, O as Racer, P as ReportKind, Q as socialForwarder, R as SocialMe, S as RaceParams, T as RaceStatValue, U as REALTIME_FAILED_EVENT, V as findRealtimeApi, W as REALTIME_FEATURE_VERSION, X as notifyForwarder, Y as linkRealtimeToHub, Z as presenceForwarder, _ as PlayerLite, a as ErrorBody, at as SocialEvents, b as PresenceKind, c as JoinInfo, d as Message, et as HubPresenceApi, f as MessagesPage, g as PlayerCard, h as Party, i as Counts, it as SocialCounts, j as RecentPlayer, k as RacerResult, l as Launch, m as NotifyPrefs, n as ChatMode, nt as OpenInviteOptions, o as FriendEntry, p as NotifyChange, q as RealtimeApi, r as Conversation, rt as PlayerRef, s as Invite, t as Audience, tt as HubSocialApi, u as LaunchTicket, v as Presence, w as RaceResult, x as RaceOutcome, y as PresenceInput, z as Suggestion } from "./shared/social.js";
|
|
11
|
+
import { $ as SubmitScoreResult, A as BoardWithTop, B as Json, C as CLIENT_VERSION_HEADER, D as QueuedScoreOptions, E as QueueOpInput, F as GlobalAnalytics, G as Profile, H as LeaderboardResult, I as HubOptions, J as SaveMeta, K as ProfileSummary, L as HubStatus, M as GameInfo, N as GameLeaderboards, O as BufferedEvent, P as GameRecords, Q as SubmitScoreOptions, R as Inventory, S as SyncResult, T as QueueOp, U as MeResponse, V as LeaderboardEntry, W as Metrics, X as SortDir, Y as SnapshotResponse, Z as Stats, _ as TradeNoteOptions, a as HubErrorDetails, b as StatResult, c as Hub, d as ClientSupport, et as User, f as HubMenuControl, g as TradeListOptions, h as TradeId, i as HubErrorCode, it as GamePayload, j as GameAnalytics, k as Board, l as createHub, m as TradeBundle, n as ContentRejectedError, nt as EndpointName, o as OfflineError, p as GrantBundle, q as Save, r as HubError, rt as EndpointReply, s as UNSUPPORTED_BY_HUB, t as HUB_CLIENT_VERSION, tt as EndpointFields, u as hub, v as AuthResponse, w as ProfilePatch, x as SyncConflict, y as ProfileUpdate, z as InventorySnapshot } from "./shared/index.js";
|
|
12
|
+
export { type Anchor, type Audience, type AuthResponse, type AutoPauseOptions, type AxisDef, type AxisSide, type Board, type BoardWithTop, type BufferedEvent, type BusyOptions, CLIENT_VERSION_HEADER, type ChatMode, type ClientSupport, ContentRejectedError, type Conversation, type Counts, DAILY_SINGLETON_API, DAILY_START_EVENT, type DailyAll, type DailyChallenge, type DailyCompleteResponse, type DailyCompletion, type DailyCompletionMeta, type DailyCompletions, type DailyDefinition, type DailyEventDetail, type DailyGameStatus, type DailyHost, type DailyStartResponse, type DailyStatus, DailySystem, type DraggedSpot, type EdgeOffsets, type EndpointFields, type EndpointName, type EndpointReply, type ErrorBody, type FriendEntry, type GameAnalytics, type GameInfo, type GameLeaderboards, type GamePayload, type GameRecords, type GamepadMapping, type GlobalAnalytics, type GrantBundle, type GroupDef, HUB_CLIENT_VERSION, Hub, HubError, type HubErrorCode, type HubErrorDetails, type HubMenuControl, type HubMpApi, type HubNotifyApi, type HubOptions, type HubPresenceApi, type HubRaceApi, type HubRoom, type HubRoomsApi, type HubSocialApi, type HubStatus, INPUT_SINGLETON_API, type InputConfig, type InputDef, type InputEvents, type InputHost, type InputOptions, type InputOverrides, type InputReading, type InputSource, InputSystem, type InputSystemOptions, type Insets, type Inventory, type InventorySnapshot, type Invite, type InviteCreated, type InviteOptions, type InviteResult, type JoinInfo, type JoinInfoEvent, type JoinOptions, type Json, type Launch, type LaunchTicket, type LayoutBox, type LayoutItem, type LayoutOptions, type LeaderboardEntry, type LeaderboardResult, type MeResponse, type MenuBridge, type Message, type MessagesPage, type Metrics, type MouseMapping, type NavBlurEvent, type NavElement, type NavElementKind, type NavFocusEvent, type NavTarget, type NavigableDef, type Notice, type NotifyChange, type NotifyPrefs, OfflineError, type OpenInviteOptions, Overlay, type OverlayEdge, type OverlayEvent, type OverlayListener, type OverlayReason, type PageInputControl, type Party, type PlayerCard, type PlayerLite, type PlayerRef, type Presence, type PresenceInput, type PresenceKind, type Profile, type ProfilePatch, type ProfileSummary, type ProfileUpdate, type QueueOp, type QueueOpInput, type QueuedScoreOptions, type REALTIME_FAILED_EVENT, type REALTIME_FEATURE_VERSION, type REALTIME_READY_EVENT, type REALTIME_SINGLETON_API, type RaceCreateOptions, type RaceDefinition, type RaceEvents, type RaceHistory, type RaceHistoryQuery, type RaceHistoryViewOptions, type RaceHudPlace, type RaceOutcome, type RaceParams, type RaceRecord, type RaceRecordPlayer, type RaceResult, type RaceResultPlayer, type RaceRuntimeApi, type RaceStart, type RaceStatValue, type RaceState, type RaceStats, type RaceStatusEvent, type Racer, type RacerResult, type RacerState, type RealtimeApi, type RealtimeErrorShape, type RealtimeHubLink, type RecentPlayer, type Rect, type Relation, type ReportInput, type ReportKind, type ReportReason, type RoomChatLine, type RoomCreateOptions, type RoomEvents, type RoomInfo, type RoomListOptions, type RoomMessage, type RoomSeat, type RoomSelf, type RoomSendOptions, type RoomState, type RoomStateChange, type RoomStateOptions, type Save, type SaveMeta, type SchemaOutput, type ServerEvents, type Snapshot, type SnapshotResponse, type SocialConfig, type SocialCounts, type SocialEvents, type SocialMe, type SortDir, type StatResult, type Stats, type SubmitScoreOptions, type SubmitScoreResult, type Suggestion, type SuggestionStatus, type SyncConflict, type SyncResult, type TouchMapping, type TradeBundle, type TradeId, type TradeListOptions, type TradeNoteOptions, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, type UiStack, type UiStackHandoff, type User, type Vector, type VirtualControlType, type VirtualDef, type VirtualInputs, type VirtualOverride, boxesTouch, controlSize, createHub, type findRealtimeApi, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, type isRealtimeApi, isUiStack, layoutControls, type linkRealtimeToHub, type multiplayerForwarder as mp, type notifyForwarder as notify, parseInputOverrides, type presenceForwarder as presence, type raceForwarder as race, type roomsForwarder as rooms, type socialForwarder as social };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { a as DailySystem, i as DAILY_START_EVENT, n as getDaily, r as isDailySystem, t as DAILY_SINGLETON_API } from "./shared/daily.js";
|
|
2
|
+
import { t as HUB_CLIENT_VERSION } from "./shared/client-version.gen.js";
|
|
3
|
+
import { a as isPageInputControl, c as layoutControls, i as parseInputOverrides, l as boxesTouch, n as getInput, o as InputSystem, r as isInputSystem, s as Overlay, t as INPUT_SINGLETON_API, u as controlSize } from "./shared/input.js";
|
|
4
|
+
import { n as isUiStack, r as UI_STACK_VERSION, t as getUiStack } from "./shared/page-stack.js";
|
|
5
|
+
import { a as ContentRejectedError, c as UNSUPPORTED_BY_HUB, i as CLIENT_VERSION_HEADER, n as createHub, o as HubError, r as hub, s as OfflineError, t as Hub } from "./shared/src.js";
|
|
6
|
+
export { CLIENT_VERSION_HEADER, ContentRejectedError, DAILY_SINGLETON_API, DAILY_START_EVENT, DailySystem, HUB_CLIENT_VERSION, Hub, HubError, INPUT_SINGLETON_API, InputSystem, OfflineError, Overlay, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, boxesTouch, controlSize, createHub, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as VirtualControlType, A as AxisSide, B as InputReading, C as parseInputOverrides, D as isPageInputControl, E as PageInputControl, F as InputConfig, G as NavElement, H as MenuBridge, I as InputDef, J as NavTarget, K as NavElementKind, L as InputEvents, M as EdgeOffsets, N as GamepadMapping, O as Anchor, P as GroupDef, Q as Vector, R as InputHost, S as isInputSystem, T as InputSystemOptions, U as MouseMapping, V as InputSource, W as NavBlurEvent, X as Rect, Y as NavigableDef, Z as TouchMapping, _ as boxesTouch, a as OverlayEdge, b as InputOptions, c as OverlayReason, d as LayoutOptions, et as VirtualDef, f as layoutControls, g as LayoutItem, h as LayoutBox, i as AutoPauseOptions, j as DraggedSpot, k as AxisDef, l as UiStack, m as Insets, n as getUiStack, nt as VirtualOverride, o as OverlayEvent, p as Overlay, q as NavFocusEvent, r as isUiStack, s as OverlayListener, t as UI_STACK_VERSION, tt as VirtualInputs, u as UiStackHandoff, v as controlSize, w as InputSystem, x as getInput, y as INPUT_SINGLETON_API, z as InputOverrides } from "./shared/input.js";
|
|
2
|
+
export { type Anchor, type AutoPauseOptions, type AxisDef, type AxisSide, type DraggedSpot, type EdgeOffsets, type GamepadMapping, type GroupDef, INPUT_SINGLETON_API, type InputConfig, type InputDef, type InputEvents, type InputHost, type InputOptions, type InputOverrides, type InputReading, type InputSource, InputSystem, type InputSystemOptions, type Insets, type LayoutBox, type LayoutItem, type LayoutOptions, type MenuBridge, type MouseMapping, type NavBlurEvent, type NavElement, type NavElementKind, type NavFocusEvent, type NavTarget, type NavigableDef, Overlay, type OverlayEdge, type OverlayEvent, type OverlayListener, type OverlayReason, type PageInputControl, type Rect, type TouchMapping, UI_STACK_VERSION, type UiStack, type UiStackHandoff, type Vector, type VirtualControlType, type VirtualDef, type VirtualInputs, type VirtualOverride, boxesTouch, controlSize, getInput, getUiStack, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as isPageInputControl, c as layoutControls, i as parseInputOverrides, l as boxesTouch, n as getInput, o as InputSystem, r as isInputSystem, s as Overlay, t as INPUT_SINGLETON_API, u as controlSize } from "./shared/input.js";
|
|
2
|
+
import { n as isUiStack, r as UI_STACK_VERSION, t as getUiStack } from "./shared/page-stack.js";
|
|
3
|
+
export { INPUT_SINGLETON_API, InputSystem, Overlay, UI_STACK_VERSION, boxesTouch, controlSize, getInput, getUiStack, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|
package/dist/mp.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { t as InviteCreated } from "./shared/wire-types.js";
|
|
2
|
+
import { a as JoinInfoEvent, i as InviteResult, n as HubMpApi, r as InviteOptions, t as BusyOptions } from "./shared/multiplayer-types.js";
|
|
3
|
+
import { a as Party, i as LaunchTicket, n as JoinInfo, o as multiplayerForwarder, r as Launch, t as Invite } from "./shared/mp.js";
|
|
4
|
+
export { type BusyOptions, type HubMpApi, type Invite, type InviteCreated, type InviteOptions, type InviteResult, type JoinInfo, type JoinInfoEvent, type Launch, type LaunchTicket, type Party, multiplayerForwarder as mp };
|
package/dist/mp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as mp } from "./shared/mp.js";
|
package/dist/race.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as RaceResultPlayer, i as RaceRecordPlayer, o as RaceStatusEvent, r as RaceHistory } from "./shared/wire-types.js";
|
|
2
|
+
import { a as RaceHistoryQuery, c as RaceRuntimeApi, i as RaceEvents, l as RaceStart, n as RaceCreateOptions, o as RaceHistoryViewOptions, r as RaceDefinition, s as RaceHudPlace, t as HubRaceApi } from "./shared/race-types.js";
|
|
3
|
+
import { a as RaceStatValue, c as Racer, d as RoomInfo, f as raceForwarder, i as RaceResult, l as RacerResult, n as RaceParams, o as RaceState, r as RaceRecord, s as RaceStats, t as RaceOutcome, u as RacerState } from "./shared/race.js";
|
|
4
|
+
export { type HubRaceApi, type RaceCreateOptions, type RaceDefinition, type RaceEvents, type RaceHistory, type RaceHistoryQuery, type RaceHistoryViewOptions, type RaceHudPlace, type RaceOutcome, type RaceParams, type RaceRecord, type RaceRecordPlayer, type RaceResult, type RaceResultPlayer, type RaceRuntimeApi, type RaceStart, type RaceStatValue, type RaceState, type RaceStats, type RaceStatusEvent, type Racer, type RacerResult, type RacerState, type RoomInfo, raceForwarder as race };
|
package/dist/race.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as race } from "./shared/race.js";
|
package/dist/rooms.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { c as RoomChatLine, d as RoomStateChange, l as RoomMessage, u as RoomSeat } from "./shared/wire-types.js";
|
|
2
|
+
import { a as RoomEvents, c as RoomSendOptions, i as RoomCreateOptions, l as RoomState, n as HubRoomsApi, o as RoomListOptions, r as JoinOptions, s as RoomSelf, t as HubRoom, u as RoomStateOptions } from "./shared/room-types.js";
|
|
3
|
+
import { n as roomsForwarder, t as RoomInfo } from "./shared/rooms.js";
|
|
4
|
+
export { type HubRoom, type HubRoomsApi, type JoinOptions, type RoomChatLine, type RoomCreateOptions, type RoomEvents, type RoomInfo, type RoomListOptions, type RoomMessage, type RoomSeat, type RoomSelf, type RoomSendOptions, type RoomState, type RoomStateChange, type RoomStateOptions, roomsForwarder as rooms };
|
package/dist/rooms.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as rooms } from "./shared/rooms.js";
|