@hadoku/game-server 0.1.119 → 0.1.120

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.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Account erase in a game's draft record (Magic's `history/drafts.ts`, `<stateDir>/history/drafts.jsonl`).
3
+ * A record keeps every seat of a draft: the other drafters' picks and the draft's counts hang on
4
+ * it, so the person's seat is anonymised and kept, never removed. The game's store decides what
5
+ * an anonymised seat looks like; this step only says whose.
6
+ *
7
+ * An account merge moves the merged-away account's seats to the kept account.
8
+ *
9
+ * Generic on purpose: this package is the platform (MIT) and knows no game's record, so the game
10
+ * hands its store in where it registers the step.
11
+ */
12
+ import type { EraseStep } from './index.js';
13
+ export interface SeatRecords {
14
+ /** Every seat naming one of `userIds` is anonymised. Answers the seats changed. */
15
+ anonymise(userIds: ReadonlySet<string>): Promise<number>;
16
+ /** Every seat naming a key of `renames` names its value instead. Answers the seats changed. */
17
+ move(renames: ReadonlyMap<string, string>): Promise<number>;
18
+ }
19
+ export declare function draftsEraseStep(store: SeatRecords): EraseStep;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Account erase in a game's draft record (Magic's `history/drafts.ts`, `<stateDir>/history/drafts.jsonl`).
3
+ * A record keeps every seat of a draft: the other drafters' picks and the draft's counts hang on
4
+ * it, so the person's seat is anonymised and kept, never removed. The game's store decides what
5
+ * an anonymised seat looks like; this step only says whose.
6
+ *
7
+ * An account merge moves the merged-away account's seats to the kept account.
8
+ *
9
+ * Generic on purpose: this package is the platform (MIT) and knows no game's record, so the game
10
+ * hands its store in where it registers the step.
11
+ */
12
+ export function draftsEraseStep(store) {
13
+ return {
14
+ what: 'drafts',
15
+ erase: ({ userId }) => store.anonymise(new Set([userId])),
16
+ merge: ({ from, into }) => store.move(new Map([[from.userId, into.userId]])),
17
+ };
18
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-server",
3
- "version": "0.1.119",
4
- "gitHead": "fb1e748fe4c9ca5a7128c6604740ccea6ddbd134",
3
+ "version": "0.1.120",
4
+ "gitHead": "d082664a2ae59161386bf8b543e536c941f13d1b",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "The server parts any hosted game shares, above the kernel: the app config and edge auth, the room core (identity, seats, sessions, membership, the room list, the generic room routes), match hosting (the host contract, local and remote JVMs, placement, the start queue, recordings, the in-process and relay runtimes), streams, erase, telemetry and usage. Knows no game; Magic plugs in from apps/server. MIT; imports only node built-ins, express, socket.io, @wolffm/* and the platform packages.",
@@ -17,9 +17,9 @@
17
17
  "play/remote/"
18
18
  ],
19
19
  "dependencies": {
20
- "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.119",
21
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.119",
22
- "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.152",
20
+ "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.120",
21
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.120",
22
+ "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.153",
23
23
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.2.0",
24
24
  "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.134",
25
25
  "@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.134",