gs2-studio-dsl 2026.11.21 → 2026.11.22

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 CHANGED
@@ -24,6 +24,7 @@ Instructions for an agent that writes or edits a GS2 Studio package DSL. Follow
24
24
  id-ledger.json ids of the package; created by dsl build --write-ledger; keep it with index.ts
25
25
  dependency-surface.json written by dsl build: what this package publishes to packages that depend on it
26
26
  surfaces/<packageId>.json written by dsl surfaces: what each package of the project publishes
27
+ surfaces/<packageId>.md written by dsl surfaces: how to use a package that has usage notes
27
28
  tsconfig.json the tsconfig from the README
28
29
  package.json devDependencies: gs2-studio-dsl, typescript
29
30
  ```
@@ -46,6 +47,8 @@ commands below with the executable's path; the first build writes the ledger. It
46
47
  the project with `dsl build`. The DSL cannot install packages.
47
48
  2. If the package depends on other packages, write their surfaces (one file per package of the project):
48
49
  `"<GS2 Studio>" dsl surfaces --dir <project> --out <dsl>/surfaces`
50
+ Before you use a dependency, read `<dsl>/surfaces/<packageId>.md` when it exists: the package's own notes on how
51
+ to use it in the DSL and in the game, and what to check.
49
52
  3. Write or edit `<dsl>/index.ts`. When the package depends on other packages, declare the dependencies first and build
50
53
  (steps 4 to 7): the build then names the types of the dependencies that need rows from this package.
51
54
  4. Type-check: `npx tsc --noEmit -p <dsl>`. Fix every error before building.
@@ -88,38 +91,32 @@ MUST:
88
91
  of its surface is not `[]` (`mountedBy` names the dependency's resources that mount it), or when your package mounts
89
92
  its overlay of the type itself. A type gets one only when a user data resource, or a master data resource of a model
90
93
  other than a namespace, mounts it.
91
- - To use what a dependency does as it is (for example "make the wallet usable" with `foundation-economy-currency`),
92
- declare the dependency and call its transforms; add rows, resources or UI only for what the surface or a build asks
94
+ - Before you use a dependency, read `surfaces/<packageId>.md` when it exists. It is the package's own usage notes:
95
+ which rows to author, which of its items and Handlers the game uses, and what to check.
96
+ - To use what a dependency does as it is (for example a dependency whose transforms are all the game needs), declare
97
+ the dependency and call its transforms; add rows, resources or UI only for what the surface or a build asks
93
98
  for. The dependency's own UI components (`types.<Type>.uiComponents`) are generated with it, and the game places
94
- the Handler that holds the row they show, such as a `WalletHandler` whose Inspector field `_slot` is `0`. See
99
+ the Handler that holds the row they show (its usage notes say which). See
95
100
  [Rows in the game](REFERENCE.md#rows-in-the-game).
96
- - With `micro-economy-quest`, use its `QuestStartButton` and `ProgressCompleteButton` (surface keys `StartButton` on
97
- `Quest` and `CompleteButton` on `Progress`) instead of writing Start and Complete buttons, and gate the quest list's
98
- Start buttons with `ProgressIdleActiveToggle` (surface key `IdleActiveToggle` on `Progress`), or with an
99
- `interactable` on `Quest` that reads the progress row `"progress"` with `UiSource.rowProp`: GS2 refuses a second
100
- Start while a quest is in progress (`alreadyExists`). A player with no quest in progress, including one who never
101
- started any, still has that row, with `inProgress` `false`, so this check passes once the `ProgressHandler` has loaded.
102
- See [Rows in the game](REFERENCE.md#rows-in-the-game).
103
- - With `micro-shop-energy`, use its `EnergyProductBuyButton` (surface key `BuyButton` on `EnergyProduct`) instead of
104
- writing a purchase button. One press charges the product's price and refills the stamina in one GS2 transaction, so
105
- a refused charge refills nothing. The refill stops at the stamina's cap (its `overflowedMaximum` when the stamina sets
106
- `useOverflow`), so a purchase at the cap still charges the full price.
107
- - Show the time left until a timestamp (a stamina's next recovery) with a `UiItem.countdown`, or the one a dependency
108
- lists in `types.<Type>.uiComponents` (`foundation-economy-energy`'s `NextRecoveryCountdown`), never with a hand-written
109
- timer: it counts on the session's GS2 clock, which `DateTime.UtcNow` is not. See
101
+ - Use a button a dependency ships (`kind: "buttonAction"` in `types.<Type>.uiComponents`, with the `method` it calls)
102
+ instead of writing one that calls the same action.
103
+ - Show the time left until a timestamp (a row's next scheduled change) with a `UiItem.countdown`, or the one a dependency
104
+ lists in `types.<Type>.uiComponents` (`kind: "countdown"`), never with a hand-written timer: it counts on the
105
+ session's GS2 clock, which `DateTime.UtcNow` is not. See [UI components](REFERENCE.md#ui-components).
106
+ - Place an `activeToggle` on a GameObject that stays active below the type's Handler, with what it shows or hides as
107
+ its targets, never on a GameObject it hides: once hidden it stops listening and never shows it again. See
110
108
  [UI components](REFERENCE.md#ui-components).
111
- - Place an `activeToggle` such as `ProgressIdleActiveToggle` on a GameObject that stays active below the type's
112
- Handler, with what it shows or hides as its targets, never on a GameObject it hides: once hidden it stops listening
113
- and never shows it again. See [UI components](REFERENCE.md#ui-components).
114
109
  - Before adding UI to a dependency's type, read `types.<Type>.uiComponents` of its surface. Its keys are the class
115
110
  names items are declared with; the generated Unity class is the type's generated name followed by the key (surface
116
- key `StartButton` on `Quest` → generated class `QuestStartButton`; a rename of the type changes the prefix, see
117
- [Item options](REFERENCE.md#item-options)). Reuse a listed item instead of adding one that shows the same, and give
118
- new items unlisted class names: a listed one replaces that item.
111
+ key `OpenButton` on `example-gift-shop`'s `GiftBox` → generated class `GiftBoxOpenButton`; a rename of the type
112
+ changes the prefix, see [Item options](REFERENCE.md#item-options)). Each entry also gives what the item shows: a
113
+ `templateLabel`'s `template` (per locale when it has several), the `fallbackText` shown while its value is unset, and
114
+ the author's `description`. Reuse a listed item instead of adding one that shows the same, and give new items
115
+ unlisted class names: a listed one replaces that item.
119
116
  - Give a single-entry type's row the type name in lower case as its id (`GameSettings` → `gamesettings`). The same id
120
117
  is the row its Handler holds and the row id to pass to `UiSource.rowProp`. For a dependency's type, read it from
121
- `types.<Type>.singleEntryRowId` of the surface, also when the surface lists no row (`micro-economy-quest`'s
122
- `Progress` → `"progress"`); an overlay that renames the type keeps it. See
118
+ `types.<Type>.singleEntryRowId` of the surface, also when the surface lists no row (a player's own data that nobody
119
+ authors); an overlay that renames the type keeps it. See
123
120
  [Keys and identity](REFERENCE.md#keys-and-identity).
124
121
  - Refer to anything of another package only through `dependencyPackage(surface)` built from a surface file that
125
122
  `dsl surfaces` wrote (or, for a package you build yourself, the `dependency-surface.json` beside its ledger, which
@@ -161,10 +158,8 @@ MUST:
161
158
  you leave out deploys as what `actionPropertyTransforms` add to it, or empty.
162
159
  - A property or parameter of type `ref<<packageId>:<Type>>` takes a row of that package's type. Declare that package
163
160
  as a dependency if it is not one yet (its own surface file and spec), author the row with
164
- `instance(other.type("<Type>"), id, values)`, and give the row id as the value. Example, a limited-time quest:
165
- `micro-economy-quest` keeps the period on `QuestCollection.schedule` (`ref<foundation-economy-schedule:Schedule>`),
166
- not on `Quest`, so put the quest in a quest collection of its own with an absolute `Schedule` row, and have the game
167
- list that collection too. See [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type).
161
+ `instance(other.type("<Type>"), id, values)`, and give the row id as the value. See
162
+ [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type).
168
163
  - Choose each property's binding hint by what reads its value, also for a property an overlay adds: the client, from
169
164
  the rows you author (a UI component shows it) → `.assetDelivery()`; only an `actionPropertyTransforms` argument → no
170
165
  hint; a field a master data resource of this package binds → `.masterData()`. See the table in
@@ -225,13 +220,16 @@ Names and ids:
225
220
  only if asked, and then keep its id as above; only a kept id carries the generated script's GUID over, so scenes and
226
221
  prefabs stay wired. See [The id ledger](REFERENCE.md#the-id-ledger).
227
222
  - A row id is letters, digits, `_`, `.` and `-`, at most 128 characters; a resource that binds `id` to a GS2 name sends
228
- it as that name (a `micro-economy-quest` `Quest` row id is the quest model name), and some GS2 fields take fewer.
223
+ it as that name (a GS2 model name), and some GS2 fields take fewer.
229
224
  - A row token contains the row id. Before you treat a "not current" + "missing" row token pair as a rename of a
230
225
  composite-key row, check the new row id against the composite key rule below; a wrong id must be fixed in the DSL,
231
226
  not moved in the ledger.
232
- - A composite-key row id is its key values joined with `.` in ascending order of the key members' property ids in the
233
- ledger, not in the order passed to `compositeKey`. Build the type with `--write-ledger` before adding its rows,
234
- read the ids, then add the rows. See [Keys and identity](REFERENCE.md#keys-and-identity).
227
+ - A composite-key row id is its key values joined with `.` in ascending order of the key members' property ids, not in
228
+ the order passed to `compositeKey`. For your own type the ids are in your ledger: build the type with
229
+ `--write-ledger` before adding its rows, read the ids, then add the rows. For a dependency's type, read the members
230
+ in that order from its surface's `types.<Type>.compositeKey`. A `ref` member's value is the id of the row it refers to; when that row is
231
+ itself composite-keyed, that is its composed id, `.` included. A wrong row id fails `dsl build`, which names each
232
+ row's id and the id to use (`"<id>" → "<id to use>"`). See [Keys and identity](REFERENCE.md#keys-and-identity).
235
233
 
236
234
  ## 5. API cheat sheet
237
235
 
@@ -248,7 +246,7 @@ Names and ids:
248
246
  | Conditional requirement | `.requiredWhen(Cond.eq("limited", true))` | [Conditions](REFERENCE.md#conditions) |
249
247
  | Identity and order | `singleEntry: true`, `compositeKey: [...]`, `sort: { key, direction? }` | [Keys and identity](REFERENCE.md#keys-and-identity) |
250
248
  | Author rows | `instance(definition, id, values)` in `instances: [...]` | [Instances](REFERENCE.md#instances) |
251
- | Rows a dependency's type needs from the project | `instance(dep.type("Energy"), id, values)` in `instances: [...]` | [Instances](REFERENCE.md#instances) |
249
+ | Rows a dependency's type needs from the project | `instance(dep.type("<Type>"), id, values)` in `instances: [...]` | [Instances](REFERENCE.md#instances) |
252
250
  | Change a row a dependency ships | `overlayInstance(type, sourceInstanceId, { overrides?, suppressed? })` in `overlayInstances: [...]` | [Instances](REFERENCE.md#instances) |
253
251
  | Extend a dependency's type | `defineOverlayDomainType(name, dep.overlay(name), { properties?, actionPropertyTransforms?, ... })` | [Overlay types](REFERENCE.md#overlay-types) |
254
252
  | List of structured elements | `defineInlineElement(name, { properties, elementKey?, ... })`, `PT.listOf(PT.inlineElement(schema))`, `inlineElementOf(Host, "listProp")` | [Inline elements](REFERENCE.md#inline-elements) |
@@ -256,16 +254,17 @@ Names and ids:
256
254
  | Map GS2 user data to properties | `defineUserDataResource({ model: GS2.svc.Model, linkedMaster?, mount?, bindings: {...}, children? })` | [User data resources](REFERENCE.md#user-data-resources) |
257
255
  | Field values | `Bind.*`, `Source.direct(T, "prop")`, `Source.parent(...)`, `transactionSettingV2()` | [Bindings](REFERENCE.md#bindings) |
258
256
  | 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) |
259
- | 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) |
260
- | 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) |
257
+ | Add a dependency's transform to an inherited action property | `actionPropertyTransforms: prop => [{ targetProperty, mode: "append", ...dep.transformCall(name, { count: prop("price") }) }]`. One transform per property per overlay, whatever the mode: to add several actions, attach one transform of this package whose delegation outputs call them | [Overlay types](REFERENCE.md#overlay-types) |
258
+ | A row of another package's type (a `ref<pkg:Type>` value) | Declare that package too, `instance(other.type("<Type>"), id, values)`, pass the row id | [A row of another package's type](REFERENCE.md#a-row-of-another-packages-type) |
261
259
  | Produce GS2 actions from parameters | `defineActionTransform(name, { category, parameters, outputs })` + `OutputMap.*` | [Action transforms](REFERENCE.md#action-transforms) |
262
260
  | 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) |
263
261
  | Generated UI | `defineUiComponent(T, { items: [UiItem.label(...), UiItem.buttonAction(...)] })`, `UiSource.*`, `UiCond.*` | [UI components](REFERENCE.md#ui-components) |
264
- | 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) |
262
+ | Enable a button by another type's row (the coins a player owns) | `UiItem.interactable("AffordableInteractable", UiCond.gte(UiSource.rowProp(inventory.type("Item"), "coin", "count"), UiSource.prop("price")))` | [Another type's row](REFERENCE.md#another-types-row) |
265
263
  | Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `countdown` the time left until a timestamp, `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) |
