@dreamboard-games/sdk 0.5.0-alpha.2 → 0.5.0-alpha.21
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/README.md +462 -53
- package/dist/board-element-CqtxU5VZ.d.ts +13 -0
- package/dist/chunk-3RFGPBES.js +1792 -0
- package/dist/chunk-3RFGPBES.js.map +1 -0
- package/dist/chunk-CZRPUWCT.js +1602 -0
- package/dist/chunk-CZRPUWCT.js.map +1 -0
- package/dist/chunk-DMSXVMYY.js +7199 -0
- package/dist/chunk-DMSXVMYY.js.map +1 -0
- package/dist/chunk-U6R7FAH4.js +630 -0
- package/dist/chunk-U6R7FAH4.js.map +1 -0
- package/dist/chunk-YT3RPO5J.js +635 -0
- package/dist/chunk-YT3RPO5J.js.map +1 -0
- package/dist/diagnostics-ZAPEBlJP.d.ts +64 -0
- package/dist/extract-CwJWDrSD.d.ts +6850 -0
- package/dist/index.d.ts +5177 -1
- package/dist/index.js +1990 -6
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +158 -0
- package/dist/react.js +1119 -0
- package/dist/react.js.map +1 -0
- package/dist/reducer.d.ts +1028 -97
- package/dist/reducer.js +4892 -125
- package/dist/reducer.js.map +1 -1
- package/dist/shortcuts-B_RrufOM.d.ts +822 -0
- package/dist/testing.d.ts +529 -569
- package/dist/testing.js +2588 -934
- package/dist/testing.js.map +1 -1
- package/dist/types-BxXRINRF.d.ts +118 -0
- package/package.json +39 -144
- package/dist/HandView-Bi2lxzQP.d.ts +0 -79
- package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
- package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
- package/dist/attributes-DbvyMbXw.d.ts +0 -68
- package/dist/browser-interaction.d.ts +0 -910
- package/dist/browser-interaction.js +0 -119
- package/dist/browser-interaction.js.map +0 -1
- package/dist/chunk-32PFKDV7.js +0 -11705
- package/dist/chunk-32PFKDV7.js.map +0 -1
- package/dist/chunk-3BAD4VC2.js +0 -263
- package/dist/chunk-3BAD4VC2.js.map +0 -1
- package/dist/chunk-3SKDNDPG.js +0 -104
- package/dist/chunk-3SKDNDPG.js.map +0 -1
- package/dist/chunk-5YV2WHJ4.js +0 -25
- package/dist/chunk-5YV2WHJ4.js.map +0 -1
- package/dist/chunk-ANRB4XKA.js +0 -90
- package/dist/chunk-ANRB4XKA.js.map +0 -1
- package/dist/chunk-BI4G3PM2.js +0 -1864
- package/dist/chunk-BI4G3PM2.js.map +0 -1
- package/dist/chunk-EVCLTY4Q.js +0 -935
- package/dist/chunk-EVCLTY4Q.js.map +0 -1
- package/dist/chunk-GDPKTBUR.js +0 -564
- package/dist/chunk-GDPKTBUR.js.map +0 -1
- package/dist/chunk-H6VDGFL5.js +0 -2903
- package/dist/chunk-H6VDGFL5.js.map +0 -1
- package/dist/chunk-LR3ZTWQF.js +0 -5960
- package/dist/chunk-LR3ZTWQF.js.map +0 -1
- package/dist/chunk-PF7L4BMG.js +0 -117
- package/dist/chunk-PF7L4BMG.js.map +0 -1
- package/dist/chunk-PN5O6GG2.js +0 -32
- package/dist/chunk-PN5O6GG2.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-S2JEDVWH.js +0 -7165
- package/dist/chunk-S2JEDVWH.js.map +0 -1
- package/dist/chunk-T3ZKNUZ7.js +0 -1
- package/dist/chunk-T3ZKNUZ7.js.map +0 -1
- package/dist/chunk-UGH54WZ2.js +0 -223
- package/dist/chunk-UGH54WZ2.js.map +0 -1
- package/dist/chunk-VCDWP5VL.js +0 -746
- package/dist/chunk-VCDWP5VL.js.map +0 -1
- package/dist/chunk-VDXOF4FW.js +0 -69
- package/dist/chunk-VDXOF4FW.js.map +0 -1
- package/dist/chunk-WHR5UW3F.js +0 -1988
- package/dist/chunk-WHR5UW3F.js.map +0 -1
- package/dist/chunk-Y75CFE77.js +0 -17
- package/dist/chunk-Y75CFE77.js.map +0 -1
- package/dist/chunk-Z7QCREWI.js +0 -3435
- package/dist/chunk-Z7QCREWI.js.map +0 -1
- package/dist/chunk-ZZGN2ATS.js +0 -1941
- package/dist/chunk-ZZGN2ATS.js.map +0 -1
- package/dist/components-gAbIz7hK.d.ts +0 -1284
- package/dist/definitions-BgmV_GhC.d.ts +0 -300
- package/dist/diagnostics-DIi3ina7.d.ts +0 -50
- package/dist/digest.d.ts +0 -8
- package/dist/game-CsZScpcn.d.ts +0 -763
- package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
- package/dist/index-CcT9Q7N7.d.ts +0 -193
- package/dist/index.d-DjzoK7zn.d.ts +0 -2101
- package/dist/package-set.d.ts +0 -13
- package/dist/package-set.js +0 -12
- package/dist/package-set.js.map +0 -1
- package/dist/player-state-Cqpyeql0.d.ts +0 -371
- package/dist/plugin-runtime-contract.d.ts +0 -17
- package/dist/plugin-runtime-contract.js +0 -92
- package/dist/plugin-runtime-contract.js.map +0 -1
- package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
- package/dist/protocol-dYgafTYY.d.ts +0 -314
- package/dist/reducer/advanced.d.ts +0 -82
- package/dist/reducer/advanced.js +0 -51
- package/dist/reducer/advanced.js.map +0 -1
- package/dist/reducer-contract.d.ts +0 -11
- package/dist/reducer-contract.js +0 -16
- package/dist/reducer-contract.js.map +0 -1
- package/dist/reference-games/index.d.ts +0 -31
- package/dist/reference-games/index.js +0 -48
- package/dist/reference-games/index.js.map +0 -1
- package/dist/runtime/primitives.d.ts +0 -250
- package/dist/runtime/primitives.js +0 -189
- package/dist/runtime/primitives.js.map +0 -1
- package/dist/runtime/runtime-api.d.ts +0 -2
- package/dist/runtime/runtime-api.js +0 -1
- package/dist/runtime/runtime-api.js.map +0 -1
- package/dist/runtime/workspace-contract.d.ts +0 -392
- package/dist/runtime/workspace-contract.js +0 -28
- package/dist/runtime/workspace-contract.js.map +0 -1
- package/dist/runtime-RJ5orDJU.d.ts +0 -1699
- package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
- package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
- package/dist/runtime.d.ts +0 -83
- package/dist/runtime.js +0 -242
- package/dist/runtime.js.map +0 -1
- package/dist/schema.d.ts +0 -379
- package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
- package/dist/testing-compiler.d.ts +0 -37
- package/dist/testing-compiler.js +0 -272
- package/dist/testing-compiler.js.map +0 -1
- package/dist/testing-runtime.d.ts +0 -119
- package/dist/testing-runtime.js +0 -212
- package/dist/testing-runtime.js.map +0 -1
- package/dist/types-DJj5MJkl.d.ts +0 -256
- package/dist/types-DR7DoB1x.d.ts +0 -28
- package/dist/types-JWCYHmu7.d.ts +0 -122
- package/dist/types.d.ts +0 -1958
- package/dist/types.js +0 -14
- package/dist/types.js.map +0 -1
- package/dist/ui/components.d.ts +0 -17
- package/dist/ui/components.js +0 -216
- package/dist/ui/components.js.map +0 -1
- package/dist/ui/defaults.d.ts +0 -19
- package/dist/ui/defaults.js +0 -104
- package/dist/ui/defaults.js.map +0 -1
- package/dist/ui/player-state.d.ts +0 -2
- package/dist/ui/player-state.js +0 -1
- package/dist/ui/player-state.js.map +0 -1
- package/dist/ui/plugin-styles.css +0 -2
- package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
- package/dist/ui.d.ts +0 -317
- package/dist/ui.js +0 -277
- package/dist/ui.js.map +0 -1
- package/dist/views-BpuWcOyN.d.ts +0 -1641
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BoardProjectionSchema,
|
|
3
|
+
BoardSpaceTargetSchema,
|
|
4
|
+
GENERATED_ID_PREFIX,
|
|
5
|
+
PlayerIdSchema,
|
|
6
|
+
PlayerRosterSchema,
|
|
7
|
+
ProjectedTileSchema,
|
|
8
|
+
RuntimeJsonSchema,
|
|
9
|
+
SeatTileRefSchema,
|
|
10
|
+
__export
|
|
11
|
+
} from "./chunk-CZRPUWCT.js";
|
|
12
|
+
|
|
13
|
+
// src/shared/domain/cards.ts
|
|
14
|
+
import * as z from "zod";
|
|
15
|
+
var CARD_REFERENCE_PREFIX = "card-ref:";
|
|
16
|
+
var HiddenCardIdSchema = z.string().regex(/^card-ref:sha256:[0-9a-f]{64}$/);
|
|
17
|
+
function isHiddenCardId(id) {
|
|
18
|
+
return HiddenCardIdSchema.safeParse(id).success;
|
|
19
|
+
}
|
|
20
|
+
function isCardReferenceNamespace(id) {
|
|
21
|
+
return id.startsWith(CARD_REFERENCE_PREFIX);
|
|
22
|
+
}
|
|
23
|
+
var ViewCardSchema = z.strictObject({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
cardType: z.string(),
|
|
26
|
+
name: z.string().optional(),
|
|
27
|
+
text: z.string().optional(),
|
|
28
|
+
/** Manifest asset path; game UIs receive a loadable URL. */
|
|
29
|
+
frontImage: z.string().optional(),
|
|
30
|
+
/** Manifest asset path; game UIs receive a loadable URL. */
|
|
31
|
+
backImage: z.string().optional(),
|
|
32
|
+
properties: z.record(z.string(), RuntimeJsonSchema)
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// src/shared/interaction-schema.ts
|
|
36
|
+
import * as z2 from "zod";
|
|
37
|
+
var InteractionCommitPolicySchema = z2.discriminatedUnion("mode", [
|
|
38
|
+
z2.object({ mode: z2.literal("manual") }).strict(),
|
|
39
|
+
z2.object({ mode: z2.literal("autoWhenReady") }).strict()
|
|
40
|
+
]);
|
|
41
|
+
var InputSelectionSchema = z2.discriminatedUnion("mode", [
|
|
42
|
+
z2.object({ mode: z2.literal("single") }).strict(),
|
|
43
|
+
z2.object({
|
|
44
|
+
mode: z2.literal("many"),
|
|
45
|
+
min: z2.number().int(),
|
|
46
|
+
max: z2.number().int().optional(),
|
|
47
|
+
distinct: z2.boolean().optional()
|
|
48
|
+
}).strict()
|
|
49
|
+
]);
|
|
50
|
+
var InteractionChoiceOptionSchema = z2.object({
|
|
51
|
+
value: z2.string().nullable(),
|
|
52
|
+
label: z2.string(),
|
|
53
|
+
icon: z2.string().optional(),
|
|
54
|
+
badge: z2.string().optional(),
|
|
55
|
+
description: z2.string().optional(),
|
|
56
|
+
disabled: z2.boolean().optional(),
|
|
57
|
+
disabledReason: z2.string().optional()
|
|
58
|
+
}).strict();
|
|
59
|
+
var selection = { selection: InputSelectionSchema.optional() };
|
|
60
|
+
var InputDomainSchema = z2.discriminatedUnion("type", [
|
|
61
|
+
z2.strictObject({
|
|
62
|
+
type: z2.literal("cardTarget"),
|
|
63
|
+
projection: z2.literal("resolved"),
|
|
64
|
+
targetKind: z2.literal("card"),
|
|
65
|
+
zoneIds: z2.array(z2.string()),
|
|
66
|
+
eligibleTargets: z2.array(z2.string()),
|
|
67
|
+
...selection
|
|
68
|
+
}),
|
|
69
|
+
z2.strictObject({
|
|
70
|
+
type: z2.literal("tileTarget"),
|
|
71
|
+
projection: z2.literal("resolved"),
|
|
72
|
+
targetKind: z2.literal("tile"),
|
|
73
|
+
zoneIds: z2.array(z2.string()),
|
|
74
|
+
boardIds: z2.array(z2.string()),
|
|
75
|
+
eligibleTargets: z2.array(SeatTileRefSchema),
|
|
76
|
+
...selection
|
|
77
|
+
}),
|
|
78
|
+
z2.discriminatedUnion("valueKind", [
|
|
79
|
+
z2.strictObject({
|
|
80
|
+
type: z2.literal("boardTarget"),
|
|
81
|
+
projection: z2.literal("resolved"),
|
|
82
|
+
targetKind: z2.enum(["edge", "vertex", "space"]),
|
|
83
|
+
boardId: z2.string(),
|
|
84
|
+
valueKind: z2.literal("board-id"),
|
|
85
|
+
eligibleTargets: z2.array(z2.string()),
|
|
86
|
+
...selection
|
|
87
|
+
}),
|
|
88
|
+
z2.strictObject({
|
|
89
|
+
type: z2.literal("boardTarget"),
|
|
90
|
+
projection: z2.literal("resolved"),
|
|
91
|
+
targetKind: z2.literal("space"),
|
|
92
|
+
boardBaseId: z2.string(),
|
|
93
|
+
valueKind: z2.literal("board-space"),
|
|
94
|
+
eligibleTargets: z2.array(BoardSpaceTargetSchema),
|
|
95
|
+
...selection
|
|
96
|
+
})
|
|
97
|
+
]),
|
|
98
|
+
z2.strictObject({
|
|
99
|
+
type: z2.literal("zonePosition"),
|
|
100
|
+
/** Each zone host a component may be placed in, and how many it holds now. */
|
|
101
|
+
zones: z2.array(
|
|
102
|
+
z2.strictObject({
|
|
103
|
+
zoneId: z2.string(),
|
|
104
|
+
hostId: z2.string(),
|
|
105
|
+
size: z2.number().int().nonnegative()
|
|
106
|
+
})
|
|
107
|
+
),
|
|
108
|
+
...selection
|
|
109
|
+
}),
|
|
110
|
+
z2.strictObject({
|
|
111
|
+
type: z2.literal("resourceMap"),
|
|
112
|
+
resources: z2.array(
|
|
113
|
+
z2.strictObject({
|
|
114
|
+
resourceId: z2.string(),
|
|
115
|
+
label: z2.string().optional(),
|
|
116
|
+
icon: z2.string().optional(),
|
|
117
|
+
min: z2.number(),
|
|
118
|
+
max: z2.number()
|
|
119
|
+
})
|
|
120
|
+
),
|
|
121
|
+
...selection
|
|
122
|
+
}),
|
|
123
|
+
z2.strictObject({
|
|
124
|
+
type: z2.literal("boundedNumber"),
|
|
125
|
+
min: z2.number(),
|
|
126
|
+
max: z2.number(),
|
|
127
|
+
step: z2.number().optional(),
|
|
128
|
+
...selection
|
|
129
|
+
}),
|
|
130
|
+
z2.strictObject({
|
|
131
|
+
type: z2.literal("choice"),
|
|
132
|
+
choices: z2.array(InteractionChoiceOptionSchema),
|
|
133
|
+
...selection
|
|
134
|
+
}),
|
|
135
|
+
z2.strictObject({
|
|
136
|
+
type: z2.literal("choiceList"),
|
|
137
|
+
choices: z2.array(
|
|
138
|
+
InteractionChoiceOptionSchema.extend({ value: z2.string() })
|
|
139
|
+
),
|
|
140
|
+
min: z2.number().int().optional(),
|
|
141
|
+
max: z2.number().int().optional(),
|
|
142
|
+
...selection
|
|
143
|
+
})
|
|
144
|
+
]);
|
|
145
|
+
var InteractionInputDescriptorSchema = z2.object({
|
|
146
|
+
key: z2.string().min(1),
|
|
147
|
+
kind: z2.enum([
|
|
148
|
+
"form",
|
|
149
|
+
"board-vertex",
|
|
150
|
+
"board-edge",
|
|
151
|
+
"tile",
|
|
152
|
+
"board-space",
|
|
153
|
+
"card",
|
|
154
|
+
"position",
|
|
155
|
+
"rng"
|
|
156
|
+
]),
|
|
157
|
+
domain: InputDomainSchema,
|
|
158
|
+
defaultValue: RuntimeJsonSchema.optional()
|
|
159
|
+
}).strict();
|
|
160
|
+
var InteractionAvailabilitySchema = z2.discriminatedUnion("status", [
|
|
161
|
+
z2.object({ status: z2.literal("available") }).strict(),
|
|
162
|
+
z2.object({ status: z2.literal("notYourTurn"), reason: z2.string() }).strict(),
|
|
163
|
+
z2.object({
|
|
164
|
+
status: z2.literal("blocked"),
|
|
165
|
+
reason: z2.string(),
|
|
166
|
+
code: z2.string().optional()
|
|
167
|
+
}).strict()
|
|
168
|
+
]);
|
|
169
|
+
var InteractionBaseSchema = z2.object({
|
|
170
|
+
phaseName: z2.string().min(1),
|
|
171
|
+
interactionKey: z2.string().min(1),
|
|
172
|
+
interactionId: z2.string().min(1),
|
|
173
|
+
label: z2.string().min(1),
|
|
174
|
+
help: z2.string().optional(),
|
|
175
|
+
zoneId: z2.string().optional(),
|
|
176
|
+
zoneIds: z2.array(z2.string()).optional(),
|
|
177
|
+
commit: InteractionCommitPolicySchema,
|
|
178
|
+
descriptorDigest: z2.string().optional(),
|
|
179
|
+
actorSeat: z2.number().int().optional(),
|
|
180
|
+
draftDigest: z2.string().optional(),
|
|
181
|
+
inputs: z2.array(InteractionInputDescriptorSchema),
|
|
182
|
+
step: z2.object({
|
|
183
|
+
index: z2.number().int().nonnegative(),
|
|
184
|
+
total: z2.number().int().positive(),
|
|
185
|
+
selected: z2.record(z2.string(), RuntimeJsonSchema),
|
|
186
|
+
canCancel: z2.boolean()
|
|
187
|
+
}).strict().optional(),
|
|
188
|
+
availability: InteractionAvailabilitySchema,
|
|
189
|
+
reasons: z2.array(
|
|
190
|
+
z2.object({
|
|
191
|
+
ruleId: z2.string(),
|
|
192
|
+
errorCode: z2.string()
|
|
193
|
+
}).strict()
|
|
194
|
+
).optional()
|
|
195
|
+
}).strict();
|
|
196
|
+
var InteractionDescriptorSchema = InteractionBaseSchema.extend({
|
|
197
|
+
kind: z2.literal("action")
|
|
198
|
+
}).strict();
|
|
199
|
+
var ZoneInteractionRefsSchema = z2.strictObject({
|
|
200
|
+
tiles: z2.array(ProjectedTileSchema),
|
|
201
|
+
cardIds: z2.array(z2.string()),
|
|
202
|
+
cardViewsById: z2.record(z2.string(), ViewCardSchema),
|
|
203
|
+
cardBacksById: z2.record(z2.string(), z2.string()),
|
|
204
|
+
playableByCardId: z2.record(z2.string(), z2.array(z2.string()))
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// src/shared/runtime-schema.ts
|
|
208
|
+
var runtime_schema_exports = {};
|
|
209
|
+
__export(runtime_schema_exports, {
|
|
210
|
+
AuthoredViewSchema: () => AuthoredViewSchema,
|
|
211
|
+
BoardProjectionSchema: () => BoardProjectionSchema,
|
|
212
|
+
DispatchRequestSchema: () => DispatchRequestSchema,
|
|
213
|
+
DispatchResultAcceptSchema: () => DispatchResultAcceptSchema,
|
|
214
|
+
DispatchResultRejectSchema: () => DispatchResultRejectSchema,
|
|
215
|
+
DispatchResultSchema: () => DispatchResultSchema,
|
|
216
|
+
DispatchTraceAcceptedClientInputSchema: () => DispatchTraceAcceptedClientInputSchema,
|
|
217
|
+
DispatchTracePhaseEnteredSchema: () => DispatchTracePhaseEnteredSchema,
|
|
218
|
+
DispatchTraceRngConsumptionSchema: () => DispatchTraceRngConsumptionSchema,
|
|
219
|
+
DispatchTraceSchema: () => DispatchTraceSchema,
|
|
220
|
+
EventAudienceSchema: () => EventAudienceSchema,
|
|
221
|
+
GameEventDetailSchema: () => GameEventDetailSchema,
|
|
222
|
+
GameEventSchema: () => GameEventSchema,
|
|
223
|
+
GameInputCancelSchema: () => GameInputCancelSchema,
|
|
224
|
+
GameInputInteractionSchema: () => GameInputInteractionSchema,
|
|
225
|
+
GameInputSchema: () => GameInputSchema,
|
|
226
|
+
GameOutcomeReasonSchema: () => GameOutcomeReasonSchema,
|
|
227
|
+
GameOutcomeSchema: () => GameOutcomeSchema,
|
|
228
|
+
GameplayBasisSchema: () => GameplayBasisSchema,
|
|
229
|
+
InitializeRequestSchema: () => InitializeRequestSchema,
|
|
230
|
+
InitializeResultSchema: () => InitializeResultSchema,
|
|
231
|
+
OutcomeResultSchema: () => OutcomeResultSchema,
|
|
232
|
+
OutcomeScoreComponentSchema: () => OutcomeScoreComponentSchema,
|
|
233
|
+
OutcomeStandingSchema: () => OutcomeStandingSchema,
|
|
234
|
+
OutcomeTieBreakSchema: () => OutcomeTieBreakSchema,
|
|
235
|
+
ProjectRequestSchema: () => ProjectRequestSchema,
|
|
236
|
+
ProjectedGameEventDetailSchema: () => ProjectedGameEventDetailSchema,
|
|
237
|
+
ProjectedGameEventSchema: () => ProjectedGameEventSchema,
|
|
238
|
+
ProjectionTimingMetadataSchema: () => ProjectionTimingMetadataSchema,
|
|
239
|
+
ReducerContractVersionSchema: () => ReducerContractVersionSchema,
|
|
240
|
+
ReducerDomainStateSchema: () => ReducerDomainStateSchema,
|
|
241
|
+
ReducerFlowStateSchema: () => ReducerFlowStateSchema,
|
|
242
|
+
ReducerRuntimeLogEntryAcceptedClientInputSchema: () => ReducerRuntimeLogEntryAcceptedClientInputSchema,
|
|
243
|
+
ReducerRuntimeLogEntryPhaseEnteredSchema: () => ReducerRuntimeLogEntryPhaseEnteredSchema,
|
|
244
|
+
ReducerRuntimeLogEntryRngConsumptionSchema: () => ReducerRuntimeLogEntryRngConsumptionSchema,
|
|
245
|
+
ReducerRuntimeLogEntrySchema: () => ReducerRuntimeLogEntrySchema,
|
|
246
|
+
ReducerRuntimeLogEntryStateCommitSchema: () => ReducerRuntimeLogEntryStateCommitSchema,
|
|
247
|
+
ReducerRuntimeStateSchema: () => ReducerRuntimeStateSchema,
|
|
248
|
+
ReducerSessionStateSchema: () => ReducerSessionStateSchema,
|
|
249
|
+
ReferenceBasisSchema: () => ReferenceBasisSchema,
|
|
250
|
+
RngDrawSchema: () => RngDrawSchema,
|
|
251
|
+
RngOperationParameterSchema: () => RngOperationParameterSchema,
|
|
252
|
+
RngOperationSchema: () => RngOperationSchema,
|
|
253
|
+
RngStateSchema: () => RngStateSchema,
|
|
254
|
+
RuntimePendingInteractionSchema: () => RuntimePendingInteractionSchema,
|
|
255
|
+
RuntimeSimultaneousCurrentSchema: () => RuntimeSimultaneousCurrentSchema,
|
|
256
|
+
RuntimeSimultaneousStateSchema: () => RuntimeSimultaneousStateSchema,
|
|
257
|
+
RuntimeSimultaneousSubmissionSchema: () => RuntimeSimultaneousSubmissionSchema,
|
|
258
|
+
SchedulerContinuationDependencySchema: () => SchedulerContinuationDependencySchema,
|
|
259
|
+
SchedulerFlowAuthorityProjectionSchema: () => SchedulerFlowAuthorityProjectionSchema,
|
|
260
|
+
SeatProjectionBundleSchema: () => SeatProjectionBundleSchema,
|
|
261
|
+
SeatProjectionSchema: () => SeatProjectionSchema,
|
|
262
|
+
SimultaneousPhaseProjectionSchema: () => SimultaneousPhaseProjectionSchema,
|
|
263
|
+
SystemActionEventSchema: () => SystemActionEventSchema,
|
|
264
|
+
TransitionRecordSchema: () => TransitionRecordSchema
|
|
265
|
+
});
|
|
266
|
+
import * as z3 from "zod";
|
|
267
|
+
var ReducerContractVersionSchema = z3.string().regex(new RegExp("^[0-9]+\\.[0-9]+\\.[0-9]+$"));
|
|
268
|
+
var RngOperationParameterSchema = z3.union([
|
|
269
|
+
z3.string(),
|
|
270
|
+
z3.number().finite(),
|
|
271
|
+
z3.boolean()
|
|
272
|
+
]);
|
|
273
|
+
var RngOperationSchema = z3.strictObject({
|
|
274
|
+
kind: z3.string().min(1),
|
|
275
|
+
parameters: z3.record(z3.string(), RngOperationParameterSchema)
|
|
276
|
+
});
|
|
277
|
+
var RngDrawSchema = z3.strictObject({
|
|
278
|
+
index: z3.number().int().gte(0),
|
|
279
|
+
cursorBefore: z3.number().int().gte(0),
|
|
280
|
+
cursorAfter: z3.number().int().gte(0),
|
|
281
|
+
operation: RngOperationSchema
|
|
282
|
+
});
|
|
283
|
+
var RngStateSchema = z3.strictObject({
|
|
284
|
+
seed: z3.union([
|
|
285
|
+
z3.number().refine(Number.isInteger, { message: "Expected integer" }),
|
|
286
|
+
z3.null()
|
|
287
|
+
]),
|
|
288
|
+
cursor: z3.number().int(),
|
|
289
|
+
trace: z3.array(z3.string()),
|
|
290
|
+
draws: z3.array(RngDrawSchema).optional()
|
|
291
|
+
});
|
|
292
|
+
var ReducerFlowStateSchema = z3.strictObject({
|
|
293
|
+
currentPhase: z3.string().min(1),
|
|
294
|
+
turn: z3.number().int(),
|
|
295
|
+
round: z3.number().int(),
|
|
296
|
+
activePlayers: z3.array(PlayerIdSchema)
|
|
297
|
+
});
|
|
298
|
+
var RuntimeSimultaneousSubmissionSchema = z3.strictObject({
|
|
299
|
+
interactionId: z3.string().min(1),
|
|
300
|
+
params: RuntimeJsonSchema
|
|
301
|
+
});
|
|
302
|
+
var RuntimeSimultaneousCurrentSchema = z3.strictObject({
|
|
303
|
+
phaseName: z3.string().min(1),
|
|
304
|
+
actors: z3.array(PlayerIdSchema),
|
|
305
|
+
submissions: z3.record(PlayerIdSchema, RuntimeSimultaneousSubmissionSchema)
|
|
306
|
+
});
|
|
307
|
+
var RuntimeSimultaneousStateSchema = z3.strictObject({
|
|
308
|
+
current: z3.union([RuntimeSimultaneousCurrentSchema, z3.null()])
|
|
309
|
+
});
|
|
310
|
+
var TransitionRecordSchema = z3.strictObject({
|
|
311
|
+
from: z3.string().min(1),
|
|
312
|
+
to: z3.string().min(1)
|
|
313
|
+
});
|
|
314
|
+
var ReferenceBasisSchema = z3.strictObject({
|
|
315
|
+
sessionId: z3.string().min(1),
|
|
316
|
+
version: z3.number().int().gte(0)
|
|
317
|
+
});
|
|
318
|
+
var RuntimePendingInteractionSchema = z3.strictObject({
|
|
319
|
+
phaseName: z3.string().min(1),
|
|
320
|
+
interactionId: z3.string().min(1),
|
|
321
|
+
values: z3.array(RuntimeJsonSchema).min(1),
|
|
322
|
+
concealedBasis: ReferenceBasisSchema.optional()
|
|
323
|
+
});
|
|
324
|
+
var GameEventDetailSchema = z3.strictObject({
|
|
325
|
+
label: z3.string().min(1),
|
|
326
|
+
value: z3.union([
|
|
327
|
+
z3.string(),
|
|
328
|
+
z3.number().finite(),
|
|
329
|
+
z3.boolean(),
|
|
330
|
+
z3.strictObject({ kind: z3.literal("tile"), tileId: z3.string().min(1) })
|
|
331
|
+
])
|
|
332
|
+
});
|
|
333
|
+
var EventAudienceSchema = z3.discriminatedUnion("kind", [
|
|
334
|
+
z3.strictObject({ kind: z3.literal("public") }),
|
|
335
|
+
z3.strictObject({
|
|
336
|
+
kind: z3.literal("seats"),
|
|
337
|
+
playerIds: z3.array(PlayerIdSchema).min(1)
|
|
338
|
+
}).superRefine((audience, context) => {
|
|
339
|
+
if (new Set(audience.playerIds).size !== audience.playerIds.length)
|
|
340
|
+
context.addIssue({
|
|
341
|
+
code: "custom",
|
|
342
|
+
path: ["playerIds"],
|
|
343
|
+
message: "Event audience seats must be unique."
|
|
344
|
+
});
|
|
345
|
+
})
|
|
346
|
+
]);
|
|
347
|
+
var ProjectedGameEventDetailSchema = GameEventDetailSchema.extend({
|
|
348
|
+
value: z3.union([
|
|
349
|
+
z3.string(),
|
|
350
|
+
z3.number().finite(),
|
|
351
|
+
z3.boolean(),
|
|
352
|
+
z3.strictObject({ kind: z3.literal("tile"), ref: SeatTileRefSchema })
|
|
353
|
+
])
|
|
354
|
+
});
|
|
355
|
+
var ProjectedGameEventSchema = z3.strictObject({
|
|
356
|
+
kind: z3.literal("systemAction"),
|
|
357
|
+
procedureId: z3.string().min(1),
|
|
358
|
+
title: z3.string().min(1),
|
|
359
|
+
summary: z3.string().min(1).optional(),
|
|
360
|
+
details: z3.array(ProjectedGameEventDetailSchema).max(16).optional()
|
|
361
|
+
});
|
|
362
|
+
var SystemActionEventSchema = ProjectedGameEventSchema.extend({
|
|
363
|
+
audience: EventAudienceSchema,
|
|
364
|
+
details: z3.array(GameEventDetailSchema).max(16).optional()
|
|
365
|
+
});
|
|
366
|
+
var GameEventSchema = z3.discriminatedUnion("kind", [
|
|
367
|
+
SystemActionEventSchema
|
|
368
|
+
]);
|
|
369
|
+
var GameplayBasisSchema = ReferenceBasisSchema.extend({
|
|
370
|
+
actionSetVersion: z3.string().min(1),
|
|
371
|
+
perspectivePlayerId: PlayerIdSchema
|
|
372
|
+
});
|
|
373
|
+
var ReducerRuntimeStateSchema = z3.strictObject({
|
|
374
|
+
events: z3.array(GameEventSchema).max(32),
|
|
375
|
+
rng: RngStateSchema,
|
|
376
|
+
pending: z3.record(z3.string(), RuntimePendingInteractionSchema),
|
|
377
|
+
simultaneous: RuntimeSimultaneousStateSchema,
|
|
378
|
+
lastTransition: z3.union([TransitionRecordSchema, z3.null()]),
|
|
379
|
+
options: z3.record(z3.string(), RuntimeJsonSchema)
|
|
380
|
+
});
|
|
381
|
+
var ReducerDomainStateSchema = z3.strictObject({
|
|
382
|
+
table: RuntimeJsonSchema,
|
|
383
|
+
publicState: RuntimeJsonSchema,
|
|
384
|
+
privateState: z3.record(PlayerIdSchema, RuntimeJsonSchema),
|
|
385
|
+
hiddenState: RuntimeJsonSchema,
|
|
386
|
+
flow: ReducerFlowStateSchema,
|
|
387
|
+
phase: RuntimeJsonSchema
|
|
388
|
+
});
|
|
389
|
+
var ReducerSessionStateSchema = z3.strictObject({
|
|
390
|
+
domain: ReducerDomainStateSchema,
|
|
391
|
+
runtime: ReducerRuntimeStateSchema
|
|
392
|
+
});
|
|
393
|
+
var GameInputInteractionSchema = z3.strictObject({
|
|
394
|
+
kind: z3.literal("interaction"),
|
|
395
|
+
basis: GameplayBasisSchema,
|
|
396
|
+
playerId: PlayerIdSchema,
|
|
397
|
+
interactionId: z3.string().min(1),
|
|
398
|
+
params: RuntimeJsonSchema
|
|
399
|
+
});
|
|
400
|
+
var GameInputCancelSchema = z3.strictObject({
|
|
401
|
+
kind: z3.literal("interaction.cancel"),
|
|
402
|
+
basis: GameplayBasisSchema,
|
|
403
|
+
playerId: PlayerIdSchema,
|
|
404
|
+
interactionId: z3.string().min(1)
|
|
405
|
+
});
|
|
406
|
+
var GameInputSchema = z3.discriminatedUnion("kind", [
|
|
407
|
+
GameInputInteractionSchema,
|
|
408
|
+
GameInputCancelSchema
|
|
409
|
+
]);
|
|
410
|
+
var GameOutcomeReasonSchema = z3.strictObject({
|
|
411
|
+
code: z3.string().min(1),
|
|
412
|
+
message: z3.string().min(1).optional()
|
|
413
|
+
});
|
|
414
|
+
var OutcomeResultSchema = z3.enum([
|
|
415
|
+
"win",
|
|
416
|
+
"draw",
|
|
417
|
+
"loss",
|
|
418
|
+
"eliminated"
|
|
419
|
+
]);
|
|
420
|
+
var OutcomeScoreComponentSchema = z3.strictObject({
|
|
421
|
+
id: z3.string().min(1),
|
|
422
|
+
label: z3.string().min(1),
|
|
423
|
+
value: z3.number().finite()
|
|
424
|
+
});
|
|
425
|
+
var OutcomeTieBreakSchema = z3.strictObject({
|
|
426
|
+
id: z3.string().min(1),
|
|
427
|
+
label: z3.string().min(1),
|
|
428
|
+
value: z3.union([z3.number().finite(), z3.string()])
|
|
429
|
+
});
|
|
430
|
+
var OutcomeStandingSchema = z3.strictObject({
|
|
431
|
+
playerId: PlayerIdSchema,
|
|
432
|
+
rank: z3.number().int().gte(1),
|
|
433
|
+
result: OutcomeResultSchema,
|
|
434
|
+
score: z3.number().finite().optional(),
|
|
435
|
+
scoreBreakdown: z3.array(OutcomeScoreComponentSchema).optional(),
|
|
436
|
+
tieBreaks: z3.array(OutcomeTieBreakSchema).optional()
|
|
437
|
+
});
|
|
438
|
+
var GameOutcomeSchema = z3.strictObject({
|
|
439
|
+
reason: GameOutcomeReasonSchema,
|
|
440
|
+
standings: z3.array(OutcomeStandingSchema).min(1)
|
|
441
|
+
});
|
|
442
|
+
var InitializeResultSchema = z3.strictObject({
|
|
443
|
+
state: ReducerSessionStateSchema,
|
|
444
|
+
terminal: GameOutcomeSchema.optional(),
|
|
445
|
+
events: z3.array(GameEventSchema).optional()
|
|
446
|
+
});
|
|
447
|
+
var InitializeRequestSchema = z3.strictObject({
|
|
448
|
+
table: RuntimeJsonSchema,
|
|
449
|
+
playerIds: PlayerRosterSchema,
|
|
450
|
+
rngSeed: z3.union([
|
|
451
|
+
z3.number().refine(Number.isInteger, { message: "Expected integer" }),
|
|
452
|
+
z3.null()
|
|
453
|
+
]).optional(),
|
|
454
|
+
options: z3.record(z3.string(), RuntimeJsonSchema).optional()
|
|
455
|
+
});
|
|
456
|
+
var DispatchRequestSchema = z3.strictObject({
|
|
457
|
+
referenceBasis: ReferenceBasisSchema,
|
|
458
|
+
state: ReducerSessionStateSchema,
|
|
459
|
+
input: GameInputSchema
|
|
460
|
+
});
|
|
461
|
+
var DispatchTraceAcceptedClientInputSchema = z3.strictObject({
|
|
462
|
+
kind: z3.literal("acceptedClientInput"),
|
|
463
|
+
input: GameInputSchema
|
|
464
|
+
});
|
|
465
|
+
var DispatchTracePhaseEnteredSchema = z3.strictObject({
|
|
466
|
+
kind: z3.literal("phaseEntered"),
|
|
467
|
+
from: z3.string(),
|
|
468
|
+
to: z3.string()
|
|
469
|
+
});
|
|
470
|
+
var DispatchTraceRngConsumptionSchema = z3.strictObject({
|
|
471
|
+
kind: z3.literal("rngConsumption"),
|
|
472
|
+
version: z3.literal(2),
|
|
473
|
+
operation: z3.string().min(1),
|
|
474
|
+
drawIndex: z3.number().int().gte(0),
|
|
475
|
+
traceEntry: z3.string()
|
|
476
|
+
});
|
|
477
|
+
var DispatchTraceSchema = z3.discriminatedUnion("kind", [
|
|
478
|
+
DispatchTraceAcceptedClientInputSchema,
|
|
479
|
+
DispatchTracePhaseEnteredSchema,
|
|
480
|
+
DispatchTraceRngConsumptionSchema
|
|
481
|
+
]);
|
|
482
|
+
var DispatchResultRejectSchema = z3.strictObject({
|
|
483
|
+
kind: z3.literal("reject"),
|
|
484
|
+
errorCode: z3.string().min(1),
|
|
485
|
+
message: z3.string().optional()
|
|
486
|
+
});
|
|
487
|
+
var DispatchResultAcceptSchema = z3.strictObject({
|
|
488
|
+
kind: z3.literal("accept"),
|
|
489
|
+
state: ReducerSessionStateSchema,
|
|
490
|
+
terminal: GameOutcomeSchema.optional(),
|
|
491
|
+
trace: z3.array(DispatchTraceSchema),
|
|
492
|
+
events: z3.array(GameEventSchema).max(32)
|
|
493
|
+
});
|
|
494
|
+
var DispatchResultSchema = z3.discriminatedUnion("kind", [
|
|
495
|
+
DispatchResultRejectSchema,
|
|
496
|
+
DispatchResultAcceptSchema
|
|
497
|
+
]);
|
|
498
|
+
var ReducerRuntimeLogEntryAcceptedClientInputSchema = z3.strictObject({
|
|
499
|
+
kind: z3.literal("acceptedClientInput"),
|
|
500
|
+
version: z3.number().int(),
|
|
501
|
+
input: GameInputSchema
|
|
502
|
+
});
|
|
503
|
+
var ReducerRuntimeLogEntryPhaseEnteredSchema = z3.strictObject({
|
|
504
|
+
kind: z3.literal("phaseEntered"),
|
|
505
|
+
from: z3.string(),
|
|
506
|
+
to: z3.string(),
|
|
507
|
+
version: z3.number().int()
|
|
508
|
+
});
|
|
509
|
+
var ReducerRuntimeLogEntryRngConsumptionSchema = z3.strictObject({
|
|
510
|
+
kind: z3.literal("rngConsumption"),
|
|
511
|
+
version: z3.number().int(),
|
|
512
|
+
operation: z3.string().min(1),
|
|
513
|
+
drawIndex: z3.number().int().gte(0).optional(),
|
|
514
|
+
traceEntry: z3.string()
|
|
515
|
+
});
|
|
516
|
+
var ReducerRuntimeLogEntryStateCommitSchema = z3.strictObject({
|
|
517
|
+
kind: z3.literal("stateCommit"),
|
|
518
|
+
version: z3.number().int(),
|
|
519
|
+
state: ReducerSessionStateSchema
|
|
520
|
+
});
|
|
521
|
+
var ReducerRuntimeLogEntrySchema = z3.discriminatedUnion("kind", [
|
|
522
|
+
ReducerRuntimeLogEntryAcceptedClientInputSchema,
|
|
523
|
+
ReducerRuntimeLogEntryPhaseEnteredSchema,
|
|
524
|
+
ReducerRuntimeLogEntryRngConsumptionSchema,
|
|
525
|
+
ReducerRuntimeLogEntryStateCommitSchema
|
|
526
|
+
]);
|
|
527
|
+
var AuthoredViewSchema = z3.object({
|
|
528
|
+
boards: z3.never({
|
|
529
|
+
error: "The view field 'boards' is reserved for projected board topology."
|
|
530
|
+
}).optional()
|
|
531
|
+
}).catchall(RuntimeJsonSchema);
|
|
532
|
+
var SeatProjectionSchema = z3.strictObject({
|
|
533
|
+
events: z3.array(ProjectedGameEventSchema).max(32),
|
|
534
|
+
view: AuthoredViewSchema.nullable().optional(),
|
|
535
|
+
boards: BoardProjectionSchema.optional(),
|
|
536
|
+
availableInteractionRefs: z3.array(z3.string()).optional(),
|
|
537
|
+
zones: z3.record(z3.string(), z3.record(z3.string(), ZoneInteractionRefsSchema)).optional(),
|
|
538
|
+
/** Resource balances by player that this seat may see. */
|
|
539
|
+
resources: z3.record(z3.string(), z3.record(z3.string(), z3.number().int())).optional()
|
|
540
|
+
});
|
|
541
|
+
var SimultaneousPhaseProjectionSchema = z3.strictObject({
|
|
542
|
+
phaseName: z3.string().min(1),
|
|
543
|
+
interactionId: z3.string().min(1),
|
|
544
|
+
actorIds: z3.array(z3.string().min(1)),
|
|
545
|
+
sealedPlayerIds: z3.array(z3.string().min(1)),
|
|
546
|
+
pendingPlayerIds: z3.array(z3.string().min(1))
|
|
547
|
+
});
|
|
548
|
+
var SchedulerContinuationDependencySchema = z3.strictObject({
|
|
549
|
+
waiterPlayerId: z3.string().min(1),
|
|
550
|
+
blockerPlayerIds: z3.array(z3.string().min(1))
|
|
551
|
+
});
|
|
552
|
+
var SchedulerFlowAuthorityProjectionSchema = z3.strictObject({
|
|
553
|
+
version: z3.literal(1),
|
|
554
|
+
activePlayerIds: z3.array(z3.string().min(1)),
|
|
555
|
+
pendingPlayerIds: z3.array(z3.string().min(1)),
|
|
556
|
+
continuationDependencies: z3.array(SchedulerContinuationDependencySchema)
|
|
557
|
+
});
|
|
558
|
+
var ProjectionTimingMetadataSchema = z3.strictObject({
|
|
559
|
+
resolveAvailableInteractionsMs: z3.number().finite().gte(0),
|
|
560
|
+
resolveViewMs: z3.number().finite().gte(0),
|
|
561
|
+
resolveZoneHandlesMs: z3.number().finite().gte(0),
|
|
562
|
+
descriptorHashMs: z3.number().finite().gte(0)
|
|
563
|
+
});
|
|
564
|
+
var SeatProjectionBundleSchema = z3.strictObject({
|
|
565
|
+
referenceBasis: ReferenceBasisSchema,
|
|
566
|
+
simultaneousPhase: z3.union([SimultaneousPhaseProjectionSchema, z3.null()]).optional(),
|
|
567
|
+
schedulerFlow: SchedulerFlowAuthorityProjectionSchema.optional(),
|
|
568
|
+
interactionsByRef: z3.record(z3.string(), InteractionDescriptorSchema).optional(),
|
|
569
|
+
seats: z3.record(PlayerIdSchema, SeatProjectionSchema),
|
|
570
|
+
timing: ProjectionTimingMetadataSchema.optional()
|
|
571
|
+
});
|
|
572
|
+
var ProjectRequestSchema = z3.strictObject({
|
|
573
|
+
referenceBasis: ReferenceBasisSchema,
|
|
574
|
+
state: ReducerSessionStateSchema,
|
|
575
|
+
playerIds: PlayerRosterSchema
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// src/shared/domain/board-space-host.ts
|
|
579
|
+
import * as z4 from "zod";
|
|
580
|
+
var hostTuple = z4.tuple([
|
|
581
|
+
z4.literal("board-space"),
|
|
582
|
+
z4.string().min(1),
|
|
583
|
+
z4.string().min(1)
|
|
584
|
+
]);
|
|
585
|
+
function boardSpaceHostId(boardId, spaceId) {
|
|
586
|
+
hostTuple.parse(["board-space", boardId, spaceId]);
|
|
587
|
+
return `${GENERATED_ID_PREFIX}${JSON.stringify(["board-space", boardId, spaceId])}`;
|
|
588
|
+
}
|
|
589
|
+
function parseBoardSpaceHostId(value) {
|
|
590
|
+
if (typeof value !== "string" || !value.startsWith(GENERATED_ID_PREFIX))
|
|
591
|
+
return null;
|
|
592
|
+
let candidate;
|
|
593
|
+
try {
|
|
594
|
+
candidate = JSON.parse(value.slice(GENERATED_ID_PREFIX.length));
|
|
595
|
+
} catch {
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
const parsed = hostTuple.safeParse(candidate);
|
|
599
|
+
if (!parsed.success) return null;
|
|
600
|
+
const [, boardId, spaceId] = parsed.data;
|
|
601
|
+
if (boardSpaceHostId(boardId, spaceId) !== value) return null;
|
|
602
|
+
return { boardId, spaceId };
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export {
|
|
606
|
+
CARD_REFERENCE_PREFIX,
|
|
607
|
+
isHiddenCardId,
|
|
608
|
+
isCardReferenceNamespace,
|
|
609
|
+
ViewCardSchema,
|
|
610
|
+
InteractionCommitPolicySchema,
|
|
611
|
+
InputDomainSchema,
|
|
612
|
+
InteractionInputDescriptorSchema,
|
|
613
|
+
InteractionAvailabilitySchema,
|
|
614
|
+
InteractionDescriptorSchema,
|
|
615
|
+
RngDrawSchema,
|
|
616
|
+
ReferenceBasisSchema,
|
|
617
|
+
ProjectedGameEventDetailSchema,
|
|
618
|
+
ProjectedGameEventSchema,
|
|
619
|
+
SystemActionEventSchema,
|
|
620
|
+
GameEventSchema,
|
|
621
|
+
ReducerSessionStateSchema,
|
|
622
|
+
GameInputSchema,
|
|
623
|
+
GameOutcomeSchema,
|
|
624
|
+
SimultaneousPhaseProjectionSchema,
|
|
625
|
+
SeatProjectionBundleSchema,
|
|
626
|
+
runtime_schema_exports,
|
|
627
|
+
boardSpaceHostId,
|
|
628
|
+
parseBoardSpaceHostId
|
|
629
|
+
};
|
|
630
|
+
//# sourceMappingURL=chunk-U6R7FAH4.js.map
|