@dreamboard-games/sdk 0.4.0-alpha.5 → 0.4.0-alpha.7
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/REFERENCE.md +1493 -127
- package/dist/{HandView-x8MhbhFl.d.ts → HandView-Bi2lxzQP.d.ts} +3 -3
- package/dist/{ThemeProvider-DRalAWzY.d.ts → ThemeProvider-CElaL2ik.d.ts} +1 -1
- package/dist/authoring/index.d.ts +5 -4
- package/dist/authoring/index.js +4 -4
- package/dist/authoring/index.js.map +1 -1
- package/dist/browser-interaction.js +1 -1
- package/dist/{chunk-E3X552YM.js → chunk-2TRZSZGD.js} +1061 -425
- package/dist/chunk-2TRZSZGD.js.map +1 -0
- package/dist/{chunk-K5ZRJTZZ.js → chunk-3QIZKXJ2.js} +10 -5
- package/dist/chunk-3QIZKXJ2.js.map +1 -0
- package/dist/{chunk-KHY3RJLT.js → chunk-52DH7VQF.js} +62 -13
- package/dist/chunk-52DH7VQF.js.map +1 -0
- package/dist/chunk-5IHU5CUK.js +575 -0
- package/dist/chunk-5IHU5CUK.js.map +1 -0
- package/dist/{chunk-N6ZDIMRB.js → chunk-B2YBS3SG.js} +1 -1
- package/dist/chunk-B2YBS3SG.js.map +1 -0
- package/dist/chunk-IU6KGPY7.js +659 -0
- package/dist/chunk-IU6KGPY7.js.map +1 -0
- package/dist/{chunk-FXQPZZXC.js → chunk-KYEWGZ2Y.js} +2 -2
- package/dist/{chunk-FXQPZZXC.js.map → chunk-KYEWGZ2Y.js.map} +1 -1
- package/dist/{chunk-AQMEN3AT.js → chunk-NO537WSS.js} +2 -2
- package/dist/{chunk-TTISZQNI.js → chunk-Q322XCY2.js} +47 -31
- package/dist/chunk-Q322XCY2.js.map +1 -0
- package/dist/{chunk-QOFFRHZR.js → chunk-RKGJ64UN.js} +81 -41
- package/dist/chunk-RKGJ64UN.js.map +1 -0
- package/dist/{chunk-Y6Y2YABD.js → chunk-TGMXBRKY.js} +22 -6
- package/dist/chunk-TGMXBRKY.js.map +1 -0
- package/dist/{chunk-XZ667T4K.js → chunk-UC2UXAC6.js} +2 -2
- package/dist/chunk-VLG4YST5.js +564 -0
- package/dist/chunk-VLG4YST5.js.map +1 -0
- package/dist/{chunk-WUIVY2KE.js → chunk-WHR5UW3F.js} +1 -1
- package/dist/chunk-WHR5UW3F.js.map +1 -0
- package/dist/codegen.d.ts +13 -0
- package/dist/codegen.js +1 -1
- package/dist/{components-B7hFaEn_.d.ts → components-BTwSIjXj.d.ts} +77 -206
- package/dist/{stale-contract-artifact-error-BelRiIDR.d.ts → diagnostics-1BWjRo6-.d.ts} +1 -18
- package/dist/{hex-board-view-BFlWDb9k.d.ts → hex-board-view-aKkblDp6.d.ts} +180 -1
- package/dist/{index-gjxQichK.d.ts → index-CFTjJIXd.d.ts} +5 -4
- package/dist/{index.d-BL3bT5lt.d.ts → index.d-DMASeF6M.d.ts} +294 -27
- package/dist/index.js +2 -2
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -2
- package/dist/{runtime-api-BJharVaj.d.ts → plugin-state-BRH3UiUp.d.ts} +19 -3
- package/dist/{protocol-BP193lva.d.ts → protocol-835hEGne.d.ts} +42 -1
- package/dist/reducer/advanced.d.ts +4 -2
- package/dist/reducer/advanced.js +1 -1
- package/dist/reducer-contract.d.ts +1 -1
- package/dist/reducer-contract.js +2 -2
- package/dist/reducer.d.ts +13 -6
- package/dist/reducer.js +322 -20
- package/dist/reducer.js.map +1 -1
- package/dist/reference-games/index.d.ts +223 -0
- package/dist/reference-games/index.js +230 -0
- package/dist/reference-games/index.js.map +1 -0
- package/dist/runtime/primitives.d.ts +32 -7
- package/dist/runtime/primitives.js +10 -5
- package/dist/runtime/runtime-api.d.ts +1 -1
- package/dist/runtime/workspace-contract.d.ts +7 -7
- package/dist/runtime/workspace-contract.js +7 -6
- package/dist/runtime-Dkfm1x2r.d.ts +1670 -0
- package/dist/runtime.d.ts +10 -9
- package/dist/runtime.js +53 -19
- package/dist/runtime.js.map +1 -1
- package/dist/stale-contract-artifact-error-C5AaZPJ8.d.ts +18 -0
- package/dist/testing-runtime.d.ts +42 -0
- package/dist/testing-runtime.js +153 -0
- package/dist/testing-runtime.js.map +1 -0
- package/dist/testing.d.ts +82 -205
- package/dist/testing.js +83 -640
- package/dist/testing.js.map +1 -1
- package/dist/types-DcADVHe9.d.ts +192 -0
- package/dist/{types-CYeN0wLK.d.ts → types-aI4V9CWe.d.ts} +5 -5
- package/dist/types.d.ts +13 -0
- package/dist/ui/components.d.ts +6 -3
- package/dist/ui/components.js +15 -3
- package/dist/ui/plugin-styles.css +2 -2
- package/dist/{ui-contract-B4NjRlvC.d.ts → ui-contract-Ue6SywvO.d.ts} +24 -10
- package/dist/ui.d.ts +9 -6
- package/dist/ui.js +16 -4
- package/dist/views-32rSsfeU.d.ts +1559 -0
- package/package.json +33 -21
- package/dist/chunk-E3X552YM.js.map +0 -1
- package/dist/chunk-K5ZRJTZZ.js.map +0 -1
- package/dist/chunk-KHY3RJLT.js.map +0 -1
- package/dist/chunk-N6ZDIMRB.js.map +0 -1
- package/dist/chunk-O6M6PN4E.js +0 -1225
- package/dist/chunk-O6M6PN4E.js.map +0 -1
- package/dist/chunk-QOFFRHZR.js.map +0 -1
- package/dist/chunk-TTISZQNI.js.map +0 -1
- package/dist/chunk-WUIVY2KE.js.map +0 -1
- package/dist/chunk-Y6Y2YABD.js.map +0 -1
- package/dist/views-fn2RuXOx.d.ts +0 -3168
- /package/dist/{chunk-AQMEN3AT.js.map → chunk-NO537WSS.js.map} +0 -0
- /package/dist/{chunk-XZ667T4K.js.map → chunk-UC2UXAC6.js.map} +0 -0
package/dist/views-fn2RuXOx.d.ts
DELETED
|
@@ -1,3168 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CardCollection, ViewCard, ViewSlotOccupant } from './types.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Opaque brand applied to a runtime player identifier.
|
|
6
|
-
*
|
|
7
|
-
* Generators produce a workspace-specific `PlayerId` alias (e.g.
|
|
8
|
-
* `Brand<string, "PlayerId">` in `shared/manifest-contract.ts`). Authors
|
|
9
|
-
* obtain `PlayerId` values only through:
|
|
10
|
-
* - `q.player.order()` / `q.player.current()` (reducer queries),
|
|
11
|
-
* - engine-injected callback arguments (actions, phases, prompts),
|
|
12
|
-
* - `perPlayerKeys(...)` / entries iteration,
|
|
13
|
-
* - `asPlayerId(raw)` as an explicit escape hatch (e.g. ingress parsing).
|
|
14
|
-
*
|
|
15
|
-
* The brand is a phantom type: at runtime a `PlayerId` is just a string.
|
|
16
|
-
* Do not JSON-serialize the brand marker; it exists purely at the type
|
|
17
|
-
* level to block accidental literal comparisons such as
|
|
18
|
-
* `playerId === "player-1"`.
|
|
19
|
-
*/
|
|
20
|
-
type PlayerId = Brand<string, "PlayerId">;
|
|
21
|
-
/**
|
|
22
|
-
* Explicit conversion from a raw string to a branded `PlayerId`.
|
|
23
|
-
*
|
|
24
|
-
* Use at trust boundaries only (wire ingress, tests, fixtures). Inside
|
|
25
|
-
* reducer logic, obtain `PlayerId` values from the engine instead of
|
|
26
|
-
* constructing them yourself.
|
|
27
|
-
*/
|
|
28
|
-
declare function asPlayerId(raw: string): PlayerId;
|
|
29
|
-
/**
|
|
30
|
-
* Type guard that narrows `unknown` to `PlayerId` when the value is a
|
|
31
|
-
* non-empty string. Does not validate against a specific player roster;
|
|
32
|
-
* use `perPlayerSchema`/ingress parsing for that.
|
|
33
|
-
*/
|
|
34
|
-
declare function isPlayerId(value: unknown): value is PlayerId;
|
|
35
|
-
/**
|
|
36
|
-
* A runtime-accurate per-player map.
|
|
37
|
-
*
|
|
38
|
-
* `PerPlayer<Value>` is an opaque, ordered container whose entries are
|
|
39
|
-
* exactly the players that exist at runtime (the seats passed to
|
|
40
|
-
* `initialize`).
|
|
41
|
-
*
|
|
42
|
-
* The `__perPlayer` discriminator keeps the structural type nominal-ish
|
|
43
|
-
* without depending on a symbol (symbols do not round-trip through JSON,
|
|
44
|
-
* which this shape must).
|
|
45
|
-
*
|
|
46
|
-
* Construct with `perPlayer(ids, init)` and read with the accessors in
|
|
47
|
-
* this module; do not reach into `entries` directly unless you need
|
|
48
|
-
* ordered iteration.
|
|
49
|
-
*/
|
|
50
|
-
interface PerPlayer<Value, Id extends PlayerId = PlayerId> {
|
|
51
|
-
readonly __perPlayer: true;
|
|
52
|
-
readonly entries: ReadonlyArray<readonly [Id, Value]>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Construct a `PerPlayer<Value>` with one entry per `id` in `ids`.
|
|
56
|
-
*
|
|
57
|
-
* `ids` is treated as the authoritative runtime seat list: the returned
|
|
58
|
-
* `PerPlayer` contains exactly `ids.length` entries, in the same order.
|
|
59
|
-
* Duplicate ids throw.
|
|
60
|
-
*/
|
|
61
|
-
declare function perPlayer<Value, Id extends PlayerId = PlayerId>(ids: readonly Id[], init: (id: Id, index: number) => Value): PerPlayer<Value, Id>;
|
|
62
|
-
/** Ordered list of seat ids present in the `PerPlayer`. */
|
|
63
|
-
declare function perPlayerKeys<Id extends PlayerId>(value: PerPlayer<unknown, Id>): Id[];
|
|
64
|
-
/** Ordered list of values present in the `PerPlayer`. */
|
|
65
|
-
declare function perPlayerValues<Value>(value: PerPlayer<Value, PlayerId>): Value[];
|
|
66
|
-
/**
|
|
67
|
-
* Ordered `[id, value]` pairs. Returns the backing array as-is; callers
|
|
68
|
-
* must not mutate it.
|
|
69
|
-
*/
|
|
70
|
-
declare function perPlayerEntries<Value, Id extends PlayerId>(value: PerPlayer<Value, Id>): ReadonlyArray<readonly [Id, Value]>;
|
|
71
|
-
/** Number of seats in the `PerPlayer`. */
|
|
72
|
-
declare function perPlayerSize(value: PerPlayer<unknown, PlayerId>): number;
|
|
73
|
-
/** Whether `id` has a value. */
|
|
74
|
-
declare function perPlayerHas<Id extends PlayerId>(value: PerPlayer<unknown, Id>, id: Id): boolean;
|
|
75
|
-
/** Lookup with no fallback; returns `undefined` for missing seats. */
|
|
76
|
-
declare function perPlayerGet<Value, Id extends PlayerId>(value: PerPlayer<Value, Id>, id: Id): Value | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Lookup that throws if `id` is not present.
|
|
79
|
-
*
|
|
80
|
-
* Use when the caller has already established (via `q.player.order()`,
|
|
81
|
-
* an action context, etc.) that `id` is an active runtime seat.
|
|
82
|
-
*/
|
|
83
|
-
declare function perPlayerRequire<Value, Id extends PlayerId>(value: PerPlayer<Value, Id>, id: Id): Value;
|
|
84
|
-
/**
|
|
85
|
-
* Return a new `PerPlayer` with `id`'s value replaced (or added if the
|
|
86
|
-
* id is not present). Preserves entry order; new entries are appended.
|
|
87
|
-
*/
|
|
88
|
-
declare function perPlayerSet<Value, Id extends PlayerId>(value: PerPlayer<Value, Id>, id: Id, next: Value): PerPlayer<Value, Id>;
|
|
89
|
-
/**
|
|
90
|
-
* Return a new `PerPlayer` where each value is replaced by `f(value, id)`.
|
|
91
|
-
* Seat order is preserved.
|
|
92
|
-
*/
|
|
93
|
-
declare function perPlayerMap<Value, Next, Id extends PlayerId>(value: PerPlayer<Value, Id>, f: (v: Value, id: Id, index: number) => Next): PerPlayer<Next, Id>;
|
|
94
|
-
/**
|
|
95
|
-
* Structural check for a `PerPlayer` without a Zod schema. Useful in
|
|
96
|
-
* debug paths and as a fast pre-filter before schema validation.
|
|
97
|
-
*/
|
|
98
|
-
declare function isPerPlayer(value: unknown): value is PerPlayer<unknown>;
|
|
99
|
-
/**
|
|
100
|
-
* Options accepted by `perPlayerSchema`.
|
|
101
|
-
*
|
|
102
|
-
* Setting `players` locks the schema to an exact seat list: parse fails
|
|
103
|
-
* if the input is missing any seat or has an unknown id. Leaving
|
|
104
|
-
* `players` unset yields a schema that accepts any non-empty string as
|
|
105
|
-
* a key, which is the right default for generic SDK types.
|
|
106
|
-
*
|
|
107
|
-
* `playerIdSchema` lets callers feed a manifest-scoped Zod id schema in
|
|
108
|
-
* so parse errors carry the same message as other branded ids.
|
|
109
|
-
*/
|
|
110
|
-
type PerPlayerSchemaOptions<Id extends PlayerId> = {
|
|
111
|
-
readonly playerIdSchema?: z.ZodType<Id>;
|
|
112
|
-
readonly players?: readonly Id[];
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Build a Zod schema that validates a wire-shaped `PerPlayer<Value>`.
|
|
116
|
-
*
|
|
117
|
-
* When `options.players` is supplied the schema enforces that entries
|
|
118
|
-
* match that exact set (same cardinality, same ids, any order). This is
|
|
119
|
-
* the mechanism that catches the class of bug where a 3-player session
|
|
120
|
-
* produced a view shape the old `Record<PlayerId, T>` type claimed had
|
|
121
|
-
* a `player-4` key.
|
|
122
|
-
*/
|
|
123
|
-
declare function perPlayerSchema<Value, Id extends PlayerId = PlayerId>(valueSchema: z.ZodType<Value>, options?: PerPlayerSchemaOptions<Id>): z.ZodType<PerPlayer<Value, Id>>;
|
|
124
|
-
/**
|
|
125
|
-
* Reference to a board by its authored `baseId`, plus an optional seat
|
|
126
|
-
* for per-player boards.
|
|
127
|
-
*
|
|
128
|
-
* Replaces the old generated `"ring:player-1" | "ring:player-2" | ...`
|
|
129
|
-
* flat unions whose keys pretended to be static but were actually
|
|
130
|
-
* derived from `maxPlayers` and therefore misaligned with the runtime
|
|
131
|
-
* seat list.
|
|
132
|
-
*
|
|
133
|
-
* The discriminant is the *presence* of `seat`, not a `scope` field, so
|
|
134
|
-
* authors can destructure and pass the ref directly without needing a
|
|
135
|
-
* discriminator check for shared boards.
|
|
136
|
-
*/
|
|
137
|
-
type BoardRef<BaseId extends string = string, Id extends PlayerId = PlayerId> = SharedBoardRef<BaseId> | PerPlayerBoardRef<BaseId, Id>;
|
|
138
|
-
interface SharedBoardRef<BaseId extends string = string> {
|
|
139
|
-
readonly baseId: BaseId;
|
|
140
|
-
readonly seat?: undefined;
|
|
141
|
-
}
|
|
142
|
-
interface PerPlayerBoardRef<BaseId extends string = string, Id extends PlayerId = PlayerId> {
|
|
143
|
-
readonly baseId: BaseId;
|
|
144
|
-
readonly seat: Id;
|
|
145
|
-
}
|
|
146
|
-
/** Construct a shared board ref. */
|
|
147
|
-
declare function sharedBoardRef<BaseId extends string>(baseId: BaseId): SharedBoardRef<BaseId>;
|
|
148
|
-
/** Construct a per-player board ref. */
|
|
149
|
-
declare function perPlayerBoardRef<BaseId extends string, Id extends PlayerId>(baseId: BaseId, seat: Id): PerPlayerBoardRef<BaseId, Id>;
|
|
150
|
-
/**
|
|
151
|
-
* Construct a `BoardRef` without knowing the scope ahead of time. Pass
|
|
152
|
-
* `seat` for per-player boards; omit for shared boards.
|
|
153
|
-
*/
|
|
154
|
-
declare function boardRef<BaseId extends string, Id extends PlayerId>(baseId: BaseId, seat?: Id): BoardRef<BaseId, Id>;
|
|
155
|
-
/** Stable string key for Maps/Records keyed by a `BoardRef`. */
|
|
156
|
-
declare function boardRefKey(ref: BoardRef): string;
|
|
157
|
-
/**
|
|
158
|
-
* Inverse of `boardRefKey`. Parses `"base"` as a shared ref and
|
|
159
|
-
* `"base:player-N"` as a per-player ref. Returns `null` for malformed
|
|
160
|
-
* input.
|
|
161
|
-
*/
|
|
162
|
-
declare function parseBoardRefKey(key: string): BoardRef | null;
|
|
163
|
-
/**
|
|
164
|
-
* Zod schema for a `BoardRef` with free-form base and seat ids.
|
|
165
|
-
*
|
|
166
|
-
* Feed a manifest-scoped `baseIdSchema` and `playerIdSchema` to bind
|
|
167
|
-
* the ref to a specific workspace.
|
|
168
|
-
*/
|
|
169
|
-
declare function boardRefSchema<BaseId extends string = string, Id extends PlayerId = PlayerId>(options?: {
|
|
170
|
-
readonly baseIdSchema?: z.ZodType<BaseId>;
|
|
171
|
-
readonly playerIdSchema?: z.ZodType<Id>;
|
|
172
|
-
}): z.ZodType<BoardRef<BaseId, Id>>;
|
|
173
|
-
/** True when `ref` targets a shared board (no seat). */
|
|
174
|
-
declare function isSharedBoardRef<BaseId extends string>(ref: BoardRef<BaseId, PlayerId>): ref is SharedBoardRef<BaseId>;
|
|
175
|
-
/** True when `ref` targets a per-player board (has a seat). */
|
|
176
|
-
declare function isPerPlayerBoardRef<BaseId extends string, Id extends PlayerId>(ref: BoardRef<BaseId, Id>): ref is PerPlayerBoardRef<BaseId, Id>;
|
|
177
|
-
|
|
178
|
-
type RuntimeScalar = boolean | number | string | null;
|
|
179
|
-
interface RuntimeRecord {
|
|
180
|
-
[key: string]: RuntimePayload;
|
|
181
|
-
}
|
|
182
|
-
type RuntimePayload = RuntimeScalar | RuntimePayload[] | RuntimeRecord;
|
|
183
|
-
type RuntimeParams = RuntimeRecord;
|
|
184
|
-
type SchemaLike<Output> = z.ZodType<Output>;
|
|
185
|
-
type AnySchema = z.ZodTypeAny;
|
|
186
|
-
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
187
|
-
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
188
|
-
type Brand<Value, Name extends string> = Value & {
|
|
189
|
-
readonly __brand: Name;
|
|
190
|
-
};
|
|
191
|
-
type RuntimeHandVisibilityMode = "all" | "ownerOnly" | "public" | "hidden";
|
|
192
|
-
type RuntimeDeckMap = Record<string, string[]>;
|
|
193
|
-
type RuntimeHandMap = Record<string, PerPlayer<string[]>>;
|
|
194
|
-
type RuntimeZoneMap = {
|
|
195
|
-
shared: Record<string, string[]>;
|
|
196
|
-
perPlayer: Record<string, PerPlayer<string[]>>;
|
|
197
|
-
visibility: Record<string, RuntimeHandVisibilityMode>;
|
|
198
|
-
cardSetIdsByZoneId?: Record<string, readonly string[]>;
|
|
199
|
-
};
|
|
200
|
-
type RuntimeOwnerMap = Record<string, string | null>;
|
|
201
|
-
type RuntimeResourceMap = PerPlayer<RuntimeRecord>;
|
|
202
|
-
type RuntimeBoardSpaceState = {
|
|
203
|
-
id: string;
|
|
204
|
-
name?: string | null;
|
|
205
|
-
typeId?: string | null;
|
|
206
|
-
fields: RuntimeRecord;
|
|
207
|
-
zoneId?: string | null;
|
|
208
|
-
};
|
|
209
|
-
type RuntimeBoardRelationState = {
|
|
210
|
-
id?: string | null;
|
|
211
|
-
typeId: string;
|
|
212
|
-
fromSpaceId: string;
|
|
213
|
-
toSpaceId: string;
|
|
214
|
-
directed: boolean;
|
|
215
|
-
fields: RuntimeRecord;
|
|
216
|
-
};
|
|
217
|
-
type RuntimeBoardContainerState = {
|
|
218
|
-
id: string;
|
|
219
|
-
name: string;
|
|
220
|
-
host: {
|
|
221
|
-
type: "board";
|
|
222
|
-
} | {
|
|
223
|
-
type: "space";
|
|
224
|
-
spaceId: string;
|
|
225
|
-
};
|
|
226
|
-
allowedCardSetIds?: readonly string[];
|
|
227
|
-
zoneId: string;
|
|
228
|
-
fields: RuntimeRecord;
|
|
229
|
-
};
|
|
230
|
-
type RuntimeBoardCompatibilityState = {
|
|
231
|
-
spaces: Record<string, RuntimeBoardSpaceState>;
|
|
232
|
-
relations: RuntimeBoardRelationState[];
|
|
233
|
-
containers: Record<string, RuntimeBoardContainerState>;
|
|
234
|
-
};
|
|
235
|
-
type RuntimeBoardBaseState = {
|
|
236
|
-
id: string;
|
|
237
|
-
baseId?: string;
|
|
238
|
-
layout: "generic" | "hex" | "square";
|
|
239
|
-
typeId?: string | null;
|
|
240
|
-
scope: "shared" | "perPlayer";
|
|
241
|
-
playerId?: string | null;
|
|
242
|
-
templateId?: string | null;
|
|
243
|
-
fields: RuntimeRecord;
|
|
244
|
-
};
|
|
245
|
-
type RuntimeGenericBoardState = RuntimeBoardBaseState & {
|
|
246
|
-
layout: "generic";
|
|
247
|
-
} & RuntimeBoardCompatibilityState;
|
|
248
|
-
type RuntimeHexSpaceState = RuntimeBoardSpaceState & {
|
|
249
|
-
q: number;
|
|
250
|
-
r: number;
|
|
251
|
-
};
|
|
252
|
-
type RuntimeSquareSpaceState = RuntimeBoardSpaceState & {
|
|
253
|
-
row: number;
|
|
254
|
-
col: number;
|
|
255
|
-
};
|
|
256
|
-
type RuntimeTiledSpaceState = RuntimeHexSpaceState | RuntimeSquareSpaceState;
|
|
257
|
-
type RuntimeTiledEdgeState = {
|
|
258
|
-
id: string;
|
|
259
|
-
spaceIds: readonly string[];
|
|
260
|
-
typeId?: string | null;
|
|
261
|
-
label?: string | null;
|
|
262
|
-
ownerId?: string | null;
|
|
263
|
-
fields: RuntimeRecord;
|
|
264
|
-
};
|
|
265
|
-
type RuntimeTiledVertexState = {
|
|
266
|
-
id: string;
|
|
267
|
-
spaceIds: readonly string[];
|
|
268
|
-
typeId?: string | null;
|
|
269
|
-
label?: string | null;
|
|
270
|
-
ownerId?: string | null;
|
|
271
|
-
fields: RuntimeRecord;
|
|
272
|
-
};
|
|
273
|
-
type RuntimeHexEdgeState = RuntimeTiledEdgeState;
|
|
274
|
-
type RuntimeHexVertexState = RuntimeTiledVertexState;
|
|
275
|
-
type RuntimeSquareEdgeState = RuntimeTiledEdgeState;
|
|
276
|
-
type RuntimeSquareVertexState = RuntimeTiledVertexState;
|
|
277
|
-
type RuntimeHexOrientation = "pointy-top" | "flat-top";
|
|
278
|
-
type RuntimeTiledBoardBaseState = RuntimeBoardBaseState & {
|
|
279
|
-
layout: "hex" | "square";
|
|
280
|
-
relations: RuntimeBoardRelationState[];
|
|
281
|
-
containers: Record<string, RuntimeBoardContainerState>;
|
|
282
|
-
edges: RuntimeTiledEdgeState[];
|
|
283
|
-
vertices: RuntimeTiledVertexState[];
|
|
284
|
-
};
|
|
285
|
-
type RuntimeHexBoardState = RuntimeTiledBoardBaseState & {
|
|
286
|
-
layout: "hex";
|
|
287
|
-
spaces: Record<string, RuntimeHexSpaceState>;
|
|
288
|
-
orientation: RuntimeHexOrientation;
|
|
289
|
-
edges: RuntimeHexEdgeState[];
|
|
290
|
-
vertices: RuntimeHexVertexState[];
|
|
291
|
-
};
|
|
292
|
-
type RuntimeSquareBoardState = RuntimeTiledBoardBaseState & {
|
|
293
|
-
layout: "square";
|
|
294
|
-
spaces: Record<string, RuntimeSquareSpaceState>;
|
|
295
|
-
edges: RuntimeSquareEdgeState[];
|
|
296
|
-
vertices: RuntimeSquareVertexState[];
|
|
297
|
-
};
|
|
298
|
-
type RuntimeTiledBoardState = RuntimeHexBoardState | RuntimeSquareBoardState;
|
|
299
|
-
type RuntimeBoardState = RuntimeGenericBoardState | RuntimeTiledBoardState;
|
|
300
|
-
type RuntimeBoardCollections = {
|
|
301
|
-
byId: Record<string, RuntimeBoardState>;
|
|
302
|
-
hex: Record<string, RuntimeHexBoardState>;
|
|
303
|
-
square: Record<string, RuntimeSquareBoardState>;
|
|
304
|
-
/** Structured board buckets used by manifest table schemas (empty when unused). */
|
|
305
|
-
network: Record<string, RuntimeRecord>;
|
|
306
|
-
track: Record<string, RuntimeRecord>;
|
|
307
|
-
};
|
|
308
|
-
type RuntimeCardVisibility = {
|
|
309
|
-
faceUp: boolean;
|
|
310
|
-
visibleTo?: string[] | null;
|
|
311
|
-
};
|
|
312
|
-
type RuntimeCardData = {
|
|
313
|
-
componentType?: string;
|
|
314
|
-
id: string;
|
|
315
|
-
cardSetId: string;
|
|
316
|
-
cardType: string;
|
|
317
|
-
name?: string;
|
|
318
|
-
text?: string;
|
|
319
|
-
properties: RuntimeRecord;
|
|
320
|
-
};
|
|
321
|
-
type RuntimePieceData = {
|
|
322
|
-
componentType?: string;
|
|
323
|
-
id: string;
|
|
324
|
-
pieceTypeId: string;
|
|
325
|
-
pieceName?: string | null;
|
|
326
|
-
ownerId?: string | null;
|
|
327
|
-
properties: RuntimeRecord;
|
|
328
|
-
};
|
|
329
|
-
type RuntimeDieData = {
|
|
330
|
-
componentType?: string;
|
|
331
|
-
id: string;
|
|
332
|
-
dieTypeId: string;
|
|
333
|
-
dieName?: string | null;
|
|
334
|
-
ownerId?: string | null;
|
|
335
|
-
sides: number;
|
|
336
|
-
value?: number | null;
|
|
337
|
-
properties: RuntimeRecord;
|
|
338
|
-
};
|
|
339
|
-
type RuntimeSlotHostRef = {
|
|
340
|
-
kind: "piece";
|
|
341
|
-
id: string;
|
|
342
|
-
} | {
|
|
343
|
-
kind: "die";
|
|
344
|
-
id: string;
|
|
345
|
-
};
|
|
346
|
-
type RuntimeComponentLocation = {
|
|
347
|
-
type: "Detached";
|
|
348
|
-
} | {
|
|
349
|
-
type: "InDeck";
|
|
350
|
-
deckId: string;
|
|
351
|
-
playedBy: string | null;
|
|
352
|
-
position?: number | null;
|
|
353
|
-
} | {
|
|
354
|
-
type: "InHand";
|
|
355
|
-
handId: string;
|
|
356
|
-
playerId: string;
|
|
357
|
-
position?: number | null;
|
|
358
|
-
} | {
|
|
359
|
-
type: "InZone";
|
|
360
|
-
zoneId: string;
|
|
361
|
-
playedBy?: string | null;
|
|
362
|
-
position?: number | null;
|
|
363
|
-
} | {
|
|
364
|
-
type: "OnSpace";
|
|
365
|
-
boardId: string;
|
|
366
|
-
spaceId: string;
|
|
367
|
-
position?: number | null;
|
|
368
|
-
} | {
|
|
369
|
-
type: "InContainer";
|
|
370
|
-
boardId: string;
|
|
371
|
-
containerId: string;
|
|
372
|
-
position?: number | null;
|
|
373
|
-
} | {
|
|
374
|
-
type: "OnEdge";
|
|
375
|
-
boardId: string;
|
|
376
|
-
edgeId: string;
|
|
377
|
-
position?: number | null;
|
|
378
|
-
} | {
|
|
379
|
-
type: "OnVertex";
|
|
380
|
-
boardId: string;
|
|
381
|
-
vertexId: string;
|
|
382
|
-
position?: number | null;
|
|
383
|
-
} | {
|
|
384
|
-
type: "InSlot";
|
|
385
|
-
host: RuntimeSlotHostRef;
|
|
386
|
-
slotId: string;
|
|
387
|
-
position?: number | null;
|
|
388
|
-
};
|
|
389
|
-
type RuntimeComponentLocationMap = Record<string, RuntimeComponentLocation>;
|
|
390
|
-
type RuntimeVisibilityMap = Record<string, RuntimeCardVisibility>;
|
|
391
|
-
type RuntimeTableRecord = {
|
|
392
|
-
playerOrder: string[];
|
|
393
|
-
zones: RuntimeZoneMap;
|
|
394
|
-
decks: RuntimeDeckMap;
|
|
395
|
-
hands: RuntimeHandMap;
|
|
396
|
-
handVisibility: Record<string, RuntimeHandVisibilityMode>;
|
|
397
|
-
cards: Record<string, RuntimeCardData>;
|
|
398
|
-
pieces: Record<string, RuntimePieceData>;
|
|
399
|
-
componentLocations: RuntimeComponentLocationMap;
|
|
400
|
-
ownerOfCard: RuntimeOwnerMap;
|
|
401
|
-
visibility: RuntimeVisibilityMap;
|
|
402
|
-
resources: RuntimeResourceMap;
|
|
403
|
-
boards: RuntimeBoardCollections;
|
|
404
|
-
dice: Record<string, RuntimeDieData>;
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
declare const FrameworkErrorCodes: {
|
|
408
|
-
readonly NOT_YOUR_TURN: "NOT_YOUR_TURN";
|
|
409
|
-
readonly WRONG_PHASE: "WRONG_PHASE";
|
|
410
|
-
readonly WRONG_STEP: "WRONG_STEP";
|
|
411
|
-
readonly INVALID_PARAMS: "INVALID_PARAMS";
|
|
412
|
-
readonly UNKNOWN_INTERACTION: "UNKNOWN_INTERACTION";
|
|
413
|
-
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
414
|
-
};
|
|
415
|
-
type FrameworkErrorCode = (typeof FrameworkErrorCodes)[keyof typeof FrameworkErrorCodes];
|
|
416
|
-
|
|
417
|
-
type TableOfState<State> = State extends {
|
|
418
|
-
table: infer Table;
|
|
419
|
-
} ? Table : never;
|
|
420
|
-
type TableOfManifest<Manifest> = Manifest extends {
|
|
421
|
-
tableSchema: z.ZodType<infer Table extends RuntimeTableRecord>;
|
|
422
|
-
} ? Table : Manifest extends GeneratedManifestContractLike<infer Table> ? Table : never;
|
|
423
|
-
type PhaseNameOfState<State> = State extends {
|
|
424
|
-
flow: {
|
|
425
|
-
currentPhase: infer PhaseName;
|
|
426
|
-
};
|
|
427
|
-
} ? Extract<PhaseName, string> : never;
|
|
428
|
-
type PhaseNameOfManifest<Manifest> = Manifest extends {
|
|
429
|
-
literals: {
|
|
430
|
-
phaseNames: readonly (infer PhaseName)[];
|
|
431
|
-
};
|
|
432
|
-
} ? Extract<PhaseName, string> : never;
|
|
433
|
-
type PlayerIdOfTable<Table> = Table extends {
|
|
434
|
-
playerOrder: readonly (infer PlayerId)[];
|
|
435
|
-
} ? Extract<PlayerId, string> : never;
|
|
436
|
-
type PlayerIdOfManifest<Manifest> = Manifest extends {
|
|
437
|
-
literals: {
|
|
438
|
-
playerIds: readonly (infer PlayerId)[];
|
|
439
|
-
};
|
|
440
|
-
} ? Extract<PlayerId, string> : string;
|
|
441
|
-
type PlayerIdOfState<State> = PlayerIdOfTable<TableOfState<State>>;
|
|
442
|
-
type ErrorCodeOfContract<Contract> = Contract extends {
|
|
443
|
-
errors: infer Errors extends Record<string, string>;
|
|
444
|
-
} ? (keyof Errors & string) | FrameworkErrorCode : string;
|
|
445
|
-
/**
|
|
446
|
-
* Manifest-declared resource id union for a runtime table.
|
|
447
|
-
*
|
|
448
|
-
* Derived from the shape of `table.resources`, which the generated
|
|
449
|
-
* manifest contract seeds as `PerPlayer<Record<ResourceId, number>>`.
|
|
450
|
-
* The helper peeks inside the `PerPlayer` wrapper to surface the
|
|
451
|
-
* resource-id keys without forcing callers to remember the wrapper.
|
|
452
|
-
*/
|
|
453
|
-
type ResourceIdOfTable<Table> = Table extends {
|
|
454
|
-
resources: infer Resources;
|
|
455
|
-
} ? ValueOfPerPlayer<Resources> extends infer PerPlayerValue ? PerPlayerValue extends Record<string, unknown> ? StringKeyOf<PerPlayerValue> : never : never : never;
|
|
456
|
-
type ResourceIdOfState<State> = ResourceIdOfTable<TableOfState<State>>;
|
|
457
|
-
/**
|
|
458
|
-
* Per-player balance shape for a runtime table. Strips the `PerPlayer`
|
|
459
|
-
* wrapper around `table.resources` so callers receive the manifest-typed
|
|
460
|
-
* record directly (e.g. `Record<ResourceId, number>`).
|
|
461
|
-
*/
|
|
462
|
-
type ResourceBalancesOfTable<Table> = Table extends {
|
|
463
|
-
resources: infer Resources;
|
|
464
|
-
} ? ValueOfPerPlayer<Resources> extends infer PerPlayerValue ? PerPlayerValue extends Record<string, unknown> ? PerPlayerValue : never : never : never;
|
|
465
|
-
type ResourceBalancesOfState<State> = ResourceBalancesOfTable<TableOfState<State>>;
|
|
466
|
-
type ResourceIdOfManifest<Manifest> = Manifest extends {
|
|
467
|
-
literals: {
|
|
468
|
-
resourceIds: readonly (infer ResourceId)[];
|
|
469
|
-
};
|
|
470
|
-
} ? Extract<ResourceId, string> : string;
|
|
471
|
-
/**
|
|
472
|
-
* Per-player resource counts: a partial `Record<ResourceId, number>`.
|
|
473
|
-
*
|
|
474
|
-
* Used as the input shape for {@link ReducerOps.addResources},
|
|
475
|
-
* {@link ReducerOps.spendResources}, and {@link ReducerOps.transferResources}.
|
|
476
|
-
*/
|
|
477
|
-
type ResourceAmountsOfTable<Table> = Partial<Record<ResourceIdOfTable<Table>, number>>;
|
|
478
|
-
type PhaseStateOfState<State> = State extends {
|
|
479
|
-
phase: infer PhaseState;
|
|
480
|
-
} ? PhaseState : never;
|
|
481
|
-
type PhaseStepOfState<State> = PhaseStateOfState<State> extends {
|
|
482
|
-
step?: infer Step;
|
|
483
|
-
} ? Extract<NonNullable<Step>, string> : never;
|
|
484
|
-
type PhaseMapOfState<State> = PhaseStateOfState<State>;
|
|
485
|
-
type PublicStateOfState<State> = State extends {
|
|
486
|
-
publicState: infer PublicState;
|
|
487
|
-
} ? PublicState : never;
|
|
488
|
-
type HiddenStateOfState<State> = State extends {
|
|
489
|
-
hiddenState: infer HiddenState;
|
|
490
|
-
} ? HiddenState : never;
|
|
491
|
-
type PrivateStateOfState<State> = State extends {
|
|
492
|
-
privateState: Record<string, infer PrivateState>;
|
|
493
|
-
} ? PrivateState : never;
|
|
494
|
-
type DeckIdOfTable<Table> = Table extends {
|
|
495
|
-
decks: infer Decks;
|
|
496
|
-
} ? StringKeyOf<Decks> : never;
|
|
497
|
-
type HandIdOfTable<Table> = Table extends {
|
|
498
|
-
hands: infer Hands;
|
|
499
|
-
} ? StringKeyOf<Hands> : never;
|
|
500
|
-
type CardIdOfTable<Table> = Table extends {
|
|
501
|
-
cards: infer Cards;
|
|
502
|
-
} ? StringKeyOf<Cards> : never;
|
|
503
|
-
type CardTypeOfTable<Table> = Table extends {
|
|
504
|
-
cards: Record<string, {
|
|
505
|
-
cardType: infer CardType;
|
|
506
|
-
}>;
|
|
507
|
-
} ? Extract<CardType, string> : string;
|
|
508
|
-
type DeckIdOfState<State> = DeckIdOfTable<TableOfState<State>>;
|
|
509
|
-
type HandIdOfState<State> = HandIdOfTable<TableOfState<State>>;
|
|
510
|
-
type CardIdOfState<State> = CardIdOfTable<TableOfState<State>>;
|
|
511
|
-
type CardTypeOfState<State> = CardTypeOfTable<TableOfState<State>>;
|
|
512
|
-
type CardIdOfManifest<Manifest> = Manifest extends {
|
|
513
|
-
literals: {
|
|
514
|
-
cardIds: readonly (infer CardId)[];
|
|
515
|
-
};
|
|
516
|
-
} ? Extract<CardId, string> : string;
|
|
517
|
-
type SharedZoneIdOfTable<Table> = DeckIdOfTable<Table>;
|
|
518
|
-
type PlayerZoneIdOfTable<Table> = HandIdOfTable<Table>;
|
|
519
|
-
type BoardMapOfTable<Table> = Table extends {
|
|
520
|
-
boards: {
|
|
521
|
-
byId: infer Boards;
|
|
522
|
-
};
|
|
523
|
-
} ? Boards : never;
|
|
524
|
-
type BoardIdOfTable<Table> = StringKeyOf<BoardMapOfTable<Table>>;
|
|
525
|
-
type BoardStateOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardMapOfTable<Table>[BoardId];
|
|
526
|
-
type BoardTypeIdOfTable<Table> = BoardStateOfTable<Table, BoardIdOfTable<Table>> extends {
|
|
527
|
-
typeId?: infer BoardTypeId | null;
|
|
528
|
-
} ? Extract<BoardTypeId, string> : never;
|
|
529
|
-
type TiledBoardIdOfTable<Table> = {
|
|
530
|
-
[BoardId in BoardIdOfTable<Table>]: BoardStateOfTable<Table, BoardId> extends {
|
|
531
|
-
layout: "hex" | "square";
|
|
532
|
-
} ? BoardId : never;
|
|
533
|
-
}[BoardIdOfTable<Table>];
|
|
534
|
-
type TiledBoardStateOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends infer BoardState ? BoardState extends {
|
|
535
|
-
layout: "hex" | "square";
|
|
536
|
-
spaces: Record<string, unknown>;
|
|
537
|
-
edges: readonly {
|
|
538
|
-
id: string;
|
|
539
|
-
}[];
|
|
540
|
-
vertices: readonly {
|
|
541
|
-
id: string;
|
|
542
|
-
}[];
|
|
543
|
-
} ? BoardState : never : never;
|
|
544
|
-
type HexBoardIdOfTable<Table> = {
|
|
545
|
-
[BoardId in BoardIdOfTable<Table>]: BoardStateOfTable<Table, BoardId> extends {
|
|
546
|
-
layout: "hex";
|
|
547
|
-
} ? BoardId : never;
|
|
548
|
-
}[BoardIdOfTable<Table>];
|
|
549
|
-
type HexBoardStateOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends infer BoardState ? BoardState extends {
|
|
550
|
-
layout: "hex";
|
|
551
|
-
spaces: Record<string, unknown>;
|
|
552
|
-
edges: readonly {
|
|
553
|
-
id: string;
|
|
554
|
-
}[];
|
|
555
|
-
vertices: readonly {
|
|
556
|
-
id: string;
|
|
557
|
-
}[];
|
|
558
|
-
} ? BoardState : never : never;
|
|
559
|
-
type SquareBoardIdOfTable<Table> = {
|
|
560
|
-
[BoardId in BoardIdOfTable<Table>]: BoardStateOfTable<Table, BoardId> extends {
|
|
561
|
-
layout: "square";
|
|
562
|
-
} ? BoardId : never;
|
|
563
|
-
}[BoardIdOfTable<Table>];
|
|
564
|
-
type SquareBoardStateOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends infer BoardState ? BoardState extends {
|
|
565
|
-
layout: "square";
|
|
566
|
-
spaces: Record<string, unknown>;
|
|
567
|
-
edges: readonly {
|
|
568
|
-
id: string;
|
|
569
|
-
}[];
|
|
570
|
-
vertices: readonly {
|
|
571
|
-
id: string;
|
|
572
|
-
}[];
|
|
573
|
-
} ? BoardState : never : never;
|
|
574
|
-
type SpaceIdOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends {
|
|
575
|
-
spaces: infer Spaces;
|
|
576
|
-
} ? StringKeyOf<Spaces> : never;
|
|
577
|
-
type SpaceTypeIdOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends {
|
|
578
|
-
spaces: infer Spaces extends Record<string, unknown>;
|
|
579
|
-
} ? Spaces[StringKeyOf<Spaces>] extends {
|
|
580
|
-
typeId?: infer SpaceTypeId | null;
|
|
581
|
-
} ? Extract<SpaceTypeId, string> : never : never;
|
|
582
|
-
type BoardContainerIdOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends {
|
|
583
|
-
containers: infer Containers;
|
|
584
|
-
} ? StringKeyOf<Containers> : never;
|
|
585
|
-
type RelationTypeIdOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends {
|
|
586
|
-
relations: readonly (infer Relation)[];
|
|
587
|
-
} ? Relation extends {
|
|
588
|
-
typeId: infer RelationTypeId;
|
|
589
|
-
} ? Extract<RelationTypeId, string> : never : never;
|
|
590
|
-
type TiledSpaceIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
591
|
-
spaces: infer Spaces;
|
|
592
|
-
} ? StringKeyOf<Spaces> : never;
|
|
593
|
-
type HexSpaceIdOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
594
|
-
spaces: infer Spaces;
|
|
595
|
-
} ? StringKeyOf<Spaces> : never;
|
|
596
|
-
type SquareSpaceIdOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
597
|
-
spaces: infer Spaces;
|
|
598
|
-
} ? StringKeyOf<Spaces> : never;
|
|
599
|
-
type HexSpaceTypeIdOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
600
|
-
spaces: infer Spaces extends Record<string, unknown>;
|
|
601
|
-
} ? Spaces[StringKeyOf<Spaces>] extends {
|
|
602
|
-
typeId?: infer SpaceTypeId | null;
|
|
603
|
-
} ? Extract<SpaceTypeId, string> : never : never;
|
|
604
|
-
type SquareSpaceTypeIdOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
605
|
-
spaces: infer Spaces extends Record<string, unknown>;
|
|
606
|
-
} ? Spaces[StringKeyOf<Spaces>] extends {
|
|
607
|
-
typeId?: infer SpaceTypeId | null;
|
|
608
|
-
} ? Extract<SpaceTypeId, string> : never : never;
|
|
609
|
-
type TiledEdgeIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
610
|
-
edges: readonly (infer Edge)[];
|
|
611
|
-
} ? Edge extends {
|
|
612
|
-
id: infer EdgeId;
|
|
613
|
-
} ? Extract<EdgeId, string> : never : never;
|
|
614
|
-
type HexEdgeIdOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
615
|
-
edges: readonly (infer Edge)[];
|
|
616
|
-
} ? Edge extends {
|
|
617
|
-
id: infer EdgeId;
|
|
618
|
-
} ? Extract<EdgeId, string> : never : never;
|
|
619
|
-
type SquareEdgeIdOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
620
|
-
edges: readonly (infer Edge)[];
|
|
621
|
-
} ? Edge extends {
|
|
622
|
-
id: infer EdgeId;
|
|
623
|
-
} ? Extract<EdgeId, string> : never : never;
|
|
624
|
-
/**
|
|
625
|
-
* Edge record on a tiled board narrowed to a specific `EdgeId` literal.
|
|
626
|
-
*
|
|
627
|
-
* The generated board state stores edges as a single array element type
|
|
628
|
-
* `{ id: <union-of-edge-ids>, spaceIds, typeId, fields, ... }`. Looking up an
|
|
629
|
-
* edge by id should return a record whose `id` is narrowed to the literal
|
|
630
|
-
* that was requested, not the entire edge-id union.
|
|
631
|
-
*/
|
|
632
|
-
type TiledEdgeStateOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>, EdgeId extends TiledEdgeIdOfTable<Table, BoardId>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
633
|
-
edges: readonly (infer Edge)[];
|
|
634
|
-
} ? Edge extends {
|
|
635
|
-
id: string;
|
|
636
|
-
} ? Omit<Edge, "id"> & {
|
|
637
|
-
id: EdgeId;
|
|
638
|
-
} : never : never;
|
|
639
|
-
type HexEdgeStateOfTable<Table, BoardId extends HexBoardIdOfTable<Table>, EdgeId extends HexEdgeIdOfTable<Table, BoardId>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
640
|
-
edges: readonly (infer Edge)[];
|
|
641
|
-
} ? Edge extends {
|
|
642
|
-
id: string;
|
|
643
|
-
} ? Omit<Edge, "id"> & {
|
|
644
|
-
id: EdgeId;
|
|
645
|
-
} : never : never;
|
|
646
|
-
type SquareEdgeStateOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>, EdgeId extends SquareEdgeIdOfTable<Table, BoardId>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
647
|
-
edges: readonly (infer Edge)[];
|
|
648
|
-
} ? Edge extends {
|
|
649
|
-
id: string;
|
|
650
|
-
} ? Omit<Edge, "id"> & {
|
|
651
|
-
id: EdgeId;
|
|
652
|
-
} : never : never;
|
|
653
|
-
type TiledEdgeTypeIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
654
|
-
edges: readonly (infer Edge)[];
|
|
655
|
-
} ? Edge extends {
|
|
656
|
-
typeId?: infer EdgeTypeId | null;
|
|
657
|
-
} ? Extract<EdgeTypeId, string> : never : never;
|
|
658
|
-
type HexEdgeTypeIdOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
659
|
-
edges: readonly (infer Edge)[];
|
|
660
|
-
} ? Edge extends {
|
|
661
|
-
typeId?: infer EdgeTypeId | null;
|
|
662
|
-
} ? Extract<EdgeTypeId, string> : never : never;
|
|
663
|
-
type SquareEdgeTypeIdOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
664
|
-
edges: readonly (infer Edge)[];
|
|
665
|
-
} ? Edge extends {
|
|
666
|
-
typeId?: infer EdgeTypeId | null;
|
|
667
|
-
} ? Extract<EdgeTypeId, string> : never : never;
|
|
668
|
-
type TiledVertexIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
669
|
-
vertices: readonly (infer Vertex)[];
|
|
670
|
-
} ? Vertex extends {
|
|
671
|
-
id: infer VertexId;
|
|
672
|
-
} ? Extract<VertexId, string> : never : never;
|
|
673
|
-
type HexVertexIdOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
674
|
-
vertices: readonly (infer Vertex)[];
|
|
675
|
-
} ? Vertex extends {
|
|
676
|
-
id: infer VertexId;
|
|
677
|
-
} ? Extract<VertexId, string> : never : never;
|
|
678
|
-
type SquareVertexIdOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
679
|
-
vertices: readonly (infer Vertex)[];
|
|
680
|
-
} ? Vertex extends {
|
|
681
|
-
id: infer VertexId;
|
|
682
|
-
} ? Extract<VertexId, string> : never : never;
|
|
683
|
-
/**
|
|
684
|
-
* Vertex record on a tiled board narrowed to a specific `VertexId` literal.
|
|
685
|
-
* See {@link TiledEdgeStateOfTable} for rationale.
|
|
686
|
-
*/
|
|
687
|
-
type TiledVertexStateOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>, VertexId extends TiledVertexIdOfTable<Table, BoardId>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
688
|
-
vertices: readonly (infer Vertex)[];
|
|
689
|
-
} ? Vertex extends {
|
|
690
|
-
id: string;
|
|
691
|
-
} ? Omit<Vertex, "id"> & {
|
|
692
|
-
id: VertexId;
|
|
693
|
-
} : never : never;
|
|
694
|
-
type HexVertexStateOfTable<Table, BoardId extends HexBoardIdOfTable<Table>, VertexId extends HexVertexIdOfTable<Table, BoardId>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
695
|
-
vertices: readonly (infer Vertex)[];
|
|
696
|
-
} ? Vertex extends {
|
|
697
|
-
id: string;
|
|
698
|
-
} ? Omit<Vertex, "id"> & {
|
|
699
|
-
id: VertexId;
|
|
700
|
-
} : never : never;
|
|
701
|
-
type SquareVertexStateOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>, VertexId extends SquareVertexIdOfTable<Table, BoardId>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
702
|
-
vertices: readonly (infer Vertex)[];
|
|
703
|
-
} ? Vertex extends {
|
|
704
|
-
id: string;
|
|
705
|
-
} ? Omit<Vertex, "id"> & {
|
|
706
|
-
id: VertexId;
|
|
707
|
-
} : never : never;
|
|
708
|
-
type TiledVertexTypeIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
|
|
709
|
-
vertices: readonly (infer Vertex)[];
|
|
710
|
-
} ? Vertex extends {
|
|
711
|
-
typeId?: infer VertexTypeId | null;
|
|
712
|
-
} ? Extract<VertexTypeId, string> : never : never;
|
|
713
|
-
type HexVertexTypeIdOfTable<Table, BoardId extends HexBoardIdOfTable<Table>> = HexBoardStateOfTable<Table, BoardId> extends {
|
|
714
|
-
vertices: readonly (infer Vertex)[];
|
|
715
|
-
} ? Vertex extends {
|
|
716
|
-
typeId?: infer VertexTypeId | null;
|
|
717
|
-
} ? Extract<VertexTypeId, string> : never : never;
|
|
718
|
-
type SquareVertexTypeIdOfTable<Table, BoardId extends SquareBoardIdOfTable<Table>> = SquareBoardStateOfTable<Table, BoardId> extends {
|
|
719
|
-
vertices: readonly (infer Vertex)[];
|
|
720
|
-
} ? Vertex extends {
|
|
721
|
-
typeId?: infer VertexTypeId | null;
|
|
722
|
-
} ? Extract<VertexTypeId, string> : never : never;
|
|
723
|
-
type TiledSpaceMap<Table, BoardId extends TiledBoardIdOfTable<Table>, Value> = Partial<Record<TiledSpaceIdOfTable<Table, BoardId>, Value>>;
|
|
724
|
-
type TiledEdgeMap<Table, BoardId extends TiledBoardIdOfTable<Table>, Value> = Partial<Record<TiledEdgeIdOfTable<Table, BoardId>, Value>>;
|
|
725
|
-
type TiledVertexMap<Table, BoardId extends TiledBoardIdOfTable<Table>, Value> = Partial<Record<TiledVertexIdOfTable<Table, BoardId>, Value>>;
|
|
726
|
-
type ComponentIdOfTable<Table> = Table extends {
|
|
727
|
-
componentLocations: infer ComponentLocations;
|
|
728
|
-
} ? StringKeyOf<ComponentLocations> : never;
|
|
729
|
-
type SharedZoneIdOfManifest<Manifest> = Manifest extends {
|
|
730
|
-
literals: {
|
|
731
|
-
sharedZoneIds: readonly (infer ZoneId)[];
|
|
732
|
-
};
|
|
733
|
-
} ? Extract<ZoneId, string> : string;
|
|
734
|
-
type PlayerZoneIdOfManifest<Manifest> = Manifest extends {
|
|
735
|
-
literals: {
|
|
736
|
-
playerZoneIds: readonly (infer ZoneId)[];
|
|
737
|
-
};
|
|
738
|
-
} ? Extract<ZoneId, string> : string;
|
|
739
|
-
type SharedZoneIdOfState<State> = DeckIdOfState<State>;
|
|
740
|
-
type PlayerZoneIdOfState<State> = HandIdOfState<State>;
|
|
741
|
-
type BoardIdOfManifest<Manifest> = Manifest extends {
|
|
742
|
-
literals: {
|
|
743
|
-
boardIds: readonly (infer BoardId)[];
|
|
744
|
-
};
|
|
745
|
-
} ? Extract<BoardId, string> : string;
|
|
746
|
-
type BoardLayoutOfManifest<Manifest> = Manifest extends {
|
|
747
|
-
literals: {
|
|
748
|
-
boardLayouts: readonly (infer BoardLayout)[];
|
|
749
|
-
};
|
|
750
|
-
} ? Extract<BoardLayout, string> : "generic" | "hex" | "square";
|
|
751
|
-
type BoardTypeIdOfManifest<Manifest> = Manifest extends {
|
|
752
|
-
literals: {
|
|
753
|
-
boardTypeIds: readonly (infer BoardTypeId)[];
|
|
754
|
-
};
|
|
755
|
-
} ? Extract<BoardTypeId, string> : string;
|
|
756
|
-
type BoardBaseIdOfManifest<Manifest> = Manifest extends {
|
|
757
|
-
literals: {
|
|
758
|
-
boardBaseIds: readonly (infer BoardBaseId)[];
|
|
759
|
-
};
|
|
760
|
-
} ? Extract<BoardBaseId, string> : string;
|
|
761
|
-
type RelationTypeIdOfManifest<Manifest> = Manifest extends {
|
|
762
|
-
literals: {
|
|
763
|
-
relationTypeIds: readonly (infer RelationTypeId)[];
|
|
764
|
-
};
|
|
765
|
-
} ? Extract<RelationTypeId, string> : string;
|
|
766
|
-
type BoardContainerIdOfManifest<Manifest> = Manifest extends {
|
|
767
|
-
literals: {
|
|
768
|
-
boardContainerIds: readonly (infer ContainerId)[];
|
|
769
|
-
};
|
|
770
|
-
} ? Extract<ContainerId, string> : string;
|
|
771
|
-
type EdgeTypeIdOfManifest<Manifest> = Manifest extends {
|
|
772
|
-
literals: {
|
|
773
|
-
edgeTypeIds: readonly (infer EdgeTypeId)[];
|
|
774
|
-
};
|
|
775
|
-
} ? Extract<EdgeTypeId, string> : string;
|
|
776
|
-
type VertexTypeIdOfManifest<Manifest> = Manifest extends {
|
|
777
|
-
literals: {
|
|
778
|
-
vertexTypeIds: readonly (infer VertexTypeId)[];
|
|
779
|
-
};
|
|
780
|
-
} ? Extract<VertexTypeId, string> : string;
|
|
781
|
-
type SpaceIdOfManifest<Manifest> = Manifest extends {
|
|
782
|
-
literals: {
|
|
783
|
-
spaceIds: readonly (infer SpaceId)[];
|
|
784
|
-
};
|
|
785
|
-
} ? Extract<SpaceId, string> : string;
|
|
786
|
-
type SpaceTypeIdOfManifest<Manifest> = Manifest extends {
|
|
787
|
-
literals: {
|
|
788
|
-
spaceTypeIds: readonly (infer SpaceTypeId)[];
|
|
789
|
-
};
|
|
790
|
-
} ? Extract<SpaceTypeId, string> : string;
|
|
791
|
-
type PieceIdOfManifest<Manifest> = Manifest extends {
|
|
792
|
-
literals: {
|
|
793
|
-
pieceIds: readonly (infer PieceId)[];
|
|
794
|
-
};
|
|
795
|
-
} ? Extract<PieceId, string> : string;
|
|
796
|
-
type DieIdOfManifest<Manifest> = Manifest extends {
|
|
797
|
-
literals: {
|
|
798
|
-
dieIds: readonly (infer DieId)[];
|
|
799
|
-
};
|
|
800
|
-
} ? Extract<DieId, string> : string;
|
|
801
|
-
type ManifestOf<Source> = Source extends {
|
|
802
|
-
contract: infer Contract;
|
|
803
|
-
} ? ManifestOf<Contract> : Source extends {
|
|
804
|
-
manifest: infer Manifest;
|
|
805
|
-
} ? Manifest : never;
|
|
806
|
-
type SetupOptionIdOfManifest<Manifest> = Manifest extends {
|
|
807
|
-
literals: {
|
|
808
|
-
setupOptionIds: readonly (infer SetupOptionId)[];
|
|
809
|
-
};
|
|
810
|
-
} ? Extract<SetupOptionId, string> : string;
|
|
811
|
-
type SetupProfileIdOfManifest<Manifest> = Manifest extends {
|
|
812
|
-
literals: {
|
|
813
|
-
setupProfileIds: readonly (infer SetupProfileId)[];
|
|
814
|
-
};
|
|
815
|
-
} ? Extract<SetupProfileId, string> : string;
|
|
816
|
-
type SetupSelectionInputOfManifest<Manifest> = {
|
|
817
|
-
profileId: SetupProfileIdOfManifest<Manifest>;
|
|
818
|
-
optionValues?: Partial<Record<SetupOptionIdOfManifest<Manifest>, string>>;
|
|
819
|
-
};
|
|
820
|
-
type SetupSelectionOfManifest<Manifest> = {
|
|
821
|
-
profileId: SetupProfileIdOfManifest<Manifest>;
|
|
822
|
-
optionValues: Record<SetupOptionIdOfManifest<Manifest>, string | null>;
|
|
823
|
-
};
|
|
824
|
-
type RuntimeSetupSelectionInput<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
|
|
825
|
-
type RuntimeSetupSelection<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupSelectionOfManifest<Manifest>;
|
|
826
|
-
type RuntimeSetupSelectionOverride<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
|
|
827
|
-
type StateDefinitionOfContract<Contract> = Contract extends {
|
|
828
|
-
state: infer StateDefinitionValue;
|
|
829
|
-
} ? StateDefinitionValue : never;
|
|
830
|
-
type PhaseSchemasOfContract<Contract> = Contract extends {
|
|
831
|
-
phases: infer Phases extends Record<string, SchemaLike<object>>;
|
|
832
|
-
} ? Phases : Record<PhaseNameOfManifest<ManifestOf<Contract>>, SchemaLike<object>>;
|
|
833
|
-
type PhaseStateMapOfContract<Contract> = {
|
|
834
|
-
[Name in keyof PhaseSchemasOfContract<Contract> & string]: z.infer<PhaseSchemasOfContract<Contract>[Name]>;
|
|
835
|
-
};
|
|
836
|
-
type PublicSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<infer PublicSchema, SchemaLike<object>, SchemaLike<object>> ? PublicSchema : never;
|
|
837
|
-
type PrivateSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<SchemaLike<object>, infer PrivateSchema, SchemaLike<object>> ? PrivateSchema : never;
|
|
838
|
-
type HiddenSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<SchemaLike<object>, SchemaLike<object>, infer HiddenSchema> ? HiddenSchema : never;
|
|
839
|
-
type PhaseNameOfContract<Contract> = keyof PhaseSchemasOfContract<Contract> extends string ? keyof PhaseSchemasOfContract<Contract> & string : PhaseNameOfManifest<ManifestOf<Contract>>;
|
|
840
|
-
type ManifestContractOf<Contract> = ManifestContract<TableOfManifest<ManifestOf<Contract>>>;
|
|
841
|
-
type ExactManifestContractOf<Contract> = ManifestOf<Contract> & GeneratedManifestContractLike<TableOfManifest<ManifestOf<Contract>>>;
|
|
842
|
-
type PhaseNameOf<Source> = Source extends {
|
|
843
|
-
flow: {
|
|
844
|
-
currentPhase: infer PhaseName;
|
|
845
|
-
};
|
|
846
|
-
} ? Extract<PhaseName, string> : PhaseNameOfContract<Source>;
|
|
847
|
-
type DeckCardsOfTable<Table, DeckId extends DeckIdOfTable<Table>> = Table extends {
|
|
848
|
-
decks: infer Decks extends Record<string, readonly unknown[]>;
|
|
849
|
-
} ? Decks[DeckId] : never;
|
|
850
|
-
type ValueOfPerPlayer<T> = T extends {
|
|
851
|
-
readonly entries: ReadonlyArray<readonly [unknown, infer Value]>;
|
|
852
|
-
} ? Value : never;
|
|
853
|
-
type HandCardsOfTable<Table, HandId extends HandIdOfTable<Table>> = Table extends {
|
|
854
|
-
hands: infer Hands extends Record<string, unknown>;
|
|
855
|
-
} ? HandId extends keyof Hands ? ValueOfPerPlayer<Hands[HandId]> extends infer Value ? Value extends readonly unknown[] ? Value : never : never : never : never;
|
|
856
|
-
type CardIdOfDeck<Table, DeckId extends DeckIdOfTable<Table>> = DeckCardsOfTable<Table, DeckId>[number];
|
|
857
|
-
type CardIdOfHand<Table, HandId extends HandIdOfTable<Table>> = HandCardsOfTable<Table, HandId>[number];
|
|
858
|
-
type CompatibleHandIdForDeck<Table, DeckId extends DeckIdOfTable<Table>> = {
|
|
859
|
-
[CandidateHandId in HandIdOfTable<Table>]: Extract<CardIdOfDeck<Table, DeckId>, CardIdOfHand<Table, CandidateHandId>> extends never ? never : CandidateHandId;
|
|
860
|
-
}[HandIdOfTable<Table>];
|
|
861
|
-
type CompatibleCardIdForHandAndDeck<Table, HandId extends HandIdOfTable<Table>, DeckId extends DeckIdOfTable<Table>> = Extract<CardIdOfHand<Table, HandId>, CardIdOfDeck<Table, DeckId>>;
|
|
862
|
-
type CompatibleCardIdForTwoPlayerZones<Table, FromZoneId extends HandIdOfTable<Table>, ToZoneId extends HandIdOfTable<Table>> = Extract<CardIdOfHand<Table, FromZoneId>, CardIdOfHand<Table, ToZoneId>>;
|
|
863
|
-
|
|
864
|
-
type BoardRecord<Table extends RuntimeTableRecord, BoardId extends BoardIdOfTable<Table>> = Table["boards"]["byId"][BoardId];
|
|
865
|
-
type TiledBoardRecord<Table extends RuntimeTableRecord, BoardId extends TiledBoardIdOfTable<Table>> = Extract<BoardRecord<Table, BoardId>, {
|
|
866
|
-
layout: "hex" | "square";
|
|
867
|
-
}>;
|
|
868
|
-
type ViewCardOfTable<Table extends RuntimeTableRecord, CardId extends CardIdOfTable<Table>> = CardId extends CardIdOfTable<Table> ? ViewCard<CardId & string, Table["cards"][CardId]["cardType"] & string, Extract<Table["cards"][CardId]["properties"], Record<string, unknown>>> : never;
|
|
869
|
-
type CardsByIdOfTable<Table extends RuntimeTableRecord, CardIds extends readonly CardIdOfTable<Table>[]> = Readonly<{
|
|
870
|
-
[Id in CardIds[number]]: ViewCardOfTable<Table, Id> | undefined;
|
|
871
|
-
}>;
|
|
872
|
-
type DeckCardsForZone<Table extends RuntimeTableRecord, ZoneId extends DeckIdOfTable<Table>> = ZoneId extends infer Each extends DeckIdOfTable<Table> ? DeckCardsOfTable<Table, Each> : never;
|
|
873
|
-
type HandCardsForZone<Table extends RuntimeTableRecord, ZoneId extends HandIdOfTable<Table>> = ZoneId extends infer Each extends HandIdOfTable<Table> ? HandCardsOfTable<Table, Each> : never;
|
|
874
|
-
type CardCollectionOfTable<Table extends RuntimeTableRecord> = CardCollection<CardIdOfTable<Table> & string, ViewCardOfTable<Table, CardIdOfTable<Table>>>;
|
|
875
|
-
type SlotOccupantOfTable<Table extends RuntimeTableRecord> = ViewSlotOccupant<ComponentIdOfTable<Table> & string, PlayerIdOfTable<Table> & string, string, Record<string, unknown>>;
|
|
876
|
-
type SlotOccupantsOfTable<Table extends RuntimeTableRecord> = ReadonlyArray<SlotOccupantOfTable<Table>>;
|
|
877
|
-
type SlotOccupantsBySlotIdOfTable<Table extends RuntimeTableRecord> = Readonly<Record<string, SlotOccupantsOfTable<Table>>>;
|
|
878
|
-
type ComponentLocationOfTable<Table, ComponentId extends ComponentIdOfTable<Table>> = Table extends {
|
|
879
|
-
componentLocations: infer ComponentLocations extends Record<string, unknown>;
|
|
880
|
-
} ? ComponentLocations[ComponentId] : never;
|
|
881
|
-
type ComponentDataOfTable<Table, ComponentId extends ComponentIdOfTable<Table>> = Table extends {
|
|
882
|
-
cards: infer Cards extends Record<string, unknown>;
|
|
883
|
-
pieces: infer Pieces extends Record<string, unknown>;
|
|
884
|
-
dice: infer Dice extends Record<string, unknown>;
|
|
885
|
-
} ? ComponentId extends keyof Cards ? Cards[ComponentId] : ComponentId extends keyof Pieces ? Pieces[ComponentId] : ComponentId extends keyof Dice ? Dice[ComponentId] : never : never;
|
|
886
|
-
type ComponentLocationByTypeOfTable<Table, ComponentId extends ComponentIdOfTable<Table>, Type extends RuntimeComponentLocation["type"]> = Extract<ComponentLocationOfTable<Table, ComponentId>, {
|
|
887
|
-
type: Type;
|
|
888
|
-
}>;
|
|
889
|
-
type ResolvedDeckLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
|
|
890
|
-
[DeckId in DeckIdOfTable<Table>]: {
|
|
891
|
-
componentId: ComponentId;
|
|
892
|
-
deckId: DeckId;
|
|
893
|
-
cards: DeckCardsOfTable<Table, DeckId>;
|
|
894
|
-
location: ComponentLocationByTypeOfTable<Table, ComponentId, "InDeck"> & {
|
|
895
|
-
deckId: DeckId;
|
|
896
|
-
};
|
|
897
|
-
};
|
|
898
|
-
}[DeckIdOfTable<Table>];
|
|
899
|
-
type ResolvedHandLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
|
|
900
|
-
[HandId in HandIdOfTable<Table>]: {
|
|
901
|
-
[PlayerId in PlayerIdOfTable<Table>]: {
|
|
902
|
-
componentId: ComponentId;
|
|
903
|
-
handId: HandId;
|
|
904
|
-
playerId: PlayerId;
|
|
905
|
-
cards: HandCardsOfTable<Table, HandId>;
|
|
906
|
-
location: ComponentLocationByTypeOfTable<Table, ComponentId, "InHand"> & {
|
|
907
|
-
handId: HandId;
|
|
908
|
-
playerId: PlayerId;
|
|
909
|
-
};
|
|
910
|
-
};
|
|
911
|
-
}[PlayerIdOfTable<Table>];
|
|
912
|
-
}[HandIdOfTable<Table>];
|
|
913
|
-
type ResolvedZoneLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = ComponentLocationByTypeOfTable<Table, ComponentId, "InZone"> extends infer Location ? Location extends {
|
|
914
|
-
type: "InZone";
|
|
915
|
-
zoneId: infer ZoneId extends string;
|
|
916
|
-
} ? {
|
|
917
|
-
componentId: ComponentId;
|
|
918
|
-
zoneId: ZoneId;
|
|
919
|
-
location: Location;
|
|
920
|
-
} : never : never;
|
|
921
|
-
type ResolvedSpaceLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
|
|
922
|
-
[BoardId in BoardIdOfTable<Table>]: {
|
|
923
|
-
[SpaceId in SpaceIdOfTable<Table, BoardId>]: {
|
|
924
|
-
componentId: ComponentId;
|
|
925
|
-
boardId: BoardId;
|
|
926
|
-
board: BoardRecord<Table, BoardId>;
|
|
927
|
-
spaceId: SpaceId;
|
|
928
|
-
space: Table["boards"]["byId"][BoardId]["spaces"][SpaceId];
|
|
929
|
-
location: ComponentLocationByTypeOfTable<Table, ComponentId, "OnSpace"> & {
|
|
930
|
-
boardId: BoardId;
|
|
931
|
-
spaceId: SpaceId;
|
|
932
|
-
};
|
|
933
|
-
};
|
|
934
|
-
}[SpaceIdOfTable<Table, BoardId>];
|
|
935
|
-
}[BoardIdOfTable<Table>];
|
|
936
|
-
type ResolvedContainerLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
|
|
937
|
-
[BoardId in BoardIdOfTable<Table>]: {
|
|
938
|
-
[ContainerId in BoardContainerIdOfTable<Table, BoardId>]: {
|
|
939
|
-
componentId: ComponentId;
|
|
940
|
-
boardId: BoardId;
|
|
941
|
-
board: BoardRecord<Table, BoardId>;
|
|
942
|
-
containerId: ContainerId;
|
|
943
|
-
container: Table["boards"]["byId"][BoardId]["containers"][ContainerId];
|
|
944
|
-
location: ComponentLocationByTypeOfTable<Table, ComponentId, "InContainer"> & {
|
|
945
|
-
boardId: BoardId;
|
|
946
|
-
containerId: ContainerId;
|
|
947
|
-
};
|
|
948
|
-
};
|
|
949
|
-
}[BoardContainerIdOfTable<Table, BoardId>];
|
|
950
|
-
}[BoardIdOfTable<Table>];
|
|
951
|
-
type ResolvedEdgeLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
|
|
952
|
-
[BoardId in TiledBoardIdOfTable<Table>]: {
|
|
953
|
-
[EdgeId in TiledEdgeIdOfTable<Table, BoardId>]: {
|
|
954
|
-
componentId: ComponentId;
|
|
955
|
-
boardId: BoardId;
|
|
956
|
-
board: TiledBoardRecord<Table, BoardId>;
|
|
957
|
-
edgeId: EdgeId;
|
|
958
|
-
edge: Extract<Table["boards"]["byId"][BoardId], {
|
|
959
|
-
layout: "hex" | "square";
|
|
960
|
-
}>["edges"][number];
|
|
961
|
-
location: ComponentLocationByTypeOfTable<Table, ComponentId, "OnEdge"> & {
|
|
962
|
-
boardId: BoardId;
|
|
963
|
-
edgeId: EdgeId;
|
|
964
|
-
};
|
|
965
|
-
};
|
|
966
|
-
}[TiledEdgeIdOfTable<Table, BoardId>];
|
|
967
|
-
}[TiledBoardIdOfTable<Table>];
|
|
968
|
-
type ResolvedVertexLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
|
|
969
|
-
[BoardId in TiledBoardIdOfTable<Table>]: {
|
|
970
|
-
[VertexId in TiledVertexIdOfTable<Table, BoardId>]: {
|
|
971
|
-
componentId: ComponentId;
|
|
972
|
-
boardId: BoardId;
|
|
973
|
-
board: TiledBoardRecord<Table, BoardId>;
|
|
974
|
-
vertexId: VertexId;
|
|
975
|
-
vertex: Extract<Table["boards"]["byId"][BoardId], {
|
|
976
|
-
layout: "hex" | "square";
|
|
977
|
-
}>["vertices"][number];
|
|
978
|
-
location: ComponentLocationByTypeOfTable<Table, ComponentId, "OnVertex"> & {
|
|
979
|
-
boardId: BoardId;
|
|
980
|
-
vertexId: VertexId;
|
|
981
|
-
};
|
|
982
|
-
};
|
|
983
|
-
}[TiledVertexIdOfTable<Table, BoardId>];
|
|
984
|
-
}[TiledBoardIdOfTable<Table>];
|
|
985
|
-
type ResolvedSlotLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = ComponentLocationByTypeOfTable<Table, ComponentId, "InSlot"> extends infer Location ? Location extends {
|
|
986
|
-
type: "InSlot";
|
|
987
|
-
host: infer Host extends RuntimeSlotHostRef;
|
|
988
|
-
slotId: infer SlotId extends string;
|
|
989
|
-
} ? {
|
|
990
|
-
componentId: ComponentId;
|
|
991
|
-
host: Host;
|
|
992
|
-
slotId: SlotId;
|
|
993
|
-
location: Location;
|
|
994
|
-
} : never : never;
|
|
995
|
-
type TableQueries<Table extends RuntimeTableRecord> = {
|
|
996
|
-
board: {
|
|
997
|
-
get: <BoardId extends BoardIdOfTable<Table>>(boardId: BoardId) => BoardRecord<Table, BoardId>;
|
|
998
|
-
hex: <BoardId extends HexBoardIdOfTable<Table>>(boardId: BoardId) => Extract<BoardRecord<Table, BoardId>, {
|
|
999
|
-
layout: "hex";
|
|
1000
|
-
}>;
|
|
1001
|
-
square: <BoardId extends SquareBoardIdOfTable<Table>>(boardId: BoardId) => Extract<BoardRecord<Table, BoardId>, {
|
|
1002
|
-
layout: "square";
|
|
1003
|
-
}>;
|
|
1004
|
-
tiled: <BoardId extends TiledBoardIdOfTable<Table>>(boardId: BoardId) => TiledBoardRecord<Table, BoardId>;
|
|
1005
|
-
space: <BoardId extends BoardIdOfTable<Table>, SpaceId extends SpaceIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId) => Table["boards"]["byId"][BoardId]["spaces"][SpaceId];
|
|
1006
|
-
hexSpace: <BoardId extends HexBoardIdOfTable<Table>, SpaceId extends HexSpaceIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId) => Extract<Table["boards"]["byId"][BoardId], {
|
|
1007
|
-
layout: "hex";
|
|
1008
|
-
}>["spaces"][SpaceId];
|
|
1009
|
-
squareSpace: <BoardId extends SquareBoardIdOfTable<Table>, SpaceId extends SquareSpaceIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId) => Extract<Table["boards"]["byId"][BoardId], {
|
|
1010
|
-
layout: "square";
|
|
1011
|
-
}>["spaces"][SpaceId];
|
|
1012
|
-
container: <BoardId extends BoardIdOfTable<Table>, ContainerId extends BoardContainerIdOfTable<Table, BoardId>>(boardId: BoardId, containerId: ContainerId) => Table["boards"]["byId"][BoardId]["containers"][ContainerId];
|
|
1013
|
-
edge: <BoardId extends TiledBoardIdOfTable<Table>, EdgeId extends TiledEdgeIdOfTable<Table, BoardId>>(boardId: BoardId, edgeId: EdgeId) => TiledEdgeStateOfTable<Table, BoardId, EdgeId>;
|
|
1014
|
-
vertex: <BoardId extends TiledBoardIdOfTable<Table>, VertexId extends TiledVertexIdOfTable<Table, BoardId>>(boardId: BoardId, vertexId: VertexId) => TiledVertexStateOfTable<Table, BoardId, VertexId>;
|
|
1015
|
-
byType: <TypeId extends BoardTypeIdOfTable<Table>>(typeId: TypeId) => BoardIdOfTable<Table>[];
|
|
1016
|
-
spacesByType: <BoardId extends BoardIdOfTable<Table>, TypeId extends SpaceTypeIdOfTable<Table, BoardId>>(boardId: BoardId, typeId: TypeId) => SpaceIdOfTable<Table, BoardId>[];
|
|
1017
|
-
edgesByType: <BoardId extends TiledBoardIdOfTable<Table>, TypeId extends TiledEdgeTypeIdOfTable<Table, BoardId>>(boardId: BoardId, typeId: TypeId) => TiledEdgeIdOfTable<Table, BoardId>[];
|
|
1018
|
-
verticesByType: <BoardId extends TiledBoardIdOfTable<Table>, TypeId extends TiledVertexTypeIdOfTable<Table, BoardId>>(boardId: BoardId, typeId: TypeId) => TiledVertexIdOfTable<Table, BoardId>[];
|
|
1019
|
-
adjacentSpaces: <BoardId extends BoardIdOfTable<Table>, SpaceId extends SpaceIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId) => SpaceIdOfTable<Table, BoardId>[];
|
|
1020
|
-
relatedSpaces: <BoardId extends BoardIdOfTable<Table>, SpaceId extends SpaceIdOfTable<Table, BoardId>, TypeId extends RelationTypeIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId, relationTypeId: TypeId) => SpaceIdOfTable<Table, BoardId>[];
|
|
1021
|
-
incidentEdges: <BoardId extends TiledBoardIdOfTable<Table>, VertexId extends TiledVertexIdOfTable<Table, BoardId>>(boardId: BoardId, vertexId: VertexId) => TiledEdgeIdOfTable<Table, BoardId>[];
|
|
1022
|
-
incidentVertices: <BoardId extends TiledBoardIdOfTable<Table>, EdgeId extends TiledEdgeIdOfTable<Table, BoardId>>(boardId: BoardId, edgeId: EdgeId) => TiledVertexIdOfTable<Table, BoardId>[];
|
|
1023
|
-
spaceEdges: <BoardId extends TiledBoardIdOfTable<Table>>(boardId: BoardId, spaceId: SpaceIdOfTable<Table, BoardId>) => TiledEdgeIdOfTable<Table, BoardId>[];
|
|
1024
|
-
spaceVertices: <BoardId extends TiledBoardIdOfTable<Table>>(boardId: BoardId, spaceId: SpaceIdOfTable<Table, BoardId>) => TiledVertexIdOfTable<Table, BoardId>[];
|
|
1025
|
-
spaceDistance: <BoardId extends BoardIdOfTable<Table>, SpaceId extends SpaceIdOfTable<Table, BoardId>>(boardId: BoardId, fromSpaceId: SpaceId, toSpaceId: SpaceId) => number;
|
|
1026
|
-
hexSpaceAt: <BoardId extends HexBoardIdOfTable<Table>>(boardId: BoardId, q: number, r: number) => Extract<Table["boards"]["byId"][BoardId], {
|
|
1027
|
-
layout: "hex";
|
|
1028
|
-
}>["spaces"][HexSpaceIdOfTable<Table, BoardId>] | undefined;
|
|
1029
|
-
squareSpaceAt: <BoardId extends SquareBoardIdOfTable<Table>>(boardId: BoardId, row: number, col: number) => Extract<Table["boards"]["byId"][BoardId], {
|
|
1030
|
-
layout: "square";
|
|
1031
|
-
}>["spaces"][SquareSpaceIdOfTable<Table, BoardId>] | undefined;
|
|
1032
|
-
squareNeighbors: <BoardId extends SquareBoardIdOfTable<Table>, SpaceId extends SquareSpaceIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId, options?: {
|
|
1033
|
-
mode?: "orthogonal" | "diagonal" | "all";
|
|
1034
|
-
}) => SquareSpaceIdOfTable<Table, BoardId>[];
|
|
1035
|
-
squareDistance: <BoardId extends SquareBoardIdOfTable<Table>, SpaceId extends SquareSpaceIdOfTable<Table, BoardId>>(boardId: BoardId, fromSpaceId: SpaceId, toSpaceId: SpaceId, options?: {
|
|
1036
|
-
metric?: "manhattan" | "chebyshev";
|
|
1037
|
-
}) => number;
|
|
1038
|
-
spaceOccupants: <BoardId extends BoardIdOfTable<Table>, SpaceId extends SpaceIdOfTable<Table, BoardId>>(boardId: BoardId, spaceId: SpaceId) => ComponentIdOfTable<Table>[];
|
|
1039
|
-
containerOccupants: <BoardId extends BoardIdOfTable<Table>, ContainerId extends BoardContainerIdOfTable<Table, BoardId>>(boardId: BoardId, containerId: ContainerId) => ComponentIdOfTable<Table>[];
|
|
1040
|
-
edgeOccupants: <BoardId extends TiledBoardIdOfTable<Table>, EdgeId extends TiledEdgeIdOfTable<Table, BoardId>>(boardId: BoardId, edgeId: EdgeId) => ComponentIdOfTable<Table>[];
|
|
1041
|
-
vertexOccupants: <BoardId extends TiledBoardIdOfTable<Table>, VertexId extends TiledVertexIdOfTable<Table, BoardId>>(boardId: BoardId, vertexId: VertexId) => ComponentIdOfTable<Table>[];
|
|
1042
|
-
};
|
|
1043
|
-
zone: {
|
|
1044
|
-
sharedCards: <ZoneId extends DeckIdOfTable<Table>>(zoneId: ZoneId) => DeckCardsForZone<Table, ZoneId>;
|
|
1045
|
-
sharedCardCollection: <ZoneId extends DeckIdOfTable<Table>>(zoneId: ZoneId) => CardCollectionOfTable<Table>;
|
|
1046
|
-
allSharedCards: () => {
|
|
1047
|
-
readonly [Z in DeckIdOfTable<Table>]: DeckCardsOfTable<Table, Z>;
|
|
1048
|
-
};
|
|
1049
|
-
playerCards: <PlayerId extends PlayerIdOfTable<Table>, ZoneId extends HandIdOfTable<Table>>(playerId: PlayerId, zoneId: ZoneId) => HandCardsForZone<Table, ZoneId>;
|
|
1050
|
-
playerCardCollection: <PlayerId extends PlayerIdOfTable<Table>, ZoneId extends HandIdOfTable<Table>>(playerId: PlayerId, zoneId: ZoneId) => CardCollectionOfTable<Table>;
|
|
1051
|
-
allPlayerCards: <ZoneId extends HandIdOfTable<Table>>(zoneId: ZoneId) => {
|
|
1052
|
-
readonly [P in PlayerIdOfTable<Table>]: HandCardsOfTable<Table, ZoneId>;
|
|
1053
|
-
};
|
|
1054
|
-
};
|
|
1055
|
-
card: {
|
|
1056
|
-
get: <CardId extends CardIdOfTable<Table>>(cardId: CardId) => ViewCardOfTable<Table, CardId>;
|
|
1057
|
-
byIds: <CardIds extends readonly CardIdOfTable<Table>[]>(cardIds: CardIds) => CardsByIdOfTable<Table, CardIds>;
|
|
1058
|
-
owner: <CardId extends CardIdOfTable<Table>>(cardId: CardId) => Table["ownerOfCard"][CardId];
|
|
1059
|
-
visibility: <CardId extends CardIdOfTable<Table>>(cardId: CardId) => Table["visibility"][CardId];
|
|
1060
|
-
};
|
|
1061
|
-
slot: {
|
|
1062
|
-
occupants: (host: RuntimeSlotHostRef, slotId: string) => SlotOccupantsOfTable<Table>;
|
|
1063
|
-
occupantsByHost: (host: RuntimeSlotHostRef) => SlotOccupantsBySlotIdOfTable<Table>;
|
|
1064
|
-
pieceOccupants: (hostId: string, slotId: string) => SlotOccupantsOfTable<Table>;
|
|
1065
|
-
pieceOccupantsByHost: (hostId: string) => SlotOccupantsBySlotIdOfTable<Table>;
|
|
1066
|
-
dieOccupants: (hostId: string, slotId: string) => SlotOccupantsOfTable<Table>;
|
|
1067
|
-
dieOccupantsByHost: (hostId: string) => SlotOccupantsBySlotIdOfTable<Table>;
|
|
1068
|
-
};
|
|
1069
|
-
player: {
|
|
1070
|
-
/** Seating order from the manifest / setup profile. */
|
|
1071
|
-
order: () => Table["playerOrder"];
|
|
1072
|
-
/**
|
|
1073
|
-
* Next player id in seating order after `playerId`, wrapping around to
|
|
1074
|
-
* the first seat. Returns `null` when `playerId` is unknown or the
|
|
1075
|
-
* order is empty. Convenient for "whose turn is next" logic.
|
|
1076
|
-
*/
|
|
1077
|
-
nextInOrder: (playerId: PlayerIdOfTable<Table>) => PlayerIdOfTable<Table> | null;
|
|
1078
|
-
/** All resource balances for a player, as the manifest-typed record. */
|
|
1079
|
-
resources: <PlayerId extends PlayerIdOfTable<Table>>(playerId: PlayerId) => ResourceBalancesOfTable<Table>;
|
|
1080
|
-
/** Balance of a single resource; returns `0` when unset. */
|
|
1081
|
-
resource: (playerId: PlayerIdOfTable<Table>, resourceId: ResourceIdOfTable<Table>) => number;
|
|
1082
|
-
/**
|
|
1083
|
-
* Sum of every resource amount held by a player (e.g. "total cards in
|
|
1084
|
-
* hand" checks). Returns `0` for unknown players or empty balances.
|
|
1085
|
-
*/
|
|
1086
|
-
resourceTotal: (playerId: PlayerIdOfTable<Table>) => number;
|
|
1087
|
-
/** `true` when the player can pay every non-zero amount in `amounts`. */
|
|
1088
|
-
canAfford: (playerId: PlayerIdOfTable<Table>, amounts: ResourceAmountsOfTable<Table>) => boolean;
|
|
1089
|
-
/** Shortfall per resource when the player cannot afford `amounts`. */
|
|
1090
|
-
missingResources: (playerId: PlayerIdOfTable<Table>, amounts: ResourceAmountsOfTable<Table>) => Partial<Record<ResourceIdOfTable<Table>, number>>;
|
|
1091
|
-
};
|
|
1092
|
-
component: {
|
|
1093
|
-
data: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ComponentDataOfTable<Table, ComponentId> | undefined;
|
|
1094
|
-
location: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ComponentLocationOfTable<Table, ComponentId> | undefined;
|
|
1095
|
-
deck: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedDeckLocation<Table, ComponentId> | null;
|
|
1096
|
-
hand: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedHandLocation<Table, ComponentId> | null;
|
|
1097
|
-
zone: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedZoneLocation<Table, ComponentId> | null;
|
|
1098
|
-
space: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedSpaceLocation<Table, ComponentId> | null;
|
|
1099
|
-
container: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedContainerLocation<Table, ComponentId> | null;
|
|
1100
|
-
edge: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedEdgeLocation<Table, ComponentId> | null;
|
|
1101
|
-
vertex: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedVertexLocation<Table, ComponentId> | null;
|
|
1102
|
-
slot: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedSlotLocation<Table, ComponentId> | null;
|
|
1103
|
-
};
|
|
1104
|
-
};
|
|
1105
|
-
type TableQueriesOfState<State extends {
|
|
1106
|
-
table: RuntimeTableRecord;
|
|
1107
|
-
}> = TableQueries<TableOfState<State>>;
|
|
1108
|
-
|
|
1109
|
-
declare const manifestIdSchemaBrand: unique symbol;
|
|
1110
|
-
type ManifestIdSchema<Output = unknown> = z.ZodType<Output> & {
|
|
1111
|
-
readonly [manifestIdSchemaBrand]: true;
|
|
1112
|
-
};
|
|
1113
|
-
type ManifestLiterals<PlayerId extends string, DeckId extends string, HandId extends string, CardId extends string, PhaseName extends string = string> = {
|
|
1114
|
-
playerIds: readonly PlayerId[];
|
|
1115
|
-
phaseNames: readonly PhaseName[];
|
|
1116
|
-
boardLayouts: readonly ("generic" | "hex" | "square")[];
|
|
1117
|
-
setupOptionIds: readonly string[];
|
|
1118
|
-
setupProfileIds: readonly string[];
|
|
1119
|
-
cardSetIds: readonly string[];
|
|
1120
|
-
cardTypes: readonly string[];
|
|
1121
|
-
deckIds: readonly DeckId[];
|
|
1122
|
-
handIds: readonly HandId[];
|
|
1123
|
-
sharedZoneIds: readonly DeckId[];
|
|
1124
|
-
playerZoneIds: readonly HandId[];
|
|
1125
|
-
zoneIds: readonly (DeckId | HandId)[];
|
|
1126
|
-
cardIds: readonly CardId[];
|
|
1127
|
-
resourceIds: readonly string[];
|
|
1128
|
-
resourcePresentationById?: Record<string, {
|
|
1129
|
-
label: string;
|
|
1130
|
-
icon?: string | null;
|
|
1131
|
-
}>;
|
|
1132
|
-
pieceTypeIds: readonly string[];
|
|
1133
|
-
pieceIds: readonly string[];
|
|
1134
|
-
dieTypeIds: readonly string[];
|
|
1135
|
-
dieIds: readonly string[];
|
|
1136
|
-
boardTemplateIds: readonly string[];
|
|
1137
|
-
boardTypeIds: readonly string[];
|
|
1138
|
-
boardBaseIds: readonly string[];
|
|
1139
|
-
boardIds: readonly string[];
|
|
1140
|
-
boardContainerIds: readonly string[];
|
|
1141
|
-
relationTypeIds: readonly string[];
|
|
1142
|
-
edgeIds: readonly string[];
|
|
1143
|
-
edgeTypeIds: readonly string[];
|
|
1144
|
-
vertexIds: readonly string[];
|
|
1145
|
-
vertexTypeIds: readonly string[];
|
|
1146
|
-
spaceIds: readonly string[];
|
|
1147
|
-
spaceTypeIds: readonly string[];
|
|
1148
|
-
handVisibilityById: Record<HandId, RuntimeHandVisibilityMode>;
|
|
1149
|
-
zoneVisibilityById: Record<DeckId | HandId, RuntimeHandVisibilityMode>;
|
|
1150
|
-
setupChoiceIdsByOptionId: Record<string, readonly string[]>;
|
|
1151
|
-
cardSetIdByCardId: Record<CardId, string>;
|
|
1152
|
-
cardTypeByCardId: Record<CardId, string>;
|
|
1153
|
-
cardSetIdsBySharedZoneId: Record<DeckId, readonly string[]>;
|
|
1154
|
-
cardSetIdsByPlayerZoneId: Record<HandId, readonly string[]>;
|
|
1155
|
-
};
|
|
1156
|
-
type ManifestIds<PlayerId extends string, DeckId extends string, HandId extends string, CardId extends string, PhaseName extends string = string> = {
|
|
1157
|
-
playerId: z.ZodType<PlayerId>;
|
|
1158
|
-
phaseName: z.ZodType<PhaseName>;
|
|
1159
|
-
boardLayout: AnySchema;
|
|
1160
|
-
setupOptionId: AnySchema;
|
|
1161
|
-
setupProfileId: AnySchema;
|
|
1162
|
-
cardSetId: AnySchema;
|
|
1163
|
-
cardType: AnySchema;
|
|
1164
|
-
cardId: z.ZodType<CardId>;
|
|
1165
|
-
deckId: z.ZodType<DeckId>;
|
|
1166
|
-
handId: z.ZodType<HandId>;
|
|
1167
|
-
sharedZoneId: AnySchema;
|
|
1168
|
-
playerZoneId: AnySchema;
|
|
1169
|
-
zoneId: AnySchema;
|
|
1170
|
-
resourceId: AnySchema;
|
|
1171
|
-
pieceTypeId: AnySchema;
|
|
1172
|
-
pieceId: AnySchema;
|
|
1173
|
-
dieId: AnySchema;
|
|
1174
|
-
dieTypeId: AnySchema;
|
|
1175
|
-
boardTypeId: AnySchema;
|
|
1176
|
-
boardId: AnySchema;
|
|
1177
|
-
boardBaseId: AnySchema;
|
|
1178
|
-
boardContainerId: AnySchema;
|
|
1179
|
-
relationTypeId: AnySchema;
|
|
1180
|
-
edgeId: AnySchema;
|
|
1181
|
-
edgeTypeId: AnySchema;
|
|
1182
|
-
vertexId: AnySchema;
|
|
1183
|
-
vertexTypeId: AnySchema;
|
|
1184
|
-
spaceId: AnySchema;
|
|
1185
|
-
spaceTypeId: AnySchema;
|
|
1186
|
-
};
|
|
1187
|
-
type ManifestDefaults<Table extends RuntimeTableRecord> = {
|
|
1188
|
-
zones: (playerIds?: readonly string[]) => Table["zones"];
|
|
1189
|
-
decks: (playerIds?: readonly string[]) => Table["decks"];
|
|
1190
|
-
hands: (playerIds?: readonly string[]) => Table["hands"];
|
|
1191
|
-
handVisibility: (playerIds?: readonly string[]) => Table["handVisibility"];
|
|
1192
|
-
ownerOfCard: (playerIds?: readonly string[]) => Table["ownerOfCard"];
|
|
1193
|
-
visibility: (playerIds?: readonly string[]) => Table["visibility"];
|
|
1194
|
-
resources: (playerIds?: readonly string[]) => Table["resources"];
|
|
1195
|
-
};
|
|
1196
|
-
type StaticBoards<Table extends RuntimeTableRecord> = Pick<Table["boards"], "byId" | "hex" | "square">;
|
|
1197
|
-
type StaticBoardsJsonEnvelope<Table extends RuntimeTableRecord = RuntimeTableRecord> = {
|
|
1198
|
-
formatVersion: 1;
|
|
1199
|
-
generatedBy: "@dreamboard-games/sdk/codegen";
|
|
1200
|
-
boards: StaticBoards<Table>;
|
|
1201
|
-
initialTable: Table;
|
|
1202
|
-
};
|
|
1203
|
-
type SetupOptionChoiceMetadata = {
|
|
1204
|
-
id: string;
|
|
1205
|
-
label: string;
|
|
1206
|
-
description?: string | null;
|
|
1207
|
-
};
|
|
1208
|
-
type SetupOptionMetadata = {
|
|
1209
|
-
id: string;
|
|
1210
|
-
name: string;
|
|
1211
|
-
description?: string | null;
|
|
1212
|
-
choices: readonly SetupOptionChoiceMetadata[];
|
|
1213
|
-
};
|
|
1214
|
-
type SetupProfileMetadata = {
|
|
1215
|
-
id: string;
|
|
1216
|
-
name: string;
|
|
1217
|
-
description?: string | null;
|
|
1218
|
-
optionValues?: Record<string, string> | null;
|
|
1219
|
-
};
|
|
1220
|
-
type ReducerManifestContract<Table extends RuntimeTableRecord, PhaseName extends string, PlayerId extends string, DeckId extends string, HandId extends string, CardId extends string> = {
|
|
1221
|
-
literals: ManifestLiterals<PlayerId, DeckId, HandId, CardId, PhaseName>;
|
|
1222
|
-
ids: ManifestIds<PlayerId, DeckId, HandId, CardId, PhaseName>;
|
|
1223
|
-
defaults: ManifestDefaults<Table>;
|
|
1224
|
-
staticBoards?: StaticBoards<Table>;
|
|
1225
|
-
setupOptionsById: Record<string, SetupOptionMetadata>;
|
|
1226
|
-
setupChoiceIdsByOptionId: Record<string, readonly string[]>;
|
|
1227
|
-
setupProfilesById: Record<string, SetupProfileMetadata>;
|
|
1228
|
-
tableSchema: z.ZodType<Table>;
|
|
1229
|
-
runtimeSchema: AnySchema;
|
|
1230
|
-
createGameStateSchema: (config: {
|
|
1231
|
-
phaseNameSchema: AnySchema;
|
|
1232
|
-
publicSchema: AnySchema;
|
|
1233
|
-
privateSchema: AnySchema;
|
|
1234
|
-
hiddenSchema: AnySchema;
|
|
1235
|
-
phasesSchema: AnySchema;
|
|
1236
|
-
}) => AnySchema;
|
|
1237
|
-
};
|
|
1238
|
-
type GeneratedManifestContractLike<Table extends RuntimeTableRecord = RuntimeTableRecord, PhaseName extends string = string, PlayerId extends string = string, DeckId extends string = string, HandId extends string = string, CardId extends string = string> = ReducerManifestContract<Table, PhaseName, PlayerId, DeckId, HandId, CardId>;
|
|
1239
|
-
type ManifestContract<Table extends RuntimeTableRecord> = ReducerManifestContract<Table, string, PlayerIdOfTable<Table>, DeckIdOfTable<Table>, HandIdOfTable<Table>, CardIdOfTable<Table>>;
|
|
1240
|
-
declare function markManifestScopedSchema<Schema extends z.ZodTypeAny>(schema: Schema): Schema & ManifestIdSchema<z.infer<Schema>>;
|
|
1241
|
-
declare function isManifestScopedSchema(schema: unknown): boolean;
|
|
1242
|
-
declare function createManifestStringLiteralSchema<Values extends readonly string[]>(values: Values): ManifestIdSchema<Values[number] extends never ? string : Values[number]>;
|
|
1243
|
-
declare function assumeManifestSchema<Output>(schema: z.ZodTypeAny): z.ZodType<Output>;
|
|
1244
|
-
declare function cloneManifestDefault<Value>(value: Value): Value;
|
|
1245
|
-
declare function resolveManifestPlayerIds<PlayerId extends string>(manifestPlayerIds: readonly PlayerId[], playerIds: readonly string[] | undefined): readonly PlayerId[];
|
|
1246
|
-
declare function createManifestRuntimeSchema<PhaseNameSchema extends z.ZodTypeAny, PlayerId extends string, SetupProfileId extends string>({ phaseNameSchema, playerIdSchema, setupProfileIdSchema, }: {
|
|
1247
|
-
phaseNameSchema: PhaseNameSchema;
|
|
1248
|
-
playerIdSchema: z.ZodType<PlayerId>;
|
|
1249
|
-
setupProfileIdSchema: z.ZodType<SetupProfileId>;
|
|
1250
|
-
}): z.ZodObject<{
|
|
1251
|
-
prompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1252
|
-
id: z.ZodString;
|
|
1253
|
-
promptId: z.ZodString;
|
|
1254
|
-
to: z.ZodType<PlayerId, unknown, z.core.$ZodTypeInternals<PlayerId, unknown>>;
|
|
1255
|
-
title: z.ZodOptional<z.ZodString>;
|
|
1256
|
-
payload: z.ZodOptional<z.ZodUnknown>;
|
|
1257
|
-
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1258
|
-
id: z.ZodString;
|
|
1259
|
-
label: z.ZodString;
|
|
1260
|
-
}, z.core.$strip>>>;
|
|
1261
|
-
resume: z.ZodObject<{
|
|
1262
|
-
id: z.ZodString;
|
|
1263
|
-
data: z.ZodUnknown;
|
|
1264
|
-
}, z.core.$strip>;
|
|
1265
|
-
}, z.core.$strip>>>;
|
|
1266
|
-
rng: z.ZodDefault<z.ZodObject<{
|
|
1267
|
-
seed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1268
|
-
cursor: z.ZodDefault<z.ZodNumber>;
|
|
1269
|
-
trace: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1270
|
-
}, z.core.$strip>>;
|
|
1271
|
-
setup: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
1272
|
-
profileId: z.ZodType<SetupProfileId, unknown, z.core.$ZodTypeInternals<SetupProfileId, unknown>>;
|
|
1273
|
-
optionValues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
1274
|
-
}, z.core.$strip>>>;
|
|
1275
|
-
simultaneous: z.ZodDefault<z.ZodObject<{
|
|
1276
|
-
current: z.ZodNullable<z.ZodObject<{
|
|
1277
|
-
phaseName: PhaseNameSchema;
|
|
1278
|
-
actors: z.ZodArray<z.ZodType<PlayerId, unknown, z.core.$ZodTypeInternals<PlayerId, unknown>>>;
|
|
1279
|
-
submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1280
|
-
interactionId: z.ZodString;
|
|
1281
|
-
params: z.ZodUnknown;
|
|
1282
|
-
}, z.core.$strip>>;
|
|
1283
|
-
}, z.core.$strip>>;
|
|
1284
|
-
}, z.core.$strip>>;
|
|
1285
|
-
lastTransition: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
1286
|
-
from: PhaseNameSchema;
|
|
1287
|
-
to: PhaseNameSchema;
|
|
1288
|
-
}, z.core.$strip>>>;
|
|
1289
|
-
nextInstanceId: z.ZodDefault<z.ZodNumber>;
|
|
1290
|
-
}, z.core.$strip>;
|
|
1291
|
-
declare function createManifestGameStateSchema<Table extends RuntimeTableRecord, PhaseNameSchema extends z.ZodTypeAny, PublicSchema extends z.ZodTypeAny, PrivateSchema extends z.ZodTypeAny, HiddenSchema extends z.ZodTypeAny, PhasesSchema extends z.ZodTypeAny, PlayerId extends string, SetupProfileId extends string>({ tableSchema, playerIdSchema, setupProfileIdSchema, phaseNameSchema, publicSchema, privateSchema, hiddenSchema, phasesSchema, }: {
|
|
1292
|
-
tableSchema: z.ZodType<Table>;
|
|
1293
|
-
playerIdSchema: z.ZodType<PlayerId>;
|
|
1294
|
-
setupProfileIdSchema: z.ZodType<SetupProfileId>;
|
|
1295
|
-
phaseNameSchema: PhaseNameSchema;
|
|
1296
|
-
publicSchema: PublicSchema;
|
|
1297
|
-
privateSchema: PrivateSchema;
|
|
1298
|
-
hiddenSchema: HiddenSchema;
|
|
1299
|
-
phasesSchema: PhasesSchema;
|
|
1300
|
-
}): z.ZodObject<{
|
|
1301
|
-
table: z.ZodType<Table, unknown, z.core.$ZodTypeInternals<Table, unknown>>;
|
|
1302
|
-
public: PublicSchema;
|
|
1303
|
-
private: z.ZodRecord<z.ZodString, PrivateSchema>;
|
|
1304
|
-
hidden: HiddenSchema;
|
|
1305
|
-
flow: z.ZodObject<{
|
|
1306
|
-
currentPhase: PhaseNameSchema;
|
|
1307
|
-
turn: z.ZodNumber;
|
|
1308
|
-
round: z.ZodNumber;
|
|
1309
|
-
activePlayers: z.ZodArray<z.ZodType<PlayerId, unknown, z.core.$ZodTypeInternals<PlayerId, unknown>>>;
|
|
1310
|
-
}, z.core.$strip>;
|
|
1311
|
-
phase: PhasesSchema;
|
|
1312
|
-
runtime: z.ZodObject<{
|
|
1313
|
-
prompts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1314
|
-
id: z.ZodString;
|
|
1315
|
-
promptId: z.ZodString;
|
|
1316
|
-
to: z.ZodType<PlayerId, unknown, z.core.$ZodTypeInternals<PlayerId, unknown>>;
|
|
1317
|
-
title: z.ZodOptional<z.ZodString>;
|
|
1318
|
-
payload: z.ZodOptional<z.ZodUnknown>;
|
|
1319
|
-
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1320
|
-
id: z.ZodString;
|
|
1321
|
-
label: z.ZodString;
|
|
1322
|
-
}, z.core.$strip>>>;
|
|
1323
|
-
resume: z.ZodObject<{
|
|
1324
|
-
id: z.ZodString;
|
|
1325
|
-
data: z.ZodUnknown;
|
|
1326
|
-
}, z.core.$strip>;
|
|
1327
|
-
}, z.core.$strip>>>;
|
|
1328
|
-
rng: z.ZodDefault<z.ZodObject<{
|
|
1329
|
-
seed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1330
|
-
cursor: z.ZodDefault<z.ZodNumber>;
|
|
1331
|
-
trace: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1332
|
-
}, z.core.$strip>>;
|
|
1333
|
-
setup: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
1334
|
-
profileId: z.ZodType<SetupProfileId, unknown, z.core.$ZodTypeInternals<SetupProfileId, unknown>>;
|
|
1335
|
-
optionValues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
1336
|
-
}, z.core.$strip>>>;
|
|
1337
|
-
simultaneous: z.ZodDefault<z.ZodObject<{
|
|
1338
|
-
current: z.ZodNullable<z.ZodObject<{
|
|
1339
|
-
phaseName: PhaseNameSchema;
|
|
1340
|
-
actors: z.ZodArray<z.ZodType<PlayerId, unknown, z.core.$ZodTypeInternals<PlayerId, unknown>>>;
|
|
1341
|
-
submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1342
|
-
interactionId: z.ZodString;
|
|
1343
|
-
params: z.ZodUnknown;
|
|
1344
|
-
}, z.core.$strip>>;
|
|
1345
|
-
}, z.core.$strip>>;
|
|
1346
|
-
}, z.core.$strip>>;
|
|
1347
|
-
lastTransition: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
1348
|
-
from: PhaseNameSchema;
|
|
1349
|
-
to: PhaseNameSchema;
|
|
1350
|
-
}, z.core.$strip>>>;
|
|
1351
|
-
nextInstanceId: z.ZodDefault<z.ZodNumber>;
|
|
1352
|
-
}, z.core.$strip>;
|
|
1353
|
-
}, z.core.$strip>;
|
|
1354
|
-
type StateDefinition<PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>> = {
|
|
1355
|
-
public: PublicSchema;
|
|
1356
|
-
private: PrivateSchema;
|
|
1357
|
-
hidden: HiddenSchema;
|
|
1358
|
-
};
|
|
1359
|
-
type InitContext<Table extends RuntimeTableRecord, Manifest extends ReducerManifestContract<Table, string, string, string, string, string> = ManifestContract<Table>> = {
|
|
1360
|
-
manifest: Manifest;
|
|
1361
|
-
table: Table;
|
|
1362
|
-
playerIds: PlayerIdOfTable<Table>[];
|
|
1363
|
-
rngSeed?: number | null;
|
|
1364
|
-
setup: SetupSelectionOfManifest<Manifest> | null;
|
|
1365
|
-
q: TableQueriesOfState<{
|
|
1366
|
-
table: Table;
|
|
1367
|
-
}>;
|
|
1368
|
-
};
|
|
1369
|
-
type InitSetupSelectionInput<Manifest extends ReducerManifestContract<RuntimeTableRecord, string, string, string, string, string> = GeneratedManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
|
|
1370
|
-
type SetupBootstrapSharedZoneRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1371
|
-
type: "sharedZone";
|
|
1372
|
-
zoneId: SharedZoneIdOfManifest<Manifest>;
|
|
1373
|
-
};
|
|
1374
|
-
type SetupBootstrapPerPlayerZoneRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1375
|
-
type: "playerZone";
|
|
1376
|
-
zoneId: PlayerZoneIdOfManifest<Manifest>;
|
|
1377
|
-
playerId: PlayerIdOfManifest<Manifest>;
|
|
1378
|
-
};
|
|
1379
|
-
type SetupBootstrapSharedBoardContainerRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1380
|
-
type: "sharedBoardContainer";
|
|
1381
|
-
boardId: BoardBaseIdOfManifest<Manifest>;
|
|
1382
|
-
containerId: BoardContainerIdOfManifest<Manifest>;
|
|
1383
|
-
};
|
|
1384
|
-
type SetupBootstrapPerPlayerBoardContainerRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1385
|
-
type: "playerBoardContainer";
|
|
1386
|
-
boardId: BoardBaseIdOfManifest<Manifest>;
|
|
1387
|
-
playerId: PlayerIdOfManifest<Manifest>;
|
|
1388
|
-
containerId: BoardContainerIdOfManifest<Manifest>;
|
|
1389
|
-
};
|
|
1390
|
-
type SetupBootstrapSharedBoardSpaceRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1391
|
-
type: "sharedBoardSpace";
|
|
1392
|
-
boardId: BoardBaseIdOfManifest<Manifest>;
|
|
1393
|
-
spaceId: SpaceIdOfManifest<Manifest>;
|
|
1394
|
-
};
|
|
1395
|
-
type SetupBootstrapPerPlayerBoardSpaceRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1396
|
-
type: "playerBoardSpace";
|
|
1397
|
-
boardId: BoardBaseIdOfManifest<Manifest>;
|
|
1398
|
-
playerId: PlayerIdOfManifest<Manifest>;
|
|
1399
|
-
spaceId: SpaceIdOfManifest<Manifest>;
|
|
1400
|
-
};
|
|
1401
|
-
type SetupBootstrapContainerRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupBootstrapSharedZoneRef<Manifest> | SetupBootstrapPerPlayerZoneRef<Manifest> | SetupBootstrapSharedBoardContainerRef<Manifest> | SetupBootstrapPerPlayerBoardContainerRef<Manifest>;
|
|
1402
|
-
type SetupBootstrapDestinationRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupBootstrapContainerRef<Manifest> | SetupBootstrapSharedBoardSpaceRef<Manifest> | SetupBootstrapPerPlayerBoardSpaceRef<Manifest>;
|
|
1403
|
-
type SetupBootstrapPerPlayerContainerTemplateRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1404
|
-
type: "playerZone";
|
|
1405
|
-
zoneId: PlayerZoneIdOfManifest<Manifest>;
|
|
1406
|
-
} | {
|
|
1407
|
-
type: "playerBoardContainer";
|
|
1408
|
-
boardId: BoardBaseIdOfManifest<Manifest>;
|
|
1409
|
-
containerId: BoardContainerIdOfManifest<Manifest>;
|
|
1410
|
-
};
|
|
1411
|
-
type SetupBootstrapStep<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1412
|
-
type: "shuffle";
|
|
1413
|
-
container: SetupBootstrapContainerRef<Manifest>;
|
|
1414
|
-
} | {
|
|
1415
|
-
type: "move";
|
|
1416
|
-
from: SetupBootstrapContainerRef<Manifest>;
|
|
1417
|
-
to: SetupBootstrapDestinationRef<Manifest>;
|
|
1418
|
-
count?: number;
|
|
1419
|
-
componentIds?: readonly (CardIdOfManifest<Manifest> | PieceIdOfManifest<Manifest> | DieIdOfManifest<Manifest>)[];
|
|
1420
|
-
} | {
|
|
1421
|
-
type: "deal";
|
|
1422
|
-
from: SetupBootstrapSharedZoneRef<Manifest> | SetupBootstrapSharedBoardContainerRef<Manifest>;
|
|
1423
|
-
to: SetupBootstrapPerPlayerContainerTemplateRef<Manifest>;
|
|
1424
|
-
count: number;
|
|
1425
|
-
playerIds?: readonly PlayerIdOfManifest<Manifest>[];
|
|
1426
|
-
};
|
|
1427
|
-
type SetupProfileDefinition<PhaseName extends string = string, Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
|
|
1428
|
-
initialPhase?: PhaseName;
|
|
1429
|
-
bootstrap?: readonly SetupBootstrapStep<Manifest>[];
|
|
1430
|
-
};
|
|
1431
|
-
|
|
1432
|
-
type FlowInstruction<PhaseName extends string> = {
|
|
1433
|
-
kind: "flow.transition";
|
|
1434
|
-
to: PhaseName;
|
|
1435
|
-
};
|
|
1436
|
-
type EngineRollDieInstruction = {
|
|
1437
|
-
kind: "engine.rollDie";
|
|
1438
|
-
dieId: string;
|
|
1439
|
-
continuation?: AnyContinuationToken;
|
|
1440
|
-
};
|
|
1441
|
-
type EngineShuffleSharedZoneInstruction<DeckId extends string> = {
|
|
1442
|
-
kind: "engine.shuffleSharedZone";
|
|
1443
|
-
zoneId: DeckId;
|
|
1444
|
-
continuation?: AnyContinuationToken;
|
|
1445
|
-
};
|
|
1446
|
-
type EngineShufflePlayerZoneInstruction<PlayerZoneId extends string, PlayerId extends string> = {
|
|
1447
|
-
kind: "engine.shufflePlayerZone";
|
|
1448
|
-
zoneId: PlayerZoneId;
|
|
1449
|
-
playerId: PlayerId;
|
|
1450
|
-
continuation?: AnyContinuationToken;
|
|
1451
|
-
};
|
|
1452
|
-
type EngineInstruction<DeckId extends string, PlayerZoneId extends string = string, PlayerId extends string = string> = EngineRollDieInstruction | EngineShuffleSharedZoneInstruction<DeckId> | EngineShufflePlayerZoneInstruction<PlayerZoneId, PlayerId>;
|
|
1453
|
-
type RuntimeInstruction<PhaseName extends string, DeckId extends string, PlayerZoneId extends string = string, PlayerId extends string = string> = FlowInstruction<PhaseName> | EngineInstruction<DeckId, PlayerZoneId, PlayerId>;
|
|
1454
|
-
type RuntimeInstructionForState<State> = RuntimeInstruction<PhaseNameOfState<State>, DeckIdOfState<State>, PlayerZoneIdOfState<State>, PlayerIdOfState<State>>;
|
|
1455
|
-
|
|
1456
|
-
type ContinuationToken<Data = RuntimePayload, ContinuationId extends string = string, Response = RuntimePayload> = {
|
|
1457
|
-
id: ContinuationId;
|
|
1458
|
-
data: Data;
|
|
1459
|
-
readonly __responseType?: Response;
|
|
1460
|
-
};
|
|
1461
|
-
type ContinuationResponseOf<Token> = Token extends ContinuationToken<unknown, string, infer Response> ? Response : never;
|
|
1462
|
-
type AnyContinuationToken = ContinuationToken<RuntimePayload, string, RuntimePayload>;
|
|
1463
|
-
/**
|
|
1464
|
-
* Declarative choice option. Retained as the shape used by prompt-kind
|
|
1465
|
-
* interactions' `options` field (see `InteractionSpec.options` in
|
|
1466
|
-
* `model/spec.ts`). Independent of any specific prompt authoring API.
|
|
1467
|
-
*/
|
|
1468
|
-
type ChoiceOption<OptionId extends string = string> = {
|
|
1469
|
-
id: OptionId;
|
|
1470
|
-
label: string;
|
|
1471
|
-
};
|
|
1472
|
-
type RuntimePhaseState = object;
|
|
1473
|
-
type PhaseAccessor<PhaseStates extends Record<string, object>, CurrentPhase extends keyof PhaseStates & string = keyof PhaseStates & string> = {
|
|
1474
|
-
get<PhaseName extends keyof PhaseStates & string>(phaseName: PhaseName): CurrentPhase extends PhaseName ? PhaseStates[PhaseName] : PhaseStates[PhaseName] | null;
|
|
1475
|
-
};
|
|
1476
|
-
type PhasePayload<PhaseStates extends Record<string, object>, CurrentPhase extends keyof PhaseStates & string> = PhaseStates[CurrentPhase] & PhaseAccessor<PhaseStates, CurrentPhase>;
|
|
1477
|
-
type FlowState<PhaseName extends string, PlayerId extends string> = {
|
|
1478
|
-
currentPhase: PhaseName;
|
|
1479
|
-
turn: number;
|
|
1480
|
-
round: number;
|
|
1481
|
-
activePlayers: PlayerId[];
|
|
1482
|
-
};
|
|
1483
|
-
type RuntimeRngState = {
|
|
1484
|
-
seed?: number | null;
|
|
1485
|
-
cursor: number;
|
|
1486
|
-
trace: string[];
|
|
1487
|
-
};
|
|
1488
|
-
type RuntimeSimultaneousSubmission = {
|
|
1489
|
-
interactionId: string;
|
|
1490
|
-
params: RuntimePayload;
|
|
1491
|
-
};
|
|
1492
|
-
type RuntimeSimultaneousState<PhaseName extends string, PlayerId extends string> = {
|
|
1493
|
-
current: {
|
|
1494
|
-
phaseName: PhaseName;
|
|
1495
|
-
actors: PlayerId[];
|
|
1496
|
-
submissions: Partial<Record<PlayerId, RuntimeSimultaneousSubmission>>;
|
|
1497
|
-
} | null;
|
|
1498
|
-
};
|
|
1499
|
-
/**
|
|
1500
|
-
* Marker tag attached by `defineEffect` to every effect spec. `fx.effect`
|
|
1501
|
-
* uses `type` to dispatch to the right wire-effect builder.
|
|
1502
|
-
*/
|
|
1503
|
-
type EffectTypeTag = "rollDie" | "shuffleSharedZone" | "shufflePlayerZone";
|
|
1504
|
-
/**
|
|
1505
|
-
* Structural shape of the objects produced by `defineEffect`, as seen by
|
|
1506
|
-
* the `fx.effect` dispatcher. The public, per-type effect definitions live
|
|
1507
|
-
* in `model/spec.ts`.
|
|
1508
|
-
*/
|
|
1509
|
-
type EffectSpecLike<ContextSchema extends AnySchema = AnySchema> = {
|
|
1510
|
-
type: EffectTypeTag;
|
|
1511
|
-
id: string;
|
|
1512
|
-
contextSchema?: ContextSchema;
|
|
1513
|
-
/**
|
|
1514
|
-
* Opaque authoring-time continuation callable. The runtime only needs its
|
|
1515
|
-
* `id`; the heterogeneously-typed `(data) => ...` signature is erased
|
|
1516
|
-
* here. The `data` parameter is typed as `never` so that this structural
|
|
1517
|
-
* upper bound is assignable-from every concrete per-effect continuation
|
|
1518
|
-
* (function parameters are contravariant — a specific `(data: T) => R`
|
|
1519
|
-
* is assignable to `(data: X) => R` only when `X <: T`, and `never <: T`
|
|
1520
|
-
* holds for every `T`).
|
|
1521
|
-
*/
|
|
1522
|
-
__continuation?: ((data: never) => unknown) & {
|
|
1523
|
-
id: string;
|
|
1524
|
-
};
|
|
1525
|
-
};
|
|
1526
|
-
/**
|
|
1527
|
-
* Options accepted by `fx.effect(effect, options)`, specialized by
|
|
1528
|
-
* `effect.type`.
|
|
1529
|
-
*/
|
|
1530
|
-
type EffectContextValue<Effect extends EffectSpecLike> = NonNullable<Effect["contextSchema"]> extends AnySchema ? z.infer<NonNullable<Effect["contextSchema"]>> : undefined;
|
|
1531
|
-
type EffectInvokeOptions<Effect extends EffectSpecLike, State extends {
|
|
1532
|
-
table: RuntimeTableRecord;
|
|
1533
|
-
flow: {
|
|
1534
|
-
currentPhase: string;
|
|
1535
|
-
};
|
|
1536
|
-
}> = Effect["type"] extends "rollDie" ? {
|
|
1537
|
-
dieId: StringKeyOf<TableOfState<State>["dice"]>;
|
|
1538
|
-
context?: EffectContextValue<Effect>;
|
|
1539
|
-
} : Effect["type"] extends "shuffleSharedZone" ? {
|
|
1540
|
-
zoneId: DeckIdOfState<State>;
|
|
1541
|
-
context?: EffectContextValue<Effect>;
|
|
1542
|
-
} : Effect["type"] extends "shufflePlayerZone" ? {
|
|
1543
|
-
zoneId: PlayerZoneIdOfState<State>;
|
|
1544
|
-
playerId: PlayerIdOfState<State>;
|
|
1545
|
-
context?: EffectContextValue<Effect>;
|
|
1546
|
-
} : never;
|
|
1547
|
-
type EffectInstructionForState<Effect extends EffectSpecLike, State extends {
|
|
1548
|
-
table: RuntimeTableRecord;
|
|
1549
|
-
flow: {
|
|
1550
|
-
currentPhase: string;
|
|
1551
|
-
};
|
|
1552
|
-
}> = Effect["type"] extends "rollDie" ? EngineRollDieInstruction : Effect["type"] extends "shuffleSharedZone" ? EngineShuffleSharedZoneInstruction<DeckIdOfState<State>> : Effect["type"] extends "shufflePlayerZone" ? EngineShufflePlayerZoneInstruction<PlayerZoneIdOfState<State>, PlayerIdOfState<State>> : never;
|
|
1553
|
-
type ReducerFx<State extends {
|
|
1554
|
-
table: RuntimeTableRecord;
|
|
1555
|
-
flow: {
|
|
1556
|
-
currentPhase: string;
|
|
1557
|
-
};
|
|
1558
|
-
}> = {
|
|
1559
|
-
transition: <To extends PhaseNameOfState<State>>(to: To) => FlowInstruction<To>;
|
|
1560
|
-
/**
|
|
1561
|
-
* Invoke an engine-side resumable effect authored via `defineEffect`.
|
|
1562
|
-
* The returned runtime instruction is consumed by the engine; if the effect
|
|
1563
|
-
* has a `reduce`, its continuation is delivered back as a typed input.
|
|
1564
|
-
*/
|
|
1565
|
-
effect: <Effect extends EffectSpecLike>(effect: Effect, options: EffectInvokeOptions<Effect, State>) => EffectInstructionForState<Effect, State>;
|
|
1566
|
-
};
|
|
1567
|
-
type RuntimeState<PhaseName extends string, PlayerId extends string, Setup extends RuntimeSetupSelection = RuntimeSetupSelection> = {
|
|
1568
|
-
rng: RuntimeRngState;
|
|
1569
|
-
setup: Setup | null;
|
|
1570
|
-
simultaneous: RuntimeSimultaneousState<PhaseName, PlayerId>;
|
|
1571
|
-
lastTransition: {
|
|
1572
|
-
from: PhaseName;
|
|
1573
|
-
to: PhaseName;
|
|
1574
|
-
} | null;
|
|
1575
|
-
};
|
|
1576
|
-
type ReducerRuntimeStateForState<State extends {
|
|
1577
|
-
table: RuntimeTableRecord;
|
|
1578
|
-
flow: {
|
|
1579
|
-
currentPhase: string;
|
|
1580
|
-
};
|
|
1581
|
-
}, Setup extends RuntimeSetupSelection = RuntimeSetupSelection> = RuntimeState<PhaseNameOfState<State>, PlayerIdOfState<State>, Setup>;
|
|
1582
|
-
type ReducerGameState<Table extends RuntimeTableRecord, PublicState extends object, PrivateState extends object, HiddenState extends object, PhaseState extends RuntimePhaseState, PhaseName extends string, PhaseStates extends Record<PhaseName, object> = Record<PhaseName, PhaseState>> = {
|
|
1583
|
-
table: Table;
|
|
1584
|
-
publicState: PublicState;
|
|
1585
|
-
privateState: Record<PlayerIdOfTable<Table>, PrivateState>;
|
|
1586
|
-
hiddenState: HiddenState;
|
|
1587
|
-
flow: FlowState<PhaseName, PlayerIdOfTable<Table>>;
|
|
1588
|
-
phase: PhaseState & PhaseAccessor<PhaseStates>;
|
|
1589
|
-
};
|
|
1590
|
-
type ReducerSessionState<State extends {
|
|
1591
|
-
table: RuntimeTableRecord;
|
|
1592
|
-
flow: {
|
|
1593
|
-
currentPhase: string;
|
|
1594
|
-
};
|
|
1595
|
-
}, Setup extends RuntimeSetupSelection = RuntimeSetupSelection> = {
|
|
1596
|
-
domain: State;
|
|
1597
|
-
runtime: ReducerRuntimeStateForState<State, Setup>;
|
|
1598
|
-
};
|
|
1599
|
-
type ReducerValidationResult = {
|
|
1600
|
-
valid: true;
|
|
1601
|
-
} | {
|
|
1602
|
-
valid: false;
|
|
1603
|
-
errorCode: string;
|
|
1604
|
-
message?: string;
|
|
1605
|
-
};
|
|
1606
|
-
type ReducerReject = {
|
|
1607
|
-
type: "reject";
|
|
1608
|
-
errorCode: string;
|
|
1609
|
-
message?: string;
|
|
1610
|
-
};
|
|
1611
|
-
type TerminalOutcome<PlayerId extends string = string, Score extends number = number> = {
|
|
1612
|
-
winnerPlayerId?: PlayerId;
|
|
1613
|
-
finalScores?: Partial<Record<PlayerId, Score>>;
|
|
1614
|
-
reason: string;
|
|
1615
|
-
};
|
|
1616
|
-
type ReducerAccept<State> = {
|
|
1617
|
-
type: "accept";
|
|
1618
|
-
state: State;
|
|
1619
|
-
instructions?: RuntimeInstructionForState<State>[];
|
|
1620
|
-
terminal?: TerminalOutcome<PlayerIdOfState<State>>;
|
|
1621
|
-
};
|
|
1622
|
-
type ReducerResult<State> = ReducerAccept<State> | ReducerReject;
|
|
1623
|
-
|
|
1624
|
-
/**
|
|
1625
|
-
* State composition primitives.
|
|
1626
|
-
*
|
|
1627
|
-
* `pipe` threads a seed state through a sequence of `State -> State`
|
|
1628
|
-
* transformations, left to right. It is the preferred way to compose curried
|
|
1629
|
-
* writers (the `ops.*` namespace) in reducers:
|
|
1630
|
-
*
|
|
1631
|
-
* return accept(
|
|
1632
|
-
* pipe(state,
|
|
1633
|
-
* ops.spendPlayerResources({ playerId, resources: cost }),
|
|
1634
|
-
* ops.placePieceOnVertex({ boardId, vertexId, pieceId, ownerId: playerId }),
|
|
1635
|
-
* ),
|
|
1636
|
-
* );
|
|
1637
|
-
*/
|
|
1638
|
-
/**
|
|
1639
|
-
* A state-preserving transformation.
|
|
1640
|
-
*
|
|
1641
|
-
* `Op<State>` is polymorphic in the exact input subtype — given a state `S`
|
|
1642
|
-
* that extends `State`, it returns the same `S`. This lets curried writers
|
|
1643
|
-
* from `ops.*` and author-written helpers thread through phase-scoped `pipe`
|
|
1644
|
-
* calls without losing the narrowed phase state type.
|
|
1645
|
-
*/
|
|
1646
|
-
type Op<State> = <S extends State>(state: S) => S;
|
|
1647
|
-
declare function pipe<State>(state: State, ...ops: ReadonlyArray<Op<NoInfer<State>>>): State;
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* Curried state writers for use with `pipe`.
|
|
1651
|
-
*
|
|
1652
|
-
* Each entry in the returned `ops` namespace is a curried transformation
|
|
1653
|
-
* `(args) => (state) => state` that can be composed with `pipe`:
|
|
1654
|
-
*
|
|
1655
|
-
* const ops = createReducerOps<GameState>();
|
|
1656
|
-
*
|
|
1657
|
-
* return accept(
|
|
1658
|
-
* pipe(state,
|
|
1659
|
-
* ops.setActivePlayers([playerId]),
|
|
1660
|
-
* ops.moveCardFromPlayerZoneToSharedZone({
|
|
1661
|
-
* playerId,
|
|
1662
|
-
* fromZoneId: "things-hand",
|
|
1663
|
-
* toZoneId: "ring-1",
|
|
1664
|
-
* cardId: "a-dog",
|
|
1665
|
-
* }),
|
|
1666
|
-
* ),
|
|
1667
|
-
* );
|
|
1668
|
-
*
|
|
1669
|
-
* The factory binds all ops to a specific `State` type so that ID arguments
|
|
1670
|
-
* (deck ids, card ids, etc.) are checked against the manifest-derived table
|
|
1671
|
-
* shape of the game.
|
|
1672
|
-
*/
|
|
1673
|
-
|
|
1674
|
-
/**
|
|
1675
|
-
* Minimum shape required for any state targeted by reducer ops.
|
|
1676
|
-
*
|
|
1677
|
-
* All curried writers operate on a game state with a `table` field.
|
|
1678
|
-
*/
|
|
1679
|
-
type ReducerStateBase = {
|
|
1680
|
-
table: RuntimeTableRecord;
|
|
1681
|
-
};
|
|
1682
|
-
type PipeTable<State extends ReducerStateBase> = TableOfState<State>;
|
|
1683
|
-
/**
|
|
1684
|
-
* A shallow patch for a slice of state. Either a partial object to merge
|
|
1685
|
-
* over the previous value, or a functional updater `(prev) => next`.
|
|
1686
|
-
*/
|
|
1687
|
-
type StatePatch<T> = Partial<T> | ((prev: T) => T);
|
|
1688
|
-
/**
|
|
1689
|
-
* Curried writer namespace for a specific game state type.
|
|
1690
|
-
*
|
|
1691
|
-
* Created via {@link createReducerOps}.
|
|
1692
|
-
*/
|
|
1693
|
-
interface ReducerOps<State extends ReducerStateBase> {
|
|
1694
|
-
/** Set the list of players whose turn is currently active. */
|
|
1695
|
-
setActivePlayers(activePlayers: ReadonlyArray<PlayerIdOfState<State>>): Op<State>;
|
|
1696
|
-
/**
|
|
1697
|
-
* Advance `flow.activePlayers` to the single next seat in `playerOrder`.
|
|
1698
|
-
*
|
|
1699
|
-
* Uses `state.flow.activePlayers[0]` as the current seat (or the first
|
|
1700
|
-
* seat in `playerOrder` when `activePlayers` is empty) and sets
|
|
1701
|
-
* `activePlayers` to `[q.player.nextInOrder(current)]`. No-op when the
|
|
1702
|
-
* player order is empty.
|
|
1703
|
-
*/
|
|
1704
|
-
advanceActivePlayer(): Op<State>;
|
|
1705
|
-
/**
|
|
1706
|
-
* Update the current phase's local state.
|
|
1707
|
-
*
|
|
1708
|
-
* Accepts either a `Partial<PhaseState>` which is shallow-merged into the
|
|
1709
|
-
* previous value, or a functional updater `(prev) => next` which must
|
|
1710
|
-
* return a complete `PhaseState`.
|
|
1711
|
-
*/
|
|
1712
|
-
patchPhaseState(patch: StatePatch<PhaseStateOfState<State>>): Op<State>;
|
|
1713
|
-
/**
|
|
1714
|
-
* Update `state.publicState`.
|
|
1715
|
-
*
|
|
1716
|
-
* Accepts either a `Partial<PublicState>` which is shallow-merged into the
|
|
1717
|
-
* previous value, or a functional updater `(prev) => next` which must
|
|
1718
|
-
* return a complete `PublicState`.
|
|
1719
|
-
*/
|
|
1720
|
-
patchPublicState(patch: StatePatch<PublicStateOfState<State>>): Op<State>;
|
|
1721
|
-
/**
|
|
1722
|
-
* Update `state.hiddenState`.
|
|
1723
|
-
*
|
|
1724
|
-
* Accepts either a `Partial<HiddenState>` or a functional updater.
|
|
1725
|
-
*/
|
|
1726
|
-
patchHiddenState(patch: StatePatch<HiddenStateOfState<State>>): Op<State>;
|
|
1727
|
-
/**
|
|
1728
|
-
* Update a single player's entry in `state.privateState`.
|
|
1729
|
-
*
|
|
1730
|
-
* Accepts either a `Partial<PrivateState>` or a functional updater.
|
|
1731
|
-
*/
|
|
1732
|
-
patchPlayerPrivateState(args: {
|
|
1733
|
-
playerId: PlayerIdOfState<State>;
|
|
1734
|
-
patch: StatePatch<PrivateStateOfState<State>>;
|
|
1735
|
-
}): Op<State>;
|
|
1736
|
-
/**
|
|
1737
|
-
* Append a card to a shared zone (deck). Defaults to placing the card at the
|
|
1738
|
-
* bottom; pass `position: "top"` for top-of-deck placement (e.g. Bureaucrat-style).
|
|
1739
|
-
*/
|
|
1740
|
-
addCardToSharedZone<DeckId extends SharedZoneIdOfTable<PipeTable<State>>>(args: {
|
|
1741
|
-
deckId: DeckId;
|
|
1742
|
-
cardId: DeckCardsOfTable<PipeTable<State>, DeckId>[number];
|
|
1743
|
-
playedBy?: PlayerIdOfTable<PipeTable<State>> | null;
|
|
1744
|
-
position?: "top" | "bottom";
|
|
1745
|
-
}): Op<State>;
|
|
1746
|
-
/** Remove a card from a shared zone (deck). */
|
|
1747
|
-
removeCardFromSharedZone<DeckId extends DeckIdOfTable<PipeTable<State>>>(args: {
|
|
1748
|
-
deckId: DeckId;
|
|
1749
|
-
cardId: DeckCardsOfTable<PipeTable<State>, DeckId>[number];
|
|
1750
|
-
}): Op<State>;
|
|
1751
|
-
/**
|
|
1752
|
-
* Move a card between two shared zones (decks). Defaults to placing the card
|
|
1753
|
-
* at the bottom of the destination; pass `position: "top"` for top placement.
|
|
1754
|
-
*/
|
|
1755
|
-
moveCardBetweenSharedZones<FromZoneId extends SharedZoneIdOfTable<PipeTable<State>>, ToZoneId extends SharedZoneIdOfTable<PipeTable<State>>>(args: {
|
|
1756
|
-
fromZoneId: FromZoneId;
|
|
1757
|
-
toZoneId: ToZoneId;
|
|
1758
|
-
cardId: DeckCardsOfTable<PipeTable<State>, FromZoneId>[number];
|
|
1759
|
-
playedBy?: PlayerIdOfTable<PipeTable<State>> | null;
|
|
1760
|
-
position?: "top" | "bottom";
|
|
1761
|
-
}): Op<State>;
|
|
1762
|
-
/**
|
|
1763
|
-
* Draw the top `count` cards from one perPlayer zone into another for the
|
|
1764
|
-
* same player (e.g. deck → hand at the start of a turn). Companion to
|
|
1765
|
-
* {@link dealCardsToPlayerZone} for the perPlayer → perPlayer case. Stops
|
|
1766
|
-
* silently if the source runs out before `count` is reached.
|
|
1767
|
-
*/
|
|
1768
|
-
dealCardsBetweenPlayerZones<FromZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, ToZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, PlayerId extends PlayerIdOfTable<PipeTable<State>>>(args: {
|
|
1769
|
-
playerId: PlayerId;
|
|
1770
|
-
fromZoneId: FromZoneId;
|
|
1771
|
-
toZoneId: ToZoneId;
|
|
1772
|
-
count: number;
|
|
1773
|
-
}): Op<State>;
|
|
1774
|
-
/**
|
|
1775
|
-
* Move a card between two perPlayer zones owned by the same player (e.g.
|
|
1776
|
-
* hand → in-play → discard). Owner is preserved; visibility is recomputed
|
|
1777
|
-
* from the destination zone.
|
|
1778
|
-
*/
|
|
1779
|
-
moveCardBetweenPlayerZones<FromZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, ToZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, PlayerId extends PlayerIdOfTable<PipeTable<State>>>(args: {
|
|
1780
|
-
playerId: PlayerId;
|
|
1781
|
-
fromZoneId: FromZoneId;
|
|
1782
|
-
toZoneId: ToZoneId;
|
|
1783
|
-
cardId: CompatibleCardIdForTwoPlayerZones<PipeTable<State>, FromZoneId, ToZoneId>;
|
|
1784
|
-
position?: "top" | "bottom";
|
|
1785
|
-
}): Op<State>;
|
|
1786
|
-
/**
|
|
1787
|
-
* Move a card from a player zone (hand) to a shared zone (deck). Defaults to
|
|
1788
|
-
* placing the card at the bottom; pass `position: "top"` to topdeck.
|
|
1789
|
-
*/
|
|
1790
|
-
moveCardFromPlayerZoneToSharedZone<FromZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, ToZoneId extends SharedZoneIdOfTable<PipeTable<State>>, PlayerId extends PlayerIdOfTable<PipeTable<State>>>(args: {
|
|
1791
|
-
playerId: PlayerId;
|
|
1792
|
-
fromZoneId: FromZoneId;
|
|
1793
|
-
toZoneId: ToZoneId;
|
|
1794
|
-
cardId: CompatibleCardIdForHandAndDeck<PipeTable<State>, FromZoneId, ToZoneId>;
|
|
1795
|
-
playedBy?: PlayerIdOfTable<PipeTable<State>> | null;
|
|
1796
|
-
position?: "top" | "bottom";
|
|
1797
|
-
}): Op<State>;
|
|
1798
|
-
/**
|
|
1799
|
-
* Move a named card from a shared zone (supply pile, deck) to a perPlayer
|
|
1800
|
-
* zone (e.g. discard). The "gain" verb in deck-builders. Distinct from
|
|
1801
|
-
* {@link dealCardsToPlayerZone}, which draws unspecified top-N cards from a
|
|
1802
|
-
* deck. Owner flips to the receiving player; visibility is recomputed.
|
|
1803
|
-
*/
|
|
1804
|
-
moveCardFromSharedZoneToPlayerZone<FromZoneId extends SharedZoneIdOfTable<PipeTable<State>>, ToZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, PlayerId extends PlayerIdOfTable<PipeTable<State>>>(args: {
|
|
1805
|
-
playerId: PlayerId;
|
|
1806
|
-
fromZoneId: FromZoneId;
|
|
1807
|
-
toZoneId: ToZoneId;
|
|
1808
|
-
cardId: CompatibleCardIdForHandAndDeck<PipeTable<State>, ToZoneId, FromZoneId>;
|
|
1809
|
-
position?: "top" | "bottom";
|
|
1810
|
-
}): Op<State>;
|
|
1811
|
-
/**
|
|
1812
|
-
* Deal the top `count` cards from a shared deck into a player's hand zone.
|
|
1813
|
-
*
|
|
1814
|
-
* This op does not consume RNG. If the deck needs to be random, shuffle it
|
|
1815
|
-
* first with `fx.shuffleSharedZone(...)`, then deal from the shuffled deck
|
|
1816
|
-
* inside the same reducer via this op.
|
|
1817
|
-
*/
|
|
1818
|
-
dealCardsToPlayerZone<FromZoneId extends DeckIdOfTable<PipeTable<State>>, PlayerId extends PlayerIdOfTable<PipeTable<State>>, ToZoneId extends CompatibleHandIdForDeck<PipeTable<State>, FromZoneId> & HandIdOfTable<PipeTable<State>>>(args: {
|
|
1819
|
-
fromZoneId: FromZoneId;
|
|
1820
|
-
playerId: PlayerId;
|
|
1821
|
-
toZoneId: ToZoneId;
|
|
1822
|
-
count: number;
|
|
1823
|
-
}): Op<State>;
|
|
1824
|
-
/**
|
|
1825
|
-
* Atomically rotate cards in a per-player zone around the table.
|
|
1826
|
-
*
|
|
1827
|
-
* Defaults to rotating every card currently in `zoneId` for every player in
|
|
1828
|
-
* turn order. Pass `players` to use a smaller explicit order, or
|
|
1829
|
-
* `cardIdsByPlayer` to rotate only selected cards such as Hearts passes.
|
|
1830
|
-
*/
|
|
1831
|
-
rotatePlayerZone<ZoneId extends PlayerZoneIdOfTable<PipeTable<State>>, PlayerId extends PlayerIdOfTable<PipeTable<State>>>(args: {
|
|
1832
|
-
zoneId: ZoneId;
|
|
1833
|
-
direction: "left" | "right";
|
|
1834
|
-
players?: readonly PlayerId[];
|
|
1835
|
-
cardIdsByPlayer?: Partial<Record<PlayerId, readonly CardIdOfTable<PipeTable<State>>[]>>;
|
|
1836
|
-
position?: "top" | "bottom";
|
|
1837
|
-
}): Op<State>;
|
|
1838
|
-
/** Move a component onto a board space. */
|
|
1839
|
-
moveComponentToSpace<BoardId extends BoardIdOfTable<PipeTable<State>>, SpaceId extends SpaceIdOfTable<PipeTable<State>, BoardId>, ComponentId extends ComponentIdOfTable<PipeTable<State>>>(args: {
|
|
1840
|
-
componentId: ComponentId;
|
|
1841
|
-
boardId: BoardId;
|
|
1842
|
-
spaceId: SpaceId;
|
|
1843
|
-
}): Op<State>;
|
|
1844
|
-
/** Move a component into a board container. */
|
|
1845
|
-
moveComponentToContainer<BoardId extends BoardIdOfTable<PipeTable<State>>, ContainerId extends BoardContainerIdOfTable<PipeTable<State>, BoardId>, ComponentId extends ComponentIdOfTable<PipeTable<State>>>(args: {
|
|
1846
|
-
componentId: ComponentId;
|
|
1847
|
-
boardId: BoardId;
|
|
1848
|
-
containerId: ContainerId;
|
|
1849
|
-
}): Op<State>;
|
|
1850
|
-
/** Move a component onto a tiled board edge. */
|
|
1851
|
-
moveComponentToEdge<BoardId extends TiledBoardIdOfTable<PipeTable<State>>, EdgeId extends TiledEdgeIdOfTable<PipeTable<State>, BoardId>, ComponentId extends ComponentIdOfTable<PipeTable<State>>>(args: {
|
|
1852
|
-
componentId: ComponentId;
|
|
1853
|
-
boardId: BoardId;
|
|
1854
|
-
edgeId: EdgeId;
|
|
1855
|
-
}): Op<State>;
|
|
1856
|
-
/** Move a component onto a tiled board vertex. */
|
|
1857
|
-
moveComponentToVertex<BoardId extends TiledBoardIdOfTable<PipeTable<State>>, VertexId extends TiledVertexIdOfTable<PipeTable<State>, BoardId>, ComponentId extends ComponentIdOfTable<PipeTable<State>>>(args: {
|
|
1858
|
-
componentId: ComponentId;
|
|
1859
|
-
boardId: BoardId;
|
|
1860
|
-
vertexId: VertexId;
|
|
1861
|
-
}): Op<State>;
|
|
1862
|
-
/** Move a component back to the detached pool. */
|
|
1863
|
-
moveComponentToDetached<ComponentId extends ComponentIdOfTable<PipeTable<State>>>(args: {
|
|
1864
|
-
componentId: ComponentId;
|
|
1865
|
-
}): Op<State>;
|
|
1866
|
-
/**
|
|
1867
|
-
* Credit the specified resources to a player.
|
|
1868
|
-
*
|
|
1869
|
-
* Amounts must be non-negative; use {@link spendResources} for deductions
|
|
1870
|
-
* so that affordability is checked explicitly.
|
|
1871
|
-
*
|
|
1872
|
-
* pipe(
|
|
1873
|
-
* state,
|
|
1874
|
-
* ops.addResources({ playerId, amounts: { wood: 1, brick: 1 } }),
|
|
1875
|
-
* )
|
|
1876
|
-
*/
|
|
1877
|
-
addResources(args: {
|
|
1878
|
-
playerId: PlayerIdOfTable<PipeTable<State>>;
|
|
1879
|
-
amounts: ResourceAmountsOfTable<PipeTable<State>>;
|
|
1880
|
-
}): Op<State>;
|
|
1881
|
-
/**
|
|
1882
|
-
* Debit the specified resources from a player.
|
|
1883
|
-
*
|
|
1884
|
-
* Throws when the player cannot afford the full cost — gate with
|
|
1885
|
-
* `q.player.canAfford(...)` in your `validate` step before invoking.
|
|
1886
|
-
*
|
|
1887
|
-
* pipe(
|
|
1888
|
-
* state,
|
|
1889
|
-
* ops.spendResources({ playerId, amounts: COST_DEV_CARD }),
|
|
1890
|
-
* ops.dealCardsToPlayerZone({ ... }),
|
|
1891
|
-
* )
|
|
1892
|
-
*/
|
|
1893
|
-
spendResources(args: {
|
|
1894
|
-
playerId: PlayerIdOfTable<PipeTable<State>>;
|
|
1895
|
-
amounts: ResourceAmountsOfTable<PipeTable<State>>;
|
|
1896
|
-
}): Op<State>;
|
|
1897
|
-
/**
|
|
1898
|
-
* Transfer the specified resources from one player to another.
|
|
1899
|
-
*
|
|
1900
|
-
* Throws when the source cannot afford the full amount. On success the
|
|
1901
|
-
* destination gains exactly what the source loses.
|
|
1902
|
-
*/
|
|
1903
|
-
transferResources(args: {
|
|
1904
|
-
fromPlayerId: PlayerIdOfTable<PipeTable<State>>;
|
|
1905
|
-
toPlayerId: PlayerIdOfTable<PipeTable<State>>;
|
|
1906
|
-
amounts: ResourceAmountsOfTable<PipeTable<State>>;
|
|
1907
|
-
}): Op<State>;
|
|
1908
|
-
/**
|
|
1909
|
-
* Overwrite a single resource balance for a player. Prefer
|
|
1910
|
-
* {@link addResources} / {@link spendResources} — use this only when the
|
|
1911
|
-
* new balance is an absolute (e.g. scripted setup).
|
|
1912
|
-
*/
|
|
1913
|
-
setResource(args: {
|
|
1914
|
-
playerId: PlayerIdOfTable<PipeTable<State>>;
|
|
1915
|
-
resourceId: ResourceIdOfTable<PipeTable<State>>;
|
|
1916
|
-
amount: number;
|
|
1917
|
-
}): Op<State>;
|
|
1918
|
-
}
|
|
1919
|
-
/**
|
|
1920
|
-
* Create the `ops.*` namespace specialised to a game state.
|
|
1921
|
-
*
|
|
1922
|
-
* Call this once (typically in a shared reducer-support module) and reuse the
|
|
1923
|
-
* resulting object across phases:
|
|
1924
|
-
*
|
|
1925
|
-
* export const ops = createReducerOps<GameState>();
|
|
1926
|
-
*/
|
|
1927
|
-
declare function createReducerOps<State extends ReducerStateBase>(): ReducerOps<State>;
|
|
1928
|
-
|
|
1929
|
-
type RotatePlayerZoneArgs<State extends {
|
|
1930
|
-
table: RuntimeTableRecord;
|
|
1931
|
-
}, ZoneId extends PlayerZoneIdOfTable<TableOfState<State>> = PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>> = PlayerIdOfTable<TableOfState<State>>> = {
|
|
1932
|
-
zoneId: ZoneId;
|
|
1933
|
-
direction: "left" | "right";
|
|
1934
|
-
players?: readonly PlayerId[];
|
|
1935
|
-
cardIdsByPlayer?: Partial<Record<PlayerId, readonly CardIdOfTable<TableOfState<State>>[]>>;
|
|
1936
|
-
position?: "top" | "bottom";
|
|
1937
|
-
};
|
|
1938
|
-
type TransactionMethods<State extends {
|
|
1939
|
-
table: RuntimeTableRecord;
|
|
1940
|
-
}> = {
|
|
1941
|
-
[Key in Exclude<keyof ReducerOps<State>, "moveComponentToSpace">]: ReducerOps<State>[Key] extends (...args: infer Args) => Op<State> ? (...args: Args) => State : never;
|
|
1942
|
-
} & {
|
|
1943
|
-
moveComponentToSpace<BoardId extends BoardIdOfTable<TableOfState<State>>, SpaceId extends SpaceIdOfTable<TableOfState<State>, BoardId>, ComponentId extends ComponentIdOfTable<TableOfState<State>>>(args: {
|
|
1944
|
-
componentId: ComponentId;
|
|
1945
|
-
boardId: BoardId;
|
|
1946
|
-
spaceId: SpaceId;
|
|
1947
|
-
}): State;
|
|
1948
|
-
};
|
|
1949
|
-
type ReducerTransaction<State extends {
|
|
1950
|
-
table: RuntimeTableRecord;
|
|
1951
|
-
}> = TransactionMethods<State> & {
|
|
1952
|
-
readonly state: State;
|
|
1953
|
-
readonly q: TableQueriesOfState<State>;
|
|
1954
|
-
apply(op: Op<State>): State;
|
|
1955
|
-
rotatePlayerZone<ZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>>(args: RotatePlayerZoneArgs<State, ZoneId, PlayerId>): State;
|
|
1956
|
-
};
|
|
1957
|
-
type ReducerEdit<State extends {
|
|
1958
|
-
table: RuntimeTableRecord;
|
|
1959
|
-
}> = <DraftState extends State>(state: DraftState) => ReducerTransaction<DraftState>;
|
|
1960
|
-
declare function createReducerTransaction<State extends {
|
|
1961
|
-
table: RuntimeTableRecord;
|
|
1962
|
-
}>(initialState: State, ops?: ReducerOps<State>): ReducerTransaction<State>;
|
|
1963
|
-
declare function createReducerEdit<State extends {
|
|
1964
|
-
table: RuntimeTableRecord;
|
|
1965
|
-
}>(ops?: ReducerOps<State>): ReducerEdit<State>;
|
|
1966
|
-
|
|
1967
|
-
type ReducerGameContract<Table extends RuntimeTableRecord, Manifest extends ReducerManifestContract<Table, string, string, string, string, string>, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, Phases extends Record<string, SchemaLike<object>>, Errors extends Record<string, string> | undefined = undefined> = {
|
|
1968
|
-
manifest: Manifest;
|
|
1969
|
-
state: StateDefinition<PublicSchema, PrivateSchema, HiddenSchema>;
|
|
1970
|
-
phases: Phases;
|
|
1971
|
-
errors?: Errors;
|
|
1972
|
-
/** Derived from `phases`; retained as an internal runtime convenience. */
|
|
1973
|
-
phaseNames: readonly string[];
|
|
1974
|
-
};
|
|
1975
|
-
type ReducerStateForConfig<Table extends RuntimeTableRecord, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, PhaseName extends string> = ReducerGameState<Table, z.infer<PublicSchema>, z.infer<PrivateSchema>, z.infer<HiddenSchema>, RuntimePhaseState, PhaseName, Record<PhaseName, RuntimePhaseState>>;
|
|
1976
|
-
type ReducerSessionForConfig<Table extends RuntimeTableRecord, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, PhaseName extends string, Setup extends RuntimeSetupSelection = RuntimeSetupSelection> = ReducerSessionState<ReducerStateForConfig<Table, PublicSchema, PrivateSchema, HiddenSchema, PhaseName>, Setup>;
|
|
1977
|
-
type BaseGameStateOfContract<Contract> = ReducerGameState<TableOfManifest<ManifestContractOf<Contract>>, z.infer<PublicSchemaOfContract<Contract>>, z.infer<PrivateSchemaOfContract<Contract>>, z.infer<HiddenSchemaOfContract<Contract>>, PhaseStateMapOfContract<Contract>[PhaseNameOfContract<Contract>], PhaseNameOfContract<Contract>, PhaseStateMapOfContract<Contract>>;
|
|
1978
|
-
type BaseGameSessionOfContract<Contract> = ReducerSessionState<BaseGameStateOfContract<Contract>, RuntimeSetupSelection<ManifestContractOf<Contract>>>;
|
|
1979
|
-
/**
|
|
1980
|
-
* Heterogeneous phase map for a contract. Each phase carries its own local
|
|
1981
|
-
* `PhaseStateSchema` plus authoring-time Actions/Flows/Interactions/
|
|
1982
|
-
* Stages/Zones maps. The registries are bound to the contract's base state +
|
|
1983
|
-
* manifest so the runtime can iterate them through a single index type
|
|
1984
|
-
* without reaching for `any`.
|
|
1985
|
-
*/
|
|
1986
|
-
type PhaseMapOf<Contract> = {
|
|
1987
|
-
[Name in PhaseNameOfContract<Contract>]: PhaseDefinition<SchemaLike<object>, BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>, Record<string, InputCollector>, EffectMap<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>>, InteractionMap<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>>, StageMap<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>>, PhaseZoneList<ManifestContractOf<Contract>>, CardActionMap<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>>>;
|
|
1988
|
-
};
|
|
1989
|
-
type AnyPhaseDefinitionForContract<Contract> = PhaseMapOf<Contract>[PhaseNameOfContract<Contract>];
|
|
1990
|
-
/**
|
|
1991
|
-
* Helpers below accept heterogeneous phase maps (each phase binds its own
|
|
1992
|
-
* `PhaseStateSchema` + per-phase registries). TypeScript requires the
|
|
1993
|
-
* constraint to use a shape compatible with contract-bound state types in a
|
|
1994
|
-
* contravariant `initialState` position, so we erase the registry-bound
|
|
1995
|
-
* state/manifest generics with `any`. The only purpose of the constraint is
|
|
1996
|
-
* to guarantee `Definitions[Name]` is a `PhaseDefinition` so the `extends`
|
|
1997
|
-
* check below can infer `PhaseStateSchema`.
|
|
1998
|
-
*/
|
|
1999
|
-
type PhaseStateMapOfDefinitions<Definitions extends Record<string, PhaseDefinition<SchemaLike<object>, any, any, Record<string, InputCollector>, EffectMap<any, any>, InteractionMap<any, any>, StageMap<any, any>, PhaseZoneList<any>, CardActionMap<any, any>>>> = Partial<{
|
|
2000
|
-
[Name in keyof Definitions & string]: Definitions[Name] extends {
|
|
2001
|
-
state: infer PhaseStateSchema extends SchemaLike<object>;
|
|
2002
|
-
} ? z.infer<PhaseStateSchema> : never;
|
|
2003
|
-
}>;
|
|
2004
|
-
type PhaseStateOfDefinitions<Definitions extends Record<string, PhaseDefinition<SchemaLike<object>, any, any, Record<string, InputCollector>, EffectMap<any, any>, InteractionMap<any, any>, StageMap<any, any>, PhaseZoneList<any>, CardActionMap<any, any>>>> = {
|
|
2005
|
-
[Name in keyof Definitions & string]: Definitions[Name] extends {
|
|
2006
|
-
state: infer PhaseStateSchema extends SchemaLike<object>;
|
|
2007
|
-
} ? z.infer<PhaseStateSchema> : never;
|
|
2008
|
-
}[keyof Definitions & string];
|
|
2009
|
-
type ResolvedGameStateOf<Contract, Definitions extends PhaseMapOf<Contract>> = {
|
|
2010
|
-
[Name in keyof Definitions & string]: ReducerGameState<TableOfManifest<ManifestContractOf<Contract>>, z.infer<PublicSchemaOfContract<Contract>>, z.infer<PrivateSchemaOfContract<Contract>>, z.infer<HiddenSchemaOfContract<Contract>>, Definitions[Name] extends {
|
|
2011
|
-
state: infer PhaseStateSchema extends SchemaLike<object>;
|
|
2012
|
-
} ? z.infer<PhaseStateSchema> : never, PhaseNameOfContract<Contract>> & {
|
|
2013
|
-
flow: ReducerGameState<TableOfManifest<ManifestContractOf<Contract>>, z.infer<PublicSchemaOfContract<Contract>>, z.infer<PrivateSchemaOfContract<Contract>>, z.infer<HiddenSchemaOfContract<Contract>>, PhaseStateOfDefinitions<Definitions>, PhaseNameOfContract<Contract>>["flow"] & {
|
|
2014
|
-
currentPhase: Name;
|
|
2015
|
-
};
|
|
2016
|
-
};
|
|
2017
|
-
}[keyof Definitions & string];
|
|
2018
|
-
type ResolvedGameSessionOf<Contract, Definitions extends PhaseMapOf<Contract>> = ReducerSessionState<ResolvedGameStateOf<Contract, Definitions>, RuntimeSetupSelection<ManifestContractOf<Contract>>>;
|
|
2019
|
-
type ViewMapOf<Contract> = Record<string, ViewDefinition<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>, unknown>>;
|
|
2020
|
-
type PhasesOfDefinition<Definition> = Definition extends {
|
|
2021
|
-
phases: infer Definitions extends Record<string, unknown>;
|
|
2022
|
-
} ? Definitions : never;
|
|
2023
|
-
type ViewsOfDefinition<Definition> = Definition extends {
|
|
2024
|
-
views?: infer Views;
|
|
2025
|
-
} ? NonNullable<Views> : never;
|
|
2026
|
-
type NonNeverKeys<Registry> = {
|
|
2027
|
-
[Key in keyof Registry]-?: [Registry[Key]] extends [never] ? never : Key;
|
|
2028
|
-
}[keyof Registry];
|
|
2029
|
-
type ViewNamesOfDefinition<Definition> = NonNeverKeys<ViewsOfDefinition<Definition>> & string;
|
|
2030
|
-
type ViewDefinitionByName<Definition, ViewName extends ViewNamesOfDefinition<Definition>> = ViewsOfDefinition<Definition>[ViewName];
|
|
2031
|
-
type ViewOfDefinition<Definition, ViewName extends ViewNamesOfDefinition<Definition>> = ViewDefinitionByName<Definition, ViewName> extends {
|
|
2032
|
-
project: (...args: never[]) => infer Projection;
|
|
2033
|
-
} ? Projection : never;
|
|
2034
|
-
type PhaseNamesOfDefinition<Definition> = keyof PhasesOfDefinition<Definition> & string;
|
|
2035
|
-
type PhaseDefinitionByName<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseName extends keyof PhasesOfDefinition<Definition> & string ? PhasesOfDefinition<Definition>[PhaseName] : never;
|
|
2036
|
-
type EffectsOfDefinition<Definition> = PhasesOfDefinition<Definition>[keyof PhasesOfDefinition<Definition> & string] extends {
|
|
2037
|
-
effects?: infer Effects;
|
|
2038
|
-
} ? Effects extends Record<string, unknown> ? Effects[keyof Effects & string] : never : never;
|
|
2039
|
-
type EffectIdsOfDefinition<Definition> = EffectsOfDefinition<Definition> extends infer Effect ? Effect extends {
|
|
2040
|
-
id: infer Id;
|
|
2041
|
-
} ? Extract<Id, string> : never : never;
|
|
2042
|
-
type GameStateOf<Source> = Source extends {
|
|
2043
|
-
contract: infer Contract extends ReducerGameContractLike;
|
|
2044
|
-
phases: infer Definitions;
|
|
2045
|
-
} ? Definitions extends PhaseMapOf<Contract> ? ResolvedGameStateOf<Contract, Definitions> : never : Source extends ReducerGameContract<any, any, any, any, any, any, any> ? BaseGameStateOfContract<Source> : never;
|
|
2046
|
-
/**
|
|
2047
|
-
* Public structural upper bound for a reducer game contract.
|
|
2048
|
-
*
|
|
2049
|
-
* The `manifest` slot is intentionally erased with `any` because concrete
|
|
2050
|
-
* manifests bind per-contract branded literals (e.g. `PlayerId` unions with
|
|
2051
|
-
* specific string literals). Using a ground `ManifestContract<...>` type
|
|
2052
|
-
* here would prevent assignability from contract-bound manifests in a
|
|
2053
|
-
* contravariant position.
|
|
2054
|
-
*/
|
|
2055
|
-
type ReducerGameContractLike = {
|
|
2056
|
-
manifest: any;
|
|
2057
|
-
state: StateDefinition<SchemaLike<object>, SchemaLike<object>, SchemaLike<object>>;
|
|
2058
|
-
};
|
|
2059
|
-
type InitialStateContextOf<Contract extends ReducerGameContractLike> = InitContext<TableOfManifest<ManifestOf<Contract>>, ExactManifestContractOf<Contract>>;
|
|
2060
|
-
type InitialStateCallbacks<Contract extends ReducerGameContractLike> = {
|
|
2061
|
-
public?: (ctx: InitialStateContextOf<Contract>) => z.infer<PublicSchemaOfContract<Contract>>;
|
|
2062
|
-
private?: (ctx: InitialStateContextOf<Contract> & {
|
|
2063
|
-
playerId: PlayerIdOfTable<TableOfManifest<ManifestOf<Contract>>>;
|
|
2064
|
-
}) => z.infer<PrivateSchemaOfContract<Contract>>;
|
|
2065
|
-
hidden?: (ctx: InitialStateContextOf<Contract>) => z.infer<HiddenSchemaOfContract<Contract>>;
|
|
2066
|
-
};
|
|
2067
|
-
type ReducerGameDefinition<Contract extends ReducerGameContractLike, Definitions extends PhaseMapOf<Contract>, Views extends ViewMapOf<Contract> = Record<string, never>> = {
|
|
2068
|
-
contract: Contract;
|
|
2069
|
-
initial?: InitialStateCallbacks<NoInfer<Contract>>;
|
|
2070
|
-
initialPhase?: keyof Definitions & string;
|
|
2071
|
-
setupProfiles?: Record<string, SetupProfileDefinition<keyof Definitions & string, ExactManifestContractOf<Contract>>>;
|
|
2072
|
-
phases: Definitions;
|
|
2073
|
-
views?: Views;
|
|
2074
|
-
/**
|
|
2075
|
-
* Optional session-scoped static projection. Authored via
|
|
2076
|
-
* {@link StaticViewDefinition}; computed once per reducer session from the
|
|
2077
|
-
* manifest + setup profile and cached by the host. The client merges the
|
|
2078
|
-
* cached payload into every seat view, so the per-tick `projectSeatsDynamic`
|
|
2079
|
-
* call no longer needs to re-serialize static board topology.
|
|
2080
|
-
*/
|
|
2081
|
-
staticView?: StaticViewDefinition<ExactManifestContractOf<NoInfer<Contract>>, unknown>;
|
|
2082
|
-
};
|
|
2083
|
-
type AnyReducerGameDefinition = ReducerGameDefinition<ReducerGameContractLike, PhaseMapOf<ReducerGameContractLike>, ViewMapOf<ReducerGameContractLike>>;
|
|
2084
|
-
type InteractionRegistriesOfDefinition<Definition> = PhasesOfDefinition<Definition>[keyof PhasesOfDefinition<Definition> & string] extends {
|
|
2085
|
-
interactions?: infer Interactions;
|
|
2086
|
-
} ? NonNullable<Interactions> : never;
|
|
2087
|
-
type SimultaneousSubmitRegistriesOfDefinition<Definition> = PhasesOfDefinition<Definition>[keyof PhasesOfDefinition<Definition> & string] extends {
|
|
2088
|
-
submit?: infer Submit;
|
|
2089
|
-
} ? {
|
|
2090
|
-
submit: NonNullable<Submit>;
|
|
2091
|
-
} : never;
|
|
2092
|
-
type CardActionRegistriesOfDefinition<Definition> = PhasesOfDefinition<Definition>[keyof PhasesOfDefinition<Definition> & string] extends {
|
|
2093
|
-
cardActions?: infer CardActions;
|
|
2094
|
-
} ? NonNullable<CardActions> : never;
|
|
2095
|
-
type InteractionIdOfDefinition<Definition> = InteractionRegistriesOfDefinition<Definition> extends infer Interactions ? SimultaneousSubmitRegistriesOfDefinition<Definition> extends infer Submit ? CardActionRegistriesOfDefinition<Definition> extends infer CardActions ? Interactions extends Record<string, unknown> ? CardActions extends Record<string, unknown> ? Submit extends Record<string, unknown> ? (NonNeverKeys<Interactions> & string) | (NonNeverKeys<CardActions> & string) | (NonNeverKeys<Submit> & string) : (NonNeverKeys<Interactions> & string) | (NonNeverKeys<CardActions> & string) : Submit extends Record<string, unknown> ? (NonNeverKeys<Interactions> & string) | (NonNeverKeys<Submit> & string) : NonNeverKeys<Interactions> & string : CardActions extends Record<string, unknown> ? Submit extends Record<string, unknown> ? (NonNeverKeys<CardActions> & string) | (NonNeverKeys<Submit> & string) : NonNeverKeys<CardActions> & string : Submit extends Record<string, unknown> ? NonNeverKeys<Submit> & string : never : never : never : never;
|
|
2096
|
-
type InteractionRegistryOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
|
|
2097
|
-
interactions?: infer Interactions;
|
|
2098
|
-
} ? NonNullable<Interactions> : Record<string, never>;
|
|
2099
|
-
type SimultaneousSubmitRegistryOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
|
|
2100
|
-
submit?: infer Submit;
|
|
2101
|
-
} ? {
|
|
2102
|
-
submit: NonNullable<Submit>;
|
|
2103
|
-
} : Record<string, never>;
|
|
2104
|
-
type CardActionRegistryOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
|
|
2105
|
-
cardActions?: infer CardActions;
|
|
2106
|
-
} ? NonNullable<CardActions> : Record<string, never>;
|
|
2107
|
-
type NonNeverRegistryValue<Registry, Key extends string> = Registry extends Record<string, unknown> ? Key extends keyof Registry ? [Registry[Key]] extends [never] ? never : Registry[Key] : never : never;
|
|
2108
|
-
type InteractionIdOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = InteractionRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Interactions ? SimultaneousSubmitRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Submit ? CardActionRegistryOfDefinitionPhase<Definition, PhaseName> extends infer CardActions ? Interactions extends Record<string, unknown> ? CardActions extends Record<string, unknown> ? Submit extends Record<string, unknown> ? (NonNeverKeys<Interactions> & string) | (NonNeverKeys<CardActions> & string) | (NonNeverKeys<Submit> & string) : (NonNeverKeys<Interactions> & string) | (NonNeverKeys<CardActions> & string) : Submit extends Record<string, unknown> ? (NonNeverKeys<Interactions> & string) | (NonNeverKeys<Submit> & string) : NonNeverKeys<Interactions> & string : CardActions extends Record<string, unknown> ? Submit extends Record<string, unknown> ? (NonNeverKeys<CardActions> & string) | (NonNeverKeys<Submit> & string) : NonNeverKeys<CardActions> & string : Submit extends Record<string, unknown> ? NonNeverKeys<Submit> & string : never : never : never : never;
|
|
2109
|
-
type InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>> = InteractionRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Interactions ? Interactions extends Record<string, unknown> ? NonNeverRegistryValue<Interactions, InteractionId> extends infer InteractionSpec ? [InteractionSpec] extends [never] ? CardActionRegistryOfDefinitionPhase<Definition, PhaseName> extends infer CardActions ? NonNeverRegistryValue<CardActions, InteractionId> extends infer CardActionSpec ? [CardActionSpec] extends [never] ? SimultaneousSubmitRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Submit ? NonNeverRegistryValue<Submit, InteractionId> : never : CardActionSpec : never : never : InteractionSpec : never : never : never;
|
|
2110
|
-
type CollectorKindsOf<Collectors> = Collectors extends Record<string, InputCollector> ? Collectors[keyof Collectors] extends infer Collector ? Collector extends {
|
|
2111
|
-
kind: infer Kind extends string;
|
|
2112
|
-
} ? Kind : never : never : never;
|
|
2113
|
-
type CollectorKeysWithKind<Collectors, Kind extends string> = Collectors extends Record<string, InputCollector> ? {
|
|
2114
|
-
[K in keyof Collectors]: Collectors[K] extends {
|
|
2115
|
-
kind: infer CollectorKind;
|
|
2116
|
-
} ? Extract<CollectorKind, Kind> extends never ? never : K : never;
|
|
2117
|
-
}[keyof Collectors] : never;
|
|
2118
|
-
type CardCollectorZoneIds<Collector> = Collector extends {
|
|
2119
|
-
kind: "card";
|
|
2120
|
-
meta: infer Meta;
|
|
2121
|
-
} ? Meta extends {
|
|
2122
|
-
readonly zoneIds: infer ZoneIds extends readonly string[];
|
|
2123
|
-
} ? ZoneIds[number] : Meta extends {
|
|
2124
|
-
readonly zoneId: infer ZoneId extends string;
|
|
2125
|
-
} ? ZoneId : never : never;
|
|
2126
|
-
type CollectorCardZoneIds<Collectors, Input extends string> = Collectors extends Record<string, InputCollector> ? Input extends keyof Collectors ? CardCollectorZoneIds<Collectors[Input]> : never : never;
|
|
2127
|
-
type CollectorsOfInteractionDefinition<Spec> = Spec extends {
|
|
2128
|
-
readonly inputs?: infer Collectors;
|
|
2129
|
-
} ? NonNullable<Collectors> extends Record<string, InputCollector> ? NonNullable<Collectors> : Record<string, never> : Record<string, never>;
|
|
2130
|
-
type CollectorKindsOfInteractionDefinition<Spec> = (Spec extends {
|
|
2131
|
-
readonly cardType: unknown;
|
|
2132
|
-
readonly playFrom: unknown;
|
|
2133
|
-
} ? "card" : never) | CollectorKindsOf<CollectorsOfInteractionDefinition<Spec>>;
|
|
2134
|
-
type InputKeysWithCollectorKindOfInteractionDefinition<Spec, Kind extends string> = (Spec extends {
|
|
2135
|
-
readonly cardType: unknown;
|
|
2136
|
-
readonly playFrom: unknown;
|
|
2137
|
-
} ? Extract<"card", Kind> extends never ? never : "cardId" : never) | (CollectorKeysWithKind<CollectorsOfInteractionDefinition<Spec>, Kind> & string);
|
|
2138
|
-
type CardInputZoneIdsOfInteractionDefinition<Spec, Input extends string> = Input extends "cardId" ? Spec extends {
|
|
2139
|
-
readonly playFrom: infer PlayFrom extends string;
|
|
2140
|
-
} ? PlayFrom : CollectorCardZoneIds<CollectorsOfInteractionDefinition<Spec>, Input> : CollectorCardZoneIds<CollectorsOfInteractionDefinition<Spec>, Input>;
|
|
2141
|
-
type ParamsOfCollectors<Collectors> = Collectors extends Record<string, InputCollector> ? {
|
|
2142
|
-
[K in keyof Collectors]: Collectors[K] extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
|
|
2143
|
-
} : never;
|
|
2144
|
-
type ClientParamsOfCollectors<Collectors> = Collectors extends Record<string, InputCollector> ? {
|
|
2145
|
-
[K in keyof Collectors as Collectors[K] extends {
|
|
2146
|
-
readonly kind: "rng";
|
|
2147
|
-
} ? never : K]: Collectors[K] extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
|
|
2148
|
-
} : never;
|
|
2149
|
-
type InteractionIdsWithCollectorKindOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, Kind extends string> = {
|
|
2150
|
-
[InteractionId in InteractionIdOfDefinitionPhase<Definition, PhaseName>]: InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? Extract<CollectorKindsOfInteractionDefinition<Spec>, Kind> extends never ? never : InteractionId : never;
|
|
2151
|
-
}[InteractionIdOfDefinitionPhase<Definition, PhaseName>];
|
|
2152
|
-
type QualifiedInteractionIdsWithCollectorKindOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, Kind extends string> = InteractionIdsWithCollectorKindOfDefinitionPhase<Definition, PhaseName, Kind> extends infer InteractionId extends string ? `${PhaseName}.${InteractionId}` : never;
|
|
2153
|
-
type PromptInteractionKeyOfDefinition<Definition> = {
|
|
2154
|
-
[PhaseName in PhaseNamesOfDefinition<Definition>]: QualifiedInteractionIdsWithCollectorKindOfDefinitionPhase<Definition, PhaseName, "prompt">;
|
|
2155
|
-
}[PhaseNamesOfDefinition<Definition>];
|
|
2156
|
-
type BoardInteractionKeyOfDefinition<Definition> = {
|
|
2157
|
-
[PhaseName in PhaseNamesOfDefinition<Definition>]: QualifiedInteractionIdsWithCollectorKindOfDefinitionPhase<Definition, PhaseName, "board-edge" | "board-space" | "board-tile" | "board-vertex">;
|
|
2158
|
-
}[PhaseNamesOfDefinition<Definition>];
|
|
2159
|
-
type CardInteractionKeyOfDefinition<Definition> = {
|
|
2160
|
-
[PhaseName in PhaseNamesOfDefinition<Definition>]: QualifiedInteractionIdsWithCollectorKindOfDefinitionPhase<Definition, PhaseName, "card">;
|
|
2161
|
-
}[PhaseNamesOfDefinition<Definition>];
|
|
2162
|
-
type InputKeysWithCollectorKindOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>, Kind extends string> = InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? InputKeysWithCollectorKindOfInteractionDefinition<Spec, Kind> : never;
|
|
2163
|
-
type CardInputZoneIdsOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>, Input extends string> = InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? CardInputZoneIdsOfInteractionDefinition<Spec, Input> : never;
|
|
2164
|
-
type ParamsOfInteractionOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>> = InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? Spec extends {
|
|
2165
|
-
readonly cardType: unknown;
|
|
2166
|
-
readonly playFrom: unknown;
|
|
2167
|
-
} ? {
|
|
2168
|
-
cardId: string;
|
|
2169
|
-
} & ParamsOfCollectors<CollectorsOfInteractionDefinition<Spec>> : ParamsOfCollectors<CollectorsOfInteractionDefinition<Spec>> : never;
|
|
2170
|
-
/**
|
|
2171
|
-
* Client-facing params shape for an interaction. Omits engine-sampled
|
|
2172
|
-
* collectors (`rngInput.*`) — clients never supply those fields; the
|
|
2173
|
-
* trusted reducer bundle fills them during `submitInteraction`.
|
|
2174
|
-
*
|
|
2175
|
-
* This is the type that drives `submit(playerId, id, params)`,
|
|
2176
|
-
* `handle.submit(params)`, and the generated `InteractionParams` surface
|
|
2177
|
-
* in `shared/generated/ui-contract.ts`. The `reduce`-input counterpart is
|
|
2178
|
-
* {@link ParamsOfInteractionOfDefinition}, which includes every field
|
|
2179
|
-
* because the engine has already filled the sampled ones by then.
|
|
2180
|
-
*/
|
|
2181
|
-
type ClientParamsOfInteractionOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>> = InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? Spec extends {
|
|
2182
|
-
readonly cardType: unknown;
|
|
2183
|
-
readonly playFrom: unknown;
|
|
2184
|
-
} ? {
|
|
2185
|
-
cardId: string;
|
|
2186
|
-
} & ClientParamsOfCollectors<CollectorsOfInteractionDefinition<Spec>> : ClientParamsOfCollectors<CollectorsOfInteractionDefinition<Spec>> : never;
|
|
2187
|
-
type DefaultedClientCollectorKeys<Collectors extends Record<string, InputCollector>> = {
|
|
2188
|
-
[K in keyof Collectors]: Collectors[K] extends {
|
|
2189
|
-
readonly kind: "rng";
|
|
2190
|
-
} ? never : Collectors[K] extends {
|
|
2191
|
-
readonly defaultValue: unknown;
|
|
2192
|
-
} ? K : never;
|
|
2193
|
-
}[keyof Collectors];
|
|
2194
|
-
type DefaultedClientParamKeysOfInteractionOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>> = InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? DefaultedClientCollectorKeys<CollectorsOfInteractionDefinition<Spec>> & string : never;
|
|
2195
|
-
type StageRegistryOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
|
|
2196
|
-
stages?: infer Stages;
|
|
2197
|
-
} ? NonNullable<Stages> : Record<string, never>;
|
|
2198
|
-
type StageNamesOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = StageRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Stages ? Stages extends Record<string, unknown> ? NonNeverKeys<Stages> & string : never : never;
|
|
2199
|
-
type ZoneRegistriesOfDefinition<Definition> = PhasesOfDefinition<Definition>[keyof PhasesOfDefinition<Definition> & string] extends {
|
|
2200
|
-
zones?: infer Zones;
|
|
2201
|
-
} ? NonNullable<Zones> : never;
|
|
2202
|
-
type ZoneIdsOfDefinition<Definition> = ZoneRegistriesOfDefinition<Definition> extends infer Zones ? Zones extends readonly (infer ZoneId)[] ? Extract<ZoneId, string> : never : never;
|
|
2203
|
-
type ZoneListOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
|
|
2204
|
-
zones?: infer Zones;
|
|
2205
|
-
} ? NonNullable<Zones> : readonly [];
|
|
2206
|
-
type PlayableInteractionsOfZoneOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, ZoneId extends string> = ZoneListOfDefinitionPhase<Definition, PhaseName> extends readonly (infer From)[] ? Extract<From, ZoneId> extends never ? never : CardActionRegistryOfDefinitionPhase<Definition, PhaseName> extends infer CardActions ? CardActions extends Record<string, unknown> ? {
|
|
2207
|
-
[ActionId in keyof CardActions & string]: CardActions[ActionId] extends {
|
|
2208
|
-
playFrom: infer PlayFrom extends string;
|
|
2209
|
-
} ? Extract<PlayFrom, ZoneId> extends never ? never : ActionId : never;
|
|
2210
|
-
}[keyof CardActions & string] : never : never : never;
|
|
2211
|
-
|
|
2212
|
-
/**
|
|
2213
|
-
* A freestanding, memoized projection of immutable game state.
|
|
2214
|
-
*
|
|
2215
|
-
* Use `defineDerived` for values that are pure functions of component
|
|
2216
|
-
* locations, zone contents, resources, or other state fields - and are
|
|
2217
|
-
* consumed from multiple reducer or view call sites, or whose compute cost
|
|
2218
|
-
* is non-trivial (graph walks, aggregate reductions).
|
|
2219
|
-
*
|
|
2220
|
-
* Do NOT cache derived values in `publicState`. State fields should be
|
|
2221
|
-
* inputs to derivations, not mirrors of them.
|
|
2222
|
-
*/
|
|
2223
|
-
type DerivedDefinition<Contract, Value> = {
|
|
2224
|
-
/** Optional label for debugging. Does not affect caching. */
|
|
2225
|
-
readonly name?: string;
|
|
2226
|
-
readonly compute: (ctx: {
|
|
2227
|
-
readonly state: BaseGameStateOfContract<Contract>;
|
|
2228
|
-
readonly q: TableQueriesOfState<BaseGameStateOfContract<Contract>>;
|
|
2229
|
-
readonly derived: DerivedResolver;
|
|
2230
|
-
}) => Value;
|
|
2231
|
-
};
|
|
2232
|
-
/**
|
|
2233
|
-
* Resolves a `DerivedDefinition` to its value. Callers do not need to know
|
|
2234
|
-
* about memoization - the resolver handles caching internally.
|
|
2235
|
-
*/
|
|
2236
|
-
type DerivedResolver = <Value>(def: DerivedDefinition<never, Value>) => Value;
|
|
2237
|
-
/**
|
|
2238
|
-
* Author-facing factory for creating a derived value tied to a game
|
|
2239
|
-
* contract. Usage:
|
|
2240
|
-
*
|
|
2241
|
-
* ```ts
|
|
2242
|
-
* export const longestRoad = defineDerived<GameContract>()({
|
|
2243
|
-
* name: "longestRoad",
|
|
2244
|
-
* compute: ({ q, derived }) => computeLongestRoad(q),
|
|
2245
|
-
* });
|
|
2246
|
-
* ```
|
|
2247
|
-
*/
|
|
2248
|
-
declare function defineDerived<Contract>(): <Value>(def: {
|
|
2249
|
-
name?: string;
|
|
2250
|
-
compute: (ctx: {
|
|
2251
|
-
state: BaseGameStateOfContract<Contract>;
|
|
2252
|
-
q: TableQueriesOfState<BaseGameStateOfContract<Contract>>;
|
|
2253
|
-
derived: DerivedResolver;
|
|
2254
|
-
}) => Value;
|
|
2255
|
-
}) => DerivedDefinition<Contract, Value>;
|
|
2256
|
-
/**
|
|
2257
|
-
* Creates a resolver scoped to a single state snapshot. Each engine tick
|
|
2258
|
-
* and each view projection call creates its own resolver; cache lifetime
|
|
2259
|
-
* ends with the call. Cache key is the `DerivedDefinition` identity (the
|
|
2260
|
-
* object reference).
|
|
2261
|
-
*
|
|
2262
|
-
* Re-entry on an in-flight definition throws a readable error.
|
|
2263
|
-
*/
|
|
2264
|
-
declare function createDerivedResolver<State extends {
|
|
2265
|
-
table: RuntimeTableRecord;
|
|
2266
|
-
}>(state: State, options?: {
|
|
2267
|
-
q?: TableQueriesOfState<State>;
|
|
2268
|
-
}): DerivedResolver;
|
|
2269
|
-
|
|
2270
|
-
type StaticBoardsOfManifest<Manifest> = Manifest extends {
|
|
2271
|
-
staticBoards?: infer StaticBoards;
|
|
2272
|
-
} ? NonNullable<StaticBoards> : {
|
|
2273
|
-
byId: Record<string, never>;
|
|
2274
|
-
hex: Record<string, never>;
|
|
2275
|
-
square: Record<string, never>;
|
|
2276
|
-
};
|
|
2277
|
-
type StaticBoardMapOfManifest<Manifest> = StaticBoardsOfManifest<Manifest> extends {
|
|
2278
|
-
byId: infer Boards;
|
|
2279
|
-
} ? Boards : Record<string, never>;
|
|
2280
|
-
type StaticHexBoardMapOfManifest<Manifest> = StaticBoardsOfManifest<Manifest> extends {
|
|
2281
|
-
hex: infer Boards;
|
|
2282
|
-
} ? Boards : Record<string, never>;
|
|
2283
|
-
type StaticSquareBoardMapOfManifest<Manifest> = StaticBoardsOfManifest<Manifest> extends {
|
|
2284
|
-
square: infer Boards;
|
|
2285
|
-
} ? Boards : Record<string, never>;
|
|
2286
|
-
type StaticViewQueries<Manifest extends ManifestContract<RuntimeTableRecord>> = {
|
|
2287
|
-
board: {
|
|
2288
|
-
get: <BoardId extends StringKeyOf<StaticBoardMapOfManifest<Manifest>>>(boardId: BoardId) => StaticBoardMapOfManifest<Manifest>[BoardId];
|
|
2289
|
-
hex: <BoardId extends StringKeyOf<StaticHexBoardMapOfManifest<Manifest>>>(boardId: BoardId) => StaticHexBoardMapOfManifest<Manifest>[BoardId];
|
|
2290
|
-
square: <BoardId extends StringKeyOf<StaticSquareBoardMapOfManifest<Manifest>>>(boardId: BoardId) => StaticSquareBoardMapOfManifest<Manifest>[BoardId];
|
|
2291
|
-
};
|
|
2292
|
-
};
|
|
2293
|
-
type ContinuationSourceKind = "effect";
|
|
2294
|
-
type ResumableEffectKind = "rollDie" | "shuffleSharedZone" | "shufflePlayerZone";
|
|
2295
|
-
type ContinuationKind = ResumableEffectKind;
|
|
2296
|
-
type RollDieContinuationResponse = {
|
|
2297
|
-
dieId: string;
|
|
2298
|
-
value: number;
|
|
2299
|
-
};
|
|
2300
|
-
type ShuffleSharedZoneContinuationResponse = {
|
|
2301
|
-
zoneId: string;
|
|
2302
|
-
orderedCardIds: readonly string[];
|
|
2303
|
-
};
|
|
2304
|
-
type ShufflePlayerZoneContinuationResponse = {
|
|
2305
|
-
zoneId: string;
|
|
2306
|
-
playerId: string;
|
|
2307
|
-
orderedCardIds: readonly string[];
|
|
2308
|
-
};
|
|
2309
|
-
type EffectContinuationResponse<Kind extends ResumableEffectKind> = Kind extends "rollDie" ? RollDieContinuationResponse : Kind extends "shuffleSharedZone" ? ShuffleSharedZoneContinuationResponse : Kind extends "shufflePlayerZone" ? ShufflePlayerZoneContinuationResponse : never;
|
|
2310
|
-
type EffectContinuationInput<DataSchema extends AnySchema, Kind extends ResumableEffectKind = ResumableEffectKind> = {
|
|
2311
|
-
source: "effect";
|
|
2312
|
-
effectKind: Kind;
|
|
2313
|
-
data: z.infer<DataSchema>;
|
|
2314
|
-
response: EffectContinuationResponse<Kind>;
|
|
2315
|
-
};
|
|
2316
|
-
type ContinuationInput<DataSchema extends AnySchema> = EffectContinuationInput<DataSchema, ResumableEffectKind>;
|
|
2317
|
-
type ContinuationInputForSource<DataSchema extends AnySchema, EffectType extends ResumableEffectKind = ResumableEffectKind> = EffectContinuationInput<DataSchema, EffectType>;
|
|
2318
|
-
type PhaseEnterContext = {
|
|
2319
|
-
event: "initialize" | "transition";
|
|
2320
|
-
};
|
|
2321
|
-
type BivariantCallback<Args, Result> = {
|
|
2322
|
-
bivarianceHack(args: Args): Result;
|
|
2323
|
-
}["bivarianceHack"];
|
|
2324
|
-
type ActionContext<State extends {
|
|
2325
|
-
table: RuntimeTableRecord;
|
|
2326
|
-
flow: {
|
|
2327
|
-
currentPhase: string;
|
|
2328
|
-
};
|
|
2329
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = {
|
|
2330
|
-
currentPhase: PhaseNameOfState<State>;
|
|
2331
|
-
manifest: Manifest;
|
|
2332
|
-
playerOrder: PlayerIdOfState<State>[];
|
|
2333
|
-
activePlayers: PlayerIdOfState<State>[];
|
|
2334
|
-
runtime: Omit<ReducerRuntimeStateForState<State>, "rng">;
|
|
2335
|
-
setup: SetupSelectionOfManifest<Manifest> | null;
|
|
2336
|
-
};
|
|
2337
|
-
type ValidationIssue<ErrorCode extends string = string> = {
|
|
2338
|
-
errorCode: ErrorCode;
|
|
2339
|
-
message?: string;
|
|
2340
|
-
};
|
|
2341
|
-
type RuntimeHelpers<State extends {
|
|
2342
|
-
table: RuntimeTableRecord;
|
|
2343
|
-
flow: {
|
|
2344
|
-
currentPhase: string;
|
|
2345
|
-
};
|
|
2346
|
-
}, ErrorCode extends string = string> = {
|
|
2347
|
-
accept(state: State, instructions?: RuntimeInstructionForState<State>[]): ReducerAccept<State>;
|
|
2348
|
-
endGame(state: State, outcome: TerminalOutcome<PlayerIdOfState<State>>, instructions?: RuntimeInstructionForState<State>[]): ReducerAccept<State>;
|
|
2349
|
-
reject: (errorCode: ErrorCode, message?: string) => ReducerReject;
|
|
2350
|
-
fx: ReducerFx<State>;
|
|
2351
|
-
ops: ReducerOps<State>;
|
|
2352
|
-
edit<DraftState extends State>(state: DraftState): ReducerTransaction<DraftState>;
|
|
2353
|
-
q: TableQueriesOfState<State>;
|
|
2354
|
-
derived: DerivedResolver;
|
|
2355
|
-
};
|
|
2356
|
-
type RandomHelpers = {
|
|
2357
|
-
subset<const Values extends readonly unknown[]>(options: {
|
|
2358
|
-
from: Values;
|
|
2359
|
-
count: number;
|
|
2360
|
-
}): readonly Values[number][];
|
|
2361
|
-
};
|
|
2362
|
-
type MutationRuntimeHelpers = {
|
|
2363
|
-
random: RandomHelpers;
|
|
2364
|
-
};
|
|
2365
|
-
type PhaseEnterArgs<State extends {
|
|
2366
|
-
table: RuntimeTableRecord;
|
|
2367
|
-
flow: {
|
|
2368
|
-
currentPhase: string;
|
|
2369
|
-
};
|
|
2370
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & RuntimeHelpers<State> & MutationRuntimeHelpers & PhaseEnterContext & {
|
|
2371
|
-
state: State;
|
|
2372
|
-
};
|
|
2373
|
-
type ActorSelectorArgs<State extends {
|
|
2374
|
-
table: RuntimeTableRecord;
|
|
2375
|
-
flow: {
|
|
2376
|
-
currentPhase: string;
|
|
2377
|
-
};
|
|
2378
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & RuntimeHelpers<State> & {
|
|
2379
|
-
state: State;
|
|
2380
|
-
};
|
|
2381
|
-
type ActorSelection<State extends {
|
|
2382
|
-
table: RuntimeTableRecord;
|
|
2383
|
-
flow: {
|
|
2384
|
-
currentPhase: string;
|
|
2385
|
-
};
|
|
2386
|
-
}> = PlayerIdOfState<State> | readonly PlayerIdOfState<State>[] | null | undefined;
|
|
2387
|
-
type ActorSelector<State extends {
|
|
2388
|
-
table: RuntimeTableRecord;
|
|
2389
|
-
flow: {
|
|
2390
|
-
currentPhase: string;
|
|
2391
|
-
};
|
|
2392
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = BivariantCallback<ActorSelectorArgs<State, Manifest>, ActorSelection<State>>;
|
|
2393
|
-
type ContinuationReduceArgs<DataSchema extends AnySchema, State extends {
|
|
2394
|
-
table: RuntimeTableRecord;
|
|
2395
|
-
flow: {
|
|
2396
|
-
currentPhase: string;
|
|
2397
|
-
};
|
|
2398
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, EffectType extends ResumableEffectKind = ResumableEffectKind> = ActionContext<State, Manifest> & RuntimeHelpers<State> & MutationRuntimeHelpers & {
|
|
2399
|
-
state: State;
|
|
2400
|
-
input: ContinuationInputForSource<DataSchema, EffectType>;
|
|
2401
|
-
};
|
|
2402
|
-
type ScopedPhaseState<State extends {
|
|
2403
|
-
table: RuntimeTableRecord;
|
|
2404
|
-
flow: {
|
|
2405
|
-
currentPhase: string;
|
|
2406
|
-
};
|
|
2407
|
-
phase: object;
|
|
2408
|
-
}, PhaseState extends object> = State & {
|
|
2409
|
-
phase: PhaseState;
|
|
2410
|
-
};
|
|
2411
|
-
type ContinuationCallable<DataSchema extends AnySchema, State extends {
|
|
2412
|
-
table: RuntimeTableRecord;
|
|
2413
|
-
flow: {
|
|
2414
|
-
currentPhase: string;
|
|
2415
|
-
};
|
|
2416
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, ContinuationId extends string = string, EffectType extends ResumableEffectKind = ResumableEffectKind> = ((data: z.infer<DataSchema>) => ContinuationToken<z.infer<DataSchema>, ContinuationId, EffectContinuationResponse<EffectType>>) & {
|
|
2417
|
-
id: ContinuationId;
|
|
2418
|
-
source: "effect";
|
|
2419
|
-
dataSchema: DataSchema;
|
|
2420
|
-
responseSchema: AnySchema;
|
|
2421
|
-
effectKind?: EffectType;
|
|
2422
|
-
reduce: BivariantCallback<ContinuationReduceArgs<DataSchema, State, Manifest, EffectType>, ReducerResult<State>>;
|
|
2423
|
-
};
|
|
2424
|
-
type AnyContinuationCallable<State extends {
|
|
2425
|
-
table: RuntimeTableRecord;
|
|
2426
|
-
flow: {
|
|
2427
|
-
currentPhase: string;
|
|
2428
|
-
};
|
|
2429
|
-
}> = {
|
|
2430
|
-
(data: never): AnyContinuationToken;
|
|
2431
|
-
id: string;
|
|
2432
|
-
source: "effect";
|
|
2433
|
-
dataSchema: AnySchema;
|
|
2434
|
-
responseSchema: AnySchema;
|
|
2435
|
-
effectKind?: ResumableEffectKind;
|
|
2436
|
-
reduce: (args: unknown) => ReducerResult<State>;
|
|
2437
|
-
};
|
|
2438
|
-
type EffectContinuationCallable<DataSchema extends AnySchema, State extends {
|
|
2439
|
-
table: RuntimeTableRecord;
|
|
2440
|
-
flow: {
|
|
2441
|
-
currentPhase: string;
|
|
2442
|
-
};
|
|
2443
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, ContinuationId extends string = string, Kind extends ResumableEffectKind = ResumableEffectKind> = ContinuationCallable<DataSchema, State, Manifest, ContinuationId, Kind>;
|
|
2444
|
-
|
|
2445
|
-
/**
|
|
2446
|
-
* `rollDie` effect. Resolves a `rollDie` wire effect. `reduce` / `context`
|
|
2447
|
-
* are both optional so authors can fire-and-forget a die roll without
|
|
2448
|
-
* observing the result.
|
|
2449
|
-
*/
|
|
2450
|
-
type EffectRollDieDefinition<Id extends string, ContextSchema extends AnySchema, State extends {
|
|
2451
|
-
table: RuntimeTableRecord;
|
|
2452
|
-
flow: {
|
|
2453
|
-
currentPhase: string;
|
|
2454
|
-
};
|
|
2455
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = {
|
|
2456
|
-
readonly type: "rollDie";
|
|
2457
|
-
readonly id: Id;
|
|
2458
|
-
readonly contextSchema?: ContextSchema;
|
|
2459
|
-
readonly __continuation?: EffectContinuationCallable<ContextSchema, State, Manifest, Id, "rollDie">;
|
|
2460
|
-
};
|
|
2461
|
-
/**
|
|
2462
|
-
* `shuffleSharedZone` effect. Resolves a `shuffleSharedZone` wire effect.
|
|
2463
|
-
* `reduce` / `context` are both optional.
|
|
2464
|
-
*/
|
|
2465
|
-
type EffectShuffleDefinition<Id extends string, ContextSchema extends AnySchema, State extends {
|
|
2466
|
-
table: RuntimeTableRecord;
|
|
2467
|
-
flow: {
|
|
2468
|
-
currentPhase: string;
|
|
2469
|
-
};
|
|
2470
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = {
|
|
2471
|
-
readonly type: "shuffleSharedZone";
|
|
2472
|
-
readonly id: Id;
|
|
2473
|
-
readonly contextSchema?: ContextSchema;
|
|
2474
|
-
readonly __continuation?: EffectContinuationCallable<ContextSchema, State, Manifest, Id, "shuffleSharedZone">;
|
|
2475
|
-
};
|
|
2476
|
-
/**
|
|
2477
|
-
* `shufflePlayerZone` effect. Resolves a `shufflePlayerZone` wire effect for
|
|
2478
|
-
* a single player's perPlayer zone (e.g. deck-builder reshuffle of discard
|
|
2479
|
-
* into deck). `reduce` / `context` are both optional.
|
|
2480
|
-
*/
|
|
2481
|
-
type EffectShufflePlayerZoneDefinition<Id extends string, ContextSchema extends AnySchema, State extends {
|
|
2482
|
-
table: RuntimeTableRecord;
|
|
2483
|
-
flow: {
|
|
2484
|
-
currentPhase: string;
|
|
2485
|
-
};
|
|
2486
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = {
|
|
2487
|
-
readonly type: "shufflePlayerZone";
|
|
2488
|
-
readonly id: Id;
|
|
2489
|
-
readonly contextSchema?: ContextSchema;
|
|
2490
|
-
readonly __continuation?: EffectContinuationCallable<ContextSchema, State, Manifest, Id, "shufflePlayerZone">;
|
|
2491
|
-
};
|
|
2492
|
-
/**
|
|
2493
|
-
* Discriminated union of every `defineEffect` output.
|
|
2494
|
-
*/
|
|
2495
|
-
type EffectDefinition<State extends {
|
|
2496
|
-
table: RuntimeTableRecord;
|
|
2497
|
-
flow: {
|
|
2498
|
-
currentPhase: string;
|
|
2499
|
-
};
|
|
2500
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = EffectRollDieDefinition<string, AnySchema, State, Manifest> | EffectShuffleDefinition<string, AnySchema, State, Manifest> | EffectShufflePlayerZoneDefinition<string, AnySchema, State, Manifest>;
|
|
2501
|
-
type EffectMap<State extends {
|
|
2502
|
-
table: RuntimeTableRecord;
|
|
2503
|
-
flow: {
|
|
2504
|
-
currentPhase: string;
|
|
2505
|
-
};
|
|
2506
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, EffectDefinition<State, Manifest>>;
|
|
2507
|
-
type EffectRegistryOfPhase<Phase> = Phase extends {
|
|
2508
|
-
effects?: infer Effects extends Record<string, unknown>;
|
|
2509
|
-
} ? Effects : Record<string, never>;
|
|
2510
|
-
|
|
2511
|
-
type InputCollectorKind = "form" | "board-vertex" | "board-edge" | "board-tile" | "board-space" | "card" | "prompt" | "rng";
|
|
2512
|
-
type TargetKind = "edge" | "vertex" | "space" | "tile" | "card";
|
|
2513
|
-
type BoardInputCollectorKind = Exclude<InputCollectorKind, "form" | "card" | "prompt" | "rng">;
|
|
2514
|
-
type CardInputCollectorMeta = {
|
|
2515
|
-
readonly zoneId: string;
|
|
2516
|
-
readonly zoneIds?: readonly string[];
|
|
2517
|
-
readonly targetKind: "card";
|
|
2518
|
-
};
|
|
2519
|
-
type BoardInputCollectorMeta = {
|
|
2520
|
-
readonly targetKind: TargetKind;
|
|
2521
|
-
readonly boardId: string;
|
|
2522
|
-
readonly valueKind?: "board-id" | "player-board-space";
|
|
2523
|
-
};
|
|
2524
|
-
type PromptInputCollectorMeta = {
|
|
2525
|
-
readonly options: (state: unknown, playerId: unknown, q: unknown) => ReadonlyArray<{
|
|
2526
|
-
id: unknown;
|
|
2527
|
-
label?: string;
|
|
2528
|
-
}>;
|
|
2529
|
-
readonly eligibleOptions: (state: unknown, playerId: unknown, q: unknown) => ReadonlyArray<{
|
|
2530
|
-
id: unknown;
|
|
2531
|
-
label?: string;
|
|
2532
|
-
}>;
|
|
2533
|
-
};
|
|
2534
|
-
type RngInputCollectorMeta = {
|
|
2535
|
-
readonly rng: "d6";
|
|
2536
|
-
readonly count: number;
|
|
2537
|
-
} | {
|
|
2538
|
-
readonly rng: "coin";
|
|
2539
|
-
};
|
|
2540
|
-
type InputCollectorMetaForKind<Kind extends InputCollectorKind> = Kind extends "card" ? CardInputCollectorMeta : Kind extends BoardInputCollectorKind ? BoardInputCollectorMeta : Kind extends "prompt" ? PromptInputCollectorMeta | undefined : Kind extends "rng" ? RngInputCollectorMeta : never;
|
|
2541
|
-
type InputSelectionDescriptor = {
|
|
2542
|
-
readonly mode: "single";
|
|
2543
|
-
} | {
|
|
2544
|
-
readonly mode: "many";
|
|
2545
|
-
readonly min: number;
|
|
2546
|
-
readonly max?: number;
|
|
2547
|
-
readonly distinct?: boolean;
|
|
2548
|
-
};
|
|
2549
|
-
type InputDomainResolverDescriptor = {
|
|
2550
|
-
readonly interactionKey?: string;
|
|
2551
|
-
readonly inputKey: string;
|
|
2552
|
-
};
|
|
2553
|
-
type InputDomainDependencyCase<Domain extends InputDomainDescriptor = InputDomainDescriptor> = {
|
|
2554
|
-
when: Record<string, string>;
|
|
2555
|
-
domain: Domain;
|
|
2556
|
-
};
|
|
2557
|
-
type EagerInputDomainDependencies<Domain extends InputDomainDescriptor = InputDomainDescriptor> = {
|
|
2558
|
-
readonly mode: "eager";
|
|
2559
|
-
readonly dependentCases: readonly InputDomainDependencyCase<Domain>[];
|
|
2560
|
-
};
|
|
2561
|
-
type LazyInputDomainDependencies = {
|
|
2562
|
-
readonly mode: "lazy";
|
|
2563
|
-
readonly dependsOn: readonly string[];
|
|
2564
|
-
readonly resolver: InputDomainResolverDescriptor;
|
|
2565
|
-
};
|
|
2566
|
-
type CardTargetDomainDescriptor = ResolvedCardTargetDomainDescriptor | LazyCardTargetDomainDescriptor;
|
|
2567
|
-
type ResolvedCardTargetDomainDescriptor = {
|
|
2568
|
-
readonly type: "cardTarget";
|
|
2569
|
-
readonly projection: "resolved";
|
|
2570
|
-
readonly targetKind: "card";
|
|
2571
|
-
readonly zoneIds: readonly string[];
|
|
2572
|
-
readonly eligibleTargets: readonly string[];
|
|
2573
|
-
readonly selection?: InputSelectionDescriptor;
|
|
2574
|
-
readonly dependencies?: EagerInputDomainDependencies<ResolvedCardTargetDomainDescriptor>;
|
|
2575
|
-
};
|
|
2576
|
-
type LazyCardTargetDomainDescriptor = {
|
|
2577
|
-
readonly type: "cardTarget";
|
|
2578
|
-
readonly projection: "lazy";
|
|
2579
|
-
readonly targetKind: "card";
|
|
2580
|
-
readonly zoneIds: readonly string[];
|
|
2581
|
-
readonly eligibleTargets?: never;
|
|
2582
|
-
readonly selection?: InputSelectionDescriptor;
|
|
2583
|
-
readonly dependencies: LazyInputDomainDependencies;
|
|
2584
|
-
};
|
|
2585
|
-
type BoardTargetDomainDescriptor = ResolvedBoardTargetDomainDescriptor | LazyBoardTargetDomainDescriptor;
|
|
2586
|
-
type ResolvedBoardTargetDomainDescriptor = {
|
|
2587
|
-
readonly type: "boardTarget";
|
|
2588
|
-
readonly projection: "resolved";
|
|
2589
|
-
readonly targetKind: Exclude<TargetKind, "card">;
|
|
2590
|
-
readonly boardId: string;
|
|
2591
|
-
readonly valueKind?: "board-id" | "player-board-space";
|
|
2592
|
-
readonly eligibleTargets: readonly string[];
|
|
2593
|
-
readonly selection?: InputSelectionDescriptor;
|
|
2594
|
-
readonly dependencies?: EagerInputDomainDependencies<ResolvedBoardTargetDomainDescriptor>;
|
|
2595
|
-
};
|
|
2596
|
-
type LazyBoardTargetDomainDescriptor = {
|
|
2597
|
-
readonly type: "boardTarget";
|
|
2598
|
-
readonly projection: "lazy";
|
|
2599
|
-
readonly targetKind: Exclude<TargetKind, "card">;
|
|
2600
|
-
readonly boardId: string;
|
|
2601
|
-
readonly valueKind?: "board-id" | "player-board-space";
|
|
2602
|
-
readonly eligibleTargets?: never;
|
|
2603
|
-
readonly selection?: InputSelectionDescriptor;
|
|
2604
|
-
readonly dependencies: LazyInputDomainDependencies;
|
|
2605
|
-
};
|
|
2606
|
-
type ResourceMapDomainDescriptor = {
|
|
2607
|
-
type: "resourceMap";
|
|
2608
|
-
resources: Array<{
|
|
2609
|
-
resourceId: string;
|
|
2610
|
-
label?: string;
|
|
2611
|
-
icon?: string;
|
|
2612
|
-
min: number;
|
|
2613
|
-
max: number;
|
|
2614
|
-
}>;
|
|
2615
|
-
selection?: InputSelectionDescriptor;
|
|
2616
|
-
};
|
|
2617
|
-
type BoundedNumberDomainDescriptor = {
|
|
2618
|
-
type: "boundedNumber";
|
|
2619
|
-
min: number;
|
|
2620
|
-
max: number;
|
|
2621
|
-
step?: number;
|
|
2622
|
-
selection?: InputSelectionDescriptor;
|
|
2623
|
-
};
|
|
2624
|
-
type ChoiceDomainDescriptor = {
|
|
2625
|
-
type: "choice";
|
|
2626
|
-
choices: Array<{
|
|
2627
|
-
value: string | null;
|
|
2628
|
-
label: string;
|
|
2629
|
-
icon?: string;
|
|
2630
|
-
badge?: string;
|
|
2631
|
-
description?: string;
|
|
2632
|
-
disabled?: boolean;
|
|
2633
|
-
disabledReason?: string;
|
|
2634
|
-
}>;
|
|
2635
|
-
selection?: InputSelectionDescriptor;
|
|
2636
|
-
dependencies?: EagerInputDomainDependencies<ChoiceDomainDescriptor>;
|
|
2637
|
-
};
|
|
2638
|
-
type ChoiceListDomainDescriptor = {
|
|
2639
|
-
type: "choiceList";
|
|
2640
|
-
choices: Array<{
|
|
2641
|
-
value: string;
|
|
2642
|
-
label: string;
|
|
2643
|
-
icon?: string;
|
|
2644
|
-
badge?: string;
|
|
2645
|
-
description?: string;
|
|
2646
|
-
disabled?: boolean;
|
|
2647
|
-
disabledReason?: string;
|
|
2648
|
-
}>;
|
|
2649
|
-
min?: number;
|
|
2650
|
-
max?: number;
|
|
2651
|
-
selection?: InputSelectionDescriptor;
|
|
2652
|
-
dependencies?: EagerInputDomainDependencies<ChoiceListDomainDescriptor>;
|
|
2653
|
-
};
|
|
2654
|
-
type InputDomainDescriptor = CardTargetDomainDescriptor | BoardTargetDomainDescriptor | ResourceMapDomainDescriptor | BoundedNumberDomainDescriptor | ChoiceDomainDescriptor | ChoiceListDomainDescriptor;
|
|
2655
|
-
type DomainProjector<Domain extends InputDomainDescriptor> = (state: CollectorState, playerId: string, q: unknown, derived: DerivedResolver, values?: Readonly<Record<string, unknown>>) => Domain;
|
|
2656
|
-
type InputDomainForCollectorKind<Kind extends InputCollectorKind> = Kind extends "card" ? CardTargetDomainDescriptor : Kind extends BoardInputCollectorKind ? BoardTargetDomainDescriptor : Exclude<InputDomainDescriptor, CardTargetDomainDescriptor | BoardTargetDomainDescriptor>;
|
|
2657
|
-
/**
|
|
2658
|
-
* Base state shape every collector is generic over. Collectors that need
|
|
2659
|
-
* narrowed ids (card / player) use `PlayerIdOfState<State>` etc. to thread
|
|
2660
|
-
* the manifest's branded types.
|
|
2661
|
-
*/
|
|
2662
|
-
type CollectorState = {
|
|
2663
|
-
table: RuntimeTableRecord;
|
|
2664
|
-
flow: {
|
|
2665
|
-
currentPhase: string;
|
|
2666
|
-
};
|
|
2667
|
-
};
|
|
2668
|
-
/**
|
|
2669
|
-
* An input collector declares:
|
|
2670
|
-
* - a Zod schema for the parameter value the interaction expects. The
|
|
2671
|
-
* schema's `z.infer` feeds `ParamsOf<Collectors>`, so downstream
|
|
2672
|
-
* `reduce({ input: { params } })` sees branded ids from `cardInput` /
|
|
2673
|
-
* `boardInput` without a second declaration.
|
|
2674
|
-
* - an optional `eligibleTargets(state, playerId, q)` hook that the runtime
|
|
2675
|
-
* calls to enumerate server-authoritative valid values. The hook receives
|
|
2676
|
-
* the same `q` table-queries helper that `validate` / `reduce` see, so
|
|
2677
|
-
* board/card/prompt collectors can reuse whatever board-graph or zone
|
|
2678
|
-
* lookups they already use for validation without rebuilding them from
|
|
2679
|
-
* raw state. Each collector helper narrows the return type to its own
|
|
2680
|
-
* branded id (`CardIdOfState<State>` for `cardInput`, the caller-supplied
|
|
2681
|
-
* `Id extends string` for `boardInput.*`, etc.). At the generic interface
|
|
2682
|
-
* level we keep inputs weak (`CollectorState`, `string`, `unknown`) and
|
|
2683
|
-
* the return `ReadonlyArray<unknown>` so the runtime can treat all
|
|
2684
|
-
* collectors uniformly; per-helper signatures provide the author-facing
|
|
2685
|
-
* strong typing.
|
|
2686
|
-
* - optional `meta` for collector-kind-specific routing (e.g. `cardInput`
|
|
2687
|
-
* stores the `zoneId` the card must come from).
|
|
2688
|
-
*
|
|
2689
|
-
* Collectors without meaningful eligibility (`form`, `rng`) leave
|
|
2690
|
-
* `eligibleTargets` undefined.
|
|
2691
|
-
*/
|
|
2692
|
-
type InputCollectorMetaSlot<Kind extends InputCollectorKind> = [
|
|
2693
|
-
InputCollectorMetaForKind<Kind>
|
|
2694
|
-
] extends [never] ? {
|
|
2695
|
-
readonly meta?: never;
|
|
2696
|
-
} : undefined extends InputCollectorMetaForKind<Kind> ? {
|
|
2697
|
-
readonly meta?: Exclude<InputCollectorMetaForKind<Kind>, undefined>;
|
|
2698
|
-
} : {
|
|
2699
|
-
readonly meta: InputCollectorMetaForKind<Kind>;
|
|
2700
|
-
};
|
|
2701
|
-
type InputCollectorBase<Schema extends SchemaLike<unknown> = SchemaLike<unknown>, State extends CollectorState = CollectorState, Kind extends InputCollectorKind = InputCollectorKind> = {
|
|
2702
|
-
readonly kind: Kind;
|
|
2703
|
-
readonly schema: Schema;
|
|
2704
|
-
readonly defaultValue?: z.infer<Schema>;
|
|
2705
|
-
readonly selection?: InputSelectionDescriptor;
|
|
2706
|
-
readonly eligibleTargets?: (state: CollectorState, playerId: string, q: unknown, values?: Readonly<Record<string, unknown>>) => ReadonlyArray<unknown>;
|
|
2707
|
-
readonly validateTarget?: (state: CollectorState, playerId: string, q: unknown, targetId: unknown, values?: Readonly<Record<string, unknown>>) => ValidationIssue | null | undefined;
|
|
2708
|
-
readonly dependsOn?: readonly string[];
|
|
2709
|
-
readonly resolveDefaultValue?: (state: CollectorState, playerId: string, q: unknown, derived: DerivedResolver, domain: InputDomainDescriptor) => z.infer<Schema> | undefined;
|
|
2710
|
-
} & (Kind extends "rng" ? {
|
|
2711
|
-
readonly domain?: never;
|
|
2712
|
-
} : Kind extends "card" | BoardInputCollectorKind ? {
|
|
2713
|
-
readonly domain: DomainProjector<InputDomainForCollectorKind<Kind>>;
|
|
2714
|
-
} : {
|
|
2715
|
-
readonly domain?: DomainProjector<InputDomainForCollectorKind<Kind>>;
|
|
2716
|
-
}) & InputCollectorMetaSlot<Kind>;
|
|
2717
|
-
type InputCollector<Schema extends SchemaLike<unknown> = SchemaLike<unknown>, State extends CollectorState = CollectorState, Kind extends InputCollectorKind = InputCollectorKind> = Kind extends InputCollectorKind ? InputCollectorBase<Schema, State, Kind> : never;
|
|
2718
|
-
type ParamsOf<Collectors extends Record<string, InputCollector>> = {
|
|
2719
|
-
[K in keyof Collectors]: Collectors[K] extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
|
|
2720
|
-
};
|
|
2721
|
-
type EngineSampledCollectorKeys<Collectors extends Record<string, InputCollector>> = {
|
|
2722
|
-
[K in keyof Collectors]: Collectors[K] extends InputCollector & {
|
|
2723
|
-
kind: "rng";
|
|
2724
|
-
} ? K : never;
|
|
2725
|
-
}[keyof Collectors];
|
|
2726
|
-
type ClientParamsOf<Collectors extends Record<string, InputCollector>> = {
|
|
2727
|
-
[K in keyof Collectors as K extends EngineSampledCollectorKeys<Collectors> ? never : K]: Collectors[K] extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
|
|
2728
|
-
};
|
|
2729
|
-
|
|
2730
|
-
type InteractionReduceInput<Collectors extends Record<string, InputCollector>, State extends {
|
|
2731
|
-
table: RuntimeTableRecord;
|
|
2732
|
-
flow: {
|
|
2733
|
-
currentPhase: string;
|
|
2734
|
-
};
|
|
2735
|
-
}> = {
|
|
2736
|
-
playerId: PlayerIdOfState<State>;
|
|
2737
|
-
params: ParamsOf<Collectors>;
|
|
2738
|
-
};
|
|
2739
|
-
type InteractionValidateArgs<Collectors extends Record<string, InputCollector>, State extends {
|
|
2740
|
-
table: RuntimeTableRecord;
|
|
2741
|
-
flow: {
|
|
2742
|
-
currentPhase: string;
|
|
2743
|
-
};
|
|
2744
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = ActionContext<State, Manifest> & RuntimeHelpers<State, ErrorCode> & {
|
|
2745
|
-
state: State;
|
|
2746
|
-
input: InteractionReduceInput<Collectors, State>;
|
|
2747
|
-
};
|
|
2748
|
-
type InteractionReduceArgs<Collectors extends Record<string, InputCollector>, State extends {
|
|
2749
|
-
table: RuntimeTableRecord;
|
|
2750
|
-
flow: {
|
|
2751
|
-
currentPhase: string;
|
|
2752
|
-
};
|
|
2753
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = InteractionValidateArgs<Collectors, State, Manifest, ErrorCode> & MutationRuntimeHelpers;
|
|
2754
|
-
type InteractionAvailabilityArgs<State extends {
|
|
2755
|
-
table: RuntimeTableRecord;
|
|
2756
|
-
flow: {
|
|
2757
|
-
currentPhase: string;
|
|
2758
|
-
};
|
|
2759
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & RuntimeHelpers<State> & {
|
|
2760
|
-
state: State;
|
|
2761
|
-
input: {
|
|
2762
|
-
playerId: PlayerIdOfState<State>;
|
|
2763
|
-
};
|
|
2764
|
-
};
|
|
2765
|
-
type InteractionRuleValidationResult<ErrorCode extends string = string> = boolean | string | ValidationIssue<ErrorCode> | null | undefined;
|
|
2766
|
-
type InteractionRule<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
|
|
2767
|
-
table: RuntimeTableRecord;
|
|
2768
|
-
flow: {
|
|
2769
|
-
currentPhase: string;
|
|
2770
|
-
};
|
|
2771
|
-
} = {
|
|
2772
|
-
table: RuntimeTableRecord;
|
|
2773
|
-
flow: {
|
|
2774
|
-
currentPhase: string;
|
|
2775
|
-
};
|
|
2776
|
-
}, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = {
|
|
2777
|
-
/**
|
|
2778
|
-
* Stable rule id for diagnostics and tests. Rule ids are author-owned and
|
|
2779
|
-
* should be unique within one interaction.
|
|
2780
|
-
*/
|
|
2781
|
-
id: string;
|
|
2782
|
-
/**
|
|
2783
|
-
* Error code used when the rule fails. The same code is used for descriptor
|
|
2784
|
-
* availability and submit-time validation unless `validate` returns a
|
|
2785
|
-
* specific ValidationIssue.
|
|
2786
|
-
*/
|
|
2787
|
-
errorCode: ErrorCode;
|
|
2788
|
-
message?: string;
|
|
2789
|
-
/**
|
|
2790
|
-
* Projection-time rule. Runs without submitted params, so UI descriptors can
|
|
2791
|
-
* reflect action availability before the user clicks.
|
|
2792
|
-
*/
|
|
2793
|
-
available?: BivariantCallback<InteractionAvailabilityArgs<State, Manifest>, boolean>;
|
|
2794
|
-
/**
|
|
2795
|
-
* Submit-time rule. Runs with parsed params and may return false, a concrete
|
|
2796
|
-
* ValidationIssue, null, or undefined.
|
|
2797
|
-
*/
|
|
2798
|
-
validate?: BivariantCallback<InteractionValidateArgs<Collectors, State, Manifest, ErrorCode>, InteractionRuleValidationResult<ErrorCode>>;
|
|
2799
|
-
};
|
|
2800
|
-
type InteractionCommitPolicy = {
|
|
2801
|
-
mode: "manual";
|
|
2802
|
-
} | {
|
|
2803
|
-
mode: "autoWhenReady";
|
|
2804
|
-
};
|
|
2805
|
-
type HasManyInputCollector<Collectors extends Record<string, InputCollector>> = Extract<Collectors[keyof Collectors], {
|
|
2806
|
-
readonly selection: {
|
|
2807
|
-
readonly mode: "many";
|
|
2808
|
-
};
|
|
2809
|
-
}> extends never ? false : true;
|
|
2810
|
-
type InteractionCommitPolicyFor<Collectors extends Record<string, InputCollector>> = HasManyInputCollector<Collectors> extends true ? {
|
|
2811
|
-
mode: "manual";
|
|
2812
|
-
} : InteractionCommitPolicy;
|
|
2813
|
-
/**
|
|
2814
|
-
* Projection-level interaction kind, derived by the trusted bundle from
|
|
2815
|
-
* collector shape:
|
|
2816
|
-
*
|
|
2817
|
-
* - `"action"`: any interaction whose inputs are ordinary collectors
|
|
2818
|
-
* (`formInput`, `cardInput`).
|
|
2819
|
-
* - `"prompt"`: any interaction whose inputs include a `promptInput`
|
|
2820
|
-
* collector. Prompt descriptors carry addressed-player context and options
|
|
2821
|
-
* so UI primitives can render response controls without reducer-owned
|
|
2822
|
-
* placement metadata.
|
|
2823
|
-
*
|
|
2824
|
-
* Authors never set this directly — the `promptInput(...)` collector is
|
|
2825
|
-
* the single source of truth for prompt semantics. See {@link promptInput}
|
|
2826
|
-
* and {@link InteractionDescriptor.kind}.
|
|
2827
|
-
*/
|
|
2828
|
-
type InteractionKind = "action" | "prompt";
|
|
2829
|
-
type InteractionToArgs<State extends {
|
|
2830
|
-
table: RuntimeTableRecord;
|
|
2831
|
-
flow: {
|
|
2832
|
-
currentPhase: string;
|
|
2833
|
-
};
|
|
2834
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & {
|
|
2835
|
-
state: State;
|
|
2836
|
-
};
|
|
2837
|
-
type InteractionSpec<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
|
|
2838
|
-
table: RuntimeTableRecord;
|
|
2839
|
-
flow: {
|
|
2840
|
-
currentPhase: string;
|
|
2841
|
-
};
|
|
2842
|
-
} = {
|
|
2843
|
-
table: RuntimeTableRecord;
|
|
2844
|
-
flow: {
|
|
2845
|
-
currentPhase: string;
|
|
2846
|
-
};
|
|
2847
|
-
}, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = {
|
|
2848
|
-
inputs: Collectors;
|
|
2849
|
-
paramsSchema?: SchemaLike<ClientParamsOf<Collectors>>;
|
|
2850
|
-
/** @internal Phase-local step gates are attached by `defineStepPhase`. */
|
|
2851
|
-
__steps?: readonly string[];
|
|
2852
|
-
/**
|
|
2853
|
-
* Draft commit policy. The input collectors still own value shape and
|
|
2854
|
-
* validation; this only controls whether a ready draft may be submitted
|
|
2855
|
-
* automatically by SDK controls.
|
|
2856
|
-
*
|
|
2857
|
-
* Multi-value collectors created with `many(...)` are always manual draft
|
|
2858
|
-
* interactions. They represent a selection set that should be committed by
|
|
2859
|
-
* explicit player intent, so `autoWhenReady` is intentionally not accepted.
|
|
2860
|
-
*/
|
|
2861
|
-
commit?: InteractionCommitPolicyFor<Collectors>;
|
|
2862
|
-
/**
|
|
2863
|
-
* Addressed-player selector, used by prompt-kind interactions. When
|
|
2864
|
-
* present, the trusted bundle only emits this descriptor for players in
|
|
2865
|
-
* the returned set (or the single player, if a scalar is returned). Use
|
|
2866
|
-
* to thread e.g. `state.publicState.knowerPlayerId` through without
|
|
2867
|
-
* having to manage `activePlayers`. `undefined` / empty returns fall back
|
|
2868
|
-
* to the standard `activePlayers` gating used by action-kind interactions.
|
|
2869
|
-
*/
|
|
2870
|
-
to?: BivariantCallback<InteractionToArgs<State, Manifest>, PlayerIdOfState<State> | ReadonlyArray<PlayerIdOfState<State>> | null | undefined>;
|
|
2871
|
-
/**
|
|
2872
|
-
* Explicit actor selector. Overrides the phase-level actor for this
|
|
2873
|
-
* interaction. Prefer this over `to` for new non-prompt interactions; `to`
|
|
2874
|
-
* remains the prompt/addressee shorthand.
|
|
2875
|
-
*/
|
|
2876
|
-
actor?: ActorSelector<State, Manifest>;
|
|
2877
|
-
/**
|
|
2878
|
-
* Descriptor visibility policy. `all` keeps non-actors visible but disabled;
|
|
2879
|
-
* `actorsOnly` suppresses descriptors for seats that cannot act.
|
|
2880
|
-
*/
|
|
2881
|
-
visibility?: "all" | "actorsOnly";
|
|
2882
|
-
errorCodes?: readonly ErrorCode[];
|
|
2883
|
-
cost?: BivariantCallback<InteractionValidateArgs<Collectors, State, Manifest, ErrorCode>, Readonly<Record<string, number>>>;
|
|
2884
|
-
rules?: readonly InteractionRule<NoInfer<Collectors>, State, Manifest, ErrorCode>[];
|
|
2885
|
-
reduce: BivariantCallback<InteractionReduceArgs<Collectors, State, Manifest, ErrorCode>, ReducerResult<State>>;
|
|
2886
|
-
};
|
|
2887
|
-
type CardActionSpec<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
|
|
2888
|
-
table: RuntimeTableRecord;
|
|
2889
|
-
flow: {
|
|
2890
|
-
currentPhase: string;
|
|
2891
|
-
};
|
|
2892
|
-
} = {
|
|
2893
|
-
table: RuntimeTableRecord;
|
|
2894
|
-
flow: {
|
|
2895
|
-
currentPhase: string;
|
|
2896
|
-
};
|
|
2897
|
-
}, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>, PlayFrom extends PlayerZoneIdOfManifest<Manifest> = PlayerZoneIdOfManifest<Manifest>, ErrorCode extends string = string> = {
|
|
2898
|
-
cardType: CardTypeOfState<State>;
|
|
2899
|
-
playFrom: PlayFrom;
|
|
2900
|
-
inputs?: Collectors;
|
|
2901
|
-
paramsSchema?: SchemaLike<Record<string, unknown>>;
|
|
2902
|
-
/** @internal Phase-local step gates are attached by `defineStepPhase`. */
|
|
2903
|
-
__steps?: readonly string[];
|
|
2904
|
-
/**
|
|
2905
|
-
* Draft commit policy. Card clicks still mutate the draft first;
|
|
2906
|
-
* `autoWhenReady` submits only once the full interaction draft validates.
|
|
2907
|
-
* Multi-value collectors created with `many(...)` are always manual draft
|
|
2908
|
-
* interactions and cannot opt into `autoWhenReady`.
|
|
2909
|
-
*/
|
|
2910
|
-
commit?: InteractionCommitPolicyFor<Collectors>;
|
|
2911
|
-
actor?: ActorSelector<State, Manifest>;
|
|
2912
|
-
visibility?: "all" | "actorsOnly";
|
|
2913
|
-
errorCodes?: readonly ErrorCode[];
|
|
2914
|
-
cost?: BivariantCallback<InteractionValidateArgs<Collectors & {
|
|
2915
|
-
cardId: InputCollector<SchemaLike<CardIdOfState<State>>>;
|
|
2916
|
-
}, State, Manifest, ErrorCode>, Readonly<Record<string, number>>>;
|
|
2917
|
-
rules?: readonly InteractionRule<NoInfer<Collectors & {
|
|
2918
|
-
cardId: InputCollector<SchemaLike<CardIdOfState<State>>>;
|
|
2919
|
-
}>, State, Manifest, ErrorCode>[];
|
|
2920
|
-
reduce: BivariantCallback<InteractionReduceArgs<Collectors & {
|
|
2921
|
-
cardId: InputCollector<SchemaLike<CardIdOfState<State>>>;
|
|
2922
|
-
}, State, Manifest, ErrorCode>, ReducerResult<State>>;
|
|
2923
|
-
};
|
|
2924
|
-
type AnyInteractionRule = Omit<InteractionRule<any, any, any, any>, "available" | "validate"> & {
|
|
2925
|
-
available?: BivariantCallback<any, boolean>;
|
|
2926
|
-
validate?: BivariantCallback<any, InteractionRuleValidationResult<any>>;
|
|
2927
|
-
};
|
|
2928
|
-
type AnyCardActionSpec<State extends {
|
|
2929
|
-
table: RuntimeTableRecord;
|
|
2930
|
-
flow: {
|
|
2931
|
-
currentPhase: string;
|
|
2932
|
-
};
|
|
2933
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Omit<CardActionSpec<any, State, Manifest, any, any>, "actor" | "cost" | "rules" | "reduce"> & {
|
|
2934
|
-
actor?: BivariantCallback<any, any>;
|
|
2935
|
-
cost?: BivariantCallback<any, Readonly<Record<string, number>>>;
|
|
2936
|
-
rules?: readonly AnyInteractionRule[];
|
|
2937
|
-
reduce: BivariantCallback<any, ReducerResult<any>>;
|
|
2938
|
-
};
|
|
2939
|
-
type CardActionMap<State extends {
|
|
2940
|
-
table: RuntimeTableRecord;
|
|
2941
|
-
flow: {
|
|
2942
|
-
currentPhase: string;
|
|
2943
|
-
};
|
|
2944
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, AnyCardActionSpec<State, Manifest>>;
|
|
2945
|
-
/**
|
|
2946
|
-
* Type-safe erasure of {@link InteractionSpec} used by the runtime when it
|
|
2947
|
-
* stores heterogeneous interactions in a single map. The collectors generic is
|
|
2948
|
-
* intentionally erased with `any`: each authored interaction keeps a specific
|
|
2949
|
-
* params shape, but phase registries need to store all of them together.
|
|
2950
|
-
*/
|
|
2951
|
-
type AnyInteractionSpec<State extends {
|
|
2952
|
-
table: RuntimeTableRecord;
|
|
2953
|
-
flow: {
|
|
2954
|
-
currentPhase: string;
|
|
2955
|
-
};
|
|
2956
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Omit<InteractionSpec<any, State, Manifest, any>, "actor" | "cost" | "rules" | "reduce" | "to"> & {
|
|
2957
|
-
actor?: BivariantCallback<any, any>;
|
|
2958
|
-
cost?: BivariantCallback<any, Readonly<Record<string, number>>>;
|
|
2959
|
-
rules?: readonly AnyInteractionRule[];
|
|
2960
|
-
reduce: BivariantCallback<any, ReducerResult<any>>;
|
|
2961
|
-
to?: BivariantCallback<any, any>;
|
|
2962
|
-
};
|
|
2963
|
-
type InteractionMap<State extends {
|
|
2964
|
-
table: RuntimeTableRecord;
|
|
2965
|
-
flow: {
|
|
2966
|
-
currentPhase: string;
|
|
2967
|
-
};
|
|
2968
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, AnyInteractionSpec<State, Manifest>>;
|
|
2969
|
-
type StageSpec<State extends {
|
|
2970
|
-
table: RuntimeTableRecord;
|
|
2971
|
-
flow: {
|
|
2972
|
-
currentPhase: string;
|
|
2973
|
-
};
|
|
2974
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = {
|
|
2975
|
-
when?: BivariantCallback<ActionContext<State, Manifest> & {
|
|
2976
|
-
state: State;
|
|
2977
|
-
}, boolean>;
|
|
2978
|
-
onEnter?: BivariantCallback<PhaseEnterArgs<State, Manifest>, ReducerResult<State> | void>;
|
|
2979
|
-
onExit?: BivariantCallback<PhaseEnterArgs<State, Manifest>, ReducerResult<State> | void>;
|
|
2980
|
-
allow: readonly string[];
|
|
2981
|
-
};
|
|
2982
|
-
type StageMap<State extends {
|
|
2983
|
-
table: RuntimeTableRecord;
|
|
2984
|
-
flow: {
|
|
2985
|
-
currentPhase: string;
|
|
2986
|
-
};
|
|
2987
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, StageSpec<State, Manifest>>;
|
|
2988
|
-
type PhaseZoneList<Manifest extends ManifestContract<RuntimeTableRecord>> = readonly PlayerZoneIdOfManifest<Manifest>[];
|
|
2989
|
-
|
|
2990
|
-
type SimultaneousSubmission<Collectors extends Record<string, InputCollector>, State extends {
|
|
2991
|
-
table: RuntimeTableRecord;
|
|
2992
|
-
flow: {
|
|
2993
|
-
currentPhase: string;
|
|
2994
|
-
};
|
|
2995
|
-
}> = {
|
|
2996
|
-
playerId: PlayerIdOfState<State>;
|
|
2997
|
-
params: ParamsOf<Collectors>;
|
|
2998
|
-
};
|
|
2999
|
-
type SimultaneousResolveArgs<Collectors extends Record<string, InputCollector>, State extends {
|
|
3000
|
-
table: RuntimeTableRecord;
|
|
3001
|
-
flow: {
|
|
3002
|
-
currentPhase: string;
|
|
3003
|
-
};
|
|
3004
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & RuntimeHelpers<State> & MutationRuntimeHelpers & {
|
|
3005
|
-
state: State;
|
|
3006
|
-
submissions: Record<PlayerIdOfState<State>, SimultaneousSubmission<Collectors, State>>;
|
|
3007
|
-
submittedPlayerIds: PlayerIdOfState<State>[];
|
|
3008
|
-
waitingPlayerIds: PlayerIdOfState<State>[];
|
|
3009
|
-
};
|
|
3010
|
-
type SimultaneousSubmitSpec<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
|
|
3011
|
-
table: RuntimeTableRecord;
|
|
3012
|
-
flow: {
|
|
3013
|
-
currentPhase: string;
|
|
3014
|
-
};
|
|
3015
|
-
} = {
|
|
3016
|
-
table: RuntimeTableRecord;
|
|
3017
|
-
flow: {
|
|
3018
|
-
currentPhase: string;
|
|
3019
|
-
};
|
|
3020
|
-
}, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>> = Omit<InteractionSpec<Collectors, State, Manifest>, "reduce"> & {
|
|
3021
|
-
/**
|
|
3022
|
-
* Optional compatibility slot for callers that reuse `defineInteraction`.
|
|
3023
|
-
* The simultaneous phase barrier stores submissions and invokes the
|
|
3024
|
-
* phase-level `resolve`; this per-submission reducer is intentionally
|
|
3025
|
-
* ignored when present.
|
|
3026
|
-
*/
|
|
3027
|
-
reduce?: InteractionSpec<Collectors, State, Manifest>["reduce"];
|
|
3028
|
-
};
|
|
3029
|
-
|
|
3030
|
-
type PhaseDefinitionCommon<PhaseStateSchema extends SchemaLike<object>, State extends {
|
|
3031
|
-
table: RuntimeTableRecord;
|
|
3032
|
-
flow: {
|
|
3033
|
-
currentPhase: string;
|
|
3034
|
-
};
|
|
3035
|
-
phase: object;
|
|
3036
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = {
|
|
3037
|
-
name?: string;
|
|
3038
|
-
state: PhaseStateSchema;
|
|
3039
|
-
initialState?: (ctx: {
|
|
3040
|
-
manifest: Manifest;
|
|
3041
|
-
state: State;
|
|
3042
|
-
playerIds: PlayerIdOfState<State>[];
|
|
3043
|
-
setup: SetupSelectionOfManifest<Manifest> | null;
|
|
3044
|
-
}) => z.infer<PhaseStateSchema>;
|
|
3045
|
-
enter?: BivariantCallback<PhaseEnterArgs<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>, ReducerResult<ScopedPhaseState<State, z.infer<PhaseStateSchema>>> | void>;
|
|
3046
|
-
};
|
|
3047
|
-
type AutoPhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
|
|
3048
|
-
table: RuntimeTableRecord;
|
|
3049
|
-
flow: {
|
|
3050
|
-
currentPhase: string;
|
|
3051
|
-
};
|
|
3052
|
-
phase: object;
|
|
3053
|
-
}, Manifest extends ManifestContract<TableOfState<State>>> = PhaseDefinitionCommon<PhaseStateSchema, State, Manifest> & {
|
|
3054
|
-
kind: "auto";
|
|
3055
|
-
actor?: never;
|
|
3056
|
-
actors?: never;
|
|
3057
|
-
submit?: never;
|
|
3058
|
-
canResubmit?: never;
|
|
3059
|
-
resolve?: never;
|
|
3060
|
-
effects?: never;
|
|
3061
|
-
interactions?: never;
|
|
3062
|
-
stages?: never;
|
|
3063
|
-
zones?: never;
|
|
3064
|
-
cardActions?: never;
|
|
3065
|
-
};
|
|
3066
|
-
type PlayerPhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
|
|
3067
|
-
table: RuntimeTableRecord;
|
|
3068
|
-
flow: {
|
|
3069
|
-
currentPhase: string;
|
|
3070
|
-
};
|
|
3071
|
-
phase: object;
|
|
3072
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, Effects extends EffectMap<State, Manifest> = Record<string, never>, Interactions extends InteractionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Stages extends StageMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Zones extends PhaseZoneList<Manifest> = readonly [], CardActions extends CardActionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>> = PhaseDefinitionCommon<PhaseStateSchema, State, Manifest> & {
|
|
3073
|
-
kind: "player";
|
|
3074
|
-
/**
|
|
3075
|
-
* Default actor selector for interactions in this phase. When omitted the
|
|
3076
|
-
* runtime falls back to `flow.activePlayers`, preserving the existing turn
|
|
3077
|
-
* ownership model. Returning multiple players models simultaneous actors.
|
|
3078
|
-
*/
|
|
3079
|
-
actor?: ActorSelector<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>;
|
|
3080
|
-
actors?: never;
|
|
3081
|
-
submit?: never;
|
|
3082
|
-
canResubmit?: never;
|
|
3083
|
-
resolve?: never;
|
|
3084
|
-
effects?: Effects;
|
|
3085
|
-
interactions?: Interactions;
|
|
3086
|
-
stages?: Stages;
|
|
3087
|
-
zones?: Zones;
|
|
3088
|
-
cardActions?: CardActions;
|
|
3089
|
-
};
|
|
3090
|
-
type SimultaneousPlayerPhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
|
|
3091
|
-
table: RuntimeTableRecord;
|
|
3092
|
-
flow: {
|
|
3093
|
-
currentPhase: string;
|
|
3094
|
-
};
|
|
3095
|
-
phase: object;
|
|
3096
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Effects extends EffectMap<State, Manifest> = Record<string, never>, Interactions extends InteractionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Stages extends StageMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Zones extends PhaseZoneList<Manifest> = readonly [], CardActions extends CardActionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>> = PhaseDefinitionCommon<PhaseStateSchema, State, Manifest> & {
|
|
3097
|
-
kind: "simultaneousPlayer";
|
|
3098
|
-
actor?: never;
|
|
3099
|
-
/**
|
|
3100
|
-
* Actor selector for `kind: "simultaneousPlayer"` phases. This is an alias
|
|
3101
|
-
* of `actor` with wording that matches simultaneous submission semantics.
|
|
3102
|
-
*/
|
|
3103
|
-
actors: ActorSelector<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>;
|
|
3104
|
-
/**
|
|
3105
|
-
* Canonical sealed submission interaction for simultaneous phases. It is
|
|
3106
|
-
* projected like a normal interaction, but the trusted runtime stores the
|
|
3107
|
-
* parsed params until every actor has submitted, then calls `resolve`.
|
|
3108
|
-
*/
|
|
3109
|
-
submit: SimultaneousSubmitSpec<SubmitCollectors, ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>;
|
|
3110
|
-
/**
|
|
3111
|
-
* When false or omitted, each actor can submit once per simultaneous
|
|
3112
|
-
* barrier. Set true to allow replacing the sealed submission before every
|
|
3113
|
-
* required actor has submitted.
|
|
3114
|
-
*/
|
|
3115
|
-
canResubmit?: boolean;
|
|
3116
|
-
/**
|
|
3117
|
-
* Batch resolver invoked once all simultaneous actors have submitted. The
|
|
3118
|
-
* submitted params are passed together so game state mutates from one
|
|
3119
|
-
* deterministic base state instead of one player at a time.
|
|
3120
|
-
*/
|
|
3121
|
-
resolve: BivariantCallback<SimultaneousResolveArgs<SubmitCollectors, ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>, ReducerResult<ScopedPhaseState<State, z.infer<PhaseStateSchema>>>>;
|
|
3122
|
-
effects?: Effects;
|
|
3123
|
-
interactions?: Interactions;
|
|
3124
|
-
stages?: Stages;
|
|
3125
|
-
zones?: Zones;
|
|
3126
|
-
cardActions?: CardActions;
|
|
3127
|
-
};
|
|
3128
|
-
type PhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
|
|
3129
|
-
table: RuntimeTableRecord;
|
|
3130
|
-
flow: {
|
|
3131
|
-
currentPhase: string;
|
|
3132
|
-
};
|
|
3133
|
-
phase: object;
|
|
3134
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Effects extends EffectMap<State, Manifest> = Record<string, never>, Interactions extends InteractionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Stages extends StageMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Zones extends PhaseZoneList<Manifest> = readonly [], CardActions extends CardActionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>> = AutoPhaseDefinition<PhaseStateSchema, State, Manifest> | PlayerPhaseDefinition<PhaseStateSchema, State, Manifest, Effects, Interactions, Stages, Zones, CardActions> | SimultaneousPlayerPhaseDefinition<PhaseStateSchema, State, Manifest, SubmitCollectors, Effects, Interactions, Stages, Zones, CardActions>;
|
|
3135
|
-
|
|
3136
|
-
type ViewDefinition<State extends {
|
|
3137
|
-
table: RuntimeTableRecord;
|
|
3138
|
-
flow: {
|
|
3139
|
-
currentPhase: string;
|
|
3140
|
-
};
|
|
3141
|
-
}, Manifest extends ManifestContract<TableOfState<State>>, Projection = unknown> = {
|
|
3142
|
-
project: (args: ActionContext<State, Manifest> & RuntimeHelpers<State> & {
|
|
3143
|
-
state: State;
|
|
3144
|
-
playerId: PlayerIdOfState<State>;
|
|
3145
|
-
runtime: State extends {
|
|
3146
|
-
runtime: infer RuntimeStateValue;
|
|
3147
|
-
} ? RuntimeStateValue : never;
|
|
3148
|
-
}) => Projection;
|
|
3149
|
-
};
|
|
3150
|
-
/**
|
|
3151
|
-
* Session-scoped, once-per-init view. The `project` callback receives only
|
|
3152
|
-
* the authored manifest — the mutable-state helpers (`state`, `playerId`,
|
|
3153
|
-
* `runtime`, `fx`, `ops`, `accept`, `reject`, `q`) that `ViewDefinition.project`
|
|
3154
|
-
* exposes are structurally absent, so an author cannot accidentally project
|
|
3155
|
-
* per-tick state into the payload. The host calls this once per reducer
|
|
3156
|
-
* session, caches the result, and merges it back into every seat view on
|
|
3157
|
-
* the client. Moving static board topology here is what lets the adapter
|
|
3158
|
-
* skip the ~87% of `projectSeatsDynamic` wall time that used to re-serialize
|
|
3159
|
-
* manifest-sourced fields on every input.
|
|
3160
|
-
*/
|
|
3161
|
-
type StaticViewDefinition<Manifest extends ManifestContract<RuntimeTableRecord>, Projection = unknown> = {
|
|
3162
|
-
project: (args: {
|
|
3163
|
-
manifest: Manifest;
|
|
3164
|
-
q: StaticViewQueries<Manifest>;
|
|
3165
|
-
}) => Projection;
|
|
3166
|
-
};
|
|
3167
|
-
|
|
3168
|
-
export { type ComponentDataOfTable as $, type ActionContext as A, type BaseGameSessionOfContract as B, type BoardTypeIdOfTable as C, type BoundedNumberDomainDescriptor as D, type Brand as E, type CardActionMap as F, type CardActionSpec as G, type CardIdOfDeck as H, type CardIdOfHand as I, type CardIdOfManifest as J, type CardIdOfState as K, type CardIdOfTable as L, type CardInputCollectorMeta as M, type CardInputZoneIdsOfDefinition as N, type CardInteractionKeyOfDefinition as O, type CardTargetDomainDescriptor as P, type CardTypeOfState as Q, type CardTypeOfTable as R, type ChoiceDomainDescriptor as S, type ChoiceListDomainDescriptor as T, type ChoiceOption as U, type ClientParamsOf as V, type ClientParamsOfInteractionOfDefinition as W, type CollectorState as X, type CompatibleCardIdForHandAndDeck as Y, type CompatibleCardIdForTwoPlayerZones as Z, type CompatibleHandIdForDeck as _, type ActorSelection as a, type InputDomainResolverDescriptor as a$, type ComponentIdOfTable as a0, type ComponentLocationByTypeOfTable as a1, type ComponentLocationOfTable as a2, type ContinuationCallable as a3, type ContinuationInput as a4, type ContinuationInputForSource as a5, type ContinuationKind as a6, type ContinuationReduceArgs as a7, type ContinuationResponseOf as a8, type ContinuationSourceKind as a9, type FrameworkErrorCode as aA, FrameworkErrorCodes as aB, type GameStateOf as aC, type GeneratedManifestContractLike as aD, type HandCardsOfTable as aE, type HandIdOfState as aF, type HandIdOfTable as aG, type HexBoardIdOfTable as aH, type HexBoardStateOfTable as aI, type HexEdgeIdOfTable as aJ, type HexEdgeStateOfTable as aK, type HexEdgeTypeIdOfTable as aL, type HexSpaceIdOfTable as aM, type HexSpaceTypeIdOfTable as aN, type HexVertexIdOfTable as aO, type HexVertexStateOfTable as aP, type HexVertexTypeIdOfTable as aQ, type HiddenSchemaOfContract as aR, type HiddenStateOfState as aS, type InitContext as aT, type InitSetupSelectionInput as aU, type InitialStateCallbacks as aV, type InputCollector as aW, type InputCollectorKind as aX, type InputCollectorMetaForKind as aY, type InputDomainDependencyCase as aZ, type InputDomainDescriptor as a_, type ContinuationToken as aa, type DeckCardsOfTable as ab, type DeckIdOfState as ac, type DeckIdOfTable as ad, type DefaultedClientParamKeysOfInteractionOfDefinition as ae, type DerivedDefinition as af, type DerivedResolver as ag, type DieIdOfManifest as ah, type EagerInputDomainDependencies as ai, type EdgeTypeIdOfManifest as aj, type EffectContinuationCallable as ak, type EffectContinuationInput as al, type EffectContinuationResponse as am, type EffectDefinition as an, type EffectIdsOfDefinition as ao, type EffectInvokeOptions as ap, type EffectMap as aq, type EffectRegistryOfPhase as ar, type EffectRollDieDefinition as as, type EffectShuffleDefinition as at, type EffectShufflePlayerZoneDefinition as au, type EffectSpecLike as av, type EffectTypeTag as aw, type ErrorCodeOfContract as ax, type ExactManifestContractOf as ay, type FlowState as az, type ActorSelector as b, type PlayerZoneIdOfTable as b$, type InputKeysWithCollectorKindOfDefinition as b0, type InputSelectionDescriptor as b1, type InteractionAvailabilityArgs as b2, type InteractionCommitPolicy as b3, type InteractionIdOfDefinition as b4, type InteractionIdOfDefinitionPhase as b5, type InteractionKind as b6, type InteractionMap as b7, type InteractionReduceArgs as b8, type InteractionReduceInput as b9, type PhaseDefinitionByName as bA, type PhaseEnterArgs as bB, type PhaseEnterContext as bC, type PhaseMapOf as bD, type PhaseMapOfState as bE, type PhaseNameOf as bF, type PhaseNameOfContract as bG, type PhaseNameOfManifest as bH, type PhaseNameOfState as bI, type PhaseNamesOfDefinition as bJ, type PhasePayload as bK, type PhaseSchemasOfContract as bL, type PhaseStateMapOfContract as bM, type PhaseStateMapOfDefinitions as bN, type PhaseStateOfDefinitions as bO, type PhaseStateOfState as bP, type PhaseStepOfState as bQ, type PhaseZoneList as bR, type PieceIdOfManifest as bS, type PlayableInteractionsOfZoneOfDefinition as bT, type PlayerId as bU, type PlayerIdOfManifest as bV, type PlayerIdOfState as bW, type PlayerIdOfTable as bX, type PlayerPhaseDefinition as bY, type PlayerZoneIdOfManifest as bZ, type PlayerZoneIdOfState as b_, type InteractionRule as ba, type InteractionRuleValidationResult as bb, type InteractionSpec as bc, type InteractionSpecByNameOfDefinitionPhase as bd, type InteractionToArgs as be, type InteractionValidateArgs as bf, type LazyBoardTargetDomainDescriptor as bg, type LazyCardTargetDomainDescriptor as bh, type LazyInputDomainDependencies as bi, type ManifestContract as bj, type ManifestContractOf as bk, type ManifestDefaults as bl, type ManifestIdSchema as bm, type ManifestIds as bn, type ManifestLiterals as bo, type ManifestOf as bp, type MutationRuntimeHelpers as bq, type NonEmptyReadonlyArray as br, type Op as bs, type ParamsOf as bt, type ParamsOfInteractionOfDefinition as bu, type PerPlayer as bv, type PerPlayerBoardRef as bw, type PerPlayerSchemaOptions as bx, type PhaseAccessor as by, type PhaseDefinition as bz, type ActorSelectorArgs as c, type RuntimeGenericBoardState as c$, type PrivateSchemaOfContract as c0, type PrivateStateOfState as c1, type PromptInputCollectorMeta as c2, type PromptInteractionKeyOfDefinition as c3, type PublicSchemaOfContract as c4, type PublicStateOfState as c5, type RandomHelpers as c6, type ReducerAccept as c7, type ReducerEdit as c8, type ReducerFx as c9, type ResolvedSpaceLocation as cA, type ResolvedVertexLocation as cB, type ResolvedZoneLocation as cC, type ResourceAmountsOfTable as cD, type ResourceBalancesOfState as cE, type ResourceBalancesOfTable as cF, type ResourceIdOfManifest as cG, type ResourceIdOfState as cH, type ResourceIdOfTable as cI, type ResourceMapDomainDescriptor as cJ, type ResumableEffectKind as cK, type RngInputCollectorMeta as cL, type RollDieContinuationResponse as cM, type RotatePlayerZoneArgs as cN, type RuntimeBoardBaseState as cO, type RuntimeBoardCollections as cP, type RuntimeBoardCompatibilityState as cQ, type RuntimeBoardContainerState as cR, type RuntimeBoardRelationState as cS, type RuntimeBoardSpaceState as cT, type RuntimeBoardState as cU, type RuntimeCardData as cV, type RuntimeCardVisibility as cW, type RuntimeComponentLocation as cX, type RuntimeComponentLocationMap as cY, type RuntimeDeckMap as cZ, type RuntimeDieData as c_, type ReducerGameContract as ca, type ReducerGameContractLike as cb, type ReducerGameDefinition as cc, type ReducerGameState as cd, type ReducerManifestContract as ce, type ReducerOps as cf, type ReducerReject as cg, type ReducerResult as ch, type ReducerRuntimeStateForState as ci, type ReducerSessionForConfig as cj, type ReducerSessionState as ck, type ReducerStateBase as cl, type ReducerStateForConfig as cm, type ReducerTransaction as cn, type ReducerValidationResult as co, type RelationTypeIdOfManifest as cp, type RelationTypeIdOfTable as cq, type ResolvedBoardTargetDomainDescriptor as cr, type ResolvedCardTargetDomainDescriptor as cs, type ResolvedContainerLocation as ct, type ResolvedDeckLocation as cu, type ResolvedEdgeLocation as cv, type ResolvedGameSessionOf as cw, type ResolvedGameStateOf as cx, type ResolvedHandLocation as cy, type ResolvedSlotLocation as cz, type AnyCardActionSpec as d, type SimultaneousPlayerPhaseDefinition as d$, type RuntimeHandMap as d0, type RuntimeHandVisibilityMode as d1, type RuntimeHelpers as d2, type RuntimeHexBoardState as d3, type RuntimeHexEdgeState as d4, type RuntimeHexOrientation as d5, type RuntimeHexSpaceState as d6, type RuntimeHexVertexState as d7, type RuntimeOwnerMap as d8, type RuntimeParams as d9, type RuntimeZoneMap as dA, type SchemaLike as dB, type ScopedPhaseState as dC, type SetupBootstrapContainerRef as dD, type SetupBootstrapDestinationRef as dE, type SetupBootstrapPerPlayerBoardContainerRef as dF, type SetupBootstrapPerPlayerBoardSpaceRef as dG, type SetupBootstrapPerPlayerContainerTemplateRef as dH, type SetupBootstrapPerPlayerZoneRef as dI, type SetupBootstrapSharedBoardContainerRef as dJ, type SetupBootstrapSharedBoardSpaceRef as dK, type SetupBootstrapSharedZoneRef as dL, type SetupBootstrapStep as dM, type SetupOptionChoiceMetadata as dN, type SetupOptionIdOfManifest as dO, type SetupOptionMetadata as dP, type SetupProfileDefinition as dQ, type SetupProfileIdOfManifest as dR, type SetupProfileMetadata as dS, type SetupSelectionInputOfManifest as dT, type SetupSelectionOfManifest as dU, type SharedBoardRef as dV, type SharedZoneIdOfManifest as dW, type SharedZoneIdOfState as dX, type SharedZoneIdOfTable as dY, type ShufflePlayerZoneContinuationResponse as dZ, type ShuffleSharedZoneContinuationResponse as d_, type RuntimePayload as da, type RuntimePhaseState as db, type RuntimePieceData as dc, type RuntimeRecord as dd, type RuntimeResourceMap as de, type RuntimeRngState as df, type RuntimeScalar as dg, type RuntimeSetupSelection as dh, type RuntimeSetupSelectionInput as di, type RuntimeSetupSelectionOverride as dj, type RuntimeSimultaneousState as dk, type RuntimeSimultaneousSubmission as dl, type RuntimeSlotHostRef as dm, type RuntimeSquareBoardState as dn, type RuntimeSquareEdgeState as dp, type RuntimeSquareSpaceState as dq, type RuntimeSquareVertexState as dr, type RuntimeState as ds, type RuntimeTableRecord as dt, type RuntimeTiledBoardBaseState as du, type RuntimeTiledBoardState as dv, type RuntimeTiledEdgeState as dw, type RuntimeTiledSpaceState as dx, type RuntimeTiledVertexState as dy, type RuntimeVisibilityMap as dz, type AnyContinuationCallable as e, createManifestStringLiteralSchema as e$, type SimultaneousResolveArgs as e0, type SimultaneousSubmission as e1, type SimultaneousSubmitSpec as e2, type SpaceIdOfManifest as e3, type SpaceIdOfTable as e4, type SpaceTypeIdOfManifest as e5, type SpaceTypeIdOfTable as e6, type SquareBoardIdOfTable as e7, type SquareBoardStateOfTable as e8, type SquareEdgeIdOfTable as e9, type TiledEdgeMap as eA, type TiledEdgeStateOfTable as eB, type TiledEdgeTypeIdOfTable as eC, type TiledSpaceIdOfTable as eD, type TiledSpaceMap as eE, type TiledVertexIdOfTable as eF, type TiledVertexMap as eG, type TiledVertexStateOfTable as eH, type TiledVertexTypeIdOfTable as eI, type ValidationIssue as eJ, type VertexTypeIdOfManifest as eK, type ViewDefinition as eL, type ViewDefinitionByName as eM, type ViewMapOf as eN, type ViewNamesOfDefinition as eO, type ViewOfDefinition as eP, type ViewsOfDefinition as eQ, type ZoneIdsOfDefinition as eR, asPlayerId as eS, assumeManifestSchema as eT, boardRef as eU, boardRefKey as eV, boardRefSchema as eW, cloneManifestDefault as eX, createDerivedResolver as eY, createManifestGameStateSchema as eZ, createManifestRuntimeSchema as e_, type SquareEdgeStateOfTable as ea, type SquareEdgeTypeIdOfTable as eb, type SquareSpaceIdOfTable as ec, type SquareSpaceTypeIdOfTable as ed, type SquareVertexIdOfTable as ee, type SquareVertexStateOfTable as ef, type SquareVertexTypeIdOfTable as eg, type StageMap as eh, type StageNamesOfDefinitionPhase as ei, type StageSpec as ej, type StateDefinition as ek, type StateDefinitionOfContract as el, type StaticBoards as em, type StaticBoardsJsonEnvelope as en, type StaticViewDefinition as eo, type StaticViewQueries as ep, type StringKeyOf as eq, type TableOfManifest as er, type TableOfState as es, type TableQueries as et, type TableQueriesOfState as eu, type TargetKind as ev, type TerminalOutcome as ew, type TiledBoardIdOfTable as ex, type TiledBoardStateOfTable as ey, type TiledEdgeIdOfTable as ez, type AnyContinuationToken as f, createReducerEdit as f0, createReducerOps as f1, createReducerTransaction as f2, defineDerived as f3, isManifestScopedSchema as f4, isPerPlayer as f5, isPerPlayerBoardRef as f6, isPlayerId as f7, isSharedBoardRef as f8, markManifestScopedSchema as f9, parseBoardRefKey as fa, perPlayer as fb, perPlayerBoardRef as fc, perPlayerEntries as fd, perPlayerGet as fe, perPlayerHas as ff, perPlayerKeys as fg, perPlayerMap as fh, perPlayerRequire as fi, perPlayerSchema as fj, perPlayerSet as fk, perPlayerSize as fl, perPlayerValues as fm, pipe as fn, resolveManifestPlayerIds as fo, sharedBoardRef as fp, type AnyInteractionSpec as g, type AnyPhaseDefinitionForContract as h, type AnyReducerGameDefinition as i, type AnySchema as j, type AutoPhaseDefinition as k, type BaseGameStateOfContract as l, type BoardBaseIdOfManifest as m, type BoardContainerIdOfManifest as n, type BoardContainerIdOfTable as o, type BoardIdOfManifest as p, type BoardIdOfTable as q, type BoardInputCollectorKind as r, type BoardInputCollectorMeta as s, type BoardInteractionKeyOfDefinition as t, type BoardLayoutOfManifest as u, type BoardMapOfTable as v, type BoardRef as w, type BoardStateOfTable as x, type BoardTargetDomainDescriptor as y, type BoardTypeIdOfManifest as z };
|