266
264
  | 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) |
267
265
  | 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) |
268
266
  | Code template | `codeTemplates: [{ outputFileName: "File.cs", templateSource: text }]` with a `?raw` import | [Code templates](REFERENCE.md#code-templates) |
267
+ | Tell the authors of dependent packages how to use yours | `usageNotes: text` with a `?raw` import of a `USAGE.md` | [Usage notes](REFERENCE.md#usage-notes) |
269
268
  | 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) |
270
269
 
271
270
  ## 6. Common mistakes
@@ -307,12 +306,12 @@ Names and ids:
307
306
  | `CLI_DSL_VALIDATION_FAILED` ... `No user data resource binds this property.` | A `.userData()` property no resource binds. | Bind it in a user data resource (`Bind.domainProperty` / `Bind.domainProperties` with `Source.direct(T, "prop")`), or remove the hint. |
308
307
  | `CLI_DSL_VALIDATION_FAILED` ... `No Handler is generated for the target domain model` | A UI component on a type that gets no Handler (`generatedHandlers: []` in its surface). | Mount the type with a user data resource or a master data resource of a model other than a namespace, or remove the component. |
309
308
  | `CLI_DSL_VALIDATION_FAILED` ... `the condition cannot read a value of another domain model's row` | A `UiSource.rowProp` of a type that gets no Handler. | Read a type whose `generatedHandlers` is not `[]`, or remove the item. |
310
- | `CLI_DSL_VALIDATION_FAILED` ... `instance ids that no longer match their composite-key values` | Row ids not composed from key values in property-id order. | Recompose ids per [Keys and identity](REFERENCE.md#keys-and-identity). |
309
+ | `CLI_DSL_VALIDATION_FAILED` ... `instance ids that no longer match their composite-key values` | Row ids not composed from key values in property-id order. | Give each named row's `instance(...)` the id after `→`. If the line says rows would share an id, first change those rows' key values so each composes an id of its own. |
311
310
  | `CLI_DSL_DEPENDENCY_NOT_INSTALLED` | `dependencies` names a package the project lacks. | A package authored in the project: build it with `dsl build` first. Another package: add it in GS2 Studio. |
312
311
  | `CLI_DSL_PACKAGE_INVALID` ... `Invalid GitHub dependency spec: github:<owner>/<repo>/<dir>` | A subdirectory in a GitHub spec. | Use `github:<owner>/<repo>`; the project's lock records the directory. |
313
312
  | `CLI_DSL_DEPENDENCY_SPEC_MISMATCH` | `dependencies` gives an installed package a spec that names another source than the one the project installed it from, such as `"*"`. | Declare it with the spec the message prints, then build again. |
314
- | `CLI_DSL_VALIDATION_FAILED` ... `the parent <resource> resource has no row` ... `Add a row of "T"` | Rows of a dependency's type sit under a GS2 resource made from rows of `T`, which nobody authored. | Add a row of `T` with `instance(dep.type("T"), id, values)` and point your rows at it (for example the `collection` of a quest row). |
315
- | `... is a dependency the DSL cannot change, so these are fixed through the dependency that brings it in: ...` | A defect of the dependency itself, not of this DSL. | If the message says to remove the dependency `"X"` from the DSL and the package does not need X, remove it and what refers to it. Otherwise tell the user: the project's owner updates or removes the dependency in GS2 Studio, as the message says. |
313
+ | `CLI_DSL_VALIDATION_FAILED` ... `the parent <resource> resource has no row` ... `Add a row of "T"` | Rows of a dependency's type sit under a GS2 resource made from rows of `T`, which nobody authored. | Add a row of `T` with `instance(dep.type("T"), id, values)` and point your rows at it (the property of your rows that refers to it). |
314
+ | `... is a dependency whose own definitions the DSL cannot change, so the findings in them are fixed through the dependency that brings it in: ...` | A defect in the dependency's own definitions, not of this DSL; said once for the package. A finding about rows (rows to add, a row's values) is fixed in this DSL and is not covered by it. | If the message says to remove the dependency `"X"` from the DSL and the package does not need X, remove it and what refers to it. Otherwise tell the user: the project's owner updates or removes the dependency in GS2 Studio, as the message says. |
316
315
  | A successful build prints `[warning] ... No master data is registered for domain model "T"` | A dependency's GS2 resource needs rows of `T` from the project; it is not deployed without them. | Add the row the message names, `instance(dep.type("T"), id, values)`, with the values it names, and build again. `dep.type("<Type>")` means the message names no type `dep.type()` takes: for an inline schema, add elements to the host type's list property with `dep.inlineElements(...)`; for an unresolved type, find it in the surfaces. |
317
316
  | A successful build prints `[error] ... the required arguments (...) of action transform ... have no value for row "r"` | An `actionPropertyTransforms` argument reads a property row `r` has no value for. | Give the row the value; for a row a dependency ships, use `overlayInstance(type, "r", { overrides })`. |
318
317
  | `CLI_DSL_VALIDATION_FAILED` ... `is not a UTC ISO 8601 timestamp` | A `PT.timestamp()` value in another form, such as with an offset (`+09:00`). The message says `In package "<your package>"` when the row is yours, even of a dependency's type. | Write it in UTC with `Z`, such as `"2026-11-30T15:00:00Z"`, in that `instance(...)` (see [Property types](REFERENCE.md#property-types)). |
@@ -492,6 +491,9 @@ The game signs in to GS2 with a client ID and a client secret. Take them from th
492
491
  client has ApplicationAccess permission and is made to be embedded in the game, so the two values are low-sensitivity.
493
492
  - Never create a GS2-Identifier user or client for the game, and never put the developer's GS2 sign-in (email,
494
493
  password, credentials file) or any other management credential into the game.
