@dreamboard-games/sdk 0.4.0-alpha.6 → 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.
Files changed (46) hide show
  1. package/REFERENCE.md +408 -8
  2. package/dist/authoring/index.d.ts +5 -4
  3. package/dist/authoring/index.js +3 -3
  4. package/dist/authoring/index.js.map +1 -1
  5. package/dist/{chunk-PAPIAMYX.js → chunk-3QIZKXJ2.js} +6 -4
  6. package/dist/{chunk-PAPIAMYX.js.map → chunk-3QIZKXJ2.js.map} +1 -1
  7. package/dist/chunk-5IHU5CUK.js +575 -0
  8. package/dist/chunk-5IHU5CUK.js.map +1 -0
  9. package/dist/chunk-IU6KGPY7.js +659 -0
  10. package/dist/chunk-IU6KGPY7.js.map +1 -0
  11. package/dist/{chunk-HK3WN4U7.js → chunk-KYEWGZ2Y.js} +2 -2
  12. package/dist/{chunk-HK3WN4U7.js.map → chunk-KYEWGZ2Y.js.map} +1 -1
  13. package/dist/{chunk-DDST4U2P.js → chunk-NO537WSS.js} +2 -2
  14. package/dist/{chunk-SOBNI363.js → chunk-Q322XCY2.js} +11 -6
  15. package/dist/{chunk-SOBNI363.js.map → chunk-Q322XCY2.js.map} +1 -1
  16. package/dist/{chunk-OV6JC2BM.js → chunk-RKGJ64UN.js} +19 -15
  17. package/dist/chunk-RKGJ64UN.js.map +1 -0
  18. package/dist/chunk-VLG4YST5.js +564 -0
  19. package/dist/chunk-VLG4YST5.js.map +1 -0
  20. package/dist/{stale-contract-artifact-error-BelRiIDR.d.ts → diagnostics-1BWjRo6-.d.ts} +1 -18
  21. package/dist/index.js +2 -2
  22. package/dist/package-set.d.ts +2 -2
  23. package/dist/package-set.js +2 -2
  24. package/dist/reducer.d.ts +3 -2
  25. package/dist/reducer.js +5 -5
  26. package/dist/reducer.js.map +1 -1
  27. package/dist/reference-games/index.d.ts +223 -0
  28. package/dist/reference-games/index.js +230 -0
  29. package/dist/reference-games/index.js.map +1 -0
  30. package/dist/runtime/primitives.js +4 -3
  31. package/dist/runtime/workspace-contract.js +5 -4
  32. package/dist/runtime.js +15 -205
  33. package/dist/runtime.js.map +1 -1
  34. package/dist/stale-contract-artifact-error-C5AaZPJ8.d.ts +18 -0
  35. package/dist/testing-runtime.d.ts +42 -0
  36. package/dist/testing-runtime.js +153 -0
  37. package/dist/testing-runtime.js.map +1 -0
  38. package/dist/testing.d.ts +5 -191
  39. package/dist/testing.js +22 -640
  40. package/dist/testing.js.map +1 -1
  41. package/dist/types-DcADVHe9.d.ts +192 -0
  42. package/package.json +13 -2
  43. package/dist/chunk-OV6JC2BM.js.map +0 -1
  44. package/dist/chunk-UUQNOGZV.js +0 -1266
  45. package/dist/chunk-UUQNOGZV.js.map +0 -1
  46. /package/dist/{chunk-DDST4U2P.js.map → chunk-NO537WSS.js.map} +0 -0
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { R as ReducerDiagnosticEvent, D as DispatchTraceSummaryEntry } from './stale-contract-artifact-error-BelRiIDR.js';
2
- export { S as StaleContractArtifactError, b as StaleContractArtifactErrorOptions, c as StaleContractArtifactKind, i as isStaleContractArtifactError } from './stale-contract-artifact-error-BelRiIDR.js';
1
+ import { n as SnapshotMatcherHandler, E as ExpectFn, d as InteractionExplanationLike, C as CreateReducerScenarioRunnerOptions, i as ReducerScenarioRunner, j as ReducerScenarioTrace } from './types-DcADVHe9.js';
2
+ export { B as BaseContext, a as BaseDefinition, b as ExpectMatchers, I as InteractionAvailabilityLike, c as InteractionDescriptorLike, R as ReducerScenarioBundle, e as ReducerScenarioDiagnostic, f as ReducerScenarioExchange, g as ReducerScenarioFrame, h as ReducerScenarioOperation, k as ReducerScenarioViewer, l as RejectionExpectation, S as ScenarioDefinition, m as SharedScenarioContext, T as TestRunner, o as defineBase, p as defineScenario } from './types-DcADVHe9.js';
3
+ import { R as ReducerDiagnosticEvent, D as DispatchTraceSummaryEntry } from './diagnostics-1BWjRo6-.js';
3
4
  import { w as wire, a as ReducerBundleContract } from './index.d-DMASeF6M.js';
