@pipelab/cli 2.0.0-beta.37 → 2.0.0-beta.40

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.
Files changed (254) hide show
  1. package/LICENSE +110 -0
  2. package/assets/asset-discord/.oxfmtrc.json +9 -0
  3. package/assets/asset-discord/CHANGELOG.md +199 -0
  4. package/assets/asset-discord/package.json +16 -0
  5. package/assets/asset-discord/template/netlify.toml +3 -0
  6. package/assets/asset-discord/template/nitro.config.ts +9 -0
  7. package/assets/asset-discord/template/package.json +15 -0
  8. package/assets/asset-discord/template/pnpm-lock.yaml +3311 -0
  9. package/assets/asset-discord/template/server/api/index.ts +3 -0
  10. package/assets/asset-discord/template/server/middleware/security-header.ts +8 -0
  11. package/assets/asset-discord/template/server/public/index.html +34 -0
  12. package/assets/asset-discord/template/tsconfig.json +4 -0
  13. package/assets/asset-electron/.oxfmtrc.json +9 -0
  14. package/assets/asset-electron/CHANGELOG.md +199 -0
  15. package/assets/asset-electron/package.json +16 -0
  16. package/assets/asset-electron/template/config.cjs +45 -0
  17. package/assets/asset-electron/template/forge.config.cjs +70 -0
  18. package/assets/asset-electron/template/package.json +62 -0
  19. package/assets/asset-electron/template/pipelab-plugin.cjs +160 -0
  20. package/assets/asset-electron/template/src/custom-main.js +1 -0
  21. package/assets/asset-electron/template/src/handlers/dialog/folder.js +25 -0
  22. package/assets/asset-electron/template/src/handlers/dialog/open.js +25 -0
  23. package/assets/asset-electron/template/src/handlers/dialog/save.js +24 -0
  24. package/assets/asset-electron/template/src/handlers/discord/set-activity.js +68 -0
  25. package/assets/asset-electron/template/src/handlers/fs/copy.js +29 -0
  26. package/assets/asset-electron/template/src/handlers/fs/delete.js +23 -0
  27. package/assets/asset-electron/template/src/handlers/fs/exist.js +37 -0
  28. package/assets/asset-electron/template/src/handlers/fs/file-size.js +24 -0
  29. package/assets/asset-electron/template/src/handlers/fs/folder-create.js +25 -0
  30. package/assets/asset-electron/template/src/handlers/fs/list.js +61 -0
  31. package/assets/asset-electron/template/src/handlers/fs/move.js +30 -0
  32. package/assets/asset-electron/template/src/handlers/fs/read-binary.js +24 -0
  33. package/assets/asset-electron/template/src/handlers/fs/read.js +42 -0
  34. package/assets/asset-electron/template/src/handlers/fs/write-base64.js +32 -0
  35. package/assets/asset-electron/template/src/handlers/fs/write.js +30 -0
  36. package/assets/asset-electron/template/src/handlers/general/engine.js +17 -0
  37. package/assets/asset-electron/template/src/handlers/general/exit.js +20 -0
  38. package/assets/asset-electron/template/src/handlers/general/infos.js +23 -0
  39. package/assets/asset-electron/template/src/handlers/general/open-in-explorer.js +21 -0
  40. package/assets/asset-electron/template/src/handlers/general/open.js +21 -0
  41. package/assets/asset-electron/template/src/handlers/general/run.js +27 -0
  42. package/assets/asset-electron/template/src/handlers/steam/deleteItem.js +26 -0
  43. package/assets/asset-electron/template/src/handlers/steam/download.js +26 -0
  44. package/assets/asset-electron/template/src/handlers/steam/downloadInfo.js +26 -0
  45. package/assets/asset-electron/template/src/handlers/steam/downloadScore.js +28 -0
  46. package/assets/asset-electron/template/src/handlers/steam/getItem.js +28 -0
  47. package/assets/asset-electron/template/src/handlers/steam/getItems.js +28 -0
  48. package/assets/asset-electron/template/src/handlers/steam/installInfo.js +26 -0
  49. package/assets/asset-electron/template/src/handlers/steam/raw.js +42 -0
  50. package/assets/asset-electron/template/src/handlers/steam/saveScreenshot.js +66 -0
  51. package/assets/asset-electron/template/src/handlers/steam/state.js +26 -0
  52. package/assets/asset-electron/template/src/handlers/steam/subscribe.js +26 -0
  53. package/assets/asset-electron/template/src/handlers/steam/unsubscribe.js +26 -0
  54. package/assets/asset-electron/template/src/handlers/steam/updateItem.js +26 -0
  55. package/assets/asset-electron/template/src/handlers/steam/uploadScore.js +27 -0
  56. package/assets/asset-electron/template/src/handlers/steam/utils.js +78 -0
  57. package/assets/asset-electron/template/src/handlers/user/folder.js +80 -0
  58. package/assets/asset-electron/template/src/handlers/user/save-data-folder.js +31 -0
  59. package/assets/asset-electron/template/src/handlers/window/maximize.js +20 -0
  60. package/assets/asset-electron/template/src/handlers/window/minimize.js +20 -0
  61. package/assets/asset-electron/template/src/handlers/window/request-attention.js +20 -0
  62. package/assets/asset-electron/template/src/handlers/window/restore.js +20 -0
  63. package/assets/asset-electron/template/src/handlers/window/set-always-on-top.js +20 -0
  64. package/assets/asset-electron/template/src/handlers/window/set-fullscreen.js +26 -0
  65. package/assets/asset-electron/template/src/handlers/window/set-height.js +21 -0
  66. package/assets/asset-electron/template/src/handlers/window/set-ignore-mouse-events.js +22 -0
  67. package/assets/asset-electron/template/src/handlers/window/set-maximum-size.js +20 -0
  68. package/assets/asset-electron/template/src/handlers/window/set-minimum-size.js +20 -0
  69. package/assets/asset-electron/template/src/handlers/window/set-resizable.js +20 -0
  70. package/assets/asset-electron/template/src/handlers/window/set-title.js +20 -0
  71. package/assets/asset-electron/template/src/handlers/window/set-width.js +21 -0
  72. package/assets/asset-electron/template/src/handlers/window/set-x.js +21 -0
  73. package/assets/asset-electron/template/src/handlers/window/set-y.js +21 -0
  74. package/assets/asset-electron/template/src/handlers/window/show-dev-tools.js +24 -0
  75. package/assets/asset-electron/template/src/handlers/window/unmaximize.js +20 -0
  76. package/assets/asset-electron/template/src/index.js +958 -0
  77. package/assets/asset-electron/template/src/preload.js +27 -0
  78. package/assets/asset-electron/template/src/utils.js +18 -0
  79. package/assets/asset-netlify/.oxfmtrc.json +9 -0
  80. package/assets/asset-netlify/CHANGELOG.md +199 -0
  81. package/assets/asset-netlify/package.json +16 -0
  82. package/assets/asset-netlify/template/netlify.toml +3 -0
  83. package/assets/asset-netlify/template/package.json +9 -0
  84. package/assets/asset-netlify/template/pnpm-lock.yaml +8150 -0
  85. package/assets/asset-netlify/template/pnpm-workspace.yaml +6 -0
  86. package/assets/asset-tauri/.oxfmtrc.json +9 -0
  87. package/assets/asset-tauri/CHANGELOG.md +199 -0
  88. package/assets/asset-tauri/package.json +16 -0
  89. package/assets/asset-tauri/template/README.md +7 -0
  90. package/assets/asset-tauri/template/index.html +45 -0
  91. package/assets/asset-tauri/template/package.json +23 -0
  92. package/assets/asset-tauri/template/pnpm-lock.yaml +715 -0
  93. package/assets/asset-tauri/template/src-tauri/Cargo.lock +11191 -0
  94. package/assets/asset-tauri/template/src-tauri/Cargo.toml +40 -0
  95. package/assets/asset-tauri/template/src-tauri/build.rs +3 -0
  96. package/assets/asset-tauri/template/src-tauri/capabilities/default.json +7 -0
  97. package/assets/asset-tauri/template/src-tauri/icons/128x128.png +0 -0
  98. package/assets/asset-tauri/template/src-tauri/icons/128x128@2x.png +0 -0
  99. package/assets/asset-tauri/template/src-tauri/icons/32x32.png +0 -0
  100. package/assets/asset-tauri/template/src-tauri/icons/Square107x107Logo.png +0 -0
  101. package/assets/asset-tauri/template/src-tauri/icons/Square142x142Logo.png +0 -0
  102. package/assets/asset-tauri/template/src-tauri/icons/Square150x150Logo.png +0 -0
  103. package/assets/asset-tauri/template/src-tauri/icons/Square284x284Logo.png +0 -0
  104. package/assets/asset-tauri/template/src-tauri/icons/Square30x30Logo.png +0 -0
  105. package/assets/asset-tauri/template/src-tauri/icons/Square310x310Logo.png +0 -0
  106. package/assets/asset-tauri/template/src-tauri/icons/Square44x44Logo.png +0 -0
  107. package/assets/asset-tauri/template/src-tauri/icons/Square71x71Logo.png +0 -0
  108. package/assets/asset-tauri/template/src-tauri/icons/Square89x89Logo.png +0 -0
  109. package/assets/asset-tauri/template/src-tauri/icons/StoreLogo.png +0 -0
  110. package/assets/asset-tauri/template/src-tauri/icons/icon.icns +0 -0
  111. package/assets/asset-tauri/template/src-tauri/icons/icon.ico +0 -0
  112. package/assets/asset-tauri/template/src-tauri/icons/icon.png +0 -0
  113. package/assets/asset-tauri/template/src-tauri/src/lib copy 2.rs +438 -0
  114. package/assets/asset-tauri/template/src-tauri/src/lib copy.rs +449 -0
  115. package/assets/asset-tauri/template/src-tauri/src/lib.rs +616 -0
  116. package/assets/asset-tauri/template/src-tauri/src/lib_webview_screenshot.rs +430 -0
  117. package/assets/asset-tauri/template/src-tauri/src/main.rs +6 -0
  118. package/assets/asset-tauri/template/src-tauri/tauri.conf.json +36 -0
  119. package/assets/asset-tauri/template/tsconfig.json +23 -0
  120. package/bundled-cli-DjHJDJJv.mjs +236 -0
  121. package/cli-truncate-BY7ddxg2.mjs +105 -0
  122. package/index.mjs +10050 -76797
  123. package/keyring-BxpluaPo.mjs +498 -0
  124. package/log-update-B6PDNCEp.mjs +369 -0
  125. package/mjs-DqOON7ud.mjs +200 -0
  126. package/package.json +6 -14
  127. package/remote-B_ZFvW4p.mjs +4 -0
  128. package/slice-ansi-Vm1FkQh1.mjs +699 -0
  129. package/src-BIhqbSQ8.mjs +296410 -0
  130. package/string-width-C6RIB1An.mjs +964 -0
  131. package/ui/_headers +3 -0
  132. package/ui/_redirects +1 -0
  133. package/ui/assets/AuthDialog-BtwoFyO3.css +1 -0
  134. package/ui/assets/AuthDialog-DNe8w1lM.js +1 -0
  135. package/ui/assets/DevBenefitsOverride-BxPg6f56.js +1 -0
  136. package/ui/assets/DevBenefitsOverride-ByXhgsQn.css +1 -0
  137. package/ui/assets/MigrationModal-CyZCJxcO.css +1 -0
  138. package/ui/assets/MigrationModal-DuJQALyS.js +1 -0
  139. package/ui/assets/ReleaseFieldControl-BCSpnqrN.css +1 -0
  140. package/ui/assets/ReleaseFieldControl-C82U_9_V.js +1 -0
  141. package/ui/assets/ReleaseFlowWizard-CWyQIs7Y.js +197 -0
  142. package/ui/assets/ReleaseFlowWizard-cLpsiFgk.css +1 -0
  143. package/ui/assets/ReleaseStatus-CicR7pJh.js +1 -0
  144. package/ui/assets/ReleaseStatus-Gl5TNh_D.css +1 -0
  145. package/ui/assets/Settings-BYZJtOCz.css +1 -0
  146. package/ui/assets/Settings-DtwQpUBq.js +1 -0
  147. package/ui/assets/UpgradeDialog-BYlS8EsD.js +1 -0
  148. package/ui/assets/UpgradeDialog-DlzV1p2-.js +1 -0
  149. package/ui/assets/UpgradeDialog-Dr6O-c7N.css +1 -0
  150. package/ui/assets/WebFilePicker-ByD9A5hx.css +1 -0
  151. package/ui/assets/WebFilePicker-CuKyjLIb.js +908 -0
  152. package/ui/assets/WorkflowLayout-Crxbk85s.css +1 -0
  153. package/ui/assets/WorkflowLayout-D0Ov4Xa8.js +2 -0
  154. package/ui/assets/WorkflowRunsSwitch-CCKOmbG6.js +1 -0
  155. package/ui/assets/WorkflowRunsSwitch-YcaC-oCZ.css +1 -0
  156. package/ui/assets/_plugin-vue_export-helper-B--CGESJ.js +1 -0
  157. package/ui/assets/angleright-hUImis5P.js +2 -0
  158. package/ui/assets/api-BX52XN_e.js +44 -0
  159. package/ui/assets/app-C1OvZt-G.js +1 -0
  160. package/ui/assets/auth-B3aQodZi.js +3 -0
  161. package/ui/assets/auth-callback-6dScvj-R.js +1 -0
  162. package/ui/assets/auth-callback-C4vBx2WT.css +1 -0
  163. package/ui/assets/basedirective-DjIYocfS.js +146 -0
  164. package/ui/assets/baseinput-JV9lcSVG.js +1 -0
  165. package/ui/assets/browser-preferences-Buru6Hxa.js +1 -0
  166. package/ui/assets/check-BQAjnzRN.js +2 -0
  167. package/ui/assets/checkbox-CuuOMj4F.js +142 -0
  168. package/ui/assets/chunk-DHx0Hwia.js +1 -0
  169. package/ui/assets/cloud-files-DBd9hI7f.js +1 -0
  170. package/ui/assets/cloud-files-xAs7g-II.css +1 -0
  171. package/ui/assets/confirmdialog-jKXl-kz8.js +14 -0
  172. package/ui/assets/connection-field-values-CBJW3ufH.js +1 -0
  173. package/ui/assets/connections-BBvA9VDf.js +1 -0
  174. package/ui/assets/connections-Dik13UKq.js +1 -0
  175. package/ui/assets/connections-DxatVovS.css +1 -0
  176. package/ui/assets/dialog-CXRKrOM1.js +107 -0
  177. package/ui/assets/elk.bundled-7Ebuml0l.js +26 -0
  178. package/ui/assets/emscripten-module-NWak2PoB.wasm +0 -0
  179. package/ui/assets/files-ZzBNjFOp.js +1 -0
  180. package/ui/assets/icon-DHXUE_zQ.js +1 -0
  181. package/ui/assets/index-C6DeXXbV.css +1 -0
  182. package/ui/assets/index-kScFpWKQ.js +4 -0
  183. package/ui/assets/injection-keys-Bz1jHw01.js +1 -0
  184. package/ui/assets/inputicon-BJrePlxQ.js +46 -0
  185. package/ui/assets/inputnumber-Bt-PASzE.js +196 -0
  186. package/ui/assets/inputtext-DHWEihg1.js +79 -0
  187. package/ui/assets/materialdesignicons-webfont-Dp5v-WZN.woff2 +0 -0
  188. package/ui/assets/menu-DB60wagr.js +84 -0
  189. package/ui/assets/message-Mk5F59sg.js +316 -0
  190. package/ui/assets/overlayeventbus-C3oPS1-i.js +1 -0
  191. package/ui/assets/pages-ClErrWgI.css +1 -0
  192. package/ui/assets/pages-CqoFIMuz.js +1 -0
  193. package/ui/assets/password-Bj8UHZbm.js +101 -0
  194. package/ui/assets/preload-helper-DzyYoeor.js +1 -0
  195. package/ui/assets/primeicons-C6QP2o4f.woff2 +0 -0
  196. package/ui/assets/provider-icons-CRPH84vX.js +1 -0
  197. package/ui/assets/release-flow-BFMuiCQ8.css +1 -0
  198. package/ui/assets/release-flow-CwysHAJg.js +1 -0
  199. package/ui/assets/release-flow-ZM2ABjtG.js +198 -0
  200. package/ui/assets/release-flow-model-zLYGJX9f.js +1 -0
  201. package/ui/assets/run-detail-CIxnF_YO.css +1 -0
  202. package/ui/assets/run-detail-DLIEwsXS.js +1 -0
  203. package/ui/assets/run-events-BmuCa9Gf.js +1 -0
  204. package/ui/assets/run-notifications-DH6BOKUo.js +1 -0
  205. package/ui/assets/select-CFadtOMk.js +316 -0
  206. package/ui/assets/settings-o1fcf6h3.js +1 -0
  207. package/ui/assets/tag-pu2jwaEM.js +54 -0
  208. package/ui/assets/team-BsRT_XMD.js +1 -0
  209. package/ui/assets/team-Q70fm3JV.css +1 -0
  210. package/ui/assets/textarea-DJMLplRb.js +84 -0
  211. package/ui/assets/times-C0gJ32fl.js +783 -0
  212. package/ui/assets/timescircle-BVgZMVXP.js +2 -0
  213. package/ui/assets/toast-CkRP_4uf.js +280 -0
  214. package/ui/assets/toggleswitch-DEJHf-X3.js +115 -0
  215. package/ui/assets/tooltip-D8yj-VBZ.js +62 -0
  216. package/ui/assets/ui-runtime-DU4LyHJc.js +1 -0
  217. package/ui/assets/useAgentAvailability-BINIZn07.js +1 -0
  218. package/ui/assets/useConfig-PpjtIN5w.js +1 -0
  219. package/ui/assets/useRouteReadiness-D3cPCIxt.js +1 -0
  220. package/ui/assets/useWorkflowDocument-C-kddkTH.js +1 -0
  221. package/ui/assets/useconfirm-BqzkTI4f.js +1 -0
  222. package/ui/assets/usetoast-Ov60sYtn.js +1 -0
  223. package/ui/assets/utils-Du1R6010.js +2 -0
  224. package/ui/assets/vue-i18n-4ORAgZhy.js +3 -0
  225. package/ui/assets/vue-router-n82eHMqB.js +1 -0
  226. package/ui/assets/workflow-artifacts-Bora9DWu.js +1 -0
  227. package/ui/assets/workflow-artifacts-CIp1eVVV.css +1 -0
  228. package/ui/assets/workflow-builds-CA3nFuXD.js +304 -0
  229. package/ui/assets/workflow-builds-CsaAvz42.css +1 -0
  230. package/ui/assets/workflow-header-state-Be-Qx5eP.js +1 -0
  231. package/ui/assets/workflow-load-state-CX4ZXkU-.js +1 -0
  232. package/ui/assets/workflow-plan-CsmYsbCx.js +27 -0
  233. package/ui/assets/workflow-plan-GqjsnfT3.css +1 -0
  234. package/ui/assets/workflow-runs-C1w1nkph.css +1 -0
  235. package/ui/assets/workflow-runs-D9Mkb510.js +1 -0
  236. package/ui/assets/workflow-settings-GlytqFO7.css +1 -0
  237. package/ui/assets/workflow-settings-sOU0eeiX.js +1 -0
  238. package/ui/assets/workflows-C-_gp-iL.css +1 -0
  239. package/ui/assets/workflows-Cl6-J3Zn.js +52 -0
  240. package/ui/assets/zindex-Bxg6aFb7.js +1 -0
  241. package/ui/icon.png +0 -0
  242. package/ui/index.html +280 -0
  243. package/wrap-ansi-Bo1ooDW0.mjs +453 -0
  244. package/chunk-JTKJZQYV-CYfgezxc.mjs +0 -1151
  245. package/config-BiWs1Yas.mjs +0 -4
  246. package/config-NkNuuChQ.mjs +0 -40439
  247. package/dist-BC_B45iu.mjs +0 -17054
  248. package/emscripten-module-VHMWRAJ2-Jdkq656T.mjs +0 -372
  249. package/ffi-DpuJHCem.mjs +0 -142
  250. package/module-6F3E5H7Y-DS2ftHS3.mjs +0 -2
  251. package/src-DWDTyjEY.mjs +0 -5
  252. package/src-DeMtUa5W.mjs +0 -3
  253. package/src-WvjC0MqI.mjs +0 -32387
  254. /package/{p-map-BsbQZn5E.mjs → p-map-BUuI5TlX.mjs} +0 -0