494
+ - The one exception is a user a package's usage notes (`surfaces/<packageId>.md`) tell you to create, such as the
495
+ user a version check signs a passing player in as. Create it as those notes say, with no security policy and no
496
+ client.
495
497
  - In Unity, they go into a `Gs2Environment` asset (Create > Game Server Services > Core > Environment) with `region`,
496
498
  `clientId`, `clientSecret` and `name`. `Gs2ClientHolder` lists the asset under Environments, and its Active
497
499
  Environment Name must equal the asset's `name` field, not its file name.
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.21
12
+ npm install --save-dev gs2-studio-dsl@2026.11.22
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.21 builds with GS2 Studio 2026.11.21 and later. Install the version that
16
+ against gs2-studio-dsl 2026.11.22 builds with GS2 Studio 2026.11.22 and later. Install the version that
17
17
  matches the oldest GS2 Studio you build with.
18
18
 
19
19
  ```ts
package/REFERENCE.md CHANGED
@@ -28,11 +28,12 @@ If you are an LLM coding agent, read [LLM.md](LLM.md) first.
28
28
  16. [Delegated actions](#delegated-actions)
29
29
  17. [UI components](#ui-components)
30
30
  18. [Code templates](#code-templates)
31
- 19. [Dependencies](#dependencies)
32
- 20. [The id ledger](#the-id-ledger)
33
- 21. [Building with dsl build](#building-with-dsl-build)
34
- 22. [Validation error kinds](#validation-error-kinds)
35
- 23. [Exported types](#exported-types)
31
+ 19. [Usage notes](#usage-notes)
32
+ 20. [Dependencies](#dependencies)
33
+ 21. [The id ledger](#the-id-ledger)
34
+ 22. [Building with dsl build](#building-with-dsl-build)
35
+ 23. [Validation error kinds](#validation-error-kinds)
36
+ 24. [Exported types](#exported-types)
36
37
 
37
38
  ## Concepts
38
39
 
@@ -64,7 +65,7 @@ Naming rules the build enforces:
64
65
  | Package id | Segments of letters, digits, `_` and `-` joined by `/`, optionally starting with `@`. |
65
66
  | Domain type name, inline element name | PascalCase: `^[A-Z][a-zA-Z0-9]*$`, at most 100 characters. |
66
67
  | Property name | camelCase: `^[a-z][a-zA-Z0-9]*$`, at most 100 characters. `id` is reserved. |
67
- | Instance id | Letters, digits, `_`, `.` and `-`, at most 128 characters (`instanceIdTooLong`), also a composite-key id no resource sends. A resource that binds `id` to a GS2 name sends the row id as that name: a `micro-economy-quest` `Quest` row id is the GS2 quest model name. The GS2 field it is bound to may take fewer characters (a Lottery prize id takes at most 36); deploy reports that. |
68
+ | Instance id | Letters, digits, `_`, `.` and `-`, at most 128 characters (`instanceIdTooLong`), also a composite-key id no resource sends. A resource that binds `id` to a GS2 name sends the row id as that name, such as a GS2 model name. The GS2 field it is bound to may take fewer characters (a Lottery prize id takes at most 36); deploy reports that. |
68
69
  | UI component class name | PascalCase. |
69
70
 
70
71
  ## Modules and imports
@@ -111,6 +112,7 @@ import { GS2 } from "gs2-studio-dsl/gs2";
111
112
 
112
113
  import inventorySurface from "./surfaces/example-inventory.json" with { type: "json" };
113
114
  import giftShopTemplate from "./templates/GiftShop.cs.njk?raw";
115
+ import usageNotes from "./USAGE.md?raw";
114
116
  ```
115
117
 
116
118
  ## Packages