4
5
  import { p, w, v, t, u } from './protocol-835hEGne.js';
5
6
  import { R as RuntimeAPI, V as ValidationResult } from './runtime-api-C6aWo9c0.js';
@@ -9,128 +10,7 @@ import { r as BrowserInteractionIntentRequest, l as BrowserInteractionEffectRequ
9
10
  import { b as PluginTransport, P as PluginRuntimeClient } from './types-aI4V9CWe.js';
10
11
  import * as react_jsx_runtime from 'react/jsx-runtime';
11
12
  import react__default from 'react';
12
-
13
- type TestRunner = "reducer" | "remote" | "browser";
14
- type InteractionDescriptorLike = {
15
- interactionId?: string;
16
- surface?: string;
17
- kind?: string;
18
- availability?: InteractionAvailabilityLike;
19
- context?: {
20
- to?: string;
21
- };
22
- } & Record<string, unknown>;
23
- type InteractionAvailabilityLike = {
24
- status: "available";
25
- } | {
26
- status: "notYourTurn";
27
- reason: string;
28
- } | {
29
- status: "insufficientResources";
30
- reason: string;
31
- missingResources?: Record<string, unknown>;
32
- } | {
33
- status: "blocked";
34
- reason: string;
35
- };
36
- type InteractionExplanationLike = {
37
- interactionId: string;
38
- phase: string;
39
- step: string | null;
40
- availability: "available" | "notYourTurn" | "wrongPhase" | "wrongStep" | "blocked";
41
- rules: ReadonlyArray<{
42
- ruleId: string;
43
- outcome: "passed" | "failed" | "notEvaluated";
44
- errorCode?: string;
45
- message?: string;
46
- }>;
47
- actor: {
48
- required: readonly string[];
49
- playerIsActor: boolean;
50
- };
51
- inputs: ReadonlyArray<{
52
- key: string;
53
- kind: string;
54
- eligibleCount: number | "lazy";
55
- }>;
56
- };
57
- type SnapshotMatcherHandler = (name: string | undefined, actual: unknown) => void;
58
- type RejectionExpectation = {
59
- errorCode?: string;
60
- message?: string | RegExp;
61
- };
62
- type ExpectMatchers = {
63
- toBe: (expected: unknown) => void;
64
- toEqual: (expected: unknown) => void;
65
- toMatchObject: (expected: Record<string, unknown>) => void;
66
- toBeDefined: () => void;
67
- toBeUndefined: () => void;
68
- toBeNull: () => void;
69
- toContain: (expected: unknown) => void;
70
- toContainEqual: (expected: unknown) => void;
71
- toHaveLength: (expected: number) => void;
72
- toBeGreaterThan: (expected: number) => void;
73
- toBeGreaterThanOrEqual: (expected: number) => void;
74
- toThrow: (predicate?: string | RegExp | ((error: Error) => boolean)) => void;
75
- toMatchSnapshot: (filename?: string) => void;
76
- toRejectWith: (expected: RejectionExpectation) => Promise<void>;
77
- toHaveInteraction: (interactionId: string, opts?: Partial<InteractionDescriptorLike>) => void;
78
- toBeGatedBy: (reason: string, opts?: {
79
- interactionId?: string;
80
- }) => void;
81
- toBeAvailable: (explanation?: InteractionExplanationLike) => void;
82
- toBeActiveFor: (playerId: string, opts?: {
83
- interactionId?: string;
84
- }) => void;
85
- not: {
86
- toHaveInteraction: (interactionId: string) => void;
87
- };
88
- };
89
- type ExpectFn = (actual: unknown) => ExpectMatchers;
90
- interface BaseContext<PlayerId extends string = string> {
91
- game: {
92
- start(): Promise<void>;
93
- patchState?(mutator: (state: Record<string, unknown>) => void): Promise<void>;
94
- submit(playerId: PlayerId, interactionId: string, params?: unknown): Promise<void>;
95
- };
96
- players(): readonly PlayerId[];
97
- seat(index: number): PlayerId;
98
- }
99
- interface SharedScenarioContext<PlayerId extends string = string, StateName extends string = string, View = unknown, Descriptor extends InteractionDescriptorLike = InteractionDescriptorLike> extends BaseContext<PlayerId> {
100
- state(): StateName;
101
- view(playerId: PlayerId): View;
102
- interactions(playerId: PlayerId): readonly Descriptor[];
103
- explain(playerId: PlayerId, interactionId: string): InteractionExplanationLike;
104
- diagnostics: {
105
- readonly events: readonly ReducerDiagnosticEvent[];
106
- readonly lastDispatch: {
107
- submissionId: string;
108
- trace: readonly DispatchTraceSummaryEntry[];
109
- } | null;
110
- clear(): void;
111
- };
112
- expect: ExpectFn;
113
- }
114
- interface BaseDefinition {
115
- id: string;
116
- seed?: number;
117
- players?: number;
118
- setupProfileId?: string | null;
119
- extends?: string;
120
- setup: (ctx: BaseContext) => void | Promise<void>;
121
- }
122
- interface ScenarioDefinition<Runners extends readonly TestRunner[] = readonly ["reducer"], PhaseName extends string = string, StageName extends string = string> {
123
- id: string;
124
- description?: string;
125
- from: string;
126
- runners?: Runners;
127
- phase?: PhaseName;
128
- stage?: StageName;
129
- when: (ctx: SharedScenarioContext) => void | Promise<void>;
130
- then: (ctx: SharedScenarioContext) => void | Promise<void>;
131
- }
132
- declare function defineBase<const Definition extends BaseDefinition>(definition: Definition): Definition;
133
- declare function defineScenario<const Runners extends readonly TestRunner[] = readonly ["reducer"], const PhaseName extends string = string, const StageName extends string = string>(definition: ScenarioDefinition<Runners, PhaseName, StageName>): ScenarioDefinition<Runners, PhaseName, StageName>;
13
+ export { S as StaleContractArtifactError, a as StaleContractArtifactErrorOptions, b as StaleContractArtifactKind, i as isStaleContractArtifactError } from './stale-contract-artifact-error-C5AaZPJ8.js';
134
14
 
135
15
  type CreateExpectApiOptions = {
136
16
  matchSnapshot?: SnapshotMatcherHandler;
@@ -190,72 +70,6 @@ type CreatedTestRuntime = {
190
70
  };
191
71
  declare function createTestRuntime(options: CreateTestRuntimeOptions): CreatedTestRuntime;
192
72
 
193
- type ReducerScenarioBundle = Pick<ReducerBundleContract, "projectSeatsDynamic" | "validateInput" | "dispatch" | "projectStatic">;
194
- interface ReducerScenarioViewer {
195
- readonly seatId: string;
196
- readonly playerId: string;
197
- }
198
- interface ReducerScenarioFrame {
199
- readonly id: string;
200
- readonly reducerState: wire.ReducerSessionState;
201
- readonly dynamicProjection: wire.SeatProjectionBundle;
202
- readonly staticProjection?: wire.BoardStaticProjection | null;
203
- readonly gameVersion: number;
204
- readonly actionSetVersion: string;
205
- readonly projectionDigest: string;
206
- }
207
- interface ReducerScenarioTrace {
208
- readonly scenarioId: string;
209
- readonly gameId: string;
210
- readonly viewer: ReducerScenarioViewer;
211
- readonly frames: readonly ReducerScenarioFrame[];
212
- readonly exchanges: readonly ReducerScenarioExchange[];
213
- }
214
- type ReducerScenarioExchange = {
215
- readonly id: string;
216
- readonly operation: "validate";
217
- readonly fromFrameId: string;
218
- readonly input: wire.GameInput;
219
- readonly result: wire.ReducerInputValidationResult;
220
- } | {
221
- readonly id: string;
222
- readonly operation: "submit";
223
- readonly fromFrameId: string;
224
- readonly input: wire.GameInput;
225
- readonly result: {
226
- readonly kind: "accepted";
227
- readonly toFrameId: string;
228
- } | {
229
- readonly kind: "rejected";
230
- readonly diagnostics: readonly ReducerScenarioDiagnostic[];
231
- };
232
- };
233
- interface ReducerScenarioDiagnostic {
234
- readonly code: string;
235
- readonly message: string;
236
- }
237
- type ReducerScenarioOperation = {
238
- readonly id: string;
239
- readonly operation: "validate";
240
- readonly input: wire.GameInput;
241
- } | {
242
- readonly id: string;
243
- readonly operation: "submit";
244
- readonly input: wire.GameInput;
245
- };
246
- interface CreateReducerScenarioRunnerOptions {
247
- readonly scenarioId: string;
248
- readonly gameId: string;
249
- readonly initialState: wire.ReducerSessionState;
250
- readonly bundle: ReducerScenarioBundle;
251
- readonly viewer: ReducerScenarioViewer;
252
- readonly playerIds: readonly string[];
253
- readonly initialGameVersion?: number;
254
- }
255
- interface ReducerScenarioRunner {
256
- run(operations: readonly ReducerScenarioOperation[]): Promise<ReducerScenarioTrace>;
257
- }
258
-
259
73
  declare function createReducerScenarioRunner(options: CreateReducerScenarioRunnerOptions): ReducerScenarioRunner;
260
74
 
261
75
  declare const UI_SCENARIO_FIXTURE_SCHEMA_VERSION = 2;
@@ -884,4 +698,4 @@ declare function drag(options: DragReplayStepOptions): UIScenarioReplayStep;
884
698
  declare function submit(options: ReplayStepOptions): UIScenarioReplayStep;
885
699
  declare function assertStep(stepId: string, expect: UIStepExpectation): UIScenarioReplayStep;
886
700
 
887
- export { type BaseContext, type BaseDefinition, type CompilePluginProtocolTapeOptions, type CompileUIScenarioFixtureOptions, type CreateFixtureHostHarnessOptions, type CreateReducerScenarioRunnerOptions, type CreateTestRuntimeOptions, type CreatedTestRuntime, type DeterministicIdFactory, type ExpectFn, type ExpectMatchers, type FixtureEnvironmentInit, type FixtureHostEvent, type FixtureHostHarness, FixturePluginRuntime, type InteractionAvailabilityLike, type InteractionDescriptorLike, type InteractionExplanationLike, type PluginProtocolTape, type PortableSemanticReplayStep, type ProtocolUIScenarioAuthority, type ReducerScenarioBundle, type ReducerScenarioDiagnostic, type ReducerScenarioExchange, type ReducerScenarioFrame, type ReducerScenarioOperation, type ReducerScenarioRunner, type ReducerScenarioTrace, type ReducerScenarioViewer, type ReducerUIScenarioAuthority, type RejectionExpectation, type ScenarioDefinition, type SharedScenarioContext, type SnapshotMatcherHandler, type TestRunner, type UIFixtureFrame, type UIFixtureProtocolStep, type UIReplayExecution, type UIReplayIdentityCandidate, type UIReplayRequest, type UIResolvedReplayIdentity, type UIScenarioAuthority, type UIScenarioAuthorityKind, type UIScenarioDefinition, type UIScenarioEnvironmentDefinition, type UIScenarioFixture, type UIScenarioFixtureBundleIndex, type UIScenarioReplayStep, type UIStepExpectation, UI_SCENARIO_FIXTURE_BUNDLE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_PLUGIN_RUNTIME_PROTOCOL, UI_SCENARIO_FIXTURE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_SUPPORTED_BROWSER_PROTOCOL_MAJOR, activate, assertDeterministicUIScenarioFixture, assertStep, assertSupportedBrowserInteractionProtocol, assertUIStepExpectationSatisfied, assertUniqueReplayIdentity, canonicalUIFixtureJson, canonicalizeUIFixtureJson, canonicalizeUIScenarioFixture, compareUIParityObservations, compilePluginProtocolTape, compileUIScenarioFixture, createDeterministicIdFactory, createExpectApi, createFixtureHostHarness, createReducerScenarioRunner, createTestRuntime, createUIParityObservationFromFixture, defaultFixtureEnvironmentInit, defineBase, defineScenario, defineUIScenario, digestPluginProtocolTape, digestUIFixtureJson, digestUIFixtureRequest, digestUIFixtureTransportRequest, digestUIScenarioFixture, drag, fill, fixtureEnvironmentInitFor, isSha256Digest, parseUIParityObservationV1, parseUIScenarioFixture, parseUIScenarioFixtureBundleIndex, pluginProtocolTapeSchema, portableSemanticReplayStepSchema, press, serializeUIScenarioFixture, submit, uiFixtureFrameSchema, uiFixtureProtocolStepSchema, uiReplayExecutionSchema, uiReplayRequestSchema, uiResolvedReplayIdentitySchema, uiScenarioFixtureBundleIndexSchema, uiScenarioFixtureSchema, uiScenarioReplayStepSchema, uiStepExpectationSchema };
701
+ export { type CompilePluginProtocolTapeOptions, type CompileUIScenarioFixtureOptions, type CreateFixtureHostHarnessOptions, CreateReducerScenarioRunnerOptions, type CreateTestRuntimeOptions, type CreatedTestRuntime, type DeterministicIdFactory, ExpectFn, type FixtureEnvironmentInit, type FixtureHostEvent, type FixtureHostHarness, FixturePluginRuntime, InteractionExplanationLike, type PluginProtocolTape, type PortableSemanticReplayStep, type ProtocolUIScenarioAuthority, ReducerScenarioRunner, ReducerScenarioTrace, type ReducerUIScenarioAuthority, SnapshotMatcherHandler, type UIFixtureFrame, type UIFixtureProtocolStep, type UIReplayExecution, type UIReplayIdentityCandidate, type UIReplayRequest, type UIResolvedReplayIdentity, type UIScenarioAuthority, type UIScenarioAuthorityKind, type UIScenarioDefinition, type UIScenarioEnvironmentDefinition, type UIScenarioFixture, type UIScenarioFixtureBundleIndex, type UIScenarioReplayStep, type UIStepExpectation, UI_SCENARIO_FIXTURE_BUNDLE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_PLUGIN_RUNTIME_PROTOCOL, UI_SCENARIO_FIXTURE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_SUPPORTED_BROWSER_PROTOCOL_MAJOR, activate, assertDeterministicUIScenarioFixture, assertStep, assertSupportedBrowserInteractionProtocol, assertUIStepExpectationSatisfied, assertUniqueReplayIdentity, canonicalUIFixtureJson, canonicalizeUIFixtureJson, canonicalizeUIScenarioFixture, compareUIParityObservations, compilePluginProtocolTape, compileUIScenarioFixture, createDeterministicIdFactory, createExpectApi, createFixtureHostHarness, createReducerScenarioRunner, createTestRuntime, createUIParityObservationFromFixture, defaultFixtureEnvironmentInit, defineUIScenario, digestPluginProtocolTape, digestUIFixtureJson, digestUIFixtureRequest, digestUIFixtureTransportRequest, digestUIScenarioFixture, drag, fill, fixtureEnvironmentInitFor, isSha256Digest, parseUIParityObservationV1, parseUIScenarioFixture, parseUIScenarioFixtureBundleIndex, pluginProtocolTapeSchema, portableSemanticReplayStepSchema, press, serializeUIScenarioFixture, submit, uiFixtureFrameSchema, uiFixtureProtocolStepSchema, uiReplayExecutionSchema, uiReplayRequestSchema, uiResolvedReplayIdentitySchema, uiScenarioFixtureBundleIndexSchema, uiScenarioFixtureSchema, uiScenarioReplayStepSchema, uiStepExpectationSchema };