gs2-studio-dsl 2026.11.13 → 2026.11.14
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 +26 -8
- package/README.md +5 -4
- package/REFERENCE.md +65 -14
- package/index.d.ts +12 -0
- package/package.json +1 -1
package/LLM.md
CHANGED
|
@@ -51,6 +51,8 @@ commands below with the executable's path; the first build writes the ledger. It
|
|
|
51
51
|
4. Type-check: `npx tsc --noEmit -p <dsl>`. Fix every error before building.
|
|
52
52
|
5. First build of a new package:
|
|
53
53
|
`"<GS2 Studio>" dsl build --dir <project> --entry <dsl>/index.ts --write-ledger`
|
|
54
|
+
It adds the package with the id `definePackage({ id })` declares beside the project's other packages, which stay as
|
|
55
|
+
they are; later builds replace that package. Only a DSL that declares the id `local-project` replaces `local-project`.
|
|
54
56
|
6. Later builds: the same command without `--write-ledger`. Add `--write-ledger` only when the build reports missing
|
|
55
57
|
ledger tokens for things you added (a type, property, row or transform) and reports no token as "not current".
|
|
56
58
|
A "not current" token means a rename or removal: handle it as in section 4 first.
|
|
@@ -59,7 +61,8 @@ commands below with the executable's path; the first build writes the ledger. It
|
|
|
59
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
|
|
60
62
|
line on another package that the DSL does not change. Then open the project in GS2 Studio and fix what it reports:
|
|
61
63
|
what Unity code generation alone refuses is not printed (see
|
|
62
|
-
[Building with dsl build](REFERENCE.md#building-with-dsl-build)).
|
|
64
|
+
[Building with dsl build](REFERENCE.md#building-with-dsl-build)). A build with no such line prints
|
|
65
|
+
`project check (without Unity code generation): no errors or warnings` last.
|
|
63
66
|
8. Keep `id-ledger.json` and `dependency-surface.json` with `index.ts`; commit them together.
|
|
64
67
|
|
|
65
68
|
A build that fails a check writes nothing. On failure, read every listed problem, fix the DSL, and rerun.
|
|
@@ -77,7 +80,16 @@ MUST:
|
|
|
77
80
|
- Name domain types in PascalCase and properties in camelCase. Never declare a property named `id`.
|
|
78
81
|
- Bind every `.masterData()` property in some master data resource and every `.userData()` property in some user data
|
|
79
82
|
resource, or remove the hint.
|
|
80
|
-
-
|
|
83
|
+
- Put a `defineUiComponent`, and the type of a `UiSource.rowProp`, only on a type that gets a Handler; `dsl build`
|
|
84
|
+
refuses either on a type without one and says why. A dependency's type gets one when `types.<Type>.generatedHandlers`
|
|
85
|
+
of its surface is not `[]` (`mountedBy` names the dependency's resources that mount it), or when your package mounts
|
|
86
|
+
its overlay of the type itself. A type gets one only when a user data resource, or a master data resource of a model
|
|
87
|
+
other than a namespace, mounts it.
|
|
88
|
+
- To use what a dependency does as it is (for example "make the wallet usable" with `foundation-economy-currency`),
|
|
89
|
+
declare the dependency and call its transforms; add rows, resources or UI only for what the surface or a build asks
|
|
90
|
+
for. The dependency's own UI components (`types.<Type>.uiComponents`) are generated with it, and the game places
|
|
91
|
+
the Handler that holds the row they show, such as a `WalletHandler` set to the slot (`"0"`). See
|
|
92
|
+
[Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
81
93
|
- Before adding UI to a dependency's type, read `types.<Type>.uiComponents` of its surface. Reuse a listed item instead
|
|
82
94
|
of adding one that shows the same, and give new items unlisted class names: a listed one replaces that item.
|
|
83
95
|
- Give a single-entry type's row the type name in lower case as its id (`GameSettings` → `gamesettings`).
|
|
@@ -89,8 +101,10 @@ MUST:
|
|
|
89
101
|
project is `"*"`. An installed package has the spec of its source, as the `dependencies` of
|
|
90
102
|
`<project>/packages/<packageId>/package.json` of the package that installed it declare it: a package installed from
|
|
91
103
|
GitHub is `github:<owner>/<repo>[@<range>]` without its subdirectory, and every package of the GS2 Studio package
|
|
92
|
-
repository is `github:gs2io/gs2-studio-package`.
|
|
93
|
-
|
|
104
|
+
repository is `github:gs2io/gs2-studio-package`. A package that came in as a dependency of another one appears in no
|
|
105
|
+
`package.json` there: take the spec from its entry in `<project>/project-lock.json` (`github:<owner>/<repo>` for
|
|
106
|
+
`"sourceKind": "github"`). Never give an installed package `"*"`; `dsl build` refuses it and prints the spec to
|
|
107
|
+
declare (see [Dependencies](REFERENCE.md#dependencies)).
|
|
94
108
|
- Learn what a dependency needs from its surface file, not from its package files: `types.<Type>.propertyDetails`
|
|
95
109
|
gives each property's `type`, `requirement`, `bindingHint` and, when it has one, its `display` (label and description
|
|
96
110
|
per locale); `actionTransformSignatures.<Name>` gives each transform's category and parameters (name, type,
|
|
@@ -142,9 +156,10 @@ Names and ids:
|
|
|
142
156
|
|
|
143
157
|
- You write names; GS2 Studio stores ids. The ledger maps names (tokens such as `property:Item.count`) to ids.
|
|
144
158
|
- Renaming a type, property, row or transform: the build reports the old token as "not current" and the new one as
|
|
145
|
-
missing
|
|
146
|
-
|
|
147
|
-
`
|
|
159
|
+
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`, then build without `--write-ledger`. Never let
|
|
161
|
+
`--write-ledger` record a new id for a renamed thing. Renaming a type also renames its `property:<Type>.<name>` and
|
|
162
|
+
row tokens; move each of them, all before the next build. It also changes, without a message, the ids of the
|
|
148
163
|
type's UI component and its items and of user data resources mounted on the type; keep them with
|
|
149
164
|
`deterministicOverrides`. See [The id ledger](REFERENCE.md#the-id-ledger).
|
|
150
165
|
- A row id is letters, digits, `_`, `.` and `-`, at most 128 characters; a resource that binds `id` to a GS2 name sends
|
|
@@ -214,11 +229,13 @@ Names and ids:
|
|
|
214
229
|
| `{"kind":"unresolvedParentBinding",...}` | `Source.parent(...)` on a root resource. | Use `Source.direct(...)`, or move the resource under a parent. |
|
|
215
230
|
| `CLI_DSL_LEDGER_MISSING` | First build without `--write-ledger`. | Add `--write-ledger`. |
|
|
216
231
|
| `CLI_DSL_LEDGER_MISMATCH` ... `random token ... is missing from the ledger`, and no token is "not current" | You added something. | Check the tokens, then rebuild with `--write-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). If you removed it and added another, do what the line's last sentence says. Then rebuild without `--write-ledger`. |
|
|
217
233
|
| `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`. |
|
|
218
234
|
| `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). |
|
|
219
235
|
| `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. |
|
|
220
236
|
| `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. |
|
|
221
|
-
| `CLI_DSL_VALIDATION_FAILED` ... `is
|
|
237
|
+
| `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. |
|
|
238
|
+
| `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. |
|
|
222
239
|
| `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). |
|
|
223
240
|
| `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. |
|
|
224
241
|
| `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. |
|
|
@@ -227,6 +244,7 @@ Names and ids:
|
|
|
227
244
|
| `... 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. |
|
|
228
245
|
| 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. |
|
|
229
246
|
| 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 })`. |
|
|
247
|
+
| `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)). |
|
|
230
248
|
| A UI item of a property you added shows nothing (or `0`) in the game | The property has no binding hint, so the client never gets its value. | Give it `.assetDelivery()`. |
|
|
231
249
|
|
|
232
250
|
## 7. Minimal complete example
|
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.14
|
|
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.14 builds with GS2 Studio 2026.11.14 and later. Install the version that
|
|
17
17
|
matches the oldest GS2 Studio you build with.
|
|
18
18
|
|
|
19
19
|
```ts
|
|
@@ -67,8 +67,9 @@ The GS2 Studio executable runs the `dsl` commands headless and exits with their
|
|
|
67
67
|
"<GS2 Studio>" dsl init --dir <project> --out <dsl> --package-id <id>
|
|
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
|
-
# evaluate the DSL, check it, and save the package into the project
|
|
71
|
-
# after saving it prints the [error] and [warning] lines project check reports,
|
|
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, or a
|
|
72
|
+
# line saying there are none, and exits with 0
|
|
72
73
|
"<GS2 Studio>" dsl build --dir <project> --entry <dsl/index.ts> --write-ledger
|
|
73
74
|
```
|
|
74
75
|
|
package/REFERENCE.md
CHANGED
|
@@ -244,7 +244,7 @@ transform parameters.
|
|
|
244
244
|
| `PT.int32()`, `PT.int64()` | integer | `number` |
|
|
245
245
|
| `PT.float32()`, `PT.float64()` | floating point | `number` |
|
|
246
246
|
| `PT.bool()` | boolean | `boolean` |
|
|
247
|
-
| `PT.timestamp()` | timestamp | `string` |
|
|
247
|
+
| `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"` |
|
|
248
248
|
| `PT.localizedString()` | text per locale, delivered as an asset (only with `.assetDelivery()`) | `{ [locale]: string }`, such as `{ ja: "森の巡回", en: "Forest Patrol" }` |
|
|
249
249
|
| `PT.enum(...values)` | one of `values` | `string` |
|
|
250
250
|
| `PT.ref(target)` | a reference to a row of another type (`LocalDomainTypeDef`, `OverlayDomainTypeDef`, `DependencyDomainTypeRef`, or `() => target` for forward/self references) | the row id (`string`) |
|
|
@@ -253,6 +253,15 @@ transform parameters.
|
|
|
253
253
|
| `PT.inlineElement(schema)` | an element of a list, from `defineInlineElement` (only inside `PT.listOf`) | an object |
|
|
254
254
|
| `PT.verifyAction()`, `PT.consumeAction()`, `PT.acquireAction()` | a GS2 transaction action | an action value |
|
|
255
255
|
|
|
256
|
+
A timestamp value is `YYYY-MM-DDTHH:mm:ssZ`, or `YYYY-MM-DDTHH:mm:ss.SSSZ` with exactly three fraction digits. It is
|
|
257
|
+
UTC: it ends with `Z`, never with an offset such as `+09:00`, so convert local times yourself (00:00 on 1 December 2026
|
|
258
|
+
in Japan, UTC+9, is `"2026-11-30T15:00:00Z"`). The date and time must exist (no `24:00:00`, no 30 February) and the year
|
|
259
|
+
is 0001 to 9999. `tsc` checks none of this; `dsl build` refuses another form (`it is not a UTC ISO 8601 timestamp`) and a
|
|
260
|
+
date or time that does not exist (`it is not a valid date and time`).
|
|
261
|
+
GS2's documentation does not say whether the end of a period, such as `endAt` of `foundation-economy-schedule`'s
|
|
262
|
+
`Schedule` (GS2-Schedule's `absoluteEnd`), is itself inside the period. When that second matters, give the last
|
|
263
|
+
moment that must be inside: `"2026-12-31T14:59:59Z"` keeps 31 December open to its end in Japan.
|
|
264
|
+
|
|
256
265
|
`PT.ref` takes a domain type handle (`Item`), a thunk (`() => Item`) for circular or forward references, or a
|
|
257
266
|
dependency type handle (`dep.type("Item")`; see [Dependencies](#dependencies)). An unregistered target fails with
|
|
258
267
|
`invalidRefTarget`.
|
|
@@ -1074,7 +1083,7 @@ A `PT.localizedString` operand reads the translation for the player's locale: `t
|
|
|
1074
1083
|
Rules: class names are PascalCase and unique among all UI components of the same target type; property names must exist
|
|
1075
1084
|
on the target (`uiComponentUnknownProperty`); a button's method must be a delegated action registered for the target or
|
|
1076
1085
|
published by its dependency (`uiComponentUnknownDelegatedAction`). `dsl build` also refuses a UI component whose target
|
|
1077
|
-
type no
|
|
1086
|
+
type gets no Handler (see [Rows in the game](#rows-in-the-game)).
|
|
1078
1087
|
|
|
1079
1088
|
```ts
|
|
1080
1089
|
defineUiComponent(Item, {
|
|
@@ -1118,7 +1127,8 @@ at once and evaluates the condition again whenever its own row or any of those h
|
|
|
1118
1127
|
holds the row, or while a property it reads has no value, the condition is unknown; it logs a warning once when no handler of
|
|
1119
1128
|
the type is above it, and once when all of them have loaded and none holds the row. While unknown, `interactable` makes every `Selectable` in both lists non-interactable, and `activeToggle` leaves its
|
|
1120
1129
|
targets as they are. `dsl build` refuses an unknown type or property and an invalid row id. Code generation leaves the item
|
|
1121
|
-
out with a warning when the property is not a number or `bool
|
|
1130
|
+
out with a warning when the property is not a number or `bool`. `dsl build` refuses the component when `type` gets no
|
|
1131
|
+
Handler, as code generation would refuse the project (see [Rows in the game](#rows-in-the-game)).
|
|
1122
1132
|
|
|
1123
1133
|
### Item options
|
|
1124
1134
|
|
|
@@ -1160,7 +1170,10 @@ uiComponents: [
|
|
|
1160
1170
|
A UI component describes the components of one row. It makes no list, prefab or scene: the game places the generated
|
|
1161
1171
|
components in its own UI, below a handler that holds the row. Each component uses the nearest `<Type>HandlerBase` above
|
|
1162
1172
|
it in the hierarchy; without one it logs a warning and does nothing. Code generation writes these handlers for each type
|
|
1163
|
-
a resource mounts:
|
|
1173
|
+
that a resource it reads rows from mounts: a user data resource, or a master data resource of a model other than a namespace
|
|
1174
|
+
(a namespace is deploy settings, not rows). A dependency's surface names the handlers of each of its types
|
|
1175
|
+
(`types.<Type>.generatedHandlers`), judged on that package and its dependencies; a type it lists none for takes no UI
|
|
1176
|
+
component and no `UiSource.rowProp`, unless your package mounts its overlay of the type with such a resource:
|
|
1164
1177
|
|
|
1165
1178
|
| Generated class | Holds |
|
|
1166
1179
|
| --- | --- |
|
|
@@ -1171,6 +1184,13 @@ a resource mounts:
|
|
|
1171
1184
|
A list shows the rows GS2 holds at run time (the deployed master data, or the player's user data), each with the values
|
|
1172
1185
|
of its asset-delivered properties.
|
|
1173
1186
|
|
|
1187
|
+
A dependency's own UI components are generated with it, so a dependency used as it is needs nothing in the DSL beyond
|
|
1188
|
+
the dependency and what its surface asks for. `foundation-economy-currency` is an example: the transforms that deposit
|
|
1189
|
+
into a wallet (`DepositFreeCurrency`, `DepositCurrency`) are all the DSL needs, and no `Wallet` row is needed. The game
|
|
1190
|
+
shows a balance with the package's `Wallet` items (`FreeBalanceLabel`, `PaidBalanceLabel`, `TotalBalanceLabel`, listed
|
|
1191
|
+
under `types.Wallet.uiComponents`) below a `WalletHandler` whose row id is the wallet slot as a decimal string (`"0"`
|
|
1192
|
+
for slot 0, the `slot` the transforms take).
|
|
1193
|
+
|
|
1174
1194
|
Every list of a type is in the order of the type's sort setting (`sort` on a local type in
|
|
1175
1195
|
[Keys and identity](#keys-and-identity), or on an overlay in [Overlay types](#overlay-types)). Rows whose keys are
|
|
1176
1196
|
equal, and all rows of a type without a sort setting, are in ascending id order (code-unit order); only the elements of
|
|
@@ -1264,6 +1284,12 @@ the project's package that installed it (`<project>/packages/<packageId>/package
|
|
|
1264
1284
|
included. A `file:` path is relative to the declaring package's directory, so recompute it from
|
|
1265
1285
|
`<project>/packages/<your packageId>/` when the two directories are not at the same depth:
|
|
1266
1286
|
|
|
1287
|
+
- A package that came into the project as a dependency of another one, rather than being added itself, is declared in
|
|
1288
|
+
no `package.json` of `<project>/packages/`. Its entry in `<project>/project-lock.json` names its source: for
|
|
1289
|
+
`"sourceKind": "github"`, the spec is `github:<owner>/<repo>` with that entry's `owner` and `repo`; for `"sourceKind":
|
|
1290
|
+
"npm"`, `npm:<packageName>@<range>`. `dsl build`
|
|
1291
|
+
accepts any spec of the same repository, and when a spec names another source it prints the spec the packages that
|
|
1292
|
+
brought the dependency in declare.
|
|
1267
1293
|
- A GitHub spec names the repository only, also for a package in a subdirectory of it: `github:<owner>/<repo>/<dir>`
|
|
1268
1294
|
is refused. The project's `project-lock.json` records the directory (`subdirectory` of the package's entry, beside
|
|
1269
1295
|
`owner` and `repo`). Every package of the GS2 Studio package repository is `github:gs2io/gs2-studio-package`.
|
|
@@ -1303,6 +1329,8 @@ Besides names and ids, the surface describes what a dependent needs to use them:
|
|
|
1303
1329
|
| `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. |
|
|
1304
1330
|
| `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. |
|
|
1305
1331
|
| `types.<Type>.uiComponents.<ClassName>` | The UI items on the type, the package's own and those of the packages it overlays (`{}` for none), by class name: `kind` (`label`, `buttonAction`, ...), `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. |
|
|
1332
|
+
| `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 an overlay keeps. `[]` 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. |
|
|
1333
|
+
| `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. |
|
|
1306
1334
|
| `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. |
|
|
1307
1335
|
| `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`. |
|
|
1308
1336
|
|
|
@@ -1322,6 +1350,19 @@ throw. Write it again with `dsl surfaces`.
|
|
|
1322
1350
|
"shippedRowIds": [],
|
|
1323
1351
|
"canonicalPackageId": "example-inventory",
|
|
1324
1352
|
"canonicalTypeId": "dt_20QRK0BTMW89TAWPHGNYFXNYJ5",
|
|
1353
|
+
"generatedHandlers": [
|
|
1354
|
+
"ItemHandler",
|
|
1355
|
+
"ItemListHandler",
|
|
1356
|
+
"ItemListItemHandler"
|
|
1357
|
+
],
|
|
1358
|
+
"mountedBy": {
|
|
1359
|
+
"masterData": [
|
|
1360
|
+
"inventory.SimpleItemModel"
|
|
1361
|
+
],
|
|
1362
|
+
"userData": [
|
|
1363
|
+
"inventory.SimpleItem"
|
|
1364
|
+
]
|
|
1365
|
+
},
|
|
1325
1366
|
"uiComponents": {
|
|
1326
1367
|
"CountValue": {
|
|
1327
1368
|
"kind": "value",
|
|
@@ -1461,9 +1502,15 @@ Rules:
|
|
|
1461
1502
|
- The first build runs with `--write-ledger`; it creates the ledger. Later builds that add types, properties, rows or
|
|
1462
1503
|
transforms need `--write-ledger` again, which only adds missing `random` tokens and never changes existing values.
|
|
1463
1504
|
- Never change an existing id: other packages and projects refer to it.
|
|
1464
|
-
- Renaming a type, property, row or transform changes its token, and the build fails with
|
|
1465
|
-
|
|
1466
|
-
|
|
1505
|
+
- Renaming a type, property, row or transform changes its token, and the build fails, also with `--write-ledger`. When
|
|
1506
|
+
the old token and the new one are the only pair of their kind and owner (the same type for a property or row), or a
|
|
1507
|
+
property or row keeps its name under a renamed type, it reports them together: `random token <old> is not current and
|
|
1508
|
+
<new> is missing, which looks like a rename: ... move its id "<id>" from "<old>" to "<new>"`. Otherwise, as for two
|
|
1509
|
+
properties of one type renamed at once, it reports `random token <old> is not current; ...` and `random token <new> is
|
|
1510
|
+
missing from the ledger` apart. To keep the identity, move the old token's id to the new token in `random` and keep the
|
|
1511
|
+
entries sorted. Move every id the build lists before building again: once `type:<old>` is moved, its properties and
|
|
1512
|
+
rows no longer pair. A pair that is really a removal and an unrelated addition, such as deleting one row and adding
|
|
1513
|
+
another, is reported the same way; do what the line's last sentence says for it. While the old token is still in `random`,
|
|
1467
1514
|
`--write-ledger` fails with the same "not current" problem and writes nothing; it would record a new id for the new
|
|
1468
1515
|
token only after the old one is moved to `retired`, which ends the old identity. Renaming a type renames the tokens
|
|
1469
1516
|
of its properties and rows too (`type:Item` and `property:Item.count` become `type:Article` and
|
|
@@ -1496,10 +1543,13 @@ Rules:
|
|
|
1496
1543
|
"<GS2 Studio>" dsl build --dir <project> --entry <dsl/index.ts> [--ledger <path>] [--write-ledger] [--catalogs <dir>]
|
|
1497
1544
|
```
|
|
1498
1545
|
|
|
1499
|
-
`dsl build` evaluates the entry, checks the package, and on success saves it into the project
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1546
|
+
`dsl build` evaluates the entry, checks the package, and on success saves it into the project as the package whose id
|
|
1547
|
+
`definePackage({ id })` declares, beside the project's other packages: the first build adds it (`added <id> in
|
|
1548
|
+
<project>`), and later builds replace it (`replaced <id> in <project>`). It changes no other package. `local-project`,
|
|
1549
|
+
the package a new project starts with, is replaced only by a DSL that declares that id. Deploy and code generation cover
|
|
1550
|
+
every package of the project, and a dependency several packages declare is in the project once. The build writes the
|
|
1551
|
+
ledger (when it changes), then the project, then `dependency-surface.json` beside the ledger. When a check fails it
|
|
1552
|
+
writes nothing.
|
|
1503
1553
|
|
|
1504
1554
|
| Failure | Cause | Fix |
|
|
1505
1555
|
| --- | --- | --- |
|
|
@@ -1510,15 +1560,16 @@ fails it writes nothing.
|
|
|
1510
1560
|
| `CLI_DSL_DEPENDENCY_NOT_INSTALLED` | A declared dependency is not in the project. | For a package authored in the project, build it with `dsl build` first; for another package, add it in GS2 Studio. |
|
|
1511
1561
|
| `CLI_DSL_DEPENDENCY_SPEC_MISMATCH` | The spec of an installed package names another source than the one the project installed it from, such as `*`. | Declare it with the spec the message prints. |
|
|
1512
1562
|
| `CLI_DSL_LEDGER_MISSING` | No ledger, and no `--write-ledger`. | Run with `--write-ledger` the first time. |
|
|
1513
|
-
| `CLI_DSL_LEDGER_MISMATCH` | Missing tokens (listed with candidate ids), tokens that are no longer current, or a retired token that reappeared. |
|
|
1563
|
+
| `CLI_DSL_LEDGER_MISMATCH` | Missing tokens (listed with candidate ids), tokens that are no longer current, likely renames (a token not current paired with a missing one), or a retired token that reappeared. | A rename (the line says `looks like a rename`, or you renamed it): move the old token's id to the new token, as [The id ledger](#the-id-ledger) says. A removal: move the token and its id to `retired`. Then, only for tokens of things you added, rerun with `--write-ledger`. A reappeared token: add the override the message shows. |
|
|
1514
1564
|
| `CLI_DSL_LEDGER_INVALID` | The ledger is not canonical JSON of the shape above. | Repair the file as the message says. |
|
|
1515
1565
|
| `CLI_DSL_LEDGER_UNREADABLE` | The ledger file exists but cannot be read. | Fix the file's permissions or path. |
|
|
1516
1566
|
| `CLI_DSL_WRITE_FAILED` | Writing the ledger or the dependency surface failed. | Fix the cause the message names and rerun. |
|
|
1517
|
-
| `CLI_DSL_VALIDATION_FAILED` | The checks the editor applies before it opens or installs a package: unbound `masterData` / `userData` properties, rows that fail validation, composite-key ids, UI components on
|
|
1567
|
+
| `CLI_DSL_VALIDATION_FAILED` | The checks the editor applies before it opens or installs a package: unbound `masterData` / `userData` properties, rows that fail validation, composite-key ids, UI components and `UiSource.rowProp` on types that get no Handler, and others, listed one by one. | Fix each finding. |
|
|
1518
1568
|
|
|
1519
1569
|
After it saves the package, `dsl build` prints on stderr the errors and warnings `project check` reports for the
|
|
1520
1570
|
project, as `[error] ...` and `[warning] ...` lines (`--json`: `diagnostics`). The build still exits with 0, because the
|
|
1521
|
-
package is saved; fix each line and build again
|
|
1571
|
+
package is saved; fix each line and build again. When there is none, the build prints `project check (without Unity code
|
|
1572
|
+
generation): no errors or warnings` as its last line on stdout (`--json`: `diagnostics` is `[]`):
|
|
1522
1573
|
|
|
1523
1574
|
| Line | Fix |
|
|
1524
1575
|
| --- | --- |
|
package/index.d.ts
CHANGED
|
@@ -100,6 +100,10 @@ interface PublishedTransformSignature {
|
|
|
100
100
|
readonly category: string;
|
|
101
101
|
readonly parameters: Readonly<Record<string, PublishedTransformParameter>>;
|
|
102
102
|
}
|
|
103
|
+
interface PublishedResourceMounts {
|
|
104
|
+
readonly masterData: readonly string[];
|
|
105
|
+
readonly userData: readonly string[];
|
|
106
|
+
}
|
|
103
107
|
interface DependencySurfaceType {
|
|
104
108
|
/** Keep the declaring id for direct-source links even when canonical identity belongs to another package. */
|
|
105
109
|
readonly id: string;
|
|
@@ -134,6 +138,14 @@ interface DependencySurfaceType {
|
|
|
134
138
|
* same class name. Absent from surfaces written before UI components were published.
|
|
135
139
|
*/
|
|
136
140
|
readonly uiComponents?: Readonly<Record<string, PublishedUiComponentItem>>;
|
|
141
|
+
/**
|
|
142
|
+
* The class names of the Handlers Unity code generation writes for the rows of the type (`<Type>Handler`, `<Type>ListHandler`,
|
|
143
|
+
* `<Type>ListItemHandler`, `<Type>ListBy<Ref>Handler`), judged on the package and its dependencies. Empty when it writes none, so
|
|
144
|
+
* no UI component on the type and no `UiSource.rowProp` of it can be generated. Absent when generation refuses the type.
|
|
145
|
+
*/
|
|
146
|
+
readonly generatedHandlers?: readonly string[];
|
|
147
|
+
/** The package's own resources mounted on the type; other packages that overlay it list theirs in their own surfaces. */
|
|
148
|
+
readonly mountedBy?: PublishedResourceMounts;
|
|
137
149
|
}
|
|
138
150
|
interface DependencySurface {
|
|
139
151
|
readonly schemaVersion: number;
|