@simeonradivoev/gameflow-sdk 1.4.0 → 1.5.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.
Files changed (3) hide show
  1. package/README.md +15 -0
  2. package/index.d.ts +53 -223
  3. package/package.json +14 -14
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # Gameflow Deck SDK
2
+
3
+ This is the type definitions for Gameflow Deck plugins.
4
+
5
+ ## Developing a plugin
6
+
7
+ The plugin must have a default export class of type `PluginType`. It exposes the context and all the hooks to be tapped.
8
+ Gameflow uses the [Tapable Hooks](https://github.com/webpack/tapable).
9
+
10
+ The package must expose a main script gameflow will import and validate. It must implement the type fields on `PluginDescriptionType`.
11
+
12
+ ## Publishing
13
+
14
+ For the plugin to show up in the UI for download. It must be published to NPM with the `gameflow-plugin` keyword. Gameflow uses bun to install plugins as packages from npmjs.
15
+ Follow publishing instruction check the [NPM Docs](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import Conf from 'conf';
4
4
  import EventEmitter from 'node:events';
5
- import { AsyncSeriesBailHook, AsyncSeriesHook, SyncBailHook } from 'tapable';
5
+ import { AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, SyncBailHook } from 'tapable';
6
6
  import z from 'zod';
7
7
 
8
8
  declare class AuthHooks {
@@ -177,14 +177,14 @@ declare class GameHooks {
177
177
  name?: string;
178
178
  family_name?: string;
179
179
  } | undefined, import("tapable").UnsetAdditionalOptions>;
180
- gameLookup: AsyncSeriesHook<[
180
+ gameLookup: AsyncSeriesWaterfallHook<[
181
+ matches: Map<string, GameLookup[]>,
181
182
  ctx: {
182
183
  source?: string;
183
184
  id?: string;
184
185
  search?: string;
185
- matches: GameLookup[];
186
186
  }
187
- ], import("tapable").UnsetAdditionalOptions>;
187
+ ], Map<string, GameLookup[]>, import("tapable").UnsetAdditionalOptions>;
188
188
  fetchPlatforms: AsyncSeriesHook<[
189
189
  ctx: {
190
190
  platforms: FrontEndPlatformType[];
@@ -491,6 +491,37 @@ export declare const PluginDescriptionSchema: z.ZodObject<{
491
491
  main: z.ZodString;
492
492
  canDisable: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
493
493
  }, z.core.$strip>;
494
+ export declare const PluginEntrySchema: z.ZodObject<{
495
+ downloads: z.ZodObject<{
496
+ monthly: z.ZodNumber;
497
+ weekly: z.ZodNumber;
498
+ }, z.core.$strip>;
499
+ searchScore: z.ZodNumber;
500
+ installed: z.ZodBoolean;
501
+ package: z.ZodObject<{
502
+ name: z.ZodString;
503
+ keywords: z.ZodArray<z.ZodString>;
504
+ version: z.ZodString;
505
+ description: z.ZodOptional<z.ZodString>;
506
+ sanitized_name: z.ZodString;
507
+ license: z.ZodOptional<z.ZodString>;
508
+ publisher: z.ZodObject<{
509
+ email: z.ZodString;
510
+ username: z.ZodString;
511
+ trustedPublisher: z.ZodOptional<z.ZodObject<{
512
+ id: z.ZodString;
513
+ oidcConfigId: z.ZodString;
514
+ }, z.core.$strip>>;
515
+ }, z.core.$strip>;
516
+ date: z.ZodCoercedDate<unknown>;
517
+ links: z.ZodObject<{
518
+ homepage: z.ZodOptional<z.ZodString>;
519
+ repository: z.ZodOptional<z.ZodString>;
520
+ bugs: z.ZodOptional<z.ZodString>;
521
+ npm: z.ZodURL;
522
+ }, z.core.$strip>;
523
+ }, z.core.$strip>;
524
+ }, z.core.$strip>;
494
525
  export declare const PluginLoadingContextSchema: z.ZodObject<{
495
526
  setProgress: z.ZodFunction<z.core.$ZodTuple<readonly [
496
527
  z.ZodNumber,
@@ -500,6 +531,7 @@ export declare const PluginLoadingContextSchema: z.ZodObject<{
500
531
  zodRegistry: z.ZodCustom<z.core.$ZodRegistry<object | undefined, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>, z.core.$ZodRegistry<object | undefined, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
501
532
  hooks: z.ZodCustom<GameflowHooks, GameflowHooks>;
502
533
  }, z.core.$strip>;
534
+ export declare const PluginRegistry: string;
503
535
  export declare const PluginSchema: z.ZodObject<{
504
536
  load: z.ZodFunction<z.core.$ZodTuple<readonly [
505
537
  z.ZodObject<{
@@ -981,6 +1013,7 @@ export interface FrontendPlugin {
981
1013
  category: string;
982
1014
  enabled: boolean;
983
1015
  canDisable: boolean;
1016
+ canUninstall: boolean;
984
1017
  source: PluginSourceType;
985
1018
  hasSettings: boolean;
986
1019
  version: string;
@@ -1055,130 +1088,28 @@ export interface SaveFileChange {
1055
1088
  shared: boolean;
1056
1089
  fixedSize?: boolean;
1057
1090
  }
1058
- export type ActiveGameType = {
1059
- process?: any | undefined;
1060
- gameId: {
1061
- id: string;
1062
- source: string;
1063
- };
1064
- source?: string | undefined;
1065
- sourceId?: string | undefined;
1066
- name: string;
1067
- command: {
1068
- command: string | string[];
1069
- startDir?: string | undefined;
1070
- };
1071
- };
1072
- export type DirType = {
1073
- name: string;
1074
- parentPath: string;
1075
- isDirectory: boolean;
1076
- };
1077
- export type DownloadSourceType = {
1078
- id: string;
1079
- name: string;
1080
- };
1091
+ export type ActiveGameType = z.infer<typeof ActiveGameSchema>;
1092
+ export type DirType = z.infer<typeof DirSchema>;
1093
+ export type DownloadSourceType = z.infer<typeof DownloadSourceSchema>;
1081
1094
  export type EmulatorCapabilities = "saves" | "fullscreen" | "resolution" | "batch" | "states" | "config";
1082
- export type EmulatorDownloadInfoType = {
1083
- id: string;
1084
- version?: string | undefined;
1085
- url?: string | undefined;
1086
- description?: string | undefined;
1087
- downloadDate: Date;
1088
- type: string;
1089
- };
1090
- export type EmulatorPackageType = {
1091
- name: string;
1092
- description: string;
1093
- homepage: string;
1094
- logo: string;
1095
- type: "emulator";
1096
- os: ("darwin" | "linux" | "win32" | "android")[];
1097
- keywords?: string[] | undefined;
1098
- downloads?: {
1099
- [key: string]: ({
1100
- type: "github" | "gitlab";
1101
- pattern: string;
1102
- path: string;
1103
- bin?: string | undefined;
1104
- } | {
1105
- type: "direct";
1106
- url: string;
1107
- bin?: string | undefined;
1108
- } | {
1109
- type: "scoop";
1110
- url: string;
1111
- bin?: string | undefined;
1112
- })[];
1113
- } | undefined;
1114
- systems: string[];
1115
- bios?: ("required" | "optional") | undefined;
1116
- };
1095
+ export type EmulatorDownloadInfoType = z.infer<typeof EmulatorDownloadInfoSchema>;
1096
+ export type EmulatorPackageType = z.infer<typeof EmulatorPackageSchema>;
1117
1097
  export type EmulatorSourceType = "custom" | "store" | "registry" | "system" | "static" | "embedded";
1118
1098
  export type GameInstallProgressEvent = "refresh";
1119
- export type GameListFilterType = {
1120
- platform_source?: string | undefined;
1121
- platform_slug?: string | undefined;
1122
- platform_id?: number | undefined;
1123
- collection_id?: number | undefined;
1124
- collection_source?: string | undefined;
1125
- limit?: number | undefined;
1126
- search?: string | undefined;
1127
- offset?: number | undefined;
1128
- source?: string | undefined;
1129
- localOnly?: boolean | undefined;
1130
- orderBy?: ("added" | "activity" | "name" | "release") | undefined;
1131
- age_ratings?: (string[] | any) | undefined;
1132
- genres?: (string[] | any) | undefined;
1133
- keywords?: (string[] | any) | undefined;
1134
- };
1099
+ export type GameListFilterType = z.infer<typeof GameListFilterSchema>;
1135
1100
  export type GameStatusType = "installed" | "missing-emulator" | "error" | "install" | "download" | "extract" | "playing" | "queued";
1136
1101
  export type JobStatus = "completed" | "error" | "running" | "queued" | "aborted";
1137
1102
  export type KeysWithValueAssignableTo<T, Value> = {
1138
1103
  [K in keyof T]: Exclude<T[K], undefined> extends Value ? K : never;
1139
1104
  }[keyof T];
1140
- export type LocalSettingsType = {
1141
- backgroundBlur: boolean;
1142
- backgroundAnimation: boolean;
1143
- theme: "dark" | "light" | "auto";
1144
- soundEffects: boolean;
1145
- soundEffectsVolume: number;
1146
- hapticsEffects: boolean;
1147
- showRouterDevOptions: boolean;
1148
- showQueryDevOptions: boolean;
1149
- /** Show the gameflow on screen keyboard when using a controller */
1150
- useGameflowKeyboard: boolean;
1151
- /** Open on screen keybaord automatically */
1152
- autoKeybaord: boolean;
1153
- };
1154
- export type PluginContextType = {
1155
- hooks: any;
1156
- };
1157
- export type PluginDescriptionType = {
1158
- name: string;
1159
- displayName: string;
1160
- version: string;
1161
- description: string;
1162
- /** Can be an external URL to an image or a data url */
1163
- icon?: string | undefined;
1164
- keywords?: string[] | undefined;
1165
- category: string;
1166
- /** The main entry. It must export a default class implementing PluginType */
1167
- main: string;
1168
- /** Can the plugin be disabled or enabled by the user */
1169
- canDisable?: boolean | undefined;
1170
- };
1171
- export type PluginLoadingContextType<TSettings extends Record<string, any> = Record<string, any>> = {
1172
- setProgress: (args_0: number, args_1: string) => void | undefined;
1173
- /** Per plugin config. It will use the settings schema defined in the plugin class */
1174
- config: any;
1175
- /** Used by the settings to register metadata for the UI */
1176
- zodRegistry: any;
1177
- hooks: any;
1178
- } & {
1105
+ export type LocalSettingsType = z.infer<typeof LocalSettingsSchema>;
1106
+ export type PluginContextType = z.infer<typeof PluginContextSchema>;
1107
+ export type PluginDescriptionType = z.infer<typeof PluginDescriptionSchema>;
1108
+ export type PluginEntryType = z.infer<typeof PluginEntrySchema>;
1109
+ export type PluginLoadingContextType<TSettings extends Record<string, any> = Record<string, any>> = z.infer<typeof PluginLoadingContextSchema> & {
1179
1110
  config: Conf<TSettings>;
1180
1111
  };
1181
- export type PluginSourceType = "builtin";
1112
+ export type PluginSourceType = "builtin" | "store";
1182
1113
  export type PluginType<T extends Record<string, any> = Record<string, any>> = Omit<z.infer<typeof PluginSchema>, "load" | "settingsMigrations"> & {
1183
1114
  load: (ctx: PluginLoadingContextType<T>) => Promise<void>;
1184
1115
  settingsMigrations?: Record<string, (conf: Conf<T>) => void>;
@@ -1186,110 +1117,9 @@ export type PluginType<T extends Record<string, any> = Record<string, any>> = Om
1186
1117
  export type SaveSlots = Record<string, {
1187
1118
  cwd: string;
1188
1119
  }>;
1189
- export type SettingsType = {
1190
- rommAddress?: string | undefined;
1191
- rommUser?: string | undefined;
1192
- windowSize?: {
1193
- width: number;
1194
- height: number;
1195
- } | undefined;
1196
- windowPosition?: {
1197
- x: number;
1198
- y: number;
1199
- } | undefined;
1200
- downloadPath: string;
1201
- launchInFullscreen: boolean;
1202
- disabledPlugins: string[];
1203
- emulatorResolution: "720p" | "1080p" | "1440p" | "4k";
1204
- emulatorWidescreen: boolean;
1205
- };
1206
- export type StoreDownloadType = {
1207
- type: "direct";
1208
- url: string;
1209
- name?: string | undefined;
1210
- system: string;
1211
- main?: string | undefined;
1212
- saves?: {
1213
- [key: string]: {
1214
- cwd: string;
1215
- globs: string[];
1216
- };
1217
- } | undefined;
1218
- } | {
1219
- type: "itch";
1220
- path: string;
1221
- name?: string | undefined;
1222
- system: string;
1223
- saves?: {
1224
- [key: string]: {
1225
- cwd: string;
1226
- globs: string[];
1227
- };
1228
- } | undefined;
1229
- };
1230
- export type StoreGameType = {
1231
- name: string;
1232
- description: string;
1233
- version: string;
1234
- homepage?: string | undefined;
1235
- keywords?: string[] | undefined;
1236
- genres?: string[] | undefined;
1237
- companies?: string[] | undefined;
1238
- screenshots?: string[] | undefined;
1239
- covers?: string[] | undefined;
1240
- igdb_id?: number | undefined;
1241
- ra_id?: number | undefined;
1242
- sgdb_id?: number | undefined;
1243
- first_release_date?: (number | Date) | undefined;
1244
- player_count?: string | undefined;
1245
- saves?: {
1246
- [key: string]: {
1247
- [key: string]: {
1248
- cwd: string;
1249
- globs: string[];
1250
- };
1251
- };
1252
- } | undefined;
1253
- downloads: {
1254
- [key: string]: {
1255
- type: "direct";
1256
- url: string;
1257
- name?: string | undefined;
1258
- system: string;
1259
- main?: string | undefined;
1260
- saves?: {
1261
- [key: string]: {
1262
- cwd: string;
1263
- globs: string[];
1264
- };
1265
- } | undefined;
1266
- } | {
1267
- type: "itch";
1268
- path: string;
1269
- name?: string | undefined;
1270
- system: string;
1271
- saves?: {
1272
- [key: string]: {
1273
- cwd: string;
1274
- globs: string[];
1275
- };
1276
- } | undefined;
1277
- };
1278
- };
1279
- };
1280
- export type SystemInfoType = {
1281
- battery: {
1282
- percent: number;
1283
- isCharging: boolean;
1284
- acConnected: boolean;
1285
- hasBattery: boolean;
1286
- };
1287
- wifiConnections: {
1288
- signalLevel: number;
1289
- }[];
1290
- bluetoothDevices: {
1291
- connected: boolean;
1292
- }[];
1293
- };
1120
+ export type SettingsType = z.infer<typeof SettingsSchema>;
1121
+ export type StoreDownloadType = z.infer<typeof StoreDownloadSchema>;
1122
+ export type StoreGameType = z.infer<typeof StoreGameSchema>;
1123
+ export type SystemInfoType = z.infer<typeof SystemInfoSchema>;
1294
1124
 
1295
1125
  export {};
package/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@simeonradivoev/gameflow-sdk",
3
+ "version": "1.5.0",
3
4
  "types": "index.d.ts",
4
5
  "description": "plugin SDK for the Gameflow Deck Launcher",
5
6
  "keywords": [
@@ -7,7 +8,6 @@
7
8
  "sdk"
8
9
  ],
9
10
  "license": "AGPL-3.0",
10
- "version": "1.4.0",
11
11
  "repository": {
12
12
  "type": "git",
13
13
  "url": "https://github.com/simeonradivoev/gameflow-deck"
@@ -20,35 +20,35 @@
20
20
  "peerDependencies": {
21
21
  "7zip-bin": "^5.2.0",
22
22
  "@auth/core": "^0.34.3",
23
- "@elysiajs/cors": "^1.4.1",
24
- "@elysiajs/eden": "^1.4.6",
25
- "@jimp/wasm-webp": "^1.6.0",
23
+ "@elysiajs/cors": "^1.4.2",
24
+ "@elysiajs/eden": "^1.4.9",
25
+ "@jimp/wasm-webp": "^1.6.1",
26
26
  "@phalcode/ts-igdb-client": "^1.0.26",
27
27
  "cheerio": "^1.2.0",
28
- "conf": "^15.0.2",
29
- "drizzle-orm": "^0.45.1",
30
- "elysia": "^1.4.22",
31
- "fs-extra": "^11.3.3",
28
+ "conf": "^15.1.0",
29
+ "drizzle-orm": "^0.45.2",
30
+ "elysia": "^1.4.28",
31
+ "fs-extra": "^11.3.5",
32
32
  "get-folder-size": "^5.0.0",
33
33
  "ini": "^6.0.0",
34
- "jimp": "^1.6.0",
34
+ "jimp": "^1.6.1",
35
35
  "mustache": "^4.2.0",
36
36
  "node-7z": "^3.0.0",
37
37
  "node-disk-info": "^1.3.0",
38
- "node-downloader-helper": "^2.1.10",
38
+ "node-downloader-helper": "^2.1.11",
39
39
  "node-stream-zip": "^1.15.0",
40
40
  "node-unrar-js": "^2.0.2",
41
41
  "open": "^11.0.0",
42
- "p-queue": "^9.1.2",
42
+ "p-queue": "^9.2.0",
43
43
  "pathe": "^2.0.3",
44
44
  "slugify": "^1.6.9",
45
45
  "smol-toml": "^1.6.1",
46
46
  "systeminformation": "^5.31.5",
47
- "tapable": "^2.3.0",
48
- "tough-cookie": "^6.0.0",
47
+ "tapable": "^2.3.3",
48
+ "tough-cookie": "^6.0.1",
49
49
  "tough-cookie-file-store": "^3.3.0",
50
50
  "unzip-stream": "^0.3.4",
51
51
  "webview-bun": "^2.4.0",
52
- "zod": "^4.3.6"
52
+ "zod": "^4.4.3"
53
53
  }
54
54
  }