@game-infra/story-schemas 0.2.0 → 0.5.0
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 +27 -18
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +8 -8
- package/dist/contracts.js.map +1 -1
- package/dist/designContent.d.ts +3 -3
- package/dist/designContent.d.ts.map +1 -1
- package/dist/designContent.js +15 -15
- package/dist/designContent.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/nodePaths.d.ts.map +1 -1
- package/dist/nodePaths.js +3 -3
- package/dist/nodePaths.js.map +1 -1
- package/dist/storyPayloads.d.ts +79 -4
- package/dist/storyPayloads.d.ts.map +1 -1
- package/dist/storyPayloads.js +25 -4
- package/dist/storyPayloads.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -31,11 +31,11 @@ All of it is the same shape — a keyed JSON payload, scoped to a parent, tagged
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
import { designContentListContract, designContentLoadContract } from
|
|
35
|
-
import { mapApiContractToPath } from
|
|
34
|
+
import { designContentListContract, designContentLoadContract } from '@game-infra/story-schemas'
|
|
35
|
+
import { mapApiContractToPath } from '@toad-contracts/valibot'
|
|
36
36
|
|
|
37
|
-
designContentListContract.pathResolver({ gameId:
|
|
38
|
-
mapApiContractToPath(designContentLoadContract)
|
|
37
|
+
designContentListContract.pathResolver({ gameId: 'g1' }) // '/games/g1/design-content'
|
|
38
|
+
mapApiContractToPath(designContentLoadContract)
|
|
39
39
|
// '/games/:gameId/design-content/:contentType/:scopeId/:contentId'
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -80,39 +80,48 @@ The listing answers every question story mode asks:
|
|
|
80
80
|
|
|
81
81
|
A branching story and a multi-stage event are the same object seen from two angles: both are prose with gated, consequential branches out of it. So a story beat **is** an `EncounterStageDTO` and a branch **is** a `ChoiceDefinitionDTO`, straight from `@game-infra/event-schemas`:
|
|
82
82
|
|
|
83
|
-
| Story mode | event-editor DTO
|
|
84
|
-
| ---------- |
|
|
85
|
-
| arc | `EventDefinitionDTO` header (multi-stage) + `hook`/`tags` |
|
|
86
|
-
| beat | `EncounterStageDTO` + `model`/`origin`/`revision`/`notes`
|
|
87
|
-
| branch | `ChoiceDefinitionDTO`, unchanged
|
|
83
|
+
| Story mode | event-editor DTO |
|
|
84
|
+
| ---------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| arc | `EventDefinitionDTO` header (multi-stage) + `hook`/`tags` + story-specific player power, stat values, and skill ranks |
|
|
86
|
+
| beat | `EncounterStageDTO` + `model`/`origin`/`revision`/`notes` |
|
|
87
|
+
| branch | `ChoiceDefinitionDTO`, unchanged |
|
|
88
88
|
|
|
89
89
|
A branch therefore carries `conditionsToShow`, `conditionsToEnable`, `consumableConditions`, `effects` and an outcome config exactly as an event's choice does, and a finished arc assembles into an `event_definitions` row by collecting its beats into `stages` — a copy, not a translation.
|
|
90
90
|
|
|
91
91
|
`data` is opaque to the _service_, but two clients writing and reading the same rows still have to agree, so the shapes ship alongside the contract and are parsed client-side:
|
|
92
92
|
|
|
93
93
|
```ts
|
|
94
|
-
import { StoryBeatPayloadSchema } from
|
|
95
|
-
import { safeParse } from
|
|
94
|
+
import { StoryBeatPayloadSchema } from '@game-infra/story-schemas'
|
|
95
|
+
import { safeParse } from 'valibot'
|
|
96
96
|
|
|
97
|
-
const parsed = safeParse(StoryBeatPayloadSchema, JSON.parse(row.data ??
|
|
98
|
-
if (parsed.success) console.log(parsed.output.description, parsed.output.choices)
|
|
97
|
+
const parsed = safeParse(StoryBeatPayloadSchema, JSON.parse(row.data ?? '{}'))
|
|
98
|
+
if (parsed.success) console.log(parsed.output.description, parsed.output.choices)
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
`WorldPayloadSchema`, `StoryArcPayloadSchema` and `StoryBeatPayloadSchema` are exported for this, along with the underlying `ChoiceDefinitionDTOSchema`, `PreconditionDTOSchema`, `ActivationDTOSchema` and `ConsumableConditionDTOSchema` so a story client needs one import rather than two. They are deliberately _not_ attached to any endpoint.
|
|
102
102
|
|
|
103
103
|
**Use the lenient DTOs, not the strict ones.** `StrictPreconditionDTOSchema` and `StrictActivationDTOSchema` enumerate one game's vocabulary (`strength`, `mana`, `LearnSpell`, `SpecificLecture`). A design world declares its own stats, skills, perks and resources, so a story client uses the lenient `{ type, params }` forms and validates `type` and the ids in `params` against the world it belongs to.
|
|
104
104
|
|
|
105
|
+
### What this package is not for
|
|
106
|
+
|
|
107
|
+
Everything here is **authored** — written once, read by every player, and the
|
|
108
|
+
same tomorrow as today. Anything that changes because someone is _playing_ —
|
|
109
|
+
a session in progress, its journal of turns, a save slot — belongs to
|
|
110
|
+
`@game-infra/game-state-schemas` and `game-state-service` instead. Freeform
|
|
111
|
+
mode's turn journal and synapse memory live there, in
|
|
112
|
+
`FreeformTurnPayloadSchema` and friends.
|
|
113
|
+
|
|
105
114
|
### Beat addressing
|
|
106
115
|
|
|
107
116
|
A beat's identity is the trail of choices taken to reach it — that is what makes "has this branch been travelled before?" a lookup rather than a search. The client minting ids and the service sweeping subtrees import the same helpers:
|
|
108
117
|
|
|
109
118
|
```ts
|
|
110
|
-
import { storyNodeId, childStoryNodeId, isStoryNodeAtOrBelow } from
|
|
119
|
+
import { storyNodeId, childStoryNodeId, isStoryNodeAtOrBelow } from '@game-infra/story-schemas'
|
|
111
120
|
|
|
112
|
-
storyNodeId([])
|
|
113
|
-
childStoryNodeId(
|
|
114
|
-
isStoryNodeAtOrBelow(
|
|
115
|
-
isStoryNodeAtOrBelow(
|
|
121
|
+
storyNodeId([]) // 'root'
|
|
122
|
+
childStoryNodeId('root', 'take-the-tunnel') // 'root.take-the-tunnel'
|
|
123
|
+
isStoryNodeAtOrBelow('root.take.left', 'root.take') // true
|
|
124
|
+
isStoryNodeAtOrBelow('root.taken', 'root.take') // false
|
|
116
125
|
```
|
|
117
126
|
|
|
118
127
|
Segments join with `.` rather than `/` because a beat id travels as a single URL path segment, which a slash would split; the dot is also what `cascade=prefix` sweeps on.
|
package/dist/contracts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AA+DA;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;QAKX,GAAG;;;;;;;;;;;;;;;CAC5B,CAAA;AAEF,yEAAyE;AACzE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;QAKX,GAAG;;;;;;;;;;;;;;;CAC5B,CAAA;AAEF,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;QAKX,GAAG;;;;;;;CAC5B,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;QAKf,GAAG;;;;;;;;CAC5B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;QAMb,GAAG;;;;;;;CAC5B,CAAA"}
|
package/dist/contracts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineApiContract, withObjectKeys } from
|
|
2
|
-
import { object, optional, string } from
|
|
3
|
-
import { DesignContentBulkSaveRequestSchema, DesignContentBulkSaveResponseSchema, DesignContentDeleteResponseSchema, DesignContentListResponseSchema, DesignContentLoadResponseSchema, DesignContentSaveRequestSchema, DesignContentSaveResponseSchema, } from
|
|
1
|
+
import { defineApiContract, withObjectKeys } from '@toad-contracts/valibot';
|
|
2
|
+
import { object, optional, string } from 'valibot';
|
|
3
|
+
import { DesignContentBulkSaveRequestSchema, DesignContentBulkSaveResponseSchema, DesignContentDeleteResponseSchema, DesignContentListResponseSchema, DesignContentLoadResponseSchema, DesignContentSaveRequestSchema, DesignContentSaveResponseSchema, } from './designContent.js';
|
|
4
4
|
/**
|
|
5
5
|
* Typed endpoint contracts for authored design content — worlds, the content
|
|
6
6
|
* written against them, story arcs, and story beats.
|
|
@@ -56,7 +56,7 @@ const deleteQuery = object({ cascade: optional(string()) });
|
|
|
56
56
|
* which is the map of what is pregenerated and must not be generated again.
|
|
57
57
|
*/
|
|
58
58
|
export const designContentListContract = defineApiContract({
|
|
59
|
-
method:
|
|
59
|
+
method: 'get',
|
|
60
60
|
requestPathParamsSchema: gameParams,
|
|
61
61
|
requestQuerySchema: listQuery,
|
|
62
62
|
pathResolver: ({ gameId }) => `/games/${gameId}/design-content`,
|
|
@@ -64,14 +64,14 @@ export const designContentListContract = defineApiContract({
|
|
|
64
64
|
});
|
|
65
65
|
/** One row by key, or `item: undefined` when nothing is stored there. */
|
|
66
66
|
export const designContentLoadContract = defineApiContract({
|
|
67
|
-
method:
|
|
67
|
+
method: 'get',
|
|
68
68
|
requestPathParamsSchema: itemParams,
|
|
69
69
|
pathResolver: ({ gameId, contentType, scopeId, contentId }) => `/games/${gameId}/design-content/${contentType}/${scopeId}/${contentId}`,
|
|
70
70
|
responsesByStatusCode: { 200: DesignContentLoadResponseSchema },
|
|
71
71
|
});
|
|
72
72
|
/** Create or replace one row. Re-saving the same key keeps its `createdAt`. */
|
|
73
73
|
export const designContentSaveContract = defineApiContract({
|
|
74
|
-
method:
|
|
74
|
+
method: 'post',
|
|
75
75
|
requestPathParamsSchema: gameParams,
|
|
76
76
|
pathResolver: ({ gameId }) => `/games/${gameId}/design-content`,
|
|
77
77
|
requestBodySchema: DesignContentSaveRequestSchema,
|
|
@@ -82,7 +82,7 @@ export const designContentSaveContract = defineApiContract({
|
|
|
82
82
|
* which is how a whole design document lands in one request.
|
|
83
83
|
*/
|
|
84
84
|
export const designContentBulkSaveContract = defineApiContract({
|
|
85
|
-
method:
|
|
85
|
+
method: 'post',
|
|
86
86
|
requestPathParamsSchema: gameParams,
|
|
87
87
|
pathResolver: ({ gameId }) => `/games/${gameId}/design-content/bulk`,
|
|
88
88
|
requestBodySchema: DesignContentBulkSaveRequestSchema,
|
|
@@ -95,7 +95,7 @@ export const designContentBulkSaveContract = defineApiContract({
|
|
|
95
95
|
* transitively (a world, its content, its arcs, and their beats).
|
|
96
96
|
*/
|
|
97
97
|
export const designContentDeleteContract = defineApiContract({
|
|
98
|
-
method:
|
|
98
|
+
method: 'delete',
|
|
99
99
|
requestPathParamsSchema: itemParams,
|
|
100
100
|
requestQuerySchema: deleteQuery,
|
|
101
101
|
pathResolver: ({ gameId, contentType, scopeId, contentId }) => `/games/${gameId}/design-content/${contentType}/${scopeId}/${contentId}`,
|
package/dist/contracts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EACL,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,EACjC,+BAA+B,EAC/B,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,oBAAoB,CAAA;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;AAC/D,MAAM,UAAU,GAAG,cAAc,CAC/B,MAAM,CAAC;IACL,MAAM,EAAE,MAAM,EAAE;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AC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,UAAU,MAAM,iBAAiB;IAC/D,iBAAiB,EAAE,8BAA8B;IACjD,qBAAqB,EAAE,EAAE,GAAG,EAAE,+BAA+B,EAAE;CAChE,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,iBAAiB,CAAC;IAC7D,MAAM,EAAE,MAAM;IACd,uBAAuB,EAAE,UAAU;IACnC,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,UAAU,MAAM,sBAAsB;IACpE,iBAAiB,EAAE,kCAAkC;IACrD,qBAAqB,EAAE,EAAE,GAAG,EAAE,mCAAmC,EAAE;CACpE,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IAC3D,MAAM,EAAE,QAAQ;IAChB,uBAAuB,EAAE,UAAU;IACnC,kBAAkB,EAAE,WAAW;IAC/B,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,CAC5D,UAAU,MAAM,mBAAmB,WAAW,IAAI,OAAO,IAAI,SAAS,EAAE;IAC1E,qBAAqB,EAAE,EAAE,GAAG,EAAE,iCAAiC,EAAE;CAClE,CAAC,CAAA"}
|
package/dist/designContent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InferOutput } from
|
|
1
|
+
import { type InferOutput } from 'valibot';
|
|
2
2
|
/**
|
|
3
3
|
* The transport for everything an author writes: worlds, the content written
|
|
4
4
|
* against them (locations, characters, skill definitions, lore entries), the
|
|
@@ -50,7 +50,7 @@ export declare const ROOT_SCOPE = "-";
|
|
|
50
50
|
* DESIGN_CONTENT_TYPES.includes('story-node') // true
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
export declare const DESIGN_CONTENT_TYPES: readonly [
|
|
53
|
+
export declare const DESIGN_CONTENT_TYPES: readonly ['world', 'locations', 'characters', 'events', 'stats', 'skills', 'perks', 'resources', 'lore', 'story-arc', 'story-node'];
|
|
54
54
|
/** One of {@link DESIGN_CONTENT_TYPES}, widened to `string` at the wire boundary. */
|
|
55
55
|
export type DesignContentType = (typeof DESIGN_CONTENT_TYPES)[number];
|
|
56
56
|
/**
|
|
@@ -171,7 +171,7 @@ export type DesignContentBulkSaveRequest = InferOutput<typeof DesignContentBulkS
|
|
|
171
171
|
* - `scope` — the row and everything scoped to it, transitively. Deleting a
|
|
172
172
|
* world this way also removes its content, its story arcs, and their beats.
|
|
173
173
|
*/
|
|
174
|
-
export declare const DESIGN_CONTENT_CASCADES: readonly [
|
|
174
|
+
export declare const DESIGN_CONTENT_CASCADES: readonly ['none', 'prefix', 'scope'];
|
|
175
175
|
export declare const DesignContentCascadeSchema: import("valibot").PicklistSchema<readonly ["none", "prefix", "scope"], undefined>;
|
|
176
176
|
export type DesignContentCascade = InferOutput<typeof DesignContentCascadeSchema>;
|
|
177
177
|
/** Rows matching the listing, most recently edited first. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"designContent.d.ts","sourceRoot":"","sources":["../src/designContent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAqD,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"designContent.d.ts","sourceRoot":"","sources":["../src/designContent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAqD,MAAM,SAAS,CAAA;AAE7F;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,MAAM,CAAA;AAE7B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,oBAAoB,YAC/B,OAAO,EACP,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,YAAY,CACJ,CAAA;AAE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AAA;AAE3F,uCAAuC;AACvC,eAAO,MAAM,+BAA+B;;;;;aAE1C,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE3F,iFAAiF;AACjF,eAAO,MAAM,mCAAmC;;;;;;aAG9C,CAAA;AAEF,MAAM,MAAM,6BAA6B,GAAG,WAAW,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAEnG,iEAAiE;AACjE,eAAO,MAAM,iCAAiC;;;;;aAE5C,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG,WAAW,CAAC,OAAO,iCAAiC,CAAC,CAAA"}
|
package/dist/designContent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSuccessResponseSchema } from
|
|
2
|
-
import { array, number, object, optional, picklist, string } from
|
|
1
|
+
import { createSuccessResponseSchema } from '@game-infra/api-schemas-core';
|
|
2
|
+
import { array, number, object, optional, picklist, string } from 'valibot';
|
|
3
3
|
/**
|
|
4
4
|
* The transport for everything an author writes: worlds, the content written
|
|
5
5
|
* against them (locations, characters, skill definitions, lore entries), the
|
|
@@ -28,7 +28,7 @@ import { array, number, object, optional, picklist, string } from "valibot";
|
|
|
28
28
|
* }) // '/games/g1/design-content/world/-/the-ash-reckoning'
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export const ROOT_SCOPE =
|
|
31
|
+
export const ROOT_SCOPE = '-';
|
|
32
32
|
/**
|
|
33
33
|
* The vocabulary this contract was written against, and how each type is scoped:
|
|
34
34
|
*
|
|
@@ -52,17 +52,17 @@ export const ROOT_SCOPE = "-";
|
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
export const DESIGN_CONTENT_TYPES = [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
'world',
|
|
56
|
+
'locations',
|
|
57
|
+
'characters',
|
|
58
|
+
'events',
|
|
59
|
+
'stats',
|
|
60
|
+
'skills',
|
|
61
|
+
'perks',
|
|
62
|
+
'resources',
|
|
63
|
+
'lore',
|
|
64
|
+
'story-arc',
|
|
65
|
+
'story-node',
|
|
66
66
|
];
|
|
67
67
|
/**
|
|
68
68
|
* One row.
|
|
@@ -169,7 +169,7 @@ export const DesignContentBulkSaveRequestSchema = object({
|
|
|
169
169
|
* - `scope` — the row and everything scoped to it, transitively. Deleting a
|
|
170
170
|
* world this way also removes its content, its story arcs, and their beats.
|
|
171
171
|
*/
|
|
172
|
-
export const DESIGN_CONTENT_CASCADES = [
|
|
172
|
+
export const DESIGN_CONTENT_CASCADES = ['none', 'prefix', 'scope'];
|
|
173
173
|
export const DesignContentCascadeSchema = picklist(DESIGN_CONTENT_CASCADES);
|
|
174
174
|
/** Rows matching the listing, most recently edited first. */
|
|
175
175
|
export const DesignContentListResponseSchema = createSuccessResponseSchema({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"designContent.js","sourceRoot":"","sources":["../src/designContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"designContent.js","sourceRoot":"","sources":["../src/designContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EAAoB,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAE7F;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;AAE7B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,OAAO;IACP,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,O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C,CAAA;AAI3E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;IACzE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;CAClD,CAAC,CAAA;AAIF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;IACzE,IAAI,EAAE,QAAQ,CAAC,yBAAyB,CAAC;CAC1C,CAAC,CAAA;AAIF,uCAAuC;AACvC,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;IACzE,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAA;AAIF,iFAAiF;AACjF,MAAM,CAAC,MAAM,mCAAmC,GAAG,2BAA2B,CAAC;IAC7E,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC9B,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAA;AAIF,iEAAiE;AACjE,MAAM,CAAC,MAAM,iCAAiC,GAAG,2BAA2B,CAAC;IAC3E,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { DESIGN_CONTENT_CASCADES, DESIGN_CONTENT_TYPES, DesignContentBulkSaveRequestSchema, DesignContentBulkSaveResponseSchema, DesignContentCascadeSchema, DesignContentDeleteResponseSchema, DesignContentListResponseSchema, DesignContentLoadResponseSchema, DesignContentRecordSchema, DesignContentReplaceScopeSchema, DesignContentSaveRequestSchema, DesignContentSaveResponseSchema, ROOT_SCOPE, } from
|
|
2
|
-
export type { DesignContentBulkSaveRequest, DesignContentBulkSaveResponse, DesignContentCascade, DesignContentDeleteResponse, DesignContentListResponse, DesignContentLoadResponse, DesignContentRecord, DesignContentReplaceScope, DesignContentSaveRequest, DesignContentSaveResponse, DesignContentType, } from
|
|
3
|
-
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, STORY_BEAT_ORIGINS, StoryArcPayloadSchema, StoryBeatOriginSchema, StoryBeatPayloadSchema, WorldPayloadSchema, } from
|
|
4
|
-
export type { ActivationDTO, ChoiceDefinitionDTO, ConsumableConditionDTO, EncounterStageDTO, PreconditionDTO, StoryArcPayload, StoryBeatOrigin, StoryBeatPayload, WorldPayload, } from
|
|
5
|
-
export { NODE_ID_SEPARATOR, ROOT_NODE_ID, childStoryNodeId, isStoryNodeAtOrBelow, parentStoryNodeId, storyNodeChoiceIds, storyNodeDepth, storyNodeId, storyNodePath, } from
|
|
6
|
-
export { designContentBulkSaveContract, designContentDeleteContract, designContentListContract, designContentLoadContract, designContentSaveContract, } from
|
|
1
|
+
export { DESIGN_CONTENT_CASCADES, DESIGN_CONTENT_TYPES, DesignContentBulkSaveRequestSchema, DesignContentBulkSaveResponseSchema, DesignContentCascadeSchema, DesignContentDeleteResponseSchema, DesignContentListResponseSchema, DesignContentLoadResponseSchema, DesignContentRecordSchema, DesignContentReplaceScopeSchema, DesignContentSaveRequestSchema, DesignContentSaveResponseSchema, ROOT_SCOPE, } from './designContent.js';
|
|
2
|
+
export type { DesignContentBulkSaveRequest, DesignContentBulkSaveResponse, DesignContentCascade, DesignContentDeleteResponse, DesignContentListResponse, DesignContentLoadResponse, DesignContentRecord, DesignContentReplaceScope, DesignContentSaveRequest, DesignContentSaveResponse, DesignContentType, } from './designContent.js';
|
|
3
|
+
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConditionalTextDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, STORY_BEAT_ORIGINS, TextFragmentDTOSchema, TextVariantDTOSchema, conditionalTextFrom, flattenConditionalText, resolveConditionalText, resolveConditionalTextParts, StoryArcPayloadSchema, StoryBeatOriginSchema, StoryBeatPayloadSchema, WorldPayloadSchema, } from './storyPayloads.js';
|
|
4
|
+
export type { ActivationDTO, ChoiceDefinitionDTO, ConditionalTextDTO, ConsumableConditionDTO, EncounterStageDTO, PreconditionDTO, PreconditionPredicate, ResolvedTextFragment, StoryArcPayload, StoryBeatOrigin, StoryBeatPayload, WorldPayload, } from './storyPayloads.js';
|
|
5
|
+
export { NODE_ID_SEPARATOR, ROOT_NODE_ID, childStoryNodeId, isStoryNodeAtOrBelow, parentStoryNodeId, storyNodeChoiceIds, storyNodeDepth, storyNodeId, storyNodePath, } from './nodePaths.js';
|
|
6
|
+
export { designContentBulkSaveContract, designContentDeleteContract, designContentListContract, designContentLoadContract, designContentSaveContract, } from './contracts.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,mCAAmC,EACnC,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAC/B,UAAU,GACX,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,mCAAmC,EACnC,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAC/B,UAAU,GACX,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,4BAA4B,EAC5B,6BAA6B,EAC7B,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,oBAAoB,CAAA;AAO3B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAI3B,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAA;AAKvB,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Explicit barrel (no export *). Every public symbol is re-exported by name.
|
|
2
2
|
// The transport: one keyed, scoped, typed JSON row for every kind of authored
|
|
3
3
|
// design content.
|
|
4
|
-
export { DESIGN_CONTENT_CASCADES, DESIGN_CONTENT_TYPES, DesignContentBulkSaveRequestSchema, DesignContentBulkSaveResponseSchema, DesignContentCascadeSchema, DesignContentDeleteResponseSchema, DesignContentListResponseSchema, DesignContentLoadResponseSchema, DesignContentRecordSchema, DesignContentReplaceScopeSchema, DesignContentSaveRequestSchema, DesignContentSaveResponseSchema, ROOT_SCOPE, } from
|
|
4
|
+
export { DESIGN_CONTENT_CASCADES, DESIGN_CONTENT_TYPES, DesignContentBulkSaveRequestSchema, DesignContentBulkSaveResponseSchema, DesignContentCascadeSchema, DesignContentDeleteResponseSchema, DesignContentListResponseSchema, DesignContentLoadResponseSchema, DesignContentRecordSchema, DesignContentReplaceScopeSchema, DesignContentSaveRequestSchema, DesignContentSaveResponseSchema, ROOT_SCOPE, } from './designContent.js';
|
|
5
5
|
// What goes inside a row's `data`. Not part of any endpoint — the service never
|
|
6
6
|
// parses it — but shared so two clients agree on the shapes.
|
|
7
7
|
//
|
|
8
8
|
// A beat is an encounter stage and a branch is a choice: the event editor's own
|
|
9
9
|
// DTOs, re-exported here so a story client needs one import rather than two.
|
|
10
|
-
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, STORY_BEAT_ORIGINS, StoryArcPayloadSchema, StoryBeatOriginSchema, StoryBeatPayloadSchema, WorldPayloadSchema, } from
|
|
10
|
+
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConditionalTextDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, STORY_BEAT_ORIGINS, TextFragmentDTOSchema, TextVariantDTOSchema, conditionalTextFrom, flattenConditionalText, resolveConditionalText, resolveConditionalTextParts, StoryArcPayloadSchema, StoryBeatOriginSchema, StoryBeatPayloadSchema, WorldPayloadSchema, } from './storyPayloads.js';
|
|
11
11
|
// Beat addressing, shared by the client that mints ids and the service that
|
|
12
12
|
// sweeps subtrees.
|
|
13
|
-
export { NODE_ID_SEPARATOR, ROOT_NODE_ID, childStoryNodeId, isStoryNodeAtOrBelow, parentStoryNodeId, storyNodeChoiceIds, storyNodeDepth, storyNodeId, storyNodePath, } from
|
|
13
|
+
export { NODE_ID_SEPARATOR, ROOT_NODE_ID, childStoryNodeId, isStoryNodeAtOrBelow, parentStoryNodeId, storyNodeChoiceIds, storyNodeDepth, storyNodeId, storyNodePath, } from './nodePaths.js';
|
|
14
14
|
// Typed endpoint contracts (toad-contracts). Each contract carries its own
|
|
15
15
|
// `pathResolver`; wire them into a client via @toad-contracts/frontend-http-client
|
|
16
16
|
// and into a Hono service via @toad-contracts/hono.
|
|
17
|
-
export { designContentBulkSaveContract, designContentDeleteContract, designContentListContract, designContentLoadContract, designContentSaveContract, } from
|
|
17
|
+
export { designContentBulkSaveContract, designContentDeleteContract, designContentListContract, designContentLoadContract, designContentSaveContract, } from './contracts.js';
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,8EAA8E;AAC9E,kBAAkB;AAClB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,mCAAmC,EACnC,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAC/B,UAAU,GACX,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,8EAA8E;AAC9E,kBAAkB;AAClB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,mCAAmC,EACnC,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,+BAA+B,EAC/B,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAC/B,UAAU,GACX,MAAM,oBAAoB,CAAA;AAe3B,gFAAgF;AAChF,6DAA6D;AAC7D,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAgB3B,4EAA4E;AAC5E,mBAAmB;AACnB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAA;AAEvB,2EAA2E;AAC3E,mFAAmF;AACnF,oDAAoD;AACpD,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAA"}
|
package/dist/nodePaths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodePaths.d.ts","sourceRoot":"","sources":["../src/nodePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,uCAAuC;AACvC,eAAO,MAAM,YAAY,SAAS,
|
|
1
|
+
{"version":3,"file":"nodePaths.d.ts","sourceRoot":"","sources":["../src/nodePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,uCAAuC;AACvC,eAAO,MAAM,YAAY,SAAS,CAAA;AAElC,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAElE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAGpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEhF"}
|
package/dist/nodePaths.js
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* for reading: it is what a breadcrumb shows.
|
|
17
17
|
*/
|
|
18
18
|
/** The opening beat of every story. */
|
|
19
|
-
export const ROOT_NODE_ID =
|
|
19
|
+
export const ROOT_NODE_ID = 'root';
|
|
20
20
|
/** Separator between choice ids inside a node id. */
|
|
21
|
-
export const NODE_ID_SEPARATOR =
|
|
21
|
+
export const NODE_ID_SEPARATOR = '.';
|
|
22
22
|
/**
|
|
23
23
|
* The id of the beat reached by taking `choiceIds` in order.
|
|
24
24
|
*
|
|
@@ -44,7 +44,7 @@ export function storyNodeId(choiceIds) {
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export function storyNodePath(choiceIds) {
|
|
47
|
-
return choiceIds.join(
|
|
47
|
+
return choiceIds.join('/');
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* The choice trail a node id encodes. The inverse of {@link storyNodeId}.
|
package/dist/nodePaths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodePaths.js","sourceRoot":"","sources":["../src/nodePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,uCAAuC;AACvC,MAAM,CAAC,MAAM,Y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AC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAA;AAC1C,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,UAAkB;IACrE,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,iBAAiB,EAAE,CAAC,CAAA;AACxF,CAAC"}
|
package/dist/storyPayloads.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InferOutput } from
|
|
1
|
+
import { type InferOutput } from 'valibot';
|
|
2
2
|
/**
|
|
3
3
|
* What goes *inside* a design-content row's `data` for story mode.
|
|
4
4
|
*
|
|
@@ -62,6 +62,9 @@ export type WorldPayload = InferOutput<typeof WorldPayloadSchema>;
|
|
|
62
62
|
* tags: ['mystery', 'descent'],
|
|
63
63
|
* protagonistId: 'tallow',
|
|
64
64
|
* openingLocationId: 'quiet-forge',
|
|
65
|
+
* playerPowerLevel: 5,
|
|
66
|
+
* playerStatValues: [{ statId: 'wits', value: 7 }],
|
|
67
|
+
* playerSkillValues: [{ skillId: 'salvage', rank: 5 }],
|
|
65
68
|
* }
|
|
66
69
|
* ```
|
|
67
70
|
*/
|
|
@@ -97,10 +100,22 @@ export declare const StoryArcPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
97
100
|
readonly protagonistId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
98
101
|
/** A location id from the world, when the arc opens somewhere in particular. */
|
|
99
102
|
readonly openingLocationId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
103
|
+
/** The player's story-specific capability, from ordinary novice to world-shaping. */
|
|
104
|
+
readonly playerPowerLevel: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>;
|
|
105
|
+
/** Story-specific starting stats, calibrated to the protagonist described by this arc. */
|
|
106
|
+
readonly playerStatValues: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
107
|
+
readonly statId: import("valibot").StringSchema<undefined>;
|
|
108
|
+
readonly value: import("valibot").NumberSchema<undefined>;
|
|
109
|
+
}, undefined>, undefined>;
|
|
110
|
+
/** Story-specific starting skill ranks, calibrated to the protagonist described by this arc. */
|
|
111
|
+
readonly playerSkillValues: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
112
|
+
readonly skillId: import("valibot").StringSchema<undefined>;
|
|
113
|
+
readonly rank: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").MaxValueAction<number, 10, undefined>]>;
|
|
114
|
+
}, undefined>, undefined>;
|
|
100
115
|
}, undefined>;
|
|
101
116
|
export type StoryArcPayload = InferOutput<typeof StoryArcPayloadSchema>;
|
|
102
117
|
/** Whether a beat's narration came from a model or from the player's own words. */
|
|
103
|
-
export declare const STORY_BEAT_ORIGINS: readonly [
|
|
118
|
+
export declare const STORY_BEAT_ORIGINS: readonly ['generated', 'authored'];
|
|
104
119
|
export declare const StoryBeatOriginSchema: import("valibot").PicklistSchema<readonly ["generated", "authored"], undefined>;
|
|
105
120
|
export type StoryBeatOrigin = InferOutput<typeof StoryBeatOriginSchema>;
|
|
106
121
|
/**
|
|
@@ -111,6 +126,12 @@ export type StoryBeatOrigin = InferOutput<typeof StoryBeatOriginSchema>;
|
|
|
111
126
|
* `conditionsToShow`, `conditionsToEnable`, `consumableConditions`, `effects`
|
|
112
127
|
* and an outcome config exactly as an event's choice does.
|
|
113
128
|
*
|
|
129
|
+
* A beat that reads differently depending on what the player has done carries
|
|
130
|
+
* `conditionalDescription` beside `description` (see `ConditionalTextDTO`): the
|
|
131
|
+
* fragments a reader in this state is shown, with `description` holding the
|
|
132
|
+
* flattened reading for anything that cannot evaluate preconditions. Branch
|
|
133
|
+
* labels vary the same way through a choice's `conditionalName`.
|
|
134
|
+
*
|
|
114
135
|
* The beat's *address* is not in here — it is the row's `contentId`, the trail
|
|
115
136
|
* of choices taken to reach it (see `nodePaths.ts`). Keeping the address out of
|
|
116
137
|
* the payload is what keeps the two from disagreeing. The stage's own `id` is
|
|
@@ -143,10 +164,64 @@ export declare const StoryBeatPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
143
164
|
readonly id: import("valibot").StringSchema<undefined>;
|
|
144
165
|
readonly title: import("valibot").StringSchema<undefined>;
|
|
145
166
|
readonly description: import("valibot").StringSchema<undefined>;
|
|
167
|
+
readonly conditionalDescription: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
|
|
168
|
+
readonly fragments: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
169
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
170
|
+
readonly text: import("valibot").StringSchema<undefined>;
|
|
171
|
+
readonly conditions: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
172
|
+
readonly type: import("valibot").StringSchema<undefined>;
|
|
173
|
+
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
174
|
+
}, undefined>, undefined>, undefined>;
|
|
175
|
+
readonly variants: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
176
|
+
readonly conditions: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
177
|
+
readonly type: import("valibot").StringSchema<undefined>;
|
|
178
|
+
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
179
|
+
}, undefined>, undefined>;
|
|
180
|
+
readonly text: import("valibot").StringSchema<undefined>;
|
|
181
|
+
}, undefined>, undefined>, undefined>;
|
|
182
|
+
}, undefined>, undefined>;
|
|
183
|
+
readonly separator: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
184
|
+
}, undefined>, undefined>;
|
|
146
185
|
readonly choices: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").ObjectSchema<{
|
|
147
186
|
readonly id: import("valibot").StringSchema<undefined>;
|
|
148
187
|
readonly name: import("valibot").StringSchema<undefined>;
|
|
149
188
|
readonly description: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
189
|
+
readonly conditionalName: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
|
|
190
|
+
readonly fragments: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
191
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
192
|
+
readonly text: import("valibot").StringSchema<undefined>;
|
|
193
|
+
readonly conditions: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
194
|
+
readonly type: import("valibot").StringSchema<undefined>;
|
|
195
|
+
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
196
|
+
}, undefined>, undefined>, undefined>;
|
|
197
|
+
readonly variants: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
198
|
+
readonly conditions: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
199
|
+
readonly type: import("valibot").StringSchema<undefined>;
|
|
200
|
+
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
201
|
+
}, undefined>, undefined>;
|
|
202
|
+
readonly text: import("valibot").StringSchema<undefined>;
|
|
203
|
+
}, undefined>, undefined>, undefined>;
|
|
204
|
+
}, undefined>, undefined>;
|
|
205
|
+
readonly separator: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
206
|
+
}, undefined>, undefined>;
|
|
207
|
+
readonly conditionalDescription: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
|
|
208
|
+
readonly fragments: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
209
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
210
|
+
readonly text: import("valibot").StringSchema<undefined>;
|
|
211
|
+
readonly conditions: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
212
|
+
readonly type: import("valibot").StringSchema<undefined>;
|
|
213
|
+
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
214
|
+
}, undefined>, undefined>, undefined>;
|
|
215
|
+
readonly variants: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
216
|
+
readonly conditions: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
217
|
+
readonly type: import("valibot").StringSchema<undefined>;
|
|
218
|
+
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
219
|
+
}, undefined>, undefined>;
|
|
220
|
+
readonly text: import("valibot").StringSchema<undefined>;
|
|
221
|
+
}, undefined>, undefined>, undefined>;
|
|
222
|
+
}, undefined>, undefined>;
|
|
223
|
+
readonly separator: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
224
|
+
}, undefined>, undefined>;
|
|
150
225
|
readonly effects: import("valibot").ArraySchema<import("valibot").ObjectSchema<{
|
|
151
226
|
readonly type: import("valibot").StringSchema<undefined>;
|
|
152
227
|
readonly params: import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").UnknownSchema, undefined>;
|
|
@@ -221,6 +296,6 @@ export type StoryBeatPayload = InferOutput<typeof StoryBeatPayloadSchema>;
|
|
|
221
296
|
* Re-exported so a story client needs one import, not two, for the shapes it
|
|
222
297
|
* reads out of a beat.
|
|
223
298
|
*/
|
|
224
|
-
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, } from
|
|
225
|
-
export type { ActivationDTO, ChoiceDefinitionDTO, ConsumableConditionDTO, EncounterStageDTO, PreconditionDTO, } from
|
|
299
|
+
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConditionalTextDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, TextFragmentDTOSchema, TextVariantDTOSchema, conditionalTextFrom, flattenConditionalText, resolveConditionalText, resolveConditionalTextParts, } from '@game-infra/event-schemas';
|
|
300
|
+
export type { ActivationDTO, ChoiceDefinitionDTO, ConditionalTextDTO, ConsumableConditionDTO, EncounterStageDTO, PreconditionDTO, PreconditionPredicate, ResolvedTextFragment, } from '@game-infra/event-schemas';
|
|
226
301
|
//# sourceMappingURL=storyPayloads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyPayloads.d.ts","sourceRoot":"","sources":["../src/storyPayloads.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"storyPayloads.d.ts","sourceRoot":"","sources":["../src/storyPayloads.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,EAajB,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;IAE7B,+BAA+B;;;;;aAK/B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,qBAAqB;;;;;;IAMhC,sFAAsF;;;;;;;;;;;;;;IAGtF,mEAAmE;;;;;IAKnE,wEAAwE;;;IAGxE,mEAAmE;;IAEnE,gFAAgF;;IAEhF,qFAAqF;;IAErF,0FAA0F;;;;;IAO1F,gGAAgG;;;;;aAOhG,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEvE,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,YAAI,WAAW,EAAE,UAAU,CAAU,CAAA;AAEpE,eAAO,MAAM,qBAAqB,iFAA+B,CAAA;AAEjE,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEjC,6EAA6E;;;IAG7E,wDAAwD;;IAExD,qDAAqD;;aAErD,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAEzE;;;GAGG;AACH,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA"}
|
package/dist/storyPayloads.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActivationDTOSchema, EncounterStageDTOSchema, EventDescriptionSchema, EventRaritySchema, EventParticipantPersonaDTOSchema, PreconditionDTOSchema, } from
|
|
2
|
-
import { array, boolean, number, object, optional, picklist, record, string, } from
|
|
1
|
+
import { ActivationDTOSchema, EncounterStageDTOSchema, EventDescriptionSchema, EventRaritySchema, EventParticipantPersonaDTOSchema, PreconditionDTOSchema, } from '@game-infra/event-schemas';
|
|
2
|
+
import { array, boolean, integer, maxValue, minValue, number, object, optional, picklist, pipe, record, string, } from 'valibot';
|
|
3
3
|
/**
|
|
4
4
|
* What goes *inside* a design-content row's `data` for story mode.
|
|
5
5
|
*
|
|
@@ -62,6 +62,9 @@ export const WorldPayloadSchema = object({
|
|
|
62
62
|
* tags: ['mystery', 'descent'],
|
|
63
63
|
* protagonistId: 'tallow',
|
|
64
64
|
* openingLocationId: 'quiet-forge',
|
|
65
|
+
* playerPowerLevel: 5,
|
|
66
|
+
* playerStatValues: [{ statId: 'wits', value: 7 }],
|
|
67
|
+
* playerSkillValues: [{ skillId: 'salvage', rank: 5 }],
|
|
65
68
|
* }
|
|
66
69
|
* ```
|
|
67
70
|
*/
|
|
@@ -84,9 +87,21 @@ export const StoryArcPayloadSchema = object({
|
|
|
84
87
|
protagonistId: optional(string()),
|
|
85
88
|
/** A location id from the world, when the arc opens somewhere in particular. */
|
|
86
89
|
openingLocationId: optional(string()),
|
|
90
|
+
/** The player's story-specific capability, from ordinary novice to world-shaping. */
|
|
91
|
+
playerPowerLevel: pipe(number(), integer(), minValue(1), maxValue(10)),
|
|
92
|
+
/** Story-specific starting stats, calibrated to the protagonist described by this arc. */
|
|
93
|
+
playerStatValues: array(object({
|
|
94
|
+
statId: string(),
|
|
95
|
+
value: number(),
|
|
96
|
+
})),
|
|
97
|
+
/** Story-specific starting skill ranks, calibrated to the protagonist described by this arc. */
|
|
98
|
+
playerSkillValues: array(object({
|
|
99
|
+
skillId: string(),
|
|
100
|
+
rank: pipe(number(), integer(), minValue(0), maxValue(10)),
|
|
101
|
+
})),
|
|
87
102
|
});
|
|
88
103
|
/** Whether a beat's narration came from a model or from the player's own words. */
|
|
89
|
-
export const STORY_BEAT_ORIGINS = [
|
|
104
|
+
export const STORY_BEAT_ORIGINS = ['generated', 'authored'];
|
|
90
105
|
export const StoryBeatOriginSchema = picklist(STORY_BEAT_ORIGINS);
|
|
91
106
|
/**
|
|
92
107
|
* One beat of a story: an `EncounterStageDTO`, plus how it came to exist.
|
|
@@ -96,6 +111,12 @@ export const StoryBeatOriginSchema = picklist(STORY_BEAT_ORIGINS);
|
|
|
96
111
|
* `conditionsToShow`, `conditionsToEnable`, `consumableConditions`, `effects`
|
|
97
112
|
* and an outcome config exactly as an event's choice does.
|
|
98
113
|
*
|
|
114
|
+
* A beat that reads differently depending on what the player has done carries
|
|
115
|
+
* `conditionalDescription` beside `description` (see `ConditionalTextDTO`): the
|
|
116
|
+
* fragments a reader in this state is shown, with `description` holding the
|
|
117
|
+
* flattened reading for anything that cannot evaluate preconditions. Branch
|
|
118
|
+
* labels vary the same way through a choice's `conditionalName`.
|
|
119
|
+
*
|
|
99
120
|
* The beat's *address* is not in here — it is the row's `contentId`, the trail
|
|
100
121
|
* of choices taken to reach it (see `nodePaths.ts`). Keeping the address out of
|
|
101
122
|
* the payload is what keeps the two from disagreeing. The stage's own `id` is
|
|
@@ -138,5 +159,5 @@ export const StoryBeatPayloadSchema = object({
|
|
|
138
159
|
* Re-exported so a story client needs one import, not two, for the shapes it
|
|
139
160
|
* reads out of a beat.
|
|
140
161
|
*/
|
|
141
|
-
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, } from
|
|
162
|
+
export { ActivationDTOSchema, ChoiceDefinitionDTOSchema, ConditionalTextDTOSchema, ConsumableConditionDTOSchema, EncounterStageDTOSchema, PreconditionDTOSchema, TextFragmentDTOSchema, TextVariantDTOSchema, conditionalTextFrom, flattenConditionalText, resolveConditionalText, resolveConditionalTextParts, } from '@game-infra/event-schemas';
|
|
142
163
|
//# sourceMappingURL=storyPayloads.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyPayloads.js","sourceRoot":"","sources":["../src/storyPayloads.ts"],"names":[],"mappings":"A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AwD;IACxD,QAAQ,EAAE,MAAM,EAAE;IAClB,qDAAqD;IACrD,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACvB,CAAC,CAAA;AAIF;;;GAGG;AACH,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@game-infra/story-schemas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Story-mode API contract: branching arcs and beats built on the event-editor's encounter-stage and choice DTOs, behind one design-content resource",
|
|
5
5
|
"homepage": "https://github.com/kibertoad/game-infra/tree/main/packages/schemas/story-schemas#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"@toad-contracts/core": "0.4.0",
|
|
31
31
|
"@toad-contracts/valibot": "0.5.0",
|
|
32
32
|
"@game-infra/api-schemas-core": "0.3.0",
|
|
33
|
-
"@game-infra/event-schemas": "1.
|
|
33
|
+
"@game-infra/event-schemas": "1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^26.1
|
|
36
|
+
"@types/node": "^26.4.1",
|
|
37
37
|
"rimraf": "^6.1.3",
|
|
38
38
|
"typescript": "^7.0.2",
|
|
39
39
|
"valibot": "^1.4.2",
|
|
40
|
-
"vitest": "^4.1.
|
|
40
|
+
"vitest": "^4.1.11"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"valibot": "^1.4.0"
|