gs2-studio-dsl 2026.11.14 → 2026.11.16
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/LLM.md +108 -30
- package/README.md +4 -4
- package/REFERENCE.md +209 -46
- package/index.d.ts +305 -251
- package/package.json +1 -1
package/LLM.md
CHANGED
|
@@ -61,8 +61,9 @@ commands below with the executable's path; the first build writes the ledger. It
|
|
|
61
61
|
generation will do wrong or leave out. Fix each one the DSL can fix (section 6) and build again; tell the user about a
|
|
62
62
|
line on another package that the DSL does not change. Then open the project in GS2 Studio and fix what it reports:
|
|
63
63
|
what Unity code generation alone refuses is not printed (see
|
|
64
|
-
[Building with dsl build](REFERENCE.md#building-with-dsl-build)).
|
|
65
|
-
`project check (without Unity code generation):
|
|
64
|
+
[Building with dsl build](REFERENCE.md#building-with-dsl-build)). The build's last line counts the errors and
|
|
65
|
+
warnings, such as `project check (without Unity code generation): 0 error(s), 2 warning(s)`, and is
|
|
66
|
+
`project check (without Unity code generation): no errors or warnings` when there is none.
|
|
66
67
|
8. Keep `id-ledger.json` and `dependency-surface.json` with `index.ts`; commit them together.
|
|
67
68
|
|
|
68
69
|
A build that fails a check writes nothing. On failure, read every listed problem, fix the DSL, and rerun.
|
|
@@ -90,48 +91,86 @@ MUST:
|
|
|
90
91
|
for. The dependency's own UI components (`types.<Type>.uiComponents`) are generated with it, and the game places
|
|
91
92
|
the Handler that holds the row they show, such as a `WalletHandler` set to the slot (`"0"`). See
|
|
92
93
|
[Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
93
|
-
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
- With `micro-economy-quest`, use its `QuestStartButton` and `ProgressCompleteButton` (surface keys `StartButton` on
|
|
95
|
+
`Quest` and `CompleteButton` on `Progress`) instead of writing Start and Complete buttons, and gate the quest list's
|
|
96
|
+
Start buttons with `ProgressIdleActiveToggle` (surface key `IdleActiveToggle` on `Progress`), or with an
|
|
97
|
+
`interactable` on `Quest` that reads the progress row `"progress"` with `UiSource.rowProp`: GS2 refuses a second
|
|
98
|
+
Start while a quest is in progress (`alreadyExists`). A player with no quest in progress, including one who never
|
|
99
|
+
started any, still has that row, with `inProgress` `false`, so this check passes once the `ProgressHandler` has loaded.
|
|
100
|
+
See [Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
101
|
+
- Place an `activeToggle` such as `ProgressIdleActiveToggle` on a GameObject that stays active below the type's
|
|
102
|
+
Handler, with what it shows or hides as its targets, never on a GameObject it hides: once hidden it stops listening
|
|
103
|
+
and never shows it again. See [UI components](REFERENCE.md#ui-components).
|
|
104
|
+
- Before adding UI to a dependency's type, read `types.<Type>.uiComponents` of its surface. Its keys are the class
|
|
105
|
+
names items are declared with; the generated Unity class is the type's generated name followed by the key (surface
|
|
106
|
+
key `StartButton` on `Quest` → generated class `QuestStartButton`; a rename of the type changes the prefix, see
|
|
107
|
+
[Item options](REFERENCE.md#item-options)). Reuse a listed item instead of adding one that shows the same, and give
|
|
108
|
+
new items unlisted class names: a listed one replaces that item.
|
|
109
|
+
- Give a single-entry type's row the type name in lower case as its id (`GameSettings` → `gamesettings`). The same id
|
|
110
|
+
is the row its Handler holds and the row id to pass to `UiSource.rowProp`. For a dependency's type, read it from
|
|
111
|
+
`types.<Type>.singleEntryRowId` of the surface, also when the surface lists no row (`micro-economy-quest`'s
|
|
112
|
+
`Progress` → `"progress"`); an overlay that renames the type keeps it. See
|
|
113
|
+
[Keys and identity](REFERENCE.md#keys-and-identity).
|
|
96
114
|
- Refer to anything of another package only through `dependencyPackage(surface)` built from a surface file that
|
|
97
115
|
`dsl surfaces` wrote (or, for a package you build yourself, the `dependency-surface.json` beside its ledger, which
|
|
98
116
|
has the same content): `dep.type(...)`, `dep.overlay(...)`, `dep.typeId(...)`, `dep.propertyId(...)`,
|
|
99
117
|
`dep.transformId(...)`, `dep.transformCall(...)`, `dep.transformProgram(...)`, `dep.resourceId(...)`. Declare the
|
|
100
118
|
dependency in `definePackage({ dependencies: { [dep.packageId]: spec } })`. The spec of a package authored in the same
|
|
101
119
|
project is `"*"`. An installed package has the spec of its source, as the `dependencies` of
|
|
102
|
-
`<project>/packages/<packageId>/package.json` of the package that installed it declare it: a package
|
|
103
|
-
GitHub is `github:<owner>/<repo>[@<range>]` without its subdirectory, and every package of the GS2
|
|
104
|
-
repository is `github:gs2io/gs2-studio-package`. A package that came in as a dependency of another one
|
|
105
|
-
`package.json` there:
|
|
106
|
-
`"sourceKind": "github"`
|
|
107
|
-
declare (see
|
|
120
|
+
`<project>/packages/<packageId>/package.json` of the package that installed it declare it, range included: a package
|
|
121
|
+
installed from GitHub is `github:<owner>/<repo>[@<range>]` without its subdirectory, and every package of the GS2
|
|
122
|
+
Studio package repository is `github:gs2io/gs2-studio-package`. A package that came in as a dependency of another one
|
|
123
|
+
appears in no `package.json` there: derive the spec from its entry in `<project>/project-lock.json`
|
|
124
|
+
(`github:<owner>/<repo>` for `"sourceKind": "github"`, `npm:<packageName>@<version>` for `"sourceKind": "npm"`).
|
|
125
|
+
Never give an installed package `"*"`; `dsl build` refuses it and prints the spec to declare (see
|
|
126
|
+
[Dependencies](REFERENCE.md#dependencies)).
|
|
108
127
|
- Learn what a dependency needs from its surface file, not from its package files: `types.<Type>.propertyDetails`
|
|
109
|
-
gives each property's `type`, `requirement
|
|
110
|
-
|
|
128
|
+
gives each property's `type`, `requirement` (for `conditional`, also its `condition`, in the form `Cond` returns,
|
|
129
|
+
and `requiredWhenMet`; see [Conditions](REFERENCE.md#conditions)), `bindingHint` and, when it has
|
|
130
|
+
one, its `display` (label and description per locale); `actionTransformSignatures.<Name>` gives each transform's category and parameters (name, type,
|
|
111
131
|
required and, when it has one, description); `types.<Type>.delegatedActions.<Method>.parameters` gives what a
|
|
112
132
|
`UiItem.buttonAction` on that method takes as `args`; `types.<Type>.sort` gives the order of its rows, which an overlay of
|
|
113
133
|
the type keeps unless it sets a `sort` other than id ascending. A `ref<T>` parameter or property takes a row id of `T`.
|
|
114
134
|
- Call a dependency's transform with `dep.transformCall(name, { <parameter>: source })` (spread into an
|
|
115
135
|
`actionPropertyTransforms` entry) or `dep.transformProgram(name, { <parameter>: source })` (in `actionProgram`),
|
|
116
136
|
not with `dep.transformId(...)` and hand-written arguments, so `tsc` and `dsl build` check the parameter names. The
|
|
117
|
-
two name a property differently:
|
|
118
|
-
row>"
|
|
119
|
-
[
|
|
137
|
+
two name a property differently: write `actionPropertyTransforms: prop => [...]` and give `transformCall`
|
|
138
|
+
`prop("<property of the row>")`; `transformProgram` takes `{ kind: "domainProperty", source: Source.direct(...) }`.
|
|
139
|
+
In the `prop => [...]` form `tsc` reports a wrong `prop("x")` on `"x"`, but any other mistake in its entries (a wrong
|
|
140
|
+
`targetProperty` or `mode`) on `actionPropertyTransforms` itself, where the array form would point at the value; the
|
|
141
|
+
message's last line names it. See the examples in [Overlay types](REFERENCE.md#overlay-types) and
|
|
142
|
+
[Action programs](REFERENCE.md#action-programs-and-arguments).
|
|
120
143
|
- Add the rows a dependency's type needs from the project with `instance(dep.type("<Type>"), id, values)` in
|
|
121
144
|
`definePackage({ instances: [...] })`: every type a build names in `No master data is registered for domain model
|
|
122
145
|
"<Type>"`. Never author a row whose id a surface lists for the same type (`shippedRowIds`,
|
|
123
146
|
`shippedRowsOfDependencyTypes`): a package ships it, and a row with its id replaces it (use `overlayInstance`). Take
|
|
124
147
|
the values from `types.<Type>.propertyDetails` of the surface. Give a value to every `requirement: "always"` property
|
|
125
148
|
except `id` (the row id), `userData` properties and action lists
|
|
126
|
-
(`list<consumeAction>` and the other action kinds): a missing one fails the build.
|
|
127
|
-
|
|
149
|
+
(`list<consumeAction>` and the other action kinds): a missing one fails the build. Give one also to each
|
|
150
|
+
`conditional` property with `requiredWhenMet: true` unless the row's values rule out its `condition`. An action list
|
|
151
|
+
you leave out deploys as what `actionPropertyTransforms` add to it, or empty.
|
|
152
|
+
- A property or parameter of type `ref<<packageId>:<Type>>` takes a row of that package's type. Declare that package
|
|
153
|
+
as a dependency if it is not one yet (its own surface file and spec), author the row with
|
|
154
|
+
`instance(other.type("<Type>"), id, values)`, and give the row id as the value. Example, a limited-time quest:
|
|
155
|
+
`micro-economy-quest` keeps the period on `QuestCollection.schedule` (`ref<foundation-economy-schedule:Schedule>`),
|
|
156
|
+
not on `Quest`, so put the quest in a quest collection of its own with an absolute `Schedule` row, and have the game
|
|
157
|
+
list that collection too. See [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type).
|
|
128
158
|
- Choose each property's binding hint by what reads its value, also for a property an overlay adds: the client, from
|
|
129
159
|
the rows you author (a UI component shows it) → `.assetDelivery()`; only an `actionPropertyTransforms` argument → no
|
|
130
160
|
hint; a field a master data resource of this package binds → `.masterData()`. See the table in
|
|
131
161
|
[Property modifiers](REFERENCE.md#property-modifiers).
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
(`
|
|
162
|
+
- Write property names as string literals where the DSL takes them. `tsc` checks each against the type it names
|
|
163
|
+
(`UiSource.prop` against the `defineUiComponent` target, `sort`, `compositeKey`, `localizedProperties`,
|
|
164
|
+
`targetProperty` and a transform argument's `prop(...)` against the type that declares them, `UiSource.rowProp`,
|
|
165
|
+
`Source.direct` and row value keys against their type), reports a wrong one on the literal itself (but see the
|
|
166
|
+
`prop => [...]` form above), and lists the names the type has. Write `UiItem` / `UiCond` / `UiSource` calls directly
|
|
167
|
+
in `defineUiComponent`'s `items`. In a variable, a helper function or a `...` spread they name no property unless
|
|
168
|
+
annotated: `function attackLabel(): UiItemSpec<PropertyNameOf<typeof Hero>>`, `const limited: UiConditionSpec<...> = ...`
|
|
169
|
+
(a name parameter of such a helper is `name: PropertyNameOf<typeof Hero>`; a helper generic in the name instead
|
|
170
|
+
passes it as the type argument: `UiItem.label<T>(className, UiSource.prop(name))`). A name typed as a plain `string`
|
|
171
|
+
does not compile; any other helper that passes one on takes `<TName extends string>(name: TName)`. A computed row value key
|
|
172
|
+
escapes `tsc`; `dsl build` still refuses it. See
|
|
173
|
+
[Property names are type-checked](REFERENCE.md#property-names-are-type-checked).
|
|
135
174
|
- Regenerate surface files after a dependency changes. Never edit them by hand.
|
|
136
175
|
- In master data, use `Bind.domainProperty` only in a resource mounted on a domain type, and never use
|
|
137
176
|
`Bind.domainProperties` (user data only). `dsl build` accepts both mistakes; the editor and code generation refuse
|
|
@@ -151,17 +190,30 @@ MUST NOT:
|
|
|
151
190
|
`node:*` modules or npm packages other than `gs2-studio-dsl`.
|
|
152
191
|
- Attach one `defineMasterDataResource` / `defineUserDataResource` definition in two places.
|
|
153
192
|
- Use one `defineInlineElement` schema for two list properties.
|
|
193
|
+
- Call a generated handler's `Reload` / `ReloadAsync` / `TryReloadAsync` or `Invalidate` after an action to refresh the
|
|
194
|
+
view. Handlers and their UI components follow action results through the GS2 SDK cache. See
|
|
195
|
+
[Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
154
196
|
|
|
155
197
|
Names and ids:
|
|
156
198
|
|
|
157
199
|
- You write names; GS2 Studio stores ids. The ledger maps names (tokens such as `property:Item.count`) to ids.
|
|
200
|
+
- Renaming a property: rename it in `properties` first and run `tsc --noEmit`, which lists every place that still uses
|
|
201
|
+
the old name (rows, `sort`, `localizedProperties`, transform arguments, UI sources, bindings). Change each, then build
|
|
202
|
+
and move the id as below.
|
|
158
203
|
- Renaming a type, property, row or transform: the build reports the old token as "not current" and the new one as
|
|
159
204
|
missing, in one line that says it looks like a rename and names the id to move when it can pair them. In
|
|
160
|
-
`id-ledger.json`, move the old token's id to the new token in `random`,
|
|
205
|
+
`id-ledger.json`, move the old token's id to the new token in `random`, keeping its tokens sorted (otherwise
|
|
206
|
+
`CLI_DSL_LEDGER_INVALID ... not canonical`), then build without `--write-ledger`. Never let
|
|
161
207
|
`--write-ledger` record a new id for a renamed thing. Renaming a type also renames its `property:<Type>.<name>` and
|
|
162
208
|
row tokens; move each of them, all before the next build. It also changes, without a message, the ids of the
|
|
163
209
|
type's UI component and its items and of user data resources mounted on the type; keep them with
|
|
164
210
|
`deterministicOverrides`. See [The id ledger](REFERENCE.md#the-id-ledger).
|
|
211
|
+
- Renaming a UI item (its class name) changes its id the same way. Keep it in `deterministicOverrides`
|
|
212
|
+
(`"ui:<Type>:item:<NewClassName>": "<old item id>"`) so Unity scenes and prefabs keep the renamed component.
|
|
213
|
+
- Renaming a property needs no change to the class names of the UI items that show it (`HpLabel` may stay after `hp`
|
|
214
|
+
becomes `health`): an item is keyed by its class name, not by the property. Rename the item
|
|
215
|
+
only if asked, and then keep its id as above; only a kept id carries the generated script's GUID over, so scenes and
|
|
216
|
+
prefabs stay wired. See [The id ledger](REFERENCE.md#the-id-ledger).
|
|
165
217
|
- A row id is letters, digits, `_`, `.` and `-`, at most 128 characters; a resource that binds `id` to a GS2 name sends
|
|
166
218
|
it as that name (a `micro-economy-quest` `Quest` row id is the quest model name), and some GS2 fields take fewer.
|
|
167
219
|
- A row token contains the row id. Before you treat a "not current" + "missing" row token pair as a rename of a
|
|
@@ -193,16 +245,17 @@ Names and ids:
|
|
|
193
245
|
| Map GS2 user data to properties | `defineUserDataResource({ model: GS2.svc.Model, linkedMaster?, mount?, bindings: {...}, children? })` | [User data resources](REFERENCE.md#user-data-resources) |
|
|
194
246
|
| Field values | `Bind.*`, `Source.direct(T, "prop")`, `Source.parent(...)`, `transactionSettingV2()` | [Bindings](REFERENCE.md#bindings) |
|
|
195
247
|
| Actions of an action entry | `ActionProgram.transform(transform, [Arg...])`; a dependency's: `dep.transformProgram(name, { count: { kind: "domainProperty", source: Source.parent(Source.direct(T, "count")) } })` | [Action programs and arguments](REFERENCE.md#action-programs-and-arguments) |
|
|
196
|
-
| Add a dependency's transform to an inherited action property | `actionPropertyTransforms: [{ targetProperty, mode: "append", ...dep.transformCall(name, { count:
|
|
248
|
+
| Add a dependency's transform to an inherited action property | `actionPropertyTransforms: prop => [{ targetProperty, mode: "append", ...dep.transformCall(name, { count: prop("price") }) }]` | [Overlay types](REFERENCE.md#overlay-types) |
|
|
249
|
+
| A row of another package's type (a `ref<pkg:Type>` value, such as a quest collection's schedule) | Declare that package too, `instance(other.type("Schedule"), id, values)`, pass the row id | [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type) |
|
|
197
250
|
| Produce GS2 actions from parameters | `defineActionTransform(name, { category, parameters, outputs })` + `OutputMap.*` | [Action transforms](REFERENCE.md#action-transforms) |
|
|
198
251
|
| A method that runs a GS2 action | `delegatedActions: { Method: { targetActionKey, targetResource } }` on the type, or `definePackage({ delegatedActions: [{ target, methodName, action: { targetActionKey, targetResource } }] })` | [Delegated actions](REFERENCE.md#delegated-actions) |
|
|
199
252
|
| Generated UI | `defineUiComponent(T, { items: [UiItem.label(...), UiItem.buttonAction(...)] })`, `UiSource.*`, `UiCond.*` | [UI components](REFERENCE.md#ui-components) |
|
|
200
|
-
| Enable a button by another type's row (stamina, coins) | `UiItem.interactable("StartInteractable", UiCond.gte(UiSource.rowProp(energy.type("Energy"), "stamina", "currentValue"), UiSource.prop("
|
|
253
|
+
| Enable a button by another type's row (stamina, coins) | `UiItem.interactable("StartInteractable", UiCond.gte(UiSource.rowProp(energy.type("Energy"), "stamina", "currentValue"), UiSource.prop("cost")))` | [Another type's row](REFERENCE.md#another-types-row) |
|
|
201
254
|
| Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `value` sends a typed value the game formats; a button never disables itself (add `interactable`). `{ name, description }` only label the item in GS2 Studio's editor; leave them out | [UI components](REFERENCE.md#ui-components), [Item options](REFERENCE.md#item-options) |
|
|
202
255
|
| Show every row in the game, in order | A UI component describes one row; the generated `<T>ListHandler` makes one instance of a prefab per row, in the order of `sort` (an overlay: the dependency's order unless it sets a `sort` other than id ascending) | [Rows in the game](REFERENCE.md#rows-in-the-game) |
|
|
203
|
-
| A button on a dependency's delegated action | `UiItem.buttonAction("
|
|
256
|
+
| A button on a dependency's delegated action | `UiItem.buttonAction("ReceiveButton", "Receive", args, options)` (first check `types.<T>.uiComponents`, keyed by class name without the `<T>` prefix: a package may already ship the button); `args` takes only the names under `types.<T>.delegatedActions.Receive.parameters` of the surface and needs each `required: true` one; with none required it may be `undefined` | [Dependencies](REFERENCE.md#dependencies) |
|
|
204
257
|
| Code template | `codeTemplates: [{ outputFileName: "File.cs", templateSource: text }]` with a `?raw` import | [Code templates](REFERENCE.md#code-templates) |
|
|
205
|
-
| Use another package of the project | `dependencyPackage(surface)`, `dependencies: { [dep.packageId]: spec }`; spec `"*"` (authored in the project), or for an installed package the spec the package that installed it declares (`"github:gs2io/gs2-studio-package"` for an official package) | [Dependencies](REFERENCE.md#dependencies) |
|
|
258
|
+
| Use another package of the project | `dependencyPackage(surface)`, `dependencies: { [dep.packageId]: spec }`; spec `"*"` (authored in the project), or for an installed package the spec the package that installed it declares, or for one only in `project-lock.json` the spec its entry gives (`"github:gs2io/gs2-studio-package"` for an official package) | [Dependencies](REFERENCE.md#dependencies) |
|
|
206
259
|
|
|
207
260
|
## 6. Common mistakes
|
|
208
261
|
|
|
@@ -216,11 +269,16 @@ Names and ids:
|
|
|
216
269
|
| `CLI_DSL_EXPORT_INVALID` | Zero or several built packages exported. | Export exactly one `definePackage({...})` or `.build()` result. |
|
|
217
270
|
| `{"kind":"domainTypeDefinitionNotRegistered",...}`, `{"kind":"invalidInstanceType",...}`, `{"kind":"uiComponentTargetTypeUnknown",...}` | A definition used (in a mount or binding, a row, a UI component) without being listed in `domainTypes: [...]`. | Include it in `definePackage({ domainTypes: [...] })`. |
|
|
218
271
|
| `{"kind":"reservedPropertyName",...}` | A property named `id`. | Rename it; `id` exists already. |
|
|
219
|
-
| `
|
|
220
|
-
|
|
|
272
|
+
| `tsc`: `Type '"x"' is not assignable to type '"a" \| "b" \| ...'`, `Argument of type '"x"' is not assignable to parameter of type '"a" \| "b" \| ...'` or `'x' does not exist in type ...`, on the name | A property name the type does not have: misspelled, or left behind by a rename. The message lists the names it has. | Use one of them; after a rename, the new name. |
|
|
273
|
+
| `<where>: "x" is not a property of "T" (properties: ...)` | The same, in a name `tsc` could not check, or a build run without `tsc`. One line per place. | Use one of the listed names. |
|
|
274
|
+
| `tsc`: `Type '{ ...; arguments: readonly DomainTypeTransformArgumentDef<"x">[]; ... }' is not assignable to type 'OverlayActionPropertyTransformDef<...>'`, on the `{` of an `actionPropertyTransforms` entry | A wrong property name in a `{ kind: "domainProperty", propertyName: "x" }` argument of that entry's `dep.transformCall(...)`: `tsc` cannot point inside the call. | Fix `"x"` in that entry's arguments; write them as `prop("x")` in `actionPropertyTransforms: prop => [...]`, which reports the name itself. |
|
|
275
|
+
| `tsc`: `Type '(prop: ...) => ...' is not assignable to type ...` on `actionPropertyTransforms` | A wrong value in an entry of `actionPropertyTransforms: prop => [...]` other than a `prop("x")` name, such as `targetProperty` or `mode`. The last line of the message names it. | Fix that value. |
|
|
276
|
+
| `tsc`: `Argument of type '"x"' is not assignable to parameter of type 'never'` on `UiSource.prop("x")` | A UI helper written in a variable, a helper function or a `...` spread instead of directly in `defineUiComponent`'s `items`, where no type gives the names. | Write it directly in `items`, or annotate the helper's return type or the variable with the component's names: `UiItemSpec<PropertyNameOf<typeof T>>`, `UiConditionSpec<...>`, `UiValueSourceSpec<...>`. A helper generic in the name passes it as the type argument: `UiItem.label<N>(className, UiSource.prop(name))`. |
|
|
277
|
+
| `{"kind":"uiComponentUnknownDelegatedAction",...}` | `UiItem.buttonAction` names a method the target lacks. | Register the delegated action on that type. |
|
|
221
278
|
| `{"kind":"duplicateUiComponentClassName",...}` | Two items of the same type share a class name. | Make class names unique per type. |
|
|
222
279
|
| `{"kind":"uiComponentTemplateLabelKeyMismatch",...}` | `{key}` placeholders and `sources` keys differ. | Make them match one to one. |
|
|
223
280
|
| `{"kind":"singleEntryInstanceIdMismatch",...,"expectedId":"..."}` | Wrong row id on a single-entry type. | Use `expectedId`. |
|
|
281
|
+
| `{"kind":"uiComponentForeignRowSingleEntryIdMismatch",...,"expectedId":"..."}` | A `UiSource.rowProp` names another row of a single-entry type than its one row, which is the only row its Handler holds. | Use `expectedId` (`types.<Type>.singleEntryRowId` of the surface). |
|
|
224
282
|
| `{"kind":"invalidCompositeKey","reason":"unsupportedMemberBindingHint",...}` | A key member without `masterData` / `assetDelivery`. | Add the hint. |
|
|
225
283
|
| `{"kind":"invalidSortKey","reason":"notRequired",...}` | Sorting by an optional property. | Make it `.required()` or sort by `"id"`. |
|
|
226
284
|
| `{"kind":"invalidBindingValue",...}` | A binding kind the resource does not accept (for example `Bind.resourceKey()` on user data), a malformed directive, or an inline schema used twice. | Read `context`; use an accepted kind. |
|
|
@@ -228,8 +286,8 @@ Names and ids:
|
|
|
228
286
|
| `{"kind":"resourceDefinitionAttachedTwice",...}` | One resource definition included in two places (two `children` lists, or a root and a child). | Make a second definition with its own `defineMasterDataResource` / `defineUserDataResource`. |
|
|
229
287
|
| `{"kind":"unresolvedParentBinding",...}` | `Source.parent(...)` on a root resource. | Use `Source.direct(...)`, or move the resource under a parent. |
|
|
230
288
|
| `CLI_DSL_LEDGER_MISSING` | First build without `--write-ledger`. | Add `--write-ledger`. |
|
|
231
|
-
| `CLI_DSL_LEDGER_MISMATCH` ... `random token ... is missing from the ledger
|
|
232
|
-
| `CLI_DSL_LEDGER_MISMATCH` ... `looks like a rename: ... move its id "<id>" from "<old>" to "<new>"` | You renamed something, or changed a row id. | If you renamed it, move the id as the line says (a changed composite-key row id: first check it against the composite key rule)
|
|
289
|
+
| `CLI_DSL_LEDGER_MISMATCH` ... `random token ... is missing from the ledger; new entry ...`, and no token is "not current" | You added something. | Check the tokens, then rebuild with `--write-ledger`, which records the entries shown; do not add them by hand. |
|
|
290
|
+
| `CLI_DSL_LEDGER_MISMATCH` ... `looks like a rename: ... move its id "<id>" from "<old>" to "<new>"` | You renamed something, or changed a row id. | If you renamed it, move the id as the line says (a changed composite-key row id: first check it against the composite key rule) and rebuild without `--write-ledger`. Only if you removed it and added another: move the old token and its id to `retired`, then rebuild with `--write-ledger`. |
|
|
233
291
|
| `CLI_DSL_LEDGER_MISMATCH` ... `is not current; move it to retired` | You renamed or removed something, or changed a row id. | A changed composite-key row id: first check it against the composite key rule. Renamed: move the old token's id to the new token. Removed: move token and id to `retired`. Then rebuild without `--write-ledger`. |
|
|
234
292
|
| `CLI_DSL_LEDGER_INVALID` ... `not canonical` | The ledger's key order, entry order, indentation or final newline differs from what GS2 Studio writes. | Restore that form (section 4). |
|
|
235
293
|
| `CLI_DSL_VALIDATION_FAILED` ... `No master data resource binds this property.` | A `.masterData()` property no resource binds. | Bind it with `Bind.domainProperty(Source.direct(T, "prop"))` in a resource mounted on `T`, or remove the hint. |
|
|
@@ -411,3 +469,23 @@ Its `id-ledger.json` after the first `dsl build --write-ledger`:
|
|
|
411
469
|
For dependencies, overlays, delegated actions and code templates, read the `example-gift-shop` sections of
|
|
412
470
|
[REFERENCE.md](REFERENCE.md#dependencies). For an overlay that appends a dependency's transform to an inherited action
|
|
413
471
|
property with `dep.transformCall`, read `example-gift-sale` in [Overlay types](REFERENCE.md#overlay-types).
|
|
472
|
+
|
|
473
|
+
## 8. The game's GS2 client credentials
|
|
474
|
+
|
|
475
|
+
The game signs in to GS2 with a client ID and a client secret. Take them from the project.
|
|
476
|
+
|
|
477
|
+
- They are the outputs `ApplicationClientId` and `ApplicationClientSecret` of the GS2-Deploy stack `Default`, which GS2
|
|
478
|
+
creates with every project (some projects name them `ClientID` and `ClientSecret`, which GS2 Studio also reads). The
|
|
479
|
+
client has ApplicationAccess permission and is made to be embedded in the game, so the two values are low-sensitivity.
|
|
480
|
+
- Never create a GS2-Identifier user or client for the game, and never put the developer's GS2 sign-in (email,
|
|
481
|
+
password, credentials file) or any other management credential into the game.
|
|
482
|
+
- In Unity, they go into a `Gs2Environment` asset (Create > Game Server Services > Core > Environment) with `region`,
|
|
483
|
+
`clientId`, `clientSecret` and `name`. `Gs2ClientHolder` lists the asset under Environments, and its Active
|
|
484
|
+
Environment Name must equal the asset's `name` field, not its file name.
|
|
485
|
+
- The GS2 Studio executable runs only `dsl` commands, so ask the user for the values: in GS2 Studio, they sign in to
|
|
486
|
+
GS2 and choose the destination on Publish, then press "Copy settings" under "Gs2Environment settings" on the Usage
|
|
487
|
+
tab of a table in Simple mode (Region, Client ID, Client Secret). Until GS2 Studio has read the values, it copies
|
|
488
|
+
`YOUR_CLIENT_ID` and `YOUR_CLIENT_SECRET`; never put those into the game.
|
|
489
|
+
- In a checkout of the GS2 Studio repository, its development CLI (`npx vite-node cli/gs2studio.ts`) reads them:
|
|
490
|
+
`deploy outputs --stack Default --project <project> --region <region>`. It signs in with the developer's account only
|
|
491
|
+
to read them; only the two output values go into the game.
|
package/README.md
CHANGED
|
@@ -9,11 +9,11 @@ type-check; use these declarations in your editor and with `tsc --noEmit`.
|
|
|
9
9
|
- For LLM coding agents: [LLM.md](LLM.md)
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --save-dev gs2-studio-dsl@2026.11.
|
|
12
|
+
npm install --save-dev gs2-studio-dsl@2026.11.16
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The version is the GS2 Studio version whose DSL these declarations describe: a DSL written
|
|
16
|
-
against gs2-studio-dsl 2026.11.
|
|
16
|
+
against gs2-studio-dsl 2026.11.16 builds with GS2 Studio 2026.11.16 and later. Install the version that
|
|
17
17
|
matches the oldest GS2 Studio you build with.
|
|
18
18
|
|
|
19
19
|
```ts
|
|
@@ -68,8 +68,8 @@ The GS2 Studio executable runs the `dsl` commands headless and exits with their
|
|
|
68
68
|
# write <out>/<packageId>.json for each package of the project (installed or authored in it)
|
|
69
69
|
"<GS2 Studio>" dsl surfaces --dir <project> --out <out>
|
|
70
70
|
# evaluate the DSL, check it, and save the package it declares into the project beside the project's other packages
|
|
71
|
-
# (--write-ledger the first time); after saving it prints the [error] and [warning] lines project check reports
|
|
72
|
-
# line
|
|
71
|
+
# (--write-ledger the first time); after saving it prints the [error] and [warning] lines project check reports and a
|
|
72
|
+
# line counting them, and exits with 0
|
|
73
73
|
"<GS2 Studio>" dsl build --dir <project> --entry <dsl/index.ts> --write-ledger
|
|
74
74
|
```
|
|
75
75
|
|