@@ -0,0 +1,28 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ // * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
4
+ /**
5
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
6
+ * @param {import('ws').WebSocket} ws
7
+ * @param {import('@pipelab/steamworks.js').Client} client
8
+ */
9
+ export default async (json, ws, client) => {
10
+ await handleSteamRequest(client, json, ws, async (client, json) => {
11
+ const { body } = json;
12
+ const { name, type, start, end } = body;
13
+
14
+ const leaderboard = await client.leaderboards.findLeaderboard(name);
15
+ /** @type {Awaited<ReturnType<leaderboards['downloadScores']>>} */
16
+ const result = await client.leaderboards.downloadScores(leaderboard, type, start, end);
17
+
18
+ // Enhance each result with the Steam friend name
19
+ const enhancedResult = await Promise.all(
20
+ result.map(async (entry) => ({
21
+ ...entry,
22
+ name: await client.friends.getFriendName(entry.steamId),
23
+ })),
24
+ );
25
+
26
+ return enhancedResult;
27
+ });
28
+ };
@@ -0,0 +1,28 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop get item logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The item result
8
+ */
9
+ const getItemHandler = async (client, json) => {
10
+ const { itemId } = json.body;
11
+
12
+ // Convert itemId from string to BigInt
13
+ const itemIdBigInt = BigInt(itemId);
14
+
15
+ // TODO: Handle queryConfig parameter when needed
16
+ const result = await client.workshop.getItem(itemIdBigInt);
17
+
18
+ return result;
19
+ };
20
+
21
+ /**
22
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
23
+ * @param {import('ws').WebSocket} ws
24
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
25
+ */
26
+ export default async (json, ws, client) => {
27
+ await handleSteamRequest(client, json, ws, getItemHandler);
28
+ };
@@ -0,0 +1,28 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop get items logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The items result
8
+ */
9
+ const getItemsHandler = async (client, json) => {
10
+ const { itemIds } = json.body;
11
+
12
+ // Convert array of string itemIds to array of BigInts
13
+ const itemIdsBigInt = itemIds.map((id) => BigInt(id));
14
+
15
+ // TODO: Handle queryConfig parameter when needed
16
+ const result = await client.workshop.getItems(itemIdsBigInt);
17
+
18
+ return result;
19
+ };
20
+
21
+ /**
22
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
23
+ * @param {import('ws').WebSocket} ws
24
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
25
+ */
26
+ export default async (json, ws, client) => {
27
+ await handleSteamRequest(client, json, ws, getItemsHandler);
28
+ };
@@ -0,0 +1,26 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop install info logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The install info result
8
+ */
9
+ const installInfoHandler = async (client, json) => {
10
+ const { itemId } = json.body;
11
+
12
+ const itemIdBigInt = BigInt(itemId);
13
+
14
+ const result = client.workshop.installInfo(itemIdBigInt);
15
+
16
+ return result;
17
+ };
18
+
19
+ /**
20
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
21
+ * @param {import('ws').WebSocket} ws
22
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
23
+ */
24
+ export default async (json, ws, client) => {
25
+ await handleSteamRequest(client, json, ws, installInfoHandler);
26
+ };
@@ -0,0 +1,42 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
5
+ * @param {import('ws').WebSocket} ws
6
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
7
+ */
8
+ export default async (json, ws, client) => {
9
+ console.log("json", json);
10
+
11
+ await handleSteamRequest(
12
+ client,
13
+ json,
14
+ ws,
15
+ async (client, json) => {
16
+ const { body } = json;
17
+ const { args, method, namespace } = body;
18
+
19
+ const result = await client[namespace][method](...args);
20
+
21
+ // if (namespace === 'localplayer' && method === 'getSteamId') {
22
+ // console.log('result', result)
23
+ // // handle bigint to string
24
+ // /**
25
+ // * @type {{
26
+ // steamId64: bigint,
27
+ // steamId32: string,
28
+ // accountId: number
29
+ // }}
30
+ // */
31
+ // result = {
32
+ // steamId64: result.steamId64.toString(),
33
+ // steamId32: result.steamId32,
34
+ // accountId: result.accountId
35
+ // }
36
+ // }
37
+
38
+ return result;
39
+ },
40
+ true,
41
+ );
42
+ };
@@ -0,0 +1,66 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+ import { writeFileSync, unlinkSync, mkdirSync, rmdirSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { tmpdir } from "node:os";
5
+ import { randomUUID } from "node:crypto";
6
+
7
+ /**
8
+ * Save screenshot from base64 data URL to Steam library
9
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
10
+ * @param {Object} json
11
+ * @returns {Promise<number>} The screenshot handle
12
+ */
13
+ const saveScreenshotHandler = async (client, json) => {
14
+ const { body } = json;
15
+ const { dataUrl, width, height } = body;
16
+
17
+ // Validate input
18
+ if (!dataUrl || typeof dataUrl !== "string") {
19
+ throw new Error("dataUrl is required and must be a string");
20
+ }
21
+
22
+ if (!dataUrl.startsWith("data:image/")) {
23
+ throw new Error("dataUrl must be a base64 data URL (data:image/...)");
24
+ }
25
+
26
+ // Extract base64 data
27
+ const matches = dataUrl.match(/^data:image\/(\w+);base64,(.+)$/);
28
+ if (!matches) {
29
+ throw new Error("Invalid base64 data URL format");
30
+ }
31
+
32
+ const [, format, base64Data] = matches;
33
+ const buffer = Buffer.from(base64Data, "base64");
34
+
35
+ // Create temp file
36
+ const tempDir = join(tmpdir(), "pipelab-screenshots");
37
+ mkdirSync(tempDir, { recursive: true });
38
+ const tempPath = join(tempDir, `screenshot-${randomUUID()}.${format}`);
39
+
40
+ // Write to temp file
41
+ writeFileSync(tempPath, buffer);
42
+
43
+ // Add to Steam library
44
+ const handle = client.screenshots.addScreenshotToLibrary(tempPath, null, width, height);
45
+
46
+ // Delete temp file after a delay to allow Steam to process it
47
+ setTimeout(() => {
48
+ try {
49
+ unlinkSync(tempPath);
50
+ rmdirSync(tempDir);
51
+ } catch {
52
+ // Ignore cleanup errors
53
+ }
54
+ }, 5000);
55
+
56
+ return handle;
57
+ };
58
+
59
+ /**
60
+ * @param {Object} json
61
+ * @param {import('ws').WebSocket} ws
62
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
63
+ */
64
+ export default async (json, ws, client) => {
65
+ await handleSteamRequest(client, json, ws, saveScreenshotHandler);
66
+ };
@@ -0,0 +1,26 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop state logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The state result
8
+ */
9
+ const stateHandler = async (client, json) => {
10
+ const { itemId } = json.body;
11
+
12
+ const itemIdBigInt = BigInt(itemId);
13
+
14
+ const result = client.workshop.state(itemIdBigInt);
15
+
16
+ return result;
17
+ };
18
+
19
+ /**
20
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
21
+ * @param {import('ws').WebSocket} ws
22
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
23
+ */
24
+ export default async (json, ws, client) => {
25
+ await handleSteamRequest(client, json, ws, stateHandler);
26
+ };
@@ -0,0 +1,26 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop subscribe logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The subscribe result
8
+ */
9
+ const subscribeHandler = async (client, json) => {
10
+ const { itemId } = json.body;
11
+
12
+ const itemIdBigInt = BigInt(itemId);
13
+
14
+ const result = await client.workshop.subscribe(itemIdBigInt);
15
+
16
+ return result;
17
+ };
18
+
19
+ /**
20
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
21
+ * @param {import('ws').WebSocket} ws
22
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
23
+ */
24
+ export default async (json, ws, client) => {
25
+ await handleSteamRequest(client, json, ws, subscribeHandler);
26
+ };
@@ -0,0 +1,26 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop unsubscribe logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The unsubscribe result
8
+ */
9
+ const unsubscribeHandler = async (client, json) => {
10
+ const { itemId } = json.body;
11
+
12
+ const itemIdBigInt = BigInt(itemId);
13
+
14
+ const result = await client.workshop.unsubscribe(itemIdBigInt);
15
+
16
+ return result;
17
+ };
18
+
19
+ /**
20
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
21
+ * @param {import('ws').WebSocket} ws
22
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
23
+ */
24
+ export default async (json, ws, client) => {
25
+ await handleSteamRequest(client, json, ws, unsubscribeHandler);
26
+ };
@@ -0,0 +1,26 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam workshop update item logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The update result
8
+ */
9
+ const updateItemHandler = async (client, json) => {
10
+ const { itemId, updateDetails, appID } = json.body;
11
+
12
+ const itemIdBigInt = BigInt(itemId);
13
+
14
+ const result = await client.workshop.updateItem(itemIdBigInt, updateDetails, appID);
15
+
16
+ return result;
17
+ };
18
+
19
+ /**
20
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
21
+ * @param {import('ws').WebSocket} ws
22
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
23
+ */
24
+ export default async (json, ws, client) => {
25
+ await handleSteamRequest(client, json, ws, updateItemHandler);
26
+ };
@@ -0,0 +1,27 @@
1
+ import { handleSteamRequest } from "./utils.js";
2
+
3
+ /**
4
+ * Core Steam leaderboard upload logic
5
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
6
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
7
+ * @returns {Promise<any>} The upload result
8
+ */
9
+ const uploadScoreHandler = async (client, json) => {
10
+ const { body } = json;
11
+ const { name, score, type, metadata } = body;
12
+
13
+ const leaderboard = await client.leaderboards.findLeaderboard(name);
14
+
15
+ const result = await client.leaderboards.uploadScore(leaderboard, score, type, metadata);
16
+
17
+ return result;
18
+ };
19
+
20
+ /**
21
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw, 'input'>} json
22
+ * @param {import('ws').WebSocket} ws
23
+ * @param {Omit<import('@pipelab/steamworks.js').Client, "init" | "runCallbacks">} client
24
+ */
25
+ export default async (json, ws, client) => {
26
+ await handleSteamRequest(client, json, ws, uploadScoreHandler);
27
+ };
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Checks if the Steam client is available and properly initialized
3
+ * @param {Object} client - The Steam client instance to check
4
+ * @returns {Object|null} Returns an error object if client is not available, null if available
5
+ */
6
+ function checkSteamClient(client) {
7
+ if (client === undefined || client === null) {
8
+ return {
9
+ success: false,
10
+ error: "Steam client is not initialized or available",
11
+ };
12
+ }
13
+
14
+ return null;
15
+ }
16
+
17
+ /**
18
+ * Enhanced Steam request handler that combines client validation with response formatting
19
+ * @param {import('@pipelab/steamworks.js').Client} client - The Steam client instance
20
+ * @param {Object} json - The JSON request object containing url, correlationId, and body
21
+ * @param {import('ws').WebSocket} ws - The WebSocket connection
22
+ * @param {Function} handlerFunction - The handler function to execute if client is valid
23
+ * @param {boolean} useRawErrorFormat - Whether to use raw error format (default: false)
24
+ * @returns {Promise<void>} A promise that resolves when the request is handled
25
+ */
26
+ function handleSteamRequest(client, json, ws, handlerFunction, useRawErrorFormat = false) {
27
+ // Check if Steam client is initialized
28
+ const clientError = checkSteamClient(client);
29
+ if (clientError) {
30
+ const errorResult = {
31
+ url: json.url,
32
+ correlationId: json.correlationId,
33
+ body: useRawErrorFormat
34
+ ? {
35
+ data: null,
36
+ success: false,
37
+ error: clientError.error,
38
+ }
39
+ : clientError,
40
+ };
41
+ ws.send(JSON.stringify(errorResult));
42
+ return Promise.resolve();
43
+ }
44
+
45
+ // Execute the handler function and format the response
46
+ return Promise.resolve(handlerFunction(client, json))
47
+ .then((result) => {
48
+ const steamResult = {
49
+ url: json.url,
50
+ correlationId: json.correlationId,
51
+ body: {
52
+ data: result,
53
+ success: true,
54
+ },
55
+ };
56
+ ws.send(JSON.stringify(steamResult, (_, v) => (typeof v === "bigint" ? v.toString() : v)));
57
+ })
58
+ .catch((error) => {
59
+ console.error("Error in Steam handler:", error);
60
+ const errorResult = {
61
+ url: json.url,
62
+ correlationId: json.correlationId,
63
+ body: useRawErrorFormat
64
+ ? {
65
+ data: null,
66
+ success: false,
67
+ error: error.message || "Unknown error occurred",
68
+ }
69
+ : {
70
+ success: false,
71
+ error: error.message || "Unknown error occurred",
72
+ },
73
+ };
74
+ ws.send(JSON.stringify(errorResult));
75
+ });
76
+ }
77
+
78
+ export { checkSteamClient, handleSteamRequest };
@@ -0,0 +1,80 @@
1
+ // @ts-check
2
+
3
+ import { app } from "electron";
4
+ import { join } from "path";
5
+
6
+ import slash from "slash";
7
+ import { getAppName } from "../../utils.js";
8
+ import { resolveSaveDataFolder } from "./save-data-folder.js";
9
+
10
+ /**
11
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'input'>} json
12
+ * @param {import('ws').WebSocket} ws
13
+ * @param {ElectronAppConfig.Config} config
14
+ */
15
+ export default (json, ws, config) => {
16
+ try {
17
+ const name = json.body.name;
18
+
19
+ let folder;
20
+
21
+ const { env } = process;
22
+ // windows linux
23
+ const { APPDATA, LOCALAPPDATA, XDG_DATA_HOME, XDG_CONFIG_HOME } = env;
24
+ const appDataBackup = app.getPath("appData");
25
+ const localAppData = LOCALAPPDATA ?? XDG_DATA_HOME ?? appDataBackup;
26
+ const appData = APPDATA ?? XDG_CONFIG_HOME ?? appDataBackup;
27
+
28
+ const appNameFolder = getAppName(config);
29
+
30
+ const localUserData = join(localAppData, appNameFolder);
31
+ const userData = join(appData, appNameFolder);
32
+
33
+ if (name === "app") {
34
+ folder = app.getAppPath();
35
+ } else if (name === "project") {
36
+ folder = join(app.getAppPath(), "src", "app"); // path to construct files
37
+ } else if (name === "localAppData") {
38
+ folder = localAppData;
39
+ } else if (name === "localUserData") {
40
+ folder = localUserData;
41
+ } else if (name === "saveData") {
42
+ folder = resolveSaveDataFolder({
43
+ platform: process.platform,
44
+ env,
45
+ homePath: app.getPath("home"),
46
+ appDataPath: appDataBackup,
47
+ appNameFolder,
48
+ });
49
+ } else if (name === "userData") {
50
+ folder = userData;
51
+ } else {
52
+ folder = app.getPath(name);
53
+ }
54
+
55
+ /**
56
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'output'>}
57
+ */
58
+ const userFolderResult = {
59
+ url: json.url,
60
+ correlationId: json.correlationId,
61
+ body: {
62
+ data: slash(folder),
63
+ },
64
+ };
65
+ ws.send(JSON.stringify(userFolderResult));
66
+ } catch (e) {
67
+ console.error("e", e);
68
+ /**
69
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'output'>}
70
+ */
71
+ const userFolderResult = {
72
+ url: json.url,
73
+ correlationId: json.correlationId,
74
+ body: {
75
+ error: e.message,
76
+ },
77
+ };
78
+ ws.send(JSON.stringify(userFolderResult));
79
+ }
80
+ };
@@ -0,0 +1,31 @@
1
+ import path from "node:path";
2
+
3
+ /**
4
+ * @param {{ platform: NodeJS.Platform, env: NodeJS.ProcessEnv, homePath: string, appDataPath: string, appNameFolder: string, pathUtils?: Pick<typeof path, "isAbsolute" | "join"> }} options
5
+ */
6
+ export function resolveSaveDataFolder({
7
+ platform,
8
+ env,
9
+ homePath,
10
+ appDataPath,
11
+ appNameFolder,
12
+ pathUtils = path,
13
+ }) {
14
+ let basePath;
15
+
16
+ if (platform === "win32") {
17
+ const localAppData = env.LOCALAPPDATA;
18
+ basePath = localAppData && pathUtils.isAbsolute(localAppData)
19
+ ? localAppData
20
+ : pathUtils.join(homePath, "AppData", "Local");
21
+ } else if (platform === "linux") {
22
+ const xdgDataHome = env.XDG_DATA_HOME;
23
+ basePath = xdgDataHome && pathUtils.isAbsolute(xdgDataHome)
24
+ ? xdgDataHome
25
+ : pathUtils.join(homePath, ".local", "share");
26
+ } else {
27
+ basePath = appDataPath;
28
+ }
29
+
30
+ return pathUtils.join(basePath, appNameFolder);
31
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageWindowMaximize, 'input'>} json
3
+ * @param {import('ws').WebSocket} ws
4
+ * @param {import('electron').BrowserWindow} mainWindow
5
+ */
6
+ export default async (json, ws, mainWindow) => {
7
+ mainWindow.maximize();
8
+
9
+ /**
10
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageWindowMaximize, 'output'>}
11
+ */
12
+ const maximizeResult = {
13
+ correlationId: json.correlationId,
14
+ url: json.url,
15
+ body: {
16
+ success: true,
17
+ },
18
+ };
19
+ ws.send(JSON.stringify(maximizeResult));
20
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageWindowMinimize, 'input'>} json
3
+ * @param {import('ws').WebSocket} ws
4
+ * @param {import('electron').BrowserWindow} mainWindow
5
+ */
6
+ export default async (json, ws, mainWindow) => {
7
+ mainWindow.minimize();
8
+
9
+ /**
10
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageWindowMinimize, 'output'>}
11
+ */
12
+ const minimizeResult = {
13
+ correlationId: json.correlationId,
14
+ url: json.url,
15
+ body: {
16
+ success: true,
17
+ },
18
+ };
19
+ ws.send(JSON.stringify(minimizeResult));
20
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageRequestAttention, 'input'>} json
3
+ * @param {import('ws').WebSocket} ws
4
+ * @param {import('electron').BrowserWindow} mainWindow
5
+ */
6
+ export default async (json, ws, mainWindow) => {
7
+ mainWindow.flashFrame(true);
8
+
9
+ /**
10
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageRequestAttention, 'output'>}
11
+ */
12
+ const requestAttentionResult = {
13
+ correlationId: json.correlationId,
14
+ url: json.url,
15
+ body: {
16
+ success: true,
17
+ },
18
+ };
19
+ ws.send(JSON.stringify(requestAttentionResult));
20
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageWindowRestore, 'input'>} json
3
+ * @param {import('ws').WebSocket} ws
4
+ * @param {import('electron').BrowserWindow} mainWindow
5
+ */
6
+ export default async (json, ws, mainWindow) => {
7
+ mainWindow.restore();
8
+
9
+ /**
10
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageWindowRestore, 'output'>}
11
+ */
12
+ const restoreResult = {
13
+ correlationId: json.correlationId,
14
+ url: json.url,
15
+ body: {
16
+ success: true,
17
+ },
18
+ };
19
+ ws.send(JSON.stringify(restoreResult));
20
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageSetAlwaysOnTop, 'input'>} json
3
+ * @param {import('ws').WebSocket} ws
4
+ * @param {import('electron').BrowserWindow} mainWindow
5
+ */
6
+ export default async (json, ws, mainWindow) => {
7
+ mainWindow.setAlwaysOnTop(true);
8
+
9
+ /**
10
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageSetAlwaysOnTop, 'output'>}
11
+ */
12
+ const setAlwaysOnTopResult = {
13
+ correlationId: json.correlationId,
14
+ url: json.url,
15
+ body: {
16
+ success: true,
17
+ },
18
+ };
19
+ ws.send(JSON.stringify(setAlwaysOnTopResult));
20
+ };