@hagicode/steamworks.js 0.1.6-dev.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -20
- package/client.d.ts +155 -1
- package/dist/linux64/steamworksjs.linux-x64-gnu.node +0 -0
- package/dist/osx/steamworksjs.darwin-arm64.node +0 -0
- package/dist/osx/steamworksjs.darwin-x64.node +0 -0
- package/dist/win64/steamworksjs.win32-x64-msvc.node +0 -0
- package/package.json +65 -56
package/README.md
CHANGED
|
@@ -2,22 +2,28 @@
|
|
|
2
2
|
[](https://npmjs.com/package/@hagicode/steamworks.js)
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
4
|
|
|
5
|
-
# Steamworks.js
|
|
5
|
+
# Steamworks.js (HagiCode fork)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Node.js and Electron bindings for the Steamworks SDK, maintained as a personal fork of [ceifa/steamworks.js](https://github.com/ceifa/steamworks.js).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Introduction, guides and agent skills: **https://steamworks.hagicode.com/**
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## About this fork
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
This project is a fork of the upstream [steamworks.js](https://github.com/ceifa/steamworks.js) (Node/Electron bindings) and, through the `vendor/steamworks-rs` submodule, of [steamworks-rs](https://github.com/Noxime/steamworks-rs) (the Rust bindings it is built on). The Rust side lives in [HagiCode-org/steamworks-rs](https://github.com/HagiCode-org/steamworks-rs).
|
|
14
|
+
|
|
15
|
+
It exists for my own development work, not as a general replacement for upstream. It is shaped around two needs:
|
|
16
|
+
|
|
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, 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
|
+
|
|
20
|
+
What that means in practice:
|
|
21
|
+
|
|
22
|
+
* The npm package is [`@hagicode/steamworks.js`](https://npmjs.com/package/@hagicode/steamworks.js), not the unscoped `steamworks.js`, and it is released on its own schedule.
|
|
23
|
+
* Changes follow what I need, so there is no promise of staying in step with upstream. If you want the general-purpose library, use upstream.
|
|
24
|
+
* Upstream's history is kept. All credit for the original design and implementation goes to the upstream authors, and the MIT license with the original copyright notice (Gabriel Francisco Dos Santos) is kept in [LICENSE](./LICENSE). The Steamworks SDK files bundled through `vendor/steamworks-rs` are not covered by that license and remain under Valve's terms.
|
|
25
|
+
|
|
26
|
+
Bug reports and pull requests are still welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
21
27
|
|
|
22
28
|
## API
|
|
23
29
|
|
|
@@ -38,6 +44,17 @@ if (client.achievement.activate('ACHIEVEMENT')) {
|
|
|
38
44
|
|
|
39
45
|
You can refer to the [declarations file](https://github.com/HagiCode-org/steamworks.js/blob/main/client.d.ts) to check the API support and get more detailed documentation of each function.
|
|
40
46
|
|
|
47
|
+
### Not in scope: remote_storage publish and screenshots tagging
|
|
48
|
+
|
|
49
|
+
These two parts of the SDK are deliberately not wrapped. This section records the decision and its reasons, so the question is not reopened without new facts. The public API did not change for it: `client.d.ts` has no remote_storage publish function and no screenshots tagging function.
|
|
50
|
+
|
|
51
|
+
| Feature | Decision | Checked in the code or SDK headers | Reason | Unverified |
|
|
52
|
+
| --- | --- | --- | --- | --- |
|
|
53
|
+
| `remote_storage` publish (`PublishWorkshopFile`) | Exclude | The SDK header declares `PublishWorkshopFile` with the other remote storage calls. Nothing in this repository wraps or calls it. | The UGC calls this binding already wraps (`createItem`, `updateItem`, the dependency and preview calls) cover publishing. A second publish route would need its own tests and skill. | Whether Steam still accepts this route for current accounts. |
|
|
54
|
+
| Screenshots tagging (`TagPublishedFile`) | Defer | The header declares `TagPublishedFile` on `ISteamScreenshots`. The `screenshots` namespace only hooks the screenshot hotkey. | The call needs a screenshot handle from the hooked hotkey flow. Without a use case in this repository, a wrapper would ship untested. Reopen it when a consumer needs it. | Whether a tag call succeeds and shows on the item page. It needs a running client. |
|
|
55
|
+
|
|
56
|
+
Recommendation: keep both out of the public API. When screenshots tagging is needed, start with a live check on a private test item.
|
|
57
|
+
|
|
41
58
|
## Installation
|
|
42
59
|
|
|
43
60
|
To use steamworks.js you don't have to build anything, just install it from npm:
|
|
@@ -46,9 +63,11 @@ To use steamworks.js you don't have to build anything, just install it from npm:
|
|
|
46
63
|
npm i @hagicode/steamworks.js
|
|
47
64
|
```
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
Guides and agent skills are on the documentation site at https://steamworks.hagicode.com/. To try the latest build from `main`, install the `dev` dist-tag: `npm i @hagicode/steamworks.js@dev`.
|
|
50
67
|
|
|
51
|
-
|
|
68
|
+
### Migration from upstream `steamworks.js`
|
|
69
|
+
|
|
70
|
+
If you were using the unscoped upstream `steamworks.js` package and want this fork instead, update your `package.json`:
|
|
52
71
|
|
|
53
72
|
```json
|
|
54
73
|
{
|
|
@@ -86,7 +105,7 @@ For the production build, copy the relevant distro files from `sdk/redistributab
|
|
|
86
105
|
|
|
87
106
|
## How to build
|
|
88
107
|
|
|
89
|
-
> You **only** need to build if you are going to change something on
|
|
108
|
+
> You **only** need to build if you are going to change something on this fork's code. If you just want to use the library in your game, see the [installation section](#installation).
|
|
90
109
|
|
|
91
110
|
Make sure you have the latest [node.js](https://nodejs.org/en/), [Rust](https://www.rust-lang.org/tools/install) and [Clang](https://rust-lang.github.io/rust-bindgen/requirements.html). We also need [Steam](https://store.steampowered.com/about/) installed and running.
|
|
92
111
|
|
|
@@ -108,7 +127,7 @@ git submodule update --init --recursive
|
|
|
108
127
|
|
|
109
128
|
Install dependencies with `pnpm install` and then run `pnpm run build:debug` to build the library.
|
|
110
129
|
|
|
111
|
-
There is no way to build for all targets
|
|
130
|
+
There is no easy way to build for all targets locally, and you do not need to. Develop and test on your current target. When the code is merged to `main`, a GitHub Action builds every target and publishes a `dev` build.
|
|
112
131
|
|
|
113
132
|
### Testing Electron
|
|
114
133
|
|
|
@@ -164,6 +183,35 @@ await client.workshop.updateItemContent(itemId, '/abs/path/mod-folder', appId, '
|
|
|
164
183
|
- Title, description, tags and visibility are not sent, so they stay as they are. To change them together with a file, keep using `updateItem`.
|
|
165
184
|
- Neither helper reports upload progress. For a large content upload use `updateItemWithCallback`.
|
|
166
185
|
|
|
186
|
+
### Creating items and the new update fields
|
|
187
|
+
|
|
188
|
+
`createItem(appId?, fileType?)` creates an empty item. Without `fileType` it is a `Community` item, as before. The `WorkshopFileType` values are `Community`, `Art`, `Screenshot`, `Video`, `Collection`, `WebGuide` and `IntegratedGuide`.
|
|
189
|
+
|
|
190
|
+
`updateItem` accepts these optional fields. A field left out keeps the item's current value:
|
|
191
|
+
|
|
192
|
+
- `additionalPreviewVideos`: YouTube video IDs, 11 characters each, not URLs. A malformed ID rejects with the entry named, before anything is sent. Whether Steam shows a video added this way is **unverified** until a live run.
|
|
193
|
+
- `metadata`: a developer metadata string.
|
|
194
|
+
- `keyValueTags`: `{ clear?, remove?, add? }`, applied in the order clear, remove, add. `add` takes `{ key, value }` pairs and `remove` takes keys.
|
|
195
|
+
- `contentDescriptors`: `{ remove?, add? }` of `WorkshopContentDescriptor` values, removals first. Only the five SDK values exist, so any other number is refused.
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
const steamworks = require('steamworks.js')
|
|
199
|
+
const client = steamworks.init(appId)
|
|
200
|
+
const { WorkshopFileType, WorkshopContentDescriptor } = client.workshop
|
|
201
|
+
|
|
202
|
+
const created = await client.workshop.createItem(appId, 1) // 1 = WorkshopFileType.Art
|
|
203
|
+
await client.workshop.updateItem(created.itemId, {
|
|
204
|
+
metadata: 'v2',
|
|
205
|
+
keyValueTags: { clear: true, add: [{ key: 'mode', value: 'hard' }] },
|
|
206
|
+
contentDescriptors: { add: [5] }, // 5 = WorkshopContentDescriptor.AnyMatureContent
|
|
207
|
+
additionalPreviewVideos: ['dQw4w9WgXcQ'],
|
|
208
|
+
}, appId)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- Each of these calls changes the item on Steam. Confirm the item and the change first.
|
|
212
|
+
- The typings expose no read for an item's metadata, key-value tags or content descriptors, so after a write only the Steam result code can be checked.
|
|
213
|
+
- `workshop.py upload` sends `--file-type` and the YouTube videos listed in `workshop.json`. It does not send metadata, key-value tags or content descriptors; those are steamworks.js calls only.
|
|
214
|
+
|
|
167
215
|
## Workshop Item Dependencies
|
|
168
216
|
|
|
169
217
|
A Workshop item can require another item, so Steam installs the required item along with it. `addDependency` and `removeDependency` take the parent and the child as `bigint` ids and resolve with the Steam result code. `1` means OK. Any other code is a Steam failure reason, and it arrives as a resolved number, not a rejection.
|
|
@@ -188,6 +236,60 @@ const removed = await client.workshop.removeDependency(modId, requiredId)
|
|
|
188
236
|
- Both calls need a running, logged-in Steam client, and the parent must be an item the logged-in account owns.
|
|
189
237
|
- 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.
|
|
190
238
|
|
|
239
|
+
### App dependencies
|
|
240
|
+
|
|
241
|
+
An item can also require an app, such as a DLC. `addAppDependency(itemId, appId)` and `removeAppDependency(itemId, appId)` resolve with the Steam result code, the same way as the item calls above.
|
|
242
|
+
|
|
243
|
+
`getAppDependencies(itemId)` resolves with `{ result, appIds, totalAppDependencies }`. Steam sends the list in pages of up to 32, and the binding collects them until the reported total is reached. If `appIds` is shorter than `totalAppDependencies`, the list is incomplete. The paging follows the SDK header, and it is **unverified** against a live Steam client.
|
|
244
|
+
|
|
245
|
+
## Workshop User Actions
|
|
246
|
+
|
|
247
|
+
These calls act for the logged-in user on Steam, so they change that user's state and not only the item. Each one resolves when Steam confirms it. `getUserItemVote` is the only one that reads.
|
|
248
|
+
|
|
249
|
+
```js
|
|
250
|
+
const steamworks = require('steamworks.js')
|
|
251
|
+
const client = steamworks.init(appId)
|
|
252
|
+
|
|
253
|
+
await client.workshop.setUserItemVote(itemId, true) // vote up; false votes down
|
|
254
|
+
const vote = await client.workshop.getUserItemVote(itemId) // { votedUp, votedDown, skipped }
|
|
255
|
+
|
|
256
|
+
await client.workshop.addItemToFavorites(itemId) // appId defaults to the client's app
|
|
257
|
+
await client.workshop.removeItemFromFavorites(itemId)
|
|
258
|
+
|
|
259
|
+
await client.workshop.startPlaytimeTracking([itemId]) // the list must not be empty
|
|
260
|
+
await client.workshop.stopPlaytimeTracking([itemId])
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
- Item ID 0, a negative id and an empty playtime list are refused before any Steam call.
|
|
264
|
+
- Start and stop playtime tracking in pairs. The SDK header describes these calls as tracking the user's playtime for the listed items; that behavior is **unverified** against a live client.
|
|
265
|
+
- These calls need a running, logged-in Steam client.
|
|
266
|
+
|
|
267
|
+
## Workshop Known Game Versions
|
|
268
|
+
|
|
269
|
+
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`:
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
const steamworks = require('steamworks.js')
|
|
273
|
+
const client = steamworks.init(appId)
|
|
274
|
+
|
|
275
|
+
// read: one entry per range; an open end is left out (undefined)
|
|
276
|
+
const item = await client.workshop.getItem(itemId)
|
|
277
|
+
console.log(item.supportedGameVersions) // e.g. [{ minBranch: 'open_beta', maxBranch: 'open_beta' }, { minBranch: 'public' }]
|
|
278
|
+
|
|
279
|
+
// change: valid for open_beta and every branch published after it; the content is sent in the same update
|
|
280
|
+
await client.workshop.updateItem(itemId, {
|
|
281
|
+
contentPath: '/abs/path/mod-folder',
|
|
282
|
+
requiredGameVersionMin: 'open_beta',
|
|
283
|
+
requiredGameVersionMax: '',
|
|
284
|
+
}, appId)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- `supportedGameVersions` comes with items from `getItem`, `getItems`, `getAllItems` and `getUserItems`. It is an empty list when Steam returns no range for the item.
|
|
288
|
+
- 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.
|
|
289
|
+
- Pass both as `""` to make the item valid for every game version again.
|
|
290
|
+
- 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.
|
|
291
|
+
- Changing the range needs a running, logged-in Steam client and an item the logged-in account owns.
|
|
292
|
+
|
|
191
293
|
## Workshop Multilingual Support
|
|
192
294
|
|
|
193
295
|
Steamworks.js supports localized content for Steam Workshop items. You can update the title and description for different languages using the `language` parameter.
|
|
@@ -470,9 +572,10 @@ client.cloud.setSyncPlatforms('save.json', 0 /* SyncPlatform.None */)
|
|
|
470
572
|
|
|
471
573
|
## Release Process
|
|
472
574
|
|
|
473
|
-
This
|
|
575
|
+
This fork has its own release line and publishes to npm as `@hagicode/steamworks.js`. It does not follow upstream's release numbers. Releases are automated:
|
|
474
576
|
|
|
475
|
-
- **
|
|
476
|
-
- **
|
|
577
|
+
- **Dev builds**: Every push to the `main` branch publishes a build to the npm `dev` dist-tag for testing
|
|
578
|
+
- **Release drafts**: Every push to `main` updates one draft GitHub release for the next `vX.Y.Z`, drafted by [hagi-release-drafter](https://github.com/HagiCode-org/hagi-release-drafter). It is never published automatically
|
|
579
|
+
- **Official releases**: Publish the draft in the GitHub UI. That creates the `vX.Y.Z` tag, and the tag publishes the npm `latest` version
|
|
477
580
|
|
|
478
|
-
Release notes are automatically generated from
|
|
581
|
+
Release notes are automatically generated from Conventional Commit messages. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the commit message format.
|
package/client.d.ts
CHANGED
|
@@ -890,6 +890,43 @@ export declare namespace workshop {
|
|
|
890
890
|
Private = 2,
|
|
891
891
|
Unlisted = 3
|
|
892
892
|
}
|
|
893
|
+
/** Workshop file types for `createItem`. Omitting the argument keeps `Community`. */
|
|
894
|
+
export const enum WorkshopFileType {
|
|
895
|
+
Community = 0,
|
|
896
|
+
Art = 1,
|
|
897
|
+
Screenshot = 2,
|
|
898
|
+
Video = 3,
|
|
899
|
+
Collection = 4,
|
|
900
|
+
WebGuide = 5,
|
|
901
|
+
IntegratedGuide = 6
|
|
902
|
+
}
|
|
903
|
+
/** Steam's community content descriptors. The values are the SDK's own IDs. */
|
|
904
|
+
export const enum WorkshopContentDescriptor {
|
|
905
|
+
NudityOrSexualContent = 1,
|
|
906
|
+
FrequentViolenceOrGore = 2,
|
|
907
|
+
AdultOnlySexualContent = 3,
|
|
908
|
+
GratuitousSexualContent = 4,
|
|
909
|
+
AnyMatureContent = 5
|
|
910
|
+
}
|
|
911
|
+
/** One key-value tag, stored on the item as `key=value`. */
|
|
912
|
+
export interface KeyValueTag {
|
|
913
|
+
key: string
|
|
914
|
+
value: string
|
|
915
|
+
}
|
|
916
|
+
/** Key-value tag changes. They are applied in the order clear, remove, add. */
|
|
917
|
+
export interface KeyValueTagsUpdate {
|
|
918
|
+
/** Removes every key-value tag of the item first. */
|
|
919
|
+
clear?: boolean
|
|
920
|
+
/** Keys whose values are all removed. */
|
|
921
|
+
remove?: Array<string>
|
|
922
|
+
/** Pairs added after the removals. */
|
|
923
|
+
add?: Array<KeyValueTag>
|
|
924
|
+
}
|
|
925
|
+
/** Content descriptor changes. Removals are applied before additions. */
|
|
926
|
+
export interface ContentDescriptorsUpdate {
|
|
927
|
+
remove?: Array<WorkshopContentDescriptor>
|
|
928
|
+
add?: Array<WorkshopContentDescriptor>
|
|
929
|
+
}
|
|
893
930
|
export interface UgcUpdate {
|
|
894
931
|
title?: string
|
|
895
932
|
description?: string
|
|
@@ -903,6 +940,23 @@ export declare namespace workshop {
|
|
|
903
940
|
tags?: Array<string>
|
|
904
941
|
visibility?: UgcItemVisibility
|
|
905
942
|
language?: string
|
|
943
|
+
/**
|
|
944
|
+
* Oldest game version (Steam branch, e.g. `open_beta`) the item is valid for.
|
|
945
|
+
* Set either required-version field to change the range; the unset end becomes open.
|
|
946
|
+
* Pass both as `""` to make the item valid for every game version again.
|
|
947
|
+
* Steam applies the range only when this update also changes the item's content.
|
|
948
|
+
*/
|
|
949
|
+
requiredGameVersionMin?: string
|
|
950
|
+
/** Newest game version (Steam branch) the item is valid for; see `requiredGameVersionMin`. */
|
|
951
|
+
requiredGameVersionMax?: string
|
|
952
|
+
/** YouTube video IDs (11 characters each) added as video previews. Checked before submission. */
|
|
953
|
+
additionalPreviewVideos?: Array<string>
|
|
954
|
+
/** Developer metadata set on the item. Left unchanged when omitted. */
|
|
955
|
+
metadata?: string
|
|
956
|
+
/** Key-value tag changes, applied in the order clear, remove, add. */
|
|
957
|
+
keyValueTags?: KeyValueTagsUpdate
|
|
958
|
+
/** Content descriptor changes, applied as removals then additions. */
|
|
959
|
+
contentDescriptors?: ContentDescriptorsUpdate
|
|
906
960
|
}
|
|
907
961
|
export interface InstallInfo {
|
|
908
962
|
folder: string
|
|
@@ -926,7 +980,13 @@ export declare namespace workshop {
|
|
|
926
980
|
progress: bigint
|
|
927
981
|
total: bigint
|
|
928
982
|
}
|
|
929
|
-
|
|
983
|
+
/**
|
|
984
|
+
* Creates an empty Workshop item. The file type defaults to `Community`; `Art` creates an Artwork item.
|
|
985
|
+
*
|
|
986
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
987
|
+
* @param fileType - the Workshop file type; omitted keeps `Community`
|
|
988
|
+
*/
|
|
989
|
+
export function createItem(appId?: number | undefined | null, fileType?: WorkshopFileType | undefined | null): Promise<UgcResult>
|
|
930
990
|
export function updateItem(itemId: bigint, updateDetails: UgcUpdate, appId?: number | undefined | null): Promise<UgcResult>
|
|
931
991
|
/**
|
|
932
992
|
* Replace only the main preview image of a Workshop item.
|
|
@@ -1017,6 +1077,89 @@ export declare namespace workshop {
|
|
|
1017
1077
|
* code (`1` is OK), with the same validation and rejection rules as `addDependency`.
|
|
1018
1078
|
*/
|
|
1019
1079
|
export function removeDependency(parentId: bigint, childId: bigint): Promise<number>
|
|
1080
|
+
/** The user's vote on a Workshop item, as Steam reports it. */
|
|
1081
|
+
export interface UserItemVoteState {
|
|
1082
|
+
votedUp: boolean
|
|
1083
|
+
votedDown: boolean
|
|
1084
|
+
/** The user has neither voted up nor down. */
|
|
1085
|
+
skipped: boolean
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* The app dependencies of a Workshop item. When `appIds` is shorter than
|
|
1089
|
+
* `totalAppDependencies`, the list is incomplete.
|
|
1090
|
+
*/
|
|
1091
|
+
export interface AppDependencies {
|
|
1092
|
+
/** Steam result code; `1` is OK. */
|
|
1093
|
+
result: number
|
|
1094
|
+
appIds: Array<number>
|
|
1095
|
+
totalAppDependencies: number
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Votes for (`voteUp` true) or against a Workshop item as the current user.
|
|
1099
|
+
*
|
|
1100
|
+
* **Changes the user's vote on Steam.** Resolves when Steam confirms the vote.
|
|
1101
|
+
*
|
|
1102
|
+
* @param itemId - the Workshop item
|
|
1103
|
+
* @param voteUp - true to vote up, false to vote down
|
|
1104
|
+
*/
|
|
1105
|
+
export function setUserItemVote(itemId: bigint, voteUp: boolean): Promise<void>
|
|
1106
|
+
/** Reads the current user's vote on a Workshop item. Read-only. */
|
|
1107
|
+
export function getUserItemVote(itemId: bigint): Promise<UserItemVoteState>
|
|
1108
|
+
/**
|
|
1109
|
+
* Adds a Workshop item to the current user's favorites.
|
|
1110
|
+
*
|
|
1111
|
+
* **Changes the user's favorites on Steam.**
|
|
1112
|
+
*
|
|
1113
|
+
* @param itemId - the Workshop item
|
|
1114
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1115
|
+
*/
|
|
1116
|
+
export function addItemToFavorites(itemId: bigint, appId?: number | undefined | null): Promise<void>
|
|
1117
|
+
/**
|
|
1118
|
+
* Removes a Workshop item from the current user's favorites.
|
|
1119
|
+
*
|
|
1120
|
+
* **Changes the user's favorites on Steam.**
|
|
1121
|
+
*
|
|
1122
|
+
* @param itemId - the Workshop item
|
|
1123
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1124
|
+
*/
|
|
1125
|
+
export function removeItemFromFavorites(itemId: bigint, appId?: number | undefined | null): Promise<void>
|
|
1126
|
+
/**
|
|
1127
|
+
* Starts playtime tracking for Workshop items. The list must not be empty.
|
|
1128
|
+
*
|
|
1129
|
+
* **Changes the user's playtime records on Steam.**
|
|
1130
|
+
*
|
|
1131
|
+
* @param itemIds - the Workshop items
|
|
1132
|
+
*/
|
|
1133
|
+
export function startPlaytimeTracking(itemIds: Array<bigint>): Promise<void>
|
|
1134
|
+
/**
|
|
1135
|
+
* Stops playtime tracking for Workshop items. The list must not be empty.
|
|
1136
|
+
*
|
|
1137
|
+
* **Changes the user's playtime records on Steam.**
|
|
1138
|
+
*
|
|
1139
|
+
* @param itemIds - the Workshop items
|
|
1140
|
+
*/
|
|
1141
|
+
export function stopPlaytimeTracking(itemIds: Array<bigint>): Promise<void>
|
|
1142
|
+
/**
|
|
1143
|
+
* Adds `appId` as an app dependency of a Workshop item (for example a DLC the item needs).
|
|
1144
|
+
* Resolves with the Steam result code, where `1` is OK. A non-OK code resolves rather than rejects.
|
|
1145
|
+
*
|
|
1146
|
+
* **Changes the item's remote state.**
|
|
1147
|
+
*/
|
|
1148
|
+
export function addAppDependency(itemId: bigint, appId: number): Promise<number>
|
|
1149
|
+
/**
|
|
1150
|
+
* Removes `appId` from the app dependencies of a Workshop item. Resolves with the Steam result code
|
|
1151
|
+
* (`1` is OK), with the same rules as `addAppDependency`.
|
|
1152
|
+
*
|
|
1153
|
+
* **Changes the item's remote state.**
|
|
1154
|
+
*/
|
|
1155
|
+
export function removeAppDependency(itemId: bigint, appId: number): Promise<number>
|
|
1156
|
+
/**
|
|
1157
|
+
* Reads every app dependency of a Workshop item. Steam sends them in pages; they are collected
|
|
1158
|
+
* until the reported total is reached. Read-only.
|
|
1159
|
+
*
|
|
1160
|
+
* Not verified against a live Steam client: see the paging note in steamworks-rs.
|
|
1161
|
+
*/
|
|
1162
|
+
export function getAppDependencies(itemId: bigint): Promise<AppDependencies>
|
|
1020
1163
|
export const enum UGCQueryType {
|
|
1021
1164
|
RankedByVote = 0,
|
|
1022
1165
|
RankedByPublicationDate = 1,
|
|
@@ -1118,6 +1261,15 @@ export declare namespace workshop {
|
|
|
1118
1261
|
/** Type of preview (image, video, sketchfab model, etc.) */
|
|
1119
1262
|
previewType: ItemPreviewType
|
|
1120
1263
|
}
|
|
1264
|
+
/**
|
|
1265
|
+
* A game version (Steam branch) range a Workshop item is valid for.
|
|
1266
|
+
* `minBranch` / `maxBranch` are branch names such as `open_beta`. An open end is left out
|
|
1267
|
+
* (`undefined`): no `minBranch` starts at the earliest branch, no `maxBranch` runs through the newest.
|
|
1268
|
+
*/
|
|
1269
|
+
export interface SupportedGameVersion {
|
|
1270
|
+
minBranch?: string
|
|
1271
|
+
maxBranch?: string
|
|
1272
|
+
}
|
|
1121
1273
|
export interface WorkshopItem {
|
|
1122
1274
|
publishedFileId: bigint
|
|
1123
1275
|
creatorAppId?: number
|
|
@@ -1145,6 +1297,8 @@ export declare namespace workshop {
|
|
|
1145
1297
|
children?: Array<bigint>
|
|
1146
1298
|
/** Additional preview media (images, videos, etc.) for the workshop item */
|
|
1147
1299
|
additionalPreviews?: Array<AdditionalPreview>
|
|
1300
|
+
/** Game versions (Steam branches) the item is valid for. Empty when Steam returns no range. */
|
|
1301
|
+
supportedGameVersions: Array<SupportedGameVersion>
|
|
1148
1302
|
}
|
|
1149
1303
|
export interface WorkshopPaginatedResult {
|
|
1150
1304
|
items: Array<WorkshopItem | undefined | null>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,58 +1,67 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
2
|
+
"name": "@hagicode/steamworks.js",
|
|
3
|
+
"description": "Node.js and Electron bindings for the Steamworks SDK: Steam Workshop, achievements, stats, cloud, overlay, networking.",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"steam",
|
|
6
|
+
"steamworks",
|
|
7
|
+
"steamworks-sdk",
|
|
8
|
+
"workshop",
|
|
9
|
+
"ugc",
|
|
10
|
+
"napi",
|
|
11
|
+
"electron"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/HagiCode-org/steamworks.js#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/HagiCode-org/steamworks.js/issues"
|
|
16
|
+
},
|
|
17
|
+
"version": "0.2.0",
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"types": "index.d.ts",
|
|
20
|
+
"napi": {
|
|
21
|
+
"name": "steamworksjs",
|
|
22
|
+
"triples": {
|
|
23
|
+
"additional": [
|
|
24
|
+
"x86_64-pc-windows-msvc",
|
|
25
|
+
"x86_64-unknown-linux-gnu",
|
|
26
|
+
"x86_64-apple-darwin",
|
|
27
|
+
"aarch64-apple-darwin"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist/*",
|
|
33
|
+
"index.js",
|
|
34
|
+
"*.d.ts",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@napi-rs/cli": "2.18.4",
|
|
40
|
+
"electron": "24.2.0",
|
|
41
|
+
"rimraf": "6.0.1",
|
|
42
|
+
"typescript": "5.5.3"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@types/node": "*"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">= 14"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "node build --release",
|
|
52
|
+
"build:debug": "node build",
|
|
53
|
+
"prune": "rimraf dist target client.d.ts",
|
|
54
|
+
"format": "cargo clippy --fix --allow-staged && cargo fmt",
|
|
55
|
+
"prepack": "node scripts/check-package.js",
|
|
56
|
+
"test:offline": "node test/offline-smoke-test.js",
|
|
57
|
+
"test:types": "cd test/typescript && pnpm run compile"
|
|
58
|
+
},
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "https://github.com/HagiCode-org/steamworks.js"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"packageManager": "pnpm@12.16.1"
|
|
58
67
|
}
|