@thoughts-on-things/beacon-protocol 0.0.0-stage → 0.0.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 +201 -0
- package/README.md +27 -2
- package/dist/beacon-management.d.ts +203 -0
- package/dist/beacon-management.d.ts.map +1 -0
- package/dist/beacon-management.js +94 -0
- package/dist/beacon-management.js.map +1 -0
- package/dist/directory.d.ts +100 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +12 -0
- package/dist/directory.js.map +1 -0
- package/dist/fixtures.d.ts +141 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +141 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/index.d.ts +430 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +455 -0
- package/dist/index.js.map +1 -0
- package/dist/mod-relay.d.ts +26 -0
- package/dist/mod-relay.d.ts.map +1 -0
- package/dist/mod-relay.js +79 -0
- package/dist/mod-relay.js.map +1 -0
- package/dist/play.d.ts +57 -0
- package/dist/play.d.ts.map +1 -0
- package/dist/play.js +122 -0
- package/dist/play.js.map +1 -0
- package/dist/publish.d.ts +117 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +133 -0
- package/dist/publish.js.map +1 -0
- package/package.json +66 -3
- package/src/beacon-management.ts +210 -0
- package/src/directory.ts +115 -0
- package/src/fixtures.ts +169 -0
- package/src/index.ts +538 -0
- package/src/mod-relay.ts +125 -0
- package/src/play.ts +152 -0
- package/src/publish.ts +237 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
// @thoughts-on-things/beacon-protocol: the wire contract between a self-hosted beacon and the
|
|
2
|
+
// Beacon Atlas directory.
|
|
3
|
+
//
|
|
4
|
+
// A beacon that opts into public listing POSTs a *heartbeat* to the Atlas on a
|
|
5
|
+
// timer. This module is the single source of truth for that shape: the
|
|
6
|
+
// beacon's publisher (`@beacon/shared/beacon-publish`) and the Atlas's ingest
|
|
7
|
+
// endpoint both validate against the schemas here, so a field is never defined
|
|
8
|
+
// in two places. `fixtures.ts` carries canonical heartbeats that the
|
|
9
|
+
// conformance tests in this package round-trip through `parseHeartbeat` and
|
|
10
|
+
// `invalidBodies` that must be rejected; both are exposed via the `./fixtures`
|
|
11
|
+
// subpath so downstream consumers can pin against the same baseline.
|
|
12
|
+
//
|
|
13
|
+
// ── The three buckets ─────────────────────────────────────────────────────
|
|
14
|
+
// A heartbeat is `{ schemaVersion, beaconId, manifest, profile?, status }`.
|
|
15
|
+
// The buckets are split by *who owns the data and how often it changes*.
|
|
16
|
+
// Atlas owns every operator-typed field (name, description, addresses,
|
|
17
|
+
// locations, tags, profile copy, privacy, consent flags): a beacon never
|
|
18
|
+
// publishes those over the wire. The heartbeat carries only what the
|
|
19
|
+
// running server itself knows or measures:
|
|
20
|
+
//
|
|
21
|
+
// manifest: slow-changing server-derived facts. Loader, MC version,
|
|
22
|
+
// installed mods, optional world stats. Always present.
|
|
23
|
+
//
|
|
24
|
+
// profile : optional consent-gated opt-in player-identity data
|
|
25
|
+
// (roster, activity). The Atlas listing row carries the consent
|
|
26
|
+
// toggles; the beacon refuses to publish a section the operator
|
|
27
|
+
// hasn't opted into.
|
|
28
|
+
//
|
|
29
|
+
// status : the live, machine-sampled snapshot, re-measured every
|
|
30
|
+
// heartbeat: online flag, player counts, TPS, uptime, peaks. The
|
|
31
|
+
// Atlas independently Server-List-Pings the listing's address and
|
|
32
|
+
// treats the ping as authoritative over these self-reported numbers.
|
|
33
|
+
//
|
|
34
|
+
// ── Versioning ────────────────────────────────────────────────────────────
|
|
35
|
+
// `SCHEMA_VERSION` is the current wire version. The Atlas is version-tolerant
|
|
36
|
+
// (see {@link parseHeartbeat}): a newer beacon's extra fields are stripped, an
|
|
37
|
+
// older beacon validates as long as it satisfies today's required fields.
|
|
38
|
+
// That tolerance only holds for *additive* change: every field added after a
|
|
39
|
+
// version's required core must be optional. Re-categorising a field across
|
|
40
|
+
// buckets, removing one, or adding a required one is a BREAKING change: it
|
|
41
|
+
// needs a `SCHEMA_VERSION` bump and an explicit normalise-on-parse shim, not a
|
|
42
|
+
// silent redefinition.
|
|
43
|
+
//
|
|
44
|
+
// ── Authentication ────────────────────────────────────────────────────────
|
|
45
|
+
// A heartbeat is authenticated by a per-listing bearer secret carried in the
|
|
46
|
+
// `Authorization: Bearer <beaconSecret>` header: never in this body. The
|
|
47
|
+
// Atlas stores only `SHA-256(secret)` and constant-time compares, so a Atlas
|
|
48
|
+
// database compromise yields no usable credential. (This is not HMAC: HMAC
|
|
49
|
+
// would force the Atlas to hold the raw key. TLS provides transport
|
|
50
|
+
// integrity; `status.sampledAt` + {@link checkHeartbeatFreshness} bounds
|
|
51
|
+
// replay value without needing a key.)
|
|
52
|
+
//
|
|
53
|
+
// Heartbeats are untrusted input on the Atlas side: every text field is
|
|
54
|
+
// sanitized (NFC, control chars stripped) and length-capped here, in the
|
|
55
|
+
// schema, so both sides agree on what is acceptable. Oversize input is
|
|
56
|
+
// rejected, never silently truncated.
|
|
57
|
+
import { z } from "zod";
|
|
58
|
+
/**
|
|
59
|
+
* Current wire-format version. Bumped only on a breaking change: see the
|
|
60
|
+
* versioning note above. Additive-optional fields do not bump it.
|
|
61
|
+
*/
|
|
62
|
+
export const SCHEMA_VERSION = 1;
|
|
63
|
+
/**
|
|
64
|
+
* Hard cap on a heartbeat request body, in bytes. The ingest route rejects a
|
|
65
|
+
* larger body with 413 before parsing. A legitimate worst-case heartbeat: a
|
|
66
|
+
* full 300-entry roster, 300 mods, 50 activity rows: lands around 50 KiB;
|
|
67
|
+
* 64 KiB leaves headroom without letting a beacon flood the endpoint.
|
|
68
|
+
*/
|
|
69
|
+
export const MAX_HEARTBEAT_BYTES = 64 * 1024;
|
|
70
|
+
/**
|
|
71
|
+
* Freshness window for `status.sampledAt`, relative to the Atlas's clock.
|
|
72
|
+
* A heartbeat sampled too far in the past is stale (or replayed); one too far
|
|
73
|
+
* in the future means a badly skewed beacon clock. Both are rejected. The
|
|
74
|
+
* past bound is generous enough to absorb publisher retry/backoff.
|
|
75
|
+
*/
|
|
76
|
+
export const HEARTBEAT_MAX_AGE_MS = 15 * 60_000;
|
|
77
|
+
export const HEARTBEAT_MAX_SKEW_MS = 5 * 60_000;
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Sanitization
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// C0 and C1 control characters. Stripped from every text field so a beacon
|
|
82
|
+
// cannot smuggle terminal escapes or layout characters into a directory card.
|
|
83
|
+
// eslint-disable-next-line no-control-regex
|
|
84
|
+
const CONTROL_CHARS = /[\u0000-\u001F\u007F-\u009F]/g;
|
|
85
|
+
/**
|
|
86
|
+
* Normalize a single-line text field: NFC-normalize, replace C0/C1 control
|
|
87
|
+
* characters with spaces, collapse runs of whitespace, and trim. Applied to
|
|
88
|
+
* every bounded text field before length validation, so the beacon and the
|
|
89
|
+
* Atlas treat input identically.
|
|
90
|
+
*/
|
|
91
|
+
export function sanitizeText(value) {
|
|
92
|
+
return value
|
|
93
|
+
.normalize("NFC")
|
|
94
|
+
.replace(CONTROL_CHARS, " ")
|
|
95
|
+
.replace(/\s+/g, " ")
|
|
96
|
+
.trim();
|
|
97
|
+
}
|
|
98
|
+
function isHttpsUrl(value) {
|
|
99
|
+
try {
|
|
100
|
+
return new URL(value).protocol === "https:";
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// A non-empty, single-line text field, sanitized then capped. Sanitization
|
|
107
|
+
// runs first so an all-whitespace value collapses to "" and is rejected, and
|
|
108
|
+
// an oversize value is rejected (not truncated).
|
|
109
|
+
const boundedText = (max) => z
|
|
110
|
+
.string()
|
|
111
|
+
.transform(sanitizeText)
|
|
112
|
+
.pipe(z.string().min(1).max(max));
|
|
113
|
+
// An https:// URL, trimmed and capped. http:// is rejected: the Atlas is a
|
|
114
|
+
// public surface and only links to TLS origins.
|
|
115
|
+
const httpsUrl = (max) => z
|
|
116
|
+
.string()
|
|
117
|
+
.transform((value) => value.trim())
|
|
118
|
+
.pipe(z
|
|
119
|
+
.string()
|
|
120
|
+
.min(1)
|
|
121
|
+
.max(max)
|
|
122
|
+
.refine(isHttpsUrl, { message: "must be a valid https:// URL" }));
|
|
123
|
+
// A strict ISO 8601 datetime: `YYYY-MM-DDThh:mm:ss(.sss)?(Z|±hh:mm)`. The
|
|
124
|
+
// previous schema accepted anything `Date.parse` tolerated: "2026", a bare
|
|
125
|
+
// date, a locale string: which let inconsistent timestamps onto the wire.
|
|
126
|
+
// This pins the format so both sides agree, then confirms it is a real,
|
|
127
|
+
// in-range instant.
|
|
128
|
+
const ISO_8601 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})$/;
|
|
129
|
+
const isoDatetime = () => z
|
|
130
|
+
.string()
|
|
131
|
+
.max(40)
|
|
132
|
+
.refine((value) => ISO_8601.test(value) && !Number.isNaN(Date.parse(value)), {
|
|
133
|
+
message: "must be a strict ISO 8601 datetime (YYYY-MM-DDThh:mm:ssZ)",
|
|
134
|
+
});
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// Manifest: a beacon's core public identity
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
/** Coarse geographic regions, used for directory filtering. */
|
|
139
|
+
export const REGIONS = [
|
|
140
|
+
"na",
|
|
141
|
+
"sa",
|
|
142
|
+
"eu",
|
|
143
|
+
"uk",
|
|
144
|
+
"africa",
|
|
145
|
+
"asia",
|
|
146
|
+
"oce",
|
|
147
|
+
"other",
|
|
148
|
+
];
|
|
149
|
+
export const regionSchema = z.enum(REGIONS);
|
|
150
|
+
/** Granular public placement, still privacy-preserving by default. */
|
|
151
|
+
export const coordinateSchema = z.object({
|
|
152
|
+
/** Approximate latitude. Operators should not publish a home address. */
|
|
153
|
+
lat: z.number().min(-85).max(85),
|
|
154
|
+
/** Approximate longitude. Operators should not publish a home address. */
|
|
155
|
+
lon: z.number().min(-180).max(180),
|
|
156
|
+
/** Radius of uncertainty around the point, in kilometres. */
|
|
157
|
+
precisionKm: z.number().int().min(1).max(1000).optional(),
|
|
158
|
+
});
|
|
159
|
+
const publicLocationSchema = z.object({
|
|
160
|
+
/** Coarse region for filtering and fallback placement. */
|
|
161
|
+
region: regionSchema,
|
|
162
|
+
/** ISO 3166-1 alpha-2 country code, e.g. `US`, `CA`, `BR`. */
|
|
163
|
+
countryCode: z
|
|
164
|
+
.string()
|
|
165
|
+
.trim()
|
|
166
|
+
.toUpperCase()
|
|
167
|
+
.regex(/^[A-Z]{2}$/)
|
|
168
|
+
.optional(),
|
|
169
|
+
/** State/province/region code or label, e.g. `NY`, `ON`, `Scotland`. */
|
|
170
|
+
subdivisionCode: boundedText(32).optional(),
|
|
171
|
+
/** City/metro/nearest community label. */
|
|
172
|
+
locality: boundedText(80).optional(),
|
|
173
|
+
/**
|
|
174
|
+
* Optional approximate point. If omitted, Atlas places the beacon from the
|
|
175
|
+
* most specific available public geography above.
|
|
176
|
+
*/
|
|
177
|
+
coordinates: coordinateSchema.optional(),
|
|
178
|
+
});
|
|
179
|
+
export const serverLocationSchema = publicLocationSchema;
|
|
180
|
+
export const communityLocationSchema = publicLocationSchema;
|
|
181
|
+
/**
|
|
182
|
+
* How a player gets into the beacon, surfaced so the Atlas renders the right
|
|
183
|
+
* call to action: `gated` links to the beacon's own `/join` flow (the operator
|
|
184
|
+
* still approves), `open` means Atlas deep-links to a public Minecraft login
|
|
185
|
+
* flow that the beacon auto-approves after re-checking its Atlas profile.
|
|
186
|
+
*/
|
|
187
|
+
export const joinPolicySchema = z.enum(["gated", "open"]);
|
|
188
|
+
/**
|
|
189
|
+
* The mod loader / server software a beacon runs: part of core identity.
|
|
190
|
+
* These mirror `@beacon/shared`'s `LoaderId` exactly: a beacon publishes the
|
|
191
|
+
* loader it runs, so the publisher passes the value straight through with no
|
|
192
|
+
* mapping. Keep the two enums in lockstep.
|
|
193
|
+
*/
|
|
194
|
+
export const loaderSchema = z.enum([
|
|
195
|
+
"vanilla",
|
|
196
|
+
"paper",
|
|
197
|
+
"purpur",
|
|
198
|
+
"folia",
|
|
199
|
+
"fabric",
|
|
200
|
+
"quilt",
|
|
201
|
+
"forge",
|
|
202
|
+
"neoforge",
|
|
203
|
+
]);
|
|
204
|
+
/**
|
|
205
|
+
* A Beacon-hosted Vantage protocol endpoint. Atlas never receives the tile
|
|
206
|
+
* tree: this capability tells the public profile that it may connect directly
|
|
207
|
+
* to the Beacon's public map boundary and speak Vantage protocol v1 there.
|
|
208
|
+
*/
|
|
209
|
+
export const vantageStreamSchema = z.object({
|
|
210
|
+
protocolVersion: z.literal(1),
|
|
211
|
+
mode: z.literal("live"),
|
|
212
|
+
/**
|
|
213
|
+
* How many dimensions the endpoint serves, when it publishes a `world.json`
|
|
214
|
+
* index naming them. Absent means an older Beacon whose only entry point is
|
|
215
|
+
* `manifest.json` — so its presence, not its value, is what tells a viewer
|
|
216
|
+
* which URL to open. No coordinates ride on this: it is a count.
|
|
217
|
+
*/
|
|
218
|
+
dimensions: z.number().int().min(1).max(64).optional(),
|
|
219
|
+
});
|
|
220
|
+
/**
|
|
221
|
+
* The slow-changing server-derived facts a beacon publishes about itself.
|
|
222
|
+
* These are values the running server measures or knows about its own
|
|
223
|
+
* runtime, not anything the operator typed. Operator-typed identity
|
|
224
|
+
* (name, description, addresses, locations, tags, …) lives on the Atlas
|
|
225
|
+
* listing row and never crosses this wire.
|
|
226
|
+
*
|
|
227
|
+
* Coordinates, invite codes, the audit log, and any operator account
|
|
228
|
+
* data have no field to ride on. Player identities leave a beacon only
|
|
229
|
+
* through the opt-in `profile.roster` / `profile.activity` fields.
|
|
230
|
+
*/
|
|
231
|
+
export const manifestSchema = z.object({
|
|
232
|
+
/** Minecraft version string, e.g. "1.21.4". */
|
|
233
|
+
mcVersion: boundedText(32),
|
|
234
|
+
/** Server software / mod loader. */
|
|
235
|
+
loader: loaderSchema,
|
|
236
|
+
/** Installed mods / plugins, by name. */
|
|
237
|
+
mods: z.array(boundedText(64)).max(300).default([]),
|
|
238
|
+
/** Server render distance, in chunks. */
|
|
239
|
+
renderDistance: z.number().int().min(2).max(64).optional(),
|
|
240
|
+
/** How long the current world has existed, in days. */
|
|
241
|
+
worldAgeDays: z.number().int().min(0).max(40_000).optional(),
|
|
242
|
+
/** On-disk world size, in mebibytes. */
|
|
243
|
+
worldSizeMib: z.number().int().min(0).max(100_000_000).optional(),
|
|
244
|
+
/** Public, federated Vantage stream capability. No map bytes ride here. */
|
|
245
|
+
vantage: vantageStreamSchema.optional(),
|
|
246
|
+
});
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// Profile: opt-in consent-gated player-identity data
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
//
|
|
251
|
+
// Everything operator-typed (host name, vibe, rules, host note, events,
|
|
252
|
+
// difficulty, Discord invite, per-section privacy) lives on the Atlas
|
|
253
|
+
// listing row, not on the wire. The only thing the beacon publishes
|
|
254
|
+
// itself is *opt-in player data*: a roster of members and a recent-
|
|
255
|
+
// activity feed. Both are absent unless the operator flipped the
|
|
256
|
+
// matching consent toggle on the Atlas dashboard.
|
|
257
|
+
/** World difficulty: stored on the Atlas listing row, surfaced on `/b/[slug]`. */
|
|
258
|
+
export const difficultySchema = z.enum([
|
|
259
|
+
"peaceful",
|
|
260
|
+
"easy",
|
|
261
|
+
"normal",
|
|
262
|
+
"hard",
|
|
263
|
+
"hardcore",
|
|
264
|
+
]);
|
|
265
|
+
/**
|
|
266
|
+
* Per-section visibility the host configures on the Atlas dashboard.
|
|
267
|
+
* `public` shows the section to everyone; `members` restricts it to the
|
|
268
|
+
* beacon's members; `hidden` hides it from everyone but the host. The
|
|
269
|
+
* Atlas renders a `members`/`hidden` section as a locked placeholder for
|
|
270
|
+
* visitors. `coords` also gates the federated Vantage world; its bytes stay on
|
|
271
|
+
* the Beacon and never cross the heartbeat wire.
|
|
272
|
+
*/
|
|
273
|
+
export const privacyLevelSchema = z.enum(["public", "members", "hidden"]);
|
|
274
|
+
/** The profile sections whose visibility a host can configure. */
|
|
275
|
+
export const PRIVACY_SECTIONS = [
|
|
276
|
+
"coords",
|
|
277
|
+
"roster",
|
|
278
|
+
"activity",
|
|
279
|
+
"mods",
|
|
280
|
+
"perf",
|
|
281
|
+
];
|
|
282
|
+
/** Visibility map, one level per gateable section. Defaults to `public`. */
|
|
283
|
+
export const privacySchema = z.object({
|
|
284
|
+
coords: privacyLevelSchema.default("public"),
|
|
285
|
+
roster: privacyLevelSchema.default("public"),
|
|
286
|
+
activity: privacyLevelSchema.default("public"),
|
|
287
|
+
mods: privacyLevelSchema.default("public"),
|
|
288
|
+
perf: privacyLevelSchema.default("public"),
|
|
289
|
+
});
|
|
290
|
+
/** A staff/member role, used to tally and badge the roster. */
|
|
291
|
+
export const rosterRoleSchema = z.enum([
|
|
292
|
+
"host",
|
|
293
|
+
"admin",
|
|
294
|
+
"mod",
|
|
295
|
+
"builder",
|
|
296
|
+
"member",
|
|
297
|
+
]);
|
|
298
|
+
/** One entry in the published roster: opt-in player-identity data. */
|
|
299
|
+
export const rosterEntrySchema = z.object({
|
|
300
|
+
name: boundedText(32),
|
|
301
|
+
role: rosterRoleSchema,
|
|
302
|
+
/** Whether this player is connected as of the heartbeat. */
|
|
303
|
+
online: z.boolean().default(false),
|
|
304
|
+
});
|
|
305
|
+
/** The kind of a recent-activity row. */
|
|
306
|
+
export const activityKindSchema = z.enum([
|
|
307
|
+
"join",
|
|
308
|
+
"leave",
|
|
309
|
+
"death",
|
|
310
|
+
"advancement",
|
|
311
|
+
"build",
|
|
312
|
+
"broadcast",
|
|
313
|
+
]);
|
|
314
|
+
/** One row in the published recent-activity feed: opt-in player data. */
|
|
315
|
+
export const activityEntrySchema = z.object({
|
|
316
|
+
kind: activityKindSchema,
|
|
317
|
+
/** The player the row is about. Absent for server-level rows. */
|
|
318
|
+
actor: boundedText(32).optional(),
|
|
319
|
+
/** Human-readable detail, e.g. "earned The End" or "was slain by a Warden". */
|
|
320
|
+
detail: boundedText(160),
|
|
321
|
+
/** When it happened, ISO 8601. */
|
|
322
|
+
at: isoDatetime(),
|
|
323
|
+
});
|
|
324
|
+
/** An upcoming community event for the "Up next" panel. Stored on the
|
|
325
|
+
* Atlas listing row (operator-typed), not on the wire. */
|
|
326
|
+
export const eventEntrySchema = z.object({
|
|
327
|
+
at: isoDatetime(),
|
|
328
|
+
title: boundedText(80),
|
|
329
|
+
detail: boundedText(120).optional(),
|
|
330
|
+
});
|
|
331
|
+
/** A pinned note from the host. Stored on the Atlas listing row. */
|
|
332
|
+
export const hostNoteSchema = z.object({
|
|
333
|
+
body: boundedText(600),
|
|
334
|
+
postedAt: isoDatetime(),
|
|
335
|
+
});
|
|
336
|
+
/**
|
|
337
|
+
* The optional opt-in player-data block on a heartbeat. Both fields are
|
|
338
|
+
* gated by the matching consent toggle on the Atlas listing row: the
|
|
339
|
+
* beacon must not publish them unless the operator opted in.
|
|
340
|
+
*/
|
|
341
|
+
export const profileSchema = z.object({
|
|
342
|
+
/** Published member roster: opt-in player-identity data. */
|
|
343
|
+
roster: z.array(rosterEntrySchema).max(300).optional(),
|
|
344
|
+
/** Published recent-activity feed: opt-in player-identity data. */
|
|
345
|
+
activity: z.array(activityEntrySchema).max(50).optional(),
|
|
346
|
+
});
|
|
347
|
+
// ---------------------------------------------------------------------------
|
|
348
|
+
// Status: a beacon's live snapshot
|
|
349
|
+
// ---------------------------------------------------------------------------
|
|
350
|
+
/**
|
|
351
|
+
* The live, fast-changing slice of a heartbeat: re-measured every tick.
|
|
352
|
+
* Self-reported: the Atlas independently Server-List-Pings `manifest.mcAddress`
|
|
353
|
+
* and treats the ping result as authoritative over these numbers.
|
|
354
|
+
*/
|
|
355
|
+
export const statusSchema = z.object({
|
|
356
|
+
/** Whether the beacon considers its Minecraft server reachable. */
|
|
357
|
+
online: z.boolean(),
|
|
358
|
+
/** Players currently connected. */
|
|
359
|
+
playersOnline: z.number().int().min(0).max(100_000),
|
|
360
|
+
/** Player slot capacity. */
|
|
361
|
+
playersMax: z.number().int().min(0).max(100_000),
|
|
362
|
+
/** Server ticks per second, 0–20. Drives the Performance panel. */
|
|
363
|
+
tps: z.number().min(0).max(20).optional(),
|
|
364
|
+
/** Seconds since the Minecraft process last started. */
|
|
365
|
+
uptimeSeconds: z.number().int().min(0).optional(),
|
|
366
|
+
/** Rolling uptime reliability, as a percentage 0–100. */
|
|
367
|
+
uptimePct: z.number().min(0).max(100).optional(),
|
|
368
|
+
/**
|
|
369
|
+
* Daily player peaks for the last 7 days, oldest first. Powers the
|
|
370
|
+
* profile's "players, last 7 days" sparkline.
|
|
371
|
+
*/
|
|
372
|
+
playersPeak7d: z
|
|
373
|
+
.array(z.number().int().min(0).max(100_000))
|
|
374
|
+
.max(14)
|
|
375
|
+
.optional(),
|
|
376
|
+
/** When this status was sampled, ISO 8601. */
|
|
377
|
+
sampledAt: isoDatetime(),
|
|
378
|
+
});
|
|
379
|
+
// ---------------------------------------------------------------------------
|
|
380
|
+
// Heartbeat: the full POST body
|
|
381
|
+
// ---------------------------------------------------------------------------
|
|
382
|
+
// Opaque listing id minted by the Atlas at registration. The bearer secret
|
|
383
|
+
// that authenticates a heartbeat travels in an HTTP header, not in this body.
|
|
384
|
+
const beaconIdSchema = z
|
|
385
|
+
.string()
|
|
386
|
+
.min(1)
|
|
387
|
+
.max(64)
|
|
388
|
+
.regex(/^[A-Za-z0-9_-]+$/, "must be an opaque url-safe id");
|
|
389
|
+
export const heartbeatSchema = z.object({
|
|
390
|
+
/** Wire-format version the sending beacon was built against. */
|
|
391
|
+
schemaVersion: z.number().int().min(1),
|
|
392
|
+
/** The listing this heartbeat belongs to. */
|
|
393
|
+
beaconId: beaconIdSchema,
|
|
394
|
+
manifest: manifestSchema,
|
|
395
|
+
/** Optional operator-curated extended block: backs the profile page. */
|
|
396
|
+
profile: profileSchema.optional(),
|
|
397
|
+
status: statusSchema,
|
|
398
|
+
});
|
|
399
|
+
/**
|
|
400
|
+
* Stamp a heartbeat with the current {@link SCHEMA_VERSION}. The beacon-side
|
|
401
|
+
* publisher uses this so the version is set in exactly one place.
|
|
402
|
+
*/
|
|
403
|
+
export function buildHeartbeat(beaconId, manifest, status, profile) {
|
|
404
|
+
return {
|
|
405
|
+
schemaVersion: SCHEMA_VERSION,
|
|
406
|
+
beaconId,
|
|
407
|
+
manifest,
|
|
408
|
+
...(profile ? { profile } : {}),
|
|
409
|
+
status,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Parse and validate an inbound heartbeat body on the Atlas side.
|
|
414
|
+
*
|
|
415
|
+
* Schema-version tolerant by design: a heartbeat is accepted regardless of its
|
|
416
|
+
* `schemaVersion`. A beacon on a newer version may send extra fields: zod
|
|
417
|
+
* strips unknown keys, so the known shape still validates. A beacon on an
|
|
418
|
+
* older version is fine as long as it satisfies the current required fields;
|
|
419
|
+
* future additive fields must therefore be optional. `futureSchema` flags a
|
|
420
|
+
* heartbeat newer than this build so callers can log or surface it.
|
|
421
|
+
*/
|
|
422
|
+
export function parseHeartbeat(input) {
|
|
423
|
+
const result = heartbeatSchema.safeParse(input);
|
|
424
|
+
if (!result.success) {
|
|
425
|
+
const error = result.error.issues
|
|
426
|
+
.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
427
|
+
.join("; ");
|
|
428
|
+
return { ok: false, error };
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
ok: true,
|
|
432
|
+
heartbeat: result.data,
|
|
433
|
+
futureSchema: result.data.schemaVersion > SCHEMA_VERSION,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Check that a heartbeat's `status.sampledAt` sits inside the freshness
|
|
438
|
+
* window around the Atlas's clock. A too-old sample is `stale` (a delayed or
|
|
439
|
+
* replayed heartbeat); a too-far-ahead sample is `future` (a skewed beacon
|
|
440
|
+
* clock). The ingest route rejects either. This is a key-free replay bound:
|
|
441
|
+
* a captured heartbeat is worthless once it ages past {@link
|
|
442
|
+
* HEARTBEAT_MAX_AGE_MS}.
|
|
443
|
+
*/
|
|
444
|
+
export function checkHeartbeatFreshness(sampledAt, now = new Date()) {
|
|
445
|
+
const sampled = Date.parse(sampledAt);
|
|
446
|
+
if (Number.isNaN(sampled))
|
|
447
|
+
return { fresh: false, reason: "future" };
|
|
448
|
+
const delta = now.getTime() - sampled;
|
|
449
|
+
if (delta > HEARTBEAT_MAX_AGE_MS)
|
|
450
|
+
return { fresh: false, reason: "stale" };
|
|
451
|
+
if (delta < -HEARTBEAT_MAX_SKEW_MS)
|
|
452
|
+
return { fresh: false, reason: "future" };
|
|
453
|
+
return { fresh: true };
|
|
454
|
+
}
|
|
455
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0BAA0B;AAC1B,EAAE;AACF,+EAA+E;AAC/E,uEAAuE;AACvE,8EAA8E;AAC9E,+EAA+E;AAC/E,qEAAqE;AACrE,4EAA4E;AAC5E,+EAA+E;AAC/E,qEAAqE;AACrE,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,uEAAuE;AACvE,yEAAyE;AACzE,qEAAqE;AACrE,2CAA2C;AAC3C,EAAE;AACF,sEAAsE;AACtE,4DAA4D;AAC5D,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,oEAAoE;AACpE,yBAAyB;AACzB,EAAE;AACF,oEAAoE;AACpE,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,+EAA+E;A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AG,CAAC,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aACvE,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,MAAM,CAAC,IAAI;QACtB,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,GAAG,cAAc;KACzD,CAAC;AACJ,CAAC;AAMD;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAiB,EACjB,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrE,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,KAAK,GAAG,oBAAoB;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC3E,IAAI,KAAK,GAAG,CAAC,qBAAqB;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const MOD_RELAY_BASE_PATH = "/api/mods";
|
|
2
|
+
export declare const MOD_RELAY_STATUS_PATH = "/api/mods/status";
|
|
3
|
+
export declare const MOD_RELAY_BEACON_ID_HEADER = "x-beacon-id";
|
|
4
|
+
export declare const MOD_RELAY_UPSTREAMS: {
|
|
5
|
+
readonly modrinth: "https://api.modrinth.com/v2";
|
|
6
|
+
readonly curseforge: "https://api.curseforge.com/v1";
|
|
7
|
+
};
|
|
8
|
+
export type ModRelayProvider = keyof typeof MOD_RELAY_UPSTREAMS;
|
|
9
|
+
export declare const MOD_RELAY_PROVIDERS: readonly ModRelayProvider[];
|
|
10
|
+
export declare function isModRelayProvider(value: string): value is ModRelayProvider;
|
|
11
|
+
export declare function modRelayProviderBasePath(provider: ModRelayProvider): string;
|
|
12
|
+
export type ModRelayMethod = "GET" | "POST";
|
|
13
|
+
export type ModRelayRoute = {
|
|
14
|
+
method: ModRelayMethod;
|
|
15
|
+
pattern: RegExp;
|
|
16
|
+
};
|
|
17
|
+
export declare const MOD_RELAY_ROUTES: Record<ModRelayProvider, readonly ModRelayRoute[]>;
|
|
18
|
+
export declare function isAllowedModRelayRoute(provider: ModRelayProvider, method: string, upstreamPath: string): boolean;
|
|
19
|
+
export declare const MOD_RELAY_MAX_BODY_BYTES: number;
|
|
20
|
+
export type ModRelayStatus = {
|
|
21
|
+
providers: Record<ModRelayProvider, {
|
|
22
|
+
available: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export declare function parseModRelayStatus(raw: unknown): ModRelayStatus | null;
|
|
26
|
+
//# sourceMappingURL=mod-relay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-relay.d.ts","sourceRoot":"","sources":["../src/mod-relay.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAKxD,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AAIxD,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAEhE,eAAO,MAAM,mBAAmB,EAE3B,SAAS,gBAAgB,EAAE,CAAC;AAEjC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAE3E;AAID,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAE3E;AAUD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAKF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,gBAAgB,EAChB,SAAS,aAAa,EAAE,CAezB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,OAAO,CAMT;AAID,eAAO,MAAM,wBAAwB,QAAY,CAAC;AASlD,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAavE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Atlas mod relay: the wire contract between a beacon and the Atlas's
|
|
2
|
+
// central mod-provider gateway.
|
|
3
|
+
//
|
|
4
|
+
// The Atlas fronts every provider's catalog API for registered beacons:
|
|
5
|
+
// one place holds upstream credentials (CurseForge's key never leaves
|
|
6
|
+
// the Atlas), responses are cached across ALL beacons, and per-beacon
|
|
7
|
+
// rate limits protect the shared upstream quota. A beacon calls
|
|
8
|
+
//
|
|
9
|
+
// {atlas}/api/mods/{provider}/{upstream path}?{query}
|
|
10
|
+
//
|
|
11
|
+
// with its registration credentials (`Authorization: Bearer <secret>` +
|
|
12
|
+
// `X-Beacon-Id`), and the relay forwards the allowlisted subset below to
|
|
13
|
+
// the provider's real API. The allowlist lives HERE — shared by the
|
|
14
|
+
// Atlas (enforcement) and admin-rpc (so a client change that needs a new
|
|
15
|
+
// route shows up as a contract change, not a mysterious 404).
|
|
16
|
+
export const MOD_RELAY_BASE_PATH = "/api/mods";
|
|
17
|
+
export const MOD_RELAY_STATUS_PATH = "/api/mods/status";
|
|
18
|
+
// Beacon identity header accompanying the bearer secret. The heartbeat
|
|
19
|
+
// carries its beacon id in the body; relay calls are mostly GETs, so the
|
|
20
|
+
// id rides a header instead.
|
|
21
|
+
export const MOD_RELAY_BEACON_ID_HEADER = "x-beacon-id";
|
|
22
|
+
// Upstream base URLs, owned by the relay — a beacon cannot point the
|
|
23
|
+
// Atlas at an arbitrary origin.
|
|
24
|
+
export const MOD_RELAY_UPSTREAMS = {
|
|
25
|
+
modrinth: "https://api.modrinth.com/v2",
|
|
26
|
+
curseforge: "https://api.curseforge.com/v1",
|
|
27
|
+
};
|
|
28
|
+
export const MOD_RELAY_PROVIDERS = Object.keys(MOD_RELAY_UPSTREAMS);
|
|
29
|
+
export function isModRelayProvider(value) {
|
|
30
|
+
return Object.prototype.hasOwnProperty.call(MOD_RELAY_UPSTREAMS, value);
|
|
31
|
+
}
|
|
32
|
+
// The relay path a beacon-side client uses as its API base for one
|
|
33
|
+
// provider (append the provider client's usual upstream paths).
|
|
34
|
+
export function modRelayProviderBasePath(provider) {
|
|
35
|
+
return `${MOD_RELAY_BASE_PATH}/${provider}`;
|
|
36
|
+
}
|
|
37
|
+
// One URL-encoded path segment (slug, id, or percent-escaped bytes).
|
|
38
|
+
const SEG = "[A-Za-z0-9._%!\\-~]+";
|
|
39
|
+
export const MOD_RELAY_ROUTES = {
|
|
40
|
+
modrinth: [
|
|
41
|
+
{ method: "GET", pattern: new RegExp(`^/search$`) },
|
|
42
|
+
{ method: "GET", pattern: new RegExp(`^/project/${SEG}$`) },
|
|
43
|
+
{ method: "GET", pattern: new RegExp(`^/project/${SEG}/version$`) },
|
|
44
|
+
{ method: "GET", pattern: new RegExp(`^/version/${SEG}$`) },
|
|
45
|
+
],
|
|
46
|
+
curseforge: [
|
|
47
|
+
{ method: "GET", pattern: new RegExp(`^/mods/search$`) },
|
|
48
|
+
{ method: "GET", pattern: new RegExp(`^/mods/\\d+$`) },
|
|
49
|
+
{ method: "GET", pattern: new RegExp(`^/mods/\\d+/files$`) },
|
|
50
|
+
{ method: "POST", pattern: new RegExp(`^/mods/files$`) },
|
|
51
|
+
{ method: "GET", pattern: new RegExp(`^/categories$`) },
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
export function isAllowedModRelayRoute(provider, method, upstreamPath) {
|
|
55
|
+
const normalizedMethod = method.toUpperCase();
|
|
56
|
+
return MOD_RELAY_ROUTES[provider].some((route) => route.method === normalizedMethod && route.pattern.test(upstreamPath));
|
|
57
|
+
}
|
|
58
|
+
// Cap for relayed POST bodies (CurseForge bulk file lookups are tiny;
|
|
59
|
+
// anything larger is not a legitimate relay call).
|
|
60
|
+
export const MOD_RELAY_MAX_BODY_BYTES = 16 * 1024;
|
|
61
|
+
export function parseModRelayStatus(raw) {
|
|
62
|
+
if (!raw || typeof raw !== "object")
|
|
63
|
+
return null;
|
|
64
|
+
const providers = raw.providers;
|
|
65
|
+
if (!providers || typeof providers !== "object")
|
|
66
|
+
return null;
|
|
67
|
+
const out = {};
|
|
68
|
+
for (const provider of MOD_RELAY_PROVIDERS) {
|
|
69
|
+
const entry = providers[provider];
|
|
70
|
+
if (!entry || typeof entry !== "object")
|
|
71
|
+
return null;
|
|
72
|
+
const available = entry.available;
|
|
73
|
+
if (typeof available !== "boolean")
|
|
74
|
+
return null;
|
|
75
|
+
out[provider] = { available };
|
|
76
|
+
}
|
|
77
|
+
return { providers: out };
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=mod-relay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-relay.js","sourceRoot":"","sources":["../src/mod-relay.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,gCAAgC;AAChC,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,gEAAgE;AACh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K,MAAM,QAAQ,IAAI,mBAAmB,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAI,SAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACrD,MAAM,SAAS,GAAI,KAAiC,CAAC,SAAS,CAAC;QAC/D,IAAI,OAAO,SAAS,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QAChD,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/play.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Where a play link points: a loadout on a specific beacon. */
|
|
2
|
+
export interface PlayTarget {
|
|
3
|
+
/** Full origin of the beacon's web app (scheme + host + port), normalized —
|
|
4
|
+
* e.g. `http://localhost:3000`, `https://play.example`. */
|
|
5
|
+
beaconOrigin: string;
|
|
6
|
+
/** The loadout to resolve from `<beaconOrigin>/i/<loadoutId>`. */
|
|
7
|
+
loadoutId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* What a beacon advertises at `GET /api/play`: its current (active) loadout and
|
|
11
|
+
* whether the launcher can one-click play it. Loadouts live on the beacon, not
|
|
12
|
+
* Atlas, so the launcher resolves this from a directory beacon's `publicUrl` to
|
|
13
|
+
* launch straight from Browse — no `beacon://play` deep link needed.
|
|
14
|
+
*
|
|
15
|
+
* This is the public, low-sensitivity descriptor (the same facts the beacon's
|
|
16
|
+
* own home page shows on its Play button); the heavy mod list still comes from
|
|
17
|
+
* the gated `/i/<loadoutId>/manifest.json` at launch time.
|
|
18
|
+
*/
|
|
19
|
+
export interface ActivePlayTarget {
|
|
20
|
+
/** The active loadout's id — the deep-link target and the install-record key. */
|
|
21
|
+
loadoutId: string;
|
|
22
|
+
/** Display name of the client pack. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** One-line summary, or null. */
|
|
25
|
+
summary: string | null;
|
|
26
|
+
/** Loader id (`fabric`/`quilt`/`vanilla`/…), for display. `vanilla` means
|
|
27
|
+
* nothing to install client-side — the stock client just connects. */
|
|
28
|
+
loader: string;
|
|
29
|
+
/** Minecraft version. */
|
|
30
|
+
mcVersion: string;
|
|
31
|
+
/** True when the launcher can resolve/install + boot the loadout (plain
|
|
32
|
+
* vanilla, Fabric/Quilt metadata, or Forge/NeoForge official installers). */
|
|
33
|
+
launchable: boolean;
|
|
34
|
+
/** True when the loadout's manifest is publicly fetchable (a `shared` loadout).
|
|
35
|
+
* A false value still may be playable: the launcher can authorize the gated
|
|
36
|
+
* manifest through its first-party Beacon session at launch time. */
|
|
37
|
+
shared: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate an untrusted `GET /api/play` payload into an {@link ActivePlayTarget},
|
|
41
|
+
* or null if it isn't one. Mirrors the defensive parsing the launcher applies to
|
|
42
|
+
* any beacon-served JSON.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseActivePlayTarget(data: unknown): ActivePlayTarget | null;
|
|
45
|
+
/**
|
|
46
|
+
* Build a `beacon://play` deep link. Throws if `beaconOrigin` is not a valid
|
|
47
|
+
* http(s) origin or `loadoutId` is empty — both are programming errors at the
|
|
48
|
+
* call site (the web Play button always has a real origin + id).
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildPlayUri(target: PlayTarget): string;
|
|
51
|
+
/**
|
|
52
|
+
* Parse a `beacon://play` deep link. Returns null for anything that isn't a
|
|
53
|
+
* well-formed play link carrying a loadout id and a valid http(s) `host`
|
|
54
|
+
* origin — a malformed or hostile link simply doesn't resolve.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parsePlayUri(uri: string): PlayTarget | null;
|
|
57
|
+
//# sourceMappingURL=play.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../src/play.ts"],"names":[],"mappings":"AAmBA,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB;gEAC4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;2EACuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB;kFAC8E;IAC9E,UAAU,EAAE,OAAO,CAAC;IACpB;;0EAEsE;IACtE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAkB5E;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CASvD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAsB3D"}
|