@dreamboard-games/sdk 0.4.0-alpha.7 → 0.4.0-alpha.9
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 +1292 -287
- package/dist/authoring/index.d.ts +4 -9
- package/dist/authoring/index.js +11 -547
- package/dist/authoring/index.js.map +1 -1
- package/dist/authoring-compiler.d.ts +27 -0
- package/dist/authoring-compiler.js +12 -0
- package/dist/authoring-compiler.js.map +1 -0
- package/dist/authoring-materialize-cli.d.ts +1 -0
- package/dist/authoring-materialize-cli.js +46 -0
- package/dist/authoring-materialize-cli.js.map +1 -0
- package/dist/browser-interaction.d.ts +1 -1
- package/dist/{chunk-TGMXBRKY.js → chunk-3PFDHTR7.js} +19 -7
- package/dist/chunk-3PFDHTR7.js.map +1 -0
- package/dist/chunk-45P5CEGH.js +176 -0
- package/dist/chunk-45P5CEGH.js.map +1 -0
- package/dist/chunk-5XTAQ4EQ.js +32 -0
- package/dist/chunk-5XTAQ4EQ.js.map +1 -0
- package/dist/chunk-7ADPYKFT.js +532 -0
- package/dist/chunk-7ADPYKFT.js.map +1 -0
- package/dist/{chunk-RKGJ64UN.js → chunk-BUOODBVO.js} +2 -2
- package/dist/{chunk-VLG4YST5.js → chunk-GMOBG7Y7.js} +4 -4
- package/dist/{chunk-Q322XCY2.js → chunk-JRGP6W4V.js} +3 -3
- package/dist/chunk-L3W2FPRQ.js +1793 -0
- package/dist/chunk-L3W2FPRQ.js.map +1 -0
- package/dist/{chunk-3QIZKXJ2.js → chunk-NGYFBNBP.js} +3 -3
- package/dist/chunk-P6IJ5YVY.js +154 -0
- package/dist/chunk-P6IJ5YVY.js.map +1 -0
- package/dist/{chunk-5IHU5CUK.js → chunk-QQNL4WTX.js} +25 -22
- package/dist/chunk-QQNL4WTX.js.map +1 -0
- package/dist/{chunk-52DH7VQF.js → chunk-SACZWUA6.js} +143 -47
- package/dist/chunk-SACZWUA6.js.map +1 -0
- package/dist/{chunk-KYEWGZ2Y.js → chunk-SFOAY5H4.js} +2 -2
- package/dist/{chunk-KYEWGZ2Y.js.map → chunk-SFOAY5H4.js.map} +1 -1
- package/dist/chunk-UNVCT5Z7.js +73 -0
- package/dist/chunk-UNVCT5Z7.js.map +1 -0
- package/dist/{chunk-NO537WSS.js → chunk-WDR7SKBM.js} +2 -2
- package/dist/chunk-XDGRC6OR.js +7039 -0
- package/dist/chunk-XDGRC6OR.js.map +1 -0
- package/dist/chunk-XLHLFTLI.js +399 -0
- package/dist/chunk-XLHLFTLI.js.map +1 -0
- package/dist/{chunk-B2YBS3SG.js → chunk-YNW3KBDE.js} +41 -13
- package/dist/chunk-YNW3KBDE.js.map +1 -0
- package/dist/codegen.js +1 -1
- package/dist/{components-BTwSIjXj.d.ts → components-BPzsSRs8.d.ts} +1 -1
- package/dist/definitions-0kjPV9wh.d.ts +294 -0
- package/dist/{diagnostics-1BWjRo6-.d.ts → diagnostics-DIi3ina7.d.ts} +2 -1
- package/dist/{index-CFTjJIXd.d.ts → index-CWzWpQzM.d.ts} +1 -1
- package/dist/{index.d-DMASeF6M.d.ts → index.d-C7Ztirg6.d.ts} +234 -5
- package/dist/index.js +2 -2
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -2
- package/dist/{protocol-835hEGne.d.ts → protocol-B2LWcqB4.d.ts} +14 -0
- package/dist/reducer/advanced.d.ts +4 -4
- package/dist/reducer/advanced.js +7 -26
- package/dist/reducer/advanced.js.map +1 -1
- package/dist/reducer-contract.d.ts +1 -1
- package/dist/reducer-contract.js +2 -2
- package/dist/reducer.d.ts +37 -28
- package/dist/reducer.js +43 -6018
- package/dist/reducer.js.map +1 -1
- package/dist/reference-game-compiler.d.ts +45 -0
- package/dist/reference-game-compiler.js +25 -0
- package/dist/reference-game-compiler.js.map +1 -0
- package/dist/reference-game-source-manifest-cli.d.ts +1 -0
- package/dist/reference-game-source-manifest-cli.js +84 -0
- package/dist/reference-game-source-manifest-cli.js.map +1 -0
- package/dist/reference-games/index.d.ts +7 -217
- package/dist/reference-games/index.js +28 -208
- package/dist/reference-games/index.js.map +1 -1
- package/dist/runtime/primitives.d.ts +3 -3
- package/dist/runtime/primitives.js +3 -3
- package/dist/runtime/runtime-api.d.ts +1 -1
- package/dist/runtime/workspace-contract.d.ts +4 -4
- package/dist/runtime/workspace-contract.js +4 -4
- package/dist/{runtime-Dkfm1x2r.d.ts → runtime-B_w9AO2n.d.ts} +60 -5
- package/dist/{runtime-api-C6aWo9c0.d.ts → runtime-api-xCWLMQRT.d.ts} +2 -0
- package/dist/runtime.d.ts +7 -7
- package/dist/runtime.js +13 -13
- package/dist/schema-9jZzlEWZ.d.ts +220 -0
- package/dist/{stale-contract-artifact-error-C5AaZPJ8.d.ts → stale-contract-artifact-error-XLaweZtF.d.ts} +1 -1
- package/dist/testing-compiler.d.ts +36 -0
- package/dist/testing-compiler.js +236 -0
- package/dist/testing-compiler.js.map +1 -0
- package/dist/testing-runtime.d.ts +97 -21
- package/dist/testing-runtime.js +154 -95
- package/dist/testing-runtime.js.map +1 -1
- package/dist/testing.d.ts +178 -60
- package/dist/testing.js +641 -26
- package/dist/testing.js.map +1 -1
- package/dist/types-Bvptkukh.d.ts +122 -0
- package/dist/{types-aI4V9CWe.d.ts → types-_zfC_7CD.d.ts} +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/ui/components.d.ts +2 -2
- package/dist/ui/plugin-styles.css +1 -1
- package/dist/{ui-contract-Ue6SywvO.d.ts → ui-contract-CUC7Lyoc.d.ts} +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/{views-32rSsfeU.d.ts → views-DE2eZxPz.d.ts} +42 -13
- package/package.json +22 -3
- package/dist/chunk-3OZMHZK3.js +0 -40
- package/dist/chunk-3OZMHZK3.js.map +0 -1
- package/dist/chunk-52DH7VQF.js.map +0 -1
- package/dist/chunk-5IHU5CUK.js.map +0 -1
- package/dist/chunk-B2YBS3SG.js.map +0 -1
- package/dist/chunk-IU6KGPY7.js +0 -659
- package/dist/chunk-IU6KGPY7.js.map +0 -1
- package/dist/chunk-TGMXBRKY.js.map +0 -1
- package/dist/types-DcADVHe9.d.ts +0 -192
- /package/dist/{chunk-RKGJ64UN.js.map → chunk-BUOODBVO.js.map} +0 -0
- /package/dist/{chunk-VLG4YST5.js.map → chunk-GMOBG7Y7.js.map} +0 -0
- /package/dist/{chunk-Q322XCY2.js.map → chunk-JRGP6W4V.js.map} +0 -0
- /package/dist/{chunk-3QIZKXJ2.js.map → chunk-NGYFBNBP.js.map} +0 -0
- /package/dist/{chunk-NO537WSS.js.map → chunk-WDR7SKBM.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing/create-expect-api.ts","../src/testing/create-test-runtime.ts"],"sourcesContent":["import type {\n ExpectFn,\n ExpectMatchers,\n InteractionDescriptorLike,\n RejectionExpectation,\n InteractionExplanationLike,\n SnapshotMatcherHandler,\n} from \"./definitions.js\";\nimport type { ReducerDiagnosticEvent } from \"../reducer/diagnostics.js\";\n\ntype CreateExpectApiOptions = {\n matchSnapshot?: SnapshotMatcherHandler;\n lastDiagnosticRejection?: () =>\n | Extract<ReducerDiagnosticEvent, { type: \"submitRejected\" }>\n | null\n | undefined;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isDeepStrictEqual(actual: unknown, expected: unknown): boolean {\n if (Object.is(actual, expected)) return true;\n if (typeof actual !== typeof expected) return false;\n if (actual === null || expected === null) return false;\n if (typeof actual !== \"object\" || typeof expected !== \"object\") return false;\n\n if (actual instanceof Date || expected instanceof Date) {\n return (\n actual instanceof Date &&\n expected instanceof Date &&\n Object.is(actual.getTime(), expected.getTime())\n );\n }\n if (actual instanceof RegExp || expected instanceof RegExp) {\n return (\n actual instanceof RegExp &&\n expected instanceof RegExp &&\n actual.source === expected.source &&\n actual.flags === expected.flags\n );\n }\n if (Array.isArray(actual) || Array.isArray(expected)) {\n return (\n Array.isArray(actual) &&\n Array.isArray(expected) &&\n actual.length === expected.length &&\n actual.every((value, index) => isDeepStrictEqual(value, expected[index]))\n );\n }\n\n const actualPrototype = Object.getPrototypeOf(actual);\n const expectedPrototype = Object.getPrototypeOf(expected);\n if (actualPrototype !== expectedPrototype) return false;\n\n const actualRecord = actual as Record<string, unknown>;\n const expectedRecord = expected as Record<string, unknown>;\n const actualKeys = Object.keys(actualRecord);\n const expectedKeys = Object.keys(expectedRecord);\n return (\n actualKeys.length === expectedKeys.length &&\n actualKeys.every(\n (key) =>\n Object.prototype.hasOwnProperty.call(expectedRecord, key) &&\n isDeepStrictEqual(actualRecord[key], expectedRecord[key]),\n )\n );\n}\n\nfunction matchPartial(\n actual: unknown,\n expected: unknown,\n path: string = \"value\",\n): string | null {\n if (!isRecord(expected)) {\n return isDeepStrictEqual(actual, expected)\n ? null\n : `${path} does not match`;\n }\n if (!isRecord(actual)) {\n return `${path} is not an object`;\n }\n for (const [key, expectedValue] of Object.entries(expected)) {\n const actualValue = actual[key];\n if (!(key in actual)) {\n return `${path}.${key} is missing`;\n }\n const mismatch = matchPartial(actualValue, expectedValue, `${path}.${key}`);\n if (mismatch) {\n return mismatch;\n }\n }\n return null;\n}\n\nfunction asDescriptorList(actual: unknown): InteractionDescriptorLike[] {\n if (!Array.isArray(actual)) {\n throw new Error(\"Expected interaction descriptor array.\");\n }\n return actual as InteractionDescriptorLike[];\n}\n\nfunction findInteraction(\n descriptors: readonly InteractionDescriptorLike[],\n interactionId: string,\n): InteractionDescriptorLike | null {\n return (\n descriptors.find(\n (descriptor) => descriptor.interactionId === interactionId,\n ) ?? null\n );\n}\n\nfunction assertDescriptorMatches(\n descriptor: InteractionDescriptorLike,\n opts: Partial<InteractionDescriptorLike> | undefined,\n): void {\n if (!opts) {\n return;\n }\n const mismatch = matchPartial(descriptor, opts, \"interaction\");\n if (mismatch) {\n throw new Error(mismatch);\n }\n}\n\nfunction createSubmissionErrorMatcher(\n actual: unknown,\n expected: RejectionExpectation,\n options: CreateExpectApiOptions,\n): Promise<void> {\n const resolvePromise = (): Promise<unknown> => {\n if (typeof actual === \"function\") {\n return Promise.resolve().then(() => (actual as () => unknown)());\n }\n return Promise.resolve(actual);\n };\n\n return resolvePromise()\n .then(() => {\n throw new Error(\"Expected promise to reject.\");\n })\n .catch((error: unknown) => {\n if (!(error instanceof Error)) {\n throw new Error(\"Expected rejection to be an Error.\");\n }\n if (\n expected.errorCode !== undefined &&\n (error as Error & { errorCode?: string }).errorCode !==\n expected.errorCode\n ) {\n throw new Error(\n `Expected rejection errorCode '${expected.errorCode}', received '${\n (error as Error & { errorCode?: string }).errorCode ?? \"undefined\"\n }'.${formatLastDiagnosticRejection(options)}`,\n );\n }\n if (\n typeof expected.message === \"string\" &&\n error.message !== expected.message\n ) {\n throw new Error(\n `Expected rejection message '${expected.message}', received '${error.message}'.${formatLastDiagnosticRejection(\n options,\n )}`,\n );\n }\n if (\n expected.message instanceof RegExp &&\n !expected.message.test(error.message)\n ) {\n throw new Error(\n `Expected rejection message '${error.message}' to match ${String(\n expected.message,\n )}.${formatLastDiagnosticRejection(options)}`,\n );\n }\n });\n}\n\nfunction formatLastDiagnosticRejection(\n options: CreateExpectApiOptions,\n): string {\n const rejection = options.lastDiagnosticRejection?.();\n if (!rejection) return \"\";\n const rule = rejection.ruleId ? ` ruleId=${rejection.ruleId}` : \"\";\n const message = rejection.message ? ` message=${rejection.message}` : \"\";\n return `\\nlast rejection: errorCode=${rejection.errorCode}${rule}${message}`;\n}\n\nfunction assertLength(actual: unknown, expected: number): void {\n if (\n actual === null ||\n actual === undefined ||\n typeof (actual as { length?: unknown }).length !== \"number\"\n ) {\n throw new Error(\"toHaveLength expects a value with a numeric length.\");\n }\n const length = (actual as { length: number }).length;\n if (length !== expected) {\n throw new Error(`Expected length ${expected}, received ${length}.`);\n }\n}\n\nfunction formatInteractionExplanation(\n explanation: InteractionExplanationLike | undefined,\n): string {\n if (!explanation) {\n return \"\";\n }\n const lines = [\n `availability: ${explanation.availability}`,\n ...explanation.rules.map((rule) => {\n const code = rule.errorCode ? ` (${rule.errorCode})` : \"\";\n const message = rule.message ? `: ${rule.message}` : \"\";\n return `rule ${rule.ruleId} ${rule.outcome}${code}${message}`;\n }),\n ...explanation.inputs.map(\n (input) => `input ${input.key} eligibleCount=${input.eligibleCount}`,\n ),\n ];\n return `\\n${lines.join(\"\\n\")}`;\n}\n\nfunction assertThrown(\n actual: unknown,\n predicate?: string | RegExp | ((error: Error) => boolean),\n): void {\n if (typeof actual !== \"function\") {\n throw new Error(\"toThrow expects a function.\");\n }\n try {\n (actual as () => unknown)();\n } catch (error) {\n if (!(error instanceof Error)) {\n throw new Error(\"Thrown value is not an Error.\");\n }\n if (predicate === undefined) {\n return;\n }\n if (typeof predicate === \"string\" && error.message !== predicate) {\n throw new Error(\n `Expected thrown message '${predicate}', received '${error.message}'.`,\n );\n }\n if (predicate instanceof RegExp && !predicate.test(error.message)) {\n throw new Error(\n `Expected thrown message '${error.message}' to match ${String(predicate)}.`,\n );\n }\n if (typeof predicate === \"function\" && !predicate(error)) {\n throw new Error(\"Thrown error did not satisfy predicate.\");\n }\n return;\n }\n throw new Error(\"Expected function to throw.\");\n}\n\nexport function createExpectApi(\n options: CreateExpectApiOptions = {},\n): ExpectFn {\n const buildMatchers = (actual: unknown): ExpectMatchers => ({\n toBe: (expected: unknown) => {\n if (actual !== expected) {\n throw new Error(\n `Expected '${String(actual)}' to be '${String(expected)}'.`,\n );\n }\n },\n toEqual: (expected: unknown) => {\n if (!isDeepStrictEqual(actual, expected)) {\n throw new Error(\"Expected values to be deeply equal.\");\n }\n },\n toMatchObject: (expected: Record<string, unknown>) => {\n const mismatch = matchPartial(actual, expected);\n if (mismatch) {\n throw new Error(mismatch);\n }\n },\n toBeDefined: () => {\n if (actual === undefined) {\n throw new Error(\"Expected value to be defined.\");\n }\n },\n toBeUndefined: () => {\n if (actual !== undefined) {\n throw new Error(\n `Expected value to be undefined, but received '${String(actual)}'.`,\n );\n }\n },\n toBeNull: () => {\n if (actual !== null) {\n throw new Error(\n `Expected value to be null, but received '${String(actual)}'.`,\n );\n }\n },\n toContain: (expected: unknown) => {\n if (Array.isArray(actual)) {\n if (!actual.includes(expected)) {\n throw new Error(\"Expected array to contain value.\");\n }\n return;\n }\n if (typeof actual === \"string\") {\n if (!actual.includes(String(expected))) {\n throw new Error(\"Expected string to contain value.\");\n }\n return;\n }\n throw new Error(\"toContain expects an array or string actual value.\");\n },\n toContainEqual: (expected: unknown) => {\n if (!Array.isArray(actual)) {\n throw new Error(\"toContainEqual expects an array actual value.\");\n }\n if (!actual.some((value) => isDeepStrictEqual(value, expected))) {\n throw new Error(\"Expected array to contain an equal value.\");\n }\n },\n toHaveLength: (expected: number) => {\n assertLength(actual, expected);\n },\n toBeGreaterThan: (expected: number) => {\n if (typeof actual !== \"number\") {\n throw new Error(\"toBeGreaterThan expects a number actual value.\");\n }\n if (actual <= expected) {\n throw new Error(`Expected ${actual} to be > ${expected}.`);\n }\n },\n toBeGreaterThanOrEqual: (expected: number) => {\n if (typeof actual !== \"number\") {\n throw new Error(\n \"toBeGreaterThanOrEqual expects a number actual value.\",\n );\n }\n if (actual < expected) {\n throw new Error(`Expected ${actual} to be >= ${expected}.`);\n }\n },\n toThrow: (predicate) => {\n assertThrown(actual, predicate);\n },\n toMatchSnapshot: (filename) => {\n if (!options.matchSnapshot) {\n throw new Error(\n \"Snapshot matching is not configured for this expect API.\",\n );\n }\n options.matchSnapshot(filename, actual);\n },\n toRejectWith: (expected) =>\n createSubmissionErrorMatcher(actual, expected, options),\n toHaveInteraction: (interactionId, opts) => {\n const descriptors = asDescriptorList(actual);\n const descriptor = findInteraction(descriptors, interactionId);\n if (!descriptor) {\n throw new Error(`Expected interaction '${interactionId}' to exist.`);\n }\n assertDescriptorMatches(descriptor, opts);\n },\n toBeGatedBy: (reason, opts) => {\n const descriptor = Array.isArray(actual)\n ? (() => {\n if (!opts?.interactionId) {\n throw new Error(\n \"toBeGatedBy on a descriptor array requires opts.interactionId.\",\n );\n }\n return findInteraction(\n asDescriptorList(actual),\n opts.interactionId,\n );\n })()\n : (actual as InteractionDescriptorLike | null);\n if (!descriptor) {\n throw new Error(\"Expected interaction descriptor to exist.\");\n }\n if (descriptor.availability?.status === \"available\") {\n throw new Error(\"Expected interaction to be unavailable.\");\n }\n const actualReason =\n descriptor.availability?.status === \"notYourTurn\" ||\n descriptor.availability?.status === \"insufficientResources\" ||\n descriptor.availability?.status === \"blocked\"\n ? descriptor.availability.reason\n : undefined;\n if (actualReason !== reason) {\n throw new Error(\n `Expected unavailable reason '${reason}', received '${\n actualReason ?? \"undefined\"\n }'.`,\n );\n }\n },\n toBeAvailable: (explanation) => {\n const descriptor = Array.isArray(actual)\n ? (() => {\n if (!explanation?.interactionId) {\n throw new Error(\n \"toBeAvailable on a descriptor array requires an explanation.\",\n );\n }\n return findInteraction(\n asDescriptorList(actual),\n explanation.interactionId,\n );\n })()\n : (actual as InteractionDescriptorLike | null);\n if (!descriptor) {\n throw new Error(\n `Expected interaction descriptor to exist.${formatInteractionExplanation(\n explanation,\n )}`,\n );\n }\n if (descriptor.availability?.status !== \"available\") {\n throw new Error(\n `Expected interaction '${descriptor.interactionId ?? \"unknown\"}' to be available.${formatInteractionExplanation(\n explanation,\n )}`,\n );\n }\n },\n toBeActiveFor: (playerId, opts) => {\n const descriptor = Array.isArray(actual)\n ? (() => {\n if (!opts?.interactionId) {\n throw new Error(\n \"toBeActiveFor on a descriptor array requires opts.interactionId.\",\n );\n }\n return findInteraction(\n asDescriptorList(actual),\n opts.interactionId,\n );\n })()\n : (actual as InteractionDescriptorLike | null);\n if (!descriptor) {\n throw new Error(\"Expected interaction descriptor to exist.\");\n }\n if (descriptor.context?.to !== playerId) {\n throw new Error(\n `Expected interaction to target '${playerId}', received '${\n descriptor.context?.to ?? \"undefined\"\n }'.`,\n );\n }\n if (descriptor.availability?.status !== \"available\") {\n throw new Error(\"Expected interaction to be available.\");\n }\n },\n not: {\n toHaveInteraction: (interactionId) => {\n const descriptors = asDescriptorList(actual);\n if (findInteraction(descriptors, interactionId)) {\n throw new Error(\n `Expected interaction '${interactionId}' to be absent.`,\n );\n }\n },\n },\n });\n\n return (actual: unknown) => buildMatchers(actual);\n}\n","import type {\n ReducerBundleContract,\n Wire,\n} from \"@dreamboard-games/reducer-contract\";\nimport type { InteractionDescriptor } from \"../runtime/reducer.js\";\nimport {\n computePluginActionSetVersion,\n type InteractionDescriptor as ContractInteractionDescriptor,\n type ZoneHandlesSnapshot as ContractZoneHandlesSnapshot,\n type PluginGameplayFrame,\n type PluginSessionDescriptor,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type {\n RuntimeAPI,\n SubmissionError,\n ValidationResult,\n} from \"../runtime/types/runtime-api.js\";\nimport type { PluginSessionState as RuntimePluginSessionState } from \"../runtime/types/runtime-api.js\";\nimport type {\n DispatchTraceSummaryEntry,\n ReducerDiagnosticEvent,\n} from \"../reducer/diagnostics.js\";\nimport { StaleContractArtifactError } from \"../reducer/stale-contract-artifact-error.js\";\nimport type { InteractionExplanationLike } from \"./definitions.js\";\n\ntype ReducerBundleLike = Pick<\n ReducerBundleContract,\n \"projectSeatsDynamic\" | \"validateInput\" | \"dispatch\"\n> & {\n explainInteraction?: (input: {\n state: Wire.ReducerSessionState;\n playerId: string;\n interactionId: string;\n }) => InteractionExplanationLike;\n};\n\ntype DeepReadonly<T> = T extends (...args: readonly unknown[]) => unknown\n ? T\n : T extends readonly (infer Item)[]\n ? readonly DeepReadonly<Item>[]\n : T extends object\n ? { readonly [Key in keyof T]: DeepReadonly<T[Key]> }\n : T;\n\ntype DeepMutable<T> = T extends (...args: readonly unknown[]) => unknown\n ? T\n : T extends readonly (infer Item)[]\n ? DeepMutable<Item>[]\n : T extends object\n ? { -readonly [Key in keyof T]: DeepMutable<T[Key]> }\n : T;\n\ntype BaseStateArtifact = {\n snapshot: DeepReadonly<Wire.ReducerSessionState>;\n fingerprint: {\n players: number;\n contractFingerprint?: string;\n };\n};\n\ntype WireZoneHandles = {\n cardIds?: readonly string[];\n cardViewsById?: Readonly<Record<string, string>>;\n playableByCardId?: Readonly<Record<string, readonly string[]>>;\n};\n\nexport type CreateTestRuntimeOptions = {\n baseId: string;\n baseStates: Record<string, BaseStateArtifact>;\n bundle: ReducerBundleLike;\n phase?: string;\n playerIds?: readonly string[];\n sessionId?: string;\n userId?: string | null;\n gameId?: string;\n displayNameByPlayerId?: Record<string, string>;\n contractFingerprint?: string;\n expectedBaseStateFingerprint?: string;\n};\n\nexport type CreatedTestRuntime = {\n runtime: RuntimeAPI;\n getFrame(): PluginGameplayFrame;\n getSessionDescriptor(): PluginSessionDescriptor;\n players(): readonly string[];\n seat(index: number): string;\n submit(\n playerId: string,\n interactionId: string,\n params?: unknown,\n ): Promise<void>;\n validate(\n playerId: string,\n interactionId: string,\n params?: unknown,\n ): Promise<ValidationResult>;\n explain(playerId: string, interactionId: string): InteractionExplanationLike;\n diagnostics: {\n readonly events: readonly ReducerDiagnosticEvent[];\n readonly lastDispatch: {\n submissionId: string;\n trace: readonly DispatchTraceSummaryEntry[];\n } | null;\n clear(): void;\n };\n};\n\nfunction cloneState<T>(value: T): DeepMutable<T> {\n return structuredClone(value) as DeepMutable<T>;\n}\n\nfunction createSubmissionError(\n errorCode: string | undefined,\n message: string | undefined,\n): SubmissionError {\n const error = new Error(message ?? \"Interaction rejected\") as SubmissionError;\n error.name = \"SubmissionError\";\n error.errorCode = errorCode;\n return error;\n}\n\nfunction summarizeWireTrace(\n trace: readonly unknown[] | undefined,\n): DispatchTraceSummaryEntry[] {\n return (trace ?? []).flatMap((entry): DispatchTraceSummaryEntry[] => {\n if (typeof entry !== \"object\" || entry === null) return [];\n const record = entry as Record<string, unknown>;\n switch (record.kind) {\n case \"acceptedClientInput\": {\n const input =\n typeof record.input === \"object\" && record.input !== null\n ? (record.input as Record<string, unknown>)\n : {};\n return [\n {\n kind: \"acceptedClientInput\",\n interactionId: String(input.interactionId ?? \"\"),\n playerId: String(input.playerId ?? \"\"),\n },\n ];\n }\n case \"appliedEffect\": {\n const effect =\n typeof record.effect === \"object\" && record.effect !== null\n ? (record.effect as Record<string, unknown>)\n : {};\n return [\n {\n kind: \"appliedInstruction\",\n instruction: String(effect.kind ?? effect.type ?? \"effect\"),\n },\n ];\n }\n case \"rngConsumption\":\n return [\n {\n kind: \"rngConsumption\",\n operation: String(record.operation ?? \"\"),\n traceEntry: String(record.traceEntry ?? \"\"),\n },\n ];\n default:\n return [];\n }\n });\n}\n\nfunction readFlowState(state: Wire.ReducerSessionState): {\n currentPhase: string | null;\n activePlayers: string[];\n} {\n const flow = ((\n state.domain as\n | { flow?: { currentPhase?: string; activePlayers?: string[] } }\n | undefined\n )?.flow ?? {}) as {\n currentPhase?: string;\n activePlayers?: string[];\n };\n return {\n currentPhase: flow.currentPhase ?? null,\n activePlayers: Array.isArray(flow.activePlayers) ? flow.activePlayers : [],\n };\n}\n\nfunction resolvePlayerIds(options: {\n baseState: BaseStateArtifact;\n explicitPlayerIds?: readonly string[];\n}): string[] {\n if (options.explicitPlayerIds && options.explicitPlayerIds.length > 0) {\n return [...options.explicitPlayerIds];\n }\n return Array.from(\n { length: options.baseState.fingerprint.players },\n (_, index) => `player-${index + 1}`,\n );\n}\n\nfunction isWireZoneHandles(value: unknown): value is WireZoneHandles {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction buildPluginFrame(options: {\n state: Wire.ReducerSessionState;\n bundle: ReducerBundleLike;\n playerId: string;\n version: number;\n expectedPhase: string | undefined;\n baseId: string;\n}): PluginGameplayFrame {\n const projection = options.bundle.projectSeatsDynamic({\n state: options.state,\n playerIds: [options.playerId],\n });\n\n const flow = readFlowState(options.state);\n if (options.expectedPhase && flow.currentPhase !== options.expectedPhase) {\n throw new Error(\n `Expected base '${options.baseId}' to be in phase '${options.expectedPhase}', received '${\n flow.currentPhase ?? \"null\"\n }'.`,\n );\n }\n\n const interactionsByRef =\n (projection.interactionsByRef as\n | Record<string, InteractionDescriptor>\n | undefined) ?? {};\n const hydrateRefs = (\n refs: readonly string[] | undefined,\n ): ContractInteractionDescriptor[] =>\n (refs ?? [])\n .map((ref) => interactionsByRef[ref])\n .filter((descriptor): descriptor is InteractionDescriptor =>\n Boolean(descriptor),\n ) as ContractInteractionDescriptor[];\n\n const seat = projection.seats?.[options.playerId];\n const zones = Object.fromEntries(\n Object.entries(\n (seat?.zones as Record<string, unknown> | undefined) ?? {},\n ).map(([zoneId, zoneValue]) => {\n const zone = isWireZoneHandles(zoneValue) ? zoneValue : {};\n return [\n zoneId,\n {\n cardIds: [...(zone.cardIds ?? [])],\n cardViewsById: { ...(zone.cardViewsById ?? {}) },\n playableByCardId: Object.fromEntries(\n Object.entries(zone.playableByCardId ?? {}).map(\n ([cardId, refs]) => [cardId, hydrateRefs(refs)],\n ),\n ),\n } satisfies ContractZoneHandlesSnapshot,\n ];\n }),\n ) as PluginGameplayFrame[\"zones\"];\n\n const availableInteractions = hydrateRefs(\n seat?.availableInteractionRefs as readonly string[] | undefined,\n );\n return {\n gameVersion: options.version,\n actionSetVersion: computePluginActionSetVersion({\n gameVersion: options.version,\n availableInteractions,\n }),\n perspectivePlayerId: options.playerId || null,\n view: seat?.view ?? null,\n flow: {\n currentPhase: flow.currentPhase,\n currentStage: projection.currentStage ?? null,\n activePlayers: flow.activePlayers,\n simultaneousPhase: projection.simultaneousPhase ?? null,\n },\n availableInteractions,\n recentEvents: [],\n zones,\n };\n}\n\nexport function createTestRuntime(\n options: CreateTestRuntimeOptions,\n): CreatedTestRuntime {\n const baseState = options.baseStates[options.baseId];\n if (!baseState) {\n throw new Error(`Unknown test base '${options.baseId}'.`);\n }\n const expectedBaseStateFingerprint =\n options.expectedBaseStateFingerprint ??\n baseState.fingerprint.contractFingerprint;\n if (\n options.contractFingerprint &&\n expectedBaseStateFingerprint &&\n options.contractFingerprint !== expectedBaseStateFingerprint\n ) {\n throw new StaleContractArtifactError({\n artifact: \"base-states\",\n expected: options.contractFingerprint,\n found: expectedBaseStateFingerprint,\n });\n }\n\n let currentState = cloneState(baseState.snapshot);\n const playerIds = resolvePlayerIds({\n baseState,\n explicitPlayerIds: options.playerIds,\n });\n const sessionId = options.sessionId ?? \"test-session\";\n const sessionDescriptor: PluginSessionDescriptor = {\n sessionId,\n players: playerIds.map((playerId) => ({\n playerId,\n displayName: options.displayNameByPlayerId?.[playerId] ?? playerId,\n })),\n };\n\n let version = 0;\n let submissionCounter = 0;\n const currentPlayerId = playerIds[0] ?? \"\";\n const diagnosticEvents: ReducerDiagnosticEvent[] = [];\n let lastDispatch: {\n submissionId: string;\n trace: readonly DispatchTraceSummaryEntry[];\n } | null = null;\n const toReadySessionState = (\n frame: PluginGameplayFrame,\n ): RuntimePluginSessionState => ({\n status: \"ready\",\n sessionId,\n controllingPlayerId: frame.perspectivePlayerId,\n });\n\n let lastPluginFrame: PluginGameplayFrame;\n let lastSessionState: RuntimePluginSessionState;\n\n const applyCurrentState = (): void => {\n version += 1;\n lastPluginFrame = buildPluginFrame({\n state: currentState,\n bundle: options.bundle,\n playerId: currentPlayerId,\n version,\n expectedPhase: version === 1 ? options.phase : undefined,\n baseId: options.baseId,\n });\n lastSessionState = toReadySessionState(lastPluginFrame);\n };\n\n applyCurrentState();\n\n const validate = async (\n playerId: string,\n interactionId: string,\n params: unknown = {},\n ): Promise<ValidationResult> => {\n const result = await options.bundle.validateInput({\n state: currentState,\n input: {\n kind: \"interaction\",\n playerId,\n interactionId,\n params: params as Wire.JsonValue,\n },\n });\n return {\n valid: result.valid,\n errorCode: result.errorCode,\n message: result.message,\n };\n };\n\n const submit = async (\n playerId: string,\n interactionId: string,\n params: unknown = {},\n ): Promise<void> => {\n submissionCounter += 1;\n const submissionId = `sub-${submissionCounter}`;\n diagnosticEvents.push({\n type: \"submitReceived\",\n submissionId,\n playerId,\n interactionId,\n phase: readFlowState(currentState).currentPhase ?? \"\",\n });\n const validation = await validate(playerId, interactionId, params);\n if (!validation.valid) {\n diagnosticEvents.push({\n type: \"submitRejected\",\n submissionId,\n errorCode: validation.errorCode ?? \"invalid-action\",\n ...(validation.message ? { message: validation.message } : {}),\n });\n throw createSubmissionError(validation.errorCode, validation.message);\n }\n const result = await options.bundle.dispatch({\n state: currentState,\n input: {\n kind: \"interaction\",\n playerId,\n interactionId,\n params: params as Wire.JsonValue,\n },\n });\n if (result.kind === \"reject\") {\n diagnosticEvents.push({\n type: \"submitRejected\",\n submissionId,\n errorCode: result.errorCode,\n ...(result.message ? { message: result.message } : {}),\n });\n throw createSubmissionError(result.errorCode, result.message);\n }\n const trace = summarizeWireTrace(result.trace);\n lastDispatch = { submissionId, trace };\n diagnosticEvents.push({\n type: \"submitAccepted\",\n submissionId,\n trace,\n });\n currentState = cloneState(result.state);\n applyCurrentState();\n };\n\n const explain = (\n playerId: string,\n interactionId: string,\n ): InteractionExplanationLike => {\n if (!options.bundle.explainInteraction) {\n throw new Error(\n \"This reducer bundle does not expose explainInteraction().\",\n );\n }\n return options.bundle.explainInteraction({\n state: currentState,\n playerId,\n interactionId,\n });\n };\n\n const runtime = {\n validateInteraction: (interactionId: string, params?: unknown) =>\n validate(currentPlayerId, interactionId, params),\n submitInteraction: (interactionId: string, params?: unknown) =>\n submit(currentPlayerId, interactionId, params),\n getSessionState: (): RuntimePluginSessionState => lastSessionState,\n disconnect: () => undefined,\n };\n\n return {\n runtime,\n getFrame: () => lastPluginFrame,\n getSessionDescriptor: () => sessionDescriptor,\n players: () => [...playerIds],\n seat: (index: number) => {\n if (!Number.isInteger(index) || index < 0 || index >= playerIds.length) {\n throw new Error(\n `seat(${index}) is out of range; base '${options.baseId}' has ${playerIds.length} player(s).`,\n );\n }\n return playerIds[index]!;\n },\n submit,\n validate,\n explain,\n diagnostics: {\n get events() {\n return diagnosticEvents;\n },\n get lastDispatch() {\n return lastDispatch;\n },\n clear() {\n diagnosticEvents.length = 0;\n lastDispatch = null;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;AAkBA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAA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MACF;AACA,aAAO,UAAU,KAAK;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,MACX,IAAI,SAAS;AACX,eAAO;AAAA,MACT;AAAA,MACA,IAAI,eAAe;AACjB,eAAO;AAAA,MACT;AAAA,MACA,QAAQ;AACN,yBAAiB,SAAS;AAC1B,uBAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../reducer-contract/generated/zod.ts","../../reducer-contract/generated/version.ts","../../reducer-contract/generated/builders.ts"],"sourcesContent":["// @generated by packages/reducer-contract/scripts/generate-ts.mjs\n// DO NOT EDIT BY HAND. Edit schema/reducer-runtime.schema.json and rerun `pnpm generate`.\n\n/* eslint-disable */\nimport { z } from \"zod\";\n\nexport const ReducerContractVersionSchema = z.string().regex(new RegExp(\"^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$\"));\n\nexport const EffectIdSchema = z.string().min(1);\n\nlet JsonValueSchemaInternal: z.ZodType<unknown>;\nJsonValueSchemaInternal = z.lazy(() => z.union([z.record(z.string(), JsonValueSchemaInternal), z.array(JsonValueSchemaInternal), z.string(), z.number(), z.boolean(), z.null()]));\nexport const JsonValueSchema = JsonValueSchemaInternal;\n\nexport const ContinuationTokenSchema = z.object({ \"id\": z.string().min(1), \"data\": JsonValueSchema }).strict();\n\nexport const ContinuationMapSchema = z.record(z.string(), ContinuationTokenSchema);\n\nexport const ReducerSetupSelectionSchema = z.object({ \"profileId\": z.string().min(1), \"optionValues\": z.record(z.string(), z.union([z.string(), z.null()])) }).strict();\n\nexport const RngStateSchema = z.object({ \"seed\": z.union([z.number().refine(Number.isInteger, { message: \"Expected integer\" }), z.null()]), \"cursor\": z.number().int(), \"trace\": z.array(z.string()) }).strict();\n\nexport const ReducerFlowStateSchema = z.object({ \"currentPhase\": z.string().min(1), \"turn\": z.number().int(), \"round\": z.number().int(), \"activePlayers\": z.array(z.string().min(1)) }).strict();\n\nexport const RuntimeSimultaneousSubmissionSchema = z.object({ \"interactionId\": z.string().min(1), \"params\": JsonValueSchema }).strict();\n\nexport const RuntimeSimultaneousCurrentSchema = z.object({ \"phaseName\": z.string().min(1), \"actors\": z.array(z.string().min(1)), \"submissions\": z.record(z.string(), RuntimeSimultaneousSubmissionSchema) }).strict();\n\nexport const RuntimeSimultaneousStateSchema = z.object({ \"current\": z.union([RuntimeSimultaneousCurrentSchema, z.null()]) }).strict();\n\nexport const TransitionRecordSchema = z.object({ \"from\": z.string().min(1), \"to\": z.string().min(1) }).strict();\n\nexport const ReducerRuntimeStateSchema = z.object({ \"rng\": RngStateSchema, \"setup\": z.union([ReducerSetupSelectionSchema, z.null()]), \"simultaneous\": RuntimeSimultaneousStateSchema, \"lastTransition\": z.union([TransitionRecordSchema, z.null()]) }).strict();\n\nexport const ReducerDomainStateSchema = z.object({ \"table\": JsonValueSchema, \"publicState\": JsonValueSchema, \"privateState\": z.record(z.string(), JsonValueSchema), \"hiddenState\": JsonValueSchema, \"flow\": ReducerFlowStateSchema, \"phase\": JsonValueSchema }).strict();\n\nexport const ReducerSessionMetaSchema = z.object({ \"contractFingerprint\": z.string().regex(new RegExp(\"^cfp[0-9]+:[a-f0-9]{16}$\")) }).strict();\n\nexport const ReducerSessionStateSchema = z.object({ \"meta\": ReducerSessionMetaSchema.optional(), \"domain\": ReducerDomainStateSchema, \"runtime\": ReducerRuntimeStateSchema }).strict();\n\nexport const GameInputInteractionSchema = z.object({ \"kind\": z.literal(\"interaction\"), \"playerId\": z.string().min(1), \"interactionId\": z.string().min(1), \"params\": JsonValueSchema }).strict();\n\nexport const GameInputSchema = z.discriminatedUnion(\"kind\", [GameInputInteractionSchema]);\n\nexport const EffectTransitionSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"transition\"), \"to\": z.string().min(1) }).strict();\n\nexport const EffectRollDieSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"rollDie\"), \"dieId\": z.string().min(1) }).strict();\n\nexport const EffectShuffleSharedZoneSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"shuffleSharedZone\"), \"zoneId\": z.string().min(1) }).strict();\n\nexport const EffectShufflePlayerZoneSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"shufflePlayerZone\"), \"zoneId\": z.string().min(1), \"playerId\": z.string().min(1) }).strict();\n\nexport const EffectSchema = z.discriminatedUnion(\"type\", [EffectTransitionSchema, EffectRollDieSchema, EffectShuffleSharedZoneSchema, EffectShufflePlayerZoneSchema]);\n\nexport const ReducerInputValidationResultSchema = z.object({ \"valid\": z.boolean(), \"errorCode\": z.string().optional(), \"message\": z.string().optional() }).strict();\n\nexport const InitializeRequestSchema = z.object({ \"table\": JsonValueSchema, \"playerIds\": z.array(z.string().min(1)), \"rngSeed\": z.union([z.number().refine(Number.isInteger, { message: \"Expected integer\" }), z.null()]).optional(), \"setup\": z.union([ReducerSetupSelectionSchema, z.null()]).optional() }).strict();\n\nexport const InitializePhaseRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"to\": z.string().min(1) }).strict();\n\nexport const ValidateInputRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"input\": GameInputSchema }).strict();\n\nexport const ReduceRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"input\": GameInputSchema }).strict();\n\nexport const DispatchRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"input\": GameInputSchema }).strict();\n\nexport const ReduceResultRejectSchema = z.object({ \"kind\": z.literal(\"reject\"), \"errorCode\": z.string().min(1), \"message\": z.string().optional() }).strict();\n\nexport const GameOutcomeReasonSchema = z.object({ \"code\": z.string().min(1), \"message\": z.string().min(1).optional() }).strict();\n\nexport const OutcomeResultSchema = z.enum([\"win\", \"draw\", \"loss\", \"eliminated\"]);\n\nexport const OutcomeScoreComponentSchema = z.object({ \"id\": z.string().min(1), \"label\": z.string().min(1), \"value\": z.number().finite() }).strict();\n\nexport const OutcomeTieBreakSchema = z.object({ \"id\": z.string().min(1), \"label\": z.string().min(1), \"value\": z.union([z.number().finite(), z.string()]) }).strict();\n\nexport const OutcomeStandingSchema = z.object({ \"playerId\": z.string().min(1), \"rank\": z.number().int().gte(1), \"result\": OutcomeResultSchema, \"score\": z.number().finite().optional(), \"scoreBreakdown\": z.array(OutcomeScoreComponentSchema).optional(), \"tieBreaks\": z.array(OutcomeTieBreakSchema).optional() }).strict();\n\nexport const GameOutcomeSchema = z.object({ \"reason\": GameOutcomeReasonSchema, \"standings\": z.array(OutcomeStandingSchema).min(1) }).strict();\n\nexport const GameEventDetailSchema = z.object({ \"label\": z.string().min(1), \"value\": z.union([z.string(), z.number().finite(), z.boolean()]) }).strict();\n\nexport const SystemActionEventSchema = z.object({ \"kind\": z.literal(\"systemAction\"), \"procedureId\": z.string().min(1), \"title\": z.string().min(1), \"summary\": z.string().min(1).optional(), \"details\": z.array(GameEventDetailSchema).max(16).optional() }).strict();\n\nexport const GameEventSchema = z.discriminatedUnion(\"kind\", [SystemActionEventSchema]);\n\nexport const ReduceResultAcceptSchema = z.object({ \"kind\": z.literal(\"accept\"), \"state\": ReducerSessionStateSchema, \"terminal\": GameOutcomeSchema.optional(), \"effects\": z.array(EffectSchema), \"continuations\": ContinuationMapSchema, \"events\": z.array(GameEventSchema).max(32) }).strict();\n\nexport const ReduceResultSchema = z.discriminatedUnion(\"kind\", [ReduceResultRejectSchema, ReduceResultAcceptSchema]);\n\nexport const DispatchTraceAcceptedClientInputSchema = z.object({ \"kind\": z.literal(\"acceptedClientInput\"), \"input\": GameInputSchema }).strict();\n\nexport const DispatchTraceAppliedEffectSchema = z.object({ \"kind\": z.literal(\"appliedEffect\"), \"effect\": EffectSchema, \"continuation\": ContinuationTokenSchema.optional() }).strict();\n\nexport const DispatchTraceRngConsumptionSchema = z.object({ \"kind\": z.literal(\"rngConsumption\"), \"operation\": z.string().min(1), \"traceEntry\": z.string() }).strict();\n\nexport const DispatchTraceSchema = z.discriminatedUnion(\"kind\", [DispatchTraceAcceptedClientInputSchema, DispatchTraceAppliedEffectSchema, DispatchTraceRngConsumptionSchema]);\n\nexport const DispatchResultRejectSchema = z.object({ \"kind\": z.literal(\"reject\"), \"errorCode\": z.string().min(1), \"message\": z.string().optional() }).strict();\n\nexport const DispatchResultAcceptSchema = z.object({ \"kind\": z.literal(\"accept\"), \"state\": ReducerSessionStateSchema, \"terminal\": GameOutcomeSchema.optional(), \"trace\": z.array(DispatchTraceSchema), \"events\": z.array(GameEventSchema).max(32) }).strict();\n\nexport const DispatchResultSchema = z.discriminatedUnion(\"kind\", [DispatchResultRejectSchema, DispatchResultAcceptSchema]);\n\nexport const ReducerRuntimeLogEntryAcceptedClientInputSchema = z.object({ \"kind\": z.literal(\"acceptedClientInput\"), \"version\": z.number().int(), \"input\": GameInputSchema }).strict();\n\nexport const ReducerRuntimeLogEntryAppliedEffectSchema = z.object({ \"kind\": z.literal(\"appliedEffect\"), \"version\": z.number().int(), \"effect\": EffectSchema, \"continuation\": z.union([ContinuationTokenSchema, z.null()]) }).strict();\n\nexport const ReducerRuntimeLogEntryRngConsumptionSchema = z.object({ \"kind\": z.literal(\"rngConsumption\"), \"version\": z.number().int(), \"operation\": z.string().min(1), \"traceEntry\": z.string() }).strict();\n\nexport const ReducerRuntimeLogEntryStateCommitSchema = z.object({ \"kind\": z.literal(\"stateCommit\"), \"version\": z.number().int(), \"state\": ReducerSessionStateSchema }).strict();\n\nexport const ReducerRuntimeLogEntrySchema = z.discriminatedUnion(\"kind\", [ReducerRuntimeLogEntryAcceptedClientInputSchema, ReducerRuntimeLogEntryAppliedEffectSchema, ReducerRuntimeLogEntryRngConsumptionSchema, ReducerRuntimeLogEntryStateCommitSchema]);\n\nexport const SeatProjectionSchema = z.object({ \"view\": JsonValueSchema.optional(), \"availableInteractionRefs\": JsonValueSchema.optional(), \"zones\": JsonValueSchema.optional() }).strict();\n\nexport const SimultaneousPhaseProjectionSchema = z.object({ \"phaseName\": z.string().min(1), \"interactionId\": z.string().min(1), \"actorIds\": z.array(z.string().min(1)), \"sealedPlayerIds\": z.array(z.string().min(1)), \"pendingPlayerIds\": z.array(z.string().min(1)) }).strict();\n\nexport const SeatProjectionBundleSchema = z.object({ \"currentStage\": z.union([z.string().min(1), z.null()]).optional(), \"stageSeats\": z.array(z.string().min(1)).optional(), \"simultaneousPhase\": z.union([SimultaneousPhaseProjectionSchema, z.null()]).optional(), \"interactionsByRef\": JsonValueSchema.optional(), \"seats\": z.record(z.string(), SeatProjectionSchema) }).strict();\n\nexport const ProjectSeatsDynamicRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"playerIds\": z.array(z.string().min(1)), \"viewId\": z.string().min(1).optional(), \"projectionMode\": z.union([z.enum([\"full\", \"actionsOnly\"]), z.null()]).optional() }).strict();\n\nexport const BoardStaticProjectionSchema = z.object({ \"view\": JsonValueSchema, \"hash\": z.string().min(1), \"manifestVersion\": z.string() }).strict();\n","// @generated by packages/reducer-contract/scripts/generate-ts.mjs\n// DO NOT EDIT BY HAND. Edit schema/reducer-runtime.schema.json and rerun `pnpm generate`.\n\n/**\n * The wire-protocol version this package implements. Bumped in lockstep with\n * any breaking change to schema/reducer-runtime.schema.json. At bundle load\n * time hosts refuse bundles whose major version differs.\n */\nexport const REDUCER_CONTRACT_VERSION = \"0.3.0\" as const;\n","// @generated by packages/reducer-contract/scripts/generate-ts.mjs\n// DO NOT EDIT BY HAND. Edit schema/reducer-runtime.schema.json and rerun `pnpm generate`.\n\n/* eslint-disable */\nimport type * as Wire from \"./wire\";\n\n/**\n * Typed effect constructors. Authors MUST go through these; hand-constructing\n * Wire.Effect objects is banned by convention because it's how wire drift\n * re-enters the codebase.\n *\n * The `effectId` is minted by the runtime (see createEffectIdMinter below),\n * not by the author. Each builder returns a `PendingEffect` that carries\n * the optional continuation; the reducer bundle's accept materializer splits\n * pending effects into the wire's `effects[]` + `continuations` map.\n */\n\nexport type PendingEffect = Wire.Effect & {\n readonly __continuation?: Wire.ContinuationToken;\n};\n\nexport type EffectIdMinter = () => Wire.EffectId;\n\n/**\n * Produces sequential, deterministic effect ids scoped to a single accept\n * payload: \"ef0\", \"ef1\", ... . Uniqueness only needs to be local to the\n * payload because the host consumes and discards them per dispatch.\n */\nexport function createEffectIdMinter(): EffectIdMinter {\n let i = 0;\n return () => `ef${i++}` as Wire.EffectId;\n}\n\nexport type EffectBuilders = {\n transition(args: { to: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n rollDie(args: { dieId: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n shuffleSharedZone(args: { zoneId: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n shufflePlayerZone(args: { zoneId: string; playerId: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n};\n\nexport function createEffectBuilders(mint: EffectIdMinter): EffectBuilders {\n return {\n transition(args, continuation) {\n const effect = { effectId: mint(), type: \"transition\" as const, to: args.to };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n rollDie(args, continuation) {\n const effect = { effectId: mint(), type: \"rollDie\" as const, dieId: args.dieId };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n shuffleSharedZone(args, continuation) {\n const effect = { effectId: mint(), type: \"shuffleSharedZone\" as const, zoneId: args.zoneId };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n shufflePlayerZone(args, continuation) {\n const effect = { effectId: mint(), type: \"shufflePlayerZone\" as const, zoneId: args.zoneId, playerId: args.playerId };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n };\n}\n\n/**\n * Takes a list of PendingEffects and splits them into the canonical wire\n * shape: `effects[]` (stripped of `__continuation`) + `continuations` map\n * keyed by effectId. Use at the boundary where reduce/dispatch results leave\n * author code and enter the wire.\n */\nexport function materializeAccept(pending: ReadonlyArray<PendingEffect>): {\n effects: Wire.Effect[];\n continuations: Wire.ContinuationMap;\n} {\n const effects: Wire.Effect[] = [];\n const continuations: Wire.ContinuationMap = {};\n for (const pe of pending) {\n const { __continuation, ...effect } = pe as PendingEffect & { __continuation?: Wire.ContinuationToken };\n effects.push(effect as Wire.Effect);\n if (__continuation !== undefined) {\n continuations[(effect as Wire.Effect).effectId] = __continuation;\n }\n }\n return { effects, continuations };\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAS,SAAS;AAEX,IAAM,+BAA+B,EAAE,OAAO,EAAE,MAAM,IAAI,OAAO,4BAA4B,CAAC;AAE9F,IAAM,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC;AAE9C,IAAI;AACJ,0BAA0B,EAAE,KAAK,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,uBAAuB,GAAG,EAAE,MAAM,uBAAuB,GAAG,EAAE,OAAO,GAAG,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACzK,IAAM,kBAAkB;AAExB,IAAM,0BAA0B,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,QAAQ,gBAAgB,CAAC,EAAE,OAAO;AAEtG,IAAM,wBAAwB,EAAE,OAAO,EAAE,OAAO,GAAG,uBAAuB;AAE1E,IAAM,8BAA8B,EAAE,OAAO,EAAE,aAAa,EAAE,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M,UAAyB,CAAC;AAChC,QAAM,gBAAsC,CAAC;AAC7C,aAAW,MAAM,SAAS;AACxB,UAAM,EAAE,gBAAgB,GAAG,OAAO,IAAI;AACtC,YAAQ,KAAK,MAAqB;AAClC,QAAI,mBAAmB,QAAW;AAChC,oBAAe,OAAuB,QAAQ,IAAI;AAAA,IACpD;AAAA,EACF;AACA,SAAO,EAAE,SAAS,cAAc;AAClC;","names":[]}
|
package/dist/types-DcADVHe9.d.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { R as ReducerDiagnosticEvent, D as DispatchTraceSummaryEntry } from './diagnostics-1BWjRo6-.js';
|
|
2
|
-
import { a as ReducerBundleContract, w as wire } from './index.d-DMASeF6M.js';
|
|
3
|
-
|
|
4
|
-
type TestRunner = "reducer" | "remote" | "browser";
|
|
5
|
-
type InteractionDescriptorLike = {
|
|
6
|
-
interactionId?: string;
|
|
7
|
-
surface?: string;
|
|
8
|
-
kind?: string;
|
|
9
|
-
availability?: InteractionAvailabilityLike;
|
|
10
|
-
context?: {
|
|
11
|
-
to?: string;
|
|
12
|
-
};
|
|
13
|
-
} & Record<string, unknown>;
|
|
14
|
-
type InteractionAvailabilityLike = {
|
|
15
|
-
status: "available";
|
|
16
|
-
} | {
|
|
17
|
-
status: "notYourTurn";
|
|
18
|
-
reason: string;
|
|
19
|
-
} | {
|
|
20
|
-
status: "insufficientResources";
|
|
21
|
-
reason: string;
|
|
22
|
-
missingResources?: Record<string, unknown>;
|
|
23
|
-
} | {
|
|
24
|
-
status: "blocked";
|
|
25
|
-
reason: string;
|
|
26
|
-
};
|
|
27
|
-
type InteractionExplanationLike = {
|
|
28
|
-
interactionId: string;
|
|
29
|
-
phase: string;
|
|
30
|
-
step: string | null;
|
|
31
|
-
availability: "available" | "notYourTurn" | "wrongPhase" | "wrongStep" | "blocked";
|
|
32
|
-
rules: ReadonlyArray<{
|
|
33
|
-
ruleId: string;
|
|
34
|
-
outcome: "passed" | "failed" | "notEvaluated";
|
|
35
|
-
errorCode?: string;
|
|
36
|
-
message?: string;
|
|
37
|
-
}>;
|
|
38
|
-
actor: {
|
|
39
|
-
required: readonly string[];
|
|
40
|
-
playerIsActor: boolean;
|
|
41
|
-
};
|
|
42
|
-
inputs: ReadonlyArray<{
|
|
43
|
-
key: string;
|
|
44
|
-
kind: string;
|
|
45
|
-
eligibleCount: number | "lazy";
|
|
46
|
-
}>;
|
|
47
|
-
};
|
|
48
|
-
type SnapshotMatcherHandler = (name: string | undefined, actual: unknown) => void;
|
|
49
|
-
type RejectionExpectation = {
|
|
50
|
-
errorCode?: string;
|
|
51
|
-
message?: string | RegExp;
|
|
52
|
-
};
|
|
53
|
-
type ExpectMatchers = {
|
|
54
|
-
toBe: (expected: unknown) => void;
|
|
55
|
-
toEqual: (expected: unknown) => void;
|
|
56
|
-
toMatchObject: (expected: Record<string, unknown>) => void;
|
|
57
|
-
toBeDefined: () => void;
|
|
58
|
-
toBeUndefined: () => void;
|
|
59
|
-
toBeNull: () => void;
|
|
60
|
-
toContain: (expected: unknown) => void;
|
|
61
|
-
toContainEqual: (expected: unknown) => void;
|
|
62
|
-
toHaveLength: (expected: number) => void;
|
|
63
|
-
toBeGreaterThan: (expected: number) => void;
|
|
64
|
-
toBeGreaterThanOrEqual: (expected: number) => void;
|
|
65
|
-
toThrow: (predicate?: string | RegExp | ((error: Error) => boolean)) => void;
|
|
66
|
-
toMatchSnapshot: (filename?: string) => void;
|
|
67
|
-
toRejectWith: (expected: RejectionExpectation) => Promise<void>;
|
|
68
|
-
toHaveInteraction: (interactionId: string, opts?: Partial<InteractionDescriptorLike>) => void;
|
|
69
|
-
toBeGatedBy: (reason: string, opts?: {
|
|
70
|
-
interactionId?: string;
|
|
71
|
-
}) => void;
|
|
72
|
-
toBeAvailable: (explanation?: InteractionExplanationLike) => void;
|
|
73
|
-
toBeActiveFor: (playerId: string, opts?: {
|
|
74
|
-
interactionId?: string;
|
|
75
|
-
}) => void;
|
|
76
|
-
not: {
|
|
77
|
-
toHaveInteraction: (interactionId: string) => void;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
type ExpectFn = (actual: unknown) => ExpectMatchers;
|
|
81
|
-
interface BaseContext<PlayerId extends string = string> {
|
|
82
|
-
game: {
|
|
83
|
-
start(): Promise<void>;
|
|
84
|
-
patchState?(mutator: (state: Record<string, unknown>) => void): Promise<void>;
|
|
85
|
-
submit(playerId: PlayerId, interactionId: string, params?: unknown): Promise<void>;
|
|
86
|
-
};
|
|
87
|
-
players(): readonly PlayerId[];
|
|
88
|
-
seat(index: number): PlayerId;
|
|
89
|
-
}
|
|
90
|
-
interface SharedScenarioContext<PlayerId extends string = string, StateName extends string = string, View = unknown, Descriptor extends InteractionDescriptorLike = InteractionDescriptorLike> extends BaseContext<PlayerId> {
|
|
91
|
-
state(): StateName;
|
|
92
|
-
view(playerId: PlayerId): View;
|
|
93
|
-
interactions(playerId: PlayerId): readonly Descriptor[];
|
|
94
|
-
explain(playerId: PlayerId, interactionId: string): InteractionExplanationLike;
|
|
95
|
-
diagnostics: {
|
|
96
|
-
readonly events: readonly ReducerDiagnosticEvent[];
|
|
97
|
-
readonly lastDispatch: {
|
|
98
|
-
submissionId: string;
|
|
99
|
-
trace: readonly DispatchTraceSummaryEntry[];
|
|
100
|
-
} | null;
|
|
101
|
-
clear(): void;
|
|
102
|
-
};
|
|
103
|
-
expect: ExpectFn;
|
|
104
|
-
}
|
|
105
|
-
interface BaseDefinition {
|
|
106
|
-
id: string;
|
|
107
|
-
seed?: number;
|
|
108
|
-
players?: number;
|
|
109
|
-
setupProfileId?: string | null;
|
|
110
|
-
extends?: string;
|
|
111
|
-
setup: (ctx: BaseContext) => void | Promise<void>;
|
|
112
|
-
}
|
|
113
|
-
interface ScenarioDefinition<Runners extends readonly TestRunner[] = readonly ["reducer"], PhaseName extends string = string, StageName extends string = string> {
|
|
114
|
-
id: string;
|
|
115
|
-
description?: string;
|
|
116
|
-
from: string;
|
|
117
|
-
runners?: Runners;
|
|
118
|
-
phase?: PhaseName;
|
|
119
|
-
stage?: StageName;
|
|
120
|
-
when: (ctx: SharedScenarioContext) => void | Promise<void>;
|
|
121
|
-
then: (ctx: SharedScenarioContext) => void | Promise<void>;
|
|
122
|
-
}
|
|
123
|
-
declare function defineBase<const Definition extends BaseDefinition>(definition: Definition): Definition;
|
|
124
|
-
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>;
|
|
125
|
-
|
|
126
|
-
type ReducerScenarioBundle = Pick<ReducerBundleContract, "projectSeatsDynamic" | "validateInput" | "dispatch" | "projectStatic">;
|
|
127
|
-
interface ReducerScenarioViewer {
|
|
128
|
-
readonly seatId: string;
|
|
129
|
-
readonly playerId: string;
|
|
130
|
-
}
|
|
131
|
-
interface ReducerScenarioFrame {
|
|
132
|
-
readonly id: string;
|
|
133
|
-
readonly reducerState: wire.ReducerSessionState;
|
|
134
|
-
readonly dynamicProjection: wire.SeatProjectionBundle;
|
|
135
|
-
readonly staticProjection?: wire.BoardStaticProjection | null;
|
|
136
|
-
readonly gameVersion: number;
|
|
137
|
-
readonly actionSetVersion: string;
|
|
138
|
-
readonly projectionDigest: string;
|
|
139
|
-
}
|
|
140
|
-
interface ReducerScenarioTrace {
|
|
141
|
-
readonly scenarioId: string;
|
|
142
|
-
readonly gameId: string;
|
|
143
|
-
readonly viewer: ReducerScenarioViewer;
|
|
144
|
-
readonly frames: readonly ReducerScenarioFrame[];
|
|
145
|
-
readonly exchanges: readonly ReducerScenarioExchange[];
|
|
146
|
-
}
|
|
147
|
-
type ReducerScenarioExchange = {
|
|
148
|
-
readonly id: string;
|
|
149
|
-
readonly operation: "validate";
|
|
150
|
-
readonly fromFrameId: string;
|
|
151
|
-
readonly input: wire.GameInput;
|
|
152
|
-
readonly result: wire.ReducerInputValidationResult;
|
|
153
|
-
} | {
|
|
154
|
-
readonly id: string;
|
|
155
|
-
readonly operation: "submit";
|
|
156
|
-
readonly fromFrameId: string;
|
|
157
|
-
readonly input: wire.GameInput;
|
|
158
|
-
readonly result: {
|
|
159
|
-
readonly kind: "accepted";
|
|
160
|
-
readonly toFrameId: string;
|
|
161
|
-
} | {
|
|
162
|
-
readonly kind: "rejected";
|
|
163
|
-
readonly diagnostics: readonly ReducerScenarioDiagnostic[];
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
interface ReducerScenarioDiagnostic {
|
|
167
|
-
readonly code: string;
|
|
168
|
-
readonly message: string;
|
|
169
|
-
}
|
|
170
|
-
type ReducerScenarioOperation = {
|
|
171
|
-
readonly id: string;
|
|
172
|
-
readonly operation: "validate";
|
|
173
|
-
readonly input: wire.GameInput;
|
|
174
|
-
} | {
|
|
175
|
-
readonly id: string;
|
|
176
|
-
readonly operation: "submit";
|
|
177
|
-
readonly input: wire.GameInput;
|
|
178
|
-
};
|
|
179
|
-
interface CreateReducerScenarioRunnerOptions {
|
|
180
|
-
readonly scenarioId: string;
|
|
181
|
-
readonly gameId: string;
|
|
182
|
-
readonly initialState: wire.ReducerSessionState;
|
|
183
|
-
readonly bundle: ReducerScenarioBundle;
|
|
184
|
-
readonly viewer: ReducerScenarioViewer;
|
|
185
|
-
readonly playerIds: readonly string[];
|
|
186
|
-
readonly initialGameVersion?: number;
|
|
187
|
-
}
|
|
188
|
-
interface ReducerScenarioRunner {
|
|
189
|
-
run(operations: readonly ReducerScenarioOperation[]): Promise<ReducerScenarioTrace>;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export { type BaseContext as B, type CreateReducerScenarioRunnerOptions as C, type ExpectFn as E, type InteractionAvailabilityLike as I, type ReducerScenarioBundle as R, type ScenarioDefinition as S, type TestRunner as T, type BaseDefinition as a, type ExpectMatchers as b, type InteractionDescriptorLike as c, type InteractionExplanationLike as d, type ReducerScenarioDiagnostic as e, type ReducerScenarioExchange as f, type ReducerScenarioFrame as g, type ReducerScenarioOperation as h, type ReducerScenarioRunner as i, type ReducerScenarioTrace as j, type ReducerScenarioViewer as k, type RejectionExpectation as l, type SharedScenarioContext as m, type SnapshotMatcherHandler as n, defineBase as o, defineScenario as p };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|