@hagicode/steamworks.js 0.1.6-dev.22 → 0.1.6-dev.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@ This project is a fork of the upstream [steamworks.js](https://github.com/ceifa/
15
15
  It exists for my own development work, not as a general replacement for upstream. It is shaped around two needs:
16
16
 
17
17
  * **Working well with coding agents.** The repository carries agent guidance (`AGENTS.md`), task-oriented skills for Steam Workshop work (`steamworks-js/` and the `steamworks-workshop-*` folders), and a documentation site built from this README and those skills.
18
- * **Covering the Steamworks features my projects use.** Workshop publishing and updates (additional previews, preview-only and content-only updates, item dependencies, per-language titles and descriptions), plus friends, stats and leaderboards, networking sockets/messages/utils, the server browser, timeline, screenshots and Remote Play.
18
+ * **Covering the Steamworks features my projects use.** Workshop publishing and updates (additional previews, preview-only and content-only updates, item dependencies, known game versions, per-language titles and descriptions), plus friends, stats and leaderboards, networking sockets/messages/utils, the server browser, timeline, screenshots and Remote Play.
19
19
 
20
20
  What that means in practice:
21
21
 
@@ -196,6 +196,32 @@ const removed = await client.workshop.removeDependency(modId, requiredId)
196
196
  - Both calls need a running, logged-in Steam client, and the parent must be an item the logged-in account owns.
197
197
  - An id that is negative or does not fit in 64 bits rejects before any Steam call. A failed call with no completion also rejects, and the error says the outcome is unknown, so check the item before retrying.
198
198
 
199
+ ## Workshop Known Game Versions
200
+
201
+ An item can declare the game versions (Steam branches such as `open_beta` or `public`) it is valid for. Every item returned by a query carries those ranges in `supportedGameVersions`, and `updateItem` changes them with `requiredGameVersionMin` and `requiredGameVersionMax`:
202
+
203
+ ```js
204
+ const steamworks = require('steamworks.js')
205
+ const client = steamworks.init(appId)
206
+
207
+ // read: one entry per range; an open end is left out (undefined)
208
+ const item = await client.workshop.getItem(itemId)
209
+ console.log(item.supportedGameVersions) // e.g. [{ minBranch: 'open_beta', maxBranch: 'open_beta' }, { minBranch: 'public' }]
210
+
211
+ // change: valid for open_beta and every branch published after it; the content is sent in the same update
212
+ await client.workshop.updateItem(itemId, {
213
+ contentPath: '/abs/path/mod-folder',
214
+ requiredGameVersionMin: 'open_beta',
215
+ requiredGameVersionMax: '',
216
+ }, appId)
217
+ ```
218
+
219
+ - `supportedGameVersions` comes with items from `getItem`, `getItems`, `getAllItems` and `getUserItems`. It is an empty list when Steam returns no range for the item.
220
+ - Both change fields are optional. Setting one changes that end, and the other end is left open. Leaving both out keeps the range as it is.
221
+ - Pass both as `""` to make the item valid for every game version again.
222
+ - Steam applies the range only when the same update changes the item's content, so send `contentPath` with it. Otherwise Steam does not apply the range.
223
+ - Changing the range needs a running, logged-in Steam client and an item the logged-in account owns.
224
+
199
225
  ## Workshop Multilingual Support
200
226
 
201
227
  Steamworks.js supports localized content for Steam Workshop items. You can update the title and description for different languages using the `language` parameter.
package/client.d.ts CHANGED
@@ -903,6 +903,15 @@ export declare namespace workshop {
903
903
  tags?: Array<string>
904
904
  visibility?: UgcItemVisibility
905
905
  language?: string
906
+ /**
907
+ * Oldest game version (Steam branch, e.g. `open_beta`) the item is valid for.
908
+ * Set either required-version field to change the range; the unset end becomes open.
909
+ * Pass both as `""` to make the item valid for every game version again.
910
+ * Steam applies the range only when this update also changes the item's content.
911
+ */
912
+ requiredGameVersionMin?: string
913
+ /** Newest game version (Steam branch) the item is valid for; see `requiredGameVersionMin`. */
914
+ requiredGameVersionMax?: string
906
915
  }
907
916
  export interface InstallInfo {
908
917
  folder: string
@@ -1118,6 +1127,15 @@ export declare namespace workshop {
1118
1127
  /** Type of preview (image, video, sketchfab model, etc.) */
1119
1128
  previewType: ItemPreviewType
1120
1129
  }
1130
+ /**
1131
+ * A game version (Steam branch) range a Workshop item is valid for.
1132
+ * `minBranch` / `maxBranch` are branch names such as `open_beta`. An open end is left out
1133
+ * (`undefined`): no `minBranch` starts at the earliest branch, no `maxBranch` runs through the newest.
1134
+ */
1135
+ export interface SupportedGameVersion {
1136
+ minBranch?: string
1137
+ maxBranch?: string
1138
+ }
1121
1139
  export interface WorkshopItem {
1122
1140
  publishedFileId: bigint
1123
1141
  creatorAppId?: number
@@ -1145,6 +1163,8 @@ export declare namespace workshop {
1145
1163
  children?: Array<bigint>
1146
1164
  /** Additional preview media (images, videos, etc.) for the workshop item */
1147
1165
  additionalPreviews?: Array<AdditionalPreview>
1166
+ /** Game versions (Steam branches) the item is valid for. Empty when Steam returns no range. */
1167
+ supportedGameVersions: Array<SupportedGameVersion>
1148
1168
  }
1149
1169
  export interface WorkshopPaginatedResult {
1150
1170
  items: Array<WorkshopItem | undefined | null>
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "bugs": {
15
15
  "url": "https://github.com/HagiCode-org/steamworks.js/issues"
16
16
  },
17
- "version": "0.1.6-dev.22",
17
+ "version": "0.1.6-dev.25",
18
18
  "main": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "napi": {