@@ -188,6 +190,7 @@ export const exampleInventory = definePackage({
188
190
  | `actionTransforms?` | Action transform definitions made with `defineActionTransform` (see [Action transforms](#action-transforms)). |
189
191
  | `uiComponents?` | UI component definitions made with `defineUiComponent` (see [UI components](#ui-components)). |
190
192
  | `codeTemplates?` | `{ outputFileName, templateSource }[]` (see [Code templates](#code-templates)). |
193
+ | `usageNotes?` | Markdown that tells the authors of dependent packages how to use this one (see [Usage notes](#usage-notes)). |
191
194
 
192
195
  `LocalizedDisplay` is `{ [locale: string]: { label?: string; description?: string; unit?: string } }`, for example
193
196
  `{ en: { label: "Item", description: "An item a player can own." } }`.
@@ -273,7 +276,7 @@ the names `Source.idRef`, a `delegatedActions` parameter override, `UiCond.rowEl
273
276
  name. In `sort`, `compositeKey`, `elementKey`, `localizedProperties`, `targetProperty`, a transform argument, a
274
277
  row value key, `UiSource.prop`, a `delegatedActions` parameter override, `Source.direct` / `Source.idRef` and
275
278
  `existenceProperty` it reports each place once, in the terms you wrote it (for example
276
- `actionPropertyTransforms[0] (ConsumeEnergy → consumeActions) argument "value"` or `Source.direct in "name"`), as
279
+ `actionPropertyTransforms[0] (ConsumeItem → cost) argument "count"` or `Source.direct in "name"`), as
277
280
  `<where>: "<name>" is not a property of "<Type>" (properties: ...)`.
278
281
 
279
282
  To rename a property, rename it in `properties`, run `tsc --noEmit`, which lists every place that still uses the old
@@ -293,7 +296,7 @@ transform parameters.
293
296
  | `PT.float32()`, `PT.float64()` | floating point | `number` |
294
297
  | `PT.bool()` | boolean | `boolean` |
295
298
  | `PT.timestamp()` | timestamp, sent to GS2 as Unix time in milliseconds | a UTC ISO 8601 `string` (see below), such as `"2026-11-30T15:00:00Z"` |
296
- | `PT.localizedString()` | text per locale, delivered as an asset (only with `.assetDelivery()`) | `{ [locale]: string }`, such as `{ ja: "森の巡回", en: "Forest Patrol" }` |
299
+ | `PT.localizedString()` | text per locale, delivered as an asset (only with `.assetDelivery()`) | `{ [locale]: string }`, such as `{ ja: "剣", en: "Sword" }` |
297
300
  | `PT.enum(...values)` | one of `values` | `string` |
298
301
  | `PT.ref(target)` | a reference to a row of another type (`LocalDomainTypeDef`, `OverlayDomainTypeDef`, `DependencyDomainTypeRef`, or `() => target` for forward/self references) | the row id (`string`) |
299
302
  | `PT.inline(target)` | a value of another domain type, embedded | an object |
@@ -389,7 +392,7 @@ Binding hints the build accepts for each shape:
389
392
  ### Localized text
390
393
 
391
394
  A `PT.localizedString` property holds one text per locale on each row, for text the game shows in the player's
392
- language, such as a quest's display name. Declare one property, not one per language:
395
+ language, such as an item's display name. Declare one property, not one per language:
393
396
 
394
397
  ```ts
395
398
  displayName: PT.localizedString().assetDelivery(),
@@ -512,8 +515,8 @@ id is the name the type's first declaration gives it, in lower case, and an over
512
515
  change it. The same id names the row in the game: the generated `<Type>Handler` of a single-entry type has no row id in
513
516
  its Inspector and always holds that row, and it is the `rowId` that `UiSource.rowProp` takes for the type
514
517
  ([Another type's row](#another-types-row)). A dependency's surface gives the id as
515
- `types.<Type>.singleEntryRowId`, beside `singleEntry: true`, whether or not a package ships the row: for
516
- `micro-economy-quest`'s `Progress`, the player's quest progress (user data), it is `"progress"`. A surface written by
518
+ `types.<Type>.singleEntryRowId`, beside `singleEntry: true`, whether or not a package ships the row: for a dependency's
519
+ `GameSettings`, it is `"gamesettings"`. A surface written by
517
520
  an older GS2 Studio lacks it: write the surface again with `dsl surfaces`, or lower-case the type's key in the surface
518
521
  of its `canonicalPackageId`.
519
522
 
@@ -534,12 +537,18 @@ const GameSettings = defineDomainType("GameSettings", {
534
537
  **Composite key.** `compositeKey: [first, ...rest]` makes each row id the members' values joined with `.`. Members must
535
538
  be declared properties of type `string`, `int32`, `int64`, `bool`, `enum` or `ref`, with hint `masterData` or
536
539
  `assetDelivery`; `id`, duplicates and unknown names fail with `invalidCompositeKey`. The parts are joined in the order of
537
- the members' **property ids** (as the ledger records them), not in the order you pass them, and a member value may not
540
+ the members' **property ids**, not in the order you pass them. A `ref` member's value is the id of the row it refers
541
+ to; when that row is itself composite-keyed, the part is its composed id, `.` included. Any other member value may not
538
542
  contain `.`. A row id that differs from the composed id fails `dsl build` ("instance ids that no longer match their
539
- composite-key values"), and a failed build writes no ledger. The member ids are random until the ledger records them, so
540
- author a composite-key type in two steps: build it with `--write-ledger` before it has rows, read the members'
541
- `property:<Type>.<name>` ids in `id-ledger.json`, then add the rows with their values in ascending id order and build
542
- again.
543
+ composite-key values"), which names each such row's id and the id to give its `instance(...)`
544
+ (`"<id>" → "<id to use>"`). When that id would be another row's too, it asks you first to change the key values of
545
+ those rows so that each composes an id of its own. A failed build writes no ledger.
546
+
547
+ The member ids of your own type are random until the ledger records them, so author a composite-key type in two steps:
548
+ build it with `--write-ledger` before it has rows, read the members' `property:<Type>.<name>` ids in `id-ledger.json`,
549
+ then add the rows with their values in ascending id order and build again. A dependency's type takes its member ids
550
+ from the dependency, not from your ledger: read the members from its surface's `types.<Type>.compositeKey`, which
551
+ names them in the order their values join (their ids are under `types.<Type>.properties`).
543
552
 
544
553
  ```ts
545
554
  const HeroLevel = defineDomainType("HeroLevel", {
@@ -646,7 +655,7 @@ Inherited properties are addressed by the names the dependency publishes, for ex
646
655
  | `localizedProperties?` | Display metadata for added properties and `id`. An inherited property keeps its source's; a key naming one fails. |
647
656
  | `sort?` | `{ key: propertyName \| null, direction?: "asc" \| "desc" }`. Without it, the overlay keeps the dependency's order, as does the overlay that `defineUiComponent`, `delegatedActions`, `UiCond.rowElement` and `UiSource.rowProp` create for a dependency type (`types.<Type>.sort` of the surface). It replaces that order; `{ key: null }` with `"asc"` is the same as no `sort`. |
648
657
  | `compositeKey?` | `{ kind: "inherit" }`, `{ kind: "suppress" }`, or `{ kind: "override", members: [...names] }`. |
649
- | `actionPropertyTransforms?` | Transform calls attached to an action property of the type: `{ targetProperty, mode?: "replace" \| "append", transform, arguments }` for a transform of this package (its `ActionTransformDef` or `() => transform`), or `{ targetProperty, mode?, transformPackageId, transformId, arguments }` for a dependency's. `mode` defaults to `"replace"`; `"append"` lets several packages add to the same action. `arguments` is `{ parameterName, source }[]`, where `source` is `{ kind: "static", value }`, `{ kind: "domainProperty", propertyName }`, `{ kind: "actionLiteral", value }`, `{ kind: "placeholder", value }` or a nested `{ kind: "actionTransformRef", invocation }`. For a dependency's transform, write `{ targetProperty, mode, ...dep.transformCall(name, { <parameter>: source }) }`. The field also takes a function of `prop` that returns the entries (`prop => [...]`); `prop("x")` is `{ kind: "domainProperty", propertyName: "x" }`, and `tsc` reports a wrong `"x"` on that literal ([Property names are type-checked](#property-names-are-type-checked)). `dsl build` refuses a top-level argument the transform does not declare, one named twice, and a missing required one. |
658
+ | `actionPropertyTransforms?` | Transform calls attached to an action property of the type: `{ targetProperty, mode?: "replace" \| "append", transform, arguments }` for a transform of this package (its `ActionTransformDef` or `() => transform`), or `{ targetProperty, mode?, transformPackageId, transformId, arguments }` for a dependency's. `mode` defaults to `"replace"`; `"append"` lets each package that overlays the type add its own transform to the same action. One overlay attaches one transform per property in either mode (a second fails with `duplicateActionPropertyTransformTarget`): to add several actions, define one transform in this package whose delegation outputs call each of them ([Action transforms](#action-transforms)) and attach that one. `arguments` is `{ parameterName, source }[]`, where `source` is `{ kind: "static", value }`, `{ kind: "domainProperty", propertyName }`, `{ kind: "actionLiteral", value }`, `{ kind: "placeholder", value }` or a nested `{ kind: "actionTransformRef", invocation }`. For a dependency's transform, write `{ targetProperty, mode, ...dep.transformCall(name, { <parameter>: source }) }`. The field also takes a function of `prop` that returns the entries (`prop => [...]`); `prop("x")` is `{ kind: "domainProperty", propertyName: "x" }`, and `tsc` reports a wrong `"x"` on that literal ([Property names are type-checked](#property-names-are-type-checked)). `dsl build` refuses a top-level argument the transform does not declare, one named twice, and a missing required one. |
650
659
  | `delegatedActions?` | `{ [methodName]: DelegatedActionDef }`, as [delegated actions](#delegated-actions). |
651
660
  | `renamedInheritedProperties?` | `Record<string, string>`; not covered by this reference. |
652
661
 
@@ -1234,10 +1243,10 @@ defineUiComponent(Item, {
1234
1243
 
1235
1244
  ### Another type's row
1236
1245
 
1237
- `UiSource.rowProp(type, rowId, propertyName)` lets a condition read one row of another type, such as the player's stamina in
1238
- `Energy` row `"stamina"` while the component targets a quest. `rowId` is the row's id; for a single-entry type, the
1239
- type name in lower case, even when nobody authors the row ([Keys and identity](#keys-and-identity); `"progress"` for
1240
- `micro-economy-quest`'s `Progress`). For a single-entry type, `dsl build` refuses another id
1246
+ `UiSource.rowProp(type, rowId, propertyName)` lets a condition read one row of another type, such as the coins a player owns
1247
+ (`Item` row `"coin"`) while the component targets a gift box. `rowId` is the row's id; for a single-entry type, the
1248
+ type name in lower case, even when nobody authors the row ([Keys and identity](#keys-and-identity); `"gamesettings"`
1249
+ for `GameSettings`). For a single-entry type, `dsl build` refuses another id
1241
1250
  (`uiComponentForeignRowSingleEntryIdMismatch`, whose `expectedId` names the id), as the type's handler can hold no
1242
1251
  other row; it does so whenever it knows the id, which it does except for a dependency's type that a surface from an
1243
1252
  older GS2 Studio re-exports. For another type it checks only that `rowId` is a valid row id, not that such a row exists.
@@ -1275,16 +1284,16 @@ under its class name, shows `name` as its display name when it differs from the
1275
1284
  its problem messages, and shows `description` under it. Neither reaches the generated code or the game. Without `name`, the
1276
1285
  item's name is the target type's name. Leave both out unless the editor's reader needs them.
1277
1286
 
1278
- The class name is what the generated code uses: the item becomes the C# class `<Type><className>` (`QuestStartButton`
1279
- for `buttonAction("StartButton", ...)` on `Quest`) in the namespace of the type's handler followed by `.UI`, listed in
1287
+ The class name is what the generated code uses: the item becomes the C# class `<Type><className>` (`GiftBoxOpenButton`
1288
+ for `buttonAction("OpenButton", ...)` on `GiftBox`) in the namespace of the type's handler followed by `.UI`, listed in
1280
1289
  Unity's Add Component menu under `GS2 Studio/DomainType/<Type>/<Kind>/<className>`. A surface lists a type's items by
1281
- `className` alone (`types.Quest.uiComponents.StartButton`), so prefix `<Type>` to find the class in Unity.
1290
+ `className` alone (`types.GiftBox.uiComponents.OpenButton`), so prefix `<Type>` to find the class in Unity.
1282
1291
 
1283
1292
  `<Type>` is the type's generated name, the one its `<Type>Handler` has (see `types.<Type>.generatedHandlers` of a
1284
1293
  surface): the type's name or, when an overlay in any package of the project renames the type, the overlay's name
1285
1294
  (that of the overlay furthest from the type's declaration, when overlays that build on each other rename it). That
1286
1295
  rename changes the classes of every item on the type, a dependency's included, also when the surface you read was
1287
- written before it: if your package renames `Quest` to `Mission`, `QuestStartButton` becomes `MissionStartButton`.
1296
+ written before it: if your package renames `GiftBox` to `Present`, `GiftBoxOpenButton` becomes `PresentOpenButton`.
1288
1297
  An item on the elements of an inline element list (`inlineElementOf(Host, "listProp")`) puts the list property's name
1289
1298
  in PascalCase between them: `<Host><ListProp><className>`; a nested list puts the name of each list on the path.
1290
1299
 
@@ -1324,48 +1333,25 @@ component and no `UiSource.rowProp`, unless your package mounts its overlay of t
1324
1333
 
1325
1334
  | Generated class | Holds |
1326
1335
  | --- | --- |
1327
- | `<Type>Handler` | One row: the row whose id is set in its Inspector, with the scope ids the GS2 model needs (such as the quest group of a quest). It loads from these values alone, unless a GS2 key it reads cannot be derived from them, such as the trigger name of a schedule: such a handler waits until a script calls its `SetSdkKeys(...)` with that key, and the Unity project's `Assets/GS2Studio/AGENTS.md` lists these handlers and their keys. A single-entry type's handler has no row id to set: it holds the type's one row, whose id is the type name in lower case ([Keys and identity](#keys-and-identity)). |
1336
+ | `<Type>Handler` | One row: the row whose id is set in its Inspector, with the scope ids the GS2 model needs (such as the group a row belongs to). It loads from these values alone, unless a GS2 key it reads cannot be derived from them, such as the trigger name of a schedule: such a handler waits until a script calls its `SetSdkKeys(...)` with that key, and the Unity project's `Assets/GS2Studio/AGENTS.md` lists these handlers and their keys. A single-entry type's handler has no row id to set: it holds the type's one row, whose id is the type name in lower case ([Keys and identity](#keys-and-identity)). |
1328
1337
  | `<Type>ListHandler` | Every row GS2 returns for the scope set in its Inspector. For each row it instantiates `_itemPrefab`, a prefab with a `<Type>ListItemHandler` at its root and the item components below it, under `_contentParent`, and it adds and removes instances as rows come and go. When the type has both a master data and a user data model that can be listed, `_axis` picks one; it must be set, or the list loads nothing. Written only for a type that is not single entry and whose rows a GS2 master data or user data model lists. |
1329
- | `<Type>ListBy<Property>Handler` | The same, for the rows whose `ref` property `<Property>` names the row of the nearest handler of the referenced type above it (for example the products that refill one stamina, `EnergyProductListByEnergyHandler`). When the type has a scope, the scope is still set in its Inspector, and the handler above only narrows the rows of that scope. |
1338
+ | `<Type>ListBy<Property>Handler` | The same, for the rows whose `ref` property `<Property>` names the row of the nearest handler of the referenced type above it (for example the gift boxes that hold one item, `GiftBoxListByItemHandler` below an `ItemHandler`). When the type has a scope, the scope is still set in its Inspector, and the handler above only narrows the rows of that scope. |
1330
1339
 
1331
- A list follows the handler above it only for a type without a scope. To list the rows of a scope, such as the quests of
1332
- one quest group, set the scope on a `<Type>ListHandler` in its Inspector; to switch scopes while the game runs, such as
1333
- a tab per quest group, call its `SetScope(...)` with the new scope.
1340
+ A list follows the handler above it only for a type without a scope. To list the rows of a scope, such as the rows of one
1341
+ group, set the scope on a `<Type>ListHandler` in its Inspector; to switch scopes while the game runs, such as a tab per
1342
+ group, call its `SetScope(...)` with the new scope.
1334
1343
 
1335
1344
  A list shows the rows GS2 holds at run time (the deployed master data, or the player's user data), each with the values
1336
1345
  of its asset-delivered properties.
1337
1346
 
1338
- To show the time left until a timestamp of a row, such as a stamina's next recovery, use a `UiItem.countdown` (or the one
1347
+ To show the time left until a timestamp of a row, such as the end of a period, use a `UiItem.countdown` (or the one
1339
1348
  the dependency lists in `types.<Type>.uiComponents`) instead of a hand-written timer: it counts on the session's GS2 clock,
1340
1349
  which `DateTime.UtcNow` is not.
1341
1350
 
1342
1351
  A dependency's own UI components are generated with it, so a dependency used as it is needs nothing in the DSL beyond
1343
- the dependency and what its surface asks for. `foundation-economy-currency` is an example: the transforms that deposit
1344
- into a wallet (`DepositFreeCurrency`, `DepositCurrency`) are all the DSL needs, and no `Wallet` row is needed. The game
1345
- shows a balance with the package's `Wallet` items (`FreeBalanceLabel`, `PaidBalanceLabel`, `TotalBalanceLabel`, listed
1346
- under `types.Wallet.uiComponents`; classes `WalletFreeBalanceLabel` and so on) below a `WalletHandler` whose Inspector
1347
- field `_slot` is the wallet slot (`0` for slot 0, the `slot` the transforms take); its row id is that slot as a decimal
1348
- string (`"0"`).
1349
-
1350
- `micro-economy-quest` is another: its `Quest` item `StartButton` (class `QuestStartButton`, which calls `Start`) works
1351
- below a quest list's item handler or a `QuestHandler` (whose Inspector fields `_id` and `_collection` are all it
1352
- needs), and its `Progress` items `CompleteButton`, `IdleActiveToggle` and `RunningActiveToggle` (classes
1353
- `ProgressCompleteButton`, `ProgressIdleActiveToggle`, `ProgressRunningActiveToggle`) work below a `ProgressHandler`.
1354
- `Progress` is single entry, as a player has at most one quest in progress, so the `ProgressHandler` has no row id to
1355
- set and holds the row `"progress"`. GS2 refuses every `Start` while a quest is in progress
1356
- (the Console shows `quest.progress.progress.error.alreadyExists`), so gate the quest list's Start buttons with
1357
- `ProgressIdleActiveToggle`: list the GameObject that holds them (the list's content parent, or a panel around the list)
1358
- in its `_activeWhenTrue` and put the toggle on a GameObject that stays active, such as that panel's parent, never on the
1359
- panel itself (see [UI components](#ui-components)). Or put one in the list's item prefab with that row's
1360
- `QuestStartButton` in `_activeWhenTrue`, where it reads the `ProgressHandler` above the list. To disable Start instead
1361
- of hiding it, add an `interactable` on `Quest` whose condition includes
1362
- `UiCond.not(UiCond.truthy(UiSource.rowProp(quest.type("Progress"), "progress", "inProgress")))` (see
1363
- [Another type's row](#another-types-row)). A player with no quest in progress, including one who never started any,
1364
- has no GS2 progress, yet the `ProgressHandler` still holds the row, with `inProgress` `false` (the resource's
1365
- `existenceProperty`): the condition is unknown only until the handler has loaded, and Start is enabled after that. Put
1366
- what shows the quest in progress, with its `ProgressCompleteButton`, in the `_activeWhenTrue` of
1367
- `ProgressRunningActiveToggle`, and put that toggle on a GameObject that stays active too, such as the parent of what it
1368
- shows.
1352
+ the dependency and what its surface asks for: the game places the dependency's Handler and its items. Which Handler,
1353
+ which Inspector fields to set and which items to use are the package's own: read its usage notes,
1354
+ `surfaces/<packageId>.md`, when it has them ([Usage notes](#usage-notes)).
1369
1355
 
1370
1356
  Every list of a type is in the order of the type's sort setting (`sort` on a local type in
1371
1357
  [Keys and identity](#keys-and-identity), or on an overlay in [Overlay types](#overlay-types)). Rows whose keys are
@@ -1444,6 +1430,47 @@ namespace {{ namespacePrefix }}.GiftShop
1444
1430
  }
1445
1431
  ```
1446
1432
 
1433
+ ## Usage notes
1434
+
1435
+ `usageNotes` on `definePackage(...)` is Markdown that tells the authors of packages that depend on yours how to use it:
1436
+ which rows of its types to author, which of its transforms to call, which of its Handlers and items the game places
1437
+ and what to set on them, and what to check. Write it in a `USAGE.md` beside the entry and load it with a `?raw`
1438
+ import:
1439
+
1440
+ ```ts
1441
+ import usageNotes from "./USAGE.md?raw";
1442
+ ```
1443
+
1444
+ ```ts
1445
+ usageNotes,
1446
+ ```
1447
+
1448
+ `example-gift-shop`'s `USAGE.md`:
1449
+
1450
+ ```text
1451
+ # example-gift-shop
1452
+
1453
+ Gift boxes that put items of `example-inventory` into the player's inventory.
1454
+
1455
+ ## In the DSL
1456
+
1457
+ - Author each `GiftBox` row with the `Item` it holds and how many (`count`). Opening consumes its `cost`; leave `cost`
1458
+ out for a free box.
1459
+
1460
+ ## In the game
1461
+
1462
+ - Place a `GiftBoxHandler` whose Inspector field `_id` is the gift box id, with `GiftBoxOpenButton` below it. Each press
1463
+ opens the box once and adds its items.
1464
+ ```
1465
+
1466
+ The package keeps it as `usage.md`, and it reaches a dependent's author as `surfaces/<packageId>.md`, which
1467
+ `dsl surfaces` writes beside the package's surface, and as `usageNotes` in the surface. Notes that hold nothing but
1468
+ whitespace fail with `blankUsageNotes`; leave `usageNotes` out instead. A package with usage notes needs GS2 Studio
1469
+ 2026.11.22 or later: its `package.json` says so in `engines.gs2studio`, and an older GS2 Studio refuses to load it.
1470
+
1471
+ Write what the surface does not say, short and concrete. The surface already gives names, property types, transform
1472
+ parameters and what each UI item shows.
1473
+
1447
1474
  ## Dependencies
1448
1475
 
1449
1476
  A package can use what another package of the same project publishes: a package installed into the project, or a
@@ -1452,9 +1479,9 @@ project, so it learns the dependency's names and ids from the dependency's surfa
1452
1479
 
1453
1480
  1. Put the dependency in the project: install it in GS2 Studio ("Add dependency" under a package's "Dependencies"), or
1454
1481
  build it into the project with `dsl build` first.
1455
- 2. Run `dsl surfaces --dir <project> --out <dir>`; it writes `<dir>/<packageId>.json` for every package of the project.
1456
- For a package you build yourself, the `dependency-surface.json` that `dsl build` writes beside its ledger has the
1457
- same content.
1482
+ 2. Run `dsl surfaces --dir <project> --out <dir>`; it writes `<dir>/<packageId>.json` for every package of the project,
1483
+ and `<dir>/<packageId>.md` for a package with usage notes: read them before you use the package. For a package you
1484
+ build yourself, the `dependency-surface.json` that `dsl build` writes beside its ledger has the same content.
1458
1485
  3. Import the JSON and pass it to `dependencyPackage(surface)`.
1459
1486
  4. Declare the dependency in `definePackage({ dependencies: { [dep.packageId]: spec } })`.
1460
1487
 
@@ -1538,12 +1565,14 @@ Besides names and ids, the surface describes what a dependent needs to use them:
1538
1565
  | `types.<Type>.delegatedActions.<Method>` | `targetResource`, `targetActionKey` and `parameters`: the parameters the generated method takes from its caller, which a button's `args` gives, by name with `type` (the GS2 catalog's spelling, such as `[]transaction::Config`) and `required`. The method fills every other parameter of the action itself: the namespace, the access token, the keys of the row, and those the delegated action's `parameterOverrides` set. Give `args` every `required: true` parameter; when none is, `args` may be `undefined`. A button binds only a parameter of a scalar type (a string, number or bool); one of another type, such as `config`, keeps its default. `Gs2Exchange:RateModel.Exchange` and `Gs2Showcase:DisplayItem.Buy` also take a required `storeProductId` string, which `parameters` does not list, when a master data resource of the packages that make up the type has `Gs2Money2:VerifyReceiptByUserId` (a paid product) among its actions, written directly, in a static binding, or produced by an action transform it uses. `parameters` is absent when the action does not resolve (an action the catalog lacks, or a target resource that does not mount the type) or code generation blocks it, for the delegated actions of inline schemas (`inlineSchemas.<list>.delegatedActions`), and from older surfaces: then the surface does not say what the method takes. |
1539
1566
  | `types.<Type>.singleEntry` | `true` when the type has one row (see [Keys and identity](#keys-and-identity)). |
1540
1567
  | `types.<Type>.singleEntryRowId` | The id of that one row, for a single-entry type: the name of the type's first declaration in lower case, also when an overlay renames the type. It is the id of a row you author of the type and the `rowId` to pass to `UiSource.rowProp`. Absent for other types, and from older surfaces. |
1568
+ | `types.<Type>.compositeKey` | The names of the composite key's members in ascending order of their property ids: join the members' values with `.` in this order to make a row id (see [Keys and identity](#keys-and-identity)). An overlay that renames a member lists it under its new name. Absent for a type without a composite key, and from older surfaces (write the surface again with `dsl surfaces`). |
1541
1569
  | `types.<Type>.sort` | The order of the type's rows, `{ key, direction }` as an overlay's `sort` takes it (`key` is `null` for the id); absent when the rows are in ascending id order, and from older surfaces. |
1542
1570
  | `types.<Type>.shippedRowIds` | The ids of the rows this package ships of the type, sorted; `[]` when it ships none. Each package lists only its own rows: the rows of a type are those of every surface entry with the same `canonicalPackageId` and `canonicalTypeId`, plus those every surface lists under `shippedRowsOfDependencyTypes."<canonicalPackageId>:<canonicalTypeId>"`. These rows are provided, so do not author them: a row you author with a listed id replaces the shipped row and all its values (change some values with `overlayInstance` instead). Rows with other ids are added beside them, except on a single-entry type, whose one row is the shipped one. A row an `overlayInstance` suppresses is still listed. When no surface lists a row and a build names the type in `No master data is registered for domain model "<Type>"`, the rows are yours to author. |
1543
- | `types.<Type>.uiComponents.<className>` | The UI items on the type, the package's own and those of the packages it overlays (`{}` for none), by the class name the item was declared with, not the generated class: key `StartButton` on `Quest` is the generated class `QuestStartButton` (`<Type><className>`; see [Item options](#item-options)). Each gives `kind` (`label`, `buttonAction`, ...), `name` (the item's label in GS2 Studio's editor, which is not part of any class name), the declaring `packageId` and, for a button, the delegated action `method` it calls. An inline schema lists its items under `inlineSchemas.<list>.uiComponents`. Code generation gives the items of an overlay, renamed or not, the same generated classes as the type's, so an item you add with a listed class name replaces the listed item (`dsl build` warns about it). Reuse a listed item instead of adding one that shows the same. |
1571
+ | `types.<Type>.uiComponents.<className>` | The UI items on the type, the package's own and those of the packages it overlays (`{}` for none), by the class name the item was declared with, not the generated class: key `OpenButton` on `GiftBox` is the generated class `GiftBoxOpenButton` (`<Type><className>`; see [Item options](#item-options)). Each gives `kind` (`label`, `buttonAction`, ...), `name` (the item's label in GS2 Studio's editor, which is not part of any class name), the declaring `packageId`, for a button the delegated action `method` it calls, for a `templateLabel` its `template` (one text, or one per locale keyed by tag; `{key}` names a source), for a `label`, `countdown` or `templateLabel` the `fallbackText` it shows while its value is unset (absent when it has none: then it shows empty text), and the item's `description` when it has one. An inline schema lists its items under `inlineSchemas.<list>.uiComponents`. Code generation gives the items of an overlay, renamed or not, the same generated classes as the type's, so an item you add with a listed class name replaces the listed item (`dsl build` warns about it). Reuse a listed item instead of adding one that shows the same. |
1544
1572
  | `types.<Type>.generatedHandlers` | The classes Unity code generation writes for the rows of the type, judged on the package and its dependencies: `<Type>Handler`, and for a type whose rows a GS2 model lists, `<Type>ListHandler`, `<Type>ListItemHandler` and one `<Type>ListBy<Ref>Handler` per reference it can list by (see [Rows in the game](#rows-in-the-game)). `<Type>` is the type's one generated name, which also starts the class of each of its UI items; an overlay keeps it unless it renames the type ([Item options](#item-options)). `[]` when it writes none: a UI component on the type, or a `UiSource.rowProp` of it, then fails `dsl build` unless your package mounts its overlay of the type with a resource of its own. The element Handlers of an inline schema are not listed. Absent when code generation refuses the type. |
1545
1573
  | `types.<Type>.mountedBy` | `masterData` and `userData`: the GS2 models (`<service>.<Model>`) of this package's own resources mounted on the type, sorted. A type mounted only by a namespace, such as `CurrencyStore` (`money2.Namespace`), gets no Handler. Other packages that overlay the type list their resources in their own surfaces. |
1546
1574
  | `shippedRowsOfDependencyTypes` | The ids of the rows this package ships of a dependency's type it does not declare (`instance(dep.type("<Type>"), ...)`), keyed `<canonicalPackageId>:<canonicalTypeId>` of the type, as its surface entries publish them. |
1575
+ | `usageNotes` | The package's usage notes ([Usage notes](#usage-notes)); absent when it has none. `dsl surfaces` also writes them as `<dir>/<packageId>.md`. |
1547
1576
  | `actionTransformSignatures.<Name>` | `category` (`acquire`, `consume` or `verify`) and `parameters`: per parameter in declaration order, `type`, `required` and, only when the parameter gives one, `description` (one text, not per locale). A `ref<T>` parameter takes a row id of `T`. |
1548
1577
 
1549
1578
  A surface written by an older GS2 Studio has neither `propertyDetails` nor `actionTransformSignatures`; `transformCall` and `transformProgram` then fail to compile and
@@ -1589,7 +1618,8 @@ throw. Write it again with `dsl surfaces`.
1589
1618
  "StockLabel": {
1590
1619
  "kind": "templateLabel",
1591
1620
  "name": "Item",
1592
- "packageId": "example-inventory"
1621
+ "packageId": "example-inventory",
1622
+ "template": "{id} x{count}"
1593
1623
  }
1594
1624
  },
1595
1625
  "properties": {
@@ -1674,18 +1704,7 @@ a type that package `<packageId>` declares, which need not be the package whose
1674
1704
  2. Author the row with `instance(other.type("<Type>"), id, values)`, with the values its `propertyDetails` ask for.
1675
1705
  3. Give that row id as the `ref` value.
1676
1706
 
1677
- A limited-time quest is an example. `micro-economy-quest` keeps the period on the quest collection, not on `Quest`:
1678
- `QuestCollection.schedule` is `ref<foundation-economy-schedule:Schedule>`, GS2's challenge period of the quest group,
1679
- which holds for every quest in the collection. To limit one quest, give it a collection of its own: declare
1680
- `foundation-economy-schedule` (`github:gs2io/gs2-studio-package` for the official package), author
1681
- `instance(schedule.type("Schedule"), "winter_event", { scheduleType: "absolute", repeatType: "always", startAt:
1682
- "2026-11-30T15:00:00Z", endAt: "2026-12-31T14:59:59Z" })` (1 to 31 December 2026 in Japan; timestamps are UTC, see
1683
- [Property types](#property-types)) and `instance(quest.type("QuestCollection"), "winter_event", { schedule:
1684
- "winter_event" })`, and give the quest's row `collection: "winter_event"`.
1685
-
1686
- A game lists quests by collection (a `QuestListHandler` whose `_collection` is set to one collection; see
1687
- [Rows in the game](#rows-in-the-game)), so a scene that lists the other collection does not show this quest: the game
1688
- must list the new collection as well, with another list or by switching the list's scope with `SetScope(...)`.
1707
+ A dependency's usage notes give examples of such rows when it has them.
1689
1708
 
1690
1709
  ## The id ledger
1691
1710
 
@@ -1821,7 +1840,7 @@ warnings` when there is none (`--json`: `diagnostics` is `[]`):
1821
1840
  | Line | Fix |
1822
1841
  | --- | --- |
1823
1842
  | `[warning] <dependency> / <Type>::id: ... No master data is registered for domain model "<Type>", so <resource> resource cannot be expanded.` | The dependency's GS2 resource needs rows of `<Type>` from the project. Add them with `instance(dep.type("<Type>"), id, values)`, with a value for each property `types.<Type>.propertyDetails` of the surface lists as `requirement: "always"`, except `id` (the row id), `userData` properties and action lists, and for each `conditional` one with `requiredWhenMet: true` unless the row's values rule out its `condition`. The line's remedy names that call and that surface key with the type's name; it keeps `<Type>` when the warning names an inline schema or an unresolved type rather than a type `dep.type()` takes. An inline schema's rows are elements of the host type's list property (`dep.inlineElements(...)`). |
1824
- | `... is a dependency the DSL cannot change, so these are fixed through the dependency that brings it in: ...` | A defect of the dependency itself. Remove the dependency the message names from the DSL when the package does not need it; the update or removal the message leaves to the project's owner is made in GS2 Studio. |
1843
+ | `... is a dependency whose own definitions the DSL cannot change, so the findings in them are fixed through the dependency that brings it in: ...` | A defect in the dependency's own definitions, said once for the package; a finding about rows, which the DSL adds or overrides, is not among them. Remove the dependency the message names from the DSL when the package does not need it; the update or removal the message leaves to the project's owner is made in GS2 Studio. |
1825
1844
  | `[error] ... the required arguments (...) of action transform "..." have no value for row "..."` | A transform argument reads a property the row has no value for. Give every row the value, also the dependency's rows (`overlayInstance`). |
1826
1845
  | A line about another package that this DSL does not change | Leave it; tell the user about it instead of building again. |
1827
1846
  | Any other line | Fix the DSL as the message says. Messages written for the editor name the editor's steps. |
@@ -1834,7 +1853,8 @@ These lines do not include what Unity code generation alone refuses: run `"<GS2
1834
1853
  `CLI_DSL_PACKAGE_INVALID` prints each problem as a JSON object; its `kind` is one of these. The other fields name the
1835
1854
  type, property, resource or component involved. A `restoreFailure` is printed as its plain message, and a property name
1836
1855
  that resolves to nothing (`unresolvedPropertySlot`, `uiComponentUnknownProperty`) as
1837
- `<where>: "<name>" is not a property of "<Type>" (properties: ...)`.
1856
+ `<where>: "<name>" is not a property of "<Type>" (properties: ...)`. `duplicateActionPropertyTransformTarget` is printed
1857
+ as a sentence that names the transforms and says how to combine them.
1838
1858
 
1839
1859
  | Kind | Cause |
1840
1860
  | --- | --- |
@@ -1844,6 +1864,7 @@ that resolves to nothing (`unresolvedPropertySlot`, `uiComponentUnknownProperty`
1844
1864
  | `reservedPropertyName` | A property named `id`. |
1845
1865
  | `duplicateDomainTypeName`, `duplicatePropertyName` | Two types, or two properties of one type, share a name. |
1846
1866
  | `duplicateOverlaySource` | Two overlays of the same source type. |
1867
+ | `duplicateActionPropertyTransformTarget` | An overlay attaches two transforms to one property (`targetProperty`, `transformNames`), whatever their `mode`. Define one transform in this package whose delegation outputs call each of them and attach that one. |
1847
1868
  | `domainTypeDefinitionNotRegistered` | A definition used without being listed in `domainTypes`; `context` says where it was used. |
1848
1869
  | `invalidRefTarget` | `PT.ref(...)` names a type the package does not include. |
1849
1870
  | `invalidInstanceType` | A row of a type the package does not declare. |
@@ -1880,6 +1901,7 @@ that resolves to nothing (`unresolvedPropertySlot`, `uiComponentUnknownProperty`
1880
1901
  | `uiComponentTemplateLabelLocaleInvalid` | A template per locale with no locale, a tag that is no BCP 47 locale, one locale twice, or empty text (`issue.kind`). |
1881
1902
  | `uiComponentTemplateLabelLocalePlaceholderMissing` | `locale`'s template leaves out `{key}`, which another locale's template uses. |
1882
1903
  | `unsafeCodeTemplateOutputFileName` | A code template output name that cannot be written as a file. |
1904
+ | `blankUsageNotes` | `usageNotes` that is not text or holds nothing but whitespace. |
1883
1905
 
1884
1906
  ## Exported types
1885
1907
 
package/index.d.ts CHANGED
@@ -5691,6 +5691,12 @@ interface PublishedUiComponentItem {
5691
5691
  readonly name: string;
5692
5692
  readonly packageId: string;
5693
5693
  readonly method?: string;
5694
+ /** The description its author gave it. */
5695
+ readonly description?: string;
5696
+ /** A `templateLabel`'s text: one for every player, or one per locale keyed by BCP 47 tag, `{key}` naming a source. */
5697
+ readonly template?: string | Readonly<Record<string, string>>;
5698
+ /** What a `label`, `countdown` or `templateLabel` shows while its value is unset; absent when its author gave none. */
5699
+ readonly fallbackText?: string;
5694
5700
  }
5695
5701
  interface PublishedInlineElementSchema {
5696
5702
  readonly properties: Readonly<Record<string, string>>;
@@ -5743,6 +5749,12 @@ interface DependencySurfaceType {
5743
5749
  * it. Absent for other types and from older surfaces.
5744
5750
  */
5745
5751
  readonly singleEntryRowId?: string;
5752
+ /**
5753
+ * The effective names of the composite key's members in ascending order of their property ids, the order their values join with
5754
+ * `.` into a row id. Absent for a type without a composite key, for one with a member that is not one of its properties, and
5755
+ * from older surfaces.
5756
+ */
5757
+ readonly compositeKey?: readonly string[];
5746
5758
  /** Preserve canonical identity across re-exporting overlays. */
5747
5759
  readonly canonicalPackageId: string;
5748
5760
  readonly canonicalTypeId: string;
@@ -5793,6 +5805,8 @@ export interface DependencySurface {
5793
5805
  readonly actionTransformSignatures?: Readonly<Record<string, PublishedTransformSignature>>;
5794
5806
  /** Use service.modelName coordinates to distinguish resources with the same model name in different services. */
5795
5807
  readonly masterDataResources: Readonly<Record<string, string>>;
5808
+ /** The package's usage notes, Markdown telling an author how to use it. Absent when it has none and from older surfaces. */
5809
+ readonly usageNotes?: string;
5796
5810
  }
5797
5811
  interface DependencyOverlaySource {
5798
5812
  readonly directSourcePackageId: string;
@@ -6247,6 +6261,11 @@ export interface PackageSpec {
6247
6261
  readonly actionTransforms?: readonly ActionTransformDef[];
6248
6262
  readonly uiComponents?: readonly UiComponentDef[];
6249
6263
  readonly codeTemplates?: readonly CodeTemplateSnapshotDto[];
6264
+ /**
6265
+ * Markdown telling an author how to use the package, such as a `USAGE.md` beside the DSL imported with `?raw`. The package
6266
+ * ships it as `usage.md`, and `dsl surfaces` writes it beside the package's surface.
6267
+ */
6268
+ readonly usageNotes?: string;
6250
6269
  }
6251
6270
  interface ScriptSettingShape {
6252
6271
  readonly triggerScriptId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gs2-studio-dsl",
3
- "version": "2026.11.21",
3
+ "version": "2026.11.22",
4
4
  "description": "Type definitions for the GS2 Studio package DSL.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {