@droposs/plugin-sdk 0.1.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/dist/client-mock.d.ts +75 -0
- package/dist/client-mock.d.ts.map +1 -0
- package/dist/client-mock.js +206 -0
- package/dist/client-mock.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/mock.d.ts +43 -0
- package/dist/mock.d.ts.map +1 -0
- package/dist/mock.js +93 -0
- package/dist/mock.js.map +1 -0
- package/dist/types.d.ts +289 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { AntiCheatReport, ClientCapability, ClientPluginContext, ClientPluginStorage, ClientPluginWebSocket, GameMenuItem, LaunchHook, PlayAction, PluginLogger, ScopedGameFs, ScopedGameScanner, SidebarItem, TopBarItem, UISlotName, UISlotRegistration } from "./types.js";
|
|
2
|
+
export declare class MockClientPluginStorage implements ClientPluginStorage {
|
|
3
|
+
private store;
|
|
4
|
+
get<T>(key: string): Promise<T | null>;
|
|
5
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
6
|
+
delete(key: string): Promise<void>;
|
|
7
|
+
listKeys(): Promise<string[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare class MockScopedGameFs implements ScopedGameFs {
|
|
10
|
+
files: Map<string, Uint8Array<ArrayBufferLike>>;
|
|
11
|
+
backups: Map<string, {
|
|
12
|
+
sha256: string;
|
|
13
|
+
content: Uint8Array;
|
|
14
|
+
}>;
|
|
15
|
+
private makeKey;
|
|
16
|
+
readFile(gameId: string, relativePath: string): Promise<Uint8Array>;
|
|
17
|
+
writeFile(gameId: string, relativePath: string, data: Uint8Array | string): Promise<void>;
|
|
18
|
+
backupFile(gameId: string, relativePath: string): Promise<string>;
|
|
19
|
+
restoreFile(gameId: string, relativePath: string): Promise<void>;
|
|
20
|
+
fileExists(gameId: string, relativePath: string): Promise<boolean>;
|
|
21
|
+
deleteFile(gameId: string, relativePath: string): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export declare class MockScopedGameScanner implements ScopedGameScanner {
|
|
24
|
+
mockExecutables: Array<{
|
|
25
|
+
relativePath: string;
|
|
26
|
+
sha256: string;
|
|
27
|
+
size: number;
|
|
28
|
+
}>;
|
|
29
|
+
mockAntiCheat: AntiCheatReport;
|
|
30
|
+
scanExecutables(_gameId: string): Promise<Array<{
|
|
31
|
+
relativePath: string;
|
|
32
|
+
sha256: string;
|
|
33
|
+
size: number;
|
|
34
|
+
}>>;
|
|
35
|
+
checkAntiCheat(_gameId: string): Promise<AntiCheatReport>;
|
|
36
|
+
}
|
|
37
|
+
export declare class MockClientPluginWebSocket implements ClientPluginWebSocket {
|
|
38
|
+
sentMessages: Array<{
|
|
39
|
+
channel: string;
|
|
40
|
+
data: unknown;
|
|
41
|
+
}>;
|
|
42
|
+
subscribers: Map<string, Set<(data: unknown) => void>>;
|
|
43
|
+
send(channel: string, data: unknown): Promise<unknown>;
|
|
44
|
+
subscribe(channel: string, listener: (data: unknown) => void): () => void;
|
|
45
|
+
simulateServerMessage(channel: string, data: unknown): void;
|
|
46
|
+
}
|
|
47
|
+
export declare class MockClientPluginContext implements ClientPluginContext {
|
|
48
|
+
id: string;
|
|
49
|
+
logger: PluginLogger;
|
|
50
|
+
storage: ClientPluginStorage;
|
|
51
|
+
capabilities: Set<ClientCapability>;
|
|
52
|
+
registeredSlots: Map<UISlotName, UISlotRegistration[]>;
|
|
53
|
+
playActionProviders: Array<(gameId: string) => Promise<PlayAction[]> | PlayAction[]>;
|
|
54
|
+
gameMenuItems: GameMenuItem[];
|
|
55
|
+
sidebarItems: SidebarItem[];
|
|
56
|
+
topBarItems: TopBarItem[];
|
|
57
|
+
launchHooks: LaunchHook[];
|
|
58
|
+
gameFs: MockScopedGameFs;
|
|
59
|
+
gameScanner: MockScopedGameScanner;
|
|
60
|
+
serverWs: MockClientPluginWebSocket;
|
|
61
|
+
constructor(id: string, capabilities?: ClientCapability[]);
|
|
62
|
+
registerSlot(slot: UISlotName, component: unknown, options?: {
|
|
63
|
+
order?: number;
|
|
64
|
+
label?: string;
|
|
65
|
+
icon?: string;
|
|
66
|
+
}): void;
|
|
67
|
+
registerPlayAction(provider: (gameId: string) => Promise<PlayAction[]> | PlayAction[]): () => void;
|
|
68
|
+
registerGameMenuItem(item: GameMenuItem): () => void;
|
|
69
|
+
registerSidebarItem(item: SidebarItem): () => void;
|
|
70
|
+
registerTopBarItem(item: TopBarItem): () => void;
|
|
71
|
+
registerLaunchHook(hook: LaunchHook): () => void;
|
|
72
|
+
resolvePlayActions(gameId: string): Promise<PlayAction[]>;
|
|
73
|
+
private assertCapability;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=client-mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-mock.d.ts","sourceRoot":"","sources":["../src/client-mock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EAEZ,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,UAAU,EACV,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,qBAAa,uBAAwB,YAAW,mBAAmB;IACjE,OAAO,CAAC,KAAK,CAA0B;IAEjC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAMtC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,I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,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAC9D,IAAI;IAcP,kBAAkB,CAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,UAAU,EAAE,GACjE,MAAM,IAAI;IASb,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,IAAI;IASpD,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,IAAI;IASlD,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,IAAI;IAShD,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,IAAI;IAS1C,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAS/D,OAAO,CAAC,gBAAgB;CAOzB"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { MockPluginLogger } from "./mock.js";
|
|
2
|
+
export class MockClientPluginStorage {
|
|
3
|
+
store = new Map();
|
|
4
|
+
async get(key) {
|
|
5
|
+
return this.store.has(key)
|
|
6
|
+
? JSON.parse(JSON.stringify(this.store.get(key)))
|
|
7
|
+
: null;
|
|
8
|
+
}
|
|
9
|
+
async set(key, value) {
|
|
10
|
+
this.store.set(key, JSON.parse(JSON.stringify(value)));
|
|
11
|
+
}
|
|
12
|
+
async delete(key) {
|
|
13
|
+
this.store.delete(key);
|
|
14
|
+
}
|
|
15
|
+
async listKeys() {
|
|
16
|
+
return Array.from(this.store.keys());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class MockScopedGameFs {
|
|
20
|
+
files = new Map();
|
|
21
|
+
backups = new Map();
|
|
22
|
+
makeKey(gameId, path) {
|
|
23
|
+
return `${gameId}:${path.replace(/\\/g, "/")}`;
|
|
24
|
+
}
|
|
25
|
+
async readFile(gameId, relativePath) {
|
|
26
|
+
const key = this.makeKey(gameId, relativePath);
|
|
27
|
+
const content = this.files.get(key);
|
|
28
|
+
if (!content) {
|
|
29
|
+
throw new Error(`File not found: ${relativePath}`);
|
|
30
|
+
}
|
|
31
|
+
return new Uint8Array(content);
|
|
32
|
+
}
|
|
33
|
+
async writeFile(gameId, relativePath, data) {
|
|
34
|
+
const key = this.makeKey(gameId, relativePath);
|
|
35
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
36
|
+
this.files.set(key, bytes);
|
|
37
|
+
}
|
|
38
|
+
async backupFile(gameId, relativePath) {
|
|
39
|
+
const key = this.makeKey(gameId, relativePath);
|
|
40
|
+
const content = this.files.get(key);
|
|
41
|
+
if (!content) {
|
|
42
|
+
throw new Error(`Cannot backup non-existent file: ${relativePath}`);
|
|
43
|
+
}
|
|
44
|
+
const mockHash = "mock-sha256-" + content.length;
|
|
45
|
+
this.backups.set(key, { sha256: mockHash, content: new Uint8Array(content) });
|
|
46
|
+
return mockHash;
|
|
47
|
+
}
|
|
48
|
+
async restoreFile(gameId, relativePath) {
|
|
49
|
+
const key = this.makeKey(gameId, relativePath);
|
|
50
|
+
const backup = this.backups.get(key);
|
|
51
|
+
if (!backup) {
|
|
52
|
+
throw new Error(`No backup found for: ${relativePath}`);
|
|
53
|
+
}
|
|
54
|
+
this.files.set(key, new Uint8Array(backup.content));
|
|
55
|
+
}
|
|
56
|
+
async fileExists(gameId, relativePath) {
|
|
57
|
+
const key = this.makeKey(gameId, relativePath);
|
|
58
|
+
return this.files.has(key);
|
|
59
|
+
}
|
|
60
|
+
async deleteFile(gameId, relativePath) {
|
|
61
|
+
const key = this.makeKey(gameId, relativePath);
|
|
62
|
+
this.files.delete(key);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class MockScopedGameScanner {
|
|
66
|
+
mockExecutables = [];
|
|
67
|
+
mockAntiCheat = { detected: false };
|
|
68
|
+
async scanExecutables(_gameId) {
|
|
69
|
+
return [...this.mockExecutables];
|
|
70
|
+
}
|
|
71
|
+
async checkAntiCheat(_gameId) {
|
|
72
|
+
return { ...this.mockAntiCheat };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export class MockClientPluginWebSocket {
|
|
76
|
+
sentMessages = [];
|
|
77
|
+
subscribers = new Map();
|
|
78
|
+
async send(channel, data) {
|
|
79
|
+
this.sentMessages.push({ channel, data });
|
|
80
|
+
return { ack: true };
|
|
81
|
+
}
|
|
82
|
+
subscribe(channel, listener) {
|
|
83
|
+
if (!this.subscribers.has(channel)) {
|
|
84
|
+
this.subscribers.set(channel, new Set());
|
|
85
|
+
}
|
|
86
|
+
this.subscribers.get(channel).add(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
this.subscribers.get(channel)?.delete(listener);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
simulateServerMessage(channel, data) {
|
|
92
|
+
const set = this.subscribers.get(channel);
|
|
93
|
+
if (set) {
|
|
94
|
+
for (const listener of set) {
|
|
95
|
+
listener(data);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export class MockClientPluginContext {
|
|
101
|
+
id;
|
|
102
|
+
logger;
|
|
103
|
+
storage;
|
|
104
|
+
capabilities;
|
|
105
|
+
registeredSlots = new Map();
|
|
106
|
+
playActionProviders = [];
|
|
107
|
+
gameMenuItems = [];
|
|
108
|
+
sidebarItems = [];
|
|
109
|
+
topBarItems = [];
|
|
110
|
+
launchHooks = [];
|
|
111
|
+
gameFs;
|
|
112
|
+
gameScanner;
|
|
113
|
+
serverWs;
|
|
114
|
+
constructor(id, capabilities = [
|
|
115
|
+
"ui:slot",
|
|
116
|
+
"ui:play-action",
|
|
117
|
+
"ui:context-menu",
|
|
118
|
+
"ui:sidebar",
|
|
119
|
+
"ui:topbar",
|
|
120
|
+
"game:launch-hook",
|
|
121
|
+
"game:fs",
|
|
122
|
+
"game:scan",
|
|
123
|
+
"client:storage",
|
|
124
|
+
"client:ws",
|
|
125
|
+
]) {
|
|
126
|
+
this.id = id;
|
|
127
|
+
this.logger = new MockPluginLogger();
|
|
128
|
+
this.storage = new MockClientPluginStorage();
|
|
129
|
+
this.capabilities = new Set(capabilities);
|
|
130
|
+
this.gameFs = new MockScopedGameFs();
|
|
131
|
+
this.gameScanner = new MockScopedGameScanner();
|
|
132
|
+
this.serverWs = new MockClientPluginWebSocket();
|
|
133
|
+
}
|
|
134
|
+
registerSlot(slot, component, options = {}) {
|
|
135
|
+
this.assertCapability("ui:slot");
|
|
136
|
+
if (!this.registeredSlots.has(slot)) {
|
|
137
|
+
this.registeredSlots.set(slot, []);
|
|
138
|
+
}
|
|
139
|
+
this.registeredSlots.get(slot).push({
|
|
140
|
+
slot,
|
|
141
|
+
component,
|
|
142
|
+
order: options.order ?? 0,
|
|
143
|
+
label: options.label,
|
|
144
|
+
icon: options.icon,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
registerPlayAction(provider) {
|
|
148
|
+
this.assertCapability("ui:play-action");
|
|
149
|
+
this.playActionProviders.push(provider);
|
|
150
|
+
return () => {
|
|
151
|
+
const idx = this.playActionProviders.indexOf(provider);
|
|
152
|
+
if (idx !== -1)
|
|
153
|
+
this.playActionProviders.splice(idx, 1);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
registerGameMenuItem(item) {
|
|
157
|
+
this.assertCapability("ui:context-menu");
|
|
158
|
+
this.gameMenuItems.push(item);
|
|
159
|
+
return () => {
|
|
160
|
+
const idx = this.gameMenuItems.indexOf(item);
|
|
161
|
+
if (idx !== -1)
|
|
162
|
+
this.gameMenuItems.splice(idx, 1);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
registerSidebarItem(item) {
|
|
166
|
+
this.assertCapability("ui:sidebar");
|
|
167
|
+
this.sidebarItems.push(item);
|
|
168
|
+
return () => {
|
|
169
|
+
const idx = this.sidebarItems.indexOf(item);
|
|
170
|
+
if (idx !== -1)
|
|
171
|
+
this.sidebarItems.splice(idx, 1);
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
registerTopBarItem(item) {
|
|
175
|
+
this.assertCapability("ui:topbar");
|
|
176
|
+
this.topBarItems.push(item);
|
|
177
|
+
return () => {
|
|
178
|
+
const idx = this.topBarItems.indexOf(item);
|
|
179
|
+
if (idx !== -1)
|
|
180
|
+
this.topBarItems.splice(idx, 1);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
registerLaunchHook(hook) {
|
|
184
|
+
this.assertCapability("game:launch-hook");
|
|
185
|
+
this.launchHooks.push(hook);
|
|
186
|
+
return () => {
|
|
187
|
+
const idx = this.launchHooks.indexOf(hook);
|
|
188
|
+
if (idx !== -1)
|
|
189
|
+
this.launchHooks.splice(idx, 1);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
async resolvePlayActions(gameId) {
|
|
193
|
+
const actions = [];
|
|
194
|
+
for (const provider of this.playActionProviders) {
|
|
195
|
+
const result = await provider(gameId);
|
|
196
|
+
actions.push(...result);
|
|
197
|
+
}
|
|
198
|
+
return actions;
|
|
199
|
+
}
|
|
200
|
+
assertCapability(cap) {
|
|
201
|
+
if (!this.capabilities.has(cap)) {
|
|
202
|
+
throw new Error(`Client plugin '${this.id}' missing required capability '${cap}'`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=client-mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-mock.js","sourceRoot":"","sources":["../src/client-mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAoB7C,MAAM,OAAO,uBAAuB;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;IAEvC,KAAK,CAAC,GAAG,CAAI,GAAW;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YACxB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,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AAG,EAAE;YACV,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,GAAG,KAAK,CAAC,CAAC;gBAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,MAAc;QACrC,MAAM,OAAO,GAAiB,EAAE,CAAC;QACjC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAChD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,gBAAgB,CAAC,GAAqB;QAC5C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,kBAAkB,IAAI,CAAC,EAAE,kCAAkC,GAAG,GAAG,CAClE,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { HttpMethod, PluginCapability, PluginContext, PluginLogger, PluginStorage, RouteHandler, SubscriptionAuthorizer, WebSocketHandler } from "./types.js";
|
|
2
|
+
export declare class MockPluginStorage implements PluginStorage {
|
|
3
|
+
private store;
|
|
4
|
+
private schemaVersion;
|
|
5
|
+
get<T>(key: string): Promise<T | null>;
|
|
6
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
7
|
+
delete(key: string): Promise<void>;
|
|
8
|
+
listKeys(): Promise<string[]>;
|
|
9
|
+
getSchemaVersion(): Promise<number>;
|
|
10
|
+
setSchemaVersion(version: number): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class MockPluginLogger implements PluginLogger {
|
|
13
|
+
info(msg: string, ...args: any[]): void;
|
|
14
|
+
warn(msg: string, ...args: any[]): void;
|
|
15
|
+
error(msg: string, ...args: any[]): void;
|
|
16
|
+
debug(msg: string, ...args: any[]): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class MockPluginContext implements PluginContext {
|
|
19
|
+
id: string;
|
|
20
|
+
logger: PluginLogger;
|
|
21
|
+
storage: PluginStorage;
|
|
22
|
+
capabilities: Set<PluginCapability>;
|
|
23
|
+
routes: Map<string, {
|
|
24
|
+
method: HttpMethod;
|
|
25
|
+
pattern: string;
|
|
26
|
+
handler: RouteHandler;
|
|
27
|
+
}>;
|
|
28
|
+
wsHandlers: Map<string, WebSocketHandler>;
|
|
29
|
+
eventListeners: Map<string, Set<(event: unknown) => void>>;
|
|
30
|
+
authorizers: Array<{
|
|
31
|
+
matches: (c: string) => boolean;
|
|
32
|
+
auth: SubscriptionAuthorizer;
|
|
33
|
+
}>;
|
|
34
|
+
constructor(id: string, capabilities?: PluginCapability[]);
|
|
35
|
+
registerRoute(method: HttpMethod, pattern: string, handler: RouteHandler): void;
|
|
36
|
+
broadcast(channel: string, event: unknown): void;
|
|
37
|
+
subscribe(channel: string, listener: (event: unknown) => void): () => void;
|
|
38
|
+
registerWebSocket(channel: string, handler: WebSocketHandler): void;
|
|
39
|
+
registerSubscriptionAuthorizer(matches: (channel: string) => boolean, authorize: SubscriptionAuthorizer): void;
|
|
40
|
+
fetch(input: string | URL, init?: RequestInit): Promise<Response>;
|
|
41
|
+
private assertCapability;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,aAAa,CAAK;IAEpB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAItC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI7B,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvD;AAED,qBAAa,gBAAiB,YAAW,YAAY;IACnD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAGvC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAGvC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAGxC,KAAK,CAA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@
|
|
|
1
|
+
export class MockPluginStorage {
|
|
2
|
+
store = new Map();
|
|
3
|
+
schemaVersion = 0;
|
|
4
|
+
async get(key) {
|
|
5
|
+
return this.store.has(key) ? JSON.parse(JSON.stringify(this.store.get(key))) : null;
|
|
6
|
+
}
|
|
7
|
+
async set(key, value) {
|
|
8
|
+
this.store.set(key, JSON.parse(JSON.stringify(value)));
|
|
9
|
+
}
|
|
10
|
+
async delete(key) {
|
|
11
|
+
this.store.delete(key);
|
|
12
|
+
}
|
|
13
|
+
async listKeys() {
|
|
14
|
+
return Array.from(this.store.keys());
|
|
15
|
+
}
|
|
16
|
+
async getSchemaVersion() {
|
|
17
|
+
return this.schemaVersion;
|
|
18
|
+
}
|
|
19
|
+
async setSchemaVersion(version) {
|
|
20
|
+
this.schemaVersion = version;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class MockPluginLogger {
|
|
24
|
+
info(msg, ...args) {
|
|
25
|
+
console.log(`[INFO] ${msg}`, ...args);
|
|
26
|
+
}
|
|
27
|
+
warn(msg, ...args) {
|
|
28
|
+
console.warn(`[WARN] ${msg}`, ...args);
|
|
29
|
+
}
|
|
30
|
+
error(msg, ...args) {
|
|
31
|
+
console.error(`[ERROR] ${msg}`, ...args);
|
|
32
|
+
}
|
|
33
|
+
debug(msg, ...args) {
|
|
34
|
+
console.debug(`[DEBUG] ${msg}`, ...args);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class MockPluginContext {
|
|
38
|
+
id;
|
|
39
|
+
logger;
|
|
40
|
+
storage;
|
|
41
|
+
capabilities;
|
|
42
|
+
routes = new Map();
|
|
43
|
+
wsHandlers = new Map();
|
|
44
|
+
eventListeners = new Map();
|
|
45
|
+
authorizers = [];
|
|
46
|
+
constructor(id, capabilities = ["routes", "storage", "websocket", "events", "network"]) {
|
|
47
|
+
this.id = id;
|
|
48
|
+
this.logger = new MockPluginLogger();
|
|
49
|
+
this.storage = new MockPluginStorage();
|
|
50
|
+
this.capabilities = new Set(capabilities);
|
|
51
|
+
}
|
|
52
|
+
registerRoute(method, pattern, handler) {
|
|
53
|
+
this.assertCapability("routes");
|
|
54
|
+
this.routes.set(`${method} ${pattern}`, { method, pattern, handler });
|
|
55
|
+
}
|
|
56
|
+
broadcast(channel, event) {
|
|
57
|
+
this.assertCapability("events");
|
|
58
|
+
const listeners = this.eventListeners.get(channel);
|
|
59
|
+
if (listeners) {
|
|
60
|
+
for (const listener of listeners) {
|
|
61
|
+
listener(event);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
subscribe(channel, listener) {
|
|
66
|
+
this.assertCapability("events");
|
|
67
|
+
if (!this.eventListeners.has(channel)) {
|
|
68
|
+
this.eventListeners.set(channel, new Set());
|
|
69
|
+
}
|
|
70
|
+
this.eventListeners.get(channel).add(listener);
|
|
71
|
+
return () => {
|
|
72
|
+
this.eventListeners.get(channel)?.delete(listener);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
registerWebSocket(channel, handler) {
|
|
76
|
+
this.assertCapability("websocket");
|
|
77
|
+
this.wsHandlers.set(channel, handler);
|
|
78
|
+
}
|
|
79
|
+
registerSubscriptionAuthorizer(matches, authorize) {
|
|
80
|
+
this.assertCapability("websocket");
|
|
81
|
+
this.authorizers.push({ matches, auth: authorize });
|
|
82
|
+
}
|
|
83
|
+
async fetch(input, init) {
|
|
84
|
+
this.assertCapability("network");
|
|
85
|
+
return globalThis.fetch(input, init);
|
|
86
|
+
}
|
|
87
|
+
assertCapability(cap) {
|
|
88
|
+
if (!this.capabilities.has(cap)) {
|
|
89
|
+
throw new Error(`Plugin '${this.id}' missing required capability '${cap}'`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=mock.js.map
|
package/dist/mock.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"A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AE,IAAI,CAAC,CAAC;IACvC,CAAC;IAEO,gBAAgB,CAAC,GAAqB;QAC5C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,EAAE,kCAAkC,GAAG,GAAG,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current plugin API version. Bump this when `PluginContext` or the manifest
|
|
3
|
+
* contract changes incompatibly. Plugins declare the version they were built
|
|
4
|
+
* against in `metadata.apiVersion`; mismatches are rejected at registration.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PLUGIN_API_VERSION = 2;
|
|
7
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "ALL";
|
|
8
|
+
export type PluginTarget = "server" | "client";
|
|
9
|
+
export type PluginCategory = "generic" | "metadata" | "storage" | "multiplayer";
|
|
10
|
+
export type ServerCapability = "routes" | "storage" | "websocket" | "events" | "network";
|
|
11
|
+
export type ClientCapability = "ui:slot" | "ui:play-action" | "ui:context-menu" | "ui:sidebar" | "ui:topbar" | "game:launch-hook" | "game:fs" | "game:scan" | "client:storage" | "client:ws" | "system:sidecar";
|
|
12
|
+
export type PluginCapability = ServerCapability | ClientCapability;
|
|
13
|
+
/**
|
|
14
|
+
* Trust tier. Only `"trusted"` is supported today: plugins run in-process with
|
|
15
|
+
* the server or client's own privileges. `"sandboxed"` is reserved for a future isolated
|
|
16
|
+
* runtime and must be rejected until that runtime exists.
|
|
17
|
+
*/
|
|
18
|
+
export type PluginTrust = "trusted" | "sandboxed";
|
|
19
|
+
export type PluginStatus = "active" | "disabled" | "error" | "registered";
|
|
20
|
+
export interface PluginMetadata {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
version: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
author?: string;
|
|
26
|
+
homepage?: string;
|
|
27
|
+
license?: string;
|
|
28
|
+
builtin?: boolean;
|
|
29
|
+
/** Plugin API version the plugin was built against. */
|
|
30
|
+
apiVersion?: number;
|
|
31
|
+
/** Trust tier. Defaults to "trusted". */
|
|
32
|
+
trust?: PluginTrust;
|
|
33
|
+
/** Declared storage schema version; drives `migrateStorage`. */
|
|
34
|
+
storageVersion?: number;
|
|
35
|
+
category?: PluginCategory;
|
|
36
|
+
targets?: PluginTarget[];
|
|
37
|
+
capabilities?: PluginCapability[];
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface PluginManifest extends PluginMetadata {
|
|
41
|
+
entry?: string;
|
|
42
|
+
/** SHA-256 of the entry file, hex. Verified before the bundle is imported. */
|
|
43
|
+
checksum?: string;
|
|
44
|
+
/**
|
|
45
|
+
* SHA-256 of every file the bundle may import, keyed by path relative to the
|
|
46
|
+
* bundle directory. Required for multi-file bundles so relative imports are
|
|
47
|
+
* verified too. When present with `DROP_PLUGIN_SIGNING_KEY`, `signature`
|
|
48
|
+
* covers the aggregate bundle digest rather than only the entry file.
|
|
49
|
+
*/
|
|
50
|
+
files?: Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* HMAC-SHA256 (hex) of `checksum`, keyed by `DROP_PLUGIN_SIGNING_KEY`.
|
|
53
|
+
* Set `DROP_PLUGIN_REQUIRE_SIGNATURE=true` to reject unsigned bundles.
|
|
54
|
+
*/
|
|
55
|
+
signature?: string;
|
|
56
|
+
server?: {
|
|
57
|
+
entry: string;
|
|
58
|
+
capabilities: ServerCapability[];
|
|
59
|
+
storageVersion?: number;
|
|
60
|
+
};
|
|
61
|
+
client?: {
|
|
62
|
+
entry: string;
|
|
63
|
+
css?: string;
|
|
64
|
+
capabilities: ClientCapability[];
|
|
65
|
+
slots?: Array<{
|
|
66
|
+
slot: UISlotName;
|
|
67
|
+
component: string;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export type PluginManifestV2 = PluginManifest;
|
|
72
|
+
export interface PluginStateRecord {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
updatedAt: number;
|
|
75
|
+
}
|
|
76
|
+
export interface RouteHandlerContext {
|
|
77
|
+
params: Record<string, string>;
|
|
78
|
+
query: Record<string, string | string[] | undefined>;
|
|
79
|
+
userId?: string;
|
|
80
|
+
userAcls?: string[];
|
|
81
|
+
}
|
|
82
|
+
export type RouteHandler = (event: any, context: RouteHandlerContext) => unknown | Promise<unknown>;
|
|
83
|
+
export interface PluginStorage {
|
|
84
|
+
get<T>(key: string): Promise<T | null>;
|
|
85
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
86
|
+
delete(key: string): Promise<void>;
|
|
87
|
+
listKeys(): Promise<string[]>;
|
|
88
|
+
/** Declared/recorded schema version for `migrateStorage`. */
|
|
89
|
+
getSchemaVersion(): Promise<number>;
|
|
90
|
+
setSchemaVersion(version: number): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
export interface ClientPluginStorage {
|
|
93
|
+
get<T>(key: string): Promise<T | null>;
|
|
94
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
95
|
+
delete(key: string): Promise<void>;
|
|
96
|
+
listKeys(): Promise<string[]>;
|
|
97
|
+
}
|
|
98
|
+
/** Caller identity + reply sink for a plugin WebSocket message. */
|
|
99
|
+
export interface WebSocketContext {
|
|
100
|
+
userId?: string;
|
|
101
|
+
userAcls?: string[];
|
|
102
|
+
send: (data: unknown) => void;
|
|
103
|
+
}
|
|
104
|
+
/** Caller identity available when authorizing a channel subscription. */
|
|
105
|
+
export interface SubscriptionContext {
|
|
106
|
+
userId: string | undefined;
|
|
107
|
+
userAcls: string[] | undefined;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Authorize a client subscription to a channel. Returning `false` denies the
|
|
111
|
+
* subscription; a channel with no matching authorizer is allowed (subject to
|
|
112
|
+
* the gateway's authentication requirement).
|
|
113
|
+
*/
|
|
114
|
+
export type SubscriptionAuthorizer = (channel: string, context: SubscriptionContext) => Promise<boolean> | boolean;
|
|
115
|
+
export type WebSocketHandler = (message: unknown, context: WebSocketContext) => Promise<void> | void;
|
|
116
|
+
export interface PluginLogger {
|
|
117
|
+
info(msg: string, ...args: any[]): void;
|
|
118
|
+
warn(msg: string, ...args: any[]): void;
|
|
119
|
+
error(msg: string, ...args: any[]): void;
|
|
120
|
+
debug(msg: string, ...args: any[]): void;
|
|
121
|
+
}
|
|
122
|
+
export interface PluginContext {
|
|
123
|
+
id: string;
|
|
124
|
+
logger: PluginLogger;
|
|
125
|
+
storage: PluginStorage;
|
|
126
|
+
registerRoute(method: HttpMethod, pattern: string, handler: RouteHandler): void;
|
|
127
|
+
broadcast(channel: string, event: unknown): void;
|
|
128
|
+
subscribe(channel: string, listener: (event: unknown) => void): () => void;
|
|
129
|
+
/**
|
|
130
|
+
* Handle client messages on a WebSocket channel. Requires the `websocket`
|
|
131
|
+
* capability. Channel names are global; a channel may only be claimed once.
|
|
132
|
+
*/
|
|
133
|
+
registerWebSocket(channel: string, handler: WebSocketHandler): void;
|
|
134
|
+
/**
|
|
135
|
+
* Gate client subscriptions to channels matching `matches`. Requires the
|
|
136
|
+
* `websocket` capability. Channels with no matching authorizer stay open to
|
|
137
|
+
* authenticated peers.
|
|
138
|
+
*/
|
|
139
|
+
registerSubscriptionAuthorizer(matches: (channel: string) => boolean, authorize: SubscriptionAuthorizer): void;
|
|
140
|
+
/** Network egress. Requires the `network` capability. */
|
|
141
|
+
fetch(input: string | URL, init?: RequestInit): Promise<Response>;
|
|
142
|
+
}
|
|
143
|
+
export interface ServerPlugin {
|
|
144
|
+
metadata: PluginMetadata;
|
|
145
|
+
init(ctx: PluginContext): Promise<void> | void;
|
|
146
|
+
teardown?(): Promise<void> | void;
|
|
147
|
+
/**
|
|
148
|
+
* Apply storage migrations when the recorded schema version is older than
|
|
149
|
+
* `metadata.storageVersion`. `from` is exclusive, `to` inclusive.
|
|
150
|
+
*/
|
|
151
|
+
migrateStorage?(from: number, to: number, storage: PluginStorage): Promise<void>;
|
|
152
|
+
}
|
|
153
|
+
export type UISlotName = "game-detail:actions" | "game-detail:panels" | "game-detail:badges" | "settings:tabs" | "topbar:status" | "sidebar:nav";
|
|
154
|
+
export interface UISlotRegistration {
|
|
155
|
+
slot: UISlotName;
|
|
156
|
+
component: unknown;
|
|
157
|
+
order?: number;
|
|
158
|
+
label?: string;
|
|
159
|
+
icon?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Playnite-inspired Play Action.
|
|
163
|
+
* Injected dynamically by plugins to offer alternative game startup modes
|
|
164
|
+
* (e.g. "Play Multiplayer", "Play Offline", "Launch with Reshade").
|
|
165
|
+
*/
|
|
166
|
+
export interface PlayAction {
|
|
167
|
+
id: string;
|
|
168
|
+
name: string;
|
|
169
|
+
icon?: string;
|
|
170
|
+
isDefault?: boolean;
|
|
171
|
+
execute: (context: LaunchContext) => Promise<void> | void;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Playnite-inspired Game Context Menu Item.
|
|
175
|
+
* Injected into right-click menus on game items across the library.
|
|
176
|
+
*/
|
|
177
|
+
export interface GameMenuItem {
|
|
178
|
+
id: string;
|
|
179
|
+
label: string;
|
|
180
|
+
icon?: string;
|
|
181
|
+
execute: (gameId: string) => Promise<void> | void;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Playnite-inspired Sidebar Item with optional real-time progress.
|
|
185
|
+
*/
|
|
186
|
+
export interface SidebarItem {
|
|
187
|
+
id: string;
|
|
188
|
+
title: string;
|
|
189
|
+
icon?: string;
|
|
190
|
+
type: "button" | "view";
|
|
191
|
+
progressValue?: number;
|
|
192
|
+
activated?: () => void;
|
|
193
|
+
component?: unknown;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Playnite-inspired Top Bar Status Item.
|
|
197
|
+
*/
|
|
198
|
+
export interface TopBarItem {
|
|
199
|
+
id: string;
|
|
200
|
+
title: string;
|
|
201
|
+
icon?: string;
|
|
202
|
+
component?: unknown;
|
|
203
|
+
activated?: () => void;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Stages in the game launch pipeline.
|
|
207
|
+
* Pre-launch stages are cancelable with automatic reverse rollback.
|
|
208
|
+
*/
|
|
209
|
+
export type LaunchStage = "pre-launch:validate" | "pre-launch:prepare" | "pre-launch:stage" | "pre-launch:network" | "launch" | "post-exit:cleanup" | "post-exit:restore" | "post-exit:sync";
|
|
210
|
+
export interface LaunchContext {
|
|
211
|
+
gameId: string;
|
|
212
|
+
gameTitle: string;
|
|
213
|
+
gameDir: string;
|
|
214
|
+
actionId?: string;
|
|
215
|
+
metadata?: Record<string, unknown>;
|
|
216
|
+
}
|
|
217
|
+
export interface LaunchHook {
|
|
218
|
+
stage: LaunchStage;
|
|
219
|
+
order?: number;
|
|
220
|
+
execute: (ctx: LaunchContext) => Promise<void> | void;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Scoped filesystem access strictly confined to the active game directory.
|
|
224
|
+
* Path traversal (`..`) and symlink escapes outside the target root are rejected.
|
|
225
|
+
*/
|
|
226
|
+
export interface ScopedGameFs {
|
|
227
|
+
readFile(gameId: string, relativePath: string): Promise<Uint8Array>;
|
|
228
|
+
writeFile(gameId: string, relativePath: string, data: Uint8Array | string): Promise<void>;
|
|
229
|
+
backupFile(gameId: string, relativePath: string): Promise<string>;
|
|
230
|
+
restoreFile(gameId: string, relativePath: string): Promise<void>;
|
|
231
|
+
fileExists(gameId: string, relativePath: string): Promise<boolean>;
|
|
232
|
+
deleteFile(gameId: string, relativePath: string): Promise<void>;
|
|
233
|
+
}
|
|
234
|
+
export interface AntiCheatReport {
|
|
235
|
+
detected: boolean;
|
|
236
|
+
reason?: string;
|
|
237
|
+
binaries?: string[];
|
|
238
|
+
}
|
|
239
|
+
export interface ScopedGameScanner {
|
|
240
|
+
scanExecutables(gameId: string): Promise<Array<{
|
|
241
|
+
relativePath: string;
|
|
242
|
+
sha256: string;
|
|
243
|
+
size: number;
|
|
244
|
+
}>>;
|
|
245
|
+
checkAntiCheat(gameId: string): Promise<AntiCheatReport>;
|
|
246
|
+
}
|
|
247
|
+
export interface ClientPluginWebSocket {
|
|
248
|
+
send(channel: string, data: unknown): Promise<unknown>;
|
|
249
|
+
subscribe(channel: string, listener: (data: unknown) => void): () => void;
|
|
250
|
+
}
|
|
251
|
+
export interface ClientPluginContext {
|
|
252
|
+
id: string;
|
|
253
|
+
logger: PluginLogger;
|
|
254
|
+
storage: ClientPluginStorage;
|
|
255
|
+
registerSlot(slot: UISlotName, component: unknown, options?: {
|
|
256
|
+
order?: number;
|
|
257
|
+
label?: string;
|
|
258
|
+
icon?: string;
|
|
259
|
+
}): void;
|
|
260
|
+
registerPlayAction(provider: (gameId: string) => Promise<PlayAction[]> | PlayAction[]): () => void;
|
|
261
|
+
registerGameMenuItem(item: GameMenuItem): () => void;
|
|
262
|
+
registerSidebarItem(item: SidebarItem): () => void;
|
|
263
|
+
registerTopBarItem(item: TopBarItem): () => void;
|
|
264
|
+
registerLaunchHook(hook: LaunchHook): () => void;
|
|
265
|
+
gameFs: ScopedGameFs;
|
|
266
|
+
gameScanner: ScopedGameScanner;
|
|
267
|
+
serverWs: ClientPluginWebSocket;
|
|
268
|
+
}
|
|
269
|
+
export interface ClientPlugin {
|
|
270
|
+
metadata?: PluginMetadata;
|
|
271
|
+
init(ctx: ClientPluginContext): Promise<void> | void;
|
|
272
|
+
teardown?(): Promise<void> | void;
|
|
273
|
+
}
|
|
274
|
+
export interface FullstackPlugin {
|
|
275
|
+
server?: ServerPlugin;
|
|
276
|
+
client?: ClientPlugin;
|
|
277
|
+
}
|
|
278
|
+
export interface MetadataPlugin extends ClientPlugin {
|
|
279
|
+
getGameMetadata?(gameId: string, fingerprint: string): Promise<Record<string, unknown> | null>;
|
|
280
|
+
}
|
|
281
|
+
export interface StoragePlugin extends ClientPlugin {
|
|
282
|
+
getDepotStatus?(depotId: string): Promise<Record<string, unknown> | null>;
|
|
283
|
+
}
|
|
284
|
+
export interface MultiplayerPlugin extends ClientPlugin {
|
|
285
|
+
getActiveRoom?(gameId: string): Promise<Record<string, unknown> | null>;
|
|
286
|
+
}
|
|
287
|
+
export interface GenericPlugin extends ClientPlugin {
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE7E,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,gBAAgB,GAChB,iBAAiB,GACjB,YAAY,GACZ,WAAW,GACX,kBAAkB,GAClB,SAAS,GACT,WAAW,GACX,gBAAgB,GAChB,WAAW,GACX,gBAAgB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,C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iBAAiB,CAAC;IAC/B,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,IAAI,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAGD,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,eAAe,CAAC,CACd,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,cAAc,CAAC,CACb,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,aAAa,CAAC,CACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;CAAG"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current plugin API version. Bump this when `PluginContext` or the manifest
|
|
3
|
+
* contract changes incompatibly. Plugins declare the version they were built
|
|
4
|
+
* against in `metadata.apiVersion`; mismatches are rejected at registration.
|
|
5
|
+
*/
|
|
6
|
+
export const PLUGIN_API_VERSION = 2;
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@droposs/plugin-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Drop Plugin SDK contract, types, and mock testing harness for Drop OSS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Heretek-Games/drop-plugin-sdk.git",
|
|
23
|
+
"directory": "packages/plugin-sdk"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/Heretek-Games/drop-plugin-sdk#readme",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Heretek-Games/drop-plugin-sdk/issues"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"drop",
|
|
31
|
+
"drop-oss",
|
|
32
|
+
"droposs",
|
|
33
|
+
"drop-plugin",
|
|
34
|
+
"plugin-sdk",
|
|
35
|
+
"extensibility",
|
|
36
|
+
"gaming",
|
|
37
|
+
"playnite"
|
|
38
|
+
],
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.7.0",
|
|
41
|
+
"@types/node": "^22.0.0"
|
|
42
|
+
},
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc",
|
|
46
|
+
"test": "node --test"
|
|
47
|
+
}
|
|
48
|
+
}
|