@edhspace/api 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +43 -2
- package/dist/chunk-4STXB3BK.js +160 -0
- package/dist/chunk-F72S63D3.cjs +160 -0
- package/dist/chunk-HL56LR6P.cjs +311 -0
- package/dist/chunk-LBLXK5J2.js +311 -0
- package/dist/client-CSAi6AFj.d.ts +136 -0
- package/dist/client-DKX6ZfiJ.d.cts +136 -0
- package/dist/contracts-r8d4RACz.d.cts +474 -0
- package/dist/contracts-r8d4RACz.d.ts +474 -0
- package/dist/host.cjs +356 -0
- package/dist/host.d.cts +57 -0
- package/dist/host.d.ts +57 -0
- package/dist/host.js +356 -0
- package/dist/index.cjs +85 -0
- package/dist/index.d.cts +148 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +85 -0
- package/dist/math.cjs +107 -0
- package/dist/math.d.cts +70 -0
- package/dist/math.d.ts +70 -0
- package/dist/math.js +107 -0
- package/dist/react.cjs +69 -0
- package/dist/react.d.cts +177 -0
- package/dist/react.d.ts +177 -0
- package/dist/react.js +69 -0
- package/dist/sideload.cjs +213 -0
- package/dist/sideload.d.cts +290 -0
- package/dist/sideload.d.ts +290 -0
- package/dist/sideload.js +213 -0
- package/package.json +81 -5
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { D as DeckOperation, o as NetworkRequest, a as ExtensionArguments } from './contracts-r8d4RACz.cjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const sideloadProtocol: "edhspace-sideload";
|
|
5
|
+
declare const sideloadVersion: 1;
|
|
6
|
+
declare const maxSideloadBytes: number;
|
|
7
|
+
declare const sideloadPanelSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
javascript: z.ZodString;
|
|
10
|
+
css: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
declare const sideloadBundleSchema: z.ZodObject<{
|
|
13
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
14
|
+
version: z.ZodLiteral<1>;
|
|
15
|
+
manifest: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
apiVersion: z.ZodLiteral<1>;
|
|
18
|
+
version: z.ZodString;
|
|
19
|
+
title: z.ZodString;
|
|
20
|
+
description: z.ZodString;
|
|
21
|
+
author: z.ZodString;
|
|
22
|
+
permissions: z.ZodArray<z.ZodEnum<{
|
|
23
|
+
"deck.read": "deck.read";
|
|
24
|
+
"selection.read": "selection.read";
|
|
25
|
+
"deck.propose": "deck.propose";
|
|
26
|
+
"cards.inspect": "cards.inspect";
|
|
27
|
+
"cards.search": "cards.search";
|
|
28
|
+
"workspace.open": "workspace.open";
|
|
29
|
+
"notifications.show": "notifications.show";
|
|
30
|
+
"storage.read": "storage.read";
|
|
31
|
+
"storage.write": "storage.write";
|
|
32
|
+
"preferences.read": "preferences.read";
|
|
33
|
+
"preferences.write": "preferences.write";
|
|
34
|
+
"network.request": "network.request";
|
|
35
|
+
}>>;
|
|
36
|
+
panels: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
location: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
workspace: "workspace";
|
|
41
|
+
sidebar: "sidebar";
|
|
42
|
+
}>>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
title: z.ZodString;
|
|
47
|
+
}, z.core.$strict>>>;
|
|
48
|
+
preferences: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
title: z.ZodString;
|
|
51
|
+
description: z.ZodOptional<z.ZodString>;
|
|
52
|
+
type: z.ZodLiteral<"text">;
|
|
53
|
+
default: z.ZodString;
|
|
54
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
title: z.ZodString;
|
|
57
|
+
description: z.ZodOptional<z.ZodString>;
|
|
58
|
+
type: z.ZodLiteral<"boolean">;
|
|
59
|
+
default: z.ZodBoolean;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
title: z.ZodString;
|
|
63
|
+
description: z.ZodOptional<z.ZodString>;
|
|
64
|
+
type: z.ZodLiteral<"number">;
|
|
65
|
+
default: z.ZodNumber;
|
|
66
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
title: z.ZodString;
|
|
69
|
+
description: z.ZodOptional<z.ZodString>;
|
|
70
|
+
type: z.ZodLiteral<"select">;
|
|
71
|
+
default: z.ZodString;
|
|
72
|
+
options: z.ZodArray<z.ZodObject<{
|
|
73
|
+
value: z.ZodString;
|
|
74
|
+
label: z.ZodString;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
}, z.core.$strict>], "type">>>;
|
|
77
|
+
network: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
title: z.ZodString;
|
|
80
|
+
url: z.ZodString;
|
|
81
|
+
methods: z.ZodArray<z.ZodEnum<{
|
|
82
|
+
GET: "GET";
|
|
83
|
+
POST: "POST";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strict>>>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
panels: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
javascript: z.ZodString;
|
|
90
|
+
css: z.ZodString;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
type SideloadBundle = z.infer<typeof sideloadBundleSchema>;
|
|
94
|
+
type SideloadPanel = z.infer<typeof sideloadPanelSchema>;
|
|
95
|
+
declare const sideloadReadySchema: z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"ready">;
|
|
97
|
+
panelId: z.ZodString;
|
|
98
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
99
|
+
version: z.ZodLiteral<1>;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
declare const sideloadInitSchema: z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"init">;
|
|
103
|
+
sessionId: z.ZodUUID;
|
|
104
|
+
permissions: z.ZodArray<z.ZodEnum<{
|
|
105
|
+
"deck.read": "deck.read";
|
|
106
|
+
"selection.read": "selection.read";
|
|
107
|
+
"deck.propose": "deck.propose";
|
|
108
|
+
"cards.inspect": "cards.inspect";
|
|
109
|
+
"cards.search": "cards.search";
|
|
110
|
+
"workspace.open": "workspace.open";
|
|
111
|
+
"notifications.show": "notifications.show";
|
|
112
|
+
"storage.read": "storage.read";
|
|
113
|
+
"storage.write": "storage.write";
|
|
114
|
+
"preferences.read": "preferences.read";
|
|
115
|
+
"preferences.write": "preferences.write";
|
|
116
|
+
"network.request": "network.request";
|
|
117
|
+
}>>;
|
|
118
|
+
revision: z.ZodString;
|
|
119
|
+
theme: z.ZodEnum<{
|
|
120
|
+
light: "light";
|
|
121
|
+
dark: "dark";
|
|
122
|
+
}>;
|
|
123
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
124
|
+
version: z.ZodLiteral<1>;
|
|
125
|
+
}, z.core.$strict>;
|
|
126
|
+
declare const sideloadStateSchema: z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"state">;
|
|
128
|
+
revision: z.ZodString;
|
|
129
|
+
theme: z.ZodEnum<{
|
|
130
|
+
light: "light";
|
|
131
|
+
dark: "dark";
|
|
132
|
+
}>;
|
|
133
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
134
|
+
version: z.ZodLiteral<1>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
declare const sideloadRevokeSchema: z.ZodObject<{
|
|
137
|
+
type: z.ZodLiteral<"revoke">;
|
|
138
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
139
|
+
version: z.ZodLiteral<1>;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
declare const sideloadErrorSchema: z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"error">;
|
|
143
|
+
message: z.ZodString;
|
|
144
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
145
|
+
version: z.ZodLiteral<1>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
type SideloadInit = z.infer<typeof sideloadInitSchema>;
|
|
148
|
+
type SideloadState = Pick<SideloadInit, "revision" | "theme"> & {
|
|
149
|
+
error?: Error;
|
|
150
|
+
};
|
|
151
|
+
declare function createSideloadConnection(port: MessagePort, raw: unknown): {
|
|
152
|
+
api: {
|
|
153
|
+
permissions: readonly ("deck.read" | "selection.read" | "deck.propose" | "cards.inspect" | "cards.search" | "workspace.open" | "notifications.show" | "storage.read" | "storage.write" | "preferences.read" | "preferences.write" | "network.request")[];
|
|
154
|
+
deck: {
|
|
155
|
+
read: () => Promise<{
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
format: string;
|
|
159
|
+
revision: string;
|
|
160
|
+
cards: {
|
|
161
|
+
id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
quantity: number;
|
|
164
|
+
manaCost?: string | undefined;
|
|
165
|
+
manaValue?: number | undefined;
|
|
166
|
+
typeLine?: string | undefined;
|
|
167
|
+
commander?: boolean | undefined;
|
|
168
|
+
}[];
|
|
169
|
+
}>;
|
|
170
|
+
propose: (operations: DeckOperation[]) => Promise<{
|
|
171
|
+
id: string;
|
|
172
|
+
status: "pending" | "dismissed";
|
|
173
|
+
revision?: string | undefined;
|
|
174
|
+
undoId?: string | undefined;
|
|
175
|
+
} | {
|
|
176
|
+
id: string;
|
|
177
|
+
status: "applied";
|
|
178
|
+
revision: string;
|
|
179
|
+
undoId: string;
|
|
180
|
+
}>;
|
|
181
|
+
addCard: (cardId: string, category: string, quantity?: number) => Promise<{
|
|
182
|
+
id: string;
|
|
183
|
+
status: "pending" | "dismissed";
|
|
184
|
+
revision?: string | undefined;
|
|
185
|
+
undoId?: string | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
id: string;
|
|
188
|
+
status: "applied";
|
|
189
|
+
revision: string;
|
|
190
|
+
undoId: string;
|
|
191
|
+
}>;
|
|
192
|
+
removeCard: (cardId: string, quantity?: number) => Promise<{
|
|
193
|
+
id: string;
|
|
194
|
+
status: "pending" | "dismissed";
|
|
195
|
+
revision?: string | undefined;
|
|
196
|
+
undoId?: string | undefined;
|
|
197
|
+
} | {
|
|
198
|
+
id: string;
|
|
199
|
+
status: "applied";
|
|
200
|
+
revision: string;
|
|
201
|
+
undoId: string;
|
|
202
|
+
}>;
|
|
203
|
+
applyTags: (cardIds: string[], tags: string[]) => Promise<{
|
|
204
|
+
id: string;
|
|
205
|
+
status: "pending" | "dismissed";
|
|
206
|
+
revision?: string | undefined;
|
|
207
|
+
undoId?: string | undefined;
|
|
208
|
+
} | {
|
|
209
|
+
id: string;
|
|
210
|
+
status: "applied";
|
|
211
|
+
revision: string;
|
|
212
|
+
undoId: string;
|
|
213
|
+
}>;
|
|
214
|
+
};
|
|
215
|
+
selection: {
|
|
216
|
+
read: () => Promise<{
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
quantity: number;
|
|
220
|
+
manaCost?: string | undefined;
|
|
221
|
+
manaValue?: number | undefined;
|
|
222
|
+
typeLine?: string | undefined;
|
|
223
|
+
commander?: boolean | undefined;
|
|
224
|
+
}[]>;
|
|
225
|
+
};
|
|
226
|
+
network: {
|
|
227
|
+
request: (request: NetworkRequest) => Promise<{
|
|
228
|
+
status: number;
|
|
229
|
+
data: z.core.util.JSONType;
|
|
230
|
+
}>;
|
|
231
|
+
};
|
|
232
|
+
cards: {
|
|
233
|
+
inspect: (cardId: string) => Promise<{
|
|
234
|
+
opened: true;
|
|
235
|
+
}>;
|
|
236
|
+
search: (query: string, page?: number) => Promise<{
|
|
237
|
+
cards: {
|
|
238
|
+
id: string;
|
|
239
|
+
name: string;
|
|
240
|
+
quantity: number;
|
|
241
|
+
manaCost?: string | undefined;
|
|
242
|
+
manaValue?: number | undefined;
|
|
243
|
+
typeLine?: string | undefined;
|
|
244
|
+
commander?: boolean | undefined;
|
|
245
|
+
}[];
|
|
246
|
+
nextPage?: number | undefined;
|
|
247
|
+
}>;
|
|
248
|
+
getByName: (name: string) => Promise<{
|
|
249
|
+
id: string;
|
|
250
|
+
name: string;
|
|
251
|
+
quantity: number;
|
|
252
|
+
manaCost?: string | undefined;
|
|
253
|
+
manaValue?: number | undefined;
|
|
254
|
+
typeLine?: string | undefined;
|
|
255
|
+
commander?: boolean | undefined;
|
|
256
|
+
} | null>;
|
|
257
|
+
};
|
|
258
|
+
workspace: {
|
|
259
|
+
openPanel: (panelId: string, location?: "workspace" | "sidebar") => Promise<{
|
|
260
|
+
panelId: string;
|
|
261
|
+
}>;
|
|
262
|
+
};
|
|
263
|
+
notifications: {
|
|
264
|
+
show: (message: string, kind?: "info" | "success" | "error") => Promise<{
|
|
265
|
+
shown: true;
|
|
266
|
+
}>;
|
|
267
|
+
};
|
|
268
|
+
storage: {
|
|
269
|
+
get: (key: string) => Promise<z.core.util.JSONType>;
|
|
270
|
+
set: (key: string, value: ExtensionArguments["storage.set"]["value"]) => Promise<{
|
|
271
|
+
saved: true;
|
|
272
|
+
}>;
|
|
273
|
+
};
|
|
274
|
+
preferences: {
|
|
275
|
+
get: () => Promise<Record<string, z.core.util.JSONType>>;
|
|
276
|
+
set: (key: string, value: ExtensionArguments["preferences.set"]["value"]) => Promise<{
|
|
277
|
+
saved: true;
|
|
278
|
+
}>;
|
|
279
|
+
};
|
|
280
|
+
dispose: () => void;
|
|
281
|
+
};
|
|
282
|
+
getSnapshot: () => SideloadState;
|
|
283
|
+
subscribe: (listener: () => void) => () => void;
|
|
284
|
+
dispose: () => void;
|
|
285
|
+
};
|
|
286
|
+
type SideloadConnection = ReturnType<typeof createSideloadConnection>;
|
|
287
|
+
declare function connectSideload(panel: string, timeoutMs?: number): Promise<SideloadConnection>;
|
|
288
|
+
declare function createSideloadDocument(raw: SideloadPanel): string;
|
|
289
|
+
|
|
290
|
+
export { type SideloadBundle, type SideloadConnection, type SideloadInit, type SideloadPanel, type SideloadState, connectSideload, createSideloadConnection, createSideloadDocument, maxSideloadBytes, sideloadBundleSchema, sideloadErrorSchema, sideloadInitSchema, sideloadPanelSchema, sideloadProtocol, sideloadReadySchema, sideloadRevokeSchema, sideloadStateSchema, sideloadVersion };
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { D as DeckOperation, o as NetworkRequest, a as ExtensionArguments } from './contracts-r8d4RACz.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const sideloadProtocol: "edhspace-sideload";
|
|
5
|
+
declare const sideloadVersion: 1;
|
|
6
|
+
declare const maxSideloadBytes: number;
|
|
7
|
+
declare const sideloadPanelSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
javascript: z.ZodString;
|
|
10
|
+
css: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
declare const sideloadBundleSchema: z.ZodObject<{
|
|
13
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
14
|
+
version: z.ZodLiteral<1>;
|
|
15
|
+
manifest: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
apiVersion: z.ZodLiteral<1>;
|
|
18
|
+
version: z.ZodString;
|
|
19
|
+
title: z.ZodString;
|
|
20
|
+
description: z.ZodString;
|
|
21
|
+
author: z.ZodString;
|
|
22
|
+
permissions: z.ZodArray<z.ZodEnum<{
|
|
23
|
+
"deck.read": "deck.read";
|
|
24
|
+
"selection.read": "selection.read";
|
|
25
|
+
"deck.propose": "deck.propose";
|
|
26
|
+
"cards.inspect": "cards.inspect";
|
|
27
|
+
"cards.search": "cards.search";
|
|
28
|
+
"workspace.open": "workspace.open";
|
|
29
|
+
"notifications.show": "notifications.show";
|
|
30
|
+
"storage.read": "storage.read";
|
|
31
|
+
"storage.write": "storage.write";
|
|
32
|
+
"preferences.read": "preferences.read";
|
|
33
|
+
"preferences.write": "preferences.write";
|
|
34
|
+
"network.request": "network.request";
|
|
35
|
+
}>>;
|
|
36
|
+
panels: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
location: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
workspace: "workspace";
|
|
41
|
+
sidebar: "sidebar";
|
|
42
|
+
}>>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
title: z.ZodString;
|
|
47
|
+
}, z.core.$strict>>>;
|
|
48
|
+
preferences: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
title: z.ZodString;
|
|
51
|
+
description: z.ZodOptional<z.ZodString>;
|
|
52
|
+
type: z.ZodLiteral<"text">;
|
|
53
|
+
default: z.ZodString;
|
|
54
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
title: z.ZodString;
|
|
57
|
+
description: z.ZodOptional<z.ZodString>;
|
|
58
|
+
type: z.ZodLiteral<"boolean">;
|
|
59
|
+
default: z.ZodBoolean;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
title: z.ZodString;
|
|
63
|
+
description: z.ZodOptional<z.ZodString>;
|
|
64
|
+
type: z.ZodLiteral<"number">;
|
|
65
|
+
default: z.ZodNumber;
|
|
66
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
title: z.ZodString;
|
|
69
|
+
description: z.ZodOptional<z.ZodString>;
|
|
70
|
+
type: z.ZodLiteral<"select">;
|
|
71
|
+
default: z.ZodString;
|
|
72
|
+
options: z.ZodArray<z.ZodObject<{
|
|
73
|
+
value: z.ZodString;
|
|
74
|
+
label: z.ZodString;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
}, z.core.$strict>], "type">>>;
|
|
77
|
+
network: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
title: z.ZodString;
|
|
80
|
+
url: z.ZodString;
|
|
81
|
+
methods: z.ZodArray<z.ZodEnum<{
|
|
82
|
+
GET: "GET";
|
|
83
|
+
POST: "POST";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strict>>>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
panels: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
javascript: z.ZodString;
|
|
90
|
+
css: z.ZodString;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
type SideloadBundle = z.infer<typeof sideloadBundleSchema>;
|
|
94
|
+
type SideloadPanel = z.infer<typeof sideloadPanelSchema>;
|
|
95
|
+
declare const sideloadReadySchema: z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"ready">;
|
|
97
|
+
panelId: z.ZodString;
|
|
98
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
99
|
+
version: z.ZodLiteral<1>;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
declare const sideloadInitSchema: z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"init">;
|
|
103
|
+
sessionId: z.ZodUUID;
|
|
104
|
+
permissions: z.ZodArray<z.ZodEnum<{
|
|
105
|
+
"deck.read": "deck.read";
|
|
106
|
+
"selection.read": "selection.read";
|
|
107
|
+
"deck.propose": "deck.propose";
|
|
108
|
+
"cards.inspect": "cards.inspect";
|
|
109
|
+
"cards.search": "cards.search";
|
|
110
|
+
"workspace.open": "workspace.open";
|
|
111
|
+
"notifications.show": "notifications.show";
|
|
112
|
+
"storage.read": "storage.read";
|
|
113
|
+
"storage.write": "storage.write";
|
|
114
|
+
"preferences.read": "preferences.read";
|
|
115
|
+
"preferences.write": "preferences.write";
|
|
116
|
+
"network.request": "network.request";
|
|
117
|
+
}>>;
|
|
118
|
+
revision: z.ZodString;
|
|
119
|
+
theme: z.ZodEnum<{
|
|
120
|
+
light: "light";
|
|
121
|
+
dark: "dark";
|
|
122
|
+
}>;
|
|
123
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
124
|
+
version: z.ZodLiteral<1>;
|
|
125
|
+
}, z.core.$strict>;
|
|
126
|
+
declare const sideloadStateSchema: z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"state">;
|
|
128
|
+
revision: z.ZodString;
|
|
129
|
+
theme: z.ZodEnum<{
|
|
130
|
+
light: "light";
|
|
131
|
+
dark: "dark";
|
|
132
|
+
}>;
|
|
133
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
134
|
+
version: z.ZodLiteral<1>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
declare const sideloadRevokeSchema: z.ZodObject<{
|
|
137
|
+
type: z.ZodLiteral<"revoke">;
|
|
138
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
139
|
+
version: z.ZodLiteral<1>;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
declare const sideloadErrorSchema: z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"error">;
|
|
143
|
+
message: z.ZodString;
|
|
144
|
+
protocol: z.ZodLiteral<"edhspace-sideload">;
|
|
145
|
+
version: z.ZodLiteral<1>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
type SideloadInit = z.infer<typeof sideloadInitSchema>;
|
|
148
|
+
type SideloadState = Pick<SideloadInit, "revision" | "theme"> & {
|
|
149
|
+
error?: Error;
|
|
150
|
+
};
|
|
151
|
+
declare function createSideloadConnection(port: MessagePort, raw: unknown): {
|
|
152
|
+
api: {
|
|
153
|
+
permissions: readonly ("deck.read" | "selection.read" | "deck.propose" | "cards.inspect" | "cards.search" | "workspace.open" | "notifications.show" | "storage.read" | "storage.write" | "preferences.read" | "preferences.write" | "network.request")[];
|
|
154
|
+
deck: {
|
|
155
|
+
read: () => Promise<{
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
format: string;
|
|
159
|
+
revision: string;
|
|
160
|
+
cards: {
|
|
161
|
+
id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
quantity: number;
|
|
164
|
+
manaCost?: string | undefined;
|
|
165
|
+
manaValue?: number | undefined;
|
|
166
|
+
typeLine?: string | undefined;
|
|
167
|
+
commander?: boolean | undefined;
|
|
168
|
+
}[];
|
|
169
|
+
}>;
|
|
170
|
+
propose: (operations: DeckOperation[]) => Promise<{
|
|
171
|
+
id: string;
|
|
172
|
+
status: "pending" | "dismissed";
|
|
173
|
+
revision?: string | undefined;
|
|
174
|
+
undoId?: string | undefined;
|
|
175
|
+
} | {
|
|
176
|
+
id: string;
|
|
177
|
+
status: "applied";
|
|
178
|
+
revision: string;
|
|
179
|
+
undoId: string;
|
|
180
|
+
}>;
|
|
181
|
+
addCard: (cardId: string, category: string, quantity?: number) => Promise<{
|
|
182
|
+
id: string;
|
|
183
|
+
status: "pending" | "dismissed";
|
|
184
|
+
revision?: string | undefined;
|
|
185
|
+
undoId?: string | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
id: string;
|
|
188
|
+
status: "applied";
|
|
189
|
+
revision: string;
|
|
190
|
+
undoId: string;
|
|
191
|
+
}>;
|
|
192
|
+
removeCard: (cardId: string, quantity?: number) => Promise<{
|
|
193
|
+
id: string;
|
|
194
|
+
status: "pending" | "dismissed";
|
|
195
|
+
revision?: string | undefined;
|
|
196
|
+
undoId?: string | undefined;
|
|
197
|
+
} | {
|
|
198
|
+
id: string;
|
|
199
|
+
status: "applied";
|
|
200
|
+
revision: string;
|
|
201
|
+
undoId: string;
|
|
202
|
+
}>;
|
|
203
|
+
applyTags: (cardIds: string[], tags: string[]) => Promise<{
|
|
204
|
+
id: string;
|
|
205
|
+
status: "pending" | "dismissed";
|
|
206
|
+
revision?: string | undefined;
|
|
207
|
+
undoId?: string | undefined;
|
|
208
|
+
} | {
|
|
209
|
+
id: string;
|
|
210
|
+
status: "applied";
|
|
211
|
+
revision: string;
|
|
212
|
+
undoId: string;
|
|
213
|
+
}>;
|
|
214
|
+
};
|
|
215
|
+
selection: {
|
|
216
|
+
read: () => Promise<{
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
quantity: number;
|
|
220
|
+
manaCost?: string | undefined;
|
|
221
|
+
manaValue?: number | undefined;
|
|
222
|
+
typeLine?: string | undefined;
|
|
223
|
+
commander?: boolean | undefined;
|
|
224
|
+
}[]>;
|
|
225
|
+
};
|
|
226
|
+
network: {
|
|
227
|
+
request: (request: NetworkRequest) => Promise<{
|
|
228
|
+
status: number;
|
|
229
|
+
data: z.core.util.JSONType;
|
|
230
|
+
}>;
|
|
231
|
+
};
|
|
232
|
+
cards: {
|
|
233
|
+
inspect: (cardId: string) => Promise<{
|
|
234
|
+
opened: true;
|
|
235
|
+
}>;
|
|
236
|
+
search: (query: string, page?: number) => Promise<{
|
|
237
|
+
cards: {
|
|
238
|
+
id: string;
|
|
239
|
+
name: string;
|
|
240
|
+
quantity: number;
|
|
241
|
+
manaCost?: string | undefined;
|
|
242
|
+
manaValue?: number | undefined;
|
|
243
|
+
typeLine?: string | undefined;
|
|
244
|
+
commander?: boolean | undefined;
|
|
245
|
+
}[];
|
|
246
|
+
nextPage?: number | undefined;
|
|
247
|
+
}>;
|
|
248
|
+
getByName: (name: string) => Promise<{
|
|
249
|
+
id: string;
|
|
250
|
+
name: string;
|
|
251
|
+
quantity: number;
|
|
252
|
+
manaCost?: string | undefined;
|
|
253
|
+
manaValue?: number | undefined;
|
|
254
|
+
typeLine?: string | undefined;
|
|
255
|
+
commander?: boolean | undefined;
|
|
256
|
+
} | null>;
|
|
257
|
+
};
|
|
258
|
+
workspace: {
|
|
259
|
+
openPanel: (panelId: string, location?: "workspace" | "sidebar") => Promise<{
|
|
260
|
+
panelId: string;
|
|
261
|
+
}>;
|
|
262
|
+
};
|
|
263
|
+
notifications: {
|
|
264
|
+
show: (message: string, kind?: "info" | "success" | "error") => Promise<{
|
|
265
|
+
shown: true;
|
|
266
|
+
}>;
|
|
267
|
+
};
|
|
268
|
+
storage: {
|
|
269
|
+
get: (key: string) => Promise<z.core.util.JSONType>;
|
|
270
|
+
set: (key: string, value: ExtensionArguments["storage.set"]["value"]) => Promise<{
|
|
271
|
+
saved: true;
|
|
272
|
+
}>;
|
|
273
|
+
};
|
|
274
|
+
preferences: {
|
|
275
|
+
get: () => Promise<Record<string, z.core.util.JSONType>>;
|
|
276
|
+
set: (key: string, value: ExtensionArguments["preferences.set"]["value"]) => Promise<{
|
|
277
|
+
saved: true;
|
|
278
|
+
}>;
|
|
279
|
+
};
|
|
280
|
+
dispose: () => void;
|
|
281
|
+
};
|
|
282
|
+
getSnapshot: () => SideloadState;
|
|
283
|
+
subscribe: (listener: () => void) => () => void;
|
|
284
|
+
dispose: () => void;
|
|
285
|
+
};
|
|
286
|
+
type SideloadConnection = ReturnType<typeof createSideloadConnection>;
|
|
287
|
+
declare function connectSideload(panel: string, timeoutMs?: number): Promise<SideloadConnection>;
|
|
288
|
+
declare function createSideloadDocument(raw: SideloadPanel): string;
|
|
289
|
+
|
|
290
|
+
export { type SideloadBundle, type SideloadConnection, type SideloadInit, type SideloadPanel, type SideloadState, connectSideload, createSideloadConnection, createSideloadDocument, maxSideloadBytes, sideloadBundleSchema, sideloadErrorSchema, sideloadInitSchema, sideloadPanelSchema, sideloadProtocol, sideloadReadySchema, sideloadRevokeSchema, sideloadStateSchema, sideloadVersion };
|